fix ยืมคืนเครื่องราชย?มาใช้่ RootDnaId แทน rootId
This commit is contained in:
parent
65e85b7194
commit
14fd93ae95
9 changed files with 21340 additions and 22 deletions
|
|
@ -16,11 +16,9 @@ namespace BMA.EHR.Infrastructure.MessageQueue
|
|||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly InsigniaPeriodsRepository _insigniaPeriodsRepository;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private const string INSIGNIA_QUEUE = "bma_insignia_request";
|
||||
|
||||
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
private readonly IConfiguration _configuration;
|
||||
private IConnection _connection;
|
||||
|
|
@ -30,33 +28,29 @@ namespace BMA.EHR.Infrastructure.MessageQueue
|
|||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public RabbitMQConsumer(UserProfileRepository userProfileRepository,
|
||||
InsigniaPeriodsRepository insigniaPeriodsRepository,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
public RabbitMQConsumer(IHttpContextAccessor httpContextAccessor,
|
||||
IServiceScopeFactory serviceScopeFactory,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
_configuration = configuration;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_insigniaPeriodsRepository = insigniaPeriodsRepository;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
||||
|
||||
var host = _configuration["RabbitMQ:URL"];
|
||||
var userName = _configuration["RabbitMQ:UserName"];
|
||||
var password = _configuration["RabbitMQ:Password"];
|
||||
|
||||
|
||||
var factory = new ConnectionFactory()
|
||||
{
|
||||
HostName = host,
|
||||
UserName = userName,
|
||||
Password = password
|
||||
};
|
||||
|
||||
|
||||
_connection = factory.CreateConnection();
|
||||
_channel = _connection.CreateModel();
|
||||
_channel.QueueDeclare(queue: INSIGNIA_QUEUE, durable: false, exclusive: false, autoDelete: false, arguments: null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
|
|
@ -85,19 +79,19 @@ namespace BMA.EHR.Infrastructure.MessageQueue
|
|||
var userRepo = scope.ServiceProvider.GetRequiredService<UserProfileRepository>();
|
||||
var insigniaRepo = scope.ServiceProvider.GetRequiredService<InsigniaPeriodsRepository>();
|
||||
|
||||
var selectPeriod = await _insigniaPeriodsRepository.GetByIdAsync(periodId);
|
||||
var selectPeriod = await insigniaRepo.GetByIdAsync(periodId);
|
||||
if (selectPeriod == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
}
|
||||
|
||||
|
||||
var organizations = await userRepo.GetActiveRootAsync(AccessToken, selectPeriod.RevisionId);
|
||||
|
||||
|
||||
foreach (var organization in organizations)
|
||||
{
|
||||
if (organization == null)
|
||||
continue;
|
||||
|
||||
|
||||
var result = await insigniaRepo.GetInsigniaRequest(periodId, organization.Id);
|
||||
if (result != null)
|
||||
{
|
||||
|
|
|
|||
21246
BMA.EHR.Infrastructure/Migrations/20251121023046_Add rootdna to InsigniaMagOrg Table.Designer.cs
generated
Normal file
21246
BMA.EHR.Infrastructure/Migrations/20251121023046_Add rootdna to InsigniaMagOrg Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddrootdnatoInsigniaMagOrgTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RootDnaId",
|
||||
table: "InsigniaManageOrganiations",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RootDnaId",
|
||||
table: "InsigniaManageOrganiations");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5832,6 +5832,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสหน่วยงาน");
|
||||
|
||||
b.Property<Guid?>("RootDnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<int>("Total")
|
||||
.HasColumnType("int")
|
||||
.HasComment("จำนวนทั้งหมด");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue