| | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid); |
| | | if (resultObj == null) |
| | | throw new GoodsEvaluateException(1, "第一部分信息缺失"); |
| | | |
| | | List<CommentInfo> comments = new ArrayList<>(); |
| | | CommentInfo currencyCoupon = null; |