关键零部件绑定关系管理完善

This commit is contained in:
梁琦涛
2024-09-25 12:02:40 +08:00
parent ac8c178349
commit ae1d6ab3ff
14 changed files with 156 additions and 79 deletions
@@ -0,0 +1,43 @@
package com.jero.modules.laws.part.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
import com.jero.modules.laws.part.service.ILawsPartPmmPartitionInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Api(tags = "业务支持-关键零部件名称")
@RestController
@RequestMapping("/laws/lawsPartPmmPartitionInfo")
@Slf4j
public class LawsPartPmmPartitionInfoController {
@Resource
private ILawsPartPmmPartitionInfoService lawsPartPmmPartitionInfoService;
/**
* 列表查询
*
* @param lawsPartPmmPartitionInfo
* @return
*/
@AutoLog(value = "业务支持-关键零部件名称-列表")
@ApiOperation(value = "业务支持-关键零部件名称-列表", notes = "业务支持-关键零部件名称-列表")
@GetMapping(value = "/list")
@ApiOperationSupport(order = 1)
public Result<List<LawsPartPmmPartitionInfo>> list(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo,
HttpServletRequest req) {
return Result.OK(lawsPartPmmPartitionInfoService.list(lawsPartPmmPartitionInfo,req));
}
}
@@ -30,7 +30,7 @@ import java.util.Map;
@Api(tags = "业务支持-关键零部件绑定关系管理")
@RestController
@RequestMapping("/laws/part")
@RequestMapping("/laws/lawsPartRelevance")
@Slf4j
public class LawsPartRelevanceController {
@@ -45,8 +45,8 @@ public class LawsPartRelevanceController {
* @param pageSize
* @return
*/
@AutoLog(value = "外部标准库-市场法规清单-分页列表查询")
@ApiOperation(value = "外部标准库-市场法规清单-分页列表查询", notes = "外部标准库-市场法规清单-分页列表查询")
@AutoLog(value = "业务支持-关键零部件绑定关系管理-分页列表查询")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-分页列表查询", notes = "业务支持-关键零部件绑定关系管理-分页列表查询")
@GetMapping(value = "/page")
@ApiOperationSupport(order = 1)
// @RequiresPermissions("marketStandard:search")
@@ -64,8 +64,8 @@ public class LawsPartRelevanceController {
* @param lawsPartRelevance
* @return
*/
@AutoLog(value = "外部标准库-市场法规清单-详情")
@ApiOperation(value = "外部标准库-市场法规清单-详情", notes = "外部标准库-市场法规清单-详情")
@AutoLog(value = "业务支持-关键零部件绑定关系管理-详情")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-详情", notes = "业务支持-关键零部件绑定关系管理-详情")
@GetMapping(value = "/queryById")
@ApiOperationSupport(order = 2)
@Translation
@@ -80,8 +80,8 @@ public class LawsPartRelevanceController {
* @param map
* @return
*/
@AutoLog(value = "外部标准库-市场法规清单-删除")
@ApiOperation(value = "外部标准库-市场法规清单-删除", notes = "外部标准库-市场法规清单-删除")
@AutoLog(value = "业务支持-关键零部件绑定关系管理-删除")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-删除", notes = "业务支持-关键零部件绑定关系管理-删除")
@ApiOperationSupport(order = 4)
@PostMapping(value = "/delete")
// @RequiresPermissions("marketStandard:deleteBatch")
@@ -99,8 +99,8 @@ public class LawsPartRelevanceController {
* @param map
* @return
*/
@AutoLog(value = "外部标准库-市场法规清单-批量删除")
@ApiOperation(value = "外部标准库-市场法规清单-批量删除", notes = "外部标准库-市场法规清单-批量删除")
@AutoLog(value = "业务支持-关键零部件绑定关系管理-批量删除")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-批量删除", notes = "业务支持-关键零部件绑定关系管理-批量删除")
@ApiOperationSupport(order = 4)
// @PostMapping(value = "/deleteBatch")
// @RequiresPermissions("marketStandard:deleteBatch")
@@ -118,11 +118,11 @@ public class LawsPartRelevanceController {
* @param lawsPartRelevance
* @return
*/
@AutoLog(value = "外部标准库-市场法规清单-新增")
@ApiOperation(value = "外部标准库-市场法规清单-新增", notes = "外部标准库-市场法规清单-新增")
@AutoLog(value = "业务支持-关键零部件绑定关系管理-新增")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-新增", notes = "业务支持-关键零部件绑定关系管理-新增")
@ApiOperationSupport(order = 5)
@PostMapping(value = "/add")
@RequiresPermissions("marketStandard:add")
// @RequiresPermissions("marketStandard:add")
public Result<T> add(@Validated @RequestBody LawsPartRelevance lawsPartRelevance) {
lawsPartRelevanceService.add(lawsPartRelevance);
return Result.OK(ResultCommon.OK);
@@ -134,11 +134,11 @@ public class LawsPartRelevanceController {
* @param lawsPartRelevance
* @return
*/
@AutoLog(value = "外部标准库-市场法规清单-编辑")
@ApiOperation(value = "外部标准库-市场法规清单-编辑", notes = "外部标准库-市场法规清单-编辑")
@AutoLog(value = "业务支持-关键零部件绑定关系管理-编辑")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-编辑", notes = "业务支持-关键零部件绑定关系管理-编辑")
@ApiOperationSupport(order = 6)
@PostMapping(value = "/edit")
@RequiresPermissions("marketStandard:edit")
// @RequiresPermissions("marketStandard:edit")
public Result<T> edit(@Validated @RequestBody LawsPartRelevance lawsPartRelevance) {
this.lawsPartRelevanceService.edit(lawsPartRelevance);
return Result.OK(ResultCommon.OK);
@@ -151,8 +151,8 @@ public class LawsPartRelevanceController {
* @param file
* @return
*/
@AutoLog(value = "外部标准库-市场法规清单-导入")
@ApiOperation(value = "外部标准库-市场法规清单-导入", notes = "外部标准库-市场法规清单-导入")
@AutoLog(value = "业务支持-关键零部件绑定关系管理-导入")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-导入", notes = "业务支持-关键零部件绑定关系管理-导入")
@ApiOperationSupport(order = 7)
@PostMapping(value = "/importExcel")
@RequiresPermissions("marketStandard:detail:operate")
@@ -167,8 +167,8 @@ public class LawsPartRelevanceController {
* @param
* @return
*/
@AutoLog(value = "外部标准库-市场法规清单-下载模版")
@ApiOperation(value = "外部标准库-市场法规清单-下载模版", notes = "外部标准库-市场法规清单-下载模版")
@AutoLog(value = "业务支持-关键零部件绑定关系管理-下载模版")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-下载模版", notes = "业务支持-关键零部件绑定关系管理-下载模版")
@ApiOperationSupport(order = 7)
@GetMapping(value = "/downloadTemplate")
@RequiresPermissions("marketStandard:detail:operate")
@@ -16,7 +16,7 @@ import javax.validation.constraints.NotBlank;
/**
*
* @TableName laws_market_standard_detail
* @TableName laws_part_production_factory
*/
@TableName(value ="laws_part_production_factory")
@Data
@@ -59,10 +59,10 @@ public class LawsPartRelevance implements Serializable {
/**
* 关键零部件名称
*/
@NotBlank(message = "关键零部件名称不能为空")
@ApiModelProperty(value = "关键零部件名称")
@Excel(name = "关键零部件名称", width = 15)
@TableField(exist = false)
@Dict(dictTable = "laws_part_pmm_partition_info", dicCode = "fnd_gpc", dicText = "reg_part_name_cn")
private String regPartNameCn;
/**
* 关键零部件名称(英文)
@@ -75,7 +75,8 @@ public class LawsPartRelevance implements Serializable {
*/
@NotBlank(message = "形式型号不能为空")
@ApiModelProperty(value = "形式型号")
@Excel(name = "形式型号", width = 15)
@Excel(name = "形式型号", width = 15, dicCode = "form_type")
@Dict(dicCode = "form_type")
private String formType;
/**
* 功能系统码
@@ -93,8 +94,8 @@ public class LawsPartRelevance implements Serializable {
* 分类(国内)
*/
@ApiModelProperty(value = "分类(国内)")
@Excel(name = "分类(国内)", width = 15,dicCode = "market_state")
@Dict(dicCode = "")
@Excel(name = "分类(国内)", width = 15,dicCode = "classification")
@Dict(dicCode = "classification")
private String classification;
/**
* 适用市场
@@ -108,7 +109,8 @@ public class LawsPartRelevance implements Serializable {
* 零部件认证交付物
*/
@ApiModelProperty(value = "零部件认证交付物")
@Excel(name = "适用市场", width = 15)
@Excel(name = "零部件认证交付物", width = 15,dicCode = "parts_certified_deliverables")
@Dict(dicCode = "parts_certified_deliverables")
private String partsCertifiedDeliverables;
/**
* 责任部门
@@ -137,5 +139,6 @@ public class LawsPartRelevance implements Serializable {
* FND+GPC关联
*/
@ApiModelProperty(value = "FND+GPC关联")
@NotBlank(message = "关键零部件名称不能为空")
private String fndGpc;
}
@@ -3,12 +3,6 @@ package com.jero.modules.laws.part.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
/**
* @author ThinkBook
* @description 针对表【laws_market_standard_detail】的数据库操作Mapper
* @createDate 2024-06-29 11:34:34
* @Entity com.jero.modules.laws.marketStandard.entity.LawsMarketStandardDetail
*/
public interface LawsPartPmmPartitionInfoMapper extends BaseMapper<LawsPartPmmPartitionInfo> {
}
@@ -3,12 +3,7 @@ package com.jero.modules.laws.part.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.modules.laws.part.entity.LawsPartProductionFactory;
/**
* @author ThinkBook
* @description 针对表【laws_market_standard_detail】的数据库操作Mapper
* @createDate 2024-06-29 11:34:34
* @Entity com.jero.modules.laws.marketStandard.entity.LawsMarketStandardDetail
*/
public interface LawsPartProductionFactoryMapper extends BaseMapper<LawsPartProductionFactory> {
}
@@ -3,12 +3,7 @@ package com.jero.modules.laws.part.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.modules.laws.part.entity.LawsPartRelevance;
/**
* @author ThinkBook
* @description 针对表【laws_market_standard(市场法规)】的数据库操作Mapper
* @createDate 2024-06-29 11:34:04
* @Entity com.jero.modules.laws.markStandard.entity.LawsMarketStandard
*/
public interface LawsPartRelevanceMapper extends BaseMapper<LawsPartRelevance> {
}
@@ -2,6 +2,6 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.modules.laws.marketStandard.mapper.LawsPartRelevanceMapper">
<mapper namespace="com.jero.modules.laws.part.mapper.LawsPartRelevanceMapper">
</mapper>
@@ -3,11 +3,11 @@ package com.jero.modules.laws.part.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
/**
* @author ThinkBook
* @description 针对表【laws_market_standard(市场法规)】的数据库操作Service
* @createDate 2024-06-29 11:34:04
*/
import javax.servlet.http.HttpServletRequest;
import java.util.List;
public interface ILawsPartPmmPartitionInfoService extends IService<LawsPartPmmPartitionInfo> {
List<LawsPartPmmPartitionInfo> list(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo, HttpServletRequest req);
}
@@ -3,11 +3,6 @@ package com.jero.modules.laws.part.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.laws.part.entity.LawsPartProductionFactory;
/**
* @author ThinkBook
* @description 针对表【laws_market_standard(市场法规)】的数据库操作Service
* @createDate 2024-06-29 11:34:04
*/
public interface ILawsPartProductionFactoryService extends IService<LawsPartProductionFactory> {
}
@@ -10,11 +10,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author ThinkBook
* @description 针对表【laws_market_standard(市场法规)】的数据库操作Service
* @createDate 2024-06-29 11:34:04
*/
public interface ILawsPartRelevanceService extends IService<LawsPartRelevance> {
IPage<LawsPartRelevance> queryPage(LawsPartRelevance lawsPartRelevance, Integer pageNo, Integer pageSize,
@@ -1,22 +1,29 @@
package com.jero.modules.laws.part.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
import com.jero.modules.laws.part.entity.LawsPartRelevance;
import com.jero.modules.laws.part.mapper.LawsPartPmmPartitionInfoMapper;
import com.jero.modules.laws.part.service.ILawsPartPmmPartitionInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author ThinkBook
* @description 针对表【laws_market_standard_detail】的数据库操作Service实现
* @createDate 2024-06-29 11:34:34
*/
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Service
@Slf4j
public class LawsPartPmmPartitionInfoServiceImpl extends ServiceImpl<LawsPartPmmPartitionInfoMapper,
LawsPartPmmPartitionInfo> implements ILawsPartPmmPartitionInfoService {
@Override
public List<LawsPartPmmPartitionInfo> list(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo, HttpServletRequest req) {
QueryWrapper<LawsPartPmmPartitionInfo> queryWrapper =
QueryGenerator.initQueryWrapper(lawsPartPmmPartitionInfo, req.getParameterMap());
return list(queryWrapper);
}
}
@@ -7,11 +7,6 @@ import com.jero.modules.laws.part.service.ILawsPartProductionFactoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author ThinkBook
* @description 针对表【laws_market_standard(市场法规)】的数据库操作Service实现
* @createDate 2024-06-29 11:34:04
*/
@Service
@Slf4j
public class LawsPartProductionFactoryServiceImpl extends ServiceImpl<LawsPartProductionFactoryMapper, LawsPartProductionFactory>
@@ -1,10 +1,10 @@
package com.jero.modules.laws.part.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.Result;
import com.jero.common.api.vo.ResultCommon;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.base.controller.JeroController;
@@ -16,7 +16,6 @@ import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
import com.jero.modules.laws.part.entity.LawsPartRelevance;
import com.jero.modules.laws.part.mapper.LawsPartRelevanceMapper;
import com.jero.modules.laws.part.service.ILawsPartPmmPartitionInfoService;
import com.jero.modules.laws.part.service.ILawsPartProductionFactoryService;
import com.jero.modules.laws.part.service.ILawsPartRelevanceService;
import com.jero.modules.laws.utils.ValidUtil;
import lombok.extern.slf4j.Slf4j;
@@ -29,6 +28,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -38,15 +38,10 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ThinkBook
* @description 针对表【laws_market_standard(市场法规)】的数据库操作Service实现
* @createDate 2024-06-29 11:34:04
*/
@Service
@Slf4j
public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceMapper, LawsPartRelevance>
@@ -55,13 +50,21 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
@Resource
private ILawsPartPmmPartitionInfoService lawsPartPmmPartitionInfoService;
@Override
public IPage<LawsPartRelevance> queryPage(LawsPartRelevance lawsPartRelevance, Integer pageNo,
Integer pageSize, HttpServletRequest req) {
QueryWrapper<LawsPartRelevance> queryWrapper =
QueryGenerator.initQueryWrapper(lawsPartRelevance, req.getParameterMap());
Page<LawsPartRelevance> page = new Page<>(pageNo, pageSize);
return page(page, queryWrapper);
IPage<LawsPartRelevance> re = page(page, queryWrapper);
List<LawsPartRelevance> list = re.getRecords();
if(!CollectionUtils.isEmpty(list)){
list.parallelStream().forEach(p->{
p.setRegPartNameCn(p.getFndGpc());
});
}
return re;
}
@@ -98,11 +101,63 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
@Override
public void add(LawsPartRelevance lawsPartRelevance) {
// todo 是奇瑞型号的型号型式必填功能系统码和技术特性判定要求,不是奇瑞型号的不用填写
List<String> formType = Arrays.asList(lawsPartRelevance.getFormType().split(","));
if(formType.contains("1")){
if(StringUtils.isBlank(lawsPartRelevance.getSystemCode())){
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
"功能系统码 cannot be empty" : "功能系统码不能为空"));
}
if(StringUtils.isBlank(lawsPartRelevance.getDecisionRequirement())){
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
"技术特性判定要求 cannot be empty" : "技术特性判定要求不能为空"));
}
}
// 需要做名称+功能系统码唯一性校验
List<String> list = Arrays.asList(lawsPartRelevance.getFndGpc().split(","));
list.sort(null);
String fndGpc = String.join(",", list);
String systemCode = lawsPartRelevance.getSystemCode();
lawsPartRelevance.setFndGpc(fndGpc);
LambdaQueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new LambdaQueryWrapper<>();
queryLawsPartRelevance.eq(LawsPartRelevance::getFndGpc,fndGpc);
queryLawsPartRelevance.eq(LawsPartRelevance::getSystemCode,systemCode);
long l = count(queryLawsPartRelevance);
if(l > 0){
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
"名称与功能系统码 already exists" : "名称与功能系统码已存在"));
}
save(lawsPartRelevance);
}
@Override
public void edit(LawsPartRelevance lawsPartRelevance) {
// todo 是奇瑞型号的型号型式必填功能系统码和技术特性判定要求,不是奇瑞型号的不用填写
List<String> formType = Arrays.asList(lawsPartRelevance.getFormType().split(","));
if(formType.contains("1")){
if(StringUtils.isBlank(lawsPartRelevance.getSystemCode())){
throw new JeroBootException(ResultCommon.EMPTY_COMMON,"systemCode");
}
if(StringUtils.isBlank(lawsPartRelevance.getDecisionRequirement())){
throw new JeroBootException(ResultCommon.EMPTY_COMMON,"decisionRequirement");
}
}
// 需要做名称+功能系统码唯一性校验
List<String> list = Arrays.asList(lawsPartRelevance.getFndGpc().split(","));
list.sort(null);
String fndGpc = String.join(",", list);
String systemCode = lawsPartRelevance.getSystemCode();
lawsPartRelevance.setFndGpc(fndGpc);
LambdaQueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new LambdaQueryWrapper<>();
queryLawsPartRelevance.eq(LawsPartRelevance::getFndGpc,fndGpc);
queryLawsPartRelevance.eq(LawsPartRelevance::getSystemCode,systemCode);
queryLawsPartRelevance.ne(LawsPartRelevance::getId,lawsPartRelevance.getId());
long l = count(queryLawsPartRelevance);
if(l > 0){
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
"名称与功能系统码 already exists" : "名称与功能系统码已存在"));
}
updateById(lawsPartRelevance);
}