From 2da5e7076e95dbed7bc123a822a0a784a038f75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Mon, 11 Oct 2021 15:58:38 +0500 Subject: [PATCH] remove dead controller; update api client; --- src/pages/Archive.jsx | 4 +- src/services/api/index.ts | 3 +- src/services/api/models/DrillParamsDto.ts | 26 +++++++++ src/services/api/services/DataService.ts | 54 ------------------ .../api/services/DrillParamsService.ts | 56 +++++++++++++++++++ .../api/services/WellOperationService.ts | 9 +-- src/services/api/services/WellService.ts | 16 ------ 7 files changed, 89 insertions(+), 79 deletions(-) create mode 100644 src/services/api/models/DrillParamsDto.ts delete mode 100644 src/services/api/services/DataService.ts create mode 100644 src/services/api/services/DrillParamsService.ts diff --git a/src/pages/Archive.jsx b/src/pages/Archive.jsx index 3a9f28b..cb75ad5 100644 --- a/src/pages/Archive.jsx +++ b/src/pages/Archive.jsx @@ -5,7 +5,7 @@ import { Row, Col, Tooltip} from 'antd' -import { DataService } from '../services/api' +import { TelemetryDataSaubService } from '../services/api' import {generateUUID} from '../services/UidGenerator' import { ArchiveColumn } from '../components/ArchiveColumn' import moment from 'moment' @@ -94,7 +94,7 @@ export default function Archive({idWell}) { let startDate = rangeDate[0].toISOString() setLoader(true) - DataService.getData(idWell, startDate, interval, 2048) + TelemetryDataSaubService.getData(idWell, startDate, interval, 2048) .then(handleReceiveDataSaub) .catch(error => { notify(`Не удалось загрузить данные по скважине (${idWell}) c ${rangeDate[0]} по ${rangeDate[1]}`, 'error') diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 9c0ecd8..8ea0eaf 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -9,6 +9,7 @@ export type { ClusterDto } from './models/ClusterDto'; export type { CompanyDto } from './models/CompanyDto'; export type { DatesRangeDto } from './models/DatesRangeDto'; export type { DepositDto } from './models/DepositDto'; +export type { DrillParamsDto } from './models/DrillParamsDto'; export type { EventDto } from './models/EventDto'; export type { FileInfoDto } from './models/FileInfoDto'; export type { FileInfoDtoPaginationContainer } from './models/FileInfoDtoPaginationContainer'; @@ -49,9 +50,9 @@ export { AdminUserService } from './services/AdminUserService'; export { AdminWellService } from './services/AdminWellService'; export { AuthService } from './services/AuthService'; export { ClusterService } from './services/ClusterService'; -export { DataService } from './services/DataService'; export { DepositService } from './services/DepositService'; export { DrillingProgramService } from './services/DrillingProgramService'; +export { DrillParamsService } from './services/DrillParamsService'; export { FileService } from './services/FileService'; export { MeasureService } from './services/MeasureService'; export { MessageService } from './services/MessageService'; diff --git a/src/services/api/models/DrillParamsDto.ts b/src/services/api/models/DrillParamsDto.ts new file mode 100644 index 0000000..40d1c6c --- /dev/null +++ b/src/services/api/models/DrillParamsDto.ts @@ -0,0 +1,26 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type DrillParamsDto = { + id?: number; + idWell?: number; + wellSectionTypeName?: string | null; + depthStart?: number; + depthEnd?: number; + axialLoadMin?: number; + axialLoadAvg?: number; + axialLoadMax?: number; + pressureMin?: number; + pressureAvg?: number; + pressureMax?: number; + topDriveTorqueMin?: number; + topDriveTorqueAvg?: number; + topDriveTorqueMax?: number; + topDriveSpeedMin?: number; + topDriveSpeedAvg?: number; + topDriveSpeedMax?: number; + consumptionMin?: number; + consumptionAvg?: number; + consumptionMax?: number; +} \ No newline at end of file diff --git a/src/services/api/services/DataService.ts b/src/services/api/services/DataService.ts deleted file mode 100644 index 5610ba3..0000000 --- a/src/services/api/services/DataService.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 DataService { - - /** - * Возвращает данные САУБ по скважине. - * По умолчанию за последние 10 минут. - * @param idWell id скважины - * @param begin дата начала выборки. По умолчанию: текущее время - intervalSec - * @param intervalSec интервал времени даты начала выборки, секунды - * @param approxPointsCount желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. - * @returns TelemetryDataSaubDto 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/well/${idWell}/data`, - 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/well/${idWell}/data/datesRange`, - }); - return result.body; - } - -} \ No newline at end of file diff --git a/src/services/api/services/DrillParamsService.ts b/src/services/api/services/DrillParamsService.ts new file mode 100644 index 0000000..70247da --- /dev/null +++ b/src/services/api/services/DrillParamsService.ts @@ -0,0 +1,56 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { DrillParamsDto } from '../models/DrillParamsDto'; +import { request as __request } from '../core/request'; + +export class DrillParamsService { + + /** + * Возвращает автоматически расчитанные значения для режимов бурения + * @param idWell id скважины + * @param startDepth Стартовая глубина + * @param endDepth Конечная глубина + * @returns DrillParamsDto Success + * @throws ApiError + */ + public static async getDefaultDrillParams( +idWell?: number, +startDepth?: number, +endDepth?: number, +): Promise { + const result = await __request({ + method: 'GET', + path: `/drillParams/idWell/autoParams`, + query: { + 'idWell': idWell, + 'startDepth': startDepth, + 'endDepth': endDepth, + }, + }); + return result.body; + } + + /** + * Сохраняет значения для режимов бурения + * @param idWell id скважины + * @param requestBody Параметры режимов бурений для секции + * @returns number Success + * @throws ApiError + */ + public static async saveDrillParams( +idWell?: number, +requestBody?: DrillParamsDto, +): Promise { + const result = await __request({ + method: 'POST', + path: `/drillParams/idWell`, + query: { + 'idWell': idWell, + }, + body: requestBody, + }); + return result.body; + } + +} \ No newline at end of file diff --git a/src/services/api/services/WellOperationService.ts b/src/services/api/services/WellOperationService.ts index dccf339..036cc7a 100644 --- a/src/services/api/services/WellOperationService.ts +++ b/src/services/api/services/WellOperationService.ts @@ -148,22 +148,19 @@ idOperation: number, /** * Импортирует операции из excel (xlsx) файла * @param idWell id скважины - * @param deleteWellOperationsBeforeImport Удалить операции перед импортом, если фал валидный + * @param options Удалить операции перед импортом = 1, если фал валидный * @param requestBody * @returns any Success * @throws ApiError */ public static async import( idWell: number, -deleteWellOperationsBeforeImport: boolean = false, +options: number, requestBody?: any, ): Promise { const result = await __request({ method: 'POST', - path: `/api/well/${idWell}/wellOperations/import`, - query: { - 'deleteWellOperationsBeforeImport': deleteWellOperationsBeforeImport, - }, + path: `/api/well/${idWell}/wellOperations/import/${options}`, body: requestBody, }); return result.body; diff --git a/src/services/api/services/WellService.ts b/src/services/api/services/WellService.ts index c3c6290..42f08a6 100644 --- a/src/services/api/services/WellService.ts +++ b/src/services/api/services/WellService.ts @@ -2,7 +2,6 @@ /* tslint:disable */ /* eslint-disable */ import type { WellDto } from '../models/WellDto'; -import type { WellOperationDto } from '../models/WellOperationDto'; import { request as __request } from '../core/request'; export class WellService { @@ -19,21 +18,6 @@ export class WellService { return result.body; } - /** - * @param idWell - * @returns WellOperationDto Success - * @throws ApiError - */ - public static async getOperations( -idWell: number, -): Promise> { - const result = await __request({ - method: 'GET', - path: `/api/well/${idWell}/operations`, - }); - return result.body; - } - /** * @returns WellDto Success * @throws ApiError