xuhy
2024-11-01 92daf066bde1d9b60c1c5132b1ec21abbe0daffc
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
@@ -211,7 +211,7 @@
    */
   @ResponseBody
   @PostMapping("/getChargingPileById/{id}")
   public R<TChargingPile> getChargingPileById(@PathVariable Integer id){
   public R<TChargingPile> getChargingPileById(@PathVariable("id") Integer id){
      TChargingPile chargingPile = chargingPileService.getById(id);
      return R.ok(chargingPile);
   }
@@ -227,7 +227,7 @@
      Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_gun_online");
      Long time = (Long) charging_pile_online.get(pile_code + gun_code);
      //小于30秒才处理数据,防止频繁查询数据
      if(null != time || (System.currentTimeMillis() - time) < 30000){
      if(null != time && (System.currentTimeMillis() - time) < 30000){
         return;
      }
      TChargingGun tChargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, (pile_code + gun_code)).eq(TChargingGun::getDelFlag, 0));
@@ -295,7 +295,7 @@
            if(orders.size() > 0){
               TChargingOrder chargingOrder = orders.get(0);
               TChargingGun tChargingGun1 = new TChargingGun();
               if(Arrays.asList(1, 2).contains(chargingOrder.getStatus())){
               if(Arrays.asList(1, 2, 5).contains(chargingOrder.getStatus())){
                  tChargingGun1.setStatus(3);
               }
               if(Arrays.asList(3).contains(chargingOrder.getStatus())){
@@ -306,6 +306,11 @@
               }
               tChargingGun1.setId(tChargingGun.getId());
               chargingGunService.updateById(tChargingGun1);
            }else{
               TChargingGun tChargingGun1 = new TChargingGun();
               tChargingGun1.setId(tChargingGun.getId());
               tChargingGun1.setStatus(3);
               chargingGunService.updateById(tChargingGun1);
            }
         }
      }