| @@ -7,10 +7,14 @@ import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxMallBuilding; | |||
| import com.iformall.domain.po.WxMallFloor; | |||
| import com.iformall.service.WxMallBuildingService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| @@ -23,6 +27,10 @@ public class WxMallBuildingController extends BaseController { | |||
| @Autowired | |||
| private WxMallBuildingService wxMallBuildingService; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||
| @ApiOperation("获取楼层楼座数据") | |||
| @GetMapping("getbuildingfloorlist") | |||
| @SystemControllerLog(description = "商城-楼座-获取楼层楼座数据") | |||
| @@ -52,6 +60,8 @@ public class WxMallBuildingController extends BaseController { | |||
| } | |||
| } | |||
| } | |||
| String key = Constant.mallBuildingPrev + getTenantInfo().getTenantId(); | |||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, key); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| @@ -64,7 +64,7 @@ public class BaseController { | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> cuserBasicInfoTemplate; | |||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||
| @InitBinder | |||
| public void InitBinder(WebDataBinder dataBinder) { | |||
| @@ -156,7 +156,7 @@ public class BaseController { | |||
| private WxCUserBasicInfo getCacheMember(Long memberId,String finalTenantId,String key,long seconds) throws Exception { | |||
| // 缓存 | |||
| WxCUserBasicInfo member = RedisCacheUtils.getCacheObject(cuserBasicInfoTemplate, key, WxCUserBasicInfo.class); | |||
| WxCUserBasicInfo member = RedisCacheUtils.getCacheObject(objectCommonRedisTemplate, key, WxCUserBasicInfo.class); | |||
| if(null == member) { | |||
| member = wxCUserBasicInfoService.getById(memberId,finalTenantId); | |||
| if (member == null) { | |||
| @@ -164,7 +164,7 @@ public class BaseController { | |||
| } | |||
| setCUserBasicChild(member); | |||
| RedisCacheUtils.cache(cuserBasicInfoTemplate, key, member, seconds); | |||
| RedisCacheUtils.cache(objectCommonRedisTemplate, key, member, seconds); | |||
| } | |||
| return member; | |||
| } | |||
| @@ -183,9 +183,9 @@ public class BaseController { | |||
| public void removeCacheMember(Long memberId) { | |||
| String key = "webapp:member:"+memberId; | |||
| RedisCacheUtils.removeCache(cuserBasicInfoTemplate, key); | |||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, key); | |||
| String shortKey = "webapp:short:member:"+memberId; | |||
| RedisCacheUtils.removeCache(cuserBasicInfoTemplate, shortKey); | |||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, shortKey); | |||
| } | |||
| public WxAppinfo getAppInfo(String appId) { | |||
| @@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxMallBuildingFloorDto; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxMallBuilding; | |||
| @@ -16,15 +17,15 @@ import com.iformall.mapper.WxMallFloorMapper; | |||
| import com.iformall.service.WxMallBuildingService; | |||
| import com.iformall.service.WxMallService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| @Service | |||
| @@ -40,6 +41,10 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| @Autowired | |||
| WxMallFloorMapper wxMallFloorMapper; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||
| @Override | |||
| public void wxMallBuildingInit(String tenantId, String mallBuildingJSONstr) { | |||
| WxMall byTenantId = wxMallService.getByTenantId(tenantId); | |||
| @@ -70,6 +75,8 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| wxMallFloorMapper.insert(wxMallFloor); | |||
| } | |||
| } | |||
| String key = Constant.mallBuildingPrev + tenantId; | |||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, key); | |||
| } | |||
| @Override | |||
| @@ -113,10 +120,16 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| @Override | |||
| public ResultData getBuildingFloorList(TenantEntity tenantEntity) { | |||
| String key = Constant.mallBuildingPrev + tenantEntity.getTenantId(); | |||
| List<WxMallBuilding> wxMallBuildings = RedisCacheUtils.getCacheListObject(objectCommonRedisTemplate, key, WxMallBuilding.class); | |||
| if(wxMallBuildings != null){ | |||
| return new ResultData(wxMallBuildings); | |||
| } | |||
| wxMallBuildings = new ArrayList<WxMallBuilding>(); | |||
| WxMallBuilding wxMallBuilding = new WxMallBuilding(); | |||
| wxMallBuilding.updateTenantInfo(tenantEntity); | |||
| List<WxMallBuilding> buildings = wxMallBuildingMapper.findList(wxMallBuilding); | |||
| List<WxMallBuilding> wxMallBuildings = buildings.stream().map(b -> { | |||
| wxMallBuildings = buildings.stream().map(b -> { | |||
| WxMallBuilding tempb = new WxMallBuilding(); | |||
| tempb.setId(b.getId()); | |||
| tempb.setTenantId(b.getTenantId()); | |||
| @@ -146,8 +159,8 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| return tempf; | |||
| }).collect(Collectors.toList()); | |||
| building.setFloors(wxMallFloors); | |||
| } | |||
| RedisCacheUtils.cache(objectCommonRedisTemplate, key, wxMallBuildings, Constant.EXPIRE); | |||
| return new ResultData(wxMallBuildings); | |||
| } | |||
| @@ -178,6 +191,10 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| }}; | |||
| wxMallFloorMapper.insert(mallFloor); | |||
| } | |||
| String key = Constant.mallBuildingPrev + record.getTenantId(); | |||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, key); | |||
| } | |||
| @Override | |||
| @@ -193,6 +210,9 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| } | |||
| }}; | |||
| wxMallFloorMapper.updateById(mallFloor); | |||
| String key = Constant.mallBuildingPrev + record.getTenantId(); | |||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, key); | |||
| } | |||
| @Override | |||
| @@ -7,9 +7,12 @@ import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.PasswordHelper; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.scheduling.annotation.Async; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| @@ -68,6 +71,10 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| @Autowired | |||
| MallUserInfoService userInfoService; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void initProjectConfig(Long id) { | |||
| @@ -174,6 +181,9 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| wxMallFloor.setMallId(Long.parseLong(wxMallBuilding.getTenantId())); | |||
| wxMallFloor.setBuildingId(wxMallBuilding.getId()); | |||
| wxMallFloor.setBackgroundImg(Constant.floor_back_img); | |||
| if(wxMallFloor.getFloorMaps() != null || wxMallFloor.getFloorMaps().size() > 0) { | |||
| wxMallFloor.setFloorMap(JSON.toJSONString(wxMallFloor.getFloorMaps())); | |||
| } | |||
| wxMallFloorService.saveOrUpdate(wxMallFloor); | |||
| } | |||
| }else{ | |||
| @@ -182,6 +192,8 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| wxMallFloorService.deleteByBuildingId(wxMallBuilding.getId()); | |||
| } | |||
| } | |||
| String key = Constant.mallBuildingPrev + wxMallBuildings.get(0).getTenantId(); | |||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, key); | |||
| } | |||
| @Override | |||
| @@ -76,4 +76,6 @@ public class Constant { | |||
| public static final String levelConfigPrev = "levelConfig:"; | |||
| public static final String mallBuildingPrev = "mallBuilding:"; | |||
| } | |||