Browse Source

预警 实施监控 修改联系选择

tags/24080901
PoffyZhang 1 year ago
parent
commit
212871f402
1 changed files with 52 additions and 5 deletions
  1. +52
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java

+ 52
- 5
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java View File

@@ -288,6 +288,7 @@ public class EarlyWarningInstanceNotStartTask {
Integer time = rJson.getInteger("time");
Integer adventTime = rJson.getInteger("adventTime");
Integer biz = rJson.getInteger("biz");
String notice = rJson.getString("notice");
if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){
log.info("规则数据 错误 :{}",rJson);
return;
@@ -380,14 +381,60 @@ public class EarlyWarningInstanceNotStartTask {

for(Project needToWaringProject : needToWaringProjects){
//去预警通知
String employeeCode = needToWaringProject.getSponsor();
List<String> batchEmployees = Lists.newArrayList();

if(StringUtils.isBlank(notice)){
String sponsor = needToWaringProject.getSponsor();
batchEmployees.add(sponsor);
}else{
//去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发

if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){
String employeeCode = null;
String username = needToWaringProject.getContactName();
String 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)){
batchEmployees.add(employeeCode);
}
}
}
if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){
String employeeCode = null;
String username = needToWaringProject.getResponsibleMan();
String 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)){
batchEmployees.add(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,
Objects.nonNull(noticeType) && noticeType.equals(1) ? time : adventTime,biz,
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject,
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path,employeeCode,null);
for (String employeeCode : batchEmployees) {
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&&noticeType.equals(1) ? noticeContent : adventContent,
Objects.nonNull(noticeType) && noticeType.equals(1) ? time : adventTime,biz,
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject,
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path,
batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)),null);
}
}
}



Loading…
Cancel
Save