/* * @Descripttion: * @version: * @Author: congsir * @Date: 2023-02-17 11:00:25 * @LastEditors: Please set LastEditors * @LastEditTime: 2023-09-26 16:18:25 */ import { ApiOptions, ItemList } from '..'; import { ApiClientFactory } from '../core/api.client.factory'; import { Pageable } from '../model/article.model'; import { VideoGroupItem, PoliciesDetailsModel, PullURLModel, PullURLPostModel, SavePoliciesConfigModel, SurveillanceWarningModel, VideoAIEventTypesModel, VideoAIImagesModel, TenantsListModel, ProjectLsitModel, VideoDevicesListModel, TotalTextModel, TotalChartModel, TenantTotalModel, TenantListModel, AIGroupingListModel, AIGroupingSingleListModel, DeviceInfoModel, MetricsType, MetricsModel, EntirePoliciesConfig, VehicleCleaningModel, SensorModel, DeviceEngineering, IscInitData, FetchPullURLPostModel, AiEventType, AiEventSource, AiRealtimeList, AiHistoryList, SensorSettingModel, AIPermissionModel, PoliciesModel, AddDeviceReq, DeleteDeviceReq, CustomLayoutReq, LayoutListReq, CustomLayout, GroupAiHistoryList, AIwarnGroupData, AIwarnGroupRequest, UploadFormData, AlgoConfig, PushedRole, RiskEventParam, EventPushParam, AIEventDealParam, FavoriteDeviceReq, CaseModel, LdjTokenInfo, GboxAiEvent, PresetPointData, VideoGroupItemDevice, YsyAccountInfo, RemoteInsOnlineStatus, RemoteGpsModel, RemoteInsVideoModel, ManualScreenshotObj, SafeEventInfoPostParam, SafeEventInfo, BallCameraDetectModel, YsyLiveList, HikToken, HikDevice, GroupAIHistoryListReq, AiHistoryListReq, videoGroupsReq, DeviceStatusReq, DeviceFlvUrl, GpsDate, EdgeYsyList, AlgoTestReq, WatermaskData, LaborVendorsList, WatermaskStyleData, WatermaskStyleReq, WeatherReq, SpaceInfo, EventHistoryGroupDetailRequest, } from '../model/surveillance.model'; import { CreateCamera, CloudDeviceModel, CategoryList } from '../model/ysConfig.model'; export class SurveillanceServiceClient { constructor(private factory: ApiClientFactory) {} async loadSurveillanceImgEvent(projectId: string, deviceId: string): Promise { const url = `/projects/${projectId}/devices/${deviceId}/event`; const response = await this.factory.surveillance.get(url); return response; } // to remove async loadSurveillanceImgEvent_bak(projectId: string, entityId: string): Promise { const url = `/web/projects/${projectId}/surveillance/${entityId}/event`; const response = await this.factory.surveillance.get(url); return response; } // new added by guopd 2018.11.25 async loadVideoGroups(projectId: string): Promise { const url = `/projects/${projectId}/devices/groups?includeEmpty=false`; const response = await this.factory.surveillance.get(url); return response; } /** * @function loadVideoGroupsIsc 获取ISC设备列表 */ async loadVideoGroupsIsc(objectType: string, objectId: string): Promise { const url = `/api/devices/groups?includeEmpty=false&sourceType=isc`; const response = await this.factory.entity.get(url, { objectType, objectId, }); return response; } /** * 获取设备列表, 2019.9.20,新规则接口 * @param objectType * @param objectId * @param isIncludeGboxDevice true:包含所有蜂鸟盒子设备,默认false:只包含选中蜂鸟盒子设备 */ async loadVideoGroupsByProject( objectType: string, objectId: string, isIncludeGboxDevice: boolean, isIncludeUrlDevice: boolean, online?: boolean ): Promise { const url = `/api/devices/groups?includeEmpty=false`; const response = await this.factory.entity.get(url, { objectType, objectId, isIncludeGboxDevice, isIncludeUrlDevice, online, }); return response; } async loadVideoGroupsByProjectMobile( objectType: string, objectId: string, isIncludeGboxDevice: boolean, isIncludeUrlDevice: boolean ): Promise { const url = `/api/devices/mobile/groups?includeEmpty=false`; const response = await this.factory.entity.get(url, { objectType, objectId, isIncludeGboxDevice, isIncludeUrlDevice, }); return response; } /** * 获取设备列表 * @param objectType * @param objectId * @param includeEmpty false:不包含空的设备分组 * @param isIncludeGboxDevice true:包含所有蜂鸟盒子设备,默认false:只包含选中蜂鸟盒子设备 * @param includeFavorite true:包含收藏夹设备信息,false不包含收藏夹信息 * @param isIncludeUrlDevice true:包含URL视频源,false:不包含 */ async loadDeviceGroupsAndFavorite( objectType: string, objectId: string, userId: string, params: any ): Promise { const url = `/api/v2/devices/groups`; const response = await this.factory.entity.get(url, { objectType, objectId, userId, ...params, }); return response; } async loadVideoGroupByProjectV2(objectType: string, objectId: string, params: any): Promise { const url = `/api/v2/devices/groups`; const response = await this.factory.entity.get(url, { objectType, objectId, ...params, }); return response; } //获取预置点列表 async loadGetpresetpointdata(projectId: string, deviceId: string, deviceIds: string) { const url = `ptz/preset`; const result = await this.factory.surveillance.get(url, { deviceId, deviceIds, projectId, }); return result; } //删除预置点 async loadDeletePresetpointItem(id: string): Promise { const url = `ptz/preset`; const result = await this.factory.surveillance.delete(url + `/${id}`); return result; } // 修改预置点 async addPresetPoint(id: string, projectId: string, deviceId: string, params: object = {}) { const url = `ptz/preset`; const result = await this.factory.surveillance.put(url, { id, projectId, deviceId, ...params }); return result; } /** * @name 添加球机巡航路线 */ async addBallCameraDetect(projectId: string, params: BallCameraDetectModel) { const url = `ballDevice/aiDetect/v2/${projectId}/save`; const result = await this.factory.surveillance.put(url, params); return result; } /** * @name 球机巡航路线-单项|列表 * @params projectId|id?|params? */ async fetchBallCameraDetectList(...args: [string, string, any] | [string, any] | [string]) { const projectId = args[0]; let id, params; if (typeof args[1] === 'string') { id = args[1]; params = args[2]; } else if (args[1] instanceof Object) { id = null; params = args[1]; } const url = `ballDevice/aiDetect/v2/${projectId}/${id || 'list'}`; const result = await this.factory.surveillance.get(url, params); return result; } /** * @name 球机巡航路线-删除 */ async deleteBallCameraDetect(projectId: string, id: string) { const url = `ballDevice/aiDetect/v2/${projectId}/${id}`; const result = await this.factory.surveillance.delete(url); return result; } /** * @name 球机巡航路线-开启 */ async turnOnBallCameraDetect(projectId: string, id: string, status: 'on' | 'off') { const url = `ballDevice/aiDetect/v2/${projectId}/${id}/${status}`; const result = await this.factory.surveillance.post(url); return result; } /** * @name 球机巡航路线-开启 */ async batchTurnOnBallCameraDetect(projectId: string, status: 'batchOn' | 'batchOff') { const url = `ballDevice/aiDetect/v2/${projectId}/${status}`; const result = await this.factory.surveillance.post(url); return result; } /** * 设置默认预置点 * @param id * @returns */ async setDefaultPresetPoint(id: string) { const url = `ptz/preset/default/${id}`; const result = await this.factory.surveillance.put(url); return result; } //同步数据接口(全景照片拼接) async syncData(projectId: string) { const url = `/panorama/stitch/sync?projectId=${projectId}`; const result = await this.factory.surveillance.post(url); return result; } //生成全景图片地址(全景照片拼接) async createPanoramaAddress(id: string) { const url = `/panorama/stitch/makePanorama?id=${id}`; const result = await this.factory.surveillance.put(url); return result; } //视频拼接 //获取视频拼接列表 async loadvideoStitchingList(projectId: string) { const url = `/config/stitch/projects/${projectId}/devices/list`; const result = await this.factory.surveillance.get(url); return result; } //停止合成推流 async stopPushingStream(projectId: string, deviceId: string) { const url = `/config/stitch/projects/${projectId}/devices/stopVideo/${deviceId}`; const result = await this.factory.surveillance.get(url); return result; } // 停止播放(停止流) async stopVideo(projectId: string, deviceId: string) { const url = `/config/stitch/projects/${projectId}/devices/stopVideo/${deviceId}`; const result = await this.factory.surveillance.get(url); return result; } //添加视频拼接设备接口 async loadAddvideoStitching( projectId: string, id: string, name: string, cameraIds: string[], cameraNames: string[], params: object = {} ) { const url = `/config/stitch/projects/${projectId}/devices/ipc`; const result = await this.factory.surveillance.put(url, { id, name, cameraIds, cameraNames, ...params }); return result; } //删除视频拼接接口 async loadDeletevideoStitching(projectId: string, id: string): Promise { const url = `/config/stitch/projects/${projectId}/devices/${id}`; const result = await this.factory.surveillance.delete(url); return result; } /** * 同步设备状态,获取设备列表 * @param objectType * @param objectId * @param isIncludeGboxDevice * @param isIncludeUrlDevice * @param includeFavorite * @param includeEmpty * @param userId */ async syncDeviceGroups(objectType: string, objectId: string, userId: string, params: any): Promise { const url = `/api/v2/devices/groups/syncStatus`; const response = await this.factory.entity.get(url, { objectType, objectId, userId, ...params, }); return response; } // 直播 async fetchPullUrl(data: FetchPullURLPostModel): Promise { const url = `/api/live/addressV2`; const response = await this.factory.entity.post(url, data); return response; } /** * @function localRtspVideoUrl 获取本地播放视频流信息 * @param target rtsp地址 * @param streamPath 发布名称,deviceId * @param streamType 播放方式: http-flv, ws-flv */ async localRtspVideoUrl(target: string, streamPath: string, streamType: string): Promise { const response = await this.factory.localCustom.get(`/rtsp/pull`, { target, streamPath, streamType }); return response; } /** * @function closeRtspVideo 关闭本地播放视频流 * @param stream 发布名称,deviceId */ async closeRtspVideo(stream: string): Promise { const response = await this.factory.localCustom.get(`/stop`, { stream }); return response; } // 截图 async uploadSnapShot( objectType: string, objectId: string, deviceId: string, imageUrl: string, isCustomPicture: boolean = false, userInfo: { userId: string; userName: string; } ) { const url = `/api/devices/image`; const response = await this.factory.entity.put(url, { objectType, objectId, deviceId, url: imageUrl, isCustomPicture, ...userInfo, }); return response; } // 实时查询ai图片 async fetchVideoAiImages( objectType: string, objectId: string, deviceId: string, size: string ): Promise { const url = `/api/events/images/query`; const response = await this.factory.entity.get(url, { objectType, objectId, deviceId, size, }); return response as VideoAIImagesModel[]; } // 查询事件类型 async fetchGetEventTypes(objectType: string, objectId: string): Promise { const url = `/api/events/getEventTypes`; const response = await this.factory.entity.get(url, { objectType, objectId, }); return response; } // end async loadPullUrl(projectId: string, deviceId: string, data: PullURLPostModel): Promise { const url = `/projects/${projectId}/channels/${deviceId}/pullUrl`; const response = await this.factory.surveillance.post(url, data); return response; } // 获取策略详情, 摄像头是否开启AI监测 async loadPoliciesDetails(projectId: string, deviceId: string): Promise { const url = `/projects/${projectId}/policies/${deviceId}`; const response = await this.factory.surveillance.get(url); return response; } // 实时查询ai图片 async loadVideoAiImangs(projectId: string, deviceId: string, size: string): Promise { const url = `/projects/${projectId}/events/images/query?deviceId=${deviceId}&size=${size}`; const response = await this.factory.surveillance.get(url); return response as VideoAIImagesModel[]; } // 查询事件类型 async loadGetEventTypes(projectId: string): Promise { const url = `/projects/${projectId}/events/getEventTypes`; const response = await this.factory.surveillance.get(url); return response; } // 历史查询 async loadQueryHistoryVideoAi( projectId: string, deviceId: string, fromTime: string, toTime: string, eventType: string, pageSize: number, pageNo: number ): Promise> { const url = `/projects/${projectId}/events/images/queryHistory`; const response = await this.factory.surveillance.get>(url, { deviceId, fromTime, toTime, eventType, pageSize, pageNo, }); return response; } // 策略列表 async loadPoliciesList(projectId: string, pageNo: number, pageSize: number): Promise> { const url = `/projects/${projectId}/policies`; const response = await this.factory.surveillance.get>(url, { pageNo, pageSize }); return response; } // 保存策略配置 async loadSavePoliciesConfig(projectId: string, data: SavePoliciesConfigModel): Promise { const url = `/projects/${projectId}/policies/`; const response = await this.factory.surveillance.put(url, data); return response; } // 全局保存配置 async updateEntirePoliciesConfig(projectId: string, data: EntirePoliciesConfig) { const url = `/projects/${projectId}/policies/batchUpdate`; const response = await this.factory.surveillance.post(url, data); return response; } // 批量开启 async batchOn(projectId: string, onoff: 'on' | 'off') { const url = `/projects/${projectId}/policies/${onoff === 'on' ? 'batchOn' : 'batchOff'}`; const response = await this.factory.surveillance.post(url); return response; } // 清空策略配置 async loadDeletePoliciesConfig(projectId: string, deviceId: string): Promise { const url = `/projects/${projectId}/policies/${deviceId}`; const response = await this.factory.surveillance.delete(url); return response; } // 开启 关闭 策略配置 async loadOnOffPolicies(projectId: string, deviceId: string, onoff: string): Promise { const url = `/projects/${projectId}/policies/${deviceId}/${onoff}`; const response = await this.factory.surveillance.post(url); return response; } // 手动同步策略 async loadPoliciesSynchronous(projectId: string): Promise { const url = `/v2/policies/sync/${projectId}`; const response = await this.factory.surveillance.put(url); return response; } // v2 start // 获取列表 async fetchPoliciesList(objectType: string, objectId: string, pageNo: number, pageSize: number) { const url = `/v2/policies`; const response = await this.factory.surveillance.get>(url, { objectType, objectId, pageNo, pageSize, }); return response; } async fetchPolicy(deviceId: string) { const url = `/v2/policies/${deviceId}`; const response = await this.factory.surveillance.get(url); return response; } async updatePolicy(data: PoliciesModel) { const url = `/v2/policies`; const response = await this.factory.surveillance.put(url, data); return response; } async switchPolicy(deviceId: string, todo: 'on' | 'off') { const url = `/v2/policies/${deviceId}/${todo}`; const response = await this.factory.surveillance.post(url); return response; } async deletePolicy(deviceId: string) { const url = `/v2/policies/${deviceId}`; const response = await this.factory.surveillance.delete(url); return response; } // v2 end // 流量统计 START // 获取租户列表 async loadTenantsList(): Promise { const url = `/org/tenants`; const response = await this.factory.surveillance.get(url); return response; } // 获取项目列表 async loadProjectLsit(tenantsId: string): Promise { const url = `/org/tenants/${tenantsId}/projects`; return await this.factory.surveillance.get(url); } // 获取设备列表 async loadVideoDevicesList(tenantsId: string, projectId: string): Promise { const url = `/org/tenants/${tenantsId}/projects/${projectId}/devices`; return await this.factory.surveillance.get(url); } //新增AI预警中心接口 async loadVideoGroupss(param: videoGroupsReq): Promise { const url = `api/v2/events/devices`; const response = await this.factory.entity.get(url, param); return response; } // 同步数据 async loadVideoConfigSynchronous(tenantId: string, projectId: string): Promise { return await this.factory.surveillance.put(`/org/sync?tenantId=${tenantId}&projectId=${projectId}`); } // 上面的显示三个数据 合计 流入 流出 timeType 6h 1d 7d 30d all async loadTotalText( tenantId: string, projectId: string, deviceId: string, timeType: string ): Promise { const url = `/traffic/getTotalData?tenantId=${tenantId}&projectId=${projectId}&deviceId=${deviceId}&timeType=${timeType}`; return await this.factory.surveillance.get(url); } // 流量展示 全部 柱状图数据 async loadTotalChart(tenantId: string, projectId: string, deviceId: string): Promise { const url = `/traffic/getMonthData?tenantId=${tenantId}&projectId=${projectId}&deviceId=${deviceId}`; return await this.factory.surveillance.get(url); } // 流量展示 折线图数据 async loadLineChart( timeType: string, tenantId: string, projectId: string, deviceId: string ): Promise { const url = `/traffic/getData?tenantId=${tenantId}&projectId=${projectId}&deviceId=${deviceId}&timeType=${timeType}`; return await this.factory.surveillance.get(url); } // 流量统计 END // 租户设备管理 START // 统计 async loadTenantTotal(): Promise { const url = `/devices/sum`; return await this.factory.surveillance.get(url); } // 查询 async loadTenantList( tenantId: string, projectId: string, ai: string, status: string, pageNo: number, pageSize: number ): Promise> { const url = `/devices/page`; return await this.factory.surveillance.get>(url, { tenantId, projectId, ai, status, pageNo, pageSize, }); } // 租户设备管理 END // 历史 ai视频分组列表 async loadAiGroupingList( projectId: string, deviceId: string, fromTime: string, toTime: string, eventType: string, pageSize: number, pageNo: number ): Promise> { const url = `/projects/${projectId}/events/images/groups`; return await this.factory.surveillance.get>(url, { deviceId, fromTime, toTime, eventType, pageSize, pageNo, }); } // 历史 ai视频单组查询 async loadAiGroupingSingleList( projectId: string, deviceId: string, fromTime: string, toTime: string, eventType: string, pageSize: number, pageNo: number, groupsId: string ): Promise> { const url = `/projects/${projectId}/events/images/groups/${groupsId}`; return await this.factory.surveillance.get>(url, { deviceId, fromTime, toTime, eventType, pageSize, pageNo, }); } // 巡检抓拍查询 async loadSnapShotList( projectId: string, deviceId: string, fromTime: string, toTime: string, eventType: string, pageSize: number, pageNo: number ): Promise> { const url = `/image/inspection/${projectId}/queryHistory`; return await this.factory.surveillance.get>(url, { deviceId, fromTime, toTime, eventType, pageSize, pageNo, }); } async loadDeviceInfo(projectId: string, deviceId: string): Promise { return await this.factory.surveillance.get(`projects/${projectId}/devices/${deviceId}`); } async fetchDeviceInfo(deviceId: string, objectType: string, objectId: string): Promise { return await this.factory.surveillance.get(`devices/${deviceId}`, { objectType, objectId, }); } // 获取巡检抓拍事件类型 async loadSnapEventTypes(projectId: string): Promise { const url = `/image/inspection/${projectId}/getEventTypes`; const response = await this.factory.surveillance.get(url); return response; } // 获取洗车抓拍事件类型 async loadVehicleCleaningEventTypes(): Promise { const url = `/config/xc/sensors/eventTypes`; const response = await this.factory.surveillance.get(url); return response; } // 洗车抓拍图片查询 async loadVehicleCleaningSnapShotList( projectId: string, deviceId: string, fromTime: string, toTime: string, eventType: string, pageSize: number, pageNo: number ): Promise> { const url = `/xc/image/${projectId}/query`; return await this.factory.surveillance.get>(url, { deviceId, fromTime, toTime, eventType, pageSize, pageNo, }); } // 洗车抓拍传感器配置 async sensorsSetting(data: SensorSettingModel) { const url = `/config/xc/sensors`; return await this.factory.surveillance.put(url, data); } // 获取单个洗车抓拍传感器 async getSensorsInfo(serialNumber: number) { const url = `/config/xc/sensors/${serialNumber}`; return await this.factory.surveillance.get(url); } // 删除洗车抓拍传感器 async deleteSensorsList(serialNumber: number) { const url = `/config/xc/sensors/${serialNumber}`; return await this.factory.surveillance.delete(url); } // 洗车抓拍查询列表 async loadSensorsList(projectId: string) { const url = `/config/xc/sensors/list`; return await this.factory.surveillance.get(url, { projectId, }); } /** * 下发洗车传感器数据 * @param id * @returns */ async sendSensorsData(id: number) { const url = `/config/xc/sensors/gbox/issue?id=${id}`; return await this.factory.surveillance.post(url); } // 跨租户AI策略列表 async loadAIstrategyList( tenantId: string, projectId: string, on: string, pageNo: Number, pageSize: Number ): Promise> { const url = `/v2/admin/ai/policies`; return await this.factory.surveillance.get>(url, { tenantId, projectId, on, pageNo, pageSize, }); } /** * @name 重大事件 */ // 查询接口 async loadAlgoConfig(projectId: string, userId: string): Promise { const url = `/project/${projectId}/algorithmConfig`; return await this.factory.surveillance.get(url, null, { headers: { userId, }, }); } // 查询推送频率 async loadPushRate(projectId: string): Promise { const url = `/project/${projectId}/algorithmConfig/rate`; return await this.factory.surveillance.get(url, { projectId, }); } // 查询接收角色 async loadPushedRole(projectId: string): Promise { const url = `/project/${projectId}/algorithmConfig/role`; return await this.factory.surveillance.get(url, { projectId, }); } // 查询接收人员 async loadUserlist(projectId: string, params: any): Promise { const url = `/project/${projectId}/algorithmConfig/users`; return await this.factory.surveillance.get(url, params); } // 保存配置 async SaveAlgoConfig(projectId: string, param: RiskEventParam | EventPushParam | AIEventDealParam): Promise { const url = `/project/${projectId}/algorithmConfig`; return await this.factory.surveillance.put(url, param); } // AI权限列表 async loadAIPermissionList( tenantId: string, projectId: string, pageNo: Number, pageSize: Number ): Promise> { const url = `/admin/ai/auth/page`; return await this.factory.surveillance.get>(url, { tenantId, projectId, pageNo, pageSize, }); } // 全部事件类型 async loadAllEventType() { const url = `/v2/events/eventTypes/all`; return await this.factory.surveillance.get(url, {}); } /** * 获取所有事件类型包含自定义事件 * @returns */ async loadAllCustomEventType() { const url = `/v2/events/eventTypes/all/v1`; return await this.factory.surveillance.get(url, {}); } /** * @function 管理员_单个项目权限 * @param projectId */ async loadAIPermission(projectId: string): Promise { const url = `/admin/ai/auth`; return await this.factory.surveillance.get(url, { projectId, }); } // 单个项目权限 async loadProjectAIPermission(projectId: string): Promise { const url = `/ai/auth`; return await this.factory.surveillance.get(url, { projectId, }); } // 添加/修改权限 async updateAIPermission(data: AIPermissionModel): Promise { const url = `/admin/ai/auth`; return await this.factory.surveillance.put(url, data); } // 启用/停用项目权限 async switchAIPermission(projectId: string, todo: string): Promise { const url = `/admin/ai/auth/${todo}`; return await this.factory.surveillance.put(url, { projectId, }); } // 指标分类 async loadMetricsCategories(): Promise { const url = `/admin/bi/categories`; return await this.factory.surveillance.get>(url); } // 指标列表 async loadMetricsList(category: string): Promise { const url = `admin/bi/metrics?category=${category}`; return await this.factory.surveillance.get>(url); } // 萤石云列表查询 async loadCloudDevicesList( tenantId: string, projectId: string, deviceSerial: string, status: string, type: string, sourceType: string, pageNo: Number, pageSize: Number ): Promise> { const url = `v2/devices/page`; return await this.factory.surveillance.get>(url, { tenantId, projectId, pageNo, pageSize, sourceType, status, deviceSerial, type, }); } /** * @function loadCategoryList 获取Category信息列表 */ async loadCategoryList(): Promise { const result = await this.factory.surveillance.get(`/system/dict/cameraTypes`); return result; } /** * @function loadDeviceEngineering 获取设备所属的工点信息 */ async loadDeviceEngineering(projectId: string, deviceId: string): Promise { const result = await this.factory.surveillance.get( `/web/projects/${projectId}/workPoint/devices/${deviceId}` ); return result; } /** * @function loadIscInitData 获取ISC初始化信息 */ async loadIscInitData(projectId?: string, tenantId?: string): Promise { const result = await this.factory.surveillance.get(`/video/source/config/isc`, { projectId, tenantId, }); return result; } /** * @function loadAiEventType AI项目事件类型 */ async loadAiEventType(objectType: string, objectId: string): Promise { const result = await this.factory.surveillance.get(`/v2/events/eventTypes`, { objectType, objectId, }); return result; } /** * @function loadAiEventType AI项目事件类型 */ async loadAiEventTypeByDevice(projectId: string, deviceId: string): Promise { const result = await this.factory.surveillance.get(`/v2/events/deviceEventTypes`, { projectId, deviceId, }); return result; } /** * @function loadAiEventSource AI项目开启的事件来源 */ async loadAiEventSource(objectType: string, objectId: string): Promise { const result = await this.factory.surveillance.get(`/v2/events/sources`, { objectType, objectId, }); return result; } /** * @function loadAiRealtimeList AI项目最新事件信息 */ async loadAiRealtimeList( objectType: string, objectId: string, deviceIds: string, size: number, eventTypes: string ): Promise { const result = await this.factory.surveillance.get(`/v2/events/realtime`, { objectType, objectId, deviceIds, size, eventTypes, }); return result; } /** * @function loadAiHistoryList AI项目事件历史数据 */ async loadAiHistoryList(param: AiHistoryListReq): Promise { const result = await this.factory.surveillance.get(`/v2/events/query/history`, param); return result; } /** * @function loadAiHistoryList AI项目事件历史数据-AI待办 */ async loadAiHistoryListBacklog(param: AiHistoryListReq): Promise { const result = await this.factory.surveillance.get(`/safe/backlog/query/history`, param); return result; } /** * @function loadGroupAiHistoryList AI项目事件历史数据-分组查询 */ async loadGroupAiHistoryList(param: GroupAIHistoryListReq): Promise { const result = await this.factory.surveillance.get(`/v2/events/history/group`, param); return result; } /** * @function loadGroupAiHistoryList AI项目事件历史数据-分组查询-AI待办 */ async loadGroupAiHistoryListBacklog(param: GroupAIHistoryListReq): Promise { const result = await this.factory.surveillance.get(`/safe/backlog/history/group`, param); return result; } /** * @function loadGroupAiHistoryList AI项目事件历史数据-分组查询 */ async loadGroupDetailDataList(params: EventHistoryGroupDetailRequest): Promise { const result = await this.factory.surveillance.get(`/v2/events/history/group/detail`, params); return result; } /** * @function loadGroupAiHistoryList AI项目事件历史数据-分组查询-AI待办 */ async loadGroupDetailDataListBacklog( objectId: string, deviceIds: string, pageSize: number, eventTypes: string, fromTime: string, toTime: string, pageNo: number, source: string, statusIds: string ): Promise { const result = await this.factory.surveillance.get(`/safe/backlog/history/group/detail`, { objectId, deviceIds, eventTypes, fromTime, toTime, pageSize, pageNo, source, statusIds, }); return result; } /** * @function AI项目事件查询 * @param id */ async loadAIWarningInfoByID(id: string): Promise { const result = await this.factory.surveillance.get(`/v2/events?eventId=${id}`); return result; } /** * @function ai预警分组批量处理 * @param projectId * @param ids */ async batchUpdateStatus(data: AIwarnGroupData[], request: AIwarnGroupRequest, status: number) { const result = await this.factory.surveillance.put(`/events/group/updateStatus`, { data, request, status, }); return result; } /** * @function ai预警分组批量删除 * @param projectId * @param ids */ async batchGroupDelete(data: AIwarnGroupData[], request: AIwarnGroupRequest) { const result = await this.factory.surveillance.delete(`/events/group/deleteByIds`, { data, request, }); return result; } /** * @function ai预警分组批量下载 * @param projectId * @param ids */ async batchGroupDownload(data: AIwarnGroupData[], request: AIwarnGroupRequest) { const result = await this.factory.surveillance.post(`/events/group/downloadByIds`, { data, request, }); return result; } /** * @function 批量误报 */ async markingError(projectId: string, ids: string[], objectType?: string) { const result = await this.factory.surveillance.put(`/events/markingErrorByIds`, { projectId, ids, objectType, }); return result; } /** * @function 批量误报-AI待办 */ async markingErrorBacklog(projectId: string, ids: string[], objectType?: string) { const result = await this.factory.surveillance.put(`/backlogs/markingErrorByIds`, { projectId, ids, objectType, }); return result; } /** * @function 获取来源列表 */ async fetchDangerItemList(tenantId: string, projectId: string) { const result = await this.factory.surveillance.get(`/v2/events/dangerItem`, { projectId, tenantId, }); return result; } /** * @function 获取责任区域 */ async fetchResponsibleArea(tenantId: string, projectId: string) { const result = await this.factory.surveillance.get(`/v2/events/region`, { projectId, tenantId, }); return result; } /** * @function 获取整改人 */ async fetchResponsiblePerson(tenantId: string, projectId: string) { const result = await this.factory.surveillance.get(`/v2/events/change`, { projectId, tenantId, }); return result; } /** * @function 获取事件详情 */ async fetchInitiateSafeProcess(ids: string[]) { const result = await this.factory.surveillance.post(`/v2/events/initiateSafeProcess`, ids); return result; } /** * @function 批量保存 */ async saveInitiateSafeProcess(data: SafeEventInfo[]) { const result = await this.factory.surveillance.post(`/v2/events/submitSafeProcess`, data); return result; } /** * @function 批量确认 */ async markingConfirmed(projectId: string, ids: string[], objectType?: string) { const result = await this.factory.surveillance.put(`/events/markingConfirmedByIds`, { projectId, ids, objectType, }); return result; } /** * @function 批量未处理 */ async markingUntreated(projectId: string, ids: string[], objectType?: string) { const result = await this.factory.surveillance.put(`/events/markingUntreatedByIds`, { projectId, ids, objectType, }); return result; } /** * @function 批量确认-AI待办 */ async markingConfirmedBacklog(projectId: string, ids: string[], objectType?: string) { const result = await this.factory.surveillance.put(`/backlogs/markingConfirmedByIds`, { projectId, ids, objectType, }); return result; } /** * @function 批量未处理-AI待办 */ async markingUntreatedBacklog(projectId: string, ids: string[], objectType?: string) { const result = await this.factory.surveillance.put(`/backlogs/markingUntreatedByIds`, { projectId, ids, objectType, }); return result; } /** * @function 修改预警结果 */ async detectBadCase(params: CaseModel) { const result = await this.factory.surveillance.post(`/v2/events/detectBadCase`, params); return result; } /** * 添加设备到收藏夹 * @param deviceReq 设备信息 */ async addFavoritesDevice(deviceReq: AddDeviceReq | FavoriteDeviceReq): Promise { const result = await this.factory.surveillance.put(`/devices/favorite/add`, deviceReq); return result; } /** * 取消设备收藏 * @param deviceReq 设备信息 */ async deleteFavoritesDevice(deviceReq: DeleteDeviceReq | FavoriteDeviceReq): Promise { const result = await this.factory.surveillance.put(`/devices/favorite/cancel`, deviceReq); return result; } /** * 添加视频监控布局 * @param customLayoutReq */ async addCustomLayout(customLayoutReq: CustomLayoutReq): Promise { const result = await this.factory.surveillance.put(`/play/layout`, customLayoutReq); return result; } /** * 获取视频监控布局 * @param projectId * @param userId */ async loadCustomLayout(layoutListReq: LayoutListReq): Promise { const result = await this.factory.surveillance.get(`/play/layout`, layoutListReq); return result; } /** * @无人机上传 */ // 获取文件上传剩余空间 async loadSpaceSize(projectId: string) { const url = `/record/spaceSize`; const result = await this.factory.surveillance.get(url, { projectId }); return result as number; } // 获取文件上传剩余空间v2 async loadSpaceSizeV2(projectId: string) { const url = `/record/spaceSizeV2`; return this.factory.surveillance.get(url, { projectId }); } /** * 上传短视频 * @param formData * @param type record无人机 shortVideo延时摄影 */ async uploadSubmit(formData: UploadFormData, type: 'record' | 'shortVideo') { const url = `/${type}/uploadVideo`; const result = await this.factory.surveillance.post(url, formData); return result; } /** * 获取录鼎记安全帽token信息 * @param projectId * @returns */ async loadLdjTokenInfo(projectId: string): Promise { const url = `device/ludingji/tokenAndSession`; const result = await this.factory.surveillance.get(url, { projectId }); return result; } /** * 获取盒子AI事件类型 * @returns */ async loadGboxAiEvent(): Promise { const url = `devices/algo`; const result = await this.factory.surveillance.get(url); return result; } /** * 获取萤石云token信息 * @param projectId * @returns */ async loadYsyTokenInfo(projectId: string): Promise { const url = `ysy/token`; const result = await this.factory.surveillance.get(url, { projectId }); return result; } /** * 远程巡检 */ // 企业级 项目列表 async navigateTreeForRemoteIns( orgId: string, userId: number, params: { statusList: number[]; includedDevice?: boolean; includedIscDevice?: boolean; online?: boolean; mobileIndividual?: boolean; // true单兵 false无人机 } ) { const url = `remoteInspection/org/navigateTree`; const result = await this.factory.surveillance.post(url, { orgId, userId, ...params, }); return result; } /** * 企业远程巡检查询视频列表-new */ async fetchOrgRemoteInsVideo(params: { tenantId?: string; projectIds?: string; pageNo: number; pageSize: number; fromTime?: string; toTime?: string; }) { const url = `remoteInspection/org/videos/page`; const result = await this.factory.surveillance.get>(url, params); return result; } /** * 企业远程巡检查询视频列表-old */ async fetchOrgRemoteInsVideoOld(projectIds: string, fromTime: string, toTime: string) { const url = `remoteInspection/org/videos`; const result = await this.factory.surveillance.get(url, { projectIds, fromTime, toTime }); return result; } /** * 企业单兵无人机设备在线情况 */ async fetchOrgRemoteStatusOnlineStatus(tenantId: string) { const url = `remoteInspection/org/onlineOverview`; const result = await this.factory.surveillance.get(url, { tenantId }); return result; } /** * 项目单兵无人机设备在线情况 */ async fetchPrgRemoteStatusOnlineStatus(projectId: string) { const url = `remoteInspection/project/onlineOverview`; const result = await this.factory.surveillance.get(url, { projectId }); return result; } /** * 项目远程巡检设备 */ async fetchPrjRemoteInsDevices(id: string, objectType: string) { const url = `remoteInspection/${objectType === 'project' ? 'project' : 'org'}/devices`; let params = objectType === 'project' ? { projectId: id, } : { tenantId: id, }; const result = await this.factory.surveillance.get(url, params); return result; } /** * 项目远程巡检 */ async fetchPrjRemoteInsVideo(projectIds: string, fromTime: string, toTime: string) { const url = `remoteInspection/org/videos`; const result = await this.factory.surveillance.get(url, { projectIds, fromTime, toTime }); return result; } /** * 巡检gps列表 */ async fetchRemoteInsGps(id: string, objectType: string) { const url = `gps/latest/${objectType === 'project' ? '' : 'org/'}${id}`; const result = await this.factory.surveillance.get(url); return result; } /** * gps历史数据 */ async fetchRemoteInsGpsHistory( projectId: string, params: { deviceId: string; fromTime: string; toTime: string; pageNo: number; pageSize: number; timeSort?: string; } ) { const url = `/gps/history/mulDegree`; const result = await this.factory.surveillance.get(url, { projectId, ...params }); return result; } /** * 获取某个月哪些日期有巡检记录 * @param projectId * @param params * @returns */ async fetchGpsDate( projectId: string, params: { deviceId: string; dateList: string; } ) { const url = `/gps/history/${projectId}/show`; const result = await this.factory.surveillance.get(url, params); return result; } /** * 删除轨迹坐标 * @param id * @returns */ async deleteGpsPoint(id: string) { const url = `/gps/history/${id}`; const result = await this.factory.surveillance.delete(url); return result; } /** * 手动截图 */ async loadManualScreenshot(params: object): Promise { const url = `/v2/events/manualCapture`; return await this.factory.surveillance.post(url, params); } /** * 新建安全隐患 * @param params */ async saveRetification(params: object) { const result = await this.factory.surveillance.put('/safe/rectification/save', params); return result; } /** * 获取安全认证 * @param tenantId * @returns */ async loadSafeCheck(tenantId: string): Promise { const url = `v2/events/safeCheck/${tenantId}`; return await this.factory.surveillance.get(url); } /** * 获取萤石云设备播放列表 * @param projectId * @returns */ async loadYsyLiveList(projectId: string): Promise { return await this.factory.surveillance.get(`/ysy/live`, { projectId }); } /** * 获取租户下萤石云设备播放列表 * @param tenantId * @returns */ async loadTenantYsyLiveList(tenantId: string): Promise { return await this.factory.surveillance.get(`/ysy/live/tenant`, { tenantId }); } /** * 球机列表 */ async fetchBallCameraList(projectId: string): Promise { const url = `/automatic/capture/devices`; return await this.factory.surveillance.get(url, { projectId, }); } /** * 获取云眸的Token * @param projectId * @returns */ async loadHikToken(projectId: string): Promise { const url = `/hik/live/token`; return await this.factory.surveillance.get(url, { projectId, }); } /** * 获取云眸设备插件播放的信息 * @param deviceId * @returns */ async loadHikDevice(deviceId: string): Promise { const url = `/hik/live/ipc`; return await this.factory.surveillance.get(url, { deviceId, }); } /** * 获取项目下云眸所有设备的播放信息 * @param projectId * @returns */ async loadHikDeviceList(projectId: string): Promise { const url = `/hik/live/devices`; return await this.factory.surveillance.get(url, { projectId, }); } /** * 设备列表带来源 */ fetchDeviceListWithSource(objectType: string, objectId: string, isIncludeGboxDevice: boolean = true) { const url = `/v2/devices/groups/source`; return this.factory.surveillance.get(url, { objectType, objectId, isIncludeGboxDevice, }); } /** * 通用 删除设备 */ deleteDevice(projectId: string, deviceId: string) { return this.factory.surveillance.delete(`/devices/${projectId}/${deviceId}`); } /** * 设置设备状态 * @param param * @returns */ saveDeviceStatus(param: DeviceStatusReq) { return this.factory.surveillance.put(`/device/status`, param); } /** * 获取设备的flv播放地址 * @param projectId * @returns */ loadDeviceFlvUrl(projectId: string): Promise { return this.factory.surveillance.get(`/live/mse/urls`, { projectId }); } /** * @function loadSimulateUrl 获取项目级模拟视频源url * @param projectId */ loadSimulateUrl(projectId: string) { return this.factory.surveillance.get('/mp4/devices/liveUrl/project', { projectId, }); } /** * 获取按不同时间段的模拟视频源url * @param projectId * @returns */ loadSimulateUrlByTime(projectId: string) { return this.factory.surveillance.get('/mp4/devices/liveUrl/projectV2', { projectId, }); } /** * 获取盒子设备与萤石云设备关联列表 * @param projectId * @returns */ loadEdgeAndYsyList(projectId: string): Promise { return this.factory.surveillance.get(`/device/mapping/project/${projectId}`); } /** * 获取盒子设备关联列表 * @param projectId * @returns */ loadEdgeRelationList(projectId: string): Promise { return this.factory.surveillance.get(`/device/mapping/project/${projectId}/include5GCamera`); } /** * 获取企业级盒子设备关联列表 * @param tenantId * @param orgId * @returns */ loadOrgEdgeRelationList(tenantId: string, orgId: string): Promise { return this.factory.surveillance.get(`/device/mapping/org/include5GCamera`, { tenantId, orgId }); } /** * 算法测试 * @param param * @returns */ loadAlgoTest(param: AlgoTestReq): Promise { return this.factory.surveillance.put(`/test/v2/ai/detectV1`, param); } /** * 获取水印的相关数据信息 * @param projectId * @returns */ loadWatermaskData(projectId: string): Promise { return this.factory.surveillance.get(`/watermark/projects/${projectId}`); } /** * 获取天气 * @param param * @returns */ loadWatermaskWeather(projectId: string, param: WeatherReq): Promise { return this.factory.surveillance.get(`/watermark/projects/${projectId}/weather`, param); } /** * 获取分包单位列表 * @param projectId * @returns */ loadLaborVendors(projectId: string): Promise { return this.factory.surveillance.get(`/watermark/projects/${projectId}/laborVendors`); } /** * 获取项目施工楼栋列表 * @param projectId * @returns */ loadQuerySpaceStructure(projectId: string): Promise { return this.factory.surveillance.get(`/watermark/projects/${projectId}/querySpaceStructure`); } /** * 获取水印数据样式 * @param projectId * @returns */ loadWatermaskStyle(projectId: string): Promise { return this.factory.surveillance.get(`/watermark/projects/${projectId}/style`); } /** * 保存水印数据样式 * @param projectId * @returns */ saveWatermaskStyle(projectId: string, param: WatermaskStyleReq): Promise { return this.factory.surveillance.post(`/watermark/projects/${projectId}/style`, param); } }