forked from ddrilling/AsbCloudServer
Merge branch 'master' of https://bitbucket.org/frolovng/asbcloudserver
This commit is contained in:
commit
2d2a7d744e
@ -1,4 +1,6 @@
|
|||||||
namespace AsbCloudApp.Data
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AsbCloudApp.Data
|
||||||
{
|
{
|
||||||
public class ClusterDto : IMapPoint
|
public class ClusterDto : IMapPoint
|
||||||
{
|
{
|
||||||
@ -8,6 +10,6 @@
|
|||||||
public double? Latitude { get; set; }
|
public double? Latitude { get; set; }
|
||||||
public double? Longitude { get; set; }
|
public double? Longitude { get; set; }
|
||||||
|
|
||||||
//public IEnumerable<WellDto> Wells { get; set; }
|
public IEnumerable<WellDto> Wells { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
namespace AsbCloudApp.Data
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AsbCloudApp.Data
|
||||||
{
|
{
|
||||||
public class DepositDto : IMapPoint
|
public class DepositDto : IMapPoint
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Caption { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public double? Latitude { get; set; }
|
public double? Latitude { get; set; }
|
||||||
public double? Longitude { get; set; }
|
public double? Longitude { get; set; }
|
||||||
|
|
||||||
//public IEnumerable<ClusterDto> Clusters { get; set; }
|
public IEnumerable<ClusterDto> Clusters { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
public class WellDto : WellInfoDto, IMapPoint
|
public class WellDto : WellInfoDto, IMapPoint
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public object LastData { get; set; }//DataSaubBaseDto
|
|
||||||
public double? Latitude { get; set; }
|
public double? Latitude { get; set; }
|
||||||
public double? Longitude { get; set; }
|
public double? Longitude { get; set; }
|
||||||
public string WellType { get; set; }
|
public string WellType { get; set; }
|
||||||
|
@ -183,7 +183,7 @@ namespace AsbCloudDb.Model
|
|||||||
modelBuilder.Entity<Company>(entity =>
|
modelBuilder.Entity<Company>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasData(new List<Company>{
|
entity.HasData(new List<Company>{
|
||||||
new Company{ Id = 1, Caption = "\"ООО\" АСБ", IdCompanyType = 3},
|
new Company{ Id = 1, Caption = "ООО \"АСБ\"", IdCompanyType = 3},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,17 +18,41 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
public IEnumerable<DepositDto> GetDeposits(int idCompany)
|
public IEnumerable<DepositDto> GetDeposits(int idCompany)
|
||||||
{
|
{
|
||||||
var entities = db.GetWellsForCompany(idCompany)
|
var wellEntities = (from well in db.Wells
|
||||||
.Select(e => e.Cluster.Deposit)
|
.Include(w => w.RelationCompaniesWells)
|
||||||
.Distinct()
|
.Include(w => w.WellType)
|
||||||
.ToList();
|
.Include(w=>w.Cluster)
|
||||||
|
.ThenInclude(c => c.Deposit)
|
||||||
|
where well.RelationCompaniesWells.Any(r => r.IdCompany == idCompany)
|
||||||
|
select well).ToList();
|
||||||
|
|
||||||
var dtos = entities.Select(e => new DepositDto
|
var gDepositEntities = wellEntities
|
||||||
|
.GroupBy(w => w.Cluster)
|
||||||
|
.GroupBy(c => c.Key.Deposit);
|
||||||
|
|
||||||
|
var dtos = gDepositEntities.Select(gDeposit => new DepositDto
|
||||||
{
|
{
|
||||||
Id = e.Id,
|
Id = gDeposit.Key.Id,
|
||||||
Name = e.Caption,
|
Caption = gDeposit.Key.Caption,
|
||||||
Latitude = e.Latitude,
|
Latitude = gDeposit.Key.Latitude,
|
||||||
Longitude = e.Longitude,
|
Longitude = gDeposit.Key.Longitude,
|
||||||
|
Description = "",
|
||||||
|
Clusters = gDeposit.Select(gCluster=>new ClusterDto {
|
||||||
|
Id = gCluster.Key.Id,
|
||||||
|
Caption = gCluster.Key.Caption,
|
||||||
|
Latitude = gCluster.Key.Latitude,
|
||||||
|
Longitude = gCluster.Key.Longitude,
|
||||||
|
Description = "",
|
||||||
|
Wells = gCluster.Select(well => new WellDto {
|
||||||
|
Id = well.Id,
|
||||||
|
Caption = well.Caption,
|
||||||
|
Latitude = well.Latitude,
|
||||||
|
Longitude = well.Longitude,
|
||||||
|
WellType = well.WellType?.Caption,
|
||||||
|
Cluster = gCluster.Key.Caption,
|
||||||
|
Deposit = gDeposit.Key.Caption,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
return dtos;
|
return dtos;
|
||||||
@ -106,7 +130,6 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
Longitude = e.Longitude,
|
Longitude = e.Longitude,
|
||||||
FactEnd = e.FactEnd,
|
FactEnd = e.FactEnd,
|
||||||
FactStart = e.FactStart,
|
FactStart = e.FactStart,
|
||||||
LastData = null,
|
|
||||||
PlanEnd = e.PlanEnd,
|
PlanEnd = e.PlanEnd,
|
||||||
PlanStart = e.PlanStart,
|
PlanStart = e.PlanStart,
|
||||||
RateOfPenetrationFact = e.RateOfPenetrationFact,
|
RateOfPenetrationFact = e.RateOfPenetrationFact,
|
||||||
|
@ -62,7 +62,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <param name="idCluster"></param>
|
/// <param name="idCluster"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{idCluster}/Stat")]
|
[HttpGet("{idCluster}/Stat")]
|
||||||
[ProducesResponseType(typeof(IEnumerable<WellStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(ClusterStatDto), (int)System.Net.HttpStatusCode.OK)]
|
||||||
public IActionResult GetStat(int idCluster)
|
public IActionResult GetStat(int idCluster)
|
||||||
{
|
{
|
||||||
int? idCompany = User.GetCompanyId();
|
int? idCompany = User.GetCompanyId();
|
||||||
|
Loading…
Reference in New Issue
Block a user