mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
update 预约充电
This commit is contained in:
@@ -288,28 +288,25 @@ public class OrderService {
|
||||
orderInfo.setPayTime(new Date());
|
||||
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
|
||||
|
||||
if (StringUtils.equals(orderInfo.getStartType(), StartTypeEnum.NOW.getValue())) {
|
||||
startCharging(orderInfo);
|
||||
if (StringUtils.equals(orderInfo.getStartType(), StartTypeEnum.NOW.getValue())) { // 立即启动充电
|
||||
String pileSn = orderInfo.getPileSn();
|
||||
// 发送启动充电指令前,再次下发计费模板
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||
if (billingTemplateVO != null) {
|
||||
pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO);
|
||||
}
|
||||
// 发送启动指令
|
||||
pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), orderInfo.getPayAmount());
|
||||
} else { // 预约充电
|
||||
// 修改枪口状态为 占用预约
|
||||
|
||||
// 下发修改充电桩设置指令
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动充电
|
||||
* @param orderInfo
|
||||
*/
|
||||
public void startCharging(OrderBasicInfo orderInfo) {
|
||||
String pileSn = orderInfo.getPileSn();
|
||||
// 发送启动充电指令前,再次下发计费模板
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||
if (billingTemplateVO != null) {
|
||||
pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO);
|
||||
}
|
||||
|
||||
// 发送启动指令
|
||||
pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), orderInfo.getPayAmount());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存订单信息到数据库
|
||||
*
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.jsowell.netty.command.ykc;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class PileSettingCommand {
|
||||
/**
|
||||
* 充电桩编号
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 工作状态 0正常工作 1锁定
|
||||
*/
|
||||
private String workingState;
|
||||
|
||||
/**
|
||||
* 最大功率
|
||||
* 最大 100%,最小 30%
|
||||
*/
|
||||
private Integer maxPower;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.jsowell.netty.service.yunkuaichong;
|
||||
|
||||
import com.jsowell.netty.command.ykc.GetRealTimeMonitorDataCommand;
|
||||
import com.jsowell.netty.command.ykc.IssueQRCodeCommand;
|
||||
import com.jsowell.netty.command.ykc.PileSettingCommand;
|
||||
import com.jsowell.netty.command.ykc.ProofreadTimeCommand;
|
||||
import com.jsowell.netty.command.ykc.PublishPileBillingTemplateCommand;
|
||||
import com.jsowell.netty.command.ykc.RebootCommand;
|
||||
@@ -61,4 +62,9 @@ public interface YKCPushCommandService {
|
||||
* @param command
|
||||
*/
|
||||
void pushUpdateFileCommand(UpdateFileCommand command);
|
||||
|
||||
/**
|
||||
* 发送充电桩设置命令
|
||||
*/
|
||||
void pushPileSettingCommand(PileSettingCommand command);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.command.ykc.GetRealTimeMonitorDataCommand;
|
||||
import com.jsowell.netty.command.ykc.IssueQRCodeCommand;
|
||||
import com.jsowell.netty.command.ykc.PileSettingCommand;
|
||||
import com.jsowell.netty.command.ykc.ProofreadTimeCommand;
|
||||
import com.jsowell.netty.command.ykc.PublishPileBillingTemplateCommand;
|
||||
import com.jsowell.netty.command.ykc.RebootCommand;
|
||||
@@ -183,6 +184,10 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
transactionCode, pileSn, BytesUtil.bcd2Str(connectorCodeByteArr), logicCardNum, physicsCardNum, chargeAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送停止ch
|
||||
* @param command
|
||||
*/
|
||||
@Override
|
||||
public void pushStopChargingCommand(StopChargingCommand command) {
|
||||
String pileSn = command.getPileSn();
|
||||
@@ -342,4 +347,37 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
BytesUtil.binary(filePathByteArr, 16));
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Integer integer = new Integer(100);
|
||||
String s = Integer.toHexString(integer);
|
||||
byte[] bytes = s.getBytes();
|
||||
System.out.println(s);
|
||||
System.out.println(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pushPileSettingCommand(PileSettingCommand command) {
|
||||
|
||||
// 充电桩编号
|
||||
String pileSn = command.getPileSn();
|
||||
byte[] pileSnByteArr = BytesUtil.str2Bcd(pileSn);
|
||||
|
||||
// 工作状态
|
||||
String workingState = command.getWorkingState();
|
||||
byte[] workingStateByteArr;
|
||||
if (StringUtils.equals(workingState, "0")) {
|
||||
workingStateByteArr = Constants.zeroByteArray;
|
||||
} else {
|
||||
workingStateByteArr = Constants.oneByteArray;
|
||||
}
|
||||
|
||||
// 最大功率
|
||||
Integer maxPower = command.getMaxPower();
|
||||
byte[] maxPowerByteArr = BytesUtil.str2Bcd(maxPower.toString());
|
||||
|
||||
byte[] msg = Bytes.concat(pileSnByteArr, workingStateByteArr, maxPowerByteArr);
|
||||
|
||||
this.push(msg, pileSn, YKCFrameTypeCode.CHARGING_PILE_WORKING_PARAMETER_SETTING_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,9 @@ public class JsowellTask {
|
||||
}
|
||||
log.info("待启动充电订单:{}", list);
|
||||
for (OrderBasicInfo orderInfo : list) {
|
||||
// 下发充电桩设置指令
|
||||
|
||||
|
||||
String pileSn = orderInfo.getPileSn();
|
||||
// 发送启动充电指令前,再次下发计费模板
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||
|
||||
Reference in New Issue
Block a user