|
|
@@ -386,10 +386,10 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
startCharge = platformApiService.queryStartCharge(PlatformCache.INSTANCE.getPlatformNameByConnectorId(connectorId), order.getStartChargeSeq(), connectorId, qrCode, balance);
|
|
|
} catch (Exception e) {
|
|
|
// 这里可能超时,忽略
|
|
|
- LOGGER.error("启动充电异常,订单:{}", order.getStartChargeSeq());
|
|
|
+ LOGGER.error("启动充电异常,订单:{},异常信息:{}", order.getStartChargeSeq(), e.getMessage());
|
|
|
// 启动充电超时,更新订单状态为取消
|
|
|
chargeOrderService.lambdaUpdate()
|
|
|
- .set(ChargeOrder::getOrderStatus, ChargeOrder.CHARGE_STATUS_已取消)
|
|
|
+ .set(ChargeOrder::getOrderStatus, ChargeOrder.ORDER_STATUS_失败)
|
|
|
.set(ChargeOrder::getChargeStatus, ChargeOrder.CHARGE_STATUS_已取消)
|
|
|
.set(ChargeOrder::getStopReason, ChargeOrder.STOP_REASON_启动充电异常)
|
|
|
.eq(ChargeOrder::getStartChargeSeq, order.getStartChargeSeq()).update();
|
|
|
@@ -403,23 +403,54 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
} else {
|
|
|
// 启动充电失败
|
|
|
LOGGER.error("设备启动充电失败:{}", startCharge);
|
|
|
- switch (equipAuth.getIntValue("FailReason")) {
|
|
|
- case 1 -> // 设备不存在
|
|
|
- throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_NOT_EXIST);
|
|
|
- case 2 -> // 设备离线
|
|
|
- // todo 设备离线,加入重试机制
|
|
|
- throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_OFFLINE);
|
|
|
- case 3 -> // 存在未完成的订单
|
|
|
- throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_EXIST_ORDER_UNFINISHED);
|
|
|
- case 4 -> // 此订单为停车中
|
|
|
- throw new BusinessException(ResponseEnum.PLATFORM_ORDER_IS_PARKING);
|
|
|
- case 5 -> // 此订单已关闭
|
|
|
- throw new BusinessException(ResponseEnum.PLATFORM_ORDER_CLOSED);
|
|
|
- case 6 -> // 设备未插枪
|
|
|
- throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_NOT_CONNECTED);
|
|
|
- case 7 -> // 预充金额存在且小于1元
|
|
|
- throw new BusinessException(ResponseEnum.INSUFFICIENT_USER_BALANCE);
|
|
|
+ var failReason = equipAuth.getIntValue("FailReason");
|
|
|
+ // 朗新和EN+分开处理
|
|
|
+ if ("LONGSHINE".equals(PlatformCache.INSTANCE.getPlatformNameByConnectorId(connectorId))) {
|
|
|
+ switch (failReason) {
|
|
|
+ case 1 -> // 设备不存在
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_NOT_EXIST);
|
|
|
+ case 2 -> // 设备离线
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_OFFLINE);
|
|
|
+ case 3 -> // 充电枪未与车连接
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_NOT_CONNECTED);
|
|
|
+ case 4 -> // 余额不足
|
|
|
+ throw new BusinessException(ResponseEnum.INSUFFICIENT_USER_BALANCE);
|
|
|
+ case 5 -> // 设备故障
|
|
|
+ throw new BusinessException("设备故障");
|
|
|
+ case 6 -> // 设备异常
|
|
|
+ throw new BusinessException("设备异常");
|
|
|
+ case 7 -> // 参数错误
|
|
|
+ throw new BusinessException("参数错误");
|
|
|
+ case 8 -> // 二维码校验失败
|
|
|
+ throw new BusinessException("二维码校验失败");
|
|
|
+ case 9 -> // 设备已在服务中
|
|
|
+ throw new BusinessException("设备已在服务中");
|
|
|
+ case 10 -> // 系统异常
|
|
|
+ throw new BusinessException("系统异常");
|
|
|
+ case 11 -> // 请求太频繁
|
|
|
+ throw new BusinessException("请求太频繁");
|
|
|
+ }
|
|
|
}
|
|
|
+ if ("EN_PLUS".equals(PlatformCache.INSTANCE.getPlatformNameByConnectorId(connectorId))) {
|
|
|
+ switch (failReason) {
|
|
|
+ case 1 -> // 设备不存在
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_NOT_EXIST);
|
|
|
+ case 2 -> // 设备离线
|
|
|
+ // todo 设备离线,加入重试机制
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_OFFLINE);
|
|
|
+ case 3 -> // 存在未完成的订单
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_EXIST_ORDER_UNFINISHED);
|
|
|
+ case 4 -> // 此订单为停车中
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_ORDER_IS_PARKING);
|
|
|
+ case 5 -> // 此订单已关闭
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_ORDER_CLOSED);
|
|
|
+ case 6 -> // 设备未插枪
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_NOT_CONNECTED);
|
|
|
+ case 7 -> // 预充金额存在且小于1元
|
|
|
+ throw new BusinessException(ResponseEnum.INSUFFICIENT_USER_BALANCE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_START_FAIL);
|
|
|
}
|
|
|
} else {
|