mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-21 07:39:55 +08:00
update
This commit is contained in:
@@ -521,7 +521,12 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
log.info("羽信预约替换取消旧预约结果, reservedId:{}, pileConnectorCode:{}, result:{}",
|
||||
oldReservationInfo.getId(), oldReservationInfo.getPileConnectorCode(), cancelOldResult);
|
||||
if (!cancelOldResult) {
|
||||
return false;
|
||||
boolean oldReservationEnded = isReservationTimeEnded(oldReservationInfo);
|
||||
if (!oldReservationEnded) {
|
||||
return false;
|
||||
}
|
||||
log.warn("羽信预约替换取消旧预约失败, 但旧预约时间窗已过期, 继续下发新预约, memberId:{}, oldReservation:{}",
|
||||
memberId, reservationLogText(oldReservationInfo));
|
||||
}
|
||||
boolean createNewResult = sendReservationCommand(newReservationInfo, memberId, "01");
|
||||
log.info("羽信预约替换新预约结果, reservedId:{}, pileConnectorCode:{}, result:{}",
|
||||
@@ -529,6 +534,11 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
if (createNewResult) {
|
||||
return true;
|
||||
}
|
||||
if (!cancelOldResult) {
|
||||
log.error("羽信预约替换新预约失败, 旧预约取消失败但已判定过期, 不恢复旧预约, memberId:{}, oldReservation:{}, newReservation:{}",
|
||||
memberId, reservationLogText(oldReservationInfo), reservationLogText(newReservationInfo));
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
boolean restoreOldResult = sendReservationCommand(oldReservationInfo, memberId, "01");
|
||||
log.info("羽信预约替换恢复旧预约结果, reservedId:{}, pileConnectorCode:{}, result:{}",
|
||||
@@ -544,6 +554,21 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isReservationTimeEnded(PileReservationInfo reservationInfo) {
|
||||
if (reservationInfo == null || reservationInfo.getStartTime() == null || reservationInfo.getEndTime() == null) {
|
||||
log.warn("羽信旧预约过期判断失败, 预约时间为空, reservation:{}", reservationLogText(reservationInfo));
|
||||
return false;
|
||||
}
|
||||
LocalTime now = LocalTime.now();
|
||||
LocalTime startTime = reservationInfo.getStartTime().toLocalTime();
|
||||
LocalTime endTime = reservationInfo.getEndTime().toLocalTime();
|
||||
boolean crossDay = endTime.isBefore(startTime);
|
||||
boolean ended = !crossDay && !endTime.isAfter(now);
|
||||
log.info("羽信旧预约过期判断, reservedId:{}, pileConnectorCode:{}, now:{}, startTime:{}, endTime:{}, crossDay:{}, ended:{}",
|
||||
reservationInfo.getId(), reservationInfo.getPileConnectorCode(), now, startTime, endTime, crossDay, ended);
|
||||
return ended;
|
||||
}
|
||||
|
||||
private boolean isYuxinMainboard(String pileSn) {
|
||||
try {
|
||||
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
||||
|
||||
Reference in New Issue
Block a user