Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs
@@ -6,6 +6,7 @@ using Admin.NET.Core; using Admin.NET.Core.Service; using Dm.util; using Furion; using Furion.DynamicApiController; using Furion.FriendlyException; @@ -39,19 +40,22 @@ private readonly SysCacheService _sysCacheService; private readonly SqlSugarRepository<FBS_ExRole> _fBS_ExRoleRep; private readonly SqlSugarRepository<FBS_CoutomerExRole> _fBS_CustomerExRoleRep; 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,IMapper mapper,SqlSugarRepository<FBS_ExRole> exroles , SqlSugarRepository<FBS_CusExtend> cusrep) , SqlSugarRepository<FBS_EnterpriseType> fbsenrep,IMapper mapper,SqlSugarRepository<FBS_ExRole> exroles , SqlSugarRepository<FBS_CusExtend> cusrep, SqlSugarRepository<FBS_CoutomerExRole> cexrrep) { _sysCacheService= cacheService; _customerManager = managerS; @@ -60,6 +64,7 @@ _fBS_ExRoleRep = exroles; _fBS_CusExtendRep = cusrep; _mapper = mapper; _fBS_CustomerExRoleRep = cexrrep; } /// <summary> @@ -111,7 +116,9 @@ dd.CreateTime = DateTime.Now; dd.CreateUserId = 0; dd.CreateUserName = dd.NickName; dd.CoutomerExRols = new List<FBS_CoutomerExRole>() if(dd.CoutomerExRols==null) { new List<FBS_CoutomerExRole>() { new FBS_CoutomerExRole { @@ -120,6 +127,15 @@ } }; } else { dd.CoutomerExRols.add(new FBS_CoutomerExRole { ExRoleId = ExRole?.Id ?? 0 }); } @@ -168,17 +184,41 @@ { 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)==true) var ExRoles = await _fBS_CustomerExRoleRep.GetListAsync(x => x.CustomerId == id); if (ExRoles != null) { if (ExRoles?.Any(x => x.ExRoleId == rols.Id && x.HasFlsh == true) == true) { throw Oops.Oh("用户已经注册了该主体"); } } //增加用户角色 await _fBS_CustomerExRoleRep.InsertAsync(new FBS_CoutomerExRole { ExRoleId = rols.Id, CustomerId = id }); var usdata = await _fBS_CusExtendRep.GetFirstAsync(x => x.CustomerId == id&&x.TransactionCode==cusExtend.TransactionCode); if (usdata!=null) { if (usdata.steps == CusExtendStep.Pass) { throw Oops.Oh("用户已经注册了该主体"); } throw Oops.Oh("用户已经申请了该角色,请走修改流程"); } var data= cusExtend.Adapt<FBS_CusExtend>(); Admin.NET/FZCZTB.NET.MD/CutomerMd/Extend/FBS_CusExtend.cs
@@ -8,6 +8,7 @@ using SqlSugar; using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; @@ -44,6 +45,12 @@ [Required(ErrorMessage = "交易主体代码为必填项")] [SugarColumn(ColumnDescription = "交易主体code")] public string TransactionCode { get; set; } /// <summary> /// 交易主体 /// </summary> [Navigate(NavigateType.OneToOne, nameof(TransactionCode),nameof(FBS_ExRole.Code))] public FBS_ExRole? TransactionRole { get; set; } /// <summary> /// 营业执照文件路径 /// </summary> @@ -98,15 +105,15 @@ /// 法定代表人身份证号码 /// </summary> [Required(ErrorMessage = "法定代表人身份证号码为必填项")] [SugarColumn(ColumnDescription = "法定代表人姓名")] [SugarColumn(ColumnDescription = "法定代表人身份证号码")] public string LegalRepresentativeIdNumber { get; set; } /// <summary> /// 法定代表人联系电话 /// </summary> [Required(ErrorMessage = "法定代表人联系电话为必填项")] [Phone(ErrorMessage = "联系电话格式不正确")] [SugarColumn(ColumnDescription = "法定代表人姓名")] [Phone(ErrorMessage = "法定代表人联系电话不正确")] [SugarColumn(ColumnDescription = "法定代表人联系电话")] public string LegalRepresentativePhone { get; set; } /// <summary> @@ -204,19 +211,23 @@ /// <summary> /// 未审核 /// </summary> [Description("未审核")] UNExamine=0, /// <summary> /// 更改 /// </summary> [Description("更改")] Change, /// <summary> /// 通过 /// </summary> [Description("通过")] Pass, /// <summary> /// 未通过 /// </summary> [Description("未通过")] UnPass Admin.NET/FZCZTB.NET.SYSService/FZCZTSYSServiceConfig.json
@@ -9,7 +9,7 @@ "Templates": [ { "Id": "0", "SignName": "【政采咨询网】", //需要加入的公司标签 "SignName": "【四川政采招投标咨询】", //需要加入的公司标签 "TemplateCode": "VCode", "Content": "您好,您的验证码是:${code}" @@ -17,7 +17,7 @@ }, { "Id": "1", "SignName": "【政采咨询网】", "SignName": "【四川政采招投标咨询】", "TemplateCode": "RegistrationOK ", "Content": "注册成功,感谢您的注册,请妥善保管您的账户信息" } 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> /// 获取企业资料详情 ℹ️ Admin.NET/FZCZTB.Net.CustomerSYSTem/Service/FBS_Customer/FBS_CustomerService.cs