admin
2020-05-19 744594ef1a2f530fc3e86ea9dc48b62247f79420
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -930,36 +930,43 @@
         throw new GoodsEvaluateException(1, "请保存第一部分信息");
      }
      if (StringUtil.isNullOrEmpty(commentInfo.getCoupon())) {
         throw new GoodsEvaluateException(1, "券面额不能为空");
      }
      if (StringUtil.isNullOrEmpty(commentInfo.getTagDesc())) {
         throw new GoodsEvaluateException(1, "描述语不能为空");
      }
      String tagUrl = commentInfo.getTagUrl();
      String content = commentInfo.getContent();
      if (StringUtil.isNullOrEmpty(tagUrl) && StringUtil.isNullOrEmpty(content)) {
         throw new GoodsEvaluateException(1, "评论语和链接不能同时为空");
      }
      String endTime = commentInfo.getEndTime();
      if (!StringUtil.isNullOrEmpty(endTime)) {
         try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            sdf.parse(endTime);
         } catch (Exception e) {
            throw new GoodsEvaluateException(1, "请填写正确的时间格式:2020-03-05");
      GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid);
      if (resultObj == null)
         throw new GoodsEvaluateException(1, "第一部分信息缺失");
      if (EvaluateEnum.activity != resultObj.getType()) {
         if (StringUtil.isNullOrEmpty(commentInfo.getCoupon())) {
            throw new GoodsEvaluateException(1, "券面额不能为空");
         }
      } else {
         throw new GoodsEvaluateException(1, "请填写券截止时间");
         if (StringUtil.isNullOrEmpty(commentInfo.getTagDesc())) {
            throw new GoodsEvaluateException(1, "描述语不能为空");
         }
         String tagUrl = commentInfo.getTagUrl();
         String content = commentInfo.getContent();
         if (StringUtil.isNullOrEmpty(tagUrl) && StringUtil.isNullOrEmpty(content)) {
            throw new GoodsEvaluateException(1, "评论语和链接不能同时为空");
         }
         String endTime = commentInfo.getEndTime();
         if (!StringUtil.isNullOrEmpty(endTime)) {
            try {
               SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
               sdf.parse(endTime);
            } catch (Exception e) {
               throw new GoodsEvaluateException(1, "请填写正确的时间格式:2020-03-05");
            }
         } else {
            throw new GoodsEvaluateException(1, "请填写券截止时间");
         }
      }
      if (commentInfo.getNeedSpin() == null) {
         commentInfo.setNeedSpin(false);
      }
      
      String content = commentInfo.getContent();
      if (!StringUtil.isNullOrEmpty(content) && commentInfo.getNeedSpin()) {
         try {
            convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true);
@@ -972,9 +979,6 @@
         }
      }
      GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid);
      if (resultObj == null)
         throw new GoodsEvaluateException(1, "第一部分信息缺失");
      List<CommentInfo> comments = new ArrayList<>();
      CommentInfo currencyCoupon = null;
@@ -1151,6 +1155,7 @@
            } 
         }
      }
      
      int lineNum = 0;
      int totalImg = tempList.size();
@@ -1631,46 +1636,6 @@
         // 按照发布显示时间段起始时间为准。
         evaluateNew.setPublishTime(evaluateNew.getStartTime());
         // 活动链接跳转过渡页
         EvaluateEnum evaluateEnum = evaluateNew.getType();
         if (evaluateEnum != null && evaluateEnum == EvaluateEnum.activity) {
            if (evaluateNew.getComments() != null && evaluateNew.getComments().size() > 0) {
               String jumpLink = configService.get(ConfigKeyEnum.activityDetailLink.getKey()) + "?type=%s&id=%s";
               jumpLink = String.format(jumpLink, "circle", evaluateNew.getId());
               if (!StringUtil.isNullOrEmpty(evaluateNew.getJumpLink())) {
                  evaluateNew.setJumpLink(jumpLink);
               }
               List<ImgInfo> imgListNew = new ArrayList<>();
               List<ImgInfo> imgList = evaluateNew.getImgList();
               if (imgList != null && imgList.size() > 0) {
                  for (ImgInfo imgInfo: imgList) {
                     if (imgInfo.getType() != ImgEnum.img || imgInfo.getType() == ImgEnum.activity) {
                        ImgInfo imgInfoNew = new ImgInfo();
                        try {
                           PropertyUtils.copyProperties(imgInfoNew, imgInfo);
                        } catch (Exception e) {
                           e.printStackTrace();
                           continue;
                        }
                        if (!StringUtil.isNullOrEmpty(imgInfoNew.getActivityUrl())) {
                           imgInfoNew.setActivityUrl(jumpLink);
                        }
                        imgListNew.add(imgInfoNew);
                        continue;
                     }
                     imgListNew.add(imgInfo);
                  }
               }
               evaluateNew.setImgList(imgListNew);
            }
         }
         List<CommentInfo> comments = evaluateNew.getComments();
         if (comments != null && comments.size() > 0) {
            EvaluateEnum typeEnum = evaluateNew.getType();