| src/main/java/com/boying/job/DaPingScheduled.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/boying/job/ParkCarScheduled.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/boying/service/EnterParkService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/boying/service/impl/EnterParkServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/boying/job/DaPingScheduled.java
@@ -29,9 +29,9 @@ @Autowired private TicketBlackService ticketBlackService; //@Scheduled(cron = "0 0/40 * * * ?") @Scheduled(cron = "0 0/40 * * * ?") public void execute() throws IOException { System.out.println("开始定时任务-------》"); System.out.println("开始统计定时任务-------》"); // List<TicketBlack> list = ticketBlackService.updateType(); // if(list.size() > 0){ // for(TicketBlack t:list){ @@ -82,6 +82,6 @@ statistic.setData19(ticketBlackService.count1()); statistic.setData20(ticketBlackService.count2()); statisticService.saveOrUpdate(statistic); System.out.println("结束定时任务-------》"); System.out.println("结束统计定时任务-------》"); } } src/main/java/com/boying/job/ParkCarScheduled.java
New file @@ -0,0 +1,51 @@ package com.boying.job; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.boying.entity.EnterPark; import com.boying.entity.OutPark; import com.boying.service.EnterParkService; import com.boying.service.OutParkService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.IOException; import java.util.List; /** * @author kdq * @version 1.0.0 * @ClassName ParkCarScheduled.java * @Description TODO 场内车辆定时排查 * @createTime 2025年12月29日 08:50:00 */ @Component public class ParkCarScheduled { @Autowired private OutParkService outParkService; @Autowired private EnterParkService enterParkService; @Scheduled(cron = "0 0 1 * * ? ") public void execute() throws IOException { System.out.println("开始执行场内车辆定时排查任务-------》"); List<EnterPark> list = enterParkService.list(); for(EnterPark enterPark:list){ QueryWrapper<OutPark> queryWrapper = new QueryWrapper<>(); queryWrapper.lambda() .eq(OutPark::getEnterTime,enterPark.getCreateTime()) .eq(OutPark::getCarNo,enterPark.getCarNo()) .eq(OutPark::getParkId,enterPark.getParkId()); List<OutPark> outParks = outParkService.list(queryWrapper); if(outParks.size() == 0){ for (OutPark outPark : outParks) { if(outPark.getPrice() == 0 || outPark.getStatus2()==1){ enterParkService.deleteById(enterPark.getId()); } } } } System.out.println("结束执行场内车辆定时排查任务-------》"); } } src/main/java/com/boying/service/EnterParkService.java
@@ -26,4 +26,6 @@ void deleteByCarNo(String carNo,Integer parkId); EnterPark getByCarNoAndDate(String carNo, Integer parkId, LocalDateTime dateTime); void deleteById(Integer id); } src/main/java/com/boying/service/impl/EnterParkServiceImpl.java
@@ -82,4 +82,9 @@ return null; } } @Override public void deleteById(Integer id) { enterParkMapper.deleteById(id); } }