修改认证清单编辑后发消息

This commit is contained in:
高嵩
2023-08-10 20:55:52 +08:00
parent 3d75e77f6c
commit fbdddef361
4 changed files with 391 additions and 48 deletions
@@ -73,4 +73,8 @@ public enum ProjectRoleEnum {
}
return null;
}
public int getIntValue() {
return Integer.valueOf(value);
}
}
@@ -114,6 +114,10 @@ public enum TemplateInfoEnum2 {
CERTIFICATION_MESSAGE24("发起人审查退回,责任人接收-任务","ctp_AArfOgl3mr4z",""), // 已同步飞书开放平台
CERTIFICATION_MESSAGE25("发起人审查通过,责任人接收通知-通知","ctp_AArffopvM8vQ",""),// 已同步飞书开放平台
CERTIFICATION_PUBLIC_MESSAGE_G("认证清单-公用消息-绿色","ctp_AAmcXtKz4z6r",""),// 已同步飞书开放平台
CERTIFICATION_PUBLIC_MESSAGE_Y("认证清单-公用消息-黄色","ctp_AAmcKcXLbh0H",""), // 已同步飞书开放平台
CERTIFICATION_PUBLIC_MESSAGE_R("认证清单-公用消息-红色","ctp_AAmcLxM85y9p",""),// 已同步飞书开放平台
// 法规清单发布相关消息模板
REGULATION_LIST_RELEASE1("Studio发起或stuido催办,法规工程师收到消息","ctp_AArfOhy7O9R4",""),// 已同步飞书开放平台
REGULATION_LIST_RELEASE2("法规清单发布-公用消息-绿色","ctp_AArYJam3JTyg",""), // 已同步飞书开放平台
@@ -7,13 +7,20 @@ import com.jero.common.constant.enums.CutEnum;
* 认证流程 节点枚举类
*/
public enum ProjectMessageEnum {
//法规消息
SJFHXLC("sjfhxlc","设计符合性流程","Design Compliance Process"),
YZFHXLC("yzfhxlc","验证符合性流程","Verify Compliance Process"),
RWBFQRCH("rwbfqrch","您好,您以下任务已被发起人撤回。","Hello! Your task has been withdrawn by the initiator."),
RWJZSJBXG("rwjzsjbxg","您好,以下符合性任务的截止时间已被发起人修改。","Hello! The due date of the compliance task has been modified by the initiator."),
RWJFWLXBXG("rwjfwlxbxg","您好,以下符合性任务的交付物类型已被发起人修改。","Hello! The type of deliverables of the compliance task has been modified by the initiator."),
RWJFWMBBXG("rwjfwmbbxg","您好,以下符合性任务的交付物模板已被发起人修改。","Hello! The deliverable template of the compliance task has been modified by the initiator."),
//认证消息
RZRWQR("rzrwqr","认证任务确认","Homologation Task Confirmation"),
PREHOMEQR("Pre-Homoqr","Pre-Homo确认","Pre-Homo Confirmation"),
RZQRRWYQ("rzqrrwyq","您好,请及时查看确认以下任务要求,谢谢!","Hello! Please check and confirm the following task requirement in a timely manner. Thank you!"),
RZRWJZSJBXG("rzrwjzsjbxg","您好,以下任务的截止时间已被发起人修改。","Hello! The due date of the task has been modified by the initiator."),
RZRWJFWLXBXG("rzrwjfwlxbxg","您好,以下任务的交付物类型已被发起人修改。","Hello! The type of deliverables of the task has been modified by the initiator."),
RZRWJFWMBBXG("rzrwjfwmbbxg","您好,以下任务的交付物模板已被发起人修改。","Hello! The deliverable template of the task has been modified by the initiator."),
;
String key;
@@ -210,21 +210,32 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
*/
@Override
public void editById(ProjectCertificationInventoryEO projectCertificationInventoryEO) {
//获取当前用户
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<ProjectCertificationInventoryEO> certificationQueryWrap = new QueryWrapper<>();
certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId());
List<ProjectCertificationInventoryEO> oldPciEoList = this.list(certificationQueryWrap);
if(projectCertificationInventoryEO.getEndTime() != null){
// 编辑截至日期处理逻辑
this.editEndTime(projectCertificationInventoryEO, oldPciEoList);
if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getSdt())) {
// 编辑工程接口人处理逻辑
this.editSdt(projectCertificationInventoryEO, oldPciEoList, currentUser);
}
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){
if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())) {
// 编辑责任人处理逻辑
this.editDutyPerson(projectCertificationInventoryEO,oldPciEoList);
this.editDutyPerson(projectCertificationInventoryEO, oldPciEoList, currentUser);
}
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType()) || StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())){
// 编辑交付物类型交付物模板逻辑
// TODO 此处逻辑需要详细需求如何操作
if (projectCertificationInventoryEO.getEndTime() != null) {
// 编辑截至日期处理逻辑
this.editEndTime(projectCertificationInventoryEO, oldPciEoList, currentUser);
}
if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType())) {
// 编辑交付物类型逻辑
this.editDeliverableType(projectCertificationInventoryEO, oldPciEoList, currentUser);
}
if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())) {
// 编辑交付物模板逻辑
this.editDeliverableTemplate(projectCertificationInventoryEO, oldPciEoList, currentUser);
}
// 获取编辑前的数据
@@ -247,8 +258,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
//获取当前的projectId
String projectId = projectCertificationInventoryEO.getProjectLibraryId();
String cut = projectCertificationInventoryEO.getCut();
//获取当前用户
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Map<String,Object> params = new HashMap<>();
params.put("projectLibraryId",projectId);
params.put("userId",currentUser.getId());
@@ -396,11 +405,213 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
}
private void editDeliverableTemplate(ProjectCertificationInventoryEO newPciEo, List<ProjectCertificationInventoryEO> oldPciEoList, LoginUser currentUser) {
String newDeliverableTemplate = newPciEo.getDeliverableTemplate();
List<ProjectCertificationInventoryEO> oldPciEos = oldPciEoList.stream().filter(pldPciEo -> {
boolean flag = (
!newDeliverableTemplate.equals(pldPciEo.getDeliverableTemplate())
&& (
StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())
|| StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())
)
);
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(oldPciEos)){
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(oldPciEos.get(0).getProjectLibraryId());
if(ObjectUtils.isNotEmpty(projectLibraryBase)){
int role = checkUserRole(oldPciEos.get(0).getProjectLibraryId(),currentUser.getId());
for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) {
String msgTitleCn = "";
String msgTitleEn = "";
String taskDefinitionKey = "";
if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) {
msgTitleCn = ProjectMessageEnum.RZRWQR.getCnName();
msgTitleEn = ProjectMessageEnum.RZRWQR.getEnName();
taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey();
}else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())) {
msgTitleCn = ProjectMessageEnum.PREHOMEQR.getCnName();
msgTitleEn = ProjectMessageEnum.PREHOMEQR.getEnName();
taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey();
}
List<String> userIdList = new ArrayList<>();
userIdList.add(oldPciEo.getDutyPerson());
if(role == ProjectRoleEnum.STUDIO_ENGINEER.getIntValue()){
userIdList.addAll(Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")));
}
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
oldPciEo.setEndTime(newPciEo.getEndTime());
List<ProjectCertificationInventoryEO> PciEoList = new ArrayList<>();
PciEoList.add(oldPciEo);
this.sendMessageByTemplateId(
PciEoList,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
oldPciEo.getEndTime(),
taskDefinitionKey,
msgTitleCn,
msgTitleEn,
ProjectMessageEnum.RZRWJFWMBBXG.getCnName(),
ProjectMessageEnum.RZRWJFWMBBXG.getEnName()
);
}
}
}
}
private void editDeliverableType(ProjectCertificationInventoryEO newPciEo, List<ProjectCertificationInventoryEO> oldPciEoList, LoginUser currentUser) {
String newDeliverableType = newPciEo.getDeliverableType();
List<ProjectCertificationInventoryEO> oldPciEos = oldPciEoList.stream().filter(pldPciEo -> {
boolean flag = (
!newDeliverableType.equals(pldPciEo.getDeliverableType())
&& (
StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())
|| StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())
)
);
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(oldPciEos)){
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(oldPciEos.get(0).getProjectLibraryId());
if(ObjectUtils.isNotEmpty(projectLibraryBase)){
int role = checkUserRole(oldPciEos.get(0).getProjectLibraryId(),currentUser.getId());
for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) {
String msgTitleCn = "";
String msgTitleEn = "";
String taskDefinitionKey = "";
if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) {
msgTitleCn = ProjectMessageEnum.RZRWQR.getCnName();
msgTitleEn = ProjectMessageEnum.RZRWQR.getEnName();
taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey();
}else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())) {
msgTitleCn = ProjectMessageEnum.PREHOMEQR.getCnName();
msgTitleEn = ProjectMessageEnum.PREHOMEQR.getEnName();
taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey();
}
List<String> userIdList = new ArrayList<>();
userIdList.add(oldPciEo.getDutyPerson());
if(role == ProjectRoleEnum.STUDIO_ENGINEER.getIntValue()){
userIdList.addAll(Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")));
}
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
oldPciEo.setEndTime(newPciEo.getEndTime());
List<ProjectCertificationInventoryEO> PciEoList = new ArrayList<>();
PciEoList.add(oldPciEo);
this.sendMessageByTemplateId(
PciEoList,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
oldPciEo.getEndTime(),
taskDefinitionKey,
msgTitleCn,
msgTitleEn,
ProjectMessageEnum.RZRWJFWLXBXG.getCnName(),
ProjectMessageEnum.RZRWJFWLXBXG.getEnName()
);
}
}
}
}
/**
* 编辑工程接口人处理逻辑
*/
private void editSdt(ProjectCertificationInventoryEO pciEo, List<ProjectCertificationInventoryEO> oldPciEoList,LoginUser currentUser) {
// 过滤出来旧数据的接口人与新修改的接口人不是同一个人
List<ProjectCertificationInventoryEO> oldPciEos = oldPciEoList.stream().filter(oldPciEo -> {
boolean flag = (
!StringUtils.equals(oldPciEo.getDutyPerson(), pciEo.getDutyPerson())
&& (
StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())
|| StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())
)
);
return flag;
}).collect(Collectors.toList());
for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) {
List<String> userIdList = new ArrayList<>();
userIdList.add(oldPciEo.getSdt());
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
List<ProjectCertificationInventoryEO> PciEoList = new ArrayList<>();
PciEoList.add(oldPciEo);
if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) {
this.sendMessageByTemplateId(
PciEoList,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(),
ProjectMessageEnum.RZRWQR.getCnName(),
ProjectMessageEnum.RZRWQR.getEnName(),
ProjectMessageEnum.RWBFQRCH.getCnName(),
ProjectMessageEnum.RWBFQRCH.getEnName()
);
}else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){
this.sendMessageByTemplateId(
PciEoList,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
CertificationFlowNodeEnum.TASK_HANDLING.getKey(),
ProjectMessageEnum.PREHOMEQR.getCnName(),
ProjectMessageEnum.PREHOMEQR.getEnName(),
ProjectMessageEnum.RWBFQRCH.getCnName(),
ProjectMessageEnum.RWBFQRCH.getEnName()
);
}
}
if (CollectionUtils.isNotEmpty(oldPciEos)) {
List<String> userIdList = oldPciEos.stream().map(ProjectCertificationInventoryEO::getSdt).distinct().collect(Collectors.toList());
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
if (StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) {
this.sendMessageByTemplateId(
oldPciEos,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(),
ProjectMessageEnum.RZRWQR.getCnName(),
ProjectMessageEnum.RZRWQR.getEnName(),
ProjectMessageEnum.RZQRRWYQ.getCnName(),
ProjectMessageEnum.RZQRRWYQ.getEnName()
);
}else if(StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){
this.sendMessageByTemplateId(
oldPciEos,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
CertificationFlowNodeEnum.TASK_HANDLING.getKey(),
ProjectMessageEnum.PREHOMEQR.getCnName(),
ProjectMessageEnum.PREHOMEQR.getEnName(),
ProjectMessageEnum.RZQRRWYQ.getCnName(),
ProjectMessageEnum.RZQRRWYQ.getEnName()
);
}
}
}
/**
* 编辑责任人处理逻辑
* @param pciEo
*/
private void editDutyPerson(ProjectCertificationInventoryEO pciEo,List<ProjectCertificationInventoryEO> oldPciEoList) {
private void editDutyPerson(ProjectCertificationInventoryEO pciEo,List<ProjectCertificationInventoryEO> oldPciEoList,LoginUser currentUser) {
// 过滤出来旧数据的责任人与新修改的责任人不是同一个人并且流程状态是 任务待确认结果待提交审查退回的数据这三个状态的流程数据在责任人节点
List<ProjectCertificationInventoryEO> oldPciEos = oldPciEoList.stream().filter(oldPciEo -> {
boolean flag = (
@@ -413,18 +624,72 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
);
return flag;
}).collect(Collectors.toList());
for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) {
List<String> userIdList = new ArrayList<>();
userIdList.add(oldPciEo.getDutyPerson());
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
List<ProjectCertificationInventoryEO> PciEoList = new ArrayList<>();
PciEoList.add(oldPciEo);
if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) {
this.sendMessageByTemplateId(
PciEoList,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(),
ProjectMessageEnum.RZRWQR.getCnName(),
ProjectMessageEnum.RZRWQR.getEnName(),
ProjectMessageEnum.RWBFQRCH.getCnName(),
ProjectMessageEnum.RWBFQRCH.getEnName()
);
}else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){
this.sendMessageByTemplateId(
PciEoList,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
CertificationFlowNodeEnum.TASK_HANDLING.getKey(),
ProjectMessageEnum.PREHOMEQR.getCnName(),
ProjectMessageEnum.PREHOMEQR.getEnName(),
ProjectMessageEnum.RWBFQRCH.getCnName(),
ProjectMessageEnum.RWBFQRCH.getEnName()
);
}
}
if (CollectionUtils.isNotEmpty(oldPciEos)) {
List<String> userIdList = oldPciEos.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
this.sendMessageByTemplateId(
oldPciEos,
TemplateInfoEnum2.CERTIFICATION_MESSAGE15.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
""
);
if (StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) {
this.sendMessageByTemplateId(
oldPciEos,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(),
ProjectMessageEnum.RZRWQR.getCnName(),
ProjectMessageEnum.RZRWQR.getEnName(),
ProjectMessageEnum.RZQRRWYQ.getCnName(),
ProjectMessageEnum.RZQRRWYQ.getEnName()
);
}else if(StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){
this.sendMessageByTemplateId(
oldPciEos,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
CertificationFlowNodeEnum.TASK_HANDLING.getKey(),
ProjectMessageEnum.PREHOMEQR.getCnName(),
ProjectMessageEnum.PREHOMEQR.getEnName(),
ProjectMessageEnum.RZQRRWYQ.getCnName(),
ProjectMessageEnum.RZQRRWYQ.getEnName()
);
}
// 如果责任人有变更将之前责任人的待办中心任务移交给新的责任人
QueryWrapper<ProcessInfoDetailEO> detailQueryWrap = new QueryWrapper<>();
@@ -452,7 +717,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
* @param newPciEo 最新编辑的认证清单信息
* @param oldPciEoList 旧的认证清单数组
*/
private void editEndTime(ProjectCertificationInventoryEO newPciEo, List<ProjectCertificationInventoryEO> oldPciEoList) {
private void editEndTime(ProjectCertificationInventoryEO newPciEo, List<ProjectCertificationInventoryEO> oldPciEoList,LoginUser currentUser) {
Date newEndTime = newPciEo.getEndTime();
// 过滤出来旧的截止日期不等于更改后的新截止日期并且数据状态为 任务待确认结果待提交审查退回的数据
List<ProjectCertificationInventoryEO> oldPciEos = oldPciEoList.stream().filter(pldPciEo -> {
@@ -468,23 +733,49 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(oldPciEos)){
// 同步更新待办中心-流程明细截止日期
this.syncProcessInfoDetailEndTime(newEndTime, oldPciEos);
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(oldPciEos.get(0).getProjectLibraryId());
if(ObjectUtils.isNotEmpty(projectLibraryBase)){
List<String> userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
oldPciEos.get(0).setEndTime(newPciEo.getEndTime());
this.sendMessageByTemplateId(
oldPciEos,
TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(),
userIdList,
userInfoList,
newEndTime,
""
);
// 同步更新待办中心-流程明细截止日期
this.syncProcessInfoDetailEndTime(newEndTime, oldPciEos);
int role = checkUserRole(oldPciEos.get(0).getProjectLibraryId(),currentUser.getId());
for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) {
String msgTitleCn = "";
String msgTitleEn = "";
String taskDefinitionKey = "";
if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) {
msgTitleCn = ProjectMessageEnum.RZRWQR.getCnName();
msgTitleEn = ProjectMessageEnum.RZRWQR.getEnName();
taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey();
}else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())) {
msgTitleCn = ProjectMessageEnum.PREHOMEQR.getCnName();
msgTitleEn = ProjectMessageEnum.PREHOMEQR.getEnName();
taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey();
}
List<String> userIdList = new ArrayList<>();
userIdList.add(oldPciEo.getDutyPerson());
if(role == ProjectRoleEnum.STUDIO_ENGINEER.getIntValue()){
userIdList.addAll(Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")));
}else if(role == ProjectRoleEnum.HOMOLOGATION_ENGINEER.getIntValue()){
userIdList.add(projectLibraryBase.getStudioEngineer());
}
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
oldPciEo.setEndTime(newPciEo.getEndTime());
List<ProjectCertificationInventoryEO> PciEoList = new ArrayList<>();
PciEoList.add(oldPciEo);
this.sendMessageByTemplateId(
PciEoList,
TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(),
userIdList,
userInfoList,
oldPciEo.getEndTime(),
taskDefinitionKey,
msgTitleCn,
msgTitleEn,
ProjectMessageEnum.RZRWJZSJBXG.getCnName(),
ProjectMessageEnum.RZRWJZSJBXG.getEnName()
);
}
}
}
}
@@ -605,6 +896,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
@Override
public Result<?> setBatch(ProjectCertificationInventoryEO projectCertificationInventoryEO) {
//获取当前用户
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String ids = projectCertificationInventoryEO.getIds();
if(StringUtils.isEmpty(ids)){
throw new JeroBootException("至少选择一条数据进行批量设置!");
@@ -647,18 +940,25 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
updateList.add(updateProjectCertificationInventoryEO);
}
if(projectCertificationInventoryEO.getEndTime() != null){
// 编辑截至日期处理逻辑
this.editEndTime(projectCertificationInventoryEO, pciEoList);
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getSdt())){
// 编辑工程接口人处理逻辑
this.editSdt(projectCertificationInventoryEO,pciEoList,currentUser);
}
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){
// 编辑责任人处理逻辑
this.editDutyPerson(projectCertificationInventoryEO,pciEoList);
this.editDutyPerson(projectCertificationInventoryEO,pciEoList,currentUser);
}
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType()) || StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())){
// 编辑交付物类型交付物模板逻辑
// TODO 此处逻辑需要详细需求如何操作
if(projectCertificationInventoryEO.getEndTime() != null){
// 编辑截至日期处理逻辑
this.editEndTime(projectCertificationInventoryEO, pciEoList,currentUser);
}
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType()) ){
// 编辑交付物类型逻辑
this.editDeliverableType(projectCertificationInventoryEO, pciEoList, currentUser);
}
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())){
// 编辑交付物模板逻辑
this.editDeliverableTemplate(projectCertificationInventoryEO, pciEoList, currentUser);
}
// List<String> flowStatusList = new ArrayList<>();
@@ -728,8 +1028,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
/**
* 根据模板发送消息
* @param projectCertificationInventoryEOS
* @param templeteId
*/
@Override
public void sendMessageByTemplateId(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS,
@@ -738,6 +1036,22 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
List<SysUser> userInfoList,
Date endTime,
String taskDefinitionKey){
this.sendMessageByTemplateId(projectCertificationInventoryEOS,templeteId,userIdList,userInfoList,endTime,taskDefinitionKey,"","","","");
}
/**
* 根据模板发送消息(可发送公共消息)
*/
private void sendMessageByTemplateId(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS,
String templeteId,
List<String> userIdList,
List<SysUser> userInfoList,
Date endTime,
String taskDefinitionKey,
String msgTitleCn,
String msgTitleEn,
String contentCn,
String contentEn){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectCertificationInventoryEOS.get(0).getProjectLibraryId());
@@ -772,6 +1086,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
larkMesJson.put("userIds",thirdId);
Map<String,Object> templateVariableMap = new HashMap<>();
if(StringUtils.isNotEmpty(msgTitleCn)){
templateVariableMap.put("msgTitleCn",msgTitleCn);
}
if(StringUtils.isNotEmpty(msgTitleEn)){
templateVariableMap.put("msgTitleEn",msgTitleEn);
}
if(StringUtils.isNotEmpty(contentCn)){
templateVariableMap.put("contentCn",contentCn);
}
if(StringUtils.isNotEmpty(contentEn)){
templateVariableMap.put("contentEn",contentEn);
}
templateVariableMap.put("projectNameCn",PRN_CN);
templateVariableMap.put("projectNameEn",PRN_EN);
templateVariableMap.put("standName",standName);
@@ -6323,6 +6649,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
@Override
public void replacementUser(JSONObject json) {
//获取当前用户
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = json.getString("userId");
String projectLibraryId = json.getString("projectLibraryId");
List<Map<String, Object>> replacementUserList = (List<Map<String, Object>>) json.get("replacementUserList");
@@ -6348,7 +6676,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
// List<ProjectCertificationInventoryEO> oldPciEoList = this.list(certificationQueryWrap);
List<ProjectCertificationInventoryEO> oldPciEoList = pciEoList.stream().filter(p -> StringUtils.equals(p.getId(),pciEo.getId())).distinct().collect(Collectors.toList());
// 编辑责任人处理逻辑
this.editDutyPerson(newPciEo, oldPciEoList);
this.editDutyPerson(newPciEo, oldPciEoList,currentUser);
pciEo.setDutyPerson(newUserId);
}