From c5cae80b64b4c56601835f4d40e204a462563094 Mon Sep 17 00:00:00 2001 From: liaoxujun@qq.com <liaoxujun@qq.com> Date: 星期二, 29 八月 2023 16:56:38 +0800 Subject: [PATCH] 修正登录逻辑 取消租户登录选项,修正消息租户会自动创建一个员工账号,一企业账号 --- DocumentServiceAPI.Application/UserAndLogin/ViewMode/UserInfo.cs | 2 DocumentServiceAPI.Web.Entry/appsettings.json | 6 +- .gitignore | 1 DocumentServiceAPI.Application/UserAndLogin/Services/UserService.cs | 26 ++++++------ DocumentServiceApi.InitQMessage/MessageReceive.cs | 62 ++++++++++++++++++++++++++++++- DocumentServiceAPI.Model/Oder/Oder.cs | 2 DocumentServiceAPI.Application/ProjectInfo/ViewMode/DocumentEmployeeInfoDTO.cs | 7 +++ DocumentServiceApi.InitQMessage/TenantOderInfo.cs | 4 ++ DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs | 2 DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj | 2 + DocumentServiceApi.InitQMessage/INITQSetups.cs | 3 + 11 files changed, 94 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index de1d1ce..38ecefb 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ ZcPayCore/obj/ DocumentServiceApi.InitQMessage/obj/ DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml +DocumentServiceApi.InitQMessage/bin/ diff --git a/DocumentServiceAPI.Application/ProjectInfo/ViewMode/DocumentEmployeeInfoDTO.cs b/DocumentServiceAPI.Application/ProjectInfo/ViewMode/DocumentEmployeeInfoDTO.cs index e8b94e1..01bcddc 100644 --- a/DocumentServiceAPI.Application/ProjectInfo/ViewMode/DocumentEmployeeInfoDTO.cs +++ b/DocumentServiceAPI.Application/ProjectInfo/ViewMode/DocumentEmployeeInfoDTO.cs @@ -54,7 +54,12 @@ public string LastUpdateName { get; set; } /// <summary> /// 鐢ㄦ埛鍚� - /// </summary> + /// </summary> + /// <summary> + /// 鐢ㄦ埛鍚� 鎵嬫満鍙烽獙璇� 蹇呭~ + /// </summary> + [Required] + [DataValidation(ValidationTypes.PhoneNumber,ErrorMessage ="鍛樺伐璐︽埛璇疯緭鍏ユ湁鏁堢殑鐢佃瘽鍙风爜")] public string UserName { get; set; } /// <summary> /// 鐢ㄦ埛瀵嗙爜 diff --git a/DocumentServiceAPI.Application/UserAndLogin/Services/UserService.cs b/DocumentServiceAPI.Application/UserAndLogin/Services/UserService.cs index 728bcd2..0d9c2d1 100644 --- a/DocumentServiceAPI.Application/UserAndLogin/Services/UserService.cs +++ b/DocumentServiceAPI.Application/UserAndLogin/Services/UserService.cs @@ -120,21 +120,21 @@ } ).WithCache( 10).ToListAsync(); + //涓嶅啀閫夋嫨绉熸埛 + //var ten = await _db.Queryable<TenantInfo>().Where(x => x.IsEn == true && x.IsDel != true && x.ItCode == ItCode) + // .Select(x => new TenderVM + // { - var ten = await _db.Queryable<TenantInfo>().Where(x => x.IsEn == true && x.IsDel != true && x.ItCode == ItCode) - .Select(x => new TenderVM - { + // Description = x.Description, + // ItCode = ItCode, + // Name = x.Name, + // TenderId = x.Id, + // IsTender = true - Description = x.Description, - ItCode = ItCode, - Name = x.Name, - TenderId = x.Id, - IsTender = true - - } - ).WithCache(10).ToListAsync() ; - ten.AddRange(tentlist); - return ten; + // } + // ).WithCache(10).ToListAsync() ; + //ten.AddRange(tentlist); + return tentlist; } diff --git a/DocumentServiceAPI.Application/UserAndLogin/ViewMode/UserInfo.cs b/DocumentServiceAPI.Application/UserAndLogin/ViewMode/UserInfo.cs index 2ec9abe..c765b3e 100644 --- a/DocumentServiceAPI.Application/UserAndLogin/ViewMode/UserInfo.cs +++ b/DocumentServiceAPI.Application/UserAndLogin/ViewMode/UserInfo.cs @@ -133,7 +133,7 @@ /// 鐢ㄦ埛鍚� 鎵嬫満鍙烽獙璇� 蹇呭~ /// </summary> [Required] - [RegularExpression("/^(?:(?:\\+|00)86)?1\\d{10}$/")] + [DataValidation(ValidationTypes.PhoneNumber, ErrorMessage = "鍛樺伐璐︽埛璇疯緭鍏ユ湁鏁堢殑鐢佃瘽鍙风爜")] public string UserName { get; set; } /// <summary> /// 鐢ㄦ埛瀵嗙爜 diff --git a/DocumentServiceAPI.Model/Oder/Oder.cs b/DocumentServiceAPI.Model/Oder/Oder.cs index 818f1a7..a1e7ee4 100644 --- a/DocumentServiceAPI.Model/Oder/Oder.cs +++ b/DocumentServiceAPI.Model/Oder/Oder.cs @@ -63,6 +63,6 @@ /// </summary> public Guid? ZcUserID { get; set; } - + } } diff --git a/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs b/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs index 56e1f82..9950bfa 100644 --- a/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs +++ b/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs @@ -69,7 +69,7 @@ /// </summary> public DateTime? LoginTime { get; set; } /// <summary> - /// 鏄惁鐧诲綍 + /// 鏄惁鏃剁鐞嗗憳 /// </summary> public bool? IsLogin { get; set; } /// <summary> diff --git a/DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj b/DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj index 01b43b2..70473c7 100644 --- a/DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj +++ b/DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj @@ -12,9 +12,11 @@ <ItemGroup> + <ProjectReference Include="..\DocumentFile.Service\DocumentFile.Service.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Application\DocumentServiceAPI.Application.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Core\DocumentServiceAPI.Core.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Enum\DocumentServiceAPI.Enum.csproj" /> + <ProjectReference Include="..\DocumentServiceApi.InitQMessage\DocumentServiceApi.InitQMessage.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Model\DocumentServiceAPI.Model.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Services\DocumentServiceAPI.Services.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Utility\DocumentServiceAPI.Utility.csproj" /> diff --git a/DocumentServiceAPI.Web.Entry/appsettings.json b/DocumentServiceAPI.Web.Entry/appsettings.json index 5da1f39..6e558ac 100644 --- a/DocumentServiceAPI.Web.Entry/appsettings.json +++ b/DocumentServiceAPI.Web.Entry/appsettings.json @@ -12,7 +12,7 @@ { "ConfigId": "default", //澶氬簱閰嶇疆ID - "ConnectionString": "Server=.;Database=CY_DocumentSystemOnline;User ID=sa;Password=123456;", + "ConnectionString": "Server=localhost\\SQLEXPRESS;Database=CY_DocumentSystemOnline;User ID=sa;Password=123456;", "DbType": "SqlServer", "IsAutoCloseConnection": true @@ -21,7 +21,7 @@ { "ConfigId": "zhengcaioa", //澶氬簱閰嶇疆ID - "ConnectionString": "Server=.;Database=zhengcaioa55;User ID=sa;Password=123456;", + "ConnectionString": "Server=localhost\\SQLEXPRESS;Database=zhengcaioa55;User ID=sa;Password=123456;", "DbType": "SqlServer", "IsAutoCloseConnection": true @@ -29,7 +29,7 @@ } ], - "isCodeFirst": false, //鏄惁鎵цcodefirst 娉ㄦ剰杩欎釜鍦ㄨ縼寰欏畬鎴愬悗搴旇璁剧疆涓篺alse 闃叉鏇存敼鏁版嵁搴� + "isCodeFirst": true, //鏄惁鎵цcodefirst 娉ㄦ剰杩欎釜鍦ㄨ縼寰欏畬鎴愬悗搴旇璁剧疆涓篺alse 闃叉鏇存敼鏁版嵁搴� //璇蜂繚鎸乺edis涓烘甯稿彲鐢� "RedisConfig": { // 濡傛灉閲囩敤瀹瑰櫒鍖栭儴缃睸ervice 瑕佸啓鎴恟edis鐨勬湇鍔″悕锛屽惁鍒欏啓鍦板潃 diff --git a/DocumentServiceApi.InitQMessage/INITQSetups.cs b/DocumentServiceApi.InitQMessage/INITQSetups.cs index bd9ce74..522da3d 100644 --- a/DocumentServiceApi.InitQMessage/INITQSetups.cs +++ b/DocumentServiceApi.InitQMessage/INITQSetups.cs @@ -18,7 +18,8 @@ /// <summary> /// 娉ㄥ唽 INITQ /// </summary> - public class DocServiceApiStartup : AppStartup + + public class DocServiceINITQStartup : AppStartup { public void ConfigureServices(IServiceCollection services) { diff --git a/DocumentServiceApi.InitQMessage/MessageReceive.cs b/DocumentServiceApi.InitQMessage/MessageReceive.cs index 39221e6..f250681 100644 --- a/DocumentServiceApi.InitQMessage/MessageReceive.cs +++ b/DocumentServiceApi.InitQMessage/MessageReceive.cs @@ -1,9 +1,11 @@ -锘縰sing DocumentServiceAPI.Model.Oder; +锘縰sing DocumentServiceAPI.Model.cyDocumentModel; +using DocumentServiceAPI.Model.Oder; using DocumentServiceAPI.Model.Permissions; using DocumentServiceAPI.Model.UserInfoModel; using Furion; using Furion.JsonSerialization; using Furion.Logging.Extensions; +using Furion.Schedule; using InitQ.Abstractions; using InitQ.Attributes; using Microsoft.Extensions.Options; @@ -64,7 +66,7 @@ CreatBy = "娑堟伅闃熷垪 InitTenantOder", CreatTime = DateTime.Now, Description = obj.Description, - Name = obj.ITCode, + Name = obj.Name??obj.ITCode+"闆嗗洟璐﹀彿", PsW = obj.ITCode.Substring(obj.ITCode.Length - 4), @@ -81,12 +83,54 @@ }; + + //鏂板缓绉熸埛鍛樺伐 + Document_EmployeeInfo employeeInfo = new Document_EmployeeInfo() + { + EmployeeName = "闆嗗洟璐﹀彿", + UserName = Tinfo.ItCode, + AdviseFlag = 2, + UserId = 0, + IsWork = 1, + UserPassWord = Tinfo.ItCode.Substring(Tinfo.ItCode.Length - 6), + Job = "闆嗗洟鐢ㄦ埛", + IsLogin = true, + LastUpdateName = "娑堟伅闃熷垪 InitTenantOder", + LastUpdateTime = DateTime.Now, + }; + EmployeeAtTenant employeeAtTenant = new EmployeeAtTenant() + { + CreatBy = "娑堟伅闃熷垪 InitTenantOder", + CreatTime = DateTime.Now, + + }; + + Document_TenderUnit tenderUnit = new Document_TenderUnit() + { + UnitName = obj.Name ?? "闆嗗洟鍏徃", + AdviseFlag = 2, + UserId = 0, + CreatTime = DateTime.Now.ToString("yyyy MM dd"), + LastUpdateName = "娑堟伅闃熷垪 InitTenantOder", + LastUpdateTime = DateTime.Now, + IsDeled = false, + IsEn = true, + + + }; + try { await _db.AsTenant().BeginTranAsync(); var id= await _db.Insertable(Tinfo).ExecuteReturnIdentityAsync(); + var eid = await _db.Insertable(employeeInfo).ExecuteReturnIdentityAsync(); permissions.TenantId = id; + employeeAtTenant.TenantID = id; + employeeAtTenant.EmployeeID = eid; + tenderUnit.TenantId = id; + await _db.Insertable(tenderUnit).ExecuteCommandAsync(); + await _db.Insertable(employeeAtTenant).ExecuteCommandAsync(); await _db.Insertable(permissions).ExecuteCommandAsync (); await _db.Insertable(oder).ExecuteCommandAsync(); await _db.AsTenant().CommitTranAsync(); @@ -102,11 +146,17 @@ } else { + var Employee = await _db.Queryable<EmployeeAtTenant,Document_EmployeeInfo>((EAT, E) => new JoinQueryInfos( + + JoinType.Left, EAT.EmployeeID == E.EmployeeId +)).Where((EAT, E) => EAT.TenantID==Tinfo.Id).Select((EAT,E)=>E).FirstAsync(); + Tinfo.ItCode = obj.ITCode; Tinfo.UpdataBy = "娑堟伅闃熷垪 InitTenantOder"; Tinfo.UpdataTime = DateTime.Now; Tinfo.IsDel = false; Tinfo.IsEn = true; + var tp= await _db.Queryable<TenantPermissions>().Where(x=>x.TenantId==Tinfo.Id).FirstAsync(); try @@ -148,6 +198,14 @@ await _db.Updateable(tp).ExecuteCommandAsync(); } + if (obj.ITCode != Employee.UserName) + { + //濡傛灉鍙戠幇鐢ㄦ埛鍚嶅凡缁忔洿鏀癸紝鍒欒闆嗗洟鍛樺伐鐢ㄦ埛鍚嶈窡闅忔洿鏀� + Employee.UserName = obj.ITCode; + Employee.LastUpdateName= "娑堟伅闃熷垪 InitTenantOder"; + Employee.LastUpdateTime = DateTime.Now; + await _db.Updateable(Employee).ExecuteCommandAsync(); + } await _db.Insertable(oder).ExecuteCommandAsync(); await _db.AsTenant().CommitTranAsync(); diff --git a/DocumentServiceApi.InitQMessage/TenantOderInfo.cs b/DocumentServiceApi.InitQMessage/TenantOderInfo.cs index 26eac2c..874655b 100644 --- a/DocumentServiceApi.InitQMessage/TenantOderInfo.cs +++ b/DocumentServiceApi.InitQMessage/TenantOderInfo.cs @@ -54,6 +54,10 @@ /// 鎻忚堪 /// </summary> public string? Description { get; set; } + /// <summary> + /// 鍚嶇О + /// </summary> + public string? Name { get; set; } } -- Gitblit v1.9.1