mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-05 02:20:12 +08:00
update 预约充电
This commit is contained in:
@@ -4,14 +4,17 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.jsowell.adapay.dto.BalancePaymentRequestDTO;
|
||||
import com.jsowell.adapay.service.AdapayService;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.domain.AdapayMemberAccount;
|
||||
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.ykcCommond.ReservedChargingCommand;
|
||||
import com.jsowell.pile.dto.ApplyRefundDTO;
|
||||
import com.jsowell.pile.dto.CarVinDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
@@ -70,6 +73,31 @@ public class TempController extends BaseController {
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileRemoteService pileRemoteService;
|
||||
|
||||
/**
|
||||
* 预约充电测试
|
||||
* http://localhost:8080/temp/reservedChargingTest
|
||||
*/
|
||||
@PostMapping("reservedChargingTest")
|
||||
public RestApiResponse<?> reservedChargingTest(@RequestBody ReservedChargingCommand command) {
|
||||
logger.info("发送预约充电指令, command:{}", JSON.toJSONString(command));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
// 发送预约充电指令
|
||||
pileRemoteService.reservedCharging(command);
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("预约充电测试warn", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("预约充电测试error", e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_DETAIL_ERROR);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 临时刷数据接口
|
||||
* http://localhost:8080/temp/tempUpdateVirtualAmount
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.jsowell.pile.domain.ykcCommond;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -40,11 +42,15 @@ public class ReservedChargingCommand {
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date reservedStartTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date reservedEndTime;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3114,7 +3114,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
ReservedChargingCommand command = ReservedChargingCommand.builder()
|
||||
.transactionCode(orderInfo.getTransactionCode())
|
||||
.pileSn(orderInfo.getPileSn())
|
||||
.connectorCode(orderInfo.getPileConnectorCode())
|
||||
.connectorCode(orderInfo.getConnectorCode())
|
||||
.operation(BytesUtil.bcd2Str(new byte[]{0x01}))
|
||||
.reservedStartTime(orderInfo.getReservedStartTime())
|
||||
.reservedEndTime(orderInfo.getReservedEndTime())
|
||||
|
||||
@@ -56,7 +56,8 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
private final List<String> frameTypeList = Lists.newArrayList(
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_RESTART_CODE.getBytes()),
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_CONTROL_START_CODE.getBytes()),
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_STOP_CHARGING_CODE.getBytes())
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_STOP_CHARGING_CODE.getBytes()),
|
||||
YKCUtils.frameType2Str(YKCFrameTypeCode.RESERVE_CHARGING_CODE.getBytes())
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -108,12 +109,12 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
channelFuture.addListener((ChannelFutureListener) channelFutureListener -> {
|
||||
// 检查操作的状态
|
||||
if (channelFutureListener.isSuccess()) {
|
||||
log.info("push结果【成功】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
|
||||
log.info("【push结果===>成功】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
|
||||
pileSn, channel.remoteAddress(), channel.id(), value, wholeMsg);
|
||||
} else {
|
||||
// 如果发生错误,则访问描述原因的Throwable
|
||||
Throwable cause = channelFutureListener.cause();
|
||||
log.info("push结果【失败】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
|
||||
log.info("【push结果===>失败】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
|
||||
pileSn, channel.remoteAddress(), channel.id(), value, wholeMsg);
|
||||
log.error("push发送命令失败, pileSn:{}", pileSn, cause);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user