diff --git a/src/pages/Wells.jsx b/src/pages/Wells.jsx index e31fc16..bea9b70 100644 --- a/src/pages/Wells.jsx +++ b/src/pages/Wells.jsx @@ -27,14 +27,6 @@ const columns = [ }, ]; -// const groupBy = (table, key) => { -// return table.reduce((rv, item) => { -// rv[item[key]] = rv[item[key]] || [] -// rv[item[key]].push(item); -// return rv; -// }, []); -// }; - const groupBy = (table, ...keys) => { let key = keys[0] diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 75b7718..dcd0b57 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -6,12 +6,17 @@ export { OpenAPI } from './core/OpenAPI'; export type { AuthDto } from './models/AuthDto'; export type { DataSaubBaseDto } from './models/DataSaubBaseDto'; -export type { TelemetryDataDto } from './models/TelemetryDataDto'; +export type { EventDto } from './models/EventDto'; +export type { MessageDto } from './models/MessageDto'; +export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer'; export type { TelemetryInfoDto } from './models/TelemetryInfoDto'; +export type { TelemetryMessageDto } from './models/TelemetryMessageDto'; +export type { TelemetryUserDto } from './models/TelemetryUserDto'; export type { UserTokenDto } from './models/UserTokenDto'; export type { WellDto } from './models/WellDto'; export { AuthService } from './services/AuthService'; export { DataService } from './services/DataService'; +export { MessageService } from './services/MessageService'; export { TelemetryService } from './services/TelemetryService'; export { WellService } from './services/WellService'; diff --git a/src/services/api/models/DataSaubBaseDto.ts b/src/services/api/models/DataSaubBaseDto.ts index dece8d8..0a9e94f 100644 --- a/src/services/api/models/DataSaubBaseDto.ts +++ b/src/services/api/models/DataSaubBaseDto.ts @@ -5,14 +5,23 @@ export type DataSaubBaseDto = { date?: string; mode?: number | null; + user?: string | null; wellDepth?: number | null; bitDepth?: number | null; - blockHeight?: number | null; + blockPosition?: number | null; + blockPositionMin?: number | null; + blockPositionMax?: number | null; blockSpeed?: number | null; blockSpeedSp?: number | null; + blockSpeedSpRotor?: number | null; + blockSpeedSpSlide?: number | null; + blockSpeedSpDevelop?: number | null; pressure?: number | null; pressureIdle?: number | null; pressureSp?: number | null; + pressureSpRotor?: number | null; + pressureSpSlide?: number | null; + pressureSpDevelop?: number | null; pressureDeltaLimitMax?: number | null; axialLoad?: number | null; axialLoadSp?: number | null; diff --git a/src/services/api/models/EventDto.ts b/src/services/api/models/EventDto.ts new file mode 100644 index 0000000..e4d90a1 --- /dev/null +++ b/src/services/api/models/EventDto.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type EventDto = { + id?: number; + message?: string | null; + idCategory?: number; + tag?: string | null; + eventType?: number; + idSound?: number; +} \ No newline at end of file diff --git a/src/services/api/models/MessageDto.ts b/src/services/api/models/MessageDto.ts new file mode 100644 index 0000000..cfc6c95 --- /dev/null +++ b/src/services/api/models/MessageDto.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type MessageDto = { + id?: number; + date?: string; + categoryId?: number; + user?: string | null; + message?: string | null; +} \ No newline at end of file diff --git a/src/services/api/models/MessageDtoPaginationContainer.ts b/src/services/api/models/MessageDtoPaginationContainer.ts new file mode 100644 index 0000000..360fed6 --- /dev/null +++ b/src/services/api/models/MessageDtoPaginationContainer.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { MessageDto } from './MessageDto'; + +export type MessageDtoPaginationContainer = { + skip?: number; + take?: number; + count?: number; + items?: Array | null; +} \ No newline at end of file diff --git a/src/services/api/models/TelemetryDataDto.ts b/src/services/api/models/TelemetryDataDto.ts deleted file mode 100644 index 9ffccea..0000000 --- a/src/services/api/models/TelemetryDataDto.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { DataSaubBaseDto } from './DataSaubBaseDto'; - -export type TelemetryDataDto = { - date?: string; - hmiVersion?: string | null; - userName?: string | null; - dataSaub?: Array | null; -} \ No newline at end of file diff --git a/src/services/api/models/TelemetryInfoDto.ts b/src/services/api/models/TelemetryInfoDto.ts index 9d5b74d..1a94802 100644 --- a/src/services/api/models/TelemetryInfoDto.ts +++ b/src/services/api/models/TelemetryInfoDto.ts @@ -3,7 +3,13 @@ /* eslint-disable */ export type TelemetryInfoDto = { + date?: string; + timeZoneId?: string | null; + timeZoneOffsetTotalHours?: number; caption?: string | null; cluster?: string | null; deposit?: string | null; + hmiVersion?: string | null; + plcVersion?: string | null; + comment?: string | null; } \ No newline at end of file diff --git a/src/services/api/models/TelemetryMessageDto.ts b/src/services/api/models/TelemetryMessageDto.ts new file mode 100644 index 0000000..02b0166 --- /dev/null +++ b/src/services/api/models/TelemetryMessageDto.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TelemetryMessageDto = { + id?: number; + date?: string; + idEvent?: number; + state?: number | null; + idTelemetryUser?: number | null; + arg0?: string | null; + arg1?: string | null; + arg2?: string | null; + arg3?: string | null; +} \ No newline at end of file diff --git a/src/services/api/models/TelemetryUserDto.ts b/src/services/api/models/TelemetryUserDto.ts new file mode 100644 index 0000000..4bd727c --- /dev/null +++ b/src/services/api/models/TelemetryUserDto.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TelemetryUserDto = { + id?: number; + name?: string | null; + surname?: string | null; + patronymic?: string | null; + level?: number; +} \ No newline at end of file diff --git a/src/services/api/services/DataService.ts b/src/services/api/services/DataService.ts index d44fdd6..5651b37 100644 --- a/src/services/api/services/DataService.ts +++ b/src/services/api/services/DataService.ts @@ -7,17 +7,29 @@ import { request as __request } from '../core/request'; export class DataService { /** - * Возвращает данные САУБ по скважине - * @param wellId + * Возвращает данные САУБ по скважине. + * По умолчанию за последние 10 минут. + * @param wellId id скважины + * @param begin дата начала выборки. По умолчанию: текущее время - intervalSec + * @param intervalSec интервал времени даты начала выборки, секунды + * @param approxPointsCount желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. * @returns DataSaubBaseDto Success * @throws ApiError */ public static async get( wellId: number, +begin?: string, +intervalSec: number = 600, +approxPointsCount: number = 1024, ): Promise> { const result = await __request({ method: 'GET', path: `/api/well/${wellId}/data`, + query: { + 'begin': begin, + 'intervalSec': intervalSec, + 'approxPointsCount': approxPointsCount, + }, }); return result.body; } diff --git a/src/services/api/services/MessageService.ts b/src/services/api/services/MessageService.ts new file mode 100644 index 0000000..b5fc0c4 --- /dev/null +++ b/src/services/api/services/MessageService.ts @@ -0,0 +1,42 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { MessageDtoPaginationContainer } from '../models/MessageDtoPaginationContainer'; +import { request as __request } from '../core/request'; + +export class MessageService { + + /** + * Выдает список сообщений по скважине + * @param wellId id скважины + * @param categoryids список категорий + * @param begin дата начала + * @param end окончание + * @param skip для пагинации кол-во записей пропустить + * @param take для пагинации кол-во записей + * @returns MessageDtoPaginationContainer Success + * @throws ApiError + */ + public static async get( +wellId: number, +categoryids?: Array, +begin?: string, +end?: string, +skip: number, +take: number = 32, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/well/${wellId}/message`, + query: { + 'categoryids': categoryids, + 'begin': begin, + 'end': end, + 'skip': skip, + 'take': take, + }, + }); + 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 160f62e..ea8e4e0 100644 --- a/src/services/api/services/TelemetryService.ts +++ b/src/services/api/services/TelemetryService.ts @@ -1,8 +1,11 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { TelemetryDataDto } from '../models/TelemetryDataDto'; +import type { DataSaubBaseDto } from '../models/DataSaubBaseDto'; +import type { EventDto } from '../models/EventDto'; import type { TelemetryInfoDto } from '../models/TelemetryInfoDto'; +import type { TelemetryMessageDto } from '../models/TelemetryMessageDto'; +import type { TelemetryUserDto } from '../models/TelemetryUserDto'; import { request as __request } from '../core/request'; export class TelemetryService { @@ -35,7 +38,7 @@ requestBody?: TelemetryInfoDto, */ public static async data( uid: string, -requestBody?: TelemetryDataDto, +requestBody?: Array, ): Promise { const result = await __request({ method: 'POST', @@ -45,4 +48,61 @@ requestBody?: TelemetryDataDto, return result.body; } + /** + * Принимает список новых сообщений от телеметрии + * @param uid Уникальный идентификатор отправителя + * @param requestBody сообщения + * @returns any Success + * @throws ApiError + */ + public static async message( +uid: string, +requestBody?: Array, +): Promise { + const result = await __request({ + method: 'POST', + path: `/api/telemetry/${uid}/message`, + body: requestBody, + }); + return result.body; + } + + /** + * Принимает справочник событий + * @param uid Уникальный идентификатор отправителя + * @param requestBody справочник событий + * @returns any Success + * @throws ApiError + */ + public static async events( +uid: string, +requestBody?: Array, +): Promise { + const result = await __request({ + method: 'POST', + path: `/api/telemetry/${uid}/event`, + body: requestBody, + }); + return result.body; + } + + /** + * Принимает справочник пользователей телеметрии + * @param uid Уникальный идентификатор отправителя + * @param requestBody справочник пользователей телеметрии + * @returns any Success + * @throws ApiError + */ + public static async users( +uid: string, +requestBody?: Array, +): Promise { + const result = await __request({ + method: 'POST', + path: `/api/telemetry/${uid}/user`, + body: requestBody, + }); + return result.body; + } + } \ No newline at end of file