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_CusExtend/FBS_CusExtendService.cs | 86 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 85 insertions(+), 1 deletions(-) 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> /// 鑾峰彇浼佷笟璧勬枡璇︽儏 鈩癸笍 -- Gitblit v1.9.1