ludc
2023-11-29 52f15705d063ec64a6f5bffcf50d056997c23f91
鉴权服务bug修复
已修改2个文件
已删除1个文件
341 ■■■■ 文件已修改
Source/UBCS-WEB/src/views/monitor/log/loginLog.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/monitor/log/operateLog.vue 177 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-auth/src/main/java/com/vci/ubcs/auth/service/BladeUserDetailsServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/monitor/log/loginLog.vue
ÎļþÒÑɾ³ý
Source/UBCS-WEB/src/views/monitor/log/operateLog.vue
@@ -0,0 +1,177 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
               v-model="form"
               :permission="permissionList"
               :page.sync="page"
               :before-open="beforeOpen"
               @search-change="searchChange"
               @search-reset="searchReset"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
    </avue-crud>
  </basic-container>
</template>
<script>
  import { listLogOperate } from "@/api/logs";
  import {mapGetters} from "vuex";
  export default {
    data() {
      return {
        form: {},
        selectionList: [],
        query: {},
        //是否是三员管理员日志
        isAdmin: '',
        // LoginOrLogout:登录日志,grant:授权日志,operate:操作日志
        logType: '',
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        option: {
          height: 'auto',
          calcHeight: 30,
          columnBtn:false,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          editBtn: false,
          addBtn: false,
          delBtn: false,
          menuWidth: 120,
          dialogType: 'drawer',
          column: [
            {
              label: "用户名",
              prop: "userName",
              search: true,
              width:'100'
            },
            {
              label: "姓名",
              prop: "realName",
              search: true,
              width:'100'
            },
            {
              label: "用户ip",
              prop: "ip",
              width:'100'
            },
            {
              label: "模块",
              prop: "model",
              width:'140'
            },
            {
              label: "时间",
              prop: "time",
              width:'160'
            },
            {
              label: "操作结果",
              prop: "operateResult",
              width:'100'
            },
            {
              label: "描述",
              prop: "description",
              width:'300'
            },
          ]
        },
        data: []
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          viewBtn: this.vaildData(this.permission.log_usual.log_usual_view, false)
        };
      },
    },
    created() {
      this.getRouteParam()
    },
    methods: {
      //获取数据
      getRouteParam() {
        const logType = this.$route.query.log_type; // èŽ·å–log_type参数的值
        const result = logType.substring(0, logType.indexOf(':')); // æˆªå–从0到@之间的子字符串
        const isAdmin = logType.substring(logType.indexOf(':')+1, logType.indexOf('@')); // ä»Ž@之后截取到末尾的子字符串
        this.logType = result;
        this.isAdmin = isAdmin;
        //console.log(this.logType)
        //console.log(this.isAdmin)
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      underscoreName(key) {
        return key.replace(/([A-Z])/g, "_$1").toLowerCase();
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getUsualLogs(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        let conditionMaps = {};
        conditionMaps["conditionMap[is_admin]"] = this.isAdmin;
        conditionMaps["conditionMap[log_type]"] = this.logType.trim();
        if (params) {
          Object.keys(params).forEach((key) => {
            conditionMaps["conditionMap[" + this.underscoreName(key) + "_like]"] = params[key].trim();
          });
        }
        this.loading = true;
        listLogOperate(
          page.currentPage,
          page.pageSize,
          conditionMaps
        ).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
        });
      }
    }
  };
</script>
<style>
</style>
Source/UBCS/ubcs-auth/src/main/java/com/vci/ubcs/auth/service/BladeUserDetailsServiceImpl.java
@@ -31,6 +31,7 @@
import com.vci.ubcs.common.cache.CacheNames;
import org.springblade.core.jwt.JwtUtil;
import org.springblade.core.jwt.props.JwtProperties;
import org.springblade.core.launch.constant.TokenConstant;
import org.springblade.core.log.annotation.LoginOrLogoutLog;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.utils.AuthUtil;
@@ -110,6 +111,7 @@
        // èŽ·å–ç§Ÿæˆ·ID
        String headerTenant = request.getHeader(TokenUtil.TENANT_HEADER_KEY);
        String paramTenant = request.getParameter(TokenUtil.TENANT_PARAM_KEY);
        String refreshToken = request.getParameter(TokenConstant.REFRESH_TOKEN);
        String password = request.getParameter(TokenUtil.PASSWORD_KEY);
        String grantType = request.getParameter(TokenUtil.GRANT_TYPE_KEY);
        // åˆ¤æ–­ç§Ÿæˆ·è¯·æ±‚头
@@ -139,7 +141,9 @@
        //超级管理员配置文件配置账号密码,实现登录, é»˜è®¤ç§Ÿæˆ·id和超管为配置出来的
        if(tenantId.equals(this.tenantId) && userName.equals(username)){
            if (!this.userName.equals(username) || !BladePasswordEncoderFactories.createDelegatingPasswordEncoder().encode(password).equalsIgnoreCase(AuthConstant.ENCRYPT+this.password)) {
            if (Func.isBlank(refreshToken)/*刷新token不用校验密码*/
                && (!this.userName.equals(username) || !BladePasswordEncoderFactories.createDelegatingPasswordEncoder().encode(password).equalsIgnoreCase(AuthConstant.ENCRYPT+this.password))
            ) {
                setFailCount(tenantId, username, count,strategy.getLockingTime());
                throw new UsernameNotFoundException(TokenUtil.USER_NOT_FOUND+"还有【"+(failCount-count)+"】次尝试机会!");
            }