短信批量发送修改

This commit is contained in:
hongchao 2025-09-24 21:32:41 +08:00
parent 552e3ff7d0
commit b06a0be9a3
1 changed files with 14 additions and 11 deletions

View File

@ -70,7 +70,7 @@ public class ScheduledCheckWarning {
*/
private String getCronFromDatabase() {
// 这里假设从数据库中获取 cron 表达式
//return "0 */1 * * * ?";
// return "0 0/1 * * * ?";
return "0 0 9 ? * WED,FRI";
}
@ -98,23 +98,26 @@ public class ScheduledCheckWarning {
String content = "截止当天" + bean.getProjectName() +""+ bean.getTypeName() +"" +bean.getWarnNum() + "件工器具已临检检验有效期30天请尽快退回机具物流分公司复检明细请登录机具管理系统查看";
// 省公司短信发送
List<String> mobileList = new ArrayList();
List<SmsParam> mobileList = new ArrayList<>();
List<UseMaintenanceWarningBean> userList = mapper.getUserList(bean);
if(userList !=null && userList.size()>0){
for (UseMaintenanceWarningBean item : userList){
UseMaintenanceWarningBean item1 = mapper.getUserPhoneById(item);
if(item1.getClzPhone() != null){
mobileList.add(item1.getClzPhone());
if(StringUtils.isNotBlank(item1.getClzPhone())){
mobileList.add(new SmsParam(item1.getClzPhone(), content));
}
}
}
mobileList.add(leaderPhone);
mobileList.add(engPhone);
if(StringUtils.isNotBlank(leaderPhone)){
mobileList.add(new SmsParam(leaderPhone, content));
}
if(StringUtils.isNotBlank(engPhone)){
mobileList.add(new SmsParam(engPhone, content));
}
System.out.println("短信发送成功: " + mobileList);
if (CollectionUtils.isNotEmpty(mobileList)){
JSONObject sendResult = SmsTool.sendSms(new BatchSmsByContentParam(mobileList, content), BmConfigItems.ANHUI_COMPANY_SMS_KEY);
JSONObject sendResult = SmsTool.sendSms(mobileList, BmConfigItems.ANHUI_COMPANY_SMS_KEY);
if (sendResult != null && !sendResult.isEmpty()) {
log.info("短信发送成功: {}", sendResult);
System.out.println("短信发送成功: " + sendResult);
@ -138,20 +141,20 @@ public class ScheduledCheckWarning {
String content2 = "截止当天" + bean2.getProjectName() +","+ bean2.getTypeName() +""+ bean2.getWarnNum() + "件工器具已临检检验有效期15天请尽快退回机具物流分公司复检明细请登录机具管理系统查看";
// 省公司短信发送
List<String> mobileList2 = new ArrayList();
List<SmsParam> mobileList2 = new ArrayList<>();
List<UseMaintenanceWarningBean> userManger = mapper.getUserManger(bean2);
if(userManger !=null && userManger.size()>0){
for (UseMaintenanceWarningBean item : userManger){
UseMaintenanceWarningBean item1 = mapper.getUserPhoneById(item);
if(item1.getClzPhone() != null){
mobileList2.add(item1.getClzPhone());
mobileList2.add(new SmsParam(item1.getClzPhone(), content2));
}
}
}
System.out.println("短信发送成功: " + mobileList2);
if (CollectionUtils.isNotEmpty(mobileList2)){
JSONObject sendResult = SmsTool.sendSms(new BatchSmsByContentParam(mobileList2, content2), BmConfigItems.ANHUI_COMPANY_SMS_KEY);
JSONObject sendResult = SmsTool.sendSms(mobileList2, BmConfigItems.ANHUI_COMPANY_SMS_KEY);
if (sendResult != null && !sendResult.isEmpty()) {
log.info("短信发送成功: {}", sendResult);
System.out.println("短信发送成功: " + sendResult);