Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2025-10-27 10:33:00 +08:00
11 changed files with 281 additions and 77 deletions

View File

@ -27,6 +27,16 @@ public interface TableNameConstants {
*/ */
String LNG_B_STATION_LNG = "lng_b_station_lng"; String LNG_B_STATION_LNG = "lng_b_station_lng";
/**
* 公司资质证书表
*/
String LNG_B_DOC_CP = "lng_b_doc_cp";
/**
* 品种表
*/
String LNG_B_CATEGORY = "lng_b_category";
/** /**
* 银行表 * 银行表
*/ */

View File

@ -1,27 +1,21 @@
package com.xjrsoft.module.mdm.controller; package com.xjrsoft.module.mdm.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
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.xjrsoft.common.model.result.R;
import com.xjrsoft.common.constant.GlobalConstant;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
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.model.result.R;
import com.xjrsoft.common.utils.VoToColumnUtil; import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.mdm.dto.AddLngBCategoryDto; import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.dto.UpdateLngBCategoryDto; import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.xjrsoft.module.mdm.dto.LngBCategoryPageDto; import com.xjrsoft.module.mdm.dto.LngBCategoryPageDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBCategoryDto;
import com.xjrsoft.module.mdm.entity.LngBCategory; import com.xjrsoft.module.mdm.entity.LngBCategory;
import com.xjrsoft.module.mdm.service.ICategoryService; import com.xjrsoft.module.mdm.service.ICategoryService;
import com.xjrsoft.module.mdm.vo.LngBCategoryPageVo; import com.xjrsoft.module.mdm.vo.LngBCategoryPageVo;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.vo.LngBCategoryVo; import com.xjrsoft.module.mdm.vo.LngBCategoryVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -29,7 +23,6 @@ import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
@ -55,15 +48,11 @@ public class CategoryController {
LambdaQueryWrapper<LngBCategory> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<LngBCategory> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper queryWrapper
.like(StrUtil.isNotBlank(dto.getFullName()),LngBCategory::getFullName,dto.getFullName()) .like(StrUtil.isNotBlank(dto.getFullName()), LngBCategory::getFullName, dto.getFullName())
.like(StrUtil.isNotBlank(dto.getValid()),LngBCategory::getValid,dto.getValid()) .eq(StrUtil.isNotBlank(dto.getValid()), LngBCategory::getValid, dto.getValid())
.like(StrUtil.isNotBlank(dto.getCode()),LngBCategory::getCode,dto.getCode()) .orderByDesc(LngBCategory::getCode)
.like(StrUtil.isNotBlank(dto.getUnitCode()),LngBCategory::getUnitCode,dto.getUnitCode()) .select(LngBCategory.class,x -> VoToColumnUtil.fieldsToColumns(LngBCategoryPageVo.class)
.eq(ObjectUtil.isNotNull(dto.getCoefficient()),LngBCategory::getCoefficient,dto.getCoefficient()) .contains(x.getProperty()));
//.like(StrUtil.isNotBlank(dto.getSort()),LngBCategory::getSort,dto.getSort())
.like(StrUtil.isNotBlank(dto.getNote()),LngBCategory::getNote,dto.getNote())
.orderByDesc(LngBCategory::getId)
.select(LngBCategory.class,x -> VoToColumnUtil.fieldsToColumns(LngBCategoryPageVo.class).contains(x.getProperty()));
IPage<LngBCategory> page = categoryService.page(ConventPage.getPage(dto), queryWrapper); IPage<LngBCategory> page = categoryService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngBCategoryPageVo> pageOutput = ConventPage.getPageOutput(page, LngBCategoryPageVo.class); PageOutput<LngBCategoryPageVo> pageOutput = ConventPage.getPageOutput(page, LngBCategoryPageVo.class);
return R.ok(pageOutput); return R.ok(pageOutput);
@ -80,20 +69,18 @@ public class CategoryController {
return R.ok(BeanUtil.toBean(lngBCategory, LngBCategoryVo.class)); return R.ok(BeanUtil.toBean(lngBCategory, LngBCategoryVo.class));
} }
@PostMapping @PostMapping
@ApiOperation(value = "新增LngBCategory") @ApiOperation(value = "新增LngBCategory")
@SaCheckPermission("category:add") @SaCheckPermission("category:add")
public R add(@Valid @RequestBody UpdateLngBCategoryDto dto){ public R add(@Valid @RequestBody UpdateLngBCategoryDto dto){
UpdateLngBCategoryDto res = dataService.insert(dto); return R.ok(categoryService.add(dto));
return R.ok(res.getId());
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngBCategory") @ApiOperation(value = "修改LngBCategory")
@SaCheckPermission("category:edit") @SaCheckPermission("category:edit")
public R update(@Valid @RequestBody UpdateLngBCategoryDto dto){ public R update(@Valid @RequestBody UpdateLngBCategoryDto dto){
return R.ok(dataService.updateById(dto)); return R.ok(categoryService.updateByDTO(dto));
} }
@DeleteMapping @DeleteMapping
@ -101,7 +88,27 @@ public class CategoryController {
@SaCheckPermission("category:delete") @SaCheckPermission("category:delete")
public R delete(@Valid @RequestBody List<Long> ids){ public R delete(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.deleteByIds(UpdateLngBCategoryDto.class, ids)); return R.ok(dataService.deleteByIds(UpdateLngBCategoryDto.class, ids));
} }
@GetMapping(value = "/datalog")
@ApiOperation(value="根据id查询LngBCategory数据详细日志")
@SaCheckPermission("category:datalog")
public R datalog(@RequestParam Long id){
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngBCategoryDto.class,id);
return R.ok(logs);
}
@PostMapping("/enable")
@ApiOperation(value = "启用LngBCategory")
@SaCheckPermission("category:enable")
public R enable(@Valid @RequestBody List<Long> ids){
return R.ok(categoryService.enable(ids));
}
@PostMapping("/disable")
@ApiOperation(value = "禁用LngBCategory")
@SaCheckPermission("category:disable")
public R disable(@Valid @RequestBody List<Long> ids){
return R.ok(categoryService.disable(ids));
}
} }

View File

@ -50,7 +50,8 @@ public class CurrencyController {
.and(StrUtil.isNotBlank(dto.getFullName()), r -> .and(StrUtil.isNotBlank(dto.getFullName()), r ->
r.like(LngBCurrency::getCode, dto.getFullName()) r.like(LngBCurrency::getCode, dto.getFullName())
.or() .or()
.like(LngBCurrency::getFullName, dto.getFullName())) .like(LngBCurrency::getFullName, dto.getFullName())
)
.eq(StrUtil.isNotBlank(dto.getValid()), LngBCurrency::getValid, dto.getValid()) .eq(StrUtil.isNotBlank(dto.getValid()), LngBCurrency::getValid, dto.getValid())
.orderByAsc(LngBCurrency::getSort, LngBCurrency::getCode) .orderByAsc(LngBCurrency::getSort, LngBCurrency::getCode)
.select(LngBCurrency.class,x -> VoToColumnUtil.fieldsToColumns(LngBCurrencyPageVo.class) .select(LngBCurrency.class,x -> VoToColumnUtil.fieldsToColumns(LngBCurrencyPageVo.class)

View File

@ -1,27 +1,21 @@
package com.xjrsoft.module.mdm.controller; package com.xjrsoft.module.mdm.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
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.xjrsoft.common.model.result.R;
import com.xjrsoft.common.constant.GlobalConstant;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
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.model.result.R;
import com.xjrsoft.common.utils.VoToColumnUtil; import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.mdm.dto.AddLngBDocCpDto; import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.dto.UpdateLngBDocCpDto; import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.xjrsoft.module.mdm.dto.LngBDocCpPageDto; import com.xjrsoft.module.mdm.dto.LngBDocCpPageDto;
import com.xjrsoft.module.mdm.dto.UpdateLngBDocCpDto;
import com.xjrsoft.module.mdm.entity.LngBDocCp; import com.xjrsoft.module.mdm.entity.LngBDocCp;
import com.xjrsoft.module.mdm.service.IDocCpService; import com.xjrsoft.module.mdm.service.IDocCpService;
import com.xjrsoft.module.mdm.vo.LngBDocCpPageVo; import com.xjrsoft.module.mdm.vo.LngBDocCpPageVo;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.vo.LngBDocCpVo; import com.xjrsoft.module.mdm.vo.LngBDocCpVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -29,7 +23,6 @@ import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
@ -55,16 +48,11 @@ public class DocCpController {
LambdaQueryWrapper<LngBDocCp> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<LngBDocCp> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper queryWrapper
.like(StrUtil.isNotBlank(dto.getFullName()),LngBDocCp::getFullName,dto.getFullName()) .like(StrUtil.isNotBlank(dto.getFullName()), LngBDocCp::getFullName, dto.getFullName())
.like(StrUtil.isNotBlank(dto.getValid()),LngBDocCp::getValid,dto.getValid()) .eq(StrUtil.isNotBlank(dto.getValid()), LngBDocCp::getValid, dto.getValid())
.like(StrUtil.isNotBlank(dto.getCode()),LngBDocCp::getCode,dto.getCode()) .orderByDesc(LngBDocCp::getCode)
.like(StrUtil.isNotBlank(dto.getSuSign()),LngBDocCp::getSuSign,dto.getSuSign()) .select(LngBDocCp.class,x -> VoToColumnUtil.fieldsToColumns(LngBDocCpPageVo.class)
.like(StrUtil.isNotBlank(dto.getSuNecSign()),LngBDocCp::getSuNecSign,dto.getSuNecSign()) .contains(x.getProperty()));
.like(StrUtil.isNotBlank(dto.getCuSign()),LngBDocCp::getCuSign,dto.getCuSign())
.like(StrUtil.isNotBlank(dto.getCuNecSign()),LngBDocCp::getCuNecSign,dto.getCuNecSign())
.like(StrUtil.isNotBlank(dto.getNote()),LngBDocCp::getNote,dto.getNote())
.orderByDesc(LngBDocCp::getId)
.select(LngBDocCp.class,x -> VoToColumnUtil.fieldsToColumns(LngBDocCpPageVo.class).contains(x.getProperty()));
IPage<LngBDocCp> page = docCpService.page(ConventPage.getPage(dto), queryWrapper); IPage<LngBDocCp> page = docCpService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngBDocCpPageVo> pageOutput = ConventPage.getPageOutput(page, LngBDocCpPageVo.class); PageOutput<LngBDocCpPageVo> pageOutput = ConventPage.getPageOutput(page, LngBDocCpPageVo.class);
return R.ok(pageOutput); return R.ok(pageOutput);
@ -86,15 +74,14 @@ public class DocCpController {
@ApiOperation(value = "新增LngBDocCp") @ApiOperation(value = "新增LngBDocCp")
@SaCheckPermission("docCp:add") @SaCheckPermission("docCp:add")
public R add(@Valid @RequestBody UpdateLngBDocCpDto dto){ public R add(@Valid @RequestBody UpdateLngBDocCpDto dto){
UpdateLngBDocCpDto res = dataService.insert(dto); return R.ok(docCpService.add(dto));
return R.ok(res.getId());
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngBDocCp") @ApiOperation(value = "修改LngBDocCp")
@SaCheckPermission("docCp:edit") @SaCheckPermission("docCp:edit")
public R update(@Valid @RequestBody UpdateLngBDocCpDto dto){ public R update(@Valid @RequestBody UpdateLngBDocCpDto dto){
return R.ok(dataService.updateById(dto)); return R.ok(docCpService.updateByDTO(dto));
} }
@DeleteMapping @DeleteMapping
@ -102,7 +89,27 @@ public class DocCpController {
@SaCheckPermission("docCp:delete") @SaCheckPermission("docCp:delete")
public R delete(@Valid @RequestBody List<Long> ids){ public R delete(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.deleteByIds(UpdateLngBDocCpDto.class, ids)); return R.ok(dataService.deleteByIds(UpdateLngBDocCpDto.class, ids));
} }
@GetMapping(value = "/datalog")
@ApiOperation(value="根据id查询LngBDocCp数据详细日志")
@SaCheckPermission("docCp:datalog")
public R datalog(@RequestParam Long id){
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngBDocCpDto.class,id);
return R.ok(logs);
}
@PostMapping("/enable")
@ApiOperation(value = "启用LngBDocCp")
@SaCheckPermission("docCp:enable")
public R enable(@Valid @RequestBody List<Long> ids){
return R.ok(docCpService.enable(ids));
}
@PostMapping("/disable")
@ApiOperation(value = "禁用LngBDocCp")
@SaCheckPermission("docCp:disable")
public R disable(@Valid @RequestBody List<Long> ids){
return R.ok(docCpService.disable(ids));
}
} }

View File

@ -47,8 +47,8 @@ public class LNGStationController {
public R page(@Valid LngBStationLngPageDto dto){ public R page(@Valid LngBStationLngPageDto dto){
LambdaQueryWrapper<LngBStationLng> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<LngBStationLng> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper queryWrapper
.like(StrUtil.isNotBlank(dto.getFullName()),LngBStationLng::getFullName,dto.getFullName()) .like(StrUtil.isNotBlank(dto.getFullName()), LngBStationLng::getFullName, dto.getFullName())
.eq(StrUtil.isNotBlank(dto.getValid()),LngBStationLng::getValid,dto.getValid()) .eq(StrUtil.isNotBlank(dto.getValid()), LngBStationLng::getValid, dto.getValid())
.orderByAsc(LngBStationLng::getSort, LngBStationLng::getCode) .orderByAsc(LngBStationLng::getSort, LngBStationLng::getCode)
.select(LngBStationLng.class,x -> VoToColumnUtil.fieldsToColumns(LngBStationLngPageVo.class) .select(LngBStationLng.class,x -> VoToColumnUtil.fieldsToColumns(LngBStationLngPageVo.class)
.contains(x.getProperty())); .contains(x.getProperty()));

View File

@ -50,7 +50,8 @@ public class PortController {
.and(StrUtil.isNotBlank(dto.getFullName()), r -> .and(StrUtil.isNotBlank(dto.getFullName()), r ->
r.like(LngBPort::getShortName, dto.getFullName()) r.like(LngBPort::getShortName, dto.getFullName())
.or() .or()
.like(LngBPort::getFullName, dto.getFullName())) .like(LngBPort::getFullName, dto.getFullName())
)
.eq(StrUtil.isNotBlank(dto.getValid()), LngBPort::getValid, dto.getValid()) .eq(StrUtil.isNotBlank(dto.getValid()), LngBPort::getValid, dto.getValid())
.orderByAsc(LngBPort::getSort, LngBPort::getCode) .orderByAsc(LngBPort::getSort, LngBPort::getCode)
.select(LngBPort.class,x -> VoToColumnUtil.fieldsToColumns(LngBPortPageVo.class) .select(LngBPort.class,x -> VoToColumnUtil.fieldsToColumns(LngBPortPageVo.class)

View File

@ -50,7 +50,8 @@ public class PriceTermsController {
.and(StrUtil.isNotBlank(dto.getFullName()), r -> .and(StrUtil.isNotBlank(dto.getFullName()), r ->
r.like(LngBPriceTerm::getCode, dto.getFullName()) r.like(LngBPriceTerm::getCode, dto.getFullName())
.or() .or()
.like(LngBPriceTerm::getFullName, dto.getFullName())) .like(LngBPriceTerm::getFullName, dto.getFullName())
)
.eq(StrUtil.isNotBlank(dto.getValid()), LngBPriceTerm::getValid, dto.getValid()) .eq(StrUtil.isNotBlank(dto.getValid()), LngBPriceTerm::getValid, dto.getValid())
.orderByAsc(LngBPriceTerm::getSort, LngBPriceTerm::getCode) .orderByAsc(LngBPriceTerm::getSort, LngBPriceTerm::getCode)
.select(LngBPriceTerm.class,x -> VoToColumnUtil.fieldsToColumns(LngBPriceTermPageVo.class) .select(LngBPriceTerm.class,x -> VoToColumnUtil.fieldsToColumns(LngBPriceTermPageVo.class)

View File

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

View File

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

View File

@ -1,17 +1,25 @@
package com.xjrsoft.module.mdm.service.impl; 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.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.utils.DataLogTools;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.mdm.dto.UpdateLngBCategoryDto;
import com.xjrsoft.module.mdm.entity.LngBCategory; import com.xjrsoft.module.mdm.entity.LngBCategory;
import com.xjrsoft.module.mdm.mapper.LngBCategoryMapper; import com.xjrsoft.module.mdm.mapper.LngBCategoryMapper;
import com.xjrsoft.module.mdm.service.ICategoryService; import com.xjrsoft.module.mdm.service.ICategoryService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
/** /**
* @title: service * @title: service
@ -22,4 +30,74 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
public class CategoryServiceImpl extends ServiceImpl<LngBCategoryMapper, LngBCategory> implements ICategoryService { public class CategoryServiceImpl extends ServiceImpl<LngBCategoryMapper, LngBCategory> implements ICategoryService {
private final CommonCallService commonCallService;
@Override
@Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBCategoryDto dto) {
this.checkParams(dto);
UpdateLngBCategoryDto res = DataLogTools.insert(dto);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
private void checkParams(UpdateLngBCategoryDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBCategory>()
.eq(LngBCategory::getCode, dto.getCode())
.ne(!Objects.isNull(dto.getId()), LngBCategory::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBCategory>()
.eq(LngBCategory::getFullName, dto.getFullName())
.ne(!Objects.isNull(dto.getId()), LngBCategory::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_CATEGORY, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateByDTO(UpdateLngBCategoryDto 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(UpdateLngBCategoryDto.class, ids);
for (Long id : ids) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_CATEGORY, 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(UpdateLngBCategoryDto.class, ids);
for (Long id : ids) {
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_CATEGORY, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
} }

View File

@ -1,17 +1,26 @@
package com.xjrsoft.module.mdm.service.impl; 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.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.utils.DataLogTools;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.mdm.dto.UpdateLngBDocCpDto;
import com.xjrsoft.module.mdm.entity.LngBDocCp; import com.xjrsoft.module.mdm.entity.LngBDocCp;
import com.xjrsoft.module.mdm.mapper.LngBDocCpMapper; import com.xjrsoft.module.mdm.mapper.LngBDocCpMapper;
import com.xjrsoft.module.mdm.service.IDocCpService; import com.xjrsoft.module.mdm.service.IDocCpService;
import com.xjrsoft.module.system.client.ICodeRuleClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
/** /**
* @title: service * @title: service
@ -22,4 +31,80 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
public class DocCpServiceImpl extends ServiceImpl<LngBDocCpMapper, LngBDocCp> implements IDocCpService { public class DocCpServiceImpl extends ServiceImpl<LngBDocCpMapper, LngBDocCp> implements IDocCpService {
private final CommonCallService commonCallService;
private final ICodeRuleClient codeRuleClient;
private final String DOCCPCODE = "docCpCode";
@Override
@Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBDocCpDto dto) {
this.checkParams(dto);
dto.setCode(codeRuleClient.genEncode(DOCCPCODE));
UpdateLngBDocCpDto res = DataLogTools.insert(dto);
codeRuleClient.useEncode(DOCCPCODE);
this.addOrUpdateAfter(res.getId());
return res.getId();
}
private void checkParams(UpdateLngBDocCpDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBDocCp>()
.eq(LngBDocCp::getCode, dto.getCode())
.ne(!Objects.isNull(dto.getId()), LngBDocCp::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBDocCp>()
.eq(LngBDocCp::getFullName, dto.getFullName())
.ne(!Objects.isNull(dto.getId()), LngBDocCp::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_DOC_CP, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateByDTO(UpdateLngBDocCpDto 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(UpdateLngBDocCpDto.class, ids);
for (Long id : ids) {
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_DOC_CP, 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(UpdateLngBDocCpDto.class, ids);
for (Long id : ids) {
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_DOC_CP, id);
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
}
return true;
}
} }