“lifuquan” преди 7 месеца
родител
ревизия
9cad0cd1f1

+ 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.3-exec.jar >/dev/null 2>&1 &

+ 2 - 1
pom.xml

@@ -37,7 +37,7 @@
             <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>
+            <systemPath>${project.basedir}/lib/opnc-sdk-1.0.0-SNAPSHOT.jar</systemPath>
         </dependency>
         <!-- opnc-sdk 依赖开始 -->
         <dependency>
@@ -94,6 +94,7 @@
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
             <scope>provided</scope>
+            <version>1.18.30</version>
         </dependency>
     </dependencies>
 

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

@@ -11,14 +11,14 @@ import com.nokia.alarm.entity.ResultMap;
 @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}")
+        @Select("select count(1) from app_screen.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}"
+        @Update("update app_screen.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 "
+        @Insert("insert into app_screen.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,"

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

@@ -1,6 +1,5 @@
 package com.nokia.alarm.service;
 
-import java.io.IOException;
 import java.util.Date;
 import java.util.List;
 
@@ -8,8 +7,6 @@ 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
@@ -26,19 +23,19 @@ public class AlarmSaveToGPandPGService {
         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());
-        }
+        // // 使用gpload入库到GP数据库
+        // // 写入文件
+        // String dString = ExportUtil.saveToCsv(results);
+        // // gpload
+        // String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
+        // log.info("新增告警gpload:--{}", 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));
@@ -48,19 +45,19 @@ public class AlarmSaveToGPandPGService {
         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());
-        }
+        // // 通过gpload入库到GP数据库
+        // // 写入文件
+        // String dString = ExportUtil.saveToCsv(results);
+        // // gpload
+        // String gploadCommand = "sh /data1/s130/alarm/gpload/alarm.sh " + dString;
+        // log.info("消除告警gpload:--{}", 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));

+ 6 - 4
src/main/resources/application-prod.properties

@@ -5,9 +5,9 @@ server.port=8081
 # 入库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
+spring.datasource.url=jdbc:postgresql://172.16.103.7:5432/sqmmt
+spring.datasource.username=pmparse
+spring.datasource.password=WLdnJ1@!864C
 
 # log配置
 logging.level.com.nokia=info
@@ -15,6 +15,8 @@ logging.level.com.nokia=info
 # 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://192.168.70.125:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
+#10.17.160.12
+httpurl=http://10.17.160.12:12090/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA
 
 # httpurl=http://10.160.84.7:8888/esb/HEB_AlarmCustomQuery/0?authcode=SEVCX1VDSUFQI0BhdXRoQCNTWnFsVk9QeA

+ 3 - 5
src/test/com/nokia/alarm/AlarmApplicationTest.java

@@ -5,19 +5,17 @@ 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;
+import com.nokia.alarm.service.ApiCallService;
 
 @SpringBootTest
 public class AlarmApplicationTest {
 
     @Autowired
-    private AlarmSaveToGPandPGService alarmSaveToGPandPGService;
+    private ApiCallService apiCallService;
 
     @Test
     void test() {
-        Date date = new Date();
-        alarmSaveToGPandPGService.newAlarm(date);
-        alarmSaveToGPandPGService.updateAlarm(date);
+        apiCallService.getNewAlarm(new Date());
     }
 
 }