|
@@ -19,6 +19,7 @@ import com.xunmei.system.api.domain.SysOrg;
|
|
|
import com.xunmei.system.api.domain.SysUser;
|
|
import com.xunmei.system.api.domain.SysUser;
|
|
|
import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
|
|
import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
|
|
|
import com.xunmei.system.api.vo.SmsInfoVo;
|
|
import com.xunmei.system.api.vo.SmsInfoVo;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -31,6 +32,7 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
|
|
+@Slf4j
|
|
|
public class SmsService implements ISmsService {
|
|
public class SmsService implements ISmsService {
|
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(SmsService.class);
|
|
private static Logger logger = LoggerFactory.getLogger(SmsService.class);
|
|
@@ -117,9 +119,11 @@ public class SmsService implements ISmsService {
|
|
|
String date = DateUtil.format(now, "yyyy-MM-dd");
|
|
String date = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
String time = DateUtil.format(now, "HH:mm:ss");
|
|
String time = DateUtil.format(now, "HH:mm:ss");
|
|
|
if (ObjectUtil.isNotEmpty(userList)){
|
|
if (ObjectUtil.isNotEmpty(userList)){
|
|
|
- List<SmsSendRecord> records = new ArrayList<>();
|
|
|
|
|
for (SysUser sysUser : userList) {
|
|
for (SysUser sysUser : userList) {
|
|
|
String phone = sysUser.getPhone();
|
|
String phone = sysUser.getPhone();
|
|
|
|
|
+ if (ObjectUtil.isEmpty(phone)){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
SmsInfoVo smsInfoVo = new SmsInfoVo();
|
|
SmsInfoVo smsInfoVo = new SmsInfoVo();
|
|
|
smsInfoVo.setBelongBranchId(sysOrg.getGuid());
|
|
smsInfoVo.setBelongBranchId(sysOrg.getGuid());
|
|
|
smsInfoVo.setTranType(ALARM_CODE);
|
|
smsInfoVo.setTranType(ALARM_CODE);
|
|
@@ -133,12 +137,11 @@ public class SmsService implements ISmsService {
|
|
|
try {
|
|
try {
|
|
|
rspData = ESBClient.request(smsCompositeData);
|
|
rspData = ESBClient.request(smsCompositeData);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ logger.error("短信发送时发生异常 :",e);
|
|
|
}
|
|
}
|
|
|
AjaxResult result = getResult(rspData);
|
|
AjaxResult result = getResult(rspData);
|
|
|
- records.add(recordService.saveSmsRecord(sysOrg,sysUser,result,smsInfoVo));
|
|
|
|
|
|
|
+ recordService.saveSmsRecord(sysOrg, sysUser, result, smsInfoVo);
|
|
|
}
|
|
}
|
|
|
- recordService.batchSave(records);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -155,6 +158,9 @@ public class SmsService implements ISmsService {
|
|
|
List<SmsSendRecord> records = new ArrayList<>();
|
|
List<SmsSendRecord> records = new ArrayList<>();
|
|
|
for (SysUser sysUser : userList) {
|
|
for (SysUser sysUser : userList) {
|
|
|
String phone = sysUser.getPhone();
|
|
String phone = sysUser.getPhone();
|
|
|
|
|
+ if (ObjectUtil.isEmpty(phone)){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
SmsInfoVo smsInfoVo = new SmsInfoVo();
|
|
SmsInfoVo smsInfoVo = new SmsInfoVo();
|
|
|
smsInfoVo.setBelongBranchId(sysOrg.getGuid());
|
|
smsInfoVo.setBelongBranchId(sysOrg.getGuid());
|
|
|
smsInfoVo.setTranType(TODO_CODE);
|
|
smsInfoVo.setTranType(TODO_CODE);
|
|
@@ -168,12 +174,11 @@ public class SmsService implements ISmsService {
|
|
|
try {
|
|
try {
|
|
|
rspData = ESBClient.request(smsCompositeData);
|
|
rspData = ESBClient.request(smsCompositeData);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ logger.error("短信发送时发生异常 :",e);
|
|
|
}
|
|
}
|
|
|
AjaxResult result = getResult(rspData);
|
|
AjaxResult result = getResult(rspData);
|
|
|
- records.add(recordService.saveSmsRecord(sysOrg,sysUser,result,smsInfoVo));
|
|
|
|
|
|
|
+ recordService.saveSmsRecord(sysOrg,sysUser,result,smsInfoVo);
|
|
|
}
|
|
}
|
|
|
- recordService.batchSave(records);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -184,8 +189,10 @@ public class SmsService implements ISmsService {
|
|
|
String date = DateUtil.format(now, "yyyy-MM-dd");
|
|
String date = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
String time = DateUtil.format(now, "HH:mm:ss");
|
|
String time = DateUtil.format(now, "HH:mm:ss");
|
|
|
List<ReminderScheduleMsgVo> returnData = new ArrayList<>();
|
|
List<ReminderScheduleMsgVo> returnData = new ArrayList<>();
|
|
|
- List<SmsSendRecord> records = new ArrayList<>();
|
|
|
|
|
for (ReminderScheduleMsgDto dto : msgDto) {
|
|
for (ReminderScheduleMsgDto dto : msgDto) {
|
|
|
|
|
+ if (ObjectUtil.isEmpty(dto.getPhone())){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
SmsInfoVo smsInfoVo = new SmsInfoVo();
|
|
SmsInfoVo smsInfoVo = new SmsInfoVo();
|
|
|
smsInfoVo.setBelongBranchId(dto.getOrgGuid());
|
|
smsInfoVo.setBelongBranchId(dto.getOrgGuid());
|
|
|
smsInfoVo.setTranType(TODO_CODE);
|
|
smsInfoVo.setTranType(TODO_CODE);
|
|
@@ -210,7 +217,7 @@ public class SmsService implements ISmsService {
|
|
|
msgVo.setScheduleId(dto.getScheduleId());
|
|
msgVo.setScheduleId(dto.getScheduleId());
|
|
|
returnData.add(msgVo);
|
|
returnData.add(msgVo);
|
|
|
}
|
|
}
|
|
|
- records.add(recordService.saveSmsRecord(dto,result,smsInfoVo));
|
|
|
|
|
|
|
+ recordService.saveSmsRecord(dto,result,smsInfoVo);
|
|
|
}
|
|
}
|
|
|
return returnData;
|
|
return returnData;
|
|
|
}
|
|
}
|