修改关键零部件绑定关系管理

This commit is contained in:
梁琦涛
2024-10-10 13:54:14 +08:00
parent 718af5bfe7
commit 9f87893556
3 changed files with 23 additions and 4 deletions
@@ -123,7 +123,7 @@ public class LawsPartRelevanceController {
@ApiOperationSupport(order = 5)
@PostMapping(value = "/add")
@RequiresPermissions("keyPartBindingManage:add")
public Result<T> add(@Validated @RequestBody LawsPartRelevance lawsPartRelevance) {
public Result<T> add(@RequestBody LawsPartRelevance lawsPartRelevance) {
lawsPartRelevanceService.add(lawsPartRelevance);
return Result.OK(ResultCommon.OK);
}
@@ -139,7 +139,7 @@ public class LawsPartRelevanceController {
@ApiOperationSupport(order = 6)
@PostMapping(value = "/edit")
@RequiresPermissions("keyPartBindingManage:import")
public Result<T> edit(@Validated @RequestBody LawsPartRelevance lawsPartRelevance) {
public Result<T> edit(@RequestBody LawsPartRelevance lawsPartRelevance) {
this.lawsPartRelevanceService.edit(lawsPartRelevance);
return Result.OK(ResultCommon.OK);
}
@@ -100,7 +100,12 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
@Override
public void add(LawsPartRelevance lawsPartRelevance) {
checkData(lawsPartRelevance);
LambdaQueryWrapper<LawsPartPmmPartitionInfo> query = new LambdaQueryWrapper<>();
query.eq(LawsPartPmmPartitionInfo::getRegPartNameCn,lawsPartRelevance.getRegPartNameCn());
List<LawsPartPmmPartitionInfo> listLawsPartPmmPartitionInfo = lawsPartPmmPartitionInfoService.list(query);
if(CollectionUtils.isEmpty(listLawsPartPmmPartitionInfo)){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
// 需要做名称+功能系统码唯一性校验
LambdaQueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new LambdaQueryWrapper<>();
queryLawsPartRelevance.eq(LawsPartRelevance::getRegPartNameCn,lawsPartRelevance.getRegPartNameCn());
@@ -110,6 +115,8 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
"关键零部件名称与功能系统码 already exists" : "关键零部件名称与功能系统码已存在"));
}
List<String> fndGpcList = listLawsPartPmmPartitionInfo.stream().map(LawsPartPmmPartitionInfo::getFndGpc).collect(Collectors.toList());
lawsPartRelevance.setFndGpc(String.join(",",fndGpcList));
save(lawsPartRelevance);
}
@@ -131,6 +138,12 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
@Override
public void edit(LawsPartRelevance lawsPartRelevance) {
checkData(lawsPartRelevance);
LambdaQueryWrapper<LawsPartPmmPartitionInfo> query = new LambdaQueryWrapper<>();
query.eq(LawsPartPmmPartitionInfo::getRegPartNameCn,lawsPartRelevance.getRegPartNameCn());
List<LawsPartPmmPartitionInfo> listLawsPartPmmPartitionInfo = lawsPartPmmPartitionInfoService.list(query);
if(CollectionUtils.isEmpty(listLawsPartPmmPartitionInfo)){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
// 需要做名称+功能系统码唯一性校验
LambdaQueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new LambdaQueryWrapper<>();
queryLawsPartRelevance.eq(LawsPartRelevance::getRegPartNameCn,lawsPartRelevance.getRegPartNameCn());
@@ -141,6 +154,8 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
"关键零部件名称与功能系统码 already exists" : "关键零部件名称与功能系统码已存在"));
}
List<String> fndGpcList = listLawsPartPmmPartitionInfo.stream().map(LawsPartPmmPartitionInfo::getFndGpc).collect(Collectors.toList());
lawsPartRelevance.setFndGpc(String.join(",",fndGpcList));
updateById(lawsPartRelevance);
}
@@ -21,6 +21,7 @@ import com.jero.modules.laws.part.service.ILawsPartInfoService;
import com.jero.modules.laws.part.service.ILawsPartRelevanceService;
import com.jero.modules.laws.part.service.ILawsPartTypeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -196,7 +197,7 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
QueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new QueryWrapper<>();
queryLawsPartRelevance.gt("FIND_IN_SET(fnd_gpc,'" + lawsPartInfo.getFndGpc() + "')", 0);
queryLawsPartRelevance.gt("FIND_IN_SET('" + lawsPartInfo.getFndGpc() + "',fnd_gpc)", 0);
LawsPartRelevance lawsPartRelevance = lawsPartRelevanceService.getOne(queryLawsPartRelevance,false);
if(Objects.isNull(lawsPartRelevance)){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
@@ -206,6 +207,9 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
@Override
public List<LawsPartType> queryByPartNumList(String partNum) {
if(StringUtils.isEmpty(partNum)){
throw new JeroBootException(ResultCommon.PARAMETER_NOT_RECOGNIZED);
}
LambdaQueryWrapper<LawsPartType> queryLawsPartType = new LambdaQueryWrapper<>();
queryLawsPartType.select(LawsPartType::getPartRelevanceType);
queryLawsPartType.eq(LawsPartType::getPartNum,partNum);