import { ApiClientFactory } from '../core/api.client.factory'; import { Pageable } from '../model/article.model'; import { VideoGroupItem, VideoGroupItemDevice, PoliciesDetailsModel, PullURLModel, PullURLPostModel, SavePoliciesConfigModel, SurveillanceWarningModel, VideoAIEventTypesModel, VideoAIImangsModel, TenantsListModel, ProjectLsitModel, VideoDevicesListModel, TotalTextModel, TotalChartModel, TenantTotalModel, TenantListModel, AIGroupingListModel, AIGroupingSingleListModel } from '../model/surveillance.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; } async loadPullUrl(projectId: string, channelId: string, data: PullURLPostModel): Promise { const url = `/projects/${projectId}/channels/${channelId}/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 VideoAIImangsModel[]; } // 查询事件类型 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 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 = `/projects/${projectId}/policies/sync`; const response = await this.factory.surveillance.put(url); return response; } // 流量统计 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); } // 同步数据 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 }); } }