From c036557db88c6297b9a626a892dce35c14ab8ee5 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期四, 09 十一月 2023 18:30:31 +0800
Subject: [PATCH] 11.6

---
 cloud-server-other/src/main/java/com/dsh/other/util/TaskUtil.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/cloud-server-other/src/main/java/com/dsh/other/util/TaskUtil.java b/cloud-server-other/src/main/java/com/dsh/other/util/TaskUtil.java
index b294a0c..8457a24 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/util/TaskUtil.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/util/TaskUtil.java
@@ -10,6 +10,7 @@
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @author zhibing.pu
@@ -65,4 +66,25 @@
     }
 
 
+    @Scheduled(fixedRate = 60000)
+    public void taskMinute2(){
+        try {
+            List<SiteBooking> siteBookings = siteBookingMapper.selectList(new LambdaQueryWrapper<SiteBooking>().eq(SiteBooking::getStatus, 0));
+            for (SiteBooking siteBooking : siteBookings) {
+                long time = siteBooking.getInsertTime().getTime();
+                long currentTime = System.currentTimeMillis();
+                long timeDifference = currentTime - time;
+                long minutes = TimeUnit.MILLISECONDS.toMinutes(timeDifference);
+                if (minutes > 30) {
+                    siteBooking.setStatus(5);
+                    siteBookingMapper.updateById(siteBooking);
+                }
+            }
+            //定时修改赛事状态
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
 }

--
Gitblit v1.7.1