mirror of https://gitee.com/y_project/RuoYi.git
增加监控其他批处理异常情况定时任务
parent
e9cfc770c5
commit
fe8ee67030
|
@ -147,7 +147,7 @@
|
|||
</plugin> -->
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<!-- <resources>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
|
@ -155,7 +155,7 @@
|
|||
<exclude>*.xml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>-->
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
|
||||
|
|
|
@ -61,4 +61,6 @@ public interface SysJobLogMapper
|
|||
* 清空任务日志
|
||||
*/
|
||||
public void cleanJobLog();
|
||||
|
||||
Integer countJobLog(SysJobLog sysJobLogExample);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<SysJob> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -91,4 +91,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
<select id="countJobLog" resultType="java.lang.Integer">
|
||||
|
||||
select count(1) from sys_job_log s where s.create_time >= #{createTime}
|
||||
and s.job_name = #{jobName}
|
||||
|
||||
</select>
|
||||
</mapper>
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue