添加日志的操作人和时间的完整性
This commit is contained in:
@@ -2,6 +2,9 @@ package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.utils.EncryptDecryptUtil;
|
||||
import org.quickssl.api.CryptoClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
@@ -34,6 +37,8 @@ public class SysLogininforController extends BaseController
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
@Autowired
|
||||
private EncryptDecryptUtil encryptDecryptUtil;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||
@GetMapping("/list")
|
||||
@@ -41,6 +46,21 @@ public class SysLogininforController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
for(SysLogininfor sysLogininfor:list){
|
||||
boolean verifyName;
|
||||
boolean verifyTime;
|
||||
try {
|
||||
verifyName=encryptDecryptUtil.sm3Verify(sysLogininfor.getUserName(),sysLogininfor.getUserNameCipher());
|
||||
verifyTime=encryptDecryptUtil.sm3Verify(sysLogininfor.getLoginTime(),sysLogininfor.getLoginTimeCipher());
|
||||
} catch (CryptoClient.CryptoException e) {
|
||||
verifyName = false;
|
||||
verifyTime = false;
|
||||
}
|
||||
if(!verifyTime || !verifyName){
|
||||
System.out.println("完整性校验失败:{}==========="+sysLogininfor.getInfoId());
|
||||
return error(500,"日志数据已被篡改,请联系管理员确定!");
|
||||
}
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.utils.EncryptDecryptUtil;
|
||||
import org.quickssl.api.CryptoClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
@@ -30,6 +33,8 @@ public class SysOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
@Autowired
|
||||
private EncryptDecryptUtil encryptDecryptUtil;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
@@ -37,6 +42,21 @@ public class SysOperlogController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
for(SysOperLog sysOperLog:list){
|
||||
boolean verifyName;
|
||||
boolean verifyTime;
|
||||
try {
|
||||
verifyName=encryptDecryptUtil.sm3Verify(sysOperLog.getOperName(),sysOperLog.getOperNameCipher());
|
||||
verifyTime=encryptDecryptUtil.sm3Verify(sysOperLog.getOperTime(),sysOperLog.getOperTimeCipher());
|
||||
} catch (CryptoClient.CryptoException e) {
|
||||
verifyName = false;
|
||||
verifyTime = false;
|
||||
}
|
||||
if(!verifyTime || !verifyName){
|
||||
System.out.println("完整性校验失败:{}==========="+sysOperLog.getOperId());
|
||||
return error(500,"日志数据已被篡改,请联系管理员确定!");
|
||||
}
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -147,6 +147,10 @@ ocr:
|
||||
ocr_llm_url: http://39.98.44.136:6016/inner-ai/aicoapi/gateway/v2/chatbot/api_run/1763386387_d4c07131-a047-4c0d-9623-7e3c3a45bd7e
|
||||
ocr_llm_apiKey: NfzPnFRtogHlYCAh2hHIB7ra5EsrSQEM
|
||||
|
||||
cipher-security:
|
||||
socket: 39.106.16.89:11028
|
||||
path: /data/downloadmodel/cert
|
||||
|
||||
#nginx节点健康检查
|
||||
management:
|
||||
endpoints:
|
||||
|
||||
@@ -7,9 +7,11 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.EncryptDecryptUtil;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.quickssl.api.CryptoClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -29,6 +31,8 @@ public class BussinessOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBussinessOperLogService operLogService;
|
||||
@Autowired
|
||||
private EncryptDecryptUtil encryptDecryptUtil;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
@@ -37,6 +41,21 @@ public class BussinessOperlogController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<BussinessOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
for(BussinessOperLog bussinessOperLog:list){
|
||||
boolean verifyName;
|
||||
boolean verifyTime;
|
||||
try {
|
||||
verifyName=encryptDecryptUtil.sm3Verify(bussinessOperLog.getOperName(),bussinessOperLog.getOperNameCipher());
|
||||
verifyTime=encryptDecryptUtil.sm3Verify(bussinessOperLog.getOperTime(),bussinessOperLog.getOperTimeCipher());
|
||||
} catch (CryptoClient.CryptoException e) {
|
||||
verifyName = false;
|
||||
verifyTime = false;
|
||||
}
|
||||
if(!verifyTime || !verifyName){
|
||||
System.out.println("完整性校验失败:{}==========="+bussinessOperLog.getOperId());
|
||||
return error(500,"日志数据已被篡改,请联系管理员确定!");
|
||||
}
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.EncryptDecryptUtil;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
@@ -27,6 +28,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.quickssl.api.CryptoClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -66,6 +68,8 @@ public class CmsJobController extends BaseController
|
||||
private IJobApplyService iJobApplyService;
|
||||
@Autowired
|
||||
private IAppReviewJobService iAppReviewJobService;
|
||||
@Autowired
|
||||
private EncryptDecryptUtil encryptDecryptUtil;
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*/
|
||||
@@ -455,10 +459,15 @@ public class CmsJobController extends BaseController
|
||||
|
||||
@ApiOperation("岗位上架")
|
||||
@PutMapping("/jobUp/{jobId}")
|
||||
public AjaxResult jobUp(@PathVariable("jobId") Long jobId){
|
||||
public AjaxResult jobUp(@PathVariable("jobId") Long jobId) throws CryptoClient.CryptoException {
|
||||
String aa=encryptDecryptUtil.sm3Hash("2026-02-04 19:10:13");
|
||||
System.out.println(aa);
|
||||
System.out.println(encryptDecryptUtil.sm3Verify("2026-02-04 19:10:13",aa));
|
||||
if(jobId==null){
|
||||
return error("岗位id为空");
|
||||
}
|
||||
return toAjax(jobService.jobUp(jobId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class BussinessOperLog extends BaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("操作时间")
|
||||
private Date operTime;
|
||||
private String operTime;
|
||||
|
||||
@Excel(name = "消耗时间")
|
||||
@ApiModelProperty("消耗时间")
|
||||
@@ -95,4 +95,10 @@ public class BussinessOperLog extends BaseEntity
|
||||
|
||||
@ApiModelProperty("业务类型数组")
|
||||
private Integer[] businessTypes;
|
||||
|
||||
@ApiModelProperty("时间完整性")
|
||||
private String operTimeCipher;
|
||||
|
||||
@ApiModelProperty("操作人完整性")
|
||||
private String operNameCipher;
|
||||
}
|
||||
@@ -25,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOperLogVo">
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time,oper_time_cipher,oper_name_cipher
|
||||
from bussiness_oper_log
|
||||
</sql>
|
||||
|
||||
<insert id="insertOperlog" parameterType="BussinessOperLog">
|
||||
insert into bussiness_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time)
|
||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
|
||||
insert into bussiness_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time,oper_time_cipher,oper_name_cipher)
|
||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime},#{operTime},#{operTimeCipher},#{operNameCipher})
|
||||
</insert>
|
||||
|
||||
<select id="selectOperLogList" parameterType="BussinessOperLog" resultMap="SysOperLogResult">
|
||||
|
||||
@@ -121,13 +121,13 @@
|
||||
</dependency>
|
||||
|
||||
<!--奇安信密码机-->
|
||||
<!--<dependency>
|
||||
<dependency>
|
||||
<groupId>org.quickssl</groupId>
|
||||
<artifactId>quickapi-client-java</artifactId>
|
||||
<version>1.5.11-SNAPSHOT</version>
|
||||
<classifier>shaded</classifier>
|
||||
<scope>compile</scope>
|
||||
</dependency>-->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quick.api.grpc.v1.MacAlg;
|
||||
import org.quick.api.grpc.v1.SymAlg;
|
||||
import org.quick.api.grpc.v1.SymAlgPaddingMode;
|
||||
import org.quickssl.api.CryptoClient;
|
||||
import org.quickssl.api.CryptoHelper;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* 加解密工具
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EncryptDecryptUtil {
|
||||
|
||||
/**
|
||||
* socket ip:port
|
||||
*/
|
||||
@Value(value = "${cipher-security.socket}")
|
||||
private String socket;
|
||||
/**
|
||||
* path 证书绝对路径
|
||||
*/
|
||||
@Value(value = "${cipher-security.path}")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 密钥标识
|
||||
*/
|
||||
private static final String CIPHER_IDENTIFICATION = "default";
|
||||
/**
|
||||
* IV
|
||||
*/
|
||||
private static final String IV = "1234567812345678";
|
||||
|
||||
|
||||
// 初始化加密配置
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
try {
|
||||
String pem = path + File.separator + "cacert.pem";
|
||||
String pfx = path + File.separator + "client.pfx";
|
||||
CryptoClient.Config config = CryptoClient.Config.newBuilder()
|
||||
.setSocket(socket)
|
||||
.setCaCertFile(pem)
|
||||
.setKeyStoreFile(pfx)
|
||||
.build();
|
||||
CryptoHelper.initConfig(config);
|
||||
} catch (CryptoClient.CryptoException e) {
|
||||
log.error("奇安信国密安全密码应用中间件初始化失败:", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sm4加密
|
||||
*
|
||||
* @param originData 源数据
|
||||
* @return 密文数据
|
||||
*/
|
||||
public String sm4Encrypt(String originData) throws CryptoClient.CryptoException {
|
||||
return sm4Encrypt(CIPHER_IDENTIFICATION, originData);
|
||||
}
|
||||
|
||||
/**
|
||||
* sm4加密
|
||||
*
|
||||
* @param cipherIdentification 密钥标识
|
||||
* @param originData 源数据
|
||||
* @return 密文数据
|
||||
*/
|
||||
public String sm4Encrypt(String cipherIdentification, String originData)
|
||||
throws CryptoClient.CryptoException {
|
||||
byte[] cipher = CryptoHelper.symmEncrypt(cipherIdentification, SymAlg.QK_SGD_SM4_CBC,
|
||||
SymAlgPaddingMode.QK_SYMALG_PADDING_PKCS7, IV.getBytes(StandardCharsets.UTF_8),
|
||||
originData.getBytes(StandardCharsets.UTF_8));
|
||||
return Base64.getEncoder().encodeToString(cipher);
|
||||
}
|
||||
|
||||
/**
|
||||
* sm4解密
|
||||
*
|
||||
* @param cipherData 密文数据
|
||||
* @return 源数据
|
||||
*/
|
||||
public String sm4Decrypt(String cipherData) throws CryptoClient.CryptoException {
|
||||
return sm4Decrypt(CIPHER_IDENTIFICATION, cipherData);
|
||||
}
|
||||
|
||||
/**
|
||||
* sm4解密
|
||||
*
|
||||
* @param cipherIdentification 密钥标识
|
||||
* @param cipherData 密文数据
|
||||
* @return 源数据
|
||||
*/
|
||||
public String sm4Decrypt(String cipherIdentification, String cipherData)
|
||||
throws CryptoClient.CryptoException {
|
||||
byte[] origin = CryptoHelper.symmDecrypt(cipherIdentification, SymAlg.QK_SGD_SM4_CBC,
|
||||
SymAlgPaddingMode.QK_SYMALG_PADDING_PKCS7, IV.getBytes(StandardCharsets.UTF_8),
|
||||
Base64.getDecoder().decode(cipherData));
|
||||
return new String(origin);
|
||||
}
|
||||
|
||||
/**
|
||||
* sm3杂凑
|
||||
*
|
||||
* @param originData 源数据
|
||||
*/
|
||||
public String sm3Hash(String originData) throws CryptoClient.CryptoException {
|
||||
return sm3Hash(CIPHER_IDENTIFICATION, originData);
|
||||
}
|
||||
|
||||
/**
|
||||
* sm3杂凑
|
||||
*
|
||||
* @param cipherIdentification 密钥标识
|
||||
* @param originData 源数据
|
||||
* @return 杂凑数据
|
||||
*/
|
||||
public String sm3Hash(String cipherIdentification, String originData)
|
||||
throws CryptoClient.CryptoException {
|
||||
byte[] hash = CryptoHelper.calculateMAC(cipherIdentification, MacAlg.QK_HMAC_SM3,
|
||||
originData.getBytes(StandardCharsets.UTF_8));
|
||||
return Base64.getEncoder().encodeToString(hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* sm3验证
|
||||
*
|
||||
* @param originData 源数据
|
||||
* @param hashData 杂凑数据
|
||||
* @return 验证结果
|
||||
*/
|
||||
public boolean sm3Verify(String originData, String hashData) throws CryptoClient.CryptoException {
|
||||
return sm3Verify(CIPHER_IDENTIFICATION, originData, hashData);
|
||||
}
|
||||
|
||||
/**
|
||||
* sm3验证
|
||||
*
|
||||
* @param cipherIdentification 密钥标识
|
||||
* @param originData 源数据
|
||||
* @param hashData 杂凑数据
|
||||
* @return 验证结果
|
||||
*/
|
||||
public boolean sm3Verify(String cipherIdentification, String originData, String hashData)
|
||||
throws CryptoClient.CryptoException {
|
||||
return CryptoHelper.verifyMAC(cipherIdentification, MacAlg.QK_HMAC_SM3,
|
||||
originData.getBytes(StandardCharsets.UTF_8), Base64.getDecoder().decode(hashData));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -50,7 +50,12 @@ public class SysLogininfor extends BaseEntity
|
||||
/** 访问时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date loginTime;
|
||||
private String loginTime;
|
||||
|
||||
//登录时间
|
||||
public String loginTimeCipher;
|
||||
//用户名
|
||||
private String userNameCipher;
|
||||
|
||||
public Long getInfoId()
|
||||
{
|
||||
@@ -132,13 +137,29 @@ public class SysLogininfor extends BaseEntity
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Date getLoginTime()
|
||||
public String getLoginTime()
|
||||
{
|
||||
return loginTime;
|
||||
}
|
||||
|
||||
public void setLoginTime(Date loginTime)
|
||||
public void setLoginTime(String loginTime)
|
||||
{
|
||||
this.loginTime = loginTime;
|
||||
}
|
||||
|
||||
public String getLoginTimeCipher() {
|
||||
return loginTimeCipher;
|
||||
}
|
||||
|
||||
public void setLoginTimeCipher(String loginTimeCipher) {
|
||||
this.loginTimeCipher = loginTimeCipher;
|
||||
}
|
||||
|
||||
public String getUserNameCipher() {
|
||||
return userNameCipher;
|
||||
}
|
||||
|
||||
public void setUserNameCipher(String userNameCipher) {
|
||||
this.userNameCipher = userNameCipher;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,12 +81,16 @@ public class SysOperLog extends BaseEntity
|
||||
/** 操作时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date operTime;
|
||||
private String operTime;
|
||||
|
||||
/** 消耗时间 */
|
||||
@Excel(name = "消耗时间", suffix = "毫秒")
|
||||
private Long costTime;
|
||||
|
||||
//时间
|
||||
public String operTimeCipher;
|
||||
public String operNameCipher;
|
||||
|
||||
public Long getOperId()
|
||||
{
|
||||
return operId;
|
||||
@@ -247,12 +251,12 @@ public class SysOperLog extends BaseEntity
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
public Date getOperTime()
|
||||
public String getOperTime()
|
||||
{
|
||||
return operTime;
|
||||
}
|
||||
|
||||
public void setOperTime(Date operTime)
|
||||
public void setOperTime(String operTime)
|
||||
{
|
||||
this.operTime = operTime;
|
||||
}
|
||||
@@ -266,4 +270,20 @@ public class SysOperLog extends BaseEntity
|
||||
{
|
||||
this.costTime = costTime;
|
||||
}
|
||||
|
||||
public String getOperTimeCipher() {
|
||||
return operTimeCipher;
|
||||
}
|
||||
|
||||
public void setOperTimeCipher(String operTimeCipher) {
|
||||
this.operTimeCipher = operTimeCipher;
|
||||
}
|
||||
|
||||
public String getOperNameCipher() {
|
||||
return operNameCipher;
|
||||
}
|
||||
|
||||
public void setOperNameCipher(String operNameCipher) {
|
||||
this.operNameCipher = operNameCipher;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertLogininfor" parameterType="SysLogininfor">
|
||||
insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time)
|
||||
values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate())
|
||||
insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time,login_time_cipher,user_name_cipher)
|
||||
values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg},#{loginTime},#{loginTimeCipher},#{userNameCipher})
|
||||
</insert>
|
||||
|
||||
<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
|
||||
select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time from sys_logininfor
|
||||
select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time,login_time_cipher,user_name_cipher from sys_logininfor
|
||||
<where>
|
||||
<if test="ipaddr != null and ipaddr != ''">
|
||||
AND ipaddr like concat('%', #{ipaddr}, '%')
|
||||
|
||||
@@ -25,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOperLogVo">
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time,oper_time_cipher,oper_name_cipher
|
||||
from sys_oper_log
|
||||
</sql>
|
||||
|
||||
<insert id="insertOperlog" parameterType="SysOperLog">
|
||||
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time)
|
||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
|
||||
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time,oper_time_cipher,oper_name_cipher)
|
||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime},#{operTime},#{operTimeCipher},#{operNameCipher})
|
||||
</insert>
|
||||
|
||||
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
|
||||
|
||||
Reference in New Issue
Block a user