修复query_equip_charge_status接口电流电压数值错误问题

This commit is contained in:
wen 2021-11-15 17:06:47 +08:00
parent 465d2be266
commit 12d7ad6e3c

View File

@ -12,6 +12,7 @@ import com.xhpc.evcs.jpa.OrderMappingRepository;
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
import com.xhpc.evcs.utils.DateUtil;
import com.xhpc.evcs.utils.JSONUtil;
import com.xhpc.pp.utils.HexUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -66,7 +67,7 @@ public class QueryEquipChargeStatusController {
break;
}
equipChargeStatus.setStartChargeSeqStat(startChargeSeqStat);
//充电设备接口编码
//充电设备接口编码
String connectorId = internalOrderNum.substring(0, 16);
equipChargeStatus.setConnectorID(connectorId);
//充电设备接口状态
@ -90,22 +91,22 @@ public class QueryEquipChargeStatusController {
equipChargeStatus.setConnectorStatus(connectorStatus);
//A相电流
String current = (String) cacheGunData.get("current");
Double currentA = Integer.parseInt(current, 16) / 10.0;
Double currentA = HexUtils.reverseHexInt(current) / 10.0;
equipChargeStatus.setCurrentA(currentA);
//A相电压
String voltage = (String) cacheGunData.get("voltage");
Double voltageA = Integer.parseInt(voltage, 16) / 10.0;
Double voltageA = HexUtils.reverseHexInt(voltage) / 10.0;
equipChargeStatus.setVoltageA(voltageA);
//电池剩余电量
Integer endSoc = (Integer) order.get("endSoc");
Double soc = Double.valueOf(endSoc);
equipChargeStatus.setVoltageA(soc);
equipChargeStatus.setSoc(soc);
//开始充电时间
String startTime = (String) order.get("startTime");
equipChargeStatus.setStartTime(startTime);
//本次采样时间 直接new一个当前时间的Date就可以了
equipChargeStatus.setEndTime(DateUtil.getYyyyMmDdHhMmSs());
final Integer chargeModel = (Integer) order.get("chargeModel");
Integer chargeModel = (Integer) order.get("chargeModel");
equipChargeStatus.setChargeModel(chargeModel == null ? 0 : chargeModel);
//累计充电量
CacheRealtimeData orderLord = REDIS.getCacheObject("order:" + internalOrderNum + ".lord");