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

This commit is contained in:
zyx.net
2023-09-25 14:46:58 +08:00
7 changed files with 94 additions and 19 deletions
@@ -23,7 +23,8 @@
SELECT pm.id
FROM params_manifest pm
JOIN ( SELECT id FROM
( SELECT id,substring_index( substring_index( a.certification_engineer, ',', b.help_topic_id + 1 ), ',',- 1 ) user_id
( SELECT id,substring_index( substring_index( a.certification_engineer, ',', b.help_topic_id + 1 ), ',',- 1 ) user_id,
a.platform
FROM
project_library_base a
JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.certification_engineer ) - length( REPLACE ( a.certification_engineer, ',', '' ) ) + 1 )) temp
@@ -118,7 +118,7 @@ public class LawsInventoryPlatformEOController extends JeroController<LawsInvent
if(ObjectUtils.isNotEmpty(json.get("msg"))){
msg = (String)json.get("msg");
}else{
msg = "添加成功!";
msg = "";
}
return Result.OK(msg);
}
@@ -102,8 +102,8 @@ public class ProjectCertificationInventoryEOController extends JeroController<Pr
@ApiOperation(value="勾选认证清单进行关联平台件", notes="勾选认证清单进行关联平台件")
@PostMapping(value = "/listPlatform")
public Result<?> listPlatform(@RequestBody Map<String,Object> params) {
projectCertificationInventoryEOService.listPlatform(params);
return Result.OK();
String msg = projectCertificationInventoryEOService.listPlatform(params);
return Result.OK(msg);
}
/**
@@ -1,24 +1,22 @@
package com.jero.modules.project.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@@ -261,4 +259,8 @@ public class ProjectCertificationInventoryEO implements Serializable {
/**一级责任领域**/
@TableField(exist = false)
private String firstLevelDutyTerritory;
@ApiModelProperty(value = "关联平台件数据")
@TableField(exist = false)
private List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS;
}
@@ -344,5 +344,5 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
* @param params
* @return
*/
void listPlatform(Map<String, Object> params);
String listPlatform(Map<String, Object> params);
}
@@ -73,6 +73,7 @@ import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.enums.ProjectRoleEnum;
import com.jero.modules.system.enums.SysCategoryValueTypeEnum;
import com.jero.modules.system.mapper.SysCategoryMapper;
import com.jero.modules.system.mapper.SysDictItemMapper;
import com.jero.modules.system.mapper.SysRoleMapper;
import com.jero.modules.system.mapper.SysUserMapper;
import com.jero.modules.system.service.IProjectUserDutyTerritoryService;
@@ -109,6 +110,7 @@ import org.aspectj.util.FileUtil;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -230,6 +232,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
private IProcessHistoryEOService processHistoryEOService;
@Autowired
private LawsInventoryPlatformEOServiceImpl lawsInventoryPlatformEOService;
@Autowired
private SysDictItemMapper sysDictItemMapper;
/**
* 保存
@@ -1953,6 +1957,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
for (ProjectCertificationInventoryEO certificationInventoryEO : result) {
if(!projectCertificationInventoryEOS.isEmpty()){
List<LawsInventoryPlatformEO> collect = lawsInventoryPlatformEOList.stream()
.filter(e -> certificationInventoryEO.getId().equals(e.getLawsInventoryId())).collect(Collectors.toList());
if(ObjectUtils.isNotEmpty(collect)){
List<String> platformLawsInventoryIdList = collect.stream()
.map(LawsInventoryPlatformEO::getPlatformLawsInventoryId).distinct().collect(Collectors.toList());
List<ProjectCertificationInventoryEO> inventoryEOList = projectCertificationInventoryEOS.stream()
.filter(e -> platformLawsInventoryIdList.contains(e.getId())).collect(Collectors.toList());
certificationInventoryEO.setProjectCertificationInventoryEOS(inventoryEOList);
}
List<LawsInventoryPlatformEO> inventoryPlatformEOList = lawsInventoryPlatformEOList.stream()
.filter(e -> certificationInventoryEO.getId().equals(e.getLawsInventoryId())).collect(Collectors.toList());
if(!inventoryPlatformEOList.isEmpty()){
@@ -3593,8 +3609,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
throw new JeroBootException("无法获取项目库信息,项目库id为:" + projectLibraryId + " 请联系管理员!");
}
List<String> certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
List<SysUser> certificationEngineerList = new ArrayList<>();
List<String> certificationEngineerIdList = new ArrayList<>();
if(StringUtils.isNotBlank(projectLibraryBase.getCertificationEngineer())){
certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
}
String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文
String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文
@@ -3717,6 +3738,10 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
log.error("studio-流程重置失败:" + ex.getMessage());
throw new JeroBootException("流程重置失败!");
}
//流程重置后将平台件关联信息删除
LambdaQueryWrapper<LawsInventoryPlatformEO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(LawsInventoryPlatformEO::getLawsInventoryId,Arrays.asList(ids.split(",")));
lawsInventoryPlatformEOService.remove(wrapper);
return Result.OK("流程重置成功!");
}
@@ -7029,7 +7054,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
* @return
*/
@Override
public void listPlatform(Map<String,Object> params) {
public String listPlatform(Map<String,Object> params) {
String cut = (String) params.get("cut");//
String ids = (String) params.get("ids");//认证清单id
String projectLibraryIds = (String) params.get("projectLibraryIds");//平台件项目id
@@ -7052,11 +7077,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
wrapper2.in(ProjectLibraryBase::getId,projectIdList);
projectLibraryBaseList = projectLibraryBaseService.list(wrapper2);
}
List<SysDictItem> sysDictItemList = sysDictItemMapper.selectItemsByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue());
List<LawsInventoryPlatformEO> lawsInventoryPlatformEOS = new ArrayList<>();
List<ProjectCertificationInventoryEO> result = new ArrayList<>();
List<ProjectCertificationInventoryEO> emptyList = new ArrayList<>();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : certificationInventoryEOList) {
//类别
String category = projectCertificationInventoryEO.getCategory();
@@ -7090,10 +7117,15 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
//责任领域
String dutyTerritoryTemp = certificationInventoryEO.getDutyTerritory();
if(StringUtils.isBlank(configItem) || "标配".equals(configItem)){
//如果车型项目库中的配置项为空或为标配时直接将平台件信息添加到关联表
if((StringUtils.isBlank(configItem) || "标配".equals(configItem))
&& category.equals(categoryTemp)
&& inspectionItem.equals(inspectionItemTemp)
&& serialNumber.equals(serialNumberTemp)
&& dutyTerritory.equals(dutyTerritoryTemp)){
//如果车型项目库中的配置项为空或为标配时则用类别检验项目编号责任领域去匹配匹配上后将平台件信息添加到关联表
projectCertificationInventoryEOList.add(certificationInventoryEO);
}else if(StringUtils.isNotBlank(configItem) && !"标配".equals(configItem)){
//如果车型项目库中的配置项不为空且不为标配时如果车型项目库认证清单的配置项与平台件认证清单的配置项不一致则不再匹配
//如果一致则用类别检验项目编号责任领域去做匹配
@@ -7106,6 +7138,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
}
}
if(projectCertificationInventoryEOList.isEmpty()){
emptyList.add(projectCertificationInventoryEO);
}
if(!projectCertificationInventoryEOList.isEmpty()){
setDataTemp(lawsInventoryPlatformEOS, projectCertificationInventoryEO, projectCertificationInventoryEOList.get(0));
@@ -7132,6 +7167,39 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(!lawsInventoryPlatformEOS.isEmpty()){
lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS);
}
//认证清单未匹配上平台件的提示语
String html = getMsg(cut, sysDictItemList, emptyList);
return html;
}
@NotNull
private String getMsg(String cut, List<SysDictItem> sysDictItemList, List<ProjectCertificationInventoryEO> emptyList) {
List<String> msgList = new ArrayList<>();
//未匹配上法规清单
if(ObjectUtils.isNotEmpty(emptyList)){
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : emptyList) {
List<String> list = new LinkedList<>();
if(com.jero.modules.system.util.StringUtils.isNotBlank(projectCertificationInventoryEO.getDutyTerritory())){
for (String s : projectCertificationInventoryEO.getDutyTerritory().split(",")) {
List<SysDictItem> collect = sysDictItemList.stream().filter(e -> e.getItemValue().equals(s)).collect(Collectors.toList());
if(CutEnum.CN.getValue().equals(cut) && !collect.isEmpty()){
list.add(collect.get(0).getItemText());
}else if(CutEnum.EN.getValue().equals(cut) && !collect.isEmpty()){
list.add(collect.get(0).getEnName());
}
}
}
String serialNumber = projectCertificationInventoryEO.getSerialNumber();
String dutyTerritoryName = com.jero.modules.system.util.StringUtils.join(list,",");
String msg = serialNumber+" "+dutyTerritoryName+"未匹配到数据";
msgList.add(msg);
}
}
String html = "";
for (String s : msgList) {
html += s + "</br>";
}
return html;
}
private void setDataTemp(List<LawsInventoryPlatformEO> lawsInventoryPlatformEOS,
@@ -4965,6 +4965,10 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE2.getValue(), paramsMsg);
}
}
//流程重置后将平台件关联信息删除
LambdaQueryWrapper<LawsInventoryPlatformEO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(LawsInventoryPlatformEO::getLawsInventoryId,Arrays.asList(ids.split(",")));
lawsInventoryPlatformEOService.remove(wrapper);
return Result.OK("变更成功!");
}