Sfoglia il codice sorgente

update

release_toaliyun_real
xhxu 5 anni fa
parent
commit
34fb3ff7ef
1 ha cambiato i file con 14 aggiunte e 21 eliminazioni
  1. +14
    -21
      mallinkService/src/main/java/com/iformall/service/impl/WxMallServiceImpl.java

+ 14
- 21
mallinkService/src/main/java/com/iformall/service/impl/WxMallServiceImpl.java Vedi File

@@ -3,16 +3,14 @@ package com.iformall.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxProjectConfig;
import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxMallBuilding;
import com.iformall.domain.po.WxMallFloor;
import com.iformall.mapper.WxMallBuildingMapper; import com.iformall.mapper.WxMallBuildingMapper;
import com.iformall.mapper.WxMallFloorMapper; import com.iformall.mapper.WxMallFloorMapper;
import com.iformall.mapper.WxMallMapper; import com.iformall.mapper.WxMallMapper;
import com.iformall.service.WxMallService; import com.iformall.service.WxMallService;
import com.iformall.utils.Constant; import com.iformall.utils.Constant;
import com.iformall.utils.RedisCacheUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -44,8 +42,10 @@ public class WxMallServiceImpl implements WxMallService {
RedisTemplate<String, WxMall> mallRedisTemplate; RedisTemplate<String, WxMall> mallRedisTemplate;


@Autowired @Autowired
@Qualifier("subMallListRedisTemplate")
RedisTemplate<String, List<WxMall>> subMallListRedisTemplate;
@Qualifier("objectCommonRedisTemplate")
RedisTemplate<String, Object> subMallListRedisTemplate;




@Override @Override
public String wxMallInit(WxProjectConfig wxProjectConfig) { public String wxMallInit(WxProjectConfig wxProjectConfig) {
@@ -211,16 +211,13 @@ public class WxMallServiceImpl implements WxMallService {
@Override @Override
public List<WxMall> getSubByParentTenantId(String parentTenantId) { public List<WxMall> getSubByParentTenantId(String parentTenantId) {
String key = Constant.subMallinfoPrev + parentTenantId; String key = Constant.subMallinfoPrev + parentTenantId;
ValueOperations<String, List<WxMall>> operations = subMallListRedisTemplate.opsForValue();
if(subMallListRedisTemplate.hasKey(key)) {
List<WxMall> wxMalls = operations.get(key);
return wxMalls;
List<WxMall> mallList = RedisCacheUtils.getCacheListObject(subMallListRedisTemplate, key, WxMall.class);
if(null == mallList || mallList.size() == 0){
WxMall q = new WxMall();
q.setParentTenantId(parentTenantId);
mallList = wxMallMapper.selectList(new QueryWrapper<>(q));
RedisCacheUtils.cache(subMallListRedisTemplate, key, mallList, 3600*24*7);
} }
WxMall q = new WxMall();
q.setParentTenantId(parentTenantId);
List<WxMall> mallList = wxMallMapper.selectList(new QueryWrapper<>(q));

operations.set(key, mallList, 7, TimeUnit.DAYS);
return mallList; return mallList;
} }


@@ -243,14 +240,10 @@ public class WxMallServiceImpl implements WxMallService {
mallRedisTemplate.delete(key1); mallRedisTemplate.delete(key1);
} }
String key2 = Constant.subMallinfoPrev + tenantEntity.getTenantId(); String key2 = Constant.subMallinfoPrev + tenantEntity.getTenantId();
if(subMallListRedisTemplate.hasKey(key2)){
subMallListRedisTemplate.delete(key2);
}
RedisCacheUtils.removeCache(subMallListRedisTemplate, key2);
if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){
String key3 = Constant.subMallinfoPrev + tenantEntity.getParentTenantId(); String key3 = Constant.subMallinfoPrev + tenantEntity.getParentTenantId();
if(subMallListRedisTemplate.hasKey(key3)){
subMallListRedisTemplate.delete(key3);
}
RedisCacheUtils.removeCache(subMallListRedisTemplate, key3);
} }
} }




Caricamento…
Annulla
Salva