diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java index 08a9242..b99ad5a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java @@ -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 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 noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); for(Integer noticeType : noticeTypes){ - earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.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)&¬iceType.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); + } } }