优化出参

This commit is contained in:
dengli
2023-12-16 19:13:31 +08:00
parent e8cbf2c05e
commit 7fd916a219

View File

@@ -127,12 +127,7 @@ public class StockApiController {
public ServerResponse getINDStockInfo(@RequestParam("stockCode") String stockCode) {
ParamUtils.verify("股票代码", stockCode, ParamUtils.STRING_NOT_EMPTY_VERIFY_AND_CONVERT_VALUE);
IndiaStockVO market = null;
try {
market = InvestingApis.of().market(StockCode.of(stockCode));
} catch (Exception e) {
return ServerResponse.createByErrorMsg("tips.msg.221");
}
IndiaStockVO market = InvestingApis.of().market(StockCode.of(stockCode));
return ServerResponse.createBySuccess(market.toStockVo());
}
@@ -193,9 +188,15 @@ public class StockApiController {
@ApiImplicitParam(name = "code",value = "股票对应代码symbol",dataType ="String",required = true),
})
public ServerResponse getSingleStock(@RequestParam("code") String code) {
return RequestCacheUtils.cache("getSingleStock.do", code, (string) -> {
return this.stockService.getSingleStock(code);
});
ServerResponse<Object> cache = null;
try {
cache = RequestCacheUtils.cache("getSingleStock.do", code, (string) -> {
return this.stockService.getSingleStock(code);
});
} catch (Exception e) {
return ServerResponse.createByErrorMsg("tips.msg.221");
}
return cache;
}
@RequestMapping({"getMinK.do"})