puzhibing
2024-10-08 6f1a56eb02cb6eb7848e2df6773bc5abfee11efd
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
@@ -228,9 +228,10 @@
   public AjaxResult delChargingPile(Integer[] ids) {
      //检查是否有关联数据
      //接口
      long count = chargingGunService.count(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, Arrays.asList(ids)).eq(TChargingGun::getDelFlag, 0));
      long count = chargingGunService.count(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getChargingPileId, Arrays.asList(ids))
            .eq(TChargingGun::getDelFlag, 0));
      if(count > 0){
         return AjaxResult.error("该充电桩有关联的接口数据,删除失败!");
         return AjaxResult.error("该充电桩已添加接口,不可删除。");
      }
      for (Integer id : ids) {
         TChargingPile chargingPile = this.getById(id);
@@ -264,7 +265,17 @@
      List<TChargingGun> chargingGuns = chargingGunService.list(wrapper);
      // 查询充电枪信息
      chargingPileVOS.forEach(item -> {
         item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList()));
         List<TChargingGun> chargingGunList = chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList());
         for (TChargingGun chargingGun : chargingGunList) {
            if(chargingGun.getStatus().equals(4)){
               // TODO 查询正在充电的单子的实时记录
               chargingGun.setSoc(100);
            }
            if(chargingGun.getStatus().equals(5)){
               chargingGun.setSoc(100);
            }
         }
         item.setChargingGunList(chargingGunList);
      });
      return chargingPileVOS;
   }