Bladeren bron

预警规则 咨询公司

tags/24080901
PoffyZhang 1 jaar geleden
bovenliggende
commit
bef477b7b5
4 gewijzigde bestanden met toevoegingen van 110 en 5 verwijderingen
  1. +53
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningNoticeTypeEnum.java
  2. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  3. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  4. +51
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java

+ 53
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningNoticeTypeEnum.java Bestand weergeven

@@ -0,0 +1,53 @@
package com.ningdatech.pmapi.projectlib.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
*
* 预警提醒类型枚举
* @author ZPF
* @since 2023/10/31 16:14
*/
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum WarningNoticeTypeEnum {
/**
* 预警提醒类型枚举
*/
CONTACT(1, "项目联系人"),
RESPONSIBLE(2, "项目负责人");

private Integer code;
private String desc;


public static String getDescByCode(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (WarningNoticeTypeEnum t : WarningNoticeTypeEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}

public static WarningNoticeTypeEnum getByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (WarningNoticeTypeEnum t : WarningNoticeTypeEnum.values()) {
if (code.equals(t.getCode())) {
return t;
}
}
return null;
}
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java Bestand weergeven

@@ -552,4 +552,7 @@ public class Project implements Serializable {

@ApiModelProperty("建议评审意见附件")
private String proposeAttachFiles;

@ApiModelProperty("咨询公司")
private String consultancy;
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java Bestand weergeven

@@ -534,4 +534,7 @@ public class ProjectDetailVO {

@ApiModelProperty("建议评审意见附件")
private String proposeAttachFiles;

@ApiModelProperty("咨询公司")
private String consultancy;
}

+ 51
- 5
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java Bestand weergeven

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
import com.ningdatech.pmapi.projectdeclared.model.entity.Operation;
@@ -13,10 +14,13 @@ import com.ningdatech.pmapi.projectdeclared.service.IContractService;
import com.ningdatech.pmapi.projectdeclared.service.IOperationService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.WarningNoticeTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.WarningOperationTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.sys.manage.EarlyWarningManage;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.wflow.bean.entity.WflowEarlyWarning;
import com.wflow.enums.WarningRuleTypeEnum;
import com.wflow.service.IEarlyWarningService;
@@ -57,6 +61,8 @@ public class EarlyWarningInstanceNotStartTask {

private final IOperationService operationService;

private final IUserInfoService userInfoService;

@Scheduled(cron = "0 0/2 * * * ?")
public void doEarlyWarningDeclared() throws UnknownHostException {
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) {
@@ -94,6 +100,7 @@ public class EarlyWarningInstanceNotStartTask {
JSONObject rJson = JSON.parseObject(JSON.toJSONString(r));
Integer time = rJson.getInteger("time");
Integer biz = rJson.getInteger("biz");
String notice = rJson.getString("notice");
if(Objects.isNull(time) || Objects.isNull(biz)){
log.info("规则数据 错误 :{}",rJson);
return;
@@ -146,11 +153,50 @@ public class EarlyWarningInstanceNotStartTask {
}

for(Project needToWaringProject : needToWaringProjects){
//去预警通知
String employeeCode = needToWaringProject.getSponsor();
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,biz,
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject,
WarningRuleTypeEnum.DECLARED_WARNING.getCode());
if(StringUtils.isBlank(notice)){
log.info(needToWaringProject.getProjectCode() + "取不到提醒人配置!");
continue;
}
String employeeCode = null;
String username = null;
String mobile = null;
//去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发
if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){
username = needToWaringProject.getContactName();
mobile = needToWaringProject.getContactPhone();
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getUsername, username)
.eq(UserInfo::getMobile, mobile)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(user)){
employeeCode = user.getEmployeeCode();
}
if(Objects.nonNull(employeeCode)){
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,biz,
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject,
WarningRuleTypeEnum.DECLARED_WARNING.getCode());
}
}
}
if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){
username = needToWaringProject.getResponsibleMan();
mobile = needToWaringProject.getResponsibleManMobile();
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getUsername, username)
.eq(UserInfo::getMobile, mobile)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(user)){
employeeCode = user.getEmployeeCode();
}
if(Objects.nonNull(employeeCode)){
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,biz,
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject,
WarningRuleTypeEnum.DECLARED_WARNING.getCode());
}
}
}
}
});
}


Laden…
Annuleren
Opslaan