Quellcode durchsuchen

切换到linux了

“lifuquan” vor 7 Monaten
Ursprung
Commit
a2004962ce
38 geänderte Dateien mit 1649 neuen und 1723 gelöschten Zeilen
  1. 188 188
      .gitignore
  2. 5 5
      README.MD
  3. 55 55
      doc/dw_complain_realtime_alarm_h.sql
  4. 21 21
      doc/prod/gpload/alarm.sh
  5. 79 79
      doc/prod/gpload/alarm.yml
  6. 1 1
      doc/prod/run.sh
  7. 5 5
      doc/prod/stop.sh
  8. 21 21
      doc/test/gpload/alarm.sh
  9. 79 79
      doc/test/gpload/alarm.yml
  10. 1 1
      doc/test/run.sh
  11. 5 5
      doc/test/stop.sh
  12. 23 23
      doc/历史文档/历史版本/投诉1线投诉3线告警订阅.md
  13. 0 113
      doc/历史文档/告警数据字段信息/resultMap20230224163020.csv
  14. 63 63
      doc/历史文档/问题排查/20230113告警报错问题排查/20230113告警报错问题排查.md
  15. 3 3
      doc/开发文档/20240506.md
  16. 3 3
      doc/部署文档/正式环境/正式环境部署情况.md
  17. 45 45
      doc/需求文档/告警入库报错.txt
  18. 7 7
      doc/需求文档/告警数据入库需求汇总.md
  19. 116 116
      pom.xml
  20. 13 13
      src/main/java/com/nokia/alarm/AlarmApplication.java
  21. 57 0
      src/main/java/com/nokia/alarm/config/CronTaskConfig.java
  22. 31 50
      src/main/java/com/nokia/alarm/config/SchedulingConfig.java
  23. 18 18
      src/main/java/com/nokia/alarm/controller/TestController.java
  24. 19 19
      src/main/java/com/nokia/alarm/entity/MessageCfg.java
  25. 13 13
      src/main/java/com/nokia/alarm/entity/ResultInfo.java
  26. 58 58
      src/main/java/com/nokia/alarm/entity/ResultMap.java
  27. 37 37
      src/main/java/com/nokia/alarm/mapper/ResultMapDao.java
  28. 133 132
      src/main/java/com/nokia/alarm/service/AlarmSaveToFileService.java
  29. 68 68
      src/main/java/com/nokia/alarm/service/AlarmSaveToGPandPGService.java
  30. 116 116
      src/main/java/com/nokia/alarm/service/ApiCallService.java
  31. 48 48
      src/main/java/com/nokia/alarm/service/ResultMapService.java
  32. 119 119
      src/main/java/com/nokia/alarm/util/ExportUtil.java
  33. 87 87
      src/main/java/com/nokia/alarm/util/SDKUtil.java
  34. 20 20
      src/main/resources/application-prod.properties
  35. 17 17
      src/main/resources/application-test.properties
  36. 1 1
      src/main/resources/application.properties
  37. 51 51
      src/main/resources/logback-spring.xml
  38. 23 23
      src/test/com/nokia/alarm/AlarmApplicationTest.java

+ 188 - 188
.gitignore

@@ -1,188 +1,188 @@
-target/
-.vscode/### Java template
-# Compiled class file
-*.class
-.vscode
-csv
-
-# Log file
-*.log
-
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-
-### Maven template
-pom.xml.tag
-pom.xml.releaseBackup
-pom.xml.versionsBackup
-pom.xml.next
-release.properties
-dependency-reduced-pom.xml
-buildNumber.properties
-.mvn/timing.properties
-# https://github.com/takari/maven-wrapper#usage-without-binary-jar
-.mvn/wrapper/maven-wrapper.jar
-
-### VisualStudioCode template
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
-*.code-workspace
-
-# Local History for Visual Studio Code
-.history/
-
-### JetBrains template
-# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
-# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
-
-# User-specific stuff
-.idea/**/workspace.xml
-.idea/**/tasks.xml
-.idea/**/usage.statistics.xml
-.idea/**/dictionaries
-.idea/**/shelf
-
-# Generated files
-.idea/**/contentModel.xml
-
-# Sensitive or high-churn files
-.idea/**/dataSources/
-.idea/**/dataSources.ids
-.idea/**/dataSources.local.xml
-.idea/**/sqlDataSources.xml
-.idea/**/dynamic.xml
-.idea/**/uiDesigner.xml
-.idea/**/dbnavigator.xml
-
-# Gradle
-.idea/**/gradle.xml
-.idea/**/libraries
-
-# Gradle and Maven with auto-import
-# When using Gradle or Maven with auto-import, you should exclude module files,
-# since they will be recreated, and may cause churn.  Uncomment if using
-# auto-import.
-# .idea/artifacts
-# .idea/compiler.xml
-# .idea/jarRepositories.xml
-# .idea/modules.xml
-# .idea/*.iml
-# .idea/modules
-# *.iml
-# *.ipr
-
-# CMake
-cmake-build-*/
-
-# Mongo Explorer plugin
-.idea/**/mongoSettings.xml
-
-# File-based project format
-*.iws
-
-# IntelliJ
-out/
-
-# mpeltonen/sbt-idea plugin
-.idea_modules/
-
-# JIRA plugin
-atlassian-ide-plugin.xml
-
-# Cursive Clojure plugin
-.idea/replstate.xml
-
-# Crashlytics plugin (for Android Studio and IntelliJ)
-com_crashlytics_export_strings.xml
-crashlytics.properties
-crashlytics-build.properties
-fabric.properties
-
-# Editor-based Rest Client
-.idea/httpRequests
-
-# Android studio 3.1+ serialized cache file
-.idea/caches/build_file_checksums.ser
-
-### Eclipse template
-.metadata
-bin/
-tmp/
-*.tmp
-*.bak
-*.swp
-*~.nib
-local.properties
-.settings/
-.loadpath
-.recommenders
-
-# External tool builders
-.externalToolBuilders/
-
-# Locally stored "Eclipse launch configurations"
-*.launch
-
-# PyDev specific (Python IDE for Eclipse)
-*.pydevproject
-
-# CDT-specific (C/C++ Development Tooling)
-.cproject
-
-# CDT- autotools
-.autotools
-
-# Java annotation processor (APT)
-.factorypath
-
-# PDT-specific (PHP Development Tools)
-.buildpath
-
-# sbteclipse plugin
-.target
-
-# Tern plugin
-.tern-project
-
-# TeXlipse plugin
-.texlipse
-
-# STS (Spring Tool Suite)
-.springBeans
-
-# Code Recommenders
-.recommenders/
-
-# Annotation Processing
-.apt_generated/
-.apt_generated_test/
-
-# Scala IDE specific (Scala & Java development for Eclipse)
-.cache-main
-.scala_dependencies
-.worksheet
-
-# Uncomment this line if you wish to ignore the project description file.
-# Typically, this file would be tracked if it contains build/dependency configurations:
-#.project
-
-### Example user template template
-### Example user template
-
-# IntelliJ project files
-.idea
-*.iml
-out
-gen
-
-### Includes
-!lib/*
+target/
+.vscode/### Java template
+# Compiled class file
+*.class
+.vscode
+csv
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+### Maven template
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+# https://github.com/takari/maven-wrapper#usage-without-binary-jar
+.mvn/wrapper/maven-wrapper.jar
+
+### VisualStudioCode template
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+### JetBrains template
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn.  Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+### Eclipse template
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+.recommenders
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# PyDev specific (Python IDE for Eclipse)
+*.pydevproject
+
+# CDT-specific (C/C++ Development Tooling)
+.cproject
+
+# CDT- autotools
+.autotools
+
+# Java annotation processor (APT)
+.factorypath
+
+# PDT-specific (PHP Development Tools)
+.buildpath
+
+# sbteclipse plugin
+.target
+
+# Tern plugin
+.tern-project
+
+# TeXlipse plugin
+.texlipse
+
+# STS (Spring Tool Suite)
+.springBeans
+
+# Code Recommenders
+.recommenders/
+
+# Annotation Processing
+.apt_generated/
+.apt_generated_test/
+
+# Scala IDE specific (Scala & Java development for Eclipse)
+.cache-main
+.scala_dependencies
+.worksheet
+
+# Uncomment this line if you wish to ignore the project description file.
+# Typically, this file would be tracked if it contains build/dependency configurations:
+#.project
+
+### Example user template template
+### Example user template
+
+# IntelliJ project files
+.idea
+*.iml
+out
+gen
+
+### Includes
+!lib/*

+ 5 - 5
README.MD

@@ -1,5 +1,5 @@
-# 告警数据入库
-
-## v1.3说明
-
-增加入库到服务请求分析PG数据库
+# 告警数据入库
+
+## v1.3说明
+
+增加入库到服务请求分析PG数据库

+ 55 - 55
doc/dw_complain_realtime_alarm_h.sql

@@ -1,55 +1,55 @@
-CREATE TABLE tsfx.dw_complain_realtime_alarm_h
-(
-    sdate              timestamp NULL,
-    uniqueid           varchar(200) NULL,
-    uniqueclearid      varchar(200) NULL,
-    eventtime          varchar(50) NULL,
-    canceltime         varchar(50) NULL,
-    status             numeric NULL,
-    projectstatus      numeric NULL,
-    vendoralarmserial  varchar(200) NULL,
-    alarmtitle         varchar(200) NULL,
-    vendorseverity     varchar(200) NULL,
-    vendoralarmtype    varchar(200) NULL,
-    specificproblem    varchar(1000) NULL,
-    specificproblemid  varchar(200) NULL,
-    equipmentclass     varchar(200) NULL,
-    equipmentname      varchar(1000) NULL,
-    locateneclass      varchar(500) NULL,
-    locatenename       varchar(1000) NULL,
-    province           varchar(200) NULL,
-    region             varchar(200) NULL,
-    city               varchar(200) NULL,
-    grid               varchar(200) NULL,
-    area               varchar(200) NULL,
-    vendor             varchar(200) NULL,
-    specialty          numeric NULL,
-    siteid             varchar(200) NULL,
-    roomid             varchar(1000) NULL,
-    towersiteno        varchar(200) NULL,
-    proequipmentstatus numeric NULL,
-    projectname        varchar(200) NULL,
-    projectno          varchar(200) NULL,
-    projectstarttime   varchar(200) NULL,
-    projectendtime     varchar(200) NULL,
-    worksendstatus     numeric NULL,
-    workstatus         numeric NULL,
-    workno             varchar(200) NULL,
-    workarchivedtime   varchar(200) NULL,
-    workdutydep        varchar(200) NULL,
-    worksendperson     varchar(200) NULL,
-    alarmlogicclass    varchar(200) NULL,
-    alarmlogicsubclass varchar(200) NULL,
-    standardalarmname  varchar(1000) NULL,
-    alarmseverity      numeric NULL,
-    standardalarmid    varchar(500) NULL,
-    effectonequipment  varchar(200) NULL,
-    effectonbusiness   varchar(200) NULL,
-    standardflag       numeric NULL,
-    networktype        numeric NULL,
-    equipmentdn        varchar(500) NULL,
-    locatenedn         varchar(500) NULL,
-    taccode            varchar(500) NULL,
-    tacid              varchar(200) NULL,
-    alarmtext          text NULL
-) DISTRIBUTED BY (uniqueid);
+CREATE TABLE tsfx.dw_complain_realtime_alarm_h
+(
+    sdate              timestamp NULL,
+    uniqueid           varchar(200) NULL,
+    uniqueclearid      varchar(200) NULL,
+    eventtime          varchar(50) NULL,
+    canceltime         varchar(50) NULL,
+    status             numeric NULL,
+    projectstatus      numeric NULL,
+    vendoralarmserial  varchar(200) NULL,
+    alarmtitle         varchar(200) NULL,
+    vendorseverity     varchar(200) NULL,
+    vendoralarmtype    varchar(200) NULL,
+    specificproblem    varchar(1000) NULL,
+    specificproblemid  varchar(200) NULL,
+    equipmentclass     varchar(200) NULL,
+    equipmentname      varchar(1000) NULL,
+    locateneclass      varchar(500) NULL,
+    locatenename       varchar(1000) NULL,
+    province           varchar(200) NULL,
+    region             varchar(200) NULL,
+    city               varchar(200) NULL,
+    grid               varchar(200) NULL,
+    area               varchar(200) NULL,
+    vendor             varchar(200) NULL,
+    specialty          numeric NULL,
+    siteid             varchar(200) NULL,
+    roomid             varchar(1000) NULL,
+    towersiteno        varchar(200) NULL,
+    proequipmentstatus numeric NULL,
+    projectname        varchar(200) NULL,
+    projectno          varchar(200) NULL,
+    projectstarttime   varchar(200) NULL,
+    projectendtime     varchar(200) NULL,
+    worksendstatus     numeric NULL,
+    workstatus         numeric NULL,
+    workno             varchar(200) NULL,
+    workarchivedtime   varchar(200) NULL,
+    workdutydep        varchar(200) NULL,
+    worksendperson     varchar(200) NULL,
+    alarmlogicclass    varchar(200) NULL,
+    alarmlogicsubclass varchar(200) NULL,
+    standardalarmname  varchar(1000) NULL,
+    alarmseverity      numeric NULL,
+    standardalarmid    varchar(500) NULL,
+    effectonequipment  varchar(200) NULL,
+    effectonbusiness   varchar(200) NULL,
+    standardflag       numeric NULL,
+    networktype        numeric NULL,
+    equipmentdn        varchar(500) NULL,
+    locatenedn         varchar(500) NULL,
+    taccode            varchar(500) NULL,
+    tacid              varchar(200) NULL,
+    alarmtext          text NULL
+) DISTRIBUTED BY (uniqueid);

+ 21 - 21
doc/prod/gpload/alarm.sh

@@ -1,21 +1,21 @@
-#!/bin/bash
-
-source /usr/local/greenplum-db-clients/greenplum_loaders_path.sh
-
-new_date=$1
-
-# 修改gpload配置文件
-sed -i 's/\/data1\/s130\/alarm\/csv\/resultMap[0-9]\{14\}.csv/\/data1\/s130\/alarm\/csv\/resultMap'${new_date}'.csv/' /data1/s130/alarm/gpload/alarm.yml
-
-# 由于gpload需要输入密码,这里需要使用expect执行
-password=Richr00t#
-
-expect -c "
-set timeout 300
-spawn gpload -f /data1/s130/alarm/gpload/alarm.yml
-expect {
-\"connecting (yes/no)?\" { send \"yes\n\";exp_continue }
-\"Password:\" { send \"${password}\n\"; exp_continue}
-timeout { puts \"超时\" exit 2}
-}
-"
+#!/bin/bash
+
+source /usr/local/greenplum-db-clients/greenplum_loaders_path.sh
+
+new_date=$1
+
+# 修改gpload配置文件
+sed -i 's/\/data1\/s130\/alarm\/csv\/resultMap[0-9]\{14\}.csv/\/data1\/s130\/alarm\/csv\/resultMap'${new_date}'.csv/' /data1/s130/alarm/gpload/alarm.yml
+
+# 由于gpload需要输入密码,这里需要使用expect执行
+password=Richr00t#
+
+expect -c "
+set timeout 300
+spawn gpload -f /data1/s130/alarm/gpload/alarm.yml
+expect {
+\"connecting (yes/no)?\" { send \"yes\n\";exp_continue }
+\"Password:\" { send \"${password}\n\"; exp_continue}
+timeout { puts \"超时\" exit 2}
+}
+"

+ 79 - 79
doc/prod/gpload/alarm.yml

@@ -1,79 +1,79 @@
-VERSION: 1.0.0.1
-DATABASE: sqmmt
-USER: gpadmin
-HOST: 192.168.70.109
-PORT: 5432
-GPLOAD:
-  INPUT:
-    - SOURCE:
-        LOCAL_HOSTNAME:
-          - 192.168.70.130
-        PORT: 54321
-        FILE:
-          - /data1/s130/alarm/csv/resultMap20220628132304.csv
-    - FORMAT: csv
-    - DELIMITER: ","
-    - HEADER: false
-    - ENCODING: utf-8
-    - ERROR_LIMIT: 20000000
-    - LOG_ERRORS: true
-  EXTERNAL:
-    - SCHEMA: tsfx
-  OUTPUT:
-    - TABLE: tsfx.dw_complain_realtime_alarm_h
-    - MODE: merge
-    - MATCH_COLUMNS:
-        - uniqueid
-        - sdate
-    - UPDATE_COLUMNS:
-        - sdate
-        - uniqueclearid
-        - eventtime
-        - canceltime
-        - status
-        - projectstatus
-        - vendoralarmserial
-        - alarmtitle
-        - vendorseverity
-        - vendoralarmtype
-        - specificproblem
-        - specificproblemid
-        - equipmentclass
-        - equipmentname
-        - locateneclass
-        - locatenename
-        - province
-        - region
-        - city
-        - grid
-        - area
-        - vendor
-        - specialty
-        - siteid
-        - roomid
-        - towersiteno
-        - proequipmentstatus
-        - projectname
-        - projectno
-        - projectstarttime
-        - projectendtime
-        - worksendstatus
-        - workstatus
-        - workno
-        - workarchivedtime
-        - workdutydep
-        - worksendperson
-        - alarmlogicclass
-        - alarmlogicsubclass
-        - standardalarmname
-        - alarmseverity
-        - standardalarmid
-        - effectonequipment
-        - effectonbusiness
-        - standardflag
-        - networktype
-        - equipmentdn
-        - locatenedn
-        - taccode
-        - tacid
-        - alarmtext
+VERSION: 1.0.0.1
+DATABASE: sqmmt
+USER: gpadmin
+HOST: 192.168.70.109
+PORT: 5432
+GPLOAD:
+  INPUT:
+    - SOURCE:
+        LOCAL_HOSTNAME:
+          - 192.168.70.130
+        PORT: 54321
+        FILE:
+          - /data1/s130/alarm/csv/resultMap20220628132304.csv
+    - FORMAT: csv
+    - DELIMITER: ","
+    - HEADER: false
+    - ENCODING: utf-8
+    - ERROR_LIMIT: 20000000
+    - LOG_ERRORS: true
+  EXTERNAL:
+    - SCHEMA: tsfx
+  OUTPUT:
+    - TABLE: tsfx.dw_complain_realtime_alarm_h
+    - MODE: merge
+    - MATCH_COLUMNS:
+        - uniqueid
+        - sdate
+    - UPDATE_COLUMNS:
+        - sdate
+        - uniqueclearid
+        - eventtime
+        - canceltime
+        - status
+        - projectstatus
+        - vendoralarmserial
+        - alarmtitle
+        - vendorseverity
+        - vendoralarmtype
+        - specificproblem
+        - specificproblemid
+        - equipmentclass
+        - equipmentname
+        - locateneclass
+        - locatenename
+        - province
+        - region
+        - city
+        - grid
+        - area
+        - vendor
+        - specialty
+        - siteid
+        - roomid
+        - towersiteno
+        - proequipmentstatus
+        - projectname
+        - projectno
+        - projectstarttime
+        - projectendtime
+        - worksendstatus
+        - workstatus
+        - workno
+        - workarchivedtime
+        - workdutydep
+        - worksendperson
+        - alarmlogicclass
+        - alarmlogicsubclass
+        - standardalarmname
+        - alarmseverity
+        - standardalarmid
+        - effectonequipment
+        - effectonbusiness
+        - standardflag
+        - networktype
+        - equipmentdn
+        - locatenedn
+        - taccode
+        - tacid
+        - alarmtext

+ 1 - 1
doc/prod/run.sh

@@ -1 +1 @@
-nohup java -jar /data1/s130/alarm/alarm-1.2-exec.jar >/dev/null 2>&1 &
+nohup java -jar /data1/s130/alarm/alarm-1.2-exec.jar >/dev/null 2>&1 &

+ 5 - 5
doc/prod/stop.sh

@@ -1,5 +1,5 @@
-#!/bin/bash
-
-for i in $(ps -ef | grep alarm-1.2-exec.jar | grep -v grep | awk '{print $2}'); do
-  kill -9 "$i"
-done
+#!/bin/bash
+
+for i in $(ps -ef | grep alarm-1.2-exec.jar | grep -v grep | awk '{print $2}'); do
+  kill -9 "$i"
+done

+ 21 - 21
doc/test/gpload/alarm.sh

@@ -1,21 +1,21 @@
-#!/bin/bash
-
-source /usr/local/greenplum-db-clients/greenplum_loaders_path.sh
-
-new_date=$1
-
-# 修改gpload配置文件
-sed -i 's/\/data1\/s130\/alarm\/csv\/resultMap[0-9]\{14\}.csv/\/data1\/s130\/alarm\/csv\/resultMap'${new_date}'.csv/' /data1/s130/alarm/gpload/alarm.yml
-
-# 由于gpload需要输入密码,这里需要使用expect执行
-password=Richr00t#
-
-expect -c "
-set timeout 300
-spawn gpload -f /data1/s130/alarm/gpload/alarm.yml
-expect {
-\"connecting (yes/no)?\" { send \"yes\n\";exp_continue }
-\"Password:\" { send \"${password}\n\"; exp_continue}
-timeout { puts \"超时\" exit 2}
-}
-"
+#!/bin/bash
+
+source /usr/local/greenplum-db-clients/greenplum_loaders_path.sh
+
+new_date=$1
+
+# 修改gpload配置文件
+sed -i 's/\/data1\/s130\/alarm\/csv\/resultMap[0-9]\{14\}.csv/\/data1\/s130\/alarm\/csv\/resultMap'${new_date}'.csv/' /data1/s130/alarm/gpload/alarm.yml
+
+# 由于gpload需要输入密码,这里需要使用expect执行
+password=Richr00t#
+
+expect -c "
+set timeout 300
+spawn gpload -f /data1/s130/alarm/gpload/alarm.yml
+expect {
+\"connecting (yes/no)?\" { send \"yes\n\";exp_continue }
+\"Password:\" { send \"${password}\n\"; exp_continue}
+timeout { puts \"超时\" exit 2}
+}
+"

+ 79 - 79
doc/test/gpload/alarm.yml

@@ -1,79 +1,79 @@
-VERSION: 1.0.0.1
-DATABASE: sqmmt
-USER: sqmdb
-HOST: 192.168.50.5
-PORT: 5432
-GPLOAD:
-  INPUT:
-    - SOURCE:
-        LOCAL_HOSTNAME:
-          - 192.168.50.3
-        PORT: 54321
-        FILE:
-          - /data1/s130/alarm/csv/resultMap20220628132304.csv
-    - FORMAT: csv
-    - DELIMITER: ","
-    - HEADER: false
-    - ENCODING: utf-8
-    - ERROR_LIMIT: 20000000
-    - LOG_ERRORS: true
-  EXTERNAL:
-    - SCHEMA: tsfx
-  OUTPUT:
-    - TABLE: tsfx.dw_complain_realtime_alarm_h
-    - MODE: merge
-    - MATCH_COLUMNS:
-        - uniqueid
-        - sdate
-    - UPDATE_COLUMNS:
-        - sdate
-        - uniqueclearid
-        - eventtime
-        - canceltime
-        - status
-        - projectstatus
-        - vendoralarmserial
-        - alarmtitle
-        - vendorseverity
-        - vendoralarmtype
-        - specificproblem
-        - specificproblemid
-        - equipmentclass
-        - equipmentname
-        - locateneclass
-        - locatenename
-        - province
-        - region
-        - city
-        - grid
-        - area
-        - vendor
-        - specialty
-        - siteid
-        - roomid
-        - towersiteno
-        - proequipmentstatus
-        - projectname
-        - projectno
-        - projectstarttime
-        - projectendtime
-        - worksendstatus
-        - workstatus
-        - workno
-        - workarchivedtime
-        - workdutydep
-        - worksendperson
-        - alarmlogicclass
-        - alarmlogicsubclass
-        - standardalarmname
-        - alarmseverity
-        - standardalarmid
-        - effectonequipment
-        - effectonbusiness
-        - standardflag
-        - networktype
-        - equipmentdn
-        - locatenedn
-        - taccode
-        - tacid
-        - alarmtext
+VERSION: 1.0.0.1
+DATABASE: sqmmt
+USER: sqmdb
+HOST: 192.168.50.5
+PORT: 5432
+GPLOAD:
+  INPUT:
+    - SOURCE:
+        LOCAL_HOSTNAME:
+          - 192.168.50.3
+        PORT: 54321
+        FILE:
+          - /data1/s130/alarm/csv/resultMap20220628132304.csv
+    - FORMAT: csv
+    - DELIMITER: ","
+    - HEADER: false
+    - ENCODING: utf-8
+    - ERROR_LIMIT: 20000000
+    - LOG_ERRORS: true
+  EXTERNAL:
+    - SCHEMA: tsfx
+  OUTPUT:
+    - TABLE: tsfx.dw_complain_realtime_alarm_h
+    - MODE: merge
+    - MATCH_COLUMNS:
+        - uniqueid
+        - sdate
+    - UPDATE_COLUMNS:
+        - sdate
+        - uniqueclearid
+        - eventtime
+        - canceltime
+        - status
+        - projectstatus
+        - vendoralarmserial
+        - alarmtitle
+        - vendorseverity
+        - vendoralarmtype
+        - specificproblem
+        - specificproblemid
+        - equipmentclass
+        - equipmentname
+        - locateneclass
+        - locatenename
+        - province
+        - region
+        - city
+        - grid
+        - area
+        - vendor
+        - specialty
+        - siteid
+        - roomid
+        - towersiteno
+        - proequipmentstatus
+        - projectname
+        - projectno
+        - projectstarttime
+        - projectendtime
+        - worksendstatus
+        - workstatus
+        - workno
+        - workarchivedtime
+        - workdutydep
+        - worksendperson
+        - alarmlogicclass
+        - alarmlogicsubclass
+        - standardalarmname
+        - alarmseverity
+        - standardalarmid
+        - effectonequipment
+        - effectonbusiness
+        - standardflag
+        - networktype
+        - equipmentdn
+        - locatenedn
+        - taccode
+        - tacid
+        - alarmtext

+ 1 - 1
doc/test/run.sh

@@ -1 +1 @@
-nohup java -jar /data1/s130/alarm/alarm-1.2-exec.jar >/dev/null 2>&1 &
+nohup java -jar /data1/s130/alarm/alarm-1.2-exec.jar >/dev/null 2>&1 &

+ 5 - 5
doc/test/stop.sh

@@ -1,5 +1,5 @@
-#!/bin/bash
-
-for i in $(ps -ef | grep alarm-1.2-exec.jar | grep -v grep | awk '{print $2}'); do
-  kill -9 "$i"
-done
+#!/bin/bash
+
+for i in $(ps -ef | grep alarm-1.2-exec.jar | grep -v grep | awk '{print $2}'); do
+  kill -9 "$i"
+done

+ 23 - 23
doc/历史文档/历史版本/投诉1线投诉3线告警订阅.md

@@ -1,23 +1,23 @@
-# 告警订阅信息
-
-```sh
-# 1线
-httpurl: https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v1.0
-
-https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v2.0
-# 3线
-httpurl: http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
-1线和3线是同一个数据源,1线可以直通,3线通过esb转了一手
-本地使用url(通过省ESB转发): <http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA>
-appId: 0f9bf497549343e68ca36b4caffbc8c4
-secret: 087b1ceb698140cd8c65543f5ace0490
-集团使用url: <https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v1.0>
-```
-
-本地ESBurl `http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA`
-
-集团ESBurl `https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v1.0`
-
-对应平台url `https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v2.0`
-
-尊敬的能力使用方,您好! 由于本部资源池服务器(廊坊)清退,需要您对所订购能力的网络调用地址进行更改, 若调用不通则需要进行网络打通,原地址为(10.243.3.108、10.243.3.110、10.243.3.124(vip)), 新地址为(172.25.34.180:443、172.25.34.151:443、172.25.34.152:443、172.24.123.29:2443)。
+# 告警订阅信息
+
+```sh
+# 1线
+httpurl: https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v1.0
+
+https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v2.0
+# 3线
+httpurl: http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
+1线和3线是同一个数据源,1线可以直通,3线通过esb转了一手
+本地使用url(通过省ESB转发): <http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA>
+appId: 0f9bf497549343e68ca36b4caffbc8c4
+secret: 087b1ceb698140cd8c65543f5ace0490
+集团使用url: <https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v1.0>
+```
+
+本地ESBurl `http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA`
+
+集团ESBurl `https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v1.0`
+
+对应平台url `https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v2.0`
+
+尊敬的能力使用方,您好! 由于本部资源池服务器(廊坊)清退,需要您对所订购能力的网络调用地址进行更改, 若调用不通则需要进行网络打通,原地址为(10.243.3.108、10.243.3.110、10.243.3.124(vip)), 新地址为(172.25.34.180:443、172.25.34.151:443、172.25.34.152:443、172.24.123.29:2443)。

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 113
doc/历史文档/告警数据字段信息/resultMap20230224163020.csv


+ 63 - 63
doc/历史文档/问题排查/20230113告警报错问题排查/20230113告警报错问题排查.md

@@ -1,63 +1,63 @@
-# 20230113告警报错问题排查
-
-[接口源头地址](https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v2.0)
-
-```sh
-# appid
-0f9bf497549343e68ca36b4caffbc8c4
-# secret
-087b1ceb698140cd8c65543f5ace0490
-```
-
-## 20230113报错时间点总结
-
-```sh
-# 接口原始地址
-https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v2.0
-# 经过ESB转发后的地址
-http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
-# appid
-0f9bf497549343e68ca36b4caffbc8c4
-
-报错时间点:
-2023-01-13 11:35:00
-2023-01-13 11:35:00
-2023-01-13 11:40:00
-2023-01-13 11:50:16
-2023-01-13 11:55:00
-2023-01-13 12:00:00
-2023-01-13 12:00:00
-2023-01-13 12:15:00
-2023-01-13 12:25:00
-2023-01-13 12:35:00
-2023-01-13 12:45:00
-
-这边的逻辑是每5分钟执行1次任务,调用两次接口,第一次调用是获取新增告警,第二次是获取消除告警。
-今天的表现是新增告警和消除告警调用时都存在报错。
-
-持续时间是 11点36分到12点46分
-```
-
-报错时接口返回的html
-
-```html
-<!DOCTYPE html>
-<html>
-<head>
-<title>Error</title>
-<style>
-html { color-scheme: light dark; }
-body { width: 35em; margin: 0 auto;
-font-family: Tahoma, Verdana, Arial, sans-serif; }
-</style>
-</head>
-<body>
-<h1>An error occurred.</h1>
-<p>Sorry, the page you are looking for is currently unavailable.<br/>
-Please try again later.</p>
-<p>If you are the system administrator of this resource then you should check
-the error log for details.</p>
-<p><em>Faithfully yours, nginx.</em></p>
-</body>
-</html>
-```
+# 20230113告警报错问题排查
+
+[接口源头地址](https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v2.0)
+
+```sh
+# appid
+0f9bf497549343e68ca36b4caffbc8c4
+# secret
+087b1ceb698140cd8c65543f5ace0490
+```
+
+## 20230113报错时间点总结
+
+```sh
+# 接口原始地址
+https://10.243.3.124/api/middlleplatform/NCfVA7/iDYQz4/v2.0
+# 经过ESB转发后的地址
+http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
+# appid
+0f9bf497549343e68ca36b4caffbc8c4
+
+报错时间点:
+2023-01-13 11:35:00
+2023-01-13 11:35:00
+2023-01-13 11:40:00
+2023-01-13 11:50:16
+2023-01-13 11:55:00
+2023-01-13 12:00:00
+2023-01-13 12:00:00
+2023-01-13 12:15:00
+2023-01-13 12:25:00
+2023-01-13 12:35:00
+2023-01-13 12:45:00
+
+这边的逻辑是每5分钟执行1次任务,调用两次接口,第一次调用是获取新增告警,第二次是获取消除告警。
+今天的表现是新增告警和消除告警调用时都存在报错。
+
+持续时间是 11点36分到12点46分
+```
+
+报错时接口返回的html
+
+```html
+<!DOCTYPE html>
+<html>
+<head>
+<title>Error</title>
+<style>
+html { color-scheme: light dark; }
+body { width: 35em; margin: 0 auto;
+font-family: Tahoma, Verdana, Arial, sans-serif; }
+</style>
+</head>
+<body>
+<h1>An error occurred.</h1>
+<p>Sorry, the page you are looking for is currently unavailable.<br/>
+Please try again later.</p>
+<p>If you are the system administrator of this resource then you should check
+the error log for details.</p>
+<p><em>Faithfully yours, nginx.</em></p>
+</body>
+</html>
+```

+ 3 - 3
doc/开发文档/20240506.md

@@ -1,3 +1,3 @@
-# 20240506
-
-PG数据库登录信息 192.168.70.172:5432/sqmmt  sqmdb/sqmdb_1QAZ
+# 20240506
+
+PG数据库登录信息 192.168.70.172:5432/sqmmt  sqmdb/sqmdb_1QAZ

+ 3 - 3
doc/部署文档/正式环境/正式环境部署情况.md

@@ -1,3 +1,3 @@
-# 正式环境部署情况
-
-当前部署位置 192.168.70.130/data1/s130/alarm
+# 正式环境部署情况
+
+当前部署位置 192.168.70.130/data1/s130/alarm

+ 45 - 45
doc/需求文档/告警入库报错.txt

@@ -1,45 +1,45 @@
-2022-07-26 09:17:00.156 ERROR 179932 --- [lerThreadPool-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task
-
-com.alibaba.fastjson.JSONException: illegal character <
-	at com.alibaba.fastjson.JSON.parseObject(JSON.java:193) ~[fastjson-2.0.7.graal.jar!/:na]
-	at com.nokia.alarm.service.AlarmSaveToFileService.getHttpSave(AlarmSaveToFileService.java:43) ~[classes!/:1.2]
-	at com.nokia.alarm.config.SchedulingConfig.lambda$null$0(SchedulingConfig.java:53) ~[classes!/:1.2]
-	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.3.21.jar!/:5.3.21]
-	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_301]
-	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_301]
-	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_301]
-	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_301]
-	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_301]
-	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_301]
-	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_301]
-Caused by: com.alibaba.fastjson2.JSONException: illegal character <
-	at com.alibaba.fastjson2.JSONReaderUTF16.readFieldNameHashCode(JSONReaderUTF16.java:633) ~[fastjson2-2.0.7.graal.jar!/:na]
-	at com.alibaba.fastjson2.reader.ObjectReader4.readObject(ObjectReader4.java:253) ~[fastjson2-2.0.7.graal.jar!/:na]
-	at com.alibaba.fastjson.JSON.parseObject(JSON.java:183) ~[fastjson-2.0.7.graal.jar!/:na]
-	... 10 common frames omitted
-
-
-
-com.alibaba.fastjson.JSONException: illegal character C
-	at com.alibaba.fastjson.JSON.parseObject(JSON.java:193)
-	at com.nokia.alarm.service.AlarmSaveToFileService.getHttpUpdate(AlarmSaveToFileService.java:82)
-	at com.nokia.alarm.config.SchedulingConfig.lambda$configureTasks$1(SchedulingConfig.java:47)
-	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
-	at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:95)
-	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
-	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
-	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
-	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
-	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
-	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
-	at java.lang.Thread.run(Thread.java:748)
-Caused by: com.alibaba.fastjson2.JSONException: illegal character C
-	at com.alibaba.fastjson2.JSONReaderUTF16.readFieldNameHashCode(JSONReaderUTF16.java:633)
-	at com.alibaba.fastjson2.reader.ObjectReader4.readObject(ObjectReader4.java:253)
-	at com.alibaba.fastjson.JSON.parseObject(JSON.java:183)
-
-2022-08-10 09:05:19.424  INFO 179932 --- [lerThreadPool-1] c.n.a.service.AlarmSaveToFileService     : 查询消除告警开始=====================================================
-java.lang.NullPointerException
-
-2022-08-10 08:40:00.000  INFO 179932 --- [lerThreadPool-1] c.n.a.service.AlarmSaveToFileService     : 查询新增告警开始=====================================================
-java.lang.NullPointerException
+2022-07-26 09:17:00.156 ERROR 179932 --- [lerThreadPool-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task
+
+com.alibaba.fastjson.JSONException: illegal character <
+	at com.alibaba.fastjson.JSON.parseObject(JSON.java:193) ~[fastjson-2.0.7.graal.jar!/:na]
+	at com.nokia.alarm.service.AlarmSaveToFileService.getHttpSave(AlarmSaveToFileService.java:43) ~[classes!/:1.2]
+	at com.nokia.alarm.config.SchedulingConfig.lambda$null$0(SchedulingConfig.java:53) ~[classes!/:1.2]
+	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.3.21.jar!/:5.3.21]
+	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_301]
+	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_301]
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_301]
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_301]
+	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_301]
+	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_301]
+	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_301]
+Caused by: com.alibaba.fastjson2.JSONException: illegal character <
+	at com.alibaba.fastjson2.JSONReaderUTF16.readFieldNameHashCode(JSONReaderUTF16.java:633) ~[fastjson2-2.0.7.graal.jar!/:na]
+	at com.alibaba.fastjson2.reader.ObjectReader4.readObject(ObjectReader4.java:253) ~[fastjson2-2.0.7.graal.jar!/:na]
+	at com.alibaba.fastjson.JSON.parseObject(JSON.java:183) ~[fastjson-2.0.7.graal.jar!/:na]
+	... 10 common frames omitted
+
+
+
+com.alibaba.fastjson.JSONException: illegal character C
+	at com.alibaba.fastjson.JSON.parseObject(JSON.java:193)
+	at com.nokia.alarm.service.AlarmSaveToFileService.getHttpUpdate(AlarmSaveToFileService.java:82)
+	at com.nokia.alarm.config.SchedulingConfig.lambda$configureTasks$1(SchedulingConfig.java:47)
+	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
+	at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:95)
+	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
+	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
+	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
+	at java.lang.Thread.run(Thread.java:748)
+Caused by: com.alibaba.fastjson2.JSONException: illegal character C
+	at com.alibaba.fastjson2.JSONReaderUTF16.readFieldNameHashCode(JSONReaderUTF16.java:633)
+	at com.alibaba.fastjson2.reader.ObjectReader4.readObject(ObjectReader4.java:253)
+	at com.alibaba.fastjson.JSON.parseObject(JSON.java:183)
+
+2022-08-10 09:05:19.424  INFO 179932 --- [lerThreadPool-1] c.n.a.service.AlarmSaveToFileService     : 查询消除告警开始=====================================================
+java.lang.NullPointerException
+
+2022-08-10 08:40:00.000  INFO 179932 --- [lerThreadPool-1] c.n.a.service.AlarmSaveToFileService     : 查询新增告警开始=====================================================
+java.lang.NullPointerException

+ 7 - 7
doc/需求文档/告警数据入库需求汇总.md

@@ -1,7 +1,7 @@
-# 告警数据入库需求汇总
-
-## 后续需求
-
-1. 错误处理,当前发现了两个经常出现的打印消息,与查询远端接口的返回有关,后续需要优化程序,对错误情况进行处理。
-
-2. 后续会切换到河北省本地的告警数据源,采用kafka对接。
+# 告警数据入库需求汇总
+
+## 后续需求
+
+1. 错误处理,当前发现了两个经常出现的打印消息,与查询远端接口的返回有关,后续需要优化程序,对错误情况进行处理。
+
+2. 后续会切换到河北省本地的告警数据源,采用kafka对接。

+ 116 - 116
pom.xml

@@ -1,117 +1,117 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <groupId>org.springframework.boot</groupId>
-        <version>2.6.9</version>
-    </parent>
-
-    <artifactId>alarm</artifactId>
-    <version>1.3</version>
-    <packaging>jar</packaging>
-
-    <properties>
-        <!-- 跳过测试代码 -->
-        <skipTests>true</skipTests>
-        <!-- 指定java的版本 -->
-        <java.version>1.8</java.version>
-        <!-- 文件拷贝时的编码 -->
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <!-- 指定maven-compiler-plugin的配置属性开始 -->
-        <!-- 编译时的编码 -->
-        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
-        <!-- 指定编译的版本 -->
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-        <maven.compiler.compilerVersion>8</maven.compiler.compilerVersion>
-        <!-- 指定maven-compiler-plugin的配置属性结束 -->
-    </properties>
-
-    <dependencies>
-        <!-- 本地依赖开始 -->
-        <dependency>
-            <groupId>com.hl.opnc</groupId>
-            <artifactId>opnc-sdk</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-            <scope>system</scope>
-            <systemPath>${project.basedir}\lib\opnc-sdk-1.0.0-SNAPSHOT.jar</systemPath>
-        </dependency>
-        <!-- opnc-sdk 依赖开始 -->
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
-            <version>4.5.13</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpmime</artifactId>
-            <version>4.5</version>
-        </dependency>
-        <!-- opnc-sdk 依赖结束 -->
-        <!-- 本地依赖结束 -->
-        <!-- mybatis -->
-        <dependency>
-            <groupId>org.mybatis.spring.boot</groupId>
-            <artifactId>mybatis-spring-boot-starter</artifactId>
-            <version>2.2.2</version>
-        </dependency>
-        <!-- postgresql数据库和greenplum数据库驱动 -->
-        <dependency>
-            <groupId>org.postgresql</groupId>
-            <artifactId>postgresql</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
-            <version>2.0.7.graal</version>
-        </dependency>
-        <!-- commons-csv -->
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-csv</artifactId>
-            <version>1.9.0</version>
-        </dependency>
-        <!-- commons-beanutils -->
-        <dependency>
-            <groupId>commons-beanutils</groupId>
-            <artifactId>commons-beanutils-core</artifactId>
-            <version>1.8.3</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <!-- testSourceDirectory 测试代码的路径,有的ide是自动识别的 vscode需要通过pom进行配置 -->
-        <testSourceDirectory>src/test</testSourceDirectory>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <configuration>
-                    <!-- 把systemPath指定的依赖一起打包到BOOT-INF/lib -->
-                    <includeSystemScope>true</includeSystemScope>
-                    <!-- 打包1个带exec的可执行jar包和一个不带exec的可作为依赖的jar包 -->
-                    <classifier>exec</classifier>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <groupId>org.springframework.boot</groupId>
+        <version>2.6.9</version>
+    </parent>
+
+    <artifactId>alarm</artifactId>
+    <version>1.3</version>
+    <packaging>jar</packaging>
+
+    <properties>
+        <!-- 跳过测试代码 -->
+        <skipTests>true</skipTests>
+        <!-- 指定java的版本 -->
+        <java.version>1.8</java.version>
+        <!-- 文件拷贝时的编码 -->
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <!-- 指定maven-compiler-plugin的配置属性开始 -->
+        <!-- 编译时的编码 -->
+        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
+        <!-- 指定编译的版本 -->
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <maven.compiler.compilerVersion>8</maven.compiler.compilerVersion>
+        <!-- 指定maven-compiler-plugin的配置属性结束 -->
+    </properties>
+
+    <dependencies>
+        <!-- 本地依赖开始 -->
+        <dependency>
+            <groupId>com.hl.opnc</groupId>
+            <artifactId>opnc-sdk</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}\lib\opnc-sdk-1.0.0-SNAPSHOT.jar</systemPath>
+        </dependency>
+        <!-- opnc-sdk 依赖开始 -->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.13</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+            <version>4.5</version>
+        </dependency>
+        <!-- opnc-sdk 依赖结束 -->
+        <!-- 本地依赖结束 -->
+        <!-- mybatis -->
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.2.2</version>
+        </dependency>
+        <!-- postgresql数据库和greenplum数据库驱动 -->
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>2.0.7.graal</version>
+        </dependency>
+        <!-- commons-csv -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-csv</artifactId>
+            <version>1.9.0</version>
+        </dependency>
+        <!-- commons-beanutils -->
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils-core</artifactId>
+            <version>1.8.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <!-- testSourceDirectory 测试代码的路径,有的ide是自动识别的 vscode需要通过pom进行配置 -->
+        <testSourceDirectory>src/test</testSourceDirectory>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <!-- 把systemPath指定的依赖一起打包到BOOT-INF/lib -->
+                    <includeSystemScope>true</includeSystemScope>
+                    <!-- 打包1个带exec的可执行jar包和一个不带exec的可作为依赖的jar包 -->
+                    <classifier>exec</classifier>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

+ 13 - 13
src/main/java/com/nokia/alarm/AlarmApplication.java

@@ -1,13 +1,13 @@
-package com.nokia.alarm;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.scheduling.annotation.EnableScheduling;
-
-@SpringBootApplication
-@EnableScheduling
-public class AlarmApplication {
-    public static void main(String[] args) {
-        SpringApplication.run(AlarmApplication.class, args);
-    }
-}
+package com.nokia.alarm;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@SpringBootApplication
+@EnableScheduling
+public class AlarmApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(AlarmApplication.class, args);
+    }
+}

+ 57 - 0
src/main/java/com/nokia/alarm/config/CronTaskConfig.java

@@ -0,0 +1,57 @@
+package com.nokia.alarm.config;
+
+import java.io.IOException;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.SchedulingConfigurer;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
+import org.springframework.scheduling.config.ScheduledTaskRegistrar;
+
+import com.nokia.alarm.service.AlarmSaveToGPandPGService;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@SuppressWarnings("null")
+@Configuration
+public class CronTaskConfig implements SchedulingConfigurer {
+
+    @Autowired
+    private AlarmSaveToGPandPGService service;
+
+    @Autowired
+    private ThreadPoolTaskScheduler taskScheduler;
+
+    @Override
+    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
+        taskRegistrar.setScheduler(taskScheduler);
+
+        // 入库的任务
+        taskRegistrar.addCronTask(() -> {
+            Date date = new Date();
+            taskScheduler.submit(() -> {
+                service.newAlarm(date);
+                service.updateAlarm(date);
+            });
+        }, "0 */5 * * * ?");
+
+        // 删除临时文件的任务
+        taskRegistrar.addCronTask(() -> {
+            String day = DateTimeFormatter.ofPattern("yyyyMMdd").withZone(ZoneId.of("Asia/Shanghai"))
+                    .format(LocalDate.now().plusDays(-7));
+            try {
+                Runtime.getRuntime().exec("rm /data1/s130/allarm/csv/resultMap" + day + "*").waitFor();
+            } catch (InterruptedException | IOException e) {
+                e.printStackTrace();
+                log.error("删除文件出错...");
+            }
+        }, "0 0 0 * * ?");
+
+        log.info("已开启周期任务调度...");
+    }
+}

+ 31 - 50
src/main/java/com/nokia/alarm/config/SchedulingConfig.java

@@ -1,50 +1,31 @@
-package com.nokia.alarm.config;
-
-import java.util.Date;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.SchedulingConfigurer;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
-import org.springframework.scheduling.config.ScheduledTaskRegistrar;
-
-import com.nokia.alarm.service.AlarmSaveToGPandPGService;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Configuration
-@SuppressWarnings("null")
-public class SchedulingConfig implements SchedulingConfigurer {
-
-    @Value("${scheduling.scheduler.pool.size:2}")
-    private int poolSize;
-
-    @Autowired
-    private AlarmSaveToGPandPGService service;
-
-    @Bean
-    public ThreadPoolTaskScheduler taskScheduler() {
-        // 使用最常用的ThreadPoolTaskScheduler
-        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
-        // 线程数
-        taskScheduler.setPoolSize(poolSize);
-        taskScheduler.setRemoveOnCancelPolicy(true);
-        taskScheduler.setThreadNamePrefix("taskSchedulerThreadPool-");
-        log.info("已完成 ThreadPoolTaskScheduler 配置, poolSize = {}", poolSize);
-        return taskScheduler;
-    }
-
-    @Override
-    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
-        taskRegistrar.setScheduler(taskScheduler());
-        taskRegistrar.addCronTask(() -> {
-            Date date = new Date();
-            service.newAlarm(date);
-            service.updateAlarm(date);
-        }, "0 */5 * * * ?");
-    }
-
-}
+package com.nokia.alarm.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@Configuration
+
+public class SchedulingConfig {
+
+    @Value("${scheduling.scheduler.pool.size:5}")
+    private int poolSize;
+
+    @Bean
+    public ThreadPoolTaskScheduler taskScheduler() {
+        // 使用最常用的ThreadPoolTaskScheduler
+        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
+        // 线程数
+        taskScheduler.setPoolSize(poolSize);
+        taskScheduler.setRemoveOnCancelPolicy(true);
+        taskScheduler.setThreadNamePrefix("taskSchedulerThreadPool-");
+        log.info("已完成 ThreadPoolTaskScheduler 配置, poolSize = {}", poolSize);
+        return taskScheduler;
+    }
+
+    
+
+}

+ 18 - 18
src/main/java/com/nokia/alarm/controller/TestController.java

@@ -1,18 +1,18 @@
-package com.nokia.alarm.controller;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@Slf4j
-@RestController
-public class TestController {
-    /**
-     * 短信告警测试
-     */
-    @GetMapping("/test/alert")
-    public Object alert() {
-        log.error("短信告警测试");
-        return "ok";
-    }
-}
+package com.nokia.alarm.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RestController
+public class TestController {
+    /**
+     * 短信告警测试
+     */
+    @GetMapping("/test/alert")
+    public Object alert() {
+        log.error("短信告警测试");
+        return "ok";
+    }
+}

+ 19 - 19
src/main/java/com/nokia/alarm/entity/MessageCfg.java

@@ -1,19 +1,19 @@
-package com.nokia.alarm.entity;
-
-import java.util.List;
-
-import lombok.Data;
-
-@Data
-public class MessageCfg {
-    private String startTime;
-    private int pageSize;
-    private List<String> fileds;
-    private String endTime;
-    private int resultDataType;
-    private int resultFieldType;
-    private int pageNum;
-    private List<String> province;
-    private List<String> networkType;
-    private List<String> cancelTime;
-}
+package com.nokia.alarm.entity;
+
+import java.util.List;
+
+import lombok.Data;
+
+@Data
+public class MessageCfg {
+    private String startTime;
+    private int pageSize;
+    private List<String> fileds;
+    private String endTime;
+    private int resultDataType;
+    private int resultFieldType;
+    private int pageNum;
+    private List<String> province;
+    private List<String> networkType;
+    private List<String> cancelTime;
+}

+ 13 - 13
src/main/java/com/nokia/alarm/entity/ResultInfo.java

@@ -1,13 +1,13 @@
-package com.nokia.alarm.entity;
-
-import java.util.List;
-
-import lombok.Data;
-
-@Data
-public class ResultInfo {
-    private String msg;
-    private int status;
-    private int total;
-    private List<ResultMap> result;
-}
+package com.nokia.alarm.entity;
+
+import java.util.List;
+
+import lombok.Data;
+
+@Data
+public class ResultInfo {
+    private String msg;
+    private int status;
+    private int total;
+    private List<ResultMap> result;
+}

+ 58 - 58
src/main/java/com/nokia/alarm/entity/ResultMap.java

@@ -1,58 +1,58 @@
-package com.nokia.alarm.entity;
-
-import lombok.Data;
-
-@Data
-public class ResultMap {
-    private String uniqueId;
-    private String uniqueClearId;
-    private String eventTime;
-    private String cancelTime;
-    private Integer status;
-    private Integer projectStatus;
-    private String vendorAlarmSerial;
-    private String alarmTitle;
-    private String vendorSeverity;
-    private String vendorAlarmType;
-    private String specificProblem;
-    private String specificProblemID;
-    private String equipmentClass;
-    private String equipmentName;
-    private String locateNeClass;
-    private String locateNeName;
-    private String province;
-    private String region;
-    private String city;
-    private String grid;
-    private String area;
-    private String vendor;
-    private Integer specialty;
-    private String siteId;
-    private String roomId;
-    private String towerSiteNo;
-    private Integer proEquipmentStatus;
-    private String projectName;
-    private String projectNo;
-    private String projectStartTime;
-    private String projectEndTime;
-    private Integer workSendStatus;
-    private Integer workStatus;
-    private String workNo;
-    private String workArchivedTime;
-    private String workDutyDep;
-    private String workSendPerson;
-    private String alarmLogicClass;
-    private String alarmLogicSubClass;
-    private String standardAlarmName;
-    private Integer alarmSeverity;
-    private String standardAlarmId;
-    private String effectOnEquipment;
-    private String effectOnBusiness;
-    private Integer standardFlag;
-    private Integer networkType;
-    private String locateNEDN;
-    private String equipmentDN;
-    private String tacCode;
-    private String tacId;
-    private String alarmText;
-}
+package com.nokia.alarm.entity;
+
+import lombok.Data;
+
+@Data
+public class ResultMap {
+    private String uniqueId;
+    private String uniqueClearId;
+    private String eventTime;
+    private String cancelTime;
+    private Integer status;
+    private Integer projectStatus;
+    private String vendorAlarmSerial;
+    private String alarmTitle;
+    private String vendorSeverity;
+    private String vendorAlarmType;
+    private String specificProblem;
+    private String specificProblemID;
+    private String equipmentClass;
+    private String equipmentName;
+    private String locateNeClass;
+    private String locateNeName;
+    private String province;
+    private String region;
+    private String city;
+    private String grid;
+    private String area;
+    private String vendor;
+    private Integer specialty;
+    private String siteId;
+    private String roomId;
+    private String towerSiteNo;
+    private Integer proEquipmentStatus;
+    private String projectName;
+    private String projectNo;
+    private String projectStartTime;
+    private String projectEndTime;
+    private Integer workSendStatus;
+    private Integer workStatus;
+    private String workNo;
+    private String workArchivedTime;
+    private String workDutyDep;
+    private String workSendPerson;
+    private String alarmLogicClass;
+    private String alarmLogicSubClass;
+    private String standardAlarmName;
+    private Integer alarmSeverity;
+    private String standardAlarmId;
+    private String effectOnEquipment;
+    private String effectOnBusiness;
+    private Integer standardFlag;
+    private Integer networkType;
+    private String locateNEDN;
+    private String equipmentDN;
+    private String tacCode;
+    private String tacId;
+    private String alarmText;
+}

+ 37 - 37
src/main/java/com/nokia/alarm/mapper/ResultMapDao.java

@@ -1,37 +1,37 @@
-package com.nokia.alarm.mapper;
-
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
-
-import com.nokia.alarm.entity.ResultMap;
-
-/* cspell:disable */
-@Mapper
-public interface ResultMapDao {
-
-        @Select("select count(1) from tsfx.dw_complain_realtime_alarm_h where uniqueId=#{uniqueId} and sdate = to_timestamp(#{eventTime}, 'yyyy-MM-dd HH24:00:00')")
-        int findByUniqueId(ResultMap result);
-
-        @Update("update tsfx.dw_complain_realtime_alarm_h set cancelTime=#{cancelTime},status=#{status},projectStatus=#{projectStatus},workStatus=#{workStatus}"
-                        + " where uniqueId=#{uniqueId}")
-        void updateData(ResultMap result);
-
-        @Insert("insert into tsfx.dw_complain_realtime_alarm_h "
-                        + "(sdate,uniqueid,uniqueclearid,eventtime,canceltime,status,projectstatus,vendoralarmserial,alarmtitle,"
-                        + "vendorseverity,vendoralarmtype,specificproblem,specificproblemid,equipmentclass,equipmentname,locateneclass,"
-                        + "locatenename,province,region,city,grid,area,vendor,specialty,siteid,roomid,towersiteno,proequipmentstatus,"
-                        + "projectname,projectno,projectstarttime,projectendtime,worksendstatus,workstatus,workno,workarchivedtime,"
-                        + "workdutydep,worksendperson,alarmlogicclass,alarmlogicsubclass,standardalarmname,alarmseverity,standardalarmid,"
-                        + "effectonequipment,effectonbusiness,standardflag,networktype,equipmentdn,locatenedn,taccode,tacid,alarmtext) values "
-                        + "(to_timestamp(#{eventTime}, 'yyyy-MM-dd HH24:00:00'),#{uniqueId},#{uniqueClearId},#{eventTime},#{cancelTime},"
-                        + "#{status},#{projectStatus},#{vendorAlarmSerial},#{alarmTitle},#{vendorSeverity},#{vendorAlarmType},#{specificProblem},"
-                        + "#{specificProblemID},#{equipmentClass},#{equipmentName},#{locateNeClass},#{locateNeName},#{province},#{region},#{city},"
-                        + "#{grid},#{area},#{vendor},#{specialty},#{siteId},#{roomId},#{towerSiteNo},#{proEquipmentStatus},#{projectName},"
-                        + "#{projectNo},#{projectStartTime},#{projectEndTime},#{workSendStatus},#{workStatus},#{workNo},#{workArchivedTime},"
-                        + "#{workDutyDep},#{workSendPerson},#{alarmLogicClass},#{alarmLogicSubClass},#{standardAlarmName},#{alarmSeverity},"
-                        + "#{standardAlarmId},#{effectOnEquipment},#{effectOnBusiness},#{standardFlag},#{networkType},#{locateNEDN},"
-                        + "#{equipmentDN},#{tacCode},#{tacId},#{alarmText})")
-        void insertData(ResultMap result);
-}
+package com.nokia.alarm.mapper;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import com.nokia.alarm.entity.ResultMap;
+
+/* cspell:disable */
+@Mapper
+public interface ResultMapDao {
+
+        @Select("select count(1) from tsfx.dw_complain_realtime_alarm_h where sdate = to_timestamp(#{eventTime}, 'yyyy-MM-dd HH24:00:00') and uniqueId=#{uniqueId}")
+        int findByUniqueId(ResultMap result);
+
+        @Update("update tsfx.dw_complain_realtime_alarm_h set cancelTime=#{cancelTime},status=#{status},projectStatus=#{projectStatus},workStatus=#{workStatus}"
+                        + " where sdate=to_timestamp(#{eventTime}, 'yyyy-MM-dd HH24:00:00') and uniqueId=#{uniqueId}")
+        void updateData(ResultMap result);
+
+        @Insert("insert into tsfx.dw_complain_realtime_alarm_h "
+                        + "(sdate,uniqueid,uniqueclearid,eventtime,canceltime,status,projectstatus,vendoralarmserial,alarmtitle,"
+                        + "vendorseverity,vendoralarmtype,specificproblem,specificproblemid,equipmentclass,equipmentname,locateneclass,"
+                        + "locatenename,province,region,city,grid,area,vendor,specialty,siteid,roomid,towersiteno,proequipmentstatus,"
+                        + "projectname,projectno,projectstarttime,projectendtime,worksendstatus,workstatus,workno,workarchivedtime,"
+                        + "workdutydep,worksendperson,alarmlogicclass,alarmlogicsubclass,standardalarmname,alarmseverity,standardalarmid,"
+                        + "effectonequipment,effectonbusiness,standardflag,networktype,equipmentdn,locatenedn,taccode,tacid,alarmtext) values "
+                        + "(to_timestamp(#{eventTime}, 'yyyy-MM-dd HH24:00:00'),#{uniqueId},#{uniqueClearId},#{eventTime},#{cancelTime},"
+                        + "#{status},#{projectStatus},#{vendorAlarmSerial},#{alarmTitle},#{vendorSeverity},#{vendorAlarmType},#{specificProblem},"
+                        + "#{specificProblemID},#{equipmentClass},#{equipmentName},#{locateNeClass},#{locateNeName},#{province},#{region},#{city},"
+                        + "#{grid},#{area},#{vendor},#{specialty},#{siteId},#{roomId},#{towerSiteNo},#{proEquipmentStatus},#{projectName},"
+                        + "#{projectNo},#{projectStartTime},#{projectEndTime},#{workSendStatus},#{workStatus},#{workNo},#{workArchivedTime},"
+                        + "#{workDutyDep},#{workSendPerson},#{alarmLogicClass},#{alarmLogicSubClass},#{standardAlarmName},#{alarmSeverity},"
+                        + "#{standardAlarmId},#{effectOnEquipment},#{effectOnBusiness},#{standardFlag},#{networkType},#{locateNEDN},"
+                        + "#{equipmentDN},#{tacCode},#{tacId},#{alarmText})")
+        void insertData(ResultMap result);
+}

+ 133 - 132
src/main/java/com/nokia/alarm/service/AlarmSaveToFileService.java

@@ -1,132 +1,133 @@
-package com.nokia.alarm.service;
-
-import com.alibaba.fastjson.JSON;
-import com.hl.opnc.AbilityResponse;
-import com.hl.opnc.ResponseBody;
-import com.hl.opnc.invoke.AbilityInvokeManager;
-import com.hl.opnc.invoke.InvokeManager;
-import com.nokia.alarm.entity.MessageCfg;
-import com.nokia.alarm.entity.ResultInfo;
-import com.nokia.alarm.entity.ResultMap;
-import com.nokia.alarm.util.ExportUtil;
-import com.nokia.alarm.util.SDKUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-
-@Slf4j
-@Service
-public class AlarmSaveToFileService {
-    @Value("${httpurl:http://192.168.70.125:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA}")
-    private String methodUrl;
-    @Value("${appId:0f9bf497549343e68ca36b4caffbc8c4}")
-    private String appId;
-    @Value("${secret:087b1ceb698140cd8c65543f5ace0490}")
-    private String secret;
-
-    public void getHttpSave(Date date) {
-        log.info("查询新增告警开始=====================================================");
-        InvokeManager manager = new AbilityInvokeManager(appId, secret);
-        MessageCfg cfg = SDKUtil.getBody(date);
-        AbilityResponse response = manager.post(methodUrl, null, JSON.toJSONString(cfg));
-        try {
-            String responseStr = response.getRespStr();
-            ResponseBody resObj;
-            try {
-                resObj = JSON.parseObject(responseStr, ResponseBody.class);
-            } catch (Exception e) {
-                log.error("返回消息json解析错误: {}", responseStr);
-                e.printStackTrace();
-                return;
-            }
-            String body = (String) resObj.getUNI_NET_BODY();
-            // log.info(body);
-            // body = body.replace("null", "\"\"");
-            ResultInfo info;
-            try {
-                info = JSON.parseObject(body, ResultInfo.class);
-            } catch (Exception e) {
-                log.error("返回消息json解析错误: {}", responseStr);
-                e.printStackTrace();
-                return;
-            }
-            int rows = info.getTotal();
-            log.info("新增告警返回数据{}条", rows);
-            List<ResultMap> results = info.getResult();
-            // 写入文件
-            String dString = ExportUtil.saveToCsv(results);
-            // gpload
-            String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
-            log.info("新增告警goload:----{}", gploadCommand);
-            try {
-                int exitCode = Runtime.getRuntime().exec(gploadCommand).waitFor();
-                log.info("新增告警gpload完成。。。。。{}", exitCode);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-                log.error("新增告警gpload失败: {}", e.getMessage());
-            }
-            log.info("查询新增告警完成=====================================================");
-        } catch (Exception e) {
-            log.info("查询新增告警出错=====================================================");
-            e.printStackTrace();
-        } finally {
-            try {
-                response.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-
-        }
-    }
-
-    public void getHttpUpdate(Date date) {
-        log.info("查询消除告警开始=====================================================");
-        InvokeManager manager = new AbilityInvokeManager(appId, secret);
-        MessageCfg cfg = SDKUtil.gethistoryBody(date);
-        AbilityResponse response = manager.post(methodUrl, null, JSON.toJSONString(cfg));
-        try {
-            String responseStr = response.getRespStr();
-            ResponseBody resObj;
-            try {
-                resObj = JSON.parseObject(responseStr, ResponseBody.class);
-            } catch (Exception e) {
-                log.error("返回消息json解析错误: {}", responseStr);
-                e.printStackTrace();
-                return;
-            }
-            String body = (String) resObj.getUNI_NET_BODY();
-            // body = body.replace("null", "\"\"");
-            ResultInfo info;
-            try {
-                info = JSON.parseObject(body, ResultInfo.class);
-            } catch (Exception e) {
-                log.error("返回消息json解析错误: {}", responseStr);
-                e.printStackTrace();
-                return;
-            }
-            int rows = info.getTotal();
-            log.info("消除告警返回数据{}条", rows);
-            List<ResultMap> results = info.getResult();
-            // 写入文件
-            String dString = ExportUtil.saveToCsv(results);
-            // gpload
-            String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
-            log.info("消除告警goload:----{}", gploadCommand);
-            try {
-                int exitCode = Runtime.getRuntime().exec(gploadCommand).waitFor();
-                log.info("消除告警gpload完成。。。。。{}", exitCode);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-                log.error("消除告警gpload失败: {}", e.getMessage());
-            }
-            log.info("查询消除告警完成=====================================================");
-        } catch (Exception e) {
-            log.info("查询消除告警出错=====================================================");
-            e.printStackTrace();
-        }
-    }
-}
+package com.nokia.alarm.service;
+
+import com.alibaba.fastjson.JSON;
+import com.hl.opnc.AbilityResponse;
+import com.hl.opnc.ResponseBody;
+import com.hl.opnc.invoke.AbilityInvokeManager;
+import com.hl.opnc.invoke.InvokeManager;
+import com.nokia.alarm.entity.MessageCfg;
+import com.nokia.alarm.entity.ResultInfo;
+import com.nokia.alarm.entity.ResultMap;
+import com.nokia.alarm.util.ExportUtil;
+import com.nokia.alarm.util.SDKUtil;
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Service
+public class AlarmSaveToFileService {
+    @Value("${httpurl:http://192.168.70.125:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA}")
+    private String methodUrl;
+    @Value("${appId:0f9bf497549343e68ca36b4caffbc8c4}")
+    private String appId;
+    @Value("${secret:087b1ceb698140cd8c65543f5ace0490}")
+    private String secret;
+
+    public void getHttpSave(Date date) {
+        log.info("查询新增告警开始=====================================================");
+        InvokeManager manager = new AbilityInvokeManager(appId, secret);
+        MessageCfg cfg = SDKUtil.getBody(date);
+        AbilityResponse response = manager.post(methodUrl, null, JSON.toJSONString(cfg));
+        try {
+            String responseStr = response.getRespStr();
+            ResponseBody resObj;
+            try {
+                resObj = JSON.parseObject(responseStr, ResponseBody.class);
+            } catch (Exception e) {
+                log.error("返回消息json解析错误: {}", responseStr);
+                e.printStackTrace();
+                return;
+            }
+            String body = (String) resObj.getUNI_NET_BODY();
+            // log.info(body);
+            // body = body.replace("null", "\"\"");
+            ResultInfo info;
+            try {
+                info = JSON.parseObject(body, ResultInfo.class);
+            } catch (Exception e) {
+                log.error("返回消息json解析错误: {}", responseStr);
+                e.printStackTrace();
+                return;
+            }
+            int rows = info.getTotal();
+            log.info("新增告警返回数据{}条", rows);
+            List<ResultMap> results = info.getResult();
+            // 写入文件
+            String dString = ExportUtil.saveToCsv(results);
+            // gpload
+            String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
+            log.info("新增告警goload:----{}", gploadCommand);
+            try {
+                int exitCode = Runtime.getRuntime().exec(gploadCommand).waitFor();
+                log.info("新增告警gpload完成。。。。。{}", exitCode);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                log.error("新增告警gpload失败: {}", e.getMessage());
+            }
+            log.info("查询新增告警完成=====================================================");
+        } catch (Exception e) {
+            log.info("查询新增告警出错=====================================================");
+            e.printStackTrace();
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+    public void getHttpUpdate(Date date) {
+        log.info("查询消除告警开始=====================================================");
+        InvokeManager manager = new AbilityInvokeManager(appId, secret);
+        MessageCfg cfg = SDKUtil.gethistoryBody(date);
+        AbilityResponse response = manager.post(methodUrl, null, JSON.toJSONString(cfg));
+        try {
+            String responseStr = response.getRespStr();
+            ResponseBody resObj;
+            try {
+                resObj = JSON.parseObject(responseStr, ResponseBody.class);
+            } catch (Exception e) {
+                log.error("返回消息json解析错误: {}", responseStr);
+                e.printStackTrace();
+                return;
+            }
+            String body = (String) resObj.getUNI_NET_BODY();
+            // body = body.replace("null", "\"\"");
+            ResultInfo info;
+            try {
+                info = JSON.parseObject(body, ResultInfo.class);
+            } catch (Exception e) {
+                log.error("返回消息json解析错误: {}", responseStr);
+                e.printStackTrace();
+                return;
+            }
+            int rows = info.getTotal();
+            log.info("消除告警返回数据{}条", rows);
+            List<ResultMap> results = info.getResult();
+            // 写入文件
+            String dString = ExportUtil.saveToCsv(results);
+            // gpload
+            String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
+            log.info("消除告警goload:----{}", gploadCommand);
+            try {
+                int exitCode = Runtime.getRuntime().exec(gploadCommand).waitFor();
+                log.info("消除告警gpload完成。。。。。{}", exitCode);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                log.error("消除告警gpload失败: {}", e.getMessage());
+            }
+            log.info("查询消除告警完成=====================================================");
+        } catch (Exception e) {
+            log.info("查询消除告警出错=====================================================");
+            e.printStackTrace();
+        }
+    }
+}

+ 68 - 68
src/main/java/com/nokia/alarm/service/AlarmSaveToGPandPGService.java

@@ -1,68 +1,68 @@
-package com.nokia.alarm.service;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.nokia.alarm.entity.ResultMap;
-import com.nokia.alarm.util.ExportUtil;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class AlarmSaveToGPandPGService {
-
-    @Autowired
-    private ApiCallService apiCallService;
-
-    @Autowired
-    private ResultMapService resultMapService;
-
-    public void newAlarm(Date date) {
-        long start = System.currentTimeMillis();
-        // 获取新增告警
-        List<ResultMap> results = apiCallService.getNewAlarm(date);
-        // 使用gpload入库到GP数据库
-        // 写入文件
-        String dString = ExportUtil.saveToCsv(results);
-        // gpload
-        String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
-        log.info("新增告警goload:--{}", gploadCommand);
-        try {
-            int exitCode = Runtime.getRuntime().exec(gploadCommand).waitFor();
-            log.info("新增告警gpload完成...{}", exitCode);
-        } catch (InterruptedException | IOException e) {
-            e.printStackTrace();
-            log.error("新增告警gpload失败: {}", e.getMessage());
-        }
-        // 通过轮询批量插入PG数据库
-        resultMapService.insertData(results);
-        log.info("新增告警 {} 时间 入库完成, 耗时 {} 毫秒...", date, (System.currentTimeMillis() - start));
-    }
-
-    public void updateAlarm(Date date) {
-        long start = System.currentTimeMillis();
-        // 获取取消告警
-        List<ResultMap> results = apiCallService.getCanceledAlarm(date);
-        // 通过gpload入库到GP数据库
-        // 写入文件
-        String dString = ExportUtil.saveToCsv(results);
-        // gpload
-        String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
-        log.info("消除告警goload:--{}", gploadCommand);
-        try {
-            int exitCode = Runtime.getRuntime().exec(gploadCommand).waitFor();
-            log.info("消除告警gpload完成。。。。。{}", exitCode);
-        } catch (InterruptedException | IOException e) {
-            e.printStackTrace();
-            log.error("消除告警gpload失败: {}", e.getMessage());
-        }
-        // 通过resultMapService更新到PG数据库
-        resultMapService.updateOrInsertData(results);
-        log.info("消除告警 {} 时间 入库完成, 耗时 {} 毫秒...", date, (System.currentTimeMillis() - start));
-    }
-}
+package com.nokia.alarm.service;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.nokia.alarm.entity.ResultMap;
+import com.nokia.alarm.util.ExportUtil;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@Service
+public class AlarmSaveToGPandPGService {
+
+    @Autowired
+    private ApiCallService apiCallService;
+
+    @Autowired
+    private ResultMapService resultMapService;
+
+    public void newAlarm(Date date) {
+        long start = System.currentTimeMillis();
+        // 获取新增告警
+        List<ResultMap> results = apiCallService.getNewAlarm(date);
+        // 使用gpload入库到GP数据库
+        // 写入文件
+        String dString = ExportUtil.saveToCsv(results);
+        // gpload
+        String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
+        log.info("新增告警goload:--{}", gploadCommand);
+        try {
+            int exitCode = Runtime.getRuntime().exec(gploadCommand).waitFor();
+            log.info("新增告警gpload完成...{}, 耗时 {} 毫秒...", exitCode, System.currentTimeMillis() - start);
+        } catch (InterruptedException | IOException e) {
+            e.printStackTrace();
+            log.error("新增告警gpload失败: {}", e.getMessage());
+        }
+        // 通过轮询批量插入PG数据库
+        resultMapService.insertData(results);
+        log.info("新增告警 {} 时间 入库PG完成, 耗时 {} 毫秒...", date, (System.currentTimeMillis() - start));
+    }
+
+    public void updateAlarm(Date date) {
+        long start = System.currentTimeMillis();
+        // 获取取消告警
+        List<ResultMap> results = apiCallService.getCanceledAlarm(date);
+        // 通过gpload入库到GP数据库
+        // 写入文件
+        String dString = ExportUtil.saveToCsv(results);
+        // gpload
+        String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
+        log.info("消除告警goload:--{}", gploadCommand);
+        try {
+            int exitCode = Runtime.getRuntime().exec(gploadCommand).waitFor();
+            log.info("消除告警gpload完成。。。。。{}", exitCode);
+        } catch (InterruptedException | IOException e) {
+            e.printStackTrace();
+            log.error("消除告警gpload失败: {}", e.getMessage());
+        }
+        // 通过resultMapService更新到PG数据库
+        resultMapService.updateOrInsertData(results);
+        log.info("消除告警 {} 时间 入库完成, 耗时 {} 毫秒...", date, (System.currentTimeMillis() - start));
+    }
+}

+ 116 - 116
src/main/java/com/nokia/alarm/service/ApiCallService.java

@@ -1,116 +1,116 @@
-package com.nokia.alarm.service;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import com.alibaba.fastjson.JSON;
-import com.hl.opnc.AbilityResponse;
-import com.hl.opnc.ResponseBody;
-import com.hl.opnc.invoke.AbilityInvokeManager;
-import com.hl.opnc.invoke.InvokeManager;
-import com.nokia.alarm.entity.MessageCfg;
-import com.nokia.alarm.entity.ResultInfo;
-import com.nokia.alarm.entity.ResultMap;
-import com.nokia.alarm.util.SDKUtil;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class ApiCallService {
-
-    @Value("${httpurl:http://192.168.70.125:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA}")
-    private String methodUrl;
-    @Value("${appId:0f9bf497549343e68ca36b4caffbc8c4}")
-    private String appId;
-    @Value("${secret:087b1ceb698140cd8c65543f5ace0490}")
-    private String secret;
-
-    public List<ResultMap> getNewAlarm(Date date) {
-        log.info("查询新增告警开始...");
-        InvokeManager manager = new AbilityInvokeManager(appId, secret);
-        MessageCfg cfg = SDKUtil.getBody(date);
-        AbilityResponse response = manager.post(methodUrl, null, JSON.toJSONString(cfg));
-        try {
-            String responseStr = response.getRespStr();
-            ResponseBody resObj;
-            try {
-                resObj = JSON.parseObject(responseStr, ResponseBody.class);
-            } catch (Exception e) {
-                log.error("返回消息json解析错误: {}", responseStr);
-                e.printStackTrace();
-                return null;
-            }
-            String body = (String) resObj.getUNI_NET_BODY();
-            // log.info(body);
-            body = body.replace("null", "\"\"");
-            ResultInfo info;
-            try {
-                info = JSON.parseObject(body, ResultInfo.class);
-            } catch (Exception e) {
-                log.error("返回消息json解析错误: {}", responseStr);
-                e.printStackTrace();
-                return null;
-            }
-            int rows = info.getTotal();
-            log.info("新增告警返回数据{}条", rows);
-            return info.getResult();
-        } catch (Exception e) {
-            log.error("查询新增告警出错: {}", e.getMessage());
-            e.printStackTrace();
-            return null;
-        } finally {
-            try {
-                response.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    public List<ResultMap> getCanceledAlarm(Date date) {
-        log.info("查询消除告警开始...");
-        InvokeManager manager = new AbilityInvokeManager(appId, secret);
-        MessageCfg cfg = SDKUtil.gethistoryBody(date);
-        AbilityResponse response = manager.post(methodUrl, null, JSON.toJSONString(cfg));
-        try {
-            String responseStr = response.getRespStr();
-            ResponseBody resObj;
-            try {
-                resObj = JSON.parseObject(responseStr, ResponseBody.class);
-            } catch (Exception e) {
-                log.error("返回消息json解析错误: {}", responseStr);
-                e.printStackTrace();
-                return null;
-            }
-            String body = (String) resObj.getUNI_NET_BODY();
-            body = body.replace("null", "\"\"");
-            ResultInfo info;
-            try {
-                info = JSON.parseObject(body, ResultInfo.class);
-            } catch (Exception e) {
-                log.error("返回消息json解析错误: {}", responseStr);
-                e.printStackTrace();
-                return null;
-            }
-            int rows = info.getTotal();
-            log.info("消除告警返回数据{}条", rows);
-            return info.getResult();
-        } catch (Exception e) {
-            log.error("查询消除告警出错: {}...", e.getMessage());
-            e.printStackTrace();
-            return null;
-        } finally {
-            try {
-                response.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-}
+package com.nokia.alarm.service;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson.JSON;
+import com.hl.opnc.AbilityResponse;
+import com.hl.opnc.ResponseBody;
+import com.hl.opnc.invoke.AbilityInvokeManager;
+import com.hl.opnc.invoke.InvokeManager;
+import com.nokia.alarm.entity.MessageCfg;
+import com.nokia.alarm.entity.ResultInfo;
+import com.nokia.alarm.entity.ResultMap;
+import com.nokia.alarm.util.SDKUtil;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@Service
+public class ApiCallService {
+
+    @Value("${httpurl:http://192.168.70.125:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA}")
+    private String methodUrl;
+    @Value("${appId:0f9bf497549343e68ca36b4caffbc8c4}")
+    private String appId;
+    @Value("${secret:087b1ceb698140cd8c65543f5ace0490}")
+    private String secret;
+
+    public List<ResultMap> getNewAlarm(Date date) {
+        log.info("查询新增告警开始...");
+        InvokeManager manager = new AbilityInvokeManager(appId, secret);
+        MessageCfg cfg = SDKUtil.getBody(date);
+        AbilityResponse response = manager.post(methodUrl, null, JSON.toJSONString(cfg));
+        try {
+            String responseStr = response.getRespStr();
+            ResponseBody resObj;
+            try {
+                resObj = JSON.parseObject(responseStr, ResponseBody.class);
+            } catch (Exception e) {
+                log.error("返回消息json解析错误: {}", responseStr);
+                e.printStackTrace();
+                return null;
+            }
+            String body = (String) resObj.getUNI_NET_BODY();
+            // log.info(body);
+            body = body.replace("null", "\"\"");
+            ResultInfo info;
+            try {
+                info = JSON.parseObject(body, ResultInfo.class);
+            } catch (Exception e) {
+                log.error("返回消息json解析错误: {}", responseStr);
+                e.printStackTrace();
+                return null;
+            }
+            int rows = info.getTotal();
+            log.info("新增告警返回数据{}条", rows);
+            return info.getResult();
+        } catch (Exception e) {
+            log.error("查询新增告警出错: {}", e.getMessage());
+            e.printStackTrace();
+            return null;
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public List<ResultMap> getCanceledAlarm(Date date) {
+        log.info("查询消除告警开始...");
+        InvokeManager manager = new AbilityInvokeManager(appId, secret);
+        MessageCfg cfg = SDKUtil.gethistoryBody(date);
+        AbilityResponse response = manager.post(methodUrl, null, JSON.toJSONString(cfg));
+        try {
+            String responseStr = response.getRespStr();
+            ResponseBody resObj;
+            try {
+                resObj = JSON.parseObject(responseStr, ResponseBody.class);
+            } catch (Exception e) {
+                log.error("返回消息json解析错误: {}", responseStr);
+                e.printStackTrace();
+                return null;
+            }
+            String body = (String) resObj.getUNI_NET_BODY();
+            body = body.replace("null", "\"\"");
+            ResultInfo info;
+            try {
+                info = JSON.parseObject(body, ResultInfo.class);
+            } catch (Exception e) {
+                log.error("返回消息json解析错误: {}", responseStr);
+                e.printStackTrace();
+                return null;
+            }
+            int rows = info.getTotal();
+            log.info("消除告警返回数据{}条", rows);
+            return info.getResult();
+        } catch (Exception e) {
+            log.error("查询消除告警出错: {}...", e.getMessage());
+            e.printStackTrace();
+            return null;
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+}

+ 48 - 48
src/main/java/com/nokia/alarm/service/ResultMapService.java

@@ -1,48 +1,48 @@
-package com.nokia.alarm.service;
-
-import java.util.List;
-
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.nokia.alarm.entity.ResultMap;
-import com.nokia.alarm.mapper.ResultMapDao;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class ResultMapService {
-
-    private final ResultMapDao resultMapDao;
-
-    public ResultMapService(ResultMapDao resultMapDao) {
-        this.resultMapDao = resultMapDao;
-    }
-
-    public boolean isExist(ResultMap resultMap) {
-        int count = resultMapDao.findByUniqueId(resultMap);
-        return count != 0;
-    }
-
-    @Transactional
-    public void updateOrInsertData(List<ResultMap> results) {
-        if (results != null) {
-            for (ResultMap result : results) {
-                if (isExist(result)) {
-                    log.debug("更新数据 {}", result.getUniqueId());
-                    resultMapDao.updateData(result);
-                } else {
-                    resultMapDao.insertData(result);
-                }
-            }
-        }
-    }
-
-    @Transactional
-    public void insertData(List<ResultMap> results) {
-        for (ResultMap result : results) {
-            resultMapDao.insertData(result);
-        }
-    }
-}
+package com.nokia.alarm.service;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import com.nokia.alarm.entity.ResultMap;
+import com.nokia.alarm.mapper.ResultMapDao;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@Service
+public class ResultMapService {
+
+    private final ResultMapDao resultMapDao;
+
+    public ResultMapService(ResultMapDao resultMapDao) {
+        this.resultMapDao = resultMapDao;
+    }
+
+    public boolean isExist(ResultMap resultMap) {
+        int count = resultMapDao.findByUniqueId(resultMap);
+        return count != 0;
+    }
+
+    public void updateOrInsertData(List<ResultMap> results) {
+        if (results != null) {
+            for (ResultMap result : results) {
+                if (isExist(result)) {
+                    log.debug("更新数据 {}", result.getUniqueId());
+                    resultMapDao.updateData(result);
+                } else {
+                    resultMapDao.insertData(result);
+                }
+            }
+        }
+    }
+
+    public void insertData(List<ResultMap> results) {
+        if (results != null) {
+            for (ResultMap result : results) {
+                if (!isExist(result)) {
+                    resultMapDao.insertData(result);
+                }
+            }
+        }
+    }
+}

+ 119 - 119
src/main/java/com/nokia/alarm/util/ExportUtil.java

@@ -1,119 +1,119 @@
-package com.nokia.alarm.util;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.nio.charset.StandardCharsets;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.commons.csv.CSVFormat;
-import org.apache.commons.csv.CSVPrinter;
-
-import com.nokia.alarm.entity.ResultMap;
-
-public class ExportUtil {
-    public static String filePath = "csv";
-    public static String fileNamePrifix = "resultMap";
-    public static final String recordSeparator = "\r\n";
-    public static final char delimiter = ',';
-
-    public static String saveToCsv(List<ResultMap> results) {
-        DateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
-        String dString = format.format(new Date());
-        File file = new File(filePath, fileNamePrifix + dString + ".csv");
-        if (!file.getParentFile().exists()) {
-            file.getParentFile().mkdirs();
-        }
-        Appendable writer = null;
-        CSVPrinter printer = null;
-        CSVFormat csvFormat = CSVFormat.DEFAULT.builder()
-                .setRecordSeparator(recordSeparator)
-                .setDelimiter(delimiter)
-                .build();
-        try {
-            writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
-            printer = csvFormat.print(writer);
-            for (ResultMap resultMap : results) {
-                Object[] arr = toArray(resultMap);
-                if (arr != null) {
-                    printer.printRecord(arr);
-                }
-            }
-            printer.flush();
-            printer.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return dString;
-    }
-
-    private static Object[] toArray(ResultMap resultMap) {
-        DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        DateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
-        String sdate = resultMap.getEventTime();
-        try {
-            sdate = format2.format(format1.parse(sdate));
-            return new Object[] { sdate,
-                    resultMap.getUniqueId(),
-                    resultMap.getUniqueClearId(),
-                    resultMap.getEventTime(),
-                    resultMap.getCancelTime(),
-                    resultMap.getStatus(),
-                    resultMap.getProjectStatus(),
-                    resultMap.getVendorAlarmSerial(),
-                    resultMap.getAlarmTitle(),
-                    resultMap.getVendorSeverity(),
-                    resultMap.getVendorAlarmType(),
-                    resultMap.getSpecificProblem(),
-                    resultMap.getSpecificProblemID(),
-                    resultMap.getEquipmentClass(),
-                    resultMap.getEquipmentName(),
-                    resultMap.getLocateNeClass(),
-                    resultMap.getLocateNeName(),
-                    resultMap.getProvince(),
-                    resultMap.getRegion(),
-                    resultMap.getCity(),
-                    resultMap.getGrid(),
-                    resultMap.getArea(),
-                    resultMap.getVendor(),
-                    resultMap.getSpecialty(),
-                    resultMap.getSiteId(),
-                    resultMap.getRoomId(),
-                    resultMap.getTowerSiteNo(),
-                    resultMap.getProEquipmentStatus(),
-                    resultMap.getProjectName(),
-                    resultMap.getProjectNo(),
-                    resultMap.getProjectStartTime(),
-                    resultMap.getProjectEndTime(),
-                    resultMap.getWorkSendStatus(),
-                    resultMap.getWorkStatus(),
-                    resultMap.getWorkNo(),
-                    resultMap.getWorkArchivedTime(),
-                    resultMap.getWorkDutyDep(),
-                    resultMap.getWorkSendPerson(),
-                    resultMap.getAlarmLogicClass(),
-                    resultMap.getAlarmLogicSubClass(),
-                    resultMap.getStandardAlarmName(),
-                    resultMap.getAlarmSeverity(),
-                    resultMap.getStandardAlarmId(),
-                    resultMap.getEffectOnEquipment(),
-                    resultMap.getEffectOnBusiness(),
-                    resultMap.getStandardFlag(),
-                    resultMap.getNetworkType(),
-                    resultMap.getEquipmentDN(),
-                    resultMap.getLocateNEDN(),
-                    resultMap.getTacCode(),
-                    resultMap.getTacId(),
-                    resultMap.getAlarmText()
-            };
-        } catch (ParseException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-}
+package com.nokia.alarm.util;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVPrinter;
+
+import com.nokia.alarm.entity.ResultMap;
+
+public class ExportUtil {
+    public static String filePath = "csv";
+    public static String fileNamePrifix = "resultMap";
+    public static final String recordSeparator = "\r\n";
+    public static final char delimiter = ',';
+
+    public static String saveToCsv(List<ResultMap> results) {
+        DateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+        String dString = format.format(new Date());
+        File file = new File(filePath, fileNamePrifix + dString + ".csv");
+        if (!file.getParentFile().exists()) {
+            file.getParentFile().mkdirs();
+        }
+        Appendable writer = null;
+        CSVPrinter printer = null;
+        CSVFormat csvFormat = CSVFormat.DEFAULT.builder()
+                .setRecordSeparator(recordSeparator)
+                .setDelimiter(delimiter)
+                .build();
+        try {
+            writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
+            printer = csvFormat.print(writer);
+            for (ResultMap resultMap : results) {
+                Object[] arr = toArray(resultMap);
+                if (arr != null) {
+                    printer.printRecord(arr);
+                }
+            }
+            printer.flush();
+            printer.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return dString;
+    }
+
+    private static Object[] toArray(ResultMap resultMap) {
+        DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        DateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
+        String sdate = resultMap.getEventTime();
+        try {
+            sdate = format2.format(format1.parse(sdate));
+            return new Object[] { sdate,
+                    resultMap.getUniqueId(),
+                    resultMap.getUniqueClearId(),
+                    resultMap.getEventTime(),
+                    resultMap.getCancelTime(),
+                    resultMap.getStatus(),
+                    resultMap.getProjectStatus(),
+                    resultMap.getVendorAlarmSerial(),
+                    resultMap.getAlarmTitle(),
+                    resultMap.getVendorSeverity(),
+                    resultMap.getVendorAlarmType(),
+                    resultMap.getSpecificProblem(),
+                    resultMap.getSpecificProblemID(),
+                    resultMap.getEquipmentClass(),
+                    resultMap.getEquipmentName(),
+                    resultMap.getLocateNeClass(),
+                    resultMap.getLocateNeName(),
+                    resultMap.getProvince(),
+                    resultMap.getRegion(),
+                    resultMap.getCity(),
+                    resultMap.getGrid(),
+                    resultMap.getArea(),
+                    resultMap.getVendor(),
+                    resultMap.getSpecialty(),
+                    resultMap.getSiteId(),
+                    resultMap.getRoomId(),
+                    resultMap.getTowerSiteNo(),
+                    resultMap.getProEquipmentStatus(),
+                    resultMap.getProjectName(),
+                    resultMap.getProjectNo(),
+                    resultMap.getProjectStartTime(),
+                    resultMap.getProjectEndTime(),
+                    resultMap.getWorkSendStatus(),
+                    resultMap.getWorkStatus(),
+                    resultMap.getWorkNo(),
+                    resultMap.getWorkArchivedTime(),
+                    resultMap.getWorkDutyDep(),
+                    resultMap.getWorkSendPerson(),
+                    resultMap.getAlarmLogicClass(),
+                    resultMap.getAlarmLogicSubClass(),
+                    resultMap.getStandardAlarmName(),
+                    resultMap.getAlarmSeverity(),
+                    resultMap.getStandardAlarmId(),
+                    resultMap.getEffectOnEquipment(),
+                    resultMap.getEffectOnBusiness(),
+                    resultMap.getStandardFlag(),
+                    resultMap.getNetworkType(),
+                    resultMap.getEquipmentDN(),
+                    resultMap.getLocateNEDN(),
+                    resultMap.getTacCode(),
+                    resultMap.getTacId(),
+                    resultMap.getAlarmText()
+            };
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

+ 87 - 87
src/main/java/com/nokia/alarm/util/SDKUtil.java

@@ -1,87 +1,87 @@
-package com.nokia.alarm.util;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-import com.nokia.alarm.entity.MessageCfg;
-
-public class SDKUtil {
-    private final static DateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
-    public static MessageCfg getBody(Date date) {
-        // 查询开始时间
-        String startTime = addDateMinut(date, -35);
-        // 查询结束时间
-        String endTime = addDateMinut(date, -30);
-        MessageCfg cfg = new MessageCfg();
-        cfg.setStartTime(startTime);
-        cfg.setEndTime(endTime);
-        cfg.setResultDataType(1);
-        cfg.setResultFieldType(1);
-        cfg.setPageNum(0);
-        List<String> provincelist = new ArrayList<>();
-        provincelist.add("河北省");
-        cfg.setProvince(provincelist);
-        List<String> networklist = new ArrayList<>();
-        networklist.add("104");
-        networklist.add("105");
-        cfg.setNetworkType(networklist);
-        cfg.setPageSize(10000);
-        return cfg;
-    }
-
-    public static MessageCfg gethistoryBody(Date date) {
-        // 查询开始时间 1个月前
-        String startTime = addDateMonth(date, -1);
-        // 查询结束时间 当前时间
-        String endTime = FORMAT.format(date);
-        MessageCfg cfg = new MessageCfg();
-        cfg.setStartTime(startTime);
-        cfg.setEndTime(endTime);
-        cfg.setResultDataType(1);
-        cfg.setResultFieldType(1);
-        cfg.setPageNum(0);
-        List<String> provincelist = new ArrayList<>();
-        provincelist.add("河北省");
-        cfg.setProvince(provincelist);
-        List<String> networklist = new ArrayList<>();
-        networklist.add("104");
-        networklist.add("105");
-        List<String> cancelTime = new ArrayList<>();
-        // 告警消除的开始时间
-        cancelTime.add(addDateMinut(date, -35));
-        // 告警消除的结束时间
-        cancelTime.add(addDateMinut(date, -30));
-        cfg.setCancelTime(cancelTime);
-        cfg.setNetworkType(networklist);
-        cfg.setPageSize(10000);
-        return cfg;
-    }
-
-    public static String addDateMonth(Date date, int x) {
-        if (date == null)
-            return "";
-        Calendar cal = Calendar.getInstance();
-        cal.setTime(date);
-        cal.add(Calendar.MONTH, x);// 24小时制
-        date = cal.getTime();
-        cal = null;
-        return FORMAT.format(date);
-    }
-
-    private static String addDateMinut(Date date, int x) {
-        // 引号里面个格
-        if (date == null)
-            return "";
-        Calendar cal = Calendar.getInstance();
-        cal.setTime(date);
-        cal.add(Calendar.MINUTE, x);// 24小时制
-        date = cal.getTime();
-        cal = null;
-        return FORMAT.format(date);
-    }
-}
+package com.nokia.alarm.util;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import com.nokia.alarm.entity.MessageCfg;
+
+public class SDKUtil {
+    private final static DateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+    public static MessageCfg getBody(Date date) {
+        // 查询开始时间
+        String startTime = addDateMinut(date, -35);
+        // 查询结束时间
+        String endTime = addDateMinut(date, -30);
+        MessageCfg cfg = new MessageCfg();
+        cfg.setStartTime(startTime);
+        cfg.setEndTime(endTime);
+        cfg.setResultDataType(1);
+        cfg.setResultFieldType(1);
+        cfg.setPageNum(0);
+        List<String> provincelist = new ArrayList<>();
+        provincelist.add("河北省");
+        cfg.setProvince(provincelist);
+        List<String> networklist = new ArrayList<>();
+        networklist.add("104");
+        networklist.add("105");
+        cfg.setNetworkType(networklist);
+        cfg.setPageSize(10000);
+        return cfg;
+    }
+
+    public static MessageCfg gethistoryBody(Date date) {
+        // 查询开始时间 1个月前
+        String startTime = addDateMonth(date, -1);
+        // 查询结束时间 当前时间
+        String endTime = FORMAT.format(date);
+        MessageCfg cfg = new MessageCfg();
+        cfg.setStartTime(startTime);
+        cfg.setEndTime(endTime);
+        cfg.setResultDataType(1);
+        cfg.setResultFieldType(1);
+        cfg.setPageNum(0);
+        List<String> provincelist = new ArrayList<>();
+        provincelist.add("河北省");
+        cfg.setProvince(provincelist);
+        List<String> networklist = new ArrayList<>();
+        networklist.add("104");
+        networklist.add("105");
+        List<String> cancelTime = new ArrayList<>();
+        // 告警消除的开始时间
+        cancelTime.add(addDateMinut(date, -35));
+        // 告警消除的结束时间
+        cancelTime.add(addDateMinut(date, -30));
+        cfg.setCancelTime(cancelTime);
+        cfg.setNetworkType(networklist);
+        cfg.setPageSize(10000);
+        return cfg;
+    }
+
+    public static String addDateMonth(Date date, int x) {
+        if (date == null)
+            return "";
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MONTH, x);// 24小时制
+        date = cal.getTime();
+        cal = null;
+        return FORMAT.format(date);
+    }
+
+    private static String addDateMinut(Date date, int x) {
+        // 引号里面个格
+        if (date == null)
+            return "";
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MINUTE, x);// 24小时制
+        date = cal.getTime();
+        cal = null;
+        return FORMAT.format(date);
+    }
+}

+ 20 - 20
src/main/resources/application-prod.properties

@@ -1,20 +1,20 @@
-server.port=8081
-
-# 入库GP数据库使用的是GPload,不需要配置
-
-# 入库PG数据库
-# PG数据库登录信息
-spring.datasource.driverClassName=org.postgresql.Driver
-spring.datasource.url=jdbc:postgresql://192.168.70.172:5432/sqmmt
-spring.datasource.username=sqmdb
-spring.datasource.password=sqmdb_1QAZ
-
-# log配置
-logging.level.com.nokia=info
-# logging.file.name=log/alarm.log
-# logging.charset.file=utf-8
-# logging.charset.console=utf-8
-
-httpurl=http://192.168.70.125:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
-
-# httpurl=http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
+server.port=8081
+
+# 入库GP数据库使用的是GPload,不需要配置
+
+# 入库PG数据库
+# PG数据库登录信息
+spring.datasource.driverClassName=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://192.168.70.172:5432/sqmmt
+spring.datasource.username=sqmdb
+spring.datasource.password=sqmdb_1QAZ
+
+# log配置
+logging.level.com.nokia=info
+# logging.file.name=log/alarm.log
+# logging.charset.file=utf-8
+# logging.charset.console=utf-8
+
+httpurl=http://192.168.70.125:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
+
+# httpurl=http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA

+ 17 - 17
src/main/resources/application-test.properties

@@ -1,17 +1,17 @@
-server.port=8081
-
-# # 本地postgresql
-spring.datasource.driverClassName=org.postgresql.Driver
-spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
-spring.datasource.username=postgres
-spring.datasource.password=fantuan1985
-
-# log配置
-logging.level.com.nokia=info
-# logging.file.name=log/alarm.log
-# logging.charset.file=utf-8
-# logging.charset.console=utf-8
-
-httpurl=http://192.168.70.125:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
-
-# httpurl=http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
+server.port=8081
+
+# # 本地postgresql
+spring.datasource.driverClassName=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
+spring.datasource.username=postgres
+spring.datasource.password=fantuan1985
+
+# log配置
+logging.level.com.nokia=info
+# logging.file.name=log/alarm.log
+# logging.charset.file=utf-8
+# logging.charset.console=utf-8
+
+httpurl=http://192.168.70.125:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
+
+# httpurl=http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA

+ 1 - 1
src/main/resources/application.properties

@@ -1 +1 @@
-spring.profiles.active=prod
+spring.profiles.active=prod

+ 51 - 51
src/main/resources/logback-spring.xml

@@ -1,51 +1,51 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration>
-    <property name="PATH" value="./log"/>
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <Pattern>%d{HH:mm:ss.SSS} %highlight(%-5level) %yellow(%X{traceId}) %cyan(%logger:%line) %msg%n</Pattern>
-        </encoder>
-    </appender>
-    <appender name="TRACE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${PATH}/trace.log</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <!-- rollover daily -->
-            <fileNamePattern>${PATH}/trace.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
-            <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
-            <maxFileSize>10MB</maxFileSize>
-            <maxHistory>60</maxHistory>
-            <totalSizeCap>20GB</totalSizeCap>
-        </rollingPolicy>
-        <encoder>
-            <Pattern>%d %highlight(%-5level) %yellow(%X{traceId}) %cyan(%logger:%line) %msg%n</Pattern>
-        </encoder>
-    </appender>
-    <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${PATH}/error.log</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <!-- rollover daily -->
-            <fileNamePattern>${PATH}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
-            <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
-            <maxFileSize>10MB</maxFileSize>
-            <maxHistory>60</maxHistory>
-            <totalSizeCap>20GB</totalSizeCap>
-        </rollingPolicy>
-        <encoder>
-            <Pattern>%d %-5level %X{traceId} %logger:%line %msg%n</Pattern>
-        </encoder>
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <level>ERROR</level>
-            <onMatch>ACCEPT</onMatch>
-            <onMismatch>DENY</onMismatch>
-        </filter>
-    </appender>
-    <root level="INFO">
-        <appender-ref ref="STDOUT"/>
-    </root>
-    <root level="TRACE">
-        <appender-ref ref="TRACE_FILE"/>
-    </root>
-    <root level="ERROR">
-        <appender-ref ref="ERROR_FILE"/>
-    </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <property name="PATH" value="./log"/>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <Pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} %-5level [%thread] %X{traceId} %logger:%line %.-2048msg%n</Pattern>
+        </encoder>
+    </appender>
+    <appender name="TRACE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${PATH}/trace.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <!-- rollover daily -->
+            <fileNamePattern>${PATH}/trace.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
+            <maxFileSize>10MB</maxFileSize>
+            <maxHistory>60</maxHistory>
+            <totalSizeCap>20GB</totalSizeCap>
+        </rollingPolicy>
+        <encoder>
+            <Pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} %-5level [%thread] %X{traceId} %logger:%line %.-2048msg%n</Pattern>
+        </encoder>
+    </appender>
+    <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${PATH}/error.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <!-- rollover daily -->
+            <fileNamePattern>${PATH}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
+            <maxFileSize>10MB</maxFileSize>
+            <maxHistory>60</maxHistory>
+            <totalSizeCap>20GB</totalSizeCap>
+        </rollingPolicy>
+        <encoder>
+            <Pattern>%d %-5level %X{traceId} %logger:%line %msg%n</Pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>ERROR</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+    <root level="INFO">
+        <appender-ref ref="STDOUT"/>
+    </root>
+    <root level="TRACE">
+        <appender-ref ref="TRACE_FILE"/>
+    </root>
+    <root level="ERROR">
+        <appender-ref ref="ERROR_FILE"/>
+    </root>
+</configuration>

+ 23 - 23
src/test/com/nokia/alarm/AlarmApplicationTest.java

@@ -1,23 +1,23 @@
-package com.nokia.alarm;
-
-import java.util.Date;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import com.nokia.alarm.service.AlarmSaveToGPandPGService;
-
-@SpringBootTest
-public class AlarmApplicationTest {
-
-    @Autowired
-    private AlarmSaveToGPandPGService alarmSaveToGPandPGService;
-
-    @Test
-    void test() {
-        Date date = new Date();
-        alarmSaveToGPandPGService.newAlarm(date);
-        alarmSaveToGPandPGService.updateAlarm(date);
-    }
-
-}
+package com.nokia.alarm;
+
+import java.util.Date;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import com.nokia.alarm.service.AlarmSaveToGPandPGService;
+
+@SpringBootTest
+public class AlarmApplicationTest {
+
+    @Autowired
+    private AlarmSaveToGPandPGService alarmSaveToGPandPGService;
+
+    @Test
+    void test() {
+        Date date = new Date();
+        alarmSaveToGPandPGService.newAlarm(date);
+        alarmSaveToGPandPGService.updateAlarm(date);
+    }
+
+}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.