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