From 77d2e1f1456d51ab8d1201102a724b1a7ecb8ae7 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期三, 24 七月 2024 10:44:40 +0800 Subject: [PATCH] 1、完善quarz的任务工厂类; 2、完善DateTime类; 3、application-global.yml中增加统计任务启动时刻; 4、通信中间件加入对阀开工作报处理间隔控制; 5、统计子模块中自动统计逻辑继续实现。 --- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StClient.java | 50 +++++ pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/ServerProperties.java | 3 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StLoss.java | 50 +++++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsListener.java | 68 +++++++ pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealWorkReport.java | 38 +++ pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java | 72 ++++--- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml | 6 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java | 8 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml | 6 /dev/null | 59 ------ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StIntake.java | 50 +++++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsJob.java | 68 +++++++ pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskFactory.java | 5 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java | 27 +- pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 9 16 files changed, 389 insertions(+), 132 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskFactory.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskFactory.java index 1751d79..3b19a91 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskFactory.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskFactory.java @@ -61,11 +61,6 @@ if(threadPoolPriority != null && threadPoolPriority.intValue() >= 0){ pro.put("org.quartz.threadPool.threadPriority", "" + (threadPoolPriority==null?5:(threadPoolPriority<=0?5:threadPoolPriority))); } - if(threadPoolMaxCount != null && threadPoolPriority != null){ - if(threadPoolMaxCount.intValue() < threadPoolPriority.intValue()){ - throw new SchedulerException("threadPoolMaxCount蹇呴』澶т簬绛変簬threadPoolPriority") ; - } - } scheduler = new StdSchedulerFactory(pro).getScheduler(); } catch (SchedulerException e) { log.error(e) ; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java index 8e97a16..c5c1bc4 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java @@ -603,7 +603,7 @@ */ public static Long lastXMinuteTime(int xMin) { Calendar cal = Calendar.getInstance(); - cal.add(Calendar.MINUTE, -xMin); + cal.add(Calendar.MINUTE, xMin<=0?xMin:-xMin); Date date = cal.getTime() ; return date.getTime() ; } @@ -619,7 +619,7 @@ Date d = new SimpleDateFormat("yyyy-MM-dd HH", Locale.CHINA).parse(yyyy_MM_dd_HH); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); Date date = cal.getTime() ; return DateTime.yyyy_MM_dd_HH(date) ; } @@ -633,7 +633,7 @@ Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA).parse(yyyy_MM_dd_HH_mm); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); Date date = cal.getTime() ; return DateTime.yyyy_MM_dd_HH_mm(date) ; } @@ -647,7 +647,7 @@ Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).parse(yyyy_MM_dd_HH_mm_ss); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); Date date = cal.getTime() ; return DateTime.yyyy_MM_dd_HH_mm_ss(date) ; } @@ -661,7 +661,7 @@ Date d = new SimpleDateFormat("yyyyMMddHH", Locale.CHINA).parse(yyyyMMddHH); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); Date date = cal.getTime() ; return DateTime.yyyyMMddHH(date) ; } @@ -675,7 +675,7 @@ Date d = new SimpleDateFormat("yyyyMMddHHmm", Locale.CHINA).parse(yyyyMMddHHmm); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); Date date = cal.getTime() ; return DateTime.yyyyMMddHHmm(date) ; } @@ -689,7 +689,7 @@ Date d = new SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA).parse(yyyyMMddHHmmss); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); Date date = cal.getTime() ; return DateTime.yyyyMMddHHmmss(date) ; } @@ -703,7 +703,7 @@ public static String lastXHour_yyyy_MM_dd_HH(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyy_MM_dd_HH(date) ; } @@ -715,7 +715,7 @@ public static String lastXHour_yyyy_MM_dd_HH_mm(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyy_MM_dd_HH_mm(date) ; } @@ -727,7 +727,7 @@ public static String lastXHour_yyyy_MM_dd_HH_mm_ss(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyy_MM_dd_HH_mm_ss(date) ; } @@ -739,7 +739,7 @@ public static String lastXHour_yyyyMMddHH(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyyMMddHH(date) ; } @@ -751,7 +751,7 @@ public static String lastXHour_yyyyMMddHHmm(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyyMMddHHmm(date) ; } @@ -763,7 +763,7 @@ public static String lastXHour_yyyyMMddHHmmss(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, -xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?xhour:-xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyyMMddHHmmss(date) ; } @@ -779,7 +779,7 @@ Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).parse(yyyy_MM_dd_HH_mm_ss); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.MINUTE, xminute); + cal.add(Calendar.MINUTE, xminute<=0?-xminute:xminute ); Date date = cal.getTime() ; return DateTime.yyyy_MM_dd_HH_mm_ss(date) ; } @@ -795,7 +795,7 @@ Date d = new SimpleDateFormat("yyyy-MM-dd HH", Locale.CHINA).parse(yyyy_MM_dd_HH); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour ); Date date = cal.getTime() ; return DateTime.yyyy_MM_dd_HH(date) ; } @@ -809,7 +809,7 @@ Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA).parse(yyyy_MM_dd_HH_mm); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); Date date = cal.getTime() ; return DateTime.yyyy_MM_dd_HH_mm(date) ; } @@ -823,7 +823,7 @@ Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).parse(yyyy_MM_dd_HH_mm_ss); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); Date date = cal.getTime() ; return DateTime.yyyy_MM_dd_HH_mm_ss(date) ; } @@ -837,7 +837,7 @@ Date d = new SimpleDateFormat("yyyyMMddHH", Locale.CHINA).parse(yyyyMMddHH); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); Date date = cal.getTime() ; return DateTime.yyyyMMddHH(date) ; } @@ -851,7 +851,7 @@ Date d = new SimpleDateFormat("yyyyMMddHHmm", Locale.CHINA).parse(yyyyMMddHHmm); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); Date date = cal.getTime() ; return DateTime.yyyyMMddHHmm(date) ; } /** @@ -864,7 +864,7 @@ Date d = new SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA).parse(yyyyMMddHHmmss); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); Date date = cal.getTime() ; return DateTime.yyyyMMddHHmmss(date) ; } @@ -878,7 +878,7 @@ public static String nextXHour_yyyy_MM_dd_HH(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyy_MM_dd_HH(date) ; } @@ -890,7 +890,7 @@ public static String nextXHour_yyyy_MM_dd_HH_mm(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyy_MM_dd_HH_mm(date) ; } @@ -902,7 +902,7 @@ public static String nextXHour_yyyy_MM_dd_HH_mm_ss(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyy_MM_dd_HH_mm_ss(date) ; } @@ -916,7 +916,7 @@ public static String nextXHour_yyyyMMddHH(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyyMMddHH(date) ; } @@ -928,7 +928,7 @@ public static String nextXHour_yyyyMMddHHmm(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyyMMddHHmm(date) ; } @@ -940,7 +940,7 @@ public static String nextXHour_yyyyMMddHHmmss(int xhour){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR_OF_DAY, xhour); + cal.add(Calendar.HOUR_OF_DAY, xhour<=0?-xhour:xhour); date.setTime(cal.getTimeInMillis()); return DateTime.yyyyMMddHHmmss(date) ; } @@ -959,7 +959,7 @@ Date d = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA).parse(yyyy_MM_dd); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.DAY_OF_YEAR, -xday); + cal.add(Calendar.DAY_OF_YEAR, xday<=0?xday:-xday); Date date = cal.getTime() ; return DateTime.yyyy_MM_dd(date) ; } @@ -973,7 +973,7 @@ Date d = new SimpleDateFormat("yyyyMMdd", Locale.CHINA).parse(yyyyMMdd); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.DAY_OF_YEAR, -xday); + cal.add(Calendar.DAY_OF_YEAR, xday<=0?xday:-xday); Date date = cal.getTime() ; return DateTime.yyyyMMdd(date) ; } @@ -985,7 +985,7 @@ public static String lastXDay_yyyy_MM_dd(int xday){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_YEAR, -xday); + cal.add(Calendar.DAY_OF_YEAR, xday<=0?xday:-xday); date.setTime(cal.getTimeInMillis()); return DateTime.yyyy_MM_dd(date) ; } @@ -997,7 +997,7 @@ public static String lastXDay_yyyy_MM_dd_HH_ss(int xday){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_YEAR, -xday); + cal.add(Calendar.DAY_OF_YEAR, xday<=0?xday:-xday); date.setTime(cal.getTimeInMillis()); return DateTime.yyyy_MM_dd_HH_mm_ss(date) ; } @@ -1009,7 +1009,7 @@ public static String lastXDay_yyyyMMdd(int xday){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_YEAR, -xday); + cal.add(Calendar.DAY_OF_YEAR, xday<=0?xday:-xday); date.setTime(cal.getTimeInMillis()); return DateTime.yyyyMMdd(date) ; } @@ -1028,7 +1028,7 @@ Date d = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA).parse(yyyy_MM_dd); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.DAY_OF_YEAR, xday); + cal.add(Calendar.DAY_OF_YEAR, xday<=0?-xday:xday); Date date = cal.getTime() ; return DateTime.yyyy_MM_dd(date) ; } @@ -1042,7 +1042,7 @@ Date d = new SimpleDateFormat("yyyyMMdd", Locale.CHINA).parse(yyyyMMdd); Calendar cal = Calendar.getInstance(); cal.setTime(d); - cal.add(Calendar.DAY_OF_YEAR, xday); + cal.add(Calendar.DAY_OF_YEAR, xday<=0?-xday:xday); Date date = cal.getTime() ; return DateTime.yyyyMMdd(date) ; } @@ -1054,7 +1054,7 @@ public static String nextXDay_yyyy_MM_dd(int xday){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_YEAR, xday); + cal.add(Calendar.DAY_OF_YEAR, xday<=0?-xday:xday); date.setTime(cal.getTimeInMillis()); return DateTime.yyyy_MM_dd(date) ; } @@ -1066,7 +1066,7 @@ public static String nextXDay_yyyyMMdd(int xday){ Date date = new Date(); Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_YEAR, xday); + cal.add(Calendar.DAY_OF_YEAR, xday<=0?-xday:xday); date.setTime(cal.getTimeInMillis()); return DateTime.yyyyMMdd(date) ; } @@ -1640,6 +1640,8 @@ Date dt = getDate(1447857387L) ; String s = yyyy_MM_dd_HH_mm_ss(dt); System.out.println(s); + + System.out.println(lastMonth_ym()) ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java index 9f6e86f..3b8a133 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java @@ -11,7 +11,7 @@ private static final Object synObj = new Object() ; - private static final int yearLenght = 4 ;//4锛氬勾搴﹀彇鍥涗綅锛� 3锛氬勾搴﹀彇涓変綅锛� 2锛氬勾搴﹀彇涓や綅锛� 1锛氬勾搴﹀彇涓�浣嶏紝 0锛氬勾搴﹀彇0浣� + private static final int yearLength = 4 ;//4锛氬勾搴﹀彇鍥涗綅锛� 3锛氬勾搴﹀彇涓変綅锛� 2锛氬勾搴﹀彇涓や綅锛� 1锛氬勾搴﹀彇涓�浣嶏紝 0锛氬勾搴﹀彇0浣� private static int add = 0 ; private static final int chengShu = 1000 ;//1000锛氫笁浣嶈嚜澧為噺锛屽嵆涓�绉掗挓鍙骇鐢�10000涓狪D @@ -114,17 +114,17 @@ //涓婃鐢熸垚ID 涓庢湰娆$敓鎴怚D 涓嶅湪鍚屼竴绉掑唴 last = now ; add = 0 ; - id = last * chengShu + add ++; + id = last * chengShu + add++; }else{ //涓婃鐢熸垚ID 涓庢湰娆$敓鎴怚D 鍦ㄥ悓涓�绉掑唴 if(add >= maxAdd){ //闄勫姞閲忓凡缁忕敤灏� waitNextSecond(last) ;//绛夊埌涓嬩竴绉� - id = last * chengShu + add ++ ;//杩斿洖涓婁竴绉掔敓鎴愮殑ID + id = last * chengShu + add++ ;//杩斿洖涓婁竴绉掔敓鎴愮殑ID add = 0 ;//闄勫姞閲忓綊闆讹紝涓轰笅涓�绉掑噯澶� }else{ //闄勫姞閲忔湭鐢ㄥ敖 - id = last * chengShu + add ++ ; + id = last * chengShu + add++ ; } } return (id * 100) + suffix ; @@ -238,28 +238,31 @@ * @return 澶勭悊鍚庣殑骞村害 */ private static int dealYear(int year){ - if(yearLenght == 0){ + if(yearLength == 0){ return 0 ; - }else if(yearLenght == 1){ + }else if(yearLength == 1){ return year % 10 ; - }else if(yearLenght == 2){ + }else if(yearLength == 2){ return year % 100 ; - }else if(yearLenght == 3){ + }else if(yearLength == 3){ return year % 1000 ; - }else if(yearLenght == 4){ + }else if(yearLength == 4){ return year ; }else{ return year ; } } -// + // public static void main(String[] args){ +// Calendar cal = Calendar.getInstance(); +// System.out.println(cal.get(Calendar.MONTH) + 1) ; +// // IDLongGenerator o = new IDLongGenerator() ; -// int total = 800 ; -// long start = System.currentTimeMillis() ; +// int total = 1 ; // for(int i = 0 ; i < total ; i++){ // System.out.println(o.generate()) ; // } +// long start = System.currentTimeMillis() ; // long end = System.currentTimeMillis() ; // System.out.println("浜х敓" + total + "ID鐢ㄦ椂" + (end - start) + "姣"); // diff --git a/pipIrr-platform/pipIrr-global/src/bak/RmLossHistory.java b/pipIrr-platform/pipIrr-global/src/bak/RmLossHistory.java deleted file mode 100644 index 7497e81..0000000 --- a/pipIrr-platform/pipIrr-global/src/bak/RmLossHistory.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.dy.pipIrrGlobal.pojoRm; - -import com.alibaba.fastjson2.annotation.JSONField; -import com.alibaba.fastjson2.writer.ObjectWriterImplToString; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; -import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCdC0Vo; -import com.dy.common.po.BaseEntity; -import com.dy.common.util.DateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; - -import java.util.Date; - -/** - * @Author liurunyu - * @Date 2024/2/28 15:31 - * @LastEditTime 2024/2/28 15:31 - * @Description 鎺у埗鍣ㄦ棩婕忔崯姘撮噺鍘嗗彶鏁版嵁 - */ -@TableName(value="rm_loss_history_history", autoResultMap = true) -@Data -@Builder -@ToString -@NoArgsConstructor -@AllArgsConstructor -@Schema(name = "鎺у埗鍣ㄦ棩婕忔崯姘撮噺鍘嗗彶鏁版嵁 ") -public class RmLossHistory implements BaseEntity { - - public static final long serialVersionUID = 202402281620001L; - /** - * 涓婚敭 - */ - @Schema(description = "涓婚敭", requiredMode = Schema.RequiredMode.REQUIRED) - @JSONField(serializeUsing= ObjectWriterImplToString.class) - @TableId(type = IdType.INPUT) - public Long id; - - - /** - * 鎺у埗鍣ㄥ疄浣揑D锛堝閿級 - */ - @Schema(description = "鎺у埗鍣ㄥ疄浣撳閿�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JSONField(serializeUsing= ObjectWriterImplToString.class) - public Long controllerId; - - /** - * 鍙栨按鍙e疄浣揑D锛堝閿級 - */ - @Schema(description = "鍙栨按鍙e疄浣撳閿�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JSONField(serializeUsing= ObjectWriterImplToString.class) - public Long intakeId; - - /** - * 鎺у埗鍣ㄥ湴鍧� - */ - @Schema(description = "鎺у埗鍣ㄥ湴鍧�", requiredMode = Schema.RequiredMode.REQUIRED) - public String rtuAddr; - - /** - * 鏁版嵁鎺ユ敹鏃ユ湡鏃堕棿 - */ - @Schema(description = "涓婃姤鏃ユ湡鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JsonFormat(pattern = "yyyy-MM-dd") - public Date dt; - - /** - * 鎺у埗鍣ㄥ綋鏃ユ渶鍚庝笂鎶ユ暟鎹椂闂� - */ - @Schema(description = "鎺у埗鍣ㄥ綋鏃ユ渶鍚庝笂鎶ユ暟鎹椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") - public Date dtLast; - - /** - * 鎺у埗鍣ㄥ綋鏃ユ渶鍚庝笂鎶ユ暟鎹腑鐨勬帶鍒跺櫒鏃堕挓 - */ - @Schema(description = "鎺у埗鍣ㄦ椂閽�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") - public Date dtRtu; - - /** - * 鏃ユ紡鎹熸祦閲� - */ - @Schema(description = "鏃ユ紡鎹熼噺锛坢3锛�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - public Double lossAmount; - - - public void valueFrom(DataV1_0_1 dV1_0_1, DataCdC0Vo cdData) throws Exception{ - this.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt); - this.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); - this.dtRtu = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); - this.lossAmount = cdData.lossAmount ;// 鎹熷け娴侀噺(浠�0鏃跺埌褰撳墠鐨勬紡鎹熺疮璁℃祦閲忥紝24鏃朵竴涓懆鏈燂紝0鏃跺綊0)鍗曚綅涓簃3銆� - } -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/bak/RmLossHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/bak/RmLossHistoryMapper.java deleted file mode 100644 index 3630d80..0000000 --- a/pipIrr-platform/pipIrr-global/src/bak/RmLossHistoryMapper.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.dy.pipIrrGlobal.daoRm; - -import org.apache.ibatis.annotations.Mapper; - -import java.util.Date; -import java.util.List; - -/** - * @Author liurunyu - * @Date 2024/2/28 15:31 - * @LastEditTime 2024/2/28 15:31 - * @Description - */ -@Mapper -public interface RmLossHistoryMapper { - /** - * delete by primary key - * @param id primaryKey - * @return deleteCount - */ - int deleteByPrimaryKey(Long id); - - /** - * insert record to table - * @param record the record - * @return insert count - */ - int insert(RmLossHistory record); - - /** - * insert record to table selective - * @param record the record - * @return insert count - */ - int insertSelective(RmLossHistory record); - - /** - * select by primary key - * @param id primary key - * @return object by primary key - */ - RmLossHistory selectByPrimaryKey(Long id); - - /** - * select by dt - * @param date 鏃ユ湡锛坹yyy-mm-dd锛� - * @return object by rtuAddr - */ - List<RmLossHistory> selectByDate(Date date) ; - - /** - * update record selective - * @param record the updated record - * @return update count - */ - int updateByPrimaryKeySelective(RmLossHistory record); - - /** - * update record - * @param record the updated record - * @return update count - */ - int updateByPrimaryKey(RmLossHistory record); -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/bak/RmLossHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/bak/RmLossHistoryMapper.xml deleted file mode 100644 index 858ff67..0000000 --- a/pipIrr-platform/pipIrr-global/src/bak/RmLossHistoryMapper.xml +++ /dev/null @@ -1,144 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.dy.pipIrrGlobal.daoRm.RmLossHistoryMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmLossHistory"> - <!--@mbg.generated--> - <!--@Table rm_loss_history--> - <id column="id" jdbcType="BIGINT" property="id" /> - <result column="controller_id" jdbcType="BIGINT" property="controllerId" /> - <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> - <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> - <result column="dt" jdbcType="DATE" property="dt" /> - <result column="dt_last" jdbcType="TIMESTAMP" property="dtLast" /> - <result column="dt_rtu" jdbcType="TIMESTAMP" property="dtRtu" /> - <result column="loss_amount" jdbcType="DOUBLE" property="lossAmount" /> - </resultMap> - <sql id="Base_Column_List"> - <!--@mbg.generated--> - id, controller_id, intake_id, rtu_addr, dt, dt_last, dt_rtu, loss_amount - </sql> - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_loss_history - where id = #{id,jdbcType=BIGINT} - </select> - <select id="selectByDate" parameterType="java.util.Date" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_loss_history - where dt = #{dt,jdbcType=DATE} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from rm_loss_history - where id = #{id,jdbcType=BIGINT} - </delete> - <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossHistory"> - <!--@mbg.generated--> - insert into rm_loss_history (id, controller_id, intake_id, - rtu_addr, dt, dt_last, dt_rtu, loss_amount - ) - values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, - #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=DATE}, #{dtLast,jdbcType=TIMESTAMP}, #{dtRtu,jdbcType=TIMESTAMP}, #{lossAmount,jdbcType=DOUBLE} - ) - </insert> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossHistory"> - <!--@mbg.generated--> - insert into rm_loss_history - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> - id, - </if> - <if test="controllerId != null"> - controller_id, - </if> - <if test="intakeId != null"> - intake_id, - </if> - <if test="rtuAddr != null"> - rtu_addr, - </if> - <if test="dt != null"> - dt, - </if> - <if test="dtLast != null"> - dt_last, - </if> - <if test="dtRtu != null"> - dt_rtu, - </if> - <if test="lossAmount != null"> - loss_amount, - </if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null"> - #{id,jdbcType=BIGINT}, - </if> - <if test="controllerId != null"> - #{controllerId,jdbcType=BIGINT}, - </if> - <if test="intakeId != null"> - #{intakeId,jdbcType=BIGINT}, - </if> - <if test="rtuAddr != null"> - #{rtuAddr,jdbcType=VARCHAR}, - </if> - <if test="dt != null"> - #{dt,jdbcType=DATE}, - </if> - <if test="dtLast != null"> - #{dtLast,jdbcType=TIMESTAMP}, - </if> - <if test="dtRtu != null"> - #{dtRtu,jdbcType=TIMESTAMP}, - </if> - <if test="lossAmount != null"> - #{lossAmount,jdbcType=DOUBLE}, - </if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossHistory"> - <!--@mbg.generated--> - update rm_loss_history - <set> - <if test="controllerId != null"> - controller_id = #{controllerId,jdbcType=BIGINT}, - </if> - <if test="intakeId != null"> - intake_id = #{intakeId,jdbcType=BIGINT}, - </if> - <if test="rtuAddr != null"> - rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, - </if> - <if test="dt != null"> - dt = #{dt,jdbcType=DATE}, - </if> - <if test="dtLast != null"> - dt_last = #{dtLast,jdbcType=TIMESTAMP}, - </if> - <if test="dtRtu != null"> - dt_rtu = #{dtRtu,jdbcType=TIMESTAMP}, - </if> - <if test="lossAmount != null"> - loss_amount = #{lossAmount,jdbcType=DOUBLE}, - </if> - </set> - where id = #{id,jdbcType=BIGINT} - </update> - <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossHistory"> - <!--@mbg.generated--> - update rm_loss_history - set controller_id = #{controllerId,jdbcType=BIGINT}, - intake_id = #{intakeId,jdbcType=BIGINT}, - rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, - dt = #{dt,jdbcType=DATE}, - dt_last = #{dtLast,jdbcType=TIMESTAMP}, - dt_rtu = #{dtRtu,jdbcType=TIMESTAMP}, - loss_amount = #{lossAmount,jdbcType=DOUBLE} - where id = #{id,jdbcType=BIGINT} - </update> -</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/bak/RmLossLast.java b/pipIrr-platform/pipIrr-global/src/bak/RmLossLast.java deleted file mode 100644 index 5b5479d..0000000 --- a/pipIrr-platform/pipIrr-global/src/bak/RmLossLast.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.dy.pipIrrGlobal.pojoRm; - -import com.alibaba.fastjson2.annotation.JSONField; -import com.alibaba.fastjson2.writer.ObjectWriterImplToString; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; -import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCdC0Vo; -import com.dy.common.po.BaseEntity; -import com.dy.common.util.DateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; - -import java.util.Date; - -/** - * @Author liurunyu - * @Date 2024/2/28 15:31 - * @LastEditTime 2024/2/28 15:31 - * @Description 鎺у埗鍣ㄦ棩婕忔崯姘撮噺鏈�鏂版暟鎹� - */ -@TableName(value="rm_loss_last_history", autoResultMap = true) -@Data -@Builder -@ToString -@NoArgsConstructor -@AllArgsConstructor -@Schema(name = "鎺у埗鍣ㄦ棩婕忔崯姘撮噺鏈�鏂版暟鎹�") -public class RmLossLast implements BaseEntity { - - public static final long serialVersionUID = 202402281621001L; - /** - * 涓婚敭 - */ - @Schema(description = "涓婚敭", requiredMode = Schema.RequiredMode.REQUIRED) - @JSONField(serializeUsing= ObjectWriterImplToString.class) - @TableId(type = IdType.INPUT) - public Long id; - - /** - * 鐢辨渶鏂版暟鎹寔鏈夊巻鍙叉暟鎹腑鐨勬渶鏂拌褰旾D锛屼互鏂逛究蹇�熸煡璇� - * json涓嶅簭鍒楀寲姝ゅ睘鎬э紝鍗充笉鍚戝墠绔〉闈㈠彂閫佸強鏄剧ず - */ - @Schema(hidden=true) - @JSONField(serialize = false) - public Long lastHistoryId; - - /** - * 鎺у埗鍣ㄥ疄浣揑D锛堝閿級 - */ - @Schema(description = "鎺у埗鍣ㄥ疄浣撳閿�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JSONField(serializeUsing= ObjectWriterImplToString.class) - public Long controllerId; - - /** - * 鍙栨按鍙e疄浣揑D锛堝閿級 - */ - @Schema(description = "鍙栨按鍙e疄浣撳閿�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JSONField(serializeUsing= ObjectWriterImplToString.class) - public Long intakeId; - - /** - * 鎺у埗鍣ㄥ湴鍧� - */ - @Schema(description = "鎺у埗鍣ㄥ湴鍧�", requiredMode = Schema.RequiredMode.REQUIRED) - public String rtuAddr; - - /** - * 缁熻鏃� - */ - @Schema(description = "缁熻鏃�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JsonFormat(pattern = "yyyy-MM-dd") - public Date dt; - - /** - * 鎺у埗鍣ㄥ綋鏃ユ渶鍚庝笂鎶ユ暟鎹椂闂� - */ - @Schema(description = "鎺у埗鍣ㄥ綋鏃ユ渶鍚庝笂鎶ユ暟鎹椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") - public Date dtLast; - - /** - * 鎺у埗鍣ㄥ綋鏃ユ渶鍚庝笂鎶ユ暟鎹腑鐨勬帶鍒跺櫒鏃堕挓 - */ - @Schema(description = "鎺у埗鍣ㄦ椂閽�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") - public Date dtRtu; - - /** - * 鏃ユ紡鎹熸祦閲� - */ - @Schema(description = "鏃ユ紡鎹熼噺锛坢3锛�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - public Double lossAmount; - - public void valueFrom(DataV1_0_1 dV1_0_1, DataCdC0Vo cdData) throws Exception{ - this.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt); - this.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); - this.dtRtu = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); - this.lossAmount = cdData.lossAmount ;// 鎹熷け娴侀噺(浠�0鏃跺埌褰撳墠鐨勬紡鎹熺疮璁℃祦閲忥紝24鏃朵竴涓懆鏈燂紝0鏃跺綊0)鍗曚綅涓簃3銆� - } - -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/bak/RmLossLastMapper.java b/pipIrr-platform/pipIrr-global/src/bak/RmLossLastMapper.java deleted file mode 100644 index 2e7733c..0000000 --- a/pipIrr-platform/pipIrr-global/src/bak/RmLossLastMapper.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.dy.pipIrrGlobal.daoRm; - -import org.apache.ibatis.annotations.Mapper; - -import java.util.Date; -import java.util.List; - -/** - * @Author liurunyu - * @Date 2024/2/28 15:31 - * @LastEditTime 2024/2/28 15:31 - * @Description - */ -@Mapper -public interface RmLossLastMapper { - /** - * delete by primary key - * @param id primaryKey - * @return deleteCount - */ - int deleteByPrimaryKey(Long id); - - /** - * insert record to table - * @param record the record - * @return insert count - */ - int insert(RmLossLast record); - - /** - * insert record to table selective - * @param record the record - * @return insert count - */ - int insertSelective(RmLossLast record); - - /** - * select by primary key - * @param id primary key - * @return object by primary key - */ - RmLossLast selectByPrimaryKey(Long id); - - /** - * select by rtuAddr - * @param intakeId 鎺у埗鍣ㄦ墍缁戝彇姘村彛ID - * @return object by rtuAddr - */ - List<RmLossLast> selectByIntakeId(Long intakeId) ; - /** - * select by dt - * @param date 鏃ユ湡锛坹yyy-mm-dd锛� - * @return object by rtuAddr - */ - List<RmLossLast> selectByDate(Date date) ; - - /** - * update record selective - * @param record the updated record - * @return update count - */ - int updateByPrimaryKeySelective(RmLossLast record); - - /** - * update record - * @param record the updated record - * @return update count - */ - int updateByPrimaryKey(RmLossLast record); -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/bak/RmLossLastMapper.xml b/pipIrr-platform/pipIrr-global/src/bak/RmLossLastMapper.xml deleted file mode 100644 index 5a99947..0000000 --- a/pipIrr-platform/pipIrr-global/src/bak/RmLossLastMapper.xml +++ /dev/null @@ -1,162 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.dy.pipIrrGlobal.daoRm.RmLossLastMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmLossLast"> - <!--@mbg.generated--> - <!--@Table rm_loss_last--> - <id column="id" jdbcType="BIGINT" property="id" /> - <result column="last_history_id" jdbcType="BIGINT" property="lastHistoryId" /> - <result column="controller_id" jdbcType="BIGINT" property="controllerId" /> - <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> - <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> - <result column="dt" jdbcType="DATE" property="dt" /> - <result column="dt_last" jdbcType="TIMESTAMP" property="dtLast" /> - <result column="dt_rtu" jdbcType="TIMESTAMP" property="dtRtu" /> - <result column="loss_amount" jdbcType="DOUBLE" property="lossAmount" /> - </resultMap> - <sql id="Base_Column_List"> - <!--@mbg.generated--> - id, last_history_id, controller_id, intake_id, rtu_addr, dt, dt_last, dt_rtu, loss_amount - </sql> - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_loss_last - where id = #{id,jdbcType=BIGINT} - </select> - <select id="selectByIntakeId" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_loss_last - where intake_id = #{intakeId,jdbcType=BIGINT} - </select> - <select id="selectByDate" parameterType="java.util.Date" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_loss_last - where dt = #{dt,jdbcType=DATE} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from rm_loss_last - where id = #{id,jdbcType=BIGINT} - </delete> - <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossLast"> - <!--@mbg.generated--> - insert into rm_loss_last (id, last_history_id, controller_id, - intake_id, rtu_addr, dt, dt_last, dt_rtu, - loss_amount) - values (#{id,jdbcType=BIGINT}, #{lastHistoryId,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, - #{intakeId,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=DATE}, #{dtLast,jdbcType=TIMESTAMP}, #{dtRtu,jdbcType=TIMESTAMP}, - #{lossAmount,jdbcType=DOUBLE}) - </insert> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossLast"> - <!--@mbg.generated--> - insert into rm_loss_last - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> - id, - </if> - <if test="lastHistoryId != null"> - last_history_id, - </if> - <if test="controllerId != null"> - controller_id, - </if> - <if test="intakeId != null"> - intake_id, - </if> - <if test="rtuAddr != null"> - rtu_addr, - </if> - <if test="dt != null"> - dt, - </if> - <if test="dtLast != null"> - dt_last, - </if> - <if test="dtRtu != null"> - dt_rtu, - </if> - <if test="lossAmount != null"> - loss_amount, - </if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null"> - #{id,jdbcType=BIGINT}, - </if> - <if test="lastHistoryId != null"> - #{lastHistoryId,jdbcType=BIGINT}, - </if> - <if test="controllerId != null"> - #{controllerId,jdbcType=BIGINT}, - </if> - <if test="intakeId != null"> - #{intakeId,jdbcType=BIGINT}, - </if> - <if test="rtuAddr != null"> - #{rtuAddr,jdbcType=VARCHAR}, - </if> - <if test="dt != null"> - #{dt,jdbcType=DATE}, - </if> - <if test="dtLast != null"> - #{dtLast,jdbcType=TIMESTAMP}, - </if> - <if test="dtRtu != null"> - #{dtRtu,jdbcType=TIMESTAMP}, - </if> - <if test="lossAmount != null"> - #{lossAmount,jdbcType=DOUBLE}, - </if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossLast"> - <!--@mbg.generated--> - update rm_loss_last - <set> - <if test="lastHistoryId != null"> - last_history_id = #{lastHistoryId,jdbcType=BIGINT}, - </if> - <if test="controllerId != null"> - controller_id = #{controllerId,jdbcType=BIGINT}, - </if> - <if test="intakeId != null"> - intake_id = #{intakeId,jdbcType=BIGINT}, - </if> - <if test="rtuAddr != null"> - rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, - </if> - <if test="dt != null"> - dt = #{dt,jdbcType=DATE}, - </if> - <if test="dtLast != null"> - dt_last = #{dtLast,jdbcType=TIMESTAMP}, - </if> - <if test="dtRtu != null"> - dt_rtu = #{dtRtu,jdbcType=TIMESTAMP}, - </if> - <if test="lossAmount != null"> - loss_amount = #{lossAmount,jdbcType=DOUBLE}, - </if> - </set> - where id = #{id,jdbcType=BIGINT} - </update> - <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossLast"> - <!--@mbg.generated--> - update rm_loss_last - set last_history_id = #{lastHistoryId,jdbcType=BIGINT}, - controller_id = #{controllerId,jdbcType=BIGINT}, - intake_id = #{intakeId,jdbcType=BIGINT}, - rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, - dt = #{dt,jdbcType=DATE}, - dt_last = #{dtLast,jdbcType=TIMESTAMP}, - dt_rtu = #{dtRtu,jdbcType=TIMESTAMP}, - loss_amount = #{lossAmount,jdbcType=DOUBLE} - where id = #{id,jdbcType=BIGINT} - </update> -</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml index edea437..7b4214b 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -149,10 +149,7 @@ - /sso/sso - /remote/comRes/receive - /wx/comRes/receive -#鑷姩缁熻閰嶇疆 +#鑷姩缁熻閰嶇疆锛岃嚜鍔ㄧ粺璁″畾鏃朵换鍔′細姣忓ぉ瀹氭椂杩涜 auto-statistics: - #鏈堢粺璁� - month: - startDay: 1 - startHour: 0 - startMinute: 5 + startHour: 9 #寮�濮嬪皬鏃� 0 + startMinute: 51 #寮�濮嬪垎閽� 5 diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java index cedbfa8..4a09b04 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java @@ -180,13 +180,19 @@ if(ServerProperties.cacheUpDownDataMaxCount <= ServerProperties.cacheUpDownDataWarnCount){ throw new Exception("cacheUpDownDataMaxCount蹇呴』澶т簬cacheUpDownDataWarnCount") ; } - //娌℃湁涓婅鏁版嵁鐨勫垎閽熸暟锛岃揪鍒拌繖涓垎閽熸暟锛岃涓篟TU鏂綉浜嗭紝鍙栧�艰寖鍥存槸2_100 + //娌℃湁涓婅鏁版嵁鐨勫垎閽熸暟锛岃揪鍒拌繖涓垎閽熸暟锛岃涓篟TU鏂綉浜嗭紝鍙栧�艰寖鍥存槸2-100 ServerProperties.disconnectedByNoUpDataMinutes = 0L + conf.getSetAttrPlusInt(doc, "config.base", "disconnectedByNoUpDataMinutes", null, 1, 100, null) ; if(ServerProperties.disconnectedByNoUpDataMinutes < 1 || ServerProperties.disconnectedByNoUpDataMinutes > 100){ throw new Exception("disconnectedByNoUpDataMinutes鍙栧�煎繀椤绘槸1~100") ; } ServerProperties.disconnectedByNoUpDataMinutes = ServerProperties.disconnectedByNoUpDataMinutes * 60 * 1000 ; + //宸ヤ綔鎶ュお棰戠箒锛孨娆′笂鎶ュ鐞�1娆★紝鍙栧�艰寖鍥存槸1-100 + ServerProperties.workReportDealOneByTimes = conf.getSetAttrPlusInt(doc, "config.base", "workReportDealOneByTimes", null, 1, 100, null) ; + if(ServerProperties.workReportDealOneByTimes < 1 || ServerProperties.disconnectedByNoUpDataMinutes > 100){ + throw new Exception("workReportDealOneByTimes鍙栧�煎繀椤绘槸1~100") ; + } + //璁剧疆ID鐢熸垚鍣ㄧ殑鍚庣紑 IDLongGenerator.setSuffix(ServerProperties.dbDataIdSuffix.intValue()); diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/ServerProperties.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/ServerProperties.java index e225ebd..c68f753 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/ServerProperties.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/ServerProperties.java @@ -43,4 +43,7 @@ //娌℃湁涓婅鏁版嵁鐨勫垎閽熸暟锛岃揪鍒拌繖涓垎閽熸暟锛岃涓篟TU鏂綉浜嗭紝鍙栧�艰寖鍥存槸2000_100000 public static Long disconnectedByNoUpDataMinutes = 3000L ; + //宸ヤ綔鎶ュお棰戠箒锛孨娆′笂鎶ュ鐞�1娆� + public static Integer workReportDealOneByTimes = 5 ; + } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealWorkReport.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealWorkReport.java index c24d04f..62c90c5 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealWorkReport.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealWorkReport.java @@ -1,6 +1,7 @@ package com.dy.rtuMw.server.rtuData.p206V1_0_0; import com.dy.pipIrrGlobal.pojoSe.SeClient; +import com.dy.rtuMw.server.ServerProperties; import com.dy.rtuMw.server.rtuData.TaskSurpport; import com.dy.rtuMw.server.rtuData.dbSv.DbSv; import com.dy.common.mw.protocol.Data; @@ -12,6 +13,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.util.HashMap; +import java.util.Map; + /** * @Author liurunyu * @Date 2024/2/27 14:20 @@ -21,6 +25,8 @@ public class TkDealWorkReport extends TaskSurpport { private static final Logger log = LogManager.getLogger(TkDealWorkReport.class.getName()) ; + + private static final Map<String, Integer> RtuReportTimes = new HashMap<>(); //绫籌D锛屼竴瀹氫笌Tree.xml閰嶇疆鏂囦欢涓厤缃竴鑷� public static final String taskId = "TkDealWorkReport" ; @@ -35,14 +41,30 @@ DataV1_0_1 dV1_0_1 = (DataV1_0_1) d.getSubData();//鍓嶉潰浠诲姟宸茬粡鍒ゆ柇涓嶄负null Object cdObj = dV1_0_1.subData; if (cdObj != null && cdObj instanceof DataCd84Vo) { - Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ; - DbSv sv = (DbSv)objs[0] ; - PrController controller = (PrController)objs[1] ; - SeClient clientVo = (SeClient)objs[3] ;//杩欎釜鍊煎璞′腑鍙湁id鍜宯ame浼氭湁鍊� - try{ - this.doDeal(sv, clientVo, controller, d.getRtuAddr(), dV1_0_1, (DataCd84Vo)cdObj) ; - }catch (Exception e){ - log.error("淇濆瓨鎺у埗鍣ㄩ榾寮�宸ヤ綔鎶ユ椂鍙戠敓寮傚父", e); + boolean deal = false ; + Integer times = RtuReportTimes.get(d.rtuAddr) ; + if(times == null){ + times = 1 ; + RtuReportTimes.put(d.rtuAddr, times) ; + deal = true ;//绗竴娆� + }else{ + times++ ; + if(times > ServerProperties.workReportDealOneByTimes){ + times = 1 ;//寰幆绗竴娆� + deal = true ; + } + RtuReportTimes.put(d.rtuAddr, times) ; + } + if(deal){ + Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ; + DbSv sv = (DbSv)objs[0] ; + PrController controller = (PrController)objs[1] ; + SeClient clientVo = (SeClient)objs[3] ;//杩欎釜鍊煎璞′腑鍙湁id鍜宯ame浼氭湁鍊� + try{ + this.doDeal(sv, clientVo, controller, d.getRtuAddr(), dV1_0_1, (DataCd84Vo)cdObj) ; + }catch (Exception e){ + log.error("淇濆瓨鎺у埗鍣ㄩ榾寮�宸ヤ綔鎶ユ椂鍙戠敓寮傚父", e); + } } } } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml index bddaf88..fe018e1 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml @@ -18,12 +18,13 @@ dbDataIdSuffix锛氭暟鎹簱鏁版嵁id鐢熸垚鍣ㄧ殑id鍚庣紑锛�0鏄粯璁ょ殑鍚庣紑锛屼竴鑸瑆eb绯荤粺搴旂敤锛屾暟鎹腑闂翠欢id鍚庣紑澶т簬绛変簬1 cacheUpDownDataWarnCount锛氫笂涓嬭鏁版嵁缂撳瓨闃熷垪涓紦瀛樻暟鎹釜鏁扮殑鎶ヨ閲忥紝杩欎釜涓庣幇瀹為」鐩墍鎺ユ按琛ㄦ暟鐩稿叧 cacheUpDownDataMaxCount锛氫笂涓嬭鏁版嵁缂撳瓨闃熷垪涓紦瀛樻暟鎹釜鏁扮殑鏈�澶у�硷紝杩欎釜涓庣幇瀹為」鐩墍鎺ユ按琛ㄦ暟鐩稿叧 - disconnectedByNoUpDataMinutes锛氭病鏈変笂琛屾暟鎹殑鍒嗛挓鏁帮紝杈惧埌杩欎釜鍒嗛挓鏁帮紝璁や负RTU鏂綉浜嗭紝鍙栧�艰寖鍥存槸2_100 + disconnectedByNoUpDataMinutes锛氭病鏈変笂琛屾暟鎹殑鍒嗛挓鏁帮紝杈惧埌杩欎釜鍒嗛挓鏁帮紝璁や负RTU鏂綉浜嗭紝鍙栧�艰寖鍥存槸2-100 + workReportDealOneByTimes: 宸ヤ綔鎶ュお棰戠箒锛孨娆′笂鎶ュ鐞�1娆★紝鍙栧�艰寖鍥存槸1-100 --> <base orgTag="ym" isLowPower="false" - onlyDealRtus="532328059995" + onlyDealRtus="" onlyOneProtocol="false" downComandMaxResendTimes="1" commandSendInterval="2" @@ -34,6 +35,7 @@ cacheUpDownDataWarnCount="100000" cacheUpDownDataMaxCount="110000" disconnectedByNoUpDataMinutes="3" + workReportDealOneByTimes="5" /> <!-- diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java index bd2ef1d..e658f54 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java @@ -18,7 +18,7 @@ }) } ) -@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoBa"}) +@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"}) public class PipIrrStatisticsApplication { public static void main(String[] args) { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StClient.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StClient.java new file mode 100644 index 0000000..7a917ce --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StClient.java @@ -0,0 +1,50 @@ +package com.dy.pipIrrStatistics.listeners; + +import com.dy.pipIrrGlobal.daoRm.RmClientAmountDayMapper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Author: liurunyu + * @Date: 2024/7/24 9:31 + * @Description + */ +@Component +public class StClient { + + private static Logger log = LogManager.getLogger(StClient.class.getName()) ; + + @Autowired + protected RmClientAmountDayMapper rmClientAmountDayDao ; + + private String statisticsYyyy_mm; + private Long statisticsStartId ; + private Long statisticsEndId ; + + protected void statistics(String statisticsYyyy_mm, + Long statisticsStartId, + Long statisticsEndId){ + this.statisticsYyyy_mm = statisticsYyyy_mm ; + this.statisticsStartId = statisticsStartId ; + this.statisticsEndId = statisticsEndId ; + this.statisticsMonth() ; + this.statisticsYear() ; + } + + /** + * 鏈堢粺璁�---鍐滄埛 + */ + private void statisticsMonth(){ + log.info(statisticsYyyy_mm + " " + statisticsStartId + " " + statisticsEndId); + log.info(rmClientAmountDayDao.toString()); + } + + /** + * 骞寸粺璁�---鍐滄埛 + */ + private void statisticsYear(){ + + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StIntake.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StIntake.java new file mode 100644 index 0000000..1544c52 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StIntake.java @@ -0,0 +1,50 @@ +package com.dy.pipIrrStatistics.listeners; + +import com.dy.pipIrrGlobal.daoRm.RmIntakeAmountDayMapper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Author: liurunyu + * @Date: 2024/7/24 9:30 + * @Description + */ +@Component +public class StIntake { + + private static Logger log = LogManager.getLogger(StIntake.class.getName()) ; + + @Autowired + protected RmIntakeAmountDayMapper rmIntakeAmountDayDao ; + + private String statisticsYyyy_mm; + private Long statisticsStartId ; + private Long statisticsEndId ; + + protected void statistics(String statisticsYyyy_mm, + Long statisticsStartId, + Long statisticsEndId){ + this.statisticsYyyy_mm = statisticsYyyy_mm ; + this.statisticsStartId = statisticsStartId ; + this.statisticsEndId = statisticsEndId ; + this.statisticsMonth() ; + this.statisticsYear() ; + } + + /** + * 鏈堢粺璁�---鍙栨按鍙� + */ + private void statisticsMonth(){ + log.info(statisticsYyyy_mm + " " + statisticsStartId + " " + statisticsEndId); + log.info(rmIntakeAmountDayDao.toString()); + } + + /** + * 骞寸粺璁�---鍙栨按鍙� + */ + private void statisticsYear(){ + + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StLoss.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StLoss.java new file mode 100644 index 0000000..f2d6b90 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StLoss.java @@ -0,0 +1,50 @@ +package com.dy.pipIrrStatistics.listeners; + +import com.dy.pipIrrGlobal.daoRm.RmLossHistoryMapper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Author: liurunyu + * @Date: 2024/7/24 9:10 + * @Description + */ +@Component +public class StLoss { + + private static Logger log = LogManager.getLogger(StLoss.class.getName()) ; + + @Autowired + protected RmLossHistoryMapper rmLossHistoryDao ; + + private String statisticsYyyy_mm; + private Long statisticsStartId ; + private Long statisticsEndId ; + + protected void statistics(String statisticsYyyy_mm, + Long statisticsStartId, + Long statisticsEndId){ + this.statisticsYyyy_mm = statisticsYyyy_mm ; + this.statisticsStartId = statisticsStartId ; + this.statisticsEndId = statisticsEndId ; + this.statisticsMonth() ; + this.statisticsYear() ; + } + + /** + * 鏈堢粺璁�---婕忔崯 + */ + private void statisticsMonth(){ + log.info(statisticsYyyy_mm + " " + statisticsStartId + " " + statisticsEndId); + log.info(rmLossHistoryDao.toString()); + } + + /** + * 骞寸粺璁�---婕忔崯 + */ + private void statisticsYear(){ + + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsJob.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsJob.java new file mode 100644 index 0000000..a7ecb8d --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsJob.java @@ -0,0 +1,68 @@ +package com.dy.pipIrrStatistics.listeners; + +import com.dy.common.schedulerTask.TaskJob; +import com.dy.common.schedulerTask.Test; +import com.dy.common.springUtil.SpringContextUtil; +import com.dy.common.util.DateTime; +import com.dy.common.util.IDLongGenerator; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Author: liurunyu + * @Date: 2024/7/22 16:41 + * @Description + */ +public class StatisticsJob extends TaskJob { + + private static Logger log = LogManager.getLogger(Test.class.getName()) ; + + private StLoss stLoss ; + + private StIntake stIntake ; + + private StClient stClient ; + + private String statisticsYyyy_mm; + private Long statisticsStartId ; + private Long statisticsEndId ; + + @Override + public void execute(JobExecutionContext ctx) throws JobExecutionException { + stLoss = SpringContextUtil.getBean(StLoss.class); + stIntake = SpringContextUtil.getBean(StIntake.class); + stClient = SpringContextUtil.getBean(StClient.class); + if(stLoss != null && stIntake != null && stClient != null){ + int[] ymd = DateTime.yyyy_MM_dd_2_ymdGroup(DateTime.yyyy_MM_dd()) ; + if(ymd[2] == 1){ + //缁熻涓婁釜鏈堢殑 + statisticsYyyy_mm = DateTime.lastMonth_ym() ;//缁熻鏈� + int lastYear = Integer.parseInt(statisticsYyyy_mm.substring(0, 4)) ; + int lastMonth = Integer.parseInt(statisticsYyyy_mm.substring(5, 7)) ; + statisticsStartId = IDLongGenerator.generateOneDayStartId(lastYear, lastMonth, 1) ; + statisticsEndId = IDLongGenerator.generateOneDayEndId(lastYear, lastMonth, 31) ; + }else{ + //缁熻鏈湀鐨� + statisticsYyyy_mm = ymd[0] + "-" + ymd[1] ;//缁熻鏈� + statisticsStartId = IDLongGenerator.generateOneDayStartId(ymd[0], ymd[1], 1) ; + statisticsEndId = IDLongGenerator.generateOneDayEndId(ymd[0], ymd[1], 31) ; + } + doStatistics() ; + }else{ + log.error("鏈兘浠嶴pring瀹瑰櫒涓緱鍒扮粺璁ean"); + } + } + + /** + * 缁熻 + */ + private void doStatistics(){ + stLoss.statistics(statisticsYyyy_mm, statisticsStartId, statisticsEndId) ; + stIntake.statistics(statisticsYyyy_mm, statisticsStartId, statisticsEndId) ; + stClient.statistics(statisticsYyyy_mm, statisticsStartId, statisticsEndId) ; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsListener.java new file mode 100644 index 0000000..4d19109 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsListener.java @@ -0,0 +1,68 @@ +package com.dy.pipIrrStatistics.listeners; + +/** + * @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.Autowired; +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浜嬩欢鐩戝惉鍣ㄦ潵瀹炵幇 + */ +@Component +public class StatisticsListener implements ApplicationListener<ApplicationReadyEvent> { + + private static Logger log = LogManager.getLogger(StatisticsListener.class.getName()) ; + + private static final String JobName = "statisticsJob" ; + private static final String JobGroupName = "statisticsGroup" ; + private static final Integer ThreadPoolMaxCount = 1 ;//绾跨▼姹犵嚎绋嬫渶澶т釜鏁� + private static final Integer ThreadPoolPriority = 5 ;//绾跨▼浼樺厛绾� + + @Value("${auto-statistics.startHour: 0}") + protected Integer startHour;//缁熻寮�濮嬪皬鏃� + + @Value("${auto-statistics.startMinute: 5}") + protected Integer startMinute;//缁熻寮�濮嬪垎閽� + + /** + * SpringBoot瀹瑰櫒宸茬粡鍑嗗濂戒簡锛屾墽琛屼笅闈㈡柟娉� + * @param event 浜嬩欢 + */ + @Override + public void onApplicationEvent(@NonNull ApplicationReadyEvent event) { + try { + //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource瀹炲鍖栧畬鎴� + Thread.sleep(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + }finally { + try{ + this.start(event); + }catch (Exception e){ + log.error("娉ㄥ唽缁熻瀹氭椂浠诲姟鍑洪敊", e); + } + + } + } + /** + * 鍒濆鍖� + */ + private void start(ApplicationReadyEvent event) throws Exception{ + SchedulerTaskSupport.setThreadPoolPro(ThreadPoolMaxCount, ThreadPoolPriority); + SchedulerTaskSupport.addDailyJob(JobName, JobGroupName, StatisticsJob.class, null, startHour, startMinute ) ; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsMonthListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsMonthListener.java deleted file mode 100644 index c41f507..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/listeners/StatisticsMonthListener.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.dy.pipIrrStatistics.listeners; - -/** - * @Author: liurunyu - * @Date: 2024/7/22 14:39 - * @Description - */ - -import com.dy.common.util.ConfigXml; -import com.dy.common.webListener.ConfigListener; -import org.jdom2.Document; -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; - -import java.net.URL; - -/** - * 鐩戝惉鍣紝瀹炵幇鍔熻兘锛氬湪绯荤粺鍚姩鏃跺垵濮嬪寲锛屽悜鏁版嵁搴撲腑鎻掑叆鏁版嵁 - * 鏈洃鍚櫒涓嶈兘閲囩敤ServletContextListener鏂瑰紡锛屽洜涓篠ervlet涓婁笅鏂嘋ontext鍒涘缓鍚� - * Spring瀹瑰櫒骞舵病鏈夊垱寤哄畬锛岃�屾湰绫讳腑鐢ㄤ簡Spring瀹瑰櫒涓殑Bean锛屽嵆*Dao 銆� - * 鎵�浠ラ噰鐢ㄤ簡Spring浜嬩欢鐩戝惉鍣ㄦ潵瀹炵幇 - */ -@Component -public class StatisticsMonthListener implements ApplicationListener<ApplicationReadyEvent> { - - @Value("${auto-statistics.month.startDay: 1}") - private Integer startDay ;//鏈堢粺璁″紑濮嬫棩鏈� - - @Value("${auto-statistics.month.startHour: 0}") - private Integer startHour ;//鏈堢粺璁″紑濮嬪皬鏃� - - @Value("${auto-statistics.month.startMinute: 5}") - private Integer startMinute ;//鏈堢粺璁″紑濮嬪垎閽� - - /** - * SpringBoot瀹瑰櫒宸茬粡鍑嗗濂戒簡 - * @param event 浜嬩欢 - */ - @Override - public void onApplicationEvent(@NonNull ApplicationReadyEvent event) { - try { - //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource瀹炲鍖栧畬鎴� - Thread.sleep(1000L); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - this.start(event); - } - } - /** - * 瀹炲鍖� - */ - private void start(ApplicationReadyEvent event){ - - } -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml index 0031756..5e27163 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - include: global, database + include: global, database, database-ym, database-pj, database-sp #actutor鐨剋eb绔彛 management: @@ -10,9 +10,9 @@ server: port: ${pipIrr.statistics.webPort} servlet: - context-path: /sso #web璁块棶涓婁笅鏂囪矾寰� + context-path: /statistics #web璁块棶涓婁笅鏂囪矾寰� context-parameters: #GenerateIdSetSuffixListener涓簲鐢紝鍙栧�艰寖鍥存槸0-99 IdSuffix: ${pipIrr.statistics.IdSuffix} #ConfigListener涓簲鐢� - configFileNames: config-global.xml,config-sso.xml + configFileNames: config-global.xml -- Gitblit v1.8.0