Commit 25d65d6e authored by danfuman's avatar danfuman

Merge branch 'V20230915' of http://192.168.60.201/root/dsk-operate-sys into V20230915

parents 93cc39c9 9202bb0b
...@@ -28,9 +28,9 @@ public interface CacheConstants { ...@@ -28,9 +28,9 @@ public interface CacheConstants {
public static final String DATA_UIPGROUPDATA = "data:uipGroupData"; public static final String DATA_UIPGROUPDATA = "data:uipGroupData";
/** /**
* 查甲方 菜单选线 * 用户 位置信息
*/ */
public static final String PERSONAL_LOCATION = "personal:location"; public static final String PERSONAL_LOCATION = "personal:location:";
/** /**
* 查甲方 财务数据 * 查甲方 财务数据
...@@ -42,4 +42,10 @@ public interface CacheConstants { ...@@ -42,4 +42,10 @@ public interface CacheConstants {
* 全国经济大全-默认 * 全国经济大全-默认
*/ */
public static final String DATA_ECONOMIC = "data:economic"; public static final String DATA_ECONOMIC = "data:economic";
/**
* 查集团户-集团统计信息
*/
public static final String DATA_COMBINE = "data:combine:";
} }
...@@ -11,6 +11,7 @@ import com.dsk.common.core.domain.R; ...@@ -11,6 +11,7 @@ import com.dsk.common.core.domain.R;
import com.dsk.common.core.page.TableDataInfo; import com.dsk.common.core.page.TableDataInfo;
import com.dsk.common.exception.ServiceException; import com.dsk.common.exception.ServiceException;
import com.dsk.common.utils.DskOpenApiUtil; import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.common.utils.JsonUtils;
import com.dsk.common.utils.StringUtils; import com.dsk.common.utils.StringUtils;
import com.dsk.jsk.domain.JskCombineBidPageDto; import com.dsk.jsk.domain.JskCombineBidPageDto;
import com.dsk.jsk.domain.JskCombineCertificateDto; import com.dsk.jsk.domain.JskCombineCertificateDto;
...@@ -248,9 +249,9 @@ public class JskCombineInfoService { ...@@ -248,9 +249,9 @@ public class JskCombineInfoService {
*@date: 2023/9/12 16:05 *@date: 2023/9/12 16:05
*/ */
public R memberCount(JskCombineCountDto dto) { public R memberCount(JskCombineCountDto dto) {
String redisKey = CacheConstants.PERSONAL_LOCATION + dto.getCombineId(); String redisKey = CacheConstants.DATA_COMBINE + dto.getCombineId();
if (ObjectUtil.isNotEmpty(redisKey)) { if (ObjectUtil.isNotEmpty(redisKey)) {
Map<String, Object> cacheMap = redisCache.getCacheObject(redisKey); Map<String, Object> cacheMap = JsonUtils.parseObject(redisCache.getCacheObject(redisKey), Map.class);
if (MapUtils.isNotEmpty(cacheMap)) { if (MapUtils.isNotEmpty(cacheMap)) {
return R.ok(cacheMap); return R.ok(cacheMap);
} }
...@@ -263,7 +264,7 @@ public class JskCombineInfoService { ...@@ -263,7 +264,7 @@ public class JskCombineInfoService {
Map<String, Object> data = BeanUtil.beanToMap(map.get("data")); Map<String, Object> data = BeanUtil.beanToMap(map.get("data"));
data.put("performance", businessCount(paramsMap)); data.put("performance", businessCount(paramsMap));
map.put("data", data); map.put("data", data);
redisCache.setCacheObject(redisKey, data,24, TimeUnit.HOURS); redisCache.setCacheObject(redisKey, JsonUtils.toJsonString(data), 24, TimeUnit.HOURS);
} }
return BeanUtil.toBean(map, R.class); return BeanUtil.toBean(map, R.class);
} }
......
...@@ -8,6 +8,7 @@ import com.dsk.common.core.domain.AjaxResult; ...@@ -8,6 +8,7 @@ import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.helper.LoginHelper; import com.dsk.common.helper.LoginHelper;
import com.dsk.common.utils.DateUtils; import com.dsk.common.utils.DateUtils;
import com.dsk.common.utils.DskOpenApiUtil; import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.common.utils.JsonUtils;
import com.dsk.jsk.domain.*; import com.dsk.jsk.domain.*;
import com.dsk.jsk.domain.bo.*; import com.dsk.jsk.domain.bo.*;
import com.dsk.jsk.service.service.EconomicService; import com.dsk.jsk.service.service.EconomicService;
...@@ -81,7 +82,7 @@ public class EconomicServiceImpl implements EconomicService { ...@@ -81,7 +82,7 @@ public class EconomicServiceImpl implements EconomicService {
String redisKey = CacheConstants.PERSONAL_LOCATION + userId; String redisKey = CacheConstants.PERSONAL_LOCATION + userId;
if (ObjectUtil.isEmpty(detailsDto.getProvinceId()) && ObjectUtil.isEmpty(detailsDto.getCityId()) && ObjectUtil.isEmpty(detailsDto.getAreaId())) { if (ObjectUtil.isEmpty(detailsDto.getProvinceId()) && ObjectUtil.isEmpty(detailsDto.getCityId()) && ObjectUtil.isEmpty(detailsDto.getAreaId())) {
if (ObjectUtil.isNotEmpty(redisKey)) { if (ObjectUtil.isNotEmpty(redisKey)) {
Map<String, Object> cacheMap = redisCache.getCacheMap(redisKey); Map<Object, Object> cacheMap = JsonUtils.parseObject(redisCache.getCacheObject(redisKey), Map.class);
if (MapUtils.isNotEmpty(cacheMap)) { if (MapUtils.isNotEmpty(cacheMap)) {
return AjaxResult.success(cacheMap); return AjaxResult.success(cacheMap);
} }
...@@ -93,10 +94,9 @@ public class EconomicServiceImpl implements EconomicService { ...@@ -93,10 +94,9 @@ public class EconomicServiceImpl implements EconomicService {
if (!code.equals(HttpStatus.OK.value())) { if (!code.equals(HttpStatus.OK.value())) {
throw new RuntimeException(); throw new RuntimeException();
} }
Map data = MapUtils.getMap(map, "data", null); Map data = MapUtils.getMap(map, "data", null);
if (ObjectUtil.isNotEmpty(detailsDto.getProvinceId()) || ObjectUtil.isNotEmpty(detailsDto.getCityId()) || ObjectUtil.isNotEmpty(detailsDto.getAreaId())) { if (ObjectUtil.isNotEmpty(detailsDto.getProvinceId()) || ObjectUtil.isNotEmpty(detailsDto.getCityId()) || ObjectUtil.isNotEmpty(detailsDto.getAreaId())) {
redisCache.setCacheMap(redisKey, data); redisCache.setCacheObject(redisKey, JsonUtils.toJsonString(data));
} }
return BeanUtil.toBean(map, AjaxResult.class); return BeanUtil.toBean(map, AjaxResult.class);
} }
......
...@@ -7,10 +7,7 @@ import java.util.Map; ...@@ -7,10 +7,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundSetOperations; import org.springframework.data.redis.core.*;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
...@@ -25,15 +22,18 @@ public class RedisCache ...@@ -25,15 +22,18 @@ public class RedisCache
@Autowired @Autowired
public RedisTemplate redisTemplate; public RedisTemplate redisTemplate;
@Autowired
public StringRedisTemplate stringRedisTemplate;
/** /**
* 缓存基本的对象,Integer、String、实体类等 * 缓存基本的对象,Integer、String、实体类等
* *
* @param key 缓存的键值 * @param key 缓存的键值
* @param value 缓存的值 * @param value 缓存的值
*/ */
public <T> void setCacheObject(final String key, final T value) public <T> void setCacheObject(final String key, final String value)
{ {
redisTemplate.opsForValue().set(key, value); stringRedisTemplate.opsForValue().set(key, value);
} }
/** /**
...@@ -44,9 +44,9 @@ public class RedisCache ...@@ -44,9 +44,9 @@ public class RedisCache
* @param timeout 时间 * @param timeout 时间
* @param timeUnit 时间颗粒度 * @param timeUnit 时间颗粒度
*/ */
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) public <T> void setCacheObject(final String key, final String value, final Integer timeout, final TimeUnit timeUnit)
{ {
redisTemplate.opsForValue().set(key, value, timeout, timeUnit); stringRedisTemplate.opsForValue().set(key, value, timeout, timeUnit);
} }
/** /**
...@@ -102,10 +102,9 @@ public class RedisCache ...@@ -102,10 +102,9 @@ public class RedisCache
* @param key 缓存键值 * @param key 缓存键值
* @return 缓存键值对应的数据 * @return 缓存键值对应的数据
*/ */
public <T> T getCacheObject(final String key) public String getCacheObject(final String key)
{ {
ValueOperations<String, T> operation = redisTemplate.opsForValue(); return stringRedisTemplate.opsForValue().get(key);
return operation.get(key);
} }
/** /**
...@@ -191,7 +190,7 @@ public class RedisCache ...@@ -191,7 +190,7 @@ public class RedisCache
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
{ {
if (dataMap != null) { if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap); stringRedisTemplate.opsForHash().putAll(key, dataMap);
} }
} }
...@@ -201,9 +200,9 @@ public class RedisCache ...@@ -201,9 +200,9 @@ public class RedisCache
* @param key * @param key
* @return * @return
*/ */
public <T> Map<String, T> getCacheMap(final String key) public <T> Map<Object, Object> getCacheMap(final String key)
{ {
return redisTemplate.opsForHash().entries(key); return stringRedisTemplate.opsForHash().entries(key);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment