添加定时任务——insert时间完整性
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
package com.ruoyi.quartz.service.impl;
|
package com.ruoyi.quartz.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.EncryptDecryptUtil;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.quickssl.api.CryptoClient;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.quartz.domain.SysJobLog;
|
import com.ruoyi.quartz.domain.SysJobLog;
|
||||||
@@ -17,6 +22,8 @@ public class SysJobLogServiceImpl implements ISysJobLogService
|
|||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysJobLogMapper jobLogMapper;
|
private SysJobLogMapper jobLogMapper;
|
||||||
|
@Autowired
|
||||||
|
private EncryptDecryptUtil encryptDecryptUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取quartz调度器日志的计划任务
|
* 获取quartz调度器日志的计划任务
|
||||||
@@ -50,6 +57,10 @@ public class SysJobLogServiceImpl implements ISysJobLogService
|
|||||||
@Override
|
@Override
|
||||||
public void addJobLog(SysJobLog jobLog)
|
public void addJobLog(SysJobLog jobLog)
|
||||||
{
|
{
|
||||||
|
String createTime= DateUtils.getTime();
|
||||||
|
String createTimeCipher=saveCrateTimeSm3(createTime);
|
||||||
|
jobLog.setCreateTimeCipher(createTimeCipher);
|
||||||
|
jobLog.setCreateTime(createTime);
|
||||||
jobLogMapper.insertJobLog(jobLog);
|
jobLogMapper.insertJobLog(jobLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,4 +95,21 @@ public class SysJobLogServiceImpl implements ISysJobLogService
|
|||||||
{
|
{
|
||||||
jobLogMapper.cleanJobLog();
|
jobLogMapper.cleanJobLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间完整性
|
||||||
|
* @param createTime
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String saveCrateTimeSm3(String createTime) {
|
||||||
|
if (StringUtils.isBlank(createTime)) {
|
||||||
|
throw new RuntimeException("加密失败:createTime 不能为空");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return encryptDecryptUtil.sm3Hash(createTime);
|
||||||
|
} catch (CryptoClient.CryptoException e) {
|
||||||
|
System.out.println("createTime加密失败"+e);
|
||||||
|
throw new RuntimeException("加密失败:" + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user