移动系统liao
2025-06-27 6023f73a031bf93797d1cb74e705371abd3990e6
no message
6个文件已修改
418 ■■■■■ 已修改文件
Admin.NET/Admin.NET.Application/Configuration/Database.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/FZCTB.NET.API.Application/Auth/AuthService.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs 186 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/FZCZTB.NET.SYSService/CustomerSYS/CustomerManagerS.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/Admin.NET.Application/Configuration/Database.json
@@ -14,8 +14,8 @@
        //"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL
        //"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;AllowLoadLocalInfile=true;AllowUserVariables=true;", // MySql,
        //"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle
        "ConnectionString": "Server=192.168.0.31;Database=FZCZTB;User Id=SA;Password=123456;Encrypt=True;TrustServerCertificate=True;", // SqlServer
        //"ConnectionString": "Server=192.168.0.31;Database=FZCZTB;User Id=SA;Password=123456;Encrypt=True;TrustServerCertificate=True;", // SqlServer
        "ConnectionString": "Server=MS-FSEUTNLCXFDB\\SQLEXPRESS;Database=FZCZTB;Encrypt=True;TrustServerCertificate=True;Integrated Security=true;", // SqlServer
        //"SlaveConnectionConfigs": [ // 读写分离/主从
        //    {
        //        "HitRate": 10,
Admin.NET/FZCTB.NET.API.Application/Auth/AuthService.cs
@@ -19,6 +19,8 @@
using FZCTB.NET.API.Application.Auth.DTO;
using Furion.FriendlyException;
using FZCZTB.NET.SYSService.CustomerSYS;
using Furion;
using NewLife;
namespace FZCTB.NET.API.Application.Auth
{
@@ -99,6 +101,37 @@
            return await CreateToken(user, input.ExRuleCode??"");
        }
        /// <summary>
        ///  切换角色 已登录进去角色或者切换角色是调用,需要替换Token,相当于登录
        /// </summary>
        [DisplayName("切换角色")]
        public async Task<CustomerLoginOutput> ChangeLogoInExRule(string RuleCode)
        {
            var id = App.User.FindFirst(ClaimConst.UserId)?.Value.ToLong() ?? 0;
            if (id == 0)
            {
                throw Oops.Oh("用户凭证错误");
            }
            //
            // 获取登录租户和用户
            // 获取登录租户和用户
            var user = await _sysUserRep.AsQueryable().Where(x => x.Id == id).Includes(x => x.CoutomerExRols, y => y.ExRole).FirstAsync();
            if (user == null)
            {
                throw Oops.Oh("该用户没有注册");
            }
            if (user.Status == StatusEnum.Disable)
            {
                throw Oops.Oh("用异常");
            }
            return await CreateToken(user, RuleCode);
        }
        /// <summary>
        /// 手机号登录 🔖
        /// </summary>
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);
    }
   
}
Admin.NET/FZCTB.NET.API.Application/User/DTO/DTOS.cs
@@ -8,6 +8,7 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -45,3 +46,155 @@
    public List<FBS_EnterpriseType> Child { get; set; }
}
/// <summary>
/// 用户角色资料
/// </summary>
public  class CusExtendDto
{
    /// <summary>
    /// 主键
    /// </summary>
    public long ? Id { get; set; }
    /// <summary>
    /// 企业类型 从企业类型中选择 来源企业类型
    /// </summary>
    public string? EnterpriseType { get; set; }
    /// <summary>
    /// 交易主体 代码 同角色代码
    /// </summary>
    [Required(ErrorMessage = "交易主体代码为必填项")]
    public string? TransactionCode { get; set; }
    /// <summary>
    /// 交易主体名称
    /// </summary>
    public string TransactionName { get; set; }
    /// <summary>
    /// 营业执照文件路径
    /// </summary>
    public string BusinessLicense { get; set; }
    /// <summary>
    /// 企业名称
    /// </summary>
    public string EnterpriseName { get; set; }
    /// <summary>
    /// 统一社会信用代码
    /// </summary>
    public string UnifiedSocialCreditCode { get; set; }
    /// <summary>
    /// 注册资金(单位:万元 )
    /// </summary>
    public decimal RegisteredCapital { get; set; }
    /// <summary>
    /// 法定代表人姓名
    /// </summary>
    public string LegalRepresentativeName { get; set; }
    /// <summary>
    /// 法定代表人身份证文件路径
    /// </summary>
    public string LegalRepresentativeIdCard { get; set; }
    /// <summary>
    /// 法定代表人身份证号码
    /// </summary>
    public string LegalRepresentativeIdNumber { get; set; }
    /// <summary>
    /// 法定代表人联系电话
    /// </summary>
    [Phone(ErrorMessage = "联系电话格式不正确")]
    public string? LegalRepresentativePhone { get; set; }
    /// <summary>
    /// 企业住所(下拉选择,需结合实际可选值,先字符串接收 )
    /// </summary>
    public string Residence { get; set; }
    /// <summary>
    /// 企业联系电话
    /// </summary>
    [Phone(ErrorMessage = "联系电话格式不正确")]
    public string? EnterprisePhone { get; set; }
    /// <summary>
    /// 企业成立时间
    /// </summary>
    public DateTime EstablishmentTime { get; set; }
    /// <summary>
    /// 企业主营业务
    /// </summary>
    public string MainBusiness { get; set; }
    /// <summary>
    /// 企业邮箱
    /// </summary>
    [SugarColumn(ColumnDescription = "企业邮箱")]
    public string EnterpriseEmail { get; set; }
    /// <summary>
    /// 业务经办人姓名
    /// </summary>
    public string OperatorName { get; set; }
    /// <summary>
    /// 业务经办人身份证文件路径或标识(上传后存储信息)
    /// </summary>
    public string OperatorIdCard { get; set; }
    /// <summary>
    /// 业务经办人身份证号码
    /// </summary>
    public string OperatorIdNumber { get; set; }
    /// <summary>
    /// 业务经办人联系电话
    /// </summary>
    [Phone(ErrorMessage = "联系电话格式不正确")]
    public string OperatorPhone { get; set; }
    /// <summary>
    /// 企业开户行
    /// </summary>
    public string BankName { get; set; }
    /// <summary>
    /// 企业银行账号
    /// </summary>
    public string BankAccount { get; set; }
}
Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs
@@ -26,7 +26,7 @@
    /// </summary>
    [SugarColumn(ColumnDescription = "用户ID" )]
    [Required(ErrorMessage = "用户ID 必填")]
    public int CustomerId { get; set; }
    public long  CustomerId { get; set; }
  
@@ -185,5 +185,32 @@
    /// </summary>
    [SugarColumn(ColumnDescription = "审核步骤")]
    public int steps { set; get; } = 0;
    public CusExtendStep steps { set; get; } = CusExtendStep.UNExamine;
}
/// <summary>
/// 角色资料审核进度
/// </summary>
public enum CusExtendStep
{
    /// <summary>
    /// 未审核
    /// </summary>
    UNExamine=0,
    /// <summary>
    /// 更改
    /// </summary>
    Change,
    /// <summary>
    /// 通过
    /// </summary>
    Pass,
    /// <summary>
    /// 未通过
    /// </summary>
    UnPass
}
Admin.NET/FZCZTB.NET.SYSService/CustomerSYS/CustomerManagerS.cs
@@ -1,6 +1,7 @@
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.DependencyInjection;
using Furion.FriendlyException;
using FZCZTB.NET.MD.CutomerMd;
using Mapster;
using SqlSugar;
@@ -45,12 +46,13 @@
        /// 返回当前可用的用户角色 再注册和登录时需要返回编码
        /// </summary>
        /// <returns></returns>
        public async Task<CustomerRDto> GetCustomer(int id)
        public async Task<CustomerRDto> GetCustomer(long  id)
        {
            return (await _fBS_CustomerRep.GetFirstAsync(x => x.Id == id && x.Status == StatusEnum.Enable)).Adapt<CustomerRDto>();
            return await _fBS_CustomerRep.AsQueryable().Where(x=>x.Id==id&&x.Status== StatusEnum.Enable).Includes(x=>x.CoutomerExRols,y=>y.ExRole)
           .Select<CustomerRDto>().WithCache(20).FirstAsync();
            //return (await _fBS_CustomerRep.GetFirstAsync(x => x.Id == id && x.Status == StatusEnum.Enable)).Adapt<CustomerRDto>();
@@ -75,6 +77,7 @@
        }
    }
@@ -207,7 +210,7 @@
        public string? Signature { get; set; }
        /// <summary>
        /// 外部规则,登录角色
        /// 登录角色
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(FBS_CoutomerExRole.CustomerId))]
        public List<FBS_CoutomerExRole> CoutomerExRols { set; get; }