更新sql和代码规范修改
This commit is contained in:
@ -37,13 +37,14 @@ public class MerchantPayServiceConfigurer implements PayServiceConfigurer {
|
||||
* @param merchants 商户配置
|
||||
*/
|
||||
@Override
|
||||
public void configure(MerchantDetailsServiceConfigurer merchants) {
|
||||
public void configure(MerchantDetailsServiceConfigurer merchants) {
|
||||
merchants.jdbc()
|
||||
//是否开启缓存,默认不开启,这里开启缓存
|
||||
.cache(false)
|
||||
.template(jdbcTemplate);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 商户配置
|
||||
*
|
||||
|
@ -15,6 +15,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 支付宝支付回调处理器
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2023/7/15
|
||||
*/
|
||||
@ -24,6 +25,7 @@ public class AliPayMessageHandler implements PayMessageHandler<AliPayMessage, Al
|
||||
|
||||
@Resource
|
||||
private PayNoticeProducer payNoticeProducer;
|
||||
|
||||
/**
|
||||
* 处理支付回调消息的处理器接口
|
||||
*
|
||||
|
@ -15,6 +15,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 微信支付回调处理器
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2023/7/15
|
||||
*/
|
||||
@ -32,15 +33,15 @@ public class WxPayMessageHandler implements PayMessageHandler<WxPayMessage, PayS
|
||||
log.info("======pay notice ========");
|
||||
|
||||
//交易状态
|
||||
if ("SUCCESS".equals(payMessage.getPayMessage().get("result_code"))){
|
||||
if ("SUCCESS".equals(payMessage.getPayMessage().get("result_code"))) {
|
||||
String orderId = (String) payMessage.getPayMessage().get("out_trade_no");
|
||||
//消息队列处理
|
||||
log.info("微信回调消息处理,发送处理消息orderId={}",orderId);
|
||||
log.info("微信回调消息处理,发送处理消息orderId={}", orderId);
|
||||
payNoticeProducer.sendPayNoticeMessage(orderId, PayTypeEnum.WEIXIN.getType());
|
||||
|
||||
return payService.getPayOutMessage("SUCCESS", "OK");
|
||||
return payService.getPayOutMessage("SUCCESS", "OK");
|
||||
}
|
||||
|
||||
return payService.getPayOutMessage("FAIL", "失败");
|
||||
return payService.getPayOutMessage("FAIL", "失败");
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 支付宝回调信息拦截器
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2023/7/15
|
||||
*/
|
||||
@ -21,12 +22,12 @@ public class AliPayMessageInterceptor implements PayMessageInterceptor<AliPayMes
|
||||
/**
|
||||
* 拦截支付消息
|
||||
*
|
||||
* @param payMessage 支付回调消息
|
||||
* @param context 上下文,如果handler或interceptor之间有信息要传递,可以用这个
|
||||
* @param payMessage 支付回调消息
|
||||
* @param context 上下文,如果handler或interceptor之间有信息要传递,可以用这个
|
||||
* @param payService 支付服务
|
||||
* @return true代表OK,false代表不OK并直接中断对应的支付处理器
|
||||
* @see PayMessageHandler 支付处理器
|
||||
* @throws PayErrorException PayErrorException*
|
||||
* @see PayMessageHandler 支付处理器
|
||||
*/
|
||||
@Override
|
||||
public boolean intercept(AliPayMessage payMessage, Map<String, Object> context, AliPayService payService) throws PayErrorException {
|
||||
@ -36,7 +37,6 @@ public class AliPayMessageInterceptor implements PayMessageInterceptor<AliPayMes
|
||||
// todo
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2022
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
|
||||
*/
|
||||
package co.yixiang.yshop.module.pay.enums;
|
||||
|
||||
@ -18,24 +17,24 @@ import java.util.stream.Stream;
|
||||
@AllArgsConstructor
|
||||
public enum PayTypeEnum {
|
||||
|
||||
WEIXIN("weixin","微信支付"),
|
||||
WEIXIN_H5("weixin_h5","微信H5支付"),
|
||||
WEIXIN_APPLET("weixin_applet","微信小程序支付"),
|
||||
WEIXIN_APP("weixin_app","微信app支付"),
|
||||
WEIXIN("weixin", "微信支付"),
|
||||
WEIXIN_H5("weixin_h5", "微信H5支付"),
|
||||
WEIXIN_APPLET("weixin_applet", "微信小程序支付"),
|
||||
WEIXIN_APP("weixin_app", "微信app支付"),
|
||||
|
||||
YUE("yue","余额支付"),
|
||||
INTEGRAL("integral","积分兑换");
|
||||
YUE("yue", "余额支付"),
|
||||
INTEGRAL("integral", "积分兑换");
|
||||
|
||||
|
||||
private String type;
|
||||
private String type;
|
||||
|
||||
private String desc;
|
||||
private String desc;
|
||||
|
||||
public static PayTypeEnum toType(String type) {
|
||||
return Stream.of(PayTypeEnum.values())
|
||||
.filter(p -> p.type.equals(type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
public static PayTypeEnum toType(String type) {
|
||||
return Stream.of(PayTypeEnum.values())
|
||||
.filter(p -> p.type.equals(type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package co.yixiang.yshop.module.pay.mq.message;
|
||||
|
||||
import co.yixiang.yshop.framework.mq.core.stream.AbstractStreamMessage;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -15,9 +15,10 @@ public class PayNoticeProducer {
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param orderId 订单编号
|
||||
*/
|
||||
public void sendPayNoticeMessage(String orderId,String payType) {
|
||||
public void sendPayNoticeMessage(String orderId, String payType) {
|
||||
PayNoticeMessage payNoticeMessage = new PayNoticeMessage().setOrderId(orderId).setPayType(payType);
|
||||
redisMQTemplate.send(payNoticeMessage);
|
||||
}
|
||||
|
Reference in New Issue
Block a user