This commit is contained in:
2025-10-23 10:32:52 +08:00
13 changed files with 240 additions and 132 deletions

View File

@ -16,6 +16,9 @@ public interface FieldNameConstants {
* 名称
*/
String FULL_NAME = "名称";
/**
* 本币
*/
String LOCAL_SIGN = "本币";
}

View File

@ -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

View File

@ -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

View File

@ -12,18 +12,19 @@ import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.mdm.dto.AddLngBCurrencyDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBCurrencyDto;
import com.xjrsoft.module.mdm.dto.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.xjrsoft.module.mdm.dto.LngBCurrencyPageDto;
import com.xjrsoft.module.mdm.entity.LngBCurrency;
import com.xjrsoft.module.mdm.entity.LngBPriceTerm;
import com.xjrsoft.module.mdm.service.ICurrencyService;
import com.xjrsoft.module.mdm.vo.LngBCurrencyPageVo;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.datalog.entity.DataChangeLog;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.vo.LngBCurrencyVo;
import com.xjrsoft.module.mdm.vo.LngBPriceTermPageVo;
import com.xjrsoft.module.mdm.vo.LngBPriceTermVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -53,15 +54,14 @@ public class CurrencyController {
@ApiOperation(value="LngBCurrency列表(分页)")
@SaCheckPermission("currency:list")
public R page(@Valid LngBCurrencyPageDto dto){
LambdaQueryWrapper<LngBCurrency> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper
.like(StrUtil.isNotBlank(dto.getFullName()),LngBCurrency::getFullName,dto.getFullName())
.like(StrUtil.isNotBlank(dto.getValid()),LngBCurrency::getValid,dto.getValid())
.like(StrUtil.isNotBlank(dto.getCode()),LngBCurrency::getCode,dto.getCode())
.like(StrUtil.isNotBlank(dto.getLocalSign()),LngBCurrency::getLocalSign,dto.getLocalSign())
.like(StrUtil.isNotBlank(dto.getNote()),LngBCurrency::getNote,dto.getNote())
.orderByDesc(LngBCurrency::getId)
.and(StrUtil.isNotBlank(dto.getFullName()), r ->
r.like(LngBCurrency::getCode, dto.getFullName())
.or()
.like(LngBCurrency::getFullName, dto.getFullName()))
.eq(StrUtil.isNotBlank(dto.getValid()),LngBCurrency::getValid,dto.getValid())
.orderByAsc(LngBCurrency::getSort, LngBCurrency::getCode)
.select(LngBCurrency.class,x -> VoToColumnUtil.fieldsToColumns(LngBCurrencyPageVo.class).contains(x.getProperty()));
IPage<LngBCurrency> page = currencyService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngBCurrencyPageVo> pageOutput = ConventPage.getPageOutput(page, LngBCurrencyPageVo.class);
@ -78,29 +78,19 @@ public class CurrencyController {
}
return R.ok(BeanUtil.toBean(lngBCurrency, LngBCurrencyVo.class));
}
@GetMapping(value = "/datalog")
@ApiOperation(value="根据id查询LngBCurrency数据详细日志")
@SaCheckPermission("currency:datalog")
public R datalog(@RequestParam Long id){
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngBCurrencyDto.class,id);
return R.ok(logs);
}
@PostMapping
@ApiOperation(value = "新增LngBCurrency")
@SaCheckPermission("currency:add")
public R add(@Valid @RequestBody UpdateLngBCurrencyDto dto){
UpdateLngBCurrencyDto res = dataService.insert(dto);
return R.ok(res.getId());
return R.ok(currencyService.add(dto));
}
@PutMapping
@ApiOperation(value = "修改LngBCurrency")
@SaCheckPermission("currency:edit")
public R update(@Valid @RequestBody UpdateLngBCurrencyDto dto){
return R.ok(dataService.updateById(dto));
return R.ok(currencyService.updateByDTO(dto));
}
@DeleteMapping
@ -110,6 +100,18 @@ public class CurrencyController {
return R.ok(dataService.deleteByIds(UpdateLngBCurrencyDto.class, ids));
}
@PostMapping("/enable")
@ApiOperation(value = "启用LngBCurrency")
@SaCheckPermission("currency:enable")
public R enable(@Valid @RequestBody List<Long> ids){
return R.ok(currencyService.enable(ids));
}
@PostMapping("/disable")
@ApiOperation(value = "禁用LngBCurrency")
@SaCheckPermission("currency:disable")
public R disable(@Valid @RequestBody List<Long> ids){
return R.ok(currencyService.disable(ids));
}
}

View File

@ -1,30 +1,20 @@
package com.xjrsoft.module.mdm.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.pictc.utils.DataLogTools;
import com.xjrsoft.common.constant.GlobalConstant;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.mdm.dto.AddLngBPriceTermDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBCurrencyDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBPriceTermDto;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.dto.LngBPriceTermPageDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBPriceTermDto;
import com.xjrsoft.module.mdm.entity.LngBPriceTerm;
import com.xjrsoft.module.mdm.service.IPriceTermsService;
import com.xjrsoft.module.mdm.vo.LngBPriceTermPageVo;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.vo.LngBPriceTermVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -32,7 +22,6 @@ import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
@ -55,7 +44,6 @@ public class PriceTermsController {
@ApiOperation(value="LngBPriceTerm列表(分页)")
@SaCheckPermission("priceTerms:list")
public R page(@Valid LngBPriceTermPageDto dto){
LambdaQueryWrapper<LngBPriceTerm> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper
.and(StrUtil.isNotBlank(dto.getFullName()), r ->
@ -81,7 +69,6 @@ public class PriceTermsController {
return R.ok(BeanUtil.toBean(lngBPriceTerm, LngBPriceTermVo.class));
}
@PostMapping
@ApiOperation(value = "新增LngBPriceTerm")
@SaCheckPermission("priceTerms:add")
@ -104,16 +91,16 @@ public class PriceTermsController {
}
@PostMapping("/enable")
@ApiOperation(value = "启用")
@ApiOperation(value = "启用LngBPriceTerm")
@SaCheckPermission("priceTerms:enable")
public R enable(@Valid @RequestParam Long id){
return R.ok(priceTermsService.enable(id));
public R enable(@Valid @RequestBody List<Long> ids){
return R.ok(priceTermsService.enable(ids));
}
@PostMapping("/disable")
@ApiOperation(value = "停用")
@ApiOperation(value = "禁用LngBPriceTerm")
@SaCheckPermission("priceTerms:disable")
public R disable(@Valid @RequestParam Long id){
return R.ok(priceTermsService.disable(id));
public R disable(@Valid @RequestBody List<Long> ids){
return R.ok(priceTermsService.disable(ids));
}
}

View File

@ -20,4 +20,6 @@ public interface IBankService extends IService<LngBBank> {
boolean enable(List<Long> ids);
boolean disable(List<Long> ids);
Long update(UpdateLngBBankDto dto);
}

View File

@ -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);
}

View File

@ -1,11 +1,10 @@
package com.xjrsoft.module.mdm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.yulichang.base.MPJBaseService;
import com.github.yulichang.extension.mapping.base.MPJDeepService;
import com.github.yulichang.extension.mapping.base.MPJRelationService;
import com.xjrsoft.module.mdm.dto.UpdateLngBCurrencyDto;
import com.xjrsoft.module.mdm.entity.LngBCurrency;
import lombok.Data;
import javax.validation.Valid;
import java.util.List;
/**
@ -16,4 +15,11 @@ import java.util.List;
*/
public interface ICurrencyService extends IService<LngBCurrency> {
Long add(@Valid UpdateLngBCurrencyDto dto);
boolean updateByDTO(@Valid UpdateLngBCurrencyDto dto);
boolean enable(@Valid List<Long> ids);
boolean disable(@Valid List<Long> ids);
}

View File

@ -1,12 +1,8 @@
package com.xjrsoft.module.mdm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.yulichang.base.MPJBaseService;
import com.github.yulichang.extension.mapping.base.MPJDeepService;
import com.github.yulichang.extension.mapping.base.MPJRelationService;
import com.xjrsoft.module.mdm.dto.UpdateLngBPriceTermDto;
import com.xjrsoft.module.mdm.entity.LngBPriceTerm;
import lombok.Data;
import javax.validation.Valid;
import java.util.List;
@ -24,7 +20,7 @@ public interface IPriceTermsService extends IService<LngBPriceTerm> {
boolean updateByDTO(@Valid UpdateLngBPriceTermDto dto);
boolean enable(@Valid Long id);
boolean enable(@Valid List<Long> ids);
boolean disable(@Valid Long id);
boolean disable(@Valid List<Long> ids);
}

View File

@ -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));

View File

@ -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));
}
}
}

View File

@ -1,17 +1,27 @@
package com.xjrsoft.module.mdm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.pictc.constant.FieldNameConstants;
import com.pictc.constant.TableNameConstants;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.enums.ValidEnum;
import com.pictc.utils.DataLogTools;
import com.xjrsoft.common.enums.YesOrNoEnum;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.mdm.dto.UpdateLngBCurrencyDto;
import com.xjrsoft.module.mdm.entity.LngBCurrency;
import com.xjrsoft.module.mdm.mapper.LngBCurrencyMapper;
import com.xjrsoft.module.mdm.service.ICurrencyService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
/**
* @title: service
@ -22,4 +32,84 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@Service
@AllArgsConstructor
public class CurrencyServiceImpl extends ServiceImpl<LngBCurrencyMapper, LngBCurrency> implements ICurrencyService {
private final CommonCallService commonCallService;
@Override
@Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBCurrencyDto dto) {
this.checkParams(dto);
UpdateLngBCurrencyDto res = DataLogTools.insert(dto);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
private void checkParams(UpdateLngBCurrencyDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBCurrency>()
.eq(LngBCurrency::getCode, dto.getCode())
.ne(!Objects.isNull(dto.getId()), LngBCurrency::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBCurrency>()
.eq(LngBCurrency::getFullName, dto.getFullName())
.ne(!Objects.isNull(dto.getId()), LngBCurrency::getId, dto.getId()));
if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME));
}
if (YesOrNoEnum.YES.getTextCode().equals(dto.getLocalSign())) {
Long validCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBCurrency>()
.eq(LngBCurrency::getLocalSign, YesOrNoEnum.YES.getTextCode())
.eq(LngBCurrency::getValid, ValidEnum.ENABLE.getCode())
.ne(!Objects.isNull(dto.getId()), LngBCurrency::getId, dto.getId()));
if (validCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.LOCAL_SIGN));
}
}
}
private void addOrUpdateAfter(Long id) {
String msg = commonCallService.saveAfter(TableNameConstants.LNG_B_CURRENCY, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateByDTO(UpdateLngBCurrencyDto dto) {
this.checkParams(dto);
DataLogTools.update(dto);
this.addOrUpdateAfter(dto.getId());
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean enable(List<Long> ids) {
DataLogTools.enable(UpdateLngBCurrencyDto.class, ids);
for (Long id : ids) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_CURRENCY, 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(UpdateLngBCurrencyDto.class, ids);
for (Long id : ids) {
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_CURRENCY, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
}

View File

@ -2,16 +2,13 @@ package com.xjrsoft.module.mdm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.pictc.constant.FieldNameConstants;
import com.pictc.constant.TableNameConstants;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.enums.ValidEnum;
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.UpdateLngBCurrencyDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBPriceTermDto;
import com.xjrsoft.module.mdm.entity.LngBPriceTerm;
import com.xjrsoft.module.mdm.mapper.LngBPriceTermMapper;
@ -20,12 +17,9 @@ import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import static microsoft.exchange.webservices.data.core.XmlElementNames.ResponseCode;
/**
* @title: service
@ -50,13 +44,15 @@ public class PriceTermsServiceImpl extends ServiceImpl<LngBPriceTermMapper, LngB
private void checkParams(UpdateLngBPriceTermDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBPriceTerm>()
.eq(LngBPriceTerm::getCode, dto.getCode()));
.eq(LngBPriceTerm::getCode, dto.getCode())
.ne(!Objects.isNull(dto.getId()), LngBPriceTerm::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBPriceTerm>()
.eq(LngBPriceTerm::getFullName, dto.getFullName()));
.eq(LngBPriceTerm::getFullName, dto.getFullName())
.ne(!Objects.isNull(dto.getId()), LngBPriceTerm::getId, dto.getId()));
if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME));
@ -80,28 +76,27 @@ public class PriceTermsServiceImpl extends ServiceImpl<LngBPriceTermMapper, LngB
}
@Override
public boolean enable(Long id) {
this.updateValid(id, ValidEnum.ENABLE.getCode());
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_PRICE_TERM, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
@Transactional(rollbackFor = Exception.class)
public boolean enable(List<Long> ids) {
DataLogTools.enable(UpdateLngBPriceTermDto.class, ids);
for (Long id : ids) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_PRICE_TERM, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
private void updateValid(Long id, String valid) {
UpdateLngBPriceTermDto dto = new UpdateLngBPriceTermDto();
dto.setId(id);
dto.setValid(valid);
DataLogTools.update(dto);
}
@Override
public boolean disable(Long id) {
this.updateValid(id, ValidEnum.DISABLE.getCode());
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_PRICE_TERM, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
@Transactional(rollbackFor = Exception.class)
public boolean disable(List<Long> ids) {
DataLogTools.disable(UpdateLngBPriceTermDto.class, ids);
for (Long id : ids) {
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_PRICE_TERM, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}