添加内部人员修改
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);
|
var jwt = _tokenService.GetToken(userTokenInfo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return jwt;
|
return jwt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -4,6 +4,7 @@ using IRaCIS.Application.Interfaces;
|
||||||
using IRaCIS.Core.Application.Contracts.DTO;
|
using IRaCIS.Core.Application.Contracts.DTO;
|
||||||
using IRaCIS.Core.Application.Filter;
|
using IRaCIS.Core.Application.Filter;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
using MassTransit.Serialization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service
|
namespace IRaCIS.Core.Application.Service
|
||||||
|
@ -174,23 +175,33 @@ namespace IRaCIS.Core.Application.Service
|
||||||
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||||
public async Task<IResponseOutput> AddTrialUsers(TrialUserAddCommand[] userTrialCommands)
|
public async Task<IResponseOutput> AddTrialUsers(TrialUserAddCommand[] userTrialCommands)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (var item in userTrialCommands.GroupBy(t => t.IdentityUserId))
|
foreach (var item in userTrialCommands.GroupBy(t => t.IdentityUserId))
|
||||||
{
|
{
|
||||||
var currentUserRoleList = item.ToList();
|
var currentUserRoleList = item.ToList();
|
||||||
|
|
||||||
var first = currentUserRoleList.FirstOrDefault();
|
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,
|
var currentUser = new TrialIdentityUser()
|
||||||
IdentityUserId = item.Key,
|
{
|
||||||
JoinTime = DateTime.Now,
|
TrialId = first.TrialId,
|
||||||
TrialUserRoleList = currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId }).ToList()
|
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();
|
var success = await _trialIdentityUserRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue