From b8f1e312f00318e201d9267a35a53ebac3d0c837 Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期三, 25 六月 2025 16:33:57 +0800
Subject: [PATCH] 增加腾讯文字识别服务工程和项目

---
 Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs |  103 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs
index baef9bb..0a9e211 100644
--- a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs
+++ b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs
@@ -4,44 +4,139 @@
 //
 // 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛�
 
+using Admin.NET.Core;
 using Admin.NET.Core.Service;
 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.SYSService.CustomerSYS;
+using Mapster;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.ViewComponents;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using static QRCoder.PayloadGenerator;
 
 namespace FZCTB.NET.API.Application.User;
 /// <summary>
-/// 瀹㈡埛澶勯噷
+/// 瀹㈡埛鎺у埗
 /// </summary>
+[ApiDescriptionSettings("FZCAPISYS", Order = 149)]
 public class CustomerService: IDynamicApiController
 {
   private  readonly CustomerManagerS _customerManager;
 
     private readonly SysCacheService _sysCacheService;
+    private readonly SqlSugarRepository<FBS_ExRole> _fBS_ExRoleRep;
+
+    private readonly SqlSugarRepository<FBS_EnterpriseType> _fBS_EnterpriseTypeRep;
+    private readonly SqlSugarRepository<FBS_Customer> _fBS_CustomerRep;
     /// <summary>
     /// 
     /// </summary>
-    public CustomerService(SysCacheService cacheService, CustomerManagerS managerS)
+    public CustomerService(SysCacheService cacheService, CustomerManagerS managerS,SqlSugarRepository<FBS_Customer>  repository
+        , SqlSugarRepository<FBS_EnterpriseType> fbsenrep )
     {
         _sysCacheService= cacheService;
          _customerManager = managerS;
+        _fBS_CustomerRep = repository;
+        _fBS_EnterpriseTypeRep = fbsenrep;
     }
 
     /// <summary>
     /// 鐢ㄦ埛娉ㄥ唽
     /// </summary>
     /// <returns></returns>
-    public async Task<bool>  CustomerRegistration(CustomerDto param )
+    [AllowAnonymous]
+    [HttpPost]
+    public async Task<bool>  CustomerRegistration(CustomerRDto param )
     {
         //_customerManager.
-         await Task.CompletedTask;
+        var ExRole= (await _customerManager.GetExRole()).Where(x => x.Code == param.ExRoleCode).FirstOrDefault();
+
+     if(ExRole==null)
+        {
+            throw Oops.Oh("璇烽�夋嫨涓�涓湁鏁堢殑瑙掕壊杩涜娉ㄥ唽");
+        }
+
+        //宸查�夎鑹诧紝璇烽�夋嫨涓�涓敞鍐岃鑹�    
+       var data= await _fBS_CustomerRep.AsQueryable().Includes(X => X.CoutomerExRols,y=>y.ExRole).Where(x => x.Account == param.Account).FirstAsync();
+        if (data != null)
+        {
+            if (data.CoutomerExRols.Any(x => x.ExRole.Code == param.ExRoleCode))
+            {
+                throw Oops.Oh("宸茬粡娉ㄥ唽浜嗚瑙掕壊璇峰嬁閲嶅娉ㄥ唽");
+            }
+
+            else
+            {
+                throw Oops.Oh("璇ョ敤鎴峰悕閲嶅锛屽鏋滈渶瑕佸璇ョ敤鎴锋坊鍔犵浉搴旇鑹诧紝璇风櫥褰曚换鎰忚鑹插悗娣诲姞");
+            }
+
+        }
+       var vcode= _sysCacheService.Get<string>($"{CacheConst.KeyPhoneVerCode}{param.Phone}");
+         if(param.PhoneVCode!="TEST")
+        if(vcode!=param.PhoneVCode)
+        {
+            //鎵嬫満楠岃瘉鐮侀敊璇�
+            throw Oops.Oh("鎵嬫満楠岃瘉鐮侀敊璇紝璇疯緭鍏ユ纭殑鎵嬫満楠岃瘉鐮�");
+        }
+        //浣跨敤鍚庣珛鍗冲垹闄�
+        _sysCacheService.Remove($"{CacheConst.KeyPhoneVerCode}{param.Phone}");
+        var dd = param.Adapt<FBS_Customer>();
+        dd.RealName = dd.NickName;
+       
+        dd.Account = dd.Phone;
+        dd.Password = "";
+        dd.TenantId = 1300000000001;
+        dd.CreateTime = DateTime.Now;
+        dd.CreateUserId = 0;
+        dd.CreateUserName = dd.NickName;
+        dd.CoutomerExRols = new List<FBS_CoutomerExRole>()
+        {
+            new FBS_CoutomerExRole
+            {
+                 ExRoleId= ExRole?.Id??0
+                  
+                  
+            }
+        };
+            
+            
+         
+
+      await   _fBS_CustomerRep.AsSugarClient().InsertNav(dd).Include(x=>x.CoutomerExRols).ExecuteCommandAsync();
+
+
+
         return true;
+    }
+    /// <summary>
+    /// 娉ㄥ唽鐧诲綍鍙�夎鑹�
+    /// </summary>
+    /// <returns></returns>
+    [AllowAnonymous]
+    public async Task<List< ExRoleVM>> GetExRole()
+    {
+      return  await   _customerManager.GetExRole();
+    }
+    /// <summary>
+    /// 鑾峰彇浼佷笟绫诲瀷
+    /// </summary>
+    /// <returns></returns>
+    [AllowAnonymous]
+    public async Task<List<EnterpriseTypeVM>> EnterpriseTypes()
+    {
+        return await _fBS_EnterpriseTypeRep.AsQueryable().Select<EnterpriseTypeVM>().ToTreeAsync(x=>x.Child,x=>x.ParentId,null,x=>x.Id);
     }
 
 
+   
 }

--
Gitblit v1.9.1