|
@@ -30,6 +30,7 @@ import org.springframework.context.ApplicationEventPublisher;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
@@ -108,40 +109,15 @@ public class WxPayController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @PostMapping(value = "/TransferNotify")
|
|
|
- public String TransferNotify(String notifyData,HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
- SignatureHeader signatureHeader = new SignatureHeader();
|
|
|
- signatureHeader.setTimeStamp(response.getHeader("Wechatpay-Timestamp"));
|
|
|
- signatureHeader.setNonce(response.getHeader("Wechatpay-Nonce"));
|
|
|
- signatureHeader.setSerial(response.getHeader("Wechatpay-Serial"));
|
|
|
- signatureHeader.setSignature(response.getHeader("Wechatpay-Signature"));
|
|
|
- try {
|
|
|
- String json = configService.selectConfigByKey("redPacket.config");
|
|
|
- RedPacketConfig config = JSONUtil.toBean(json, RedPacketConfig.class);
|
|
|
- //创建微信订单
|
|
|
- WxPayConfig payConfig = new WxPayConfig();
|
|
|
- BeanUtils.copyProperties(config,payConfig);
|
|
|
- WxPayService wxPayService = new WxPayServiceImpl();
|
|
|
- wxPayService.setConfig(payConfig);
|
|
|
- WxPayTransferBatchesNotifyV3Result result = wxPayService.parseTransferBatchesNotifyV3Result(notifyData,signatureHeader);
|
|
|
- logger.info("到零钱回调:{}",result.getResult());
|
|
|
- if (result.getResult().getBatchStatus().equals("FINISHED")) {
|
|
|
- R r = redPacketLogService.syncRedPacket(result.getResult().getOutBatchNo());
|
|
|
- logger.info("result:{}",r);
|
|
|
- if (r.get("code").equals(200)){
|
|
|
- return WxPayNotifyResponse.success("处理成功");
|
|
|
- }else {
|
|
|
- return WxPayNotifyResponse.fail("");
|
|
|
- }
|
|
|
- }else {
|
|
|
- return WxPayNotifyResponse.fail("");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("微信回调结果异常,异常原因{}", e.getMessage());
|
|
|
- return WxPayNotifyResponse.fail(e.getMessage());
|
|
|
- }
|
|
|
+ @PostMapping( "/TransferNotify")
|
|
|
+ public String TransferNotify(@RequestBody String notifyData, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
+ return storePaymentService.transferNotify(notifyData,request);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ @PostMapping( "/v3TransferNotify")
|
|
|
+ public String v3TransferNotify(@RequestBody String notifyData,HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
+ return storePaymentService.v3TransferNotify(notifyData,request);
|
|
|
}
|
|
|
|
|
|
}
|