Commit 6856d847 by 郑云飞

支付回调,退款,退款回调功能完成

parent c47aeba4
......@@ -176,7 +176,8 @@ wx:
subAppId: #服务商模式下的子商户公众账号ID
subMchId: #服务商模式下的子商户号
keyPath: C:\\ProgramData\\certKey\xinrenli\\apiclient_cert.p12 # p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath:开头)
notifyUrl: http://xinrenli.nyinhong.com/api//xinrenli/order/notify # 微信支付回调接口
notifyUrl: http://xinrenli.nyinhong.com/api/xinrenli/order/notify # 微信支付回调接口
refundNotifyUrl: http://xinrenli.nyinhong.com/api/xinrenli/order/refundNotify # 微信t退款回调接口
# mp:
# useRedis: false
# redisConfig:
......
......@@ -31,7 +31,6 @@ public class WxPayConfiguration {
payConfig.setSubAppId(StringUtils.trimToNull(this.properties.getSubAppId()));
payConfig.setSubMchId(StringUtils.trimToNull(this.properties.getSubMchId()));
payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath()));
payConfig.setNotifyUrl(StringUtils.trimToNull(this.properties.getNotifyUrl()));
// 可以指定是否使用沙箱环境
payConfig.setUseSandboxEnv(false);
......
......@@ -41,9 +41,4 @@ public class WxPayProperties {
*/
private String keyPath;
/**
* 支付回调接口
*/
private String notifyUrl;
}
package com.yongqi.xinrenli.controller;
import java.math.BigDecimal;
import java.util.List;
import java.util.Arrays;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.yongqi.common.core.domain.model.LoginUser;
import com.yongqi.common.helper.LoginHelper;
import com.yongqi.common.utils.ip.AddressUtils;
......@@ -144,10 +146,14 @@ public class DbOrderController extends BaseController {
/**
* 下单
* @param orderId 订单id
* @param couponId 优惠券id
* @param request
* @return
*/
@SaCheckPermission("xinrenli:order:pay")
@Log(title = "下单", businessType = BusinessType.DELETE)
@RequestMapping("/orderPay")
@Log(title = "下单", businessType = BusinessType.OTHER)
@GetMapping("/orderPay")
public R orderPay(@NotNull(message = "主键不能为空") @RequestParam("id") Long orderId
, @RequestParam(value = "id", required = false) Long couponId
, HttpServletRequest request) {
......@@ -157,16 +163,41 @@ public class DbOrderController extends BaseController {
}
/**
* 下单
* 下单回调
*/
@SaCheckPermission("xinrenli:order:notify")
@Log(title = "下单", businessType = BusinessType.DELETE)
@RequestMapping("/notify")
public R payCallback(@RequestBody String xmlData) {
@Log(title = "下单回调", businessType = BusinessType.OTHER)
@PostMapping("/notify")
public String payCallback(@RequestBody String xmlData) throws WxPayException {
return iDbOrderService.payCallback(xmlData);
}
/**
* 退款
* @param orderId 订单id
* @param refundAmount 退款金额
* @return
*/
@SaCheckPermission("xinrenli:order:refund")
@Log(title = "退款", businessType = BusinessType.OTHER)
@GetMapping("/refund")
public R refund(@NotNull(message = "订单id不能为空") @RequestParam("orderId") Long orderId,
@NotNull(message = "退款金额不能为空")@RequestParam("refundeAmount")BigDecimal refundAmount) {
LoginUser loginUser = LoginHelper.getLoginUser();
return iDbOrderService.refund(orderId, refundAmount, loginUser);
}
/**
* 退款回调
*/
@SaCheckPermission("xinrenli:order:refundNotify")
@Log(title = "退款回调", businessType = BusinessType.OTHER)
@PostMapping("/refundNotify")
public String refundNotify(@RequestBody String xmlData) throws WxPayException {
return iDbOrderService.refundNotify(xmlData);
}
/**
* 报表
*/
@SaCheckPermission("xinrenli:order:reportForms")
......
......@@ -33,6 +33,10 @@ public class DbOrder {
*/
private String wxOrderNo;
/**
* 退款单号
*/
private String refundNo;
/**
* 用户id
*/
private Long userId;
......@@ -69,6 +73,10 @@ public class DbOrder {
*/
private BigDecimal payAmount;
/**
* 退款金额
*/
private BigDecimal refundAmount;
/**
* 使用优惠券id
*/
private Long useCouponId;
......
......@@ -5,6 +5,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
/**
......@@ -39,6 +40,6 @@ public class WxPayOrderResult {
*/
@DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss")
private LocalDateTime createTime;
private Date createTime;
}
......@@ -10,6 +10,7 @@ import com.yongqi.common.core.page.TableDataInfo;
import com.yongqi.common.core.domain.PageQuery;
import com.yongqi.xinrenli.domain.vo.ReportFormsVo;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -85,5 +86,21 @@ public interface IDbOrderService {
* @param xmlData
* @return
*/
R payCallback(String xmlData) throws WxPayException;
String payCallback(String xmlData) throws WxPayException;
/**
* 退款
* @param orderId
* @param refundAmount
* @param loginUser
* @return
*/
R refund(Long orderId, BigDecimal refundAmount, LoginUser loginUser);
/**
* 退款回调
* @param xmlData
* @return
*/
String refundNotify(String xmlData) throws WxPayException;
}
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