|
@ -5,14 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.*; |
|
|
import com.epmet.commons.tools.constant.*; |
|
|
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.enums.ChannelEnum; |
|
|
import com.epmet.commons.tools.enums.ChannelEnum; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.constant.SmsTemplateConstant; |
|
|
import com.epmet.constant.SmsTemplateConstant; |
|
|
import com.epmet.constant.UserMessageTypeConstant; |
|
|
import com.epmet.constant.UserMessageTypeConstant; |
|
|
import com.epmet.dao.IcNoticeDao; |
|
|
import com.epmet.dao.IcNoticeDao; |
|
|
import com.epmet.dto.IcNoticeDTO; |
|
|
import com.epmet.dto.IcNoticeDTO; |
|
|
|
|
|
import com.epmet.dto.UserBaseInfoDTO; |
|
|
import com.epmet.dto.form.IcNoticeFormDTO; |
|
|
import com.epmet.dto.form.IcNoticeFormDTO; |
|
|
import com.epmet.dto.form.ProjectSendMsgFormDTO; |
|
|
import com.epmet.dto.form.ProjectSendMsgFormDTO; |
|
|
import com.epmet.dto.form.SendNoticeFormDTO; |
|
|
import com.epmet.dto.form.SendNoticeFormDTO; |
|
@ -20,6 +23,7 @@ import com.epmet.dto.form.UserMessageFormDTO; |
|
|
import com.epmet.entity.IcNoticeEntity; |
|
|
import com.epmet.entity.IcNoticeEntity; |
|
|
import com.epmet.feign.MessageFeignClient; |
|
|
import com.epmet.feign.MessageFeignClient; |
|
|
import com.epmet.service.IcNoticeService; |
|
|
import com.epmet.service.IcNoticeService; |
|
|
|
|
|
import com.epmet.service.UserBaseInfoService; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
@ -44,6 +48,8 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private MessageFeignClient messageFeignClient; |
|
|
private MessageFeignClient messageFeignClient; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private UserBaseInfoService userBaseInfoService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<IcNoticeDTO> page(IcNoticeFormDTO formDTO) { |
|
|
public PageData<IcNoticeDTO> page(IcNoticeFormDTO formDTO) { |
|
@ -123,8 +129,14 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public void sendNotice(SendNoticeFormDTO formDTO) { |
|
|
public void sendNotice(SendNoticeFormDTO formDTO) { |
|
|
|
|
|
String orgName = ""; |
|
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|
|
|
|
|
if (null != staffInfo) { |
|
|
|
|
|
orgName = staffInfo.getAgencyName(); |
|
|
|
|
|
} |
|
|
//保存消息
|
|
|
//保存消息
|
|
|
String channel = StringUtils.join(formDTO.getChannel(), StrConstant.COMMA); |
|
|
String channel = StringUtils.join(formDTO.getChannel(), StrConstant.COMMA); |
|
|
|
|
|
String finalOrgName = orgName; |
|
|
List<IcNoticeEntity> entityList = formDTO.getUserList().stream().map(item -> { |
|
|
List<IcNoticeEntity> entityList = formDTO.getUserList().stream().map(item -> { |
|
|
IcNoticeEntity entity = new IcNoticeEntity(); |
|
|
IcNoticeEntity entity = new IcNoticeEntity(); |
|
|
entity.setCustomerId(formDTO.getCustomerId()); |
|
|
entity.setCustomerId(formDTO.getCustomerId()); |
|
@ -134,7 +146,7 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn |
|
|
entity.setUserId(item.getUserId()); |
|
|
entity.setUserId(item.getUserId()); |
|
|
entity.setMobile(item.getMobile()); |
|
|
entity.setMobile(item.getMobile()); |
|
|
entity.setIdCard(item.getIdCard()); |
|
|
entity.setIdCard(item.getIdCard()); |
|
|
entity.setOrgName(formDTO.getOrgName()); |
|
|
entity.setOrgName(finalOrgName); |
|
|
return entity; |
|
|
return entity; |
|
|
}).collect(Collectors.toList()); |
|
|
}).collect(Collectors.toList()); |
|
|
insertBatch(entityList); |
|
|
insertBatch(entityList); |
|
@ -145,18 +157,24 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn |
|
|
List<ProjectSendMsgFormDTO> smsList = new ArrayList<>(); |
|
|
List<ProjectSendMsgFormDTO> smsList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
entityList.forEach(item -> { |
|
|
entityList.forEach(item -> { |
|
|
if (StringUtils.isNotBlank(item.getUserId())) { |
|
|
if (StringUtils.isNotBlank(item.getIdCard())) { |
|
|
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); |
|
|
//根据身份证获取居民ID
|
|
|
messageFormDTO.setCustomerId(item.getCustomerId()); |
|
|
List<UserBaseInfoDTO> userList = userBaseInfoService.getCommonIdNumUser(item.getCustomerId(), item.getIdCard()); |
|
|
messageFormDTO.setApp(AppClientConstant.APP_GOV); |
|
|
if (CollectionUtils.isNotEmpty(userList)) { |
|
|
messageFormDTO.setGridId(StrConstant.STAR); |
|
|
userList.forEach(user -> { |
|
|
messageFormDTO.setUserId(item.getUserId()); |
|
|
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); |
|
|
messageFormDTO.setTitle("您有一条通知消息!"); |
|
|
messageFormDTO.setCustomerId(item.getCustomerId()); |
|
|
messageFormDTO.setMessageContent(item.getContent()); |
|
|
messageFormDTO.setApp(AppClientConstant.APP_GOV); |
|
|
messageFormDTO.setReadFlag(Constant.UNREAD); |
|
|
messageFormDTO.setGridId(StrConstant.STAR); |
|
|
messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC); |
|
|
messageFormDTO.setUserId(user.getUserId()); |
|
|
messageFormDTO.setTargetId(item.getId()); |
|
|
messageFormDTO.setTitle("您有一条通知消息!"); |
|
|
msgList.add(messageFormDTO); |
|
|
messageFormDTO.setMessageContent(item.getContent()); |
|
|
|
|
|
messageFormDTO.setReadFlag(Constant.UNREAD); |
|
|
|
|
|
messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC); |
|
|
|
|
|
messageFormDTO.setTargetId(item.getId()); |
|
|
|
|
|
msgList.add(messageFormDTO); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
//TODO 短信消息
|
|
|
//TODO 短信消息
|
|
|
if (StringUtils.isNotBlank(item.getMobile())) { |
|
|
if (StringUtils.isNotBlank(item.getMobile())) { |
|
|