Procházet zdrojové kódy

controller补全操作日志

xusl před 1 rokem
rodič
revize
140dc75fd7
25 změnil soubory, kde provedl 172 přidání a 92 odebrání
  1. 4 1
      backend/src/main/java/com/jiayue/ssi/annotation/OperateLog.java
  2. 2 0
      backend/src/main/java/com/jiayue/ssi/aspectj/OperateLogAspect.java
  3. 20 0
      backend/src/main/java/com/jiayue/ssi/backenum/BusinessType.java
  4. 3 1
      backend/src/main/java/com/jiayue/ssi/config/MyAuthenticationProvider.java
  5. 2 1
      backend/src/main/java/com/jiayue/ssi/controller/ElectricFieldController.java
  6. 4 0
      backend/src/main/java/com/jiayue/ssi/controller/ForecastPowerShortTermController.java
  7. 3 2
      backend/src/main/java/com/jiayue/ssi/controller/IpBlacklistController.java
  8. 4 0
      backend/src/main/java/com/jiayue/ssi/controller/NwpController.java
  9. 4 0
      backend/src/main/java/com/jiayue/ssi/controller/ServerController.java
  10. 5 0
      backend/src/main/java/com/jiayue/ssi/controller/SysAlarmController.java
  11. 2 1
      backend/src/main/java/com/jiayue/ssi/controller/SysApproveController.java
  12. 4 2
      backend/src/main/java/com/jiayue/ssi/controller/SysLogininforController.java
  13. 6 3
      backend/src/main/java/com/jiayue/ssi/controller/SysMenuController.java
  14. 4 2
      backend/src/main/java/com/jiayue/ssi/controller/SysOperlogController.java
  15. 4 3
      backend/src/main/java/com/jiayue/ssi/controller/SysParameterController.java
  16. 2 1
      backend/src/main/java/com/jiayue/ssi/controller/SysPolicyController.java
  17. 6 3
      backend/src/main/java/com/jiayue/ssi/controller/SysRoleController.java
  18. 11 8
      backend/src/main/java/com/jiayue/ssi/controller/SysUserController.java
  19. 3 0
      backend/src/main/java/com/jiayue/ssi/controller/UserLoginController.java
  20. 11 0
      backend/src/main/java/com/jiayue/ssi/entity/SysOperLog.java
  21. 1 1
      backend/src/main/java/com/jiayue/ssi/filter/MailCodeFilter.java
  22. 2 1
      backend/src/main/java/com/jiayue/ssi/filter/VerifyCodeFilter.java
  23. 1 1
      backend/src/main/java/com/jiayue/ssi/filter/VerifySmFilter.java
  24. 14 8
      backend/src/test/java/com/jiayue/ssi/service/Sm2UiTest.java
  25. 50 53
      ui/src/App.vue

+ 4 - 1
backend/src/main/java/com/jiayue/ssi/annotation/OperateLog.java

@@ -26,7 +26,10 @@ public @interface OperateLog
      * 功能
      */
     public BusinessType businessType() default BusinessType.OTHER;
-
+    /**
+     * 操作描述
+     */
+    public String operdesc() default "";
     /**
      * 审计类型
      */

+ 2 - 0
backend/src/main/java/com/jiayue/ssi/aspectj/OperateLogAspect.java

@@ -141,6 +141,8 @@ public class OperateLogAspect {
         operLog.setBusinessType(log.businessType().ordinal());
         // 设置标题
         operLog.setTitle(log.title());
+        // 操作描述
+        operLog.setOperdesc(log.operdesc());
         // 审计类型
         operLog.setAuditType(log.auditType().ordinal());
         // 设置操作人类别

+ 20 - 0
backend/src/main/java/com/jiayue/ssi/backenum/BusinessType.java

@@ -8,9 +8,21 @@ package com.jiayue.ssi.backenum;
 public enum BusinessType
 {
     /**
+     * 查询
+     */
+    QUERY,
+    /**
+     * 解锁
+     */
+    UNLOCK,
+    /**
      * 其它
      */
     OTHER,
+    /**
+     * 初始/重置密码
+     */
+    RESETPWD,
 
     /**
      * 新增
@@ -21,6 +33,10 @@ public enum BusinessType
      * 修改
      */
     UPDATE,
+    /**
+     * 个人密码修改
+     */
+    PWDUPDATE,
 
     /**
      * 删除
@@ -31,6 +47,10 @@ public enum BusinessType
      * 授权
      */
     GRANT,
+    /**
+     * 获取角色信息
+     */
+    GETROLE,
 
     /**
      * 导出

+ 3 - 1
backend/src/main/java/com/jiayue/ssi/config/MyAuthenticationProvider.java

@@ -3,6 +3,7 @@ package com.jiayue.ssi.config;
 import cn.hutool.crypto.SmUtil;
 import com.jiayue.ssi.constant.SecretKeyConstants;
 import com.jiayue.ssi.util.SM2CryptUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
@@ -18,6 +19,7 @@ import javax.annotation.Resource;
 * @author xsl
 * @since 2023/03/13
 */
+@Slf4j
 public class MyAuthenticationProvider extends DaoAuthenticationProvider {
 
     @Resource
@@ -36,7 +38,7 @@ public class MyAuthenticationProvider extends DaoAuthenticationProvider {
             try {
                 decryptPassword= SmUtil.sm3(presentedPassword).toUpperCase();
             } catch (Exception e) {
-                e.printStackTrace();
+                log.error("用户密码解密错误,无法登录!");
             }
 //            if (!this.passwordEncoder.matches(decryptPassword, userDetails.getPassword())) {
 //                this.logger.debug("Authentication failed: password does not match stored value");

+ 2 - 1
backend/src/main/java/com/jiayue/ssi/controller/ElectricFieldController.java

@@ -37,6 +37,7 @@ public class ElectricFieldController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('biz:electric:getAll')")
+    @OperateLog(title = "场站管理", businessType = BusinessType.QUERY, auditType = AuditType.BIZ,operdesc = "查询场站信息")
     @PreventReplay
     public ResponseVO getAll() throws CustomException {
         try {
@@ -51,7 +52,7 @@ public class ElectricFieldController {
      * 保存场站
      */
     @PostMapping
-    @OperateLog(title = "场站信息", businessType = BusinessType.UPDATE, auditType = AuditType.BIZ)
+    @OperateLog(title = "场站信息", businessType = BusinessType.UPDATE, auditType = AuditType.BIZ,operdesc = "保存场站信息")
     @PreAuthorize("@ss.hasPermi('biz:electric:update')")
     @PreventReplay
     public ResponseVO update(@RequestBody ElectricField electricField) throws CustomException {

+ 4 - 0
backend/src/main/java/com/jiayue/ssi/controller/ForecastPowerShortTermController.java

@@ -3,7 +3,10 @@ package com.jiayue.ssi.controller;
 import cn.hutool.core.util.NumberUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jiayue.ssi.annotation.OperateLog;
 import com.jiayue.ssi.annotation.PreventReplay;
+import com.jiayue.ssi.backenum.AuditType;
+import com.jiayue.ssi.backenum.BusinessType;
 import com.jiayue.ssi.constant.CustomException;
 import com.jiayue.ssi.entity.*;
 import com.jiayue.ssi.service.*;
@@ -39,6 +42,7 @@ public class ForecastPowerShortTermController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('biz:dq:getAll')")
+    @OperateLog(title = "短期预测", businessType = BusinessType.QUERY, auditType = AuditType.BIZ,operdesc = "查询短期预测数据")
     @PreventReplay
     public ResponseVO getAll(String currentPage, String pageSize, String startTime, String endTime) throws CustomException {
         try {

+ 3 - 2
backend/src/main/java/com/jiayue/ssi/controller/IpBlacklistController.java

@@ -42,6 +42,7 @@ public class IpBlacklistController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('system:ipblacklist:list')")
+    @OperateLog(title = "短期预测", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "查询黑名单列表")
     @PreventReplay
     public ResponseVO getAll(String currentPage, String pageSize, String ip) throws CustomException {
         try {
@@ -89,7 +90,7 @@ public class IpBlacklistController {
      * 新增ip
      */
     @PostMapping(value = "/addIp")
-    @OperateLog(title = "黑名单管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS)
+    @OperateLog(title = "黑名单管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS,operdesc = "新增黑名单")
     @PreAuthorize("@ss.hasPermi('system:ipblacklist:add')")
     @PreventReplay
     public ResponseVO addIp(@RequestBody SysBlacklist sysBlacklist) throws CustomException {
@@ -125,7 +126,7 @@ public class IpBlacklistController {
      * 删除用户信息
      */
     @PostMapping(value = "/delIp")
-    @OperateLog(title = "黑名单管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS)
+    @OperateLog(title = "黑名单管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS,operdesc = "删除黑名单")
     @PreAuthorize("@ss.hasPermi('system:ipblacklist:remove')")
     @PreventReplay
     public ResponseVO delIp(String id) throws CustomException {

+ 4 - 0
backend/src/main/java/com/jiayue/ssi/controller/NwpController.java

@@ -3,7 +3,10 @@ package com.jiayue.ssi.controller;
 import cn.hutool.core.util.NumberUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jiayue.ssi.annotation.OperateLog;
 import com.jiayue.ssi.annotation.PreventReplay;
+import com.jiayue.ssi.backenum.AuditType;
+import com.jiayue.ssi.backenum.BusinessType;
 import com.jiayue.ssi.constant.CustomException;
 import com.jiayue.ssi.entity.Nwp;
 import com.jiayue.ssi.service.NwpService;
@@ -42,6 +45,7 @@ public class NwpController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('biz:nwp:getAll')")
+    @OperateLog(title = "NWP预测", businessType = BusinessType.QUERY, auditType = AuditType.BIZ,operdesc = "查询NWP预测数据")
     @PreventReplay
     public ResponseVO getAll(String currentPage, String pageSize, String startTime, String endTime) throws CustomException {
         try {

+ 4 - 0
backend/src/main/java/com/jiayue/ssi/controller/ServerController.java

@@ -1,6 +1,9 @@
 package com.jiayue.ssi.controller;
 
+import com.jiayue.ssi.annotation.OperateLog;
 import com.jiayue.ssi.annotation.PreventReplay;
+import com.jiayue.ssi.backenum.AuditType;
+import com.jiayue.ssi.backenum.BusinessType;
 import com.jiayue.ssi.constant.CustomException;
 import com.jiayue.ssi.entity.Server;
 import com.jiayue.ssi.util.ResponseVO;
@@ -22,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
 public class ServerController {
     @PreAuthorize("@ss.hasPermi('monitor:server:list')")
     @GetMapping()
+    @OperateLog(title = "服务监控", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "获取服务监控信息")
     @PreventReplay
     public ResponseVO getInfo() throws CustomException {
         try {

+ 5 - 0
backend/src/main/java/com/jiayue/ssi/controller/SysAlarmController.java

@@ -2,7 +2,10 @@ package com.jiayue.ssi.controller;
 
 import cn.hutool.core.util.NumberUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.jiayue.ssi.annotation.OperateLog;
 import com.jiayue.ssi.annotation.PreventReplay;
+import com.jiayue.ssi.backenum.AuditType;
+import com.jiayue.ssi.backenum.BusinessType;
 import com.jiayue.ssi.constant.CustomException;
 import com.jiayue.ssi.entity.SysAlarm;
 import com.jiayue.ssi.service.SysAlarmService;
@@ -32,6 +35,7 @@ public class SysAlarmController {
      * @return
      */
     @GetMapping(value = "/getAll")
+    @OperateLog(title = "告警管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "获取告警信息列表")
     @PreventReplay
     public ResponseVO getAll() throws CustomException {
         try {
@@ -48,6 +52,7 @@ public class SysAlarmController {
      * 查收提交
      */
     @PostMapping(value = "/readDone")
+    @OperateLog(title = "告警管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS,operdesc = "查收告警信息")
     @PreventReplay
     public ResponseVO readDone(String id) throws CustomException {
         try {

+ 2 - 1
backend/src/main/java/com/jiayue/ssi/controller/SysApproveController.java

@@ -50,6 +50,7 @@ public class SysApproveController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('approveManager:approve:list')")
+    @OperateLog(title = "审核管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "查询审核列表")
     @PreventReplay
     public ResponseVO getAll(String currentPage, String pageSize, String approveStatus, String approveResult) throws CustomException {
         try {
@@ -235,7 +236,7 @@ public class SysApproveController {
      * 审批结果提交
      */
     @PostMapping(value = "/submitApprove")
-    @OperateLog(title = "审核管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS)
+    @OperateLog(title = "审核管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS,operdesc = "审核结果提交")
     @PreAuthorize("@ss.hasPermi('approveManager:approve:submitApprove')")
     @PreventReplay
     public ResponseVO submitApprove(@RequestBody SysApprove sysApprove) throws CustomException {

+ 4 - 2
backend/src/main/java/com/jiayue/ssi/controller/SysLogininforController.java

@@ -41,6 +41,7 @@ public class SysLogininforController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('auditManager:logininfor:list')")
+    @OperateLog(title = "登录日志", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "查询登录日志")
     @PreventReplay
     public ResponseVO getAll(String currentPage, String pageSize, String ipaddr, String userName,
                              String status, String startLoginTime, String endLoginTime, String sortOrder) throws CustomException {
@@ -125,7 +126,7 @@ public class SysLogininforController {
      * 删除登录信息
      */
     @PostMapping(value = "/delLoginInfo")
-    @OperateLog(title = "登录日志", businessType = BusinessType.DELETE, auditType = AuditType.SYS)
+    @OperateLog(title = "登录日志", businessType = BusinessType.DELETE, auditType = AuditType.SYS,operdesc = "删除登录日志")
     @PreAuthorize("@ss.hasPermi('auditManager:logininfor:remove')")
     public ResponseVO delLoginInfo(String infoId) throws CustomException {
         try {
@@ -149,7 +150,7 @@ public class SysLogininforController {
      * 清空登录信息
      */
     @PostMapping("/cleanLogininfor")
-    @OperateLog(title = "登录日志", businessType = BusinessType.CLEAN, auditType = AuditType.SYS)
+    @OperateLog(title = "登录日志", businessType = BusinessType.CLEAN, auditType = AuditType.SYS,operdesc = "清空登录日志")
     @PreAuthorize("@ss.hasPermi('auditManager:logininfor:remove')")
     public ResponseVO cleanLogininfor() throws CustomException {
         try {
@@ -172,6 +173,7 @@ public class SysLogininforController {
      */
     @GetMapping(value = "/logininforTotal")
     @PreAuthorize("@ss.hasPermi('auditManager:logininforTotal:list')")
+    @OperateLog(title = "登录日志", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "查询统计登录日志")
     @PreventReplay
     public ResponseVO logininforTotal(String startLoginTime, String endLoginTime) throws CustomException {
         try {

+ 6 - 3
backend/src/main/java/com/jiayue/ssi/controller/SysMenuController.java

@@ -45,6 +45,7 @@ public class SysMenuController {
      */
     @GetMapping("/list")
     @PreAuthorize("@ss.hasPermi('system:menu:list')")
+    @OperateLog(title = "菜单管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "查询菜单")
     @PreventReplay
     public ResponseVO list(SysMenu menu) throws CustomException {
         try {
@@ -64,7 +65,7 @@ public class SysMenuController {
      * 新增菜单
      */
     @PostMapping(value = "/addMenu")
-    @OperateLog(title = "菜单管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS)
+    @OperateLog(title = "菜单管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS,operdesc = "新增菜单")
     @PreAuthorize("@ss.hasPermi('system:menu:add')")
     @PreventReplay
     public ResponseVO addMenu(@RequestBody SysMenu menu) throws CustomException {
@@ -137,7 +138,7 @@ public class SysMenuController {
      * @return 执行结果
      */
     @PostMapping(value = "/updateMenu")
-    @OperateLog(title = "菜单管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS)
+    @OperateLog(title = "菜单管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS,operdesc = "修改菜单")
     @PreAuthorize("@ss.hasPermi('system:menu:edit')")
     @PreventReplay
     public ResponseVO updateMenu(@RequestBody SysMenu menu) throws CustomException {
@@ -211,6 +212,7 @@ public class SysMenuController {
      * 根据菜单编号获取详细信息
      */
     @GetMapping(value = "/{getDetailInfo}")
+    @OperateLog(title = "菜单管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "获取菜单详细信息")
     @PreventReplay
     public ResponseVO getDetailInfo(String menuId) throws CustomException {
         try {
@@ -237,7 +239,7 @@ public class SysMenuController {
      * 删除菜单信息
      */
     @PostMapping(value = "delMenu")
-    @OperateLog(title = "菜单管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS)
+    @OperateLog(title = "菜单管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS,operdesc = "删除菜单")
     @PreAuthorize("@ss.hasPermi('system:menu:remove')")
     @PreventReplay
     public ResponseVO delMenu(String menuId) throws CustomException {
@@ -285,6 +287,7 @@ public class SysMenuController {
      * 加载对应角色菜单列表树
      */
     @GetMapping(value = "/roleMenuTreeselect")
+    @OperateLog(title = "菜单管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "获取角色菜单列表")
     @PreventReplay
     public ResponseVO roleMenuTreeselect(String roleId) throws CustomException {
         try {

+ 4 - 2
backend/src/main/java/com/jiayue/ssi/controller/SysOperlogController.java

@@ -79,6 +79,7 @@ public class SysOperlogController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('auditManager:operlog:list')")
+    @OperateLog(title = "操作日志", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "查询操作日志")
     @PreventReplay
     public ResponseVO getAll(String currentPage, String pageSize, String title, String operName, String auditType,
                              String businessType, String status, String startOperTime, String endOperTime, String sortOrder) throws CustomException {
@@ -174,7 +175,7 @@ public class SysOperlogController {
      * 删除登录信息
      */
     @PostMapping(value = "/delOperlog")
-    @OperateLog(title = "操作日志", businessType = BusinessType.DELETE, auditType = AuditType.SYS)
+    @OperateLog(title = "操作日志", businessType = BusinessType.DELETE, auditType = AuditType.SYS,operdesc = "删除操作日志")
     @PreAuthorize("@ss.hasPermi('auditManager:operlog:remove')")
     public ResponseVO delOperlog(String operId) throws CustomException {
         try {
@@ -197,7 +198,7 @@ public class SysOperlogController {
      * 操作日志清空
      */
     @PostMapping("/cleanOperLog")
-    @OperateLog(title = "操作日志", businessType = BusinessType.CLEAN, auditType = AuditType.SYS)
+    @OperateLog(title = "操作日志", businessType = BusinessType.CLEAN, auditType = AuditType.SYS,operdesc = "清空操作日志")
     @PreAuthorize("@ss.hasPermi('auditManager:operlog:remove')")
     public ResponseVO cleanOperLog() throws CustomException {
         try {
@@ -220,6 +221,7 @@ public class SysOperlogController {
      */
     @GetMapping(value = "/sysOperlogTotal")
     @PreAuthorize("@ss.hasPermi('auditManager:sysOperlogTotal:list')")
+    @OperateLog(title = "操作日志", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "查询统计操作日志")
     @PreventReplay
     public ResponseVO sysOperlogTotal(String startLoginTime, String endLoginTime) throws CustomException {
         try {

+ 4 - 3
backend/src/main/java/com/jiayue/ssi/controller/SysParameterController.java

@@ -40,7 +40,7 @@ public class SysParameterController {
      * @return 执行结果
      */
     @PostMapping(value = "/addParameter")
-    @OperateLog(title = "参数管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS)
+    @OperateLog(title = "参数管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS,operdesc = "新增参数信息")
     @PreAuthorize("@ss.hasPermi('system:config:add')")
     @PreventReplay
     public ResponseVO addParameter(@RequestBody SysParameter sysParameter) throws CustomException {
@@ -92,7 +92,7 @@ public class SysParameterController {
      * @return 执行结果
      */
     @PostMapping(value = "/updateParameter")
-    @OperateLog(title = "参数管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS)
+    @OperateLog(title = "参数管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS,operdesc = "修改参数信息")
     @PreAuthorize("@ss.hasPermi('system:config:edit')")
     @PreventReplay
     public ResponseVO updateParameter(@RequestBody SysParameter sysParameter) throws CustomException {
@@ -148,7 +148,7 @@ public class SysParameterController {
      * 删除用户信息
      */
     @PostMapping(value = "/deleteParameter")
-    @OperateLog(title = "参数管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS)
+    @OperateLog(title = "参数管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS,operdesc = "删除参数信息")
     @PreAuthorize("@ss.hasPermi('system:config:remove')")
     @PreventReplay
     public ResponseVO deleteParameter(String id) throws CustomException {
@@ -179,6 +179,7 @@ public class SysParameterController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('system:config:list')")
+    @OperateLog(title = "参数管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "查询参数信息")
     @PreventReplay
     public ResponseVO getAll(String currentPage, String pageSize, String keywords) throws CustomException {
         try {

+ 2 - 1
backend/src/main/java/com/jiayue/ssi/controller/SysPolicyController.java

@@ -41,6 +41,7 @@ public class SysPolicyController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('system:policy:getAll')")
+    @OperateLog(title = "策略配置", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "获取策略配置信息")
     @PreventReplay
     public ResponseVO getAll() throws CustomException {
         try {
@@ -55,7 +56,7 @@ public class SysPolicyController {
      * 保存策略配置
      */
     @PostMapping
-    @OperateLog(title = "策略配置", businessType = BusinessType.UPDATE, auditType = AuditType.SYS)
+    @OperateLog(title = "策略配置", businessType = BusinessType.UPDATE, auditType = AuditType.SYS,operdesc = "保存策略配置信息")
     @PreAuthorize("@ss.hasPermi('system:policy:update')")
     @PreventReplay
     public ResponseVO update(@RequestBody SysPolicy sysPolicy) throws CustomException {

+ 6 - 3
backend/src/main/java/com/jiayue/ssi/controller/SysRoleController.java

@@ -45,6 +45,7 @@ public class SysRoleController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('system:role:list')")
+    @OperateLog(title = "角色管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "角色查询")
     @PreventReplay
     public ResponseVO getAll(String currentPage, String pageSize, String roleName, String status, String roleKey) throws CustomException {
         try {
@@ -116,7 +117,7 @@ public class SysRoleController {
      * @return 执行结果
      */
     @PostMapping(value = "/addRole")
-    @OperateLog(title = "角色管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS)
+    @OperateLog(title = "角色管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS,operdesc = "新增角色")
     @PreAuthorize("@ss.hasPermi('system:role:add')")
     @PreventReplay
     public ResponseVO addRole(@RequestBody SysRole role) throws CustomException {
@@ -169,7 +170,7 @@ public class SysRoleController {
      * @return 执行结果
      */
     @PostMapping(value = "/updateRole")
-    @OperateLog(title = "角色管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS)
+    @OperateLog(title = "角色管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS,operdesc = "修改角色")
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @PreventReplay
     public ResponseVO updateRole(@RequestBody SysRole role) throws CustomException {
@@ -231,6 +232,7 @@ public class SysRoleController {
      * 根据角色编号获取详细信息
      */
     @GetMapping(value = "getInfo")
+    @OperateLog(title = "角色管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "获取角色详细信息")
     @PreventReplay
     public ResponseVO getInfo(String roleId) throws CustomException {
         try {
@@ -257,7 +259,7 @@ public class SysRoleController {
      * 删除角色
      */
     @PostMapping(value = "/delRole")
-    @OperateLog(title = "角色管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS)
+    @OperateLog(title = "角色管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS,operdesc = "删除角色")
     @PreAuthorize("@ss.hasPermi('system:role:remove')")
     @PreventReplay
     public ResponseVO delRole(String roleId) throws CustomException {
@@ -295,6 +297,7 @@ public class SysRoleController {
      */
     @GetMapping(value = "/getRoleByType")
     @PreAuthorize("@ss.hasPermi('system:user:role')")
+    @OperateLog(title = "角色管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "获取分配角色列表")
     @PreventReplay
     public ResponseVO getRoleByType(String usertype) throws CustomException {
         try {

+ 11 - 8
backend/src/main/java/com/jiayue/ssi/controller/SysUserController.java

@@ -64,6 +64,7 @@ public class SysUserController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('system:user:list')")
+    @OperateLog(title = "用户管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "用户查询")
     @PreventReplay
     public ResponseVO getAll(String username, String phonenumber,
                              String status) throws CustomException {
@@ -132,7 +133,7 @@ public class SysUserController {
      * 新增用户
      */
     @PostMapping(value = "/addUser")
-    @OperateLog(title = "用户管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS)
+    @OperateLog(title = "用户管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS,operdesc = "新增用户")
     @PreAuthorize("@ss.hasPermi('system:user:add')")
     @PreventReplay
     public ResponseVO addUser(@RequestBody SysUser user) throws CustomException {
@@ -260,7 +261,7 @@ public class SysUserController {
      */
     @PostMapping(value = "/updateUser")
     @AgainVerify
-    @OperateLog(title = "用户管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS)
+    @OperateLog(title = "用户管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS,operdesc = "修改用户")
     @PreAuthorize("@ss.hasPermi('system:user:edit')")
     @PreventReplay
     public ResponseVO updateUser(@RequestBody SysUser user) throws CustomException {
@@ -377,7 +378,7 @@ public class SysUserController {
      * 初始密码发送邮箱
      */
     @PostMapping(value = "/resetPassword")
-    @OperateLog(title = "用户管理", businessType = BusinessType.OTHER, auditType = AuditType.SYS)
+    @OperateLog(title = "用户管理", businessType = BusinessType.RESETPWD, auditType = AuditType.SYS,operdesc = "初始/重置密码发送邮箱")
     @PreAuthorize("@ss.hasPermi('system:user:send')")
     @PreventReplay
     public ResponseVO resetPassword(String id) {
@@ -430,7 +431,7 @@ public class SysUserController {
      */
     @PostMapping(value = "/delUser")
     @AgainVerify
-    @OperateLog(title = "用户管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS)
+    @OperateLog(title = "用户管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS,operdesc = "删除用户")
     @PreAuthorize("@ss.hasPermi('system:user:remove')")
     @PreventReplay
     public ResponseVO delete(String id) throws CustomException {
@@ -473,7 +474,7 @@ public class SysUserController {
      * 修改密码
      */
     @PostMapping(value = "/updatePassword")
-    @OperateLog(title = "用户管理", businessType = BusinessType.UPDATE, auditType = AuditType.SYS)
+    @OperateLog(title = "用户管理", businessType = BusinessType.PWDUPDATE, auditType = AuditType.SYS,operdesc = "修改个人密码")
     @PreventReplay
     public ResponseVO updatePassword(String id, String oldPassword, String newPassword, String confirmPassword) throws CustomException {
         try {
@@ -557,7 +558,7 @@ public class SysUserController {
      * 解锁用户信息
      */
     @PostMapping(value = "/relockUser")
-    @OperateLog(title = "用户管理", businessType = BusinessType.OTHER, auditType = AuditType.SYS)
+    @OperateLog(title = "用户管理", businessType = BusinessType.UNLOCK, auditType = AuditType.SYS,operdesc = "用户账号解锁")
     @PreAuthorize("@ss.hasPermi('system:user:relock')")
     @PreventReplay
     public ResponseVO relockUser(String id) throws CustomException {
@@ -603,7 +604,7 @@ public class SysUserController {
      */
     @PostMapping("/authRole")
     @PreAuthorize("@ss.hasPermi('system:user:role')")
-    @OperateLog(title = "用户管理", businessType = BusinessType.GRANT, auditType = AuditType.SYS)
+    @OperateLog(title = "用户管理", businessType = BusinessType.GRANT, auditType = AuditType.SYS,operdesc = "用户授权角色")
     @PreventReplay
     public ResponseVO authRole(String userId, String roleId) throws CustomException {
         try {
@@ -667,6 +668,7 @@ public class SysUserController {
      * @return
      */
     @GetMapping("/getUserRole")
+    @OperateLog(title = "用户管理", businessType = BusinessType.GETROLE, auditType = AuditType.SYS,operdesc = "获取授权角色信息")
     @PreventReplay
     public ResponseVO getUserRole(Long userId) throws CustomException {
         try {
@@ -705,7 +707,7 @@ public class SysUserController {
      */
     @PostMapping(value = "/logOffUser")
     @AgainVerify
-    @OperateLog(title = "用户管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS)
+    @OperateLog(title = "用户管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS,operdesc = "注销用户账号")
     @PreAuthorize("@ss.hasPermi('system:user:logoff')")
     @PreventReplay
     public ResponseVO logOffUser(String id) throws CustomException {
@@ -767,6 +769,7 @@ public class SysUserController {
      */
     @GetMapping(value = "/getUserByHealthy")
     @PreAuthorize("@ss.hasPermi('monitor:onLine:list')")
+    @OperateLog(title = "在线用户管理", businessType = BusinessType.QUERY, auditType = AuditType.SYS,operdesc = "在线用户查询")
     @PreventReplay
     public ResponseVO getUserByHealthy(String currentPage, String pageSize, String onLineStatus) throws CustomException {
         try {

+ 3 - 0
backend/src/main/java/com/jiayue/ssi/controller/UserLoginController.java

@@ -1,6 +1,9 @@
 package com.jiayue.ssi.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.jiayue.ssi.annotation.OperateLog;
+import com.jiayue.ssi.backenum.AuditType;
+import com.jiayue.ssi.backenum.BusinessType;
 import com.jiayue.ssi.config.SendMailUtil;
 import com.jiayue.ssi.constant.CacheConstants;
 import com.jiayue.ssi.constant.CustomException;

+ 11 - 0
backend/src/main/java/com/jiayue/ssi/entity/SysOperLog.java

@@ -32,6 +32,17 @@ public class SysOperLog extends BaseEntity {
     @TableField(exist = false)
     private Integer[] businessTypes;
 
+    public String getOperdesc() {
+        return operdesc;
+    }
+
+    public void setOperdesc(String operdesc) {
+        this.operdesc = operdesc;
+    }
+
+    /** 操作描述 */
+    private String operdesc;
+
     /** 请求方法 */
     private String method;
 

+ 1 - 1
backend/src/main/java/com/jiayue/ssi/filter/MailCodeFilter.java

@@ -85,11 +85,11 @@ public class MailCodeFilter extends OncePerRequestFilter {
                     }
                 }
             }
-            filterChain.doFilter(request, response);
         } catch (Exception e) {
             e.printStackTrace();
             ResponseInfo.doResponse(response, "邮箱口令错误!", 401);
             return;
         }
+        filterChain.doFilter(request, response);
     }
 }

+ 2 - 1
backend/src/main/java/com/jiayue/ssi/filter/VerifyCodeFilter.java

@@ -73,10 +73,11 @@ public class VerifyCodeFilter extends OncePerRequestFilter {
                     return;
                 }
             }
-            filterChain.doFilter(request, response);
+
         } catch (Exception e) {
             ResponseInfo.doResponse(response, "验证码错误!", 401);
             return;
         }
+        filterChain.doFilter(request, response);
     }
 }

+ 1 - 1
backend/src/main/java/com/jiayue/ssi/filter/VerifySmFilter.java

@@ -189,7 +189,7 @@ public class VerifySmFilter extends OncePerRequestFilter {
             ParameterRequestWrapper pr = new ParameterRequestWrapper(initWrapper, stringToMap, decryptStr);
             filterChain.doFilter(pr, response);
         } catch (Exception e) {
-            log.error(IPUtils.getIpAddr(request) + "访问系统失败", e);
+//            log.error(IPUtils.getIpAddr(request) + "访问系统失败", e);
             ResponseInfo.doResponse(response, "访问失败,联系管理员!", 401);
             return;
         }

+ 14 - 8
backend/src/test/java/com/jiayue/ssi/service/Sm2UiTest.java

@@ -1,5 +1,6 @@
 package com.jiayue.ssi.service;
 
+import cn.hutool.crypto.SmUtil;
 import com.jiayue.ssi.constant.SecretKeyConstants;
 import com.jiayue.ssi.util.SM2CryptUtils;
 
@@ -23,17 +24,22 @@ public class Sm2UiTest {
 
 
 
-        String jiami = SM2CryptUtils.encrypt("root","041967638ca43d4577d8dba166bff4437fde944270101f398a95b846ec2f8177d09f8abc5d62b6cd2c7216274d7abe0c8e04b0bb691207a32dd2e12d6bd2798672");
-        System.out.println("加密:"+jiami);
-        String jiemi = SM2CryptUtils.decrypt(jiami,"6155d63ee27cbeca07f3e40c4f8856f1be8119fcbda1aadc7e0e595e52bad7bd");
-        System.out.println("解密:"+jiemi);
+//        String jiami = SM2CryptUtils.encrypt("root","041967638ca43d4577d8dba166bff4437fde944270101f398a95b846ec2f8177d09f8abc5d62b6cd2c7216274d7abe0c8e04b0bb691207a32dd2e12d6bd2798672");
+//        System.out.println("加密:"+jiami);
+//        String jiemi = SM2CryptUtils.decrypt(jiami,"6155d63ee27cbeca07f3e40c4f8856f1be8119fcbda1aadc7e0e595e52bad7bd");
+//        System.out.println("解密:"+jiemi);
+//
+//
+//        String qianming = SM2CryptUtils.sign("6155d63ee27cbeca07f3e40c4f8856f1be8119fcbda1aadc7e0e595e52bad7bd",jiemi);
+//        System.out.println("签名:"+qianming);
+//
+//        boolean yanqian = SM2CryptUtils.verifySign("041967638ca43d4577d8dba166bff4437fde944270101f398a95b846ec2f8177d09f8abc5d62b6cd2c7216274d7abe0c8e04b0bb691207a32dd2e12d6bd2798672",jiemi,qianming);
+//        System.out.println("验签:"+yanqian);
 
 
-        String qianming = SM2CryptUtils.sign("6155d63ee27cbeca07f3e40c4f8856f1be8119fcbda1aadc7e0e595e52bad7bd",jiemi);
-        System.out.println("签名:"+qianming);
+        String a= SmUtil.sm3("Xsl147258").toUpperCase();
+        System.out.println(SM2CryptUtils.encrypt(a,SecretKeyConstants.SERVER_PUBLIC_KEY));
 
-        boolean yanqian = SM2CryptUtils.verifySign("041967638ca43d4577d8dba166bff4437fde944270101f398a95b846ec2f8177d09f8abc5d62b6cd2c7216274d7abe0c8e04b0bb691207a32dd2e12d6bd2798672",jiemi,qianming);
-        System.out.println("验签:"+yanqian);
 
     }
 }

+ 50 - 53
ui/src/App.vue

@@ -16,59 +16,56 @@ export default {
       return false;
     };
 
-    // window.addEventListener("beforeunload", e => {
-    //   this.beforeunloadHandler(e)
-    //   let userAgent = navigator.userAgent
-    //   let isOpera = userAgent.indexOf("Opera") > -1;
-    //   if (isOpera) { //判断是否Opera浏览器
-    //     return "Opera"
-    //   }
-    //   if (userAgent.indexOf("Firefox") > -1) {
-    //     this.unloadHandler();
-    //   }
-    //   if (userAgent.indexOf("MSIE") > -1) {
-    //     this.unloadHandler();
-    //   }
-    // });
-    // window.addEventListener("unload", async e => {
-    //   this.unloadHandler(e)
-    // });
+    window.addEventListener("beforeunload", e => {
+      this.beforeunloadHandler(e)
+      let userAgent = navigator.userAgent
+      let isOpera = userAgent.indexOf("Opera") > -1;
+      if (isOpera) { //判断是否Opera浏览器
+        return "Opera"
+      }
+      if (userAgent.indexOf("Firefox") > -1) {
+        this.unloadHandler();
+      }
+      if (userAgent.indexOf("MSIE") > -1) {
+        this.unloadHandler();
+      }
+    });
+    window.addEventListener("unload", async e => {
+      this.unloadHandler(e)
+    });
   },
-  // methods: {
-  //   beforeunloadHandler(e) {
-  //     this._beforeUnload_time = new Date().getTime();
-  //   },
-  //   unloadHandler(e) {
-  //     this._gap_time = new Date().getTime() - this._beforeUnload_time;
-  //
-  //     //判断是窗口关闭还是刷新
-  //     localStorage.setItem('time', this._gap_time)
-  //     console.log(this._gap_time, 333333)
-  //     if (this._gap_time <= 5) {
-  //       console.log(this._gap_time, 333333)
-  //       // // 发送设置同步 (退出登陆的api)
-  //       // this.$store.dispatch('LogOut').then(() => {
-  //       //   location.href = '/index';
-  //       // })
-  //
-  //
-  //       this.$axios.post(
-  //         '/logout', {}
-  //       ).then((res) => {
-  //         this.$message.success(res.data)
-  //         removeToken()
-  //         //注销返回自己的登录页
-  //         this.$router.push(`/login?redirect=${this.$route.fullPath}`)
-  //       })
-  //     } else {
-  //     }
-  //   },
-  // },
-  // destroyed() {
-  //   window.removeEventListener("beforeunload", e =>
-  //     this.beforeunloadHandler(e)
-  //   );
-  //   window.removeEventListener("unload", e => this.unloadHandler(e));
-  // }
+  methods: {
+    beforeunloadHandler(e) {
+      this._beforeUnload_time = new Date().getTime();
+    },
+    unloadHandler(e) {
+      this._gap_time = new Date().getTime() - this._beforeUnload_time;
+      //判断是窗口关闭还是刷新
+      localStorage.setItem('time', this._gap_time)
+      if (this._gap_time <= 5) {
+        // // 发送设置同步 (退出登陆的api)
+        // this.$store.dispatch('LogOut').then(() => {
+        //   location.href = '/index';
+        // })
+
+
+        this.$axios.post(
+          '/logout', {}
+        ).then((res) => {
+          this.$message.success(res.data)
+          removeToken()
+          //注销返回自己的登录页
+          this.$router.push(`/login?redirect=${this.$route.fullPath}`)
+        })
+      } else {
+      }
+    },
+  },
+  destroyed() {
+    window.removeEventListener("beforeunload", e =>
+      this.beforeunloadHandler(e)
+    );
+    window.removeEventListener("unload", e => this.unloadHandler(e));
+  }
 }
 </script>