调整结构
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.stock.market.domain.basic.repository.MoneyStockRepository;
|
||||
import cn.stock.market.dto.StockHistoryRequest;
|
||||
import cn.stock.market.dto.StockHistoryResponse;
|
||||
import cn.stock.market.infrastructure.db.po.QMoneyStockPO;
|
||||
import cn.stock.market.utils.ServerResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -159,9 +160,8 @@ public class MoneyApiController {
|
||||
})
|
||||
@GetMapping("/api/market/money/getStockDetail")
|
||||
@ResponseBody
|
||||
public JSONObject getStockDetail(@RequestParam String stockType, @RequestParam String symbol) {
|
||||
public ServerResponse getStockDetail(@RequestParam String stockType, @RequestParam String symbol) {
|
||||
String url = String.format("https://priceapi.moneycontrol.com/pricefeed/%s/equitycash/%s",stockType,symbol);
|
||||
|
||||
// 设置重试次数
|
||||
int maxRetries = 3;
|
||||
for (int retry = 1; retry <= maxRetries; retry++) {
|
||||
@@ -169,7 +169,7 @@ public class MoneyApiController {
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.GET, null, String.class);
|
||||
|
||||
if (responseEntity.getStatusCode().value() == 200 && responseEntity.getBody() != null ) {
|
||||
return JSONObject.parseObject(responseEntity.getBody());
|
||||
return ServerResponse.createBySuccess(JSONObject.parseObject(responseEntity.getBody()).getJSONObject("data"));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user