From a7485c9f9b16ece4f12f0b3f6d6a8c90370f5ae4 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期三, 09 四月 2025 16:08:30 +0800
Subject: [PATCH] 灌溉计划详情信息增加取水口命令发布失败数量
---
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java | 51 +++++++++++++++++++++++++++++++++------------------
1 files changed, 33 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 af3fb64..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,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