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/User/CustomerService.cs |  188 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 186 insertions(+), 2 deletions(-)

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);
+
+    }
+
+
+
+
 }

--
Gitblit v1.9.1