|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
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.common.enumeration.CommonEnum; |
|
|
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; |
|
|
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; |
|
|
import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; |
|
|
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.projectdeclared.service.IOperationService; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum; |
|
|
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.enumeration.WarningOperationTypeEnum; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
import com.ningdatech.pmapi.sys.manage.EarlyWarningManage; |
|
|
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.bean.entity.WflowEarlyWarning; |
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
import com.wflow.service.IEarlyWarningService; |
|
|
import com.wflow.service.IEarlyWarningService; |
|
@@ -57,6 +61,8 @@ public class EarlyWarningInstanceNotStartTask { |
|
|
|
|
|
|
|
|
private final IOperationService operationService; |
|
|
private final IOperationService operationService; |
|
|
|
|
|
|
|
|
|
|
|
private final IUserInfoService userInfoService; |
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0/2 * * * ?") |
|
|
@Scheduled(cron = "0 0/2 * * * ?") |
|
|
public void doEarlyWarningDeclared() throws UnknownHostException { |
|
|
public void doEarlyWarningDeclared() throws UnknownHostException { |
|
|
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { |
|
|
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { |
|
@@ -94,6 +100,7 @@ public class EarlyWarningInstanceNotStartTask { |
|
|
JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); |
|
|
JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); |
|
|
Integer time = rJson.getInteger("time"); |
|
|
Integer time = rJson.getInteger("time"); |
|
|
Integer biz = rJson.getInteger("biz"); |
|
|
Integer biz = rJson.getInteger("biz"); |
|
|
|
|
|
String notice = rJson.getString("notice"); |
|
|
if(Objects.isNull(time) || Objects.isNull(biz)){ |
|
|
if(Objects.isNull(time) || Objects.isNull(biz)){ |
|
|
log.info("规则数据 错误 :{}",rJson); |
|
|
log.info("规则数据 错误 :{}",rJson); |
|
|
return; |
|
|
return; |
|
@@ -146,11 +153,50 @@ public class EarlyWarningInstanceNotStartTask { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for(Project needToWaringProject : needToWaringProjects){ |
|
|
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()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|