diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index e0175f4..669a2cb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -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 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); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index 6ca78cf..5354c67 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -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 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); } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 49a38c5..d28bc01 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -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: diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/BussinessOperlogController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/BussinessOperlogController.java index ec89663..613f8ee 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/BussinessOperlogController.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/BussinessOperlogController.java @@ -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 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); } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsJobController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsJobController.java index 61f5004..5cb30d3 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsJobController.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsJobController.java @@ -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)); } + + } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/BussinessOperLog.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/BussinessOperLog.java index d813ec6..879bddb 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/BussinessOperLog.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/BussinessOperLog.java @@ -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; } \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/resources/mapper/app/BussinessOperLogMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/app/BussinessOperLogMapper.xml index e5dec31..ff772c1 100644 --- a/ruoyi-bussiness/src/main/resources/mapper/app/BussinessOperLogMapper.xml +++ b/ruoyi-bussiness/src/main/resources/mapper/app/BussinessOperLogMapper.xml @@ -25,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 - 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}) - 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 AND ipaddr like concat('%', #{ipaddr}, '%') diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml index 201db07..a3cf484 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -25,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 - 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})