|
|
@ -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,16 +342,27 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void partyMeetingMessage(PartyMeetingMessageMQMsg formDTO) { |
|
|
|
//1.校验活动数据是否存在
|
|
|
|
IcPartyActEntity entity = baseDao.selectById(formDTO.getIcPartyActId()); |
|
|
|
if(null==entity){ |
|
|
|
String msg = "活动信息不存在,活动Id:" + formDTO.getIcPartyActId(); |
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg); |
|
|
|
//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.发布活动给居民端涉及党员已经工作端活动发布站推送党建活动消息
|
|
|
|
if("publish".equals(formDTO.getType())){ |
|
|
|
if ("publish".equals(formDTO.getType())) { |
|
|
|
//查询活动对应的发布范围信息
|
|
|
|
LambdaQueryWrapper<IcPartyActOrgEntity> orgWrapper = new LambdaQueryWrapper<>(); |
|
|
|
orgWrapper.eq(IcPartyActOrgEntity::getDelFlag, NumConstant.ZERO_STR); |
|
|
@ -360,19 +372,19 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
List<String> partyOrgIdList = list.stream().filter(ca -> !ca.getOrgType().equals("6")).map(m -> m.getJoinOrgId()).collect(Collectors.toList()); |
|
|
|
//分别查询党组织、党小组下的人
|
|
|
|
List<String> userIdList = new ArrayList<>(); |
|
|
|
if(!CollectionUtils.isEmpty(groupIdList)){ |
|
|
|
if (!CollectionUtils.isEmpty(groupIdList)) { |
|
|
|
Result<List<ResiGroupMemberDTO>> result = resiGroupOpenFeignClient.groupMemberList(groupIdList); |
|
|
|
if (!result.success()) { |
|
|
|
throw new RenException("调用common service查询secret失败"); |
|
|
|
} |
|
|
|
userIdList = result.getData().stream().map(ResiGroupMemberDTO::getCustomerUserId).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
if(!CollectionUtils.isEmpty(groupIdList)){ |
|
|
|
if (!CollectionUtils.isEmpty(groupIdList)) { |
|
|
|
//TODO
|
|
|
|
} |
|
|
|
|
|
|
|
//组装消息
|
|
|
|
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(), "党建小助手推送消息失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |