From 744594ef1a2f530fc3e86ea9dc48b62247f79420 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 19 五月 2020 17:13:23 +0800 Subject: [PATCH] 饿了么绘图,添加口碑 --- fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java | 97 +++++++++++++++--------------------------------- 1 files changed, 31 insertions(+), 66 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java index 43be9bf..911bbd4 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java +++ b/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(); -- Gitblit v1.8.0