diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/PoliceWeChatMessage.java b/mailbox-lan/src/main/java/com/biutag/lan/service/PoliceWeChatMessage.java index 3f2fef1..7797332 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/PoliceWeChatMessage.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/PoliceWeChatMessage.java @@ -40,6 +40,27 @@ public class PoliceWeChatMessage { List policeUsers = policeUserMapper.selectList(new LambdaQueryWrapper() .eq(PoliceUser::getRoleIds, roleId) .eq(PoliceUser::getDataDeptId, deptId)); + List dutys = dataScreenMapper.getToFjDuty(null, deptId); + try { + dutys.stream().filter(item -> PhoneUtil.isPhone(item.getMobile())) + .forEach(item -> { + SmsSend smsSend = new SmsSend().setPhone(item.getMobile()) + .setContent(content) + .setSuccess(false).setCreateTime(LocalDateTime.now()); + smsSendMapper.insert(smsSend); + Notice notice = new Notice() + .setContent(content) + .setRoleId(roleId) + .setDeptId(deptId) + .setEmpNo(item.getEmpNo()) + .setCreateTime(LocalDateTime.now()) + .setReadFlag(AppConstants.N) + .setType(NoticeType.sms.name()); + noticeMapper.insert(notice); + }); + } catch (Exception e) { + log.error(e.getMessage(), e); + } policeUsers.stream() .filter(item -> IdcardUtil.isValidCard(item.getIdCode())).forEach(item -> { log.info("通过警务微信给[{}],发送:{}", item.getIdCode(), content); @@ -55,23 +76,7 @@ public class PoliceWeChatMessage { noticeMapper.insert(notice); }); - List dutys = dataScreenMapper.getToFjDuty(null, deptId); - dutys.stream().filter(item -> PhoneUtil.isPhone(item.getMobile())) - .forEach(item -> { - SmsSend smsSend = new SmsSend().setPhone(item.getMobile()) - .setContent(content) - .setSuccess(false).setCreateTime(LocalDateTime.now()); - smsSendMapper.insert(smsSend); - Notice notice = new Notice() - .setContent(content) - .setRoleId(roleId) - .setDeptId(deptId) - .setEmpNo(item.getEmpNo()) - .setCreateTime(LocalDateTime.now()) - .setReadFlag(AppConstants.N) - .setType(NoticeType.sms.name()); - noticeMapper.insert(notice); - }); + }