diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java b/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java index 2470c1015..ffbd1bb50 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java @@ -866,13 +866,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { } } - public static void main(String[] args) { - System.out.println(isInDiscountPeriod("20:00", "08:00", "00:35:58")); // true - System.out.println(isInDiscountPeriod("00:00", "00:00", "19:59:59")); // true - System.out.println(isInDiscountPeriod("20:00", "20:00", "08:00:00")); // true - System.out.println(isInDiscountPeriod("20:00", "08:00", "08:00:00")); // false - } - /** * 当前时间是否在时间指定范围内
* diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index af2a9af97..c69d49084 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -648,25 +648,42 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { if (CollectionUtils.isEmpty(orderList)) { return; } - long currentTimeMillis = System.currentTimeMillis(); - // 判断支付成功时间距当前时间是否大于15分钟 + // long currentTimeMillis = System.currentTimeMillis(); for (OrderBasicInfo orderBasicInfo : orderList) { - // 立即启动的订单使用支付时间判断,预约充电的订单使用预约时间判断 - long time; - String startType = orderBasicInfo.getStartType(); - if (StringUtils.equals(StartTypeEnum.NOW.getValue(), startType)) { - Date payTime = orderBasicInfo.getPayTime(); - time = payTime == null ? 0L : payTime.getTime(); - } else { - Date reservedStartTime = orderBasicInfo.getReservedStartTime(); - time = reservedStartTime == null ? 0L : reservedStartTime.getTime(); - } + // 判断支付成功时间距当前时间是否大于15分钟 + // long time; + // String startType = orderBasicInfo.getStartType(); + // // 立即启动的订单使用支付时间判断,预约充电的订单使用预约时间判断 + // if (StringUtils.equals(StartTypeEnum.NOW.getValue(), startType)) { + // Date payTime = orderBasicInfo.getPayTime(); + // time = payTime == null ? 0L : payTime.getTime(); + // } else { + // Date reservedStartTime = orderBasicInfo.getReservedStartTime(); + // time = reservedStartTime == null ? 0L : reservedStartTime.getTime(); + // } + // + // if (currentTimeMillis - time < 1000 * 60 * 15) { + // logger.info("orderCode:{}, currentTimeMillis:{} - time:{} = {}, 支付成功时间距当前时间小于15分钟, 暂不执行退款", + // orderBasicInfo.getOrderCode(), currentTimeMillis, time, currentTimeMillis - time); + // continue; + // } - if (currentTimeMillis - time < 1000 * 60 * 15) { - logger.info("orderCode:{}, currentTimeMillis:{} - time:{} = {}, 支付成功时间距当前时间小于15分钟, 暂不执行退款", - orderBasicInfo.getOrderCode(), currentTimeMillis, time, currentTimeMillis - time); + // 判断支付成功时间距当前时间是否大于15分钟 + String startType = orderBasicInfo.getStartType(); + // 立即启动的订单使用支付时间判断,预约充电的订单使用预约时间判断 + String dateStr; + if (StringUtils.equals(StartTypeEnum.NOW.getValue(), startType)) { + dateStr = DateUtils.formatDateTime(orderBasicInfo.getPayTime()); + } else { + dateStr = DateUtils.formatDateTime(orderBasicInfo.getReservedStartTime()); + } + long l = DateUtils.minutesSince(dateStr); + if (l < 15) { + logger.info("orderCode:{}, 当前时间:{}与对比时间:{}间隔小于15分钟, 暂不执行退款", + orderBasicInfo.getOrderCode(), LocalDateTime.now().toString(), dateStr); continue; } + // 已经支付超过15分钟 判断充电桩的状态 String pileConnectorCode = orderBasicInfo.getPileSn() + orderBasicInfo.getConnectorCode(); PileConnectorInfoVO connector = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(pileConnectorCode);