zoujiajian 2 роки тому
батько
коміт
906b006dec

+ 1 - 4
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonCategoryFrontView.java

@@ -14,7 +14,7 @@ import lombok.Setter;
 @Getter
 @Setter
 @SearchBean(tables = "goods_don_category gc"
-		, where = "status is true"
+		, where = "status is true :condition:"
 		, orderBy = "sorted asc")
 public class GoodsDonCategoryFrontView {
 	@DbField("gc.id")
@@ -22,7 +22,4 @@ public class GoodsDonCategoryFrontView {
 
 	@DbField("gc.name")
 	private String name;
-
-	@DbField("select count(*) from goods_don_category_relate gcr inner join goods_don g on g.id = gcr.goods_id where gcr.category = gc.id")
-	private Integer num;
 }

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/views/GoodsRecommendViews.java

@@ -18,7 +18,7 @@ import java.math.BigDecimal;
 @Getter
 @Setter
 @SearchBean(tables = "goods_don g",
-		where = "g.deleted is true and g.status is true")
+		where = "g.deleted is true and g.status is true :condition:")
 public class GoodsRecommendViews {
 	@DbField("g.id")
 	private Long goodsId;

+ 2 - 8
netflix-dao/src/main/java/com/cyksj/model/views/YhShopGoodsFrontView.java

@@ -21,7 +21,7 @@ import java.util.List;
 @Setter
 @SearchBean(tables = "(select ys.goods_id,min(ys.price) as price from yh_shop_goods_sku ys left join goods_don_sku sku on sku.id = ys.sku_id where sku.status is true and ys.status is true and ys.deleted is true :condition: group by ys.goods_id) yg" +
 		" inner join goods_don g on g.id = yg.goods_id",
-		where = "g.deleted is true and g.status is true",
+		where = "g.deleted is true and g.status is true and g.is_distribute is true",
 		orderBy = "g.sort_by asc, g.id")
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class YhShopGoodsFrontView {
@@ -92,14 +92,8 @@ public class YhShopGoodsFrontView {
 	/**
 	 * 已售
 	 */
-	@DbIgnore
-	private Integer sold;
-
-	/**
-	 * 虚拟销量
-	 */
 	@DbField("g.virtual_sold")
-	private Integer vs;
+	private Integer sold;
 
 	@DbIgnore
 	private BigDecimal specificPrice;

+ 5 - 5
netflix-dao/src/main/java/com/cyksj/model/views/YhShopGoodsView.java

@@ -16,8 +16,8 @@ import java.util.List;
 @Data
 @SearchBean(tables = "yh_shop_goods_sku ysgs left join goods_don g on g.id = ysgs.goods_id" +
         " left join goods_don_sku sku on sku.id = ysgs.sku_id",
-        where = "ysgs.deleted is true and g.status = true and g.deleted = true and sku.status is true"
-        , groupBy = "g.id,g.title,g.category,ysgs.status,ysgs.user_id,ysgs.created_time,ysgs.update_time")
+        where = "ysgs.deleted is true and g.status is true and g.deleted is true and sku.status is true and g.is_distribute is true"
+        , groupBy = "g.id,g.title,g.category,ysgs.status,ysgs.user_id")
 public class YhShopGoodsView {
     @DbField("g.id")
     private Long goodsId;
@@ -37,17 +37,17 @@ public class YhShopGoodsView {
     @DbField("group_concat(sku.spec_val,cast((ysgs.price/100) as decimal(10,2)),'元')")
     private String skuDetail;
 
-    @DbField("ysgs.created_time")
+    @DbField("any_value(ysgs.created_time)")
     private Date createdTime;
 
-    @DbField("ysgs.update_time")
+    @DbField("any_value(ysgs.update_time)")
     private Date updateTime;
 
     @DbIgnore
     private List<YhShopGoodsSkuView> list;
 
     @Data
-    @SearchBean(tables = "goods_don_sku gs left join yh_shop_goods_rate ysgr on gs.id = ysgr.sku_id left join yh_shop_goods_sku ysgs on gs.id = ysgs.sku_id and ysgs.deleted is true :uid:",
+    @SearchBean(tables = "goods_don_sku gs inner join yh_shop_goods_rate ysgr on gs.id = ysgr.sku_id left join yh_shop_goods_sku ysgs on gs.id = ysgs.sku_id and ysgs.deleted is true :uid:",
             where = "gs.status = true",
             orderBy = "gs.months")
     public static class YhShopGoodsSkuView{

+ 1 - 0
netflix-service/src/main/java/com/cyksj/redis/RedisService.java

@@ -625,6 +625,7 @@ public class RedisService {
         PC_WEB_CACHE("pc_web_cache", "首页平台缓存", 10 * 60),
         H5_WEB_CACHE("h5_web_cache", "h5首页平台缓存", 10 * 60),
         YH_HOME_PAGHE_CACHE("yh_home_paghe_cache:", "银河首页缓存", 30 * 60),
+        YH_HOME_PAGHE_CACHE_SHOP("yh_home_paghe_cache:shop:", "银河首页店铺缓存", 40 * 60),
         REGISTER_HOME_PAGE_CACHE("register_home_page_cache:", "注册首页缓存", 10 * 60),
         CPS_BACK_LOGIN_KEY("cps_back_login:", "cps商务后台登录key", 3 * 60),
         CPS_AUTH_SUCCESS_KEY("cps_auth_success_key:%s", "cps后台微信授权", 60 * 10),

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/giftcard/impl/GiftCardGoodsSkuServiceImpl.java

@@ -118,7 +118,7 @@ public class GiftCardGoodsSkuServiceImpl extends ServiceImpl<GiftCardGoodsSkuMap
 			if (minPrice == null || min.getPrice().compareTo(minPrice) != 0) {
 				goodsDon.setMinPrice(min.getPrice());
 				goodsDonMapper.updateById(goodsDon);
-				Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+				Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
 				redisService.del(keys.toArray(String[]::new));
 			}
 		}

+ 56 - 40
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -73,19 +73,30 @@ public class GoodsDonController {
      * 获取平台商品分类
      */
     @GetMapping("/get/category")
-    public Result<List<GoodsDonCategoryFrontView>> getCategory() {
-        String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category";
-        Object o = redisService.get(key);
-        List<GoodsDonCategoryFrontView> list;
-        if (o == null) {
-	        list = beanSearcher.searchAll(GoodsDonCategoryFrontView.class, MapUtils.flatBuilder(request.getParameterMap())
-			        .field(GoodsDonCategoryFrontView::getNum, 0).op(Operator.GreaterThan)
-			        .build());
-            redisService.setNx(key, list, 30 * 60l);
-            o = redisService.get(key);
-        }
-        list = Jsons.parseList(o, GoodsDonCategoryFrontView.class);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(list);
+    public Result<List<GoodsDonCategoryFrontView>> getCategory(String customId) {
+	    Long yhsId = null;
+	    if (StrUtil.isNotBlank(customId)) {
+		    yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
+	    }
+	    String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category";
+	    Object o = redisService.get(key);
+	    List<GoodsDonCategoryFrontView> list;
+	    MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
+	    String condition = " and (select count(*) from goods_don_category_relate gcr inner join goods_don g on g.id = gcr.goods_id %s where gcr.category = gc.id) > 0";
+	    if (yhsId != null) {
+		    condition = String.format(condition, String.format(" inner join yh_shop_goods_sku ys on ys.goods_id = g.id and ys.status is true and ys.deleted is true and g.is_distribute is true and yhs_id = %s", yhsId));
+	    } else {
+		    condition = String.format(condition, StrUtil.EMPTY);
+	    }
+	    mapBuilder.put("condition", condition);
+	    if (o == null) {
+		    list = beanSearcher.searchAll(GoodsDonCategoryFrontView.class, mapBuilder
+				    .build());
+		    redisService.setNx(key, list, 30 * 60l);
+		    o = redisService.get(key);
+	    }
+	    list = Jsons.parseList(o, GoodsDonCategoryFrontView.class);
+	    return GatewayResponse.SUCCESS.newBuilder().toResult(list);
     }
 
     /**
@@ -386,20 +397,29 @@ public class GoodsDonController {
      * 获取商品推荐平台
      */
     @GetMapping("/get/recommend/{id}")
-    public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id) throws Exception {
+    public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, String customId) throws Exception {
 	    String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "recommend:" + id;
+	    Long yhsId = null;
+	    if (StrUtil.isNotBlank(customId)) {
+		    yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
+		    key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":recommend:" + id;
+	    }
 	    Object o = redisService.get(key);
 	    Long fUid = StpUserUtil.getUserIdAfterLogin();
 	    List<GoodsFrontListView> goodsRecommendViews = null;
 	    if (o == null) {
 		    GoodsDon goodsDon = beanSearcher.searchFirst(GoodsDon.class, MapUtils.builder()
-				    .field(GoodsDon::getId, id)
-				    .field(GoodsDon::getStatus, true)
+				    .field(GoodsDon::getId, id).field(GoodsDon::getStatus, true)
 				    .field(GoodsDon::getDeleted, true)
 				    .build());
 		    if (goodsDon != null && StrUtil.isNotEmpty(goodsDon.getRecommendGoods())) {
 			    List<Long> recommend_gidList = Jsons.parseList(goodsDon.getRecommendGoods(), Long.class);
-			    goodsRecommendViews = beanSearcher.searchAll(GoodsFrontListView.class, MapUtils.builder().field(GoodsRecommendViews::getGoodsId, recommend_gidList).op(Operator.InList).build());
+			    MapBuilder mapBuilder = MapUtils.builder();
+			    if (yhsId != null) {
+				    mapBuilder.put("condition", String.format(" and g.id in (select distinct goods_id from yh_shop_goods_sku where yhs_id = %s and status is true and deleted is true) and g.is_distribute is true", yhsId));
+			    }
+			    mapBuilder.field(GoodsFrontListView::getId, recommend_gidList).op(Operator.InList);
+			    goodsRecommendViews = beanSearcher.searchAll(GoodsFrontListView.class, mapBuilder.build());
 			    redisService.setNx(key, Jsons.toJson(goodsRecommendViews), 60 * 15l);
 			    o = redisService.get(key);
 		    } else {
@@ -410,9 +430,9 @@ public class GoodsDonController {
 		    goodsRecommendViews = Jsons.parseList(o.toString(), GoodsFrontListView.class);
 	    }
 	    goodsRecommendViews.forEach(data -> {
-		    Integer sold = registerOrderDonMapper.selectCount(Wrappers.lambdaQuery(RegisterOrderDon.class)
-				    .eq(RegisterOrderDon::getGoodsId, data.getId()).notIn(RegisterOrderDon::getStatus, Constant.noOrderStatus));
-		    data.setSold(data.getSold() + sold);
+		    Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
+				    .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
+			data.setSold(data.getSold() + sold);
 		    //设置特定价格
 		    setSpecificPrice(data, fUid);
 	    });
@@ -464,14 +484,14 @@ public class GoodsDonController {
 		Long yhsId = null;
 		if (StrUtil.isNotBlank(customId)) {
 			yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
-			key += ":yhShop:" + yhsId;
+			key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":homeManage";
 		}
 		Long fUid = StpUserUtil.getUserIdAfterLogin();
 		Object o = redisService.get(key);
 		if (o == null) {
 			String condition = "g.deleted is true and g.status is true";
 			if (yhsId != null) {
-				condition += String.format(" and g.id in (select distinct goods_id from yh_shop_goods_sku where yhs_id = %s and status is true and deleted is true)", yhsId);
+				condition += String.format(" and g.id in (select distinct goods_id from yh_shop_goods_sku where yhs_id = %s and status is true and deleted is true) and g.is_distribute is true", yhsId);
 			}
 			Map<String, List<HomeManagementFrontView>> map = new ConcurrentHashMap<>();
 			final String conditionSql = condition;
@@ -719,7 +739,7 @@ public class GoodsDonController {
      */
     @GetMapping("/get/shop/goods/{yhsId}")
     public Result<List<YhShopGoodsFrontView>> getShopGoods(@PathVariable Long yhsId) {
-        String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "yhShop:" + yhsId;
+        String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId;
         Object value = redisService.get(yhShopCacheKey);
         List<YhShopGoodsFrontView> list = null;
         if (value != null) {
@@ -737,9 +757,8 @@ public class GoodsDonController {
         DateTime now = DateTime.now();
         list.forEach(data->{
             Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-                    .eq(OrderDon::getYhsId, yhsId)
                     .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
-            data.setSold(sold + data.getVs());
+            data.setSold(sold + data.getSold());
             data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
         });
         return GatewayResponse.SUCCESS.newBuilder().toResult(list);
@@ -793,43 +812,40 @@ public class GoodsDonController {
 			o = redisService.get(categoryGoodsKey);
 		}
 		List<GoodsFrontListView> goodsFrontListViews = Jsons.parseList(o, GoodsFrontListView.class);
+		DateTime now = DateTime.now();
 		goodsFrontListViews.forEach(data -> {
 			Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-					.eq(OrderDon::getYhsId, 0)
 					.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
 			data.setSold(sold + data.getSold());
-			data.setNotifyMsg(getPayMsgTime(data.getId(), DateTime.now(), 1, null));
+			data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsFrontListViews);
 	}
 
 	@GetMapping("/get/shop/categoryGoods/{yhsId}")
 	public Result<List<YhShopGoodsFrontView>> getShopCategoryGoods(@PathVariable Long yhsId, Long category) {
-		String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category:goods:yhShop";
-		Object value = redisService.get(categoryGoodsKey);
-		List<YhShopGoodsFrontView> list = null;
-		if (value != null) {
-			try {
-				list = Jsons.parseList(value, YhShopGoodsFrontView.class);
-			} catch (Exception e) {
-			}
+		String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":category";
+		if (category != null) {
+			categoryGoodsKey += ":" + category;
 		}
-		if (CollUtil.isEmpty(list)) {
+		Object value = redisService.get(categoryGoodsKey);
+		if (value == null) {
 			MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
 			String condition = String.format("and yhs_id = %s", yhsId);
 			if (category != null) {
-				condition += String.format(" and goods_id in (select goods_id from goods_don_category_relate where category = %s)", category);
+				condition += String.format(" and ys.goods_id in (select goods_id from goods_don_category_relate where category = %s)", category);
 			}
 			builder.put("condition", condition);
-			list = beanSearcher.searchAll(YhShopGoodsFrontView.class, builder.build());
+			List<YhShopGoodsFrontView> list = beanSearcher.searchAll(YhShopGoodsFrontView.class, builder.build());
 			redisService.setNx(categoryGoodsKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 5 * 60);
+			value = redisService.get(categoryGoodsKey);
 		}
+		List<YhShopGoodsFrontView> list = Jsons.parseList(value, YhShopGoodsFrontView.class);
 		DateTime now = DateTime.now();
 		list.forEach(data -> {
 			Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-					.eq(OrderDon::getYhsId, yhsId)
 					.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
-			data.setSold(sold + data.getVs());
+			data.setSold(sold + data.getSold());
 			data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(list);

+ 4 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonCategoryController.java

@@ -63,7 +63,7 @@ public class CmsGoodsDonCategoryController {
 	@PutMapping("/put")
 	public Result<String> updateGoodsDonCategory(@RequestBody List<GoodsDonCategory> categorys) {
 		categorys.forEach(category -> goodsDonCategoryService.saveOrUpdateGoods(category));
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category" + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category" + "*");
 		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
@@ -77,7 +77,7 @@ public class CmsGoodsDonCategoryController {
 		Assert.notNull(byId, "分类不存在");
 		byId.setStatus(!byId.getStatus());
 		goodsDonCategoryService.updateById(byId);
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category" + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category" + "*");
 		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
@@ -93,7 +93,7 @@ public class CmsGoodsDonCategoryController {
 			throw BusinessRuntimeException.getInstance("存在该分类下平台");
 		}
 		goodsDonCategoryService.delById(id);
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category" + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category" + "*");
 		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
@@ -109,7 +109,7 @@ public class CmsGoodsDonCategoryController {
 		if (category.getSorted() != null) {
 			byId.setSorted(category.getSorted());
 			goodsDonCategoryService.updateById(byId);
-			Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category" + "*");
+			Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category" + "*");
 			redisService.del(keys.toArray(String[]::new));
 		}
 		return GatewayResponse.SUCCESS.newBuilder().toResult();

+ 4 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonController.java

@@ -110,7 +110,7 @@ public class CmsGoodsDonController {
         if (CollUtil.isNotEmpty(categoryList)) {
             goodsDonCategoryService.saveBatchRelate(goods.getId(), categoryList);
         }
-        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
         redisService.del(keys.toArray(String[]::new));
         return GatewayResponse.SUCCESS.newBuilder().toResult(goods.getId());
     }
@@ -153,7 +153,7 @@ public class CmsGoodsDonController {
         //平台 分类关系
         goodsDonCategoryService.handleGoodsRelate(goods.getId(), spu.getCategoryList());
         goodsDonService.updateById(goods);
-        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
         redisService.del(keys.toArray(String[]::new));
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
@@ -169,7 +169,7 @@ public class CmsGoodsDonController {
         }
         goods.setStatus(!goods.getStatus());
         goodsDonService.updateById(goods);
-        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
         redisService.del(keys.toArray(String[]::new));
         return GatewayResponse.SUCCESS.newBuilder().toResult(goods.getStatus());
     }
@@ -184,7 +184,7 @@ public class CmsGoodsDonController {
         }
         goods.setDeleted(false);
         goodsDonService.updateById(goods);
-        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
         redisService.del(keys.toArray(String[]::new));
         return GatewayResponse.SUCCESS.newBuilder().toResult(id);
     }

+ 4 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSkuController.java

@@ -90,7 +90,7 @@ public class CmsGoodsDonSkuController {
         goodsDonSpecService.skuAppend(insert, goods);
         //给平台更新额外属性
         goodsDonService.updateGoodsSkuPrice(goods.getId(), goods);
-        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
         redisService.del(keys.toArray(String[]::new));
        return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
@@ -144,7 +144,7 @@ public class CmsGoodsDonSkuController {
         goodsDonSkuService.saveOrUpdate(sku);
         //给平台更新额外属性
         goodsDonService.updateGoodsSkuPrice(sku.getGoodsId(), null);
-        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
         redisService.del(keys.toArray(String[]::new));
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
@@ -162,7 +162,7 @@ public class CmsGoodsDonSkuController {
         goodsDonSkuService.handleDiscountPurchaseGoods(sku, null);
         goodsDonSkuService.removeById(skuId);
         goodsDonService.updateGoodsSkuPrice(sku.getGoodsId(), null);
-        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+        Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
         redisService.del(keys.toArray(String[]::new));
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
@@ -209,7 +209,7 @@ public class CmsGoodsDonSkuController {
                 .eq(GoodsDonSku::getStatus, false));
         if (update) {
             goodsDonService.updateGoodsSkuPrice(goodsId, null);
-            Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
+            Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
             redisService.del(keys.toArray(String[]::new));
         }
         return GatewayResponse.SUCCESS.newBuilder().toResult();

+ 10 - 13
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopGoodsController.java

@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
+import java.util.Set;
 
 /*
  *项目名: yhlxj
@@ -69,11 +70,9 @@ public class YhShopGoodsController {
 		});
 		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
 				.eq(YhShop::getUserId, userId).last("limit 1"));
-		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "yhShop:" + yhShop.getId();
-		String homeMangeShopKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage:yhShop:" + yhShop.getId();
-		redisService.del(yhShopCacheKey);
-		redisService.del(homeMangeShopKey);
-		yhShopGoodsSkuService.saveOrUpdateBatch(goodsSkus);
+		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhShop.getId() + "*";
+		Set<String> keys = redisService.keys(yhShopCacheKey);
+		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
 
@@ -86,10 +85,9 @@ public class YhShopGoodsController {
 		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
 				.eq(YhShop::getUserId, userId).last("limit 1"));
 		yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getDeleted, true).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getStatus, status));
-		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "yhShop:" + yhShop.getId();
-		String homeMangeShopKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage:yhShop:" + yhShop.getId();
-		redisService.del(yhShopCacheKey);
-		redisService.del(homeMangeShopKey);
+		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhShop.getId() + "*";
+		Set<String> keys = redisService.keys(yhShopCacheKey);
+		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
 
@@ -103,10 +101,9 @@ public class YhShopGoodsController {
 		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
 				.eq(YhShop::getUserId, userId).last("limit 1"));
 		yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getDeleted, false));
-		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "yhShop:" + yhShop.getId();
-		String homeMangeShopKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage:yhShop:" + yhShop.getId();
-		redisService.del(yhShopCacheKey);
-		redisService.del(homeMangeShopKey);
+		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhShop.getId() + "*";
+		Set<String> keys = redisService.keys(yhShopCacheKey);
+		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
 

+ 4 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/home/HomeManageConfigController.java

@@ -54,7 +54,7 @@ public class HomeManageConfigController {
 	@PutMapping("/put")
 	public Result<String> updateConfig(@RequestBody HomeManageConfigReq config) {
 		homeManagementConfigService.saveOrUpdateConfig(config);
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage" + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage" + "*");
 		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
@@ -69,7 +69,7 @@ public class HomeManageConfigController {
 		Assert.notNull(byId, "配置不存在");
 		byId.setStatus(!byId.getStatus());
 		homeManagementConfigService.updateById(byId);
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage" + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage" + "*");
 		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
@@ -85,7 +85,7 @@ public class HomeManageConfigController {
 		Integer sorted = config.getSorted();
 		byId.setSorted(sorted);
 		homeManagementConfigService.updateById(byId);
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage" + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage" + "*");
 		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
@@ -99,7 +99,7 @@ public class HomeManageConfigController {
 						.set(HomeManagementConfig::getDeleted, false)
 						.eq(HomeManagementConfig::getId, id)
 						.eq(HomeManagementConfig::getDeleted, true));
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage" + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage" + "*");
 		redisService.del(keys.toArray(String[]::new));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}