From 123ed266760b75e0ffb89e24b3cec57d564419a4 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 07 二月 2025 09:36:22 +0800
Subject: [PATCH] 大屏展示模块:当前信息统计优化,监测信息统计实现。

---
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java |   49 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java
index af3fb64..53746fb 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java
@@ -1,31 +1,33 @@
 package com.dy.pipIrrStatistics.statistics;
+import com.dy.common.schedulerTask.SchedulerTaskSupport;
+import com.dy.pipIrrGlobal.util.Org;
+import com.dy.pipIrrGlobal.util.OrgListenerSupport;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.lang.NonNull;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
 
 /**
  * @Author: liurunyu
  * @Date: 2024/7/22 14:39
  * @Description
- */
-
-import com.dy.common.schedulerTask.SchedulerTaskSupport;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.event.ApplicationReadyEvent;
-import org.springframework.context.ApplicationListener;
-import org.springframework.lang.NonNull;
-import org.springframework.stereotype.Component;
-
-/**
  * 鐩戝惉鍣紝瀹炵幇鍔熻兘锛氬湪绯荤粺鍚姩鏃跺垵濮嬪寲锛屽悜鏁版嵁搴撲腑鎻掑叆鏁版嵁
  * 鏈洃鍚櫒涓嶈兘閲囩敤ServletContextListener鏂瑰紡锛屽洜涓篠ervlet涓婁笅鏂嘋ontext鍒涘缓鍚�
  * Spring瀹瑰櫒骞舵病鏈夊垱寤哄畬锛岃�屾湰绫讳腑鐢ㄤ簡Spring瀹瑰櫒涓殑Bean锛屽嵆*Dao 銆�
  * 鎵�浠ラ噰鐢ㄤ簡Spring浜嬩欢鐩戝惉鍣ㄦ潵瀹炵幇
  */
+@Slf4j
 @Component
-public class StatisticsListener implements ApplicationListener<ApplicationReadyEvent> {
+public class StatisticsListener extends OrgListenerSupport  implements ApplicationListener<ApplicationReadyEvent> {
 
-    private static Logger log = LogManager.getLogger(StatisticsListener.class.getName()) ;
-
+    protected static final String orgKey = "tag" ;
     private static final String JobName = "statisticsJob" ;
     private static final String JobGroupName = "statisticsGroup" ;
     private static final Integer ThreadPoolMaxCount = 1 ;//绾跨▼姹犵嚎绋嬫渶澶т釜鏁�
@@ -40,6 +42,10 @@
     @Value("${auto-statistics.startMinute: 5}")
     protected Integer startMinute;//缁熻寮�濮嬪垎閽�
 
+
+    @Autowired
+    protected ResourceLoader resourceLoader ;
+
     /**
      * SpringBoot瀹瑰櫒宸茬粡鍑嗗濂戒簡锛屾墽琛屼笅闈㈡柟娉�
      * @param event 浜嬩欢
@@ -53,6 +59,7 @@
             e.printStackTrace();
         }finally {
             try{
+                super.init(resourceLoader);
                 this.start(event);
             }catch (Exception e){
                 log.error("娉ㄥ唽缁熻瀹氭椂浠诲姟鍑洪敊", e);
@@ -67,7 +74,15 @@
         if(startHour < 0 || startHour > 5){
             startHour = 0 ;
         }
-        SchedulerTaskSupport.setThreadPoolPro(ThreadPoolMaxCount, ThreadPoolPriority);
-        SchedulerTaskSupport.addDailyJob(JobName, JobGroupName, StatisticsJob.class, null, startHour, startMinute ) ;
+        List<Org.OrgVo> orgList = Org.OrgList ;
+        if(orgList != null && orgList.size() >0){
+            SchedulerTaskSupport.setThreadPoolPro(ThreadPoolMaxCount * orgList.size(), ThreadPoolPriority);
+            for(Org.OrgVo vo : orgList){
+                HashMap<String , Object> jobDataMap	= new HashMap<String , Object>() ;
+                jobDataMap.put(orgKey, vo.tag) ;
+                SchedulerTaskSupport.addDailyJob(JobName + vo.tag, JobGroupName, StatisticsJob.class, jobDataMap, startHour, startMinute ) ;
+                //SchedulerTaskSupport.addSecondlyJob(JobName + vo.tag, JobGroupName, TestJob.class, jobDataMap, 10, 10000, 0 ) ;
+            }
+        }
     }
 }

--
Gitblit v1.8.0