diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/MsgCallHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/MsgCallHelper.java index cb577ae..a982b88 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/MsgCallHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/MsgCallHelper.java @@ -97,6 +97,7 @@ public class MsgCallHelper { if (SendStatus.SUCCESS.equals(mcr.getSendStatus())) { switch (bizType) { case EXPERT_INVITE: + case MEETING_ROSTER_CONFIRM: mcr.setNeedReply(Boolean.TRUE); mcr.setReplyStatus(ReplyStatus.WAITING); break; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpert.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpert.java index de74edb..5e26628 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpert.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpert.java @@ -92,4 +92,7 @@ public class MeetingExpert implements Serializable { @ApiModelProperty("专家签到地点") private String signAddress; + @ApiModelProperty("确认名单短信通知标识") + private String confirmedRosterMsgSubmitKey; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteExpertListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteExpertListItemVO.java index 3458121..1f7ded1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteExpertListItemVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteExpertListItemVO.java @@ -62,6 +62,10 @@ public class InviteExpertListItemVO extends ExpertBasicInfoVO { @ApiModelProperty("专家签到地点") private String signAddress; + @ApiModelProperty("是否已确认名单") + private Boolean confirmedRoster; + @ApiModelProperty("确认名单短信回复内容") + private String confirmedRosterReplyContent; } \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingNotifyHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingNotifyHelper.java index 86eaa13..af35e06 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingNotifyHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingNotifyHelper.java @@ -27,6 +27,7 @@ import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.service.IUserInfoService; import com.ningdatech.basic.util.CollUtils; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -43,6 +44,7 @@ import java.util.*; * @author WendyYang * @since 2023/4/20 **/ +@Slf4j @Component @RequiredArgsConstructor public class MeetingNotifyHelper { @@ -135,7 +137,12 @@ public class MeetingNotifyHelper { w.getExpertName(), officialTime(w.getCreateOn()), meetingTime, meeting.getMeetingAddress(), meeting.getConnecter(), meeting.getContact()); // 音信通消息 - msgCallHelper.sendMsg(w.getMobile(), msgContent, BizTypeEnum.MEETING_ROSTER_CONFIRM); + try { + String submitKey = msgCallHelper.sendMsg(w.getMobile(), msgContent, BizTypeEnum.MEETING_ROSTER_CONFIRM); + w.setConfirmedRosterMsgSubmitKey(submitKey); + } catch (Exception e) { + log.error("确认名单失败:{}", w.getMobile(), e); + } UserInfo info = userMap.get(w.getExpertId()); // 发送工作通知 if (info.getAccountId() != null) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java index 869e5c0..069f8298 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java @@ -49,6 +49,9 @@ import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.model.entity.MsgCallRecord; +import com.hz.pm.api.sys.model.enumeration.SubmitTypeEnum; +import com.hz.pm.api.sys.service.IMsgCallRecordService; import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.RoleEnum; @@ -112,6 +115,7 @@ public class MeetingManage { private final EnvironmentUtil environmentUtil; private final MhUnitCache mhUnitCache; private final ProjectStateMachineUtil projectStateMachineUtil; + private final IMsgCallRecordService msgCallRecordService; private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:"; @@ -543,12 +547,31 @@ public class MeetingManage { if (experts.isEmpty()) { return result; } - List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); + List confirmedRosterSubmitKeys = new ArrayList<>(); + List expertIds = CollUtils.fieldList(experts, w -> { + if (StrUtil.isNotBlank(w.getConfirmedRosterMsgSubmitKey())) { + confirmedRosterSubmitKeys.add(w.getConfirmedRosterMsgSubmitKey()); + } + return w.getExpertId(); + }); + Map confirmedRosterReplyMap = new HashMap<>(); + if (!confirmedRosterSubmitKeys.isEmpty()) { + Wrapper query = Wrappers.lambdaQuery(MsgCallRecord.class) + .select(MsgCallRecord::getSubmitKey, MsgCallRecord::getReplyContent) + .eq(MsgCallRecord::getSubmitType, SubmitTypeEnum.SMS) + .in(MsgCallRecord::getSubmitKey, confirmedRosterSubmitKeys); + List msgCallRecords = msgCallRecordService.list(query); + for (MsgCallRecord msgCallRecord : msgCallRecords) { + confirmedRosterReplyMap.put(msgCallRecord.getSubmitKey(), msgCallRecord.getReplyContent()); + } + } Map expertMap = meetingManageHelper.getExpertBasicInfo(expertIds); BiFunction, InviteExpertListItemVO> mapping = (me, ruleMap) -> { ExpertBasicInfoVO expert = expertMap.get(me.getExpertId()); InviteExpertListItemVO item = BeanUtil.copyProperties(expert, InviteExpertListItemVO.class); item.setExpertMeetingId(me.getId()); + item.setConfirmedRoster(me.getConfirmedRoster()); + item.setConfirmedRosterReplyContent(confirmedRosterReplyMap.get(me.getConfirmedRosterMsgSubmitKey())); item.setMeetingId(me.getMeetingId()); item.setStatus(me.getStatus()); item.setStatusName(ExpertAttendStatusEnum.getValByCode(me.getStatus())); @@ -910,13 +933,21 @@ public class MeetingManage { return; } List currConfirmedMeIds = CollUtils.fieldList(expertNoticing, MeetingExpert::getId); - Wrapper meUpdate = Wrappers.lambdaUpdate(MeetingExpert.class) - .in(MeetingExpert::getId, currConfirmedMeIds) + LambdaUpdateWrapper meUpdate = Wrappers.lambdaUpdate(MeetingExpert.class) .set(MeetingExpert::getConfirmedRoster, Boolean.TRUE); - meetingExpertService.update(meUpdate); if (environmentUtil.isProdEnv()) { meetingNotifyHelper.sendConfirmedRosterMsg(expertNoticing, meeting); + for (MeetingExpert expert : expertNoticing) { + if (StrUtil.isBlank(expert.getConfirmedRosterMsgSubmitKey())) { + currConfirmedMeIds.remove(expert.getId()); + } + } + if (currConfirmedMeIds.isEmpty()) { + throw ReturnException.wrap("参会通知短信发送失败,请重试!"); + } } + meUpdate.in(MeetingExpert::getId, currConfirmedMeIds); + meetingExpertService.update(meUpdate); } finally { distributedLock.releaseLock(key); }