mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-05 14:38:06 +08:00
Merge branch 'feature-支持羽信主板预约充电' into dev
This commit is contained in:
@@ -61,6 +61,12 @@ public class PileBasicInfo extends BaseEntity {
|
||||
@Excel(name = "软件协议", readConverterExp = "yunkuaichongV150--云快充V1.5;yunkuaichongV160--云快充V1.6;yonglianV1--永联;youdianV1--友电")
|
||||
private String softwareProtocol;
|
||||
|
||||
/**
|
||||
* 程序版本
|
||||
*/
|
||||
@Excel(name = "程序版本")
|
||||
private String programVersion;
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
@@ -126,6 +132,7 @@ public class PileBasicInfo extends BaseEntity {
|
||||
.append("businessType", getBusinessType())
|
||||
.append("secretKey", getSecretKey())
|
||||
.append("softwareProtocol", getSoftwareProtocol())
|
||||
.append("programVersion", getProgramVersion())
|
||||
.append("productionDate", getProductionDate())
|
||||
.append("licenceId", getLicenceId())
|
||||
.append("modelId", getModelId())
|
||||
|
||||
@@ -65,6 +65,11 @@ public interface PileBasicInfoMapper {
|
||||
*/
|
||||
int updatePileBasicInfo(PileBasicInfo pileBasicInfo);
|
||||
|
||||
/**
|
||||
* 更新充电桩程序版本
|
||||
*/
|
||||
int updateProgramVersion(@Param("pileSn") String pileSn, @Param("programVersion") String programVersion);
|
||||
|
||||
/**
|
||||
* 删除设备管理
|
||||
*
|
||||
|
||||
@@ -65,6 +65,15 @@ public interface PileBasicInfoService {
|
||||
*/
|
||||
int updateSimInfo(PileBasicInfo pileBasicInfo);
|
||||
|
||||
/**
|
||||
* 更新充电桩程序版本
|
||||
*
|
||||
* @param pileSn 充电桩编号
|
||||
* @param programVersion 程序版本
|
||||
* @return 更新行数
|
||||
*/
|
||||
int updateProgramVersion(String pileSn, String programVersion);
|
||||
|
||||
/**
|
||||
* 批量删除设备管理
|
||||
*
|
||||
|
||||
@@ -559,8 +559,9 @@ public class PileRemoteService {
|
||||
String failedReason = BytesUtil.bcd2Str(failedReasonByteArr);
|
||||
String failedReasonMsg = ChargingFailedReasonEnum.getMsgByCode(Integer.parseInt(failedReason, 16));
|
||||
|
||||
log.info("0x59预约充电响应sync, 交易流水号:{}, 桩SN:{}, 枪口号:{}, 结果(00-失败; 01成功):{}, 失败原因:{}",
|
||||
transactionCode, pileSn, connectorCode, resultCode, failedReasonMsg);
|
||||
String responseFrameType = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType());
|
||||
log.info("{}预约充电响应sync, 交易流水号:{}, 桩SN:{}, 枪口号:{}, 结果(00-失败; 01成功):{}, 失败原因:{}",
|
||||
responseFrameType, transactionCode, pileSn, connectorCode, resultCode, failedReasonMsg);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -242,6 +242,32 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
return pileBasicInfoMapper.updatePileBasicInfo(pileBasicInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新充电桩程序版本
|
||||
*
|
||||
* @param pileSn 充电桩编号
|
||||
* @param programVersion 程序版本
|
||||
* @return 更新行数
|
||||
*/
|
||||
@Override
|
||||
public int updateProgramVersion(String pileSn, String programVersion) {
|
||||
String normalizedProgramVersion = PileProgramVersionUtils.normalize(programVersion);
|
||||
if (StringUtils.isBlank(pileSn) || StringUtils.isBlank(normalizedProgramVersion)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PileBasicInfo basicInfo = selectPileBasicInfoBySN(pileSn);
|
||||
if (basicInfo == null || StringUtils.equals(normalizedProgramVersion, basicInfo.getProgramVersion())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int row = pileBasicInfoMapper.updateProgramVersion(pileSn, normalizedProgramVersion);
|
||||
if (row > 0) {
|
||||
cleanRedisCache(pileSn);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备管理
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.google.common.primitives.Bytes;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.enums.ykc.PileChannelEntity;
|
||||
import com.jsowell.common.enums.ykc.PileMainboardManufacturerEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.protocol.SyncPromise;
|
||||
@@ -12,8 +13,10 @@ import com.jsowell.common.service.JcppService;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.ykcCommond.*;
|
||||
import com.jsowell.pile.dto.SavePileMsgDTO;
|
||||
import com.jsowell.pile.mapper.PileBasicInfoMapper;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
@@ -58,6 +61,9 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
@Autowired
|
||||
private PileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileBasicInfoMapper pileBasicInfoMapper;
|
||||
|
||||
@DubboReference
|
||||
private JcppService jcppService;
|
||||
|
||||
@@ -70,6 +76,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_CONTROL_START_CHARGING_CODE.getBytes()),
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_CONTROL_STOP_CHARGING_CODE.getBytes()),
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.RESERVATION_CHARGING_SETUP_CODE.getBytes()),
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.YUXIN_RESERVATION_CHARGING_SETUP_CODE.getBytes()),
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.TIME_CHECK_SETTING_CODE.getBytes())
|
||||
);
|
||||
|
||||
@@ -813,17 +820,32 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
reservationTypeByteArr, verifyIdentityByteArr, vin1ByteArr, vin2ByteArr, vin3ByteArr,
|
||||
reservedStartTimeByteArr, reservedEndTimeByteArr, amountByteArr);
|
||||
|
||||
YKCFrameTypeCode frameTypeCode = getReservationChargingFrameType(pileSn);
|
||||
byte[] response;
|
||||
try {
|
||||
response = this.supplySend(msg, pileSn, YKCFrameTypeCode.RESERVATION_CHARGING_SETUP_CODE);
|
||||
response = this.supplySend(msg, pileSn, frameTypeCode);
|
||||
} catch (Exception e) {
|
||||
log.error("发送消息异常", e);
|
||||
response = null;
|
||||
}
|
||||
|
||||
log.info("【=====平台下发指令=====】: 预约充电指令, 交易流水号:{}, 桩编号:{}, 枪口号:{}, 操作(01-启动; 02-取消; 03-修改):{}, 身份验证:{}, 开始时间:{}, 结束时间:{}, 启动金额:{}",
|
||||
transactionCode, pileSn, connectorCode, operation, verifyIdentity, DateUtils.formatDateTime(reservedStartTime), DateUtils.formatDateTime(reservedEndTime), amount);
|
||||
log.info("【=====平台下发指令=====】: 预约充电指令, 帧类型:{}, 交易流水号:{}, 桩编号:{}, 枪口号:{}, 操作(01-启动; 02-取消; 03-修改):{}, 身份验证:{}, 开始时间:{}, 结束时间:{}, 启动金额:{}",
|
||||
YKCUtils.frameType2Str(frameTypeCode.getBytes()), transactionCode, pileSn, connectorCode, operation, verifyIdentity, DateUtils.formatDateTime(reservedStartTime), DateUtils.formatDateTime(reservedEndTime), amount);
|
||||
return response;
|
||||
}
|
||||
|
||||
private YKCFrameTypeCode getReservationChargingFrameType(String pileSn) {
|
||||
try {
|
||||
PileBasicInfo pileBasicInfo = pileBasicInfoMapper.selectPileBasicInfoBySn(pileSn);
|
||||
String programVersion = pileBasicInfo == null ? null : pileBasicInfo.getProgramVersion();
|
||||
PileMainboardManufacturerEnum manufacturer = PileProgramVersionUtils.getMainboardManufacturer(programVersion);
|
||||
if (manufacturer == PileMainboardManufacturerEnum.YUXIN) {
|
||||
return YKCFrameTypeCode.YUXIN_RESERVATION_CHARGING_SETUP_CODE;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("查询主板厂家失败, 使用默认预约充电帧类型, pileSn:{}", pileSn, e);
|
||||
}
|
||||
return YKCFrameTypeCode.RESERVATION_CHARGING_SETUP_CODE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user