package com.jttech.pfcs.controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.jttech.pfcs.services.ITradeService; import com.jttech.pfcs.vo.resp.ResponseVo; /** * @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 content * @return */ @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 { String body = mTradeService.excute(url, content); return result.setBody(body); } finally { final long endTime = System.currentTimeMillis(); mLogger.info("Execute excute the result is {} time spent is {} ", result, (endTime - beginTime)); } } }