zhengyiming
2025-03-19 aef74aff62bd9fc2d615f8b15a100432f2bca44f
Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentApi
11个文件已修改
4个文件已添加
270 ■■■■■ 已修改文件
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePay/LifePayService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/AccountService.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/UserRoleService.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/Common/ChannelFilter.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/Common/ChannelHelper.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | 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/LifePaymentServiceHostModule.cs 1 ●●●● 补丁 | 查看 | 原始文档 | 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.Contracts/User/QrCodeLogin.cs
@@ -75,6 +75,11 @@
        public string[] RoleNames { get; set; }
        /// <summary>
        /// 渠道列表
        /// </summary>
        public Guid[] ChannlesId { get; set; }
        /// <summary>
        /// 小程序OpenId
        /// </summary>
        public string OpenId { get; set; }
LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -175,6 +175,8 @@
                                                   new UserListOutput()
                                                   {
                                                       Id = x.Id,
                                                       CreationChannle = string.IsNullOrEmpty(x.CreationChannleNum) ? "" : _lifePayChannlesRep.Where(c => c.ChannlesNum == x.CreationChannleNum).FirstOrDefault().ChannlesName,
                                                       LastLoginChannle = string.IsNullOrEmpty(x.LastLoginChannleNum) ? "" : _lifePayChannlesRep.Where(c => c.ChannlesNum == x.LastLoginChannleNum).FirstOrDefault().ChannlesName,
                                                       PhoneNumber = x.PhoneNumber,
                                                       CreationTime = x.CreationTime,
                                                       LastLoginTime = x.LastLoginTime
LifePayment/LifePayment.Application/User/AccountService.cs
@@ -6,6 +6,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
@@ -27,6 +28,7 @@
        private readonly IConfiguration _configuration;
        private readonly IIdentityModelAuthenticationService _authenticator;
        private readonly IRepository<User, Guid> _userRepository;
        private readonly IRepository<UserChannle, Guid> _userChannleRep;
        private readonly IIdentityUserAppService _identityUserService;
        public AccountService(
@@ -35,7 +37,8 @@
               IIdentityModelAuthenticationService authenticator,
               IRepository<User, Guid> userRepository,
               IIdentityUserAppService identityUserService,
               IRepository<LifePayUser, Guid> lifePayUserRepository)
               IRepository<LifePayUser, Guid> lifePayUserRepository,
               IRepository<UserChannle, Guid> userChannleRep)
        {
            _configuration = configuration;
            _wxManager = wxManager;
@@ -43,6 +46,7 @@
            _lifePayUserRepository = lifePayUserRepository;
            _authenticator = authenticator;
            _userRepository = userRepository;
            _userChannleRep = userChannleRep;
        }
        #region 查询
@@ -92,6 +96,7 @@
                lifeUser = new LifePayUser()
                {
                    Id = GuidGenerator.Create(),
                    CreationChannleNum = input.CheckChannelId,
                    PhoneNumber = input.PhoneNumber,
                    LastLoginTime = DateTime.Now
                };
@@ -100,6 +105,7 @@
            }
            else
            {
                lifeUser.LastLoginChannleNum = input.CheckChannelId;
                lifeUser.LastLoginTime = DateTime.Now;
                await _lifePayUserRepository.UpdateAsync(lifeUser);
            }
@@ -168,6 +174,19 @@
                DepartmentOrgId = input.ClientId == LifePaymentConstant.ClientId.Back ? input.DepartmentOrgId : null,
                CompanyOrgId = input.ClientId == LifePaymentConstant.ClientId.Back ? input.CompanyOrgId : null
            });
            List<UserChannle> userChannles = new List<UserChannle>();
            foreach (var item in input.ChannlesId)
            {
                userChannles.Add(new UserChannle()
                {
                    Id = Guid.NewGuid(),
                    ChannleId = item,
                    UserId = user.Id
                });
            }
            await _userChannleRep.InsertManyAsync(userChannles);
            //if (input.ClientId == Constant.ClientType.Back)
            //{
            //    await _distributedEventBus.PublishAsync(new SendPhoneMessageInput
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/AbstractChannelFilter.cs
New file
@@ -0,0 +1,25 @@
using LifePayment.Domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Auditing;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Users;
namespace LifePayment.Domain.Common
{
    public abstract class AbstractChannelFilter
    {
        public abstract Task<IQueryable<ChannelsBase>> GetChannelFilter(IQueryable<ChannelsBase> query);
        public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
        protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService<ICurrentUser>();
        protected IRepository<UserChannle> UserChannleRepository => LazyServiceProvider.LazyGetRequiredService<IRepository<UserChannle>>();
    }
}
LifePayment/LifePayment.Domain/Common/ChannelFilter.cs
New file
@@ -0,0 +1,33 @@
using LifePayment.Application.Contracts;
using LifePayment.Domain;
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.Entities;
using Volo.Abp.Domain.Repositories;
using Z.EntityFramework.Plus;
using ZeroD.Util;
namespace LifePayment.Domain.Common
{
    public class ChannelFilter : AbstractChannelFilter
    {
        public async override Task<IQueryable<ChannelsBase>> GetChannelFilter(IQueryable<ChannelsBase> query)
        {
            var queryUser = UserChannleRepository.Where(r => r.UserId == CurrentUser.Id).Select(s => s.ChannleId).ToList();
            var queryResult = query.Where(s => queryUser.Contains(s.ChannleId));
            return queryResult;
        }
    }
    public class ChannelsBase : Entity<Guid>
    {
        public Guid ChannleId { get; set; }
    }
}
LifePayment/LifePayment.Domain/Common/ChannelHelper.cs
New file
@@ -0,0 +1,47 @@
using DynamicQuery.Net.Dto.Input;
using DynamicQuery.Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZeroD.Application.Services.Dto;
using Volo.Abp.Users;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
namespace LifePayment.Domain
{
    public interface IChannelFilter
    {
        public Task<IQueryable<TEntity>> GetChannelFilter<TEntity, TKey>(IQueryable<TEntity> query)
     where TEntity : class, IChannelData, IMayHaveCreator, IEntity<TKey>;
        //public static IQueryable<T> GetChannleQuery<T>(this IQueryable<T> query, ChannelFilterInput input) where T : class, IChannelData
        //{
        //    if (query == null)
        //    {
        //        return query;
        //    }
        //    if (input.Channels != null && input.Channels.Any())
        //    {
        //        query = query.Where(r => input.Channels.Contains(r.ChannelId));
        //    }
        //    return query;
        //}
    }
    public interface IChannelData
    {
       public Guid ChannleId { get; set; }
    }
    public class ChannelFilterInput
    {
        public List<Guid> Channels { get; set; } = new List<Guid>();
    }
}
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  Guid UserId { get; set; }
        /// <summary>
        /// 渠道Id
        /// </summary>
        public  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/LifePaymentServiceHostModule.cs
@@ -149,6 +149,7 @@
                cacheOptions.KeyPrefix = "LifePaymentServices_";
                cacheOptions.GlobalCacheEntryOptions.SlidingExpiration = TimeSpan.FromMinutes(20);
            });
            this.Configure<OssSettings>(configuration.GetSection("ossSettings"));
            this.Configure<ACOOLYOption>(configuration.GetSection("ACOOLY"));
            this.Configure<Config>("AliPayEcsign", configuration.GetSection("AliPayEcsign"));
            this.Configure<InformationOption>(configuration.GetSection("WeiXinCgi"));
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>
            查询条件:角色名称