|
|
@@ -244,7 +244,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public JSONArray mainSearch(JSONObject params) {
|
|
|
+ public JSONArray mainSearch(JSONObject params) throws Exception {
|
|
|
JSONArray result = new JSONArray();
|
|
|
if (params.getString("nameEn").equals("allPositionv2")) {
|
|
|
Map<String, String> paramMap = new HashMap<>();
|
|
|
@@ -274,11 +274,24 @@ public class CoinServiceImpl implements CoinService {
|
|
|
|
|
|
renderMainSearch4OrderHistoryProductType(historyOrderList);
|
|
|
result = (JSONArray) JSON.toJSON(historyOrderList);
|
|
|
+ } else if (params.getString("nameEn").equals("monitorCurrency")) {
|
|
|
+ List<String> monitorCurrencyList = coinMapper.findMonitorCurrencyList();
|
|
|
+
|
|
|
+ beforeProxy();
|
|
|
+ String requestUrl = mainUrl + params.getString("url");
|
|
|
+ Connection.Response response = JsoupUtil.requestBody(requestUrl, JsoupUtil.HTTP_GET, proxy, null, null);
|
|
|
+ result = JSONObject.parseObject(response.body()).getJSONArray("data");
|
|
|
+
|
|
|
+ result = renderMainSearch4MonitorCurrency(result, monitorCurrencyList);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private JSONArray renderMainSearch4MonitorCurrency(JSONArray result, List<String> monitorCurrencyList) {
|
|
|
+ return result.stream().filter(iter -> monitorCurrencyList.contains(((JSONObject) iter).getString("symbol"))).collect(Collectors.toCollection(JSONArray::new));
|
|
|
+ }
|
|
|
+
|
|
|
private void renderMainSearch4OrderHistoryProductType(List<CoinHistoryOrder> historyOrderList) {
|
|
|
for (CoinHistoryOrder coinHistoryOrder : historyOrderList) {
|
|
|
coinHistoryOrder.setCTime(DateUtils.longToString(Long.valueOf(coinHistoryOrder.getCTime())));
|