zhengyuxuan
2025-03-19 2ece861c311599d31c96ab36fcf3b19d6208d552
fix:账号管理新增渠道
9个文件已修改
1个文件已添加
141 ■■■■■ 已修改文件
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePay/LifePayService.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/AccountService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/UserRoleService.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/Common/User.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/Common/UserChannle.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/LifePay/LifePayUser.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
@@ -124,6 +124,16 @@
    /// </summary>
    public string PhoneNumber { get; set; }
    /// <summary>
    /// 最后登录渠道
    /// </summary>
    public string CreationChannle { get; set; }
    /// <summary>
    /// 最后登录渠道
    /// </summary>
    public string LastLoginChannle { get; set; }
    public DateTime? LastLoginTime { get; set; }
    public DateTime? CreationTime { get; set; }
LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
@@ -29,6 +29,11 @@
        public string[] RoleNames { get; set; }
        /// <summary>
        /// 渠道列表
        /// </summary>
        public Guid[] ChannlesId { get; set; }
        /// <summary>
        /// 组织架构公司id
        /// </summary>
        public Guid? CompanyOrgId { get; set; }
@@ -131,6 +136,12 @@
        /// </summary>
        public IEnumerable<RoleDto> Roles { get; set; }
        /// <summary>
        /// 角色信息
        /// </summary>
        public IEnumerable<UserChannleDto> Channles { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
@@ -215,6 +226,19 @@
        public string Remark { get; set; }
    }
    public class UserChannleDto
    {
        /// <summary>
        /// 渠道Id
        /// </summary>
        public Guid Id { get; set; }
        /// <summary>
        /// 渠道名
        /// </summary>
        public string Name { get; set; }
    }
    public class GetRolesInput : PageInput
    {
        /// <summary>
LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -171,10 +171,13 @@
    /// <returns></returns>
    public async Task<PageOutput<UserListOutput>> GetUserPage(PageInput input)
    {
        var channel = await _lifePayChannlesRep.ToListAsync();
        return await _lifePayUserRepository.Select(x =>
                                                   new UserListOutput()
                                                   {
                                                       Id = x.Id,
                                                       //CreationChannle = string.IsNullOrEmpty(x.CreationChannleNum) ? "" : channel.Where(c => c.ChannlesNum == x.CreationChannleNum).FirstOrDefault().ChannlesName,
                                                       //LastLoginChannle = string.IsNullOrEmpty(x.LastLoginChannleNum) ? "" : channel.Where(c => c.ChannlesNum == x.LastLoginChannleNum).FirstOrDefault().ChannlesName,
                                                       PhoneNumber = x.PhoneNumber,
                                                       CreationTime = x.CreationTime,
                                                       LastLoginTime = x.LastLoginTime
LifePayment/LifePayment.Application/User/AccountService.cs
@@ -92,6 +92,7 @@
                lifeUser = new LifePayUser()
                {
                    Id = GuidGenerator.Create(),
                    CreationChannleNum = input.CheckChannelId,
                    PhoneNumber = input.PhoneNumber,
                    LastLoginTime = DateTime.Now
                };
@@ -100,6 +101,7 @@
            }
            else
            {
                lifeUser.LastLoginChannleNum = input.CheckChannelId;
                lifeUser.LastLoginTime = DateTime.Now;
                await _lifePayUserRepository.UpdateAsync(lifeUser);
            }
LifePayment/LifePayment.Application/User/UserRoleService.cs
@@ -1,4 +1,5 @@
using LifePayment.Application.Contracts;
using LifePayment.Domain;
using LifePayment.Domain.Models;
using Microsoft.EntityFrameworkCore;
using System;
@@ -8,6 +9,7 @@
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Z.EntityFramework.Plus;
using ZeroD.Util;
namespace HumanResourcesServices.Application
@@ -16,21 +18,27 @@
    {
        private readonly IRepository<User, Guid> _userRepository;
        private readonly IRepository<Role, Guid> _roleRepository;
        private readonly IRepository<LifePayChannles, Guid> _channleRepository;
        private readonly IRepository<UserRole, Guid> _userRoleRep;
        private readonly IRepository<UserChannle, Guid> _userChannleRep;
        public UserRoleService(
               IRepository<User, Guid> userRepository,
               IRepository<Role, Guid> roleRepository,
               IRepository<UserRole, Guid> userRoleRep)
               IRepository<LifePayChannles, Guid> channleRepository,
               IRepository<UserRole, Guid> userRoleRep,
               IRepository<UserChannle, Guid> userChannleRep)
        {
            _userRepository = userRepository;
            _roleRepository = roleRepository;
            _channleRepository = channleRepository;
            _userRoleRep = userRoleRep;
            _userChannleRep = userChannleRep;
        }
        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
            var query = _userRepository.Where(s => s.ClientId == Constant.ClientType.Back).Include(i => i.UserRoles).Include(i => i.UserChannle).Select(u => new UserDto
            {
                Id = u.Id,
                UserName = u.UserName,
@@ -43,6 +51,13 @@
                        {
                            Id = r.Id,
                            Name = r.Name,
                        },
                Channles = from uc in u.UserChannle
                           from c in _channleRepository.Where(s => s.Id == uc.ChannleId)
                        select new UserChannleDto
                        {
                            Id = c.Id,
                            Name = c.ChannlesName,
                        },
                Remark = u.Remark,
                CompanyOrgId = u.CompanyOrgId,
@@ -77,6 +92,21 @@
            entity.Remark = input.Remark;
            entity.DepartmentOrgId = input.DepartmentOrgId;
            entity.CompanyOrgId = input.CompanyOrgId;
            var userchannle = await _userChannleRep.Where(s => s.UserId == input.Id).DeleteAsync();
            List<UserChannle> userChannles = new List<UserChannle>();
            foreach (var item in input.ChannlesId)
            {
                userChannles.Add(new UserChannle()
                {
                    Id = Guid.NewGuid(),
                    ChannleId = item,
                    UserId = entity.Id
                });
            }
            await _userChannleRep.InsertManyAsync(userChannles);
            return Constant.SUCCESS;
        }
LifePayment/LifePayment.Domain/Common/User.cs
@@ -10,9 +10,8 @@
    {
        public User()
        {
            UserRoles = new HashSet<UserRole>();
            UserChannle = new HashSet<UserChannle>();
        }
        /// <summary>
@@ -180,10 +179,8 @@
        /// </summary>
        public Guid? IndustrialParkId { get; set; }
        public ICollection<UserRole> UserRoles { get; set; }
        public ICollection<UserChannle> UserChannle { get; set; }
    }
}
LifePayment/LifePayment.Domain/Common/UserChannle.cs
New file
@@ -0,0 +1,19 @@
using System;
using Volo.Abp.Domain.Entities;
namespace LifePayment.Domain.Models
{
    public class UserChannle : Entity<Guid>
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        public virtual Guid UserId { get; set; }
        /// <summary>
        /// 渠道Id
        /// </summary>
        public virtual Guid ChannleId { get; set; }
        public virtual User User { get; set; }
    }
}
LifePayment/LifePayment.Domain/LifePay/LifePayUser.cs
@@ -20,8 +20,18 @@
        /// </summary>
        public string OpenId { get; set; }
        /// <summary>
        /// 注册渠道编号
        /// </summary>
        public string CreationChannleNum { get; set; }
        public string UnionId { get; set; }
        public DateTime? LastLoginTime { get; set; }
        /// <summary>
        /// 最后登录渠道编号
        /// </summary>
        public string LastLoginChannleNum { get; set; }
    }
}
LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
@@ -35,6 +35,8 @@
        public virtual DbSet<UserRole> UserRoles { get; set; }
        public virtual DbSet<UserChannle> UserChannle { get; set; }
        public virtual DbSet<OperateHistory> OperateHistory { get; set; }
        public virtual DbSet<LifePayChannles> LifePayChannles { get; set; }
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -566,6 +566,16 @@
            用户手机号
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserListOutput.CreationChannle">
            <summary>
            最后登录渠道
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserListOutput.LastLoginChannle">
            <summary>
            最后登录渠道
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.LifePayOrderListOutput.PhoneNumber">
            <summary>
            用户手机号
@@ -1456,6 +1466,11 @@
            角色
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.ChannlesId">
            <summary>
            渠道列表
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.CompanyOrgId">
            <summary>
            组织架构公司id
@@ -1541,6 +1556,11 @@
            角色信息
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.Channles">
            <summary>
            角色信息
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserDto.Remark">
            <summary>
            备注
@@ -1616,6 +1636,16 @@
            备注
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserChannleDto.Id">
            <summary>
            渠道Id
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UserChannleDto.Name">
            <summary>
            渠道名
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.GetRolesInput.QueryCondition">
            <summary>
            查询条件:角色名称