From 376f3de70bfdd7905876123ba5a331c0aa176199 Mon Sep 17 00:00:00 2001
From: 小飞侠 <8277136+liaoxujun@user.noreply.gitee.com>
Date: 星期四, 25 九月 2025 09:10:29 +0800
Subject: [PATCH] 修改注册时可以多模块注册

---
 Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs |   37 ++++++---
 Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs        |   87 ++++++++++-----------
 Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs   |   64 ++++++++--------
 3 files changed, 100 insertions(+), 88 deletions(-)

diff --git a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs
index b520808..4288a85 100644
--- a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs
+++ b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs
@@ -90,11 +90,19 @@
     {
         //_customerManager.
         var ExRole= (await _customerManager.GetExRole()).Where(x => x.Code == param.ExRoleCode).FirstOrDefault();
-
-     if(ExRole==null)
+        if(string.IsNullOrEmpty(param.ExRoleCode))
         {
-            throw Oops.Oh("璇烽�夋嫨涓�涓湁鏁堢殑瑙掕壊杩涜娉ㄥ唽");
+            throw Oops.Oh("璇疯嚦灏戦�夋嫨涓�涓敞鍐岃鑹�");
         }
+        var EzRoleListstr= param.ExRoleCode.Split(',');
+     
+        var   EzRoleList=  (await _customerManager.GetExRole()).Where(x => EzRoleListstr.Contains(x.Code) && x.Status == StatusEnum.Enable).ToList();
+       if(EzRoleListstr.Count() != EzRoleList?.Count())
+        {
+            throw Oops.Oh("娉ㄥ唽瑙掕壊鏈夎锛岃閫夋嫨鏈夋晥鐨勮鑹茶繘琛屾敞鍐�");
+        }
+
+      
 
        // //宸查�夎鑹诧紝璇烽�夋嫨涓�涓敞鍐岃鑹�    
        //var data= await _fBS_CustomerRep.AsQueryable().Includes(X => X.CoutomerExRols,y=>y.ExRole).Where(x => x.Account == param.Account).FirstAsync();
@@ -143,18 +151,23 @@
         {
              dd = await _fBS_CusExtendRep.InsertReturnEntityAsync(dd);
 
-            FBS_CoutomerExRole rulse = new FBS_CoutomerExRole
+            foreach (var item in EzRoleList)
             {
-                CusExtendId = dd.Id,
-                ExRoleId = ExRole.Id ?? 0,
-                steps = CusExtendStep.UNExamine,
-                CreateTime = DateTime.Now,
-                CreateUserName = "浼佷笟鐢ㄦ埛:" + ThisUser?.Name,
-                CreateUserId = ThisUser?.Id
 
 
-            };
-            await _fBS_CustomerExRoleRep.InsertAsync(rulse);
+                FBS_CoutomerExRole rulse = new FBS_CoutomerExRole
+                {
+                    CusExtendId = dd.Id,
+                    ExRoleId = item.Id ?? 0,
+                    steps = CusExtendStep.UNExamine,
+                    CreateTime = DateTime.Now,
+                    CreateUserName = "浼佷笟鐢ㄦ埛:" + ThisUser?.Name,
+                    CreateUserId = ThisUser?.Id
+
+
+                };
+                await _fBS_CustomerExRoleRep.InsertAsync(rulse);
+            }
 
             FBS_CustormerUsers user = new FBS_CustormerUsers
             {
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 0f16da9..c6fed92 100644
--- a/Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs
+++ b/Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs
@@ -233,81 +233,81 @@
     /// <summary>
     /// 浼佷笟绫诲瀷 
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟绫诲瀷 涓嶈兘涓虹┖")]
-    public virtual string EnterpriseType { get; set; }
+
+    public virtual string? EnterpriseType { get; set; }
 
     /// <summary>
-    /// 涓讳綋瑙掕壊浠g爜涓嶈兘浼┖ 鍘熷瓧娈� TransactionCode
+    /// 涓讳綋瑙掕壊浠g爜涓嶈兘浼┖ 鍘熷瓧娈� TransactionCode 澶氳鑹蹭互','鍒嗗壊
     /// </summary>
-    [Required(ErrorMessage = "瑙掕壊浠g爜 浣犺兘涓虹┖")]
-    public virtual string   ExRoleCode{ get; set; }
+    [Required(ErrorMessage = "瑙掕壊浠g爜 浣犺兘涓虹┖锛屽瑙掕壊浠�','鍒嗗壊")]
+    public virtual string?   ExRoleCode{ get; set; }
 
     /// <summary>
     /// 钀ヤ笟鎵х収鏂囦欢璺緞
     /// </summary>
-    [Required(ErrorMessage = "钀ヤ笟鎵х収鏂囦欢璺緞涓嶈兘涓虹┖")]
-    public virtual string BusinessLicense { get; set; }
+
+    public virtual string? BusinessLicense { get; set; }
 
     /// <summary>
     /// 浼佷笟鍚嶇О
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟鍚嶇О涓嶈兘涓虹┖")]
-    public virtual string EnterpriseName { get; set; }
+  
+    public virtual string? EnterpriseName { get; set; }
 
     /// <summary>
     /// 缁熶竴绀句細淇$敤浠g爜
     /// </summary>
-    [Required(ErrorMessage = "缁熶竴绀句細淇$敤浠g爜涓嶈兘涓虹┖")]
-    public virtual string UnifiedSocialCreditCode { get; set; }
+
+    public virtual string? UnifiedSocialCreditCode { get; set; }
 
     /// <summary>
     /// 娉ㄥ唽璧勯噾
     /// </summary>
-    [Required(ErrorMessage = "娉ㄥ唽璧勯噾涓嶈兘涓虹┖")]
-    public virtual string RegisteredCapital { get; set; }
+
+    public virtual string? RegisteredCapital { get; set; }
 
     /// <summary>
     /// 娉曞畾浠h〃浜哄鍚�
     /// </summary>
-    [Required(ErrorMessage = "娉曞畾浠h〃浜哄鍚嶄笉鑳戒负绌�")]
-    public virtual string LegalRepresentativeName { get; set; }
+
+    public virtual string? LegalRepresentativeName { get; set; }
 
     /// <summary>
     /// 娉曞畾浠h〃浜鸿韩浠借瘉鏂囦欢璺緞
     /// </summary>
-    [Required(ErrorMessage = "娉曞畾浠h〃浜鸿韩浠借瘉鏂囦欢璺緞涓嶈兘涓虹┖")]
-    public virtual string LegalRepresentativeIdCard { get; set; }
+
+    public virtual string? LegalRepresentativeIdCard { get; set; }
 
     /// <summary>
     /// 娉曞畾浠h〃浜哄鍚�
     /// </summary>
-    [Required(ErrorMessage = "娉曞畾浠h〃浜哄鍚嶄笉鑳戒负绌�")]
-    public virtual string LegalRepresentativeIdNumber { get; set; }
+
+    public virtual string? LegalRepresentativeIdNumber { get; set; }
 
     /// <summary>
     /// 娉曞畾浠h〃浜哄鍚�
     /// </summary>
-    [Required(ErrorMessage = "娉曞畾浠h〃浜哄鍚嶄笉鑳戒负绌�")]
-    public virtual string LegalRepresentativePhone { get; set; }
+
+    public virtual string? LegalRepresentativePhone { get; set; }
 
     /// <summary>
     /// 浼佷笟浣忔墍
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟浣忔墍涓嶈兘涓虹┖")]
-    public virtual string Residence { get; set; }
+  
+    public virtual string? Residence { get; set; }
 
     /// <summary>
     /// 浼佷笟鑱旂郴鐢佃瘽
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟鑱旂郴鐢佃瘽涓嶈兘涓虹┖")]
-    [DataValidation(ValidationTypes.PhoneNumber, ErrorMessage = "鎵嬫満鍙风爜涓嶆纭�")]
-    public virtual string EnterprisePhone { get; set; }
+   
+  
+    public virtual string? EnterprisePhone { get; set; }
 
     /// <summary>
     /// 浼佷笟鎴愮珛鏃堕棿
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟鎴愮珛鏃堕棿涓嶈兘涓虹┖")]
-    public virtual DateTime EstablishmentTime { get; set; }
+
+    public virtual DateTime? EstablishmentTime { get; set; }
 
     /// <summary>
     /// 浼佷笟涓昏惀涓氬姟
@@ -317,66 +317,65 @@
     /// <summary>
     /// 浼佷笟閭
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟閭涓嶈兘涓虹┖")]
-    [DataValidation(ValidationTypes.EmailAddress, ErrorMessage = "鎵嬫満鍙风爜涓嶆纭�")]
-    public virtual string EnterpriseEmail { get; set; }
+   
+    public virtual string? EnterpriseEmail { get; set; }
 
     /// <summary>
     /// 涓氬姟缁忓姙浜哄鍚嶃�佺鐞嗗憳濮撳悕
     /// </summary>
-    [Required(ErrorMessage = "涓氬姟缁忓姙浜鸿韩浠借瘉涓嶈兘涓虹┖")]
+
     public virtual string? OperatorName { get; set; }
 
     /// <summary>
     /// 涓氬姟缁忓姙浜鸿韩浠借瘉鏂囦欢璺緞鎴栨爣璇�
     /// </summary>
-    [Required(ErrorMessage = "涓氬姟缁忓姙浜鸿韩浠借瘉涓嶈兘涓虹┖")]
+
     public virtual string? OperatorIdCard { get; set; }
 
     /// <summary>
     /// 涓氬姟缁忓姙浜鸿韩浠借瘉鍙风爜
     /// </summary>
-    [Required(ErrorMessage = "涓氬姟缁忓姙浜鸿韩浠借瘉鍙风爜")]
+
     public virtual string? OperatorIdNumber { get; set; }
 
     /// <summary>
     /// 涓氬姟缁忓姙浜虹數璇�/绠$悊鍛樼數璇�
     /// </summary>
-    [DataValidation(ValidationTypes.PhoneNumber, ErrorMessage = "鎵嬫満鍙风爜涓嶆纭�")]
+
     public virtual string? OperatorPhone { get; set; }
 
     /// <summary>
     /// 寮�鎴疯鍚嶇О
     /// </summary>
-    [Required(ErrorMessage = "寮�鎴疯鍚嶇О")]
-    public virtual string BankName { get; set; }
+
+    public virtual string? BankName { get; set; }
 
     /// <summary>
     ///寮�鎴疯璐﹀彿
     /// </summary>
-    [Required(ErrorMessage = "寮�鎴疯璐﹀彿")]
-    public virtual string BankAccount { get; set; }
+
+    public virtual string? BankAccount { get; set; }
 
     /// <summary>
     /// 鐢佃瘽鍙风爜鏍¢獙鐮�
     /// </summary>
-    [Required(ErrorMessage = "鐢佃瘽鍙风爜鏍¢獙鐮佷笉鑳戒负绌�")]
-    public string PhoneVCode { get; set; }
+
+    public string? PhoneVCode { get; set; }
 
     /// <summary>
     /// 閾惰鏀舵鐮�
     /// </summary>
 
 
-    public string BankAccountIMG { get; set; }
+    public string? BankAccountIMG { get; set; }
     /// <summary>
     /// 鑱屼綅
     /// </summary>
-    public string JobTitle { get; internal set; }
+    public string?   JobTitle { get; internal set; }
     /// <summary>
     /// 鏄电О
     /// </summary>
-    public string Nickname { get; internal set; }
+    public string? Nickname { get; internal set; }
 }
 
 
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 faa2373..af9e0db 100644
--- a/Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs
+++ b/Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs
@@ -43,7 +43,7 @@
     /// 浼佷笟绫诲瀷 浠庝紒涓氱被鍨嬩腑閫夋嫨
     /// </summary>
     [SugarColumn(ColumnDescription = "浼佷笟绫诲瀷 ", Length = 255)]
-    [Required(ErrorMessage = "浼佷笟绫诲瀷")]
+    //[Required(ErrorMessage = "浼佷笟绫诲瀷")]
     public string EnterpriseType { get; set; }
 
    
@@ -52,29 +52,29 @@
     /// <summary>
     /// 钀ヤ笟鎵х収鏂囦欢璺緞
     /// </summary>
-    [Required(ErrorMessage = "钀ヤ笟鎵х収鏂囦欢蹇呬紶")]
+    //[Required(ErrorMessage = "钀ヤ笟鎵х収鏂囦欢蹇呬紶")]
     [SugarColumn(ColumnDescription = "钀ヤ笟鎵х収鏂囦欢璺緞")]
     public string BusinessLicense { get; set; }
 
     /// <summary>
     /// 浼佷笟鍚嶇О
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟鍚嶇О涓哄繀濉」")]
+    //[Required(ErrorMessage = "浼佷笟鍚嶇О涓哄繀濉」")]
     [SugarColumn(ColumnDescription = "浼佷笟鍚嶇О")]
     public string EnterpriseName { get; set; }
 
     /// <summary>
     /// 缁熶竴绀句細淇$敤浠g爜
     /// </summary>
-    [Required(ErrorMessage = "缁熶竴绀句細淇$敤浠g爜涓哄繀濉」")]
-    [SugarColumn(ColumnDescription = "缁熶竴绀句細淇$敤浠g爜")]
+    //[Required(ErrorMessage = "缁熶竴绀句細淇$敤浠g爜涓哄繀濉」")]
+    [SugarColumn(ColumnDescription = "缁熶竴绀句細淇$敤浠g爜", IsNullable = true)]
     public string UnifiedSocialCreditCode { get; set; }
 
     /// <summary>
     /// 娉ㄥ唽璧勯噾锛堝崟浣嶏細涓囧厓 锛�
     /// </summary>
-    [Required(ErrorMessage = "娉ㄥ唽璧勯噾涓哄繀濉」")]
-    [SugarColumn(ColumnDescription = "娉ㄥ唽璧勯噾")]
+    //[Required(ErrorMessage = "娉ㄥ唽璧勯噾涓哄繀濉」")]
+    [SugarColumn(ColumnDescription = "娉ㄥ唽璧勯噾", IsNullable = true)]
     public string RegisteredCapital { get; set; }
 
 
@@ -88,73 +88,73 @@
     /// <summary>
     /// 娉曞畾浠h〃浜哄鍚�
     /// </summary>
-    [Required(ErrorMessage = "娉曞畾浠h〃浜哄鍚嶄负蹇呭~椤�")]
-    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜哄鍚�")]
+    //[Required(ErrorMessage = "娉曞畾浠h〃浜哄鍚嶄负蹇呭~椤�")]
+    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜哄鍚�", IsNullable = true)]
     public string LegalRepresentativeName { get; set; }
 
     /// <summary>
     /// 娉曞畾浠h〃浜鸿韩浠借瘉鏂囦欢璺緞
     /// </summary>
-    [Required(ErrorMessage = "娉曞畾浠h〃浜鸿韩浠借瘉鏂囦欢璺緞姣曚紶")]
-    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜鸿韩浠借瘉鏂囦欢璺緞")]
+    //[Required(ErrorMessage = "娉曞畾浠h〃浜鸿韩浠借瘉鏂囦欢璺緞姣曚紶")]
+    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜鸿韩浠借瘉鏂囦欢璺緞", IsNullable = true)]
     public string LegalRepresentativeIdCard { get; set; }
 
     /// <summary>
     /// 娉曞畾浠h〃浜鸿韩浠借瘉鍙风爜
     /// </summary>
-    [Required(ErrorMessage = "娉曞畾浠h〃浜鸿韩浠借瘉鍙风爜涓哄繀濉」")]
-    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜鸿韩浠借瘉鍙风爜")]
+    //[Required(ErrorMessage = "娉曞畾浠h〃浜鸿韩浠借瘉鍙风爜涓哄繀濉」")]
+    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜鸿韩浠借瘉鍙风爜", IsNullable = true)]
     public string LegalRepresentativeIdNumber { get; set; }
 
     /// <summary>
     /// 娉曞畾浠h〃浜鸿仈绯荤數璇�
     /// </summary>
-    [Required(ErrorMessage = "娉曞畾浠h〃浜鸿仈绯荤數璇濅负蹇呭~椤�")]
+    //[Required(ErrorMessage = "娉曞畾浠h〃浜鸿仈绯荤數璇濅负蹇呭~椤�")]
     [Phone(ErrorMessage = "娉曞畾浠h〃浜鸿仈绯荤數璇濅笉姝g‘")]
-    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜鸿仈绯荤數璇�")]
+    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜鸿仈绯荤數璇�", IsNullable = true)]
     public string LegalRepresentativePhone { get; set; }
 
     /// <summary>
     /// 浼佷笟浣忔墍锛堜笅鎷夐�夋嫨锛岄渶缁撳悎瀹為檯鍙�夊�硷紝鍏堝瓧绗︿覆鎺ユ敹 锛�
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟浣忔墍涓哄繀濉」")]
-    [SugarColumn(ColumnDescription = "浼佷笟浣忔墍")]
+    //[Required(ErrorMessage = "浼佷笟浣忔墍涓哄繀濉」")]
+    [SugarColumn(ColumnDescription = "浼佷笟浣忔墍", IsNullable = true)]
     public string Residence { get; set; }
 
     /// <summary>
     /// 浼佷笟鑱旂郴鐢佃瘽
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟鑱旂郴鐢佃瘽涓哄繀濉」")]
+    //[Required(ErrorMessage = "浼佷笟鑱旂郴鐢佃瘽涓哄繀濉」")]
     [Phone(ErrorMessage = "鑱旂郴鐢佃瘽鏍煎紡涓嶆纭�")]
-    [SugarColumn(ColumnDescription = "浼佷笟鑱旂郴鐢佃瘽")]
+    [SugarColumn(ColumnDescription = "浼佷笟鑱旂郴鐢佃瘽", IsNullable = true)]
     public string EnterprisePhone { get; set; }
 
     /// <summary>
     /// 浼佷笟鎴愮珛鏃堕棿
     /// </summary>
-    [Required(ErrorMessage = "鎴愮珛鏃堕棿涓哄繀濉」")]
-    [SugarColumn(ColumnDescription = "浼佷笟鎴愮珛鏃堕棿")]
+    //[Required(ErrorMessage = "鎴愮珛鏃堕棿涓哄繀濉」")]
+    [SugarColumn(ColumnDescription = "浼佷笟鎴愮珛鏃堕棿", IsNullable = true)]
     public DateTime EstablishmentTime { get; set; }
 
     /// <summary>
     /// 浼佷笟涓昏惀涓氬姟
     /// </summary>
-    [Required(ErrorMessage = "涓昏惀涓氬姟涓哄繀濉」")]
+    //[Required(ErrorMessage = "涓昏惀涓氬姟涓哄繀濉」")]
     [SugarColumn(ColumnDescription = "浼佷笟涓昏惀涓氬姟",Length =Int32.MaxValue,IsNullable = true)]
     public string MainBusiness { get; set; }
 
     /// <summary>
     /// 浼佷笟閭
     /// </summary>
-    [Required(ErrorMessage = "浼佷笟閭涓哄繀濉」")]
+    //[Required(ErrorMessage = "浼佷笟閭涓哄繀濉」")]
     [EmailAddress(ErrorMessage = "閭鏍煎紡涓嶆纭�")]
-    [SugarColumn(ColumnDescription = "浼佷笟閭")]
+    [SugarColumn(ColumnDescription = "浼佷笟閭", IsNullable = true)]
     public string EnterpriseEmail { get; set; }
 
     /// <summary>
     /// 涓氬姟缁忓姙浜哄鍚�
     /// </summary>
-
+  
     [SugarColumn(ColumnDescription = "涓氬姟缁忓姙浜哄鍚�", IsNullable = true)]
     public string OperatorName { get; set; }
 
@@ -173,25 +173,25 @@
     public string OperatorIdNumber { get; set; }
 
     /// <summary>
-    /// 涓氬姟缁忓姙浜鸿仈绯荤數璇�
+    /// 浼佷笟缁忓姙浜鸿仈绯荤數璇�
     /// </summary>
-  
+    [Required(ErrorMessage = "浼佷笟缁忓姙浜鸿仈绯荤數璇� 蹇呭~")]
     [Phone(ErrorMessage = "鑱旂郴鐢佃瘽鏍煎紡涓嶆纭�")]
-    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜哄鍚�",IsNullable =true)]
+    [SugarColumn(ColumnDescription = "涓氬姟缁忓姙浜�", IsNullable =true)]
     public string OperatorPhone { get; set; }
 
     /// <summary>
     /// 浼佷笟寮�鎴疯
     /// </summary>
-    [Required(ErrorMessage = "寮�鎴疯涓哄繀濉」")]
-    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜哄鍚�")]
+    //[Required(ErrorMessage = "寮�鎴疯涓哄繀濉」")]
+    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜哄鍚�", IsNullable = true)]
     public string BankName { get; set; }
 
     /// <summary>
     /// 浼佷笟閾惰璐﹀彿
     /// </summary>
-    [Required(ErrorMessage = "閾惰璐﹀彿涓哄繀濉」")]
-    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜哄鍚�")]
+    //[Required(ErrorMessage = "閾惰璐﹀彿涓哄繀濉」")]
+    [SugarColumn(ColumnDescription = "娉曞畾浠h〃浜哄鍚�", IsNullable = true)]
     public string BankAccount { get; set; }
 
     /// <summary>

--
Gitblit v1.9.1