From 1b9a01bf5000714b08a75a50dd1f5f3eab65d888 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期五, 08 十二月 2023 17:18:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 cloud-server-other/src/main/java/com/dsh/other/util/TaskUtil.java |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 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 c406008..e05a3f2 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
@@ -8,6 +8,7 @@
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
@@ -29,14 +30,28 @@
     @Scheduled(fixedRate = 60000)
     public void taskMinute() {
         try {
+                Date date = new Date(); // 要增加的日期
+
             List<SiteBooking> siteBookings = siteBookingMapper.
                     selectList(new LambdaQueryWrapper<SiteBooking>().eq(SiteBooking::getStatus, 0));
             for (SiteBooking siteBooking : siteBookings) {
-                long time = siteBooking.getInsertTime().getTime();
-                long l = time + 1800 * 1000;
-                if (System.currentTimeMillis() > l) {
+
+                Date insert = siteBooking.getInsertTime();
+                // 创建 Calendar 对象,并设置为指定的日期
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(insert);
+
+                // 增加 30 分钟
+                calendar.add(Calendar.MINUTE, 30);
+
+                // 获取增加后的日期
+                Date newDate = calendar.getTime();
+
+//                long time = siteBooking.getInsertTime().getTime();
+//                long l = time + 1800 * 1000;
+                if (date.after(newDate)) {
                     siteBooking.setStatus(5);
-                    siteBookingMapper.deleteById(siteBooking.getId());
+                    siteBookingMapper.updateById(siteBooking);
                 }
             }
             //定时修改赛事状态

--
Gitblit v1.7.1