From 67965cce30e900f9b6091170745ecf115f64e23d Mon Sep 17 00:00:00 2001 From: qwj <qwjzorro@163.com> Date: 星期三, 02 八月 2023 17:15:33 +0800 Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/DocumentService --- DocumentServiceAPI.Services/IService/ICacheService.cs | 38 .gitignore | 2 DocumentServiceAPI.Model/JwtInfo.cs | 70 + DocumentServiceAPI.Model/cyDocumentModel/Document_PerformanceInfo.cs | 97 +- DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.xml | 48 + DocumentServiceAPI.Model/UserInfoModel/TenantInfo.cs | 78 + DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.csproj | 1 DocumentServiceAPI.Application/UserAndLogin/ViewMode/Login.cs | 172 +++ DocumentServiceAPI.Application/applicationsettings.json | 53 DocumentServiceAPI.Application/UserAndLogin/Services/TokenService.cs | 96 ++ DocumentServiceAPI.Services/RedisCacheScService.cs | 42 DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj | 4 DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml | 242 +++++ DocumentServiceAPI.Application/UserAndLogin/UserInfoController.cs | 25 DocumentServiceAPI.Services/DocumentServiceAPI.Services.csproj | 17 DocumentServiceAPI.Model/UserInfoModel/EmployeeInfo.cs | 71 + DocumentServiceAPI.Web.Entry/AuthorizeHandler.cs | 40 DocumentServiceAPI.Web.Core/Handlers/DSRESTfulResultProvider.cs | 110 ++ DocumentServiceAPI.Web.Entry/appsettings.json | 24 DocumentServiceAPI.Web.Entry/DocServiceApiStartup.cs | 36 DocumentServiceAPI.Application/UserAndLogin/LogInController.cs | 175 +++ DocumentServiceAPI.Model/cyDocumentModel/Document_UserInfo.cs | 61 DocumentServiceAPI.Model/cyDocumentModel/Document_TenderUnit.cs | 487 ++++------ DocumentServiceAPI.Utility/DocumentServiceAPI.Utility.csproj | 4 DocumentServiceAPI.Model/UserInfoModel/EmployeeAtTenant.cs | 37 DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs | 199 +-- DocumentServiceAPI.Application/UserAndLogin/Services/Interfaces/ILoginVerifyService.cs | 12 DocumentServiceAPI.Web.Core/Handlers/JwtHandler.cs | 7 DocumentServiceAPI.sln | 7 DocumentServiceAPI.Application/UserAndLogin/dto/Mapper.cs | 16 /dev/null | 22 DocumentServiceAPI.Application/UserAndLogin/Services/UserService.cs | 176 ++++ DocumentServiceAPI.Core/DbContext.cs | 13 DocumentServiceAPI.Web.Core/Filter/EnumSchemaFilter .cs | 12 DocumentServiceAPI.Web.Core/Startup.cs | 8 DocumentServiceAPI.Model/cyDocumentModel/库目录.md | 26 DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj | 7 DocumentServiceAPI.Model/DSFulResult.cs | 46 + DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeRole.cs | 44 39 files changed, 2,022 insertions(+), 603 deletions(-) diff --git a/.gitignore b/.gitignore index 3ee380a..34fae7d 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ /DocumentServiceAPI.Web.Entry/appsettings.json /DocumentFile.Service/bin /DocumentFile.Service/obj +/DocumentServiceAPI.Services/bin +/DocumentServiceAPI.Services/obj diff --git a/DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj b/DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj index ca6081e..1ec5c17 100644 --- a/DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj +++ b/DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj @@ -24,10 +24,12 @@ <ItemGroup> <ProjectReference Include="..\DocumentServiceAPI.Core\DocumentServiceAPI.Core.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Model\DocumentServiceAPI.Model.csproj" /> + <ProjectReference Include="..\DocumentServiceAPI.Services\DocumentServiceAPI.Services.csproj" /> + <ProjectReference Include="..\DocumentServiceAPI.Utility\DocumentServiceAPI.Utility.csproj" /> </ItemGroup> <ItemGroup> - <Folder Include="UserInfo\" /> + <Folder Include="GlobalServices\" /> </ItemGroup> </Project> diff --git a/DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml b/DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml index ea0ca7b..e696fce 100644 --- a/DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml +++ b/DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml @@ -14,5 +14,247 @@ 绯荤粺鏈嶅姟鎺ュ彛 </summary> </member> + <member name="T:DocumentServiceAPI.Application.UserAndLogin.LogInController"> + <summary> + 鐧诲綍鎺у埗鍣� + </summary> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.LogInController.LogoIn(DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN)"> + <summary> + 鐧诲綍 1 杈撳叆鍛樺伐璐︽埛鎴栬�呯鎴疯处鎴凤紝2 閫夋嫨绉熸埛璐︽埛锛�3 閫夋嫨鍏徃 + </summary> + <returns>鐧诲綍淇℃伅</returns> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.LogInController.GetUnitList"> + <summary> + 鑾峰彇鍏徃鍒楄〃 + </summary> + <returns>鐧诲綍淇℃伅</returns> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.LogInController.GetTenantInfoList"> + <summary> + 鑾峰彇鍏徃鍒楄〃 + </summary> + <returns>鐧诲綍淇℃伅</returns> + </member> + <member name="T:DocumentServiceAPI.Application.UserAndLogin.Services.TokenService"> + <summary> + token鏈嶅姟绫� + </summary> + </member> + <member name="F:DocumentServiceAPI.Application.UserAndLogin.Services.TokenService.TokenKeys"> + <summary> + Token鏄暐 + </summary> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.Services.TokenService.CreateToken(DocumentServiceAPI.Model.JwtInfo)"> + <summary> + 鏂板缓涓�涓猅Oken + </summary> + <returns></returns> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.Services.TokenService.CheckToken"> + <summary> + 鏍¢獙jwt淇℃伅鏄惁鏈夋晥锛屽垽鍐冲崟绔櫥褰曢獙璇� + </summary> + <returns></returns> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.Services.TokenService.getTokenKey(DocumentServiceAPI.Model.JwtInfo)"> + <summary> + 鑾峰彇TokenKey + </summary> + <param name="jwt"></param> + <returns></returns> + </member> + <member name="T:DocumentServiceAPI.Application.UserAndLogin.Services.UserService"> + <summary> + 鐧诲綍楠岃瘉鏈嶅姟 + </summary> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.Services.UserService.GetEmployeeInfo(System.Int32,System.Int32)"> + <summary> + 鍛樺伐璇︽儏 + </summary> + <param name="ID"></param> + <param name="TenantID"></param> + <returns></returns> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.Services.UserService.GetJwtInfo"> + <summary> + 鑾峰彇Jwt鐩稿叧淇℃伅 + </summary> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.Services.UserService.GetUserUnitInfo(System.Int32)"> + <summary> + 鑾峰彇鍗曚綅鍒楄〃 + </summary> + <returns></returns> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.Services.UserService.GetUserTenderList(System.String)"> + <summary> + 鏍规嵁璐﹀彿鑾峰彇 Tender 鍒楄〃 + </summary> + <param name="ItCode"></param> + <returns></returns> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.Services.UserService.CheckPsw(System.Int32,System.Nullable{System.Int32},System.String)"> + <summary> + 妫�鏌ュ瘑鐮佹槸鍚︾櫥褰� + </summary> + <param name="TenantID"> 绉熸埛ID</param> + <param name="employeeID">鍛樺伐ID</param> + <param name="PsW">瀵嗙爜</param> + <returns></returns> + </member> + <member name="T:DocumentServiceAPI.Application.UserAndLogin.UserInfoController"> + <summary> + 鐧诲綍鎺у埗鍣� + </summary> + </member> + <member name="M:DocumentServiceAPI.Application.UserAndLogin.UserInfoController.GetUserInfo"> + <summary> + + </summary> + </member> + <member name="T:DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN"> + <summary> + 璐︽埛瀵嗙爜鐧诲綍 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN.ITCode"> + <summary> + 鐧诲綍璐﹀彿 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN.PassWord"> + <summary> + 瀵嗙爜 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN.Key"> + <summary> + 楠岃瘉鐮乲ey + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN.VerifyCoed"> + <summary> + 楠岃瘉鐮佷唬鐮� + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN.TenantId"> + <summary> + TenantITCode 绉熸埛ITCode + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN.employeeID"> + <summary> + 鍛樺伐鐧诲綍 娉ㄦ剰 濡傛灉涓嶆槸棣栨鐧诲綍锛岃繖涓珯濂介渶瑕佹牴鎹墍閫夌殑绉熸埛鐧诲綍杩斿洖缁撴灉鏉ョ‘瀹氭槸鍚︽槸鐢ㄥ憳宸ヨ处鍙风櫥褰曪紝濡傛灉涓虹┖锛岄粯璁ゆ湭閫夋嫨绉熸埛璐﹀彿鐧诲綍 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN.UnitID"> + <summary> + 鍗曚綅ID + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.LoginPsWordIN.Form"> + <summary> + 鏉ユ簮 + </summary> + </member> + <member name="T:DocumentServiceAPI.Application.UserAndLogin.ViewMode.EmployeeTenantInfo"> + <summary> + 绉熸埛璇︽儏妯″瀷 + </summary> + </member> + <member name="F:DocumentServiceAPI.Application.UserAndLogin.ViewMode.EmployeeTenantInfo._employeeInfo"> + <summary> + 鍛樺伐Info + </summary> + </member> + <member name="F:DocumentServiceAPI.Application.UserAndLogin.ViewMode.EmployeeTenantInfo._tenantInfo"> + <summary> + 绁濈 Info + </summary> + </member> + <member name="T:DocumentServiceAPI.Application.UserAndLogin.ViewMode.UnitVM"> + <summary> + 鍗曚綅璇︽儏 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.UnitVM.UnitID"> + <summary> + ID + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.UnitVM.UnitName"> + <summary> + 鍗曚綅鍚嶇О + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.UnitVM.Remark"> + <summary> + 鏍囨敞 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.UnitVM.UnitLogo"> + <summary> + logo + </summary> + </member> + <member name="T:DocumentServiceAPI.Application.UserAndLogin.ViewMode.TenderVM"> + <summary> + 绉熸埛璇︽儏 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.TenderVM.TenderId"> + <summary> + ID + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.TenderVM.ItCode"> + <summary> + 绉熸埛鍚� + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.TenderVM.Name"> + <summary> + 鍚嶇О + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.TenderVM.Description"> + <summary> + 鎻忚堪 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.TenderVM.EmployeeID"> + <summary> + 鍛樺伐ID + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.TenderVM.IsTender"> + <summary> + 鏄惁鏄富璐﹀彿 + </summary> + </member> + <member name="T:DocumentServiceAPI.Application.UserAndLogin.ViewMode.RetLoginVM"> + <summary> + 鐧诲綍杩斿洖 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.RetLoginVM.NeedNext"> + <summary> + 闇�瑕侀噸鏂扮櫥褰� + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.RetLoginVM.Units"> + <summary> + 鍏徃鍒楄〃 + </summary> + </member> + <member name="P:DocumentServiceAPI.Application.UserAndLogin.ViewMode.RetLoginVM.Tenders"> + <summary> + 绉熸埛鍒楄〃 + </summary> + </member> </members> </doc> diff --git a/DocumentServiceAPI.Application/UserAndLogin/LogInController.cs b/DocumentServiceAPI.Application/UserAndLogin/LogInController.cs new file mode 100644 index 0000000..ddcbf1f --- /dev/null +++ b/DocumentServiceAPI.Application/UserAndLogin/LogInController.cs @@ -0,0 +1,175 @@ +锘縰sing DocumentServiceAPI.Application.UserAndLogin.Services; +using DocumentServiceAPI.Application.UserAndLogin.ViewMode; +using DocumentServiceAPI.Utility; +using Furion.DynamicApiController; +using Furion.JsonSerialization; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Application.UserAndLogin +{ + /// <summary> + /// 鐧诲綍鎺у埗鍣� + /// </summary> + [ApiDescriptionSettings("LogInAndUser")] + [DynamicApiController] + public class LogInController + { + private TokenService _tokenService; + private UserService _userService; + public LogInController(TokenService tokenService,UserService userService) { + _tokenService = tokenService; + _userService = userService; + } + /// <summary> + /// 鐧诲綍 1 杈撳叆鍛樺伐璐︽埛鎴栬�呯鎴疯处鎴凤紝2 閫夋嫨绉熸埛璐︽埛锛�3 閫夋嫨鍏徃 + /// </summary> + /// <returns>鐧诲綍淇℃伅</returns> + [HttpPost("LogoIn")] + public async Task<RetLoginVM> LogoIn (LoginPsWordIN Parma) + { + bool needtoken=false; + if (Parma.TenantId==null) + { + //濡傛灉杩樻病纭畾绉熸埛ID 闇�瑕佸厛纭畾绉熸埛ID + List<TenderVM>Tender = await _userService.GetUserTenderList(Parma.ITCode); + + switch (Tender.Count) + { + case 0: + throw Oops.Oh($"璐︽埛鎴栬�呭瘑鐮侀敊璇�"); + case 1: + needtoken = await _userService.CheckPsw(Tender[0].TenderId, Tender[0].EmployeeID,Parma.PassWord); + + if(!needtoken) + throw Oops.Oh($"璐︽埛鎴栬�呭瘑鐮侀敊璇�"); + if (Parma.UnitID == null) + { + var Units = await _userService.GetUserUnitInfo(Parma.TenantId ?? 0); + if (Units.Count == 0) + { + //娌℃湁鍏徃 + needtoken = true; + } + else if (Units.Count == 1) + { + Parma.UnitID = Units[0].UnitID; + needtoken = true; + } + else + { + //鍏朵粬闇�瑕佺敤鎴烽�夋嫨绉熸埛 + return new RetLoginVM + { + NeedNext = true, + Units = Units, + + }; + } + } + Parma.TenantId = Tender[0].TenderId; + break; + + default: + //鍏朵粬闇�瑕佺敤鎴烽�夋嫨绉熸埛 + return new RetLoginVM + { + NeedNext = true, + Tenders = Tender, + + }; + + + } + + + + + + } + else if(Parma.UnitID==null) + { + + var Units = await _userService.GetUserUnitInfo(Parma.TenantId??0); + if(Units.Count==0) + { + //娌℃湁鍏徃 + needtoken = true; + } + else if (Units.Count==1) { + Parma.UnitID= Units[0].UnitID; + needtoken = true; + } + else + { + //鍏朵粬闇�瑕佺敤鎴烽�夋嫨绉熸埛 + return new RetLoginVM + { + NeedNext = true, + Units = Units, + + }; + } + + } + + if(needtoken|| Parma.UnitID!=null) + { + TenderVM Tender = (await _userService.GetUserTenderList(Parma.ITCode)).Where(x=>x.TenderId==Parma.TenantId&&x.EmployeeID==Parma.employeeID).SingleOrDefault(); + if(Tender==null) + { + throw Oops.Oh($"璐︽埛瀵嗙爜鎴栬�呯鎴烽�夋嫨閿欒"); + } + needtoken = await _userService.CheckPsw(Tender. TenderId, Tender.EmployeeID, Parma.PassWord); + + if (!needtoken) + throw Oops.Oh($"璐︽埛鎴栬�呭瘑鐮侀敊璇�"); + var token= _tokenService.CreateToken(new Model.JwtInfo + { + EID = Tender.EmployeeID, + LogInSource = Parma.Form, + TID = Tender.TenderId, + UID = Parma.UnitID, + }); + return new RetLoginVM + { + NeedNext = false, + Token = token, + + }; + } + throw Oops.Oh($"鍙傛暟閿欒"); + + + } + + + + + /// <summary> + /// 鑾峰彇鍏徃鍒楄〃 + /// </summary> + /// <returns>鐧诲綍淇℃伅</returns> + public bool GetUnitList() + { + + return true; + } + /// <summary> + /// 鑾峰彇鍏徃鍒楄〃 + /// </summary> + /// <returns>鐧诲綍淇℃伅</returns> + public bool GetTenantInfoList() + { + + return true; + } + public string Get() + { + return $"Hello {nameof(Furion)}"; + } + } +} diff --git a/DocumentServiceAPI.Application/UserAndLogin/Services/Interfaces/ILoginVerifyService.cs b/DocumentServiceAPI.Application/UserAndLogin/Services/Interfaces/ILoginVerifyService.cs new file mode 100644 index 0000000..da67b06 --- /dev/null +++ b/DocumentServiceAPI.Application/UserAndLogin/Services/Interfaces/ILoginVerifyService.cs @@ -0,0 +1,12 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Application.UserAndLogin.Services.Interfaces +{ + public interface ILoginVerifyService + { + } +} diff --git a/DocumentServiceAPI.Application/UserAndLogin/Services/TokenService.cs b/DocumentServiceAPI.Application/UserAndLogin/Services/TokenService.cs new file mode 100644 index 0000000..f7e4355 --- /dev/null +++ b/DocumentServiceAPI.Application/UserAndLogin/Services/TokenService.cs @@ -0,0 +1,96 @@ +锘縰sing DocumentServiceAPI.Model; +using DocumentServiceAPI.Services.IService; +using Furion.Authorization; +using Furion.DistributedIDGenerator; +using Furion.JsonSerialization; +using NetTaste; +using SqlSugar.Extensions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Security.Claims; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Application.UserAndLogin.Services +{ + /// <summary> + /// token鏈嶅姟绫� + /// </summary> + public class TokenService: IScoped + { + /// <summary> + /// Token鏄暐 + /// </summary> + static string TokenKeys = "TokenKeys:"; + private ISqlSugarClient _db; + private UserService _UserService; + private IRedisCacheService _RedisCase; + public TokenService(ISqlSugarClient db, UserService UserInfoService, IRedisCacheService RedisCase ) { + _db = db; + _UserService = UserInfoService; + _RedisCase = RedisCase; + } + /// <summary> + /// 鏂板缓涓�涓猅Oken + /// </summary> + /// <returns></returns> + public string CreateToken(JwtInfo jwt) + { + string TokenKey=TokenKeys+ getTokenKey(jwt); + IDictionary<string, object> propertyDictionary = new Dictionary<string, object>(); + + PropertyInfo[] properties = jwt.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); + + foreach (PropertyInfo property in properties) + { + string propertyName = property.Name; + object propertyValue = property.GetValue(jwt); + + propertyDictionary.Add(propertyName.ToLower(), propertyValue); + } + var ID = IDGen.NextID(); + jwt.JID = ID; + var token= JWTEncryption.Encrypt(propertyDictionary, App.GetConfig<JWTSettingsOptions>("JWTSettings").ExpiredTime ?? 3600); + if(jwt.LogInSource==LogInFrom.PC) + _RedisCase.Add<string>(TokenKey, ID.ToString(), expireSeconds: (int )(App.GetConfig<JWTSettingsOptions>("JWTSettings").ExpiredTime??3600)); + return token; + } + + + + + /// <summary> + /// 鏍¢獙jwt淇℃伅鏄惁鏈夋晥锛屽垽鍐冲崟绔櫥褰曢獙璇� + /// </summary> + /// <returns></returns> + public bool CheckToken() + { + + var Jwtinfo= _UserService.GetJwtInfo(); + + var Key= getTokenKey(Jwtinfo); + + string T = _RedisCase.Get<string>(Key); + if (T == null) + return true; + if (T != Jwtinfo.JID.ToString()) + return false; + return true; + + + } + /// <summary> + /// 鑾峰彇TokenKey + /// </summary> + /// <param name="jwt"></param> + /// <returns></returns> + private string getTokenKey(JwtInfo jwt) + { + string TokenKey = TokenKeys + jwt.EID?.ToString() + jwt.UID?.ToString() + jwt.TID?.ToString(); + return TokenKey; + } + } + +} diff --git a/DocumentServiceAPI.Application/UserAndLogin/Services/UserService.cs b/DocumentServiceAPI.Application/UserAndLogin/Services/UserService.cs new file mode 100644 index 0000000..565e374 --- /dev/null +++ b/DocumentServiceAPI.Application/UserAndLogin/Services/UserService.cs @@ -0,0 +1,176 @@ +锘縰sing DocumentServiceAPI.Application.UserAndLogin.Services.Interfaces; +using DocumentServiceAPI.Application.UserAndLogin.ViewMode; +using DocumentServiceAPI.Model; +using DocumentServiceAPI.Model.cyDocumentModel; +using DocumentServiceAPI.Model.UserInfoModel; +using SqlSugar.Extensions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Claims; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Application.UserAndLogin.Services +{ + /// <summary> + /// 鐧诲綍楠岃瘉鏈嶅姟 + /// </summary> + public class UserService : ILoginVerifyService, IScoped + { + private ISqlSugarClient _db { get; set; } + public UserService(ISqlSugarClient db) + { + _db = db; + } + /// <summary> + /// 鍛樺伐璇︽儏 + /// </summary> + /// <param name="ID"></param> + /// <param name="TenantID"></param> + /// <returns></returns> + public async Task<EmployeeTenantInfo> GetEmployeeInfo(int ID, int TenantID) + { + var ret = await _db.Queryable<EmployeeInfo, EmployeeAtTenant, TenantInfo>((ei, eiat, ti) => + new JoinQueryInfos( + JoinType.Right, ei.Id == eiat.EmployeeID, //宸﹁繛鎺� 宸﹂摼鎺� 宸﹁仈 + JoinType.Right, ti.Id == eiat.TenantID + )).Where((ei, eiat, ti) => ei.Id == ID && TenantID == ti.Id) + .Select(expression: (ei, eiat, ti) => new EmployeeTenantInfo + { + _employeeInfo = ei, + _tenantInfo = ti + + }).SingleAsync(); + + return ret; + } + + /// <summary> + /// 鑾峰彇Jwt鐩稿叧淇℃伅 + /// </summary> + public JwtInfo GetJwtInfo() + { + JwtInfo jwtInfo = new JwtInfo(); + jwtInfo.LogInSource = (LogInFrom)(App.User?.FindFirstValue("loginfrom")?.ObjToInt() ?? 0); + jwtInfo.EID = App.User?.FindFirstValue("eid")?.ObjToInt(); + jwtInfo.UID = App.User?.FindFirstValue("uid")?.ObjToInt(); + jwtInfo.TID = App.User?.FindFirstValue("tid")?.ObjToInt(); + var guid = App.User?.FindFirstValue("jid"); + jwtInfo.JID = string.IsNullOrEmpty(guid) ? new Guid(guid) : null; + return jwtInfo; + } + /// <summary> + /// 鑾峰彇鍗曚綅鍒楄〃 + /// </summary> + /// <returns></returns> + public async Task<List<UnitVM>> GetUserUnitInfo(int tid ) + { + + var list = await _db.Queryable<DocumentServiceAPI.Model.cyDocumentModel.Document_TenderUnit>() + .Where((tu) => tu.TenantId == tid && tu.IsEn == true && tu.IsDeled != true) + .Select((tu) => new UnitVM + { + UnitID = tu.UnitId, + UnitName = tu.UnitName, + Remark = tu.Remark, + UnitLogo = tu.UnitLogo, + }) + .ToListAsync(); + return list; + } + + /// <summary> + /// 鏍规嵁璐﹀彿鑾峰彇 Tender 鍒楄〃 + /// </summary> + /// <param name="ItCode"></param> + /// <returns></returns> + public async Task<List<TenderVM>> GetUserTenderList(string ItCode) + + { + + var tentlist= await _db.Queryable<TenantInfo, EmployeeAtTenant, Document_EmployeeInfo>((ti, et, ei) => + + new JoinQueryInfos + ( + JoinType.Right, ti.Id == et.TenantID, //宸﹁繛鎺� 宸﹂摼鎺� 宸﹁仈 + JoinType.Right, ei.EmployeeId == et.EmployeeID + ) + ) + .Where((ti, et, ei) => + ( ei.UserName == ItCode) && (ti.IsEn == true) && (ti.IsDel != true) && (ei.IsWork == null || ei.IsWork == 1)) + + .Select((ti, et, ei) => new TenderVM + { + EmployeeID = ei.EmployeeId, + Description = ti.Description, + ItCode = ItCode, + Name = ti.Name, + TenderId = ti.Id + + } + ).ToListAsync(); + + 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 + + } + ).ToListAsync() ; + ten.AddRange(tentlist); + return ten; + + } + + /// <summary> + /// 妫�鏌ュ瘑鐮佹槸鍚︾櫥褰� + /// </summary> + /// <param name="TenantID"> 绉熸埛ID</param> + /// <param name="employeeID">鍛樺伐ID</param> + /// <param name="PsW">瀵嗙爜</param> + /// <returns></returns> + public async Task<bool> CheckPsw(int TenantID, int? employeeID, string PsW) + { + if (employeeID == null) + { + var psw = await _db.Queryable<TenantInfo>().Where(x => x.Id == TenantID).Select(x => x.PsW).SingleAsync(); + if (PsW == psw) + return true; + } + else + { + var psw = await _db.Queryable<Document_EmployeeInfo, EmployeeAtTenant, TenantInfo>((ei, et, ti) => + + new JoinQueryInfos + ( + JoinType.Left, ei.EmployeeId == et.EmployeeID, //宸﹁繛鎺� 宸﹂摼鎺� 宸﹁仈 + JoinType.Left, ti.Id == et.TenantID + ) + ).Where((ei, et, ti) => + + ei.EmployeeId == employeeID && ti.Id == TenantID + ) + .Select((ei, et, ti) => ei.UserPassWord) + .SingleAsync(); + if (PsW == psw) + return true; + } + return false; + + } + + + + } + + +} + + + diff --git a/DocumentServiceAPI.Application/UserAndLogin/UserInfoController.cs b/DocumentServiceAPI.Application/UserAndLogin/UserInfoController.cs new file mode 100644 index 0000000..0629ec4 --- /dev/null +++ b/DocumentServiceAPI.Application/UserAndLogin/UserInfoController.cs @@ -0,0 +1,25 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Application.UserAndLogin +{ + + /// <summary> + /// 鐧诲綍鎺у埗鍣� + /// </summary> + [ApiDescriptionSettings("LogInAndUser")] + [DynamicApiController] + public class UserInfoController + { + /// <summary> + /// + /// </summary> + public void GetUserInfo() + { + + } + } +} diff --git a/DocumentServiceAPI.Application/UserAndLogin/ViewMode/Login.cs b/DocumentServiceAPI.Application/UserAndLogin/ViewMode/Login.cs new file mode 100644 index 0000000..cf1f8e8 --- /dev/null +++ b/DocumentServiceAPI.Application/UserAndLogin/ViewMode/Login.cs @@ -0,0 +1,172 @@ +锘縰sing DocumentServiceAPI.Model; +using DocumentServiceAPI.Model.UserInfoModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Application.UserAndLogin.ViewMode +{ + /// <summary> + /// 璐︽埛瀵嗙爜鐧诲綍 + /// </summary> + public class LoginPsWordIN + { + /// <summary> + /// 鐧诲綍璐﹀彿 + /// </summary> + public string ITCode{ get; set; } + /// <summary> + /// 瀵嗙爜 + /// </summary> + public string? PassWord { get; set; } + + + /// <summary> + /// 楠岃瘉鐮乲ey + /// </summary> + public string? Key { get; set; } + + + /// <summary> + /// 楠岃瘉鐮佷唬鐮� + /// </summary> + public string? VerifyCoed { get; set; } + + /// <summary> + /// TenantITCode 绉熸埛ITCode + /// </summary> + public int ? TenantId { get; set; } + + /// <summary> + /// 鍛樺伐鐧诲綍 娉ㄦ剰 濡傛灉涓嶆槸棣栨鐧诲綍锛岃繖涓珯濂介渶瑕佹牴鎹墍閫夌殑绉熸埛鐧诲綍杩斿洖缁撴灉鏉ョ‘瀹氭槸鍚︽槸鐢ㄥ憳宸ヨ处鍙风櫥褰曪紝濡傛灉涓虹┖锛岄粯璁ゆ湭閫夋嫨绉熸埛璐﹀彿鐧诲綍 + /// </summary> + public int? employeeID { get; set; } + /// <summary> + /// 鍗曚綅ID + /// </summary> + public int ? UnitID { get; set; } + + /// <summary> + /// 鏉ユ簮 + /// </summary> + public LogInFrom Form { get; set; } + + } + + + + /// <summary> + /// 绉熸埛璇︽儏妯″瀷 + /// </summary> + public class EmployeeTenantInfo + { + /// <summary> + /// 鍛樺伐Info + /// </summary> + public EmployeeInfo _employeeInfo; + /// <summary> + /// 绁濈 Info + /// </summary> + public TenantInfo _tenantInfo; + + + } + + /// <summary> + /// 鍗曚綅璇︽儏 + /// </summary> + public class UnitVM + { + /// <summary> + /// ID + /// </summary> + public int UnitID { get; set; } + /// <summary> + /// 鍗曚綅鍚嶇О + /// </summary> + public string UnitName { get; set; } + /// <summary> + /// 鏍囨敞 + /// </summary> + public string Remark { get; set; } + /// <summary> + /// logo + /// </summary> + public string UnitLogo { get; set; } + } + + /// <summary> + /// 绉熸埛璇︽儏 + /// </summary> + public class TenderVM + { + /// <summary> + /// ID + /// </summary> + + + public int TenderId { get; set; } + + /// <summary> + /// 绉熸埛鍚� + /// </summary> + + + public string ItCode { get; set; } + + /// <summary> + /// 鍚嶇О + /// </summary> + + + public string Name { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + + public string Description { get; set; } + + /// <summary> + /// 鍛樺伐ID + /// </summary> + public int? EmployeeID { get; set; } + + /// <summary> + /// 鏄惁鏄富璐﹀彿 + /// </summary> + public bool IsTender { get; set; } = false; + + } + + /// <summary> + /// 鐧诲綍杩斿洖 + /// </summary> + public class RetLoginVM + { + /// <summary> + /// 闇�瑕侀噸鏂扮櫥褰� + /// </summary> + + public bool NeedNext { get; set; }=true; + /// <summary> + /// 鍏徃鍒楄〃 + /// </summary> +#nullable enable + public List<UnitVM>? Units { get; set; } + /// <summary> + /// 绉熸埛鍒楄〃 + /// </summary> +#nullable enable + public List<TenderVM>? Tenders { get; set; } + +#nullable enable + public string? Token { get; set; } + + + + } + +} diff --git a/DocumentServiceAPI.Application/UserAndLogin/dto/Mapper.cs b/DocumentServiceAPI.Application/UserAndLogin/dto/Mapper.cs new file mode 100644 index 0000000..f3c23d7 --- /dev/null +++ b/DocumentServiceAPI.Application/UserAndLogin/dto/Mapper.cs @@ -0,0 +1,16 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Application.UserAndLogin.dto +{ + public class Mapper : IRegister + { + public void Register(TypeAdapterConfig config) + { + + } + } +} diff --git a/DocumentServiceAPI.Application/applicationsettings.json b/DocumentServiceAPI.Application/applicationsettings.json index 8911167..9ba3089 100644 --- a/DocumentServiceAPI.Application/applicationsettings.json +++ b/DocumentServiceAPI.Application/applicationsettings.json @@ -3,25 +3,50 @@ "SpecificationDocumentSettings": { "DocumentTitle": "Furion | 瑙勮寖鍖栨帴鍙�", "GroupOpenApiInfos": [ - - { - "Group": "Default", - "Title": "鏍囦功绠$悊绯荤粺鏈嶅姟", - "Description": "杩欎釜涓�涓緢濂界敤鏍囦功绠$悊绯荤粺鏈嶅姟杞欢", - "Version": "1.0.0", - "Contact": { - "Name": "鏀块噰鍜ㄨ鏈夐檺鍏徃", - "Url": "http://www.51zhengcai.com" - }, - "License": { - "Name": "鏀块噰鍜ㄨ鏈夐檺鍏徃", - "Url": "http://www.51zhengcai.com" - } + { + "Group": "Default", + "Title": "鏍囦功绠$悊绯荤粺鏈嶅姟", + "Description": "杩欎釜涓�涓緢濂界敤鏍囦功绠$悊绯荤粺鏈嶅姟杞欢", + "Version": "1.0.0", + "Contact": { + "Name": "鏀块噰鍜ㄨ鏈夐檺鍏徃", + "Url": "http://www.51zhengcai.com" + + }, + "License": { + "Name": "鏀块噰鍜ㄨ鏈夐檺鍏徃", + "Url": "http://www.51zhengcai.com" } + } ] }, + + //swags 鍚嶇О閰嶇疆 榛樿鍒嗙粍 + "[openapi:LogInAndUser]": { + "Title": "鐧诲綍鍜岀敤鎴�", + "Order": 0, + "Description": "鐢ㄦ埛鍜岀櫥褰曠浉鍏�", + "Version": "1.0.0", + "Contact": { + "Name": "鏀块噰鍜ㄨ鏈夐檺鍏徃", + "Url": "http://www.51zhengcai.com" + + }, + "License": { + "Name": "鏀块噰鍜ㄨ鏈夐檺鍏徃", + "Url": "http://www.51zhengcai.com" + } + }, + + //閰嶇疆璺敱椋庢牸 + "DynamicApiControllerSettings": { + "KeepName": true,//淇濇寔璺敱涓�鑷� + "KeepVerb": true,//淇濇寔鐗堟湰鍙蜂竴鑷� + "LowercaseRoute": false + }, + "CorsAccessorSettings": { "WithExposedHeaders": [ "access-token", diff --git a/DocumentServiceAPI.Core/DbContext.cs b/DocumentServiceAPI.Core/DbContext.cs index 2aaa3fd..069d96f 100644 --- a/DocumentServiceAPI.Core/DbContext.cs +++ b/DocumentServiceAPI.Core/DbContext.cs @@ -92,11 +92,12 @@ /// <param name="ModeProjectName"></param> public static void DbCodeFirst(this IApplicationBuilder app, string ModeProjectName, string? Modenamespace = null, string? ConfigId = null) { - var ddb= App.GetService<ISqlSugarClient>(); + var _db = app.ApplicationServices.GetService<ISqlSugarClient>(); //鍒囨崲鏁版嵁搴� if (!string.IsNullOrEmpty(ConfigId)) _db.AsTenant().ChangeDatabase(ConfigId); + //寤哄簱 _db.DbMaintenance.CreateDatabase(); Type[]? types = UtilityFun.GetAllAssembly().Where(x => x.FullName.Contains(ModeProjectName + ",")).FirstOrDefault()?.GetTypes().WhereIF(!string.IsNullOrEmpty(Modenamespace), name => name.FullName.Contains(Modenamespace + ".")).ToArray().Where(x => x.IsSubclassOf(typeof(BaseModel))).ToArray(); @@ -104,4 +105,14 @@ _db.CodeFirst.InitTables(types);//鏍规嵁types鍒涘缓琛� } + public static void DbCodeFirst(this IApplicationBuilder app, Type Obj, string? ConfigId = null) + { + var _db = app.ApplicationServices.GetService<ISqlSugarClient>(); + //鍒囨崲鏁版嵁搴� + if (!string.IsNullOrEmpty(ConfigId)) + _db.AsTenant().ChangeDatabase(ConfigId); + //寤哄簱 + _db.DbMaintenance.CreateDatabase(); + _db.CodeFirst.InitTables(Obj);//鏍规嵁types鍒涘缓琛� + } } diff --git a/DocumentServiceAPI.Model/DSFulResult.cs b/DocumentServiceAPI.Model/DSFulResult.cs new file mode 100644 index 0000000..52dc8ee --- /dev/null +++ b/DocumentServiceAPI.Model/DSFulResult.cs @@ -0,0 +1,46 @@ +锘� +namespace DocumentServiceAPI.Model +{ + /// <summary> + /// 缁熶竴杩斿洖绫诲瀷妯″瀷瀹氫箟 + /// </summary> + /// <typeparam name="T"></typeparam> + public class DSFulResult<T> + { + /// <summary> + /// 鐘舵�佺爜 + /// </summary> + public int? StatusCode { get; set; } + /// <summary> + /// 鐘舵�佺爜 + /// </summary> + public int? Code { get; set; } + + /// <summary> + /// 鏁版嵁 + /// </summary> + public T? Data { get; set; } + + + + /// <summary> + /// 閿欒淇℃伅 + /// </summary> + public object? Error { get; set; } + + /// <summary> + /// 闄勫姞鏁版嵁 + /// </summary> + public object? Extras { get; set; } + + /// <summary> + /// 鏃堕棿鎴� + /// </summary> + public long? Timestamp { get; set; } + /// <summary> + /// 鍏朵粬娑堟伅 + /// </summary> + public string? Message { get; set; } + } + +} diff --git a/DocumentServiceAPI.Model/JwtInfo.cs b/DocumentServiceAPI.Model/JwtInfo.cs new file mode 100644 index 0000000..39d2cd5 --- /dev/null +++ b/DocumentServiceAPI.Model/JwtInfo.cs @@ -0,0 +1,70 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Model +{ + /// <summary> + /// Jwt淇℃伅 + /// </summary> + public class JwtInfo + { + /// <summary> + /// 鍛樺伐ITCODE + /// </summary> + public int? EID { get; set; } + + /// <summary> + /// 绉熸埛ID + /// </summary> + public int ?TID { get; set; } + + + /// <summary> + /// 鍏徃ID + /// </summary> + public int? UID { get; set; } + + /// <summary> + /// Id璇嗗埆鍙凤紝涓昏鐢ㄤ簬鍒ゆ柇鍗曠鐧诲綍 + /// </summary> + public Guid? JID { get; set; } + + /// <summary> + /// 鐧诲綍婧� + /// </summary> + public LogInFrom LogInSource { get; set; } + } + + /// <summary> + /// 鐧诲綍婧� 绫诲瀷 + /// </summary> + public enum LogInFrom + { + /// <summary> + /// PCAPP鐧诲綍 + /// </summary> + [Description( "PCAPP鐧诲綍")] + PC, + /// <summary> + /// APP绔櫥褰� + /// </summary> + [Description("APP绔櫥褰�")] + APP, + /// <summary> + /// 寰俊灏忕▼搴忕櫥褰� + /// </summary> + [Description("寰俊灏忕▼搴忕櫥褰�")] + WeChat, + /// <summary> + /// 椤甸潰绔櫥褰� + /// </summary> + [Description("椤甸潰绔櫥褰�")] + Web + + } +} diff --git a/DocumentServiceAPI.Model/User/JobInfo.cs b/DocumentServiceAPI.Model/User/JobInfo.cs deleted file mode 100644 index b9e846e..0000000 --- a/DocumentServiceAPI.Model/User/JobInfo.cs +++ /dev/null @@ -1,40 +0,0 @@ -锘縰sing DocumentServiceAPI.Enum; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DocumentServiceAPI.Model.User -{ - /// <summary> - /// 宀椾綅琛� - /// </summary> - [SugarTable(TableDescription = "宀椾綅鍜孶ser 涓棿琛�")] - public class JobInfo : BaseModel - { - /// <summary> - /// ID - /// </summary> - [Display(Name = "ID ")] - [SugarColumn(ColumnDescription = "ID ", IsPrimaryKey = true, IsIdentity = true)] - public int ID { get; set; } - - /// <summary> - /// 鑱屼綅鍚嶇О - /// </summary> - [Display(Name = "鑱屼綅鍚嶇О ")] - [SugarColumn(ColumnDescription = "鑱屼綅鍚嶇О ")] - public string JobName { get; set; } - - - /// <summary> - /// 鍏徃鍚嶇О - /// </summary> - [Display(Name = "鍏徃鍚嶇О ")] - [SugarColumn(ColumnDescription = "鍏徃鍚嶇О ")] - public int UntilID { get; set; } - } -} diff --git a/DocumentServiceAPI.Model/User/UnitInfo.cs b/DocumentServiceAPI.Model/User/UnitInfo.cs deleted file mode 100644 index bbd651d..0000000 --- a/DocumentServiceAPI.Model/User/UnitInfo.cs +++ /dev/null @@ -1,100 +0,0 @@ -锘縰sing DocumentServiceAPI.Enum; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DocumentServiceAPI.Model.User -{ - - /// <summary> - /// 鍗曚綅淇℃伅 - /// </summary> - [SugarTable(TableDescription = "鍗曚綅淇℃伅")] - public class UnitInfo : BaseModel - { - - [DisplayName("鍗曚綅ID")] - [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - public int id { get; set; } - [DisplayName("鍗曚綅鍚嶇О")] - [SugarColumn(Length = 200)] - public string UnitName { get; set; } - [DisplayName("鍗曚綅绫诲瀷")] - public string UnitType { get; set; } - [DisplayName("鍦板潃")] - public string Address { get; set; } - [DisplayName("閭斂缂栫爜")] - public string ZipCode { get; set; } - [DisplayName("鑱旂郴浜�")] - public string ContactPerson { get; set; } - [DisplayName("鑱旂郴鐢佃瘽")] - public string ContactPhone { get; set; } - [DisplayName("缃戝潃")] - public string WebUrl { get; set; } - [DisplayName("缁勭粐缁撴瀯")] - public string OrgStructure { get; set; } - [DisplayName("娉曚汉浠h〃")] - public string Corporater { get; set; } - [DisplayName("娉曚汉浠h〃鑱屽姟")] - public string CorporaterPost { get; set; } - [DisplayName("娉曚汉浠h〃鎶�鏈亴鍔�")] - public string CorporaterTechnicalPost { get; set; } - [DisplayName("娉曚汉浠h〃鐢佃瘽")] - public string CorporatePhone { get; set; } - [DisplayName("鎶�鏈礋璐d汉")] - public string TechnicalLeader { get; set; } - [DisplayName("鎶�鏈礋璐d汉鑱屽姟")] - public string TechnicalPost { get; set; } - [DisplayName("鎶�鏈礋璐d汉鐢佃瘽")] - public string TechnicalPhone { get; set; } - [DisplayName("鍛樺伐鏁伴噺")] - public string StaffCount { get; set; } - [DisplayName("浼佷笟璧勮川绛夌骇")] - public string FirmQualificationLevel { get; set; } - [DisplayName("钀ヤ笟鎵х収")] - public string BusinessLicense { get; set; } - [DisplayName("娉ㄥ唽璧勯噾")] - public string RegMoney { get; set; } - [DisplayName("寮�鎴疯")] - public string OpenBank { get; set; } - [DisplayName("閾惰璐﹀彿")] - public string BankNum { get; set; } - [DisplayName("椤圭洰缁忕悊")] - public string ProjectManager { get; set; } - [DisplayName("楂樼骇鍛樺伐")] - public string SeniorStaff { get; set; } - [DisplayName("涓骇鍛樺伐")] - public string MiddleStaff { get; set; } - [DisplayName("鍒濈骇鍛樺伐")] - public string PrimaryStaff { get; set; } - [DisplayName("鏈烘宸�")] - public string Mechanicer { get; set; } - [DisplayName("涓氬姟鍐呭")] - public string BusinessContent { get; set; } - [DisplayName("澶囨敞")] - public string Remark { get; set; } - [DisplayName("鍗曚綅Logo")] - public string UnitLogo { get; set; } - [DisplayName("鍗曚綅Logo鐗堟湰鍙�")] - public string UnitLogoVersionNo { get; set; } - [DisplayName("鍗曚綅Logo澶у皬")] - public int? UnitLogoSize { get; set; } - [DisplayName("韬唤璇佹闈�")] - public string CardPositive { get; set; } - [DisplayName("韬唤璇佹闈㈢増鏈彿")] - public string CardPositiveVersionNo { get; set; } - [DisplayName("韬唤璇佹闈㈠ぇ灏�")] - public int? CardPositiveSize { get; set; } - [DisplayName("鏄惁浣跨敤")] - public int? IsUsed { get; set; } - - [DisplayName("寤鸿鏍囧織")] - - public int? AdviseFlag { get; set; } - - } -} diff --git a/DocumentServiceAPI.Model/User/UserInfo.cs b/DocumentServiceAPI.Model/User/UserInfo.cs deleted file mode 100644 index 9f802a8..0000000 --- a/DocumentServiceAPI.Model/User/UserInfo.cs +++ /dev/null @@ -1,92 +0,0 @@ -锘縰sing DocumentServiceAPI.Enum; -using SqlSugar; -using System.ComponentModel; - -namespace DocumentServiceAPI.Model.User -{ - /// <summary> - /// 鐢ㄦ埛璇︽儏琛� - /// </summary> - - [SugarTable(TableDescription = "鐢ㄦ埛璇︽儏琛�")] - public class UserInfo : BaseModel - { - - /// <summary> - /// 鍛樺伐ID 鑷ID - /// </summary> - - [DisplayName("鍛樺伐ID")] - [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - /// <summary> - /// 鍛樺伐濮撳悕 - /// </summary> - [DisplayName("鍛樺伐濮撳悕")] - public string EmployeeName { get; set; } - - /// <summary> - /// 鐢佃瘽 - /// </summary> - [DisplayName("鐢佃瘽")] - public string Phone { get; set; } - /// <summary> - /// 鏄惁鍦ㄨ亴 - /// </summary> - [DisplayName("鏄惁鍦ㄨ亴")] - public int? IsWork { get; set; } - /// <summary> - /// 绂昏亴鏃堕棿 - /// </summary> - [DisplayName("绂昏亴鏃堕棿")] - public DateTime? LeaveTime { get; set; } - /// <summary> - /// 韬唤璇佹闈� - /// </summary> - [DisplayName("韬唤璇佹闈�")] - public string CardPositive { get; set; } - /// <summary> - /// 韬唤璇佹闈㈢増鏈彿 - /// </summary> - [DisplayName("韬唤璇佹闈㈢増鏈彿")] - public string CardPositiveVersionNo { get; set; } - /// <summary> - /// 韬唤璇佹闈㈠昂瀵� - /// </summary> - [DisplayName("韬唤璇佹闈㈠昂瀵�")] - public int? CardPositiveSize { get; set; } - - /// <summary> - /// 鐢ㄦ埛鍚� - /// </summary> - [DisplayName("鐢ㄦ埛鍚�")] - public string UserName { get; set; } - /// <summary> - /// 鐢ㄦ埛瀵嗙爜 - /// </summary> - [DisplayName("鐢ㄦ埛瀵嗙爜")] - public string UserPassWord { get; set; } - /// <summary> - /// 鐧诲綍鏃堕棿 - /// </summary> - [DisplayName("鐧诲綍鏃堕棿")] - public DateTime? LoginTime { get; set; } - /// <summary> - /// 鏄惁鐧诲綍 - /// </summary> - [DisplayName("鏄惁鐧诲綍")] - public bool? IsLogin { get; set; } - /// <summary> - /// 寤鸿鏍囧織 - /// </summary> - [DisplayName("寤鸿鏍囧織")] - public int? AdviseFlag { get; set; } - /// <summary> - /// 鐢ㄦ埛ID - /// </summary> - [DisplayName("鐢ㄦ埛ID")] - public int? UserId { get; set; } - - - } -} \ No newline at end of file diff --git a/DocumentServiceAPI.Model/User/UserUnitInfo.cs b/DocumentServiceAPI.Model/User/UserUnitInfo.cs deleted file mode 100644 index 7357460..0000000 --- a/DocumentServiceAPI.Model/User/UserUnitInfo.cs +++ /dev/null @@ -1,40 +0,0 @@ -锘縰sing DocumentServiceAPI.Enum; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DocumentServiceAPI.Model.User -{ - /// <summary> - /// 鍛樺伐鍜屽叕鍙告墍鍏崇郴琛� 涓棿琛� - /// </summary> - [SugarTable(TableDescription = "鍛樺伐鍜屽叕鍙告墍鍏崇郴琛�")] - public class UserUnitInfo : BaseModel - { - /// <summary> - /// ID - /// </summary> - [Display(Name = "ID ")] - [SugarColumn(ColumnDescription = "ID ")] - public int ID { get; set; } - /// <summary> - /// 鍛樺伐ID - /// </summary> - [Display(Name = "鍛樺伐ID ")] - [SugarColumn(ColumnDescription = "鍛樺伐ID ")] - public int UserID { get; set; } - - /// <summary> - /// 鍏徃ID - /// </summary> - [Display(Name = "鍏徃ID ")] - [SugarColumn(ColumnDescription = "鍏徃ID ")] - public int UnitID { get; set; } - - - } -} diff --git a/DocumentServiceAPI.Model/UserInfoModel/EmployeeAtTenant.cs b/DocumentServiceAPI.Model/UserInfoModel/EmployeeAtTenant.cs new file mode 100644 index 0000000..69ac741 --- /dev/null +++ b/DocumentServiceAPI.Model/UserInfoModel/EmployeeAtTenant.cs @@ -0,0 +1,37 @@ +锘縰sing DocumentServiceAPI.Enum; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Model.UserInfoModel +{ + /// <summary> + /// 鍛樺伐绉熸埛 鍏崇郴琛� + /// </summary> + public class EmployeeAtTenant:BaseModel + { + /// <summary> + /// ID + /// </summary> + [Display(Name = "ID ")] + [SugarColumn(ColumnDescription = "ID ",IsPrimaryKey =true,IsIdentity =true)] + public int ID { get; set; } + /// <summary> + /// 鍛樺伐ID + /// </summary> + [Display(Name = "鍛樺伐ID ")] + [SugarColumn(ColumnDescription = "鍛樺伐ID ")] + public int EmployeeID { get; set; } + /// <summary> + /// 绉熸埛ID + /// </summary> + [Display(Name = "绉熸埛ID ")] + [SugarColumn(ColumnDescription = "绉熸埛ID ")] + public int TenantID { get; set; } + + } +} diff --git a/DocumentServiceAPI.Model/UserInfoModel/EmployeeInfo.cs b/DocumentServiceAPI.Model/UserInfoModel/EmployeeInfo.cs new file mode 100644 index 0000000..072ca13 --- /dev/null +++ b/DocumentServiceAPI.Model/UserInfoModel/EmployeeInfo.cs @@ -0,0 +1,71 @@ +锘縰sing DocumentServiceAPI.Enum; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Model.UserInfoModel +{ + + + /// <summary> + /// 鍛樺伐 + /// </summary> + [Display(Name = "鍛樺伐 ")] + [SugarTable(TableName = "EmployeeInfo", TableDescription = "鍛樺伐")] + public class EmployeeInfo + { + /// <summary> + /// 鍛樺伐ID + /// </summary> + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + /// <summary> + /// 鍛樺伐鍚嶇О + /// </summary> + public string EmployeeName { get; set; } + + /// <summary> + /// 鐢佃瘽 + /// </summary> + public string? Phone { get; set; } + + /// <summary> + /// 绂诲紑鏃堕棿 + /// </summary> + public DateTime? LeaveTime { get; set; } + /// <summary> + /// 璇佷欢姝i潰 + /// </summary> + public string CardPositive { get; set; } + /// <summary> + /// 璇佷欢姝i潰鐗堟湰鍙� + /// </summary> + public string? CardPositiveVersionNo { get; set; } + + /// <summary> + /// 鐢ㄦ埛鍚� + /// </summary> + public string ITCode { get; set; } + /// <summary> + /// 鐢ㄦ埛瀵嗙爜 + /// </summary> + public string UserPassWord { get; set; } + + + /// <summary> + /// 寤鸿鏍囧織 + /// </summary> + public int? AdviseFlag { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public string? Description { get; set; } + + + } +} diff --git a/DocumentServiceAPI.Model/UserInfoModel/TenantInfo.cs b/DocumentServiceAPI.Model/UserInfoModel/TenantInfo.cs new file mode 100644 index 0000000..2773ab1 --- /dev/null +++ b/DocumentServiceAPI.Model/UserInfoModel/TenantInfo.cs @@ -0,0 +1,78 @@ +锘縰sing DocumentServiceAPI.Enum; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Model.UserInfoModel +{ + + /// <summary> + /// 绉熸埛琛� + /// </summary> + [Display(Name = "绉熸埛琛� ")] + [SugarTable(TableName = "TenantInfo", TableDescription = "绉熸埛琛�")] + public class TenantInfo : BaseModel + { + /// <summary> + /// ID + /// </summary> + [Display(Name = "ID ")] + [SugarColumn(ColumnDescription = "ID ",IsPrimaryKey =true,IsIdentity =true)] + public int Id { get; set; } + + /// <summary> + /// 绉熸埛鍚� + /// </summary> + [Display(Name = "绉熸埛鍚� ")] + [SugarColumn(ColumnDescription = "绉熸埛鍚� ",Length =20)] + public string ItCode { get; set; } + + /// <summary> + /// 鍚嶇О + /// </summary> + [Display(Name = "鍚嶇О ")] + [SugarColumn(ColumnDescription = "鍚嶇О ", Length = 200)] + public string? Name { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + [Display(Name = "鎻忚堪 ")] + [SugarColumn(ColumnDescription = "鎻忚堪 ")] + public string? Description { get; set; } + /// <summary> + /// 鏍囨敞 + /// </summary> + [Display(Name = "鏍囨敞")] + [SugarColumn(ColumnDescription = "鏍囨敞")] + public string? ReMark { get; set; } + /// <summary> + /// 鏁版嵁搴撻摼鎺ュ瓧绗︿覆 澶囩敤 + /// </summary> + [Display(Name = "鏁版嵁搴撻摼鎺ュ瓧绗︿覆")] + [SugarColumn(ColumnDescription = "鏁版嵁搴撻摼鎺ュ瓧绗︿覆")] + public string? ConnectionString { get; set; } + + /// <summary> + /// 鏁版嵁搴撶被鍨� 澶囩敤 + /// </summary> + [Display(Name = "鏁版嵁搴撶被鍨�")] + [SugarColumn(ColumnDescription = "鏁版嵁搴撶被鍨�")] + public string? DbType { get; set; } + + /// <summary> + /// 瀵嗙爜 + /// </summary> + [SugarColumn(Length =30)] + public string? PsW { get; set; } + + } + + + + +} diff --git a/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs b/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs index 60c1ae9..56e1f82 100644 --- a/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs +++ b/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeInfo.cs @@ -5,135 +5,80 @@ namespace DocumentServiceAPI.Model.cyDocumentModel { - ///<summary> - /// - ///</summary> + /// <summary> + /// 鏂囨。鍛樺伐淇℃伅 + /// </summary> [SugarTable("Document_EmployeeInfo")] public partial class Document_EmployeeInfo { - public Document_EmployeeInfo(){ - - - } - /// <summary> - /// Desc: - /// Default: - /// Nullable:False - /// </summary> - [SugarColumn(IsPrimaryKey=true,IsIdentity=true)] - public int EmployeeId {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string EmployeeName {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string Job {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string Phone {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public int? IsWork {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public DateTime? LeaveTime {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string CardPositive {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string CardPositiveVersionNo {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public int? CardPositiveSize {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public DateTime? LastUpdateTime {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string LastUpdateName {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string UserName {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string UserPassWord {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public DateTime? LoginTime {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public bool? IsLogin {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public int? AdviseFlag {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public int? UserId {get;set;} - + /// <summary> + /// 鍛樺伐ID + /// </summary> + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int EmployeeId { get; set; } + /// <summary> + /// 鍛樺伐鍚嶇О + /// </summary> + public string EmployeeName { get; set; } + /// <summary> + /// 宸ヤ綔鑱屼綅 + /// </summary> + public string Job { get; set; } + /// <summary> + /// 鐢佃瘽 + /// </summary> + public string Phone { get; set; } + /// <summary> + /// 鏄惁鍦ㄥ伐浣� + /// </summary> + public int? IsWork { get; set; } + /// <summary> + /// 绂诲紑鏃堕棿 + /// </summary> + public DateTime? LeaveTime { get; set; } + /// <summary> + /// 璇佷欢姝i潰 + /// </summary> + public string CardPositive { get; set; } + /// <summary> + /// 璇佷欢姝i潰鐗堟湰鍙� + /// </summary> + public string CardPositiveVersionNo { get; set; } + /// <summary> + /// 璇佷欢姝i潰澶у皬 + /// </summary> + public int? CardPositiveSize { get; set; } + /// <summary> + /// 鏈�鍚庢洿鏂版椂闂� + /// </summary> + public DateTime? LastUpdateTime { get; set; } + /// <summary> + /// 鏈�鍚庢洿鏂颁汉 + /// </summary> + public string LastUpdateName { get; set; } + /// <summary> + /// 鐢ㄦ埛鍚� + /// </summary> + public string UserName { get; set; } + /// <summary> + /// 鐢ㄦ埛瀵嗙爜 + /// </summary> + public string UserPassWord { get; set; } + /// <summary> + /// 鐧诲綍鏃堕棿 + /// </summary> + public DateTime? LoginTime { get; set; } + /// <summary> + /// 鏄惁鐧诲綍 + /// </summary> + public bool? IsLogin { get; set; } + /// <summary> + /// 寤鸿鏍囧織 + /// </summary> + public int? AdviseFlag { get; set; } + /// <summary> + /// 鐢ㄦ埛ID + /// </summary> + public int? UserId { get; set; } } } diff --git a/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeRole.cs b/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeRole.cs index 92b4b90..1353d51 100644 --- a/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeRole.cs +++ b/DocumentServiceAPI.Model/cyDocumentModel/Document_EmployeeRole.cs @@ -6,36 +6,26 @@ namespace DocumentServiceAPI.Model.cyDocumentModel { ///<summary> - /// + ///鏂囨。鍛樺伐瑙掕壊 ///</summary> [SugarTable("Document_EmployeeRole")] public partial class Document_EmployeeRole { - public Document_EmployeeRole(){ - - - } - /// <summary> - /// Desc: - /// Default: - /// Nullable:False - /// </summary> - [SugarColumn(IsPrimaryKey=true,IsIdentity=true)] - public int ID {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:False - /// </summary> - public int EmployeeId {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:False - /// </summary> - public int RoleType {get;set;} - + + /// <summary> + /// ID + /// 榛樿鍊硷細 + /// 鍙┖锛欶alse + /// </summary> + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int ID { get; set; } + /// <summary> + /// 鍛樺伐ID + /// </summary> + public int? EmployeeId { get; set; } + /// <summary> + /// 瑙掕壊绫诲瀷 + /// </summary> + public int? RoleType { get; set; } } } diff --git a/DocumentServiceAPI.Model/cyDocumentModel/Document_PerformanceInfo.cs b/DocumentServiceAPI.Model/cyDocumentModel/Document_PerformanceInfo.cs index bb8482c..b31f4cb 100644 --- a/DocumentServiceAPI.Model/cyDocumentModel/Document_PerformanceInfo.cs +++ b/DocumentServiceAPI.Model/cyDocumentModel/Document_PerformanceInfo.cs @@ -11,59 +11,50 @@ [SugarTable("Document_PerformanceInfo")] public partial class Document_PerformanceInfo { - public Document_PerformanceInfo(){ - - - } - /// <summary> - /// Desc: - /// Default: - /// Nullable:False - /// </summary> - [SugarColumn(IsPrimaryKey=true,IsIdentity=true)] - public int Id {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public int? EmployeeId {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string ProjectName {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string WorkItem {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public decimal? Price {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public DateTime? WorkTime {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string EmployeeName {get;set;} + + /// <summary> + /// ID + /// 榛樿鍊硷細 + /// 鍙┖锛欶alse + /// </summary> + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + /// <summary> + /// 鍛樺伐ID + /// 榛樿鍊硷細 + /// 鍙┖锛歍rue + /// </summary> + public int? EmployeeId { get; set; } + /// <summary> + /// 椤圭洰鍚嶇О + /// 榛樿鍊硷細 + /// 鍙┖锛歍rue + /// </summary> + public string ProjectName { get; set; } + /// <summary> + /// 宸ヤ綔椤� + /// 榛樿鍊硷細 + /// 鍙┖锛歍rue + /// </summary> + public string WorkItem { get; set; } + /// <summary> + /// 浠锋牸 + /// 榛樿鍊硷細 + /// 鍙┖锛歍rue + /// </summary> + public decimal? Price { get; set; } + /// <summary> + /// 宸ヤ綔鏃堕棿 + /// 榛樿鍊硷細 + /// 鍙┖锛歍rue + /// </summary> + public DateTime? WorkTime { get; set; } + /// <summary> + /// 鍛樺伐濮撳悕 + /// 榛樿鍊硷細 + /// 鍙┖锛歍rue + /// </summary> + public string EmployeeName { get; set; } } } diff --git a/DocumentServiceAPI.Model/cyDocumentModel/Document_TenderUnit.cs b/DocumentServiceAPI.Model/cyDocumentModel/Document_TenderUnit.cs index 5ff7e0b..6c99a1f 100644 --- a/DocumentServiceAPI.Model/cyDocumentModel/Document_TenderUnit.cs +++ b/DocumentServiceAPI.Model/cyDocumentModel/Document_TenderUnit.cs @@ -5,310 +5,193 @@ namespace DocumentServiceAPI.Model.cyDocumentModel { - ///<summary> - /// - ///</summary> + /// <summary> + /// 鍗曚綅 + /// </summary> [SugarTable("Document_TenderUnit")] public partial class Document_TenderUnit { - public Document_TenderUnit(){ - - - } - /// <summary> - /// Desc: - /// Default: - /// Nullable:False - /// </summary> - [SugarColumn(IsPrimaryKey=true,IsIdentity=true)] - public int UnitId {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:False - /// </summary> - public string UnitName {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string UnitType {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string Address {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string ZipCode {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string ContactPerson {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string ContactPhone {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string Fax {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string WebUrl {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string OrgStructure {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string Corporater {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string CorporaterPost {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string CorporaterTechnicalPost {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string CorporatePhone {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string TechnicalLeader {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string TechnicalPost {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string TechnicalPhone {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string CreatTime {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string StaffCount {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string FirmQualificationLevel {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string BusinessLicense {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string RegMoney {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string OpenBank {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string BankNum {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string ProjectManager {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string SeniorStaff {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string MiddleStaff {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string PrimaryStaff {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string Mechanicer {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string BusinessContent {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string Remark {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string UnitLogo {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string UnitLogoVersionNo {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public int? UnitLogoSize {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string CardPositive {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string CardPositiveVersionNo {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public int? CardPositiveSize {get;set;} - - /// <summary> - /// Desc: - /// Default:1 - /// Nullable:True - /// </summary> - public int? IsUsed {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public DateTime? LastUpdateTime {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string LastUpdateName {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public int? AdviseFlag {get;set;} - - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public int? UserId {get;set;} - + /// <summary> + /// ID + /// </summary> + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int UnitId { get; set; } + ///<summary> + ///鍗曚綅鍚嶇О + ///</summary> + public string UnitName { get; set; } + ///<summary> + ///鍗曚綅绫诲瀷 + ///</summary> + public string? UnitType { get; set; } + ///<summary> + ///鍦板潃 + ///</summary> + public string? Address { get; set; } + ///<summary> + ///閭斂缂栫爜 + ///</summary> + public string? ZipCode { get; set; } + ///<summary> + ///鑱旂郴浜� + ///</summary> + public string? ContactPerson { get; set; } + ///<summary> + ///鑱旂郴鐢佃瘽 + ///</summary> + public string? ContactPhone { get; set; } + ///<summary> + ///浼犵湡 + ///</summary> + public string? Fax { get; set; } + ///<summary> + ///缃戝潃 + ///</summary> + public string? WebUrl { get; set; } + ///<summary> + ///缁勭粐缁撴瀯 + ///</summary> + public string? OrgStructure { get; set; } + ///<summary> + ///娉曚汉浠h〃 + ///</summary> + public string? Corporater { get; set; } + ///<summary> + ///娉曚汉鑱屽姟 + ///</summary> + public string? CorporaterPost { get; set; } + ///<summary> + ///娉曚汉鎶�鏈亴鍔� + ///</summary> + public string? CorporaterTechnicalPost { get; set; } + ///<summary> + ///娉曚汉鑱旂郴鐢佃瘽 + ///</summary> + public string? CorporatePhone { get; set; } + ///<summary> + ///鎶�鏈礋璐d汉 + ///</summary> + public string? TechnicalLeader { get; set; } + ///<summary> + ///鎶�鏈亴鍔� + ///</summary> + public string? TechnicalPost { get; set; } + ///<summary> + ///鎶�鏈仈绯荤數璇� + ///</summary> + public string? TechnicalPhone { get; set; } + ///<summary> + ///鍒涘缓鏃堕棿 + ///</summary> + public string? CreatTime { get; set; } + ///<summary> + ///鍛樺伐鏁伴噺 + ///</summary> + public string? StaffCount { get; set; } + ///<summary> + ///浼佷笟璧勮川绛夌骇 + ///</summary> + public string? FirmQualificationLevel { get; set; } + ///<summary> + ///钀ヤ笟鎵х収 + ///</summary> + public string? BusinessLicense { get; set; } + ///<summary> + ///娉ㄥ唽璧勯噾 + ///</summary> + public string? RegMoney { get; set; } + ///<summary> + ///寮�鎴烽摱琛� + ///</summary> + public string? OpenBank { get; set; } + ///<summary> + ///閾惰璐﹀彿 + ///</summary> + public string? BankNum { get; set; } + ///<summary> + ///椤圭洰缁忕悊 + ///</summary> + public string? ProjectManager { get; set; } + ///<summary> + ///楂樼骇鑱屽伐 + ///</summary> + public string? SeniorStaff { get; set; } + ///<summary> + ///涓骇鑱屽伐 + ///</summary> + public string? MiddleStaff { get; set; } + ///<summary> + ///鍒濈骇鑱屽伐 + ///</summary> + public string ?PrimaryStaff { get; set; } + ///<summary> + ///楂樼骇宸� + ///</summary> + public string ?Mechanicer { get; set; } + ///<summary> + ///缁忚惀鍐呭 + ///</summary> + public string ?BusinessContent { get; set; } + ///<summary> + ///澶囨敞 + ///</summary> + public string ?Remark { get; set; } + ///<summary> + ///鍗曚綅Logo + ///</summary> + public string? UnitLogo { get; set; } + ///<summary> + ///鍗曚綅Logo鐗堟湰鍙� + ///</summary> + public string? UnitLogoVersionNo { get; set; } + ///<summary> + ///鍗曚綅Logo澶у皬 + ///</summary> + public int? UnitLogoSize { get; set; } + ///<summary> + ///韬唤璇佹闈� + ///</summary> + public string ?CardPositive { get; set; } + ///<summary> + ///韬唤璇佹闈㈢増鏈彿 + ///</summary> + public string ?CardPositiveVersionNo { get; set; } + ///<summary> + ///韬唤璇佹闈㈠ぇ灏� + ///</summary> + public int? CardPositiveSize { get; set; } + ///<summary> + ///鏄惁浣跨敤 + ///</summary> + public int? IsUsed { get; set; } + ///<summary> + ///鏈�鍚庢洿鏂版椂闂� + ///</summary> + public DateTime? LastUpdateTime { get; set; } + ///<summary> + ///鏈�鍚庢洿鏂颁汉 + ///</summary> + public string? LastUpdateName { get; set; } + ///<summary> + ///寤鸿鏍囧織 + ///</summary> + public int? AdviseFlag { get; set; } + ///<summary> + ///绉熸埛ID + ///</summary> + [SugarColumn(DefaultValue ="0")] + public int TenantId { get; set; } + /// <summary> + /// UserId + /// </summary> + public int? UserId { get; set; } + /// <summary> + /// 鏄惁鏈夋晥 + /// </summary> + public bool? IsEn { get; set; } + /// <summary> + /// 鏄惁鍒犻櫎 + /// </summary> + public bool ? IsDeled { get; set; } } } diff --git a/DocumentServiceAPI.Model/cyDocumentModel/Document_UserInfo.cs b/DocumentServiceAPI.Model/cyDocumentModel/Document_UserInfo.cs index 67e8064..91cdc77 100644 --- a/DocumentServiceAPI.Model/cyDocumentModel/Document_UserInfo.cs +++ b/DocumentServiceAPI.Model/cyDocumentModel/Document_UserInfo.cs @@ -5,44 +5,39 @@ namespace DocumentServiceAPI.Model.cyDocumentModel { - ///<summary> - /// - ///</summary> + /// <summary> + /// 鏂囨。鐢ㄦ埛 + /// </summary> [SugarTable("Document_UserInfo")] public partial class Document_UserInfo { - public Document_UserInfo(){ + /// <summary> + /// Desc: 鐢ㄦ埛ID + /// Default: + /// Nullable: False + /// </summary> + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int UserId { get; set; } + /// <summary> + /// Desc: 鐢ㄦ埛鍚� + /// Default: + /// Nullable: True + /// </summary> + public string UserName { get; set; } - } - /// <summary> - /// Desc: - /// Default: - /// Nullable:False - /// </summary> - [SugarColumn(IsPrimaryKey=true,IsIdentity=true)] - public int UserId {get;set;} + /// <summary> + /// Desc: 鏄惁缁忕悊 + /// Default: 0 + /// Nullable: True + /// </summary> + public int? IsManager { get; set; } - /// <summary> - /// Desc: - /// Default: - /// Nullable:True - /// </summary> - public string UserName {get;set;} - - /// <summary> - /// Desc: - /// Default:0 - /// Nullable:True - /// </summary> - public int? IsManager {get;set;} - - /// <summary> - /// Desc: - /// Default:1 - /// Nullable:True - /// </summary> - public int? IsUsed {get;set;} - + /// <summary> + /// Desc: 鏄惁宸蹭娇鐢� + /// Default: 1 + /// Nullable: True + /// </summary> + public int? IsUsed { get; set; } } } diff --git "a/DocumentServiceAPI.Model/cyDocumentModel/\345\272\223\347\233\256\345\275\225.md" "b/DocumentServiceAPI.Model/cyDocumentModel/\345\272\223\347\233\256\345\275\225.md" new file mode 100644 index 0000000..ab66188 --- /dev/null +++ "b/DocumentServiceAPI.Model/cyDocumentModel/\345\272\223\347\233\256\345\275\225.md" @@ -0,0 +1,26 @@ +锘� +Document_Adviselnfo.cs - 鏂囨。鍜ㄨ淇℃伅 +Document_AptitudelMG.cs - 鏂囨。璧勮川绠$悊 +Document_Aptitudelnfo.cs - 鏂囨。璧勮川淇℃伅 +Document_AptitudeType.cs - 鏂囨。璧勮川绫诲瀷 +Document_CommonFile.cs - 鏂囨。閫氱敤鏂囦欢 +Document_DelegatePersonlnfo.cs - 鏂囨。濮旀墭浜轰俊鎭� +Document_Dictionary.cs - 鏂囨。瀛楀吀 +Document_DocumentTempletlnfo.cs - 鏂囨。妯℃澘淇℃伅 +Document_Employeelnfo.cs - 鏂囨。鍛樺伐淇℃伅 +Document_EmployeeRole.cs - 鏂囨。鍛樺伐瑙掕壊 +Document_LayInfo.cs - 鏂囨。甯冨眬淇℃伅 +Document_OtherCompanyTenderInfo.cs - 鏂囨。鍏朵粬鍏徃鎶曟爣淇℃伅 +Document_Performancelnfo.cs - 鏂囨。缁╂晥淇℃伅 +Document_ProjectComplainlnfo.cs - 鏂囨。椤圭洰鎶曡瘔淇℃伅 +Document_ProjectDocumentInfo.cs - 鏂囨。椤圭洰鏂囨。淇℃伅 +Document_ProjectExpand.cs - 鏂囨。椤圭洰鎵╁睍 +Document_ProjectInfo.cs - 鏂囨。椤圭洰淇℃伅 +Document_ProjectLitigationlnfo.cs - 鏂囨。椤圭洰璇夎淇℃伅 +Document_ProjectOppugninfo.cs - 鏂囨。椤圭洰璐ㄧ枒淇℃伅 +Document_ProjectReviewInfo.cs - 鏂囨。椤圭洰璇勫淇℃伅 +Document_Synchrolnfo.cs - 鏂囨。鍚屾淇℃伅 +Document_TenderUnit.cs - 鏂囨。鎷涙爣鍗曚綅 +Document_Userlnfo.cs - 鏂囨。鐢ㄦ埛淇℃伅 +Document_WinInfo.cs - 鏂囨。涓爣淇℃伅 +Document_WorkRemind.cs - 鏂囨。宸ヤ綔鎻愰啋 \ No newline at end of file diff --git a/DocumentServiceAPI.Services/DocumentServiceAPI.Services.csproj b/DocumentServiceAPI.Services/DocumentServiceAPI.Services.csproj new file mode 100644 index 0000000..d56c0b4 --- /dev/null +++ b/DocumentServiceAPI.Services/DocumentServiceAPI.Services.csproj @@ -0,0 +1,17 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net6.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="CSRedisCore" Version="3.8.670" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="..\DocumentServiceAPI.Core\DocumentServiceAPI.Core.csproj" /> + </ItemGroup> + +</Project> diff --git a/DocumentServiceAPI.Services/IService/ICacheService.cs b/DocumentServiceAPI.Services/IService/ICacheService.cs new file mode 100644 index 0000000..c3bfcb6 --- /dev/null +++ b/DocumentServiceAPI.Services/IService/ICacheService.cs @@ -0,0 +1,38 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Services.IService +{ + /// <summary> + /// 缂撳瓨鏈嶅姟 + /// 鐩墠鍙啓浜嗗redis鐨勬敮鎸� 锛屽闇�瑕佸叾浠栫殑锛岃嚜琛屽畬鍠� 璇ユ帴鍙d负鎸夋爣鍑嗘湇鍔℃敞鍏ワ紝鍦ㄦ敞鍏ユ椂鍒ゅ喅浜嗗redis鐨勯厤缃�傚鏋滄病鏈夊伓閰嶇疆锛岃�呬笉娉ㄥ叆鏈嶅姟 + /// </summary> + public interface IRedisCacheService + { + /// <summary> + /// 璁剧疆涓�涓敭鍊� + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="key"></param> + /// <param name="value"></param> + /// <param name="expireSeconds"></param> + /// <returns></returns> + bool Add<T>(string key, T value, int expireSeconds); + /// <summary> + /// 鑾峰彇涓�涓敭鍊� + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="key"></param> + /// <returns></returns> + T? Get<T>(string key); + /// <summary> + /// 鑾峰彇閿�煎墿浣欒繃鏃堕棿 绉掔骇 + /// </summary> + /// <param name="key"></param> + /// <returns></returns> + public long GetTtl(string key); + } +} diff --git a/DocumentServiceAPI.Services/RedisCacheScService.cs b/DocumentServiceAPI.Services/RedisCacheScService.cs new file mode 100644 index 0000000..0d6635e --- /dev/null +++ b/DocumentServiceAPI.Services/RedisCacheScService.cs @@ -0,0 +1,42 @@ +锘縰sing DocumentServiceAPI.Services.IService; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Furion.DependencyInjection; + +namespace DocumentServiceAPI.Services +{ + /// <summary> + /// redis缂撳瓨鏈嶅姟 + /// </summary> + public class RedisCacheScService: IRedisCacheService, IScoped + { + /// <summary> + /// 璁剧疆涓�涓敭鍊� + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="key"></param> + /// <param name="value"></param> + /// <returns></returns> + public bool Add<T>(string key, T value, int expireSeconds = -1) + { + return RedisHelper.Set(key, value, expireSeconds); + } + + public T? Get<T>(string key) + { + return RedisHelper.Get<T>(key); + } + /// <summary> + /// 鑾峰彇绉掔骇杩囨湡鏃堕棿 + /// </summary> + /// <param name="key"></param> + /// <returns></returns> + public long GetTtl(string key) + { + return RedisHelper.Ttl(key); + } + } +} diff --git a/DocumentServiceAPI.Utility/DocumentServiceAPI.Utility.csproj b/DocumentServiceAPI.Utility/DocumentServiceAPI.Utility.csproj index ca61dfe..6bfde42 100644 --- a/DocumentServiceAPI.Utility/DocumentServiceAPI.Utility.csproj +++ b/DocumentServiceAPI.Utility/DocumentServiceAPI.Utility.csproj @@ -7,4 +7,8 @@ <GenerateDocumentationFile>True</GenerateDocumentationFile> </PropertyGroup> + <ItemGroup> + <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" /> + </ItemGroup> + </Project> diff --git a/DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.csproj b/DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.csproj index 8ede331..ad97204 100644 --- a/DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.csproj +++ b/DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.csproj @@ -15,6 +15,7 @@ <ItemGroup> <ProjectReference Include="..\DocumentServiceAPI.Application\DocumentServiceAPI.Application.csproj" /> + <ProjectReference Include="..\DocumentServiceAPI.Model\DocumentServiceAPI.Model.csproj" /> </ItemGroup> </Project> diff --git a/DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.xml b/DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.xml index 80d0ac9..e8542e1 100644 --- a/DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.xml +++ b/DocumentServiceAPI.Web.Core/DocumentServiceAPI.Web.Core.xml @@ -4,5 +4,53 @@ <name>DocumentServiceAPI.Web.Core</name> </assembly> <members> + <member name="T:DocumentServiceAPI.Web.Core.DSRESTFulResultProvider"> + <summary> + 缁熶竴杩斿洖 + </summary> + </member> + <member name="M:DocumentServiceAPI.Web.Core.DSRESTFulResultProvider.OnException(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext,Furion.FriendlyException.ExceptionMetadata)"> + <summary> + 寮傚父杩斿洖鍊� + </summary> + <param name="context"></param> + <param name="metadata"></param> + <returns></returns> + </member> + <member name="M:DocumentServiceAPI.Web.Core.DSRESTFulResultProvider.OnSucceeded(Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext,System.Object)"> + <summary> + 鎴愬姛杩斿洖鍊� + </summary> + <param name="context"></param> + <param name="data"></param> + <returns></returns> + </member> + <member name="M:DocumentServiceAPI.Web.Core.DSRESTFulResultProvider.OnValidateFailed(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext,Furion.DataValidation.ValidationMetadata)"> + <summary> + 楠岃瘉澶辫触杩斿洖鍊� + </summary> + <param name="context"></param> + <param name="metadata"></param> + <returns></returns> + </member> + <member name="M:DocumentServiceAPI.Web.Core.DSRESTFulResultProvider.OnResponseStatusCodes(Microsoft.AspNetCore.Http.HttpContext,System.Int32,Furion.UnifyResult.UnifyResultSettingsOptions)"> + <summary> + 鐗瑰畾鐘舵�佺爜杩斿洖鍊� + </summary> + <param name="context"></param> + <param name="statusCode"></param> + <param name="unifyResultSettings"></param> + <returns></returns> + </member> + <member name="M:DocumentServiceAPI.Web.Core.DSRESTFulResultProvider.DsFulResult(System.Int32,System.Int32,System.Object,System.Object)"> + <summary> + 杩斿洖 RESTful 椋庢牸缁撴灉闆� + </summary> + <param name="statusCode"></param> + <param name="Code">鎴愬姛鐘舵�佺爜</param> + <param name="data"></param> + <param name="errors"></param> + <returns></returns> + </member> </members> </doc> diff --git a/DocumentServiceAPI.Web.Core/Filter/EnumSchemaFilter .cs b/DocumentServiceAPI.Web.Core/Filter/EnumSchemaFilter .cs new file mode 100644 index 0000000..8f59c7b --- /dev/null +++ b/DocumentServiceAPI.Web.Core/Filter/EnumSchemaFilter .cs @@ -0,0 +1,12 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Web.Core.Filter +{ + internal class EnumSchemaFilter + { + } +} diff --git a/DocumentServiceAPI.Web.Core/Handlers/DSRESTfulResultProvider.cs b/DocumentServiceAPI.Web.Core/Handlers/DSRESTfulResultProvider.cs new file mode 100644 index 0000000..988f3aa --- /dev/null +++ b/DocumentServiceAPI.Web.Core/Handlers/DSRESTfulResultProvider.cs @@ -0,0 +1,110 @@ +锘縰sing DocumentServiceAPI.Model; +using Furion; +using Furion.DataValidation; +using Furion.FriendlyException; +using Furion.UnifyResult; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; +using System; +using System.Threading.Tasks; + +namespace DocumentServiceAPI.Web.Core +{ + /// <summary> + /// 缁熶竴杩斿洖 + /// </summary> + [UnifyModel(typeof(DSFulResult<>))] + public class DSRESTFulResultProvider : IUnifyResultProvider + { + /// <summary> + /// 寮傚父杩斿洖鍊� + /// </summary> + /// <param name="context"></param> + /// <param name="metadata"></param> + /// <returns></returns> + public IActionResult OnException(ExceptionContext context, ExceptionMetadata metadata) + { + + return new JsonResult(DsFulResult(metadata.StatusCode, Code:0, data: metadata.Data, errors: metadata.Errors) + , UnifyContext.GetSerializerSettings(context)); // 褰撳墠琛屼粎闄� Furion 4.6.6+ 浣跨敤 + } + + /// <summary> + /// 鎴愬姛杩斿洖鍊� + /// </summary> + /// <param name="context"></param> + /// <param name="data"></param> + /// <returns></returns> + public IActionResult OnSucceeded(ActionExecutedContext context, object data) + { + return new JsonResult(DsFulResult(StatusCodes.Status200OK, 1, data) + , UnifyContext.GetSerializerSettings(context)); // 褰撳墠琛屼粎闄� Furion 4.6.6+ 浣跨敤 + } + + /// <summary> + /// 楠岃瘉澶辫触杩斿洖鍊� + /// </summary> + /// <param name="context"></param> + /// <param name="metadata"></param> + /// <returns></returns> + public IActionResult OnValidateFailed(ActionExecutingContext context, ValidationMetadata metadata) + { + //璁剧疆杩斿洖鐘舵�佺爜 + + return new JsonResult(DsFulResult(metadata.StatusCode ?? StatusCodes.Status400BadRequest, Code: 0, data: metadata.Data, errors: metadata.ValidationResult) + , UnifyContext.GetSerializerSettings(context)); // 褰撳墠琛屼粎闄� Furion 4.6.6+ 浣跨敤 + } + + /// <summary> + /// 鐗瑰畾鐘舵�佺爜杩斿洖鍊� + /// </summary> + /// <param name="context"></param> + /// <param name="statusCode"></param> + /// <param name="unifyResultSettings"></param> + /// <returns></returns> + public async Task OnResponseStatusCodes(HttpContext context, int statusCode, UnifyResultSettingsOptions unifyResultSettings) + { + // 璁剧疆鍝嶅簲鐘舵�佺爜 + UnifyContext.SetResponseStatusCodes(context, statusCode, unifyResultSettings); + + switch (statusCode) + { + // 澶勭悊 401 鐘舵�佺爜 + case StatusCodes.Status401Unauthorized: + await context.Response.WriteAsJsonAsync(DsFulResult(statusCode,Code:0, errors: "401 Unauthorized") + , App.GetOptions<JsonOptions>()?.JsonSerializerOptions); + break; + // 澶勭悊 403 鐘舵�佺爜 + case StatusCodes.Status403Forbidden: + await context.Response.WriteAsJsonAsync(DsFulResult(statusCode, Code: 0, errors: "403 Forbidden") + , App.GetOptions<JsonOptions>()?.JsonSerializerOptions); + break; + + default: break; + } + } + + /// <summary> + /// 杩斿洖 RESTful 椋庢牸缁撴灉闆� + /// </summary> + /// <param name="statusCode"></param> + /// <param name="Code">鎴愬姛鐘舵�佺爜</param> + /// <param name="data"></param> + /// <param name="errors"></param> + /// <returns></returns> + private static DSFulResult<object> DsFulResult(int statusCode, int Code = 1, object data = default, object errors = default) + { + return new DSFulResult<object> + { + Code = Code, + StatusCode= statusCode, + Data = data, + Error = errors, + Extras = UnifyContext.Take(), + Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + }; + } + } +} + diff --git a/DocumentServiceAPI.Web.Core/Handlers/JwtHandler.cs b/DocumentServiceAPI.Web.Core/Handlers/JwtHandler.cs index 67313c5..a82f02d 100644 --- a/DocumentServiceAPI.Web.Core/Handlers/JwtHandler.cs +++ b/DocumentServiceAPI.Web.Core/Handlers/JwtHandler.cs @@ -1,4 +1,6 @@ -锘縰sing Furion.Authorization; +锘縰sing DocumentServiceAPI.Application.UserAndLogin.Services; +using Furion; +using Furion.Authorization; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using System.Threading.Tasks; @@ -10,7 +12,8 @@ public override Task<bool> PipelineAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext) { // 杩欓噷鍐欐偍鐨勬巿鏉冨垽鏂�昏緫锛屾巿鏉冮�氳繃杩斿洖 true锛屽惁鍒欒繑鍥� false + bool ret= App.GetService<TokenService>().CheckToken(); - return Task.FromResult(true); + return Task.FromResult(ret); } } diff --git a/DocumentServiceAPI.Web.Core/Startup.cs b/DocumentServiceAPI.Web.Core/Startup.cs index 3b828ae..984c08d 100644 --- a/DocumentServiceAPI.Web.Core/Startup.cs +++ b/DocumentServiceAPI.Web.Core/Startup.cs @@ -1,9 +1,11 @@ 锘縰sing DocumentServiceAPI.Core; +using DocumentServiceAPI.Model; using Furion; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using System.Text.Json.Serialization; namespace DocumentServiceAPI.Web.Core; @@ -16,8 +18,10 @@ services.AddCorsAccessor(); - services.AddControllers() - .AddInjectWithUnifyResult(); + services.AddControllers().AddJsonOptions(options => + options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); ; + services.AddInjectWithUnifyResult<DSRESTFulResultProvider>(); + } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/DocumentServiceAPI.Web.Entry/AuthorizeHandler.cs b/DocumentServiceAPI.Web.Entry/AuthorizeHandler.cs new file mode 100644 index 0000000..ad89288 --- /dev/null +++ b/DocumentServiceAPI.Web.Entry/AuthorizeHandler.cs @@ -0,0 +1,40 @@ +锘縰sing Furion.Authorization; +using Microsoft.AspNetCore.Authorization; + +namespace DocumentServiceAPI.Web.Entry +{ + /// <summary> + /// 閴存潈 + /// </summary> + public class AuthorizeHandler:AppAuthorizeHandler + { + /// <summary> + /// 璇锋眰绠¢亾 + /// </summary> + /// <param name="context"></param> + /// <param name="httpContext"></param> + /// <returns></returns> + public override Task<bool> PipelineAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext) + { + // 姝ゅ宸茬粡鑷姩楠岃瘉 Jwt token鐨勬湁鏁堟�т簡锛屾棤闇�鎵嬪姩楠岃瘉 + + // 妫�鏌ユ潈闄愶紝濡傛灉鏂规硶鏄紓姝ョ殑灏变笉鐢� Task.FromResult 鍖呰9锛岀洿鎺ヤ娇鐢� async/await 鍗冲彲 + return Task.FromResult(CheckAuthorzie(httpContext)); + } + + /// <summary> + /// 妫�鏌ユ潈闄� + /// </summary> + /// <param name="httpContext"></param> + /// <returns></returns> + private static bool CheckAuthorzie(DefaultHttpContext httpContext) + { + // 鑾峰彇鏉冮檺鐗规�� + var securityDefineAttribute = httpContext.GetMetadata<SecurityDefineAttribute>(); + if (securityDefineAttribute == null) return true; + + return false;// "鏌ヨ鏁版嵁搴撹繑鍥炴槸鍚︽湁鏉冮檺"; + } + + } +} diff --git a/DocumentServiceAPI.Web.Entry/DocServiceApiStartup.cs b/DocumentServiceAPI.Web.Entry/DocServiceApiStartup.cs index cc2d032..52e10eb 100644 --- a/DocumentServiceAPI.Web.Entry/DocServiceApiStartup.cs +++ b/DocumentServiceAPI.Web.Entry/DocServiceApiStartup.cs @@ -1,5 +1,11 @@ -锘縰sing DocumentServiceAPI.Core; +锘縰sing CSRedis; +using DocumentServiceAPI.Core; +using DocumentServiceAPI.Model; +using DocumentServiceAPI.Services; +using DocumentServiceAPI.Services.IService; using Furion; +using Mapster; +using System.Configuration; namespace DocumentServiceAPI.Web.Entry { @@ -9,14 +15,33 @@ { public void ConfigureServices(IServiceCollection services) { + services.AddSqlsugarSetup(); + var readisconnectionstring = App.Configuration["RedisConfig:ConnectionString"]; + if (readisconnectionstring != null) + //鍒濆鍖杛edi閰嶇疆 + { + //鏈夐厤缃墠娉ㄥ叆 + RedisHelper.Initialization(new CSRedisClient(readisconnectionstring)); + //娉ㄥ叆鏈嶅姟 + services.AddScoped<IRedisCacheService, RedisCacheScService>(); + } + } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { - - app.DbCodeFirst("DocumentServiceAPI.Model"); + var IsCodeFirst = App.GetConfig<bool>("isCodeFirst"); + + if (IsCodeFirst) + { + //codefirst 杩佸緳鏁版嵁搴撹缃� + app.DbCodeFirst("DocumentServiceAPI.Model"); + app.DbCodeFirst(typeof(DocumentServiceAPI.Model.cyDocumentModel.Document_TenderUnit)); + } + //鍚姩鍏ㄥ眬榛樿鏄犲皠閰嶇疆 + TypeAdapterConfig.GlobalSettings.Default.PreserveReference(true); app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = (stf) => @@ -25,6 +50,11 @@ stf.Context.Response.Headers["Access-Control-Allow-Headers"] = "*"; } }); + App.Configuration.Get<WebHostBuilder>().ConfigureKestrel(x => + { + x.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(20); + x.Limits.RequestHeadersTimeout = TimeSpan.FromMinutes(20); + }); } } } diff --git a/DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj b/DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj index f971233..01b43b2 100644 --- a/DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj +++ b/DocumentServiceAPI.Web.Entry/DocumentServiceAPI.Web.Entry.csproj @@ -16,6 +16,7 @@ <ProjectReference Include="..\DocumentServiceAPI.Core\DocumentServiceAPI.Core.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Enum\DocumentServiceAPI.Enum.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Model\DocumentServiceAPI.Model.csproj" /> + <ProjectReference Include="..\DocumentServiceAPI.Services\DocumentServiceAPI.Services.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Utility\DocumentServiceAPI.Utility.csproj" /> <ProjectReference Include="..\DocumentServiceAPI.Web.Core\DocumentServiceAPI.Web.Core.csproj" /> </ItemGroup> @@ -25,6 +26,12 @@ <ItemGroup> <Folder Include="鏂版枃浠跺す\" /> </ItemGroup> + + + + <ItemGroup> + <PackageReference Include="CSRedisCore" Version="3.8.670" /> + </ItemGroup> <ProjectExtensions> <VisualStudio> <UserProperties properties_4launchsettings_1json__JsonSchema="" /> diff --git a/DocumentServiceAPI.Web.Entry/HomeController.cs b/DocumentServiceAPI.Web.Entry/HomeController.cs deleted file mode 100644 index 3dda75f..0000000 --- a/DocumentServiceAPI.Web.Entry/HomeController.cs +++ /dev/null @@ -1,22 +0,0 @@ -锘縰sing Microsoft.AspNetCore.Mvc; - -namespace DocumentServiceAPI.Web.Entry -{ - /// <summary> - /// 娴嬭瘯 - /// </summary> - [ApiDescriptionSettings("Group1")] - [Route("api/[controller]")] - public class HomeController : ControllerBase - { - /// <summary> - /// 娴嬭瘯 - /// </summary> - /// <returns></returns> - [HttpGet("aaa")] - public IActionResult aaa() - { - return Ok(); - } - } -} diff --git a/DocumentServiceAPI.Web.Entry/appsettings.json b/DocumentServiceAPI.Web.Entry/appsettings.json index 5b27292..78d8527 100644 --- a/DocumentServiceAPI.Web.Entry/appsettings.json +++ b/DocumentServiceAPI.Web.Entry/appsettings.json @@ -16,27 +16,21 @@ "DbType": "SqlServer", "IsAutoCloseConnection": true + } ], - //swags 鍚嶇О閰嶇疆 榛樿鍒嗙粍 - "[openapi:Default]": { - "Title": "鏍囦功绠$悊绯荤粺鏈嶅姟", - "Order": 0, - "Description": "杩欎釜涓�涓緢濂界敤鏍囦功绠$悊绯荤粺鏈嶅姟杞欢", - "Version": "1.0.0", - "TermsOfService": "http://www.51zhengcai.com", - "Contact": { - "Name": "鏀块噰鍜ㄨ鏈夐檺鍏徃", - "Url": "http://www.51zhengcai.com" - }, - "License": { - "Name": "鏀块噰鍜ㄨ鏈夐檺鍏徃", - "Url": "http://www.51zhengcai.com" - } + "isCodeFirst": false, //鏄惁鎵цcodefirst 娉ㄦ剰杩欎釜鍦ㄨ縼寰欏畬鎴愬悗搴旇璁剧疆涓篺alse 闃叉鏇存敼鏁版嵁搴� + //璇蜂繚鎸乺edis涓烘甯稿彲鐢� + "RedisConfig": { + // 濡傛灉閲囩敤瀹瑰櫒鍖栭儴缃睸ervice 瑕佸啓鎴恟edis鐨勬湇鍔″悕锛屽惁鍒欏啓鍦板潃 + "ConnectionString": "127.0.0.1:6379,password=,connectTimeout=30000,responseTimeout=30000,abortConnect=false,connectRetry=1,syncTimeout=10000,DefaultDatabase=10" //redis鏁版嵁搴撹繛鎺ュ瓧绗︿覆 + }, + + "JWTSettings": { "ValidateIssuerSigningKey": true, // 鏄惁楠岃瘉瀵嗛挜锛宐ool 绫诲瀷锛岄粯璁rue "IssuerSigningKey": "129(*dasd09213)*(*jKDl", // 瀵嗛挜锛宻tring 绫诲瀷锛屽繀椤绘槸澶嶆潅瀵嗛挜锛岄暱搴﹀ぇ浜�16 diff --git a/DocumentServiceAPI.sln b/DocumentServiceAPI.sln index aa26889..e632510 100644 --- a/DocumentServiceAPI.sln +++ b/DocumentServiceAPI.sln @@ -19,6 +19,8 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentFile.Service", "DocumentFile.Service\DocumentFile.Service.csproj", "{F3449EF6-8E3F-492F-832F-F5F2E1F2503C}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentServiceAPI.Services", "DocumentServiceAPI.Services\DocumentServiceAPI.Services.csproj", "{3369F102-ABB2-42A4-B216-58D530AEE8BE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -56,7 +58,10 @@ {F3449EF6-8E3F-492F-832F-F5F2E1F2503C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F3449EF6-8E3F-492F-832F-F5F2E1F2503C}.Debug|Any CPU.Build.0 = Debug|Any CPU {F3449EF6-8E3F-492F-832F-F5F2E1F2503C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F3449EF6-8E3F-492F-832F-F5F2E1F2503C}.Release|Any CPU.Build.0 = Release|Any CPU + {3369F102-ABB2-42A4-B216-58D530AEE8BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3369F102-ABB2-42A4-B216-58D530AEE8BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3369F102-ABB2-42A4-B216-58D530AEE8BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3369F102-ABB2-42A4-B216-58D530AEE8BE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- Gitblit v1.9.1