|
@@ -359,23 +359,9 @@ public class OrderController {
|
|
|
orderService.refund(orderInfo, null);
|
|
|
//微信支付
|
|
|
} else if (Dict.payFlag.item_weixin.getItem().equals(orderInfo.getPayFlag())) {
|
|
|
-
|
|
|
- List<OrderWXPayRecordEntity> orderWXPayRecords =
|
|
|
- orderWXPayRecordService.getRecordsByOutTradeNo(orderInfo.getOrderSn());
|
|
|
- //支付成功的发送到微信的订单编号
|
|
|
- String paySuccessOutTradeNoWX = null;
|
|
|
- if (orderWXPayRecords != null) {
|
|
|
- for (OrderWXPayRecordEntity orderWXPayRecord : orderWXPayRecords) {
|
|
|
- if ("SUCCESS".equals(orderWXPayRecord.getTradeState())) {
|
|
|
- paySuccessOutTradeNoWX = orderWXPayRecord.getOutTradeNoWX();
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// todo 退款
|
|
|
WechatRefundApiResult result = WechatUtil
|
|
|
- .wxRefund(paySuccessOutTradeNoWX, orderInfo.getActualPrice().doubleValue(),
|
|
|
+ .wxRefund(orderInfo.getOrderSnWx(), orderInfo.getActualPrice().doubleValue(),
|
|
|
orderInfo.getActualPrice().doubleValue());
|
|
|
if (result.getResult_code().equals("SUCCESS")) {
|
|
|
orderService.refund(orderInfo, result);
|
|
@@ -448,7 +434,7 @@ public class OrderController {
|
|
|
@RequestMapping("/confirmPay")
|
|
|
@RequiresPermissions("order:confirmPay")
|
|
|
public R confirmPay(@RequestBody Long id) {
|
|
|
- orderService.confirmPay(id, Dict.payFlag.item_cash);
|
|
|
+ orderService.confirmPay(id, Dict.payFlag.item_cash, null);
|
|
|
|
|
|
return R.ok();
|
|
|
}
|
|
@@ -512,7 +498,6 @@ public class OrderController {
|
|
|
orderWXPayRecordCurrent.getOutTradeNoWX(), orderEntity.getActualPrice().doubleValue(),
|
|
|
"127.0.0.1", auth_code);
|
|
|
orderWXPayRecordService.updateRecord(orderWXPayRecordCurrent.getId(), wechatMicropayApiResult);
|
|
|
- System.out.println(wechatMicropayApiResult);
|
|
|
|
|
|
//当支付成功时,修改订单,并把其他支付记录撤销
|
|
|
if (WechatUtil.WXTradeState.SUCCESS.getCode().equals(wechatMicropayApiResult.getTrade_state())) {
|
|
@@ -541,7 +526,7 @@ public class OrderController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- orderService.confirmPay(id, Dict.payFlag.item_weixin);
|
|
|
+ orderService.confirmPay(id, Dict.payFlag.item_weixin, orderWXPayRecordCurrent.getOutTradeNoWX());
|
|
|
r = R.ok();
|
|
|
//用户支付中
|
|
|
} else if (WechatUtil.WXTradeState.USERPAYING.getCode().equals(wechatMicropayApiResult.getTrade_state())) {
|