| | |
| | | using LifePayment.Application.Contracts; |
| | | using LifePayment.Domain; |
| | | using LifePayment.Domain.Models; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using System; |
| | |
| | | using Volo.Abp; |
| | | using Volo.Abp.Application.Services; |
| | | using Volo.Abp.Domain.Repositories; |
| | | using Z.EntityFramework.Plus; |
| | | using ZeroD.Util; |
| | | |
| | | namespace HumanResourcesServices.Application |
| | |
| | | { |
| | | 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, |
| | |
| | | { |
| | | 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, |
| | |
| | | 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; |
| | | } |
| | | |