From 874dd8d939b4ae61efbb799855c9ddf328722972 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 25 十二月 2024 18:08:08 +0800
Subject: [PATCH] Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat

---
 iailab-module-model/iailab-module-model-biz/src/main/resources/logback-spring.xml                                                       |    4 ++--
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java |    9 +++++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/enums/OutResultType.java                       |    2 +-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java          |   26 ++++++++++++++++++++++++--
 iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml                                                           |    2 +-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmItemResultJsonService.java          |    2 ++
 iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml                                                          |    2 +-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java                                   |    6 +++++-
 pom.xml                                                                                                                                 |    6 +++---
 9 files changed, 48 insertions(+), 11 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml b/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml
index 1aa2d73..4cf6525 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml
+++ b/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml
@@ -61,7 +61,7 @@
 
 logging:
   file:
-    name: @log.path@/iailab-data/log/${spring.application.name}.log # 日志文件名,全路径
+    name: @log.path@/log/${spring.application.name}.log # 日志文件名,全路径
   level:
     org:
       springframework:
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
index 4d965a0..9a6275c 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
@@ -336,7 +336,11 @@
         dataView.setRangeL(rangeL);
         dataView.setLimitH(limitH);
         dataView.setLimitL(limitL);
-        dataView.setRealData(getHisData(outPut.getPointid(), startTime, endTime, timeFormat));
+        if (StringUtils.isNotBlank(outPut.getPointid())) {
+            dataView.setRealData(getHisData(outPut.getPointid(), startTime, endTime, timeFormat));
+        } else {
+            dataView.setRealData(new ArrayList<>());
+        }
         dataView.setCurData(mmItemResultJsonService.getData(outPut.getId(), predictTime, timeFormat));
         switch (lineType) {
             case TN:
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/enums/OutResultType.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/enums/OutResultType.java
index 95e6608..09cc3d1 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/enums/OutResultType.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/enums/OutResultType.java
@@ -13,7 +13,7 @@
 public enum OutResultType {
     D1(1, "一维数组"),
     D2(2, "二维数组"),
-    D(3, "二维数组");
+    D(3, "double");
 
     private Integer code;
     private String desc;
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmItemResultJsonService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmItemResultJsonService.java
index f46f267..ef59ced 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmItemResultJsonService.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmItemResultJsonService.java
@@ -14,4 +14,6 @@
 public interface MmItemResultJsonService extends BaseService<MmItemResultJsonEntity> {
 
     List<Object[]> getData(String outputId, Date predictTime, String timeFormat);
+
+    String getDoubleData(String outputId, Date predictTime);
 }
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java
index 6b60d6e..8520d31 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java
@@ -48,4 +48,13 @@
         });
         return result;
     }
+
+    @Override
+    public String getDoubleData(String outputId, Date predictTime) {
+        QueryWrapper<MmItemResultJsonEntity> wrapper = new QueryWrapper<>();
+        wrapper.eq("outputid", outputId)
+                .eq("predicttime", predictTime);
+        MmItemResultJsonEntity mmItemResultJsonEntity = baseDao.selectOne(wrapper);
+        return null == mmItemResultJsonEntity ? null : mmItemResultJsonEntity.getCumulant();
+    }
 }
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
index 60149c3..6b61389 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
@@ -8,8 +8,10 @@
 import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO;
 import com.iailab.module.data.common.ApiDataQueryDTO;
 import com.iailab.module.data.common.ApiDataValueDTO;
+import com.iailab.module.model.common.enums.OutResultType;
 import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
 import com.iailab.module.model.mcs.pre.service.MmItemOutputService;
+import com.iailab.module.model.mcs.pre.service.MmItemResultJsonService;
 import com.iailab.module.model.mcs.pre.service.MmItemResultService;
 import com.iailab.module.model.mcs.pre.service.MmItemTypeService;
 import com.iailab.module.model.mdk.common.enums.ModelParamType;
@@ -19,6 +21,7 @@
 import com.iailab.module.model.mdk.sample.dto.SampleInfo;
 import com.iailab.module.model.mdk.vo.DataValueVO;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +48,9 @@
 
     @Autowired
     private MmItemResultService mmItemResultService;
+
+    @Autowired
+    private MmItemResultJsonService mmItemResultJsonService;
 
     @Autowired
     private MmItemTypeService mmItemTypeService;
@@ -141,8 +147,24 @@
                 break;
             case NORMALITEM:
             case MERGEITEM:
-//                MmItemOutputEntity outPut = mmItemOutputService.getOutPutById(columnItem.getParamId());
-                List<DataValueVO> predictValue = mmItemResultService.getPredictValue(columnItem.getParamId(), columnItem.getStartTime(), columnItem.getEndTime());
+                MmItemOutputEntity outPut = mmItemOutputService.getOutPutById(columnItem.getParamId());
+                OutResultType outResultType = OutResultType.getEumByCode(outPut.getResultType());
+                List<DataValueVO> predictValue = new ArrayList<>();
+
+                // double类型特殊处理
+                if (outResultType.equals(OutResultType.D)) {
+                    // columnItem.getStartTime()就是预测时间
+                    String doubleData = mmItemResultJsonService.getDoubleData(outPut.getId(), columnItem.getStartTime());
+                    if (StringUtils.isNotBlank(doubleData)) {
+                        DataValueVO dataValueVO = new DataValueVO();
+                        dataValueVO.setDataTime(columnItem.getStartTime());
+                        dataValueVO.setDataValue(Double.valueOf(doubleData));
+                        predictValue.add(dataValueVO);
+                    }
+                } else {
+                    predictValue = mmItemResultService.getPredictValue(outPut.getId(), columnItem.getStartTime(), columnItem.getEndTime());
+                }
+
                 if (CollectionUtils.isEmpty(predictValue)) {
                     break;
                 }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml b/iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml
index 8ef4a92..3050d38 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml
@@ -58,7 +58,7 @@
 
 logging:
   file:
-    name: @log.path@/iailab-model/log/${spring.application.name}.log # 日志文件名,全路径
+    name: @log.path@/log/${spring.application.name}.log # 日志文件名,全路径
   level:
     org:
       springframework:
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/logback-spring.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/logback-spring.xml
index 328482a..7c90fd0 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/resources/logback-spring.xml
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/logback-spring.xml
@@ -31,11 +31,11 @@
             <!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
             <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
             <!-- 日志文件,到达多少容量,进行滚动 -->
-            <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
+            <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-100MB}</maxFileSize>
             <!-- 日志文件的总大小,0 表示不限制 -->
             <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
             <!-- 日志文件的保留天数 -->
-            <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
+            <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-7}</maxHistory>
         </rollingPolicy>
     </appender>
     <!-- 异步写入日志,提升性能 -->
diff --git a/pom.xml b/pom.xml
index 9e21489..f0a90f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -120,7 +120,7 @@
                 <nacos.username>nacos</nacos.username>
                 <nacos.password>nacos</nacos.password>
                 <nacos.metadata.version>1.0.0</nacos.metadata.version>
-                <log.path>D:\DLUT\iailab-plat</log.path>
+                <log.path>D:/DLUT/iailab-plat</log.path>
                 <logstash.address>127.0.0.1:4560</logstash.address>
                 <deploy.server>127.0.0.1</deploy.server>
             </properties>
@@ -140,7 +140,7 @@
                 <nacos.username>nacos</nacos.username>
                 <nacos.password>nacos</nacos.password>
                 <nacos.metadata.version>1.0.0</nacos.metadata.version>
-                <log.path>/home/iailab</log.path>
+                <log.path>.</log.path>
                 <logstash.address>127.0.0.1:4560</logstash.address>
                 <deploy.server>172.16.59.105</deploy.server>
             </properties>
@@ -156,7 +156,7 @@
                 <nacos.username>nacos</nacos.username>
                 <nacos.password>nacos</nacos.password>
                 <nacos.metadata.version>1.0.0</nacos.metadata.version>
-                <log.path>D:\iailab\logs</log.path>
+                <log.path>.</log.path>
                 <logstash.address>127.0.0.1:4560</logstash.address>
                 <deploy.server>10.88.4.131</deploy.server>
             </properties>

--
Gitblit v1.9.3