From 69bd5efa5e2849a560e604d0aa608d5492113915 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期二, 12 十一月 2024 15:44:52 +0800
Subject: [PATCH] 模型运行输出配置

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java |   71 ++++++++++++++++++++---------------
 1 files changed, 41 insertions(+), 30 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java
index 51c9c47..b69168a 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java
@@ -62,6 +62,7 @@
     public void savePredictValue(Map<String, List<DataValueVO>> predictValueMap, int t, String nIndex, Date predictTime) {
         List<MmItemResultEntity> importList = new ArrayList<>();
         List<MmItemResultEntity> lastList = new ArrayList<>();
+
         for (Map.Entry<String, List<DataValueVO>> entry : predictValueMap.entrySet()) {
             for (DataValueVO dataVo : entry.getValue()) {
                 MmItemResultEntity importData = new MmItemResultEntity();
@@ -104,39 +105,49 @@
             map4.put("TABLENAME", "T_MM_ITEM_RESULT_JSON");
             map4.put("entity", resultJson);
             mmItemResultDao.savePredictJsonValue(map4);
+
+            Map<String, Object> params = new HashMap(4);
+            params.put("TABLENAME", T_MM_ITEM_RESULT);
+            params.put("OUTPUTID", entry.getKey());
+            params.put("STARTTIME", importList.get(0).getDatatime());
+            params.put("ENDTIME", importList.get(importList.size() - 1).getDatatime());
+            mmItemResultDao.deletePredictValue(params);
+
+
         }
 
-        Map<String, Object> params = new HashMap(4);
-        params.put("TABLENAME", T_MM_ITEM_RESULT);
-        params.put("OUTPUTID", importList.get(0).getOutputid());
-        params.put("STARTTIME", importList.get(0).getDatatime());
-        params.put("ENDTIME", importList.get(importList.size() - 1).getDatatime());
-        mmItemResultDao.deletePredictValue(params);
+//        Map<String, Object> params = new HashMap(4);
+//        params.put("TABLENAME", T_MM_ITEM_RESULT);
+//        params.put("OUTPUTID", importList.get(0).getOutputid());
+//        params.put("STARTTIME", importList.get(0).getDatatime());
+//        params.put("ENDTIME", importList.get(importList.size() - 1).getDatatime());
+//        mmItemResultDao.deletePredictValue(params);
 
-        int num1 = importList.size() / max_group_count;
-        int num2 = importList.size() % max_group_count;
-        if (num2 != 0) {
-            num1++;
-        }
-
-        List<MmItemResultEntity> tempList;
-        //先删除已经存在的数据,再插入新数据
-        for (int i = 0; i < num1; i++) {
-            int startIndex = max_group_count * i;
-            int count = max_group_count;
-            if (num2!=0 && i == num1 - 1) {
-                count = num2;
-            }
-            tempList = new ArrayList<>();
-            //获取某个索引范围内的对象集合
-            for (int j = startIndex; j < startIndex + count; j++) {
-                tempList.add(importList.get(j));
-            }
-            Map<String, Object> map2 = new HashMap<>(2);
-            map2.put("TABLENAME", T_MM_ITEM_RESULT);
-            map2.put("list", tempList);
-            mmItemResultDao.savePredictValue(map2);
-        }
+//        int num1 = importList.size() / max_group_count;
+//        int num2 = importList.size() % max_group_count;
+//        if (num2 != 0) {
+//            num1++;
+//        }
+//
+//        List<MmItemResultEntity> tempList;
+//        //先删除已经存在的数据,再插入新数据
+//        for (int i = 0; i < num1; i++) {
+//            int startIndex = max_group_count * i;
+//            int count = max_group_count;
+//            if (num2!=0 && i == num1 - 1) {
+//                count = num2;
+//            }
+//            tempList = new ArrayList<>();
+//            //获取某个索引范围内的对象集合
+//            for (int j = startIndex; j < startIndex + count; j++) {
+//                tempList.add(importList.get(j));
+//            }
+//            Map<String, Object> map2 = new HashMap<>(2);
+//            map2.put("TABLENAME", T_MM_ITEM_RESULT);
+//            map2.put("list", tempList);
+//            mmItemResultDao.savePredictValue(map2);
+//        }
+        mmItemResultDao.insertBatch(importList,max_group_count);
 
         Map<String, Object> map3 = new HashMap<>(2);
         map3.put("TABLENAME", "T_MM_ITEM_RESULT_LAST_POINT");

--
Gitblit v1.9.3