diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index ce567a730..c724f7288 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -147,7 +147,7 @@ --> ${project.artifactId} - + diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java index ee0710cea..3490a4044 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java @@ -61,4 +61,6 @@ public interface SysJobLogMapper * 清空任务日志 */ public void cleanJobLog(); + + Integer countJobLog(SysJobLog sysJobLogExample); } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java index 93ae0f77b..dd2ec8dcd 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java @@ -1,8 +1,9 @@ package com.ruoyi.quartz.service; -import java.util.List; import com.ruoyi.quartz.domain.SysJobLog; +import java.util.List; + /** * 定时任务调度日志信息信息 服务层 * @@ -53,4 +54,6 @@ public interface ISysJobLogService * 清空任务日志 */ public void cleanJobLog(); + + Integer countJobLog(SysJobLog sysJobLogExample); } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java index ccd7379b9..b29cd769f 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java @@ -1,12 +1,13 @@ package com.ruoyi.quartz.service.impl; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; import com.ruoyi.common.core.text.Convert; import com.ruoyi.quartz.domain.SysJobLog; import com.ruoyi.quartz.mapper.SysJobLogMapper; import com.ruoyi.quartz.service.ISysJobLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; /** * 定时任务调度日志信息 服务层 @@ -85,4 +86,9 @@ public class SysJobLogServiceImpl implements ISysJobLogService { jobLogMapper.cleanJobLog(); } + + @Override + public Integer countJobLog(SysJobLog sysJobLogExample) { + return jobLogMapper.countJobLog(sysJobLogExample); + } } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MonitorTimerTaskStatusTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MonitorTimerTaskStatusTask.java new file mode 100644 index 000000000..555a6089a --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MonitorTimerTaskStatusTask.java @@ -0,0 +1,62 @@ +package com.ruoyi.quartz.task; + +import cn.hutool.core.date.DateUtil; +import com.ruoyi.common.core.domain.entity.ErrorLog; +import com.ruoyi.quartz.domain.SysJob; +import com.ruoyi.quartz.domain.SysJobLog; +import com.ruoyi.quartz.service.ISysJobLogService; +import com.ruoyi.quartz.service.ISysJobService; +import com.ruoyi.system.service.IErrorLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.List; + +@Component(value = "monitorTimerTaskStatusTask") +public class MonitorTimerTaskStatusTask { + + @Autowired + private ISysJobService sysJobService; + @Autowired + private ISysJobLogService sysJobLogService; + @Autowired + private IErrorLogService errorLogService; + + public void doMonitorTimerTaskStatus() { + + + SysJob sysJobExample = new SysJob(); + List sysJobs = sysJobService.selectJobList(sysJobExample); + + for (SysJob sysJob : sysJobs) { + //0=正常,1=暂停 + if ("1".equals(sysJob.getStatus())) { + continue; + } + if (104 == sysJob.getJobId() || 103 == sysJob.getJobId() || 106 == sysJob.getJobId()) { + continue; + } + + + SysJobLog sysJobLogExample = new SysJobLog(); + sysJobLogExample.setJobName(sysJob.getJobName()); + sysJobLogExample.setCreateTime(DateUtil.offsetMinute(new Date(), -5)); + Integer count = sysJobLogService.countJobLog(sysJobLogExample); + + if (count == 0) { + ErrorLog errorLog = ErrorLog.builder() + .address(sysJob.getJobName()) + .errorCode("定时任务调度异常") + .errorMsg("定时任务调度异常") + .fcu("system") + .lcu("system").build(); + + errorLogService.insertErrorLog(errorLog); + } + + } + + } + +} diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml index f1dd85d2f..ae3b71466 100644 --- a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml +++ b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml @@ -91,4 +91,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) - \ No newline at end of file + + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/bot/TgLongPollingBot.java b/ruoyi-system/src/main/java/com/ruoyi/system/bot/TgLongPollingBot.java index 34bebe21d..f4e4f247b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/bot/TgLongPollingBot.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/bot/TgLongPollingBot.java @@ -4,11 +4,12 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; import org.telegram.telegrambots.bots.TelegramLongPollingBot; import org.telegram.telegrambots.meta.api.objects.Update; import org.telegram.telegrambots.meta.exceptions.TelegramApiException; -//@Component +@Component @Slf4j public class TgLongPollingBot extends TelegramLongPollingBot { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/handler/TRX2EneryTransferHandler.java b/ruoyi-system/src/main/java/com/ruoyi/system/handler/TRX2EneryTransferHandler.java index a1cc9ce0d..fd295e9e8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/handler/TRX2EneryTransferHandler.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/handler/TRX2EneryTransferHandler.java @@ -223,7 +223,6 @@ public class TRX2EneryTransferHandler { @Transactional public void doDelegateResource(Contract contract, String txID, MonitorAddressAccount monitorAddressAccount) throws Exception { - Value value = contract.getParameter().getValue(); //转账金额需除以10的6次方精度 long amountSun = value.getAmount(); @@ -294,7 +293,27 @@ public class TRX2EneryTransferHandler { String apiKey = monitorAddressAccount.getApiKey(); String decryptPrivateKey = Dt.decrypt(encryptPrivateKey, encryptKey); - ApiWrapper apiWrapper = ApiWrapper.ofMainnet(decryptPrivateKey, apiKey); + + ApiWrapper apiWrapper = null; + try { + apiWrapper = ApiWrapper.ofMainnet(decryptPrivateKey, apiKey); + } catch (Exception e) { + String exceptionString = LogUtils.doRecursiveReversePrintStackCause(e, 5, ForwardCounter.builder().count(0).build(), 5); + +// log.error("获取交易列表异常:{}", exceptionString); + log.error("ofMainnet业务处理异常{},txid:{},exception:{}", monitorAddressAccount.getMonitorAddress(), txID, e); + ErrorLog errorLog = ErrorLog.builder() + .address(monitorAddressAccount.getMonitorAddress()) + .trxId(txID) + .errorCode("ofMainnet") + .errorMsg(exceptionString.length() > 2000 ? exceptionString.substring(0, 2000) : exceptionString) + .fcu("system") + .lcu("system").build(); + + errorLogService.insertErrorLog(errorLog); + + throw new RuntimeException(e); + } calcBalanceAndDelegate(txID, apiWrapper, accountAddress, transferCount, ownerAddress, lockPeriod, toAddress, price, sysEnergyBusiType, amount, "system");