添加内部人员修改
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
6b9feca865
commit
39616448b8
|
@ -1140,8 +1140,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
var jwt = _tokenService.GetToken(userTokenInfo);
|
||||
|
||||
|
||||
|
||||
return jwt;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -4,6 +4,7 @@ using IRaCIS.Application.Interfaces;
|
|||
using IRaCIS.Core.Application.Contracts.DTO;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using MassTransit.Serialization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
|
@ -174,23 +175,33 @@ namespace IRaCIS.Core.Application.Service
|
|||
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
public async Task<IResponseOutput> AddTrialUsers(TrialUserAddCommand[] userTrialCommands)
|
||||
{
|
||||
|
||||
foreach (var item in userTrialCommands.GroupBy(t => t.IdentityUserId))
|
||||
{
|
||||
var currentUserRoleList = item.ToList();
|
||||
|
||||
var first = currentUserRoleList.FirstOrDefault();
|
||||
|
||||
var currentUser = new TrialIdentityUser()
|
||||
var findTrialuser = await _trialIdentityUserRepository.Where(t => t.TrialId == first.TrialId && t.IdentityUserId == item.Key, true).Include(t => t.TrialUserRoleList).FirstOrDefaultAsync();
|
||||
|
||||
if (findTrialuser == null)
|
||||
{
|
||||
TrialId = first.TrialId,
|
||||
IdentityUserId = item.Key,
|
||||
JoinTime = DateTime.Now,
|
||||
TrialUserRoleList = currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId }).ToList()
|
||||
};
|
||||
var currentUser = new TrialIdentityUser()
|
||||
{
|
||||
TrialId = first.TrialId,
|
||||
IdentityUserId = item.Key,
|
||||
JoinTime = DateTime.Now,
|
||||
TrialUserRoleList = currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId }).ToList()
|
||||
};
|
||||
|
||||
|
||||
await _trialIdentityUserRepository.AddAsync(currentUser);
|
||||
}
|
||||
else
|
||||
{
|
||||
findTrialuser.TrialUserRoleList.AddRange(currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId, TrialUserId = findTrialuser.Id }).ToList());
|
||||
}
|
||||
|
||||
|
||||
await _trialIdentityUserRepository.AddAsync(currentUser);
|
||||
|
||||
var success = await _trialIdentityUserRepository.SaveChangesAsync();
|
||||
|
||||
|
|
Loading…
Reference in New Issue