From 469bba3a544b3beef0c170f6fce5804c9e8a9676 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期五, 10 四月 2020 17:02:51 +0800 Subject: [PATCH] 消息 --- fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java | 123 +++++++++++++--------------------------- 1 files changed, 41 insertions(+), 82 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 767430c..b1f11ea 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 @@ -46,6 +46,7 @@ import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2; import com.yeshi.fanli.exception.dynamic.ActivityUserException; import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException; +import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.activity.ActivityUserService; @@ -524,6 +525,7 @@ commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); commentInfo.setContent(commentText); commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon); + commentInfo.setNeedSpin(true); commentsNew.add(commentInfo); resultObj.setComments(commentsNew); } @@ -849,7 +851,8 @@ if (StringUtil.isNullOrEmpty(commentInfo.getId())) { commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); } - + + commentInfo.setNeedSpin(true); commentInfo.setType(commentInfo.getTags()); commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon); newList.add(commentInfo); @@ -863,60 +866,7 @@ goodsEvaluateDao.save(resultObj); } - @Override - public void saveGoodsCoupon(String pid, String content) throws GoodsEvaluateException, Exception { - if (StringUtil.isNullOrEmpty(pid)) { - throw new GoodsEvaluateException(1, "璇蜂繚瀛樼涓�閮ㄥ垎淇℃伅"); - } - - GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid); - if (resultObj == null) - throw new GoodsEvaluateException(1, "绗竴閮ㄥ垎淇℃伅缂哄け"); - - CommentInfo goodsCoupon = null; - CommentInfo currencyCoupon = null; - List<CommentInfo> oldComments = resultObj.getComments(); - if (oldComments != null) { - for (CommentInfo info : oldComments) { - if (CommentInfoEnum.goodsCoupon == info.getTypeEnum()) { - goodsCoupon = info; - } else if (CommentInfoEnum.currencyCoupon == info.getTypeEnum()) { - currencyCoupon = info; - } - } - } - - List<CommentInfo> comments = new ArrayList<>(); - if (!StringUtil.isNullOrEmpty(content)) { - - if (!StringUtil.isNullOrEmpty(content)) { - try { - convertLinkManager.convertLinkFromText(content, 1L, true); - } catch (Exception e) { - throw new GoodsEvaluateException(1, "涓嶅寘鍚彲杞摼鐨勫彛浠や笌閾炬帴"); - } - } - - CommentInfo commentInfo = new CommentInfo(); - if (goodsCoupon != null) { - commentInfo.setId(goodsCoupon.getId()); - } else { - commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); - } - commentInfo.setContent(content); - commentInfo.setType(commentInfo.getTags()); - commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon); - comments.add(commentInfo); - } - - if (currencyCoupon != null) { - comments.add(currencyCoupon); - } - - resultObj.setComments(comments); - goodsEvaluateDao.save(resultObj); - } - + @Override public void saveCurrencyCoupon(String pid, int kind, CommentInfo commentInfo) throws GoodsEvaluateException, Exception { @@ -950,16 +900,21 @@ throw new GoodsEvaluateException(1, "璇峰~鍐欏埜鎴鏃堕棿"); } - // 鍧囦笉楠岃瘉 - /* - * if (!StringUtil.isNullOrEmpty(content) && kind != 3) { try { - * convertLinkManager.convertLinkFromText(content, - * Constant.LINK_TOKEN_VERIFY_UID, true); } catch - * (ConvertLinkExceptionException e) { if - * (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { throw new - * GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); } } catch (Exception e) { - * throw new GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); } } - */ + if (commentInfo.getNeedSpin() == null) { + commentInfo.setNeedSpin(false); + } + + if (!StringUtil.isNullOrEmpty(content) && commentInfo.getNeedSpin()) { + try { + convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true); + } catch (ConvertLinkExceptionException e) { + if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { + throw new GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); + } + } catch (Exception e) { + throw new GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); + } + } GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid); if (resultObj == null) @@ -1914,6 +1869,7 @@ // 璇勮鍐呭 CommentInfo commentInfo = new CommentInfo(); + commentInfo.setNeedSpin(true); commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon); if (!StringUtil.isNullOrEmpty(comment)) { @@ -1942,12 +1898,12 @@ // 涓�琛屾樉绀哄灏戜釜鍥剧墖 int lineNum = 0; - if (imgs.size() > 0) { - if (imgs.size() == 1) { + if (imgList.size() > 0) { + if (imgList.size() == 1) { lineNum = 1; - } else if (imgs.size() == 3) { + } else if (imgList.size() == 3) { lineNum = 3; - } else if (imgs.size() <= 4) { + } else if (imgList.size() <= 4) { lineNum = 2; } else { lineNum = 3; @@ -2083,19 +2039,6 @@ } imgs.addAll(goodsimgs); - int lineNum = 0; - if (imgs.size() > 0) { - if (imgs.size() == 1) { - lineNum = 1; - } else if (imgs.size() == 3) { - lineNum = 3; - } else if (imgs.size() <= 4) { - lineNum = 2; - } else { - lineNum = 3; - } - } - goodsEvaluate.setLineNum(lineNum); int i = 0; List<ImgInfo> imgList = new ArrayList<>(); @@ -2146,6 +2089,7 @@ .replace("\r\n\r\n", "\r\n"); CommentInfo commentInfo = new CommentInfo(); + commentInfo.setNeedSpin(true); commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); commentInfo.setContent(commentText); commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon); @@ -2175,6 +2119,7 @@ commentInfo2.setContent(text2); commentInfo2.setTypeEnum(CommentInfoEnum.goodsCoupon); commentInfo2.setType(""); + commentInfo2.setNeedSpin(true); List<CommentInfo> commentsNew = new ArrayList<>(); commentsNew.add(commentInfo); @@ -2184,6 +2129,20 @@ imgList.add(imgInfo); i++; } + + int lineNum = 0; + if (imgList.size() > 0) { + if (imgList.size() == 1) { + lineNum = 1; + } else if (imgList.size() == 3) { + lineNum = 3; + } else if (imgList.size() <= 4) { + lineNum = 2; + } else { + lineNum = 3; + } + } + goodsEvaluate.setLineNum(lineNum); goodsEvaluate.setGoods(goodsVO); goodsEvaluate.setImgList(imgList); -- Gitblit v1.8.0