admin
2020-03-20 f0d06601a6be8c09ef5e8e7e76666cb1e8ef72a5
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -490,9 +490,15 @@
            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);
         }
@@ -1517,7 +1523,11 @@
      executor.execute(new Runnable() {
         @Override
         public void run() {
            // 更新信息
            updateGoodInfo(list);
            // 删除已过期
            removeOverdue();
         }
      });
@@ -1664,6 +1674,9 @@
         @Override
         public void run() {
            updateGoodInfo(listOBJ);
            // 删除已过期
            removeOverdue();
         }
      });
@@ -2286,13 +2299,8 @@
      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);
         }
         
         // 更新商品信息
@@ -2308,26 +2316,19 @@
               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);
@@ -2336,5 +2337,24 @@
      }
   }
   
   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);
         }
      }
   }
}