Browse Source

工作台 预警 催办 处理

tags/24080901
PoffyZhang 1 year ago
parent
commit
5c23197cb1
9 changed files with 77 additions and 30 deletions
  1. +7
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningFlowTypeEnum.java
  2. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningOperationTypeEnum.java
  3. +9
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java
  4. +25
    -20
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java
  5. +3
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java
  6. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java
  7. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProjectEarlyWarningVO.java
  8. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java
  9. +13
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java

+ 7
- 5
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningFlowTypeEnum.java View File

@@ -20,11 +20,11 @@ public enum WarningFlowTypeEnum {
/**
* 预警填报类型枚举
*/
UNIT_INNER_AUDIT(1, "预审申报",ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()),
PRELIMINARY_PREVIEW(2, "建设方案申报",ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()),
DEPT_UNITED_REVIEW(3,"采购结果备案",ProjectStatusEnum.TO_BE_PURCHASED.getCode()),
CONSTRUCTION_PLAN_REVIEW(4,"初验备案",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()),
PROJECT_FINAL_INSPECTION(5,"验收申报",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode());
UNIT_INNER_AUDIT(1, "预审申报",ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(),"declareManage/preExaminationDeclare"),
PRELIMINARY_PREVIEW(2, "建设方案申报",ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(),"declareManage/constructionPlanDeclare"),
DEPT_UNITED_REVIEW(3,"采购结果备案",ProjectStatusEnum.TO_BE_PURCHASED.getCode(),"declareManage/purchaseResults"),
CONSTRUCTION_PLAN_REVIEW(4,"初验备案",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),"declareManage/initialInspectionRecord"),
PROJECT_FINAL_INSPECTION(5,"验收申报",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/finalInspectionDeclare");

private Integer code;
private String desc;
@@ -32,6 +32,8 @@ public enum WarningFlowTypeEnum {
//对应的 待提交时的项目状态
private Integer projectStutas;

private String path;

public static String getDescByCode(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;


+ 4
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningOperationTypeEnum.java View File

@@ -20,8 +20,8 @@ public enum WarningOperationTypeEnum {
/**
* 预警实施类型枚举
*/
CHUYAN(1, "项目初验",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()),
ZHONGYAN(2, "项目终验",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode());
CHUYAN(1, "项目初验",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),"declareManage/initialInspectionRecord"),
ZHONGYAN(2, "项目终验",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/finalInspectionDeclare");

private Integer code;
private String desc;
@@ -29,6 +29,8 @@ public enum WarningOperationTypeEnum {
//对应的 待提交时的项目状态
private Integer projectStutas;

private String path;

public static String getDescByCode(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;


+ 9
- 1
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java View File

@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.scheduler.listener;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
@@ -25,6 +26,7 @@ import org.springframework.stereotype.Component;
import java.time.ZoneId;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* 预警规则触发
@@ -112,11 +114,17 @@ public class EarlyWarningListener {
return;
}

//这一批员工要通知的员工号
String batchEmployees = hais.stream().map(HistoricActivityInstance::getAssignee)
.collect(Collectors.joining(StrPool.COMMA));
for(HistoricActivityInstance hai : hais){
String employeeCode = hai.getAssignee();
String taskId = hai.getTaskId();
String path = "toDoCenter/handleDuringExamine?instanceId=" +
instanceId + "&projectId=1610&nodeId=" + nodeId + "&taskId=" + taskId;
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,pi.getInstType(),
hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()
,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType);
,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType,path,batchEmployees);
}
}
}

+ 25
- 20
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java View File

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
@@ -130,6 +131,7 @@ public class EarlyWarningInstanceNotStartTask {
log.info("匹配不到 业务类型");
return;
}
String path = flowTypeEnum.getPath();

//得出 对应待提交的项目状态
Integer projectStutas = flowTypeEnum.getProjectStutas();
@@ -185,11 +187,12 @@ public class EarlyWarningInstanceNotStartTask {
}

for(Project needToWaringProject : needToWaringProjects){
String employeeCode = null;
String username = null;
String mobile = null;
//去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发
List<String> batchEmployees = Lists.newArrayList();
if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){
String employeeCode = null;
username = needToWaringProject.getContactName();
mobile = needToWaringProject.getContactPhone();
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){
@@ -201,19 +204,12 @@ public class EarlyWarningInstanceNotStartTask {
employeeCode = user.getEmployeeCode();
}
if(Objects.nonNull(employeeCode)){
if(noticeMap.containsKey(needToWaringProject.getProjectCode())){
List<Integer> noticeTypes = noticeMap.get(needToWaringProject.getProjectCode());
for(Integer noticeType : noticeTypes){
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&&noticeType.equals(1) ? noticeContent : adventContent,time,biz,
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject,
WarningRuleTypeEnum.DECLARED_WARNING.getCode(),noticeType);
}
}

batchEmployees.add(employeeCode);
}
}
}
if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){
String employeeCode = null;
username = needToWaringProject.getResponsibleMan();
mobile = needToWaringProject.getResponsibleManMobile();
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){
@@ -225,15 +221,20 @@ public class EarlyWarningInstanceNotStartTask {
employeeCode = user.getEmployeeCode();
}
if(Objects.nonNull(employeeCode)){
if(noticeMap.containsKey(needToWaringProject.getProjectCode())){
List<Integer> noticeTypes = noticeMap.get(needToWaringProject.getProjectCode());
for(Integer noticeType : noticeTypes){
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&&noticeType.equals(1) ? noticeContent : adventContent,time,biz,
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject,
WarningRuleTypeEnum.DECLARED_WARNING.getCode(),noticeType);
}
batchEmployees.add(employeeCode);
}
}
}
if(CollUtil.isNotEmpty(batchEmployees)){
String batchEmployeesStr = batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA));
if(noticeMap.containsKey(needToWaringProject.getProjectCode())){
List<Integer> noticeTypes = noticeMap.get(needToWaringProject.getProjectCode());
for(Integer noticeType : noticeTypes) {
for (String employeeCode : batchEmployees) {
earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, time, biz,
needToWaringProject.getUpdateOn(),employeeCode, needToWaringProject,
WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr);
}

}
}
}
@@ -299,6 +300,7 @@ public class EarlyWarningInstanceNotStartTask {

//得出 对应待提交的项目状态
Integer projectStutas = operationTypeEnum.getProjectStutas();
String path = operationTypeEnum.getPath();
String areaCode = warning.getAreaCode();
//测试先用分钟
//查询 所有这个区域的项目 未提交的项目
@@ -383,7 +385,7 @@ public class EarlyWarningInstanceNotStartTask {
for(Integer noticeType : noticeTypes){
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&&noticeType.equals(1) ? noticeContent : adventContent,time,biz,
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject,
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType);
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path,employeeCode);
}
}

@@ -486,16 +488,19 @@ public class EarlyWarningInstanceNotStartTask {
}

for(ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects){
String path = "projectStoreManage/renewalProjectAsscess?projectRenewalId=" + needToWaringProject.getId();
Project project = projectService.getProjectByCode(needToWaringProject.getProjectCode());
//去预警通知 发给区管
List<UserInfo> users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name(),needToWaringProject.getRegionCode());
String employeesStr = users.stream().map(UserInfo::getEmployeeCode)
.collect(Collectors.joining(StrPool.COMMA));
for(UserInfo user : users){
if(noticeTypeMap.containsKey(needToWaringProject.getProjectCode())){
List<Integer> noticeTypes = noticeTypeMap.get(needToWaringProject.getProjectCode());
for(Integer noticeType : noticeTypes){
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&&noticeType.equals(1) ? noticeContent : adventContent,time,null,
needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project,
WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType);
WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType,path,employeesStr);
}
}



+ 3
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java View File

@@ -57,7 +57,7 @@ public class EarlyWarningManage {
*/
public void doEarlyWarning(String noticeMethod,String noticeContent, Integer timeout,Integer biz,
LocalDateTime startTime,String employeeCode,
Project project,Integer ruleType,Integer noticeType) {
Project project,Integer ruleType,Integer noticeType,String path,String batchEmployees) {
//1.存入 预警记录
UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode);
WflowEarlyWarningRecords records = new WflowEarlyWarningRecords();
@@ -104,6 +104,8 @@ public class EarlyWarningManage {
records.setProjectCode(project.getProjectCode());
records.setProjectStatus(project.getStatus());
records.setNoticeType(noticeType);
records.setPath(path);
records.setBatchEmployees(batchEmployees);
earlyWarningRecordsService.save(records);

//2.消息提醒


+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java View File

@@ -110,6 +110,11 @@ public class WflowEarlyWarningRecords implements Serializable {
@ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督 4.续建资金项目")
private Integer ruleType;

@ApiModelProperty(value = "路径")
private String path;

@ApiModelProperty(value = "这一批要通知的员工号")
private String batchEmployees;

private LocalDateTime createOn;



+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProjectEarlyWarningVO.java View File

@@ -62,6 +62,8 @@ public class ProjectEarlyWarningVO implements Serializable {
/**
* 最新的一条预警记录
*/
@ApiModelProperty(value = "预警ID")
private Long recordId;
@ApiModelProperty(value = "预警员工号")
private String warningEmployeecode;
@ApiModelProperty(value = "通知方式 0浙政钉 1短信 逗号分隔")
@@ -72,6 +74,11 @@ public class ProjectEarlyWarningVO implements Serializable {
private LocalDateTime instStart;
@ApiModelProperty(value = "预警时间")
private LocalDateTime warningTime;
@ApiModelProperty(value = "路径")
private String path;
@ApiModelProperty(value = "这一批要通知的员工号")
private String batchEmployees;


private LocalDateTime createOn;



+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java View File

@@ -109,6 +109,10 @@ public class WflowEarlyWarningRecordsVO implements Serializable {
@ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督4.续建")
private Integer ruleType;

@ApiModelProperty(value = "路径")
private String path;
@ApiModelProperty(value = "这一批要通知的员工号")
private String batchEmployees;

private LocalDateTime createOn;
private String createBy;


+ 13
- 1
pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java View File

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Sets;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage;
@@ -31,6 +32,7 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
import java.util.stream.Collectors;
@@ -149,9 +151,10 @@ public class WorkbenchManage {
projectEarlyWarning.setCurrent(cuurent);

List<WflowEarlyWarningRecords> warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class)
.groupBy(WflowEarlyWarningRecords::getProjectCode)
.orderByDesc(WflowEarlyWarningRecords::getWarningTime));
Set<String> projectCodeSet = Sets.newHashSet();
Map<String, WflowEarlyWarningRecords> warningMap = warningRecords.stream()
.filter(w -> projectCodeSet.add(w.getProjectCode()))
.collect(Collectors.toMap(WflowEarlyWarningRecords::getProjectCode, w -> w));

if(CollUtil.isNotEmpty(overPage.getRecords())){
@@ -165,6 +168,9 @@ public class WorkbenchManage {
vo.setWarningEmployeecode(record.getWarningEmployeecode());
vo.setNoticeMethod(record.getNoticeMethod());
vo.setNoticeContent(record.getNoticeContent());
vo.setPath(record.getPath());
vo.setBatchEmployees(record.getBatchEmployees());
vo.setRecordId(record.getId());
}
return vo;
}).collect(Collectors.toList());
@@ -184,6 +190,9 @@ public class WorkbenchManage {
vo.setWarningEmployeecode(record.getWarningEmployeecode());
vo.setNoticeMethod(record.getNoticeMethod());
vo.setNoticeContent(record.getNoticeContent());
vo.setPath(record.getPath());
vo.setBatchEmployees(record.getBatchEmployees());
vo.setRecordId(record.getId());
}
return vo;
}).collect(Collectors.toList());
@@ -203,6 +212,9 @@ public class WorkbenchManage {
vo.setWarningEmployeecode(record.getWarningEmployeecode());
vo.setNoticeMethod(record.getNoticeMethod());
vo.setNoticeContent(record.getNoticeContent());
vo.setPath(record.getPath());
vo.setBatchEmployees(record.getBatchEmployees());
vo.setRecordId(record.getId());
}
return vo;
}).collect(Collectors.toList());


Loading…
Cancel
Save