短信回调修改
This commit is contained in:
parent
ca15928e97
commit
b719ff5c76
@ -34,6 +34,8 @@ public class SendTextMessageController {
|
|||||||
private SendTextMessageService sendTextMessageService;
|
private SendTextMessageService sendTextMessageService;
|
||||||
@Resource
|
@Resource
|
||||||
private ShortMessageSendRecordMapper shortMessageSendRecordMapper;
|
private ShortMessageSendRecordMapper shortMessageSendRecordMapper;
|
||||||
|
@Resource
|
||||||
|
private SendTextMessageTask sendTextMessageTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手动执行短信发送定时任务
|
* 手动执行短信发送定时任务
|
||||||
@ -51,10 +53,15 @@ public class SendTextMessageController {
|
|||||||
return retObj;
|
return retObj;
|
||||||
}
|
}
|
||||||
List<ShortMessageSendRecord> shortMessageSendRecords = new ArrayList<>();
|
List<ShortMessageSendRecord> shortMessageSendRecords = new ArrayList<>();
|
||||||
JSONObject jsonObject = sendTextMessageService.taskTextMessageSendBack(data, shortMessageSendRecords);
|
JSONObject jsonObject = sendTextMessageService.taskTextMessageSendBack(data, shortMessageSendRecords, null);
|
||||||
if (CollectionUtils.isNotEmpty(shortMessageSendRecords)) {
|
if (CollectionUtils.isNotEmpty(shortMessageSendRecords)) {
|
||||||
shortMessageSendRecordMapper.insertShortMessageSendRecords(shortMessageSendRecords);
|
shortMessageSendRecordMapper.insertShortMessageSendRecords(shortMessageSendRecords);
|
||||||
}
|
}
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/aa")
|
||||||
|
public void aa() {
|
||||||
|
sendTextMessageTask.smsReportBack();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public interface SendTextMessageService {
|
|||||||
* @param data 任务单通电话回调传输data
|
* @param data 任务单通电话回调传输data
|
||||||
* @return JSONObject
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
JSONObject taskTextMessageSendBack(SmsReport data, List<ShortMessageSendRecord> shortMessageSendRecords);
|
JSONObject taskTextMessageSendBack(SmsReport data, List<ShortMessageSendRecord> shortMessageSendRecords, List<Integer> ids);
|
||||||
|
|
||||||
Integer updateReadState(Integer readState, List<Integer> ids);
|
Integer updateReadState(Integer readState, List<Integer> ids);
|
||||||
|
|
||||||
|
|||||||
@ -227,7 +227,7 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
|
|||||||
public List<TaskMessageBackEntity> taskMessageBack(TaskMessageBackEntity taskMessageBackEntity) {
|
public List<TaskMessageBackEntity> taskMessageBack(TaskMessageBackEntity taskMessageBackEntity) {
|
||||||
// 接口获取外呼回调数据app
|
// 接口获取外呼回调数据app
|
||||||
List<TaskMessageBackEntity> taskMessageBackEntityList = new ArrayList<>();
|
List<TaskMessageBackEntity> taskMessageBackEntityList = new ArrayList<>();
|
||||||
HttpEntity<JSONObject> requestEntity = new HttpEntity<>((JSONObject) JSON.toJSON(taskMessageBackEntityList));
|
HttpEntity<JSONObject> requestEntity = new HttpEntity<>((JSONObject) JSON.toJSON(taskMessageBackEntity));
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
ResponseEntity<String> responseEntity = restTemplate.exchange(callBackUrl + "/getMessageBackList", HttpMethod.POST, requestEntity, String.class);
|
ResponseEntity<String> responseEntity = restTemplate.exchange(callBackUrl + "/getMessageBackList", HttpMethod.POST, requestEntity, String.class);
|
||||||
JSONObject object = JSON.parseObject(responseEntity.getBody());
|
JSONObject object = JSON.parseObject(responseEntity.getBody());
|
||||||
@ -244,11 +244,11 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject taskTextMessageSendBack(SmsReport data, List<ShortMessageSendRecord> shortMessageSendRecords) {
|
public JSONObject taskTextMessageSendBack(SmsReport data, List<ShortMessageSendRecord> shortMessageSendRecords, List<Integer> ids) {
|
||||||
JSONObject retObj = new JSONObject();
|
JSONObject retObj = new JSONObject();
|
||||||
retObj.fluentPut("code", 0).fluentPut("msg", "成功");
|
retObj.fluentPut("code", 0).fluentPut("msg", "成功");
|
||||||
SignPatientManageRouteNode signPatientManageRouteNode = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeById(Long.valueOf(data.getOut_id()));
|
SignPatientManageRouteNode signPatientManageRouteNode = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeById(Long.valueOf(data.getOut_id()));
|
||||||
if (Objects.nonNull(signPatientManageRouteNode) && signPatientManageRouteNode.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.EXECUTED.getInfo())) {
|
if (Objects.isNull(signPatientManageRouteNode) || signPatientManageRouteNode.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.EXECUTED.getInfo())) {
|
||||||
return retObj;
|
return retObj;
|
||||||
}
|
}
|
||||||
ShortMessageSendRecord shortMessageSendRecord = new ShortMessageSendRecord();
|
ShortMessageSendRecord shortMessageSendRecord = new ShortMessageSendRecord();
|
||||||
@ -275,6 +275,7 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
|
|||||||
shortMessageSendRecord.setMessageExpense(shortMessageSendRecord.getMessageUnitPrice().multiply(new BigDecimal(shortMessageSendRecord.getMessageQuantity())));
|
shortMessageSendRecord.setMessageExpense(shortMessageSendRecord.getMessageUnitPrice().multiply(new BigDecimal(shortMessageSendRecord.getMessageQuantity())));
|
||||||
shortMessageSendRecords.add(shortMessageSendRecord);
|
shortMessageSendRecords.add(shortMessageSendRecord);
|
||||||
signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(signPatientManageRouteNode);
|
signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(signPatientManageRouteNode);
|
||||||
|
ids.add(Integer.valueOf(data.getOut_id()));
|
||||||
}
|
}
|
||||||
return retObj;
|
return retObj;
|
||||||
}
|
}
|
||||||
@ -283,7 +284,7 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
|
|||||||
public Integer updateReadState(Integer readState, List<Integer> ids) {
|
public Integer updateReadState(Integer readState, List<Integer> ids) {
|
||||||
log.info("修改短信回调数据已读状态--id:{}", ids);
|
log.info("修改短信回调数据已读状态--id:{}", ids);
|
||||||
JSONObject TaskCallbackUpdateDto = new JSONObject();
|
JSONObject TaskCallbackUpdateDto = new JSONObject();
|
||||||
TaskCallbackUpdateDto.fluentPut("ids", ids).fluentPut("readState", readState);
|
TaskCallbackUpdateDto.fluentPut("ids", ids.toString()).fluentPut("readState", readState);
|
||||||
HttpEntity<JSONObject> requestEntity = new HttpEntity<>(TaskCallbackUpdateDto);
|
HttpEntity<JSONObject> requestEntity = new HttpEntity<>(TaskCallbackUpdateDto);
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
ResponseEntity<String> responseEntity = restTemplate.exchange(callBackUrl + "/updateMessageBackReadState", HttpMethod.POST, requestEntity, String.class);
|
ResponseEntity<String> responseEntity = restTemplate.exchange(callBackUrl + "/updateMessageBackReadState", HttpMethod.POST, requestEntity, String.class);
|
||||||
|
|||||||
@ -15,8 +15,6 @@ import org.springframework.stereotype.Component;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 短信相关定时任务
|
* @Description 短信相关定时任务
|
||||||
@ -47,6 +45,7 @@ public class SendTextMessageTask {
|
|||||||
taskMessageBackEntity.setReadState(0);
|
taskMessageBackEntity.setReadState(0);
|
||||||
List<TaskMessageBackEntity> taskMessageBackEntityList = sendTextMessageService.taskMessageBack(taskMessageBackEntity);
|
List<TaskMessageBackEntity> taskMessageBackEntityList = sendTextMessageService.taskMessageBack(taskMessageBackEntity);
|
||||||
List<ShortMessageSendRecord> shortMessageSendRecords = new ArrayList<>();
|
List<ShortMessageSendRecord> shortMessageSendRecords = new ArrayList<>();
|
||||||
|
List<Integer> ids = new ArrayList<>();
|
||||||
if (!CollectionUtils.isEmpty(taskMessageBackEntityList)) {
|
if (!CollectionUtils.isEmpty(taskMessageBackEntityList)) {
|
||||||
// 回调数据提取
|
// 回调数据提取
|
||||||
List<SmsReport> smsReports = new ArrayList<>();
|
List<SmsReport> smsReports = new ArrayList<>();
|
||||||
@ -57,16 +56,18 @@ public class SendTextMessageTask {
|
|||||||
if (CollectionUtils.isNotEmpty(smsReports)) {
|
if (CollectionUtils.isNotEmpty(smsReports)) {
|
||||||
for (SmsReport smsReport : smsReports) {
|
for (SmsReport smsReport : smsReports) {
|
||||||
// 回调数据解析
|
// 回调数据解析
|
||||||
sendTextMessageService.taskTextMessageSendBack(smsReport, shortMessageSendRecords);
|
sendTextMessageService.taskTextMessageSendBack(smsReport, shortMessageSendRecords, ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(shortMessageSendRecords)) {
|
if (CollectionUtils.isNotEmpty(shortMessageSendRecords)) {
|
||||||
shortMessageSendRecordMapper.insertShortMessageSendRecords(shortMessageSendRecords);
|
shortMessageSendRecordMapper.insertShortMessageSendRecords(shortMessageSendRecords);
|
||||||
}
|
}
|
||||||
List<Integer> ids = taskMessageBackEntityList.stream().filter(Objects::nonNull).map(TaskMessageBackEntity::getId).collect(Collectors.toList());
|
//List<Integer> ids = taskMessageBackEntityList.stream().filter(Objects::nonNull).map(TaskMessageBackEntity::getId).collect(Collectors.toList());
|
||||||
// 修改阿里云服务器回调数据已读状态
|
// 修改阿里云服务器回调数据已读状态
|
||||||
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
sendTextMessageService.updateReadState(1, ids);
|
sendTextMessageService.updateReadState(1, ids);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
log.info("完成同步百度外呼回调数据定时任务......");
|
log.info("完成同步百度外呼回调数据定时任务......");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user