Parcourir la source

fix

release_toaliyun_real
winter il y a 2 ans
Parent
révision
f28c0253ad
4 fichiers modifiés avec 34 ajouts et 3 suppressions
  1. +1
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  2. +5
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  3. +2
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumCacheKey.java
  4. +26
    -0
      mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java

+ 1
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java Voir le fichier

@@ -230,6 +230,7 @@ public class WxCouponController extends BaseController {
CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId());
CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId(),null);
CouponCacheUtils.removeOnlyCouponCache(redisTemplate, wxCoupon.getId());
CouponCacheUtils.removeOldDetailCache(redisTemplate);
return new ResultData();
}


+ 5
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java Voir le fichier

@@ -527,11 +527,13 @@ public class WxCouponController extends BaseController {
}

ValueOperations<String, WxCouponCVo> operations = cdRedisTemplate.opsForValue();
// 缓存
boolean hasKey = cdRedisTemplate.hasKey(key);
if (hasKey) {
// 从缓存获取用户信息
WxCouponCVo wxCouponCVo = operations.get(key);
//WxCouponCVo wxCouponCVo = operations.get(key);
WxCouponCVo wxCouponCVo = CouponCacheUtils.getOldDetailCache(redisTemplate, couponChannelIdL, couponIdL);
// 库存
if (couponIdL > 0L) {
// 更新状态
@@ -576,7 +578,8 @@ public class WxCouponController extends BaseController {
}

// 插入缓存
operations.set(key, wxCouponCVo, 3600, TimeUnit.SECONDS);
//operations.set(key, wxCouponCVo, 3600, TimeUnit.SECONDS);
CouponCacheUtils.setOldDetaileCache(redisTemplate, wxCouponCVo, couponChannelIdL, couponIdL);

updateActivityStatus(wxCouponCVo);



+ 2
- 1
mallinkService/src/main/java/com/iformall/enums/EnumCacheKey.java Voir le fichier

@@ -16,7 +16,8 @@ public enum EnumCacheKey {
TOPIC_ONE(5, "topicOne_"),
TOPIC_LIST(6, "topiList_"),
COUPON_CHANNEL_STOCK(7, "couponChannelStock:couponChannelStock_"),
DOUYIN_LIVE_PAGE_LIST(8,"douyinLiveList")
DOUYIN_LIVE_PAGE_LIST(8,"douyinLiveList"),
OLD_DETAIL(9,"cc:")
;
private static Map<Integer,EnumCacheKey> map = new HashMap<Integer,EnumCacheKey>();
static {


+ 26
- 0
mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java Voir le fichier

@@ -3,6 +3,7 @@ package com.iformall.service.util;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.enums.EnumCacheKey;
import com.iformall.utils.RedisCacheUtils;
@@ -131,4 +132,29 @@ public class CouponCacheUtils {
return RedisCacheUtils.getCacheObject(template, key,PageInfo.class);
}
public static void removeOldDetailCache(RedisTemplate<String, Object> template) {
String key = EnumCacheKey.OLD_DETAIL.getMessage();
RedisCacheUtils.removeCachePrefix(template, key);
}
public static void setOldDetaileCache(RedisTemplate<String, Object> template,WxCouponCVo coupon,Long couponChannelIdL,Long couponIdL) {
String key = EnumCacheKey.OLD_DETAIL.getMessage();
if(couponChannelIdL > 0){
key = key + couponChannelIdL;
}else if(couponIdL > 0){
key = key + couponIdL;
}
RedisCacheUtils.cache(template, key, coupon, 3600);
}
public static WxCouponCVo getOldDetailCache(RedisTemplate<String, Object> template,Long couponChannelIdL,Long couponIdL) {
String key = EnumCacheKey.OLD_DETAIL.getMessage();
if(couponChannelIdL > 0){
key = key + couponChannelIdL;
}else if(couponIdL > 0){
key = key + couponIdL;
}
return RedisCacheUtils.getCacheObject(template, key,WxCouponCVo.class);
}
}

Chargement…
Annuler
Enregistrer