wanghc
2023-07-04 a042e0e63f86a0880d20e57c14ec4a60b65801fb
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/controller/TradeController.java
@@ -1,18 +1,14 @@
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;
import com.jttech.pfcs.services.ITradeService;
import com.jttech.pfcs.vo.resp.ResponseVo;
/**
 * @author wanghc
@@ -29,39 +25,20 @@
    /**
     * 单笔交易
     * @param reqVo
     * @param content
     * @return
     */
    @PostMapping("/epcSnglTran")
    public ResponseVo epcSnglTran(@RequestBody ReqEPCSnglTranType reqVo) {
        mLogger.info("TradeController.epcSnglTran req={}", reqVo);
    @PostMapping("/excute")
    public ResponseVo excute(String url, String content) {
        mLogger.info("TradeController.excute excute={}", content);
        final long beginTime = System.currentTimeMillis();
        ResponseVo result = new ResponseVo();
        try {
            RspEPCSnglTranType body = mTradeService.epcSnglTran(reqVo);
            String body = mTradeService.excute(url, content);
            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));
            mLogger.info("Execute excute the result is {} time spent is {} ", result, (endTime - beginTime));
        }
    }
}