Selaa lähdekoodia

1.修改 alarm-schedule中 oracle版 创建alarm_history xml语句
2.修改预警报告bug

wanghs 2 vuotta sitten
vanhempi
commit
f42ed51115

+ 1 - 0
schedule-job/alarm-schedule/src/main/java/com/gyee/wisdom/alarm/schedule/biz/EarlyReportTask.java

@@ -73,6 +73,7 @@ public class EarlyReportTask implements Callable<TaskResult> {
             report.getReportWindturbineInfoList().addAll(nowWindturbineInfoList);
             // 获取上次报告
             List<EarlyReport> earlyReport = earlyReportBiz.getEarlyReport(stationId, DateUtil.addDays(statEndTime, -60), statEndTime);
+            earlyReport=earlyReport.stream().filter(s->s.getRelatedParts().equals(reportParam.getWindturbineParts())).collect(Collectors.toList());
             List<EarlyReport> collect = earlyReport.stream().sorted(Comparator.comparing(EarlyReport::getId, Comparator.reverseOrder())).collect(Collectors.toList());
 
             if (collect.size() > 0) {

+ 55 - 14
schedule-job/alarm-schedule/src/main/resources/mappers-oracle/AlarmHistoryMapper.xml

@@ -174,29 +174,70 @@
 
 
     </select>
-
     <update id="timedCreatTable">
-        CREATE TABLE alarmhistory_${stationname}_${yearmonth} (
-                                                   `ID` decimal(65,0) NOT NULL,
-                                                   `ALERTTIME` datetime(6) NOT NULL,
-                                                   `MESSAGETYPE` char(1) NOT NULL,
-                                                   `SNAPID` decimal(65,0) NOT NULL,
-                                                   `DATAINFO` text,
-                                                   `ALERTTEXTLAST` varchar(50)
-        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+        create table ALARMHISTORY_${stationname}_${yearmonth}
+        (
+        ID            INTEGER not null,
+        ALERTTIME     DATE not null,
+        MESSAGETYPE   CHAR(1) default '1' not null,
+        SNAPID        INTEGER not null,
+        DATAINFO      VARCHAR2(1000),
+        ALERTTEXTLAST VARCHAR2(50)
+        )
+        tablespace ${tablespace}
+        pctfree 10
+        initrans 1
+        maxtrans 255
+        storage
+        (
+        initial 16K
+        minextents 1
+        maxextents unlimited
+        )
     </update>
     <update id="timedAlterTable">
-        alter table alarmhistory_${stationname}_${yearmonth}
-            add primary key (`id`)
+        alter table ALARMHISTORY_${stationname}_${yearmonth}
+        add constraint PK_ALARMHISTORY_${stationname}_${yearmonth} primary key (ID)
+        using index
+        tablespace ${tablespace}
+        pctfree 10
+        initrans 2
+        maxtrans 255
+        storage
+        (
+        initial 64K
+        minextents 1
+        maxextents unlimited
+        )
     </update>
     <update id="timedCreatAlerttimeIndex">
-        create index IX_AH_${stationname}_${yearmonth}_ALARMTIME on alarmhistory_${stationname}_${yearmonth} (alerttime)
+        create index IX_AH_${stationname}_${yearmonth}_ALARMTIME on ALARMHISTORY_${stationname}_${yearmonth} (ALERTTIME)
+        tablespace ${tablespace}
+        pctfree 10
+        initrans 2
+        maxtrans 255
+        storage
+        (
+        initial 64K
+        minextents 1
+        maxextents unlimited
+        )
     </update>
     <update id="timedCreatSnapidIndex">
-        create index IX_AH_${stationname}_${yearmonth}_SNAPID on alarmhistory_${stationname}_${yearmonth} (snapid)
+        create index IX_AH_${stationname}_${yearmonth}_SNAPID on ALARMHISTORY_${stationname}_${yearmonth} (SNAPID)
+        tablespace ${tablespace}
+        pctfree 10
+        initrans 2
+        maxtrans 255
+        storage
+        (
+        initial 64K
+        minextents 1
+        maxextents unlimited
+        )
     </update>
     <select id="isHasTable" resultType="java.lang.Integer">
-        select count(*) from information_schema.TABLES where table_name =upper('ALARMHISTORY_${stationname}_${yearmonth}')
+        select count(*) from user_tables where table_name =upper('ALARMHISTORY_${stationname}_${yearmonth}')
     </select>