package com.jttech.pfcs.controller; import com.jttech.pfcs.services.ITradeService; import com.jttech.pfcs.vo.ResponseVo; import com.jttech.pfcs.vo.req.trade.ReqEPCSnglTranType; import com.jttech.pfcs.vo.req.trade.ReqTranQryType; import com.jttech.pfcs.vo.resp.RspEPCSnglTranType; import com.jttech.pfcs.vo.resp.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)); } } }