Your Name
2023-04-17 da3b5c72fa45bc26a9868c2b26e3efda14845179
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
package com.java110.api.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.chargeMachine.NotifyChargeOrderDto;
import com.java110.intf.common.INotifyChargeV1InnerServiceSMO;
import com.java110.vo.ResultVo;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
 
@RestController
@RequestMapping(path = "/app/charge/kehang")
public class NotifyKeHangChargeController extends BaseController {
 
    private final static Logger logger = LoggerFactory.getLogger(NotifyKeHangChargeController.class);
 
 
    private static final String FINISH_CHARGE = "net.equip.charge.slow.async.notice.finish";
 
    @Autowired
    private INotifyChargeV1InnerServiceSMO notifyChargeV1InnerServiceSMOImpl;
 
    /**
     * <p>支付回调Api</p>
     *
     * @param request
     * @throws Exception
     */
    @RequestMapping(path = "/notice", method = RequestMethod.POST)
    public ResponseEntity<String> notice(
            @RequestBody String postInfo,
            HttpServletRequest request) {
 
        String api = request.getHeader("api");
 
        JSONObject reqJson = JSONObject.parseObject(postInfo);
        if(FINISH_CHARGE.equals(api)){
            NotifyChargeOrderDto notifyChargeOrderDto = new NotifyChargeOrderDto();
            notifyChargeOrderDto.setMachineCode(reqJson.getString("equipCd"));
            notifyChargeOrderDto.setPortCode(reqJson.getString("port"));
            notifyChargeOrderDto.setBodyParam(postInfo);
            notifyChargeOrderDto.setReason(reqJson.getString("reason"));
            ResultVo resultVo = notifyChargeV1InnerServiceSMOImpl.finishCharge(notifyChargeOrderDto);
 
            if (resultVo.getCode() != ResultVo.CODE_OK) {
               return new ResponseEntity<>("FAIL",HttpStatus.OK);
            }
 
        }
 
        return new ResponseEntity<>("SUCCESS",HttpStatus.OK);
    }
 
 
 
}