From 0eeebd371df03fe1f25f7389ab1fec66efcee2ef Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 27 三月 2025 14:23:44 +0800 Subject: [PATCH] fix:充值流水 --- LifePayment/LifePayment.Application/User/UserRoleService.cs | 62 ++++++++++++++++++++++++++++++- 1 files changed, 60 insertions(+), 2 deletions(-) diff --git a/LifePayment/LifePayment.Application/User/UserRoleService.cs b/LifePayment/LifePayment.Application/User/UserRoleService.cs index 057e212..be79492 100644 --- a/LifePayment/LifePayment.Application/User/UserRoleService.cs +++ b/LifePayment/LifePayment.Application/User/UserRoleService.cs @@ -1,5 +1,7 @@ 锘縰sing LifePayment.Application.Contracts; +using LifePayment.Domain; using LifePayment.Domain.Models; +using LifePayment.Domain.Shared; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; @@ -8,7 +10,10 @@ using Volo.Abp; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Z.EntityFramework.Plus; using ZeroD.Util; +using static LifePayment.Domain.Shared.LifePaymentConstant; namespace HumanResourcesServices.Application { @@ -16,21 +21,30 @@ { 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; + private readonly IIdentityUserAppService _identityUserService; 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, + IIdentityUserAppService identityUserService) { _userRepository = userRepository; _roleRepository = roleRepository; + _channleRepository = channleRepository; _userRoleRep = userRoleRep; + _userChannleRep = userChannleRep; + _identityUserService = identityUserService; } 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 +57,13 @@ { Id = r.Id, Name = r.Name, + }, + Channles = from uc in u.UserChannle + from c in _channleRepository.Where(s => s.ChannlesNum == uc.ChannleId) + select new UserChannleDto + { + Id = c.ChannlesNum, + Name = c.ChannlesName, }, Remark = u.Remark, CompanyOrgId = u.CompanyOrgId, @@ -77,9 +98,46 @@ 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; } + /// <summary> + /// 閲嶇疆瀵嗙爜 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + public async Task ResetPassword(ResetPasswordBaseInput input) + { + var user = await _userRepository.FirstOrDefaultAsync(x => x.Id == input.UserId); + CheckExtensions.IfTrueThrowUserFriendlyException(user == null, CustomeErrorMessage.IsNoExistUser); + CheckExtensions.IfTrueThrowUserFriendlyException(string.IsNullOrEmpty(input.Password), "璇疯緭鍏ュ瘑鐮�"); + var identiResetInput = new ResetPassWordInput + { + UserId = input.UserId, + Name = user.Name, + UserName = user.UserName, + Password = input.Password, + PhoneNumber = user.PhoneNumber + }; + var result = await _identityUserService.ResetPassword(identiResetInput); + CheckExtensions.IfTrueThrowUserFriendlyException(result != Constant.SUCCESS, + CustomeErrorMessage.ResetPasswordFail); + } public async Task<int> DeleteBackClientUser(Guid id) { var entity = await _userRepository.FirstOrDefaultAsync(s => s.Id == id && s.ClientId == Constant.ClientType.Back); -- Gitblit v1.9.1