import { ApiClientFactory } from '../core/api.client.factory'; import { Pageable } from '../model'; import { FaceConfigDetailModel, FaceData, FaceDataSeachParams, FaceGroupModel, MultiPollingList, MultiPollingParams, SimulationModel, WarnTextList, SimilarityReq, EventConfigurationModel, EventModel, EventListOnModel, EventGroup, } from '../model/aiEventConfig.model'; export class AiEventConfigService { constructor(private factory: ApiClientFactory) {} /** * @function loadWarnTextList 获取预警内容自定义列表 * @param projectId 项目ID */ async loadWarnTextList(projectId: string): Promise { return await this.factory.surveillance.get(`/event/voice/text/list`, { projectId }); } /** * @function editWarnText 修改或重置预警内容 * @param projectId 项目ID */ async editWarnText(projectId: string, warnText: WarnTextList): Promise { return await this.factory.surveillance.put(`/event/voice/text/save/${projectId}`, warnText); } /** * @function sendWarnConfig 下发预警配置 * @param projectId 项目ID */ sendWarnConfig(projectId: string, gatewayId: string, type?: 'v1' | 'v2'): Promise { if (type === 'v2') { return this.factory.surveillance.put(`/edge/v2/syncToBoxV2/${projectId}/${gatewayId}`); } return this.factory.surveillance.put(`/event/voice/text/syncToBox/${projectId}/${gatewayId}`); } // 人脸数据 /** * @function 人脸分组数据 */ async fetchFaceGroupList(projectId: string): Promise { return await this.factory.surveillance.get(`/faceGroup/list?projectId=${projectId}`); } /** * @function 添加分组数据 */ async addFaceGroupData(params: FaceGroupModel): Promise { return await this.factory.surveillance.post(`/faceGroup/save`, params); } /** * @function 删除分组数据 */ async deleteFaceGroupData(id: string): Promise { return await this.factory.surveillance.delete(`/faceGroup/delete?id=${id}`); } /** * @function 人脸数据 */ async fetchFaceDataList(projectId: string, params: FaceDataSeachParams): Promise> { return await this.factory.surveillance.get(`/faceGroupDetail/page?`, { projectId, ...params }); } /** * @function 同步人脸库 */ async syncFaceData(projectId: string, faceGroupId: string): Promise> { return await this.factory.surveillance.post( `/faceGroupDetail/sync?projectId=${projectId}&faceGroupId=${faceGroupId}` ); } /** * @function 添加人脸到分组 */ async addFaceData(params: FaceData): Promise { return await this.factory.surveillance.post(`/faceGroupDetail/save`, params); } /** * @function 删除分组人脸 */ async deleteFaceData(ids: string): Promise { return await this.factory.surveillance.delete(`/faceGroupDetail/batchDel?ids=${ids}`); } // 人脸布控 // 设备状态 async fetchDeviceFaceDataStatus(id: string): Promise { return await this.factory.surveillance.get(`/ysyFace/deviceStatus?deviceId=${id}`); } // 下发 async issueDeviceFaceData(id: string, faceGroupId: string): Promise { return await this.factory.surveillance.get(`/ysyFace/createFdLib?deviceId=${id}&faceGroupId=${faceGroupId}`); } // 构建模型 async buildFaceDataModel(id: string): Promise { return await this.factory.surveillance.get(`/ysyFace/model?deviceId=${id}`); } // 启用 async enableFaceConfig(id: string): Promise { return await this.factory.surveillance.get(`/ysyFace/schedules?deviceId=${id}`); } async fetchFaceConfigDetail(id: string): Promise { return await this.factory.surveillance.get(`/ysyFace/showDetail?deviceId=${id}`); } // 批量 导入 importFaceData(projectId: string, excelUrl: string, faceGroupId: string): Promise { return this.factory.surveillance.post( `/faceGroupDetail/importExcel?excelUrl=${excelUrl}&projectId=${projectId}&faceGroupId=${faceGroupId}` ); } faceExlModelDownload() { return this.factory.surveillance.get('/faceGroupDetail/excelTemplateUrl'); } /** * 下发 */ faceIssue(projectId: string, faceGroupId: string) { return this.factory.surveillance.post( `/faceGroupDetail/issue/face?projectId=${projectId}&faceGroupId=${faceGroupId}` ); } // 事件模拟 // 提交 async sendEventInfo(params: SimulationModel): Promise { return await this.factory.surveillance.post(`/handWorkEvent`, params); } //AI巡检抓拍配置接口 /** * 查询ai巡检配置列表 * @param projectId * @param params 查询参数 * @param isGbox 是否是蜂鸟盒子 */ async loadGetMultiPollingList(projectId: string, params?: MultiPollingParams, isGbox?: boolean): Promise { return await this.factory.surveillance.get( `/aiDetect/v2/${projectId}${isGbox ? '/gbox' : ''}/list`, params ); } /** * 获取盒子路数信息 */ async fetchGboxAlgoNumInfo(projectId: string, id: string): Promise { return await this.factory.surveillance.get(`/aiDetect/v2/${projectId}/gbox/${id}/algoNum`); } // 开启单个 async loadPollingOpenSingle(projectId: string, id: string): Promise { return await this.factory.surveillance.post(`/aiDetect/v2/${projectId}/${id}/on`); } // 关闭单个 async loadPollingCloseSingle(projectId: string, id: string): Promise { return await this.factory.surveillance.post(`/aiDetect/v2/${projectId}/${id}/off`); } // 开启全部 async loadPollingOpenALL(projectId: string, params: any): Promise { return await this.factory.surveillance.post(`/aiDetect/v2/${projectId}/batchOn`, params); } // 关闭全部 async loadPollingOpenCloseAll(projectId: string, params: any): Promise { return await this.factory.surveillance.post(`/aiDetect/v2/${projectId}/batchOff`, params); } // 删除数据 async loadPollingDelete(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`/aiDetect/v2/${projectId}/${id}`); } // 添加数据 async loadPollingAdd(projectId: string, params: object): Promise { return await this.factory.surveillance.put(`/aiDetect/v2/${projectId}/save`, params); } //查看详情 async loadPollingDetails(projectId: string, id: string): Promise { return await this.factory.surveillance.get(`/aiDetect/v2/${projectId}/${id}`); } /** * 设置相似度 * @param projectId * @param option * @returns */ async setSimilarity(projectId: string, option: SimilarityReq): Promise { return await this.factory.surveillance.put(`/config/ysy/projects/${projectId}/devices/ipc`, option); } /** * @name ai巡检抓拍盒子配置同步数据 */ async issueConfigToGbox(projectId: string, id: string) { return await this.factory.surveillance.post(`/aiDetect/v2/${projectId}/gbox/${id}/issue`); } // 事件类型配置 /** * 获取事件 * @param projectId * @param id */ async fetchOrgEventCloudListOn(params: { tenantId?: string; orgId?: string; projectIds?: string }) { return await this.factory.surveillance.get(`/org/eventCloudConfig/listOn`, params); } async fetchEventCloudListOn(projectId: string) { return await this.factory.surveillance.get(`/projects/${projectId}/eventCloudConfig/listOn`); } fetchEventCloudGroup(projectId: string) { return this.factory.surveillance.get(`/user/eventTypes/projectGroups?projectId=${projectId}`); } fetchOrgEventCloudGroup(params: { tenantId?: string; orgId?: string; projectIds?: string }) { return this.factory.surveillance.get(`/user/eventTypes/orgGroups`, params); } fetchEventCloudConfigGroup(projectId: string) { return this.factory.surveillance.get(`/user/eventTypes/projectConfigGroups?projectId=${projectId}`); } fetchEventGroupManual(projectId: string) { return this.factory.surveillance.get(`/user/eventTypes/projectGroupsManual?projectId=${projectId}`); } /** * 获取事件-后台配置 * @param projectId * @param id */ async fetchEventCloudList(projectId: string) { return await this.factory.surveillance.get(`/projects/${projectId}/eventCloudConfig/list`); } /** * 配置事件 * @param projectId * @param id */ async enableEventCloudConfiguration(projectId: string, params: { id: string; on: boolean }) { return await this.factory.surveillance.post(`/projects/${projectId}/eventCloudConfig/update`, params); } /** * 重置 * @param projectId * @param id */ resetEventCloudConf(projectId: string) { return this.factory.surveillance.post(`/projects/${projectId}/eventCloudConfig/reset`); } /** * 网页预警推送 */ /** * 模块列表 */ fetchModulesList(projectId: string) { return this.factory.surveillance.get(`/project/${projectId}/algorithmConfig/modules`); } /** * 开关推送 */ closeEventPush(projectId: string) { return this.factory.surveillance.post(`/project/${projectId}/algorithmConfig/closeEventPush`); } /** * 获取人脸自动下发状态 * @param deviceId * @returns */ fetchAutoSendStatus(deviceId: string) { return this.factory.surveillance.get(`/device/labor/${deviceId}`); } /** * 人脸自动下发开启关闭 * @param param * @returns */ autoSend(param: object) { return this.factory.surveillance.post('/device/labor/sync/on', param); } }