lingling
2025-03-17 2dffeebb60078f6ee1d59ac327c0ecce3fd200e9
添加后端用户逻辑
8个文件已添加
9个文件已修改
1483 ■■■■■ 已修改文件
LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs 225 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/IUserRoleService.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/AccountService.cs 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/UserRoleService.cs 167 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain.Shared/Enum/LifePay/EnterpriseTypeEnum.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/Common/Role.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/Common/User.cs 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/Common/UserRole.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentServiceHostModule.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml 245 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/appsettings.json 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/AccountController.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
New file
@@ -0,0 +1,225 @@
using System;
using System.Collections.Generic;
using ZeroD.Util;
namespace LifePayment.Application.Contracts
{
    public class CreateBackClientUserInput
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 手机号
        /// </summary>
        public string PhoneNumber { get; set; }
        /// <summary>
        /// 账户
        /// </summary>
        public string UserName { get; set; }
        public string Remark { get; set; }
        /// <summary>
        /// 角色
        /// </summary>
        public string[] RoleNames { get; set; }
        /// <summary>
        /// 组织架构公司id
        /// </summary>
        public Guid? CompanyOrgId { get; set; }
        /// <summary>
        /// 组织架构部门id
        /// </summary>
        public Guid? DepartmentOrgId { get; set; }
    }
    public class CreateOrUpdateRoleInput : CreateBaseRoleInput
    {
        /// <summary>
        /// 角色Id
        /// </summary>
        public Guid Id { get; set; }
    }
    public class CreateBaseRoleInput
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int Sequence { get; set; }
        /// <summary>
        /// 部门Id
        /// </summary>
        public int DepartmentId { get; set; }
        /// <summary>
        /// 数据范围 全部数据100 个人数据 10
        /// </summary>
        public int DataRange { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }
    public class UpdateBackClientUserInput : CreateBackClientUserInput
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        public Guid Id { get; set; }
    }
    public class RoleEnableOrForbidInput
    {
        /// <summary>
        /// 角色Id
        /// </summary>
        public Guid Id { get; set; }
        /// <summary>
        /// 启用:true,禁用:false
        /// </summary>
        public bool IsEnable { get; set; }
        [System.Text.Json.Serialization.JsonIgnore]
        public string Name { get; set; } = "Name";
    }
    public class UserDto
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        public Guid Id { get; set; }
        /// <summary>
        /// 登录用户名(账号)
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 用户手机号
        /// </summary>
        public string PhoneNumber { get; set; }
        /// <summary>
        /// 账户是否锁住(是否禁用)
        /// </summary>
        public bool IsLocked { get; set; }
        /// <summary>
        /// 角色信息
        /// </summary>
        public IEnumerable<RoleDto> Roles { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 组织架构公司id
        /// </summary>
        public Guid? CompanyOrgId { get; set; }
        /// <summary>
        /// 组织架构部门id
        /// </summary>
        public Guid? DepartmentOrgId { get; set; }
    }
    public class GetBackClientUsersInput : PageInput
    {
        /// <summary>
        /// 账户是否锁住(是否禁用)
        /// </summary>
        public bool? IsLocked { get; set; }
        /// <summary>
        /// 查询条件:名称/账号
        /// </summary>
        public string QueryCondition { get; set; }
    }
    public class RoleDto
    {
        /// <summary>
        /// 角色Id
        /// </summary>
        public Guid Id { get; set; }
        /// <summary>
        /// 角色名
        /// </summary>
        public string Name { get; set; }
    }
    public class RoleInfo
    {
        /// <summary>
        /// 角色Id
        /// </summary>
        public Guid Id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int Sequence { get; set; }
        /// <summary>
        /// 是否可用
        /// </summary>
        public bool IsEnable { get; set; } = true;
        /// <summary>
        /// 部门Id
        /// </summary>
        public int DepartmentId { get; set; }
        /// <summary>
        /// 数据范围 全部数据:100   个人数据:10
        /// </summary>
        public int DataRange { get; set; }
        /// <summary>
        /// 账号数量
        /// </summary>
        public int UserCount { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }
    public class GetRolesInput : PageInput
    {
        /// <summary>
        /// 查询条件:角色名称
        /// </summary>
        public string QueryCondition { get; set; }
    }
}
LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
@@ -2,13 +2,13 @@
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity.Application.Contracts.Account;
using Volo.Abp.IdentityModel;
namespace LifePayment.Application.Contracts
{
    public interface IAccountService : IApplicationService
    {
        #region life pay
        Task<WxMiniAppIndentityInfo> GetLifePayWxIndentity(string code);
@@ -21,6 +21,9 @@
        /// <exception cref="UserFriendlyException"></exception>
        Task<Guid> LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input);
        Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto, string webClientIp);
        Task<Guid> CreateAccount(CreateAccountInput input, bool isSend = false, bool isAdminCreate = false, string password = null);
        #endregion
    }
}
LifePayment/LifePayment.Application.Contracts/User/IUserRoleService.cs
New file
@@ -0,0 +1,26 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using ZeroD.Util;
namespace LifePayment.Application.Contracts
{
    public interface IUserRoleService : IApplicationService
    {
        Task<PageOutput<UserDto>> GetBackClientUsers(GetBackClientUsersInput input);
        Task<int> UpdateBackClientUser(UpdateBackClientUserInput input);
        Task<int> DeleteBackClientUser(Guid id);
        Task<Guid> CreateRole(CreateOrUpdateRoleInput input);
        Task<PageOutput<RoleInfo>> GetRoles(GetRolesInput input);
        Task<int> UpdateRole(CreateOrUpdateRoleInput input);
        Task<int> RoleEnableOrForbid(Guid id, bool isEnable);
        Task<int> DeleteRole(Guid id);
    }
}
LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
@@ -1,6 +1,8 @@
using LifePayment.Domain.Shared;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using ZeroD.Util;
namespace LifePayment.Application.Contracts
{
@@ -39,4 +41,72 @@
        /// </summary>
        public string UnionId { get; set; }
    }
    public class CreateAccountInput
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 用户名
        /// </summary>
        [RegularExpression(LifePaymentConstant.RegularExpression.UserNameEx, ErrorMessage = "账号格式不正确")]
        public string UserName { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 手机号
        /// </summary>
        public string PhoneNumber { get; set; }
        /// <summary>
        /// 用户端Id
        /// </summary>
        public string ClientId { get; set; } = Constant.ClientType.Back;
        /// <summary>
        /// 角色
        /// </summary>
        public string[] RoleNames { get; set; }
        /// <summary>
        /// 小程序OpenId
        /// </summary>
        public string OpenId { get; set; }
        ///// <summary>
        ///// 联系人
        ///// </summary>
        // public string Contact { get; set; }
        /// <summary>
        /// 企业名称
        /// </summary>
        public string EnterpriseName { get; set; }
        /// <summary>
        /// 企业类型
        /// </summary>
        public EnterpriseTypeEnum? AuthType { get; set; }
        /// <summary>
        /// MatchMaking小程序OpenId
        /// </summary>
        public string MatchMakingOpenId { get; set; }
        /// <summary>
        /// 组织架构公司id
        /// </summary>
        public Guid? CompanyOrgId { get; set; }
        /// <summary>
        /// 组织架构部门id
        /// </summary>
        public Guid? DepartmentOrgId { get; set; }
    }
}
LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs
@@ -13,7 +13,6 @@
            CreateMap<CreateLifePayOrderInput, LifePayOrder>(MemberList.None);
            CreateMap<CreateEditPayChannelsInput, LifePayChannles>(MemberList.None);
            #endregion
        }
LifePayment/LifePayment.Application/User/AccountService.cs
@@ -1,31 +1,46 @@
using LifePayment.Application.Contracts;

using LifePayment.Application.Contracts;
using LifePayment.Domain;
using LifePayment.Domain.Models;
using LifePayment.Domain.Shared;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Volo.Abp.Identity.Application.Contracts.Account;
using Volo.Abp.IdentityModel;
using ZeroD.Util;
using static LifePayment.Domain.Shared.LifePaymentConstant;
namespace LifePayment.Application
{
    public class AccountService : ApplicationService, IAccountService
    {
        private readonly IWxManager _wxManager;
        private readonly IRepository<LifePayUser, Guid> _lifePayUserRepository;
        private readonly IConfiguration _configuration;
        private readonly IIdentityModelAuthenticationService _authenticator;
        private readonly IRepository<User, Guid> _userRepository;
        private readonly IIdentityUserAppService _identityUserService;
        public AccountService(
               IWxManager wxManager,
               IRepository<LifePayUser, Guid> lifePayUserRepository
)
               IConfiguration configuration,
               IIdentityModelAuthenticationService authenticator,
               IIdentityUserAppService identityUserService,
               IRepository<LifePayUser, Guid> lifePayUserRepository)
        {
            _configuration = configuration;
            _wxManager = wxManager;
            _identityUserService = identityUserService;
            _lifePayUserRepository = lifePayUserRepository;
            _authenticator = authenticator;
        }
        #region 查询
@@ -90,6 +105,131 @@
            return lifeUser.Id;
        }
        public async Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto, string webClientIp)
        {
            IdentityClientConfiguration config = new IdentityClientConfiguration
            {
                UserName = accessRequestDto.UserName,
                UserPassword = accessRequestDto.UserPassword,
                GrantType = accessRequestDto.GrantType == 1 ? "password" : "client_credentials",
                ClientId = accessRequestDto.ClientId,
                ClientSecret = "1q2w3e*",
                Authority = _configuration["AuthServer:Authority"],
                Scope = accessRequestDto.Scope + " offline_access",
            };
            var result = await _authenticator.GetAccessTokenAsync(config);
            var user = await _userRepository.Where(r => r.UserName == accessRequestDto.UserName && !r.IsDeleted).FirstOrDefaultAsync();
            // 记录日志
           // await PublishUserOperateHistoryEvent(LogsSpecies.Login, LogsSpecies.Login, user.Id, user.Id, creatorName: user.Name);
            return result;
        }
        public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false, string password = null)
        {
            if (input.ClientId == LifePaymentConstant.ClientId.Back)
            {
                CheckExtensions.IfTrueThrowUserFriendlyException(!input.CompanyOrgId.HasValue || !input.DepartmentOrgId.HasValue,
                                                                 "所属公司和部门不能为空");
            }
            var any = await _userRepository.Where(x => x.PhoneNumber == input.PhoneNumber && x.ClientId == input.ClientId).AnyAsync();
            CheckExtensions.IfTrueThrowUserFriendlyException(any,
                                                             CustomeErrorMessage.PhoneNumberRepeatSaveFail);
            password ??= GlobalRandom.GetRandomPassword();
            var res = await _identityUserService.CreateAsync(new IdentityUserCreateDto
            {
                Name = input.Name,
                PhoneNumber = input.PhoneNumber,
                UserName = input.UserName,
                RoleNames = input.RoleNames,
                ClientId = input.ClientId,
                Password = password,
            });
            var user = await _userRepository.InsertAsync(new User
            {
                Id = res.Id,
                Name = input.Name,
                UserName = input.UserName,
                PhoneNumber = input.PhoneNumber,
                ClientId = input.ClientId,
                OpenId = input.OpenId,
                LastLoginTime = DateTime.Now,
                ContactPhone = input.PhoneNumber,
                Contact = isAdminCreate ? input.Name : null,
                EnterpriseName = input.EnterpriseName,
                AuthType = input.AuthType,
                Remark = input.Remark,
                DepartmentOrgId = input.ClientId == LifePaymentConstant.ClientId.Back ? input.DepartmentOrgId : null,
                CompanyOrgId = input.ClientId == LifePaymentConstant.ClientId.Back ? input.CompanyOrgId : null
            });
            //if (input.ClientId == Constant.ClientType.Back)
            //{
            //    await _distributedEventBus.PublishAsync(new SendPhoneMessageInput
            //    {
            //        Phone = input.PhoneNumber,
            //        ProviderName = "CreateBackAccount",
            //        TemplateParams = new
            //        {
            //            account = input.UserName,
            //            pwd = password,
            //        },
            //        MessageType = PhoneMessageTypeEnum.Notice
            //    });
            //}
            //else
            //{
            //    if (isSend)
            //    {
            //        //await _commonManager.SendPhoneMessage(new SendPhoneMessageInput
            //        //{
            //        //    Phone = input.PhoneNumber,
            //        //    ProviderName = "CreateAccount",
            //        //    TemplateParams = new
            //        //    {
            //        //        name = input.Name,
            //        //        account = input.UserName,
            //        //        pwd = password,
            //        //    },
            //        //});
            //        await _distributedEventBus.PublishAsync(new SendPhoneMessageInput
            //        {
            //            Phone = input.PhoneNumber,
            //            ProviderName = "CreateAccountNotice",
            //            TemplateParams = new
            //            {
            //                account = input.UserName,
            //                password = password,
            //            },
            //            MessageType = PhoneMessageTypeEnum.Notice
            //        });
            //    }
            //}
            var logoption = LogsSpecies.UserRegister;
            var creatorName = user.Name;
            // 记录日志
            if (isAdminCreate)
            {
                logoption = LogsSpecies.Create;
                creatorName = CurrentUser.Name;
            }
            //await PublishUserOperateHistoryEvent(logoption, logoption, res.Id, res.Id, creatorName: creatorName);
            #region 添加IM用户
            //await PublishAddTencentUserEvent(user.Id, user.UserName, user.AvatarUrl);
            #endregion
            return res.Id;
        }
        #endregion
        #endregion
LifePayment/LifePayment.Application/User/UserRoleService.cs
New file
@@ -0,0 +1,167 @@
using LifePayment.Application.Contracts;
using LifePayment.Domain.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using ZeroD.Util;
namespace HumanResourcesServices.Application
{
    public class UserRoleService : ApplicationService, IUserRoleService
    {
        private readonly IRepository<User, Guid> _userRepository;
        private readonly IRepository<Role, Guid> _roleRepository;
        private readonly IRepository<UserRole, Guid> _userRoleRep;
        public UserRoleService(
               IRepository<User, Guid> userRepository,
               IRepository<Role, Guid> roleRepository,
               IRepository<UserRole, Guid> userRoleRep)
        {
            _userRepository = userRepository;
            _roleRepository = roleRepository;
            _userRoleRep = userRoleRep;
        }
        public async Task<PageOutput<UserDto>> GetBackClientUsers(GetBackClientUsersInput input)
        {
            var query = _userRepository.Where(s => s.ClientId == Constant.ClientType.Back).Include(i => i.UserRoles).Select(u => new UserDto
            {
                Id = u.Id,
                UserName = u.UserName,
                Name = u.Name,
                PhoneNumber = u.PhoneNumber,
                IsLocked = u.IsLocked ?? default,
                Roles = from ur in u.UserRoles
                        from r in _roleRepository.Where(s => s.Id == ur.RoleId)
                        select new RoleDto
                        {
                            Id = r.Id,
                            Name = r.Name,
                        },
                Remark = u.Remark,
                CompanyOrgId = u.CompanyOrgId,
                DepartmentOrgId = u.DepartmentOrgId
            });
            if (input.IsLocked.HasValue)
            {
                query = query.Where(s => s.IsLocked == input.IsLocked);
            }
            if (!input.QueryCondition.IsNullOrEmpty())
            {
                query = query.Where(s => s.UserName.Contains(input.QueryCondition) ||
                                         s.Name.Contains(input.QueryCondition));
            }
            var result = await query.GetPageResult(input.PageModel);
            return result;
        }
        public async Task<int> UpdateBackClientUser(UpdateBackClientUserInput input)
        {
            var entity = await _userRepository.FirstOrDefaultAsync(s => s.Id == input.Id && s.ClientId == Constant.ClientType.Back);
            if (entity == null)
            {
                throw new UserFriendlyException("未找到对应用户");
            }
            entity.Name = input.Name;
            entity.PhoneNumber = input.PhoneNumber;
            entity.UserName = input.UserName;
            entity.Remark = input.Remark;
            entity.DepartmentOrgId = input.DepartmentOrgId;
            entity.CompanyOrgId = input.CompanyOrgId;
            return Constant.SUCCESS;
        }
        public async Task<int> DeleteBackClientUser(Guid id)
        {
            var entity = await _userRepository.FirstOrDefaultAsync(s => s.Id == id && s.ClientId == Constant.ClientType.Back);
            if (entity == null)
            {
                throw new UserFriendlyException("未找到对应用户");
            }
            entity.IsDeleted = true;
            return Constant.SUCCESS;
        }
        public async Task<Guid> CreateRole(CreateOrUpdateRoleInput input)
        {
            var entity = ObjectMapper.Map<CreateOrUpdateRoleInput, Role>(input);
            return await _roleRepository.InsertAndGetIdAsync(entity);
        }
        public async Task<PageOutput<RoleInfo>> GetRoles(GetRolesInput input)
        {
            var query = _roleRepository.Select(r => new RoleInfo
            {
                Id = r.Id,
                Name = r.Name,
                Sequence = r.Sequence,
                IsEnable = r.IsEnable,
                DepartmentId = r.DepartmentId,
                DataRange = r.DataRange,
                Remark = r.Remark,
            });
            if (!input.QueryCondition.IsNullOrEmpty())
            {
                query = query.Where(s => s.Name.Contains(input.QueryCondition));
            }
            var result = await query.GetPageResult(input.PageModel);
            var listrols = new List<UserRole>();
            if (result.Data.Any())
            {
                listrols = await (from ur in _userRoleRep.Where(r => result.Data.Select(d => d.Id).Contains(r.RoleId))
                                  join u in _userRepository.Where(r => !r.IsDeleted) on ur.UserId equals u.Id
                                  select ur).ToListAsync();
            }
            foreach (var item in result.Data)
            {
                item.UserCount = listrols.Where(r => r.RoleId == item.Id).Count();
            }
            return result;
        }
        public async Task<int> UpdateRole(CreateOrUpdateRoleInput input)
        {
            var entity = await _roleRepository.FirstOrDefaultAsync(s => s.Id == input.Id);
            if (entity == null)
            {
                throw new UserFriendlyException("未找到对应角色");
            }
            entity.Name = input.Name;
            entity.Sequence = input.Sequence;
            entity.DepartmentId = input.DepartmentId;
            entity.DataRange = input.DataRange;
            entity.Remark = input.Remark;
            return Constant.SUCCESS;
        }
        public async Task<int> RoleEnableOrForbid(Guid id, bool isEnable)
        {
            var entity = await _roleRepository.FirstOrDefaultAsync(s => s.Id == id);
            if (entity == null)
            {
                throw new UserFriendlyException("未找到对应角色");
            }
            entity.IsEnable = isEnable;
            return Constant.SUCCESS;
        }
        public async Task<int> DeleteRole(Guid id)
        {
            await _roleRepository.DeleteAsync(id);
            return Constant.SUCCESS;
        }
    }
}
LifePayment/LifePayment.Domain.Shared/Enum/LifePay/EnterpriseTypeEnum.cs
New file
@@ -0,0 +1,51 @@
using System.ComponentModel;
namespace LifePayment.Domain.Shared;
/// <summary>
/// 企业类型
/// </summary>
public enum EnterpriseTypeEnum
{
    /// <summary>
    /// 人力资源公司
    /// </summary>
    [Description("人力资源公司")]
    HREnterprise = 10,
    /// <summary>
    /// 甲方企业
    /// </summary>
    [Description("甲方企业")]
    FirstPartyCompany = 20,
    /// <summary>
    /// 行业配套
    /// </summary>
    [Description("行业配套")]
    IndustryMating = 30,
    /// <summary>
    /// 行业机构
    /// </summary>
    [Description("行业机构")]
    IndustryBody = 40,
}
/// <summary>
/// 性别枚举
/// </summary>
public enum GenderTypeEnum
{
    /// <summary>
    /// 男
    /// </summary>
    [Description("男")]
    Male = 1,
    /// <summary>
    /// 女
    /// </summary>
    [Description("女")]
    Female = 2,
}
LifePayment/LifePayment.Domain/Common/Role.cs
New file
@@ -0,0 +1,38 @@
using System;
using Volo.Abp.Domain.Entities;
namespace LifePayment.Domain.Models
{
    public class Role : Entity<Guid>, IAggregateRoot<Guid>
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int Sequence { get; set; }
        /// <summary>
        /// 是否可用
        /// </summary>
        public bool IsEnable { get; set; } = true;
        /// <summary>
        /// 部门Id
        /// </summary>
        public int DepartmentId { get; set; }
        /// <summary>
        /// 数据范围 100全部数据  10个人数据
        /// </summary>
        public int DataRange { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }
}
LifePayment/LifePayment.Domain/Common/User.cs
New file
@@ -0,0 +1,189 @@
using LifePayment.Domain.Shared;
using System;
using System.Collections.Generic;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
namespace LifePayment.Domain.Models
{
    public partial class User : FullAuditedEntity<Guid>, IDataUserFilter
    {
        public User()
        {
            UserRoles = new HashSet<UserRole>();
        }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 登录用户名
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 用户手机号
        /// </summary>
        public string PhoneNumber { get; set; }
        /// <summary>
        /// 用户端Id
        /// </summary>
        public string ClientId { get; set; }
        /// <summary>
        /// 小程序OpenId
        /// </summary>
        public string OpenId { get; set; }
        /// <summary>
        /// 账户余额
        /// </summary>
        public decimal Amount { get; set; }
        /// <summary>
        /// 账户是否锁住(是否禁用),默认为0未锁住即未禁用
        /// </summary>
        public bool? IsLocked { get; set; }
        /// <summary>
        /// 注册类型:1为企业,2为个人
        /// </summary>
        public int Type { get; set; }
        /// <summary>
        /// 企业类型
        /// </summary>
        public EnterpriseTypeEnum? AuthType { get; set; }
        public DateTime? LastLoginTime { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 企业名称
        /// </summary>
        public string EnterpriseName { get; set; }
        /// <summary>
        /// 联系人
        /// </summary>
        public string Contact { get; set; }
        /// <summary>
        /// 联系电话
        /// </summary>
        public string ContactPhone { get; set; }
        /// <summary>
        /// 绑定邮箱地址
        /// </summary>
        public string BindEmailAddress { get; set; }
        /// <summary>
        /// 个人信息邮箱地址
        /// </summary>
        public string UserInfoEmailAddress { get; set; }
        /// <summary>
        /// 用户头像地址
        /// </summary>
        public string AvatarUrl { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        public GenderTypeEnum? GenderType { get; set; }
        /// <summary>
        /// 职称
        /// </summary>
        public string JobTitle { get; set; }
        /// <summary>
        /// 省code
        /// </summary>
        public int? ProvinceCode { get; set; }
        /// <summary>
        /// 市code
        /// </summary>
        public int? CityCode { get; set; }
        /// <summary>
        /// 区县code
        /// </summary>
        public int? CountyCode { get; set; }
        /// <summary>
        /// 省
        /// </summary>
        public string ProvinceName { get; set; }
        /// <summary>
        /// 市
        /// </summary>
        public string CityName { get; set; }
        /// <summary>
        /// 区县
        /// </summary>
        public string CountyName { get; set; }
        /// <summary>
        /// 详细地址
        /// </summary>
        public string AddressDetail { get; set; }
        /// <summary>
        /// 纬度
        /// </summary>
        public decimal? AddressLatitude { get; set; }
        /// <summary>
        /// 经度
        /// </summary>
        public decimal? AddressLongitude { get; set; }
        /// <summary>
        /// 微信二维码图片
        /// </summary>
        public string WxQrCodeUrl { get; set; }
        /// <summary>
        /// MatchMaking小程序OpenId
        /// </summary>
        public string MatchMakingOpenId { get; set; }
        /// <summary>
        /// im腾讯用户id
        /// </summary>
        public string IMTencentUserId { get; set; }
        /// <summary>
        /// 所属公司id
        /// </summary>
        public Guid? CompanyOrgId { get; set; }
        /// <summary>
        /// 所属部门id
        /// </summary>
        public Guid? DepartmentOrgId { get; set; }
        /// <summary>
        /// 产业园区id
        /// </summary>
        public Guid? IndustrialParkId { get; set; }
        public ICollection<UserRole> UserRoles { get; set; }
    }
}
LifePayment/LifePayment.Domain/Common/UserRole.cs
New file
@@ -0,0 +1,20 @@
using System;
using Volo.Abp.Domain.Entities;
namespace LifePayment.Domain.Models
{
    public class UserRole : Entity<Guid>
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        public virtual Guid UserId { get; set; }
        /// <summary>
        /// 角色Id
        /// </summary>
        public virtual Guid RoleId { get; set; }
        public virtual User User { get; set; }
    }
}
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -278,6 +278,69 @@
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.CreateBackClientUser(LifePayment.Application.Contracts.CreateBackClientUserInput)">
            <summary>
            新增后台管理账户
            </summary>
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.GetBackClientUsers(LifePayment.Application.Contracts.GetBackClientUsersInput)">
            <summary>
            后台管理账户列表
            </summary>
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.UpdateBackClientUser(LifePayment.Application.Contracts.UpdateBackClientUserInput)">
            <summary>
            后台管理账户编辑
            </summary>
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.DeleteBackClientUser(System.Guid)">
            <summary>
            删除后台管理账户
            </summary>
            <param name="id">用户Id</param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.CreateRole(LifePayment.Application.Contracts.CreateBaseRoleInput)">
            <summary>
            新增角色
            </summary>
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.GetRoles(LifePayment.Application.Contracts.GetRolesInput)">
            <summary>
            角色列表
            </summary>
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.UpdateRole(LifePayment.Application.Contracts.CreateOrUpdateRoleInput)">
            <summary>
            角色编辑
            </summary>
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.RoleEnableOrForbid(LifePayment.Application.Contracts.RoleEnableOrForbidInput)">
            <summary>
            角色启用/禁用
            </summary>
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.DeleteRole(System.Guid)">
            <summary>
            删除角色
            </summary>
            <param name="id">角色Id</param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.WxPayNotifyController.WxRechargeNotify(LifePayment.Application.Contracts.WxRechargeNotifyInput)">
            <summary>
            微信支付回调通知
LifePayment/LifePayment.Host/LifePaymentServiceHostModule.cs
@@ -54,7 +54,7 @@
            //Configure<AliYunSMSSettingOptions>(configuration.GetSection("AliYunSMSSetting"));
            context.Services.AddAutoMapperObjectMapper();
            ConfigureConventionalControllers();
            context.Services.AddAuthentication("Bearer").AddIdentityServerAuthentication(options =>
            {
                options.Authority = configuration["AuthServer:Authority"];
@@ -186,10 +186,19 @@
            });
        }
        private void ConfigureConventionalControllers()
        private void ConfigurePays(ServiceConfigurationContext context, IConfiguration configuration)
        {
            Configure<WxPayOption>(configuration.GetSection("WxPay"));
            context.Services.AddHttpClient(LifePaymentConstant.WxPayHttpClientName, config =>
            {
                config.Timeout = TimeSpan.FromSeconds(120);
                config.DefaultRequestHeaders.Add("Connection", "Keep-Alive");
                config.DefaultRequestHeaders.Add("User-Agent", "Aop4Net");
                config.DefaultRequestHeaders.Add("Accept", "application/json");
            });
            Configure<Config>(configuration.GetSection("AliPay"));
            PostConfigure<Config>(r => { Factory.SetOptions(r); });
        }
    }
}
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -1298,6 +1298,191 @@
            线下支付汇款最晚时间
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.Name">
            <summary>
            名称
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.PhoneNumber">
            <summary>
            手机号
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.UserName">
            <summary>
            账户
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.RoleNames">
            <summary>
            角色
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.CompanyOrgId">
            <summary>
            组织架构公司id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.DepartmentOrgId">
            <summary>
            组织架构部门id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateOrUpdateRoleInput.Id">
            <summary>
            角色Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBaseRoleInput.Name">
            <summary>
            名称
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBaseRoleInput.Sequence">
            <summary>
            排序
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBaseRoleInput.DepartmentId">
            <summary>
            部门Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBaseRoleInput.DataRange">
            <summary>
            数据范围 全部数据100 个人数据 10
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBaseRoleInput.Remark">
            <summary>
            备注
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UpdateBackClientUserInput.Id">
            <summary>
            用户Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleEnableOrForbidInput.Id">
            <summary>
            角色Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleEnableOrForbidInput.IsEnable">
            <summary>
            启用:true,禁用:false
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.Id">
            <summary>
            用户Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.UserName">
            <summary>
            登录用户名(账号)
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.Name">
            <summary>
            名称
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.PhoneNumber">
            <summary>
            用户手机号
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.IsLocked">
            <summary>
            账户是否锁住(是否禁用)
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.Roles">
            <summary>
            角色信息
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.Remark">
            <summary>
            备注
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.CompanyOrgId">
            <summary>
            组织架构公司id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.DepartmentOrgId">
            <summary>
            组织架构部门id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.GetBackClientUsersInput.IsLocked">
            <summary>
            账户是否锁住(是否禁用)
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.GetBackClientUsersInput.QueryCondition">
            <summary>
            查询条件:名称/账号
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleDto.Id">
            <summary>
            角色Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleDto.Name">
            <summary>
            角色名
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleInfo.Id">
            <summary>
            角色Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleInfo.Name">
            <summary>
            名称
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleInfo.Sequence">
            <summary>
            排序
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleInfo.IsEnable">
            <summary>
            是否可用
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleInfo.DepartmentId">
            <summary>
            部门Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleInfo.DataRange">
            <summary>
            数据范围 全部数据:100   个人数据:10
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleInfo.UserCount">
            <summary>
            账号数量
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RoleInfo.Remark">
            <summary>
            备注
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.GetRolesInput.QueryCondition">
            <summary>
            查询条件:角色名称
            </summary>
        </member>
        <member name="M:LifePayment.Application.Contracts.IAccountService.LifePayPhoneMesssageCodeLogin(LifePayment.Application.Contracts.LifePayPhoneMesssageCodeLoginInput)">
            <summary>
            手机验证码登录
@@ -1332,5 +1517,65 @@
            
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.Name">
            <summary>
            名称
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.UserName">
            <summary>
            用户名
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.Remark">
            <summary>
            备注
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.PhoneNumber">
            <summary>
            手机号
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.ClientId">
            <summary>
            用户端Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.RoleNames">
            <summary>
            角色
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.OpenId">
            <summary>
            小程序OpenId
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.EnterpriseName">
            <summary>
            企业名称
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.AuthType">
            <summary>
            企业类型
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.MatchMakingOpenId">
            <summary>
            MatchMaking小程序OpenId
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.CompanyOrgId">
            <summary>
            组织架构公司id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.DepartmentOrgId">
            <summary>
            组织架构部门id
            </summary>
        </member>
    </members>
</doc>
LifePayment/LifePayment.Host/appsettings.json
@@ -132,5 +132,29 @@
    "CheckPath": false,
    "AppName": "生活缴费"
  },
  "WxPay": {
    "Mchid": "1679627608",
    "Url": "https://api.mch.weixin.qq.com",
    "AppID": "wxf940ff1d35a98493",
    "APIKey": "NingBoChuangSheng818nbcsxxjsfwyx",
    "APIPrivateKey": "MIIEpQIBAAKCAQEA7M9w/63JiWRd9p1jAvnwbz52VFLCyG5qQLwZQP1WqD8UpUtuaqpOA0RNuCXJuNjyDpwGJdEU1vOTTEmrSmJ+liMTBC2Am6k15my1mxkaei/3UtzJLxzptLROBkWDz9SIMtuhMA+ychmAgJwuMS6HaDqSvfa9sdBqSkZf7i2ZMOUaZPVr+rsDMjlYlp87MNTJzvPkKjIJdxGhRw0S1O5G3A7Q36zTu5heAnR6+S9MLlW4cWJ1Qn+DxS71oK1K9rHEloEqgBFZC8LFSPD6dJ9ls7kWSy897B2LiArWJW8m/DO5mqNpq+4lTaX9ZGvlOmRRekRX0pM8qbasRZpN9TXNHwIDAQABAoIBAQCpXsCqDYj8XC2cSfrb0Rl25wzIyJyJr/cMr7u8MLV/BgblJisl3QKI8ZxInbZGH9wYON1oxL6L8pAiWvpI7GMvTIy4SzcVnhNv58aH1I+MXqwcts6phJteZCr971AUICT9gvopHsD5PGYdFhcvk+DC2knD1ircd3zd/LF172UGgyWCiyernOWYVdt+1HiO3EQNYpuiS1aTaDzRsxR4UOv8Cjlj5jKxa5Grhe5OwzUmupj48slwVqBgfhbWP70ZzIbFfBbRpMMkcU20v0N6QK2I0GsQ5ZdXnZb9pXWcUfgu8TMvpEiUYlAZOvYmDq/mnXc8epr9YfVTWxwomfvSRcWBAoGBAPiSKqQTzU1XBhJgFU+q8VSDHMz7ZYgZ++Pp9Jxti9jDzThDIxBFWHWCybsaZd0VZmJbDX3lq7G3+n783cXDgWDubdY57wo7nBlhRbf3h3nbS53gzrJ1pfVwIL+rpb3MqvfNnq5ffsO13fpoudI17IaFyyQ3BJwPvLtiWJUvmyBfAoGBAPPjSxf/SLcfP7pBs87gEiOAEi3cGZcwfgQijbdI+7fb3zyHXxE1muiH7VOwcVFJ3GnggQcvH+sG1ChoFG1O4ZYxPlZeANtgVX+HikVIOuddP2nkOf7ogUhhJswS8qBnELjW24+mzBrlOdm4kBvppk9Mya+mmy37uwP0o96IIYtBAoGASMIIBzTgoCW72j8TndksgI9MK9feNUNdzq2ZcvxBtfZCKJjGN6oEpYjd4Y1tiZQM/vcl8Nb8Na3jfa4ogA2k3imMLuuQQ4+FNoyZaqrildGRxama9vOm2zux6kik3/R7isM+Ek5TfZfLXNOwqI4uKIYbGwObrs6QcMztnuVrY8MCgYEAqCSZPicre8zYg9IOZF9JQh5m6iUno3u0NaeY6rcvjBfTdYii+1tovE4SSjOIPJHem0RD0K8lo0Sm+mCfTKkokALNRoAyuQxWhcDtjEx7B83bDWdisKKdl0gblnCtw/aqqbS/1O8bIqPM2ZUMDaJtnZiEKEyGChLWYajFXYOfFMECgYEAv1UxaZDVdge7qulUBtbALmuRE2kl+NZiuTkb9hjvQTD9iKJ8xdxBMvRIHi7m9tm10whDXdYSYMESEeyhEGE2HNoPqr4r8E10aH5GqrsZ6oil5xOB81B6aHksEJG9WIzbMjnKo6KSjx8PxMng9+tlMMmG5kA368dHOxnQxBTcZh4=",
    "APIPublicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7M9w/63JiWRd9p1jAvnwbz52VFLCyG5qQLwZQP1WqD8UpUtuaqpOA0RNuCXJuNjyDpwGJdEU1vOTTEmrSmJ+liMTBC2Am6k15my1mxkaei/3UtzJLxzptLROBkWDz9SIMtuhMA+ychmAgJwuMS6HaDqSvfa9sdBqSkZf7i2ZMOUaZPVr+rsDMjlYlp87MNTJzvPkKjIJdxGhRw0S1O5G3A7Q36zTu5heAnR6+S9MLlW4cWJ1Qn+DxS71oK1K9rHEloEqgBFZC8LFSPD6dJ9ls7kWSy897B2LiArWJW8m/DO5mqNpq+4lTaX9ZGvlOmRRekRX0pM8qbasRZpN9TXNHwIDAQAB",
    "SerialNo": "6DDD965D7597FA8280A0715306B86E77A87BA15B",
    "NotifyUrl": "https://testrlywx.boleyuma.com"
  },
  "AliPay": {
    "Protocol": "https",
    "GatewayHost": "openapi.alipay.com",
    "SignType": "RSA2",
    "AppId": "2021004171602214",
    "MerchantPrivateKey": "MIIEogIBAAKCAQEAoDrOheetqHkE1RYaNhogP/iHVXEtGZW4A/JJnwpJs+6eLXfpXf/ecuywplDpgc/BXSUEnDaktUwceLXO8vdIf8h0y8yqWwYdgzC0xELYpTroK3dlNiShgVkUEeMXi+n3Mhjp9OVrqieggDI3YGzDBLY4UAWsXCcXnD+r/xIpT8keVMtb/LrUmL5XLvBVcn5MkJTAoeFt18EQXOLFN1+ldpaf9k+iyM2fbgXCc6InNSgHGSHZwhzm9t+cGqNd1ju/nQN9lHwKCDQPMn6cor2lsP1nsEfpHp2vdfNEdccVSRZB/kdtFzXEUpTFznz8+zK2D0Ra+B0G1nSxus9xsD3HmwIDAQABAoIBACQYm2X3J1wIx1npvMXrZNCEgJhzAqH85JOfBY7alnf+jYvYs64FcmuZfsI5ACHKV9lP+ZXniXt+Rfu7mX+Kzb5bvlQbK1WOLx/a3R5JoNy4RI1mPFrSLcAh/S96ZVeTwah7jFkrRfHzM2kt5uPGHLj3BACjBo1METmV7n1r7fqXCus/Eihdo5ah8WOUPPMg8MqLadSnKVgnkzDLEa+8bagN/WgNfg9m4nW3IocEtFmKox3xV938eXpzn6KrgCduyK1Xn3d1PViRDT1QFOqhTCg17j8qDD4xZphH32Vbgq+heURmSMfecmC1u0CEpvFq3WBVxir/VOxk88gqkAzwusECgYEA+x/OjjNYaeOTFxCLtcI6EnerwgisF39rSNVAdSziWO3u8tUhzhHxB1cE5im4f9Qsd+r3Mw7Vu26YHgQn9O/A1QGoU3e0W/0Ckz5iIIJdAqBB279lNN+puYo4lIUfZha00i/R3Sj6eXrKGTwqCPRyHvJUC7biAAUgnqDAPLdPpgkCgYEAo1c3P4saxVqPnGheplud+jpEilp92dwHn9nIsaX0A/ohcYQIes+bKEZHHafn7ksDhidcjrbPMK72PP2HOJOL6D8a2w9zdyZ6jlycV5jiFHB6ywmkJ0517HWAJ6Fl3OsltDrxWHnuiyb/G/2fU1uLsO2U/b7zT9s2zXJzN53ZiYMCgYAmVku9T79eovxwl/kMLXOaICTbgWFsUOp6+vtVKB4B/4jsD3eSsxB9014PGS1ubmC/ieJlLA2bCJ42buH+tZ9VpWQiIfMp2+1Jt0tZtS0n2nlTZ9u2f7K0fZJ3sf8CIdNHBz/dqITciM9TnOi55z+I0+vawfeskxvQu6+9VSrWqQKBgD55voUMhMnVsLZnaUSCKHOsU8kDgb2Rnkzy9QOV8TaQNrh/gurOe481CkB6l4iaopdueMWRgMAjO8XqRw1Jyiqj8Ha3ezeovRm0rIwIyvh8aUs9vc7XAN3Xt5Pw9NBCFOLR5LwtryMEYHFpWcZ9bnnW9bT0k4YI1/ZO/2jXdHxXAoGAQLGrsed0HLWRjGU2rAUvA9Kny6wo+ScUas5IhoAhGMYDDQ8lFbndgnIOMjdXllT9IvmVERMTSMmP2m7+aqKNz3x0kTkg0tIQTLPsaWCjI5G4CDASUPo/jPvcd4h3euclhpuhcU9FMme3R5UhMAZy1bt+1VWPRxRB0gzWi4d7AFQ=",
    "MerchantCertPath": "Cert/appCertPublicKey_2021004171602214.crt",
    "AlipayCertPath": "Cert/alipayCertPublicKey_RSA2.crt",
    "AlipayRootCertPath": "Cert/alipayRootCert.crt",
    "NotifyUrl": "https://testrlywx.boleyuma.com",
    "EncryptKey": "jjy8A7hB/1Bkhg+8FtXyyg==",
    "AlipayPublicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoDrOheetqHkE1RYaNhogP/iHVXEtGZW4A/JJnwpJs+6eLXfpXf/ecuywplDpgc/BXSUEnDaktUwceLXO8vdIf8h0y8yqWwYdgzC0xELYpTroK3dlNiShgVkUEeMXi+n3Mhjp9OVrqieggDI3YGzDBLY4UAWsXCcXnD+r/xIpT8keVMtb/LrUmL5XLvBVcn5MkJTAoeFt18EQXOLFN1+ldpaf9k+iyM2fbgXCc6InNSgHGSHZwhzm9t+cGqNd1ju/nQN9lHwKCDQPMn6cor2lsP1nsEfpHp2vdfNEdccVSRZB/kdtFzXEUpTFznz8+zK2D0Ra+B0G1nSxus9xsD3HmwIDAQAB"
  },
  "AllowedHosts": "*"
}
LifePayment/LifePayment.HttpApi/LifePay/AccountController.cs
@@ -9,6 +9,8 @@
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.WebClientInfo;
using Volo.Abp.Identity.Application.Contracts.Account;
using Volo.Abp.IdentityModel;
namespace LifePayment.HttpApi
{
@@ -69,6 +71,13 @@
            OssSTSHelper ossSTSHelper = new OssSTSHelper(this.ossSettings);
            return ossSTSHelper.GetOssSTS();
        }
        [HttpPost]
        public async Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto)
        {
            var webClientIp = _webClientInfoProvider.ClientIpAddress;
            return await _accountService.GetTokenForWeb(accessRequestDto, webClientIp);
        }
        #endregion
LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
New file
@@ -0,0 +1,183 @@
using LifePayment.Application.Contracts;
using LifePayment.Domain.Shared;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Identity;
using ZeroD.Util;
namespace LifePayment.HttpApi
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class UserRoleController : AbpController
    {
        private readonly IAccountService _accountService;
        private readonly IUserRoleService _userRoleService;
        private readonly IIdentityUserAppService _identityUserService;
        private readonly IIdentityRoleAppService _identityRoleService;
        public UserRoleController(
               IAccountService accountService,
               IUserRoleService userRoleService,
               IIdentityUserAppService identityUserService,
               IIdentityRoleAppService identityRoleService)
        {
            _accountService = accountService;
            _userRoleService = userRoleService;
            _identityUserService = identityUserService;
            _identityRoleService = identityRoleService;
        }
        /// <summary>
        /// 新增后台管理账户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Guid> CreateBackClientUser(CreateBackClientUserInput input)
        {
            return await _accountService.CreateAccount(ObjectMapper.Map<CreateBackClientUserInput, CreateAccountInput>(input), isAdminCreate: true);
        }
        /// <summary>
        /// 后台管理账户列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageOutput<UserDto>> GetBackClientUsers(GetBackClientUsersInput input)
        {
            return await _userRoleService.GetBackClientUsers(input);
        }
        /// <summary>
        /// 后台管理账户编辑
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> UpdateBackClientUser(UpdateBackClientUserInput input)
        {
            await _identityUserService.UpdateAsync(input.Id, new IdentityUserUpdateDto
            {
                Name = input.Name,
                PhoneNumber = input.PhoneNumber,
                UserName = input.UserName,
                RoleNames = input.RoleNames,
            });
            return await _userRoleService.UpdateBackClientUser(input);
        }
        /// <summary>
        /// 删除后台管理账户
        /// </summary>
        /// <param name="id">用户Id</param>
        /// <returns></returns>
        [HttpGet]
        public async Task<int> DeleteBackClientUser(Guid id)
        {
            await _identityUserService.DeleteAsync(id);
            return await _userRoleService.DeleteBackClientUser(id);
        }
        /// <summary>
        /// 新增角色
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Guid> CreateRole(CreateBaseRoleInput input)
        {
            if (input.DataRange == LifePaymentConstant.DataRange.PowerPerson)
            {
                input.Name = input.Name.Replace(LifePaymentConstant.DataRangePower.PowerPerson, string.Empty) + LifePaymentConstant.DataRangePower.PowerPerson;
            }
            else
            {
                input.Name = input.Name.Replace(LifePaymentConstant.DataRangePower.PowerAll, string.Empty) + LifePaymentConstant.DataRangePower.PowerAll;
            }
            var res = await _identityRoleService.CreateAsync(new IdentityRoleCreateDto
            {
                Name = input.Name,
                Sequence = input.Sequence,
                Note = input.Remark,
            });
            var newInput = ObjectMapper.Map<CreateBaseRoleInput, CreateOrUpdateRoleInput>(input);
            newInput.Id = res.Id;
            await _userRoleService.CreateRole(newInput);
            return res.Id;
        }
        /// <summary>
        /// 角色列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageOutput<RoleInfo>> GetRoles(GetRolesInput input)
        {
            return await _userRoleService.GetRoles(input);
        }
        /// <summary>
        /// 角色编辑
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> UpdateRole(CreateOrUpdateRoleInput input)
        {
            if (input.DataRange == LifePaymentConstant.DataRange.PowerPerson)
            {
                input.Name = input.Name.Replace(LifePaymentConstant.DataRangePower.PowerPerson, string.Empty) + LifePaymentConstant.DataRangePower.PowerPerson;
            }
            else
            {
                input.Name = input.Name.Replace(LifePaymentConstant.DataRangePower.PowerAll, string.Empty) + LifePaymentConstant.DataRangePower.PowerAll;
            }
            await _identityRoleService.UpdateAsync(input.Id, new IdentityRoleUpdateDto
            {
                Name = input.Name,
                Sequence = input.Sequence,
                Note = input.Remark,
            });
            return await _userRoleService.UpdateRole(input);
        }
        /// <summary>
        /// 角色启用/禁用
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> RoleEnableOrForbid(RoleEnableOrForbidInput input)
        {
            await _identityRoleService.UpdateAsync(input.Id, new IdentityRoleUpdateDto
            {
                IsSetEnable = true,
                IsEnable = input.IsEnable,
                Name = input.Name,
            });
            return await _userRoleService.RoleEnableOrForbid(input.Id, input.IsEnable);
        }
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="id">角色Id</param>
        /// <returns></returns>
        [HttpGet]
        public async Task<int> DeleteRole(Guid id)
        {
            await _identityRoleService.DeleteAsync(id);
            return await _userRoleService.DeleteRole(id);
        }
    }
}