|
|
@@ -16,6 +16,7 @@ import com.ningdatech.pmapi.sys.service.INotifyService; |
|
|
|
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
|
import com.ningdatech.yxt.model.cmd.SendSmsCmd; |
|
|
|
import com.wflow.enums.WarningNoticeTypeEnum; |
|
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@@ -51,12 +52,12 @@ public class EarlyWarningManage { |
|
|
|
* 预警通知 |
|
|
|
* @param noticeMethod |
|
|
|
* @param noticeContent |
|
|
|
* @param timeout |
|
|
|
* @param adventTimeout |
|
|
|
* @param employeeCode |
|
|
|
* @param project |
|
|
|
*/ |
|
|
|
public void doEarlyWarning(String noticeMethod,String noticeContent, Integer timeout,Integer biz, |
|
|
|
LocalDateTime startTime,String employeeCode, |
|
|
|
public void doEarlyWarning(String noticeMethod,String noticeContent, Integer adventTimeout,Integer overTimeout, |
|
|
|
Integer biz, LocalDateTime startTime,String employeeCode, |
|
|
|
Project project,Integer ruleType,Integer noticeType, |
|
|
|
String path,String batchEmployees,String nodeId) { |
|
|
|
//1.存入 预警记录 |
|
|
@@ -66,22 +67,53 @@ public class EarlyWarningManage { |
|
|
|
|
|
|
|
switch (WarningRuleTypeEnum.checkByCode(ruleType)){ |
|
|
|
case PROCESS_WARNING: |
|
|
|
content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
InstTypeEnum.getByCode(biz),timeout); |
|
|
|
if(Objects.isNull(noticeType)){ |
|
|
|
content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
InstTypeEnum.getByCode(biz),overTimeout); |
|
|
|
}else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { |
|
|
|
content = convertAdventContent(noticeContent,project.getProjectName(), |
|
|
|
InstTypeEnum.getByCode(biz),adventTimeout,overTimeout); |
|
|
|
}else{ |
|
|
|
content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
InstTypeEnum.getByCode(biz),overTimeout); |
|
|
|
} |
|
|
|
records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); |
|
|
|
break; |
|
|
|
case DECLARED_WARNING: |
|
|
|
content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
WarningFlowTypeEnum.getByCode(biz),timeout); |
|
|
|
if(Objects.isNull(noticeType)){ |
|
|
|
content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
WarningFlowTypeEnum.getByCode(biz),overTimeout); |
|
|
|
}else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { |
|
|
|
content = convertAdventContent(noticeContent,project.getProjectName(), |
|
|
|
WarningFlowTypeEnum.getByCode(biz),adventTimeout,overTimeout); |
|
|
|
}else{ |
|
|
|
content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
WarningFlowTypeEnum.getByCode(biz),overTimeout); |
|
|
|
} |
|
|
|
records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); |
|
|
|
break; |
|
|
|
case OPERATION_WARNING: |
|
|
|
content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
WarningOperationTypeEnum.getByCode(biz),timeout); |
|
|
|
if(Objects.isNull(noticeType)){ |
|
|
|
content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
WarningOperationTypeEnum.getByCode(biz),overTimeout); |
|
|
|
}else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { |
|
|
|
content = convertAdventContent(noticeContent,project.getProjectName(), |
|
|
|
WarningOperationTypeEnum.getByCode(biz),adventTimeout,overTimeout); |
|
|
|
}else{ |
|
|
|
content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
WarningOperationTypeEnum.getByCode(biz),overTimeout); |
|
|
|
} |
|
|
|
records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); |
|
|
|
break; |
|
|
|
case RENEWAL_FUND: |
|
|
|
content = convertContent(noticeContent,project.getProjectName(),timeout); |
|
|
|
if(Objects.isNull(noticeType)){ |
|
|
|
content = convertContent(noticeContent,project.getProjectName(),overTimeout); |
|
|
|
}else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { |
|
|
|
content = convertAdventContent(noticeContent,project.getProjectName(),adventTimeout,overTimeout); |
|
|
|
}else{ |
|
|
|
content = convertContent(noticeContent,project.getProjectName(),overTimeout); |
|
|
|
} |
|
|
|
|
|
|
|
records.setRuleType(WarningRuleTypeEnum.RENEWAL_FUND.getCode()); |
|
|
|
break; |
|
|
|
default: |
|
|
@@ -147,6 +179,13 @@ public class EarlyWarningManage { |
|
|
|
log.info("通知内容 :{}",noticeContent); |
|
|
|
return noticeContent; |
|
|
|
} |
|
|
|
private String convertAdventContent(String noticeContent, String projectName, Integer timeout,Integer overTimeOut) { |
|
|
|
noticeContent = noticeContent.replace("{projectName}",projectName) |
|
|
|
.replace("{time}",String.valueOf(timeout)) |
|
|
|
.replace("{time2}",String.valueOf((overTimeOut - timeout))); |
|
|
|
log.info("通知内容 :{}",noticeContent); |
|
|
|
return noticeContent; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 转换出 通知的内容 |
|
|
@@ -165,6 +204,16 @@ public class EarlyWarningManage { |
|
|
|
return noticeContent; |
|
|
|
} |
|
|
|
|
|
|
|
private String convertAdventContent(String noticeContent, String projectName, InstTypeEnum instTypeEnum, Integer timeout,Integer overTimeOut) { |
|
|
|
noticeContent = noticeContent.replace("{projectName}",projectName) |
|
|
|
.replace("{flowType}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{flowType}") |
|
|
|
.replace("{stepName}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{stepName}") |
|
|
|
.replace("{time}",String.valueOf(timeout)) |
|
|
|
.replace("{time2}",String.valueOf((overTimeOut - timeout))); |
|
|
|
log.info("通知内容 :{}",noticeContent); |
|
|
|
return noticeContent; |
|
|
|
} |
|
|
|
|
|
|
|
private String convertContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout) { |
|
|
|
noticeContent = noticeContent.replace("{projectName}",projectName) |
|
|
|
.replace("{flowType}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{flowType}") |
|
|
@@ -174,6 +223,16 @@ public class EarlyWarningManage { |
|
|
|
return noticeContent; |
|
|
|
} |
|
|
|
|
|
|
|
private String convertAdventContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout,Integer overTimeout) { |
|
|
|
noticeContent = noticeContent.replace("{projectName}",projectName) |
|
|
|
.replace("{flowType}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{flowType}") |
|
|
|
.replace("{stepName}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{stepName}") |
|
|
|
.replace("{time}",String.valueOf(timeout)) |
|
|
|
.replace("{time2}",String.valueOf((overTimeout - timeout))); |
|
|
|
log.info("通知内容 :{}",noticeContent); |
|
|
|
return noticeContent; |
|
|
|
} |
|
|
|
|
|
|
|
private String convertContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout) { |
|
|
|
noticeContent = noticeContent.replace("{projectName}",projectName) |
|
|
|
.replace("{flowType}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{flowType}") |
|
|
@@ -182,4 +241,14 @@ public class EarlyWarningManage { |
|
|
|
log.info("通知内容 :{}",noticeContent); |
|
|
|
return noticeContent; |
|
|
|
} |
|
|
|
|
|
|
|
private String convertAdventContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout,Integer overTimeout) { |
|
|
|
noticeContent = noticeContent.replace("{projectName}",projectName) |
|
|
|
.replace("{flowType}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{flowType}") |
|
|
|
.replace("{stepName}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{stepName}") |
|
|
|
.replace("{time}",String.valueOf(timeout)) |
|
|
|
.replace("{time2}",String.valueOf((overTimeout - timeout))); |
|
|
|
log.info("通知内容 :{}",noticeContent); |
|
|
|
return noticeContent; |
|
|
|
} |
|
|
|
} |