|
@@ -62,13 +62,19 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
private final DelayService<DelayChargeOrder> startDelayService;
|
|
private final DelayService<DelayChargeOrder> startDelayService;
|
|
|
private final DelayService<DelayChargeOrder> stopDelayService;
|
|
private final DelayService<DelayChargeOrder> stopDelayService;
|
|
|
|
|
|
|
|
- public ChargeServiceImpl(EquipmentRelationService equipmentRelationService, EquipmentInfoService equipmentInfoService,
|
|
|
|
|
- ConnectorInfoService connectorInfoService, ChargeOrderService chargeOrderService,
|
|
|
|
|
- OrderRechargeRightsService orderRechargeRightsService, UserRechargeRightsService userRechargeRightsService,
|
|
|
|
|
- UserCouponService userCouponService, OrderCouponService orderCouponService,
|
|
|
|
|
- AccountService accountService, PlatformApiService platformApiService,
|
|
|
|
|
|
|
+ public ChargeServiceImpl(EquipmentRelationService equipmentRelationService,
|
|
|
|
|
+ EquipmentInfoService equipmentInfoService,
|
|
|
|
|
+ ConnectorInfoService connectorInfoService,
|
|
|
|
|
+ ChargeOrderService chargeOrderService,
|
|
|
|
|
+ OrderRechargeRightsService orderRechargeRightsService,
|
|
|
|
|
+ UserRechargeRightsService userRechargeRightsService,
|
|
|
|
|
+ UserCouponService userCouponService,
|
|
|
|
|
+ OrderCouponService orderCouponService,
|
|
|
|
|
+ AccountService accountService,
|
|
|
|
|
+ PlatformApiService platformApiService,
|
|
|
@Qualifier("StartChargeDelayJob") @Lazy DelayService<DelayChargeOrder> startDelayService,
|
|
@Qualifier("StartChargeDelayJob") @Lazy DelayService<DelayChargeOrder> startDelayService,
|
|
|
- @Qualifier("StopChargeDelayJob") @Lazy DelayService<DelayChargeOrder> stopDelayService, StringRedisTemplate redisTemplate) {
|
|
|
|
|
|
|
+ @Qualifier("StopChargeDelayJob") @Lazy DelayService<DelayChargeOrder> stopDelayService,
|
|
|
|
|
+ StringRedisTemplate redisTemplate) {
|
|
|
this.equipmentRelationService = equipmentRelationService;
|
|
this.equipmentRelationService = equipmentRelationService;
|
|
|
this.equipmentInfoService = equipmentInfoService;
|
|
this.equipmentInfoService = equipmentInfoService;
|
|
|
this.connectorInfoService = connectorInfoService;
|
|
this.connectorInfoService = connectorInfoService;
|
|
@@ -191,8 +197,7 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
@DSTransactional(rollbackFor = Exception.class)
|
|
@DSTransactional(rollbackFor = Exception.class)
|
|
|
- public Map<String, String> queryStartCharge(Long userId, String connectorId, Long userRechargeRightsId, Long userCouponId,
|
|
|
|
|
- Boolean isBooking, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
|
|
|
|
+ public Map<String, String> queryStartCharge(Long userId, String connectorId, Long userRechargeRightsId, Long userCouponId, Boolean isBooking, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
var connectorId2StationId = getConnectorIdAndStationId(connectorId);
|
|
var connectorId2StationId = getConnectorIdAndStationId(connectorId);
|
|
|
connectorId = connectorId2StationId.get("connectorId");
|
|
connectorId = connectorId2StationId.get("connectorId");
|
|
|
var stationId = connectorId2StationId.get("stationId");
|
|
var stationId = connectorId2StationId.get("stationId");
|
|
@@ -228,7 +233,8 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
order.setDiscountType(Activity.DISCOUNT_TYPE_服务费折扣权益);
|
|
order.setDiscountType(Activity.DISCOUNT_TYPE_服务费折扣权益);
|
|
|
|
|
|
|
|
var orderRechargeRights = new OrderRechargeRights()
|
|
var orderRechargeRights = new OrderRechargeRights()
|
|
|
- .setUserId(userId).setStartChargeSeq(startChargeSeq)
|
|
|
|
|
|
|
+ .setUserId(userId)
|
|
|
|
|
+ .setStartChargeSeq(startChargeSeq)
|
|
|
.setActivityId(userRechargeRights.getActivityId())
|
|
.setActivityId(userRechargeRights.getActivityId())
|
|
|
.setRightsId(userRechargeRights.getRightsId())
|
|
.setRightsId(userRechargeRights.getRightsId())
|
|
|
.setUserRightsId(userRechargeRights.getId())
|
|
.setUserRightsId(userRechargeRights.getId())
|
|
@@ -392,13 +398,18 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
.set(ChargeOrder::getOrderStatus, ChargeOrder.ORDER_STATUS_失败)
|
|
.set(ChargeOrder::getOrderStatus, ChargeOrder.ORDER_STATUS_失败)
|
|
|
.set(ChargeOrder::getChargeStatus, ChargeOrder.CHARGE_STATUS_已取消)
|
|
.set(ChargeOrder::getChargeStatus, ChargeOrder.CHARGE_STATUS_已取消)
|
|
|
.set(ChargeOrder::getStopReason, ChargeOrder.STOP_REASON_启动充电异常)
|
|
.set(ChargeOrder::getStopReason, ChargeOrder.STOP_REASON_启动充电异常)
|
|
|
- .eq(ChargeOrder::getStartChargeSeq, order.getStartChargeSeq()).update();
|
|
|
|
|
|
|
+ .eq(ChargeOrder::getStartChargeSeq, order.getStartChargeSeq())
|
|
|
|
|
+ .update();
|
|
|
return Map.of("startChargeSeq", order.getStartChargeSeq());
|
|
return Map.of("startChargeSeq", order.getStartChargeSeq());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (startCharge != null && startCharge.containsKey("SuccStat") && startCharge.getIntValue("SuccStat") == 0) {
|
|
if (startCharge != null && startCharge.containsKey("SuccStat") && startCharge.getIntValue("SuccStat") == 0) {
|
|
|
// 启动成功,更新充电订单状态
|
|
// 启动成功,更新充电订单状态
|
|
|
- chargeOrderService.lambdaUpdate().set(ChargeOrder::getIsBooking, ChargeOrder.IS_BOOKING_否).set(ChargeOrder::getChargeStatus, startCharge.getIntValue("StartChargeSeqStat")).eq(ChargeOrder::getStartChargeSeq, order.getStartChargeSeq()).update();
|
|
|
|
|
|
|
+ chargeOrderService.lambdaUpdate()
|
|
|
|
|
+ .set(ChargeOrder::getIsBooking, ChargeOrder.IS_BOOKING_否)
|
|
|
|
|
+ .set(ChargeOrder::getChargeStatus, startCharge.getIntValue("StartChargeSeqStat"))
|
|
|
|
|
+ .eq(ChargeOrder::getStartChargeSeq, order.getStartChargeSeq())
|
|
|
|
|
+ .update();
|
|
|
return Map.of("startChargeSeq", order.getStartChargeSeq());
|
|
return Map.of("startChargeSeq", order.getStartChargeSeq());
|
|
|
} else {
|
|
} else {
|
|
|
// 启动充电失败
|
|
// 启动充电失败
|
|
@@ -459,9 +470,17 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
switch (equipAuth.getIntValue("FailReason")) {
|
|
switch (equipAuth.getIntValue("FailReason")) {
|
|
|
case 1 -> // 设备未插枪
|
|
case 1 -> // 设备未插枪
|
|
|
throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_NOT_CONNECTED);
|
|
throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_NOT_CONNECTED);
|
|
|
|
|
+
|
|
|
case 2 -> // 设备检测失败
|
|
case 2 -> // 设备检测失败
|
|
|
throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_CHECK_FAIL);
|
|
throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_CHECK_FAIL);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 订单标记为失败已结束
|
|
|
|
|
+ chargeOrderService.lambdaUpdate()
|
|
|
|
|
+ .set(ChargeOrder::getOrderStatus, ChargeOrder.ORDER_STATUS_失败)
|
|
|
|
|
+ .set(ChargeOrder::getChargeStatus, ChargeOrder.CHARGE_STATUS_已结束)
|
|
|
|
|
+ .set(ChargeOrder::getStopReason, ChargeOrder.STOP_REASON_启动充电异常)
|
|
|
|
|
+ .eq(ChargeOrder::getStartChargeSeq, order.getStartChargeSeq())
|
|
|
|
|
+ .update();
|
|
|
throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_AUTH_FAIL);
|
|
throw new BusinessException(ResponseEnum.PLATFORM_EQUIP_AUTH_FAIL);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|