From e0b86ecb9040b56bad93356263805baff76442b4 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 29 十一月 2024 17:24:30 +0800
Subject: [PATCH] Timestamp

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

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
index 3a38f00..7f4dfec 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
@@ -17,6 +17,7 @@
 import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO;
 import com.iailab.module.model.mdk.vo.ItemVO;
 import com.iailab.module.model.mdk.vo.MergeItemVO;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -166,11 +167,17 @@
         }
         mmItemOutputService.deleteByItemId(predictItem.getId());
         List<MmItemOutputEntity> mmItemOutput = mmPredictItemDto.getMmItemOutputList();
-        mmItemOutput.forEach(e -> {
-            e.setId(UUID.randomUUID().toString());
-            e.setItemid(predictItem.getId());
-        });
-        mmItemOutputService.saveMmItemOutput(mmItemOutput);
+        if (!CollectionUtils.isEmpty(mmItemOutput)) {
+            mmItemOutput.forEach(e -> {
+                // 尽量保存原有id
+                if (StringUtils.isBlank(e.getId())) {
+                    e.setId(UUID.randomUUID().toString());
+                }
+                e.setItemid(predictItem.getId());
+            });
+            mmItemOutputService.saveMmItemOutput(mmItemOutput);
+        }
+
 
         // 清空缓存
         clearCatch();
@@ -268,6 +275,19 @@
     }
 
     @Override
+    public ItemVO getItemByOutPutId(String outPutId) {
+        if (StringUtils.isBlank(outPutId)) {
+            return null;
+        }
+        MmItemOutputEntity outPutById = mmItemOutputService.getOutPutById(outPutId);
+        if (ObjectUtils.isEmpty(outPutById)) {
+            return null;
+        }
+        String itemId = outPutById.getItemid();
+        return getItemById(itemId);
+    }
+
+    @Override
     public MergeItemVO getMergeItemByItemId(String itemId) {
         if (StringUtils.isBlank(itemId)) {
             return null;

--
Gitblit v1.9.3