PushNoPassPayFailureMsgService.java
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.zteits.ipay.biz;
import org.apache.commons.lang3.StringUtils;
import com.alibaba.fastjson.JSON;
import com.aliyun.openservices.ons.api.SendResult;
import com.zteits.clouds.api.dto.order.parkorder.dto.OrderParkDTO;
import com.zteits.clouds.api.dto.rocketmq.constants.MQTopicConstants;
import com.zteits.clouds.api.dto.rocketmq.constants.tags.OrderTags;
import com.zteits.order.domain.OrderPark;
import zteits.rocketmq.spring.starter.core.RocketMQTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 账户余额不足导致无感支付失败消息推送服务
* Copyright: Copyright (c) 2019 zteits
*
* @ClassName: PushNoPassPayFailueMsgService
* @Description:
* @version: v1.0.0
* @author: niueb
* @date: 2020/7/16 15:05
* Modification History:
* Date Author Version Description
* ---------------------------------------------------------*
* 2020/7/16 niueb v1.0.0 创建
*/
@Service
public class PushNoPassPayFailureMsgService {
private static final Logger logger = LoggerFactory.getLogger(PushNoPassPayFailureMsgService.class);
@Autowired
private RocketMQTemplate rocketMQTemplate;
public void sendNoPassPayFailureMsg(OrderPark orderPark) {
String keys = "";
OrderParkDTO orderParkDTO = new OrderParkDTO();
BeanUtils.copyProperties(orderPark,orderParkDTO);
try{
logger.info("发送无感支付失败消息,参数:"+ JSON.toJSONString(orderPark));
SendResult sendResult = rocketMQTemplate.syncSend(MQTopicConstants.ZTEITS_RNT_CLOUD, OrderTags.NO_PASS_PAY_FAILURE, keys, orderParkDTO);
logger.info("发送无感支付失败消息结果:"+JSON.toJSONString(sendResult));
if(StringUtils.isBlank(sendResult.getMessageId())){
//发送失败,后期可以使用定时任务辅助,针对发送失败的,定时重发
}
}catch (Exception e){
//发送失败,后期可以使用定时任务辅助,针对发送失败的,定时重发
logger.error("无感支付失败消息发送失败",e);
}
}
}