充电桩协议数据:0x19充电结束
This commit is contained in:
parent
3456fbdd43
commit
e7ebf9a722
@ -0,0 +1,127 @@
|
||||
package com.xhpc.common.pilemsg;
|
||||
|
||||
public class ChargingCompletedData extends BaseData {
|
||||
|
||||
private String orderNo; //交易流水号
|
||||
private String pileNo; //桩号
|
||||
private String gunId; //枪号
|
||||
private String soc; //结束SOC
|
||||
private String bmsBatteryMonoMinimumVoltage; //BMS单体电池最低电压V
|
||||
private String bmsBatteryMonoMaximumVoltage; //BMS单体电池最高电压V
|
||||
private String bmsBatteryMinimumTemperature; //BMS电池最低温度°
|
||||
private String bmsBatteryMaximumTemperature; //BMS电池最高温度°
|
||||
private String totalChargingTime; //累计充电时间min
|
||||
private String outputEnergy; //电桩输出能量kWh
|
||||
private String chargerSn; //电桩充电机编号
|
||||
|
||||
public String getOrderNo() {
|
||||
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public String getPileNo() {
|
||||
|
||||
return pileNo;
|
||||
}
|
||||
|
||||
public void setPileNo(String pileNo) {
|
||||
|
||||
this.pileNo = pileNo;
|
||||
}
|
||||
|
||||
public String getGunId() {
|
||||
|
||||
return gunId;
|
||||
}
|
||||
|
||||
public void setGunId(String gunId) {
|
||||
|
||||
this.gunId = gunId;
|
||||
}
|
||||
|
||||
public String getSoc() {
|
||||
|
||||
return soc;
|
||||
}
|
||||
|
||||
public void setSoc(String soc) {
|
||||
|
||||
this.soc = soc;
|
||||
}
|
||||
|
||||
public String getBmsBatteryMonoMinimumVoltage() {
|
||||
|
||||
return bmsBatteryMonoMinimumVoltage;
|
||||
}
|
||||
|
||||
public void setBmsBatteryMonoMinimumVoltage(String bmsBatteryMonoMinimumVoltage) {
|
||||
|
||||
this.bmsBatteryMonoMinimumVoltage = bmsBatteryMonoMinimumVoltage;
|
||||
}
|
||||
|
||||
public String getBmsBatteryMonoMaximumVoltage() {
|
||||
|
||||
return bmsBatteryMonoMaximumVoltage;
|
||||
}
|
||||
|
||||
public void setBmsBatteryMonoMaximumVoltage(String bmsBatteryMonoMaximumVoltage) {
|
||||
|
||||
this.bmsBatteryMonoMaximumVoltage = bmsBatteryMonoMaximumVoltage;
|
||||
}
|
||||
|
||||
public String getBmsBatteryMinimumTemperature() {
|
||||
|
||||
return bmsBatteryMinimumTemperature;
|
||||
}
|
||||
|
||||
public void setBmsBatteryMinimumTemperature(String bmsBatteryMinimumTemperature) {
|
||||
|
||||
this.bmsBatteryMinimumTemperature = bmsBatteryMinimumTemperature;
|
||||
}
|
||||
|
||||
public String getBmsBatteryMaximumTemperature() {
|
||||
|
||||
return bmsBatteryMaximumTemperature;
|
||||
}
|
||||
|
||||
public void setBmsBatteryMaximumTemperature(String bmsBatteryMaximumTemperature) {
|
||||
|
||||
this.bmsBatteryMaximumTemperature = bmsBatteryMaximumTemperature;
|
||||
}
|
||||
|
||||
public String getTotalChargingTime() {
|
||||
|
||||
return totalChargingTime;
|
||||
}
|
||||
|
||||
public void setTotalChargingTime(String totalChargingTime) {
|
||||
|
||||
this.totalChargingTime = totalChargingTime;
|
||||
}
|
||||
|
||||
public String getOutputEnergy() {
|
||||
|
||||
return outputEnergy;
|
||||
}
|
||||
|
||||
public void setOutputEnergy(String outputEnergy) {
|
||||
|
||||
this.outputEnergy = outputEnergy;
|
||||
}
|
||||
|
||||
public String getChargerSn() {
|
||||
|
||||
return chargerSn;
|
||||
}
|
||||
|
||||
public void setChargerSn(String chargerSn) {
|
||||
|
||||
this.chargerSn = chargerSn;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.xhpc.pp.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.pilemsg.ChargingCompletedData;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.pp.server.ChargingPileServer.REDIS;
|
||||
|
||||
@Lazy
|
||||
@Component("ChargingCompletedDataLogic")
|
||||
public class ChargingCompletedDataLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(ChargingCompletedDataLogic.class);
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
ChargingCompletedData chargingCompletedData = objectMapper.convertValue(req, ChargingCompletedData.class);
|
||||
String orderNo = chargingCompletedData.getOrderNo();
|
||||
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderNo);
|
||||
cacheOrder.put("completed", chargingCompletedData);
|
||||
REDIS.setCacheMap(orderNo, cacheOrder);
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@ -36,6 +37,17 @@ public class RegisterLogic implements ServiceLogic {
|
||||
hexCode = ServiceResult.HEX_FAIL;
|
||||
resultCode = ServiceResult.FAIL;
|
||||
}
|
||||
int gunNum = Integer.parseInt(req.get("gunNum").toString());
|
||||
for (int gunN = 1; gunN <= gunNum; gunN++) {
|
||||
String gunId = String.format("%02d", (int) gunN);
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap(pileNo.concat(gunId));
|
||||
if (cacheGun == null) {
|
||||
cacheGun = new HashMap<>();
|
||||
}
|
||||
int seq = (int) cacheGun.getOrDefault("seq", 0);
|
||||
cacheGun.put("seq", seq);
|
||||
REDIS.setCacheMap(pileNo.concat(gunId), cacheGun);
|
||||
}
|
||||
String resultStr = "680C00000002".concat(pileNo).concat(hexCode);
|
||||
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
||||
return new ServiceResult(HexUtils.toBytes(resultStr), resultCode);
|
||||
|
||||
@ -15,5 +15,6 @@
|
||||
<entry key="13" value-ref="RealtimeDataLogic"/>
|
||||
<entry key="15" value-ref="ChargingHandshakeDataLogic"/>
|
||||
<entry key="17" value-ref="ChargingConfigDataLogic"/>
|
||||
<entry key="19" value-ref="ChargingCompletedDataLogic"/>
|
||||
</util:map>
|
||||
</beans>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user