Commit c753ae6d by 18356073052

新增同步群发消息结果接口

1 parent 5700a5ff
...@@ -87,10 +87,20 @@ public class WeCustomerMessagePushController extends BaseController { ...@@ -87,10 +87,20 @@ public class WeCustomerMessagePushController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:pushResults')") @PreAuthorize("@ss.hasPermi('customerMessagePush:push:pushResults')")
@GetMapping(value = "/pushResults") @GetMapping(value = "/pushResults")
public TableDataInfo customerMessagePushResult(@RequestParam(value = "messageId") Long messageId,@RequestParam(value = "status") String status){ public TableDataInfo customerMessagePushResult(@RequestParam(value = "messageId") Long messageId, @RequestParam(value = "status") String status) {
startPage(); startPage();
List<WeCustomerMessageResultVo> weCustomerMessageResuls = weCustomerMessgaeResultService.customerMessagePushs(messageId, status); List<WeCustomerMessageResultVo> weCustomerMessageResuls = weCustomerMessgaeResultService.customerMessagePushs(messageId, status);
return getDataTable(weCustomerMessageResuls); return getDataTable(weCustomerMessageResuls);
} }
/**
* 同步消息发送结果
*/
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:asyncResult')")
@PostMapping(value = "asyncResult")
public AjaxResult asyncResult(@RequestParam(value = "msgid") String msgid, @RequestParam(value = "messageId") Long messageId) {
return AjaxResult.success();
}
} }
...@@ -40,4 +40,12 @@ public interface IWeCustomerMessageOriginalService extends IService<WeCustomerMe ...@@ -40,4 +40,12 @@ public interface IWeCustomerMessageOriginalService extends IService<WeCustomerMe
*/ */
CustomerMessagePushVo CustomerMessagePushDetail(Long messageId); CustomerMessagePushVo CustomerMessagePushDetail(Long messageId);
/**
* 同步发送结果
*
* @param msgid 可以用于获取发送结果
*/
void asyncResult(String msgid, Long messageId);
} }
...@@ -63,20 +63,31 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer ...@@ -63,20 +63,31 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer
CustomerMessagePushVo customerMessagePushDetail = weCustomerMessageOriginalMapper.findCustomerMessagePushDetail(messageId); CustomerMessagePushVo customerMessagePushDetail = weCustomerMessageOriginalMapper.findCustomerMessagePushDetail(messageId);
AtomicInteger atomicInteger=new AtomicInteger();
//拉取消息发送结果 //拉取消息发送结果
CompletableFuture.runAsync(()->{ CompletableFuture.runAsync(() -> syncSendResult(customerMessagePushDetail.getMsgid(), messageId));
return customerMessagePushDetail;
}
@Override
public void asyncResult(String msgid, Long messageId) {
syncSendResult(msgid, messageId);
}
String msgid = customerMessagePushDetail.getMsgid(); public void syncSendResult(String msgid, Long messageId) {
if(StringUtils.isNotEmpty(msgid)){ AtomicInteger atomicInteger = new AtomicInteger();
if (StringUtils.isNotEmpty(msgid)) {
List<String> msgIds = null; List<String> msgIds = null;
try { try {
msgIds = objectMapper.readValue(msgid,new TypeReference<List<String>>() { }); msgIds = objectMapper.readValue(msgid, new TypeReference<List<String>>() {
});
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
...@@ -84,11 +95,11 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer ...@@ -84,11 +95,11 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer
} }
if(CollectionUtils.isNotEmpty(msgIds)){ if (CollectionUtils.isNotEmpty(msgIds)) {
msgIds.forEach(m->{ msgIds.forEach(m -> {
QueryCustomerMessageStatusResultDataObjectDto dataObjectDto=new QueryCustomerMessageStatusResultDataObjectDto(); QueryCustomerMessageStatusResultDataObjectDto dataObjectDto = new QueryCustomerMessageStatusResultDataObjectDto();
dataObjectDto.setMsgid(m); dataObjectDto.setMsgid(m);
...@@ -100,15 +111,15 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer ...@@ -100,15 +111,15 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer
List<DetailMessageStatusResultDto> detailList = queryCustomerMessageStatusResultDto.getDetail_list(); List<DetailMessageStatusResultDto> detailList = queryCustomerMessageStatusResultDto.getDetail_list();
detailList.forEach(d-> { detailList.forEach(d -> {
if(d.getStatus().equals("1")){ if (d.getStatus().equals("1")) {
atomicInteger.incrementAndGet(); atomicInteger.incrementAndGet();
} }
weCustomerMessgaeResultMapper.updateWeCustomerMessgaeResult(messageId,d.getChat_id(),d.getExternal_userid(),d.getStatus(),d.getSend_time()); weCustomerMessgaeResultMapper.updateWeCustomerMessgaeResult(messageId, d.getChat_id(), d.getExternal_userid(), d.getStatus(), d.getSend_time());
}); });
...@@ -121,11 +132,7 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer ...@@ -121,11 +132,7 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer
} }
//更新微信实际发送条数 //更新微信实际发送条数
weCustomerMessageService.updateWeCustomerMessageActualSend(messageId,atomicInteger.get()); weCustomerMessageService.updateWeCustomerMessageActualSend(messageId, atomicInteger.get());
});
return customerMessagePushDetail;
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!