发起清单确认。

This commit is contained in:
wangzhijiang
2022-04-18 19:23:16 +08:00
parent 2a565f6b22
commit f4e575e8c0
2 changed files with 96 additions and 19 deletions
@@ -1,14 +1,9 @@
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 com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@@ -18,7 +13,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/**
@@ -172,6 +166,10 @@ public class ProjectLawsInventoryEO implements Serializable {
@ApiModelProperty(value = "设计符合性确认-交付物模板")
private String designDeliverableTemplate;
/**设计符合性确认-交付物模板名称*/
@TableField(exist = false)
private String designDeliverableTemplateName;
/**设计符合性确认-发起人*/
@Excel(name = "设计符合性确认-发起人", width = 15)
@ApiModelProperty(value = "设计符合性确认-发起人")
@@ -201,6 +199,10 @@ public class ProjectLawsInventoryEO implements Serializable {
@ApiModelProperty(value = "prehomo确认-交付物模板")
private String prehomoDeliverableTemplate;
/**prehomo确认-交付物模板名称*/
@TableField(exist = false)
private String prehomoDeliverableTemplateName;
/**prehomo确认-发起人*/
@Excel(name = "prehomo确认-发起人", width = 15)
@ApiModelProperty(value = "prehomo确认-发起人")
@@ -230,6 +232,10 @@ public class ProjectLawsInventoryEO implements Serializable {
@ApiModelProperty(value = "验证符合性确认-交付物模板")
private String verifyDeliverableTemplate;
/**验证符合性确认-交付物模板名称*/
@TableField(exist = false)
private String verifyDeliverableTemplateName;
/**验证符合性确认-发起人*/
@Excel(name = "验证符合性确认-发起人", width = 15)
@ApiModelProperty(value = "验证符合性确认-发起人")
@@ -276,10 +282,12 @@ public class ProjectLawsInventoryEO implements Serializable {
/**法规工程师提交状态 :0通过 1驳回 */
@ApiModelProperty(value = "法规工程师提交状态")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String regulationOwnerSubmitStatus;
//这两个只要有一个是拒绝 那么该数据的清单确认状态就为拒绝
/**认证工程师提交状态 :0通过 1驳回 */
@ApiModelProperty(value = "认证工程师提交状态")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String homologationEngineerSubmitStatus;
@TableField(exist = false)
@@ -2,12 +2,15 @@ package com.jero.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.enums.*;
@@ -23,6 +26,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -48,6 +52,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
@Autowired
private IBussDocumentLibraryEOService iBussDocumentLibraryEOService;
@Autowired
private IOSSFileService iOSSFileService;
/**
* 保存
*
@@ -170,6 +177,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
public void dataDispose(List<ProjectLawsInventoryEO> list,LoginUser currentUser,int isProjectRole){
if(CollectionUtils.isNotEmpty(list)){
List<String> userIdList = new ArrayList<>();
List<String> deliverableList = new ArrayList<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : list) {
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId())){
userIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
@@ -180,6 +188,19 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())){
userIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
}
//设计符合性确认交付物模板
if(StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDeliverableTemplate())){
deliverableList.addAll(Arrays.asList(projectLawsInventoryEO.getDesignDeliverableTemplate().split(",")));
}
// Prehomo确认交付物模板
if(StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDeliverableTemplate())){
deliverableList.addAll(Arrays.asList(projectLawsInventoryEO.getPrehomoDeliverableTemplate().split(",")));
}
// 验证符合性确认交付物模板
if(StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyDeliverableTemplate())){
deliverableList.addAll(Arrays.asList(projectLawsInventoryEO.getVerifyDeliverableTemplate().split(",")));
}
}
List<SysUser> sysUsers = new ArrayList<>();
@@ -190,6 +211,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
sysUsers = sysUserMapper.selectList(sysUserQueryWrapper);
}
//文件
List<OSSFile> fileInfos = new ArrayList<>();
if(deliverableList.size() != 0){
fileInfos = iOSSFileService.getFileInfos(org.apache.commons.lang3.StringUtils.join(deliverableList, ","));
}
for (ProjectLawsInventoryEO projectLawsInventoryEO : list) {
//处理人员展示名称
if(CollectionUtils.isNotEmpty(sysUsers)){
@@ -245,10 +272,46 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}
projectLawsInventoryEO.setRoleCode(roleCode);
projectLawsInventoryEO.setRoleName(roleName);
//交付物类型模板
if(fileInfos.size() != 0){
if(StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDeliverableTemplate())){
String fileName = getFileName(projectLawsInventoryEO, fileInfos,projectLawsInventoryEO.getDesignDeliverableTemplate());
if(org.apache.commons.lang3.StringUtils.isNotBlank(fileName)){
projectLawsInventoryEO.setDesignDeliverableTemplateName(fileName);
}
}
if(StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDeliverableTemplate())){
String fileName = getFileName(projectLawsInventoryEO, fileInfos,projectLawsInventoryEO.getPrehomoDeliverableTemplate());
if(org.apache.commons.lang3.StringUtils.isNotBlank(fileName)){
projectLawsInventoryEO.setPrehomoDeliverableTemplateName(fileName);
}
}
if(StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyDeliverableTemplate())){
String fileName = getFileName(projectLawsInventoryEO, fileInfos,projectLawsInventoryEO.getVerifyDeliverableTemplate());
if(org.apache.commons.lang3.StringUtils.isNotBlank(fileName)){
projectLawsInventoryEO.setVerifyDeliverableTemplateName(fileName);
}
}
}
}
}
}
private String getFileName(ProjectLawsInventoryEO projectLawsInventoryEO, List<OSSFile> fileInfos, String deliverableTemplate){
StringBuilder sb = new StringBuilder();
for (String s : deliverableTemplate.split(",")) {
List<OSSFile> collect = fileInfos.stream().filter(e -> s.equals(e.getId())).collect(Collectors.toList());
sb.append(collect.get(0).getFileName() + ",");
}
String sbStr = "";
if(org.apache.commons.lang3.StringUtils.isNotBlank(sb)){
sbStr = sb.substring(0, sb.length() - 1);
}
return sbStr;
}
/**
* 验证数据
* @param projectLibraryId 项目id
@@ -343,8 +406,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
try {
//TODO 切换成枚举,不要在代码里出现魔数
if(StringUtils.equals(operatorType, OperatorTypeEnum.INVENTORY_AFFIRM.getValue())){
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd");
//清单确认截止时间
Date inventoryAffirmDueDate = (Date) params.get("inventoryAffirmDueDate");
String inventoryAffirmDueDate = (String) params.get("inventoryAffirmDueDate");
QueryWrapper<ProjectLawsInventoryEO> queryWrapper = new QueryWrapper<>();
if(StringUtils.isNotEmpty(ids)){
@@ -363,10 +427,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(checkStatus && checkUser){
projectLawsInventoryEO.setInventoryAffirmStatus(InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue());
projectLawsInventoryEO.setRegulationOwnerSubmitStatus(null);
projectLawsInventoryEO.setHomologationEngineerSubmitStatus(null);
projectLawsInventoryEO.setInventoryAffirmDueDate(inventoryAffirmDueDate);
super.updateById(projectLawsInventoryEO);
projectLawsInventoryEO.setInventoryAffirmDueDate(sdf.parse(inventoryAffirmDueDate));
LambdaUpdateWrapper<ProjectLawsInventoryEO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(ProjectLawsInventoryEO::getRegulationOwnerSubmitStatus,null);
updateWrapper.set(ProjectLawsInventoryEO::getHomologationEngineerSubmitStatus,null);
updateWrapper.eq(ProjectLawsInventoryEO::getId,projectLawsInventoryEO.getId());
super.update(projectLawsInventoryEO, updateWrapper);
//发送消息
String sendMessage = "XXX" + "发起了" + " XXX " + "(项目名称)法规的清单确认,截止时间为:" +inventoryAffirmDueDate+ " 请及时查看处理。";
}
@@ -403,18 +469,21 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
String inventoryAffirmStatus = "";
//如果法规工程师与认证工程师都是提交通过 把清单确认状态设置为 接受
if(projectLawsInventoryEO.getRegulationOwnerSubmitStatus().equals("0") && projectLawsInventoryEO.getHomologationEngineerSubmitStatus().equals("0")){
inventoryAffirmStatus = InventoryAffirmStatusEnum.ACCEPTED.getValue();
}
//如果法规工程师与认证工程师 其中一个人是拒绝 把清单确认状态设置为 拒绝
if(projectLawsInventoryEO.getRegulationOwnerSubmitStatus().equals("1") || projectLawsInventoryEO.getHomologationEngineerSubmitStatus().equals("1")){
inventoryAffirmStatus = InventoryAffirmStatusEnum.REJECTED.getValue();
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus()) && StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
if(projectLawsInventoryEO.getRegulationOwnerSubmitStatus().equals("0") && projectLawsInventoryEO.getHomologationEngineerSubmitStatus().equals("0")){
inventoryAffirmStatus = InventoryAffirmStatusEnum.ACCEPTED.getValue();
}
//如果法规工程师与认证工程师 其中一个人是拒绝 把清单确认状态设置为 拒绝
if(projectLawsInventoryEO.getRegulationOwnerSubmitStatus().equals("1") || projectLawsInventoryEO.getHomologationEngineerSubmitStatus().equals("1")){
inventoryAffirmStatus = InventoryAffirmStatusEnum.REJECTED.getValue();
}
}
if(StringUtils.isNotEmpty(inventoryAffirmStatus)){
projectLawsInventoryEO.setInventoryAffirmStatus(inventoryAffirmStatus);
super.baseMapper.updateById(projectLawsInventoryEO);
}
super.baseMapper.updateById(projectLawsInventoryEO);
}
}
}