|
@@ -2,9 +2,9 @@ package com.hys.app.controller.erp.use;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import com.alipay.api.AlipayApiException;
|
|
|
-import com.alipay.api.internal.util.AlipaySignature;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
|
|
+import com.github.binarywang.wxpay.service.WxPayService;
|
|
|
import com.hys.app.framework.exception.ServiceException;
|
|
|
import com.hys.app.model.erp.dos.OrderCustomerFee;
|
|
|
import com.hys.app.model.erp.dos.OrderDO;
|
|
@@ -14,7 +14,6 @@ import com.hys.app.pay.ali.PayOrder;
|
|
|
import com.hys.app.pay.ali.WxService;
|
|
|
import com.hys.app.service.erp.OrderCustomerFeeManager;
|
|
|
import com.hys.app.service.erp.OrderManager;
|
|
|
-import com.wechat.pay.java.core.auth.WechatPay2Validator;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -25,7 +24,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.HashMap;
|
|
@@ -42,6 +40,7 @@ public class PayController {
|
|
|
private AliPayService aliPayService;
|
|
|
private WxService wxService;
|
|
|
private OrderCustomerFeeManager orderCustomerFeeManager;
|
|
|
+ private WxPayService wxPayService;
|
|
|
|
|
|
@ApiOperation(value = "扫描完获取拉起支付的url")
|
|
|
@PostMapping("/getPayUrl")
|
|
@@ -88,4 +87,19 @@ public class PayController {
|
|
|
}
|
|
|
return "success";
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/wxpay/notify")
|
|
|
+ public String payNotify(@RequestBody String xmlData) throws Exception {
|
|
|
+ WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData);
|
|
|
+
|
|
|
+ if ("SUCCESS".equals(notifyResult.getResultCode())) {
|
|
|
+ // 处理业务逻辑
|
|
|
+ String outTradeNo = notifyResult.getOutTradeNo();
|
|
|
+ String transactionId = notifyResult.getTransactionId();
|
|
|
+ // 更新订单状态等
|
|
|
+ return "<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>";
|
|
|
+ } else {
|
|
|
+ return "<xml><return_code><![CDATA[FAIL]]></return_code></xml>";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|