From 970453ec0b28479ba9ba30280051932cec8e4666 Mon Sep 17 00:00:00 2001
From: kongdeqiang <123456>
Date: 星期二, 30 十二月 2025 13:36:45 +0800
Subject: [PATCH] fix :修改

---
 src/main/java/com/boying/service/impl/EnterParkServiceImpl.java |    5 ++
 src/main/java/com/boying/job/DaPingScheduled.java               |    6 +-
 src/main/java/com/boying/job/ParkCarScheduled.java              |   51 +++++++++++++++++++++++++
 src/main/java/com/boying/service/EnterParkService.java          |    2 +
 4 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/boying/job/DaPingScheduled.java b/src/main/java/com/boying/job/DaPingScheduled.java
index acd4274..e3806b9 100644
--- a/src/main/java/com/boying/job/DaPingScheduled.java
+++ b/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("缁撴潫缁熻瀹氭椂浠诲姟-------銆�");
     }
 }
diff --git a/src/main/java/com/boying/job/ParkCarScheduled.java b/src/main/java/com/boying/job/ParkCarScheduled.java
new file mode 100644
index 0000000..0093d79
--- /dev/null
+++ b/src/main/java/com/boying/job/ParkCarScheduled.java
@@ -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("缁撴潫鎵ц鍦哄唴杞﹁締瀹氭椂鎺掓煡浠诲姟-------銆�");
+    }
+
+}
diff --git a/src/main/java/com/boying/service/EnterParkService.java b/src/main/java/com/boying/service/EnterParkService.java
index 63829cc..b3a3001 100644
--- a/src/main/java/com/boying/service/EnterParkService.java
+++ b/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);
 }
diff --git a/src/main/java/com/boying/service/impl/EnterParkServiceImpl.java b/src/main/java/com/boying/service/impl/EnterParkServiceImpl.java
index 2062705..cae0c85 100644
--- a/src/main/java/com/boying/service/impl/EnterParkServiceImpl.java
+++ b/src/main/java/com/boying/service/impl/EnterParkServiceImpl.java
@@ -82,4 +82,9 @@
             return null;
         }
     }
+
+    @Override
+    public void deleteById(Integer id) {
+        enterParkMapper.deleteById(id);
+    }
 }

--
Gitblit v1.9.1