Преглед изворни кода

当阳线程任务更换位置

1037015548@qq.com пре 8 месеци
родитељ
комит
31edf76902

+ 3 - 1
dc3-center/dc3-center-manager/src/main/resources/application-dev.yml

@@ -44,4 +44,6 @@ spring:
         group: ${spring.group}
         watch-delay: 5000
         username: dc3
-        password: dc3
+        password: dc3
+        #服务器配置
+        server-addr: 127.0.0.1:8849

+ 39 - 0
dc3-driver/dc3-driver-mqtt/src/main/resources/application-pre.yml

@@ -0,0 +1,39 @@
+#
+# Copyright 2016-present the IoT DC3 original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# 预发布环境配置, 会覆盖 application-*.yml 中配置的内容
+driver:
+  schedule:
+    # 定时读数据
+    read:
+      cron: '0 0/15 * * * ?'
+  mqtt:
+    url: ${MQTT_BROKER_URL:tcp://dc3-rabbitmq:1883}
+    auth-type: USERNAME
+    username: ${MQTT_USERNAME:dc3}
+    password: ${MQTT_PASSWORD:dc3}
+    topic-prefix: dc3/${driver.tenant}/${spring.application.name}/
+    receive-topics:
+      - qos: 1
+        name: data
+
+spring:
+  rabbitmq:
+    virtual-host: ${RABBITMQ_VIRTUAL_HOST:dc3}
+    host: ${RABBITMQ_HOST:dc3-rabbitmq}
+    port: ${RABBITMQ_PORT:5672}
+    username: ${RABBITMQ_USERNAME:dc3}
+    password: ${RABBITMQ_PASSWORD:dc3}

+ 39 - 0
dc3-driver/dc3-driver-mqtt/src/main/resources/application-pro.yml

@@ -0,0 +1,39 @@
+#
+# Copyright 2016-present the IoT DC3 original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# 生产环境配置, 会覆盖 application-*.yml 中配置的内容
+driver:
+  schedule:
+    # 定时读数据
+    read:
+      cron: '0 0/15 * * * ?'
+  mqtt:
+    url: ${MQTT_BROKER_URL:tcp://dc3-rabbitmq:1883}
+    auth-type: USERNAME
+    username: ${MQTT_USERNAME:dc3}
+    password: ${MQTT_PASSWORD:dc3}
+    topic-prefix: dc3/${driver.tenant}/${spring.application.name}/
+    receive-topics:
+      - qos: 1
+        name: data
+
+spring:
+  rabbitmq:
+    virtual-host: ${RABBITMQ_VIRTUAL_HOST:dc3}
+    host: ${RABBITMQ_HOST:dc3-rabbitmq}
+    port: ${RABBITMQ_PORT:5672}
+    username: ${RABBITMQ_USERNAME:dc3}
+    password: ${RABBITMQ_PASSWORD:dc3}

+ 4 - 6
dc3-gateway/src/main/java/io/github/pnoker/gateway/bizmgr/KprDangyangWaterBizFun.java

@@ -5,30 +5,28 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import io.github.pnoker.gateway.comtool.*;
+import io.github.pnoker.gateway.comtool.dangyangThread.ThreadDinzhiHistoryTask;
+import io.github.pnoker.gateway.comtool.dangyangThread.ThreadHistoryTask;
+import io.github.pnoker.gateway.comtool.dangyangThread.ThreadPoolTaskTool;
+import io.github.pnoker.gateway.comtool.dangyangThread.ThreadTask;
 import io.github.pnoker.gateway.dbdao.DBMgrProxy;
 import io.github.pnoker.gateway.dbdao.services.intef.DeviceKindService;
 import io.github.pnoker.gateway.dbdao.services.intef.TypeDefineService;
 import io.github.pnoker.gateway.utils.HttpUtil;
 import io.github.pnoker.gateway.utils.InfulxDbUtil;
-import org.apache.http.client.methods.HttpPatch;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.influxdb.dto.Point;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
-import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
 
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.*;
 import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**

+ 1 - 1
dc3-gateway/src/main/java/io/github/pnoker/gateway/comtool/ThreadDinzhiHistoryTask.java

@@ -1,4 +1,4 @@
-package io.github.pnoker.gateway.comtool;
+package io.github.pnoker.gateway.comtool.dangyangThread;
 
 import com.alibaba.fastjson.JSONObject;
 import io.github.pnoker.gateway.bizmgr.KprDangyangWaterBizFun;

+ 1 - 2
dc3-gateway/src/main/java/io/github/pnoker/gateway/comtool/ThreadHistoryTask.java

@@ -1,4 +1,4 @@
-package io.github.pnoker.gateway.comtool;
+package io.github.pnoker.gateway.comtool.dangyangThread;
 
 import com.alibaba.fastjson.JSONObject;
 import io.github.pnoker.gateway.bizmgr.KprDangyangWaterBizFun;
@@ -9,7 +9,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.math.BigDecimal;
-import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.*;
 import java.time.format.DateTimeFormatter;

+ 1 - 4
dc3-gateway/src/main/java/io/github/pnoker/gateway/comtool/ThreadPoolTaskTool.java

@@ -1,7 +1,4 @@
-package io.github.pnoker.gateway.comtool;
-
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
-import org.springframework.scheduling.support.CronTrigger;
+package io.github.pnoker.gateway.comtool.dangyangThread;
 
 import java.util.Map;
 import java.util.concurrent.*;

+ 1 - 5
dc3-gateway/src/main/java/io/github/pnoker/gateway/comtool/ThreadTask.java

@@ -1,16 +1,12 @@
-package io.github.pnoker.gateway.comtool;
+package io.github.pnoker.gateway.comtool.dangyangThread;
 
 import com.alibaba.fastjson.JSONObject;
 import io.github.pnoker.gateway.bizmgr.KprDangyangWaterBizFun;
 import io.github.pnoker.gateway.bizmgr.baseInit.KprBaseInitFun;
-import io.github.pnoker.gateway.dbdao.DBMgrProxy;
-import io.github.pnoker.gateway.dbdao.services.intef.DeviceKindService;
-import io.github.pnoker.gateway.dbdao.services.intef.TypeDefineService;
 import io.github.pnoker.gateway.utils.HttpUtil;
 import org.influxdb.dto.Point;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.util.ObjectUtils;
 
 import java.math.BigDecimal;
 import java.text.ParseException;