| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.google.gson.Gson; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.config.NginxConfigBean; |
| | | 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.Constant; |
| | | import com.sandu.ximon.admin.utils.FileUtil; |
| | | import com.sandu.ximon.admin.utils.HtmlTemplateUtils; |
| | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | |
| | | /** |
| | | * 熙讯设备 |
| | | */ |
| | | @Service |
| | | @EnableCaching |
| | | public class PoleLightemitService extends BaseServiceImpl<PoleLightemitEntityMapper, PoleLightemitEntity> { |
| | | |
| | | @Autowired |
| | | private PoleBindingService poleBindingService; |
| | | // @Autowired |
| | | // PoleStreetlightLightemitService poleStreetlightLightemitService; |
| | | |
| | |
| | | } |
| | | */ |
| | | |
| | | /* public void ledOnlineCheck(List<PoleLightemitEntity> list) { |
| | | |
| | | for(PoleLightemitEntity poleLightemitEntity : list){ |
| | | 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()) { |
| | | onLineList.add(poleLightemitEntity); |
| | | } |
| | | } |
| | | }*/ |
| | | return onLineList; |
| | | } |
| | | |
| | | |
| | | public void ledOnlineCheck(List<PoleLightemitEntity> list) { |
| | | for (PoleLightemitEntity poleLightemitEntity : list) { |
| | | poleLightemitEntity.setIsOpen(lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode()).contains("true")); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | public void savePoleLightemit(PoleLightemitEntity poleLightemit) { |
| | | boolean save = this.save(poleLightemit); |
| | | // 绑定灯杆 |
| | | if(save&&poleLightemit.getPoleId()!=null){ |
| | | |
| | | if (save && poleLightemit.getStreetlightId() != null) { |
| | | PoleBindingParam poleBindingParam = new PoleBindingParam(); |
| | | poleBindingParam.setDeviceCode(poleLightemit.getLightemitControlCode()); |
| | | poleBindingParam.setDeviceType(1); |
| | | poleBindingParam.setDeviceName(poleLightemit.getLightemitName()); |
| | | poleBindingService.bindPole(poleLightemit.getStreetlightId(), poleBindingParam); |
| | | } |
| | | // poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId()); |
| | | // poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId()); |
| | | } |
| | | |
| | | |
| | | /* public void updatePoleLightemit(PoleLightemitEntity poleLightemit) { |
| | | this.updateById(poleLightemit); |
| | | poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId()); |
| | | }*/ |
| | | public void updatePoleLightemit(Long ledId, PoleLightemitEntity poleLightemit) { |
| | | PoleLightemitEntity byId = getById(ledId); |
| | | if (byId == null) { |
| | | throw new BusinessException("未找到LED屏"); |
| | | } |
| | | poleLightemit.setLightemitId(ledId); |
| | | boolean b = this.updateById(poleLightemit); |
| | | // 绑定灯杆 |
| | | |
| | | if (b && poleLightemit.getStreetlightId() != null) { |
| | | //先删除绑定关系 |
| | | poleBindingService.unBindPole(null, poleLightemit.getLightemitControlCode()); |
| | | //再绑定 |
| | | PoleBindingParam poleBindingParam = new PoleBindingParam(); |
| | | poleBindingParam.setDeviceCode(poleLightemit.getLightemitControlCode()); |
| | | poleBindingParam.setDeviceType(1); |
| | | poleBindingParam.setDeviceName(poleLightemit.getLightemitName()); |
| | | poleBindingService.bindPole(poleLightemit.getStreetlightId(), poleBindingParam); |
| | | } |
| | | // poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId()); |
| | | } |
| | | |
| | | public boolean deletePoleLightemit(List<Long> ledIds) { |
| | | |
| | | List<PoleLightemitEntity> poleLightemitEntities = listByIds(ledIds); |
| | | |
| | | // 删除设备绑定 |
| | | if (poleLightemitEntities != null && poleLightemitEntities.size() != 0) { |
| | | for (PoleLightemitEntity poleLightemitEntitie : poleLightemitEntities) { |
| | | if (poleLightemitEntitie.getLightemitControlCode() != null) { |
| | | //删除绑定关系//先删除绑定关系 |
| | | poleBindingService.unBindPole(null, poleLightemitEntitie.getLightemitControlCode()); |
| | | } |
| | | } |
| | | } |
| | | //删除设备 |
| | | boolean b = removeByIds(ledIds); |
| | | return b; |
| | | // poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId()); |
| | | } |
| | | |
| | | /** |
| | | * 查询权限范围内的所有led屏信息 |