Your Name
2023-03-11 ae6ca64dcd91e4d0bd4095b64946a0567fc7bd90
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.java110.boot.controller.app.charge;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.core.base.controller.BaseController;
import com.java110.core.log.LoggerFactory;
import com.java110.dto.chargeMachineOrder.NotifyChargeOrderDto;
import com.java110.intf.common.INotifyChargeV1InnerServiceSMO;
import com.java110.utils.cache.MappingCache;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
 
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import java.util.Base64;
 
@RestController
@RequestMapping(path = "/app/charge")
public class NotifyCommonChargeController extends BaseController {
 
    private final static Logger logger = LoggerFactory.getLogger(NotifyCommonChargeController.class);
 
    public static final String DING_DING_DOMAIN = "DING_DING_CHARGE";
 
 
    public static final String DING_DING_APP_ID = "APP_ID";
    public static final String DING_DING_APP_SECURE = "APP_SECURE";
    @Autowired
    private INotifyChargeV1InnerServiceSMO notifyChargeV1InnerServiceSMOImpl;
 
    /**
     * <p>支付回调Api</p>
     *
     * @param request
     * @throws Exception
     */
    @RequestMapping(path = "/{id}/{port}/finish", method = RequestMethod.POST)
    public ResponseEntity<String> finishCharge(
            @PathVariable String id,
            @PathVariable String port,
            @RequestBody String postInfo,
            HttpServletRequest request) {
 
        JSONObject param = JSONObject.parseObject(postInfo);
        NotifyChargeOrderDto notifyChargeOrderDto = new NotifyChargeOrderDto();
        notifyChargeOrderDto.setOrderId(param.getString("chargeId"));
        notifyChargeOrderDto.setMachineCode(id);
        notifyChargeOrderDto.setPortCode(port);
        notifyChargeOrderDto.setBodyParam(postInfo);
 
        return notifyChargeV1InnerServiceSMOImpl.finishCharge(notifyChargeOrderDto);
 
    }
 
    /**
     * <p>支付回调Api</p>
     *
     * @param request
     * @throws Exception
     */
    @RequestMapping(path = "/{id}/event", method = RequestMethod.POST)
    public ResponseEntity<String> heartbeat(
            @PathVariable String id,
            @RequestBody String postInfo,
            HttpServletRequest request) {
        NotifyChargeOrderDto notifyChargeOrderDto = new NotifyChargeOrderDto();
        notifyChargeOrderDto.setMachineCode(id);
        notifyChargeOrderDto.setBodyParam(postInfo);
 
        return notifyChargeV1InnerServiceSMOImpl.heartbeat(notifyChargeOrderDto);
 
    }
 
    /**
     * <p>支付回调Api</p>
     *
     * @param request
     * @throws Exception
     */
    @RequestMapping(path = "/{id}/{port}/event", method = RequestMethod.POST)
    public ResponseEntity<String> chargeHeartbeat(
            @PathVariable String id,
            @PathVariable String port,
            @RequestBody String postInfo,
            HttpServletRequest request) {
 
        NotifyChargeOrderDto notifyChargeOrderDto = new NotifyChargeOrderDto();
        notifyChargeOrderDto.setMachineCode(id);
        notifyChargeOrderDto.setPortCode(port);
        notifyChargeOrderDto.setBodyParam(postInfo);
 
        return notifyChargeV1InnerServiceSMOImpl.chargeHeartBeat(notifyChargeOrderDto);
 
    }
 
 
}