This commit is contained in:
Lemon
2024-05-24 14:58:16 +08:00
5 changed files with 33 additions and 6 deletions

View File

@@ -222,4 +222,8 @@ public class PileController extends BaseController {
commonService.commonQueryStationStatus(stationId, thirdPartyType);
}
}
/**
* 预约充电接口
*/
}

View File

@@ -33,6 +33,7 @@ public class ReservedChargingCommand {
/**
* 操作
* 0x01:启动 0x02:取消 0x03:修改
*/
private String operation;

View File

@@ -29,6 +29,7 @@ import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.*;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.StringUtils;
@@ -36,6 +37,7 @@ import com.jsowell.common.util.bean.BeanUtils;
import com.jsowell.common.util.id.IdUtils;
import com.jsowell.common.util.id.SnowflakeIdWorker;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.domain.ykcCommond.ReservedChargingCommand;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO;
@@ -3548,6 +3550,9 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
}
}
/**
* 预约时间
*/
if (StringUtils.equals(dto.getStartType(), StartTypeEnum.RESERVED.getValue())) {
orderBasicInfo.setReservedStartTime(DateUtils.parseDate(dto.getReservedStartTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
orderBasicInfo.setReservedEndTime(DateUtils.parseDate(dto.getReservedEndTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
@@ -3586,6 +3591,28 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
.orderDetail(orderDetail)
.build();
pileTransactionService.doCreateOrder(createOrderTransactionDTO);
/**
* 异步发送预约充电指令
*/
if (StringUtils.equals(dto.getStartType(), StartTypeEnum.RESERVED.getValue())) {
ReservedChargingCommand command = ReservedChargingCommand.builder()
.transactionCode(orderBasicInfo.getTransactionCode())
.pileSn(orderBasicInfo.getPileSn())
.connectorCode(orderBasicInfo.getPileConnectorCode())
.operation(BytesUtil.bcd2Str(new byte[]{0x01}))
.reservedStartTime(DateUtils.parseDate(dto.getReservedStartTime(), DateUtils.YYYY_MM_DD_HH_MM_SS))
.reservedStartTime(DateUtils.parseDate(dto.getReservedEndTime(), DateUtils.YYYY_MM_DD_HH_MM_SS))
.amount(new BigDecimal(Constants.FIVE_HUNDRED))
.build();
CompletableFuture.runAsync(() -> {
try {
pileRemoteService.reservedCharging(command);
} catch (Exception e) {
logger.error("异步发送预约充电指令, orderCode:{}", orderBasicInfo.getOrderCode(), e);
}
});
}
return orderBasicInfo;
}

View File

@@ -486,7 +486,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
String connectorCode = command.getConnectorCode();
byte[] connectorCodeByteArr = BytesUtil.str2Bcd(connectorCode);
// 枪口号
// 0x01:启动 0x02:取消 0x03:修改
String operation = command.getOperation();
byte[] operateByteArr = BytesUtil.str2Bcd(operation);

View File

@@ -69,11 +69,6 @@ public class AMapServiceImpl implements AMapService {
@Autowired
private OrderBasicInfoService orderBasicInfoService;
/**
* 异步操作任务调度线程池
*/
private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService");
/**
* 高德拉取充电站静态数据
* @param dto