فهرست منبع

增加数据调用测试
数据同步地址更改

zoro 11 ماه پیش
والد
کامیت
8cca6d5327

+ 68 - 0
src/main/java/com/shcd/controller/ShipLockController.java

@@ -0,0 +1,68 @@
+package com.shcd.controller;
+
+import com.shcd.service.*;
+import com.xxl.job.core.biz.model.ReturnT;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@CrossOrigin
+@RequestMapping("/shipLock")
+public class ShipLockController {
+    @Autowired
+    private ShipLockAreaStatisticService shipLockAreaStatisticService;
+    @Autowired
+    private ShipLockDoorStatusRealtimeService shipLockDoorStatusRealtimeService;
+    @Autowired
+    private ShipIllegalAutoService autoService;
+    @Autowired
+    private ShipLockStatisticService shipLockStatisticService;
+    @Autowired
+    private ShipLockWaterLevelService shipLockWaterLevelService;
+    @Autowired
+    private ShipLockShipStatusService shipLockShipStatusService;
+
+    @PostMapping("testArea")
+    public String testArea(){
+        ReturnT<String> areaStatistic = shipLockAreaStatisticService.getAreaStatistic();
+        return "success";
+    }
+
+    @PostMapping("testDoor")
+    public String testDoor(){
+        ReturnT<String> doorStatus = shipLockDoorStatusRealtimeService.saveDoorStatus();
+        return "success";
+    }
+
+
+    @PostMapping("testAuto")
+    public String testAuto(){
+        ReturnT<String> auto = autoService.saveShipIllegalInfo();
+        return "success";
+
+    }
+
+    @PostMapping("testStatic")
+    public String testStatic(){
+        ReturnT<String> testStatic = shipLockStatisticService.saveShipStatisticInfo();
+        return "success";
+
+    }
+
+    @PostMapping("testWater")
+    public String testWater(){
+        ReturnT<String> testWater = shipLockWaterLevelService.saveWaterLevel();
+        return "success";
+
+    }
+
+    @PostMapping("testShip")
+    public String testShip(){
+        ReturnT<String> testShip = shipLockShipStatusService.saveShipStatus();
+        return "success";
+
+    }
+}

+ 6 - 0
src/main/java/com/shcd/service/impl/ShipLockDoorStatusRealtimeServiceImpl.java

@@ -17,6 +17,8 @@ import org.springframework.transaction.annotation.Transactional;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  *
  *
@@ -41,7 +43,11 @@ public class ShipLockDoorStatusRealtimeServiceImpl extends ServiceImpl<ShipLockD
             HashMap hashMap = JSONObject.parseObject(execute.body(), HashMap.class);
             HashMap hashMap = JSONObject.parseObject(execute.body(), HashMap.class);
             if (new Integer(0).equals(hashMap.get("code"))) {
             if (new Integer(0).equals(hashMap.get("code"))) {
                 List<ShipLockDoorStatusRealtime> data = JSONObject.parseArray(hashMap.get("data").toString(), ShipLockDoorStatusRealtime.class);
                 List<ShipLockDoorStatusRealtime> data = JSONObject.parseArray(hashMap.get("data").toString(), ShipLockDoorStatusRealtime.class);
+                data = data.stream().filter(Objects::nonNull).collect(Collectors.toList());
                 data.forEach(i -> i.setDates(i.getDate()));
                 data.forEach(i -> i.setDates(i.getDate()));
+                for (ShipLockDoorStatusRealtime datum : data) {
+                    System.out.println(datum);
+                }
                 boolean b = this.saveOrUpdateBatch(data);
                 boolean b = this.saveOrUpdateBatch(data);
                 if (b) {
                 if (b) {
                     return ReturnT.SUCCESS;
                     return ReturnT.SUCCESS;

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
src/main/resources/profile/dev/application.properties


+ 6 - 6
src/main/resources/profile/test/application.properties

@@ -62,13 +62,13 @@ spring.redis.jedis.pool.min-idle=-1
 spring.redis.timeout=10000
 spring.redis.timeout=10000
 
 
 
 
-shipLockDoorStatusUrl=http://172.31.233.22:8095/shipLock/xunxiang/ship/info/query/doorStatus
+shipLockDoorStatusUrl=http://10.121.41.3:8081/xunxiang/ship/info/query/doorStatus
 shipLockSecretId=yangshuai
 shipLockSecretId=yangshuai
 shipLockSecretKey=rlDR2kzLkZ5mpJbUscF7Si9EnlLJWcAc3uCnIiZdAvfm9haipGiCBZ0GuyFypkSWQ2hVgpTgAu0MdgLfLw64TkOvTmKkleci0rgE55wQuck=
 shipLockSecretKey=rlDR2kzLkZ5mpJbUscF7Si9EnlLJWcAc3uCnIiZdAvfm9haipGiCBZ0GuyFypkSWQ2hVgpTgAu0MdgLfLw64TkOvTmKkleci0rgE55wQuck=
-illegalInfoUrl=http://172.31.233.22:8095/shipLock/xunxiang/ship/open/get-illegal-info?
+illegalInfoUrl=http://10.121.41.3:8081/xunxiang/ship/open/get-illegal-info?
 infoSecretId=durr
 infoSecretId=durr
 infoSecretKey=WpEuxS+GyBzT0go10TGJeQjR5reA0LolEkmVzfmS87dU7H7LNP2xYsD1rmGgoEHx8ApuX8GaIPgZsUhOa8wJ+YkfkTsuMC74zMOVCyt5xOw=
 infoSecretKey=WpEuxS+GyBzT0go10TGJeQjR5reA0LolEkmVzfmS87dU7H7LNP2xYsD1rmGgoEHx8ApuX8GaIPgZsUhOa8wJ+YkfkTsuMC74zMOVCyt5xOw=
-lockStaticUrl=http://172.31.233.22:8095/shipLock/xunxiang/ship/open/get-lock-statistic?
-shipStatusUrl=http://172.31.233.22:8095/shipLock/xunxiang/ship/open/get-ship-by-status?
-shipLockWaterLevelUrl=http://172.31.233.22:8095/shipLock/xunxiang/ship/info/query/newData
-areaStatisticUrl=http://172.31.233.22:8095/shipLock/xunxiang/ship/open/get-area-statistic
+lockStaticUrl=http://10.121.41.3:8081/xunxiang/ship/open/get-lock-statistic?
+shipStatusUrl=http://10.121.41.3:8081/xunxiang/ship/open/get-ship-by-status?
+shipLockWaterLevelUrl=http://10.121.41.3:8081/xunxiang/ship/info/query/newData
+areaStatisticUrl=http://10.121.41.3:8081/xunxiang/ship/open/get-area-statistic

+ 8 - 60
src/main/resources/profile/test/logback-spring.xml

@@ -1,14 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
-<!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true -->
-<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。
-                 当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
-<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
 <configuration  scan="true" scanPeriod="10 seconds">
 <configuration  scan="true" scanPeriod="10 seconds">
     <contextName>logback</contextName>
     <contextName>logback</contextName>
 
 
     <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 -->
     <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 -->
-    <property name="log.path" value="./logFiles" />
+    <property name="log.path" value="./shipLock" />
 
 
     <!--0. 日志格式和颜色渲染 -->
     <!--0. 日志格式和颜色渲染 -->
     <!-- 彩色日志依赖的渲染类 -->
     <!-- 彩色日志依赖的渲染类 -->
@@ -23,7 +18,6 @@
         <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
         <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
             <level>debug</level>
             <level>debug</level>
-
         </filter>
         </filter>
         <encoder>
         <encoder>
             <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
             <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
@@ -50,7 +44,7 @@
                 <maxFileSize>100MB</maxFileSize>
                 <maxFileSize>100MB</maxFileSize>
             </timeBasedFileNamingAndTriggeringPolicy>
             </timeBasedFileNamingAndTriggeringPolicy>
             <!--日志文档保留天数-->
             <!--日志文档保留天数-->
-            <maxHistory>5</maxHistory>
+            <maxHistory>2</maxHistory>
         </rollingPolicy>
         </rollingPolicy>
         <!-- 此日志文档只记录debug级别的 -->
         <!-- 此日志文档只记录debug级别的 -->
         <filter class="ch.qos.logback.classic.filter.LevelFilter">
         <filter class="ch.qos.logback.classic.filter.LevelFilter">
@@ -74,10 +68,10 @@
             <!-- 每天日志归档路径以及格式 -->
             <!-- 每天日志归档路径以及格式 -->
             <fileNamePattern>${log.path}/web-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <fileNamePattern>${log.path}/web-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>20MB</maxFileSize>
+                <maxFileSize>100MB</maxFileSize>
             </timeBasedFileNamingAndTriggeringPolicy>
             </timeBasedFileNamingAndTriggeringPolicy>
             <!--日志文档保留天数-->
             <!--日志文档保留天数-->
-            <maxHistory>10</maxHistory>
+            <maxHistory>2</maxHistory>
         </rollingPolicy>
         </rollingPolicy>
         <!-- 此日志文档只记录info级别的 -->
         <!-- 此日志文档只记录info级别的 -->
         <filter class="ch.qos.logback.classic.filter.LevelFilter">
         <filter class="ch.qos.logback.classic.filter.LevelFilter">
@@ -100,10 +94,10 @@
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
             <fileNamePattern>${log.path}/web-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <fileNamePattern>${log.path}/web-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>20MB</maxFileSize>
+                <maxFileSize>100MB</maxFileSize>
             </timeBasedFileNamingAndTriggeringPolicy>
             </timeBasedFileNamingAndTriggeringPolicy>
             <!--日志文档保留天数-->
             <!--日志文档保留天数-->
-            <maxHistory>5</maxHistory>
+            <maxHistory>2</maxHistory>
         </rollingPolicy>
         </rollingPolicy>
         <!-- 此日志文档只记录warn级别的 -->
         <!-- 此日志文档只记录warn级别的 -->
         <filter class="ch.qos.logback.classic.filter.LevelFilter">
         <filter class="ch.qos.logback.classic.filter.LevelFilter">
@@ -126,10 +120,10 @@
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
             <fileNamePattern>${log.path}/web-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <fileNamePattern>${log.path}/web-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>20MB</maxFileSize>
+                <maxFileSize>100MB</maxFileSize>
             </timeBasedFileNamingAndTriggeringPolicy>
             </timeBasedFileNamingAndTriggeringPolicy>
             <!--日志文档保留天数-->
             <!--日志文档保留天数-->
-            <maxHistory>5</maxHistory>
+            <maxHistory>2</maxHistory>
         </rollingPolicy>
         </rollingPolicy>
         <!-- 此日志文档只记录ERROR级别的 -->
         <!-- 此日志文档只记录ERROR级别的 -->
         <filter class="ch.qos.logback.classic.filter.LevelFilter">
         <filter class="ch.qos.logback.classic.filter.LevelFilter">
@@ -139,42 +133,6 @@
         </filter>
         </filter>
     </appender>
     </appender>
 
 
-    <logger name="com.InterfaceServices.mapper" level="DEBUG" />
-    <logger name="io.lettuce.core.protocol" level="ERROR">
-        <appender-ref ref="ERROR_FILE" />
-    </logger>
-    <!--
-        <logger>用来设置某一个包或者具体的某一个类的日志打印级别、
-        以及指定<appender>。<logger>仅有一个name属性,
-        一个可选的level和一个可选的addtivity属性。
-        name:用来指定受此logger约束的某一个包或者具体的某一个类。
-        level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
-              还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。
-              如果未设置此属性,那么当前logger将会继承上级的级别。
-        addtivity:是否向上级logger传递打印信息。默认是true。
-        <logger name="org.springframework.web" level="info"/>
-        <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>
-    -->
-
-    <!--
-        使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作:
-        第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息
-        第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别:
-        【logging.level.org.mybatis=debug logging.level.dao=debug】
-     -->
-
-    <!--
-        root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性
-        level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
-        不能设置为INHERITED或者同义词NULL。默认是DEBUG
-        可以包含零个或多个元素,标识这个appender将会添加到这个logger。
-    -->
-
-    <!-- 4. 最终的策略 -->
-    <!-- 4.1 开发环境:打印控制台-->
-    <!-- <springProfile name="dev">
-        <logger name="com.sdcm.pmp" level="debug"/>
-    </springProfile> -->
 
 
     <root level="info">
     <root level="info">
         <appender-ref ref="CONSOLE" />
         <appender-ref ref="CONSOLE" />
@@ -184,15 +142,5 @@
         <appender-ref ref="ERROR_FILE" />
         <appender-ref ref="ERROR_FILE" />
     </root>
     </root>
 
 
-    <!-- 4.2 生产环境:输出到文档
-    <springProfile name="pro">
-        <root level="info">
-            <appender-ref ref="CONSOLE" />
-            <appender-ref ref="DEBUG_FILE" />
-            <appender-ref ref="INFO_FILE" />
-            <appender-ref ref="ERROR_FILE" />
-            <appender-ref ref="WARN_FILE" />
-        </root>
-    </springProfile> -->
 
 
 </configuration>
 </configuration>