This commit is contained in:
张秉卓
2025-11-06 17:03:16 +08:00
17 changed files with 183 additions and 79 deletions

View File

@ -0,0 +1,17 @@
package com.xjrsoft.module.mdm.client;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import com.xjrsoft.common.constant.GlobalConstant;
/**
* @author: ksy
* @since: 2025/11/5
*/
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.MDM_MODULE_PREFIX + "/countryRegion")
public interface ICountryRegionClient {
@GetMapping("/refreshCache")
void refreshCache();
}

View File

@ -1,22 +1,12 @@
package com.xjrsoft.module.mdm.dto;
import java.io.Serializable;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogTable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.pictc.annotations.datalog.LogTable;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogJoin;
import com.pictc.annotations.datalog.LogJoinColumn;
import com.pictc.annotations.datalog.JoinCaseType;
import com.pictc.annotations.datalog.JoinType;
import com.pictc.annotations.datalog.ValueDirectionType;

View File

@ -1,22 +1,12 @@
package com.xjrsoft.module.mdm.dto;
import java.io.Serializable;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogTable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.pictc.annotations.datalog.LogTable;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogJoin;
import com.pictc.annotations.datalog.LogJoinColumn;
import com.pictc.annotations.datalog.JoinCaseType;
import com.pictc.annotations.datalog.JoinType;
import com.pictc.annotations.datalog.ValueDirectionType;

View File

@ -0,0 +1,49 @@
package com.xjrsoft.module.mdm.client;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.RedisUtil;
import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.service.ICountryRegionService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* @author: yjw
* @since: 2025/3/5
*/
//@Api(hidden = true)
@RestController
@RequestMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MDM_MODULE_PREFIX + "/countryRegion")
@AllArgsConstructor
@Slf4j
public class CountryRegionClientImpl implements ICountryRegionClient {
private final ICountryRegionService countryRegionService;
private final RedisUtil redisUtil;
@GetMapping("/refreshCache")
public void refreshCache() {
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: 加载所有国家地区表缓存结束");
}finally {
TenantUtil.clear();
}
}
}

View File

@ -113,7 +113,6 @@ public class BankController {
@ApiOperation(value = "新增LngBBank")
@SaCheckPermission("bank:add")
public R add(@Valid @RequestBody UpdateLngBBankDto dto){
Long res = bankService.add(dto);
return R.ok(res);
}

View File

@ -24,7 +24,7 @@ import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.mdm.dto.LngBFeePageDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBFeeDto;
import com.xjrsoft.module.mdm.entity.LngBFee;
import com.xjrsoft.module.mdm.service.IExpenseNameService;
import com.xjrsoft.module.mdm.service.IFeeService;
import com.xjrsoft.module.mdm.vo.LngBFeePageVo;
import com.xjrsoft.module.mdm.vo.LngBFeeVo;
@ -42,18 +42,18 @@ import lombok.AllArgsConstructor;
* @Version 1.0
*/
@RestController
@RequestMapping("/mdm" + "/expenseName")
@Api(value = "/mdm" + "/expenseName",tags = "费用名称代码")
@RequestMapping("/mdm" + "/fee")
@Api(value = "/mdm" + "/fee",tags = "费用名称代码")
@AllArgsConstructor
public class ExpenseNameController {
public class FeeController {
private final IExpenseNameService expenseNameService;
private final IFeeService feeService;
private final DatalogService dataService;
@GetMapping(value = "/page")
@ApiOperation(value="LngBFee列表(分页)")
@SaCheckPermission("expenseName:list")
@SaCheckPermission("fee:list")
public R page(@Valid LngBFeePageDto dto){
LambdaQueryWrapper<LngBFee> queryWrapper = new LambdaQueryWrapper<>();
@ -64,16 +64,16 @@ public class ExpenseNameController {
.like(StrUtil.isNotBlank(dto.getNote()),LngBFee::getNote,dto.getNote())
.orderByAsc(LngBFee::getSort,LngBFee::getCode)
.select(LngBFee.class,x -> VoToColumnUtil.fieldsToColumns(LngBFeePageVo.class).contains(x.getProperty()));
IPage<LngBFee> page = expenseNameService.page(ConventPage.getPage(dto), queryWrapper);
IPage<LngBFee> page = feeService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngBFeePageVo> pageOutput = ConventPage.getPageOutput(page, LngBFeePageVo.class);
return R.ok(pageOutput);
}
@GetMapping(value = "/info")
@ApiOperation(value="根据id查询LngBFee信息")
@SaCheckPermission("expenseName:detail")
@SaCheckPermission("fee:detail")
public R info(@RequestParam Long id){
LngBFee lngBFee = expenseNameService.getById(id);
LngBFee lngBFee = feeService.getById(id);
if (lngBFee == null) {
return R.error("找不到此数据!");
}
@ -83,21 +83,21 @@ public class ExpenseNameController {
@PostMapping
@ApiOperation(value = "新增LngBFee")
@SaCheckPermission("expenseName:add")
@SaCheckPermission("fee:add")
public R add(@Valid @RequestBody UpdateLngBFeeDto dto){
return R.ok(expenseNameService.add(dto));
return R.ok(feeService.add(dto));
}
@PutMapping
@ApiOperation(value = "修改LngBFee")
@SaCheckPermission("expenseName:edit")
@SaCheckPermission("fee:edit")
public R update(@Valid @RequestBody UpdateLngBFeeDto dto){
return R.ok(expenseNameService.update(dto));
return R.ok(feeService.update(dto));
}
@DeleteMapping
@ApiOperation(value = "删除")
@SaCheckPermission("expenseName:delete")
@SaCheckPermission("fee:delete")
public R delete(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.deleteByIds(UpdateLngBFeeDto.class, ids));
@ -105,7 +105,7 @@ public class ExpenseNameController {
@GetMapping(value = "/datalog")
@ApiOperation(value="根据id查询LngBFee数据详细日志")
@SaCheckPermission("expenseName:datalog")
@SaCheckPermission("fee:datalog")
public R datalog(@RequestParam Long id){
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngBFeeDto.class,id);
return R.ok(logs);
@ -113,7 +113,7 @@ public class ExpenseNameController {
@PostMapping("/enable")
@ApiOperation(value = "启用")
@SaCheckPermission("expenseName:enable")
@SaCheckPermission("fee:enable")
public R enable(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.enable(UpdateLngBFeeDto.class,ids));
}
@ -121,7 +121,7 @@ public class ExpenseNameController {
@PostMapping("/disable")
@ApiOperation(value = "禁用")
@SaCheckPermission("expenseName:disable")
@SaCheckPermission("fee:disable")
public R disable(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.disable(UpdateLngBFeeDto.class,ids));
}

View File

@ -13,7 +13,7 @@ import com.xjrsoft.module.mdm.entity.LngBFee;
* @Version 1.0
*/
public interface IExpenseNameService extends IService<LngBFee> {
public interface IFeeService extends IService<LngBFee> {
Boolean enable(List<Long> ids);

View File

@ -1,6 +1,7 @@
package com.xjrsoft.module.mdm.service.impl;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -14,6 +15,7 @@ import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.utils.DataLogTools;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.utils.CacheUtil;
import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.dto.UpdateLngBRegionDto;
@ -54,6 +56,7 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
this.checkParams(dto);
UpdateLngBRegionDto res = DataLogTools.insert(dto);
this.addOrUpdateAfter(res.getId());
refreshCahe();
return res.getId();
}
@ -67,6 +70,7 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
refreshCahe();
return true;
}
@ -81,6 +85,7 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
refreshCahe();
return true;
}
@ -102,6 +107,7 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
this.checkParams(dto);
UpdateLngBRegionDto res = DataLogTools.update(dto);
this.addOrUpdateAfter(res.getId());
refreshCahe();
return res.getId();
}
@ -126,5 +132,13 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
private void refreshCahe(){
//异步更新用户表、用户部门表、用户角色表、用户岗位表数据
CompletableFuture.runAsync(() -> {
CacheUtil.refreshRegionList();
});
}
}

View File

@ -19,7 +19,7 @@ import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBFeeDto;
import com.xjrsoft.module.mdm.entity.LngBFee;
import com.xjrsoft.module.mdm.mapper.LngBFeeMapper;
import com.xjrsoft.module.mdm.service.IExpenseNameService;
import com.xjrsoft.module.mdm.service.IFeeService;
import lombok.AllArgsConstructor;
@ -31,7 +31,7 @@ import lombok.AllArgsConstructor;
*/
@Service
@AllArgsConstructor
public class ExpenseNameServiceImpl extends ServiceImpl<LngBFeeMapper, LngBFee> implements IExpenseNameService {
public class FeeServiceImpl extends ServiceImpl<LngBFeeMapper, LngBFee> implements IFeeService {
private final CommonCallService commonCallService;