优化代码
This commit is contained in:
@@ -2,6 +2,7 @@ package cn.stock.market.web;
|
||||
|
||||
import cn.stock.market.domain.basic.entity.BtodayStock;
|
||||
import cn.stock.market.domain.basic.service.BtodayStockService;
|
||||
import cn.stock.market.web.annotations.EncryptFilter;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -43,6 +44,8 @@ public class BTodayStockController {
|
||||
@ApiImplicitParam(name="durationtype",value = "D(1D的时候传D),D(5D的时候传D),M(3M的时候传M),Y(1Y的时候传Y),Y(5Y的时候传Y),Y(10Y的时候传Y)"),
|
||||
@ApiImplicitParam(name="duration",value = "1(1D的时候传1),5(5D的时候传5),3(3M的时候传3),1(1Y的时候传1),5(5Y的时候传5),10(10Y的时候传10)"),
|
||||
})
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
|
||||
public JSONArray getPriceChartCompanyPullView(
|
||||
@RequestParam(value = "exchange") String exchange,
|
||||
@RequestParam(value = "co_code") String coCode,
|
||||
@@ -138,6 +141,7 @@ public class BTodayStockController {
|
||||
|
||||
})
|
||||
@GetMapping("/api/bToday/stockDetail")
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
public com.alibaba.fastjson.JSONObject getPriceChartCompanyPullView(
|
||||
@RequestParam(value = "exchange") String exchange,
|
||||
@RequestParam(value = "co_code") String coCode
|
||||
|
||||
@@ -8,6 +8,7 @@ import cn.stock.market.dto.StockHistoryResponse;
|
||||
import cn.stock.market.infrastructure.db.po.QMoneyStockPO;
|
||||
import cn.stock.market.utils.RequestCacheUtils;
|
||||
import cn.stock.market.utils.ServerResponse;
|
||||
import cn.stock.market.web.annotations.EncryptFilter;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
@@ -167,6 +168,8 @@ public class MoneyApiController {
|
||||
})
|
||||
@GetMapping("/api/market/money/getStockDetail")
|
||||
@ResponseBody
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
|
||||
public ServerResponse getStockDetail(@RequestParam String stockType, @RequestParam String symbol ) {
|
||||
String url = String.format("https://priceapi.moneycontrol.com/pricefeed/%s/equitycash/%s",stockType,symbol);
|
||||
MoneyStock moneyStock = moneyStockRepository.findOne(QMoneyStockPO.moneyStockPO.stockType.eq(stockType).and(QMoneyStockPO.moneyStockPO.moneyScId.eq(symbol))).orElse(null);
|
||||
@@ -501,6 +504,8 @@ public class MoneyApiController {
|
||||
})
|
||||
@GetMapping("/api/market/money/getTopGainer")
|
||||
@ResponseBody
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
|
||||
public List<MoneyStockSuggestDTO> getTopGainer(@RequestParam String stockType) {
|
||||
List<MoneyStockSuggestDTO> moneyStockSuggestDTOS = null;
|
||||
// 尝试从缓存中获取结果
|
||||
@@ -542,6 +547,8 @@ public class MoneyApiController {
|
||||
})
|
||||
@GetMapping("/api/market/money/getTopLoser")
|
||||
@ResponseBody
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
|
||||
public List<MoneyStockSuggestDTO> getTopLoser(@RequestParam String stockType) {
|
||||
List<MoneyStockSuggestDTO> moneyStockSuggestDTOS = null;
|
||||
moneyStockSuggestDTOS = loserStockSuggestCache.getIfPresent(stockType);
|
||||
@@ -590,6 +597,8 @@ public class MoneyApiController {
|
||||
})
|
||||
@GetMapping("/api/market/money/getTopActives")
|
||||
@ResponseBody
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
|
||||
public List<MoneyStockSuggestDTO> getTopActive(@RequestParam String stockType) {
|
||||
List<MoneyStockSuggestDTO> moneyStockSuggestDTOS = null;
|
||||
moneyStockSuggestDTOS = activesStockSuggestCache.getIfPresent(stockType);
|
||||
@@ -639,6 +648,7 @@ public class MoneyApiController {
|
||||
@ApiImplicitParam(name = "currencyCode", value = "INR 不变", required = true, dataType = "String", paramType = "query")
|
||||
})
|
||||
@ResponseBody
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
public ResponseEntity<StockHistoryResponse> getStockHistory( @RequestParam String symbol,
|
||||
@RequestParam String resolution
|
||||
) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.stock.market.web;
|
||||
|
||||
import cn.stock.market.infrastructure.api.TodayApis;
|
||||
import cn.stock.market.utils.ServerResponse;
|
||||
import cn.stock.market.web.annotations.EncryptFilter;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -17,6 +18,7 @@ public class TodayApiController {
|
||||
@RequestMapping({"getTopGainers.do"})
|
||||
@ApiOperation(value = "获取Top Gainers",notes = "exchange传nse或者bse", httpMethod = "GET")
|
||||
@ResponseBody
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
public ServerResponse getTopGainers(@RequestParam("exchange") String exchange) {
|
||||
return ServerResponse.createBySuccess(TodayApis.getTopGainers(exchange));
|
||||
}
|
||||
@@ -24,6 +26,7 @@ public class TodayApiController {
|
||||
@RequestMapping({"getTopLosers.do"})
|
||||
@ApiOperation(value = "获取 Top Losers",notes = "exchange传nse或者bse", httpMethod = "GET")
|
||||
@ResponseBody
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
public ServerResponse getTopLosers(@RequestParam("exchange") String exchange) {
|
||||
return ServerResponse.createBySuccess(TodayApis.getTopLosers(exchange));
|
||||
}
|
||||
@@ -31,6 +34,7 @@ public class TodayApiController {
|
||||
@RequestMapping({"getMostActiveVolume.do"})
|
||||
@ApiOperation(value = "获取 Most Active Volume",notes = "exchange传nse或者bse", httpMethod = "GET")
|
||||
@ResponseBody
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
public ServerResponse getMostActiveVolume(@RequestParam("exchange") String exchange) {
|
||||
return ServerResponse.createBySuccess(TodayApis.getMostActiveVolume(exchange));
|
||||
}
|
||||
@@ -38,6 +42,7 @@ public class TodayApiController {
|
||||
@RequestMapping({"getMostActiveValue.do"})
|
||||
@ApiOperation(value = "获取 Most Active Value",notes = "exchange传nse或者bse",httpMethod = "GET")
|
||||
@ResponseBody
|
||||
@EncryptFilter(decryptRequest = false)
|
||||
public ServerResponse getMostActiveValue(@RequestParam("exchange") String exchange) {
|
||||
return ServerResponse.createBySuccess(TodayApis.getMostActiveValue(exchange));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user