|
|
@@ -10,6 +10,7 @@ import com.xunmei.common.core.constant.HttpStatus;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.domain.reminder.dto.ReminderScheduleMsgDto;
|
|
|
import com.xunmei.common.core.domain.reminder.vo.ReminderScheduleMsgVo;
|
|
|
+import com.xunmei.common.core.domain.sms.domain.SmsSendRecord;
|
|
|
import com.xunmei.common.core.web.domain.AjaxResult;
|
|
|
import com.xunmei.sms.utils.SmsUtil;
|
|
|
import com.xunmei.system.api.RemoteOrgService;
|
|
|
@@ -40,6 +41,9 @@ public class SmsService implements ISmsService {
|
|
|
@Autowired
|
|
|
private RemoteOrgService remoteOrgService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISmsSendRecordService recordService;
|
|
|
+
|
|
|
//告警代码
|
|
|
private static final String ALARM_CODE="854002";
|
|
|
//逾期提醒代码
|
|
|
@@ -113,6 +117,7 @@ public class SmsService implements ISmsService {
|
|
|
String date = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
String time = DateUtil.format(now, "HH:mm:ss");
|
|
|
if (ObjectUtil.isNotEmpty(userList)){
|
|
|
+ List<SmsSendRecord> records = new ArrayList<>();
|
|
|
for (SysUser sysUser : userList) {
|
|
|
String phone = sysUser.getPhone();
|
|
|
SmsInfoVo smsInfoVo = new SmsInfoVo();
|
|
|
@@ -129,8 +134,10 @@ public class SmsService implements ISmsService {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- getResult(rspData);
|
|
|
+ AjaxResult result = getResult(rspData);
|
|
|
+ records.add(recordService.saveSmsRecord(sysOrg,sysUser,result,smsInfoVo));
|
|
|
}
|
|
|
+ recordService.batchSave(records);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -144,6 +151,7 @@ public class SmsService implements ISmsService {
|
|
|
String day = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
String sfm = DateUtil.format(now, "HH:mm:ss");
|
|
|
if (ObjectUtil.isNotEmpty(userList)){
|
|
|
+ List<SmsSendRecord> records = new ArrayList<>();
|
|
|
for (SysUser sysUser : userList) {
|
|
|
String phone = sysUser.getPhone();
|
|
|
SmsInfoVo smsInfoVo = new SmsInfoVo();
|
|
|
@@ -154,15 +162,18 @@ public class SmsService implements ISmsService {
|
|
|
smsInfoVo.setOccurTime(sfm);
|
|
|
smsInfoVo.setBak3("任务【"+ content + "】未完成,将于"+date+"逾期。");
|
|
|
CompositeData smsCompositeData = SmsUtil.createSmsBody(smsInfoVo,systemCode,systemName,serviceCode,serviceScene);
|
|
|
- CompositeData rspData = null;//result_description
|
|
|
+ CompositeData rspData = null;
|
|
|
try {
|
|
|
rspData = ESBClient.request(smsCompositeData);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- getResult(rspData);
|
|
|
+ AjaxResult result = getResult(rspData);
|
|
|
+ records.add(recordService.saveSmsRecord(sysOrg,sysUser,result,smsInfoVo));
|
|
|
}
|
|
|
+ recordService.batchSave(records);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -171,6 +182,7 @@ public class SmsService implements ISmsService {
|
|
|
String date = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
String time = DateUtil.format(now, "HH:mm:ss");
|
|
|
List<ReminderScheduleMsgVo> returnData = new ArrayList<>();
|
|
|
+ List<SmsSendRecord> records = new ArrayList<>();
|
|
|
for (ReminderScheduleMsgDto dto : msgDto) {
|
|
|
SmsInfoVo smsInfoVo = new SmsInfoVo();
|
|
|
smsInfoVo.setBelongBranchId(dto.getOrgGuid());
|
|
|
@@ -184,7 +196,7 @@ public class SmsService implements ISmsService {
|
|
|
try {
|
|
|
rspData = ESBClient.request(smsCompositeData);
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ logger.error("短信发送时发生异常 :",e);
|
|
|
}
|
|
|
AjaxResult result = getResult(rspData);
|
|
|
if (result.get(AjaxResult.CODE_TAG).equals(String.valueOf(HttpStatus.ERROR))){
|
|
|
@@ -195,6 +207,7 @@ public class SmsService implements ISmsService {
|
|
|
msgVo.setScheduleId(dto.getScheduleId());
|
|
|
returnData.add(msgVo);
|
|
|
}
|
|
|
+ records.add(recordService.saveSmsRecord(dto,result,smsInfoVo));
|
|
|
}
|
|
|
return returnData;
|
|
|
}
|