forked from ddrilling/AsbCloudServer
IsCompanyOwnsWell rename to IsCompanyInvolvedInWell
This commit is contained in:
parent
59a86e4c4b
commit
77f1f54c30
@ -2,20 +2,80 @@
|
||||
{
|
||||
public class WellSectionDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Конструкция секции
|
||||
/// </summary>
|
||||
public string SectionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Глубина план, м
|
||||
/// </summary>
|
||||
public double WellDepthPlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Глубина факт, м
|
||||
/// </summary>
|
||||
public double WellDepthFact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Период план, д
|
||||
/// </summary>
|
||||
public double BuildDaysPlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Период факт, д
|
||||
/// </summary>
|
||||
public double BuildDaysFact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Механическая скорость проходки план, м/час
|
||||
/// </summary>
|
||||
public double RateOfPenetrationPlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Механическая скорость проходки факт, м/час
|
||||
/// </summary>
|
||||
public double RateOfPenetrationFact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Рейсовая скорость план, м/час
|
||||
/// </summary>
|
||||
public double RouteSpeedPlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Рейсовая скорость план, м/час
|
||||
/// </summary>
|
||||
public double RouteSpeedFact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Скорость подъема КНБК план
|
||||
/// </summary>
|
||||
public double BhaUpSpeedPlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Скорость подъема КНБК факт
|
||||
/// </summary>
|
||||
public double BhaUpSpeedFact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Скорость спуска КНБК план
|
||||
/// </summary>
|
||||
public double BhaDownSpeedPlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Скорость спуска КНБК факт
|
||||
/// </summary>
|
||||
public double BhaDownSpeedFact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Скорость спуска обсадной колонны план
|
||||
/// </summary>
|
||||
public double CasingDownSpeedPlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Скорость спуска обсадной колонны факт
|
||||
/// </summary>
|
||||
public double CasingDownSpeedFact { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ namespace AsbCloudApp.Services
|
||||
{
|
||||
IEnumerable<WellDto> GetWellsByCompany(int idCompany);
|
||||
IEnumerable<WellDto> GetTransmittingWells(int idCompany);
|
||||
bool IsCompanyOwnsWell(int idCompany, int idWell);
|
||||
bool IsCompanyInvolvedInWell(int idCompany, int idWell);
|
||||
IEnumerable<WellSectionDto> GetSections(int idWell);
|
||||
IEnumerable<WellOperationDto> GetOperations(int idWell);
|
||||
}
|
||||
|
@ -20,28 +20,28 @@ namespace AsbCloudDb.Model
|
||||
[Column("id_well")]
|
||||
public int IdWell { get; set; }
|
||||
|
||||
[Column("well_depth_plan"), Comment("глубина план")]
|
||||
[Column("well_depth_plan"), Comment("глубина план, м")]
|
||||
public double WellDepthPlan { get; set; }
|
||||
|
||||
[Column("well_depth_fact"), Comment("глубина факт")]
|
||||
[Column("well_depth_fact"), Comment("глубина факт, м")]
|
||||
public double WellDepthFact { get; set; }
|
||||
|
||||
[Column("build_days_plan"), Comment("период план")]
|
||||
[Column("build_days_plan"), Comment("период план, д")]
|
||||
public double BuildDaysPlan { get; set; }
|
||||
|
||||
[Column("build_days_fact"), Comment("период факт")]
|
||||
[Column("build_days_fact"), Comment("период факт, д")]
|
||||
public double BuildDaysFact { get; set; }
|
||||
|
||||
[Column("rate_of_penetration_plan"), Comment("Механическая скорость проходки план")]
|
||||
[Column("rate_of_penetration_plan"), Comment("Механическая скорость проходки план, м/час")]
|
||||
public double RateOfPenetrationPlan { get; set; }
|
||||
|
||||
[Column("rate_of_penetration_fact"), Comment("Механическая скорость проходки факт")]
|
||||
[Column("rate_of_penetration_fact"), Comment("Механическая скорость проходки факт, м/час")]
|
||||
public double RateOfPenetrationFact { get; set; }
|
||||
|
||||
[Column("route_speed_plan"), Comment("Рейсовая скорость план")]
|
||||
[Column("route_speed_plan"), Comment("Рейсовая скорость план, м/час")]
|
||||
public double RouteSpeedPlan { get; set; }
|
||||
|
||||
[Column("route_speed_fact"), Comment("Рейсовая скорость факт")]
|
||||
[Column("route_speed_fact"), Comment("Рейсовая скорость факт, м/час")]
|
||||
public double RouteSpeedFact { get; set; }
|
||||
|
||||
[Column("bha_down_speed_plan"), Comment("Скорость спуска КНБК план")]
|
||||
@ -56,10 +56,10 @@ namespace AsbCloudDb.Model
|
||||
[Column("bha_up_speed_fact"), Comment("Скорость подъема КНБК факт")]
|
||||
public double BhaUpSpeedFact { get; set; }
|
||||
|
||||
[Column("casing_down_speed_plan"), Comment("Скорость спуска ОК план")]
|
||||
[Column("casing_down_speed_plan"), Comment("Скорость спуска обсадной колонны план")]
|
||||
public double CasingDownSpeedPlan { get; set; }
|
||||
|
||||
[Column("casing_down_speed_fact"), Comment("Скорость спуска ОК факт")]
|
||||
[Column("casing_down_speed_fact"), Comment("Скорость спуска обсадной колонны факт")]
|
||||
public double CasingDownSpeedFact { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
|
@ -41,10 +41,9 @@ namespace AsbCloudInfrastructure.Services
|
||||
return wells.Select(w => From(w));
|
||||
}
|
||||
|
||||
public bool IsCompanyOwnsWell(int idCompany, int idWell)
|
||||
public bool IsCompanyInvolvedInWell(int idCompany, int idWell)
|
||||
=> cacheRelationCompaniesWells.Contains(r => r.IdWell == idWell && r.IdCompany == idCompany);
|
||||
|
||||
|
||||
public IEnumerable<WellSectionDto> GetSections(int idWell)
|
||||
{
|
||||
var entities = db
|
||||
|
@ -34,7 +34,7 @@ namespace AsbCloudWebApi.Tests.ControllersTests
|
||||
analyticsService.Setup(s => s.GetWellDepthToDay(It.IsAny<int>()))
|
||||
.Returns(depthToDayDtos);
|
||||
|
||||
wellService.Setup(s => s.IsCompanyOwnsWell(It.IsAny<int>(), It.IsAny<int>()))
|
||||
wellService.Setup(s => s.IsCompanyInvolvedInWell(It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
controller = new AnalyticsController(analyticsService.Object,
|
||||
@ -94,7 +94,7 @@ namespace AsbCloudWebApi.Tests.ControllersTests
|
||||
{
|
||||
var wellServiceReturnsFalse = new Mock<IWellService>();
|
||||
|
||||
wellServiceReturnsFalse.Setup(s => s.IsCompanyOwnsWell(It.IsAny<int>(), It.IsAny<int>()))
|
||||
wellServiceReturnsFalse.Setup(s => s.IsCompanyInvolvedInWell(It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(false);
|
||||
|
||||
var newControllerInstance = new AnalyticsController(analyticsService.Object,
|
||||
|
@ -40,7 +40,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var analytics = analyticsService.GetOperationsByWell(idWell, categoryIds, begin, end, skip, take);
|
||||
@ -63,7 +63,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var wellDepthToDayData = analyticsService.GetWellDepthToDay(idWell);
|
||||
@ -89,7 +89,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var wellDepthToIntervalData = analyticsService.GetWellDepthToInterval(idWell,
|
||||
@ -115,7 +115,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var analytics = analyticsService.GetOperationsSummary(idWell, begin, end);
|
||||
@ -141,7 +141,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var analytics = analyticsService.GetOperationsToInterval(idWell, intervalSeconds, workBeginSeconds);
|
||||
|
@ -59,7 +59,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
bool isCompanyOwnsWell = wellService.IsCompanyOwnsWell((int)idCompany, idWell);
|
||||
bool isCompanyOwnsWell = wellService.IsCompanyInvolvedInWell((int)idCompany, idWell);
|
||||
|
||||
if (!isCompanyOwnsWell)
|
||||
return Forbid();
|
||||
|
@ -42,7 +42,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var fileInfoCollection = files.Select(f =>
|
||||
@ -87,7 +87,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var filesInfo = fileService.GetFilesInfo(idWell, idCategory,
|
||||
@ -117,7 +117,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var fileInfo = fileService.GetFileInfo(fileId);
|
||||
|
@ -58,7 +58,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
bool isCompanyOwnsWell = wellService.IsCompanyOwnsWell((int)idCompany, idWell);
|
||||
bool isCompanyOwnsWell = wellService.IsCompanyInvolvedInWell((int)idCompany, idWell);
|
||||
|
||||
if (!isCompanyOwnsWell)
|
||||
return Forbid();
|
||||
|
@ -72,7 +72,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var id = reportService.CreateReport(idWell, idUser,
|
||||
@ -99,7 +99,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
// TODO: словарь content typoв
|
||||
var relativePath = Path.Combine(fileService.RootPath, $"{idWell}",
|
||||
@ -155,7 +155,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
int reportSize = reportService.GetReportPagesCount(idWell, begin, end, stepSeconds, format);
|
||||
@ -178,7 +178,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
DatesRangeDto wellReportsDatesRange = reportService.GetReportsDatesRange(idWell);
|
||||
|
@ -47,7 +47,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return NoContent();
|
||||
|
||||
if (wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var dto = wellService.GetSections(idWell);
|
||||
@ -64,7 +64,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null)
|
||||
return NoContent();
|
||||
|
||||
if (wellService.IsCompanyOwnsWell((int)idCompany, idWell))
|
||||
if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
|
||||
return Forbid();
|
||||
|
||||
var dto = wellService.GetOperations(idWell);
|
||||
|
Loading…
Reference in New Issue
Block a user