prehomo,待办中心增加节点,认证清单增加 清单校核截止时间、责任确认截止时间

This commit is contained in:
wangzhijiang
2023-04-17 15:39:38 +08:00
parent 4685935d37
commit 49c6da1517
9 changed files with 423 additions and 53 deletions
@@ -605,4 +605,9 @@ where id in (
);
-- 认证清单,增加字段 2023-04-17 未同步生产环境
ALTER TABLE `project_certification_inventory`
ADD COLUMN `inventory_verify_end_time` datetime(0) NULL COMMENT '清单校核截止时间' AFTER `project_library_id`,
ADD COLUMN `task_confirm_end_time` datetime(0) NULL COMMENT '责任确认截止时间' AFTER `inventory_verify_end_time`;
@@ -230,4 +230,16 @@ public class ProjectCertificationInventoryEO implements Serializable {
//排序字段
@TableField(exist = false)
private String orderByField;
/**清单校核截止时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "清单校核截止时间")
private Date inventoryVerifyEndTime;
/**责任确认截止时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "责任确认截止时间")
private Date taskConfirmEndTime;
}
@@ -17,6 +17,18 @@ public enum CertificationFlowNodeEnum {
RZGCSSC ("rzgcssc","认证工程师审查","Certified engineer review"),
RZGCSSC_TG ("rzgcssc_tg","认证工程师审查-通过","Certified engineer review through"),
RZGCSSC_TH ("rzgcssc_th","认证工程师审查-退回","Certified engineer review returned"),
/**
* 待办中心,展示任务节点key
* 清单校核-> studio发给认证工程师处理
* 任务责任确认 -> 认证工程师发给责任人
* 任务办理 -> 责任人接受之后,等待提交交付物
* 任务审查 -> 责任人提交交付物之后,认证工程师审查。
*/
CHECKLIST_VERIFICATION ("Checklist verification","清单校核","Checklist verification"),
TASK_RESPONSIBILITY_CONFIRMATION ("Task responsibility confirmation","任务责任确认","Task responsibility confirmation"),
TASK_HANDLING ("Task handling","任务办理","Task handling"),
TASK_REVIEW ("Task Review","任务审查","Task Review"),
;
String key;
@@ -89,17 +89,14 @@ public class CertificationInventoryJob implements Job {
* @param projectCertificationInventoryEOS
*/
private void remindCertificationEngineer( List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS,ProjectLibraryBase projectLibraryBase) {
List<ProjectCertificationInventoryEO> certificationInventoryEOList = projectCertificationInventoryEOS.stream().filter(data -> {
List<ProjectCertificationInventoryEO> toBeReviewedCiEoList = projectCertificationInventoryEOS.stream().filter(data -> {
boolean flag = (
StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())
|| StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue())
|| StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())
StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())
);
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(certificationInventoryEOList)){
Map<String, Object> sendMsgDataListMap = this.disposeSendMsgDataList(certificationInventoryEOList);
if(CollectionUtils.isNotEmpty(toBeReviewedCiEoList)){
Map<String, Object> sendMsgDataListMap = this.disposeSendMsgDataList(toBeReviewedCiEoList);
List<String> certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
@@ -113,7 +110,8 @@ public class CertificationInventoryJob implements Job {
certificationEngineerList,
certificationEngineerId,
threeDaysList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE6.getValue()
TemplateInfoEnum2.CERTIFICATION_MESSAGE6.getValue(),
threeDaysList.get(0).getEndTime()
);
}
}
@@ -126,7 +124,8 @@ public class CertificationInventoryJob implements Job {
certificationEngineerList,
certificationEngineerId,
currentDaysList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE7.getValue()
TemplateInfoEnum2.CERTIFICATION_MESSAGE7.getValue(),
currentDaysList.get(0).getEndTime()
);
}
}
@@ -139,7 +138,66 @@ public class CertificationInventoryJob implements Job {
certificationEngineerList,
certificationEngineerId,
overdueList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE8.getValue()
TemplateInfoEnum2.CERTIFICATION_MESSAGE8.getValue(),
overdueList.get(0).getEndTime()
);
}
}
}
List<ProjectCertificationInventoryEO> toBeCheckedCiEoList = projectCertificationInventoryEOS.stream().filter(data -> {
boolean flag = (
StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())
|| StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue())
);
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(toBeCheckedCiEoList)){
Map<String, Object> sendMsgDataListMap = this.disposeSendMsgDataListByInventoryVerifyEndTime(toBeCheckedCiEoList);
List<String> certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
// 三天后结束的
List<ProjectCertificationInventoryEO> threeDaysList = (List<ProjectCertificationInventoryEO>) sendMsgDataListMap.get("threeDaysList");
if(CollectionUtils.isNotEmpty(threeDaysList)){
for (String certificationEngineerId : certificationEngineerIdList) {
this.sendLarkCardMsgByTemplate(
projectLibraryBase,
certificationEngineerList,
certificationEngineerId,
threeDaysList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE6.getValue(),
threeDaysList.get(0).getInventoryVerifyEndTime()
);
}
}
// 当天结束的
List<ProjectCertificationInventoryEO> currentDaysList = (List<ProjectCertificationInventoryEO>) sendMsgDataListMap.get("currentDaysList");
if(CollectionUtils.isNotEmpty(currentDaysList)){
for (String certificationEngineerId : certificationEngineerIdList) {
this.sendLarkCardMsgByTemplate(
projectLibraryBase,
certificationEngineerList,
certificationEngineerId,
currentDaysList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE7.getValue(),
currentDaysList.get(0).getInventoryVerifyEndTime()
);
}
}
// 逾期的
List<ProjectCertificationInventoryEO> overdueList = (List<ProjectCertificationInventoryEO>) sendMsgDataListMap.get("overdueList");
if(CollectionUtils.isNotEmpty(overdueList)){
for (String certificationEngineerId : certificationEngineerIdList) {
this.sendLarkCardMsgByTemplate(
projectLibraryBase,
certificationEngineerList,
certificationEngineerId,
overdueList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE8.getValue(),
overdueList.get(0).getInventoryVerifyEndTime()
);
}
}
@@ -193,7 +251,8 @@ public class CertificationInventoryJob implements Job {
dutyPersonList,
dutyPersonUserId,
fourteenDaysList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE19.getValue()
TemplateInfoEnum2.CERTIFICATION_MESSAGE19.getValue(),
fourteenDaysList.get(0).getEndTime()
);
}
@@ -205,7 +264,8 @@ public class CertificationInventoryJob implements Job {
dutyPersonList,
dutyPersonUserId,
sevenDaysList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE20.getValue()
TemplateInfoEnum2.CERTIFICATION_MESSAGE20.getValue(),
sevenDaysList.get(0).getEndTime()
);
}
@@ -217,7 +277,8 @@ public class CertificationInventoryJob implements Job {
dutyPersonList,
dutyPersonUserId,
currentDaysList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE21.getValue()
TemplateInfoEnum2.CERTIFICATION_MESSAGE21.getValue(),
currentDaysList.get(0).getEndTime()
);
}
// 逾期的
@@ -228,7 +289,8 @@ public class CertificationInventoryJob implements Job {
dutyPersonList,
dutyPersonUserId,
overdueList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE22.getValue()
TemplateInfoEnum2.CERTIFICATION_MESSAGE22.getValue(),
overdueList.get(0).getEndTime()
);
}
}
@@ -351,6 +413,101 @@ public class CertificationInventoryJob implements Job {
return result;
}
/**
* 处理需要发送消息的数据
* @param pciEoList
* @return
*/
private Map<String,Object> disposeSendMsgDataListByInventoryVerifyEndTime(List<ProjectCertificationInventoryEO> pciEoList) {
Map<String,Object> result = new HashMap<>();
Date currentDate = new Date();
//获取后三天前的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,3);
Date threeDays = calendar.getTime();
//获取后七天后的时间
Calendar sevenCalendar=new GregorianCalendar();
sevenCalendar.setTime(new Date());
sevenCalendar.add(Calendar.DATE,7);
Date sevenDays = sevenCalendar.getTime();
//获取后十四天后的时间
Calendar fourteenCalendar=new GregorianCalendar();
fourteenCalendar.setTime(new Date());
fourteenCalendar.add(Calendar.DATE,14);
Date fourteenDays = fourteenCalendar.getTime();
String threeDaysStr = sdf.format(threeDays);
String sevenDaysStr = sdf.format(sevenDays);
String fourteenDaysStr = sdf.format(fourteenDays);
String currentDateStr = sdf.format(currentDate);
// 当天结束的
List<ProjectCertificationInventoryEO> currentDaysList = pciEoList.stream().filter(data -> {
boolean flag = false;
//结束日期是当前日期
if(data.getInventoryVerifyEndTime() != null){
if (StringUtils.equals(currentDateStr, sdf.format(data.getInventoryVerifyEndTime()))) {
flag = true;
}
}
return flag;
}).collect(Collectors.toList());
// 三天后结束的
List<ProjectCertificationInventoryEO> threeDaysList = pciEoList.stream().filter(data -> {
boolean flag = false;
if(data.getInventoryVerifyEndTime() != null){
if (StringUtils.equals(threeDaysStr, sdf.format(data.getInventoryVerifyEndTime()))) {
flag = true;
}
}
return flag;
}).collect(Collectors.toList());
// 七天后结束的
List<ProjectCertificationInventoryEO> sevenDaysList = pciEoList.stream().filter(data -> {
boolean flag = false;
if(data.getInventoryVerifyEndTime()!=null){
if (StringUtils.equals(sevenDaysStr, sdf.format(data.getInventoryVerifyEndTime()))) {
flag = true;
}
}
return flag;
}).collect(Collectors.toList());
// 十四天后结束的
List<ProjectCertificationInventoryEO> fourteenDaysList = pciEoList.stream().filter(data -> {
boolean flag = false;
if(data.getInventoryVerifyEndTime() != null){
if (StringUtils.equals(fourteenDaysStr, sdf.format(data.getInventoryVerifyEndTime()))) {
flag = true;
}
}
return flag;
}).collect(Collectors.toList());
// 逾期的
List<ProjectCertificationInventoryEO> overdueList = pciEoList.stream().filter(data -> {
// 只要早于当前日期都算逾期
boolean flag = false;
if(data.getInventoryVerifyEndTime() != null){
flag = (data.getInventoryVerifyEndTime().before(currentDate) && !StringUtils.equals(currentDateStr, sdf.format(data.getInventoryVerifyEndTime())));
}
return flag;
}).collect(Collectors.toList());
result.put("currentDaysList",currentDaysList);
result.put("threeDaysList",threeDaysList);
result.put("overdueList",overdueList);
result.put("sevenDaysList",sevenDaysList);
result.put("fourteenDaysList",fourteenDaysList);
return result;
}
/**
* 根据模板 发送飞书消息
* @param projectLibraryBase
@@ -358,7 +515,11 @@ public class CertificationInventoryJob implements Job {
* @param userId
* @param list
*/
private void sendLarkCardMsgByTemplate(ProjectLibraryBase projectLibraryBase, List<SysUser> userList,String userId,List<ProjectCertificationInventoryEO> list,String templateId) {
private void sendLarkCardMsgByTemplate(ProjectLibraryBase projectLibraryBase,
List<SysUser> userList,String userId,
List<ProjectCertificationInventoryEO> list,
String templateId,
Date endTime) {
String thirdId = this.sysUserService.getUserThirdIdByUserId(userList,userId);
if(StringUtils.isNotEmpty(thirdId)){
@@ -385,7 +546,7 @@ public class CertificationInventoryJob implements Job {
templateVariableMap.put("standName",standName);
templateVariableMap.put("itemName",itemName);
templateVariableMap.put("Initiator", projectLibraryBase.getStudioEngineerName());
templateVariableMap.put("endTime", DateUtils.formatDate(list.get(0).getEndTime()));
templateVariableMap.put("endTime", DateUtils.formatDate(endTime));
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -225,7 +226,7 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
* @param userIdList
* @param userInfoList
*/
void sendMessageByTemplateId(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS,String templeteId,List<String> userIdList,List<SysUser> userInfoList);
void sendMessageByTemplateId(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS, String templeteId, List<String> userIdList, List<SysUser> userInfoList, Date endTime);
/**
* 数据唯一校验。
@@ -248,4 +249,8 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
* @return
*/
Result<?> addConfigByIds(JSONObject json);
void certificationInventoryEOListSortByEndTimeAsc(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList);
void certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList);
void certificationInventoryEOListSortByTaskConfirmEndTimeAsc(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList);
}
@@ -222,7 +222,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
editEndTimeCertificationInventoryEOS,
TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(),
userIdList,
userInfoList
userInfoList,
projectCertificationInventoryEO.getEndTime()
);
}
}
@@ -248,7 +249,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
editDutyPersonCertificationInventoryEOS,
TemplateInfoEnum2.CERTIFICATION_MESSAGE15.getValue(),
userIdList,
userInfoList
userInfoList,
projectCertificationInventoryEO.getEndTime()
);
// 如果责任人有变更,将之前责任人的待办中心任务,移交给新的责任人。
@@ -627,7 +629,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
projectCertificationInventoryEOS,
TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(),
userIdList,
userInfoList
userInfoList,
projectCertificationInventoryEO.getEndTime()
);
}
}
@@ -663,7 +666,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
* @param templeteId
*/
@Override
public void sendMessageByTemplateId(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS,String templeteId,List<String> userIdList,List<SysUser> userInfoList){
public void sendMessageByTemplateId(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS,
String templeteId,
List<String> userIdList,
List<SysUser> userInfoList,
Date endTime){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectCertificationInventoryEOS.get(0).getProjectLibraryId());
@@ -686,8 +693,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(StringUtils.isNotEmpty(thirdId)){
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOS);
Date endTime = projectCertificationInventoryEOS.get(0).getEndTime();
// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOS);
// Date endTime = projectCertificationInventoryEOS.get(0).getEndTime();
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", templeteId);
@@ -1027,7 +1034,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(StringUtils.isEmpty(ids)){
throw new JeroBootException("至少选择一条数据进行发布!");
}
// String endTime = json.getString("endTime");
String inventoryVerifyEndTimeStr = json.getString("inventoryVerifyEndTime");
Date inventoryVerifyEndTime = DateUtils.str2Date(inventoryVerifyEndTimeStr, DateUtils.date_sdf.get());
String cut = json.getString("cut");
List<String> idList = Arrays.asList(ids.split(","));
@@ -1055,13 +1064,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
// 将数据的状态更新为:清单待校核,更新截止时间。等待认证工程师进行操作。
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue());
// projectCertificationInventoryEO.setEndTime(DateUtils.str2Date(endTime,DateUtils.date_sdf.get()));
projectCertificationInventoryEO.setInventoryVerifyEndTime(inventoryVerifyEndTime);
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_ISSUE.getValue());
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
// Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
String projectLibraryId = json.getString("projectLibraryId");
// 获取项目信息,获取认证工程师,给认证工程师分配待办任务
@@ -1091,6 +1100,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
processInfoDetailEO.setProcessInfoId(projectLibraryId);
processInfoDetailEO.setActiProcInstId(projectLibraryId);
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(inventoryVerifyEndTime);
processInfoDetailEOList.add(processInfoDetailEO);
}
@@ -1125,7 +1135,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
templateVariableMap.put("projectNameCn",PRN_CN);
templateVariableMap.put("projectNameEn",PRN_EN);
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
templateVariableMap.put("endTime",DateUtils.formatDate(endTime));
templateVariableMap.put("endTime",DateUtils.formatDate(inventoryVerifyEndTime));
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
@@ -1660,11 +1670,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
// 如果还有 结果待审查 的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办 flowStatus
this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSSC.getKey(),flowStatus);
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
this.sendMessageByTemplateId(
projectCertificationInventoryEOList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE24.getValue(),
dutyPersonIdList,
dutyPersonList
dutyPersonList,
projectCertificationInventoryEOList.get(0).getEndTime()
);
}catch (Exception ex){
ex.printStackTrace();
@@ -1721,12 +1733,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
// 如果还有 结果待审查 的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办 flowStatus
this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSSC.getKey(),flowStatus);
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
this.sendMessageByTemplateId(
projectCertificationInventoryEOList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE25.getValue(),
dutyPersonIdList,
dutyPersonList
dutyPersonList,
projectCertificationInventoryEOList.get(0).getEndTime()
);
}catch (Exception ex){
ex.printStackTrace();
@@ -1791,6 +1804,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){
throw new JeroBootException("至少选择一条数据流程状态为'结果待提交 或 审查退回'的数据!");
}
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
@@ -1812,6 +1826,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(projectCertificationInventoryEOList.get(0).getEndTime());
processInfoDetailEOList.add(processInfoDetailEO);
}
// 数据更新为结果待审查
@@ -1839,12 +1854,12 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
// 给认证工程师分配待办中心的任务 认证工程师审查
this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.RZGCSSC.getKey());
this.sendMessageByTemplateId(
projectCertificationInventoryEOList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(),
certificationEngineerList,
certificationEngineers
certificationEngineers,
projectCertificationInventoryEOList.get(0).getEndTime()
);
}catch (Exception ex){
ex.printStackTrace();
@@ -2038,6 +2053,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue());
this.processInfoDetailEOService.update(detailUpdateWrap);
this.certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(projectCertificationInventoryEOList);
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
// 给认证工程师分配任务
@@ -2050,6 +2067,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime());
processInfoDetailEOList.add(processInfoDetailEO);
}
@@ -2071,8 +2089,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(StringUtils.isNotEmpty(thirdId)){
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
Date endTime = projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime();
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE11.getValue());
@@ -2242,6 +2260,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(StringUtils.isEmpty(ids)){
throw new JeroBootException("至少选择一条数据进行操作!");
}
String taskConfirmEndTimeStr = json.getString("taskConfirmEndTime");
Date taskConfirmEndTime = DateUtils.str2Date(taskConfirmEndTimeStr, DateUtils.date_sdf.get());
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> idList = Arrays.asList(ids.split(","));
@@ -2277,10 +2298,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue());
projectCertificationInventoryEO.setTaskConfirmEndTime(taskConfirmEndTime);
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setUserId(projectCertificationInventoryEO.getDutyPerson());
processInfoDetailEO.setEndTime(projectCertificationInventoryEO.getEndTime());
processInfoDetailEO.setEndTime(taskConfirmEndTime);
processInfoDetailEO.setProjectLawsInventoryId(projectCertificationInventoryEO.getId());
processInfoDetailEOList.add(processInfoDetailEO);
}
@@ -2314,8 +2336,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(StringUtils.isNotEmpty(thirdId)){
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
// Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE10.getValue());
@@ -2327,7 +2349,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
templateVariableMap.put("standName",standName);
templateVariableMap.put("itemName",itemName);
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
templateVariableMap.put("endTime",DateUtils.formatDate(endTime));
templateVariableMap.put("endTime",DateUtils.formatDate(taskConfirmEndTime));
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
templateVariableMap.put("certificationEngineer",currentUser.getUsername());
@@ -2353,7 +2375,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
* 认证清单数据排序,根据截至时间顺序排序
* @param projectCertificationInventoryEOList
*/
private void certificationInventoryEOListSortByEndTimeAsc(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList) {
@Override
public void certificationInventoryEOListSortByEndTimeAsc(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList) {
Collections.sort(projectCertificationInventoryEOList, new Comparator<ProjectCertificationInventoryEO>() {
@Override
public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) {
@@ -2365,6 +2388,39 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
});
}
/**
* 认证清单数据排序,根据清单校核截至时间顺序排序
* @param pciEoList
*/
@Override
public void certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(List<ProjectCertificationInventoryEO> pciEoList) {
Collections.sort(pciEoList, new Comparator<ProjectCertificationInventoryEO>() {
@Override
public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) {
if(p1.getInventoryVerifyEndTime() != null && p2.getInventoryVerifyEndTime() != null){
return p1.getInventoryVerifyEndTime().compareTo(p2.getInventoryVerifyEndTime());
}
return 1;
}
});
}
/**
* 认证清单数据排序,根据任务确认截至时间顺序排序
* @param pciEoList
*/
@Override
public void certificationInventoryEOListSortByTaskConfirmEndTimeAsc(List<ProjectCertificationInventoryEO> pciEoList) {
Collections.sort(pciEoList, new Comparator<ProjectCertificationInventoryEO>() {
@Override
public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) {
if(p1.getTaskConfirmEndTime() != null && p2.getTaskConfirmEndTime() != null){
return p1.getTaskConfirmEndTime().compareTo(p2.getTaskConfirmEndTime());
}
return 1;
}
});
}
@Override
public Result<?> saveBatch(JSONObject json) {
Date now = new Date();
@@ -2633,7 +2689,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
projectCertificationInventoryEOList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE17.getValue(),
userIdList,
userInfoList
userInfoList,
projectCertificationInventoryEOList.get(0).getEndTime()
);
// 获取认证清单 - 飞书跳转链接
@@ -2709,13 +2766,12 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
*/
String operatorType = json.getString("operatorType");
if(StringUtils.equals(operatorType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_EXPEDITING.getValue())){
List<ProjectCertificationInventoryEO> certificationInventoryEOList = projectCertificationInventoryEOList.stream().filter(data -> {
return (StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())
|| StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue())
|| StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()));
// 结果待审查
List<ProjectCertificationInventoryEO> toBeReviewedCiEoList = projectCertificationInventoryEOList.stream().filter(data -> {
return (StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()));
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(certificationInventoryEOList)){
if(CollectionUtils.isNotEmpty(toBeReviewedCiEoList)){
String certificationEngineerIds = projectLibraryBase.getCertificationEngineer();
if(StringUtils.isNotEmpty(certificationEngineerIds)){
List<String> certificationEngineerIdList = Arrays.asList(certificationEngineerIds.split(","));
@@ -2723,7 +2779,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
Collections.sort(certificationInventoryEOList, new Comparator<ProjectCertificationInventoryEO>() {
Collections.sort(toBeReviewedCiEoList, new Comparator<ProjectCertificationInventoryEO>() {
@Override
public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) {
if(p1.getEndTime() != null && p2.getEndTime() != null){
@@ -2732,9 +2788,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
return 1;
}
});
Date endTime = certificationInventoryEOList.get(0).getEndTime();
Date endTime = toBeReviewedCiEoList.get(0).getEndTime();
Map<String, Object> standNameAndItemName = this.getStandNameAndItemName(certificationInventoryEOList);
Map<String, Object> standNameAndItemName = this.getStandNameAndItemName(toBeReviewedCiEoList);
String standName = (String) standNameAndItemName.get("standName");
String itemName = (String) standNameAndItemName.get("itemName");
@@ -2768,6 +2824,65 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
}
}
// 清单待校核、责任人拒绝
List<ProjectCertificationInventoryEO> toBeCheckedCiEoList = projectCertificationInventoryEOList.stream().filter(data -> {
return (StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())
|| StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()));
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(toBeCheckedCiEoList)) {
String certificationEngineerIds = projectLibraryBase.getCertificationEngineer();
if(StringUtils.isNotEmpty(certificationEngineerIds)){
List<String> certificationEngineerIdList = Arrays.asList(certificationEngineerIds.split(","));
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
Collections.sort(toBeCheckedCiEoList, new Comparator<ProjectCertificationInventoryEO>() {
@Override
public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) {
if(p1.getInventoryVerifyEndTime() != null && p2.getInventoryVerifyEndTime() != null){
return p1.getInventoryVerifyEndTime().compareTo(p2.getInventoryVerifyEndTime());
}
return 1;
}
});
Date inventoryVerifyEndTime = toBeCheckedCiEoList.get(0).getInventoryVerifyEndTime();
Map<String, Object> standNameAndItemName = this.getStandNameAndItemName(toBeCheckedCiEoList);
String standName = (String) standNameAndItemName.get("standName");
String itemName = (String) standNameAndItemName.get("itemName");
if(CollectionUtils.isNotEmpty(certificationEngineerList)){
for (String certificationEngineerId : certificationEngineerIdList) {
String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerList,certificationEngineerId);
if(StringUtils.isNotEmpty(thirdId)){
try {
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE1.getValue());
larkMesJson.put("userIds",thirdId);
Map<String,Object> templateVariableMap = new HashMap<>();
templateVariableMap.put("projectNameCn",PRN_CN);
templateVariableMap.put("projectNameEn",PRN_EN);
templateVariableMap.put("standName",standName);
templateVariableMap.put("itemName",itemName);
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
templateVariableMap.put("endTime",DateUtils.formatDate(inventoryVerifyEndTime));
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
larkMesJson.put("templateVariableMap",templateVariableMap);
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
} catch (Exception e) {
log.error("飞书消息推送失败");
}
}
}
}
}
}
}
List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
@@ -2792,13 +2907,16 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
return flag;
}).collect(Collectors.toList());
this.certificationInventoryEOListSortByTaskConfirmEndTimeAsc(toBeConfirmedPciEoList);
if (CollectionUtils.isNotEmpty(toBeConfirmedPciEoList)) {
Date taskConfirmEndTime = toBeConfirmedPciEoList.get(0).getTaskConfirmEndTime();
// 给责任人发消息
this.sendMessageByTemplateId(
toBeConfirmedPciEoList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE16.getValue(),
userIdList,
dutyPersonList
dutyPersonList,
taskConfirmEndTime
);
}
@@ -2812,12 +2930,14 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(toBeSubmitOrReturnPciEoList)) {
this.certificationInventoryEOListSortByTaskConfirmEndTimeAsc(toBeSubmitOrReturnPciEoList);
// 给责任人发消息
this.sendMessageByTemplateId(
toBeSubmitOrReturnPciEoList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE18.getValue(),
userIdList,
dutyPersonList
dutyPersonList,
toBeSubmitOrReturnPciEoList.get(0).getTaskConfirmEndTime()
);
}
@@ -437,12 +437,14 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
certificationInventoryEOQueryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(certificationInventoryEOQueryWrapper);
if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){
this.projectCertificationInventoryEOService.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(originalCertificationEngineerIdList);
this.projectCertificationInventoryEOService.sendMessageByTemplateId(
projectCertificationInventoryEOList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE13.getValue(),
originalCertificationEngineerIdList,
userInfoList
userInfoList,
projectCertificationInventoryEOList.get(0).getEndTime()
);
}
}
@@ -245,7 +245,7 @@
pid.end_time
from
process_info_detail pid
where pid.process_info_id = pi.id and pid.STATUS = 'NotDone' order by pid.end_time asc limit 1
where pid.process_info_id = pi.id and pid.STATUS = 'NotDone' and pid.end_time is not null order by pid.end_time asc limit 1
) as end_time,
<!--(
case when flow_type = '21' then
@@ -766,6 +766,59 @@ public class ProcessInfoEOServiceImpl extends ServiceImpl<ProcessInfoEOMapper, P
}
data.setTaskDefinitionKeyName(taskDefinitionKeyName);
}
// 如果是Pre-Homo流程
if(StringUtils.equals(data.getFlowType(),FlowTypeEnum.CERTIFICATION_LC.getValue())){
String taskDefinitionKey = "";
String processInfoId = data.getId();
Date preHomoEndTime = data.getEndTime();
List<ProcessInfoDetailEO> pidEoListTemp = processInfoDetailEOList.stream().filter(pidEo -> {
boolean flag = false;
if (StringUtils.equals(processInfoId, pidEo.getProcessInfoId()) && pidEo.getEndTime() != null) {
if(pidEo.getEndTime().equals(preHomoEndTime)){
flag = true;
}
}
return flag;
}).collect(Collectors.toList());
boolean qdjhFlag = false; // 清单校核标识
boolean rwzrqrFlag = false; // 任务责任确认标识
boolean rwblFlag = false; // 任务办理标识
boolean rwscFlag = false; // 任务审查标识
for (ProcessInfoDetailEO pidEo : pidEoListTemp) {
if(pidEo.getEndTime() == null){
continue;
}
if (StringUtils.equals(processInfoId, pidEo.getProcessInfoId()) && StringUtils.equals(pidEo.getStatus(),TaskStatusEnum.NOT_DONE.getValue())) {
if(StringUtils.equals(pidEo.getTaskDefinitionKey(), CertificationFlowNodeEnum.RZGCSJSRW.getKey())){
qdjhFlag = true;
}
if(StringUtils.equals(pidEo.getTaskDefinitionKey(), CertificationFlowNodeEnum.ZRRJSRW.getKey())){
rwzrqrFlag = true;
}
if(StringUtils.equals(pidEo.getTaskDefinitionKey(), CertificationFlowNodeEnum.ZRRTJRW.getKey())){
rwblFlag = true;
}
if(StringUtils.equals(pidEo.getTaskDefinitionKey(), CertificationFlowNodeEnum.RZGCSSC.getKey())){
rwscFlag = true;
}
}
}
if(qdjhFlag){
taskDefinitionKey = CertificationFlowNodeEnum.CHECKLIST_VERIFICATION.getKey();
}else if(rwzrqrFlag){
taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey();
}else if(rwblFlag){
taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey();
}else if(rwscFlag){
taskDefinitionKey = CertificationFlowNodeEnum.TASK_REVIEW.getKey();
}
data.setTaskDefinitionKeyName(CertificationFlowNodeEnum.getTextByValue(taskDefinitionKey,cut));
}
});
}
}