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

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

@@ -1,15 +1,14 @@
package com.ruoyi.framework.manager.factory;
import java.util.Date;
import java.util.TimerTask;
import com.ruoyi.cms.domain.BussinessOperLog;
import com.ruoyi.cms.service.IBussinessOperLogService;
import com.ruoyi.common.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.LogUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.AddressUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
@@ -77,6 +76,16 @@ public class AsyncFactory
{
logininfor.setStatus(Constants.FAIL);
}
try {
String loginTime=DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,new Date());
String userNameCipher=SpringUtils.getBean(EncryptDecryptUtil.class).sm3Hash(username);
String operTimeCipher=SpringUtils.getBean(EncryptDecryptUtil.class).sm3Hash(loginTime);
logininfor.setUserNameCipher(userNameCipher);
logininfor.setLoginTimeCipher(operTimeCipher);
logininfor.setLoginTime(loginTime);
}catch (org.quickssl.api.CryptoClient.CryptoException e) {
throw new RuntimeException(e);
}
// 插入数据
SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor);
}
@@ -97,6 +106,16 @@ public class AsyncFactory
public void run()
{
// 远程查询操作地点
try {
String createTime=DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,new Date());
String operTimeCipher=SpringUtils.getBean(EncryptDecryptUtil.class).sm3Hash(createTime);
String operNameCipher=SpringUtils.getBean(EncryptDecryptUtil.class).sm3Hash(operLog.getOperName());
operLog.setOperTimeCipher(operTimeCipher);
operLog.setOperNameCipher(operNameCipher);
operLog.setOperTime(createTime);
}catch (org.quickssl.api.CryptoClient.CryptoException e) {
throw new RuntimeException(e);
}
operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog);
}
@@ -112,6 +131,16 @@ public class AsyncFactory
public void run()
{
// 远程查询操作地点
try {
String operTime=DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,new Date());
String operNameCipher=SpringUtils.getBean(EncryptDecryptUtil.class).sm3Hash(operLog.getOperName());
String operTimeCipher=SpringUtils.getBean(EncryptDecryptUtil.class).sm3Hash(operTime);
operLog.setOperNameCipher(operNameCipher);
operLog.setOperTimeCipher(operTimeCipher);
operLog.setOperTime(operTime);
}catch (org.quickssl.api.CryptoClient.CryptoException e) {
throw new RuntimeException(e);
}
operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
SpringUtils.getBean(IBussinessOperLogService.class).insertOperlog(operLog);
}