Commit 1c263404 authored by huangjie's avatar huangjie

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

parents 9ad64129 d2ad14c3
......@@ -40,29 +40,25 @@ public class EconomicServiceImpl implements EconomicService {
*/
private static final Integer TYPE = 1;
/**
* 默认排序
*/
private static final String FIELD = "gdp";
private static final String ORDER = "desc";
@Override
public AjaxResult nationalPage(OpRegionalEconomicDataV1PageDto dto) {
if (ObjectUtil.isEmpty(dto.getYear())) {
dto.setYear(DateUtils.getYear() - 1);
}
String redisKey = CacheConstants.DATA_ECONOMIC + dto.getYear() + dto.getProvinceIds() + dto.getCityIds() + dto.getAreaIds();
Map<String, Object> cacheMap = redisCache.getCacheObject(redisKey);
if (ObjectUtil.isNotEmpty(cacheMap)) {
return BeanUtil.toBean(cacheMap, AjaxResult.class);
}
Map<String, Object> map = dskOpenApiUtil.requestBody("/economic/national/nationalPage", BeanUtil.beanToMap(dto, false, false));
Integer code = MapUtils.getInteger(map, "code", 300);
if (!code.equals(HttpStatus.OK.value())) {
throw new RuntimeException();
}
Map data = MapUtils.getMap(map, "data", null);
List<Object> list = CommonUtils.assertAsArray(MapUtils.getObject(data, "list", ""));
if (ObjectUtil.isNotEmpty(list) && TYPE.equals(dto.getType())) {
if (ObjectUtil.isEmpty(dto.getProvinceIds()) && ObjectUtil.isEmpty(dto.getCityIds()) && ObjectUtil.isEmpty(dto.getAreaIds())) {
redisCache.setCacheObject(redisKey, map);
}
}
return BeanUtil.toBean(map, AjaxResult.class);
}
......
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