From 1e790795f4e2c365f604ecc0fc1b290e3ff3c35f Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期五, 20 十月 2023 09:34:22 +0800
Subject: [PATCH] 更新bug

---
 cloud-server-other/src/main/java/com/dsh/other/util/TaskUtil.java |   19 +++++++++++++++++++
 1 files changed, 19 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 ca148cc..7eeb104 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
@@ -1,7 +1,15 @@
 package com.dsh.other.util;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.dsh.other.entity.SiteBooking;
+import com.dsh.other.mapper.SiteBookingMapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
 
 /**
  * @author zhibing.pu
@@ -10,6 +18,8 @@
 @Component
 public class TaskUtil {
 
+    @Resource
+    private SiteBookingMapper siteBookingMapper;
 
     /**
      * 每隔一分钟去处理的定时任务
@@ -17,6 +27,15 @@
     @Scheduled(fixedRate = 60000)
     public void taskMinute(){
         try {
+            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){
+                    siteBooking.setStatus(5);
+                    siteBookingMapper.updateById(siteBooking);
+                }
+            }
             //定时修改赛事状态
         } catch (Exception e) {
             e.printStackTrace();

--
Gitblit v1.7.1