Przeglądaj źródła

😎代码整理优化

zuohuaijun 2 lat temu
rodzic
commit
bc0b950832

+ 1 - 1
Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj

@@ -38,7 +38,7 @@
     <PackageReference Include="Novell.Directory.Ldap.NETStandard" Version="3.6.0" />
     <PackageReference Include="OnceMi.AspNetCore.OSS" Version="1.1.9" />
     <PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
-    <PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.1" />
+    <PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.2" />
     <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.0.0" />
     <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.2.0" />
     <PackageReference Include="SqlSugarCore" Version="5.1.4.152" />

+ 4 - 3
Admin.NET/Admin.NET.Core/Entity/SysUserLdap.cs

@@ -29,17 +29,18 @@ public class SysUserLdap : EntityTenant
     /// Ldap对应uid
     /// </summary>
     [SugarColumn(ColumnDescription = "域账号", Length = 32)]
+    [Required]
     public string Account { get; set; }
 
     /// <summary>
     /// 对应EmployeeId(用于数据导入对照)
     /// </summary>
     [SugarColumn(ColumnDescription = "对应EmployeeId", Length = 32)]
-    public string EmployeeId { get; set; }
+    public string? EmployeeId { get; set; }
 
     /// <summary>
     /// 组织代码
     /// </summary>
-    [SugarColumn(ColumnDescription = "DeptCode", Length = 64)]
-    public string DeptCode { get; set; }
+    [SugarColumn(ColumnDescription = "组织代码", Length = 64)]
+    public string? DeptCode { get; set; }
 }

+ 9 - 8
Admin.NET/Admin.NET.Core/Service/Auth/SysLdapService.cs

@@ -186,13 +186,14 @@ public class SysLdapService : IDynamicApiController, ITransient
                 }
 
                 var attrs = ldapEntry.GetAttributeSet();
-                string deptCode = GetDepartmentCode(attrs, sysLdap.BindAttrCode);
+                var deptCode = GetDepartmentCode(attrs, sysLdap.BindAttrCode);
                 if (attrs.Count == 0 || attrs.ContainsKey("OU"))
+                {
                     SearchDnLdapUser(ldapConn, sysLdap, userLdapList, ldapEntry.Dn, deptCode);
+                }
                 else
                 {
                     var sysUserLdap = CreateSysUserLdap(attrs, sysLdap.BindAttrAccount, sysLdap.BindAttrEmployeeId, deptCode);
-
                     if (string.IsNullOrEmpty(sysUserLdap.EmployeeId)) continue;
                     userLdapList.Add(sysUserLdap);
                 }
@@ -302,7 +303,7 @@ public class SysLdapService : IDynamicApiController, ITransient
             ldapConn.Connect(sysLdap.Host, sysLdap.Port);
             ldapConn.Bind(sysLdap.Version, sysLdap.BindDn, sysLdap.BindPass);
             var ldapSearchResults = ldapConn.Search(sysLdap.BaseDn, LdapConnection.ScopeOne, "(objectClass=*)", null, false);
-            var listOrgs = new List<SysOrg>();
+            var orgList = new List<SysOrg>();
             while (ldapSearchResults.HasMore())
             {
                 LdapEntry ldapEntry;
@@ -319,17 +320,17 @@ public class SysLdapService : IDynamicApiController, ITransient
                 var attrs = ldapEntry.GetAttributeSet();
                 if (attrs.Count == 0 || attrs.ContainsKey("OU"))
                 {
-                    var sysOrg = CreateSysOrg(attrs, sysLdap, listOrgs, new SysOrg { Id = 0, Level = 0 });
-                    listOrgs.Add(sysOrg);
+                    var sysOrg = CreateSysOrg(attrs, sysLdap, orgList, new SysOrg { Id = 0, Level = 0 });
+                    orgList.Add(sysOrg);
 
-                    SearchDnLdapDept(ldapConn, sysLdap, listOrgs, ldapEntry.Dn, sysOrg);
+                    SearchDnLdapDept(ldapConn, sysLdap, orgList, ldapEntry.Dn, sysOrg);
                 }
             }
 
-            if (listOrgs.Count == 0)
+            if (orgList.Count == 0)
                 return;
 
-            await App.GetRequiredService<SysOrgService>().BatchAddOrgs(listOrgs);
+            await App.GetRequiredService<SysOrgService>().BatchAddOrgs(orgList);
         }
         catch (LdapException e)
         {

+ 3 - 3
Admin.NET/Admin.NET.Core/Service/Org/SysOrgService.cs

@@ -132,14 +132,14 @@ public class SysOrgService : IDynamicApiController, ITransient
     /// <summary>
     /// 批量增加机构
     /// </summary>
-    /// <param name="list"></param>
+    /// <param name="orgs"></param>
     /// <returns></returns>
     [NonAction]
-    public async Task BatchAddOrgs(List<SysOrg> list)
+    public async Task BatchAddOrgs(List<SysOrg> orgs)
     {
         DeleteAllUserOrgCache(0, 0);
         await _sysOrgRep.AsDeleteable().ExecuteCommandAsync();
-        await _sysOrgRep.AsInsertable(list).ExecuteCommandAsync();
+        await _sysOrgRep.AsInsertable(orgs).ExecuteCommandAsync();
     }
 
     /// <summary>

+ 24 - 24
Web/src/api-services/apis/sys-ldap-api.ts

@@ -273,13 +273,13 @@ export const SysLdapApiAxiosParamCreator = function (configuration?: Configurati
         },
         /**
          * 
-         * @summary 同步域用户 🔖
+         * @summary 同步域组织 🔖
          * @param {SyncSysLdapInput} [body] 
          * @param {*} [options] Override http request option.
          * @throws {RequiredError}
          */
-        apiSysLdapSyncUserPost: async (body?: SyncSysLdapInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
-            const localVarPath = `/api/sysLdap/syncUser`;
+        apiSysLdapSyncDeptPost: async (body?: SyncSysLdapInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
+            const localVarPath = `/api/sysLdap/syncDept`;
             // use dummy base URL string because the URL constructor only accepts absolute URLs.
             const localVarUrlObj = new URL(localVarPath, 'https://example.com');
             let baseOptions;
@@ -321,13 +321,13 @@ export const SysLdapApiAxiosParamCreator = function (configuration?: Configurati
         },
         /**
          * 
-         * @summary 同步域组织 🔖
+         * @summary 同步域用户 🔖
          * @param {SyncSysLdapInput} [body] 
          * @param {*} [options] Override http request option.
          * @throws {RequiredError}
          */
-        apiSysLdapSyncOrgPost: async (body?: SyncSysLdapInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
-            const localVarPath = `/api/sysLdap/syncOrg`;
+        apiSysLdapSyncUserPost: async (body?: SyncSysLdapInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
+            const localVarPath = `/api/sysLdap/syncUser`;
             // use dummy base URL string because the URL constructor only accepts absolute URLs.
             const localVarUrlObj = new URL(localVarPath, 'https://example.com');
             let baseOptions;
@@ -495,13 +495,13 @@ export const SysLdapApiFp = function(configuration?: Configuration) {
         },
         /**
          * 
-         * @summary 同步域用户 🔖
+         * @summary 同步域组织 🔖
          * @param {SyncSysLdapInput} [body] 
          * @param {*} [options] Override http request option.
          * @throws {RequiredError}
          */
-        async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
-            const localVarAxiosArgs = await SysLdapApiAxiosParamCreator(configuration).apiSysLdapSyncUserPost(body, options);
+        async apiSysLdapSyncDeptPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
+            const localVarAxiosArgs = await SysLdapApiAxiosParamCreator(configuration).apiSysLdapSyncDeptPost(body, options);
             return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                 const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                 return axios.request(axiosRequestArgs);
@@ -509,13 +509,13 @@ export const SysLdapApiFp = function(configuration?: Configuration) {
         },
         /**
          * 
-         * @summary 同步域组织 🔖
+         * @summary 同步域用户 🔖
          * @param {SyncSysLdapInput} [body] 
          * @param {*} [options] Override http request option.
          * @throws {RequiredError}
          */
-        async apiSysLdapSyncOrgPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
-            const localVarAxiosArgs = await SysLdapApiAxiosParamCreator(configuration).apiSysLdapSyncOrgPost(body, options);
+        async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
+            const localVarAxiosArgs = await SysLdapApiAxiosParamCreator(configuration).apiSysLdapSyncUserPost(body, options);
             return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                 const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                 return axios.request(axiosRequestArgs);
@@ -595,23 +595,23 @@ export const SysLdapApiFactory = function (configuration?: Configuration, basePa
         },
         /**
          * 
-         * @summary 同步域用户 🔖
+         * @summary 同步域组织 🔖
          * @param {SyncSysLdapInput} [body] 
          * @param {*} [options] Override http request option.
          * @throws {RequiredError}
          */
-        async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
-            return SysLdapApiFp(configuration).apiSysLdapSyncUserPost(body, options).then((request) => request(axios, basePath));
+        async apiSysLdapSyncDeptPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
+            return SysLdapApiFp(configuration).apiSysLdapSyncDeptPost(body, options).then((request) => request(axios, basePath));
         },
         /**
          * 
-         * @summary 同步域组织 🔖
+         * @summary 同步域用户 🔖
          * @param {SyncSysLdapInput} [body] 
          * @param {*} [options] Override http request option.
          * @throws {RequiredError}
          */
-        async apiSysLdapSyncOrgPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
-            return SysLdapApiFp(configuration).apiSysLdapSyncOrgPost(body, options).then((request) => request(axios, basePath));
+        async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
+            return SysLdapApiFp(configuration).apiSysLdapSyncUserPost(body, options).then((request) => request(axios, basePath));
         },
         /**
          * 
@@ -689,25 +689,25 @@ export class SysLdapApi extends BaseAPI {
     }
     /**
      * 
-     * @summary 同步域用户 🔖
+     * @summary 同步域组织 🔖
      * @param {SyncSysLdapInput} [body] 
      * @param {*} [options] Override http request option.
      * @throws {RequiredError}
      * @memberof SysLdapApi
      */
-    public async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
-        return SysLdapApiFp(this.configuration).apiSysLdapSyncUserPost(body, options).then((request) => request(this.axios, this.basePath));
+    public async apiSysLdapSyncDeptPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
+        return SysLdapApiFp(this.configuration).apiSysLdapSyncDeptPost(body, options).then((request) => request(this.axios, this.basePath));
     }
     /**
      * 
-     * @summary 同步域组织 🔖
+     * @summary 同步域用户 🔖
      * @param {SyncSysLdapInput} [body] 
      * @param {*} [options] Override http request option.
      * @throws {RequiredError}
      * @memberof SysLdapApi
      */
-    public async apiSysLdapSyncOrgPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
-        return SysLdapApiFp(this.configuration).apiSysLdapSyncOrgPost(body, options).then((request) => request(this.axios, this.basePath));
+    public async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
+        return SysLdapApiFp(this.configuration).apiSysLdapSyncUserPost(body, options).then((request) => request(this.axios, this.basePath));
     }
     /**
      * 

+ 1 - 1
Web/src/api-services/models/sys-ldap.ts

@@ -169,7 +169,7 @@ export interface SysLdap {
      * 绑定Code属性值
      *
      * @type {string}
-     * @memberof AddSysLdapInput
+     * @memberof SysLdap
      */
     bindAttrCode: string;
 

+ 1 - 1
Web/src/api-services/models/update-sys-ldap-input.ts

@@ -169,7 +169,7 @@ export interface UpdateSysLdapInput {
      * 绑定Code属性值
      *
      * @type {string}
-     * @memberof AddSysLdapInput
+     * @memberof UpdateSysLdapInput
      */
     bindAttrCode: string;
 

+ 0 - 1
Web/src/layout/lockScreen/index.vue

@@ -194,7 +194,6 @@ const onLockScreenSubmit = async () => {
 	if (state.lockScreenPassword) {
 		try {
 			// SM2加密密码
-			// const keys = SM2.generateKeyPair();
 			const publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
 			const password = sm2.doEncrypt(state.lockScreenPassword, publicKey, 1);
 			const [err, res] = await feature(getAPI(SysAuthApi).apiSysAuthUnLockScreenPost(password));

+ 4 - 4
Web/src/views/system/ldap/component/editLdap.vue

@@ -20,12 +20,12 @@
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-						<el-form-item label="用户搜索基准" prop="baseDn">
+						<el-form-item label="搜索基准" prop="baseDn">
 							<el-input v-model="state.ruleForm.baseDn" placeholder="请输入用户搜索基准" maxlength="128" show-word-limit clearable />
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-						<el-form-item label="用户过滤规则" prop="authFilter">
+						<el-form-item label="过滤规则" prop="authFilter">
 							<el-input v-model="state.ruleForm.authFilter" placeholder="请输入用户过滤规则" maxlength="128" show-word-limit clearable />
 						</el-form-item>
 					</el-col>
@@ -40,12 +40,12 @@
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-						<el-form-item label="绑定账号属性" prop="bindAttrAccount">
+						<el-form-item label="字段属性" prop="bindAttrAccount">
 							<el-input v-model="state.ruleForm.bindAttrAccount" placeholder="请输入域账号字段属性值" maxlength="24" show-word-limit clearable />
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-						<el-form-item label="绑定账号属性" prop="bindAttrEmployeeId">
+						<el-form-item label="用户属性" prop="bindAttrEmployeeId">
 							<el-input v-model="state.ruleForm.bindAttrEmployeeId" placeholder="请输入绑定用户EmployeeId属性!" maxlength="24" show-word-limit clearable />
 						</el-form-item>
 					</el-col>

+ 1 - 1
Web/src/views/system/ldap/index.vue

@@ -41,7 +41,7 @@
 						<ModifyRecord :data="scope.row" />
 					</template>
 				</el-table-column>
-				<el-table-column label="操作" width="240" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('sysLdap:update') || auth('sysLdap:delete') || auth('sysLdap:syncUser') || auth('sysLdap:syncOrg')">
+				<el-table-column label="操作" width="300" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('sysLdap:update') || auth('sysLdap:delete') || auth('sysLdap:syncUser') || auth('sysLdap:syncOrg')">
 					<template #default="scope">
 						<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditSysLdap(scope.row)" v-auth="'sysLdap:update'"> 编辑 </el-button>
 						<el-button icon="ele-Delete" size="small" text type="danger" @click="delSysLdap(scope.row)" v-auth="'sysLdap:delete'"> 删除 </el-button>