| | |
| | | import com.yeshi.fanli.util.jd.JDApiUtil; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; |
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.vo.goods.CouponInfoVO; |
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO; |
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO; |
| | |
| | | record.setId(id); |
| | | record.setShareNumReal(0); |
| | | record.setCreateTime(new Date()); |
| | | record.setUpdateTime(new Date()); |
| | | goodsEvaluateDao.save(record); |
| | | } else { |
| | | GoodsEvaluate resultObj = goodsEvaluateDao.getById(id); |
| | |
| | | resultObj.setStartTime(record.getStartTime()); |
| | | resultObj.setEndTime(record.getEndTime()); |
| | | resultObj.setTitle(tilte); |
| | | resultObj.setUpdateTime(new Date()); |
| | | goodsEvaluateDao.save(resultObj); |
| | | } |
| | | return id; |
| | |
| | | } |
| | | |
| | | // 编辑图片 |
| | | List<String> listpic = null; |
| | | List<String> listpic = new ArrayList<>(); |
| | | if (!StringUtil.isNullOrEmpty(picUrls)) { |
| | | String[] pics = picUrls.split(","); |
| | | if (pics != null) { |
| | | listpic = new ArrayList<>(); |
| | | for (int i = 0; i < pics.length; i++) { |
| | | String picLink = pics[i]; |
| | | if (fileRequest != null) { |
| | | MultipartFile file = fileRequest.getFile("file" + i); |
| | | if (file != null) { |
| | | picLink = uploadPicture(file); |
| | | } |
| | | |
| | | } |
| | | if (picLink.startsWith("http")) { |
| | | listpic.add(picLink); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // 上传文件替换 |
| | | if (fileRequest != null) { |
| | | for (int i = 0; i < 9; i++) { |
| | | MultipartFile file = fileRequest.getFile("file" + i); |
| | | if (file != null) { |
| | | String picLink = uploadPicture(file); |
| | | if (i < listpic.size()) { |
| | | listpic.set(i, picLink); |
| | | } else { |
| | | listpic.add(picLink); |
| | | } |
| | | } |
| | |
| | | String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, |
| | | JDApiUtil.POSITION_SHARE + "", "1"); |
| | | String template = configService.get(ConfigKeyEnum.quickShareJDCommentText.getKey()); |
| | | if (jumpLink == null) { |
| | | throw new GoodsEvaluateException(1, "该商品转链失败"); |
| | | } |
| | | commentText = template.replace("[链接]", jumpLink); |
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) { |
| | | String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", "1"); |
| | | if (jumpLink == null) { |
| | | throw new GoodsEvaluateException(1, "该商品转链失败"); |
| | | } |
| | | String template = configService.get(ConfigKeyEnum.quickSharePDDCommentText.getKey()); |
| | | commentText = template.replace("[链接]", jumpLink); |
| | | } |
| | |
| | | commentsNew.add(commentInfo); |
| | | resultObj.setComments(commentsNew); |
| | | } |
| | | resultObj.setUpdateTime(new Date()); |
| | | goodsEvaluateDao.save(resultObj); |
| | | |
| | | // 删除图片 |
| | |
| | | } |
| | | |
| | | resultObj.setComments(comments); |
| | | resultObj.setUpdateTime(new Date()); |
| | | goodsEvaluateDao.save(resultObj); |
| | | } |
| | | |
| | |
| | | listImg.add(imgActivity); |
| | | } |
| | | |
| | | int totalImg = 0; |
| | | // 编辑图片 |
| | | List<String> listpic = new ArrayList<>(); |
| | | if (!StringUtil.isNullOrEmpty(picUrls)) { |
| | | String[] pics = picUrls.split(","); |
| | | if (pics != null) { |
| | | for (int i = 0; i < pics.length; i++) { |
| | | String picLink = pics[i]; |
| | | if (fileRequest != null) { |
| | | MultipartFile file = fileRequest.getFile("file" + i); |
| | | if (file != null) { |
| | | picLink = uploadPicture(file); |
| | | |
| | | ImgInfo imgInfo0 = new ImgInfo(); |
| | | imgInfo0.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | imgInfo0.setLarge(false); |
| | | imgInfo0.setPid(pid); |
| | | imgInfo0.setUrl(picLink); |
| | | imgInfo0.setUrlHD(picLink); |
| | | imgInfo0.setType(ImgEnum.img); |
| | | imgInfo0.setW(1); |
| | | imgInfo0.setH(1); |
| | | listImg.add(imgInfo0); |
| | | totalImg++; |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | if (picLink.startsWith("http")) { |
| | | if (listOldImgInfo != null) { |
| | | for (ImgInfo imgInfo : listOldImgInfo) { |
| | | String url = imgInfo.getUrl(); |
| | | if (picLink.equals(url)) { |
| | | listImg.add(imgInfo); |
| | | totalImg++; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | listpic.add(picLink); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 上传文件替换 |
| | | if (fileRequest != null) { |
| | | for (int i = 0; i < 9; i++) { |
| | | MultipartFile file = fileRequest.getFile("file" + i); |
| | | if (file != null) { |
| | | String picLink = uploadPicture(file); |
| | | if (i < listpic.size()) { |
| | | listpic.set(i, picLink); |
| | | } else { |
| | | listpic.add(picLink); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | int totalImg = 0; |
| | | for (String pic : listpic) { |
| | | ImgInfo imgInfo0 = new ImgInfo(); |
| | | imgInfo0.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | imgInfo0.setLarge(false); |
| | | imgInfo0.setPid(pid); |
| | | imgInfo0.setUrl(pic); |
| | | imgInfo0.setUrlHD(pic); |
| | | imgInfo0.setType(ImgEnum.img); |
| | | imgInfo0.setW(1); |
| | | imgInfo0.setH(1); |
| | | listImg.add(imgInfo0); |
| | | totalImg++; |
| | | } |
| | | |
| | | if (listOld != null && listOld.size() > 0) { |
| | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 更新信息 |
| | | updateGoodInfo(list); |
| | | |
| | | // 删除已过期 |
| | | removeOverdue(); |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | List<GoodsEvaluate> listNew = new ArrayList<>(); |
| | | for (GoodsEvaluate goodsEvaluate : list) { |
| | | |
| | | GoodsEvaluate evaluateNew = new GoodsEvaluate(); |
| | | try { |
| | | PropertyUtils.copyProperties(evaluateNew, goodsEvaluate); |
| | |
| | | continue; |
| | | } |
| | | |
| | | int comment = 0; |
| | | List<CommentInfo> comments = evaluateNew.getComments(); |
| | | if (comments != null && comments.size() > 0) { |
| | | EvaluateEnum typeEnum = evaluateNew.getType(); |
| | | List<CommentInfo> commentNew = new ArrayList<>(); |
| | | |
| | | boolean singleCoupn = true; |
| | | boolean currencyCoupon = true; |
| | | for (CommentInfo commentInfo : comments) { |
| | | if (StringUtil.isNullOrEmpty(commentInfo.getContent()) |
| | | && StringUtil.isNullOrEmpty(commentInfo.getCoupon())) { |
| | |
| | | if (goods.isHasCoupon()) { |
| | | content = content.replace("[券后价]",MoneyBigDecimalUtil.getWithNoZera(goods.getCouponPrice())+""); |
| | | } else { |
| | | singleCoupn = false; |
| | | content = content.replace("领券抢购", "抢购"); |
| | | content = content.replace("【券后价】[券后价]元", ""); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | comment++; |
| | | CommentInfoEnum typeComment = commentInfoNew.getTypeEnum(); |
| | | if (typeComment != null && typeComment == CommentInfoEnum.goodsCoupon) { |
| | | GoodsDetailVO goods = evaluateNew.getGoods(); |
| | |
| | | commentNew.add(commentInfoNew); |
| | | continue; |
| | | } else { |
| | | currencyCoupon = false; |
| | | continue; |
| | | } |
| | | } else { |
| | | currencyCoupon = false; |
| | | continue; |
| | | } |
| | | } |
| | |
| | | evaluateNew.setComments(commentNew); |
| | | |
| | | if (typeEnum != null && typeEnum == EvaluateEnum.single) { |
| | | if (comment > 0 && commentNew.size() == 0) { // 所有券评论下架 |
| | | if (!currencyCoupon && !singleCoupn) { // 所有券评论下架 |
| | | GoodsDetailVO goods = evaluateNew.getGoods(); |
| | | if (goods != null) { |
| | | goods.setState(1); // 评论不存在 下架 |
| | | LogHelper.test("获取列表商品下架1"); |
| | | evaluateNew.setRemarks("评论验证下架"); |
| | | } |
| | | |
| | | List<ImgInfo> imgList = evaluateNew.getImgList(); |
| | |
| | | SimpleGoods simpleGoods = imgInfo.getGoods(); |
| | | if (simpleGoods != null) { |
| | | simpleGoods.setState(1); |
| | | LogHelper.test("获取列表商品下架2"); |
| | | simpleGoods.setRemarks("评论验证下架"); |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void run() { |
| | | updateGoodInfo(listOBJ); |
| | | |
| | | // 删除已过期 |
| | | removeOverdue(); |
| | | } |
| | | }); |
| | | |
| | |
| | | if (goodsNew != null) { |
| | | goodsEvaluate.setGoods(goodsNew); |
| | | } else { |
| | | goodsEvaluate.setRemarks("更新-位置找到商品信息"); |
| | | goodsEvaluate.setState(0); // 已商品下架 |
| | | goods.setState(1); |
| | | goodsEvaluate.setGoods(goods); |
| | |
| | | imgInfo.setGoods(simpleGoods); |
| | | imgInfo.setGoodsVO(goodsDetailVO); |
| | | } else { |
| | | simpleGoods.setRemarks("更新-位置找到商品信息"); |
| | | simpleGoods.setState(1); |
| | | imgInfo.setGoods(simpleGoods); |
| | | GoodsDetailVO goodsVO = imgInfo.getGoodsVO(); |
| | |
| | | for (GoodsEvaluate goodsEvaluate: listExist) { |
| | | GoodsDetailVO goodsDetailVO = goodsEvaluate.getGoods(); |
| | | if (goodsDetailVO != null && goodsDetailVO.getGoodsId() != null |
| | | && goodsDetailVO.getGoodsId() == goodsId && goodsDetailVO.getGoodsType() == goodsType ) { |
| | | if (goodsDetailVO.getTitle().equalsIgnoreCase(goodsNew.getTitle())) { |
| | | goodsEvaluate.setGoods(goodsNew); |
| | | } else { |
| | | goodsEvaluate.setState(1); |
| | | goodsEvaluate.setRemarks("商品标题发生变化下架:" + goodsDetailVO.getTitle() +" / 新:" + goodsNew.getTitle()); |
| | | } |
| | | && goodsDetailVO.getGoodsId() == goodsId && goodsDetailVO.getGoodsType() == goodsType) { |
| | | goodsEvaluate.setGoods(goodsNew); |
| | | } |
| | | |
| | | // 更新商品信息 |
| | |
| | | continue; |
| | | } |
| | | |
| | | GoodsDetailVO goodsVO = imgInfo.getGoodsVO(); |
| | | if (goodsVO != null) { |
| | | if (goodsVO.getTitle().equalsIgnoreCase(goodsNew.getTitle())) { |
| | | simpleGoods.setState(0); |
| | | } else { |
| | | simpleGoods.setState(1); |
| | | simpleGoods.setRemarks("商品标题发生变化下架:" + goodsVO.getTitle() +" / 新:" + goodsNew.getTitle()); |
| | | } |
| | | } |
| | | |
| | | simpleGoods.setPrice(goodsDetailVO.getCouponPrice()); |
| | | CouponInfoVO couponInfo = goodsDetailVO.getCouponInfo(); |
| | | simpleGoods.setState(0); |
| | | simpleGoods.setPrice(goodsNew.getCouponPrice()); |
| | | CouponInfoVO couponInfo = goodsNew.getCouponInfo(); |
| | | if (couponInfo == null) { |
| | | simpleGoods.setPrice(goodsDetailVO.getZkPrice()); |
| | | simpleGoods.setPrice(goodsNew.getZkPrice()); |
| | | } else { |
| | | simpleGoods.setPrice(goodsDetailVO.getCouponPrice()); |
| | | simpleGoods.setPrice(goodsNew.getCouponPrice()); |
| | | simpleGoods.setAmount(couponInfo.getAmount()); |
| | | } |
| | | |
| | | imgInfo.setGoods(simpleGoods); |
| | | imgInfo.setGoodsVO(goodsDetailVO); |
| | | imgInfo.setGoodsVO(goodsNew); |
| | | } |
| | | |
| | | goodsEvaluate.setImgList(imgList); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private void removeOverdue() { |
| | | List<GoodsEvaluate> list = goodsEvaluateDao.queryOverdue(); |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | long nm = 1000 * 60;// 一分钟的毫秒数 |
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数 |
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数 |
| | | |
| | | long time = java.lang.System.currentTimeMillis(); |
| | | for (GoodsEvaluate goodsEvaluate: list) { |
| | | long diff = time - goodsEvaluate.getEndTime().getTime(); |
| | | long min = diff % nd % nh / nm; |
| | | |
| | | // 过期超过10分钟就删除 |
| | | if (min > 10) { |
| | | goodsEvaluateDao.remove(goodsEvaluate); |
| | | } |
| | | } |
| | | } |
| | | } |