代码优化
This commit is contained in:
@ -35,6 +35,8 @@ import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.utils.CacheUtil;
|
||||
import com.xjrsoft.common.utils.RedisUtil;
|
||||
import com.xjrsoft.common.utils.TenantUtil;
|
||||
import com.xjrsoft.common.utils.TreeUtil;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
|
||||
@ -74,6 +76,7 @@ public class CountryRegionController {
|
||||
|
||||
private final ICountryRegionService countryRegionService;
|
||||
private final DatalogService dataService;
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value="LngBRegion列表(分页)")
|
||||
@ -286,9 +289,20 @@ public class CountryRegionController {
|
||||
|
||||
private void refreshCahe(){
|
||||
//异步更新
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
CacheUtil.refreshRegionList();
|
||||
try {
|
||||
TenantUtil.ignore(true);
|
||||
Log.info("MDM: 加载所有国家地区表缓存开始");
|
||||
List<LngBRegion> list = countryRegionService.list();
|
||||
redisUtil.set(GlobalConstant.REGION_CACHE_KEY, list);
|
||||
redisUtil.set(GlobalConstant.REGION_NAME_CACHE_KEY, list.stream().collect(Collectors.toMap(LngBRegion::getCode,LngBRegion::getFullPath)));
|
||||
Log.info("MDM: 加载所有国家地区表缓存结束");
|
||||
}catch (Exception e) {
|
||||
Log.info(e.getLocalizedMessage(), e);
|
||||
}finally {
|
||||
TenantUtil.clear();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user