Forráskód Böngészése

fix 店铺最低月份、天数

zoujiajian 1 éve
szülő
commit
d3f2007c70

+ 18 - 5
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -940,11 +940,24 @@ public class GoodsDonController {
             redisService.setNx(yhShopCacheKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
         }
         DateTime now = DateTime.now();
-        list.forEach(data->{
-	        data.setSold(getGoodsSold(data.getId(), data.getSold()));
-            data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(list);
+	    list.forEach(data -> {
+		    data.setSold(getGoodsSold(data.getId(), data.getSold()));
+		    data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
+		    Optional.ofNullable(yhShopGoodsSkuMapper.selectOne(Wrappers.lambdaQuery(YhShopGoodsSku.class)
+				    .eq(YhShopGoodsSku::getYhsId, yhsId)
+				    .eq(YhShopGoodsSku::getGoodsId, data.getId())
+				    .eq(YhShopGoodsSku::getPrice, data.getPrice())
+				    .eq(YhShopGoodsSku::getStatus, 1)
+				    .eq(YhShopGoodsSku::getDeleted, 1)
+				    .last("limit 1"))).ifPresent(yhSku -> {
+			    GoodsDonSku sku = goodsDonSkuMapper.selectById(yhSku.getSkuId());
+			    if (sku != null) {
+				    data.setMonths(sku.getMonths());
+				    data.setDays(sku.getDays());
+			    }
+		    });
+	    });
+	    return GatewayResponse.SUCCESS.newBuilder().toResult(list);
     }
 
     /**