|
|
@@ -996,8 +996,19 @@ public class CoinServiceImpl implements CoinService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Async
|
|
|
- public void syncCexFlag() {
|
|
|
- List<CoinWatchlistOther> watchlistOtherList = coinMapper.findAllCoinWatchlistOther();
|
|
|
+ public void syncCexFlag(String symbol) {
|
|
|
+ List<CoinWatchlistOther> watchlistOtherList;
|
|
|
+ if (StringUtils.isNotEmpty(symbol)) {
|
|
|
+ CoinWatchlistOther watchlistOther = coinMapper.findWatchlistOtherBySymbol2(symbol);
|
|
|
+ if (watchlistOther == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ watchlistOtherList = new ArrayList<>();
|
|
|
+ watchlistOtherList.add(watchlistOther);
|
|
|
+ } else {
|
|
|
+ watchlistOtherList = coinMapper.findAllCoinWatchlistOther();
|
|
|
+ }
|
|
|
|
|
|
// Perpetual
|
|
|
String coingeckoExchangeFuturesTickersUrl = InitRunner.dicCodeMap.get("coingecko_exchange_futures_tickers_url").getCodeValue();
|
|
|
@@ -1189,8 +1200,13 @@ public class CoinServiceImpl implements CoinService {
|
|
|
JSONObject jsonObject = dataJO.getJSONObject(String.valueOf(key));
|
|
|
value.setTotalMarketRanking(jsonObject.getInteger("cmc_rank"));
|
|
|
|
|
|
- BigDecimal totalMarketValue = jsonObject.getJSONObject("quote").getJSONObject("USD").getBigDecimal("market_cap").setScale(2, RoundingMode.HALF_UP);
|
|
|
- if (totalMarketValue.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ BigDecimal totalMarketValue;
|
|
|
+ try {
|
|
|
+ totalMarketValue = jsonObject.getJSONObject("quote").getJSONObject("USD").getBigDecimal("market_cap").setScale(2, RoundingMode.HALF_UP);
|
|
|
+ if (totalMarketValue.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ totalMarketValue = jsonObject.getBigDecimal("self_reported_market_cap").setScale(2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
totalMarketValue = jsonObject.getBigDecimal("self_reported_market_cap").setScale(2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
value.setTotalMarketValue(totalMarketValue);
|
|
|
@@ -1224,13 +1240,13 @@ public class CoinServiceImpl implements CoinService {
|
|
|
coinWatchlistOther.setTotalSupply(jsonObject.getBigDecimal("total_supply").setScale(0, RoundingMode.HALF_UP).toPlainString());
|
|
|
}
|
|
|
JSONObject usdQuote = jsonObject.getJSONObject("quote").getJSONObject("USD");
|
|
|
- if (null != usdQuote.get("market_cap")) {
|
|
|
+ if (usdQuote != null && null != usdQuote.get("market_cap")) {
|
|
|
coinWatchlistOther.setMarketCap(usdQuote.getBigDecimal("market_cap").setScale(0, RoundingMode.HALF_UP).toPlainString());
|
|
|
if ("0".equals(coinWatchlistOther.getMarketCap()) && null != jsonObject.get("self_reported_market_cap")) {
|
|
|
coinWatchlistOther.setMarketCap(jsonObject.getBigDecimal("self_reported_market_cap").setScale(0, RoundingMode.HALF_UP).toPlainString());
|
|
|
}
|
|
|
}
|
|
|
- if (null != usdQuote.get("fully_diluted_market_cap")) {
|
|
|
+ if (usdQuote != null && null != usdQuote.get("fully_diluted_market_cap")) {
|
|
|
coinWatchlistOther.setFullyDilutedMarketCap(usdQuote.getBigDecimal("fully_diluted_market_cap").setScale(0, RoundingMode.HALF_UP).toPlainString());
|
|
|
}
|
|
|
|
|
|
@@ -2273,7 +2289,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
//Map<Long, CoinWatchlist> coinWatchlistMap4CmcId = watchlistList.stream().collect(Collectors.toMap(CoinWatchlist::getCmcId, coinWatchlist -> coinWatchlist));
|
|
|
// parseWatchlistMap4CmC(coinWatchlistMap4CmcId);
|
|
|
|
|
|
- syncCexFlag();
|
|
|
+ syncCexFlag("PONKE");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -2291,6 +2307,9 @@ public class CoinServiceImpl implements CoinService {
|
|
|
List<CoinWatchlist> watchlistListCMC = coinMapper.findWatchlistList(params);
|
|
|
Map<Long, CoinWatchlist> coinWatchlistMap4CmcId = watchlistListCMC.stream().collect(Collectors.toMap(CoinWatchlist::getCmcId, coinWatchlist -> coinWatchlist));
|
|
|
parseWatchlistMap4CmC(coinWatchlistMap4CmcId);
|
|
|
+
|
|
|
+ // 初始化cexflag信息
|
|
|
+ syncCexFlag(coinWatchlist2.getSymbol());
|
|
|
}
|
|
|
|
|
|
public String convertHumanReadable(String number) {
|