From 0ea895e1f6cfdc47720005dd6a6927dd974b373f Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Tue, 27 Jul 2021 16:51:32 +0500 Subject: [PATCH] =?UTF-8?q?CF2-37:=20=D0=A0=D0=B5=D0=BF=D0=BE=D1=80=D1=82?= =?UTF-8?q?=D1=8B=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=B2=20=D0=BE=D0=B4=D0=BD=D1=83=20=D0=B8=D0=B7=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=82=D0=B5=D0=B3=D0=BE=D1=80=D0=B8=D0=B9=20=D0=94?= =?UTF-8?q?=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Report.jsx | 8 +++- src/services/api/index.ts | 7 +-- .../models/OperationDtoPaginationContainer.ts | 12 ----- ...erationDto.ts => TelemetryOperationDto.ts} | 2 +- ...elemetryOperationDtoPaginationContainer.ts | 12 +++++ ...to.ts => TelemetryOperationDurationDto.ts} | 2 +- src/services/api/models/WellOperationDto.ts | 6 +++ src/services/api/services/AnalyticsService.ts | 46 +++++++++---------- src/services/api/services/DataService.ts | 14 +++--- src/services/api/services/FileService.ts | 20 ++++---- src/services/api/services/MessageService.ts | 12 ++--- src/services/api/services/ReportService.ts | 35 +++++++------- src/services/api/services/WellService.ts | 32 +++++++++++++ 13 files changed, 127 insertions(+), 81 deletions(-) delete mode 100644 src/services/api/models/OperationDtoPaginationContainer.ts rename src/services/api/models/{OperationDto.ts => TelemetryOperationDto.ts} (85%) create mode 100644 src/services/api/models/TelemetryOperationDtoPaginationContainer.ts rename src/services/api/models/{OperationDurationDto.ts => TelemetryOperationDurationDto.ts} (73%) create mode 100644 src/services/api/models/WellOperationDto.ts diff --git a/src/pages/Report.jsx b/src/pages/Report.jsx index 9f48e46..80db6b0 100644 --- a/src/pages/Report.jsx +++ b/src/pages/Report.jsx @@ -133,7 +133,10 @@ export default function Report(props) { let end = rangeDate[1].toISOString() try { - const taskId = await ReportService.createReport(wellId, values.step, values.format, begin, end) + const idUser = localStorage['userId']; + + const taskId = await ReportService.createReport(wellId, + idUser, values.step, values.format, begin, end) if(!taskId) return @@ -191,7 +194,8 @@ export default function Report(props) { let end = rangeDate[1].toISOString() try { setLoader(true) - let suitableReportsResponse = await ReportService.getSuitableReportsNames(wellId, step, format, begin, end) + let suitableReportsResponse = await ReportService.getSuitableReportsNames(wellId, step, format, begin, end) ?? [] + let suitableReports = suitableReportsResponse.map(value => { return { key: value.id, diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 18cdace..452e2b5 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -16,16 +16,17 @@ export type { FilePropertiesDto } from './models/FilePropertiesDto'; export type { FilePropertiesDtoPaginationContainer } from './models/FilePropertiesDtoPaginationContainer'; export type { MessageDto } from './models/MessageDto'; export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer'; -export type { OperationDto } from './models/OperationDto'; -export type { OperationDtoPaginationContainer } from './models/OperationDtoPaginationContainer'; -export type { OperationDurationDto } from './models/OperationDurationDto'; export type { TelemetryInfoDto } from './models/TelemetryInfoDto'; export type { TelemetryMessageDto } from './models/TelemetryMessageDto'; +export type { TelemetryOperationDto } from './models/TelemetryOperationDto'; +export type { TelemetryOperationDtoPaginationContainer } from './models/TelemetryOperationDtoPaginationContainer'; +export type { TelemetryOperationDurationDto } from './models/TelemetryOperationDurationDto'; export type { TelemetryUserDto } from './models/TelemetryUserDto'; export type { UserTokenDto } from './models/UserTokenDto'; export type { WellDepthToDayDto } from './models/WellDepthToDayDto'; export type { WellDepthToIntervalDto } from './models/WellDepthToIntervalDto'; export type { WellDto } from './models/WellDto'; +export type { WellOperationDto } from './models/WellOperationDto'; export type { WellSectionDto } from './models/WellSectionDto'; export type { WellStatDto } from './models/WellStatDto'; diff --git a/src/services/api/models/OperationDtoPaginationContainer.ts b/src/services/api/models/OperationDtoPaginationContainer.ts deleted file mode 100644 index 64fcf00..0000000 --- a/src/services/api/models/OperationDtoPaginationContainer.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { OperationDto } from './OperationDto'; - -export type OperationDtoPaginationContainer = { - skip?: number; - take?: number; - count?: number; - items?: Array | null; -} \ No newline at end of file diff --git a/src/services/api/models/OperationDto.ts b/src/services/api/models/TelemetryOperationDto.ts similarity index 85% rename from src/services/api/models/OperationDto.ts rename to src/services/api/models/TelemetryOperationDto.ts index 9481988..97cb3b5 100644 --- a/src/services/api/models/OperationDto.ts +++ b/src/services/api/models/TelemetryOperationDto.ts @@ -2,7 +2,7 @@ /* tslint:disable */ /* eslint-disable */ -export type OperationDto = { +export type TelemetryOperationDto = { id?: number; name?: string | null; beginDate?: string; diff --git a/src/services/api/models/TelemetryOperationDtoPaginationContainer.ts b/src/services/api/models/TelemetryOperationDtoPaginationContainer.ts new file mode 100644 index 0000000..d09351d --- /dev/null +++ b/src/services/api/models/TelemetryOperationDtoPaginationContainer.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { TelemetryOperationDto } from './TelemetryOperationDto'; + +export type TelemetryOperationDtoPaginationContainer = { + skip?: number; + take?: number; + count?: number; + items?: Array | null; +} \ No newline at end of file diff --git a/src/services/api/models/OperationDurationDto.ts b/src/services/api/models/TelemetryOperationDurationDto.ts similarity index 73% rename from src/services/api/models/OperationDurationDto.ts rename to src/services/api/models/TelemetryOperationDurationDto.ts index 5be7a04..361a705 100644 --- a/src/services/api/models/OperationDurationDto.ts +++ b/src/services/api/models/TelemetryOperationDurationDto.ts @@ -2,7 +2,7 @@ /* tslint:disable */ /* eslint-disable */ -export type OperationDurationDto = { +export type TelemetryOperationDurationDto = { operationName?: string | null; duration?: number; } \ No newline at end of file diff --git a/src/services/api/models/WellOperationDto.ts b/src/services/api/models/WellOperationDto.ts new file mode 100644 index 0000000..2e9fb3c --- /dev/null +++ b/src/services/api/models/WellOperationDto.ts @@ -0,0 +1,6 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type WellOperationDto = { +} \ No newline at end of file diff --git a/src/services/api/services/AnalyticsService.ts b/src/services/api/services/AnalyticsService.ts index 8c52822..21cf3d3 100644 --- a/src/services/api/services/AnalyticsService.ts +++ b/src/services/api/services/AnalyticsService.ts @@ -1,8 +1,8 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { OperationDtoPaginationContainer } from '../models/OperationDtoPaginationContainer'; -import type { OperationDurationDto } from '../models/OperationDurationDto'; +import type { TelemetryOperationDtoPaginationContainer } from '../models/TelemetryOperationDtoPaginationContainer'; +import type { TelemetryOperationDurationDto } from '../models/TelemetryOperationDurationDto'; import type { WellDepthToDayDto } from '../models/WellDepthToDayDto'; import type { WellDepthToIntervalDto } from '../models/WellDepthToIntervalDto'; import { request as __request } from '../core/request'; @@ -11,26 +11,26 @@ export class AnalyticsService { /** * Возвращает список операций на скважине за все время - * @param wellId id скважины + * @param idWell id скважины * @param skip для пагинации кол-во записей пропустить * @param take для пагинации кол-во записей * @param categoryIds список категорий * @param begin дата начала * @param end окончание - * @returns OperationDtoPaginationContainer Success + * @returns TelemetryOperationDtoPaginationContainer Success * @throws ApiError */ public static async getOperationsByWell( -wellId: number, +idWell: number, skip: number, take: number = 32, categoryIds?: Array, begin?: string, end?: string, -): Promise { +): Promise { const result = await __request({ method: 'GET', - path: `/api/analytics/${wellId}/operationsByWell`, + path: `/api/analytics/${idWell}/operationsByWell`, query: { 'skip': skip, 'take': take, @@ -44,36 +44,36 @@ end?: string, /** * Возвращает данные по скважине "глубина-день" - * @param wellId id скважины + * @param idWell id скважины * @returns WellDepthToDayDto Success * @throws ApiError */ public static async getWellDepthToDay( -wellId: number, +idWell: number, ): Promise> { const result = await __request({ method: 'GET', - path: `/api/analytics/${wellId}/wellDepthToDay`, + path: `/api/analytics/${idWell}/wellDepthToDay`, }); return result.body; } /** * Возвращает данные по глубине скважины за период - * @param wellId id скважины + * @param idWell id скважины * @param intervalSeconds количество секунд в необходимом интервале времени * @param workBeginSeconds количество секунд в времени начала смены * @returns WellDepthToIntervalDto Success * @throws ApiError */ public static async getWellDepthToInterval( -wellId: number, +idWell: number, intervalSeconds?: number, workBeginSeconds?: number, ): Promise> { const result = await __request({ method: 'GET', - path: `/api/analytics/${wellId}/wellDepthToInterval`, + path: `/api/analytics/${idWell}/wellDepthToInterval`, query: { 'intervalSeconds': intervalSeconds, 'workBeginSeconds': workBeginSeconds, @@ -84,20 +84,20 @@ workBeginSeconds?: number, /** * Возвращает данные по операциям на скважине "операции-время" - * @param wellId id скважины + * @param idWell id скважины * @param begin дата начала интервала * @param end дата окончания интервала - * @returns OperationDurationDto Success + * @returns TelemetryOperationDurationDto Success * @throws ApiError */ public static async getOperationsSummary( -wellId: number, +idWell: number, begin?: string, end?: string, -): Promise> { +): Promise> { const result = await __request({ method: 'GET', - path: `/api/analytics/${wellId}/operationsSummary`, + path: `/api/analytics/${idWell}/operationsSummary`, query: { 'begin': begin, 'end': end, @@ -108,20 +108,20 @@ end?: string, /** * Возвращает детальные данные по операциям на скважине за период - * @param wellId id скважины + * @param idWell id скважины * @param intervalSeconds количество секунд в необходимом интервале времени * @param workBeginSeconds количество секунд в времени начала смены - * @returns OperationDurationDto Success + * @returns TelemetryOperationDurationDto Success * @throws ApiError */ public static async getOperationsToInterval( -wellId: number, +idWell: number, intervalSeconds?: number, workBeginSeconds?: number, -): Promise> { +): Promise> { const result = await __request({ method: 'GET', - path: `/api/analytics/${wellId}/operationsToInterval`, + path: `/api/analytics/${idWell}/operationsToInterval`, query: { 'intervalSeconds': intervalSeconds, 'workBeginSeconds': workBeginSeconds, diff --git a/src/services/api/services/DataService.ts b/src/services/api/services/DataService.ts index 38d648a..cbc7f1c 100644 --- a/src/services/api/services/DataService.ts +++ b/src/services/api/services/DataService.ts @@ -10,22 +10,22 @@ export class DataService { /** * Возвращает данные САУБ по скважине. * По умолчанию за последние 10 минут. - * @param wellId id скважины + * @param idWell id скважины * @param begin дата начала выборки. По умолчанию: текущее время - intervalSec * @param intervalSec интервал времени даты начала выборки, секунды - * @param approxPointsCount жела��мое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. + * @param approxPointsCount желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. * @returns DataSaubBaseDto Success * @throws ApiError */ public static async getData( -wellId: number, +idWell: number, begin?: string, intervalSec: number = 600, approxPointsCount: number = 1024, ): Promise> { const result = await __request({ method: 'GET', - path: `/api/well/${wellId}/data`, + path: `/api/well/${idWell}/data`, query: { 'begin': begin, 'intervalSec': intervalSec, @@ -36,16 +36,16 @@ approxPointsCount: number = 1024, } /** - * @param wellId + * @param idWell * @returns DatesRangeDto Success * @throws ApiError */ public static async getDataDatesRange( -wellId: number, +idWell: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/well/${wellId}/dataDatesRange`, + path: `/api/well/${idWell}/dataDatesRange`, }); return result.body; } diff --git a/src/services/api/services/FileService.ts b/src/services/api/services/FileService.ts index 60af0b4..949f09e 100644 --- a/src/services/api/services/FileService.ts +++ b/src/services/api/services/FileService.ts @@ -8,7 +8,7 @@ export class FileService { /** * Сохраняет переданные файлы и информацию о них - * @param wellId id скважины + * @param idWell id скважины * @param idCategory id категории файла * @param idUser id отправившего файл пользователя * @param requestBody @@ -16,14 +16,14 @@ export class FileService { * @throws ApiError */ public static async saveFiles( -wellId: number, +idWell: number, idCategory?: number, idUser?: number, requestBody?: any, ): Promise { const result = await __request({ method: 'POST', - path: `/api/files/${wellId}/files`, + path: `/api/files/${idWell}/files`, query: { 'idCategory': idCategory, 'idUser': idUser, @@ -34,8 +34,8 @@ requestBody?: any, } /** - * Возвращает информацию о файлах для сква��ины в выбраной категории - * @param wellId id скважины + * Возвращает информацию о файлах для скважины в выбраной категории + * @param idWell id скважины * @param skip для пагинации кол-во записей пропустить * @param take для пагинации кол-во записей взять * @param idCategory id категории файла @@ -45,7 +45,7 @@ requestBody?: any, * @throws ApiError */ public static async getFilesInfo( -wellId: number, +idWell: number, skip: number, take: number = 32, idCategory: number, @@ -54,7 +54,7 @@ end?: string, ): Promise { const result = await __request({ method: 'GET', - path: `/api/files/${wellId}`, + path: `/api/files/${idWell}`, query: { 'skip': skip, 'take': take, @@ -68,18 +68,18 @@ end?: string, /** * Возвращает файл с диска на сервере - * @param wellId id скважины + * @param idWell id скважины * @param fileId id запрашиваемого файла * @returns string Success * @throws ApiError */ public static async getFile( -wellId: number, +idWell: number, fileId: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/files/${wellId}/${fileId}`, + path: `/api/files/${idWell}/${fileId}`, }); return result.body; } diff --git a/src/services/api/services/MessageService.ts b/src/services/api/services/MessageService.ts index 5becc7c..fa951fa 100644 --- a/src/services/api/services/MessageService.ts +++ b/src/services/api/services/MessageService.ts @@ -9,7 +9,7 @@ export class MessageService { /** * Выдает список сообщений по скважине - * @param wellId id скважины + * @param idWell id скважины * @param skip для пагинации кол-во записей пропустить * @param take для пагинации кол-во записей * @param categoryids список категорий @@ -19,7 +19,7 @@ export class MessageService { * @throws ApiError */ public static async getMessage( -wellId: number, +idWell: number, skip: number, take: number = 32, categoryids?: Array, @@ -28,7 +28,7 @@ end?: string, ): Promise { const result = await __request({ method: 'GET', - path: `/api/well/${wellId}/message`, + path: `/api/well/${idWell}/message`, query: { 'skip': skip, 'take': take, @@ -41,16 +41,16 @@ end?: string, } /** - * @param wellId + * @param idWell * @returns DatesRangeDto Success * @throws ApiError */ public static async getMessagesDateRange( -wellId: number, +idWell: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/well/${wellId}/messagesDatesRange`, + path: `/api/well/${idWell}/messagesDatesRange`, }); return result.body; } diff --git a/src/services/api/services/ReportService.ts b/src/services/api/services/ReportService.ts index e02c282..8a6cb5b 100644 --- a/src/services/api/services/ReportService.ts +++ b/src/services/api/services/ReportService.ts @@ -8,7 +8,8 @@ export class ReportService { /** * Создает отчет по скважине с указанными параметрами - * @param wellId id скважины + * @param idWell id скважины + * @param idUser id пользователя * @param stepSeconds шаг интервала * @param format формат отчета (0-PDF, 1-LAS) * @param begin дата начала интервала @@ -17,7 +18,8 @@ export class ReportService { * @throws ApiError */ public static async createReport( -wellId: number, +idWell: number, +idUser?: number, stepSeconds?: number, format?: number, begin?: string, @@ -25,8 +27,9 @@ end?: string, ): Promise { const result = await __request({ method: 'POST', - path: `/api/report/${wellId}/report`, + path: `/api/report/${idWell}/report`, query: { + 'idUser': idUser, 'stepSeconds': stepSeconds, 'format': format, 'begin': begin, @@ -38,18 +41,18 @@ end?: string, /** * Возвращает файл-отчет с диска на сервере - * @param wellId id скважины + * @param idWell id скважины * @param reportName имя запрашиваемого файла (отчета) * @returns string Success * @throws ApiError */ public static async getReport( -wellId: number, +idWell: number, reportName: string, ): Promise { const result = await __request({ method: 'GET', - path: `/api/report/${wellId}/${reportName}`, + path: `/api/report/${idWell}/${reportName}`, }); return result.body; } @@ -57,7 +60,7 @@ reportName: string, /** * Возвращает имена отчетов, хранящихся на диске, * которые подходят под указанные параметры - * @param wellId id скважины + * @param idWell id скважины * @param stepSeconds шаг интервала * @param format формат отчета (0-PDF, 1-LAS) * @param begin дата начала интервала @@ -66,7 +69,7 @@ reportName: string, * @throws ApiError */ public static async getSuitableReportsNames( -wellId: number, +idWell: number, stepSeconds?: number, format?: number, begin?: string, @@ -74,7 +77,7 @@ end?: string, ): Promise> { const result = await __request({ method: 'GET', - path: `/api/report/${wellId}/suitableReports`, + path: `/api/report/${idWell}/suitableReports`, query: { 'stepSeconds': stepSeconds, 'format': format, @@ -87,7 +90,7 @@ end?: string, /** * Возвращает прогнозируемое количество страниц будущего отчета - * @param wellId id скважины + * @param idWell id скважины * @param stepSeconds шаг интервала * @param format формат отчета (0-PDF, 1-LAS) * @param begin дата начала интервала @@ -96,7 +99,7 @@ end?: string, * @throws ApiError */ public static async getReportSize( -wellId: number, +idWell: number, stepSeconds?: number, format?: number, begin?: string, @@ -104,7 +107,7 @@ end?: string, ): Promise { const result = await __request({ method: 'GET', - path: `/api/report/${wellId}/reportSize`, + path: `/api/report/${idWell}/reportSize`, query: { 'stepSeconds': stepSeconds, 'format': format, @@ -116,17 +119,17 @@ end?: string, } /** - * Возвра��ает даты самого старого и самого свежего отчетов в БД - * @param wellId id скважины + * Возвращает даты самого старого и самого свежего отчетов в БД + * @param idWell id скважины * @returns DatesRangeDto Success * @throws ApiError */ public static async getReportsDateRange( -wellId: number, +idWell: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/report/${wellId}/reportsDatesRange`, + path: `/api/report/${idWell}/reportsDatesRange`, }); return result.body; } diff --git a/src/services/api/services/WellService.ts b/src/services/api/services/WellService.ts index 42f08a6..a12772e 100644 --- a/src/services/api/services/WellService.ts +++ b/src/services/api/services/WellService.ts @@ -2,6 +2,8 @@ /* tslint:disable */ /* eslint-disable */ import type { WellDto } from '../models/WellDto'; +import type { WellOperationDto } from '../models/WellOperationDto'; +import type { WellSectionDto } from '../models/WellSectionDto'; import { request as __request } from '../core/request'; export class WellService { @@ -18,6 +20,36 @@ export class WellService { return result.body; } + /** + * @param idWell + * @returns WellSectionDto Success + * @throws ApiError + */ + public static async getSections( +idWell: number, +): Promise> { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/sections`, + }); + 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