| | |
| | | import com.google.gson.Gson; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.config.RealtimeServerBean; |
| | | import com.sandu.ximon.admin.entity.*; |
| | | import com.sandu.ximon.admin.param.PoleBindingParam; |
| | |
| | | import com.sandu.ximon.admin.utils.FileUtil; |
| | | import com.sandu.ximon.admin.utils.HtmlTemplateUtils; |
| | | import com.sandu.ximon.admin.utils.LightemitUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.vo.EquipmentInfomation; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.domain.PoleLightemitEntity; |
| | | import com.sandu.ximon.dao.enums.PoleBindingEnums; |
| | | import com.sandu.ximon.dao.mapper.PoleLightemitEntityMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | } else { |
| | | poleLightemitEntityList = poleLightemitDao.listLed(keyword, SecurityUtils.getUserId()); |
| | | } |
| | | if (isOnLine) { |
| | | return ledOnline(poleLightemitEntityList); |
| | | } else { |
| | | ledOnlineCheck(poleLightemitEntityList); |
| | | return poleLightemitEntityList; |
| | | |
| | | List<PoleLightemitEntity> temp = new ArrayList<>(); |
| | | for (PoleLightemitEntity poleLightemitEntity : poleLightemitEntityList) { |
| | | //查询设备在线状态 |
| | | boolean onLine = lightemitUtils.getLedOnLine(poleLightemitEntity.getLightemitControlCode()); |
| | | //查询屏幕的开启状态 |
| | | String isOpen = lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode()); |
| | | poleLightemitEntity.setIsOpen(String.valueOf(isOpen)); |
| | | poleLightemitEntity.setOnLine(onLine); |
| | | if (!isOnLine || onLine) { |
| | | temp.add(poleLightemitEntity); |
| | | } |
| | | } |
| | | return temp; |
| | | } |
| | | |
| | | /** |
| | | * 取出在线的熙讯 |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public List<PoleLightemitEntity> ledOnline(List<PoleLightemitEntity> list) { |
| | | List<PoleLightemitEntity> onLineList = new ArrayList<>(); |
| | | for (PoleLightemitEntity poleLightemitEntity : list) { |
| | | poleLightemitEntity.setIsOpen(lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode()).contains("true")); |
| | | if (poleLightemitEntity.getIsOpen()) { |
| | | // if(lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode()).contains("true")){ |
| | | // poleLightemitEntity.setIsOpen(lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode()).contains("true")); |
| | | // } |
| | | poleLightemitEntity.setIsOpen(lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode())); |
| | | boolean ledOnLine = lightemitUtils.getLedOnLine(poleLightemitEntity.getLightemitControlCode()); |
| | | if (ledOnLine) { |
| | | poleLightemitEntity.setOnLine(true); |
| | | onLineList.add(poleLightemitEntity); |
| | | } else { |
| | | poleLightemitEntity.setOnLine(false); |
| | | } |
| | | } |
| | | return onLineList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置在线状态 |
| | | * |
| | | * @param list |
| | | */ |
| | | public void ledOnlineCheck(List<PoleLightemitEntity> list) { |
| | | for (PoleLightemitEntity poleLightemitEntity : list) { |
| | | poleLightemitEntity.setIsOpen(lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode()).contains("true")); |
| | | |
| | | poleLightemitEntity.setIsOpen(lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode())); |
| | | poleLightemitEntity.setOnLine(lightemitUtils.getLedOnLine(poleLightemitEntity.getLightemitControlCode())); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public PoleLightemitEntity getLedByLightControlCode(String lightControlCode) { |
| | | PoleLightemitEntity xiXun = getOne(Wrappers.lambdaQuery(PoleLightemitEntity.class).eq(PoleLightemitEntity::getLightemitControlCode, lightControlCode)); |
| | | Pole getpole = poleLightemitDao.getpole(lightControlCode); |
| | | if (xiXun == null) { |
| | | return null; |
| | | } |
| | | String isScreenOpen = lightemitUtils.getIsScreenOpen(xiXun.getLightemitControlCode()); |
| | | if (isScreenOpen.contains("true")) { |
| | | xiXun.setIsOpen(true); |
| | | } |
| | | xiXun.setIsOpen(false); |
| | | boolean isScreenOpen = lightemitUtils.getLedOnLine(xiXun.getLightemitControlCode()); |
| | | |
| | | xiXun.setIsOpen(lightemitUtils.getIsScreenOpen(lightControlCode)); |
| | | xiXun.setOnLine(isScreenOpen); |
| | | xiXun.setStreetlightName(getpole.getPoleName()); |
| | | xiXun.setStreetlightId(getpole.getId()); |
| | | |
| | | return xiXun; |
| | | } |
| | | |
| | | /** |
| | | * 首页灯杆绑定信息 |
| | | */ |
| | | public EquipmentInfomation getLedByLightControlCodeInfo(String lightControlCode) { |
| | | EquipmentInfomation equipmentInfo = new EquipmentInfomation(); |
| | | equipmentInfo.setEquipmentType("熙讯LED"); |
| | | if (lightControlCode == null || lightControlCode.trim().length() == 0) { |
| | | return equipmentInfo; |
| | | } |
| | | |
| | | PoleLightemitEntity xiXun = getOne(Wrappers.lambdaQuery(PoleLightemitEntity.class).eq(PoleLightemitEntity::getLightemitControlCode, lightControlCode)); |
| | | if (xiXun != null) { |
| | | equipmentInfo.setEquipmentCreateTime(xiXun.getCreateTime()); |
| | | equipmentInfo.setEquipmentMac(xiXun.getLightemitControlCode()); |
| | | equipmentInfo.setEquipmentName(xiXun.getLightemitName()); |
| | | } |
| | | boolean isScreenOpen = lightemitUtils.getLedOnLine(xiXun.getLightemitControlCode()); |
| | | if (isScreenOpen) { |
| | | equipmentInfo.setEquipmentState("在线"); |
| | | } else { |
| | | equipmentInfo.setEquipmentState("离线"); |
| | | } |
| | | |
| | | return equipmentInfo; |
| | | } |
| | | |
| | | |
| | |
| | | poleBindingParam.setDeviceName(poleLightemit.getLightemitName()); |
| | | poleBindingService.bindPole(poleLightemit.getPoleId(), poleBindingParam); |
| | | } |
| | | |
| | | /** |
| | | * 熙汛led新增日志记录开始 |
| | | */ |
| | | List<String> listCode = new ArrayList<>(); |
| | | listCode.add(poleLightemit.getLightemitControlCode()); |
| | | String content = "{屏幕id:" + poleLightemit.getLightemitId() + ", 屏幕名称:" + poleLightemit.getLightemitName() + ", 屏幕编码:" + poleLightemit.getLightemitControlCode() + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "熙汛LED新增", content); |
| | | /** |
| | | * 熙汛led新增日志记录结束 |
| | | */ |
| | | // poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId()); |
| | | } |
| | | |
| | |
| | | PoleLightemitEntity byId = getById(ledId); |
| | | if (byId == null) { |
| | | throw new BusinessException("未找到LED屏"); |
| | | } |
| | | |
| | | boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getLightemitControlCode(), PoleBindingEnums.XIXUN); |
| | | if (!belong) { |
| | | throw new BusinessException("该设备不属于您,不能修改设备信息"); |
| | | } |
| | | poleLightemit.setLightemitId(ledId); |
| | | boolean b = this.updateById(poleLightemit); |
| | |
| | | poleBindingParam.setDeviceName(poleLightemit.getLightemitName()); |
| | | poleBindingService.bindPole(poleLightemit.getPoleId(), poleBindingParam); |
| | | } |
| | | |
| | | /** |
| | | * 熙汛led编辑日志记录开始 |
| | | */ |
| | | List<String> listCode = new ArrayList<>(); |
| | | listCode.add(poleLightemit.getLightemitControlCode()); |
| | | String content = "{屏幕id:" + poleLightemit.getLightemitId() + ", 屏幕原名:" + byId.getLightemitName() + ", 屏幕名称:" + poleLightemit.getLightemitName() + ", 屏幕编码:" + poleLightemit.getLightemitControlCode() + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "熙汛LED编辑", content); |
| | | /** |
| | | * 熙汛led编辑日志记录结束 |
| | | */ |
| | | // poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId()); |
| | | } |
| | | |
| | | public boolean deletePoleLightemit(List<Long> ledIds) { |
| | | |
| | | List<PoleLightemitEntity> poleLightemitEntities = listByIds(ledIds); |
| | | if (poleLightemitEntities != null && poleLightemitEntities.size() != 0) { |
| | | throw new BusinessException("设备不存在"); |
| | | } |
| | | |
| | | List<String> listCode = new ArrayList<>(); |
| | | // 删除设备绑定 |
| | | if (poleLightemitEntities != null && poleLightemitEntities.size() != 0) { |
| | | for (PoleLightemitEntity poleLightemitEntitie : poleLightemitEntities) { |
| | | if (poleLightemitEntitie.getLightemitControlCode() != null) { |
| | | //删除绑定关系//先删除绑定关系 |
| | | listCode.add(poleLightemitEntitie.getLightemitControlCode()); |
| | | poleBindingService.unBindPole(poleLightemitEntitie.getLightemitControlCode()); |
| | | } |
| | | } |
| | | } |
| | | //删除设备 |
| | | boolean b = removeByIds(ledIds); |
| | | |
| | | /** |
| | | * 熙汛led删除日志记录开始 |
| | | */ |
| | | List<String> nameList = new ArrayList<>(); |
| | | for (PoleLightemitEntity poleLightemitEntitie : poleLightemitEntities) { |
| | | nameList.add(poleLightemitEntitie.getLightemitName()); |
| | | } |
| | | |
| | | String content = "{删除熙汛LED的设备信息:" + nameList.toString() + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "熙汛LED删除", content); |
| | | /** |
| | | * 熙汛led删除日志记录结束 |
| | | */ |
| | | return b; |
| | | // poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId()); |
| | | } |