关键零部件数据修改
This commit is contained in:
+9
-4
@@ -1,5 +1,6 @@
|
|||||||
package com.jero.modules.laws.part.controller;
|
package com.jero.modules.laws.part.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.aspect.annotation.AutoLog;
|
import com.jero.common.aspect.annotation.AutoLog;
|
||||||
@@ -10,6 +11,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -34,10 +36,13 @@ public class LawsPartPmmPartitionInfoController {
|
|||||||
*/
|
*/
|
||||||
@AutoLog(value = "业务支持-关键零部件名称-列表")
|
@AutoLog(value = "业务支持-关键零部件名称-列表")
|
||||||
@ApiOperation(value = "业务支持-关键零部件名称-列表", notes = "业务支持-关键零部件名称-列表")
|
@ApiOperation(value = "业务支持-关键零部件名称-列表", notes = "业务支持-关键零部件名称-列表")
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/page")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
public Result<List<LawsPartPmmPartitionInfo>> list(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo,
|
public Result<IPage<LawsPartPmmPartitionInfo>> page(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo,
|
||||||
HttpServletRequest req) {
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
return Result.OK(lawsPartPmmPartitionInfoService.list(lawsPartPmmPartitionInfo,req));
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
IPage<LawsPartPmmPartitionInfo> page = lawsPartPmmPartitionInfoService.page(lawsPartPmmPartitionInfo,pageNo,pageSize,req);
|
||||||
|
return Result.OK(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
@@ -71,4 +71,13 @@ public class LawsPartPmmPartitionInfo implements Serializable {
|
|||||||
@Dict(dicCode = "法规件名称(关键零部件名称)")
|
@Dict(dicCode = "法规件名称(关键零部件名称)")
|
||||||
@ApiModelProperty(value = "法规件名称(关键零部件名称)")
|
@ApiModelProperty(value = "法规件名称(关键零部件名称)")
|
||||||
private String regPartNameCn;
|
private String regPartNameCn;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定状态 1已绑定 2未绑定
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "绑定状态 1已绑定 2未绑定")
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Dict(dicCode = "binding_state")
|
||||||
|
private String status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,9 +60,7 @@ public class LawsPartRelevance implements Serializable {
|
|||||||
* 关键零部件名称
|
* 关键零部件名称
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "关键零部件名称")
|
@ApiModelProperty(value = "关键零部件名称")
|
||||||
@Excel(name = "关键零部件名称", width = 15, dictTable = "laws_part_pmm_partition_info", dicCode = "fnd_gpc", dicText = "reg_part_name_cn")
|
@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;
|
private String regPartNameCn;
|
||||||
/**
|
/**
|
||||||
* 关键零部件名称(英文)
|
* 关键零部件名称(英文)
|
||||||
|
|||||||
+7
@@ -1,10 +1,17 @@
|
|||||||
package com.jero.modules.laws.part.mapper;
|
package com.jero.modules.laws.part.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
|
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
public interface LawsPartPmmPartitionInfoMapper extends BaseMapper<LawsPartPmmPartitionInfo> {
|
public interface LawsPartPmmPartitionInfoMapper extends BaseMapper<LawsPartPmmPartitionInfo> {
|
||||||
|
|
||||||
|
IPage<LawsPartPmmPartitionInfo> pageList(Page<LawsPartPmmPartitionInfo> page,
|
||||||
|
@Param(Constants.WRAPPER) QueryWrapper<LawsPartPmmPartitionInfo> queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
@@ -4,4 +4,10 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.jero.modules.laws.part.mapper.LawsPartPmmPartitionInfoMapper">
|
<mapper namespace="com.jero.modules.laws.part.mapper.LawsPartPmmPartitionInfoMapper">
|
||||||
|
|
||||||
|
<select id="pageList" resultType="com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo">
|
||||||
|
select l1.reg_part_name_cn,IF(l2.id is null,'2','1') as status from laws_part_pmm_partition_info l1
|
||||||
|
left join laws_part_relevance l2 on l1.reg_part_name_cn = l2.reg_part_name_cn and l2.del_flag = 0
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
group by l1.reg_part_name_cn
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,6 @@
|
|||||||
package com.jero.modules.laws.part.service;
|
package com.jero.modules.laws.part.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
|
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
|
||||||
|
|
||||||
@@ -9,5 +10,6 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface ILawsPartPmmPartitionInfoService extends IService<LawsPartPmmPartitionInfo> {
|
public interface ILawsPartPmmPartitionInfoService extends IService<LawsPartPmmPartitionInfo> {
|
||||||
|
|
||||||
List<LawsPartPmmPartitionInfo> list(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo, HttpServletRequest req);
|
IPage<LawsPartPmmPartitionInfo> page(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo,Integer pageNo,
|
||||||
|
Integer pageSize, HttpServletRequest req);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -1,6 +1,8 @@
|
|||||||
package com.jero.modules.laws.part.service.impl;
|
package com.jero.modules.laws.part.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
import com.jero.common.system.query.QueryGenerator;
|
||||||
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
|
import com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo;
|
||||||
@@ -8,8 +10,10 @@ import com.jero.modules.laws.part.entity.LawsPartRelevance;
|
|||||||
import com.jero.modules.laws.part.mapper.LawsPartPmmPartitionInfoMapper;
|
import com.jero.modules.laws.part.mapper.LawsPartPmmPartitionInfoMapper;
|
||||||
import com.jero.modules.laws.part.service.ILawsPartPmmPartitionInfoService;
|
import com.jero.modules.laws.part.service.ILawsPartPmmPartitionInfoService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -17,12 +21,22 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class LawsPartPmmPartitionInfoServiceImpl extends ServiceImpl<LawsPartPmmPartitionInfoMapper,
|
public class LawsPartPmmPartitionInfoServiceImpl extends ServiceImpl<LawsPartPmmPartitionInfoMapper,
|
||||||
LawsPartPmmPartitionInfo> implements ILawsPartPmmPartitionInfoService {
|
LawsPartPmmPartitionInfo> implements ILawsPartPmmPartitionInfoService {
|
||||||
|
@Resource
|
||||||
|
private LawsPartPmmPartitionInfoMapper lawsPartPmmPartitionInfoMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LawsPartPmmPartitionInfo> list(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo, HttpServletRequest req) {
|
public IPage<LawsPartPmmPartitionInfo> page(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo, Integer pageNo,
|
||||||
QueryWrapper<LawsPartPmmPartitionInfo> queryWrapper =
|
Integer pageSize, HttpServletRequest req) {
|
||||||
QueryGenerator.initQueryWrapper(lawsPartPmmPartitionInfo, req.getParameterMap());
|
QueryWrapper<LawsPartPmmPartitionInfo> queryWrapper = new QueryWrapper<>();
|
||||||
return list(queryWrapper);
|
if(!StringUtils.isBlank(lawsPartPmmPartitionInfo.getStatus())){
|
||||||
|
queryWrapper.eq("IF(l2.id is null,'2','1')",lawsPartPmmPartitionInfo.getStatus());
|
||||||
|
}
|
||||||
|
if(!StringUtils.isBlank(lawsPartPmmPartitionInfo.getRegPartNameCn())){
|
||||||
|
queryWrapper.eq("reg_part_name_cn",lawsPartPmmPartitionInfo.getRegPartNameCn());
|
||||||
|
}
|
||||||
|
Page<LawsPartPmmPartitionInfo> page = new Page<>(pageNo, pageSize);
|
||||||
|
IPage<LawsPartPmmPartitionInfo> re = lawsPartPmmPartitionInfoMapper.pageList(page, queryWrapper);
|
||||||
|
return re;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+33
-81
@@ -58,32 +58,8 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
|
|||||||
Integer pageSize, HttpServletRequest req) {
|
Integer pageSize, HttpServletRequest req) {
|
||||||
QueryWrapper<LawsPartRelevance> queryWrapper =
|
QueryWrapper<LawsPartRelevance> queryWrapper =
|
||||||
QueryGenerator.initQueryWrapper(lawsPartRelevance, req.getParameterMap());
|
QueryGenerator.initQueryWrapper(lawsPartRelevance, req.getParameterMap());
|
||||||
if(!StringUtils.isBlank(lawsPartRelevance.getRegPartNameCn())){
|
|
||||||
LambdaQueryWrapper<LawsPartPmmPartitionInfo> queryLawsPartPmmPartitionInfo = new LambdaQueryWrapper<>();
|
|
||||||
queryLawsPartPmmPartitionInfo.like(LawsPartPmmPartitionInfo::getRegPartNameCn,lawsPartRelevance.getRegPartNameCn());
|
|
||||||
List<LawsPartPmmPartitionInfo> list = lawsPartPmmPartitionInfoService.list(queryLawsPartPmmPartitionInfo);
|
|
||||||
if(!CollectionUtils.isEmpty(list)){
|
|
||||||
List<String> listFndGpc = list.stream().map(LawsPartPmmPartitionInfo::getFndGpc).collect(Collectors.toList());
|
|
||||||
queryWrapper.and(o->{
|
|
||||||
for (int i = 0; i < listFndGpc.size(); i++) {
|
|
||||||
o.like("fnd_gpc",listFndGpc.get(i));
|
|
||||||
if(listFndGpc.size() - 1 != i){
|
|
||||||
o.or();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
queryWrapper.eq("id","");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Page<LawsPartRelevance> page = new Page<>(pageNo, pageSize);
|
Page<LawsPartRelevance> page = new Page<>(pageNo, pageSize);
|
||||||
IPage<LawsPartRelevance> re = 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;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,63 +98,47 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(LawsPartRelevance lawsPartRelevance) {
|
public void add(LawsPartRelevance lawsPartRelevance) {
|
||||||
// todo 是奇瑞型号的型号型式必填功能系统码和技术特性判定要求,不是奇瑞型号的不用填写
|
checkData(lawsPartRelevance);
|
||||||
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<>();
|
LambdaQueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new LambdaQueryWrapper<>();
|
||||||
queryLawsPartRelevance.eq(LawsPartRelevance::getFndGpc,fndGpc);
|
queryLawsPartRelevance.eq(LawsPartRelevance::getRegPartNameCn,lawsPartRelevance.getRegPartNameCn());
|
||||||
queryLawsPartRelevance.eq(LawsPartRelevance::getSystemCode,systemCode);
|
queryLawsPartRelevance.eq(LawsPartRelevance::getSystemCode,lawsPartRelevance.getSystemCode());
|
||||||
long l = count(queryLawsPartRelevance);
|
long l = count(queryLawsPartRelevance);
|
||||||
if(l > 0){
|
if(l > 0){
|
||||||
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
||||||
"名称与功能系统码 already exists" : "名称与功能系统码已存在"));
|
"关键零部件名称与功能系统码 already exists" : "关键零部件名称与功能系统码已存在"));
|
||||||
}
|
}
|
||||||
save(lawsPartRelevance);
|
save(lawsPartRelevance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void checkData(LawsPartRelevance lawsPartRelevance) {
|
||||||
public void edit(LawsPartRelevance lawsPartRelevance) {
|
|
||||||
// todo 是奇瑞型号的型号型式必填功能系统码和技术特性判定要求,不是奇瑞型号的不用填写
|
// todo 是奇瑞型号的型号型式必填功能系统码和技术特性判定要求,不是奇瑞型号的不用填写
|
||||||
List<String> formType = Arrays.asList(lawsPartRelevance.getFormType().split(","));
|
List<String> formType = Arrays.asList(lawsPartRelevance.getFormType().split(","));
|
||||||
if(formType.contains("1")){
|
if (formType.contains("1")) {
|
||||||
if(StringUtils.isBlank(lawsPartRelevance.getSystemCode())){
|
if (StringUtils.isBlank(lawsPartRelevance.getSystemCode())) {
|
||||||
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(), Locale.ENGLISH) ?
|
||||||
"功能系统码 cannot be empty" : "功能系统码不能为空"));
|
"功能系统码 cannot be empty" : "功能系统码不能为空"));
|
||||||
}
|
}
|
||||||
if(StringUtils.isBlank(lawsPartRelevance.getDecisionRequirement())){
|
if (StringUtils.isBlank(lawsPartRelevance.getDecisionRequirement())) {
|
||||||
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(), Locale.ENGLISH) ?
|
||||||
"技术特性判定要求 cannot be empty" : "技术特性判定要求不能为空"));
|
"技术特性判定要求 cannot be empty" : "技术特性判定要求不能为空"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void edit(LawsPartRelevance lawsPartRelevance) {
|
||||||
|
checkData(lawsPartRelevance);
|
||||||
// 需要做名称+功能系统码唯一性校验
|
// 需要做名称+功能系统码唯一性校验
|
||||||
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<>();
|
LambdaQueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new LambdaQueryWrapper<>();
|
||||||
queryLawsPartRelevance.eq(LawsPartRelevance::getFndGpc,fndGpc);
|
queryLawsPartRelevance.eq(LawsPartRelevance::getRegPartNameCn,lawsPartRelevance.getRegPartNameCn());
|
||||||
queryLawsPartRelevance.eq(LawsPartRelevance::getSystemCode,systemCode);
|
queryLawsPartRelevance.eq(LawsPartRelevance::getSystemCode,lawsPartRelevance.getSystemCode());
|
||||||
queryLawsPartRelevance.ne(LawsPartRelevance::getId,lawsPartRelevance.getId());
|
queryLawsPartRelevance.ne(LawsPartRelevance::getId,lawsPartRelevance.getId());
|
||||||
long l = count(queryLawsPartRelevance);
|
long l = count(queryLawsPartRelevance);
|
||||||
if(l > 0){
|
if(l > 0){
|
||||||
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
||||||
"名称与功能系统码 already exists" : "名称与功能系统码已存在"));
|
"关键零部件名称与功能系统码 already exists" : "关键零部件名称与功能系统码已存在"));
|
||||||
}
|
}
|
||||||
updateById(lawsPartRelevance);
|
updateById(lawsPartRelevance);
|
||||||
}
|
}
|
||||||
@@ -204,26 +164,17 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
|
|||||||
return Result.error(ResultCommon.IMPORT_DATA_CANNOT_BE_EMPTY);
|
return Result.error(ResultCommon.IMPORT_DATA_CANNOT_BE_EMPTY);
|
||||||
}
|
}
|
||||||
StringBuilder m = new StringBuilder();
|
StringBuilder m = new StringBuilder();
|
||||||
for (LawsPartRelevance lawsPartRelevance : listLawsPartRelevance) {
|
List<String> listRegPartNameCn = listLawsPartRelevance.stream().map(LawsPartRelevance::getRegPartNameCn).collect(Collectors.toList());
|
||||||
List<String> list = Arrays.asList(lawsPartRelevance.getRegPartNameCn().split(","));
|
LambdaQueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new LambdaQueryWrapper<>();
|
||||||
list.sort(null);
|
queryLawsPartRelevance.in(LawsPartRelevance::getRegPartNameCn,listRegPartNameCn);
|
||||||
String fndGpc = String.join(",", list);
|
|
||||||
lawsPartRelevance.setRegPartNameCn(fndGpc);
|
|
||||||
lawsPartRelevance.setFndGpc(fndGpc);
|
|
||||||
}
|
|
||||||
List<String> listCode = listLawsPartRelevance.stream().map(o->o.getFndGpc() + "_" +o.getSystemCode()).collect(Collectors.toList());
|
|
||||||
QueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new QueryWrapper<>();
|
|
||||||
queryLawsPartRelevance.select("CONCAT(fnd_gpc,'_',system_code) as fnd_gpc");
|
|
||||||
queryLawsPartRelevance.in("CONCAT(fnd_gpc,'_',system_code)",listCode);
|
|
||||||
List<LawsPartRelevance> listOld = list(queryLawsPartRelevance);
|
List<LawsPartRelevance> listOld = list(queryLawsPartRelevance);
|
||||||
List<LawsPartRelevance> listNotNull = listLawsPartRelevance.stream().filter(o->!StringUtils.isBlank(o.getFndGpc())).collect(Collectors.toList());
|
List<LawsPartRelevance> listNotNull = listLawsPartRelevance.stream().filter(o->!StringUtils.isBlank(o.getRegPartNameCn())).collect(Collectors.toList());
|
||||||
List<LawsPartPmmPartitionInfo> lawsPartPmmPartitionInfoList = new ArrayList<>();
|
List<LawsPartPmmPartitionInfo> lawsPartPmmPartitionInfoList = new ArrayList<>();
|
||||||
if(!CollectionUtils.isEmpty(listNotNull)){
|
if(!CollectionUtils.isEmpty(listNotNull)){
|
||||||
List<String> listFndGpc = listLawsPartRelevance.stream().map(LawsPartRelevance::getFndGpc).collect(Collectors.toList());
|
|
||||||
String fndGpc = String.join(",", listFndGpc);
|
|
||||||
listFndGpc = Arrays.asList(fndGpc.split(","));
|
|
||||||
LambdaQueryWrapper<LawsPartPmmPartitionInfo> queryLawsPartPmmPartitionInfo = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<LawsPartPmmPartitionInfo> queryLawsPartPmmPartitionInfo = new LambdaQueryWrapper<>();
|
||||||
queryLawsPartPmmPartitionInfo.in(LawsPartPmmPartitionInfo::getFndGpc,listFndGpc);
|
queryLawsPartPmmPartitionInfo.select(LawsPartPmmPartitionInfo::getRegPartNameCn);
|
||||||
|
queryLawsPartPmmPartitionInfo.in(LawsPartPmmPartitionInfo::getRegPartNameCn,listRegPartNameCn);
|
||||||
|
queryLawsPartPmmPartitionInfo.groupBy(LawsPartPmmPartitionInfo::getRegPartNameCn);
|
||||||
lawsPartPmmPartitionInfoList = lawsPartPmmPartitionInfoService
|
lawsPartPmmPartitionInfoList = lawsPartPmmPartitionInfoService
|
||||||
.list(queryLawsPartPmmPartitionInfo);
|
.list(queryLawsPartPmmPartitionInfo);
|
||||||
}
|
}
|
||||||
@@ -264,10 +215,9 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
|
|||||||
s.append(Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
s.append(Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
||||||
"关键零部件名称 does not exist," : "关键零部件名称不存在,");
|
"关键零部件名称 does not exist," : "关键零部件名称不存在,");
|
||||||
}else{
|
}else{
|
||||||
List<String> listFndGpc = Arrays.asList(lawsPartRelevance.getFndGpc().split(","));
|
long l = lawsPartPmmPartitionInfoList.stream().filter(o->
|
||||||
long l = lawsPartPmmPartitionInfoList
|
Objects.equals(lawsPartRelevance.getRegPartNameCn(),o.getRegPartNameCn())).count();
|
||||||
.stream().filter(o->listFndGpc.contains(o.getFndGpc())).count();
|
if(l == 0){
|
||||||
if(l != listFndGpc.size()){
|
|
||||||
s.append(Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
s.append(Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
||||||
"关键零部件名称 does not exist," : "关键零部件名称不存在,");
|
"关键零部件名称 does not exist," : "关键零部件名称不存在,");
|
||||||
}
|
}
|
||||||
@@ -285,9 +235,11 @@ public class LawsPartRelevanceServiceImpl extends ServiceImpl<LawsPartRelevanceM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 校验是否存在
|
// 校验是否存在
|
||||||
String code = lawsPartRelevance.getFndGpc() + "_" + lawsPartRelevance.getSystemCode();
|
String code = lawsPartRelevance.getRegPartNameCn() + "_" + lawsPartRelevance.getSystemCode();
|
||||||
if(!CollectionUtils.isEmpty(listOld)){
|
if(!CollectionUtils.isEmpty(listOld)){
|
||||||
long l = listOld.stream().filter(o->Objects.equals(o.getFndGpc(), code)).count();
|
long l = listOld.stream().filter(o->
|
||||||
|
Objects.equals(o.getRegPartNameCn() + "_" + lawsPartRelevance.getSystemCode(), code))
|
||||||
|
.count();
|
||||||
if(l > 0){
|
if(l > 0){
|
||||||
s.append((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
s.append((Objects.equals(LocaleContextHolder.getLocale(),Locale.ENGLISH) ?
|
||||||
"关键零部件名称与功能系统码 already exists," : "关键零部件名称与功能系统码已存在,"));
|
"关键零部件名称与功能系统码 already exists," : "关键零部件名称与功能系统码已存在,"));
|
||||||
|
|||||||
Reference in New Issue
Block a user