Pu Zhibing
2025-04-08 87dcd22d5b1b1eb951cc4abdd8b64e733928ca00
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
@@ -244,11 +244,12 @@
   public void updateChargingPileStatus(@RequestBody UpdateChargingPileStatusVo vo){
      String pile_code = vo.getPile_code();
      String gun_code = vo.getGun_code();
      //0:正常,1:故障,2=插枪
      Integer status = vo.getStatus();
      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){
      //小于1分钟才处理数据,防止频繁查询数据
      if(null != time && (System.currentTimeMillis() - time) < 60000){
         return;
      }
      TChargingGun tChargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, (pile_code + gun_code)).eq(TChargingGun::getDelFlag, 0));
@@ -264,7 +265,7 @@
            tChargingGun1.setStatus(2);
            chargingGunService.updateById(tChargingGun1);
            //推送状态给三方平台
            tcecClient.pushChargingGunStatus(tChargingGun.getId(), tChargingGun1.getStatus());
            tcecClient.pushChargingGunStatus(tChargingGun.getFullNumber(), tChargingGun1.getStatus());
            
            if(chargingPile.getStatus() != 1){
               TChargingPile chargingPile1 = new TChargingPile();
@@ -287,7 +288,7 @@
            tChargingGun1.setStatus(7);
            chargingGunService.updateById(tChargingGun1);
            //推送状态给三方平台
            tcecClient.pushChargingGunStatus(tChargingGun.getId(), tChargingGun1.getStatus());
            tcecClient.pushChargingGunStatus(tChargingGun.getFullNumber(), tChargingGun1.getStatus());
            
            //桩处于正常,桩所属的枪都处于非正常,修改桩状态为异常
            List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId()).eq(TChargingGun::getDelFlag, 0));
@@ -321,25 +322,28 @@
               TChargingGun tChargingGun1 = new TChargingGun();
               if(Arrays.asList(1, 2, 5).contains(chargingOrder.getStatus())){
                  tChargingGun1.setStatus(3);
                  tChargingGun1.setId(tChargingGun.getId());
                  chargingGunService.updateById(tChargingGun1);
               }
               if(Arrays.asList(3).contains(chargingOrder.getStatus())){
                  tChargingGun1.setStatus(4);
                  tChargingGun1.setId(tChargingGun.getId());
                  chargingGunService.updateById(tChargingGun1);
               }
               if(Arrays.asList(4).contains(chargingOrder.getStatus()) && chargingOrder.getEndMode() == 2){
                  tChargingGun1.setStatus(5);
                  tChargingGun1.setId(tChargingGun.getId());
                  chargingGunService.updateById(tChargingGun1);
               }
               tChargingGun1.setId(tChargingGun.getId());
               chargingGunService.updateById(tChargingGun1);
               //推送状态给三方平台
               tcecClient.pushChargingGunStatus(tChargingGun.getId(), tChargingGun1.getStatus());
               tcecClient.pushChargingGunStatus(tChargingGun.getFullNumber(), tChargingGun1.getStatus());
            }else{
               TChargingGun tChargingGun1 = new TChargingGun();
               tChargingGun1.setId(tChargingGun.getId());
               tChargingGun1.setStatus(3);
               chargingGunService.updateById(tChargingGun1);
               //推送状态给三方平台
               tcecClient.pushChargingGunStatus(tChargingGun.getId(), tChargingGun1.getStatus());
               tcecClient.pushChargingGunStatus(tChargingGun.getFullNumber(), tChargingGun1.getStatus());
            }
            
            List<TFaultMessage> list = faultMessageService.list(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingGunId, tChargingGun.getId())