yj
2020-03-06 ca53b2a58a60695d56dd2d523aa3658b8482b6de
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -234,7 +234,7 @@
   }
   @Override
   public void saveSingleGoods(String pid, Long goodsId, Integer goodsType, String videoUrl, Integer picNum,
   public String saveSingleGoods(String pid, Long goodsId, Integer goodsType, String videoUrl, Integer picNum,
         String picUrls, MultipartHttpServletRequest fileRequest) throws GoodsEvaluateException, Exception {
      if (StringUtil.isNullOrEmpty(pid)) {
         throw new GoodsEvaluateException(1, "请保存第一部分信息");
@@ -461,8 +461,8 @@
       * = false; }
       */
      String commentText = "";
      if (addComment) {
         String commentText = "";
         if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
            TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(1L, goodsId, "0");
            String template = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey());
@@ -512,6 +512,8 @@
            }
         }
      }
      return commentText;
   }
   private String createTokenAndLink(GoodsDetailVO goodsDetailVO) throws Exception {
@@ -1070,6 +1072,7 @@
         listImg.add(imgVideo);
      }
      int totalImg = 0;
      if (!StringUtil.isNullOrEmpty(activityPic) || !StringUtil.isNullOrEmpty(imgInfo.getActivityUrl())) {
         if (imgactivity != null) {
            imgactivity.setUrl(activityPic);
@@ -1093,8 +1096,21 @@
            imgactivity.setH(imgactivity.getH());
         }
         listImg.add(imgactivity);
         totalImg ++;
      }
      resultObj.setLineNum(1);
      int lineNum = 0;
      if (totalImg > 0) {
         if (totalImg == 1) {
            lineNum = 1;
         } else if (totalImg <= 4) {
            lineNum = 2;
         } else {
            lineNum = 3;
         }
      }
      resultObj.setLineNum(lineNum);
      resultObj.setImgList(listImg);
      goodsEvaluateDao.save(resultObj);
   }
@@ -1211,6 +1227,7 @@
         listImg.add(imgActivity);
      }
      int totalImg = 0;
      // 编辑图片
      if (!StringUtil.isNullOrEmpty(picUrls)) {
         String[] pics = picUrls.split(",");
@@ -1229,9 +1246,10 @@
                     imgInfo0.setUrl(picLink);
                     imgInfo0.setUrlHD(picLink);
                     imgInfo0.setType(ImgEnum.img);
                     imgVideo.setW(1);
                     imgVideo.setH(1);
                     imgInfo0.setW(1);
                     imgInfo0.setH(1);
                     listImg.add(imgInfo0);
                     totalImg ++;
                     continue;
                  }
               }
@@ -1242,6 +1260,7 @@
                        String url = imgInfo.getUrl();
                        if (picLink.equals(url)) {
                           listImg.add(imgInfo);
                           totalImg ++;
                           break;
                        }
                     }
@@ -1265,7 +1284,19 @@
               listDel.add(listOld.get(j));
         }
      }
      resultObj.setLineNum(1);
      int lineNum = 0;
      if (totalImg > 0) {
         if (totalImg == 1) {
            lineNum = 1;
         } else if (totalImg <= 4) {
            lineNum = 2;
         } else {
            lineNum = 3;
         }
      }
      resultObj.setLineNum(lineNum);
      resultObj.setImgList(listImg);
      goodsEvaluateDao.save(resultObj);
@@ -1441,8 +1472,7 @@
   }
   @Override
   // @Cacheable(value = "dynamicCache", key =
   // "'queryMaterialsCache-'+#start+'-'+#type")
   @Cacheable(value = "dynamicCache", key = "'queryMaterialsCache-'+#start+'-'+#type")
   public List<GoodsEvaluate> queryMaterialsCache(int start, int count, int type) throws Exception {
      List<GoodsEvaluate> list = goodsEvaluateDao.queryValid(start, count, type);
      if (list == null) {
@@ -1469,18 +1499,31 @@
            List<CommentInfo> commentNew = new ArrayList<>();
            for (CommentInfo commentInfo : comments) {
               if (StringUtil.isNullOrEmpty(commentInfo.getContent()) &&
                     StringUtil.isNullOrEmpty(commentInfo.getCoupon())) {
                  continue;
               }
               CommentInfo commentInfoNew = new CommentInfo();
               try {
                  PropertyUtils.copyProperties(commentInfoNew, commentInfo);
               } catch (Exception e) {
                  e.printStackTrace();
                  continue;
               }
               comment++;
               CommentInfoEnum typeComment = commentInfo.getTypeEnum();
               CommentInfoEnum typeComment = commentInfoNew.getTypeEnum();
               if (typeComment != null && typeComment == CommentInfoEnum.goodsCoupon) {
                  GoodsDetailVO goods = evaluateNew.getGoods();
                  if (goods.isHasCoupon()) {
                     commentNew.add(commentInfo);
                  if (goods != null && goods.isHasCoupon()) {
                     commentNew.add(commentInfoNew);
                     continue;
                  }
               }
               String coupon = commentInfo.getCoupon();
               String endTime = commentInfo.getEndTime();
               String coupon = commentInfoNew.getCoupon();
               String endTime = commentInfoNew.getEndTime();
               if (!StringUtil.isNullOrEmpty(coupon) && !StringUtil.isNullOrEmpty(endTime)) {
                  Date endDay = sdf.parse(endTime);
                  if (endDay.getTime() > now.getTime()) {
@@ -1490,11 +1533,11 @@
                        styleVO.setColor("#E5005C");
                        styleVO.setContent(daysBetween + "天后过期");
                        List<ClientTextStyleVO> tagList = commentInfo.getTagList();
                        List<ClientTextStyleVO> tagList = commentInfoNew.getTagList();
                        tagList.add(styleVO);
                        commentInfo.setTagList(tagList);
                        commentInfoNew.setTagList(tagList);
                        commentNew.add(commentInfo);
                        commentNew.add(commentInfoNew);
                        continue;
                     }
                  }