Browse Source

预警 优化 催办

tags/24080901
PoffyZhang 1 year ago
parent
commit
ed12fa4cc1
4 changed files with 30 additions and 6 deletions
  1. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java
  2. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java
  3. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java
  4. +24
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java

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

@@ -141,6 +141,7 @@ public class EarlyWarningManage {
records.setBatchEmployees(batchEmployees); records.setBatchEmployees(batchEmployees);
records.setBiz(biz); records.setBiz(biz);
records.setNodeId(nodeId); records.setNodeId(nodeId);
records.setOverTime(overTimeout);
earlyWarningRecordsService.save(records); earlyWarningRecordsService.save(records);


//2.消息提醒 //2.消息提醒


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

@@ -122,6 +122,9 @@ public class WflowEarlyWarningRecords implements Serializable {
@ApiModelProperty(value = "这一批要通知的员工号") @ApiModelProperty(value = "这一批要通知的员工号")
private String batchEmployees; private String batchEmployees;


@ApiModelProperty(value = "临期时要记录下 超期的时间")
private Integer overTime;

private LocalDateTime createOn; private LocalDateTime createOn;


} }

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

@@ -120,6 +120,8 @@ public class WflowEarlyWarningRecordsVO implements Serializable {
private String updateBy; private String updateBy;
@ApiModelProperty(value = "业务biz") @ApiModelProperty(value = "业务biz")
private Integer biz; private Integer biz;
@ApiModelProperty(value = "临期时要记录下 超期的时间")
private Integer overTime;


public String getInstTypeName(){ public String getInstTypeName(){
if(Objects.nonNull(this.instType) && Objects.nonNull(this.ruleType)){ if(Objects.nonNull(this.instType) && Objects.nonNull(this.ruleType)){


+ 24
- 6
pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java View File

@@ -10,6 +10,7 @@ import com.google.common.collect.Sets;
import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.StrPool; import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
@@ -32,8 +33,10 @@ import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter;
import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO;
import com.wflow.bean.entity.WflowEarlyWarning;
import com.wflow.enums.WarningNoticeTypeEnum; import com.wflow.enums.WarningNoticeTypeEnum;
import com.wflow.enums.WarningRuleTypeEnum; import com.wflow.enums.WarningRuleTypeEnum;
import com.wflow.service.IEarlyWarningService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -63,6 +66,8 @@ public class WorkbenchManage {


private final IEarlyWarningRecordsService earlyWarningRecordsService; private final IEarlyWarningRecordsService earlyWarningRecordsService;


private final IEarlyWarningService earlyWarningService;

private final IProjectEarlyWarningService projectEarlyWarningService; private final IProjectEarlyWarningService projectEarlyWarningService;


private final NoticeManage noticeManage; private final NoticeManage noticeManage;
@@ -297,14 +302,15 @@ public class WorkbenchManage {


VUtils.isTrue(Objects.isNull(record)) VUtils.isTrue(Objects.isNull(record))
.throwMessage("催办失败,id不存在!"); .throwMessage("催办失败,id不存在!");

String noticeMethod = record.getNoticeMethod(); String noticeMethod = record.getNoticeMethod();
Integer noticeType = record.getNoticeType(); Integer noticeType = record.getNoticeType();
String projectCode = record.getProjectCode(); String projectCode = record.getProjectCode();
Project project = projectService.getProjectByCode(projectCode); Project project = projectService.getProjectByCode(projectCode);
String noticeContent = record.getNoticeContent();
String batchEmployees = record.getBatchEmployees(); String batchEmployees = record.getBatchEmployees();
Integer ruleType = record.getRuleType(); Integer ruleType = record.getRuleType();
String areaCode = record.getAreaCode();
//如果是临期 可以取到 超期的小时数
Integer overTime = record.getOverTime();
String path = record.getPath(); String path = record.getPath();
LocalDateTime instStart = record.getInstStart(); LocalDateTime instStart = record.getInstStart();
Integer biz = record.getBiz(); Integer biz = record.getBiz();
@@ -313,15 +319,27 @@ public class WorkbenchManage {
//如果批次员工号不存在 就取当前 //如果批次员工号不存在 就取当前
batchEmployees = record.getWarningEmployeecode(); batchEmployees = record.getWarningEmployeecode();
} }
String noticeContent = record.getNoticeContent();
//查出配置的模板
WflowEarlyWarning config = earlyWarningService.getOne(Wrappers.lambdaQuery(WflowEarlyWarning.class)
.eq(WflowEarlyWarning::getAreaCode, areaCode)
.eq(WflowEarlyWarning::getRuleType, ruleType)
.last(BizConst.LIMIT_1));
//如果配置能取到 就取模板的
if(Objects.nonNull(config)){
noticeContent = config.getNoticeContent();
}

VUtils.isTrue(StringUtils.isBlank(batchEmployees)) VUtils.isTrue(StringUtils.isBlank(batchEmployees))
.throwMessage("催办失败,员工为空!"); .throwMessage("催办失败,员工为空!");
String[] employees = batchEmployees.split(StrPool.COMMA); String[] employees = batchEmployees.split(StrPool.COMMA);
//算出 当前和他的 小时差
Long between = ChronoUnit.HOURS.between(instStart,LocalDateTime.now());
//算出 当前和他的 小时差 临期
Long adventBetween = ChronoUnit.HOURS.between(instStart,LocalDateTime.now());
Integer overBetween = overTime - adventBetween.intValue();
Integer times = 0; Integer times = 0;
for(String employee : employees){ for(String employee : employees){
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,between.intValue()
,between.intValue(),biz,
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,adventBetween.intValue()
,overBetween,biz,
instStart,employee,project, instStart,employee,project,
ruleType,noticeType,path,batchEmployees,record.getNodeId()); ruleType,noticeType,path,batchEmployees,record.getNodeId());
times++; times++;


Loading…
Cancel
Save