增加国家地区缓存

This commit is contained in:
2025-11-05 16:40:24 +08:00
parent d191bbeaaf
commit 8d0e068231
3 changed files with 12 additions and 29 deletions

View File

@ -48,6 +48,7 @@ public class LngBBankPageVo {
* 所属国家和地区 * 所属国家和地区
*/ */
@ApiModelProperty("所属国家和地区") @ApiModelProperty("所属国家和地区")
@Trans(type = TransType.REGION, transToFieldName = "regionName")
private String regionCode; private String regionCode;
/** /**
* SWIFT * SWIFT
@ -66,10 +67,10 @@ public class LngBBankPageVo {
@ApiModelProperty("数据权限id") @ApiModelProperty("数据权限id")
private Long ruleUserId; private Long ruleUserId;
/**
* 所属国家和地区
*/
@ApiModelProperty("所属国家和地区名称")
private String regionName; private String regionName;
} }

View File

@ -81,9 +81,6 @@ public class BankController {
.select(LngBBank.class,x -> VoToColumnUtil.fieldsToColumns(LngBBankPageVo.class).contains(x.getProperty())); .select(LngBBank.class,x -> VoToColumnUtil.fieldsToColumns(LngBBankPageVo.class).contains(x.getProperty()));
IPage<LngBBank> page = bankService.page(ConventPage.getPage(dto), queryWrapper); IPage<LngBBank> page = bankService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngBBankPageVo> pageOutput = ConventPage.getPageOutput(page, LngBBankPageVo.class); PageOutput<LngBBankPageVo> pageOutput = ConventPage.getPageOutput(page, LngBBankPageVo.class);
List<LngBBankPageVo> list = pageOutput.getList();
setRegionName(list);
return R.ok(pageOutput); return R.ok(pageOutput);
} }
@ -163,23 +160,5 @@ public class BankController {
return R.ok(dataService.disable(UpdateLngBBankDto.class,ids)); return R.ok(dataService.disable(UpdateLngBBankDto.class,ids));
} }
private void setRegionName(List<LngBBankPageVo> list) {
if(CollectionUtil.isNotEmpty(list)) {
for(LngBBankPageVo vo: list) {
if(StrUtil.isNotBlank(vo.getRegionCode())) {
String[] regionArr = vo.getRegionCode().split(",");
if(regionArr != null && regionArr.length > 0) {
String lastRegionCode = regionArr[regionArr.length-1];
LambdaQueryWrapper<LngBRegion> regionQueryWrapper = new LambdaQueryWrapper<>();
regionQueryWrapper.eq(LngBRegion::getCode, lastRegionCode);
LngBRegion lastRegion = regionService.getOne(regionQueryWrapper);
if(lastRegion != null) {
vo.setRegionName(lastRegion.getFullPath());
}
}
} }
}
}
}
}

View File

@ -135,10 +135,13 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
private void refreshCahe(){ private void refreshCahe(){
//异步更新用户表、用户部门表、用户角色表、用户岗位表数据
//异步更新
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
CacheUtil.refreshRegionList(); CacheUtil.refreshRegionList();
}); });
} }
} }