|
@ -1,7 +1,6 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.Diagnostics; |
|
|
|
|
|
using System.Globalization; |
|
|
using System.Globalization; |
|
|
using System.IO; |
|
|
using System.IO; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
@ -13,11 +12,13 @@ using InfluxDB.LineProtocol.Client; |
|
|
using Magicodes.ExporterAndImporter.Core.Extension; |
|
|
using Magicodes.ExporterAndImporter.Core.Extension; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
|
using Microsoft.AspNetCore.SignalR; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
|
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
|
using Microsoft.EntityFrameworkCore.Storage; |
|
|
using Microsoft.EntityFrameworkCore.Storage; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.OpenApi.Extensions; |
|
|
using Microsoft.OpenApi.Extensions; |
|
|
|
|
|
using SettleAccount.Job.SignalR; |
|
|
using Volo.Abp.Application.Dtos; |
|
|
using Volo.Abp.Application.Dtos; |
|
|
using Volo.Abp.Application.Services; |
|
|
using Volo.Abp.Application.Services; |
|
|
using Volo.Abp.BlobStoring; |
|
|
using Volo.Abp.BlobStoring; |
|
@ -51,18 +52,21 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran |
|
|
private readonly INormalEfCoreRepository<VmiLog, Guid> _logRepository; |
|
|
private readonly INormalEfCoreRepository<VmiLog, Guid> _logRepository; |
|
|
private readonly INormalEfCoreRepository<VmiSnapshot, Guid> _snapshotRepository; |
|
|
private readonly INormalEfCoreRepository<VmiSnapshot, Guid> _snapshotRepository; |
|
|
private readonly IBlobContainer<MyFileContainer> _fileContainer; |
|
|
private readonly IBlobContainer<MyFileContainer> _fileContainer; |
|
|
|
|
|
private readonly IHubContext<PageHub> _hubContext; |
|
|
|
|
|
|
|
|
public VmiAppService(IConfiguration cfg, |
|
|
public VmiAppService(IConfiguration cfg, |
|
|
INormalEfCoreRepository<VmiBalance, Guid> balanceRepository, |
|
|
INormalEfCoreRepository<VmiBalance, Guid> balanceRepository, |
|
|
INormalEfCoreRepository<VmiLog, Guid> logRepository, |
|
|
INormalEfCoreRepository<VmiLog, Guid> logRepository, |
|
|
INormalEfCoreRepository<VmiSnapshot, Guid> snapshotRepository, |
|
|
INormalEfCoreRepository<VmiSnapshot, Guid> snapshotRepository, |
|
|
IBlobContainer<MyFileContainer> fileContainer) |
|
|
IBlobContainer<MyFileContainer> fileContainer, |
|
|
|
|
|
IHubContext<PageHub> hubContext) |
|
|
{ |
|
|
{ |
|
|
this._cfg = cfg; |
|
|
this._cfg = cfg; |
|
|
this._balanceRepository = balanceRepository; |
|
|
this._balanceRepository = balanceRepository; |
|
|
this._logRepository = logRepository; |
|
|
this._logRepository = logRepository; |
|
|
this._snapshotRepository = snapshotRepository; |
|
|
this._snapshotRepository = snapshotRepository; |
|
|
this._fileContainer = fileContainer; |
|
|
this._fileContainer = fileContainer; |
|
|
|
|
|
this._hubContext = hubContext; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -70,8 +74,9 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
[UnitOfWork] |
|
|
[UnitOfWork] |
|
|
public void Invoke() |
|
|
public virtual Task Invoke() |
|
|
{ |
|
|
{ |
|
|
|
|
|
this._hubContext.Clients.All.ServerToClient("JobItem", "refresh", ""); |
|
|
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/files/vmi")); |
|
|
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/files/vmi")); |
|
|
var date = DateTime.Now.ToString("yyyyMMddHH"); |
|
|
var date = DateTime.Now.ToString("yyyyMMddHH"); |
|
|
var connectionString = $"Data Source=wwwroot/files/vmi/{date}.db"; |
|
|
var connectionString = $"Data Source=wwwroot/files/vmi/{date}.db"; |
|
@ -87,7 +92,8 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran |
|
|
var snapshot = new VmiSnapshot { Name = date, Path = connectionString }; |
|
|
var snapshot = new VmiSnapshot { Name = date, Path = connectionString }; |
|
|
this._snapshotRepository.InsertAsync(snapshot).Wait(); |
|
|
this._snapshotRepository.InsertAsync(snapshot).Wait(); |
|
|
} |
|
|
} |
|
|
Debug.WriteLine($"{nameof(VmiAppService)}:{DateTime.Now}"); |
|
|
this._hubContext.Clients.All.ServerToClient("JobItem", "refresh", ""); |
|
|
|
|
|
return Task.CompletedTask; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|