wanghc
2023-03-09 f429658e8bf3c88c4550171f61d6984033940b54
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
package com.jttech.pfcs.controller;
 
import com.jttech.pfcs.services.ITradeService;
import com.jttech.pfcs.vo.resp.ResponseVo;
import com.jttech.pfcs.vo.req.trade.ReqEPCSnglTranType;
import com.jttech.pfcs.vo.req.trade.ReqTranQryType;
import com.jttech.pfcs.vo.resp.trade.RspEPCSnglTranType;
import com.jttech.pfcs.vo.resp.trade.RspTranQryType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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;
 
/**
 * @author wanghc
 * @version 1.0.0
 * @date 2023-03-07
 */
@RestController
@RequestMapping("/trade")
public class TradeController {
    private Logger mLogger = LoggerFactory.getLogger(getClass());
 
    @Autowired
    private ITradeService mTradeService;
 
    /**
     * 单笔交易
     * @param reqVo
     * @return
     */
    @PostMapping("/epcSnglTran")
    public ResponseVo epcSnglTran(@RequestBody ReqEPCSnglTranType reqVo) {
        mLogger.info("TradeController.epcSnglTran req={}", reqVo);
        final long beginTime = System.currentTimeMillis();
        ResponseVo result = new ResponseVo();
        try {
            RspEPCSnglTranType body = mTradeService.epcSnglTran(reqVo);
            return result.setBody(body);
        } finally {
            final long endTime = System.currentTimeMillis();
            mLogger.info("Execute epcSnglTran the result is {} time spent is {} ", result, (endTime - beginTime));
        }
    }
 
    /**
     * 单笔交易
     * @param reqVo
     * @return
     */
    @PostMapping("/tranQry")
    public ResponseVo tranQry(@RequestBody ReqTranQryType reqVo) {
        mLogger.info("TradeController.tranQry req={}", reqVo);
        final long beginTime = System.currentTimeMillis();
        ResponseVo result = new ResponseVo();
        try {
            RspTranQryType body = mTradeService.tranQry(reqVo);
            return result.setBody(body);
        } finally {
            final long endTime = System.currentTimeMillis();
            mLogger.info("Execute tranQry the result is {} time spent is {} ", result, (endTime - beginTime));
        }
    }
}