添加日志的操作人和时间的完整性

This commit is contained in:
sh
2026-02-04 23:13:13 +08:00
parent f7f31ae0fa
commit a5af4b6615
17 changed files with 361 additions and 25 deletions

View File

@@ -43,6 +43,10 @@ public class SysJobLog extends BaseEntity
@Excel(name = "异常信息")
private String exceptionInfo;
/**时间加密字段*/
@Excel(name = "时间加密字段")
private String createTimeCipher;
/** 开始时间 */
private Date startTime;
@@ -139,6 +143,14 @@ public class SysJobLog extends BaseEntity
this.stopTime = stopTime;
}
public String getCreateTimeCipher() {
return createTimeCipher;
}
public void setCreateTimeCipher(String createTimeCipher) {
this.createTimeCipher = createTimeCipher;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -150,6 +162,7 @@ public class SysJobLog extends BaseEntity
.append("exceptionInfo", getExceptionInfo())
.append("startTime", getStartTime())
.append("stopTime", getStopTime())
.append("createTimeCipher", getCreateTimeCipher())
.toString();
}
}

View File

@@ -1,6 +1,9 @@
package com.ruoyi.quartz.util;
import java.util.Date;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.EncryptDecryptUtil;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@@ -91,7 +94,14 @@ public abstract class AbstractQuartzJob implements Job
{
sysJobLog.setStatus(Constants.SUCCESS);
}
try {
String createTime=DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,startTime);
String createTimeCipher =SpringUtils.getBean(EncryptDecryptUtil.class).sm3Hash(createTime);
sysJobLog.setCreateTimeCipher(createTimeCipher);
sysJobLog.setCreateTime(createTime);
}catch (org.quickssl.api.CryptoClient.CryptoException ex){
ex.printStackTrace();
}
// 写入数据库当中
SpringUtils.getBean(ISysJobLogService.class).addJobLog(sysJobLog);
}

View File

@@ -78,7 +78,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="jobMessage != null and jobMessage != ''">job_message,</if>
<if test="status != null and status != ''">status,</if>
<if test="exceptionInfo != null and exceptionInfo != ''">exception_info,</if>
create_time
<if test="createTimeCipher != null">create_time_cipher,</if>
<if test="createTime != null">create_time</if>
)values(
<if test="jobLogId != null and jobLogId != 0">#{jobLogId},</if>
<if test="jobName != null and jobName != ''">#{jobName},</if>
@@ -87,7 +88,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
sysdate()
<if test="createTimeCipher != null">#{createTimeCipher},</if>
<if test="createTime != null">#{createTime}</if>
)
</insert>