import { Injectable } from '@angular/core'; import { Global } from './global.service'; import { HttpHandler } from './httpHandler.service'; @Injectable() export class ApiService { constructor(private httpHandler: HttpHandler, private global: Global) {} // 未绑定网关列表 getUnbindGateway(data: any): Promise { return this.httpHandler.post( Global.getApiHost().api + 'deviceInfo/searchUnbind?page=' + data.page + '&size=' + data.size, data, this.global.getHeader() ); } // 网关查询单位 findById(id: any): Promise { return this.httpHandler.get(Global.getApiHost().api + 'gatewayInfo/findById/' + id, this.global.getHeader()); } // 全部设备类型 findAllDeviceType(): Promise { return this.httpHandler.get(Global.getApiHost().api + 'deviceInfo/findAllDeviceType', this.global.getHeader()); } // id查询设备 deviceFindById(id: any): Promise { return this.httpHandler.get(Global.getApiHost().api + 'deviceInfo/findById/' + id, this.global.getHeader()); } // 单位详情 findOrgById(id: any): Promise { return this.httpHandler.get(Global.getApiHost().api + 'orgInfo/findById/' + id, this.global.getHeader()); } // 建筑信息 orgBuildInfo(id: any): Promise { return this.httpHandler.get(Global.getApiHost().api + 'orgBuildInfo/findById/' + id, this.global.getHeader()); } // 绑定历史 getbindHistory(data: any): Promise { return this.httpHandler.get(Global.getApiHost().api + 'gatewayInfo/findAllBindLog', this.global.getHeader()); } // 单位列表 getOrgList(data: any): Promise { return this.httpHandler.post( Global.getApiHost().api + 'orgInfo/search?page=' + data.page + '&size=' + data.size, data, this.global.getHeader() ); } // 单位添加 addOrg(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'orgInfo/create', data, this.global.getHeader()); } // 单位编辑 updateOrg(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'orgInfo/update', data, this.global.getHeader()); } // 单位删除 deleteOrg(id: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'orgInfo/delete/' + id, this.global.getHeader()); } // 运营中心列表 getOperationList(): Promise { return this.httpHandler.get(Global.getApiHost().api + 'operateInfo/findAll', this.global.getHeader()); } // 运营中心添加 addOperation(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'operateInfo/create', data, this.global.getHeader()); } // 运营中心编辑 updateOperation(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'operateInfo/update', data, this.global.getHeader()); } // 运营中心删除 deleteOperation(id: number): Promise { return this.httpHandler.post(Global.getApiHost().api + 'operateInfo/remove/' + id, this.global.getHeader()); } // 网关单位绑定 bindGateway(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'gatewayInfo/bind', data, this.global.getHeader()); } // 获取点位 getDevice(data: any) { return this.httpHandler.post( Global.getApiHost().api + 'deviceInfo/searchBindedDTO?page=' + data.page + '&size=' + data.size, data, this.global.getHeader() ); } //警情实时报警 getWireless(data: any) { return this.httpHandler.post( Global.getApiHost().api + 'fireAlarm/search?page=' + data.page + '&size=' + data.size, data, this.global.getHeader() ); } //警情确认 bacthCheck(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'situation/batchCheck', data, this.global.getHeader()); } // 隔离 batchIsolate(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'situation/batchIsolate', data, this.global.getHeader()); } // 解除隔离 batchIsolateCancel(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'situation/batchIsolateCancel', data, this.global.getHeader()); } // 风险源单位列表 getOrgRiskSource(id: any): Promise { return this.httpHandler.get(Global.getApiHost().api + 'orgRiskSource/findByOrgId//' + id, this.global.getHeader()); } //添加风险源 createRiskSource(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'orgRiskSource/create', data, this.global.getHeader()); } // 风险源列表 getRiskSourceAll(): Promise { return this.httpHandler.get(Global.getApiHost().api + 'riskSource/findAll', this.global.getHeader()); } // 单位账号列表 getAccountList(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'account/searchDTO', data, this.global.getHeader()); } // 创建账号 createAccount(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'account/create', data, this.global.getHeader()); } // 角色查询 charactarSearch(): Promise { return this.httpHandler.post(Global.getApiHost().api + 'charactar/searchList', this.global.getHeader()); } // 公司联系人 orgContactInfo(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'orgContactInfo/searchDTOList', data, this.global.getHeader()); } // 查询规则 searchLevel(data = {}): Promise { return this.httpHandler.post(Global.getApiHost().api + 'notifyRule/searchLevel', data, this.global.getHeader()); } //创建规则 createLevel(data = {}): Promise { return this.httpHandler.post(Global.getApiHost().api + 'notifyRule/createLevel', data, this.global.getHeader()); } orgContactInfoCreate(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'orgContactInfo/create', data, this.global.getHeader()); } // 告警 searchFireAlarm(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'situation/searchFireAlarmDTO', data, this.global.getHeader()); } // 预警 searchFireWarn(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'situation/searchFireWarnDTO', data, this.global.getHeader()); } // 故障 searchDeviceFault(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'situation/searchDeviceFaultDTO', data, this.global.getHeader()); } // 事件 searchDeviceEvent(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'situation/searchDeviceEventDTO', data, this.global.getHeader()); } // 报受操作日志接口 processLogSearch(data: any): Promise { return this.httpHandler.post( Global.getApiHost().api + 'processLog/search?page=' + data.page + '&size=' + data.size, data, this.global.getHeader() ); } //推送设置规则集 notifyRuleSearchList(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'orgInfo/searchForNotifyRule', data, this.global.getHeader()); } // 所有设备字典 equipmentInfoFindAll() { return this.httpHandler.get(Global.getApiHost().api + 'equipmentInfo/findAll', this.global.getHeader()); } // 编辑设备字典 equipmentInfoUpdate(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'equipmentInfo/update', data, this.global.getHeader()); } // 创建设备字典 equipmentInfoCreate(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'equipmentInfo/create', data, this.global.getHeader()); } // 所有设备字典 riskSourceFindAll() { return this.httpHandler.get(Global.getApiHost().api + 'riskSource/findAll', this.global.getHeader()); } // 编辑设备字典 riskSourceUpdate(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'riskSource/update', data, this.global.getHeader()); } // 创建设备字典 riskSourceCreate(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'riskSource/create', data, this.global.getHeader()); } // 根据事件查询日志 processLogSearchList(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'processLog/searchList', data, this.global.getHeader()); } // 站内信 informSearch(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'inform/search', data, this.global.getHeader()); } // 站内信已读 informMarkRead(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'inform/markRead', data, this.global.getHeader()); } // 添加规则集 createNotifyRuleSet(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'notifyRule/createNotifyRuleSet', data, this.global.getHeader()); } updateLevel(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'notifyRule/updateLevel', data, this.global.getHeader()); } updateSet(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'notifyRule/updateSet', data, this.global.getHeader()); } // 查询规则集 notifyRuleSearchSetList(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'notifyRule/searchSetList', data, this.global.getHeader()); } // 合同列表 contractInfoSearch(data: any) { return this.httpHandler.post(Global.getApiHost().api + 'contractInfo/searchDTO', data, this.global.getHeader()); } login(loginInfo: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'account/login', loginInfo, this.global.getHeader()); } filterData(obj: any) { for (let key in obj) { if (((!obj[key] && obj[key] !== 0) || obj[key] == -1 || obj[key] == '-1') && obj[key] !== false && obj[key] !== 'false') { delete obj[key]; } } return obj; } uploadFile(data: any): Promise { return this.httpHandler.post(Global.getApiHost().api + 'fileUpload/uploadByFormData', data, this.global.getHeader()); } }