From f46d94f547fc90e2383ddf4774c3acc751cb16d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Thu, 23 Sep 2021 14:18:22 +0500 Subject: [PATCH] update api client --- src/services/api/index.ts | 5 +- ...SaubBaseDto.ts => TelemetryDataSaubDto.ts} | 3 +- .../api/models/TelemetryDataSpinDto.ts | 72 ++++++++++++++++++ .../api/models/TelemetryMessageDto.ts | 1 + .../api/services/AdminTelemetryService.ts | 2 +- src/services/api/services/AdminUserService.ts | 2 +- src/services/api/services/DataService.ts | 6 +- src/services/api/services/ReportService.ts | 14 ++-- .../api/services/TelemetryDataSaubService.ts | 73 +++++++++++++++++++ .../api/services/TelemetryDataSpinService.ts | 73 +++++++++++++++++++ src/services/api/services/TelemetryService.ts | 4 +- src/services/signalr/index.ts | 2 +- 12 files changed, 238 insertions(+), 19 deletions(-) rename src/services/api/models/{DataSaubBaseDto.ts => TelemetryDataSaubDto.ts} (96%) create mode 100644 src/services/api/models/TelemetryDataSpinDto.ts create mode 100644 src/services/api/services/TelemetryDataSaubService.ts create mode 100644 src/services/api/services/TelemetryDataSpinService.ts diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 9b3f048..9c0ecd8 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -7,7 +7,6 @@ export { OpenAPI } from './core/OpenAPI'; export type { AuthDto } from './models/AuthDto'; export type { ClusterDto } from './models/ClusterDto'; export type { CompanyDto } from './models/CompanyDto'; -export type { DataSaubBaseDto } from './models/DataSaubBaseDto'; export type { DatesRangeDto } from './models/DatesRangeDto'; export type { DepositDto } from './models/DepositDto'; export type { EventDto } from './models/EventDto'; @@ -21,6 +20,8 @@ export type { StatOperationsDto } from './models/StatOperationsDto'; export type { StatOperationsDtoPlanFactBase } from './models/StatOperationsDtoPlanFactBase'; export type { StatSectionDto } from './models/StatSectionDto'; export type { StatWellDto } from './models/StatWellDto'; +export type { TelemetryDataSaubDto } from './models/TelemetryDataSaubDto'; +export type { TelemetryDataSpinDto } from './models/TelemetryDataSpinDto'; export type { TelemetryDto } from './models/TelemetryDto'; export type { TelemetryInfoDto } from './models/TelemetryInfoDto'; export type { TelemetryMessageDto } from './models/TelemetryMessageDto'; @@ -56,6 +57,8 @@ export { MeasureService } from './services/MeasureService'; export { MessageService } from './services/MessageService'; export { ReportService } from './services/ReportService'; export { TelemetryAnalyticsService } from './services/TelemetryAnalyticsService'; +export { TelemetryDataSaubService } from './services/TelemetryDataSaubService'; +export { TelemetryDataSpinService } from './services/TelemetryDataSpinService'; export { TelemetryService } from './services/TelemetryService'; export { WellOperationService } from './services/WellOperationService'; export { WellOperationStatService } from './services/WellOperationStatService'; diff --git a/src/services/api/models/DataSaubBaseDto.ts b/src/services/api/models/TelemetryDataSaubDto.ts similarity index 96% rename from src/services/api/models/DataSaubBaseDto.ts rename to src/services/api/models/TelemetryDataSaubDto.ts index 7898f51..c801502 100644 --- a/src/services/api/models/DataSaubBaseDto.ts +++ b/src/services/api/models/TelemetryDataSaubDto.ts @@ -2,7 +2,8 @@ /* tslint:disable */ /* eslint-disable */ -export type DataSaubBaseDto = { +export type TelemetryDataSaubDto = { + id?: number; date?: string; mode?: number | null; idTelemetry?: number; diff --git a/src/services/api/models/TelemetryDataSpinDto.ts b/src/services/api/models/TelemetryDataSpinDto.ts new file mode 100644 index 0000000..8a88f08 --- /dev/null +++ b/src/services/api/models/TelemetryDataSpinDto.ts @@ -0,0 +1,72 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TelemetryDataSpinDto = { + id?: number; + idTelemetry?: number; + date?: string; + topDriveSpeed?: number | null; + topDriveSpeedMin?: number | null; + topDriveSpeedMax?: number | null; + topDriveSpeedOffset?: number | null; + topDriveSpeedErr?: number | null; + topDriveTorque?: number | null; + topDriveTorqueMin?: number | null; + topDriveTorqueMax?: number | null; + topDriveTorqueOffset?: number | null; + topDriveTorqueErr?: number | null; + topDriveSpeedSpFrom?: number | null; + topDriveSpeedSpFromMin?: number | null; + topDriveSpeedSpFromMax?: number | null; + topDriveSpeedSpFromOffset?: number | null; + topDriveSpeedSpFromErr?: number | null; + topDriveTorqueSpFrom?: number | null; + topDriveTorqueSpFromMin?: number | null; + topDriveTorqueSpFromMax?: number | null; + topDriveTorqueSpFromOffset?: number | null; + topDriveTorqueSpFromErr?: number | null; + topDriveSpeedSpTo?: number | null; + topDriveSpeedSpToMin?: number | null; + topDriveSpeedSpToMax?: number | null; + topDriveSpeedSpToOffset?: number | null; + topDriveSpeedSpToErr?: number | null; + topDriveTorqueSpTo?: number | null; + topDriveTorqueSpToMin?: number | null; + topDriveTorqueSpToMax?: number | null; + topDriveTorqueSpToOffset?: number | null; + topDriveTorqueSpToErr?: number | null; + w2800?: number | null; + w2810?: number | null; + mode?: number | null; + w2808?: number | null; + torqueStarting?: number | null; + rotorTorqueAvg?: number | null; + encoderResolution?: number | null; + ratio?: number | null; + torqueRightLimit?: number | null; + torqueLeftLimit?: number | null; + revolsRightLimit?: number | null; + revolsLeftLimit?: number | null; + speedRightSp?: number | null; + speedLeftSp?: number | null; + revolsRightTotal?: number | null; + revolsLeftTotal?: number | null; + turnRightOnceByTorque?: number | null; + turnLeftOnceByTorque?: number | null; + turnRightOnceByAngle?: number | null; + turnLeftOnceByAngle?: number | null; + turnRightOnceByRevols?: number | null; + turnLeftOnceByRevols?: number | null; + breakAngleK?: number | null; + reverseKTorque?: number | null; + positionZero?: number | null; + positionRight?: number | null; + torqueRampTime?: number | null; + ver?: number | null; + reverseSpeedSpZeroTime?: number | null; + unlockBySectorOut?: number | null; + pidMuxTorqueLeftLimit?: number | null; + state?: number | null; + breakAngleLeft?: number | null; +} \ No newline at end of file diff --git a/src/services/api/models/TelemetryMessageDto.ts b/src/services/api/models/TelemetryMessageDto.ts index 563d515..ea9f006 100644 --- a/src/services/api/models/TelemetryMessageDto.ts +++ b/src/services/api/models/TelemetryMessageDto.ts @@ -5,6 +5,7 @@ export type TelemetryMessageDto = { id?: number; date?: string; + wellDepth?: number; idEvent?: number; idTelemetryUser?: number | null; arg0?: string | null; diff --git a/src/services/api/services/AdminTelemetryService.ts b/src/services/api/services/AdminTelemetryService.ts index 2f4f385..a92eff4 100644 --- a/src/services/api/services/AdminTelemetryService.ts +++ b/src/services/api/services/AdminTelemetryService.ts @@ -81,7 +81,7 @@ requestBody?: TelemetryDto, } /** - * Уда��ить запись по id + * Удалить запись по id * @param id id записи * @returns any Success * @throws ApiError diff --git a/src/services/api/services/AdminUserService.ts b/src/services/api/services/AdminUserService.ts index 6ce85e7..d7bd806 100644 --- a/src/services/api/services/AdminUserService.ts +++ b/src/services/api/services/AdminUserService.ts @@ -62,7 +62,7 @@ id: number, } /** - * Редактиров��ть запись по id + * Редактировать запись по id * @param id id записи * @param requestBody запись * @returns any Success diff --git a/src/services/api/services/DataService.ts b/src/services/api/services/DataService.ts index 48f7881..5610ba3 100644 --- a/src/services/api/services/DataService.ts +++ b/src/services/api/services/DataService.ts @@ -1,8 +1,8 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { DataSaubBaseDto } from '../models/DataSaubBaseDto'; import type { DatesRangeDto } from '../models/DatesRangeDto'; +import type { TelemetryDataSaubDto } from '../models/TelemetryDataSaubDto'; import { request as __request } from '../core/request'; export class DataService { @@ -14,7 +14,7 @@ export class DataService { * @param begin дата начала выборки. По умолчанию: текущее время - intervalSec * @param intervalSec интервал времени даты начала выборки, секунды * @param approxPointsCount желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. - * @returns DataSaubBaseDto Success + * @returns TelemetryDataSaubDto Success * @throws ApiError */ public static async getData( @@ -22,7 +22,7 @@ idWell: number, begin?: string, intervalSec: number = 600, approxPointsCount: number = 1024, -): Promise> { +): Promise> { const result = await __request({ method: 'GET', path: `/api/well/${idWell}/data`, diff --git a/src/services/api/services/ReportService.ts b/src/services/api/services/ReportService.ts index e524e33..e540c4c 100644 --- a/src/services/api/services/ReportService.ts +++ b/src/services/api/services/ReportService.ts @@ -9,7 +9,6 @@ export class ReportService { /** * Создает отчет по скважине с указанными параметрами * @param idWell id скважины - * @param idUser id пользователя * @param stepSeconds шаг интервала * @param format формат отчета (0-PDF, 1-LAS) * @param begin дата начала интервала @@ -19,7 +18,6 @@ export class ReportService { */ public static async createReport( idWell: number, -idUser?: number, stepSeconds?: number, format?: number, begin?: string, @@ -29,7 +27,6 @@ end?: string, method: 'POST', path: `/api/well/${idWell}/report`, query: { - 'idUser': idUser, 'stepSeconds': stepSeconds, 'format': format, 'begin': begin, @@ -40,24 +37,23 @@ end?: string, } /** - * Возвращает файл-отчет с диска на сервере + * Возвращает имена всех отчетов по скважине * @param idWell id скважины - * @param reportName имя запрашиваемого файла (отчета) * @returns string Success * @throws ApiError */ - public static async getReport( + public static async getAllReportsNamesByWell( idWell: number, -reportName: string, -): Promise { +): Promise> { const result = await __request({ method: 'GET', - path: `/api/well/${idWell}/report/${reportName}`, + path: `/api/well/${idWell}/report`, }); return result.body; } /** + * @deprecated * Возвращает имена отчетов, хранящихся на диске, * которые подходят под указанные параметры * @param idWell id скважины diff --git a/src/services/api/services/TelemetryDataSaubService.ts b/src/services/api/services/TelemetryDataSaubService.ts new file mode 100644 index 0000000..7354dbc --- /dev/null +++ b/src/services/api/services/TelemetryDataSaubService.ts @@ -0,0 +1,73 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { DatesRangeDto } from '../models/DatesRangeDto'; +import type { TelemetryDataSaubDto } from '../models/TelemetryDataSaubDto'; +import { request as __request } from '../core/request'; + +export class TelemetryDataSaubService { + + /** + * Принимает данные от разных систем по скважине + * @param uid Уникальный идентификатор отправителя + * @param requestBody Данные + * @returns any Success + * @throws ApiError + */ + public static async postData( +uid: string, +requestBody?: Array, +): Promise { + const result = await __request({ + method: 'POST', + path: `/api/TelemetryDataSaub/${uid}`, + body: requestBody, + }); + return result.body; + } + + /** + * Возвращает данные САУБ по скважине. + * По умолчанию за последние 10 минут. + * @param idWell id скважины + * @param begin дата начала выборки. По умолчанию: текущее время - intervalSec + * @param intervalSec интервал времени даты начала выборки, секунды + * @param approxPointsCount желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. + * @returns any Success + * @throws ApiError + */ + public static async getData( +idWell: number, +begin?: string, +intervalSec: number = 600, +approxPointsCount: number = 1024, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/TelemetryDataSaub/${idWell}`, + query: { + 'begin': begin, + 'intervalSec': intervalSec, + 'approxPointsCount': approxPointsCount, + }, + }); + return result.body; + } + + /** + * Возвращает диапазон дат сохраненных данных. + * @param idWell id скважины + * @returns DatesRangeDto Success + * @throws ApiError + */ + public static async getDataDatesRange( +idWell: number, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/TelemetryDataSaub/${idWell}/datesRange`, + }); + return result.body; + } + +} \ No newline at end of file diff --git a/src/services/api/services/TelemetryDataSpinService.ts b/src/services/api/services/TelemetryDataSpinService.ts new file mode 100644 index 0000000..02673ee --- /dev/null +++ b/src/services/api/services/TelemetryDataSpinService.ts @@ -0,0 +1,73 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { DatesRangeDto } from '../models/DatesRangeDto'; +import type { TelemetryDataSpinDto } from '../models/TelemetryDataSpinDto'; +import { request as __request } from '../core/request'; + +export class TelemetryDataSpinService { + + /** + * Принимает данные от разных систем по скважине + * @param uid Уникальный идентификатор отправителя + * @param requestBody Данные + * @returns any Success + * @throws ApiError + */ + public static async postData( +uid: string, +requestBody?: Array, +): Promise { + const result = await __request({ + method: 'POST', + path: `/api/TelemetryDataSpin/${uid}`, + body: requestBody, + }); + return result.body; + } + + /** + * Возвращает данные САУБ по скважине. + * По умолчанию за последние 10 минут. + * @param idWell id скважины + * @param begin дата начала выборки. По умолчанию: текущее время - intervalSec + * @param intervalSec интервал времени даты начала выборки, секунды + * @param approxPointsCount желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. + * @returns any Success + * @throws ApiError + */ + public static async getData( +idWell: number, +begin?: string, +intervalSec: number = 600, +approxPointsCount: number = 1024, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/TelemetryDataSpin/${idWell}`, + query: { + 'begin': begin, + 'intervalSec': intervalSec, + 'approxPointsCount': approxPointsCount, + }, + }); + return result.body; + } + + /** + * Возвращает диапазон дат сохраненных данных. + * @param idWell id скважины + * @returns DatesRangeDto Success + * @throws ApiError + */ + public static async getDataDatesRange( +idWell: number, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/TelemetryDataSpin/${idWell}/datesRange`, + }); + return result.body; + } + +} \ No newline at end of file diff --git a/src/services/api/services/TelemetryService.ts b/src/services/api/services/TelemetryService.ts index 172fa7d..5e0ca30 100644 --- a/src/services/api/services/TelemetryService.ts +++ b/src/services/api/services/TelemetryService.ts @@ -1,8 +1,8 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { DataSaubBaseDto } from '../models/DataSaubBaseDto'; import type { EventDto } from '../models/EventDto'; +import type { TelemetryDataSaubDto } from '../models/TelemetryDataSaubDto'; import type { TelemetryInfoDto } from '../models/TelemetryInfoDto'; import type { TelemetryMessageDto } from '../models/TelemetryMessageDto'; import type { TelemetryUserDto } from '../models/TelemetryUserDto'; @@ -38,7 +38,7 @@ requestBody?: TelemetryInfoDto, */ public static async postData( uid: string, -requestBody?: Array, +requestBody?: Array, ): Promise { const result = await __request({ method: 'POST', diff --git a/src/services/signalr/index.ts b/src/services/signalr/index.ts index 72ed2fb..a87a5e3 100644 --- a/src/services/signalr/index.ts +++ b/src/services/signalr/index.ts @@ -14,7 +14,7 @@ type ConnectionsDict = { //var baseUrl = `http://192.168.1.70:5000` var baseUrl = process.env.NODE_ENV === 'development' - ?'http://192.168.1.70:5000' + ? require('../../../package.json').proxy :'' const Connections: ConnectionsDict = {