提交domain

This commit is contained in:
Guoqs
2024-10-28 15:27:13 +08:00
parent 2eb4999038
commit 1e3dd0fa30
57 changed files with 1484 additions and 0 deletions

View File

@@ -0,0 +1,133 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
import java.math.BigDecimal;
/**
* 0x01登录请求数据
*/
@Data
public class Data0x01 extends YKCBaseMessage {
/**
* 桩编码 BCD 码 7 不足 7 位补 0
*/
private String pileSn;
/**
* 桩类型 BIN 码 1 0 表示直流桩, 1 表示交流桩
*/
private String pileType;
/**
* 充电枪数量 BIN 码 1
*/
private String connectorNum;
/**
* 通信协议版本 BIN 码 1 版本号乘 10v1.0 表示 0x0A
*/
private String communicationVersion;
/**
* 程序版本 ASCII 码 8 不足 8 位补零
*/
private String programVersion;
/**
* 网络链接类型 BIN 码 1 0x00 SIM 卡
* 0x01 LAN
* 0x02 WAN
* 0x03 其他
*/
private String internetConnection;
/**
* Sim 卡 BCD 码 10 不足 10 位补零,取不到置零
*/
private String iccid;
/**
* 运营商 BIN 码 1 0x00 移动
* 0x02 电信
* 0x03 联通
* 0x04 其他
*/
private String business;
@Override
public String toString() {
return "LoginRequestData{" +
"pileSn='" + pileSn + '\'' +
", pileType='" + pileType + '\'' +
", connectorNum='" + connectorNum + '\'' +
", communicationVersion='" + communicationVersion + '\'' +
", programVersion='" + programVersion + '\'' +
", internetConnection='" + internetConnection + '\'' +
", iccid='" + iccid + '\'' +
", business='" + business + '\'' +
'}';
}
public Data0x01(byte[] messageBytes) {
super(messageBytes);
// 初始startIndex为6, 跳过消息头等6个字节
int startIndex = 6;
// 桩编码
int length = 7;
byte[] pileSnByte = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.pileSn = BytesUtil.binary(pileSnByte, 16);
// 保存时间
// YKCUtils.saveLastTimeAndCheckChannel(pileSn, ctx);
// 桩类型 0 表示直流桩, 1 表示交流桩
startIndex += length;
length = 1;
byte[] pileTypeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.pileType = BytesUtil.bcd2Str(pileTypeByteArr);
// 充电枪数量
startIndex += length;
length = 1;
byte[] connectorNumByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.connectorNum = BytesUtil.bcd2Str(connectorNumByteArr);
// 通信协议版本 版本号乘 10v1.0 表示 0x0A
startIndex += length;
length = 1;
byte[] communicationVersionByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
BigDecimal bigDecimal = new BigDecimal(BytesUtil.bcd2Str(communicationVersionByteArr));
BigDecimal communicationVersionTemp = bigDecimal.divide(new BigDecimal(10));
this.communicationVersion = "v" + communicationVersionTemp;
// 程序版本
startIndex += length;
length = 8;
byte[] programVersionByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.programVersion = BytesUtil.ascii2Str(programVersionByteArr);
// log.info("程序版本:{} length:{}", programVersion, programVersion.length());
// 网络连接类型 0x00 SIM 卡 0x01 LAN 0x02 WAN 0x03 其他
startIndex += length;
length = 1;
byte[] internetConnectionTypeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.internetConnection = BytesUtil.bcd2Str(internetConnectionTypeByteArr);
// sim卡
startIndex += length;
length = 10;
byte[] simCardNumByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.iccid = BytesUtil.bin2HexStr(simCardNumByteArr);
// 运营商 0x00 移动 0x02 电信 0x03 联通 0x04 其他
startIndex += length;
length = 1;
byte[] businessTypeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.business = BytesUtil.bcd2Str(businessTypeByteArr);
}
}

View File

@@ -0,0 +1,69 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import com.jsowell.common.util.BytesUtil;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 心跳包数据
*/
@Data
public class Data0x03 extends YKCBaseMessage {
/**
* 桩编码 BCD 码 7 不足 7 位补 0
*/
private String pileSn;
/**
* 枪号 BCD 码 1
*/
private String connectorCode;
/**
* 枪状态 BIN 码 1 0x00正常 0x01故障
*/
private String connectorStatus;
public Data0x03(byte[] messageBytes) {
super(messageBytes);
// 初始startIndex为6, 跳过消息头等6个字节
int startIndex = 6;
// 桩编码
int length = 7;
byte[] pileSnBytes = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.pileSn = BytesUtil.binary(pileSnBytes, 16);
// 枪号
startIndex += length;
length = 1;
byte[] connectorCodeBytes = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.connectorCode = String.format("%02d", Integer.parseInt(BytesUtil.binary(connectorCodeBytes, 16)));
//枪状态(不回复)
startIndex += length;
length = 1;
byte[] connectorStatusBytes = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.connectorStatus = BytesUtil.binary(connectorStatusBytes, 16);
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
.append("pileSn", pileSn)
.append("connectorCode", connectorCode)
.append("connectorStatus", connectorStatus)
.append("header", header)
.append("dataLength", dataLength)
.append("serialNumber", serialNumber)
.append("encryptFlag", encryptFlag)
.append("frameType", frameType)
.append("frameCheckSequence", frameCheckSequence)
.append("channelId", channelId)
.toString();
}
}

View File

@@ -0,0 +1,33 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x05 extends YKCBaseMessage {
private String pileSn;
private String billingTemplateCode;
public Data0x05(byte[] messageBytes) {
super(messageBytes);
// 初始startIndex为6, 跳过消息头等6个字节
int startIndex = 6;
// 桩编码
int length = 7;
byte[] pileSnBytes = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.pileSn = BytesUtil.binary(pileSnBytes, 16);
// 计费模型编码
startIndex += length;
length = 2;
byte[] billingTemplateCodeByte = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.billingTemplateCode = BytesUtil.binary(billingTemplateCodeByte, 16);
}
}

View File

@@ -0,0 +1,26 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x09 extends YKCBaseMessage {
private String pileSn;
public Data0x09(byte[] messageBytes) {
super(messageBytes);
// 初始startIndex为6, 跳过消息头等6个字节
int startIndex = 6;
// 桩编码
int length = 7;
byte[] pileSnBytes = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.pileSn = BytesUtil.binary(pileSnBytes, 16);
}
}

View File

@@ -0,0 +1,278 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.enums.ykc.YKCPileFaultReasonEnum;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x13 extends YKCBaseMessage {
/**
* 交易流水号 BCD 码 16 见名词解释
*/
private String transactionCode;
/**
* 桩编号 BCD 码 7 不足 7 位补 0
*/
private String pileSn;
/**
* 枪号 BCD 码 1
*/
private String connectorCode;
/**
* 状态 BIN 码 1 0x00离线
* 0x01故障
* 0x02空闲
* 0x03充电
* 0x04预约中
* 需做到变位上送
*/
private String connectorStatus;
/**
* 枪是否归位 BIN 码 1 0x00 否 0x01 是 0x02 未知
* (无法检测到枪是否插回枪座即 未知)
*/
private String homingFlag;
/**
* 充电枪编号
*/
private String pileConnectorCode;
/**
* 是否插枪 BIN 码 1 0x00 否 0x01 是
* 需做到变位上送
*/
private String putGunType;
/**
* 输出电压 BIN 码 2 精确到小数点后一位;待机置零
*/
private String outputVoltage;
/**
* 输出电流 BIN 码 2 精确到小数点后一位;待机置零
*/
private String outputCurrent;
/**
* 枪线温度 BIN 码 1 整形,偏移量-50待机置零
*/
private String gunLineTemperature;
/**
* 枪线编码 BIN 码 8 没有置零
*/
private String gunLineCode;
/**
* SOC BIN 码 1 待机置零;交流桩置零
*/
private String SOC;
/**
* 电池组最高温度 BIN 码 1 整形,偏移量-50 ºC待机置零 交流桩置零
*/
private String batteryMaxTemperature;
/**
* 累计充电时间 BIN 码 2 单位min待机置零
*/
private int sumChargingTime;
/**
* 剩余时间 BIN 码 2 单位min待机置零、交流桩置 零
*/
private int timeRemaining;
/**
* 充电度数 BIN 码 4 精确到小数点后四位;待机置零
*/
private String chargingDegree;
/**
* 计损充电度数 BIN 码 4 精确到小数点后四位;待机置零 未设置计损比例时等于充电度数
*/
private String lossDegree;
/**
* 已充金额 BIN 码 4 精确到小数点后四位;待机置零 (电费+服务费) *计损充电度数
*/
private String chargingAmount;
/**
* 硬件故障 BIN 码 2 Bit 位表示 (0 否 1 是) ,低位到 高位顺序
* Bit1急停按钮动作故障
* Bit2无可用整流模块
* Bit3出风口温度过高
* Bit4交流防雷故障
* Bit5 交直流模块 DC20 通信中 断;
* Bit6绝缘检测模块 FC08 通信中 断;
* Bit7 电度表通信中断;
* Bit8读卡器通信中断
* Bit9RC10 通信中断;
* Bit10风扇调速板故障
* Bit11直流熔断器故障
* Bit12高压接触器故障
* Bit13 门打开;
*/
private String hardwareFault;
private String faultReason;
/**
* 时间
*/
private String dateTime;
private String thirdPartyType;
public String getPileConnectorCode() {
return this.pileSn + this.connectorCode;
}
public Data0x13(byte[] messageBytes) {
super(messageBytes);
// 初始startIndex为6, 跳过消息头等6个字节
int startIndex = 6;
// 交易流水号
int length = 16;
byte[] orderCodeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.transactionCode = BytesUtil.bcd2Str(orderCodeByteArr);
// 桩编码
startIndex += length;
length = 7;
byte[] pileSnByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 枪号
startIndex += length;
length = 1;
byte[] connectorCodeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.connectorCode = BytesUtil.bcd2Str(connectorCodeByteArr);
// 枪口编号
String pileConnectorCode = pileSn + connectorCode;
// 枪口状态 0x00:离线 0x01:故障 0x02:空闲 0x03:充电 0x04 预约中
startIndex += length;
length = 1;
byte[] connectorStatusByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.connectorStatus = BytesUtil.bcd2Str(connectorStatusByteArr);
// 是否归位 0x00:否 0x01:是 0x02:未知(无法检测到枪是否插回枪座即 未知)
startIndex += length;
length = 1;
byte[] homingFlagByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.homingFlag = BytesUtil.bcd2Str(homingFlagByteArr);
// 是否插枪 0x00:否 0x01:是
startIndex += length;
length = 1;
byte[] isChargerPluggedInByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.putGunType = BytesUtil.bcd2Str(isChargerPluggedInByteArr);
// 输出电压 精确到小数点后一位;待机置零
startIndex += length;
length = 2;
byte[] outputVoltageByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.outputVoltage = YKCUtils.convertVoltageCurrent(outputVoltageByteArr);
// 输出电流 精确到小数点后一位;待机置零
startIndex += length;
length = 2;
byte[] outputCurrentByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.outputCurrent = YKCUtils.convertVoltageCurrent(outputCurrentByteArr);
// 枪线温度 整形, 偏移量-50待机置零
startIndex += length;
length = 1;
byte[] gunLineTemperatureByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.gunLineTemperature = YKCUtils.transitionTemperature(gunLineTemperatureByteArr);
// 枪线编码 没有置零
startIndex += length;
length = 8;
byte[] gunLineCodeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.gunLineCode = BytesUtil.bcd2Str(gunLineCodeByteArr);
// SOC 待机置零;交流桩置零
startIndex += length;
length = 1;
byte[] SOCByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.SOC = String.valueOf(SOCByteArr[0]);
// 电池组最高温度 整形, 偏移量-50 ºC待机置零 交流桩置零
startIndex += length;
length = 1;
byte[] batteryMaxTemperatureByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.batteryMaxTemperature = YKCUtils.transitionTemperature(batteryMaxTemperatureByteArr);
// 累计充电时间 单位: min待机置零
startIndex += length;
length = 2;
byte[] sumChargingTimeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.sumChargingTime = BytesUtil.bytesToIntLittle(sumChargingTimeByteArr);
// 剩余时间 单位: min待机置零、交流桩置零
startIndex += length;
length = 2;
byte[] timeRemainingByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.timeRemaining = BytesUtil.bytesToIntLittle(timeRemainingByteArr);
// 充电度数 精确到小数点后四位;待机置零
startIndex += length;
length = 4;
byte[] chargingDegreeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.chargingDegree = YKCUtils.convertDecimalPoint(chargingDegreeByteArr, 4);
// 计损充电度数 精确到小数点后四位;待机置零 未设置计损比例时等于充电度数
startIndex += length;
length = 4;
byte[] lossDegreeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.lossDegree = YKCUtils.convertDecimalPoint(lossDegreeByteArr, 4);
// 已充金额 精确到小数点后四位;待机置零 (电费+服务费) *计损充电度数
startIndex += length;
length = 4;
byte[] chargingAmountByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.chargingAmount = YKCUtils.convertDecimalPoint(chargingAmountByteArr, 4);
// 硬件故障
startIndex += length;
length = 2;
byte[] hardwareFaultTempByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.hardwareFault = BytesUtil.bcd2Str(hardwareFaultTempByteArr);
String faultReason = "";
if (!StringUtils.equals(hardwareFault, "0000")) {
// 不等于0000说明有故障
StringBuffer sb = new StringBuffer(hardwareFault);
String lowOrder = sb.substring(0, 2);
String highOrder = sb.substring(2, 4);
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
int faultCode = 0;
for (int i = 0; i < binStr.length(); i++) {
if (binStr.charAt(i) == '1') {
faultCode = 15 - i;
break;
}
}
faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
}
this.faultReason = faultReason;
}
}

View File

@@ -0,0 +1,14 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x15 extends YKCBaseMessage {
public Data0x15(byte[] messageBytes) {
super(messageBytes);
}
}

View File

@@ -0,0 +1,14 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x17 extends YKCBaseMessage {
public Data0x17(byte[] messageBytes) {
super(messageBytes);
}
}

View File

@@ -0,0 +1,14 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x19 extends YKCBaseMessage {
public Data0x19(byte[] messageBytes) {
super(messageBytes);
}
}

View File

@@ -0,0 +1,10 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x1B {
}

View File

@@ -0,0 +1,10 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x1D {
}

View File

@@ -0,0 +1,14 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x21 extends YKCBaseMessage {
public Data0x21(byte[] messageBytes) {
super(messageBytes);
}
}

View File

@@ -0,0 +1,14 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x23 extends YKCBaseMessage {
public Data0x23(byte[] messageBytes) {
super(messageBytes);
}
}

View File

@@ -0,0 +1,14 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x25 extends YKCBaseMessage {
public Data0x25(byte[] messageBytes) {
super(messageBytes);
}
}

View File

@@ -0,0 +1,14 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x27 extends YKCBaseMessage {
public Data0x27(byte[] messageBytes) {
super(messageBytes);
}
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x31 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x33 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x35 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,366 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.enums.ykc.YKCChargingStopReasonEnum;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
import java.util.Date;
/**
* 交易记录数据
*/
@Data
public class Data0x3B extends YKCBaseMessage {
/**
* 交易流水号 BCD 码 16 见名词解释
*/
private String transactionCode;
/**
* 桩编号 BCD 码 7 不足 7 位补 0
*/
private String pileSn;
/**
* 枪号 BCD 码 1
*/
private String connectorCode;
/**
* 开始时间 BIN 7 CP56Time2a 格式
*/
private String startTime;
/**
* 结束时间 BIN 7 CP56Time2a 格式
*/
private String endTime;
/**
* 尖单价 BIN 4 精确到小数点后五位(尖电费+尖 服务费,见费率帧)
*/
private String sharpPrice;
/**
* 尖电量 BIN 4 精确到小数点后四位
*/
private String sharpUsedElectricity;
/**
* 计损尖电量 BIN 4 精确到小数点后四位
*/
private String sharpPlanLossElectricity;
/**
* 尖金额 BIN 4 精确到小数点后四位
*/
private String sharpAmount;
/**
* 峰单价 BIN 4 精确到小数点后五位(峰电费+峰 服务费)
*/
private String peakPrice;
/**
* 峰电量 BIN 4 精确到小数点后四位
*/
private String peakUsedElectricity;
/**
* 计损峰电量 BIN 4 精确到小数点后四位
*/
private String peakPlanLossElectricity;
/**
* 峰金额 BIN 4 精确到小数点后四位
*/
private String peakAmount;
/**
* 平单价 BIN 4 精确到小数点后五位(平电费+平 服务费)
*/
private String flatPrice;
/**
* 平电量 BIN 4 精确到小数点后四位
*/
private String flatUsedElectricity;
/**
* 计损平电量 BIN 4 精确到小数点后四位
*/
private String flatPlanLossElectricity;
/**
* 平金额 BIN 4 精确到小数点后四位
*/
private String flatAmount;
/**
* 谷单价 BIN 4 精确到小数点后五位(谷电费+谷 服务费)
*/
private String valleyPrice;
/**
* 谷电量 BIN 4 精确到小数点后四位
*/
private String valleyUsedElectricity;
/**
* 计损谷电量 BIN 4 精确到小数点后四位
*/
private String valleyPlanLossElectricity;
/**
* 谷金额 BIN 4 精确到小数点后四位
*/
private String valleyAmount;
/**
* 电表总起值 BIN 5 精确到小数点后四位
*/
private String ammeterTotalStart;
/**
* 电表总止值 BIN 5 精确到小数点后四位
*/
private String ammeterTotalEnd;
/**
* 总电量 BIN 4 精确到小数点后四位
*/
private String totalElectricity;
/**
* 计损总电量 BIN 4 精确到小数点后四位
*/
private String planLossTotalElectricity;
/**
* 消费金额 BIN 4 精确到小数点后四位,包含电费、 服务费
*/
private String consumptionAmount;
/**
* 电动汽车唯一标识 ASCII 17 VIN 码,此处 VIN 码和充电时 VIN 码不同, 正序直接上传, 无需补 0 和反序
*/
private String vinCode;
/**
* 交易标识 BIN 1 0x01 app 启动 0x02卡启动 0x04离线卡启动 0x05: vin 码启动充电
*/
private String transactionIdentifier;
/**
* 交易日期、时间 BIN 7 CP56Time2a 格式
*/
private String transactionTime;
/**
* 停止原因 BIN 1 见附录 11.1
*/
private String stopReason;
/**
* 停止原因描述
*/
private String stopReasonMsg;
/**
* 物理卡号 BIN 码 8 不足 8 位补 0
*/
private String logicCard;
public Data0x3B(byte[] messageBytes) {
super(messageBytes);
// 初始startIndex为6, 跳过消息头等6个字节
int startIndex = 6;
// 交易流水号
int length = 16;
byte[] transactionCodeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.transactionCode = BytesUtil.bcd2Str(transactionCodeByteArr);
// 桩编码
startIndex += length;
length = 7;
byte[] pileSnByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 枪号
startIndex += length;
length = 1;
byte[] connectorCodeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.connectorCode = BytesUtil.bcd2Str(connectorCodeByteArr);
// 开始时间 CP56Time2a 格式
startIndex += length;
length = 7;
byte[] startTimeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
// String binary = BytesUtil.binary(startTimeByteArr, 16);
Date startDate = Cp56Time2aUtil.byte2Hdate(startTimeByteArr);
this.startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, startDate);
// 结束时间 CP56Time2a 格式
startIndex += length;
byte[] endTimeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
Date endDate = Cp56Time2aUtil.byte2Hdate(endTimeByteArr);
this.endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, endDate);
// 尖单价 精确到小数点后五位(尖电费+尖服务费,见费率帧)
startIndex += length;
length = 4;
byte[] sharpPriceByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.sharpPrice = YKCUtils.convertDecimalPoint(sharpPriceByteArr, 5);
// 尖电量 精确到小数点后四位
startIndex += length;
length = 4;
byte[] sharpUsedElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.sharpUsedElectricity = YKCUtils.convertDecimalPoint(sharpUsedElectricityByteArr, 4);
// 计损尖电量
startIndex += length;
byte[] sharpPlanLossElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.sharpPlanLossElectricity = YKCUtils.convertDecimalPoint(sharpPlanLossElectricityByteArr, 4);
// 尖金额
startIndex += length;
byte[] sharpAmountByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.sharpAmount = YKCUtils.convertDecimalPoint(sharpAmountByteArr, 4);
// 峰单价 精确到小数点后五位(峰电费+峰服务费)
startIndex += length;
byte[] peakPriceByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.peakPrice = YKCUtils.convertDecimalPoint(peakPriceByteArr, 5);
// 峰电量
startIndex += length;
byte[] peakUsedElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.peakUsedElectricity = YKCUtils.convertDecimalPoint(peakUsedElectricityByteArr, 4);
// 计损峰电量
startIndex += length;
byte[] peakPlanLossElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.peakPlanLossElectricity = YKCUtils.convertDecimalPoint(peakPlanLossElectricityByteArr, 4);
// 峰金额
startIndex += length;
byte[] peakAmountByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.peakAmount = YKCUtils.convertDecimalPoint(peakAmountByteArr, 4);
// 平单价 精确到小数点后五位(平电费+平服务费)
startIndex += length;
byte[] flatPriceByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.flatPrice = YKCUtils.convertDecimalPoint(flatPriceByteArr, 5);
// 平电量
startIndex += length;
byte[] flatUsedElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.flatUsedElectricity = YKCUtils.convertDecimalPoint(flatUsedElectricityByteArr, 4);
// 计损平电量
startIndex += length;
byte[] flatPlanLossElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.flatPlanLossElectricity = YKCUtils.convertDecimalPoint(flatPlanLossElectricityByteArr, 4);
// 平金额
startIndex += length;
byte[] flatAmountByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.flatAmount = YKCUtils.convertDecimalPoint(flatAmountByteArr, 4);
// 谷单价 精确到小数点后五位(谷电费+谷 服务费)
startIndex += length;
byte[] valleyPriceByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.valleyPrice = YKCUtils.convertDecimalPoint(valleyPriceByteArr, 5);
// 谷电量
startIndex += length;
byte[] valleyUsedElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.valleyUsedElectricity = YKCUtils.convertDecimalPoint(valleyUsedElectricityByteArr, 4);
// 计损谷电量
startIndex += length;
byte[] valleyPlanLossElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.valleyPlanLossElectricity = YKCUtils.convertDecimalPoint(valleyPlanLossElectricityByteArr, 4);
// 谷金额
startIndex += length;
byte[] valleyAmountByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.valleyAmount = YKCUtils.convertDecimalPoint(valleyAmountByteArr, 4);
// 电表总起值
startIndex += length;
length = 5;
byte[] ammeterTotalStartByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.ammeterTotalStart = YKCUtils.convertDecimalPoint(ammeterTotalStartByteArr, 4);
// 电表总止值
startIndex += length;
byte[] ammeterTotalEndByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.ammeterTotalEnd = YKCUtils.convertDecimalPoint(ammeterTotalEndByteArr, 4);
// 总电量
startIndex += length;
length = 4;
byte[] totalElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.totalElectricity = YKCUtils.convertDecimalPoint(totalElectricityByteArr, 4);
// 计损总电量
startIndex += length;
byte[] planLossTotalElectricityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.planLossTotalElectricity = YKCUtils.convertDecimalPoint(planLossTotalElectricityByteArr, 4);
// 消费金额 精确到小数点后四位,包含电费、 服务费
startIndex += length;
byte[] consumptionAmountByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.consumptionAmount = YKCUtils.convertDecimalPoint(consumptionAmountByteArr, 4);
// VIN 码 VIN 码,此处 VIN 码和充电时 VIN 码不同, 正序直接上传, 无需补 0 和反序
startIndex += length;
length = 17;
byte[] vinCodeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.vinCode = YKCUtils.parseVin(vinCodeByteArr); // 解析vin
/**
* 交易标识
* 0x01 app 启动
* 0x02卡启动
* 0x04离线卡启动
* 0x05: vin 码启动充电
*/
startIndex += length;
length = 1;
byte[] transactionIdentifierByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.transactionIdentifier = BytesUtil.bcd2Str(transactionIdentifierByteArr);
// 交易时间 CP56Time2a 格式
startIndex += length;
length = 7;
byte[] transactionTimeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
Date transactionDate = Cp56Time2aUtil.byte2Hdate(transactionTimeByteArr);
this.transactionTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, transactionDate);
// 停止原因
startIndex += length;
length = 1;
byte[] stopReasonByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.stopReason = BytesUtil.bin2HexStr(stopReasonByteArr);
this.stopReasonMsg = YKCChargingStopReasonEnum.getMsgByCode(Integer.parseInt(stopReason, 16));
// 物理卡号 不足 8 位补 0
startIndex += length;
length = 8;
byte[] cardNumByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
// log.info("交易记录确认cardNumByteArr:{}", cardNumByteArr);
this.logicCard = BytesUtil.binary(cardNumByteArr, 16);
}
}

View File

@@ -0,0 +1,10 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x3D {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x41 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x43 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x45 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x47 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x51 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x55 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x57 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x59 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x61 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x63 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x91 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x93 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0xA1 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0xA4 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0xF1 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x02 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x04 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x06 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x0A extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x12 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x26 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x32 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x34 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x36 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x40 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x42 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x44 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x46 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x48 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x52 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x56 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x58 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x60 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x62 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x92 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0x94 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0xA2 extends YKCBaseMessage {
}

View File

@@ -0,0 +1,11 @@
package com.jsowell.common.core.domain.ykc.platform2device;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import lombok.Data;
/**
* 计费模板验证请求数据
*/
@Data
public class Data0xA3 extends YKCBaseMessage {
}