From b181d08b9c8c4f3f4d8c475a60506ba4d93c8382 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期三, 09 四月 2025 11:38:23 +0800
Subject: [PATCH] 灌溉计划详情页,包含计划信息、轮灌组信息、取水口命令发布员结果信息
---
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java | 57 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 39 insertions(+), 18 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 79c15cf..b313e63 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,41 +1,50 @@
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 ;//绾跨▼姹犵嚎绋嬫渶澶т釜鏁�
private static final Integer ThreadPoolPriority = 5 ;//绾跨▼浼樺厛绾�
+ /**
+ * 缁熻寮�濮嬪皬鏃讹紝蹇呴』0鐐规垨涔嬪悗锛岃StatisticsJob涓粺璁★紝鏃ョ粺璁℃槸缁熻鏄ㄥぉ鐨�
+ */
@Value("${auto-statistics.startHour: 0}")
protected Integer startHour;//缁熻寮�濮嬪皬鏃�
@Value("${auto-statistics.startMinute: 5}")
protected Integer startMinute;//缁熻寮�濮嬪垎閽�
+
+
+ @Autowired
+ protected ResourceLoader resourceLoader ;
/**
* SpringBoot瀹瑰櫒宸茬粡鍑嗗濂戒簡锛屾墽琛屼笅闈㈡柟娉�
@@ -50,6 +59,7 @@
e.printStackTrace();
}finally {
try{
+ super.init(resourceLoader);
this.start(event);
}catch (Exception e){
log.error("娉ㄥ唽缁熻瀹氭椂浠诲姟鍑洪敊", e);
@@ -61,7 +71,18 @@
* 鍒濆鍖�
*/
private void start(ApplicationReadyEvent event) throws Exception{
- SchedulerTaskSupport.setThreadPoolPro(ThreadPoolMaxCount, ThreadPoolPriority);
- SchedulerTaskSupport.addDailyJob(JobName, JobGroupName, StatisticsJob.class, null, startHour, startMinute ) ;
+ if(startHour < 0 || startHour > 5){
+ startHour = 0 ;
+ }
+ 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