import { ApiClientFactory } from '../core/api.client.factory'; import { SnapshotList, SnapshotPlanReq, SnapshotHistoryReq, SnapshotGroups, SnapshotHistory, CameraDevices, PersonStatisticModel, AttendanceStatisticModel, } from '../model/InspectionSnapshot.model'; import { Pageable } from '../model'; export class InspectionSnapshotService { constructor(private factory: ApiClientFactory) {} /** * @function loadSnapshotList 获取抓拍列表信息 * @param projectId 项目ID */ async loadSnapshotList(projectId: string): Promise { const result = await this.factory.surveillance.get(`/capture/plan`, { projectId }); return result; } /** * @function createSnapshotPlan 创建抓拍计划 */ async createSnapshotPlan(req: SnapshotPlanReq): Promise { const result = await this.factory.surveillance.put(`/capture/plan`, req); return result; } /** * @function deleSnapshotPlan 删除抓拍计划 */ async deleSnapshotPlan(planId: string): Promise { const result = await this.factory.surveillance.delete(`/capture/plan/${planId}`); return result; } /** * @function openSnapshotPlan 开启抓拍计划 */ async openSnapshotPlan(planId: string): Promise { const result = await this.factory.surveillance.post(`/capture/plan/${planId}/on`); return result; } /** * @function closeSnapshotPlan 关闭抓拍计划 */ async closeSnapshotPlan(planId: string): Promise { const result = await this.factory.surveillance.post(`/capture/plan/${planId}/off`); return result; } /** * @function openAllSnapshotPlan 开启全部抓拍计划 */ async openAllSnapshotPlan(projectId: string): Promise { const result = await this.factory.surveillance.post(`/capture/plan/batchOn/${projectId}`); return result; } /** * @function closeAllSnapshotPlan 关闭全部抓拍计划 */ async closeAllSnapshotPlan(projectId: string): Promise { const result = await this.factory.surveillance.post(`/capture/plan/batchOff/${projectId}`); return result; } /** * 获取抓拍时间分组数据 * @param req * @returns */ async loadSnapshotGroup(req: SnapshotHistoryReq, tenantId?:string): Promise { const result = await this.factory.surveillance.get( `${tenantId ? 'tenant' : ''}/inspection/image/group`, req ); return result; } /** * 企业级:获取抓拍时间分组数据 * @param req * @returns */ async loadOrgSnapshotGroup(req: SnapshotHistoryReq): Promise { const result = await this.factory.surveillance.get(`dji/inspection/image/group`, req); return result; } /** * @function loadSnapshotHistoryData 获取抓拍历史数据 */ async loadSnapshotHistoryData(req: SnapshotHistoryReq): Promise { const result = await this.factory.surveillance.get(`inspection/image/history`, req); return result; } /** * 企业级:获取抓拍历史数据 * @param req * @returns */ async loadOrgSnapshotHistoryData(req: SnapshotHistoryReq): Promise { const result = await this.factory.surveillance.get(`dji/inspection/image/history`, req); return result; } /** * @function loadDevicesList 获取摄像头设备列表 */ async loadDevicesList(projectId: string, planType: string, planId?: string): Promise { const result = await this.factory.surveillance.get(`capture/plan/devices`, { projectId, planType, planId, }); return result; } /** * 企业级:获取摄像头设备列表 * @param tenantId * @param orgId * @returns */ async loadOrgDevicesList(tenantId: string, orgId: string): Promise { const result = await this.factory.surveillance.get(`record/tenantDevices`, { tenantId, orgId, }); return result; } /** * @function 上传图片 * @params imageTime 'YYYY-MM-DD HH:mm:ss' */ async uploadImage(deviceId: string, imageUrl: string, imageTime: string) { const result = await this.factory.surveillance.post(`inspection/image/uploadImage`, { deviceId, imageUrl, imageTime, }); return result; } // 巡检抓拍设备列表 async loadCameraListShotsnap(projectId: string): Promise { const url = `/inspection/image/query/device/list`; const result = await this.factory.surveillance.get(url, { projectId }); return result; } /** * 人员抓拍 */ async fetchPersonRecord( projectId: string, params: { pageNo: number; pageSize: number; similarity?: number; stranger?: boolean; enterTrained?: number; fromTime?: string; toTime?: string; } ) { const url = `/person/record/page?projectId=${projectId}`; return await this.factory.surveillance.get>(url, params); } /** * --无感考勤-- * @name 场内统计 */ async personStatistic(projectId: string) { const url = `/person/record/basedOnTheStatistical?projectId=${projectId}`; return await this.factory.surveillance.get(url); } /** * --无感考勤-- * @name 出勤统计 */ async attendanceStatistic(projectId: string, startDate: string, endDate: string) { const url = `/person/record/attendanceDutyAnalysis?projectId=${projectId}`; return await this.factory.surveillance.get(url, { startDate, endDate, }); } /** * 出入摄像机 */ fetchCameraList(projectId: string) { return this.factory.surveillance.get('/person/record/exportDeviceList', { projectId, }); } }