From 65383b35f3b0420ab1d334ef354d4706d54f93f8 Mon Sep 17 00:00:00 2001 From: 移动系统liao <liaoxujun@qq.com> Date: 星期三, 30 七月 2025 10:47:59 +0800 Subject: [PATCH] no message --- Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_Customer/FBS_CustomerService.cs | 2 Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs | 58 ++++++++++++++++--- Admin.NET/FZCZTB.NET.SYSService/FZCZTSYSServiceConfig.json | 6 +- Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs | 21 +++++- Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_CusExtend/FBS_CusExtendService.cs | 86 ++++++++++++++++++++++++++++ 5 files changed, 154 insertions(+), 19 deletions(-) diff --git a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs index 9c5cf91..f157c21 100644 --- a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs +++ b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs @@ -6,6 +6,7 @@ using Admin.NET.Core; using Admin.NET.Core.Service; +using Dm.util; using Furion; using Furion.DynamicApiController; using Furion.FriendlyException; @@ -39,19 +40,22 @@ private readonly SysCacheService _sysCacheService; private readonly SqlSugarRepository<FBS_ExRole> _fBS_ExRoleRep; - + private readonly SqlSugarRepository<FBS_CoutomerExRole> _fBS_CustomerExRoleRep; 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,IMapper mapper,SqlSugarRepository<FBS_ExRole> exroles , SqlSugarRepository<FBS_CusExtend> cusrep) + , SqlSugarRepository<FBS_EnterpriseType> fbsenrep,IMapper mapper,SqlSugarRepository<FBS_ExRole> exroles , + SqlSugarRepository<FBS_CusExtend> cusrep, + SqlSugarRepository<FBS_CoutomerExRole> cexrrep) { _sysCacheService= cacheService; _customerManager = managerS; @@ -60,6 +64,7 @@ _fBS_ExRoleRep = exroles; _fBS_CusExtendRep = cusrep; _mapper = mapper; + _fBS_CustomerExRoleRep = cexrrep; } /// <summary> @@ -111,15 +116,26 @@ dd.CreateTime = DateTime.Now; dd.CreateUserId = 0; dd.CreateUserName = dd.NickName; - dd.CoutomerExRols = new List<FBS_CoutomerExRole>() + if(dd.CoutomerExRols==null) + { + new List<FBS_CoutomerExRole>() { new FBS_CoutomerExRole { ExRoleId= ExRole?.Id??0 - - + + } }; + } + else + { + dd.CoutomerExRols.add(new FBS_CoutomerExRole + { + ExRoleId = ExRole?.Id ?? 0 + }); + } + @@ -168,18 +184,42 @@ { 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)==true) + var ExRoles = await _fBS_CustomerExRoleRep.GetListAsync(x => x.CustomerId == id); + if (ExRoles != null) { - throw Oops.Oh("鐢ㄦ埛宸茬粡娉ㄥ唽浜嗚涓讳綋"); + if (ExRoles?.Any(x => x.ExRoleId == rols.Id && x.HasFlsh == true) == true) + { + throw Oops.Oh("鐢ㄦ埛宸茬粡娉ㄥ唽浜嗚涓讳綋"); + } + } - + //澧炲姞鐢ㄦ埛瑙掕壊 + await _fBS_CustomerExRoleRep.InsertAsync(new FBS_CoutomerExRole + { + ExRoleId = rols.Id, + CustomerId = id + }); + + + var usdata = await _fBS_CusExtendRep.GetFirstAsync(x => x.CustomerId == id&&x.TransactionCode==cusExtend.TransactionCode); + + if (usdata!=null) + { + if (usdata.steps == CusExtendStep.Pass) + { + throw Oops.Oh("鐢ㄦ埛宸茬粡娉ㄥ唽浜嗚涓讳綋"); + + } + throw Oops.Oh("鐢ㄦ埛宸茬粡鐢宠浜嗚瑙掕壊锛岃璧颁慨鏀规祦绋�"); + } + var data= cusExtend.Adapt<FBS_CusExtend>(); data.steps = CusExtendStep.UNExamine; 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 7d6269b..6265897 100644 --- a/Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs +++ b/Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs @@ -8,6 +8,7 @@ using SqlSugar; using System; using System.Collections.Generic; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; @@ -44,6 +45,12 @@ [Required(ErrorMessage = "浜ゆ槗涓讳綋浠g爜涓哄繀濉」")] [SugarColumn(ColumnDescription = "浜ゆ槗涓讳綋code")] public string TransactionCode { get; set; } + + /// <summary> + /// 浜ゆ槗涓讳綋 + /// </summary> + [Navigate(NavigateType.OneToOne, nameof(TransactionCode),nameof(FBS_ExRole.Code))] + public FBS_ExRole? TransactionRole { get; set; } /// <summary> /// 钀ヤ笟鎵х収鏂囦欢璺緞 /// </summary> @@ -98,15 +105,15 @@ /// 娉曞畾浠h〃浜鸿韩浠借瘉鍙风爜 /// </summary> [Required(ErrorMessage = "娉曞畾浠h〃浜鸿韩浠借瘉鍙风爜涓哄繀濉」")] - [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜哄鍚�")] + [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜鸿韩浠借瘉鍙风爜")] public string LegalRepresentativeIdNumber { get; set; } /// <summary> /// 娉曞畾浠h〃浜鸿仈绯荤數璇� /// </summary> [Required(ErrorMessage = "娉曞畾浠h〃浜鸿仈绯荤數璇濅负蹇呭~椤�")] - [Phone(ErrorMessage = "鑱旂郴鐢佃瘽鏍煎紡涓嶆纭�")] - [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜哄鍚�")] + [Phone(ErrorMessage = "娉曞畾浠h〃浜鸿仈绯荤數璇濅笉姝g‘")] + [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜鸿仈绯荤數璇�")] public string LegalRepresentativePhone { get; set; } /// <summary> @@ -204,19 +211,23 @@ /// <summary> /// 鏈鏍� /// </summary> - UNExamine=0, + [Description("鏈鏍�")] + UNExamine =0, /// <summary> /// 鏇存敼 /// </summary> + [Description("鏇存敼")] Change, - + /// <summary> /// 閫氳繃 /// </summary> + [Description("閫氳繃")] Pass, /// <summary> /// 鏈�氳繃 /// </summary> + [Description("鏈�氳繃")] UnPass diff --git a/Admin.NET/FZCZTB.NET.SYSService/FZCZTSYSServiceConfig.json b/Admin.NET/FZCZTB.NET.SYSService/FZCZTSYSServiceConfig.json index 84183ff..94ecea7 100644 --- a/Admin.NET/FZCZTB.NET.SYSService/FZCZTSYSServiceConfig.json +++ b/Admin.NET/FZCZTB.NET.SYSService/FZCZTSYSServiceConfig.json @@ -9,15 +9,15 @@ "Templates": [ { "Id": "0", - "SignName": "銆愭斂閲囧挩璇㈢綉銆�", //闇�瑕佸姞鍏ョ殑鍏徃鏍囩 + "SignName": "銆愬洓宸濇斂閲囨嫑鎶曟爣鍜ㄨ銆�", //闇�瑕佸姞鍏ョ殑鍏徃鏍囩 "TemplateCode": "VCode", "Content": "鎮ㄥソ锛屾偍鐨勯獙璇佺爜鏄細${code}" - + }, { "Id": "1", - "SignName": "銆愭斂閲囧挩璇㈢綉銆�", + "SignName": "銆愬洓宸濇斂閲囨嫑鎶曟爣鍜ㄨ銆�", "TemplateCode": "RegistrationOK ", "Content": "娉ㄥ唽鎴愬姛锛屾劅璋㈡偍鐨勬敞鍐岋紝璇峰Ε鍠勪繚绠℃偍鐨勮处鎴蜂俊鎭�" } diff --git a/Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_CusExtend/FBS_CusExtendService.cs b/Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_CusExtend/FBS_CusExtendService.cs index a2c2813..d16d7a0 100644 --- a/Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_CusExtend/FBS_CusExtendService.cs +++ b/Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_CusExtend/FBS_CusExtendService.cs @@ -18,6 +18,8 @@ using Admin.NET.Core; using FZCZTB.NET.MD.CutomerMd.Extend; using cylsg.utility; +using FZCZTB.NET.MD.CutomerMd; +using Furion.Logging.Extensions; namespace FZCZTB.Net.CustomerSYSTem; /// <summary> @@ -27,19 +29,23 @@ public class FBS_CusExtendService : IDynamicApiController, ITransient { private readonly SqlSugarRepository<FBS_CusExtend> _fBS_CusExtendRep; + private readonly SqlSugarRepository<FBS_CoutomerExRole> _fBS_CoutomerExRoleRep; private readonly ISqlSugarClient _sqlSugarClient; private readonly SysDictTypeService _sysDictTypeService; private readonly FBS_EnterpriseTypeService _EnterpriseTypeService; + public FBS_CusExtendService(SqlSugarRepository<FBS_CusExtend> fBS_CusExtendRep, ISqlSugarClient sqlSugarClient, SysDictTypeService sysDictTypeService, - FBS_EnterpriseTypeService fBS_EnterpriseTypeService ) + FBS_EnterpriseTypeService fBS_EnterpriseTypeService, + SqlSugarRepository<FBS_CoutomerExRole> cerRep) { _fBS_CusExtendRep = fBS_CusExtendRep; _sqlSugarClient = sqlSugarClient; _sysDictTypeService = sysDictTypeService; _EnterpriseTypeService = fBS_EnterpriseTypeService; + _fBS_CoutomerExRoleRep = cerRep; } /// <summary> /// @@ -55,6 +61,7 @@ StepsTypeItems = CommonHelper.GetEnumItemsWithAttributes<CusExtendStep>() }; } + /// <summary> /// 鍒嗛〉鏌ヨ浼佷笟璧勬枡 馃敄 /// </summary> @@ -93,6 +100,83 @@ .Select<FBS_CusExtendOutput>(); return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); } + /// <summary> + /// 鏇存敼瀹℃牳鐘舵�� + /// </summary> + /// <param name="id">瑕佹洿鏀圭殑鐢ㄦ埛瑙掕壊璧勬枡Id</param> + /// <param name="step">瑕佹洿鏀圭殑鐘舵��</param> + /// <returns></returns> + [HttpGet] + public async Task<bool > ChangeSteps (long id, CusExtendStep step) + { + + var data=await _fBS_CusExtendRep.AsQueryable().Includes(x=>x.TransactionRole).Where(x=>x.Id==id).FirstAsync(); + if (data == null) + { + throw Oops.Oh("鏁版嵁涓嶅瓨鍦�"); + }; + if(data.steps== step) + { + return true; + } + try + { + await _fBS_CusExtendRep.AsTenant().BeginTranAsync(); + if (step == CusExtendStep.Pass) + { + //鏄鏍搁�氳繃 + + if (data.TransactionRole == null) + { + throw Oops.Oh("鐢ㄦ埛鍏宠仈瑙掕壊澶辫触锛岀敤鎴锋病鏈夌敵璇疯瑙掕壊锛岃閲嶆柊鐢宠瑙掕壊"); + } + + var exrles = await _fBS_CoutomerExRoleRep.GetFirstAsync(x => x.CustomerId == data.CustomerId && x.ExRoleId == data.TransactionRole.Id); + if (exrles == null) + throw Oops.Oh("鐢ㄦ埛鍏宠仈瑙掕壊澶辫触锛岀敤鎴锋病鏈夌敵璇疯瑙掕壊锛岃閲嶆柊鐢宠瑙掕壊"); + + exrles.HasFlsh = true; + await _fBS_CoutomerExRoleRep.UpdateAsync(exrles); + + + + + + } + else + if(data.steps== CusExtendStep.Pass) + { + //鏇存敼涓烘湭閫氳繃 + + if (data.TransactionRole == null) + { + throw Oops.Oh("鐢ㄦ埛鍏宠仈瑙掕壊澶辫触锛岀敤鎴锋病鏈夌敵璇疯瑙掕壊锛岃閲嶆柊鐢宠瑙掕壊"); + } + var exrles = await _fBS_CoutomerExRoleRep.GetFirstAsync(x => x.CustomerId == data.CustomerId && x.ExRoleId == data.TransactionRole.Id); + if (exrles == null) + throw Oops.Oh("鐢ㄦ埛鍏宠仈瑙掕壊澶辫触锛岀敤鎴锋病鏈夌敵璇疯瑙掕壊锛岃閲嶆柊鐢宠瑙掕壊"); + + exrles.HasFlsh = false; + await _fBS_CoutomerExRoleRep.UpdateAsync(exrles); + + + + + } + data.steps = step; + await _fBS_CusExtendRep.AsUpdateable(data).ExecuteCommandAsync(); + await _fBS_CusExtendRep.AsTenant().CommitTranAsync(); + return true; + + } + catch (Exception e) + { + await _fBS_CusExtendRep.AsTenant().RollbackTranAsync(); + e.Message.LogError(); + throw Oops.Oh("鏇存敼瀹℃牳鐘舵�佸け璐�"); ; + } + + } /// <summary> /// 鑾峰彇浼佷笟璧勬枡璇︽儏 鈩癸笍 diff --git a/Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_Customer/FBS_CustomerService.cs b/Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_Customer/FBS_CustomerService.cs index 7bb739a..81df660 100644 --- a/Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_Customer/FBS_CustomerService.cs +++ b/Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_Customer/FBS_CustomerService.cs @@ -222,7 +222,7 @@ } if (!string.IsNullOrWhiteSpace(x.Error)) return false; if (x.CultureLevel == null){ - x.Error = "鏂囧寲绋嬪害涓嶈兘涓虹┖"; + x.Error = "鏂囧寲绋嬪害涓嶈兘涓虹┖"; return false; } if (!string.IsNullOrWhiteSpace(x.Error)) return false; -- Gitblit v1.9.1