yujian
2020-05-23 dd6a31aae79b35ccf0e006704a4d9e1d950c57d6
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -31,6 +31,7 @@
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.jd.JDCouponInfo;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
import com.yeshi.fanli.entity.bus.activity.ActivityUser;
import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
import com.yeshi.fanli.entity.dynamic.CommentInfo;
@@ -116,7 +117,6 @@
   @Resource
   private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
   @Override
   public void switchState(String id) throws GoodsEvaluateException {
      if (id == null) {
@@ -136,7 +136,6 @@
      }
      goodsEvaluateDao.updateSatate(id, state);
   }
   
   @Override
   public String saveHead(MultipartFile file, GoodsEvaluate record) throws GoodsEvaluateException {
@@ -260,7 +259,8 @@
         InputStream inputStream = file.getInputStream();
         String contentType = file.getContentType();
         String type = contentType.substring(contentType.indexOf("/") + 1);
         String filePath = FilePathEnum.goodsEvaluate.getPath() + UUID.randomUUID().toString().replace("-", "") + "."+ type;
         String filePath = FilePathEnum.goodsEvaluate.getPath() + UUID.randomUUID().toString().replace("-", "") + "."
               + type;
         
         BufferedImage sourceImg = ImageIO.read(inputStream);
         ImgInfo info = new ImgInfo();
@@ -278,7 +278,6 @@
      }
      return null;
   }
   private String uploadPicture(File file, String contentType) throws Exception {
      InputStream inputStream = new FileInputStream(file);
@@ -923,7 +922,6 @@
      goodsEvaluateDao.save(resultObj);
   }
   @Override
   public void saveCurrencyCoupon(String pid, int kind, CommentInfo commentInfo)
         throws GoodsEvaluateException, Exception {
@@ -979,7 +977,6 @@
            throw new GoodsEvaluateException(1, "包含不可转链的口令与链接");
         }
      }
      List<CommentInfo> comments = new ArrayList<>();
      CommentInfo currencyCoupon = null;
@@ -1091,7 +1088,6 @@
         }
      }
      List<ImgInfo> listImg = new ArrayList<ImgInfo>();
      if (imgVideo != null) {
         if (!StringUtil.isNullOrEmpty(imgInfo.getVideoUrl())) {
@@ -1131,7 +1127,6 @@
         }
      }
      // 上传文件替换
      if (fileRequest != null) {
         for (int i = 0; i < 9; i++) {
@@ -1156,7 +1151,6 @@
            } 
         }
      }
      
      int lineNum = 0;
      int totalImg = tempList.size();
@@ -1541,7 +1535,8 @@
   }
   @Override
   public List<GoodsEvaluate> query(int start, int count, String key, Integer state, int dynamicType, String typeEnum) {
   public List<GoodsEvaluate> query(int start, int count, String key, Integer state, int dynamicType,
         String typeEnum) {
      return goodsEvaluateDao.query(start, count, key, state, dynamicType, typeEnum);
   }
@@ -2004,7 +1999,8 @@
         if (!goodsVO.isHasCoupon()) {
            commentText = commentText.replace("领券抢购", "抢购");
            commentText = commentText.replace("【券后价】[券后价]元", "");
            commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n","\r\n");
            commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n",
                  "\r\n");
         } 
         commentInfo.setContent(commentText);
         commentInfo.setType(CommentInfoEnum.goodsCoupon.getDesc());
@@ -2158,7 +2154,6 @@
         }
         imgs.addAll(goodsimgs);
         int i = 0;
         List<ImgInfo> imgList = new ArrayList<>();
         for (String img : imgs) {
@@ -2197,7 +2192,8 @@
               if (!goodsVO.isHasCoupon()) {
                  commentText = commentText.replace("领券抢购", "抢购");
                  commentText = commentText.replace("【券后价】[券后价]元", "");
                  commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n");
                  commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n")
                        .replace("\r\n\r\n", "\r\n");
               } 
               CommentInfo commentInfo = new CommentInfo();
@@ -2362,6 +2358,23 @@
      updateGoods(queryExist, goodsNew);
   }
   @Override
   public void updateVIPGoods(VIPGoodsInfo goods) {
      if (goods == null) {
         return;
      }
      List<GoodsEvaluate> queryExist = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_VIP,
            Long.parseLong(goods.getGoodsId()));
      if (queryExist == null || queryExist.size() == 0) {
         return;
      }
      ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55");
      paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
      GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertVIPGoods(goods, paramsDTO);
      updateGoods(queryExist, goodsNew);
   }
   private void updateGoods(List<GoodsEvaluate> listExist, GoodsDetailVO goodsNew) {
      long goodsId = goodsNew.getGoodsId();
      int goodsType = goodsNew.getGoodsType();
@@ -2404,7 +2417,6 @@
         goodsEvaluateDao.save(goodsEvaluate);
      }
   }
   
   @Override
   public void offlineTaoBaoGoods(Long goodsId) {
@@ -2459,7 +2471,6 @@
      }
   }
   
   /**
    * 删除已过期时间
    */
@@ -2506,4 +2517,5 @@
         e.printStackTrace();
      }
   }
}