update 新增eth 币价定时任务
This commit is contained in:
@@ -44,7 +44,7 @@ public class NeaxPriceTask {
|
|||||||
//private String COINMARKETCAP_KEY="7b7a5fc2-795d-4900-a4db-152681382d52";
|
//private String COINMARKETCAP_KEY="7b7a5fc2-795d-4900-a4db-152681382d52";
|
||||||
|
|
||||||
|
|
||||||
private String ALL_COINS="nexa,monacoin,groestlcoin,digibyte,radiant,alephium,monero";
|
private String ALL_COINS="nexa,monacoin,groestlcoin,digibyte,radiant,alephium,monero,ethereum";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
@@ -67,6 +67,7 @@ public class NeaxPriceTask {
|
|||||||
|| StringUtils.isNull(map.get("alph"))
|
|| StringUtils.isNull(map.get("alph"))
|
||||||
|| StringUtils.isNull(map.get("monero"))
|
|| StringUtils.isNull(map.get("monero"))
|
||||||
|| StringUtils.isNull(map.get("sha3x"))
|
|| StringUtils.isNull(map.get("sha3x"))
|
||||||
|
|| StringUtils.isNull(map.get("eth"))
|
||||||
){
|
){
|
||||||
if(count >= 10){
|
if(count >= 10){
|
||||||
break;
|
break;
|
||||||
@@ -252,6 +253,30 @@ public class NeaxPriceTask {
|
|||||||
xtmVo.setValue(sha3x);
|
xtmVo.setValue(sha3x);
|
||||||
poolMapper.insertPrice("sha3x_price",date , xtmVo);
|
poolMapper.insertPrice("sha3x_price",date , xtmVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//处理eth
|
||||||
|
BigDecimal eth = map.get("eth");
|
||||||
|
if(StringUtils.isNull(eth)){
|
||||||
|
//重拿eth
|
||||||
|
eth = getResultFromNet("ethereum");
|
||||||
|
int ethCount = 1;
|
||||||
|
while (StringUtils.isNull(eth)){
|
||||||
|
if(ethCount >= 5){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
eth = getResultFromNet("ethereum");
|
||||||
|
ethCount++;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
redisService.setCacheObject("eth_price",eth);
|
||||||
|
//存入数据库
|
||||||
|
DateValueVo ethVo = new DateValueVo();
|
||||||
|
ethVo.setDate(now);
|
||||||
|
ethVo.setValue(eth);
|
||||||
|
poolMapper.insertPrice("eth_price",date , ethVo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,6 +432,8 @@ public class NeaxPriceTask {
|
|||||||
object = data.getJSONObject("14878");
|
object = data.getJSONObject("14878");
|
||||||
}else if ("monero".equalsIgnoreCase(coin)){
|
}else if ("monero".equalsIgnoreCase(coin)){
|
||||||
object = data.getJSONObject("328");
|
object = data.getJSONObject("328");
|
||||||
|
}else if("eth".equalsIgnoreCase(coin)){
|
||||||
|
object = data.getJSONObject("1027");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNull(object)){
|
if (StringUtils.isNull(object)){
|
||||||
@@ -444,6 +471,7 @@ public class NeaxPriceTask {
|
|||||||
map.put("rxd",null);
|
map.put("rxd",null);
|
||||||
map.put("alph",null);
|
map.put("alph",null);
|
||||||
map.put("monero",null);
|
map.put("monero",null);
|
||||||
|
map.put("eth",null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -473,6 +501,7 @@ public class NeaxPriceTask {
|
|||||||
JSONObject rxdObject = data.getJSONObject("22866");
|
JSONObject rxdObject = data.getJSONObject("22866");
|
||||||
JSONObject alphObject = data.getJSONObject("14878");
|
JSONObject alphObject = data.getJSONObject("14878");
|
||||||
JSONObject moneroObject = data.getJSONObject("328");
|
JSONObject moneroObject = data.getJSONObject("328");
|
||||||
|
JSONObject ethObject = data.getJSONObject("1027");
|
||||||
|
|
||||||
BigDecimal nexaPrice = getPriceByCoinIdJSONObject(nexaObject);
|
BigDecimal nexaPrice = getPriceByCoinIdJSONObject(nexaObject);
|
||||||
BigDecimal monaPrice = getPriceByCoinIdJSONObject(monaObject);
|
BigDecimal monaPrice = getPriceByCoinIdJSONObject(monaObject);
|
||||||
@@ -481,6 +510,7 @@ public class NeaxPriceTask {
|
|||||||
BigDecimal rxdPrice = getPriceByCoinIdJSONObject(rxdObject);
|
BigDecimal rxdPrice = getPriceByCoinIdJSONObject(rxdObject);
|
||||||
BigDecimal alphPrice = getPriceByCoinIdJSONObject(alphObject);
|
BigDecimal alphPrice = getPriceByCoinIdJSONObject(alphObject);
|
||||||
BigDecimal moneroPrice = getPriceByCoinIdJSONObject(moneroObject);
|
BigDecimal moneroPrice = getPriceByCoinIdJSONObject(moneroObject);
|
||||||
|
BigDecimal ethPrice = getPriceByCoinIdJSONObject(ethObject);
|
||||||
|
|
||||||
map.put("nexa",nexaPrice);
|
map.put("nexa",nexaPrice);
|
||||||
map.put("mona",monaPrice);
|
map.put("mona",monaPrice);
|
||||||
@@ -489,6 +519,7 @@ public class NeaxPriceTask {
|
|||||||
map.put("rxd",rxdPrice);
|
map.put("rxd",rxdPrice);
|
||||||
map.put("alph",alphPrice);
|
map.put("alph",alphPrice);
|
||||||
map.put("monero",moneroPrice);
|
map.put("monero",moneroPrice);
|
||||||
|
map.put("eth",ethPrice);
|
||||||
|
|
||||||
//xtm 不通过coinmarketcap 获取币价
|
//xtm 不通过coinmarketcap 获取币价
|
||||||
BlockInfo sha3xBlockInfoForXml = getSha3xBlockInfoForXml();
|
BlockInfo sha3xBlockInfoForXml = getSha3xBlockInfoForXml();
|
||||||
|
|||||||
Reference in New Issue
Block a user