Заработала синхронизация с панели

This commit is contained in:
Фролов 2021-04-30 17:35:35 +05:00
parent fce20a2a10
commit 7d8974a8e5
25 changed files with 6021 additions and 96 deletions

View File

@ -9,6 +9,7 @@ namespace AsbCloudApp.Data
{
//[JsonPropertyName("date")]
public DateTime Date { get; set; }
/// <summary>
/// Режим работы САУБ:
/// 0 - "РУЧНОЙ"

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
namespace AsbCloudApp.Data
{

View File

@ -1,9 +0,0 @@
namespace AsbCloudApp.Data
{
public class TelemetryDto<T>
{
public string HmiVersion { get; set; }
public T Payload { get; set; }
}
}

View File

@ -4,11 +4,12 @@ namespace AsbCloudApp.Data
{
public class TelemetryInfoDto
{
public DateTime Date { get; set; }
public DateTime DrillingStartDate { get; set; }
public string TimeZoneId { get; set; }
public double TimeZoneOffsetTotalHours { get; set; }
public string Caption { get; set; }
public string Well { get; set; }
public string Cluster { get; set; }
public string Customer { get; set; }
public string Deposit { get; set; }
public string HmiVersion { get; set; }
public string PlcVersion { get; set; }

View File

@ -8,15 +8,9 @@ namespace AsbCloudApp.Data
public class TelemetryMessageDto
{
public int Id { get; set; }
public DateTime Date { get; set; }
public int IdEvent { get; set; }
public int? State { get; set; }
public int? IdTelemetryUser { get; set; }
public string Arg0 { get; set; }
public string Arg1 { get; set; }
public string Arg2 { get; set; }

View File

@ -26,9 +26,6 @@ namespace AsbCloudDb.Model
[Column("date", TypeName = "timestamp with time zone")]
public DateTime Date { get; set; }
[Column("state"), Comment("1 - сработало событие. 0 - событие пропало.")]
public int? State { get; set; }
[Column("arg0"), Comment("Аргумент №0 для вставки в шаблон сообщения")]
[StringLength(255)]
public string Arg0 { get; set; }

View File

@ -1,16 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace AsbCloudDb.Model
{
public class TelemetryInfo
{
public DateTime Date { get; set; }
public DateTime DrillingStartDate { get; set; }
public string TimeZoneId { get; set; }
public double TimeZoneOffsetTotalHours { get; set; }
public string Caption { get; set; }
public string Well { get; set; }
public string Cluster { get; set; }
public string Customer { get; set; }
public string Deposit { get; set; }
public string HmiVersion { get; set; }
public string PlcVersion { get; set; }

View File

@ -48,7 +48,6 @@ namespace AsbCloudInfrastructure.Services
var messages = from m in db.Messages
where m.IdTelemetry == telemetry.Id
&& m.State == 1
select m;
if ((categoryids != default) && (categoryids.Count() > 0))
@ -117,6 +116,7 @@ namespace AsbCloudInfrastructure.Services
foreach (var dto in dtos)
{
var entity = mapper.Map<Message>(dto);
entity.Id = 0;
entity.IdTelemetry = telemetryId;
db.Messages.Add(entity);
}

View File

@ -1,7 +1,6 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using AutoMapper;
using System.Collections.Generic;
using System.Linq;

View File

@ -34,7 +34,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet]
[Route("{wellId}/data")]
[ProducesResponseType(typeof(IEnumerable<DataSaubBaseDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult Get(int wellId, DateTime begin = default, int intervalSec = 600, int approxPointsCount = 1024)
public IActionResult GetData(int wellId, DateTime begin = default, int intervalSec = 600, int approxPointsCount = 1024)
{
if (begin == default)
begin = DateTime.Now.AddSeconds(-intervalSec);

View File

@ -30,7 +30,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet]
[Route("{wellId}/message")]
[ProducesResponseType(typeof(PaginationContainer<MessageDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult Get(int wellId, [FromQuery] IEnumerable<int> categoryids = default, DateTime begin = default, DateTime end = default, int skip = 0, int take = 32)
public IActionResult GetMessage(int wellId, int skip = 0, int take = 32, [FromQuery] IEnumerable<int> categoryids = default, DateTime begin = default, DateTime end = default)
{
if (take > 1024)
return BadRequest("limit mast be less then 1024");

View File

@ -47,7 +47,7 @@ namespace AsbCloudWebApi.Controllers
/// <returns></returns>
[HttpPost]
[Route("{uid}/info")]
public IActionResult Info(string uid, [FromBody] TelemetryInfoDto info)
public IActionResult PostInfo(string uid, [FromBody] TelemetryInfoDto info)
{
telemetryService.UpdateInfo(uid, info);
return Ok();
@ -61,7 +61,7 @@ namespace AsbCloudWebApi.Controllers
/// <returns></returns>
[HttpPost]
[Route("{uid}/data")]
public IActionResult Data(string uid, [FromBody] IEnumerable<DataSaubBaseDto> dtos)
public IActionResult PostData(string uid, [FromBody] IEnumerable<DataSaubBaseDto> dtos)
{
var wellId = telemetryService.GetWellIdByTelemetryUid(uid);
DataService.UpdateData(uid, dtos);
@ -80,7 +80,7 @@ namespace AsbCloudWebApi.Controllers
/// <returns></returns>
[HttpPost]
[Route("{uid}/message")]
public IActionResult Message(string uid, [FromBody] IEnumerable<TelemetryMessageDto> dtos)
public IActionResult PostMessages(string uid, [FromBody] IEnumerable<TelemetryMessageDto> dtos)
{
var wellId = telemetryService.GetWellIdByTelemetryUid(uid);
messageService.Insert(uid, dtos);
@ -99,7 +99,7 @@ namespace AsbCloudWebApi.Controllers
/// <returns></returns>
[HttpPost]
[Route("{uid}/event")]
public IActionResult Events(string uid, [FromBody] List<EventDto> events)
public IActionResult PostEvents(string uid, [FromBody] List<EventDto> events)
{
eventService.Upsert(uid, events);
return Ok();
@ -113,10 +113,37 @@ namespace AsbCloudWebApi.Controllers
/// <returns></returns>
[HttpPost]
[Route("{uid}/user")]
public IActionResult Users(string uid, [FromBody] List<TelemetryUserDto> users)
public IActionResult PostUsers(string uid, [FromBody] List<TelemetryUserDto> users)
{
telemetryUserService.Upsert(uid, users);
return Ok();
}
/// <summary>
/// Загрузка архива (sqlite3).
/// <example>
/// var fileName = @"C:\temp\default.sqlite3";
/// var fileStream = System.IO.File.OpenRead(fileName);
/// var file = new FileParameter(fileStream, System.IO.Path.GetFileName(fileName));
/// cli.ApiTelemetryDbAsync("1", new List&lt;FileParameter&gt; { file }).Wait();
/// </example>
/// </summary>
/// <param name="uid"></param>
/// <param name="files"></param>
/// <returns></returns>
//[HttpPost]
//[Route("{uid}/db")]
//public IActionResult PostDb(string uid, IFormFileCollection files)
//{
// foreach (var file in files)
// {
// var fileName = string.IsNullOrEmpty(file.FileName)
// ? System.IO.Path.GetTempFileName()
// : file.FileName;
// using (var stream = System.IO.File.Create(fileName))
// file.CopyTo(stream);
// }
// return Ok();
//}
}
}

View File

@ -20,7 +20,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet]
[ProducesResponseType(typeof(IEnumerable<WellDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult Get()
public IActionResult GetWells()
{
var claimIdCustomer = User.FindFirst("IdCustomer");

View File

@ -0,0 +1,162 @@
{
"ProviderId": "Unchase.OpenAPI.ConnectedService",
"Version": "1.5.20.0",
"GettingStartedDocument": {
"Uri": "https://github.com/unchase/Unchase.OpenAPI.Connectedservice/"
},
"ExtendedData": {
"ServiceName": "OpenAPIService",
"GeneratedFileName": "OpenAPI",
"Endpoint": "https://localhost:5001/swagger/v1/swagger.json",
"GeneratedFileNamePrefix": null,
"GenerateCSharpClient": true,
"GenerateTypeScriptClient": false,
"GenerateCSharpController": false,
"OpenApiToCSharpClientCommand": {
"ClientBaseClass": null,
"ConfigurationClass": null,
"GenerateClientClasses": true,
"GenerateClientInterfaces": false,
"ClientBaseInterface": null,
"InjectHttpClient": true,
"DisposeHttpClient": true,
"ProtectedMethods": [],
"GenerateExceptionClasses": true,
"ExceptionClass": "ApiException",
"WrapDtoExceptions": true,
"UseHttpClientCreationMethod": false,
"HttpClientType": "System.Net.Http.HttpClient",
"UseHttpRequestMessageCreationMethod": false,
"UseBaseUrl": true,
"GenerateBaseUrlProperty": true,
"GenerateSyncMethods": false,
"GeneratePrepareRequestAndProcessResponseAsAsyncMethods": false,
"ExposeJsonSerializerSettings": false,
"ClientClassAccessModifier": "public",
"TypeAccessModifier": "public",
"GenerateContractsOutput": false,
"ContractsNamespace": null,
"ContractsOutputFilePath": null,
"ParameterDateTimeFormat": "s",
"ParameterDateFormat": "yyyy-MM-dd",
"GenerateUpdateJsonSerializerSettingsMethod": true,
"UseRequestAndResponseSerializationSettings": false,
"SerializeTypeInformation": false,
"QueryNullValue": "",
"ClassName": "{controller}Client",
"OperationGenerationMode": 1,
"AdditionalNamespaceUsages": [],
"AdditionalContractNamespaceUsages": [],
"GenerateOptionalParameters": false,
"GenerateJsonMethods": false,
"EnforceFlagEnums": false,
"ParameterArrayType": "System.Collections.Generic.IEnumerable",
"ParameterDictionaryType": "System.Collections.Generic.IDictionary",
"ResponseArrayType": "System.Collections.Generic.ICollection",
"ResponseDictionaryType": "System.Collections.Generic.IDictionary",
"WrapResponses": false,
"WrapResponseMethods": [],
"GenerateResponseClasses": true,
"ResponseClass": "SwaggerResponse",
"Namespace": "ConsoleApp1.OpenAPIService",
"RequiredPropertiesMustBeDefined": true,
"DateType": "System.DateTimeOffset",
"JsonConverters": null,
"AnyType": "object",
"DateTimeType": "System.DateTimeOffset",
"TimeType": "System.TimeSpan",
"TimeSpanType": "System.TimeSpan",
"ArrayType": "System.Collections.Generic.ICollection",
"ArrayInstanceType": "System.Collections.ObjectModel.Collection",
"DictionaryType": "System.Collections.Generic.IDictionary",
"DictionaryInstanceType": "System.Collections.Generic.Dictionary",
"ArrayBaseType": "System.Collections.ObjectModel.Collection",
"DictionaryBaseType": "System.Collections.Generic.Dictionary",
"ClassStyle": 0,
"JsonLibrary": 0,
"GenerateDefaultValues": true,
"GenerateDataAnnotations": true,
"ExcludedTypeNames": [],
"ExcludedParameterNames": [],
"HandleReferences": false,
"GenerateImmutableArrayProperties": false,
"GenerateImmutableDictionaryProperties": false,
"JsonSerializerSettingsTransformationMethod": null,
"InlineNamedArrays": false,
"InlineNamedDictionaries": false,
"InlineNamedTuples": true,
"InlineNamedAny": false,
"GenerateDtoTypes": true,
"GenerateOptionalPropertiesAsNullable": false,
"GenerateNullableReferenceTypes": false,
"TemplateDirectory": null,
"TypeNameGeneratorType": null,
"PropertyNameGeneratorType": null,
"EnumNameGeneratorType": null,
"ServiceHost": null,
"ServiceSchemes": null,
"output": "OpenAPI.cs",
"newLineBehavior": 0
},
"ExcludeTypeNamesLater": true,
"OpenApiToTypeScriptClientCommand": null,
"OpenApiToCSharpControllerCommand": null,
"Variables": null,
"Runtime": 0,
"CopySpecification": false,
"OpenGeneratedFilesOnComplete": false,
"UseRelativePath": false,
"ConvertFromOdata": false,
"OpenApiConvertSettings": {
"ServiceRoot": "http://localhost",
"Version": {
"Major": 1,
"Minor": 0,
"Build": 1,
"Revision": -1,
"MajorRevision": -1,
"MinorRevision": -1
},
"EnableKeyAsSegment": null,
"EnableUnqualifiedCall": false,
"EnableOperationPath": true,
"EnableOperationImportPath": true,
"EnableNavigationPropertyPath": true,
"TagDepth": 4,
"PrefixEntityTypeNameBeforeKey": false,
"OpenApiSpecVersion": 1,
"EnableOperationId": true,
"EnableUriEscapeFunctionCall": false,
"VerifyEdmModel": false,
"IEEE754Compatible": false,
"TopExample": 50,
"EnablePagination": false,
"PageableOperationName": "listMore",
"EnableDiscriminatorValue": false,
"EnableDerivedTypesReferencesForResponses": false,
"EnableDerivedTypesReferencesForRequestBody": false,
"PathPrefix": "OData",
"RoutePathPrefixProvider": {
"PathPrefix": "OData",
"Parameters": null
},
"ShowLinks": false,
"ShowSchemaExamples": false,
"RequireDerivedTypesConstraintForBoundOperations": false,
"ShowRootPath": false,
"ShowMsDosGroupPath": true,
"PathProvider": null
},
"OpenApiSpecVersion": 0,
"UseNetworkCredentials": false,
"NetworkCredentialsUserName": null,
"NetworkCredentialsPassword": null,
"NetworkCredentialsDomain": null,
"WebProxyUri": null,
"UseWebProxy": false,
"UseWebProxyCredentials": false,
"WebProxyNetworkCredentialsUserName": null,
"WebProxyNetworkCredentialsPassword": null,
"WebProxyNetworkCredentialsDomain": null
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
{
"runtime": "NetCore21",
"defaultVariables": null,
"documentGenerator": {
"fromDocument": {
"url": "https://localhost:5001/swagger/v1/swagger.json",
"output": "OpenAPI.nswag.json",
"newLineBehavior": "Auto"
}
},
"codeGenerators": {
"openApiToCSharpClient": {
"clientBaseClass": null,
"configurationClass": null,
"generateClientClasses": true,
"generateClientInterfaces": false,
"clientBaseInterface": null,
"injectHttpClient": true,
"disposeHttpClient": true,
"protectedMethods": [],
"generateExceptionClasses": true,
"exceptionClass": "ApiException",
"wrapDtoExceptions": true,
"useHttpClientCreationMethod": false,
"httpClientType": "System.Net.Http.HttpClient",
"useHttpRequestMessageCreationMethod": false,
"useBaseUrl": true,
"generateBaseUrlProperty": true,
"generateSyncMethods": false,
"generatePrepareRequestAndProcessResponseAsAsyncMethods": false,
"exposeJsonSerializerSettings": false,
"clientClassAccessModifier": "public",
"typeAccessModifier": "public",
"generateContractsOutput": false,
"contractsNamespace": null,
"contractsOutputFilePath": null,
"parameterDateTimeFormat": "s",
"parameterDateFormat": "yyyy-MM-dd",
"generateUpdateJsonSerializerSettingsMethod": true,
"useRequestAndResponseSerializationSettings": false,
"serializeTypeInformation": false,
"queryNullValue": "",
"className": "{controller}Client",
"operationGenerationMode": "MultipleClientsFromPathSegments",
"additionalNamespaceUsages": [],
"additionalContractNamespaceUsages": [],
"generateOptionalParameters": false,
"generateJsonMethods": false,
"enforceFlagEnums": false,
"parameterArrayType": "System.Collections.Generic.IEnumerable",
"parameterDictionaryType": "System.Collections.Generic.IDictionary",
"responseArrayType": "System.Collections.Generic.ICollection",
"responseDictionaryType": "System.Collections.Generic.IDictionary",
"wrapResponses": false,
"wrapResponseMethods": [],
"generateResponseClasses": true,
"responseClass": "SwaggerResponse",
"namespace": "ConsoleApp1.OpenAPIService",
"requiredPropertiesMustBeDefined": true,
"dateType": "System.DateTimeOffset",
"jsonConverters": null,
"anyType": "object",
"dateTimeType": "System.DateTimeOffset",
"timeType": "System.TimeSpan",
"timeSpanType": "System.TimeSpan",
"arrayType": "System.Collections.Generic.ICollection",
"arrayInstanceType": "System.Collections.ObjectModel.Collection",
"dictionaryType": "System.Collections.Generic.IDictionary",
"dictionaryInstanceType": "System.Collections.Generic.Dictionary",
"arrayBaseType": "System.Collections.ObjectModel.Collection",
"dictionaryBaseType": "System.Collections.Generic.Dictionary",
"classStyle": "Poco",
"jsonLibrary": "NewtonsoftJson",
"generateDefaultValues": true,
"generateDataAnnotations": true,
"excludedTypeNames": [],
"excludedParameterNames": [],
"handleReferences": false,
"generateImmutableArrayProperties": false,
"generateImmutableDictionaryProperties": false,
"jsonSerializerSettingsTransformationMethod": null,
"inlineNamedArrays": false,
"inlineNamedDictionaries": false,
"inlineNamedTuples": true,
"inlineNamedAny": false,
"generateDtoTypes": true,
"generateOptionalPropertiesAsNullable": false,
"generateNullableReferenceTypes": false,
"templateDirectory": null,
"typeNameGeneratorType": null,
"propertyNameGeneratorType": null,
"enumNameGeneratorType": null,
"serviceHost": null,
"serviceSchemes": null,
"output": "OpenAPI.cs",
"newLineBehavior": "Auto"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,9 @@
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
@ -17,4 +20,8 @@
<ProjectReference Include="..\AsbCloudInfrastructure\AsbCloudInfrastructure.csproj" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
{
"runtime": "NetCore21",
"defaultVariables": null,
"documentGenerator": {
"fromDocument": {
"url": "https://localhost:5001/swagger/v1/swagger.json",
"output": "AsbCloudApi.nswag.json",
"newLineBehavior": "Auto"
}
},
"codeGenerators": {
"openApiToCSharpClient": {
"clientBaseClass": null,
"configurationClass": null,
"generateClientClasses": true,
"generateClientInterfaces": false,
"clientBaseInterface": null,
"injectHttpClient": true,
"disposeHttpClient": true,
"protectedMethods": [],
"generateExceptionClasses": true,
"exceptionClass": "ApiException",
"wrapDtoExceptions": true,
"useHttpClientCreationMethod": false,
"httpClientType": "System.Net.Http.HttpClient",
"useHttpRequestMessageCreationMethod": false,
"useBaseUrl": true,
"generateBaseUrlProperty": true,
"generateSyncMethods": false,
"generatePrepareRequestAndProcessResponseAsAsyncMethods": false,
"exposeJsonSerializerSettings": false,
"clientClassAccessModifier": "public",
"typeAccessModifier": "public",
"generateContractsOutput": false,
"contractsNamespace": null,
"contractsOutputFilePath": null,
"parameterDateTimeFormat": "s",
"parameterDateFormat": "yyyy-MM-dd",
"generateUpdateJsonSerializerSettingsMethod": true,
"useRequestAndResponseSerializationSettings": false,
"serializeTypeInformation": false,
"queryNullValue": "",
"className": "{controller}Client",
"operationGenerationMode": "SingleClientFromPathSegments",
"additionalNamespaceUsages": [],
"additionalContractNamespaceUsages": [],
"generateOptionalParameters": false,
"generateJsonMethods": false,
"enforceFlagEnums": false,
"parameterArrayType": "System.Collections.Generic.IEnumerable",
"parameterDictionaryType": "System.Collections.Generic.IDictionary",
"responseArrayType": "System.Collections.Generic.ICollection",
"responseDictionaryType": "System.Collections.Generic.IDictionary",
"wrapResponses": false,
"wrapResponseMethods": [],
"generateResponseClasses": true,
"responseClass": "SwaggerResponse",
"namespace": "SyncDicts.AsbCloudApi",
"requiredPropertiesMustBeDefined": true,
"dateType": "System.DateTimeOffset",
"jsonConverters": null,
"anyType": "object",
"dateTimeType": "System.DateTimeOffset",
"timeType": "System.TimeSpan",
"timeSpanType": "System.TimeSpan",
"arrayType": "System.Collections.Generic.ICollection",
"arrayInstanceType": "System.Collections.ObjectModel.Collection",
"dictionaryType": "System.Collections.Generic.IDictionary",
"dictionaryInstanceType": "System.Collections.Generic.Dictionary",
"arrayBaseType": "System.Collections.ObjectModel.Collection",
"dictionaryBaseType": "System.Collections.Generic.Dictionary",
"classStyle": "Poco",
"jsonLibrary": "SystemTextJson",
"generateDefaultValues": true,
"generateDataAnnotations": true,
"excludedTypeNames": [],
"excludedParameterNames": [],
"handleReferences": false,
"generateImmutableArrayProperties": false,
"generateImmutableDictionaryProperties": false,
"jsonSerializerSettingsTransformationMethod": null,
"inlineNamedArrays": false,
"inlineNamedDictionaries": false,
"inlineNamedTuples": true,
"inlineNamedAny": false,
"generateDtoTypes": true,
"generateOptionalPropertiesAsNullable": false,
"generateNullableReferenceTypes": false,
"templateDirectory": null,
"typeNameGeneratorType": null,
"propertyNameGeneratorType": null,
"enumNameGeneratorType": null,
"serviceHost": null,
"serviceSchemes": null,
"output": "AsbCloudApi.cs",
"newLineBehavior": "Auto"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,162 @@
{
"ProviderId": "Unchase.OpenAPI.ConnectedService",
"Version": "1.5.20.0",
"GettingStartedDocument": {
"Uri": "https://github.com/unchase/Unchase.OpenAPI.Connectedservice/"
},
"ExtendedData": {
"ServiceName": "AsbCloudApi",
"GeneratedFileName": "AsbCloudApi",
"Endpoint": "https://localhost:5001/swagger/v1/swagger.json",
"GeneratedFileNamePrefix": null,
"GenerateCSharpClient": true,
"GenerateTypeScriptClient": false,
"GenerateCSharpController": false,
"OpenApiToCSharpClientCommand": {
"ClientBaseClass": null,
"ConfigurationClass": null,
"GenerateClientClasses": true,
"GenerateClientInterfaces": false,
"ClientBaseInterface": null,
"InjectHttpClient": true,
"DisposeHttpClient": true,
"ProtectedMethods": [],
"GenerateExceptionClasses": true,
"ExceptionClass": "ApiException",
"WrapDtoExceptions": true,
"UseHttpClientCreationMethod": false,
"HttpClientType": "System.Net.Http.HttpClient",
"UseHttpRequestMessageCreationMethod": false,
"UseBaseUrl": true,
"GenerateBaseUrlProperty": true,
"GenerateSyncMethods": false,
"GeneratePrepareRequestAndProcessResponseAsAsyncMethods": false,
"ExposeJsonSerializerSettings": false,
"ClientClassAccessModifier": "public",
"TypeAccessModifier": "public",
"GenerateContractsOutput": false,
"ContractsNamespace": null,
"ContractsOutputFilePath": null,
"ParameterDateTimeFormat": "s",
"ParameterDateFormat": "yyyy-MM-dd",
"GenerateUpdateJsonSerializerSettingsMethod": true,
"UseRequestAndResponseSerializationSettings": false,
"SerializeTypeInformation": false,
"QueryNullValue": "",
"ClassName": "{controller}Client",
"OperationGenerationMode": 5,
"AdditionalNamespaceUsages": [],
"AdditionalContractNamespaceUsages": [],
"GenerateOptionalParameters": false,
"GenerateJsonMethods": false,
"EnforceFlagEnums": false,
"ParameterArrayType": "System.Collections.Generic.IEnumerable",
"ParameterDictionaryType": "System.Collections.Generic.IDictionary",
"ResponseArrayType": "System.Collections.Generic.ICollection",
"ResponseDictionaryType": "System.Collections.Generic.IDictionary",
"WrapResponses": false,
"WrapResponseMethods": [],
"GenerateResponseClasses": true,
"ResponseClass": "SwaggerResponse",
"Namespace": "SyncDicts.AsbCloudApi",
"RequiredPropertiesMustBeDefined": true,
"DateType": "System.DateTimeOffset",
"JsonConverters": null,
"AnyType": "object",
"DateTimeType": "System.DateTimeOffset",
"TimeType": "System.TimeSpan",
"TimeSpanType": "System.TimeSpan",
"ArrayType": "System.Collections.Generic.ICollection",
"ArrayInstanceType": "System.Collections.ObjectModel.Collection",
"DictionaryType": "System.Collections.Generic.IDictionary",
"DictionaryInstanceType": "System.Collections.Generic.Dictionary",
"ArrayBaseType": "System.Collections.ObjectModel.Collection",
"DictionaryBaseType": "System.Collections.Generic.Dictionary",
"ClassStyle": 0,
"JsonLibrary": 1,
"GenerateDefaultValues": true,
"GenerateDataAnnotations": true,
"ExcludedTypeNames": [],
"ExcludedParameterNames": [],
"HandleReferences": false,
"GenerateImmutableArrayProperties": false,
"GenerateImmutableDictionaryProperties": false,
"JsonSerializerSettingsTransformationMethod": null,
"InlineNamedArrays": false,
"InlineNamedDictionaries": false,
"InlineNamedTuples": true,
"InlineNamedAny": false,
"GenerateDtoTypes": true,
"GenerateOptionalPropertiesAsNullable": false,
"GenerateNullableReferenceTypes": false,
"TemplateDirectory": null,
"TypeNameGeneratorType": null,
"PropertyNameGeneratorType": null,
"EnumNameGeneratorType": null,
"ServiceHost": null,
"ServiceSchemes": null,
"output": "AsbCloudApi.cs",
"newLineBehavior": 0
},
"ExcludeTypeNamesLater": false,
"OpenApiToTypeScriptClientCommand": null,
"OpenApiToCSharpControllerCommand": null,
"Variables": null,
"Runtime": 0,
"CopySpecification": false,
"OpenGeneratedFilesOnComplete": false,
"UseRelativePath": false,
"ConvertFromOdata": false,
"OpenApiConvertSettings": {
"ServiceRoot": "http://localhost",
"Version": {
"Major": 1,
"Minor": 0,
"Build": 1,
"Revision": -1,
"MajorRevision": -1,
"MinorRevision": -1
},
"EnableKeyAsSegment": null,
"EnableUnqualifiedCall": false,
"EnableOperationPath": true,
"EnableOperationImportPath": true,
"EnableNavigationPropertyPath": true,
"TagDepth": 4,
"PrefixEntityTypeNameBeforeKey": false,
"OpenApiSpecVersion": 1,
"EnableOperationId": true,
"EnableUriEscapeFunctionCall": false,
"VerifyEdmModel": false,
"IEEE754Compatible": false,
"TopExample": 50,
"EnablePagination": false,
"PageableOperationName": "listMore",
"EnableDiscriminatorValue": false,
"EnableDerivedTypesReferencesForResponses": false,
"EnableDerivedTypesReferencesForRequestBody": false,
"PathPrefix": "OData",
"RoutePathPrefixProvider": {
"PathPrefix": "OData",
"Parameters": null
},
"ShowLinks": false,
"ShowSchemaExamples": false,
"RequireDerivedTypesConstraintForBoundOperations": false,
"ShowRootPath": false,
"ShowMsDosGroupPath": true,
"PathProvider": null
},
"OpenApiSpecVersion": 0,
"UseNetworkCredentials": false,
"NetworkCredentialsUserName": null,
"NetworkCredentialsPassword": null,
"NetworkCredentialsDomain": null,
"WebProxyUri": null,
"UseWebProxy": false,
"UseWebProxyCredentials": false,
"WebProxyNetworkCredentialsUserName": null,
"WebProxyNetworkCredentialsPassword": null,
"WebProxyNetworkCredentialsDomain": null
}
}

View File

@ -1,7 +1,5 @@
using AsbCloudApp.Data;
using AsbSaubDbModel.V3;
using System;
using System.Linq;
using SyncDicts.AsbCloudApi;
using System.Collections.Generic;
using System.Net;
using System.Text;
using System.Text.Json;
@ -16,59 +14,69 @@ namespace SyncDicts
/// <param name="args"></param>
static void Main(/*string[] args*/)
{
bool res;
var context = new ArchiveDbContext(@"c:\temp\default.sqlite3");
//bool res;
//var context = new ArchiveDbContext(@"c:\temp\default.sqlite3");
// sync Events
var events = context.EventsDictionary.ToList()
.Select(e => new EventDto
{
EventType = e.EventType,
Id = e.Id,
IdCategory = e.CategoryId,
IdSound = e.SoundId,
Message = e.MessageTemplate,
Tag = e.Tag,
});
//// sync Events
//var events = context.EventsDictionary.ToList()
// .Select(e => new EventDto
// {
// EventType = e.EventType,
// Id = e.Id,
// IdCategory = e.CategoryId,
// IdSound = e.SoundId,
// Message = e.MessageTemplate,
// Tag = e.Tag,
// });
var info = new TelemetryInfoDto
{
Caption = "скв 32",
Deposit = "мр 2",
Cluster = "куст 22",
TimeZoneId = TimeZoneInfo.Local.Id,
TimeZoneOffsetTotalHours = TimeZoneInfo.Local.BaseUtcOffset.TotalHours,
Date = DateTime.Now,
};
//var info = new TelemetryInfoDto
//{
// Caption = "скв 111",
// Deposit = "мр 111",
// Cluster = "куст 111",
// TimeZoneId = TimeZoneInfo.Local.Id,
// TimeZoneOffsetTotalHours = TimeZoneInfo.Local.BaseUtcOffset.TotalHours,
// Date = DateTime.Now,
//};
var users = context.Users.ToList()
.Select(u => new TelemetryUserDto
{
Id = u.Id,
Level = u.Level,
Name = u.Name,
Patronymic = u.Patronymic,
Surname = u.Surname,
});
//var users = context.Users.ToList()
// .Select(u => new TelemetryUserDto
// {
// Id = u.Id,
// Level = u.Level,
// Name = u.Name,
// Patronymic = u.Patronymic,
// Surname = u.Surname,
// });
var messages = context.Messages.Take(1024).ToList()
.Select(m => new TelemetryMessageDto
{
Id = m.Id,
Date = DateTime.UnixEpoch.AddSeconds(m.TimeStamp),
IdEvent = m.EventItemId,
IdTelemetryUser = m.UserId,
State = m.State,
Arg0 = m.Arg0,
Arg1 = m.Arg1,
Arg2 = m.Arg2,
Arg3 = m.Arg3,
});
//var messages = context.Messages.Take(1024).ToList()
// .Select(m => new TelemetryMessageDto
// {
// Id = m.Id,
// Date = DateTime.UnixEpoch.AddSeconds(m.TimeStamp),
// IdEvent = m.EventItemId,
// IdTelemetryUser = m.UserId,
// State = m.State,
// Arg0 = m.Arg0,
// Arg1 = m.Arg1,
// Arg2 = m.Arg2,
// Arg3 = m.Arg3,
// });
var cli = new AsbCloudApi.Client("https://localhost:5001/", new System.Net.Http.HttpClient());
var fileName = @"C:\temp\default.sqlite3";
var fileStream = System.IO.File.OpenRead(fileName);
var file = new FileParameter(fileStream, System.IO.Path.GetFileName(fileName));
cli.ApiTelemetryDbAsync("1", new List<FileParameter> { file }).Wait();
//var cli = new swaggerClient("https://localhost:5001/", new System.Net.Http.HttpClient());
//cli.InfoAsync("aaa",info).Wait();
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/event", events);
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/info", info);
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/user", users);
res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/message", messages);
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/message", messages);
}
private static bool Send<T>(string url, T obj)

View File

@ -8,6 +8,17 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.5" />
<PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NSwag.ApiDescription.Client" Version="13.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
@ -20,4 +31,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
</Project>