认证清单-修改历史完善。67009

This commit is contained in:
wangzhijiang
2023-03-28 15:10:51 +08:00
parent c4822fa7ef
commit 5575134a49
3 changed files with 436 additions and 134 deletions
@@ -311,4 +311,12 @@ public interface ISysUserService extends IService<SysUser> {
* @return
*/
String getUserThirdIdByUserId(List<SysUser> sysUserList, String userId);
/**
* 根据用户id,获取用户名
* @param sysUserList
* @param userId
* @return
*/
String getUsernameByUserId(List<SysUser> sysUserList, String userId);
}
@@ -782,4 +782,19 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
return result;
}
@Override
public String getUsernameByUserId(List<SysUser> sysUserList, String userId) {
String result = "";
if(CollectionUtils.isNotEmpty(sysUserList)){
result = sysUserList.stream().filter(user -> {
boolean flag = false;
if (org.apache.commons.lang3.StringUtils.equals(userId, user.getId())) {
flag = true;
}
return flag;
}).map(SysUser::getUsername).collect(Collectors.joining(","));
}
return result;
}
}
@@ -220,8 +220,19 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
}
// 获取编辑前的数据
ProjectCertificationInventoryEO editBeforePciEo = this.queryById(projectCertificationInventoryEO.getId());
Map<String,Object> savePciLogParams = new HashMap<>();
List<ProjectCertificationInventoryEO> editBeforePciList = new ArrayList<>();
editBeforePciList.add(editBeforePciEo);
List<ProjectCertificationInventoryEO> editAfterPciList = new ArrayList<>();
editAfterPciList.add(projectCertificationInventoryEO);
savePciLogParams.put("editBeforePciList",editBeforePciList);
savePciLogParams.put("editAfterPciList",editAfterPciList);
savePciLogParams.put("operatorType",OperatorTypeEnum.CERTIFICATION_INVENTORY_EDIT.getValue());
this.saveProjectCertificationInventoryLog(savePciLogParams);
Date now = new Date();
Date now = new Date();
projectCertificationInventoryEO.setUpdateTime(now);
saveOrUpdate(projectCertificationInventoryEO);
//设置权限 先删后加
@@ -325,32 +336,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(CollectionUtils.isNotEmpty(saveDataList)){
this.saveBatch(saveDataList);
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO certificationInventoryEO : saveDataList) {
StringBuilder contentCnSb = new StringBuilder();
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 ");
contentCnSb.append("\"").append(certificationInventoryEO.getCategory()).append("\"").append(" ");
contentCnSb.append("\"").append(certificationInventoryEO.getInspectionItem()).append("\"").append(" ");
contentCnSb.append("\"").append(certificationInventoryEO.getConfigItem()).append("\"").append(" ");
contentCnSb.append("\"").append(certificationInventoryEO.getSerialNumber()).append("\"").append(" ");
StringBuilder contentEnSb = new StringBuilder();
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added ");
contentEnSb.append("\"").append(certificationInventoryEO.getCategory()).append("\"").append(" ");
contentEnSb.append("\"").append(certificationInventoryEO.getInspectionItem()).append("\"").append(" ");
contentEnSb.append("\"").append(certificationInventoryEO.getConfigItem()).append("\"").append(" ");
contentEnSb.append("\"").append(certificationInventoryEO.getSerialNumber()).append("\"");
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(certificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCnSb.toString());
projectCertificationInventoryLogEO.setContentEn(contentEnSb.toString());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
this.saveProjectCertificationInventoryLog(saveDataList,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD.getValue());
}
}catch (Exception ex){
throw new JeroBootException("添加失败!");
@@ -804,6 +790,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
// projectCertificationInventoryEO.setEndTime(DateUtils.str2Date(endTime,DateUtils.date_sdf.get()));
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_ISSUE.getValue());
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
@@ -1250,23 +1238,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){
throw new JeroBootException("至少选择一条数据流程状态为'结果待审查'的数据!");
}
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue());
String contentCn = "\"" + currentUser.getUsername() + "\"" +"审核退回";
String contentEn = "\"" + currentUser.getUsername() + "\"" +" review and returned";
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCn);
projectCertificationInventoryLogEO.setContentEn(contentEn);
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_RETURNED.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_RETURNED.getValue());
ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
@@ -1323,24 +1299,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
throw new JeroBootException("至少选择一条数据流程状态为'结果待审查'的数据!");
}
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue());
String contentCn = "\"" + currentUser.getUsername() + "\"" +"审核通过";
String contentEn = "\"" + currentUser.getUsername() + "\"" +" pass the audit";
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCn);
projectCertificationInventoryLogEO.setContentEn(contentEn);
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_THROUGH.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_THROUGH.getValue());
ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
@@ -1449,36 +1412,12 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEOList.add(processInfoDetailEO);
}
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
// 数据更新为结果待审查
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue());
String contentCn = "";
String contentEn = "";
if (StringUtils.equals(projectCertificationInventoryEO.getValueType(), SysCategoryValueTypeEnum.FILE.getValue())) {
String fileName = "N/A";
if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliveryResult())) {
fileName = this.ossFileService.getFileInfos(projectCertificationInventoryEO.getDeliveryResult()).stream().map(OSSFile::getFileName).distinct().collect(Collectors.joining(","));
}
contentCn = "\"" + currentUser.getUsername() + "\"" +"提交了附件 " + fileName;
contentEn = "\"" + currentUser.getUsername() + "\"" +" submitted attachment " + fileName;
}else {
String deliveryResult = (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliveryResult()) ? projectCertificationInventoryEO.getDeliveryResult() : "N/A");
contentCn = "\"" + currentUser.getUsername() + "\"" +"提交了交付结果为" + deliveryResult;
contentEn = "\"" + currentUser.getUsername() + "\"" +" submitted a delivery result of " + deliveryResult;
}
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCn);
projectCertificationInventoryLogEO.setContentEn(contentEn);
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue());
List<SysUser> certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList);
@@ -1546,7 +1485,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!");
}
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue());
@@ -1556,20 +1494,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
processInfoDetailEO.setEndTime(projectCertificationInventoryEO.getEndTime());
processInfoDetailEO.setProjectLawsInventoryId(projectCertificationInventoryEO.getId());
processInfoDetailEOList.add(processInfoDetailEO);
String contentCn = "\"" + currentUser.getUsername() + "\"" +"接受了任务信息";
String contentEn = "\"" + currentUser.getUsername() + "\"" +" accepts the task information";
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCn);
projectCertificationInventoryLogEO.setContentEn(contentEn);
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_ACCEPT_TASK.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_ACCEPT_TASK.getValue());
String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文
String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文
@@ -1677,24 +1604,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!");
}
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue());
String contentCn = "\"" + currentUser.getUsername() + "\"" +"退回了任务信息";
String contentEn = "\"" + currentUser.getUsername() + "\"" +" returned the task information";
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCn);
projectCertificationInventoryLogEO.setContentEn(contentEn);
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue());
String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文
String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文
@@ -1842,22 +1756,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
});
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue());
}
String contentCn = "\"" + currentUser.getUsername() + "\"" +"拒绝,流程退回至" + "\"" +studioEngineerUserInfo.get(0).getUsername()+"\"";
String contentEn = "\"" + currentUser.getUsername() + "\"" +" refuses, and the process returns to " + "\"" +studioEngineerUserInfo.get(0).getUsername()+"\"";
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCn);
projectCertificationInventoryLogEO.setContentEn(contentEn);
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_RETURNED_STUDIO_TASK.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_RETURNED_STUDIO_TASK.getValue());
Map<String, Object> standNameAndItemName = this.getStandNameAndItemName(projectCertificationInventoryEOList);
String standName = (String) standNameAndItemName.get("standName");
@@ -1959,7 +1862,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
Map<String, List<ProjectCertificationInventoryEO>> certifycationInventoryListByDutyPersonMap = projectCertificationInventoryEOList.stream().collect(Collectors.groupingBy(ProjectCertificationInventoryEO::getDutyPerson));
try {
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
// 给责任人分配待办中心的任务
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
@@ -1970,20 +1872,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
processInfoDetailEO.setEndTime(projectCertificationInventoryEO.getEndTime());
processInfoDetailEO.setProjectLawsInventoryId(projectCertificationInventoryEO.getId());
processInfoDetailEOList.add(processInfoDetailEO);
String contentCn = "\"" + currentUser.getUsername() + "\"" +"发起了Pre-Homo流程";
String contentEn = "The \"" + currentUser.getUsername() + "\"" +" initiates the Pre-Homo process";
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCn);
projectCertificationInventoryLogEO.setContentEn(contentEn);
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_INITIATING_TASK.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_INITIATING_TASK.getValue());
this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.ZRRJSRW.getKey());
@@ -2100,6 +1991,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(StringUtils.isEmpty(ids)){
throw new JeroBootException("至少选择一条数据进行流程重置!");
}
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String operatorType = json.getString("operatorType");
@@ -2110,6 +2002,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
List<String> certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文
String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文
@@ -2122,6 +2015,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
QueryWrapper<ProjectCertificationInventoryEO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList);
queryWrapper.lambda().ne(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue());
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.list(queryWrapper);
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
@@ -2144,7 +2038,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
// 把交付结果、截止日期清空,流程状态 设置为 清单待发布
LambdaUpdateWrapper<ProjectCertificationInventoryEO> updateWrap = new LambdaUpdateWrapper<>();
updateWrap.set(ProjectCertificationInventoryEO::getDeliveryResult,null);
// 流程重置,清空截止日期, 撤回不清空。 对应禅道问题:67048
if(StringUtils.equals(operatorType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_RESET.getValue())){
updateWrap.set(ProjectCertificationInventoryEO::getEndTime,null);
@@ -2155,6 +2048,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
this.update(updateWrap);
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,operatorType);
// 处理待办中心相关数据
// 更新该项目认证流程中,认证工程师的任务状态。
// 认证工程师接受任务节点
@@ -2176,7 +2071,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
this.processInfoDetailEOService.remove(detailRemoveWrap);
try {
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
if(CollectionUtils.isNotEmpty(certificationEngineerList)){
for (String certificationEngineerId : certificationEngineerIdList) {
String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerList,certificationEngineerId);
@@ -3348,4 +3242,389 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
permission.setUpdateTime(now);
adds.add(permission);
}
/**
* 保存认证清单修改历史
* @param pciList
* @param operateType
*/
public void saveProjectCertificationInventoryLog(List<ProjectCertificationInventoryEO> pciList,String operateType){
if(CollectionUtils.isNotEmpty(pciList)){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String projectLibraryId = pciList.get(0).getProjectLibraryId();
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectLibraryId);
List<SysUser> studioEngineerUserInfo = this.sysUserService.querySysUserListByIdList(Arrays.asList(projectLibraryBase.getStudioEngineer().split(",")));
List<String> certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
String certificationEngineerUserNames = certificationEngineerList.stream().map(SysUser::getUsername).distinct().collect(Collectors.joining(","));
List<ProjectCertificationInventoryLogEO> pciLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO pci : pciList) {
StringBuilder contentCnSb = new StringBuilder();
StringBuilder contentEnSb = new StringBuilder();
if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 ");
contentCnSb.append("\"").append(pci.getCategory()).append("\"").append(" ");
contentCnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" ");
contentCnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" ");
contentCnSb.append("\"").append(pci.getSerialNumber()).append("\"").append(" ");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added ");
contentEnSb.append("\"").append(pci.getCategory()).append("\"").append(" ");
contentEnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" ");
contentEnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" ");
contentEnSb.append("\"").append(pci.getSerialNumber()).append("\"");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_ISSUE.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("发布了认证清单");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" has published a certification list");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_RETURNED.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("审核退回");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" review and returned");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_THROUGH.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("审核通过");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" pass the audit");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue())){
if (StringUtils.equals(pci.getValueType(), SysCategoryValueTypeEnum.FILE.getValue())) {
String fileName = "N/A";
if (StringUtils.isNotEmpty(pci.getDeliveryResult())) {
fileName = this.ossFileService.getFileInfos(pci.getDeliveryResult()).stream().map(OSSFile::getFileName).distinct().collect(Collectors.joining(","));
}
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("提交了附件 ").append(fileName);
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" submitted attachment ").append(fileName);
}else {
String deliveryResult = (StringUtils.isNotEmpty(pci.getDeliveryResult()) ? pci.getDeliveryResult() : "N/A");
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("提交了交付结果为").append(deliveryResult);
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" submitted a delivery result of ").append(deliveryResult);
}
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_ACCEPT_TASK.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("接受了任务信息");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" accepts the task information");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("退回了任务信息");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" returned the task information");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_RETURNED_STUDIO_TASK.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("拒绝,流程退回至")
.append("\"").append(studioEngineerUserInfo.get(0).getUsername()).append("\"");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" refuses, and the process returns to ")
.append("\"").append(studioEngineerUserInfo.get(0).getUsername()).append("\"");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_INITIATING_TASK.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("发起了Pre-Homo流程");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" initiates the Pre-Homo process");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_RESET.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("操作了流程重置功能");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" has operated the process reset function");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_WITHDRAW.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("").append("\"").append(certificationEngineerUserNames).append("\"撤回了流程");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" withdrew the process from \"").append(certificationEngineerUserNames).append("\"");
}
ProjectCertificationInventoryLogEO pciLogEO = new ProjectCertificationInventoryLogEO();
pciLogEO.setProjectCertificationInventoryId(pci.getId());
pciLogEO.setContentCn(contentCnSb.toString());
pciLogEO.setContentEn(contentEnSb.toString());
pciLogEO.setOperatorType(operateType);
pciLogEOList.add(pciLogEO);
}
if(CollectionUtils.isNotEmpty(pciLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(pciLogEOList);
}
}
}
/**
* 保存认证清单修改历史(编辑、批量设置专用)
* @param params
*/
public void saveProjectCertificationInventoryLog(Map<String,Object> params){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProjectCertificationInventoryEO> editBeforePciList = (List<ProjectCertificationInventoryEO>) params.get("editBeforePciList");
List<ProjectCertificationInventoryEO> editAfterPciList = (List<ProjectCertificationInventoryEO>) params.get("editAfterPciList");
String operatorType = (String) params.get("operatorType");
if(CollectionUtils.isNotEmpty(editBeforePciList) && CollectionUtils.isNotEmpty(editAfterPciList)){
List<SysCategory> categoryList = this.sysCategoryService.list();
List<SysDictItem> sysDictItems = this.sysDictItemServiceImpl.getBaseMapper().selectItemsAll();
List<String> beforeSdtUserIdList = editBeforePciList.stream().map(ProjectCertificationInventoryEO::getSdt).distinct().collect(Collectors.toList());
List<String> beforeDutyPersonUserIdList = editBeforePciList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
List<String> afterSdtUserIdList = editAfterPciList.stream().map(ProjectCertificationInventoryEO::getSdt).distinct().collect(Collectors.toList());
List<String> afterDutyPersonUserIdList = editAfterPciList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
List<String> userIdList = new ArrayList<>();
userIdList.addAll(beforeSdtUserIdList);
userIdList.addAll(beforeDutyPersonUserIdList);
userIdList.addAll(afterSdtUserIdList);
userIdList.addAll(afterDutyPersonUserIdList);
List<SysUser> userList = this.sysUserService.querySysUserListByIdList(userIdList);
List<String> beforeDeliverableTemplateIdList = editBeforePciList.stream().map(ProjectCertificationInventoryEO::getDeliverableTemplate).distinct().collect(Collectors.toList());
List<String> afterDeliverableTemplateIdList = editAfterPciList.stream().map(ProjectCertificationInventoryEO::getDeliverableTemplate).distinct().collect(Collectors.toList());
List<String> allDeliverableTemplateIdList = new ArrayList<>();
allDeliverableTemplateIdList.addAll(beforeDeliverableTemplateIdList);
allDeliverableTemplateIdList.addAll(afterDeliverableTemplateIdList);
List<OSSFile> allDeliverableTemplateList = this.ossFileService.getFileInfos(allDeliverableTemplateIdList.stream().distinct().collect(Collectors.joining(",")));
List<ProjectCertificationInventoryLogEO> pciLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO editAfterPciEo : editAfterPciList) {
List<ProjectCertificationInventoryEO> editBeforePciListTemp = editBeforePciList.stream().filter(editBeforePciEo -> {
boolean flag = false;
if (StringUtils.equals(editAfterPciEo.getId(), editBeforePciEo.getId())) {
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(editBeforePciListTemp)){
boolean savePciLogFlag = false;
ProjectCertificationInventoryEO editBeforePciEo = editBeforePciListTemp.get(0);
if(ObjectUtils.isNotEmpty(editBeforePciEo)){
StringBuilder contentCnSb = new StringBuilder();
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("");
StringBuilder contentEnSb = new StringBuilder();
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" changes the ");
if(!StringUtils.equals(editBeforePciEo.getWvtaId(),editAfterPciEo.getWvtaId())){
contentCnSb.append("\"").append("WVTA ID").append("\" ")
.append(StringUtils.isNotEmpty(editBeforePciEo.getWvtaId()) ? editBeforePciEo.getWvtaId() : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(editAfterPciEo.getWvtaId()) ? editAfterPciEo.getWvtaId() : "")
.append(",");
contentEnSb.append("\"").append("WVTA ID").append("\" ")
.append(StringUtils.isNotEmpty(editBeforePciEo.getWvtaId()) ? editBeforePciEo.getWvtaId() : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(editAfterPciEo.getWvtaId()) ? editAfterPciEo.getWvtaId() : "null")
.append(",");
savePciLogFlag = true;
}
if(!StringUtils.equals(editBeforePciEo.getCategory(),editAfterPciEo.getCategory())){
contentCnSb.append("\"").append("类别").append("\" ")
.append(StringUtils.isNotEmpty(editBeforePciEo.getCategory()) ? editBeforePciEo.getCategory() : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(editAfterPciEo.getCategory()) ? editAfterPciEo.getCategory() : "")
.append(",");
contentEnSb.append("\"").append("Category").append("\" ")
.append(StringUtils.isNotEmpty(editBeforePciEo.getCategory()) ? editBeforePciEo.getCategory() : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(editAfterPciEo.getCategory()) ? editAfterPciEo.getCategory() : "null")
.append(",");
savePciLogFlag = true;
}
if(!StringUtils.equals(editBeforePciEo.getInspectionItem(),editAfterPciEo.getInspectionItem())){
contentCnSb.append("\"").append("检验项目").append("\" ")
.append(StringUtils.isNotEmpty(editBeforePciEo.getInspectionItem()) ? editBeforePciEo.getInspectionItem() : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(editAfterPciEo.getInspectionItem()) ? editAfterPciEo.getInspectionItem() : "")
.append(",");
contentEnSb.append("\"").append("Inspection Items").append("\" ")
.append(StringUtils.isNotEmpty(editBeforePciEo.getInspectionItem()) ? editBeforePciEo.getInspectionItem() : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(editAfterPciEo.getInspectionItem()) ? editAfterPciEo.getInspectionItem() : "null")
.append(",");
savePciLogFlag = true;
}
if(!StringUtils.equals(editBeforePciEo.getConfigItem(),editAfterPciEo.getConfigItem())){
contentCnSb.append("\"").append("配置项").append("\" ")
.append(StringUtils.isNotEmpty(editBeforePciEo.getConfigItem()) ? editBeforePciEo.getConfigItem() : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(editAfterPciEo.getConfigItem()) ? editAfterPciEo.getConfigItem() : "")
.append(",");
contentEnSb.append("\"").append("Configuration Item").append("\" ")
.append(StringUtils.isNotEmpty(editBeforePciEo.getConfigItem()) ? editBeforePciEo.getConfigItem() : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(editAfterPciEo.getConfigItem()) ? editAfterPciEo.getConfigItem() : "null")
.append(",");
savePciLogFlag = true;
}
if(!StringUtils.equals(editBeforePciEo.getDutyTerritory(),editAfterPciEo.getDutyTerritory())){
String beforeDutyTerritoryNameCn = this.sysDictItemService.disposeShowDictItemValue(
sysDictItems,
editBeforePciEo.getDutyTerritory(),
CutEnum.CN.getValue(),
ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()
);
String beforeDutyTerritoryNameEn = this.sysDictItemService.disposeShowDictItemValue(
sysDictItems,
editBeforePciEo.getDutyTerritory(),
CutEnum.EN.getValue(),
ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()
);
String afterDutyTerritoryNameCn = this.sysDictItemService.disposeShowDictItemValue(
sysDictItems,
editAfterPciEo.getDutyTerritory(),
CutEnum.CN.getValue(),
ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()
);
String afterDutyTerritoryNameEn = this.sysDictItemService.disposeShowDictItemValue(
sysDictItems,
editAfterPciEo.getDutyTerritory(),
CutEnum.EN.getValue(),
ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()
);
contentCnSb.append("\"").append("责任领域").append("\" ")
.append(StringUtils.isNotEmpty(beforeDutyTerritoryNameCn) ? beforeDutyTerritoryNameCn : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(afterDutyTerritoryNameCn) ? afterDutyTerritoryNameCn : "")
.append(",");
contentEnSb.append("\"").append("Responsible Field").append("\" ")
.append(StringUtils.isNotEmpty(beforeDutyTerritoryNameEn) ? beforeDutyTerritoryNameEn : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(afterDutyTerritoryNameEn) ? afterDutyTerritoryNameEn : "null")
.append(",");
savePciLogFlag = true;
}
if(!StringUtils.equals(editBeforePciEo.getDeliverableType(),editAfterPciEo.getDeliverableType())){
String beforeDeliverableTypeNameCn = this.getTreeName(CutEnum.CN.getValue(), categoryList, Arrays.asList(editBeforePciEo.getDeliverableType().split(",")));
String beforeDeliverableTypeNameEn = this.getTreeName(CutEnum.EN.getValue(), categoryList, Arrays.asList(editBeforePciEo.getDeliverableType().split(",")));
String afterDeliverableTypeNameCn = this.getTreeName(CutEnum.CN.getValue(), categoryList, Arrays.asList(editAfterPciEo.getDeliverableType().split(",")));
String afterDeliverableTypeNameEn = this.getTreeName(CutEnum.EN.getValue(), categoryList, Arrays.asList(editAfterPciEo.getDeliverableType().split(",")));
contentCnSb.append("\"").append("交付物类型").append("\" ")
.append(StringUtils.isNotEmpty(beforeDeliverableTypeNameCn) ? beforeDeliverableTypeNameCn : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(afterDeliverableTypeNameCn) ? afterDeliverableTypeNameCn : "")
.append(",");
contentEnSb.append("\"").append("Deliverable Type").append("\" ")
.append(StringUtils.isNotEmpty(beforeDeliverableTypeNameEn) ? beforeDeliverableTypeNameEn : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(afterDeliverableTypeNameEn) ? afterDeliverableTypeNameEn : "null")
.append(",");
savePciLogFlag = true;
}
if(!StringUtils.equals(editBeforePciEo.getDeliverableTemplate(),editAfterPciEo.getDeliverableTemplate())){
String[] beforeDeliverableTemplateArr = StringUtils.isNotEmpty(editBeforePciEo.getDeliverableTemplate()) ? editBeforePciEo.getDeliverableTemplate().split(",") : null;
String[] afterDeliverableTemplateArr = StringUtils.isNotEmpty(editAfterPciEo.getDeliverableTemplate()) ? editAfterPciEo.getDeliverableTemplate().split(",") : null;
String beforeDeliverableTemplateName = allDeliverableTemplateList.stream().filter(file -> {
boolean flag = false;
if(beforeDeliverableTemplateArr != null){
for (String beforeDeliverableTemplate : beforeDeliverableTemplateArr) {
if(StringUtils.equals(file.getId(),beforeDeliverableTemplate)){
flag = true;
}
}
}
return flag;
}).map(OSSFile::getFileName).collect(Collectors.joining(","));
String afterDeliverableTemplateName = allDeliverableTemplateList.stream().filter(file -> {
boolean flag = false;
if(afterDeliverableTemplateArr != null){
for (String afterDeliverableTemplate : afterDeliverableTemplateArr) {
if(StringUtils.equals(file.getId(),afterDeliverableTemplate)){
flag = true;
}
}
}
return flag;
}).map(OSSFile::getFileName).collect(Collectors.joining(","));
contentCnSb.append("\"").append("交付物模板").append("\" ")
.append(StringUtils.isNotEmpty(beforeDeliverableTemplateName) ? beforeDeliverableTemplateName : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(afterDeliverableTemplateName) ? afterDeliverableTemplateName : "")
.append(",");
contentEnSb.append("\"").append("Deliverable Template").append("\" ")
.append(StringUtils.isNotEmpty(beforeDeliverableTemplateName) ? beforeDeliverableTemplateName : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(afterDeliverableTemplateName) ? afterDeliverableTemplateName : "null")
.append(",");
savePciLogFlag = true;
}
if(!StringUtils.equals(editBeforePciEo.getSdt(),editAfterPciEo.getSdt())){
String beforeSdtUserName = this.sysUserService.getUsernameByUserId(userList,editBeforePciEo.getSdt());
String afterSdtUserName = this.sysUserService.getUsernameByUserId(userList,editAfterPciEo.getSdt());
contentCnSb.append("\"").append("工程接口人").append("\" ")
.append(StringUtils.isNotEmpty(beforeSdtUserName) ? beforeSdtUserName : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(afterSdtUserName) ? afterSdtUserName : "")
.append(",");
contentEnSb.append("\"").append("Eng. Interface").append("\" ")
.append(StringUtils.isNotEmpty(beforeSdtUserName) ? beforeSdtUserName : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(afterSdtUserName) ? afterSdtUserName : "null")
.append(",");
savePciLogFlag = true;
}
String beforeEndTimeStr = "";
if(editBeforePciEo.getEndTime() != null){
beforeEndTimeStr = DateUtils.formatDate(editBeforePciEo.getEndTime());
}
String afterEndTimeStr = "";
if(editAfterPciEo.getEndTime() != null){
afterEndTimeStr = DateUtils.formatDate(editAfterPciEo.getEndTime());
}
if(!StringUtils.equals(beforeEndTimeStr,afterEndTimeStr)){
contentCnSb.append("\"").append("截止日期").append("\" ")
.append(StringUtils.isNotEmpty(beforeEndTimeStr) ? beforeEndTimeStr : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(afterEndTimeStr) ? afterEndTimeStr : "")
.append(",");
contentEnSb.append("\"").append("Due Date").append("\" ")
.append(StringUtils.isNotEmpty(beforeEndTimeStr) ? beforeEndTimeStr : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(afterEndTimeStr) ? afterEndTimeStr : "null")
.append(",");
savePciLogFlag = true;
}
if(!StringUtils.equals(editBeforePciEo.getDutyPerson(),editAfterPciEo.getDutyPerson())){
String beforeDutyPersonUserName = this.sysUserService.getUsernameByUserId(userList,editBeforePciEo.getDutyPerson());
String afterDutyPersonUserName = this.sysUserService.getUsernameByUserId(userList,editAfterPciEo.getDutyPerson());
contentCnSb.append("\"").append("责任人").append("\" ")
.append(StringUtils.isNotEmpty(beforeDutyPersonUserName) ? beforeDutyPersonUserName : "")
.append(" 修改为 ")
.append(StringUtils.isNotEmpty(afterDutyPersonUserName) ? afterDutyPersonUserName : "")
.append(",");
contentEnSb.append("\"").append("Assignee").append("\" ")
.append(StringUtils.isNotEmpty(beforeDutyPersonUserName) ? beforeDutyPersonUserName : "null")
.append(" to ")
.append(StringUtils.isNotEmpty(afterDutyPersonUserName) ? afterDutyPersonUserName : "null")
.append(",");
savePciLogFlag = true;
}
if(savePciLogFlag){
ProjectCertificationInventoryLogEO pciLogEO = new ProjectCertificationInventoryLogEO();
pciLogEO.setProjectCertificationInventoryId(editAfterPciEo.getId());
pciLogEO.setContentCn(contentCnSb.toString().substring(0,contentCnSb.toString().length()-1));
pciLogEO.setContentEn(contentEnSb.toString().substring(0,contentEnSb.toString().length()-1));
pciLogEO.setOperatorType(operatorType);
pciLogEOList.add(pciLogEO);
}
}
}
}
if(CollectionUtils.isNotEmpty(pciLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(pciLogEOList);
}
}
}
}