forked from ddrilling/AsbCloudServer
delete comment
This commit is contained in:
parent
9b1b1f9736
commit
4d5b8932a5
@ -8,7 +8,6 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace AsbCloudWebApi.Controllers.GTR
|
|||||||
private readonly IGtrRepository gtrRepository;
|
private readonly IGtrRepository gtrRepository;
|
||||||
private readonly IHubContext<TelemetryHub> telemetryHubContext;
|
private readonly IHubContext<TelemetryHub> telemetryHubContext;
|
||||||
|
|
||||||
//public string SirnalRMethodGetDataName { get; protected set; } = "ReceiveData";
|
public string SirnalRMethodGetDataName { get; protected set; } = "ReceiveData";
|
||||||
|
|
||||||
public GtrWitsController(
|
public GtrWitsController(
|
||||||
ITelemetryService telemetryService,
|
ITelemetryService telemetryService,
|
||||||
@ -47,20 +47,20 @@ namespace AsbCloudWebApi.Controllers.GTR
|
|||||||
/// <param name = "token" > Токен завершения задачи</param>
|
/// <param name = "token" > Токен завершения задачи</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{idWell}")]
|
[HttpGet("{idWell}")]
|
||||||
//[Permission]
|
[Permission]
|
||||||
public async Task<ActionResult<IEnumerable<WitsRecordDto>>> GetDataAsync(int idWell, DateTime begin = default,
|
public async Task<ActionResult<IEnumerable<WitsRecordDto>>> GetDataAsync(int idWell, DateTime begin = default,
|
||||||
int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
//int? idCompany = User.GetCompanyId();
|
int? idCompany = User.GetCompanyId();
|
||||||
|
|
||||||
//if (idCompany is null)
|
if (idCompany is null)
|
||||||
// return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
//bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||||
// idWell, token).ConfigureAwait(false);
|
idWell, token).ConfigureAwait(false);
|
||||||
|
|
||||||
//if (!isCompanyOwnsWell)
|
if (!isCompanyOwnsWell)
|
||||||
// return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var content = await gtrRepository.GetAsync(idWell, begin,
|
var content = await gtrRepository.GetAsync(idWell, begin,
|
||||||
intervalSec, approxPointsCount, token).ConfigureAwait(false);
|
intervalSec, approxPointsCount, token).ConfigureAwait(false);
|
||||||
@ -72,16 +72,14 @@ namespace AsbCloudWebApi.Controllers.GTR
|
|||||||
public async Task<IActionResult> PostDataAsync(
|
public async Task<IActionResult> PostDataAsync(
|
||||||
string uid,
|
string uid,
|
||||||
[FromBody] WitsRecordDto dto,
|
[FromBody] WitsRecordDto dto,
|
||||||
[FromServices] IGtrRepository gtrRepository,
|
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var idTelemetry = telemetryService.GetOrCreateTelemetryIdByUid(uid);
|
var idTelemetry = telemetryService.GetOrCreateTelemetryIdByUid(uid);
|
||||||
await gtrRepository.SaveDataAsync(idTelemetry, dto, token).ConfigureAwait(false);
|
await gtrRepository.SaveDataAsync(idTelemetry, dto, token).ConfigureAwait(false);
|
||||||
//var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
|
var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
|
||||||
//if (idWell != null && dtos.Any())
|
if (idWell is not null && dto is not null)
|
||||||
// _ = Task.Run(() => telemetryHubContext.Clients.Group($"well_{idWell}_wits")
|
_ = Task.Run(() => telemetryHubContext.Clients.Group($"well_{idWell}_wits")
|
||||||
// .SendAsync(SirnalRMethodGetDataName, dtos), CancellationToken.None);
|
.SendAsync(SirnalRMethodGetDataName, dto), CancellationToken.None);
|
||||||
|
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user