|
|
@ -25,6 +25,7 @@ import com.epmet.commons.tools.utils.SpringContextUtils; |
|
|
|
import com.epmet.modules.partyOrg.dao.*; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcPartyActEntity; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcScheduleEntity; |
|
|
|
import com.epmet.modules.partyOrg.entity.ResiPartymemberAttachmentEntity; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyActOrgService; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyActService; |
|
|
@ -341,12 +342,23 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void partyMeetingMessage(PartyMeetingMessageMQMsg formDTO) { |
|
|
|
//1.校验活动数据是否存在
|
|
|
|
IcPartyActEntity entity = baseDao.selectById(formDTO.getIcPartyActId()); |
|
|
|
//1.校验活动/日程数据是否存在
|
|
|
|
IcPartyActEntity entity = null; |
|
|
|
IcScheduleEntity schedule = null; |
|
|
|
if (!"notify".equals(formDTO.getType())) { |
|
|
|
entity = baseDao.selectById(formDTO.getIcPartyActId()); |
|
|
|
if (null == entity) { |
|
|
|
String msg = "活动信息不存在,活动Id:" + formDTO.getIcPartyActId(); |
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg); |
|
|
|
} |
|
|
|
} else { |
|
|
|
schedule = scheduleDao.selectById(formDTO.getIcPartyActId()); |
|
|
|
if (null == schedule) { |
|
|
|
String msg = "日程信息不存在,活动Id:" + formDTO.getIcPartyActId(); |
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<UserMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
//2.根据不同类型消息触发不同处理逻辑
|
|
|
|
//2-1.发布活动给居民端涉及党员已经工作端活动发布站推送党建活动消息
|
|
|
@ -372,7 +384,7 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
} |
|
|
|
|
|
|
|
//组装消息
|
|
|
|
userIdList.forEach(id->{ |
|
|
|
for (String id : userIdList){ |
|
|
|
UserMessageFormDTO msg = new UserMessageFormDTO(); |
|
|
|
msg.setCustomerId(formDTO.getCustomerId()); |
|
|
|
msg.setApp(AppClientConstant.APP_RESI); |
|
|
@ -385,7 +397,7 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
msg.setTargetId(formDTO.getIcPartyActId()); |
|
|
|
msg.setUserId(id); |
|
|
|
msgList.add(msg); |
|
|
|
}); |
|
|
|
} |
|
|
|
//工作人员
|
|
|
|
UserMessageFormDTO msg = new UserMessageFormDTO(); |
|
|
|
msg.setCustomerId(formDTO.getCustomerId()); |
|
|
@ -400,10 +412,42 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
msg.setUserId(entity.getPublishStaffId()); |
|
|
|
msgList.add(msg); |
|
|
|
} |
|
|
|
//2-2.活动开始前三天给工作人员推送提醒类消息
|
|
|
|
if ("remind".equals(formDTO.getType())) { |
|
|
|
UserMessageFormDTO msg = new UserMessageFormDTO(); |
|
|
|
msg.setCustomerId(formDTO.getCustomerId()); |
|
|
|
msg.setApp(AppClientConstant.APP_GOV); |
|
|
|
msg.setTitle("您有一个活动3天后即将自动发布"); |
|
|
|
msg.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
StringBuffer str = new StringBuffer(); |
|
|
|
str.append("主题:").append(entity.getTopic()).append("\n").append("时间:").append(entity.getHoldTime()).append("\n").append("地点:").append(entity.getAddress()); |
|
|
|
msg.setMessageContent(str.toString()); |
|
|
|
msg.setMessageType("party"); |
|
|
|
msg.setTargetId(formDTO.getIcPartyActId()); |
|
|
|
msg.setUserId(entity.getPublishStaffId()); |
|
|
|
msgList.add(msg); |
|
|
|
} |
|
|
|
//2-2.给工作人员推送日程消息
|
|
|
|
if ("remind".equals(formDTO.getType())) { |
|
|
|
UserMessageFormDTO msg = new UserMessageFormDTO(); |
|
|
|
msg.setCustomerId(formDTO.getCustomerId()); |
|
|
|
msg.setApp(AppClientConstant.APP_GOV); |
|
|
|
msg.setTitle("您有一个日程提醒"); |
|
|
|
msg.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
StringBuffer str = new StringBuffer(); |
|
|
|
str.append("日程:").append(schedule.getTitle()).append("\n").append("时间:").append(schedule.getRemindTime()); |
|
|
|
msg.setMessageContent(str.toString()); |
|
|
|
msg.setMessageType("party"); |
|
|
|
msg.setTargetId(formDTO.getIcPartyActId()); |
|
|
|
msg.setUserId(schedule.getStaffId()); |
|
|
|
msgList.add(msg); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//推送消息
|
|
|
|
//3.推送消息
|
|
|
|
Result sendMessageRes = messageOpenFeignClient.saveIcMessageList(msgList); |
|
|
|
if (!sendMessageRes.success()) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "党建小助手推送消息失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |