From 29ce0d781bade912b535364eb9c4ce472bceb7a0 Mon Sep 17 00:00:00 2001 From: goodmice Date: Tue, 23 Nov 2021 12:45:40 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B2=D0=B8=D1=81=D1=8B=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Archive/ArchiveDisplay.jsx | 2 +- src/pages/Archive/index.jsx | 4 +-- src/pages/TelemetryView/MonitoringColumn.jsx | 2 +- src/pages/TelemetryView/index.jsx | 6 ++--- src/services/api/index.ts | 3 +++ src/services/api/models/ClusterRopStatDto.ts | 8 ++++++ .../api/models/TelemetryTimeZoneDto.ts | 9 +++++++ .../services/ClusterOperationStatService.ts | 25 +++++++++++++++++++ src/services/api/services/MessageService.ts | 8 ++++++ src/services/api/services/ReportService.ts | 5 ++++ .../api/services/TelemetryAnalyticsService.ts | 5 ++++ .../api/services/TelemetryDataSaubService.ts | 8 ++++++ .../api/services/TelemetryDataSpinService.ts | 8 ++++++ src/services/api/services/TelemetryService.ts | 22 +++++++++++++++- 14 files changed, 107 insertions(+), 8 deletions(-) create mode 100644 src/services/api/models/ClusterRopStatDto.ts create mode 100644 src/services/api/models/TelemetryTimeZoneDto.ts create mode 100644 src/services/api/services/ClusterOperationStatService.ts diff --git a/src/pages/Archive/ArchiveDisplay.jsx b/src/pages/Archive/ArchiveDisplay.jsx index a370bf1..bcb6020 100644 --- a/src/pages/Archive/ArchiveDisplay.jsx +++ b/src/pages/Archive/ArchiveDisplay.jsx @@ -55,7 +55,7 @@ export const ArchiveDisplay = ({data, startDate, interval, onWheel}) => { style={{ width: '15vw' }} data={chartData} lineGroup={group} - interval={Math.round(interval / 1000)} + interval={interval} headerHeight={'50px'} yStart={startDate} /> diff --git a/src/pages/Archive/index.jsx b/src/pages/Archive/index.jsx index 01de787..2af7596 100644 --- a/src/pages/Archive/index.jsx +++ b/src/pages/Archive/index.jsx @@ -127,7 +127,7 @@ export default function Archive({idWell}) { if (loadingInterval <= 0) return invokeWebApiWrapperAsync( async () => { - const data = await TelemetryDataSaubService.getData(idWell, loadingStartDate.toISOString(), loadingInterval, DATA_COUNT) + const data = await TelemetryDataSaubService.getData(idWell, loadingStartDate.toISOString(), loadingInterval, parseInt(DATA_COUNT * loadingInterval / chartInterval)) const loadedStartDate = new Date(Math.max(+newLoaded.start, +startDate - chartInterval * ADDITIVE_PAGES)) const loadedEndDate = new Date(Math.min(+newLoaded.end, +startDate + chartInterval * (ADDITIVE_PAGES + 1))) @@ -164,7 +164,7 @@ export default function Archive({idWell}) {
Период:  - setChartInterval(parseInt(val) * 1000)} /> + setChartInterval(val * 1000)} />
diff --git a/src/pages/TelemetryView/MonitoringColumn.jsx b/src/pages/TelemetryView/MonitoringColumn.jsx index 7a0c79c..906bf36 100644 --- a/src/pages/TelemetryView/MonitoringColumn.jsx +++ b/src/pages/TelemetryView/MonitoringColumn.jsx @@ -33,7 +33,7 @@ export const MonitoringColumn = ({ lineGroup, data, flowChartData, interval, sho const [dataStore, setDataStore] = useState([]) const [lineGroupWithoutShapes, setLineGroupWithoutShapes] = useState([]) const dataLast = data?.[data.length - 1] - const yStart = new Date(+(dataLast?.date ? new Date(dataLast.date) : new Date()) - interval * 1000 * 0.97) + const yStart = new Date(+(dataLast?.date ? new Date(dataLast.date) : new Date()) - interval * 0.97) const pv = lineGroup.filter(line => line.showLabels).map(line => ({ color: line.color, label: line.label, diff --git a/src/pages/TelemetryView/index.jsx b/src/pages/TelemetryView/index.jsx index 2f23ec2..0da3904 100644 --- a/src/pages/TelemetryView/index.jsx +++ b/src/pages/TelemetryView/index.jsx @@ -16,16 +16,16 @@ import { TelemetryDataSpinService, WellService } from '../../services/api' +import { makeDateSorter } from '../../components/Table' import { invokeWebApiWrapperAsync } from '../../components/factory' +import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker' import MomentStabPicEnabled from '../../images/DempherOn.png' import MomentStabPicDisabled from '../../images/DempherOff.png' import SpinPicEnabled from '../../images/SpinEnabled.png' import SpinPicDisabled from '../../images/SpinDisabled.png' -import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker' import '../../styles/message.css' -import { makeDateSorter } from '../../components/Table' const { Option } = Select @@ -398,7 +398,7 @@ export default function TelemetryView({ idWell }) { data={dataSaub} flowChartData={flowChartData} lineGroup={group} - interval={chartInterval} + interval={chartInterval * 1000} headerHeight={'50px'} showBorder={getIndexOfDrillingBy(dataSaub) === index} /> diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 2a11d14..288bdbe 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -7,6 +7,7 @@ export { OpenAPI } from './core/OpenAPI'; export type { AuthDto } from './models/AuthDto'; export type { ClusterDto } from './models/ClusterDto'; export type { ClusterDtoPaginationContainer } from './models/ClusterDtoPaginationContainer'; +export type { ClusterRopStatDto } from './models/ClusterRopStatDto'; export type { CompanyDto } from './models/CompanyDto'; export type { CompanyDtoPaginationContainer } from './models/CompanyDtoPaginationContainer'; export type { DatesRangeDto } from './models/DatesRangeDto'; @@ -36,6 +37,7 @@ 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 { TelemetryTimeZoneDto } from './models/TelemetryTimeZoneDto'; export type { TelemetryUserDto } from './models/TelemetryUserDto'; export type { UserDto } from './models/UserDto'; export type { UserDtoPaginationContainer } from './models/UserDtoPaginationContainer'; @@ -61,6 +63,7 @@ export { AdminUserRoleService } from './services/AdminUserRoleService'; export { AdminUserService } from './services/AdminUserService'; export { AdminWellService } from './services/AdminWellService'; export { AuthService } from './services/AuthService'; +export { ClusterOperationStatService } from './services/ClusterOperationStatService'; export { ClusterService } from './services/ClusterService'; export { DepositService } from './services/DepositService'; export { DrillFlowChartService } from './services/DrillFlowChartService'; diff --git a/src/services/api/models/ClusterRopStatDto.ts b/src/services/api/models/ClusterRopStatDto.ts new file mode 100644 index 0000000..ed29adb --- /dev/null +++ b/src/services/api/models/ClusterRopStatDto.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ClusterRopStatDto = { + ropMax?: number; + ropAverage?: number; +} diff --git a/src/services/api/models/TelemetryTimeZoneDto.ts b/src/services/api/models/TelemetryTimeZoneDto.ts new file mode 100644 index 0000000..1e9056b --- /dev/null +++ b/src/services/api/models/TelemetryTimeZoneDto.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TelemetryTimeZoneDto = { + hours?: number; + timeZoneId?: string | null; + isOverride?: boolean; +} diff --git a/src/services/api/services/ClusterOperationStatService.ts b/src/services/api/services/ClusterOperationStatService.ts new file mode 100644 index 0000000..a15eb9b --- /dev/null +++ b/src/services/api/services/ClusterOperationStatService.ts @@ -0,0 +1,25 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ClusterRopStatDto } from '../models/ClusterRopStatDto'; +import { request as __request } from '../core/request'; + +export class ClusterOperationStatService { + + /** + * Формирует данные по среднему и максимальному МСП на кусту + * @param idWell id скважины с данного куста (через нее будут полуены данные) + * @returns ClusterRopStatDto Success + * @throws ApiError + */ + public static async getClusterRopStat( + idWell: number, + ): Promise { + const result = await __request({ + method: 'GET', + path: `/api/cluster/${idWell}/ropStat`, + }); + return result.body; + } + +} \ No newline at end of file diff --git a/src/services/api/services/MessageService.ts b/src/services/api/services/MessageService.ts index 09b71d5..1da86dd 100644 --- a/src/services/api/services/MessageService.ts +++ b/src/services/api/services/MessageService.ts @@ -16,6 +16,7 @@ export class MessageService { * @param begin дата начала * @param end окончание * @param searchString Строка поиска + * @param isUtc Даты в формате UTC или часового пояса скважины * @returns MessageDtoPaginationContainer Success * @throws ApiError */ @@ -27,6 +28,7 @@ export class MessageService { begin?: string, end?: string, searchString?: string, + isUtc: boolean = true, ): Promise { const result = await __request({ method: 'GET', @@ -38,6 +40,7 @@ export class MessageService { 'begin': begin, 'end': end, 'searchString': searchString, + 'isUtc': isUtc, }, }); return result.body; @@ -46,15 +49,20 @@ export class MessageService { /** * Выдает список сообщений по скважине * @param idWell id скважины + * @param isUtc Смена дат с UTC формата на часовой пояс скважины * @returns DatesRangeDto Success * @throws ApiError */ public static async getMessagesDateRange( idWell: number, + isUtc: boolean = true, ): Promise { const result = await __request({ method: 'GET', path: `/api/well/${idWell}/message/datesRange`, + query: { + 'isUtc': isUtc, + }, }); return result.body; } diff --git a/src/services/api/services/ReportService.ts b/src/services/api/services/ReportService.ts index cc99805..343ea05 100644 --- a/src/services/api/services/ReportService.ts +++ b/src/services/api/services/ReportService.ts @@ -117,15 +117,20 @@ export class ReportService { /** * Возвращает даты самого старого и самого свежего отчетов в БД * @param idWell id скважины + * @param isUtc Смена дат с UTC формата на часовой пояс скважины * @returns DatesRangeDto Success * @throws ApiError */ public static async getReportsDateRange( idWell: number, + isUtc: boolean = true, ): Promise { const result = await __request({ method: 'GET', path: `/api/well/${idWell}/report/datesRange`, + query: { + 'isUtc': isUtc, + }, }); return result.body; } diff --git a/src/services/api/services/TelemetryAnalyticsService.ts b/src/services/api/services/TelemetryAnalyticsService.ts index d1d2d9f..bd412d8 100644 --- a/src/services/api/services/TelemetryAnalyticsService.ts +++ b/src/services/api/services/TelemetryAnalyticsService.ts @@ -134,15 +134,20 @@ export class TelemetryAnalyticsService { /** * Возвращает даты первой и последней операций на скважине * @param idWell id скважины + * @param isUtc Смена дат с UTC формата на часовой пояс скважины * @returns DatesRangeDto Success * @throws ApiError */ public static async getOperationsDateRange( idWell: number, + isUtc: boolean = true, ): Promise { const result = await __request({ method: 'GET', path: `/api/well/${idWell}/telemetryAnalytics/datesRange`, + query: { + 'isUtc': isUtc, + }, }); return result.body; } diff --git a/src/services/api/services/TelemetryDataSaubService.ts b/src/services/api/services/TelemetryDataSaubService.ts index 0503708..ee6adc1 100644 --- a/src/services/api/services/TelemetryDataSaubService.ts +++ b/src/services/api/services/TelemetryDataSaubService.ts @@ -33,6 +33,7 @@ export class TelemetryDataSaubService { * @param begin дата начала выборки. По умолчанию: текущее время - intervalSec * @param intervalSec интервал времени даты начала выборки, секунды * @param approxPointsCount желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. + * @param isUtc Даты в формате UTC или часового пояса скважины * @returns TelemetryDataSaubDto Success * @throws ApiError */ @@ -41,6 +42,7 @@ export class TelemetryDataSaubService { begin?: string, intervalSec: number = 600, approxPointsCount: number = 1024, + isUtc: boolean = false, ): Promise { const result = await __request({ method: 'GET', @@ -49,6 +51,7 @@ export class TelemetryDataSaubService { 'begin': begin, 'intervalSec': intervalSec, 'approxPointsCount': approxPointsCount, + 'isUtc': isUtc, }, }); return result.body; @@ -57,15 +60,20 @@ export class TelemetryDataSaubService { /** * Возвращает диапазон дат сохраненных данных. * @param idWell id скважины + * @param isUtc Смена дат с UTC формата на часовой пояс скважины * @returns DatesRangeDto Success * @throws ApiError */ public static async getDataDatesRange( idWell: number, + isUtc: boolean = false, ): Promise { const result = await __request({ method: 'GET', path: `/api/TelemetryDataSaub/${idWell}/datesRange`, + query: { + 'isUtc': isUtc, + }, }); return result.body; } diff --git a/src/services/api/services/TelemetryDataSpinService.ts b/src/services/api/services/TelemetryDataSpinService.ts index b01606d..7a0fd7a 100644 --- a/src/services/api/services/TelemetryDataSpinService.ts +++ b/src/services/api/services/TelemetryDataSpinService.ts @@ -33,6 +33,7 @@ export class TelemetryDataSpinService { * @param begin дата начала выборки. По умолчанию: текущее время - intervalSec * @param intervalSec интервал времени даты начала выборки, секунды * @param approxPointsCount желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. + * @param isUtc Даты в формате UTC или часового пояса скважины * @returns TelemetryDataSpinDto Success * @throws ApiError */ @@ -41,6 +42,7 @@ export class TelemetryDataSpinService { begin?: string, intervalSec: number = 600, approxPointsCount: number = 1024, + isUtc: boolean = false, ): Promise { const result = await __request({ method: 'GET', @@ -49,6 +51,7 @@ export class TelemetryDataSpinService { 'begin': begin, 'intervalSec': intervalSec, 'approxPointsCount': approxPointsCount, + 'isUtc': isUtc, }, }); return result.body; @@ -57,15 +60,20 @@ export class TelemetryDataSpinService { /** * Возвращает диапазон дат сохраненных данных. * @param idWell id скважины + * @param isUtc Смена дат с UTC формата на часовой пояс скважины * @returns DatesRangeDto Success * @throws ApiError */ public static async getDataDatesRange( idWell: number, + isUtc: boolean = false, ): Promise { const result = await __request({ method: 'GET', path: `/api/TelemetryDataSpin/${idWell}/datesRange`, + query: { + 'isUtc': isUtc, + }, }); return result.body; } diff --git a/src/services/api/services/TelemetryService.ts b/src/services/api/services/TelemetryService.ts index c00b1c8..405dd97 100644 --- a/src/services/api/services/TelemetryService.ts +++ b/src/services/api/services/TelemetryService.ts @@ -4,6 +4,7 @@ import type { EventDto } from '../models/EventDto'; import type { TelemetryInfoDto } from '../models/TelemetryInfoDto'; import type { TelemetryMessageDto } from '../models/TelemetryMessageDto'; +import type { TelemetryTimeZoneDto } from '../models/TelemetryTimeZoneDto'; import type { TelemetryUserDto } from '../models/TelemetryUserDto'; import { request as __request } from '../core/request'; @@ -12,7 +13,7 @@ export class TelemetryService { /** * Принимает общую информацию по скважине * @param uid Уникальный идентификатор отправителя - * @param requestBody нформация об отправителе + * @param requestBody Информация об отправителе * @returns any Success * @throws ApiError */ @@ -28,6 +29,25 @@ export class TelemetryService { return result.body; } + /** + * Обновляет часовой пояс скважины + * @param uid Уникальный идентификатор отправителя + * @param requestBody Информация о часовом поясе + * @returns any Success + * @throws ApiError + */ + public static async updateTimeZone( + uid: string, + requestBody?: TelemetryTimeZoneDto, + ): Promise { + const result = await __request({ + method: 'POST', + path: `/api/telemetry/${uid}/timeZone`, + body: requestBody, + }); + return result.body; + } + /** * Принимает список новых сообщений от телеметрии * @param uid Уникальный идентификатор отправителя