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 812eed7..783a14d 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,6 +1,11 @@ package com.ruoyi.quartz.service.impl; 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.stereotype.Service; import com.ruoyi.quartz.domain.SysJobLog; @@ -17,6 +22,8 @@ public class SysJobLogServiceImpl implements ISysJobLogService { @Autowired private SysJobLogMapper jobLogMapper; + @Autowired + private EncryptDecryptUtil encryptDecryptUtil; /** * 获取quartz调度器日志的计划任务 @@ -50,6 +57,10 @@ public class SysJobLogServiceImpl implements ISysJobLogService @Override public void addJobLog(SysJobLog jobLog) { + String createTime= DateUtils.getTime(); + String createTimeCipher=saveCrateTimeSm3(createTime); + jobLog.setCreateTimeCipher(createTimeCipher); + jobLog.setCreateTime(createTime); jobLogMapper.insertJobLog(jobLog); } @@ -84,4 +95,21 @@ public class SysJobLogServiceImpl implements ISysJobLogService { 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); + } + } }