Commit bb34d77f by ping.wu

取消支付冲正mq只发一次

parent 3789137e
...@@ -99,10 +99,16 @@ public class OrderCallBackMQService { ...@@ -99,10 +99,16 @@ public class OrderCallBackMQService {
* @param body * @param body
*/ */
public void revert(OrderCallBackRequestVo body){ public void revert(OrderCallBackRequestVo body){
ApiLog.infoMessage("activityReverse start orderCode:{}", body.getOrderCode());
if (ObjectUtils.notEqual(body.getDelayMsgEventType(),2)){ if (ObjectUtils.notEqual(body.getDelayMsgEventType(),2)){
return; return;
} }
String redisKey = "kgd:cancel_payment_oid:" + body.getOrderCode() ;
//取消支付订单缓存,
Object value = redisCache.getValue(redisKey);
if(value != null){
return;
}
ApiLog.infoMessage("activityReverse start orderCode:{}", body.getOrderCode());
String orderCode=body.getOrderCode(); String orderCode=body.getOrderCode();
OrderStatusChangeRequestDto requestDto = new OrderStatusChangeRequestDto(); OrderStatusChangeRequestDto requestDto = new OrderStatusChangeRequestDto();
requestDto.setOid(orderCode); requestDto.setOid(orderCode);
......
...@@ -100,6 +100,10 @@ public class RedisKeyConstant { ...@@ -100,6 +100,10 @@ public class RedisKeyConstant {
public final static String USER_BUY_PRODUCT_ONCE = "user_buy_product_once:"; public final static String USER_BUY_PRODUCT_ONCE = "user_buy_product_once:";
/**
* 取消支付冲正mq在redis的key前缀
*/
public final static String KGD_PAYMENT_CANCEL_OID = "kgd:cancel_payment_oid:";
/** /**
* cocoNotMadeGoods:商户号:门店号:yyyy-MM-dd * cocoNotMadeGoods:商户号:门店号:yyyy-MM-dd
......
...@@ -5,8 +5,10 @@ import cn.freemud.amqp.Header; ...@@ -5,8 +5,10 @@ import cn.freemud.amqp.Header;
import cn.freemud.amqp.MQAction; import cn.freemud.amqp.MQAction;
import cn.freemud.amqp.MQMessage; import cn.freemud.amqp.MQMessage;
import cn.freemud.amqp.MQService; import cn.freemud.amqp.MQService;
import cn.freemud.constant.RedisKeyConstant;
import cn.freemud.entities.dto.OrderPrintDto; import cn.freemud.entities.dto.OrderPrintDto;
import cn.freemud.entities.dto.pay.PaymentMqMessageDto; import cn.freemud.entities.dto.pay.PaymentMqMessageDto;
import cn.freemud.redis.RedisCache;
import cn.freemud.utils.AppLogUtil; import cn.freemud.utils.AppLogUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.freemud.application.sdk.api.config.TopicExchangeConfig; import com.freemud.application.sdk.api.config.TopicExchangeConfig;
...@@ -18,11 +20,16 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,11 +20,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
@Component @Component
public class OrderQueueService { public class OrderQueueService {
@Autowired @Autowired
private MQService mqService; private MQService mqService;
@Autowired
private RedisCache redisCache;
// TODO: 21-9-17 定义常量 // TODO: 21-9-17 定义常量
...@@ -75,6 +82,10 @@ public class OrderQueueService { ...@@ -75,6 +82,10 @@ public class OrderQueueService {
} catch (Exception e) { } catch (Exception e) {
AppLogUtil.errorLog("ActivityReverse", JSON.toJSONString(requestDto), "", e); AppLogUtil.errorLog("ActivityReverse", JSON.toJSONString(requestDto), "", e);
} }
String redisKey = RedisKeyConstant.KGD_PAYMENT_CANCEL_OID + oid ;
//取消支付订单缓存
redisCache.save(redisKey, true, 180L, TimeUnit.MINUTES);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment