yujian
2019-09-02 9eeda0d3049b71877c373c04d65533939b5582ef
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java
@@ -93,24 +93,35 @@
            goodsInfo.setBaoyou(true);
         }
         
         List<ClientTextStyleVO> labels = goodsInfo.getLabels();
         // 自营
         String owner = otherDTO.getOwner();
         if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
            List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
            if (labels == null) {
               labels = new ArrayList<ClientTextStyleVO>();
            }
            ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
            textStyleVO.setContent("京东自营");
            textStyleVO.setColor("#E42219");
            labels.add(textStyleVO);
            goodsInfo.setLabels(labels);
         }
         // 拼团价
         JDPingouInfo pinGouInfo = otherDTO.getPinGouInfo();
         if (pinGouInfo != null) {
            goods.setPrice(pinGouInfo.getPingouPrice());
            goodsInfo.setPriceName("拼购价");
            if (labels == null) {
               labels = new ArrayList<ClientTextStyleVO>();
            }
            ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
            textStyleVO.setContent("拼购");
            textStyleVO.setColor("#E42219");
            labels.add(textStyleVO);
         } else {
            goodsInfo.setPriceName("京东价");
         }
         goodsInfo.setLabels(labels);
      } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
         goodsInfo.setSalesType(4); // 总销量
         goodsInfo.setPriceName("拼团价");
@@ -122,7 +133,12 @@
      goodsInfo.setGoodsType(goodsType);
      goodsInfo.setZkPrice(goods.getPrice());
      goodsInfo.setState(goods.getState());
      Integer state = goods.getState();
      if (state == null) {
         goodsInfo.setState(0);
      } else {
         goodsInfo.setState(goods.getState());
      }
      goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getSales()));
      if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
@@ -290,6 +306,7 @@
      goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getBiz30day()));
      //白底图可能有错误  https://img.alicdn.com/bao/uploaded/TB1LVqmVZbpK1RjSZFyXXX_qFXa.png
      if (!StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
         goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrlWhite()));
      } else {
@@ -361,7 +378,7 @@
    * @param fanLiRate 返利比例
    * @return
    */
   public static GoodsDetailVO convertJDGoods(JDGoods goods, String pid, BigDecimal fanLiRate, BigDecimal shareRate) {
   public static GoodsDetailVO convertJDGoods(JDGoods goods, BigDecimal fanLiRate, BigDecimal shareRate) {
      GoodsDetailVO goodsInfo = new GoodsDetailVO();
      goodsInfo.setGoodsType(Constant.SOURCE_TYPE_JD);
      goodsInfo.setGoodsId(goods.getSkuId());
@@ -382,14 +399,6 @@
      }
      goodsInfo.setSalesCount(salesCountMidea);
      JDPingouInfo pinGouInfo = goods.getPinGouInfo();
      if (pinGouInfo != null) {
         goodsInfo.setZkPrice(pinGouInfo.getPingouPrice());
         goodsInfo.setPriceName("拼购价");
      } else {
         goodsInfo.setZkPrice(goods.getPrice());
         goodsInfo.setPriceName("京东价");
      }
      // 资金信息
      MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
@@ -407,7 +416,9 @@
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
         CouponInfoVO coupon = new CouponInfoVO();
         coupon.setAmount(discount);
         coupon.setLink(couponInfo.getLink());
         coupon.setStartFee(couponInfo.getQuota());
         if (couponInfo.getGetStartTime() != null) {
            coupon.setStartTime(sdf.format(new Date(couponInfo.getGetStartTime())));
         }
@@ -415,28 +426,47 @@
         if (couponInfo.getGetEndTime() != null) {
            coupon.setEndTime(sdf.format(new Date(couponInfo.getGetEndTime())));
         }
         coupon.setLink(couponInfo.getLink());
         coupon.setStartFee(couponInfo.getQuota());
         goodsInfo.setHasCoupon(true);
         goodsInfo.setCouponInfo(coupon);
      }
      List<ClientTextStyleVO> labels = goodsInfo.getLabels();
      // 京东自营标签
      String owner = goods.getOwner();
      if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
         List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
         goodsInfo.setShopType(21); // 京东自营
         if (labels == null) {
            labels = new ArrayList<ClientTextStyleVO>();
         }
         ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
         textStyleVO.setContent("京东自营");
         textStyleVO.setColor("#E42219");
         labels.add(textStyleVO);
         goodsInfo.setLabels(labels);
         goodsInfo.setShopType(21); // 京东自营
      } else {
         goodsInfo.setShopType(20); // 京东
      }
      JDPingouInfo pinGouInfo = goods.getPinGouInfo();
      if (pinGouInfo != null) {
         goodsInfo.setZkPrice(pinGouInfo.getPingouPrice());
         goodsInfo.setPriceName("拼购价");
         if (labels == null) {
            labels = new ArrayList<ClientTextStyleVO>();
         }
         ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
         textStyleVO.setContent("拼购");
         textStyleVO.setColor("#E42219");
         labels.add(textStyleVO);
      } else {
         goodsInfo.setZkPrice(goods.getPrice());
         goodsInfo.setPriceName("京东价");
      }
      goodsInfo.setLabels(labels);
      // 店铺信息
      JDShopInfo shopInfo = goods.getShopInfo();
      if (shopInfo != null && !StringUtil.isNullOrEmpty(shopInfo.getShopName())) {
@@ -467,8 +497,7 @@
    * @param fanLiRate 返利比例
    * @return
    */
   public static GoodsDetailVO convertPDDGoods(PDDGoodsDetail goods, String pid, BigDecimal fanLiRate,
         BigDecimal shareRate) {
   public static GoodsDetailVO convertPDDGoods(PDDGoodsDetail goods, BigDecimal fanLiRate, BigDecimal shareRate) {
      GoodsDetailVO goodsInfo = new GoodsDetailVO();
      goodsInfo.setBaoyou(true);
      goodsInfo.setGoodsType(Constant.SOURCE_TYPE_PDD);
@@ -526,7 +555,8 @@
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
         CouponInfoVO coupon = new CouponInfoVO();
         coupon.setAmount(amount);
         coupon.setStartFee(startFree);
         if (goods.getCouponStartTime() != null) {
            coupon.setStartTime(sdf.format(new Date(goods.getCouponStartTime() * 1000)));
         }
@@ -534,10 +564,7 @@
         if (goods.getCouponEndTime() != null) {
            coupon.setEndTime(sdf.format(new Date(goods.getCouponEndTime() * 1000)));
         }
         coupon.setLink(null);
         coupon.setStartFee(startFree);
         if (goods.getCouponTotalQuantity() != null)
            coupon.setTotalCount(Integer.parseInt(goods.getCouponTotalQuantity().toString()));