liujie
2025-07-24 1affeef32cf30a1765ee749db0344258058b4e2e
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/util/TaskUtil.java
@@ -1,6 +1,7 @@
package com.ruoyi.jianguan.util;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.TAppUser;
import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient;
@@ -11,6 +12,8 @@
import com.ruoyi.order.api.model.TChargingOrder;
import com.ruoyi.order.api.vo.TChargingOrderVo;
import com.ruoyi.other.api.domain.Operator;
import com.ruoyi.other.api.domain.TSystemConfiguration;
import com.ruoyi.other.api.feignClient.OtherClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
@@ -44,6 +47,9 @@
   private ChargingOrderClient chargingOrderClient;
   @Resource
   private AppUserClient appUserClient;
   @Resource
   private OtherClient otherClient;
   
   @Resource
   private RedisTemplate redisTemplate;
@@ -178,51 +184,6 @@
                  chuanYiChongSuperviseUtil.notificationStationStatus(new Operator(), jsonObject);
                  break;
               case 4:
                  jsonObject.put("StartChargeSeqStat",4);
                  int temp1 = 0;
                  //充电枪状态(1=离线,2=空闲,3=占用(未充电),4=占用(充电中),5=占用(已充满),6=占用(预约锁定),7=故障)
                  switch (chargingGun2.getStatus()){
                     case 1:
                        temp1 = 0;
                        break;
                     case 2:
                        temp1=1;
                        break;
                     case 3:
                        temp1=2;
                        break;
                     case 4:
                        temp1=3;
                        break;
                     case 5:
                        temp1=4;
                        break;
                     case 6:
                        temp1=4;
                        break;
                     case 7:
                        temp1 = 255;
                        break;
                  }
                  jsonObject.put("ConnectorStatus",temp1);
                  jsonObject.put("CurrentA",chargingOrder.getCurrent());
                  jsonObject.put("VoltageA",chargingOrder.getVoltage());
                  LocalDateTime startTime3 = chargingOrder.getStartTime();
                  if (startTime3!=null){
                     jsonObject.put("StartTime",startTime3.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
                  }else{
                     LocalDateTime now1 = LocalDateTime.now();
                     // 转化为yyyy-MM-dd HH:mm:ss格式字符串
                     jsonObject.put("StartTime",now1.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
                  }
                  LocalDateTime now1 = LocalDateTime.now();
                  // 转化为yyyy-MM-dd HH:mm:ss格式字符串
                  jsonObject.put("EndTime",now1.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
                  jsonObject.put("TotalPower",chargingOrder.getElectricity());
                  jsonObject.put("TotalMoney",chargingOrder.getOrderAmount());
                  chuanYiChongSuperviseUtil.notificationSupEquipChargeStatus(new Operator(), jsonObject);
                  break;
               case 5:
                  jsonObject.put("StartChargeSeqStat",4);
@@ -329,6 +290,14 @@
         }
      });
   }
   @Scheduled(cron = "0 0 0 * * ?")
   public void reset() {
      String electricity = KsolarUtils.getElectricity();
      otherClient.reset(electricity);
   }
}