From 638e7deedf01e2fa276d38f2215003e43996c54f Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期一, 09 六月 2025 21:07:42 +0800
Subject: [PATCH] 开发中台接口对接

---
 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java |   70 +++++++++++-----------------------
 1 files changed, 23 insertions(+), 47 deletions(-)

diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java
index c380b73..220b076 100644
--- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java
+++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java
@@ -1,38 +1,35 @@
 package com.stylefeng.guns.modular.system.util;
 
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.stylefeng.guns.modular.account.service.UserWithdrawalService;
-import com.stylefeng.guns.modular.cloudPayment.example.CusApplicationExample;
-import com.stylefeng.guns.modular.system.model.UserWithdrawal;
 import com.stylefeng.guns.modular.system.service.IDriverService;
 import com.stylefeng.guns.modular.system.service.IOrderService;
 import com.stylefeng.guns.modular.system.service.IUserMerchantCouponService;
-import com.unionpay.upyzt.resp.CusApplicationResp;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.context.WebServerInitializedEvent;
+import org.springframework.boot.web.server.WebServer;
+import org.springframework.context.ApplicationListener;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
-import java.util.stream.Collectors;
 
 
 /**
  * 定时任务工具类
  */
 @Component
-public class TaskUtil {
-
+public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> {
+    
     @Autowired
     private IDriverService driverService;
-
+    
     @Autowired
     private IOrderService orderService;
-
+    
     @Autowired
     private JGPushUtil jgPushUtil;
-
+    
     @Autowired
     private IUserMerchantCouponService userMerchantCouponService;
     @Autowired
@@ -64,23 +61,6 @@
         }
     }
 
-    /**
-     * 每隔一分钟去处理的定时任务
-     */
-//    @Scheduled(fixedRate = 1000 * 60)
-//    public void userWith(){
-//        try {
-//            List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>());
-//            List<UserWithdrawal> collect = userWithdrawals.stream().filter(e -> "succeeded".equals(e.getApplicationStatus())).collect(Collectors.toList());
-//            for (UserWithdrawal userWithdrawal : collect) {
-//                CusApplicationResp cusApplicationResp = CusApplicationExample.retrieveByOutRequestNo(userWithdrawal.getOutRequestNo());
-//                System.out.println("请求订单号:"+userWithdrawal.getApplicationStatus()+"================="+cusApplicationResp);
-//
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//    }
 
 
 
@@ -98,33 +78,29 @@
             e.printStackTrace();
         }
     }
-
-
-
+    
+    
     /**
      * 每天的凌晨执行的任务
      */
     @Scheduled(cron = "0 0 0 * * *")
-    public void taskDay(){
+    public void taskDay() {
         try {
             //生成当天的司机活动
             driverService.addTodayActivity();
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
-
-
-//
-//    /**
-//     * 每月第一天的1点执行的任务
-//     */
-//    @Scheduled(cron = "0 0 1 1 * *")
-//    public void taskMonth(){
-//        try {
-//
-//        }catch (Exception e){
-//            e.printStackTrace();
-//        }
-//    }
+    
+    
+    @Override
+    public void onApplicationEvent(WebServerInitializedEvent event) {
+        // 获取环境对象
+        WebServer webServer = event.getWebServer();
+        // 获取端口号
+        int port = webServer.getPort();
+        // 打印端口号
+        System.out.println("Spring Boot应用已启动,访问端口:" + port);
+    }
 }

--
Gitblit v1.7.1