diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java index 64d0c2b..f8ebc2f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java @@ -41,6 +41,7 @@ import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; +import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper; import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; import com.ningdatech.pmapi.meeting.service.IMeetingService; import com.ningdatech.pmapi.meeting.task.ExpertRandomInviteTask; @@ -77,6 +78,7 @@ public class LeaveManage { private final IExpertMetaApplyService metaApplyService; private final FileService fileService; private final IExpertUserFullInfoService userFullInfoService; + private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; private static final int HOURS_BEFORE_MEETING = 2; @@ -217,6 +219,7 @@ public class LeaveManage { .eq(Meeting::getId, meeting.getId()); meetingService.update(mUpdate); } + meetingCallOrMsgHelper.sendExpertLeaveMsg(expert, meeting); // 临时请假无需审核 leave.setAuditId(0L); leave.setStatus(LeaveStatusEnum.PASSED.getCode()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/constant/MeetingMsgTemplateConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/constant/MeetingMsgTemplateConst.java index 90cf49a..3a865db 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/constant/MeetingMsgTemplateConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/constant/MeetingMsgTemplateConst.java @@ -25,4 +25,8 @@ public interface MeetingMsgTemplateConst { */ String MEETING_CANCEL = "尊敬的%s专家,原定于%s的%s会议已取消。给您带来不便,敬请谅解。如有疑问请咨询会议联系人「%s」。"; + String EXPERT_LEAVE_RANDOM = "请注意,%s会议有专家请假,将重新抽取以替换该专家。"; + + String EXPERT_LEAVE_APPOINT = "请注意,%s会议的%s专家请假,请及时登录系统替换该专家。"; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingCallOrMsgHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingCallOrMsgHelper.java index 0955e82..9de3586 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingCallOrMsgHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingCallOrMsgHelper.java @@ -7,6 +7,7 @@ import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.meeting.constant.MeetingMsgTemplateConst; import com.ningdatech.pmapi.meeting.entity.domain.Meeting; import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; +import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingReviewTypeEnum; import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; @@ -187,4 +188,29 @@ public class MeetingCallOrMsgHelper { experts.forEach(w -> w.setSubmitKey(submitKey)); } + public void sendExpertLeaveMsg(MeetingExpert expert, Meeting meeting) { + Long userId = meeting.getCreateBy(); + String msgContent; + if (ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType())) { + msgContent = String.format(MeetingMsgTemplateConst.EXPERT_LEAVE_RANDOM, meeting.getName()); + } else { + msgContent = String.format(MeetingMsgTemplateConst.EXPERT_LEAVE_APPOINT, meeting.getName(), expert.getExpertName()); + } + UserInfo info = userInfoService.getById(userId); + SendSmsContext yxtContent = new SendSmsContext(); + yxtContent.setContent(msgContent); + yxtContent.setReceiveNumber(info.getMobile()); + yxtCallOrSmsHelper.sendSms(yxtContent); + // 发送工作通知 + if (info.getAccountId() != null) { + WorkNoticeInfo swn = getSendWorkNoticeInfo(info.getAccountId()); + swn.setMsg(msgContent); + workNoticeStagingService.addByWorkNotice(swn, MsgTypeEnum.REVIEW_MEETING); + Map map = new HashMap<>(2); + map.put("meetingId", meeting.getId()); + Notify notify = getNotify(userId, msgContent, MsgTypeEnum.REVIEW_MEETING, map); + notifyService.save(notify); + } + } + }