|
|
|
@ -364,6 +364,7 @@ public class EfcodeCpNoticeServiceImpl implements IEfcodeCpNoticeService { |
|
|
|
.like(EfcodeCpNotice::getBureauDeptName, sv) |
|
|
|
.or().like(EfcodeCpNotice::getEnterpriseName, sv) |
|
|
|
.or().like(EfcodeCpNotice::getEnforceContent, sv) |
|
|
|
.or().like(EfcodeCpNotice::getEnforceUserNames, sv) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@ -462,6 +463,75 @@ public class EfcodeCpNoticeServiceImpl implements IEfcodeCpNoticeService { |
|
|
|
return expiredList.size(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 明天到期的预告发送短信预警 |
|
|
|
* <p>仅查询过滤,不修改预告数据;短信由 ZwSmsClient 异步发送, |
|
|
|
* 单条失败仅记日志,不影响其余预告的发送。</p> |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public int notifyExpiryReminder() { |
|
|
|
// 发送前校验系统参数开关
|
|
|
|
if (!isSnsSendEnabled()) { |
|
|
|
log.info("系统参数[sns.send]未开启,跳过预告到期预警短信发送"); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
// 明天日期(enforce_date 为 yyyy-MM-dd 格式字符串)
|
|
|
|
String tomorrow = java.time.LocalDate.now().plusDays(1).toString(); |
|
|
|
|
|
|
|
// 查询已发布且执法日期为明天、未删除的预告
|
|
|
|
LambdaQueryWrapper<EfcodeCpNotice> lqw = Wrappers.lambdaQuery(); |
|
|
|
lqw.eq(EfcodeCpNotice::getStatus, 1L); |
|
|
|
lqw.eq(EfcodeCpNotice::getIsDelete, 0L); |
|
|
|
lqw.eq(EfcodeCpNotice::getEnforceDate, tomorrow); |
|
|
|
List<EfcodeCpNotice> noticeList = baseMapper.selectList(lqw); |
|
|
|
|
|
|
|
if (noticeList.isEmpty()) { |
|
|
|
log.info("[notifyTomorrowExpiringNotices] 无明天到期的预告需要预警,明天日期={}", tomorrow); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
log.info("[notifyTomorrowExpiringNotices] 找到{}条明天到期的预告,开始发送预警短信", noticeList.size()); |
|
|
|
|
|
|
|
int notifyCount = 0; |
|
|
|
for (EfcodeCpNotice notice : noticeList) { |
|
|
|
try { |
|
|
|
if (StringUtils.isBlank(notice.getContactPhone())) { |
|
|
|
log.info("[notifyTomorrowExpiringNotices] 预告[{}]无企业联系电话,跳过短信发送,企业={}", |
|
|
|
notice.getId(), notice.getEnterpriseName()); |
|
|
|
continue; |
|
|
|
} |
|
|
|
sendExpiryWarnSms(notice); |
|
|
|
notifyCount++; |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("[notifyTomorrowExpiringNotices] 预告[{}]预警短信发送异常:{}", |
|
|
|
notice.getId(), e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("[notifyTomorrowExpiringNotices] 预警短信分发完毕,共发送{}条预告", notifyCount); |
|
|
|
return notifyCount; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 异步发送预告到期预警短信,提醒企业联系人 |
|
|
|
*/ |
|
|
|
private void sendExpiryWarnSms(EfcodeCpNotice notice) { |
|
|
|
String enforceTimeText = switch (notice.getEnforceTime() == null ? 0 : notice.getEnforceTime().intValue()) { |
|
|
|
case 1 -> "上午"; |
|
|
|
case 2 -> "下午"; |
|
|
|
case 3 -> "其他"; |
|
|
|
default -> ""; |
|
|
|
}; |
|
|
|
String checkTime = notice.getEnforceDate() + (StringUtils.isBlank(enforceTimeText) ? "" : " " + enforceTimeText); |
|
|
|
String contactPerson = StringUtils.isNotBlank(notice.getContactPerson()) ? notice.getContactPerson() : ""; |
|
|
|
String content = |
|
|
|
"【深圳政务短信平台】尊敬的" + contactPerson + "(先生/女士),您好!您收到一则行政检查预告到期提醒。信息内容如下:" |
|
|
|
+ "企业名称:" + notice.getEnterpriseName() |
|
|
|
+ ";执法单位:" + notice.getBureauDeptName() |
|
|
|
+ ";检查时间:" + checkTime |
|
|
|
+ "。该预告将于明天到期执行,请提前做好相关准备,如需了解预告详情,请登录深政易,进入“执法监督码”查看,感谢您的理解!"; |
|
|
|
zwSmsClient.asyncSendSms("13560561199", content); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 修改预告消息已读状态 |
|
|
|
* |
|
|
|
|