From b47fb09eaffa4a13c0d63e823cb9319bcb775249 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 02 四月 2020 15:22:11 +0800 Subject: [PATCH] 发圈修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java | 100 ++++++++++++++++++++++--------------------------- 1 files changed, 45 insertions(+), 55 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 6d928e1..a063e7f 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 @@ -735,8 +735,6 @@ } } } - - // 鏁版嵁瀵规瘮 鍒犻櫎鍥剧墖 if (oldGoodsList != null && oldGoodsList.size() > 0) { @@ -955,14 +953,15 @@ 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, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); } } + * 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); @@ -1302,7 +1301,6 @@ totalImg++; } - // 娓呯悊鑰佸浘鐗� if (listOld != null && listOld.size() > 0) { for (int j = 0; j < listOld.size(); j++) { @@ -1567,14 +1565,13 @@ e.printStackTrace(); continue; } - - // 鎸夌収鍙戝竷鏄剧ず鏃堕棿娈佃捣濮嬫椂闂翠负鍑嗐�� - goodsEvaluate.setPublishTime(goodsEvaluate.getStartTime()); - // 鎸夌収鍙戝竷鏄剧ず鏃堕棿娈佃捣濮嬫椂闂翠负鍑嗐�� goodsEvaluate.setPublishTime(goodsEvaluate.getStartTime()); - + + // 鎸夌収鍙戝竷鏄剧ず鏃堕棿娈佃捣濮嬫椂闂翠负鍑嗐�� + goodsEvaluate.setPublishTime(goodsEvaluate.getStartTime()); + List<CommentInfo> comments = evaluateNew.getComments(); if (comments != null && comments.size() > 0) { EvaluateEnum typeEnum = evaluateNew.getType(); @@ -1855,11 +1852,12 @@ } @Override - public void addGoodsEvaluate(Long goodsId, Integer cid, String title, String comment) throws GoodsEvaluateException{ - if (goodsId == null || cid == null || StringUtil.isNullOrEmpty(title)) { + public void addGoodsEvaluate(Long goodsId, List<ImgInfo> imgList, ActivityUser user, String title, String comment) + throws GoodsEvaluateException { + if (goodsId == null || user == null || StringUtil.isNullOrEmpty(title)) { throw new GoodsEvaluateException(1, "鐩稿叧鍙傛暟涓嶈兘涓虹┖"); } - + TaoBaoGoodsBrief goodsBrief = null; try { goodsBrief = redisManager.getTaoBaoGoodsBrief(goodsId); @@ -1876,13 +1874,6 @@ throw new GoodsEvaluateException(1, "璇ュ晢鍝佹棤鍒�"); } - // 鍙戝竷鐢ㄦ埛 - ActivityUser user = activityUserService.getRandomByDaTaoKeCid(cid); - if (user == null) { - throw new GoodsEvaluateException(1, "鏈壘鍒板彂甯冪敤鎴�"); - } - - // 鐧藉簳鍥� List<String> imgs = new ArrayList<>(); if (!StringUtil.isNullOrEmpty(goodsBrief.getPictUrlWhite())) { @@ -1897,36 +1888,36 @@ // 鍟嗗搧鍥剧墖淇℃伅 int i = 0; - List<ImgInfo> imgList = new ArrayList<>(); - for (String img : imgs) { - ImgInfo imgInfo = new ImgInfo(); - imgInfo.setH(1); - imgInfo.setW(1); - imgInfo.setLarge(false); - imgInfo.setUrl(img); - imgInfo.setUrlHD(img); - if (i != 0) { - imgInfo.setType(ImgEnum.img); - } else { - imgInfo.setType(ImgEnum.goods); - SimpleGoods simpleGoods = new SimpleGoods(); - simpleGoods.setGoodsId(goodsVO.getGoodsId()); - simpleGoods.setGoodsType(goodsVO.getGoodsType()); - simpleGoods.setState(goodsVO.getState()); - CouponInfoVO couponInfo = goodsVO.getCouponInfo(); - if (couponInfo == null) { - simpleGoods.setPrice(goodsVO.getZkPrice()); + if (imgList == null || imgList.size() == 0) + for (String img : imgs) { + ImgInfo imgInfo = new ImgInfo(); + imgInfo.setH(1); + imgInfo.setW(1); + imgInfo.setLarge(false); + imgInfo.setUrl(img); + imgInfo.setUrlHD(img); + if (i != 0) { + imgInfo.setType(ImgEnum.img); } else { - simpleGoods.setPrice(goodsVO.getCouponPrice()); - simpleGoods.setAmount(couponInfo.getAmount()); + imgInfo.setType(ImgEnum.goods); + SimpleGoods simpleGoods = new SimpleGoods(); + simpleGoods.setGoodsId(goodsVO.getGoodsId()); + simpleGoods.setGoodsType(goodsVO.getGoodsType()); + simpleGoods.setState(goodsVO.getState()); + CouponInfoVO couponInfo = goodsVO.getCouponInfo(); + if (couponInfo == null) { + simpleGoods.setPrice(goodsVO.getZkPrice()); + } else { + simpleGoods.setPrice(goodsVO.getCouponPrice()); + simpleGoods.setAmount(couponInfo.getAmount()); + } + imgInfo.setGoods(simpleGoods); + imgInfo.setGoodsVO(goodsVO); } - imgInfo.setGoods(simpleGoods); - imgInfo.setGoodsVO(goodsVO); + imgList.add(imgInfo); + i++; } - imgList.add(imgInfo); - i++; - } - + // 璇勮鍐呭 CommentInfo commentInfo = new CommentInfo(); commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); @@ -1946,14 +1937,15 @@ commentText = commentText.replace("[鍒稿悗浠穄", MoneyBigDecimalUtil.getWithNoZera(goodsVO.getCouponPrice()) + ""); } - commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n","\r\n"); + commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", + "\r\n"); commentInfo.setContent(commentText); commentInfo.setType(CommentInfoEnum.goodsCoupon.getDesc()); } List<CommentInfo> commentsNew = new ArrayList<>(); commentsNew.add(commentInfo); - + // 涓�琛屾樉绀哄灏戜釜鍥剧墖 int lineNum = 0; if (imgs.size() > 0) { @@ -1967,7 +1959,6 @@ lineNum = 3; } } - GoodsEvaluate goodsEvaluate = new GoodsEvaluate(); goodsEvaluate.setId(UUID.randomUUID().toString().replace("-", "")); @@ -2199,7 +2190,7 @@ imgList.add(imgInfo); i++; } - + goodsEvaluate.setGoods(goodsVO); goodsEvaluate.setImgList(imgList); goodsEvaluateDao.save(goodsEvaluate); @@ -2250,7 +2241,6 @@ } return descNew; } - @Override public void updateTaoBaoGoods(TaoBaoGoodsBrief goods) { -- Gitblit v1.8.0