代码优化

This commit is contained in:
2025-11-06 17:04:11 +08:00
parent 11852beb31
commit 200035414d
25 changed files with 278 additions and 740 deletions

View File

@ -1,6 +0,0 @@
██████╗ ███████╗ ██████╗ ██╗████████╗ ██████╗
██╔════╝ ██╔════╝██╔════╝ ██║╚══██╔══╝██╔════╝
██║ ███╗█████╗ ██║ ███╗█████╗██║ ██║ ██║
██║ ██║██╔══╝ ██║ ██║╚════╝██║ ██║ ██║
╚██████╔╝███████╗╚██████╔╝ ██║ ██║ ╚██████╗
╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝

View File

@ -1,49 +0,0 @@
spring:
cloud:
nacos: #nacos监控
config:
server-addr: 127.0.0.1:8848 # nacos 配置中心地址
namespace: ITC-MS
group: DNE
username: nacos
password: nacos
extension-configs:
- data-id: global-local.yml
refresh: true
group: DNE
- data-id: discovery-local.yml
refresh: true
group: DNE
- data-id: datasource-local.yml
refresh: true
group: DNE
- data-id: seata-local.yml
refresh: true
group: DNE
- data-id: redis-local.yml
refresh: true
group: DNE
- data-id: magic-api.yml
refresh: true
group: DNE
- data-id: sa-token.yml
refresh: true
group: DNE
- data-id: camunda.yml
refresh: true
group: DNE
- data-id: sentinel-local.yml
refresh: true
group: DNE
datalog:
db:
url: jdbc:kingbase8://127.0.0.1:54321/itc?currentSchema=dne_log_sit

View File

@ -1,56 +0,0 @@
server:
port: 8099
spring:
application:
name: demo-service
main:
allow-bean-definition-overriding: true
profiles:
active: remote
cloud:
nacos: #nacos监控
config:
server-addr: 10.0.252.1:8848 # nacos 配置中心地址
namespace: ITC-MS
group: DNE
username: nacos
password: Yudean@2025
file-extension: yml # 默认配置 ${spring.application.name}-${spring.profiles.active}.${file-extension}
refresh-enabled: true
extension-configs:
- data-id: global.yml
refresh: true
group: DNE
- data-id: discovery.yml
refresh: true
group: DNE
- data-id: datasource.yml
refresh: true
group: DNE
- data-id: seata.yml
refresh: true
group: DNE
- data-id: redis.yml
refresh: true
group: DNE
- data-id: magic-api.yml
refresh: true
group: DNE
- data-id: sa-token.yml
refresh: true
group: DNE
- data-id: camunda.yml
refresh: true
group: DNE
- data-id: sentinel.yml
refresh: true
group: DNE

View File

@ -31,7 +31,8 @@ public class CommonCallUtils {
* @return String 返回类型 函数返回非空、或者数据库异常时rollback函数返回空时commit * @return String 返回类型 函数返回非空、或者数据库异常时rollback函数返回空时commit
*/ */
public static String saveAfter(String table,long id) { public static String saveAfter(String table,long id) {
return callService.saveAfter(table, id); String msg = callService.saveAfter(table, id);
return msg;
} }
/** /**

View File

@ -68,7 +68,7 @@ public class LngBBankPageVo {
private Long ruleUserId; private Long ruleUserId;
@ApiModelProperty("所属国家和地区名称")
private String regionName; private String regionName;

View File

@ -60,4 +60,9 @@ public class LngBRegionTreeVo implements ITreeNode<LngBRegionTreeVo,String>, Ser
private List<LngBRegionTreeVo> children; private List<LngBRegionTreeVo> children;
private Boolean hasChild;
private Boolean isLeaf;
} }

View File

@ -5,6 +5,7 @@ import java.util.List;
import javax.validation.Valid; import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -16,25 +17,29 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R; import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil; import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.authority.dto.BatchSetDataAuthDto; import com.xjrsoft.module.authority.dto.BatchSetDataAuthDto;
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
import com.xjrsoft.module.datalog.service.DatalogService; import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo; import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.mdm.dto.LngBBankPageDto; import com.xjrsoft.module.mdm.dto.LngBBankPageDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto; import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.entity.LngBBank; import com.xjrsoft.module.mdm.entity.LngBBank;
import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.service.IBankService; import com.xjrsoft.module.mdm.service.IBankService;
import com.xjrsoft.module.mdm.service.ICountryRegionService;
import com.xjrsoft.module.mdm.vo.LngBBankPageVo; import com.xjrsoft.module.mdm.vo.LngBBankPageVo;
import com.xjrsoft.module.mdm.vo.LngBBankVo; import com.xjrsoft.module.mdm.vo.LngBBankVo;
import com.xjrsoft.module.system.client.ICodeRuleClient;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -54,9 +59,12 @@ public class BankController {
private final IBankService bankService; private final IBankService bankService;
private final DatalogService dataService; private final DatalogService dataService;
private final ICountryRegionService regionService; private final ICodeRuleClient codeRuleClient;
private final String BANK_CODE = "bankCode";
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(value="LngBBank列表(分页)") @ApiOperation(value="LngBBank列表(分页)")
@ -110,15 +118,34 @@ public class BankController {
@ApiOperation(value = "新增LngBBank") @ApiOperation(value = "新增LngBBank")
@SaCheckPermission("bank:add") @SaCheckPermission("bank:add")
public R add(@Valid @RequestBody UpdateLngBBankDto dto){ public R add(@Valid @RequestBody UpdateLngBBankDto dto){
Long res = bankService.add(dto);
return R.ok(res); return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngBBankDto>() {
@Override
public UpdateLngBBankDto before(DataOperationContent<UpdateLngBBankDto> content) {
String code = codeRuleClient.genEncode(BANK_CODE);
dto.setCode(code);
return content.getObj();
}
@Override
public UpdateLngBBankDto after(DataOperationContent<UpdateLngBBankDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
codeRuleClient.useEncode(BANK_CODE);
return content.getObj();
}
}));
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngBBank") @ApiOperation(value = "修改LngBBank")
@SaCheckPermission("bank:edit") @SaCheckPermission("bank:edit")
public R update(@Valid @RequestBody UpdateLngBBankDto dto){ public R update(@Valid @RequestBody UpdateLngBBankDto dto){
return R.ok(bankService.update(dto)); return R.ok(dataService.updateById(dto));
} }
@DeleteMapping @DeleteMapping

View File

@ -1,9 +1,14 @@
package com.xjrsoft.module.mdm.controller; package com.xjrsoft.module.mdm.controller;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import javax.validation.Valid; import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -16,20 +21,30 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.esotericsoftware.kryo.kryo5.minlog.Log;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.enums.ValidEnum; import com.pictc.enums.ValidEnum;
import com.pictc.utils.CollectionUtils; import com.pictc.utils.CollectionUtils;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.enums.YesOrNoEnum; import com.xjrsoft.common.enums.YesOrNoEnum;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R; import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.CacheUtil;
import com.xjrsoft.common.utils.TreeUtil; import com.xjrsoft.common.utils.TreeUtil;
import com.xjrsoft.common.utils.VoToColumnUtil; import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
import com.xjrsoft.module.datalog.service.DatalogService; import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo; import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.mdm.dto.LngBRegionPageDto; import com.xjrsoft.module.mdm.dto.LngBRegionPageDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBRegionDto; import com.xjrsoft.module.mdm.dto.UpdateLngBRegionDto;
import com.xjrsoft.module.mdm.entity.LngBRegion; import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.enums.CountryRegionEnum;
import com.xjrsoft.module.mdm.service.ICountryRegionService; import com.xjrsoft.module.mdm.service.ICountryRegionService;
import com.xjrsoft.module.mdm.vo.LngBRegionPageVo; import com.xjrsoft.module.mdm.vo.LngBRegionPageVo;
import com.xjrsoft.module.mdm.vo.LngBRegionTreeVo; import com.xjrsoft.module.mdm.vo.LngBRegionTreeVo;
@ -42,6 +57,7 @@ import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import shade.powerjob.com.google.common.collect.Lists;
/** /**
* @title: 国家地区 * @title: 国家地区
@ -103,17 +119,67 @@ public class CountryRegionController {
@ApiOperation(value = "新增LngBRegion") @ApiOperation(value = "新增LngBRegion")
@SaCheckPermission("countryRegion:add") @SaCheckPermission("countryRegion:add")
public R add(@Valid @RequestBody UpdateLngBRegionDto dto){ public R add(@Valid @RequestBody UpdateLngBRegionDto dto){
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngBRegionDto>() {
@Override
public UpdateLngBRegionDto before(DataOperationContent<UpdateLngBRegionDto> content) {
if(!CountryRegionEnum.CONTINENT.getCode().equals(dto.getRegionTypeCode()) ) {
if(dto.getPid() != null && dto.getPid() != 0) {
LngBRegion parentRegion = countryRegionService.getById(dto.getPid());
if(parentRegion != null) {
dto.setFullPath(parentRegion.getFullPath()+dto.getFullName());
}
}
}else {
dto.setFullPath(dto.getFullName());
}
return content.getObj();
}
@Override
public UpdateLngBRegionDto after(DataOperationContent<UpdateLngBRegionDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
refreshCahe();
return content.getObj();
}
}));
Long res = countryRegionService.add(dto);
return R.ok(res);
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngBRegion") @ApiOperation(value = "修改LngBRegion")
@SaCheckPermission("countryRegion:edit") @SaCheckPermission("countryRegion:edit")
public R update(@Valid @RequestBody UpdateLngBRegionDto dto){ public R update(@Valid @RequestBody UpdateLngBRegionDto dto){
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngBRegionDto>() {
return R.ok(countryRegionService.update(dto)); @Override
public UpdateLngBRegionDto before(DataOperationContent<UpdateLngBRegionDto> content) {
if(!CountryRegionEnum.CONTINENT.getCode().equals(dto.getRegionTypeCode()) ) {
if(dto.getPid() != null && dto.getPid() != 0) {
LngBRegion parentRegion = countryRegionService.getById(dto.getPid());
if(parentRegion != null) {
dto.setFullPath(parentRegion.getFullPath()+dto.getFullName());
}
}
}else {
dto.setFullPath(dto.getFullName());
}
return content.getObj();
}
@Override
public UpdateLngBRegionDto after(DataOperationContent<UpdateLngBRegionDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
refreshCahe();
return content.getObj();
}
}));
} }
@DeleteMapping @DeleteMapping
@ -184,7 +250,6 @@ public class CountryRegionController {
.eq(pid != null, LngBRegion::getPid, pid) .eq(pid != null, LngBRegion::getPid, pid)
.eq(LngBRegion::getValid, ValidEnum.ENABLE.getCode()) .eq(LngBRegion::getValid, ValidEnum.ENABLE.getCode())
.in(pid == null, LngBRegion::getPid, pidList) .in(pid == null, LngBRegion::getPid, pidList)
//.ne(StrUtil.isNotBlank(excludeType), LngBRegion::getRegionTypeCode, excludeType)
.and(StrUtil.isNotBlank(keyword), x -> { .and(StrUtil.isNotBlank(keyword), x -> {
x.like(StrUtil.isNotBlank(keyword), LngBRegion::getFullName, keyword); x.like(StrUtil.isNotBlank(keyword), LngBRegion::getFullName, keyword);
})); }));
@ -209,4 +274,21 @@ public class CountryRegionController {
return R.ok(voList); return R.ok(voList);
} }
@GetMapping("/getParentByCode")
@ApiOperation(value = "根据id 查询下级区域")
public R getRegionByParentId(@RequestParam(required = true) String code,@RequestParam(required = false) String excludeType
) {
return R.ok(countryRegionService.getRegionByParentId(code,excludeType));
}
private void refreshCahe(){
//异步更新
CompletableFuture.runAsync(() -> {
CacheUtil.refreshRegionList();
});
}
} }

View File

@ -42,7 +42,7 @@ import lombok.AllArgsConstructor;
* @Version 1.0 * @Version 1.0
*/ */
@RestController @RestController
@RequestMapping("/mdm" + "/fee") @RequestMapping("/mdm/fee")
@Api(value = "/mdm" + "/fee",tags = "费用名称代码") @Api(value = "/mdm" + "/fee",tags = "费用名称代码")
@AllArgsConstructor @AllArgsConstructor
public class FeeController { public class FeeController {
@ -85,14 +85,14 @@ public class FeeController {
@ApiOperation(value = "新增LngBFee") @ApiOperation(value = "新增LngBFee")
@SaCheckPermission("fee:add") @SaCheckPermission("fee:add")
public R add(@Valid @RequestBody UpdateLngBFeeDto dto){ public R add(@Valid @RequestBody UpdateLngBFeeDto dto){
return R.ok(feeService.add(dto)); return R.ok(dataService.insert(dto));
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngBFee") @ApiOperation(value = "修改LngBFee")
@SaCheckPermission("fee:edit") @SaCheckPermission("fee:edit")
public R update(@Valid @RequestBody UpdateLngBFeeDto dto){ public R update(@Valid @RequestBody UpdateLngBFeeDto dto){
return R.ok(feeService.update(dto)); return R.ok(dataService.updateById(dto));
} }
@DeleteMapping @DeleteMapping

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.validation.Valid; import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -15,10 +16,16 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R; import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil; import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
import com.xjrsoft.module.datalog.service.DatalogService; import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo; import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.mdm.dto.LngBStationPngPageDto; import com.xjrsoft.module.mdm.dto.LngBStationPngPageDto;
@ -29,6 +36,7 @@ import com.xjrsoft.module.mdm.service.IPipeGasDownloadPointService;
import com.xjrsoft.module.mdm.service.IPipelineGgasLineService; import com.xjrsoft.module.mdm.service.IPipelineGgasLineService;
import com.xjrsoft.module.mdm.vo.LngBStationPngPageVo; import com.xjrsoft.module.mdm.vo.LngBStationPngPageVo;
import com.xjrsoft.module.mdm.vo.LngBStationPngVo; import com.xjrsoft.module.mdm.vo.LngBStationPngVo;
import com.xjrsoft.module.system.client.ICodeRuleClient;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
@ -51,10 +59,15 @@ public class PipeGasDownloadPointController {
private final IPipeGasDownloadPointService pipeGasDownloadPointService; private final IPipeGasDownloadPointService pipeGasDownloadPointService;
private final DatalogService dataService; private final DatalogService dataService;
private final IPipelineGgasLineService pipelineGgasLineService ; private final IPipelineGgasLineService pipelineGgasLineService ;
private final ICodeRuleClient codeRuleClient;
private final String PNG_DL_POINT_CODE = "pngDlPointCode";
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(value="LngBStationPng列表(分页)") @ApiOperation(value="LngBStationPng列表(分页)")
@SaCheckPermission("pipeGasDownloadPoint:list") @SaCheckPermission("pipeGasDownloadPoint:list")
@ -70,7 +83,6 @@ public class PipeGasDownloadPointController {
.like(StrUtil.isNotBlank(dto.getOwnSign()),LngBStationPng::getOwnSign,dto.getOwnSign()) .like(StrUtil.isNotBlank(dto.getOwnSign()),LngBStationPng::getOwnSign,dto.getOwnSign())
.like(StrUtil.isNotBlank(dto.getStaCodeLng()),LngBStationPng::getStaCodeLng,dto.getStaCodeLng()) .like(StrUtil.isNotBlank(dto.getStaCodeLng()),LngBStationPng::getStaCodeLng,dto.getStaCodeLng())
.like(StrUtil.isNotBlank(dto.getOwnLineSign()),LngBStationPng::getOwnLineSign,dto.getOwnLineSign()) .like(StrUtil.isNotBlank(dto.getOwnLineSign()),LngBStationPng::getOwnLineSign,dto.getOwnLineSign())
//.like(StrUtil.isNotBlank(dto.getSort()),LngBStationPng::getSort,dto.getSort())
.like(StrUtil.isNotBlank(dto.getValid()),LngBStationPng::getValid,dto.getValid()) .like(StrUtil.isNotBlank(dto.getValid()),LngBStationPng::getValid,dto.getValid())
.like(StrUtil.isNotBlank(dto.getNote()),LngBStationPng::getNote,dto.getNote()) .like(StrUtil.isNotBlank(dto.getNote()),LngBStationPng::getNote,dto.getNote())
.orderByAsc(LngBStationPng::getSort,LngBStationPng::getCode) .orderByAsc(LngBStationPng::getSort,LngBStationPng::getCode)
@ -102,14 +114,33 @@ public class PipeGasDownloadPointController {
@ApiOperation(value = "新增LngBStationPng") @ApiOperation(value = "新增LngBStationPng")
@SaCheckPermission("pipeGasDownloadPoint:add") @SaCheckPermission("pipeGasDownloadPoint:add")
public R add(@Valid @RequestBody UpdateLngBStationPngDto dto){ public R add(@Valid @RequestBody UpdateLngBStationPngDto dto){
return R.ok(pipeGasDownloadPointService.add(dto));
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngBStationPngDto>() {
@Override
public UpdateLngBStationPngDto before(DataOperationContent<UpdateLngBStationPngDto> content) {
String code = codeRuleClient.genEncode(PNG_DL_POINT_CODE);
dto.setCode(code);
return content.getObj();
}
@Override
public UpdateLngBStationPngDto after(DataOperationContent<UpdateLngBStationPngDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
codeRuleClient.useEncode(PNG_DL_POINT_CODE);
return content.getObj();
}
}));
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngBStationPng") @ApiOperation(value = "修改LngBStationPng")
@SaCheckPermission("pipeGasDownloadPoint:edit") @SaCheckPermission("pipeGasDownloadPoint:edit")
public R update(@Valid @RequestBody UpdateLngBStationPngDto dto){ public R update(@Valid @RequestBody UpdateLngBStationPngDto dto){
return R.ok(pipeGasDownloadPointService.update(dto)); return R.ok(dataService.updateById(dto));
} }
@DeleteMapping @DeleteMapping

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.validation.Valid; import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -15,10 +16,16 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R; import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil; import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
import com.xjrsoft.module.datalog.service.DatalogService; import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo; import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.mdm.dto.LngBPngLinePageDto; import com.xjrsoft.module.mdm.dto.LngBPngLinePageDto;
@ -27,6 +34,7 @@ import com.xjrsoft.module.mdm.entity.LngBPngLine;
import com.xjrsoft.module.mdm.service.IPipelineGgasLineService; import com.xjrsoft.module.mdm.service.IPipelineGgasLineService;
import com.xjrsoft.module.mdm.vo.LngBPngLinePageVo; import com.xjrsoft.module.mdm.vo.LngBPngLinePageVo;
import com.xjrsoft.module.mdm.vo.LngBPngLineVo; import com.xjrsoft.module.mdm.vo.LngBPngLineVo;
import com.xjrsoft.module.system.client.ICodeRuleClient;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
@ -49,7 +57,12 @@ public class PipelineGgasLineController {
private final IPipelineGgasLineService pipelineGgasLineService; private final IPipelineGgasLineService pipelineGgasLineService;
private final DatalogService dataService;
private final DatalogService dataService;
private final ICodeRuleClient codeRuleClient;
private final String PNG_LINE_CODE = "pngLineCode";
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(value="LngBPngLine列表(分页)") @ApiOperation(value="LngBPngLine列表(分页)")
@ -88,14 +101,33 @@ public class PipelineGgasLineController {
@ApiOperation(value = "新增LngBPngLine") @ApiOperation(value = "新增LngBPngLine")
@SaCheckPermission("pipelineGgasLine:add") @SaCheckPermission("pipelineGgasLine:add")
public R add(@Valid @RequestBody UpdateLngBPngLineDto dto){ public R add(@Valid @RequestBody UpdateLngBPngLineDto dto){
return R.ok(pipelineGgasLineService.add(dto));
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngBPngLineDto>() {
@Override
public UpdateLngBPngLineDto before(DataOperationContent<UpdateLngBPngLineDto> content) {
String code = codeRuleClient.genEncode(PNG_LINE_CODE);
dto.setCode(code);
return content.getObj();
}
@Override
public UpdateLngBPngLineDto after(DataOperationContent<UpdateLngBPngLineDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
codeRuleClient.useEncode(PNG_LINE_CODE);
return content.getObj();
}
}));
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngBPngLine") @ApiOperation(value = "修改LngBPngLine")
@SaCheckPermission("pipelineGgasLine:edit") @SaCheckPermission("pipelineGgasLine:edit")
public R update(@Valid @RequestBody UpdateLngBPngLineDto dto){ public R update(@Valid @RequestBody UpdateLngBPngLineDto dto){
return R.ok(pipelineGgasLineService.update(dto)); return R.ok(dataService.updateById(dto));
} }
@DeleteMapping @DeleteMapping

View File

@ -87,14 +87,14 @@ public class TaxRateController {
@ApiOperation(value = "新增LngBTax") @ApiOperation(value = "新增LngBTax")
@SaCheckPermission("taxRate:add") @SaCheckPermission("taxRate:add")
public R add(@Valid @RequestBody UpdateLngBTaxDto dto){ public R add(@Valid @RequestBody UpdateLngBTaxDto dto){
return R.ok(taxRateService.add(dto)); return R.ok(dataService.insert(dto));
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngBTax") @ApiOperation(value = "修改LngBTax")
@SaCheckPermission("taxRate:edit") @SaCheckPermission("taxRate:edit")
public R update(@Valid @RequestBody UpdateLngBTaxDto dto){ public R update(@Valid @RequestBody UpdateLngBTaxDto dto){
return R.ok(taxRateService.update(dto)); return R.ok(dataService.updateById(dto));
} }
@DeleteMapping @DeleteMapping
@ -117,7 +117,7 @@ public class TaxRateController {
@ApiOperation(value = "启用") @ApiOperation(value = "启用")
@SaCheckPermission("taxRate:enable") @SaCheckPermission("taxRate:enable")
public R enable(@Valid @RequestBody List<Long> ids){ public R enable(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.enable(UpdateLngBTaxDto.class,ids)); return R.ok(dataService.enable(UpdateLngBTaxDto.class,ids));
} }
@ -125,7 +125,7 @@ public class TaxRateController {
@ApiOperation(value = "禁用") @ApiOperation(value = "禁用")
@SaCheckPermission("taxRate:disable") @SaCheckPermission("taxRate:disable")
public R disable(@Valid @RequestBody List<Long> ids){ public R disable(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.disable(UpdateLngBTaxDto.class,ids)); return R.ok(dataService.disable(UpdateLngBTaxDto.class,ids));
} }
} }

View File

@ -1,9 +1,6 @@
package com.xjrsoft.module.mdm.service; package com.xjrsoft.module.mdm.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.entity.LngBBank; import com.xjrsoft.module.mdm.entity.LngBBank;
/** /**
@ -15,11 +12,5 @@ import com.xjrsoft.module.mdm.entity.LngBBank;
public interface IBankService extends IService<LngBBank> { public interface IBankService extends IService<LngBBank> {
Long add(UpdateLngBBankDto dto);
boolean enable(List<Long> ids);
boolean disable(List<Long> ids);
Long update(UpdateLngBBankDto dto);
} }

View File

@ -1,11 +1,8 @@
package com.xjrsoft.module.mdm.service; package com.xjrsoft.module.mdm.service;
import java.util.List; import java.util.Map;
import javax.validation.Valid;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xjrsoft.module.mdm.dto.UpdateLngBRegionDto;
import com.xjrsoft.module.mdm.entity.LngBRegion; import com.xjrsoft.module.mdm.entity.LngBRegion;
/** /**
@ -17,11 +14,7 @@ import com.xjrsoft.module.mdm.entity.LngBRegion;
public interface ICountryRegionService extends IService<LngBRegion> { public interface ICountryRegionService extends IService<LngBRegion> {
Long add(UpdateLngBRegionDto dto);
boolean enable(List<Long> ids); Map<String, Object> getRegionByParentId(String code, String excludeType);
boolean disable(List<Long> ids);
Long update(UpdateLngBRegionDto dto);
} }

View File

@ -1,9 +1,6 @@
package com.xjrsoft.module.mdm.service; package com.xjrsoft.module.mdm.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xjrsoft.module.mdm.dto.UpdateLngBFeeDto;
import com.xjrsoft.module.mdm.entity.LngBFee; import com.xjrsoft.module.mdm.entity.LngBFee;
/** /**
@ -15,11 +12,4 @@ import com.xjrsoft.module.mdm.entity.LngBFee;
public interface IFeeService extends IService<LngBFee> { public interface IFeeService extends IService<LngBFee> {
Boolean enable(List<Long> ids);
Boolean disable(List<Long> ids);
Long update(UpdateLngBFeeDto dto);
Long add(UpdateLngBFeeDto dto);
} }

View File

@ -1,9 +1,6 @@
package com.xjrsoft.module.mdm.service; package com.xjrsoft.module.mdm.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xjrsoft.module.mdm.dto.UpdateLngBStationPngDto;
import com.xjrsoft.module.mdm.entity.LngBStationPng; import com.xjrsoft.module.mdm.entity.LngBStationPng;
/** /**
@ -15,11 +12,6 @@ import com.xjrsoft.module.mdm.entity.LngBStationPng;
public interface IPipeGasDownloadPointService extends IService<LngBStationPng> { public interface IPipeGasDownloadPointService extends IService<LngBStationPng> {
Boolean enable(List<Long> ids);
Boolean disable(List<Long> ids);
Long add(UpdateLngBStationPngDto dto);
Long update(UpdateLngBStationPngDto dto);
} }

View File

@ -1,9 +1,6 @@
package com.xjrsoft.module.mdm.service; package com.xjrsoft.module.mdm.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xjrsoft.module.mdm.dto.UpdateLngBPngLineDto;
import com.xjrsoft.module.mdm.entity.LngBPngLine; import com.xjrsoft.module.mdm.entity.LngBPngLine;
/** /**
@ -15,13 +12,6 @@ import com.xjrsoft.module.mdm.entity.LngBPngLine;
public interface IPipelineGgasLineService extends IService<LngBPngLine> { public interface IPipelineGgasLineService extends IService<LngBPngLine> {
Boolean disable(List<Long> ids);
Boolean enable(List<Long> ids);
Long add(UpdateLngBPngLineDto dto);
Long update(UpdateLngBPngLineDto dto);
LngBPngLine getByCode(String code); LngBPngLine getByCode(String code);
} }

View File

@ -1,9 +1,6 @@
package com.xjrsoft.module.mdm.service; package com.xjrsoft.module.mdm.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xjrsoft.module.mdm.dto.UpdateLngBTaxDto;
import com.xjrsoft.module.mdm.entity.LngBTax; import com.xjrsoft.module.mdm.entity.LngBTax;
/** /**
@ -15,11 +12,5 @@ import com.xjrsoft.module.mdm.entity.LngBTax;
public interface ITaxRateService extends IService<LngBTax> { public interface ITaxRateService extends IService<LngBTax> {
Long add(UpdateLngBTaxDto dto);
Long update(UpdateLngBTaxDto dto);
Boolean enable(List<Long> ids);
Boolean disable(List<Long> ids);
} }

View File

@ -1,25 +1,11 @@
package com.xjrsoft.module.mdm.service.impl; package com.xjrsoft.module.mdm.service.impl;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pictc.constant.FieldNameConstants;
import com.pictc.constant.TableNameConstants;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.utils.DataLogTools;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.entity.LngBBank; import com.xjrsoft.module.mdm.entity.LngBBank;
import com.xjrsoft.module.mdm.mapper.LngBBankMapper; import com.xjrsoft.module.mdm.mapper.LngBBankMapper;
import com.xjrsoft.module.mdm.service.IBankService; import com.xjrsoft.module.mdm.service.IBankService;
import com.xjrsoft.module.system.client.ICodeRuleClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -33,88 +19,5 @@ import lombok.AllArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class BankServiceImpl extends ServiceImpl<LngBBankMapper, LngBBank> implements IBankService { public class BankServiceImpl extends ServiceImpl<LngBBankMapper, LngBBank> implements IBankService {
private final CommonCallService commonCallService;
private final ICodeRuleClient codeRuleClient;
private final String BANK_CODE = "bankCode";
@Override
@Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBBankDto dto) {
String code = codeRuleClient.genEncode(BANK_CODE);
dto.setCode(code);
this.checkParams(dto);
UpdateLngBBankDto res = DataLogTools.insert(dto);
codeRuleClient.useEncode(BANK_CODE);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long update(UpdateLngBBankDto dto) {
this.checkParams(dto);
UpdateLngBBankDto res = DataLogTools.update(dto);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean enable(List<Long> ids) {
DataLogTools.enable(UpdateLngBBankDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_BANK, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean disable(List<Long> ids) {
DataLogTools.disable(UpdateLngBBankDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_BANK, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
private void checkParams(UpdateLngBBankDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBBank>()
.eq(LngBBank::getCode, dto.getCode()).ne(dto.getId() != null, LngBBank::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long shortNameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBBank>()
.eq(LngBBank::getShortName, dto.getShortName()).ne(dto.getId() != null, LngBBank::getId, dto.getId()));
if (shortNameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.SHORT_NAME));
}
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBBank>()
.eq(LngBBank::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBBank::getId, dto.getId()));
if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME));
}
}
private void addOrUpdateAfter(Long id) {
String msg = commonCallService.saveAfter(TableNameConstants.LNG_B_BANK, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
} }

View File

@ -1,30 +1,29 @@
package com.xjrsoft.module.mdm.service.impl; package com.xjrsoft.module.mdm.service.impl;
import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pictc.constant.FieldNameConstants; import com.pictc.utils.CollectionUtils;
import com.pictc.constant.TableNameConstants; import com.xjrsoft.common.constant.GlobalConstant;
import com.pictc.enums.BusinessCode; import com.xjrsoft.common.utils.TreeUtil;
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;
import com.xjrsoft.module.mdm.entity.LngBRegion; import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.enums.CountryRegionEnum; import com.xjrsoft.module.mdm.enums.CountryRegionEnum;
import com.xjrsoft.module.mdm.mapper.LngBRegionMapper; import com.xjrsoft.module.mdm.mapper.LngBRegionMapper;
import com.xjrsoft.module.mdm.service.ICountryRegionService; import com.xjrsoft.module.mdm.service.ICountryRegionService;
import com.xjrsoft.module.mdm.vo.LngBRegionTreeVo;
import cn.hutool.core.bean.BeanUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import shade.powerjob.com.google.common.collect.Lists;
/** /**
* @title: service * @title: service
@ -36,112 +35,64 @@ import lombok.AllArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngBRegion> implements ICountryRegionService { public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngBRegion> implements ICountryRegionService {
private final CommonCallService commonCallService;
private final DatalogService dataService;
@Override @Override
@Transactional(rollbackFor = Exception.class) public Map<String, Object> getRegionByParentId(String code,String excludeType) {
public Long add(UpdateLngBRegionDto dto) { Map<String,Object> result = new HashMap<>();
if(!CountryRegionEnum.CONTINENT.getCode().equals(dto.getRegionTypeCode()) ) { LambdaQueryWrapper<LngBRegion> queryWrapper = new LambdaQueryWrapper<LngBRegion>();
if(dto.getPid() != null && dto.getPid() != 0) { queryWrapper.eq(LngBRegion::getCode,code);
LngBRegion parentRegion = this.getById(dto.getPid()); LngBRegion temp = this.getOne(queryWrapper);
if(parentRegion != null) { if(temp == null) {
dto.setFullPath(parentRegion.getFullPath()+dto.getFullName()); return result;
} }
} List<String> codeList = CollectionUtils.newArrayList();
}else {
dto.setFullPath(dto.getFullName());
}
this.checkParams(dto);
UpdateLngBRegionDto res = DataLogTools.insert(dto);
this.addOrUpdateAfter(res.getId());
refreshCahe();
return res.getId();
}
@Override List<LngBRegion> allList = this.list(Wrappers.<LngBRegion>query()
@Transactional(rollbackFor = Exception.class) .lambda().ne(StringUtils.isNotBlank(excludeType),LngBRegion::getRegionTypeCode, excludeType));
public boolean enable(List<Long> ids) { Map<Long,LngBRegion> map = allList.stream().collect(Collectors.toMap(LngBRegion::getId,
dataService.enable(UpdateLngBRegionDto.class,ids); obj -> obj));
for (Long id : ids) { if(map != null) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_REGION, id); codeList.add(code);
if (StringUtils.isNotBlank(msg)) { while(temp != null && temp.getPid() != null && !CountryRegionEnum.CONTINENT.getCode().equals(temp.getRegionTypeCode())) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg)); temp = map.get(temp.getPid());
} if(temp != null) {
} codeList.add(temp.getCode());
refreshCahe(); }
return true; }
} }
List<LngBRegionTreeVo> voList = CollectionUtils.newArrayList();
if(allList != null && allList.size() > 0) {
for(LngBRegion br:allList) {
LngBRegionTreeVo vo = new LngBRegionTreeVo();
BeanUtil.copyProperties(br, vo);
if(br.getPid() != null) {
@Override vo.setParentId(String.valueOf(br.getPid()) );
@Transactional(rollbackFor = Exception.class) }else {
public boolean disable(List<Long> ids) { vo.setParentId(String.valueOf(GlobalConstant.FIRST_NODE_VALUE));
dataService.disable(UpdateLngBRegionDto.class,ids); }
for (Long id : ids) { voList.add(vo);
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_REGION, id); }
if (StringUtils.isNotBlank(msg)) { }
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg)); List<LngBRegionTreeVo> treeVoList = TreeUtil.build(voList);
} filterNode(treeVoList,codeList);
} result.put("areaList", treeVoList);
refreshCahe(); Collections.reverse(codeList);
return true; result.put("regionCode", codeList);
} return result;
@Override
@Transactional(rollbackFor = Exception.class)
public Long update(UpdateLngBRegionDto dto) {
if(!CountryRegionEnum.CONTINENT.getCode().equals(dto.getRegionTypeCode()) ) {
if(dto.getPid() != null && dto.getPid() != 0) {
LngBRegion parentRegion = this.getById(dto.getPid());
if(parentRegion != null) {
dto.setFullPath(parentRegion.getFullPath()+dto.getFullName());
}
}
}else {
dto.setFullPath(dto.getFullName());
}
this.checkParams(dto);
UpdateLngBRegionDto res = DataLogTools.update(dto);
this.addOrUpdateAfter(res.getId());
refreshCahe();
return res.getId();
} }
private void checkParams(UpdateLngBRegionDto dto) { private void filterNode(List<LngBRegionTreeVo> treeVoList,List<String> codeList) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>() for(LngBRegionTreeVo tree:treeVoList) {
.eq(LngBRegion::getCode, dto.getCode()).ne(dto.getId() != null, LngBRegion::getId, dto.getId())); if( tree.getChildren() != null && tree.getChildren().size() > 0 ) {
if (codeCount > 0) { tree.setIsLeaf(false);
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION, if( !codeList.contains(tree.getCode())){
FieldNameConstants.CODE)); tree.setChildren(Lists.newArrayList());
} }
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>() filterNode(tree.getChildren(),codeList);
.eq(LngBRegion::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBRegion::getId, dto.getId())); }else {
if (nameCount > 0) { tree.setIsLeaf(true);
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION, }
FieldNameConstants.FULL_NAME)); }
} }
}
private void addOrUpdateAfter(Long id) {
String msg = commonCallService.saveAfter(TableNameConstants.LNG_B_REGION, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
private void refreshCahe(){
//异步更新
CompletableFuture.runAsync(() -> {
CacheUtil.refreshRegionList();
});
}
} }

View File

@ -1,22 +1,8 @@
package com.xjrsoft.module.mdm.service.impl; package com.xjrsoft.module.mdm.service.impl;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pictc.constant.FieldNameConstants;
import com.pictc.constant.TableNameConstants;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.utils.DataLogTools;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.module.common.db.service.CommonCallService;
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.entity.LngBFee;
import com.xjrsoft.module.mdm.mapper.LngBFeeMapper; import com.xjrsoft.module.mdm.mapper.LngBFeeMapper;
import com.xjrsoft.module.mdm.service.IFeeService; import com.xjrsoft.module.mdm.service.IFeeService;
@ -33,75 +19,6 @@ import lombok.AllArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class FeeServiceImpl extends ServiceImpl<LngBFeeMapper, LngBFee> implements IFeeService { public class FeeServiceImpl extends ServiceImpl<LngBFeeMapper, LngBFee> implements IFeeService {
private final CommonCallService commonCallService;
@Override
@Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBFeeDto dto) {
this.checkParams(dto);
UpdateLngBFeeDto res = DataLogTools.insert(dto);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long update(UpdateLngBFeeDto dto) {
this.checkParams(dto);
UpdateLngBFeeDto res = DataLogTools.update(dto);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean enable(List<Long> ids) {
DataLogTools.enable(UpdateLngBBankDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_FEE, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean disable(List<Long> ids) {
DataLogTools.disable(UpdateLngBBankDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_FEE, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
private void checkParams(UpdateLngBFeeDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBFee>()
.eq(LngBFee::getCode, dto.getCode()).ne(dto.getId() != null, LngBFee::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBFee>()
.eq(LngBFee::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBFee::getId, dto.getId()));
if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME));
}
}
private void addOrUpdateAfter(Long id) {
String msg = commonCallService.saveAfter(TableNameConstants.LNG_B_FEE, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
} }

View File

@ -1,25 +1,11 @@
package com.xjrsoft.module.mdm.service.impl; package com.xjrsoft.module.mdm.service.impl;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pictc.constant.FieldNameConstants;
import com.pictc.constant.TableNameConstants;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.utils.DataLogTools;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.mdm.dto.UpdateLngBStationPngDto;
import com.xjrsoft.module.mdm.entity.LngBStationPng; import com.xjrsoft.module.mdm.entity.LngBStationPng;
import com.xjrsoft.module.mdm.mapper.LngBStationPngMapper; import com.xjrsoft.module.mdm.mapper.LngBStationPngMapper;
import com.xjrsoft.module.mdm.service.IPipeGasDownloadPointService; import com.xjrsoft.module.mdm.service.IPipeGasDownloadPointService;
import com.xjrsoft.module.system.client.ICodeRuleClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -33,83 +19,9 @@ import lombok.AllArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class PipeGasDownloadPointServiceImpl extends ServiceImpl<LngBStationPngMapper, LngBStationPng> implements IPipeGasDownloadPointService { public class PipeGasDownloadPointServiceImpl extends ServiceImpl<LngBStationPngMapper, LngBStationPng> implements IPipeGasDownloadPointService {
private final CommonCallService commonCallService;
private final ICodeRuleClient codeRuleClient;
private final String PNG_DL_POINT_CODE = "pngDlPointCode";
@Override
@Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBStationPngDto dto) {
String code = codeRuleClient.genEncode(PNG_DL_POINT_CODE);
dto.setCode(code);
this.checkParams(dto);
UpdateLngBStationPngDto res = DataLogTools.insert(dto);
codeRuleClient.useEncode(PNG_DL_POINT_CODE);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long update(UpdateLngBStationPngDto dto) {
this.checkParams(dto);
UpdateLngBStationPngDto res = DataLogTools.update(dto);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean enable(List<Long> ids) {
DataLogTools.enable(UpdateLngBStationPngDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_STATION_PNG, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean disable(List<Long> ids) {
DataLogTools.disable(UpdateLngBStationPngDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_STATION_PNG, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
private void checkParams(UpdateLngBStationPngDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBStationPng>()
.eq(LngBStationPng::getCode, dto.getCode()).ne(dto.getId() != null, LngBStationPng::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBStationPng>()
.eq(LngBStationPng::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBStationPng::getId, dto.getId()));
if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME));
}
}
private void addOrUpdateAfter(Long id) {
String msg = commonCallService.saveAfter(TableNameConstants.LNG_B_STATION_PNG, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
} }

View File

@ -34,46 +34,6 @@ import lombok.AllArgsConstructor;
public class PipelineGgasLineServiceImpl extends ServiceImpl<LngBPngLineMapper, LngBPngLine> implements IPipelineGgasLineService { public class PipelineGgasLineServiceImpl extends ServiceImpl<LngBPngLineMapper, LngBPngLine> implements IPipelineGgasLineService {
private final CommonCallService commonCallService;
private final ICodeRuleClient codeRuleClient;
private final String PNG_LINE_CODE = "pngLineCode";
@Override
@Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBPngLineDto dto) {
String code = codeRuleClient.genEncode(PNG_LINE_CODE);
dto.setCode(code);
this.checkParams(dto);
UpdateLngBPngLineDto res = DataLogTools.insert(dto);
codeRuleClient.useEncode(PNG_LINE_CODE);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long update(UpdateLngBPngLineDto dto) {
this.checkParams(dto);
UpdateLngBPngLineDto res = DataLogTools.update(dto);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean enable(List<Long> ids) {
DataLogTools.enable(UpdateLngBPngLineDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_PNG_LINE, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
@Override @Override
public LngBPngLine getByCode(String code) { public LngBPngLine getByCode(String code) {
LngBPngLine bl = this.baseMapper.selectOne(new LambdaQueryWrapper<LngBPngLine>() LngBPngLine bl = this.baseMapper.selectOne(new LambdaQueryWrapper<LngBPngLine>()
@ -82,42 +42,6 @@ public class PipelineGgasLineServiceImpl extends ServiceImpl<LngBPngLineMapper,
} }
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean disable(List<Long> ids) {
DataLogTools.disable(UpdateLngBPngLineDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_PNG_LINE, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
private void checkParams(UpdateLngBPngLineDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBPngLine>()
.eq(LngBPngLine::getCode, dto.getCode()).ne(dto.getId() != null, LngBPngLine::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBPngLine>()
.eq(LngBPngLine::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBPngLine::getId, dto.getId()));
if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME));
}
}
private void addOrUpdateAfter(Long id) {
String msg = commonCallService.saveAfter(TableNameConstants.LNG_B_PNG_LINE, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
} }

View File

@ -1,22 +1,8 @@
package com.xjrsoft.module.mdm.service.impl; package com.xjrsoft.module.mdm.service.impl;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pictc.constant.FieldNameConstants;
import com.pictc.constant.TableNameConstants;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.utils.DataLogTools;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBTaxDto;
import com.xjrsoft.module.mdm.entity.LngBTax; import com.xjrsoft.module.mdm.entity.LngBTax;
import com.xjrsoft.module.mdm.mapper.LngBTaxMapper; import com.xjrsoft.module.mdm.mapper.LngBTaxMapper;
import com.xjrsoft.module.mdm.service.ITaxRateService; import com.xjrsoft.module.mdm.service.ITaxRateService;
@ -33,74 +19,5 @@ import lombok.AllArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class TaxRateServiceImpl extends ServiceImpl<LngBTaxMapper, LngBTax> implements ITaxRateService { public class TaxRateServiceImpl extends ServiceImpl<LngBTaxMapper, LngBTax> implements ITaxRateService {
private final CommonCallService commonCallService;
@Override
@Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBTaxDto dto) {
this.checkParams(dto);
UpdateLngBTaxDto res = DataLogTools.insert(dto);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long update(UpdateLngBTaxDto dto) {
this.checkParams(dto);
UpdateLngBTaxDto res = DataLogTools.update(dto);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean enable(List<Long> ids) {
DataLogTools.enable(UpdateLngBTaxDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_TAX, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean disable(List<Long> ids) {
DataLogTools.disable(UpdateLngBBankDto.class,ids);
for (Long id : ids) {
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_TAX, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
private void checkParams(UpdateLngBTaxDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBTax>()
.eq(LngBTax::getCode, dto.getCode()).ne(dto.getId() != null, LngBTax::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBTax>()
.eq(LngBTax::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBTax::getId, dto.getId()));
if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME));
}
}
private void addOrUpdateAfter(Long id) {
String msg = commonCallService.saveAfter(TableNameConstants.LNG_B_TAX, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
} }

View File

@ -7,7 +7,7 @@ spring:
main: main:
allow-bean-definition-overriding: true allow-bean-definition-overriding: true
profiles: profiles:
active: dev active: remote
cloud: cloud:
nacos: #nacos监控 nacos: #nacos监控
config: config: