yujian
2019-07-16 c04327c1e6271e10c6d4f13ebb53438f6edca50e
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java
@@ -2,18 +2,20 @@
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import org.yeshi.utils.taobao.TbImgUtil;
import com.yeshi.fanli.dto.jd.JDCouponInfo;
import com.yeshi.fanli.dto.jd.JDShopInfo;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
import com.yeshi.fanli.entity.taobao.TaoBaoHongBaoInfo;
import com.yeshi.fanli.entity.taobao.TaoBaoQuanInfo;
import com.yeshi.fanli.util.CommonGoodsUtil;
import com.yeshi.fanli.util.Constant;
@@ -116,11 +118,16 @@
         goodsInfo.setCouponInfo(coupon);
      }
      // 店铺信息
      ShopInfoVO shop = new ShopInfoVO();
      shop.setShopName(goods.getSellerName());
      shop.setId(goods.getSellerId().toString());
      goodsInfo.setShopInfo(shop);
      if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
         // 店铺信息
         if (!StringUtil.isNullOrEmpty(goods.getSellerName()) && goods.getSellerId() != null) {
            ShopInfoVO shop = new ShopInfoVO();
            shop.setShopName(goods.getSellerName());
            shop.setId(goods.getSellerId().toString());
            goodsInfo.setShopInfo(shop);
         }
      }
      return goodsInfo;
   }
@@ -156,8 +163,15 @@
      // 资金信息
      MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
      moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
      moneyInfoVO.setFanliMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, fanLiRate));
      moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, shareRate));
      if (goods.getTkRate() == null) {
         TaoBaoHongBaoInfo taoBaoHongBaoInfo = goods.getTaoBaoHongBaoInfo();
         moneyInfoVO.setFanliMoney("¥"+ taoBaoHongBaoInfo.getHongbao());
         moneyInfoVO.setShareMoney("¥"+ taoBaoHongBaoInfo.getHongbao());
      } else {
         moneyInfoVO.setFanliMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, fanLiRate));
         moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, shareRate));
      }
      goodsInfo.setMoneyInfo(moneyInfoVO);
      TaoBaoQuanInfo taoBaoQuanInfo = goods.getTaoBaoQuanInfo();
@@ -181,21 +195,14 @@
      }
      // 店铺信息
      ShopInfoVO shop = null;
      String shopTitle = goods.getShopTitle();
      Long sellerId = goods.getSellerId();
      if (!StringUtil.isNullOrEmpty(shopTitle)) {
         shop = new ShopInfoVO();
      if (!StringUtil.isNullOrEmpty(shopTitle) && sellerId != null) {
         ShopInfoVO shop = new ShopInfoVO();
         shop.setShopName(shopTitle);
      }
      if (sellerId != null) {
         if (shop == null) {
            shop = new ShopInfoVO();
         }
         shop.setId(goods.getSellerId().toString());
         goodsInfo.setShopInfo(shop);
      }
      goodsInfo.setShopInfo(shop);
      return goodsInfo;
   }
@@ -216,8 +223,24 @@
      goodsInfo.setTitle(goods.getTitle());
      goodsInfo.setSalesType(1); // 默认月销量
      goodsInfo.setZkPrice(goods.getZkPrice());
      goodsInfo.setImgList(goods.getImgList());
      goodsInfo.setState(goods.getState());
      List<String> imgList = goods.getImgList();
      if (imgList != null) {
         goodsInfo.setImgList(imgList);
      } else {
         imgList = new ArrayList<String>();
         imgList.add(goods.getPictUrl());
         goodsInfo.setImgList(imgList);
      }
      Integer state = goods.getState();
      if (state == null) {
         goodsInfo.setState(0);
      } else {
         goodsInfo.setState(state);
      }
      goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getBiz30day()));
      if (!StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
@@ -255,8 +278,14 @@
         coupon.setAmount(goods.getCouponAmount());
         coupon.setLeftCount(goods.getCouponLeftCount());
         coupon.setTotalCount(goods.getCouponTotalCount());
         coupon.setEndTime(goods.getCouponEffectiveEndTime().replace("-", "."));
         coupon.setStartTime(goods.getCouponEffectiveStartTime().replace("-", "."));
         if (goods.getCouponEffectiveEndTime() != null) {
            coupon.setEndTime(goods.getCouponEffectiveEndTime().replace("-", "."));
         }
         if (goods.getCouponEffectiveStartTime() != null) {
            coupon.setStartTime(goods.getCouponEffectiveStartTime().replace("-", "."));
         }
         coupon.setLink(TaoBaoCouponUtil.getCoupleUrl(goods.getCouponActivityId(), pid, goods.getAuctionId() + ""));
         coupon.setStartFee(goods.getCouponStartFee());
@@ -265,10 +294,12 @@
      }
      // 店铺信息
      ShopInfoVO shop = new ShopInfoVO();
      shop.setShopName(goods.getShopTitle());
      shop.setId(goods.getSellerId().toString());
      goodsInfo.setShopInfo(shop);
      if (!StringUtil.isNullOrEmpty(goods.getShopTitle()) && goods.getSellerId() != null) {
         ShopInfoVO shop = new ShopInfoVO();
         shop.setShopName(goods.getShopTitle());
         shop.setId(goods.getSellerId().toString());
         goodsInfo.setShopInfo(shop);
      }
      return goodsInfo;
   }
@@ -357,13 +388,13 @@
      }
      // 店铺信息
      JDShopInfo shopInfo = goods.getShopInfo();
      if (shopInfo != null && !StringUtil.isNullOrEmpty(shopInfo.getShopName())) {
         ShopInfoVO shop = new ShopInfoVO();
         shop.setShopName(shopInfo.getShopName());
         shop.setId(shopInfo.getShopId().toString());
         goodsInfo.setShopInfo(shop);
      }
//      JDShopInfo shopInfo = goods.getShopInfo();
//      if (shopInfo != null && !StringUtil.isNullOrEmpty(shopInfo.getShopName())) {
//         ShopInfoVO shop = new ShopInfoVO();
//         shop.setShopName(shopInfo.getShopName());
//         shop.setId(shopInfo.getShopId().toString());
//         goodsInfo.setShopInfo(shop);
//      }
      return goodsInfo;
   }
@@ -459,16 +490,16 @@
      }
      // 店铺信息
      String mallName = goods.getMallName();
      if (!StringUtil.isMobile(mallName)) {
         ShopInfoVO shop = new ShopInfoVO();
         shop.setShopName(mallName);
         if (goods.getMallId() != null) {
            shop.setId(goods.getMallId().toString());
         }
         goodsInfo.setShopInfo(shop);
      }
//      String mallName = goods.getMallName();
//      if (!StringUtil.isMobile(mallName)) {
//         ShopInfoVO shop = new ShopInfoVO();
//         shop.setShopName(mallName);
//
//         if (goods.getMallId() != null) {
//            shop.setId(goods.getMallId().toString());
//         }
//         goodsInfo.setShopInfo(shop);
//      }
      return goodsInfo;
   }