chengf
2025-09-02 9faac602a31237bfc67b0b0748af1b31f5302482
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.java110.api.controller.app.payment.wechat;
 
import com.java110.core.log.LoggerFactory;
import com.java110.dto.payment.NotifyPaymentOrderDto;
import com.java110.intf.acct.INotifyPaymentV1InnerServiceSMO;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
 
@RestController
@RequestMapping(path = "/app/payment/notify")
public class WechatNotifyPaymentController {
 
    private final static Logger logger = LoggerFactory.getLogger(WechatNotifyPaymentController.class);
 
    @Autowired
    private INotifyPaymentV1InnerServiceSMO notifyPaymentV1InnerServiceSMOImpl;
 
    /**
     * <p>支付回调Api</p>
     *
     * @param request
     * @throws Exception
     */
    @RequestMapping(path = "/wechat/{appId}/{paymentPoolId}", method = RequestMethod.POST)
    public ResponseEntity<String> notify(@RequestBody String postInfo, @PathVariable String appId,
                                         @PathVariable String paymentPoolId,HttpServletRequest request) {
 
        System.out.println("微信支付回调报文" + postInfo);
 
        return notifyPaymentV1InnerServiceSMOImpl.notifyPayment(new NotifyPaymentOrderDto(appId,postInfo,"",paymentPoolId));
 
    }
 
    /**
     * <p>支付回调Api</p>
     *
     * @param request
     * @throws Exception
     */
    @RequestMapping(path = "/nativeWechat/{appId}/{paymentPoolId}", method = RequestMethod.POST)
    public String nativeNotify(@RequestBody String postInfo, @PathVariable String appId,@PathVariable String paymentPoolId, HttpServletRequest request) {
 
        logger.debug("微信支付回调报文" + postInfo);
        if (paymentPoolId == null) {
            paymentPoolId = "102025072862190227";
        }
        ResponseEntity<String> stringResponseEntity = notifyPaymentV1InnerServiceSMOImpl.nativeNotifyPayment(new NotifyPaymentOrderDto(appId, postInfo, "", paymentPoolId));
        if (stringResponseEntity.getStatusCode().is2xxSuccessful()) {
            return  "1";
        }
        return "0";
    }
}