Просмотр исходного кода

Merge branch 'yh_sku_func' into pre

zoujiajian 2 лет назад
Родитель
Сommit
850c21f2e0

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/entity/OrderDonSubsidyRelate.java

@@ -11,7 +11,7 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class OrderDonSubsidyRelate {
+public class OrderDonSubsidyRelate extends BaseEntity{
 	private Long subsidyId;
 
 	private Long orderId;

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/entity/UserDistributeSubRewards.java

@@ -14,7 +14,7 @@ import java.math.BigDecimal;
  */
 @Getter
 @Setter
-public class UserDistributeSubRewards {
+public class UserDistributeSubRewards extends BaseEntity{
 	private Integer level;
 
 	/**

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

@@ -3,12 +3,10 @@ package com.cyksj.redis;
 import com.cyksj.common.util.StringUtil;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.ZSetOperations;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
@@ -29,16 +27,6 @@ public class RedisService {
     @Resource
     private RedisTemplate<String, Object> redisTemplate;
 
-    public static String env = "dev";
-
-    @Value("${spring.profiles.active}")
-    private String active;
-
-    @PostConstruct
-    public void init(){
-        env = active + ":";
-    }
-
 
     /**
      * 指定缓存失效时间
@@ -833,11 +821,8 @@ public class RedisService {
 
         private long timeout;
 
-        public String getEnvName() {
-            return this.name + env;
-        }
         public String getNameFormat(Object ... str) {
-            return String.format(this.getEnvName(), str);
+            return String.format(this.getName(), str);
         }
 
     }

+ 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.getEnvName() + "*");
+				Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
 				redisService.del(keys.toArray(String[]::new));
 			}
 		}

+ 4 - 4
netflix-service/src/main/java/com/cyksj/service/mange/impl/RefreshCacheServiceImpl.java

@@ -20,19 +20,19 @@ public class RefreshCacheServiceImpl implements RefreshCacheService {
 
 	@Override
 	public void refreshYhHomePageCache() {
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
 		redisService.del(keys.toArray(String[]::new));
 	}
 
 	@Override
 	public void refreshYhHomeCategoryPageCache() {
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category" + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category" + "*");
 		redisService.del(keys.toArray(String[]::new));
 	}
 
 	@Override
 	public void refreshGoodsSkuSubsidyPageCache() {
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "subsidy" + "*");
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "subsidy" + "*");
 		redisService.del(keys.toArray(String[]::new));
 	}
 
@@ -44,7 +44,7 @@ public class RefreshCacheServiceImpl implements RefreshCacheService {
 
 	@Override
 	public void refreshShopUserIdCacheByYshId(Long yhsId) {
-		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + "*";
+		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId + "*";
 		Set<String> keys = redisService.keys(yhShopCacheKey);
 		redisService.del(keys.toArray(String[]::new));
 	}

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/sys/impl/SysConfigChangeRecordServiceImpl.java

@@ -128,7 +128,7 @@ public class SysConfigChangeRecordServiceImpl extends ServiceImpl<SysConfigChang
 					DayOfWeek nowDayOfWeek = LocalDateTime.now().getDayOfWeek();
 					if (weekdayMsgNotifySb.length() > 0 && (nowDayOfWeek == DayOfWeek.SATURDAY || nowDayOfWeek == DayOfWeek.SUNDAY) && envCommonService.isPrdEnv()) {
 						//一个小时内 不重复发送
-						if (redisService.setNx(RedisService.key.WEEKEND_DUTY_UNDERSTAFFED_NOTIFY.getEnvName(), RedisService.key.WEEKEND_DUTY_UNDERSTAFFED_NOTIFY.getName(), RedisService.key.WEEKEND_DUTY_UNDERSTAFFED_NOTIFY.getTimeout())) {
+						if (redisService.setNx(RedisService.key.WEEKEND_DUTY_UNDERSTAFFED_NOTIFY.getName(), RedisService.key.WEEKEND_DUTY_UNDERSTAFFED_NOTIFY.getName(), RedisService.key.WEEKEND_DUTY_UNDERSTAFFED_NOTIFY.getTimeout())) {
 							SmsUtil.sendLuoKey2Msg(Constant.DUTY_SERVICE_CHANGE_NOTIFY_PHONE, String.format(Constant.DUTY_SERVICE_CHANGE_MSG, weekdayMsgNotifySb));
 						}
 					}

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/sys/impl/SysFuncTimingShelfServiceImpl.java

@@ -83,7 +83,7 @@ public class SysFuncTimingShelfServiceImpl extends ServiceImpl<SysFuncTimingShel
 				homeManagementConfigMapper.updateById(homeManagementConfig);
 				log.info("将首页配置:{}的状态置为:{}状态", funcId, timingShelf.getPreStatus());
 
-				Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
+				Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
 				redisService.del(keys.toArray(String[]::new));
 			});
 		});

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/user/impl/UserIdentCertServiceImpl.java

@@ -105,7 +105,7 @@ public class UserIdentCertServiceImpl implements UserIdentCertService {
 			return null;
 		}
 		String state = StringUtil.randomString(6);
-		redisService.set(RedisService.key.WX_INDENT_BIND_KEY.getEnvName() + state, userId, RedisService.key.WX_INDENT_BIND_KEY.getTimeout());
+		redisService.set(RedisService.key.WX_INDENT_BIND_KEY.getName() + state, userId, RedisService.key.WX_INDENT_BIND_KEY.getTimeout());
 		return state;
 	}
 
@@ -118,7 +118,7 @@ public class UserIdentCertServiceImpl implements UserIdentCertService {
 //		if (userIdList.size() == 1 && StrUtil.isNotEmpty(bindState)) {
 //			User user = userMapper.selectById(userId);
 //			if (StrUtil.isEmpty(user.getOpenId())) {
-//				String key = RedisService.key.WX_INDENT_BIND_KEY.getEnvName() + bindState;
+//				String key = RedisService.key.WX_INDENT_BIND_KEY.getName() + bindState;
 //				Object bindInfo = redisService.get(key);
 //				if (bindInfo == null) {
 //					throw BusinessRuntimeException.getInstance("认证信息已失效,请重新操作..");

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

@@ -93,7 +93,7 @@ public class GoodsDonController {
 	    if (StrUtil.isNotBlank(customId)) {
 		    yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
 	    }
-	    String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category";
+	    String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category";
 	    if (yhsId != null) {
 		    key += ":yhShop:" + yhsId;
 	    }
@@ -232,7 +232,7 @@ public class GoodsDonController {
 	    }
 	    //List<Long> filter_goodsIds = getFilterGoodsIds();
 	    List<Long> filter_goodsIds = null;
-	    String pcCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "PC";
+	    String pcCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "PC";
 	    if (CollUtil.isNotEmpty(filter_goodsIds)) {
 		    pcCacheKey += ":hz-ip";
 	    }
@@ -277,7 +277,7 @@ public class GoodsDonController {
 	    }
 	    //List<Long> filter_goodsIds = getFilterGoodsIds();
 		List<Long> filter_goodsIds = null;
-	    String h5CacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "H5";
+	    String h5CacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "H5";
 	    if (CollUtil.isNotEmpty(filter_goodsIds)) {
 		    h5CacheKey += ":hz-ip";
 	    }
@@ -315,7 +315,7 @@ public class GoodsDonController {
      */
     @GetMapping("/get/register")
     public Result<List<RegisterGoodsDonView>> getRegisterGoodsDon() {
-        String registerCacheKey = RedisService.key.REGISTER_HOME_PAGE_CACHE.getEnvName();
+        String registerCacheKey = RedisService.key.REGISTER_HOME_PAGE_CACHE.getName();
         Object value = redisService.get(registerCacheKey);
         if (value != null) {
             try {
@@ -349,7 +349,7 @@ public class GoodsDonController {
 			Result<YhShopGoodsFrontView> yhShopGoodsDetail = getGoodsDetailByYhsId(yhShopFrontService.getYhsIdByCustomId(customId), id);
 			return yhShopGoodsDetail;
 		}
-		String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "goods_detail:" + id;
+		String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "goods_detail:" + id;
 		//List<Long> filter_goodsIds = getFilterGoodsIds();
 		List<Long> filter_goodsIds = null;
 		//存在过滤平台 商品详情不返回
@@ -437,11 +437,11 @@ public class GoodsDonController {
      */
     @GetMapping("/get/recommend/{id}")
     public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, String customId, String dsCode) throws Exception {
-	    String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "recommend:" + id;
+	    String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "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;
+		    key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId + ":recommend:" + id;
 	    }
 	    Object o = redisService.get(key);
 	    Long fUid = StpUserUtil.getUserIdAfterLogin();
@@ -542,11 +542,11 @@ public class GoodsDonController {
 	 */
 	@GetMapping("/get/homeManage")
 	public Result<Map<String, List<HomeManagementFrontView>>> getHomeManagementFrontPage(String customId, String dsCode) {
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage";
+		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage";
 		Long yhsId = null;
 		if (StrUtil.isNotBlank(customId)) {
 			yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
-			key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":homeManage";
+			key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId + ":homeManage";
 		}
 //		List<Long> filter_goodsIds = getFilterGoodsIds();
 		List<Long> filter_goodsIds = null;
@@ -721,7 +721,7 @@ public class GoodsDonController {
 	    if (fUid != null) {
 		    if (data.getIsSp()) {
 			    //查找所有特定规格最小价格 满足条件
-			    String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "specific:" + data.getId();
+			    String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "specific:" + data.getId();
 			    Object speciObj = redisService.get(specificGoodsKey);
 			    List<GoodsDonSku> specificSkus = null;
 			    if (speciObj != null) {
@@ -773,7 +773,7 @@ public class GoodsDonController {
 		if (fUid != null) {
 			if (data.getIsSp()) {
 				//查找所有特定规格最小价格 满足条件
-				String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "specific:" + data.getId();
+				String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "specific:" + data.getId();
 				Object speciObj = redisService.get(specificGoodsKey);
 				List<GoodsDonSku> specificSkus = null;
 				if (speciObj != null) {
@@ -823,7 +823,7 @@ public class GoodsDonController {
 	 */
 	public List<GoodsDonSku> getSpecificSku(Long goodsId) {
 		//查找所有特定规格最小价格 满足条件
-		String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "specific:" + goodsId;
+		String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "specific:" + goodsId;
 		Object speciObj = redisService.get(specificGoodsKey);
 		List<GoodsDonSku> specificSkus = null;
 		if (speciObj != null) {
@@ -907,7 +907,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_SHOP.getEnvName() + yhsId;
+        String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId;
         Object value = redisService.get(yhShopCacheKey);
         List<YhShopGoodsFrontView> list = null;
         if (value != null) {
@@ -965,7 +965,7 @@ public class GoodsDonController {
 			return shopGoods;
 		}
 		Long fUid = StpUserUtil.getUserIdAfterLogin();
-		String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category:goods";
+		String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category:goods";
 		if (cgy != null) {
 			categoryGoodsKey += ":" + cgy;
 		}
@@ -1028,7 +1028,7 @@ public class GoodsDonController {
 
 	@GetMapping("/get/shop/categoryGoods/{yhsId}")
 	public Result<List<YhShopGoodsFrontCategoryView>> getShopCategoryGoods(@PathVariable Long yhsId, Long category) {
-		String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":category";
+		String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId + ":category";
 		if (category != null) {
 			categoryGoodsKey += ":" + category;
 		}
@@ -1080,7 +1080,7 @@ public class GoodsDonController {
 	 */
 	@GetMapping("/get/deposit")
 	public Result<? extends Object> getDepositGoods() {
-		String depositGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "deposit";
+		String depositGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "deposit";
 		Object o = redisService.get(depositGoodsKey);
 		if (o == null) {
 			List<GoodsDon> depositList = beanSearcher.searchAll(GoodsDon.class, MapUtils.builder()
@@ -1104,7 +1104,7 @@ public class GoodsDonController {
 	 */
 	@GetMapping("/get/pc/homeManage")
 	public Result<Map<String, List<HomeManagementFrontView>>> getPcHomeManagementFrontPage() {
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "pc:homeManage";
+		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "pc:homeManage";
 		//移除奈飞客厅 临时
 		Long filterConfigId = null;
 //		if (isHzIp()) {
@@ -1132,7 +1132,7 @@ public class GoodsDonController {
 	 */
 	@GetMapping("/get/pc/realGoodsConfig")
 	public Result<? extends Object> getPcRealGoodsConfig() throws Exception {
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "pc:realHomePage";
+		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "pc:realHomePage";
 		Object o = redisService.get(key);
 		List<HomeManagementFrontView> list = null;
 		if (o == null) {
@@ -1151,7 +1151,7 @@ public class GoodsDonController {
 	 */
 	@GetMapping("/get/subsidy")
 	public Result<List<GoodsDonSkuSubsidyFrontView>> getSubsidyGoods() {
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "subsidy";
+		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "subsidy";
 		Object o = redisService.get(key);
 		if (o == null) {
 			List<GoodsDonSkuSubsidyFrontView> subsidyList = beanSearcher.searchAll(GoodsDonSkuSubsidyFrontView.class, MapUtils.builder().build());
@@ -1188,7 +1188,7 @@ public class GoodsDonController {
 	 */
 	@GetMapping("/get/subsidy/detail/{id}")
 	public Result<GoodsDonSubsidyDetailView> getSubsidyDetailById(@PathVariable Long id) throws Exception {
-		String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "subsidy:detail:" + id;
+		String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "subsidy:detail:" + id;
 		Object o = redisService.get(goodsDetailKey);
 		GoodsDonSubsidyDetailView subsidyDetail = null;
 		if (o == null) {

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -276,7 +276,7 @@ public class GroupRelationController {
         Integer num = groupRelationFrontService.getUserCodeNumBySkuId(userId, groupsRelationView.getSkuId(), isHasVerifyCode);
         if (count >= num) throw BusinessRuntimeException.getInstance("获取双重验证码次数上限");
         //一分钟内 只能一人获取
-        boolean b = redisService.setNx(RedisService.key.DOUBLE_VERIFY_CODE_VIEW_MINUTES_KEY.getEnvName() + groupsRelationView.getTripsAccount(), relationId, RedisService.key.DOUBLE_VERIFY_CODE_VIEW_MINUTES_KEY.getTimeout());
+        boolean b = redisService.setNx(RedisService.key.DOUBLE_VERIFY_CODE_VIEW_MINUTES_KEY.getName() + groupsRelationView.getTripsAccount(), relationId, RedisService.key.DOUBLE_VERIFY_CODE_VIEW_MINUTES_KEY.getTimeout());
         if (!b) {
             throw BusinessRuntimeException.getInstance("一分钟内已有人获取该账号验证码,请稍后获取..");
         }

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/information/InformationController.java

@@ -63,7 +63,7 @@ public class InformationController {
      */
     @GetMapping("/get/detail/{id}")
     public Result<InformationDetailView> getInformation(@PathVariable Long id) {
-        String key = RedisService.key.INFORMATION_KEY.getEnvName() + "id:" + id;
+        String key = RedisService.key.INFORMATION_KEY.getName() + "id:" + id;
         InformationDetailView view = (InformationDetailView) redisService.get(key);
         if (view == null){
             view = beanSearcher.searchFirst(InformationDetailView.class, MapUtils.flatBuilder(request.getParameterMap())

+ 2 - 2
netflix-web/src/main/java/com/cyksj/web/controller/sys/SysConfigController.java

@@ -195,7 +195,7 @@ public class SysConfigController {
 	public Result getServiceIndx() {
 		long userId = StpUserUtil.getLoginIdAsLong();
 		long time = DateUtil.beginOfDay(DateTime.now()).getTime();
-		Object re = redisService.get(RedisService.key.EQUIPMENT_USER_SERVICE_RECORD.getEnvName() + time + userId);
+		Object re = redisService.get(RedisService.key.EQUIPMENT_USER_SERVICE_RECORD.getName() + time + userId);
 		return GatewayResponse.SUCCESS.newBuilder().toResult(re);
 	}
 
@@ -206,7 +206,7 @@ public class SysConfigController {
 	public Result<Integer> serviceRecord(@PathVariable Long indx) {
 		long userId = StpUserUtil.getLoginIdAsLong();
 		long time = DateUtil.beginOfDay(DateTime.now()).getTime();
-		redisService.set(RedisService.key.EQUIPMENT_USER_SERVICE_RECORD.getEnvName() + time + userId, indx, RedisService.key.EQUIPMENT_USER_SERVICE_RECORD.getTimeout());
+		redisService.set(RedisService.key.EQUIPMENT_USER_SERVICE_RECORD.getName() + time + userId, indx, RedisService.key.EQUIPMENT_USER_SERVICE_RECORD.getTimeout());
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}