|
|
|
@ -147,8 +147,13 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
nftLogService.insertNftLog(nftLog); |
|
|
|
|
log.info("上链日志----->:{" + contractConfig.getUnitName() + "}{" + new Date() + "}{" + checkArgs.getIds().length + "}"); |
|
|
|
|
|
|
|
|
|
executor.execute(()->{ |
|
|
|
|
executeMakeUp(contract, contractConfig.getUnitName()); |
|
|
|
|
executor.execute(() -> { |
|
|
|
|
boolean isFalg = true; |
|
|
|
|
while (isFalg) { |
|
|
|
|
if (executeMakeUp(contract, contractConfig.getUnitName())) { |
|
|
|
|
isFalg = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
System.out.println("------------------->"); |
|
|
|
|
return AjaxResult.success("上链成功!"); |
|
|
|
@ -168,7 +173,7 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
return AjaxResult.success(map); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void executeMakeUp(String contract, String markName) { |
|
|
|
|
public boolean executeMakeUp(String contract, String markName) { |
|
|
|
|
log.info("[dispatchHandler]{}", "开始监听数据"); |
|
|
|
|
CollectConfig collect = collectConfigService.selectCollectConfigByStatus(); |
|
|
|
|
if (collect.getOnPause()) { |
|
|
|
@ -178,7 +183,7 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
//=======检查数据=======
|
|
|
|
|
List<EventParam> eventParams = new ArrayList<>(); |
|
|
|
@ -192,7 +197,7 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
eventParams.add(eventParam); |
|
|
|
|
if (CollectionUtils.isEmpty(eventParams)) { |
|
|
|
|
log.error("[dispatchHandler]{}", "没有需要监听的数据"); |
|
|
|
|
return; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Gson gson = new Gson(); |
|
|
|
@ -203,7 +208,7 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
cfx = Cfx.create(collect.getNode(), 3, 1000); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
return; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
FilterMapVO vo = getFilter(eventParams); |
|
|
|
|
//获取数据高度
|
|
|
|
@ -226,7 +231,7 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
} |
|
|
|
|
if (events == null) { |
|
|
|
|
log.info("[executeMakeUp][请重启服务]"); |
|
|
|
|
return; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
List<Log> logList = events.sendAndGet(); |
|
|
|
|
boolean isSuccess = false; |
|
|
|
@ -245,7 +250,7 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
int type = vo.getMap().get(evAddress + "-" + tokenAddress.toLowerCase()); |
|
|
|
|
if (type == 0) { |
|
|
|
|
log.info("[dispatchHandler][暂无符合条件的数据]"); |
|
|
|
|
return; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
boolean res; |
|
|
|
|
try { |
|
|
|
@ -277,10 +282,11 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
log.error("[dispatchHandler][更新高度失败]:{}", to); |
|
|
|
|
throw new RuntimeException("更新高度失败"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (logList.size() > 0) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private FilterMapVO getFilter(List<EventParam> eventParams) { |
|
|
|
|