| | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 运营车辆年检/保险/运营资质过期检查定时任务 |
| | |
| | | public void checkAndStockExpiredVehicles() { |
| | | LocalDate today = LocalDate.now(ZONE_GMT8); |
| | | LocalDateTime todayStart = today.atStartOfDay(); |
| | | List<XpVehicle> expiredVehicles = xpVehicleService.lambdaQuery() |
| | | .eq(XpVehicle::getVehicleType, 2) |
| | | .and(w -> w.lt(XpVehicle::getAnnualInspectionDate, todayStart) |
| | | .or().lt(XpVehicle::getInsuranceEndTime, todayStart) |
| | | .or().lt(XpVehicle::getQualificationExpireTime, todayStart)) |
| | | .list(); |
| | | |
| | | LambdaUpdateWrapper<XpVehicle> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(XpVehicle::getVehicleType, 2) |
| | |
| | | .set(XpVehicle::getStatus, 3); |
| | | |
| | | boolean updated = xpVehicleService.update(updateWrapper); |
| | | if (updated) { |
| | | // xpVehicleService.reportVehicleOperateLogoutToMinistry(expiredVehicles, "证件过期自动下线"); |
| | | } |
| | | log.info("运营车辆证件过期检查任务执行完成,todayStart={}, updated={}", todayStart, updated); |
| | | } |
| | | } |