import { ApiClientFactory } from '../core/api.client.factory'; import { CraneDetailInfo, CraneDeviceModel, CraneDriverModel, CraneSimpleInfoList, DeviceSummary, INewLoadAllDevicesParams, DevicePosition, IBorderGuardState, IDevicesMenuList, IEnvItem, IGantryCraneDeviceInfo, IGantryCraneDriverInfo, IGantryCraneDynamicDetailInfo, ISimpleDevice, LmAlarmCategoryData, LmAlarmCategorySecondLevel, LmEquipmentConditionData, LmEquipmentConditionSecondLevel, LmIllegalLiftingData, LmManhourAnalysisData, RealTimeMachineryData, QueryZebraProgress, ZebraProgressParams, UpdataZebraProgress, CarameListFromCraneModel, CarameList, SaveCarameList, ICraneDriverListItem, ICraneDriverBaseInfo, IElevatorDevice, IDriverInfos, TypeStatistical, TypeStatisticalDetail, ModelList, DeviceLocationType, } from '../model/devices.model'; export class DevicesService { constructor(private factory: ApiClientFactory) {} // 获取设备管理中心列表 async loadDevicesMenuList(projectId: string, orgId: string): Promise { const url = `/api/web/projects/${projectId}/deviceConfigMenu`; const devicesMenuList = await this.factory.entity.get(url, { productCode: 'gss', orgId, }); return devicesMenuList; } // 所有设备信息 async loadAllDevices(projectId: string): Promise { const devices = await this.factory.entity.get(`/api/web/projects/${projectId}/entities/devices`); return devices; } // 新的所有设备信息接口 async newLoadAllDevices(projectId: string, params?: INewLoadAllDevicesParams): Promise { const devices = await this.factory.entity.get( `/api/web/projects/${projectId}/iots/devices/briefList`, params ); return devices; } async loadDevicesLocationByType(projectId: string, modelType: string, modelId: string, hasStatus: boolean) { const url = `/api/web/projects/${projectId}/devicelocation/v2/briefList/${modelType}`; const result = await this.factory.entity.get(url, { modelId, hasStatus }); return result as DeviceSummary[]; } async loadDevicesLocation(projectId: string, modelList: ModelList[], hasStatus: boolean) { const url = `/api/web/projects/${projectId}/devicelocation/v2/briefList/more?hasStatus=${hasStatus}`; const result = await this.factory.entity.post(url, modelList); return result as DeviceSummary[]; } async positionDeviceByType( projectId: string, deviceId: string, params: { type: DeviceLocationType; location: any; logoType: number; workAreaId?: string; modelId: string; modelType: string } ) { const url = `/api/web/projects/${projectId}/devicelocation/v2/devices/${deviceId}`; const result = await this.factory.entity.put(url, params); return result.result as any; } // 合成器拖动位置 async updateDevicePosition(projectId: string, deviceId: string, data: DevicePosition): Promise { const result = await this.factory.entity.put( `/api/web/projects/${projectId}/entities/devices/${deviceId}`, data ); return result; } async deletedevicesByType(projectId: string, deviceId: string, locationId: string) { const url = `/api/web/projects/${projectId}/devicelocation/v2/devices/${deviceId}?locationId=${locationId}`; await this.factory.entity.delete(url); } /** * 删除某一设备 * @param projectId * @param deviceId * @param locationType */ async deleteDevices(projectId: string, deviceId: string, locationType: string): Promise { const devices = await this.factory.entity.delete( `/api/web/projects/${projectId}/entities/devices/${deviceId}?locationType=${locationType}` ); return devices; } // 获取指定设备列表信息 async loadSimpleDevices(projectId: string, deviceType?: string): Promise { const devices = await this.factory.entity.get( `/api/web/projects/${projectId}/entities/simpleDevices`, { deviceType, } ); return devices; } // 获取气体设备列表信息 async loadGasDevices(projectId: string, deviceType: string = ''): Promise { const devices = await this.factory.entity.get( `/api/web/projects/${projectId}/entities/getHarmfulGasDevice`, { deviceType, } ); return devices; } /** * 查询塔吊列表 * @param projectId 项目Id */ async loadCranes(projectId: string): Promise { const result = await this.factory.entity.get(`/api/web/projects/${projectId}/cranes`); return result; } /** * 查询塔吊司机信息 * @param projectId 项目Id * @param entityId 塔吊实体Id */ async loadCraneDriver(projectId: string, entityId: string): Promise { const result = await this.factory.entity.get(`/api/web/projects/${projectId}/cranes/${entityId}/driverInfo`); return result; } /** * 保存塔吊司机信息 * @param projectId 项目Id * @param entityId 塔吊实体Id * @param data 塔吊司机数据 */ async postCraneDriver(projectId: string, entityId: string, data: CraneDriverModel): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/cranes/${entityId}/driverInfo`, data ); return result; } /** * 查询塔吊设备信息 * @param projectId 项目Id * @param entityId 塔吊实体Id */ async loadCraneDevice(projectId: string, entityId: string): Promise { const result = await this.factory.entity.get(`/api/web/projects/${projectId}/cranes/${entityId}/deviceInfo`); return result; } /** * 保存塔吊设备信息 * @param project 项目Id * @param entityId 塔吊实体Id * @param data 塔吊设备数据 */ async postCraneDevice(projectId: string, entityId: string, data: CraneDeviceModel): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/cranes/${entityId}/deviceInfo`, data ); return result; } /** * 根据设备类型取设备列表 * @param project 项目Id * @param deviceType 设备类型 */ async getSimpleDeviceList(projectId: string, deviceType?: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/entities/simpleDevices?deviceType=${deviceType}` ); return result; } // 加载临边防护详情弹窗 async loadGuardFenceModalData(projectId: string, deviceObjectId: string): Promise { const result = await this.factory.entity.get(`/api/web/projects/${projectId}/guardFence/statusAndAlarm`, { deviceObjectId, }); return result; } // 获取环境规则列表 async loadEnvConfigRules(projectId: string): Promise { const data = await this.factory.entity.get(`/api/web/projects/${projectId}/deviceEventRule/rules`, { deviceModelType: 'EnvironmentControlEquipment', }); return data; } // 更新环境规则列表(包括新增,删除,修改) async updateEnvConfigRules(projectId: string, ruleId: string, envRuleItem: IEnvItem): Promise { const data = await this.factory.entity.put( `/api/web/projects/${projectId}/deviceEventRule/${ruleId}`, envRuleItem ); return data; } // 重置环境规则 async resetEnvConfigRules(projectId: string): Promise { const data = await this.factory.entity.get( `/api/web/projects/${projectId}/deviceEventRule/initDefaultRule` ); return data; } // 切换当前环境规则的开启关闭状态 async updateEnvConfigRuleStatus(projectId: string, id: string, enable: boolean): Promise { const data = await this.factory.entity.put( `/api/web/projects/${projectId}/deviceEventRule/${id}/enable?enable=${enable}` ); return data as any; } // 智能设备管理 async loadRealTimeMachineryData(projectId: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/customDeviceInfos/all` ); return data as any; } // 塔吊镜像和基本数据 async loadCranesSimpleInfo(projectId: string): Promise { const data = await this.factory.entity.get(`api/web/projects/${projectId}/cranes/simpleInfo`); return data; } // 塔机二级弹窗 async loadCraneDetailInfo(projectId: string, deviceId: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/cranes/allInfo?deviceId=${deviceId}` ); return data; } // 查询周界防护设备状态 async loadBorderGuardState(projectId: string, deviceId: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/aroundProtect/${deviceId}` ); return data; } // 龙门吊======设备信息查询 async loadGantryCraneDeviceDetailInfo(projectId: string, deviceId: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/device/${deviceId}` ); return data; } // 龙门吊======司机信息查询 async loadGantryCraneDriverDetailInfo(projectId: string, deviceId: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/driver/${deviceId}` ); return data; } // 龙门吊======保存设备信息 async postGantryCraneDeviceInfo(projectId: string, data: IGantryCraneDeviceInfo): Promise { return await this.factory.entity.post(`/api/web/projects/${projectId}/gantrycrane/device`, data); } // 龙门吊======保存司机信息 async postGantryCraneDriverInfo(projectId: string, data: IGantryCraneDriverInfo): Promise { return await this.factory.entity.post(`/api/web/projects/${projectId}/gantrycrane/driver`, data); } // 龙门吊======设备基础动态详情动态信息 async loadGantryCraneDynamicDetailInfo(projectId: string, deviceId: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/deviceModel/${deviceId}` ); return data; } // 龙门吊======近三十天违章吊装次数统计 async loadLmIllegalLiftingData(projectId: string, deviceId: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/deviceId/${deviceId}/illegaLiftCount` ); return data; } // 龙门吊======违章吊装次数统计按时间筛选 async loadLmIllegalLiftingByDate(projectId: string, deviceId: string, beginDate: string, endDate: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/deviceId/${deviceId}/illegaLiftCountByDate?beginDate=${beginDate}&endDate=${endDate}` ); return data; } // 龙门吊======工时分析 async loadLmManhourAnalysisData(projectId: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/workTimeAnalyse` ); return data; } // 龙门吊======工时分析按时间筛选 async loadLmManhourAnalysisByDate( projectId: string, beginDate: string, endDate: string ): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/workTimeAnalyseByDate?beginDate=${beginDate}&endDate=${endDate}` ); return data; } // 龙门吊======设备情况汇总 async loadLmEquipmentConditionData(projectId: string): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/deviceStatusCount` ); return data; } // 龙门吊======设备情况汇总二级页面 async loadLmEquipmentConditionSecondLevel( projectId: string, status: string ): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/deviceStatus/${status}/details` ); return data; } // 龙门吊======报警类别分析 async loadLmAlarmCategoryData(projectId: string, deviceId: string, days?: number): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/alarmAnalyse`, { deviceId, days, } ); return data; } // 龙门吊======报警类别分析二级弹框 async loadLmAlarmCategorySecondLevel( projectId: string, deviceId: string, type: string, days?: number, pageIndex?: number, pageSize?: number ): Promise { const data = await this.factory.entity.get( `api/web/projects/${projectId}/gantrycrane/alarmInfo`, { deviceId, days, type, pageIndex, pageSize, } ); return data; } // 斑马进度-同步更新企业空间计划 async loadUpdataZebraProgress(projectId: string): Promise { const result = await this.factory.gssApi.get(`/web/projects/${projectId}/zebraSpace/load`); return result; } // 斑马进度-添加进度计划 async loadAddZebraProgress(projectId: string, params: ZebraProgressParams): Promise { const result = await this.factory.gssApi.post( `/web/projects/${projectId}/zebraMetaInfo/saveOrUpdateZebraProgress`, params ); return result; } // 斑马进度-删除进度计划 async loadDeleteZebraProgress(projectId: string, params: any): Promise { const result = await this.factory.gssApi.delete( `/web/projects/${projectId}/zebraMetaInfo/deleteZebraProgress`, params ); return result; } // 斑马进度-查询进度计划 async loadQueryZebraProgress(projectId: string): Promise { const result = await this.factory.gssApi.get( `/web/projects/${projectId}/zebraMetaInfo/zebraProgresses` ); return result; } // 斑马进度-查询企业计划 async loadQueryEnterpriseProgress(projectId: string, params: any): Promise { const result = await this.factory.gssApi.get( `/web/projects/${projectId}/zebraSpace/maintainZebraProgressListByName`, params ); return result; } // 获取视频列表信息(包含过滤塔吊) async loadCraneCaremaDevices(projectId: string): Promise { const devices = await this.factory.entity.get( `/api/web/projects/${projectId}/entities/devices/camera` ); return devices; } // 获取选中的塔吊对应的视频列表信息 async loadCaremaFromCrane(projectId: string, deviceId: string = ''): Promise { const devices = await this.factory.entity.get( `/api/web/projects/${projectId}/cranes/${deviceId}/cameraInfo` ); return devices; } // 保存塔吊视频列表信息 async saveCaremaFromCrane( projectId: string, deviceId: string = '', caremaList: SaveCarameList[] ): Promise { const devices = await this.factory.entity.post( `/api/web/projects/${projectId}/cranes/${deviceId}/cameraInfo`, caremaList ); return devices; } // 删除塔吊对应的摄像头 async deletearemaFromCrane( projectId: string, deviceId: string = '', caremaId: string ): Promise { const devices = await this.factory.entity.delete( `/api/web/projects/${projectId}/cranes/${deviceId}/cameraInfo/${caremaId}` ); return devices; } // 塔机司机列表 async loadCraneDriverList(projectId: string, deviceId: string): Promise { const drivers = await this.factory.entity.get( `/api/web/projects/${projectId}/cranes/${deviceId}/driverInfos/list` ); return drivers; } // 塔机所有司机列表 async loadAllCraneDriverList(projectId: string): Promise { const drivers = await this.factory.entity.get( `/api/web/projects/${projectId}/cranes/driverInfos/uniqueNameList` ); return drivers; } // 新增塔机司机列表 async addCraneDriver(projectId: string, deviceId: string, driverBaseInfo: ICraneDriverBaseInfo): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/cranes/${deviceId}/driverInfos`, driverBaseInfo ); return result; } // 修改塔机司机列表 async updateCraneDriver( projectId: string, deviceId: string, driverId: string, driverBaseInfo: ICraneDriverBaseInfo ): Promise { const result = await this.factory.entity.put( `/api/web/projects/${projectId}/cranes/${deviceId}/driverInfos/${driverId}`, driverBaseInfo ); return result; } // 查看塔机当前司机信息 async loadCraneDriverStatus(projectId: string, deviceId: string, driverId: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/cranes/${deviceId}/driverInfos/${driverId}` ); return result; } // 删除某个塔吊司机 async deleteCraneDriverStatus(projectId: string, deviceId: string, driverId: string): Promise { const result = await this.factory.entity.delete( `/api/web/projects/${projectId}/cranes/${deviceId}/driverInfos/${driverId}` ); return result; } // 更新塔吊司机顺序 async updateCraneDriverOrder( projectId: string, deviceId: string, driverId: string, direction: string ): Promise { const result = await this.factory.entity.put( `/api/web/projects/${projectId}/cranes/${deviceId}/driverInfos/${driverId}/updateOrder`, { direction, } ); return result; } // 校验司机身份证号 async validateCraneDriverIdCardNo(projectId: string, deviceId: string, idCardNo: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/cranes/${deviceId}/driverInfos/checkIdCardNo?idCardNo=${idCardNo}` ); return result; } // 电梯 - 获取设备信息 async loadElevatorDevice(projectId: string, deviceId: string): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/deviceInfo`; const result = await this.factory.entity.get(url); return result; } // 电梯 - 保存或修改设备信息 async saveEditElevatorDevice(projectId: string, deviceId: string, data: any): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/deviceInfo`; const result = await this.factory.entity.post(url, data); return result; } // 电梯 - 司机列表 async loadDriverInfosList(projectId: string, deviceId: string): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/driverInfos/list`; const result = await this.factory.entity.get(url); return result; } // 电梯 - 新增施工电梯司机 async addDriverInfos(projectId: string, deviceId: string, data: any): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/driverInfos`; const result = await this.factory.entity.post(url, data); return result; } // 电梯 - 修改施工电梯司机 async editDriverInfos(projectId: string, deviceId: string, id: string, data: any): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/driverInfos/${id}`; const result = await this.factory.entity.put(url, data); return result; } // 电梯 - 查看某个司机信息 async loadDriverInfos(projectId: string, deviceId: string, id: string): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/driverInfos/${id}`; const result = await this.factory.entity.get(url); return result; } // 电梯 - 删除某个司机信息 async deleteDriverInfos(projectId: string, deviceId: string, id: string): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/driverInfos/${id}`; const result = await this.factory.entity.delete(url); return result; } // 电梯 - 司机上下移动位置 async updateOrder(projectId: string, deviceId: string, id: string, direction: string): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/driverInfos/${id}/updateOrder`; const result = await this.factory.entity.put(url, { direction: direction }); return result; } // 电梯 - 校验司机信息身份证号 async checkIdCardNo(projectId: string, deviceId: string, idCardNo: string): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/driverInfos/checkIdCardNo?idCardNo=${idCardNo}`; const result = await this.factory.entity.get(url); return result; } // 电梯 - 数字工地模型数据 async loadDeviceModelData(projectId: string, deviceId: string): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/getDeviceModelData`; const result = await this.factory.entity.get(url); return result; } // 电梯 - 数字工地显示司机 async loadElevatorDriverInfo(projectId: string, deviceId: string): Promise { const url = `/api/web/projects/${projectId}/elevator/${deviceId}/firstElevatorDriverInfo`; const result = await this.factory.entity.get(url); return result; } // 巡检情况统计按日按周按月-一级 async getInspectionSituationStatisticalData(projectId: string, period: string): Promise { const url = `/api/web/projects/${projectId}/electronicPatrol/getInspectionSituationStatisticalData`; const result = await this.factory.entity.get(url, { period }); return result; } // 巡检情况统计二级接口 async getInspectionSituationStatisticalDetails( projectId: string, period: string, arrived: string, pageIndex: number, pageSize: number ): Promise { const url = `/api/web/projects/${projectId}/electronicPatrol/getInspectionSituationStatisticalDetails`; const result = await this.factory.entity.get(url, { period, arrived, pageIndex, pageSize, }); return result; } // 巡检占比 async getInspectionSituationRadio(projectId: string, period: string): Promise { const url = `/api/web/projects/${projectId}/electronicPatrol/getInspectionSituationRadio`; const result = await this.factory.entity.get(url, { period }); return result; } // 巡检分类统计 async getInspectionSitTypeStatistical( projectId: string, startTime: number, endTime: number, type: number ): Promise { const url = `/api/web/projects/${projectId}/electronicPatrol/getInspectionClassificationStatisticsData`; const result = await this.factory.entity.get(url, { startTime, endTime, type }); return result; } // 巡检分类统计二级接口 async getInspectionSitTypeStatisticalDetail( projectId: string, startTime: number, endTime: number, type: number ): Promise { const url = `/api/web/projects/${projectId}/electronicPatrol/getInspectionClassificationStatisticsDetails`; const result = await this.factory.entity.get(url, { startTime, endTime, type }); return result; } // AI 设备监测 async getAIMonitorInfo(projectId: string): Promise { const url = `/api/web/projects/${projectId}/ai/monitor/info`; const result = await this.factory.entity.get(url); return result; } }