Browse Source

健康状态判定计算服务

shilin 3 years ago
parent
commit
5c17bba900

BIN
realtime/datatraining-server-cph/lib/xxl-job-core-2.3.1-SNAPSHOT.jar


+ 46 - 1
realtime/datatraining-server-cph/pom.xml

@@ -6,13 +6,26 @@
         <artifactId>realtime</artifactId>
         <groupId>com.gyee</groupId>
         <version>1.0-SNAPSHOT</version>
+
     </parent>
     <modelVersion>4.0.0</modelVersion>
-
+    <packaging>jar</packaging>
     <artifactId>datatraining-server-cph</artifactId>
 
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <maven.test.skip>true</maven.test.skip>
 
+        <groovy.version>3.0.8</groovy.version>
+        <spring-boot.version>2.3.7.RELEASE</spring-boot.version>
+
+    </properties>
     <dependencies>
+
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-math3</artifactId>
@@ -110,7 +123,39 @@
             </exclusions>
 
         </dependency>
+        <!-- ********************** plugin ********************** -->
+        <!-- groovy-all -->
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy</artifactId>
+            <version>${groovy.version}</version>
+        </dependency>
+
+        <!-- xxl-job-core -->
+        <dependency>
+            <groupId>com.xuxueli</groupId>
+            <artifactId>xxl-job-core</artifactId>
+            <version>2.3.1-SNAPSHOT</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/lib/xxl-job-core-2.3.1-SNAPSHOT.jar</systemPath>
+        </dependency>
+
+
     </dependencies>
+
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <!-- Import dependency management from Spring Boot (依赖管理:继承一些默认的依赖,工程需要依赖的jar包的管理,申明其他dependency的时候就不需要version) -->
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-parent</artifactId>
+                <version>${spring-boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <build>
         <plugins>
             <plugin>

+ 3 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/DatatrainingMain.java

@@ -13,4 +13,7 @@ public class DatatrainingMain {
     public static void main(String[] args) {
         SpringApplication.run(DatatrainingMain.class, args);
     }
+
+
+
 }

+ 67 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/config/XxlJobConfig.java

@@ -0,0 +1,67 @@
+package com.gyee.datatraining.config;
+
+import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.EnvironmentAware;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+
+/**
+ * xxl-job config
+ *
+ * @author xuxueli 2017-04-28
+ */
+
+
+    @Configuration
+    @PropertySource("classpath:xxl-job-executor.properties")
+    public class XxlJobConfig implements EnvironmentAware {
+        private Environment env;
+
+        @Override
+        public void setEnvironment(Environment environment) {
+            this.env=environment;
+        }
+
+    private Logger logger = LoggerFactory.getLogger(com.gyee.datatraining.config.XxlJobConfig.class);
+
+
+
+    @Bean
+    public XxlJobSpringExecutor xxlJobExecutor() {
+        logger.info(">>>>>>>>>>> xxl-job config init.");
+        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
+        xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
+        xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
+        xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
+        xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
+        xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
+        xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
+        xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
+        xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
+
+        return xxlJobSpringExecutor;
+    }
+
+    /**
+     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
+     *
+     *      1、引入依赖:
+     *          <dependency>
+     *             <groupId>org.springframework.cloud</groupId>
+     *             <artifactId>spring-cloud-commons</artifactId>
+     *             <version>${version}</version>
+     *         </dependency>
+     *
+     *      2、配置文件,或者容器启动变量
+     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
+     *
+     *      3、获取IP
+     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+     */
+
+
+}

+ 36 - 29
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/SaticScheduleTask.java

@@ -6,11 +6,11 @@ import com.gyee.datatraining.model.auto.Windpowerstation;
 import com.gyee.datatraining.model.auto.Windturbine;
 import com.gyee.datatraining.service.DatatrainingService;
 import com.gyee.datatraining.util.dd.LstmModelWt;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -20,8 +20,9 @@ import java.util.concurrent.Executor;
  * @ClassName : SaticScheduleTask
  * @Description : 调度
  */
-@Configuration      //1.主要用于标记配置类,兼备Component的效果。
-@EnableScheduling   // 2.开启定时任务
+
+
+@Component
 public class SaticScheduleTask {
 
     private static Logger logger = LoggerFactory.getLogger(SaticScheduleTask.class);
@@ -36,13 +37,14 @@ public class SaticScheduleTask {
     /**
      * 健康状态判定
      */
-    @Scheduled(cron = "0 0/1 * * * ?")
+//    @Scheduled(cron = "0 0/1 * * * ?")
     //或直接指定时间间隔,例如:5秒
     //@Scheduled(fixedRate=5000)
-    private void configureTasks1()  {
+    @XxlJob("datatraining-wtStateJudgment")
+    public void configureTasks1()  {
 
 
-        logger.info("健康状态判定调度程序执行开始!........");
+        XxlJobHelper.log("健康状态判定调度程序执行开始!........");
 
         try {
 
@@ -52,19 +54,20 @@ public class SaticScheduleTask {
             e.printStackTrace();
         }
 
-        logger.info("健康状态判定调度任务处理完成!........");
+        XxlJobHelper.log("健康状态判定调度任务处理完成!........");
     }
 
     /**
      * 风机未来4小时数据
      */
-    @Scheduled(cron = "0 0 0/1 * * ?")
+    //@Scheduled(cron = "0 0 0/1 * * ?")
     //或直接指定时间间隔,例如:5秒
     //@Scheduled(fixedRate=5000)
-    private void configureTasks2()  {
+    @XxlJob("datatraining-nextFourHours")
+    public void configureTasks2()  {
 
 
-        logger.info("风机未来4小时数据调度程序执行开始!........");
+        XxlJobHelper.log("风机未来4小时数据调度程序执行开始!........");
 
         try {
 
@@ -86,19 +89,20 @@ public class SaticScheduleTask {
             e.printStackTrace();
         }
 
-        logger.info("风机未来4小时数据调度任务处理完成!........");
+        XxlJobHelper.log("风机未来4小时数据调度任务处理完成!........");
     }
 
     /**
      * 风机未来1天数据
      */
-    @Scheduled(cron = "0 0 0/1 * * ?")
+    //@Scheduled(cron = "0 0 0/1 * * ?")
     //或直接指定时间间隔,例如:5秒
     //@Scheduled(fixedRate=5000)
-    private void configureTasks3()  {
+    @XxlJob("datatraining-nextOneDays")
+    public void configureTasks3()  {
 
 
-        logger.info("风机未来1天数据调度程序执行开始!........");
+        XxlJobHelper.log("风机未来1天数据调度程序执行开始!........");
 
         try {
 
@@ -120,19 +124,20 @@ public class SaticScheduleTask {
             e.printStackTrace();
         }
 
-        logger.info("风机未来1天数据调度任务处理完成!........");
+        XxlJobHelper.log("风机未来1天数据调度任务处理完成!........");
     }
 
     /**
      * 风机未来3天数据
      */
-    @Scheduled(cron = "0 0 0/1 * * ?")
+    //@Scheduled(cron = "0 0 0/1 * * ?")
     //或直接指定时间间隔,例如:5秒
     //@Scheduled(fixedRate=5000)
-    private void configureTasks4()  {
+    @XxlJob("datatraining-nextThreeDays")
+    public void configureTasks4()  {
 
 
-        logger.info("风机未来3天数据调度程序执行开始!........");
+        XxlJobHelper.log("风机未来3天数据调度程序执行开始!........");
 
         try {
 
@@ -154,19 +159,20 @@ public class SaticScheduleTask {
             e.printStackTrace();
         }
 
-        logger.info("风机未来3天数据调度任务处理完成!........");
+        XxlJobHelper.log("风机未来3天数据调度任务处理完成!........");
     }
 
     /**
      * 风机未来7天数据
      */
-    @Scheduled(cron = "0 0 0/1 * * ?")
+    //@Scheduled(cron = "0 0 0/1 * * ?")
     //或直接指定时间间隔,例如:5秒
     //@Scheduled(fixedRate=5000)
-    private void configureTasks5()  {
+    @XxlJob("datatraining-nextSevenDays")
+    public void configureTasks5()  {
 
 
-        logger.info("风机未来7天数据调度程序执行开始!........");
+        XxlJobHelper.log("风机未来7天数据调度程序执行开始!........");
 
         try {
 
@@ -188,19 +194,20 @@ public class SaticScheduleTask {
             e.printStackTrace();
         }
 
-        logger.info("风机未来7天数据调度任务处理完成!........");
+        XxlJobHelper.log("风机未来7天数据调度任务处理完成!........");
     }
 
     /**
      * 风机未来1个月数据
      */
-    @Scheduled(cron = "0 0 0/1 * * ?")
+    //@Scheduled(cron = "0 0 0/1 * * ?")
     //或直接指定时间间隔,例如:5秒
     //@Scheduled(fixedRate=5000)
-    private void configureTasks6()  {
+    @XxlJob("datatraining-nextOneMonth")
+    public void configureTasks6()  {
 
 
-        logger.info("风机未来1个月数据调度程序执行开始!........");
+        XxlJobHelper.log("风机未来1个月数据调度程序执行开始!........");
 
         try {
 
@@ -222,7 +229,7 @@ public class SaticScheduleTask {
             e.printStackTrace();
         }
 
-        logger.info("风机未来1个月数据调度任务处理完成!........");
+        XxlJobHelper.log("风机未来1个月数据调度任务处理完成!........");
     }
 
 

+ 5 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/IRealTimeDataBaseUtil.java

@@ -207,4 +207,9 @@ public interface IRealTimeDataBaseUtil {
      * @throws Exception
      */
     public DNAVal[] getHistMatrix(String[] nameList, long tTime) throws Exception;
+
+
+    public void sendSinglePoint(PointData point) throws Exception;
+
+    public void sendMultiPoint(List<PointData> pointls) throws Exception;
 }

+ 147 - 125
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/EdosUtil.java

@@ -35,7 +35,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public PointData getRealData(Windpowerstationpointnew point) throws Exception {
 
-        if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             try {
                 Optional<String> keys = Optional.ofNullable(point.getCode());
@@ -55,7 +55,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 JSONObject jsonArray = resp.getBody();
-                if (com.gyee.common.model.StringUtils.isNotEmpty(jsonArray)){
+                if (StringUtils.isNotEmpty(jsonArray)){
                     List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
                     if (list.size() > 0)
                         return list.get(0);
@@ -87,7 +87,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistoryDatasSnap(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
 
-        if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
             Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
@@ -156,7 +156,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                                     else{
                                         PointData data = new PointData();
                                         data.setEdnaId(point.getCode());
-                                        data.setPointTime(snapItem.getPointTime());
+                                        data.setPointTime(0L);
                                         data.setPointValue("0");
                                         data.setPointName("1");
                                         data.setPointValueInDouble(0.0);
@@ -165,7 +165,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                                 } else {
                                     PointData data = new PointData();
                                     data.setEdnaId(point.getCode());
-                                    data.setPointTime(snapItem.getPointTime());
+                                    data.setPointTime(0l);
                                     data.setPointValue("0");
                                     data.setPointName("1");
                                     data.setPointValueInDouble(0.0);
@@ -174,7 +174,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                             } else {
                                 PointData data = new PointData();
                                 data.setEdnaId(point.getCode());
-                                data.setPointTime(snapItem.getPointTime());
+                                data.setPointTime(0l);
                                 data.setPointValue("0");
                                 data.setPointName("1");
                                 data.setPointValueInDouble(0.0);
@@ -231,7 +231,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                 else{
                     PointData data = new PointData();
                     data.setEdnaId(pointid);
-                    data.setPointTime(sectionlist.get(0).getPointTime());
+                    data.setPointTime(0L);
                     data.setPointValue("0");
                     data.setPointName("1");
                     data.setPointValueInDouble(0.0);
@@ -240,7 +240,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
             } else {
                 PointData data = new PointData();
                 data.setEdnaId(pointid);
-                data.setPointTime(sectionlist.get(0).getPointTime());
+                data.setPointTime(0L);
                 data.setPointValue("0");
                 data.setPointName("1");
                 data.setPointValueInDouble(0.0);
@@ -261,7 +261,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistoryDatasRaw(Windpowerstationpointnew point, Long beginDate, Long endDate) throws Exception {
 
-        if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
             Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
@@ -321,7 +321,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public PointData getRealData(Windturbinetestingpointnew point) throws Exception {
 
-        if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> keys = Optional.ofNullable(point.getCode());
             Optional<String> thingType = Optional.ofNullable(point.getModelid());
@@ -343,7 +343,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                 }
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 JSONObject jsonArray = resp.getBody();
-                if (com.gyee.common.model.StringUtils.isNotEmpty(jsonArray)){
+                if (StringUtils.isNotEmpty(jsonArray)){
                     List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
                     if (list.size() > 0)
                         return list.get(0);
@@ -375,7 +375,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistoryDatasSnap(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
 
-        if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
             Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
@@ -443,7 +443,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                                     else{
                                         PointData data = new PointData();
                                         data.setEdnaId(point.getCode());
-                                        data.setPointTime(snapItem.getPointTime());
+                                        data.setPointTime(0L);
                                         data.setPointValue("0");
                                         data.setPointName("1");
                                         data.setPointValueInDouble(0.0);
@@ -452,7 +452,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                                 } else {
                                     PointData data = new PointData();
                                     data.setEdnaId(point.getCode());
-                                    data.setPointTime(snapItem.getPointTime());
+                                    data.setPointTime(0l);
                                     data.setPointValue("0");
                                     data.setPointName("1");
                                     data.setPointValueInDouble(0.0);
@@ -461,7 +461,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                             } else {
                                 PointData data = new PointData();
                                 data.setEdnaId(point.getCode());
-                                data.setPointTime(snapItem.getPointTime());
+                                data.setPointTime(0l);
                                 data.setPointValue("0");
                                 data.setPointName("1");
                                 data.setPointValueInDouble(0.0);
@@ -499,7 +499,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
     @Override
     public List<PointData> getHistoryDatasRaw(Windturbinetestingpointnew point, Long beginDate, Long endDate) throws Exception {
-        if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
             Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
@@ -557,7 +557,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public PointData getRealData(String pointid) throws Exception {
 
-        if(com.gyee.common.model.StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
+        if(StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
         {
             Optional<String> keys = Optional.ofNullable(pointid);
             String url = baseURL + "/latest?null=0";
@@ -569,7 +569,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 JSONObject jsonArray = resp.getBody();
-                if (com.gyee.common.model.StringUtils.isNotEmpty(jsonArray)){
+                if (StringUtils.isNotEmpty(jsonArray)){
                     List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
                     if (list.size() > 0)
                         return list.get(0);
@@ -602,17 +602,17 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     public List<PointData> getRealData(String... pointids) throws Exception {
 
 
-        if(com.gyee.common.model.StringUtils.notEmp(pointids) )
+        if(StringUtils.notEmp(pointids) )
         {
             List<String> idls=new ArrayList<>();
             for(String str:pointids)
             {
-                if(com.gyee.common.model.StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
+                if(StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
                 {
                     idls.add(str);
                 }
             }
-            if(!idls.isEmpty()  )
+            if(!idls.isEmpty() )
             {
                 String pointIdString = StringUtil.join(idls.toArray(), ",");
                 Optional<String> keys = Optional.ofNullable(pointIdString);
@@ -627,32 +627,25 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                     JSONObject jsonObject = resp.getBody();
                     if (jsonObject != null) {
                         //对结果进行有序返回
-                        int len = idls.size();
+                        int len = pointids.length;
                         List<PointData> result = new ArrayList<>();
                         HashMap<String, PointData> pointDataHashMap = new HashMap<>();
                         for (int i = 0; i < len; i++) {
 
 
-                            PointData pd = new PointData();
-                            pd.setPointName(pointids[i]);
-                            pd.setEdnaId(pointids[i]);
-                            pd.setPointValueInDouble(0.0);
-                            pd.setPointTime(0l);
-                            result.add(pd);
-
-                            pointDataHashMap.put(pd.getPointName(), pd);
+                            if (pointDataHashMap.containsKey(pointids[i]) == false){
+                                PointData pd = new PointData();
+                                pd.setPointName(idls.get(i));
+                                pd.setEdnaId(idls.get(i));
+                                pd.setPointValueInDouble(0.0);
+                                pd.setPointTime(0l);
+                                result.add(pd);
 
-//                            if (pointDataHashMap.containsKey(idls.get(i)) == false){
-//                                PointData pd = new PointData();
-//                                pd.setPointName(idls.get(i));
-//                                pd.setEdnaId(idls.get(i));
-//                                result.add(pd);
-//
-//                                pointDataHashMap.put(pd.getPointName(), pd);
-//                            }
-//                            else{
-//                                result.add(pointDataHashMap.get(idls.get(i)));
-//                            }
+                                pointDataHashMap.put(pd.getPointName(), pd);
+                            }
+                            else{
+                                result.add(pointDataHashMap.get(idls.get(i)));
+                            }
 
                         }
                         Iterator<String> sIterator = jsonObject.keySet().iterator();
@@ -747,17 +740,17 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     public List<PointData> getRealData(List<String> pointids) throws Exception {
 
 
-        if(com.gyee.common.model.StringUtils.notEmp(pointids) )
+        if(StringUtils.notEmp(pointids) )
         {
             List<String> idls=new ArrayList<>();
             for(String str:pointids)
             {
-                if(com.gyee.common.model.StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
+                if(StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
                 {
                     idls.add(str);
                 }
             }
-            if(!idls.isEmpty()   )
+            if(!idls.isEmpty())
             {
                 String pointIdString = StringUtil.join(idls.toArray(), ",");
                 Optional<String> keys = Optional.ofNullable(pointIdString);
@@ -781,27 +774,19 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                         HashMap<String, PointData> pointDataHashMap = new HashMap<>();
                         for (int i = 0; i < len; i++) {
 
-                            PointData pd = new PointData();
-                            pd.setPointName(pointids.get(i));
-                            pd.setEdnaId(pointids.get(i));
-                            pd.setPointValueInDouble(0.0);
-                            pd.setPointTime(0l);
-                            result.add(pd);
-
-                            pointDataHashMap.put(pd.getPointName(), pd);
+                            if (pointDataHashMap.containsKey(pointids.get(i)) == false){
+                                PointData pd = new PointData();
+                                pd.setPointName(idls.get(i));
+                                pd.setEdnaId(idls.get(i));
+                                pd.setPointValueInDouble(0.0);
+                                pd.setPointTime(0l);
+                                result.add(pd);
 
-
-//                            if (pointDataHashMap.containsKey(idls.get(i)) == false){
-//                                PointData pd = new PointData();
-//                                pd.setPointName(idls.get(i));
-//                                pd.setEdnaId(idls.get(i));
-//                                result.add(pd);
-//
-//                                pointDataHashMap.put(pd.getPointName(), pd);
-//                            }
-//                            else{
-//                                result.add(pointDataHashMap.get(idls.get(i)));
-//                            }
+                                pointDataHashMap.put(pd.getPointName(), pd);
+                            }
+                            else{
+                                result.add(pointDataHashMap.get(idls.get(i)));
+                            }
                         }
                         Iterator<String> sIterator = jsonObject.keySet().iterator();
                         while (sIterator.hasNext()) {
@@ -892,12 +877,12 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     public Map<String, Double> getRealDataMap(String... pointids) throws Exception {
 
 
-        if(com.gyee.common.model.StringUtils.notEmp(pointids) )
+        if(StringUtils.notEmp(pointids) )
         {
             List<String> idls=new ArrayList<>();
             for(String str:pointids)
             {
-                if(com.gyee.common.model.StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
+                if(StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
                 {
                     idls.add(str);
                 }
@@ -914,7 +899,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                         return null;
                     ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                     JSONObject jsonArray = resp.getBody();
-                    if (com.gyee.common.model.StringUtils.isNotEmpty(jsonArray)){
+                    if (StringUtils.isNotEmpty(jsonArray)){
                         Iterator<String> sIterator = jsonArray.keySet().iterator();
                         Map<String, Double> resultMap = new HashMap();
                         while (sIterator.hasNext()) {
@@ -978,7 +963,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
 
-        if(com.gyee.common.model.StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
+        if(StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
         {
             Optional<String> tagName = Optional.ofNullable(pointid);
             Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
@@ -1037,7 +1022,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                                     else{
                                         PointData data = new PointData();
                                         data.setEdnaId(pointid);
-                                        data.setPointTime(snapItem.getPointTime());
+                                        data.setPointTime(0L);
                                         data.setPointValue("0");
                                         data.setPointName("1");
                                         data.setPointValueInDouble(0.0);
@@ -1046,7 +1031,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                                 } else {
                                     PointData data = new PointData();
                                     data.setEdnaId(pointid);
-                                    data.setPointTime(snapItem.getPointTime());
+                                    data.setPointTime(0l);
                                     data.setPointValue("0");
                                     data.setPointName("1");
                                     data.setPointValueInDouble(0.0);
@@ -1055,7 +1040,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                             } else {
                                 PointData data = new PointData();
                                 data.setEdnaId(pointid);
-                                data.setPointTime(snapItem.getPointTime());
+                                data.setPointTime(0l);
                                 data.setPointValue("0");
                                 data.setPointName("1");
                                 data.setPointValueInDouble(0.0);
@@ -1096,7 +1081,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception {
 
 
-        if(com.gyee.common.model.StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
+        if(StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
         {
             Optional<String> tagName = Optional.ofNullable(pointid);
             Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
@@ -1144,7 +1129,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistStat(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
 
-        if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
             Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
@@ -1220,7 +1205,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistStat(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
 
-        if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
             Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
@@ -1290,7 +1275,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     public List<PointData> getHistStat(String pointid, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
 
 
-        if(com.gyee.common.model.StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
+        if(StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
         {
             Optional<String> tagName = Optional.ofNullable(pointid);
             Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
@@ -1349,7 +1334,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception {
 
 
-        if(com.gyee.common.model.StringUtils.notEmp(point) &&  !V2Config.getInitialcode().equals(point))
+        if(StringUtils.notEmp(point) &&  !V2Config.getInitialcode().equals(point))
         {
             Optional<String> tagName = Optional.ofNullable(point);
             Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
@@ -1461,16 +1446,23 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     public DNAVal[] getRealtimeTagValues(String... tagNames) throws Exception {
 
 
-        if (com.gyee.common.model.StringUtils.notEmp(tagNames) && tagNames.length > 0) {
+        if (StringUtils.notEmp(tagNames) && tagNames.length > 0) {
 
 
             DNAVal[] result = new DNAVal[tagNames.length];
             for (int i = 0; i < tagNames.length; i++) {
-                if (com.gyee.common.model.StringUtils.notEmp(tagNames[i]) && !V2Config.getInitialcode().equals(tagNames[i])) {
+                if (StringUtils.notEmp(tagNames[i]) && !V2Config.getInitialcode().equals(tagNames[i])) {
                     PointData po = getRealData(tagNames[i]);
                     DNAVal val = new DNAVal();
                     val.DValue = po.getPointValueInDouble();
-                    val.Time = Integer.valueOf(String.valueOf(po.getPointTime()));
+                    if(StringUtils.notEmp(po.getPointTime()))
+                    {
+                        val.Time = Integer.valueOf(String.valueOf(po.getPointTime()));
+                    }else
+                    {
+                        val.Time = 0;
+                    }
+
                     val.Status = 1;
                     result[i] = val;
                 } else {
@@ -1497,57 +1489,87 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public void updatePoint(List<PointData> pointls) throws Exception {
         String url = baseURL + "/history/batch";
+
         List<JSONObject> writeList = new ArrayList<>();
 
-        for (PointData entity : pointls) {
-            writeList.add(convertPointData(entity));
+        if(StringUtils.notEmp(pointls) )
+        {
+            for(PointData entity:pointls)
+            {
+                if(StringUtils.notEmp(entity) && !V2Config.getInitialcode().equals(entity.getEdnaId()))
+                {
+                    writeList.add(convertPointData(entity));
+                }
+            }
+            if(!writeList.isEmpty())
+            {
+                try {
+                    String result = restTemplate.postForObject(url, writeList, String.class);
+                } catch (HttpClientErrorException exception) {
+                    if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                        //System.out.println("404请求错误");
+                    } else {
+                        throw exception;
+                    }
+                }
+
+            }
         }
-        try {
-            String result = restTemplate.postForObject(url, writeList, String.class);
-        } catch (HttpClientErrorException exception) {
-            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                return;
-            } else {
-                throw exception;
+
+    }
+
+    @Override
+    public void sendSinglePoint(PointData point) throws Exception {
+        String url = baseURL + "/latest";
+
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getEdnaId()) && !V2Config.getInitialcode().equals(point.getEdnaId()))
+        {
+            try {
+                String result = restTemplate.postForObject(url, convertPointData(point), String.class);
+            } catch (HttpClientErrorException exception) {
+                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                    return;
+                } else {
+                    throw exception;
+                }
             }
         }
+
     }
 
-//    @Override
-//    public void sendSinglePoint(PointData point) throws Exception {
-//        String url = baseURL + "/latest";
-//
-//
-//        try {
-//            String result = restTemplate.postForObject(url, convertPointData(point), String.class);
-//        } catch (HttpClientErrorException exception) {
-//            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-//                return;
-//            } else {
-//                throw exception;
-//            }
-//        }
-//    }
-//
-//    @Override
-//    public void sendMultiPoint(List<PointData> pointls) throws Exception {
-//
-//        String url = baseURL + "/latest/batch";
-//        List<JSONObject> writeList = new ArrayList<>();
-//
-//        for (PointData entity : pointls) {
-//            writeList.add(convertPointData(entity));
-//        }
-//        try {
-//            String result = restTemplate.postForObject(url, writeList, String.class);
-//        } catch (HttpClientErrorException exception) {
-//            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-//                //System.out.println("404请求错误");
-//            } else {
-//                throw exception;
-//            }
-//        }
-//    }
+    @Override
+    public void sendMultiPoint(List<PointData> pointls) throws Exception {
+
+        String url = baseURL + "/latest/batch";
+
+        List<JSONObject> writeList = new ArrayList<>();
+
+        if(StringUtils.notEmp(pointls) )
+        {
+            for(PointData entity:pointls)
+            {
+                if(StringUtils.notEmp(entity) && !V2Config.getInitialcode().equals(entity.getEdnaId()))
+                {
+                    writeList.add(convertPointData(entity));
+                }
+            }
+            if(!writeList.isEmpty())
+            {
+                try {
+                    String result = restTemplate.postForObject(url, writeList, String.class);
+                } catch (HttpClientErrorException exception) {
+                    if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                        //System.out.println("404请求错误");
+                    } else {
+                        throw exception;
+                    }
+                }
+
+            }
+        }
+
+
+    }
 //
 //    @Override
 //    public void sendMultiPoint(String[] realvalue, DNAVal[] pointls) throws Exception {
@@ -1582,12 +1604,12 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     public DNAVal[] getHistMatrix(String[] nameList, long tTime) throws Exception {
 
 
-        if(com.gyee.common.model.StringUtils.notEmp(nameList) )
+        if(StringUtils.notEmp(nameList) )
         {
             List<String> idls=new ArrayList<>();
             for(String str:nameList)
             {
-                if(com.gyee.common.model.StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
+                if(StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
                 {
                     idls.add(str);
                 }

+ 6 - 3
realtime/datatraining-server-cph/src/main/resources/application.yml

@@ -1,8 +1,9 @@
 # 项目相关配置
 gyee:
   #实时数据库Url
+  baseurl: http://10.0.118.73:8011/ts
   #baseurl: http://10.0.118.73:8011/ts
-  baseurl: http://192.168.2.205:8011/ts
+  #baseurl: http://192.168.2.205:8011/ts
   #实时数据库选择
   realtimedataBase: mongodb #数据查询模式 golden、hwy
   initialcode: INITIAL
@@ -25,8 +26,8 @@ spring:
     type: com.alibaba.druid.pool.DruidDataSource
     driver-class-name: oracle.jdbc.OracleDriver
     #外网
-    #url: jdbc:oracle:thin:@10.0.118.71:1521:gdsj
-    url: jdbc:oracle:thin:@192.168.2.215:1521:gdsj
+    url: jdbc:oracle:thin:@10.0.118.71:1521:gdsj
+    #url: jdbc:oracle:thin:@192.168.2.215:1521:gdsj
     #    url: jdbc:oracle:thin:@49.4.50.80:1521:gdnxfd
     #    url: jdbc:oracle:thin:@172.168.1.14:1521:gdnxfd
     username: gdprod
@@ -80,6 +81,8 @@ logging:
 edos:
   baseURL: http://10.0.118.73:8011/ts
 
+
+
 up82_part_state_clx: JKZT002
 up82_part_state_fdj: JKZT003
 up82_part_state_kzys: JKZT004

+ 18 - 0
realtime/datatraining-server-cph/src/main/resources/xxl-job-executor.properties

@@ -0,0 +1,18 @@
+### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
+xxl.job.admin.addresses=http://192.168.56.1:8175/xxl-job-admin
+
+### xxl-job, access token
+xxl.job.accessToken=
+
+### xxl-job executor appname
+xxl.job.executor.appname=datatraining-job
+### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
+xxl.job.executor.address=
+### xxl-job executor server-info
+xxl.job.executor.ip=
+xxl.job.executor.port=9101
+### xxl-job executor log-path
+xxl.job.executor.logpath=d:\\jobs\\datatraining-job
+### xxl-job executor log-retention-days
+xxl.job.executor.logretentiondays=30
+