银行
This commit is contained in:
@ -107,7 +107,7 @@ public class BankController {
|
||||
@ApiOperation(value = "修改LngBBank")
|
||||
@SaCheckPermission("bank:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngBBankDto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
return R.ok(bankService.update(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
|
||||
@ -102,16 +102,7 @@ public class CountryRegionController {
|
||||
@ApiOperation(value = "新增LngBRegion")
|
||||
@SaCheckPermission("countryRegion:add")
|
||||
public R add(@Valid @RequestBody UpdateLngBRegionDto dto){
|
||||
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());
|
||||
}
|
||||
|
||||
Long res = countryRegionService.add(dto);
|
||||
return R.ok(res);
|
||||
}
|
||||
@ -120,17 +111,8 @@ public class CountryRegionController {
|
||||
@ApiOperation(value = "修改LngBRegion")
|
||||
@SaCheckPermission("countryRegion:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngBRegionDto dto){
|
||||
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 R.ok(dataService.updateById(dto));
|
||||
|
||||
return R.ok(countryRegionService.update(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
|
||||
@ -20,4 +20,6 @@ public interface IBankService extends IService<LngBBank> {
|
||||
boolean enable(List<Long> ids);
|
||||
|
||||
boolean disable(List<Long> ids);
|
||||
|
||||
Long update(UpdateLngBBankDto dto);
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@ package com.xjrsoft.module.mdm.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBRegionDto;
|
||||
import com.xjrsoft.module.mdm.entity.LngBRegion;
|
||||
@ -20,4 +22,6 @@ public interface ICountryRegionService extends IService<LngBRegion> {
|
||||
boolean enable(List<Long> ids);
|
||||
|
||||
boolean disable(List<Long> ids);
|
||||
|
||||
Long update(UpdateLngBRegionDto dto);
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import com.xjrsoft.module.common.db.service.CommonCallService;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
|
||||
import com.xjrsoft.module.mdm.entity.LngBBank;
|
||||
import com.xjrsoft.module.mdm.entity.LngBRegion;
|
||||
import com.xjrsoft.module.mdm.mapper.LngBBankMapper;
|
||||
import com.xjrsoft.module.mdm.service.IBankService;
|
||||
import com.xjrsoft.module.system.client.ICodeRuleClient;
|
||||
@ -50,6 +51,15 @@ public class BankServiceImpl extends ServiceImpl<LngBBankMapper, LngBBank> imple
|
||||
//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
|
||||
public boolean enable(List<Long> ids) {
|
||||
@ -59,18 +69,18 @@ public class BankServiceImpl extends ServiceImpl<LngBBankMapper, LngBBank> imple
|
||||
|
||||
@Override
|
||||
public boolean disable(List<Long> ids) {
|
||||
return dataService.disable(UpdateLngBBankDto.class,ids);
|
||||
return dataService.disable(UpdateLngBBankDto.class,ids);
|
||||
}
|
||||
|
||||
private void checkParams(UpdateLngBBankDto dto) {
|
||||
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBBank>()
|
||||
.eq(LngBBank::getCode, dto.getCode()));
|
||||
.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 nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBBank>()
|
||||
.eq(LngBBank::getFullName, dto.getFullName()));
|
||||
.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));
|
||||
|
||||
@ -18,6 +18,7 @@ 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.enums.CountryRegionEnum;
|
||||
import com.xjrsoft.module.mdm.mapper.LngBRegionMapper;
|
||||
import com.xjrsoft.module.mdm.service.ICountryRegionService;
|
||||
|
||||
@ -40,6 +41,16 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long add(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.insert(dto);
|
||||
//this.addOrUpdateAfter(res.getId());
|
||||
@ -54,29 +65,49 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
|
||||
|
||||
@Override
|
||||
public boolean disable(List<Long> ids) {
|
||||
return dataService.disable(UpdateLngBRegionDto.class,ids);
|
||||
return dataService.disable(UpdateLngBRegionDto.class,ids);
|
||||
}
|
||||
|
||||
private void checkParams(UpdateLngBRegionDto dto) {
|
||||
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>()
|
||||
.eq(LngBRegion::getCode, dto.getCode()));
|
||||
if (codeCount > 0) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
|
||||
FieldNameConstants.CODE));
|
||||
}
|
||||
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>()
|
||||
.eq(LngBRegion::getFullName, dto.getFullName()));
|
||||
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_REGION, id);
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
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());
|
||||
return res.getId();
|
||||
}
|
||||
|
||||
private void checkParams(UpdateLngBRegionDto dto) {
|
||||
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>()
|
||||
.eq(LngBRegion::getCode, dto.getCode()).ne(dto.getId() != null, LngBRegion::getId, dto.getId()));
|
||||
if (codeCount > 0) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
|
||||
FieldNameConstants.CODE));
|
||||
}
|
||||
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>()
|
||||
.eq(LngBRegion::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBRegion::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_REGION, id);
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user