From 212871f4026a46b2f7eccb2f39eed3b3a579cfc6 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 23 Nov 2023 09:34:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=AD=A6=20=E5=AE=9E=E6=96=BD?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=20=E4=BF=AE=E6=94=B9=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/EarlyWarningInstanceNotStartTask.java | 57 ++++++++++++++++++++-- 1 file changed, 52 insertions(+), 5 deletions(-) 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); + } } }