mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
新增 0x31 充电桩主动申请充电报文存数据库
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
package com.jsowell.common.core.domain.ykc;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 0x31 充电桩主动申请充电
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/10/12 10:05
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ConfirmStartChargingData {
|
||||
/**
|
||||
* 桩编号
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 枪口号
|
||||
*/
|
||||
private String connectorCode;
|
||||
|
||||
/**
|
||||
* 启动方式
|
||||
* 0x01 表示通过刷卡启动充电
|
||||
* 0x02 表求通过帐号启动充电 (暂不支持)
|
||||
* 0x03 表示vin码启动充电
|
||||
*/
|
||||
private String startMode;
|
||||
|
||||
/**
|
||||
* 是否需要密码
|
||||
* 0x00 不需要 0x01 需要
|
||||
*/
|
||||
private String needPasswordFlag;
|
||||
|
||||
/**
|
||||
* 物理卡号 不足 8 位补 0
|
||||
*/
|
||||
private String physicsCard;
|
||||
|
||||
/**
|
||||
* 输入密码 对用户输入的密码进行16 位MD5 加密,采用小写上传
|
||||
*/
|
||||
private String inputPasswordByteArr;
|
||||
|
||||
/**
|
||||
* VIN码
|
||||
*/
|
||||
private String vinCode;
|
||||
|
||||
// /**
|
||||
// * 鉴权成功标识
|
||||
// */
|
||||
// private String authenticationFlagByteArr;
|
||||
//
|
||||
// /**
|
||||
// * 账户余额
|
||||
// */
|
||||
// private String accountBalanceByteArr;
|
||||
//
|
||||
// /**
|
||||
// * 交易流水号
|
||||
// */
|
||||
// private String serialNumByteArr;
|
||||
//
|
||||
// /**
|
||||
// * 失败原因
|
||||
// */
|
||||
// private String defeatReasonByteArr;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.jsowell.netty.handler;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.ConfirmStartChargingData;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.enums.ykc.CardStatusEnum;
|
||||
@@ -12,6 +13,7 @@ import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.common.util.sign.MD5Util;
|
||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
||||
import com.jsowell.pile.domain.PileAuthCard;
|
||||
@@ -19,6 +21,7 @@ import com.jsowell.pile.dto.GenerateOrderDTO;
|
||||
import com.jsowell.pile.service.IMemberPlateNumberRelationService;
|
||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileAuthCardService;
|
||||
import com.jsowell.pile.service.IPileMsgRecordService;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -47,6 +50,9 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
||||
@Autowired
|
||||
private IMemberPlateNumberRelationService memberPlateNumberRelationService;
|
||||
|
||||
@Autowired
|
||||
private IPileMsgRecordService pileMsgRecordService;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
YKCOperateFactory.register(type, this);
|
||||
@@ -97,6 +103,7 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
||||
startIndex += length;
|
||||
length = 16;
|
||||
byte[] inputPasswordByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String inputPasswordHexStr = BytesUtil.bin2HexStr(inputPasswordByteArr);
|
||||
|
||||
// VIN码
|
||||
startIndex += length;
|
||||
@@ -104,6 +111,18 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
||||
byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String vinCode = BytesUtil.ascii2Str(vinCodeByteArr);
|
||||
|
||||
ConfirmStartChargingData confirmStartChargingData = ConfirmStartChargingData.builder()
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(connectorCode)
|
||||
.startMode(startMode)
|
||||
.needPasswordFlag(needPasswordFlag)
|
||||
.inputPasswordByteArr(inputPasswordHexStr)
|
||||
.physicsCard(physicsCard)
|
||||
.vinCode(vinCode)
|
||||
|
||||
.build();
|
||||
|
||||
|
||||
/**
|
||||
* 刷卡启动充电
|
||||
*/
|
||||
@@ -243,6 +262,10 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
||||
// pileSnByteArr = BytesUtil.checkLengthAndBehindAppendZero(pileSnByteArr, 14);
|
||||
// accountBalanceByteArr = BytesUtil.checkLengthAndBehindAppendZero(accountBalanceByteArr, 8);
|
||||
|
||||
// 保存报文
|
||||
String jsonMsg = JSONObject.toJSONString(confirmStartChargingData);
|
||||
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, ykcDataProtocol.getHEXString());
|
||||
|
||||
// 拼装消息体
|
||||
byte[] msgBodyByteArr = Bytes.concat(serialNumByteArr, pileSnByteArr, connectorNumByteArr, cardNumByteArr, accountBalanceByteArr,
|
||||
authenticationFlagByteArr, defeatReasonByteArr);
|
||||
|
||||
Reference in New Issue
Block a user