From 6023f73a031bf93797d1cb74e705371abd3990e6 Mon Sep 17 00:00:00 2001 From: 移动系统liao <liaoxujun@qq.com> Date: 星期五, 27 六月 2025 14:47:22 +0800 Subject: [PATCH] no message --- Admin.NET/FZCTB.NET.API.Application/Auth/AuthService.cs | 33 ++++ Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs | 188 +++++++++++++++++++++++ Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs | 153 +++++++++++++++++++ Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs | 31 +++ Admin.NET/Admin.NET.Application/Configuration/Database.json | 4 Admin.NET/FZCZTB.NET.SYSService/CustomerSYS/CustomerManagerS.cs | 13 + 6 files changed, 411 insertions(+), 11 deletions(-) diff --git a/Admin.NET/Admin.NET.Application/Configuration/Database.json b/Admin.NET/Admin.NET.Application/Configuration/Database.json index e431736..f0a63d4 100644 --- a/Admin.NET/Admin.NET.Application/Configuration/Database.json +++ b/Admin.NET/Admin.NET.Application/Configuration/Database.json @@ -14,8 +14,8 @@ //"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL //"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;AllowLoadLocalInfile=true;AllowUserVariables=true;", // MySql, //"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle - "ConnectionString": "Server=192.168.0.31;Database=FZCZTB;User Id=SA;Password=123456;Encrypt=True;TrustServerCertificate=True;", // SqlServer - + //"ConnectionString": "Server=192.168.0.31;Database=FZCZTB;User Id=SA;Password=123456;Encrypt=True;TrustServerCertificate=True;", // SqlServer + "ConnectionString": "Server=MS-FSEUTNLCXFDB\\SQLEXPRESS;Database=FZCZTB;Encrypt=True;TrustServerCertificate=True;Integrated Security=true;", // SqlServer //"SlaveConnectionConfigs": [ // 璇诲啓鍒嗙/涓讳粠 // { // "HitRate": 10, diff --git a/Admin.NET/FZCTB.NET.API.Application/Auth/AuthService.cs b/Admin.NET/FZCTB.NET.API.Application/Auth/AuthService.cs index 376ef20..4c6b98e 100644 --- a/Admin.NET/FZCTB.NET.API.Application/Auth/AuthService.cs +++ b/Admin.NET/FZCTB.NET.API.Application/Auth/AuthService.cs @@ -19,6 +19,8 @@ using FZCTB.NET.API.Application.Auth.DTO; using Furion.FriendlyException; using FZCZTB.NET.SYSService.CustomerSYS; +using Furion; +using NewLife; namespace FZCTB.NET.API.Application.Auth { @@ -99,6 +101,37 @@ return await CreateToken(user, input.ExRuleCode??""); } + + /// <summary> + /// 鍒囨崲瑙掕壊 宸茬櫥褰曡繘鍘昏鑹叉垨鑰呭垏鎹㈣鑹叉槸璋冪敤锛岄渶瑕佹浛鎹oken,鐩稿綋浜庣櫥褰� + /// </summary> + [DisplayName("鍒囨崲瑙掕壊")] + public async Task<CustomerLoginOutput> ChangeLogoInExRule(string RuleCode) + { + var id = App.User.FindFirst(ClaimConst.UserId)?.Value.ToLong() ?? 0; + if (id == 0) + { + throw Oops.Oh("鐢ㄦ埛鍑瘉閿欒"); + + } + // + + // 鑾峰彇鐧诲綍绉熸埛鍜岀敤鎴� + // 鑾峰彇鐧诲綍绉熸埛鍜岀敤鎴� + var user = await _sysUserRep.AsQueryable().Where(x => x.Id == id).Includes(x => x.CoutomerExRols, y => y.ExRole).FirstAsync(); + if (user == null) + { + throw Oops.Oh("璇ョ敤鎴锋病鏈夋敞鍐�"); + } + if (user.Status == StatusEnum.Disable) + { + throw Oops.Oh("鐢ㄥ紓甯�"); + } + + return await CreateToken(user, RuleCode); + + } + /// <summary> /// 鎵嬫満鍙风櫥褰� 馃敄 /// </summary> diff --git a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs index 0a9e211..de4747c 100644 --- a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs +++ b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs @@ -6,16 +6,20 @@ using Admin.NET.Core; using Admin.NET.Core.Service; +using Furion; using Furion.DynamicApiController; using Furion.FriendlyException; using FZCTB.NET.API.Application.User.DTO; using FZCZTB.NET.MD.ConfigMd; using FZCZTB.NET.MD.CutomerMd; +using FZCZTB.NET.MD.CutomerMd.Extend; using FZCZTB.NET.SYSService.CustomerSYS; using Mapster; +using MapsterMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ViewComponents; +using NewLife; using OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers; using System; using System.Collections.Generic; @@ -39,15 +43,21 @@ private readonly SqlSugarRepository<FBS_EnterpriseType> _fBS_EnterpriseTypeRep; private readonly SqlSugarRepository<FBS_Customer> _fBS_CustomerRep; /// <summary> + /// 鐢ㄦ埛鎵╁睍 + /// </summary> + private readonly SqlSugarRepository<FBS_CusExtend> _fBS_CusExtendRep; + private IMapper _mapper; + /// <summary> /// /// </summary> public CustomerService(SysCacheService cacheService, CustomerManagerS managerS,SqlSugarRepository<FBS_Customer> repository - , SqlSugarRepository<FBS_EnterpriseType> fbsenrep ) + , SqlSugarRepository<FBS_EnterpriseType> fbsenrep,IMapper mapper ) { _sysCacheService= cacheService; _customerManager = managerS; _fBS_CustomerRep = repository; _fBS_EnterpriseTypeRep = fbsenrep; + _mapper = mapper; } /// <summary> @@ -137,6 +147,180 @@ return await _fBS_EnterpriseTypeRep.AsQueryable().Select<EnterpriseTypeVM>().ToTreeAsync(x=>x.Child,x=>x.ParentId,null,x=>x.Id); } + /// <summary> + /// 娉ㄥ唽瑙掕壊鐢ㄦ埛璧勬枡 + /// </summary> + /// <returns></returns> + [HttpPost] + public async Task<bool> CreaterExRolsInformation(CusExtendDto cusExtend ) + { - + var id = App.User.FindFirst(ClaimConst.UserId)?.Value.ToLong() ?? 0; + if (id == 0) + { + throw Oops.Oh("鐢ㄦ埛鍑瘉閿欒"); + + } + var user=await _customerManager.GetCustomer(id); + if(user==null) + { + throw Oops.Oh("鐢ㄦ埛涓嶅瓨鍦�"); + } + var rols= await _fBS_ExRoleRep.GetFirstAsync(x => x.Code == cusExtend.TransactionCode && x.Status == StatusEnum.Enable); + if(rols==null) + { + throw Oops.Oh("浜ゆ槗涓讳綋涓嶅瓨鍦�"); + } + + if(user.CoutomerExRols.Any(x=>x.ExRole.Code==cusExtend.TransactionCode&& x.HasFlsh==true)) + { + throw Oops.Oh("鐢ㄦ埛宸茬粡娉ㄥ唽浜嗚涓讳綋"); + } + + + var data= cusExtend.Adapt<FBS_CusExtend>(); + + data.steps = CusExtendStep.UNExamine; + data.CustomerId = id; + data.CreateTime = DateTime.Now; + + data.CreateUserName = user.NickName; + data.TransactionCode = rols.Code; + + + return await _fBS_CusExtendRep.InsertAsync(data); + + + + + } + /// <summary> + /// 鑾峰彇 涓汉涓績鏁版嵁锛� + /// </summary> + [HttpPost] + public async Task<CusExtendDto> GetCusExtendInfo() + { + var id = App.User.FindFirst(ClaimConst.UserId)?.Value.ToLong() ?? 0; + if (id == 0) + { + throw Oops.Oh("鐢ㄦ埛鍑瘉閿欒"); + + } + // + var typeCode = App.User.FindFirst(ClaimConst.CustomerLogoinType)?.Value ; + if (typeCode == null) + { + throw Oops.Oh("鐧诲綍浜ゆ槗涓讳綋閿欒"); + + } + var user = await _customerManager.GetCustomer(id); + if (user == null) + { + throw Oops.Oh("鐢ㄦ埛涓嶅瓨鍦�"); + } + var rols = await _fBS_ExRoleRep.GetFirstAsync(x => x.Code == typeCode && x.Status == StatusEnum.Enable); + if (rols == null) + { + throw Oops.Oh("鐧诲綍浜ゆ槗涓讳綋鏃犳晥"); + } + var tab= (await _fBS_CusExtendRep.GetFirstAsync(x => x.CustomerId == id && x.TransactionCode == typeCode)).Adapt<CusExtendDto>(); + if(tab==null) + { + throw Oops.Oh("娌℃湁瀹屾垚淇℃伅褰曞叆"); + } + return tab; + + + } + + /// <summary> + /// 淇敼涓汉涓績鏁版嵁 + /// </summary> + [HttpPost] + public async Task<bool> ChangeCusExtend(CusExtendDto InParam) + { + var id = App.User.FindFirst(ClaimConst.UserId)?.Value.ToLong() ?? 0; + if (id == 0) + { + throw Oops.Oh("鐢ㄦ埛鍑瘉閿欒"); + + } + // + var typeCode = App.User.FindFirst(ClaimConst.CustomerLogoinType)?.Value; + if (typeCode == null) + { + throw Oops.Oh("鐧诲綍浜ゆ槗涓讳綋閿欒"); + + } + var user = await _customerManager.GetCustomer(id); + if (user == null) + { + throw Oops.Oh("鐢ㄦ埛涓嶅瓨鍦�"); + } + var rols = await _fBS_ExRoleRep.GetFirstAsync(x => x.Code == typeCode && x.Status == StatusEnum.Enable); + if (rols == null) + { + throw Oops.Oh("鐧诲綍浜ゆ槗涓讳綋鏃犳晥"); + } + var tab = await _fBS_CusExtendRep.GetFirstAsync(x => x.CustomerId == id && x.TransactionCode == typeCode); + if (tab == null) + { + throw Oops.Oh("娌℃湁瀹屾垚淇℃伅褰曞叆"); + } + + + + + + //娉曚汉 + if (tab.LegalRepresentativeIdCard != InParam.LegalRepresentativeIdCard) + { + tab.LegalRepresentativeIdCard = InParam.LegalRepresentativeIdCard; + tab.LegalRepresentativeIdNumber = InParam.LegalRepresentativeIdNumber; + tab.LegalRepresentativeName = InParam.LegalRepresentativeName; + tab.LegalRepresentativePhone = InParam.LegalRepresentativePhone; + //閲嶆柊瀹℃牳? + tab.steps = CusExtendStep.Change; + } + + + //浼佷笟淇℃伅 + if (tab.BusinessLicense != InParam.BusinessLicense) + { + tab.EstablishmentTime = tab.EstablishmentTime; + tab.RegisteredCapital = tab.RegisteredCapital; + tab.Residence = tab.Residence; + tab.MainBusiness = InParam.MainBusiness; + tab.EnterpriseType = InParam.EnterpriseType; + tab.EnterpriseName = InParam.EnterpriseName; + tab.BusinessLicense = InParam.BusinessLicense; + //閲嶆柊瀹℃牳? + tab.steps = CusExtendStep.Change; + } + + + //鑱旂郴鐢佃瘽 + tab.EnterprisePhone = InParam.EnterprisePhone; + tab.EnterpriseEmail = InParam.EnterpriseEmail; + //閾惰鏄惁闇�瑕佷慨鏀� + tab.BankAccount = InParam.BankAccount; + tab.BankName = InParam.BankName; + + // 缁忓姙浜� + if (tab.OperatorIdCard != InParam.OperatorIdCard) + { + tab.OperatorIdCard = InParam.OperatorIdCard; + + tab.OperatorIdNumber = InParam.OperatorIdNumber; + tab.OperatorName = InParam.OperatorName; + tab.OperatorPhone = InParam.OperatorPhone; + } + + return await _fBS_CusExtendRep.UpdateAsync(tab); + + } + + + + } diff --git a/Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs b/Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs index 827245a..952a56b 100644 --- a/Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs +++ b/Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs @@ -8,6 +8,7 @@ using SqlSugar; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -45,3 +46,155 @@ public List<FBS_EnterpriseType> Child { get; set; } } + +/// <summary> +/// 鐢ㄦ埛瑙掕壊璧勬枡 +/// </summary> +public class CusExtendDto +{ + + /// <summary> + /// 涓婚敭 + /// </summary> + + public long ? Id { get; set; } + + /// <summary> + /// 浼佷笟绫诲瀷 浠庝紒涓氱被鍨嬩腑閫夋嫨 鏉ユ簮浼佷笟绫诲瀷 + /// </summary> + + public string? EnterpriseType { get; set; } + + + /// <summary> + /// 浜ゆ槗涓讳綋 浠g爜 鍚岃鑹蹭唬鐮� + /// </summary> + [Required(ErrorMessage = "浜ゆ槗涓讳綋浠g爜涓哄繀濉」")] + public string? TransactionCode { get; set; } + + /// <summary> + /// 浜ゆ槗涓讳綋鍚嶇О + /// </summary> + public string TransactionName { get; set; } + + /// <summary> + /// 钀ヤ笟鎵х収鏂囦欢璺緞 + /// </summary> + + public string BusinessLicense { get; set; } + + /// <summary> + /// 浼佷笟鍚嶇О + /// </summary> + + public string EnterpriseName { get; set; } + + /// <summary> + /// 缁熶竴绀句細淇$敤浠g爜 + /// </summary> + + public string UnifiedSocialCreditCode { get; set; } + + /// <summary> + /// 娉ㄥ唽璧勯噾锛堝崟浣嶏細涓囧厓 锛� + /// </summary> + + public decimal RegisteredCapital { get; set; } + + /// <summary> + /// 娉曞畾浠h〃浜哄鍚� + /// </summary> + + public string LegalRepresentativeName { get; set; } + + /// <summary> + /// 娉曞畾浠h〃浜鸿韩浠借瘉鏂囦欢璺緞 + /// </summary> + + public string LegalRepresentativeIdCard { get; set; } + + /// <summary> + /// 娉曞畾浠h〃浜鸿韩浠借瘉鍙风爜 + /// </summary> + + public string LegalRepresentativeIdNumber { get; set; } + + /// <summary> + /// 娉曞畾浠h〃浜鸿仈绯荤數璇� + /// </summary> + [Phone(ErrorMessage = "鑱旂郴鐢佃瘽鏍煎紡涓嶆纭�")] + + public string? LegalRepresentativePhone { get; set; } + + /// <summary> + /// 浼佷笟浣忔墍锛堜笅鎷夐�夋嫨锛岄渶缁撳悎瀹為檯鍙�夊�硷紝鍏堝瓧绗︿覆鎺ユ敹 锛� + /// </summary> + + public string Residence { get; set; } + + /// <summary> + /// 浼佷笟鑱旂郴鐢佃瘽 + /// </summary> + + [Phone(ErrorMessage = "鑱旂郴鐢佃瘽鏍煎紡涓嶆纭�")] + public string? EnterprisePhone { get; set; } + + /// <summary> + /// 浼佷笟鎴愮珛鏃堕棿 + /// </summary> + + public DateTime EstablishmentTime { get; set; } + + /// <summary> + /// 浼佷笟涓昏惀涓氬姟 + /// </summary> + + public string MainBusiness { get; set; } + + /// <summary> + /// 浼佷笟閭 + /// </summary> + + [SugarColumn(ColumnDescription = "浼佷笟閭")] + public string EnterpriseEmail { get; set; } + + /// <summary> + /// 涓氬姟缁忓姙浜哄鍚� + /// </summary> + + public string OperatorName { get; set; } + + /// <summary> + /// 涓氬姟缁忓姙浜鸿韩浠借瘉鏂囦欢璺緞鎴栨爣璇嗭紙涓婁紶鍚庡瓨鍌ㄤ俊鎭級 + /// </summary> + + + public string OperatorIdCard { get; set; } + + /// <summary> + /// 涓氬姟缁忓姙浜鸿韩浠借瘉鍙风爜 + /// </summary> + + + public string OperatorIdNumber { get; set; } + + /// <summary> + /// 涓氬姟缁忓姙浜鸿仈绯荤數璇� + /// </summary> + + [Phone(ErrorMessage = "鑱旂郴鐢佃瘽鏍煎紡涓嶆纭�")] + public string OperatorPhone { get; set; } + + /// <summary> + /// 浼佷笟寮�鎴疯 + /// </summary> + + + public string BankName { get; set; } + + /// <summary> + /// 浼佷笟閾惰璐﹀彿 + /// </summary> + public string BankAccount { get; set; } +} + \ No newline at end of file diff --git a/Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs b/Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs index 692e6a3..17e3204 100644 --- a/Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs +++ b/Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs @@ -26,7 +26,7 @@ /// </summary> [SugarColumn(ColumnDescription = "鐢ㄦ埛ID" )] [Required(ErrorMessage = "鐢ㄦ埛ID 蹇呭~")] - public int CustomerId { get; set; } + public long CustomerId { get; set; } @@ -185,5 +185,32 @@ /// </summary> [SugarColumn(ColumnDescription = "瀹℃牳姝ラ")] - public int steps { set; get; } = 0; + public CusExtendStep steps { set; get; } = CusExtendStep.UNExamine; } + +/// <summary> +/// 瑙掕壊璧勬枡瀹℃牳杩涘害 +/// </summary> +public enum CusExtendStep +{ + /// <summary> + /// 鏈鏍� + /// </summary> + UNExamine=0, + /// <summary> + /// 鏇存敼 + /// </summary> + Change, + + /// <summary> + /// 閫氳繃 + /// </summary> + Pass, + /// <summary> + /// 鏈�氳繃 + /// </summary> + UnPass + + + +} \ No newline at end of file diff --git a/Admin.NET/FZCZTB.NET.SYSService/CustomerSYS/CustomerManagerS.cs b/Admin.NET/FZCZTB.NET.SYSService/CustomerSYS/CustomerManagerS.cs index aca8db5..ab8c7ca 100644 --- a/Admin.NET/FZCZTB.NET.SYSService/CustomerSYS/CustomerManagerS.cs +++ b/Admin.NET/FZCZTB.NET.SYSService/CustomerSYS/CustomerManagerS.cs @@ -1,6 +1,7 @@ 锘縰sing Admin.NET.Core; using Admin.NET.Core.Service; using Furion.DependencyInjection; +using Furion.FriendlyException; using FZCZTB.NET.MD.CutomerMd; using Mapster; using SqlSugar; @@ -45,12 +46,13 @@ /// 杩斿洖褰撳墠鍙敤鐨勭敤鎴疯鑹� 鍐嶆敞鍐屽拰鐧诲綍鏃堕渶瑕佽繑鍥炵紪鐮� /// </summary> /// <returns></returns> - public async Task<CustomerRDto> GetCustomer(int id) + public async Task<CustomerRDto> GetCustomer(long id) { - - - return (await _fBS_CustomerRep.GetFirstAsync(x => x.Id == id && x.Status == StatusEnum.Enable)).Adapt<CustomerRDto>(); + + return await _fBS_CustomerRep.AsQueryable().Where(x=>x.Id==id&&x.Status== StatusEnum.Enable).Includes(x=>x.CoutomerExRols,y=>y.ExRole) + .Select<CustomerRDto>().WithCache(20).FirstAsync(); + //return (await _fBS_CustomerRep.GetFirstAsync(x => x.Id == id && x.Status == StatusEnum.Enable)).Adapt<CustomerRDto>(); @@ -77,6 +79,7 @@ } + } @@ -207,7 +210,7 @@ public string? Signature { get; set; } /// <summary> - /// 澶栭儴瑙勫垯锛岀櫥褰曡鑹� + /// 鐧诲綍瑙掕壊 /// </summary> [Navigate(NavigateType.OneToMany, nameof(FBS_CoutomerExRole.CustomerId))] public List<FBS_CoutomerExRole> CoutomerExRols { set; get; } -- Gitblit v1.9.1