From 5bf42aa9950058f391805e6fb8d7376f4378924b Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 23 十二月 2024 16:16:55 +0800
Subject: [PATCH] cumulateHandle.getCurrent

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java |   39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 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 7f4dfec..0bd305c 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
@@ -118,6 +118,14 @@
             MmPredictMergeItemEntity mMmPredictMergeItem = mmPredictItemDto.getMmPredictMergeItem();
             mMmPredictMergeItem.setItemid(predictItem.getId());
             mmPredictMergeItemService.savePredictMergeItem(mMmPredictMergeItem);
+            // 添加一条默认output
+            List<MmItemOutputEntity> mergeItemOutput = new ArrayList<>(1);
+            MmItemOutputEntity entity = new MmItemOutputEntity();
+            entity.setPointid(mmPredictItemDto.getPointId());
+            entity.setResultName(mmPredictItemDto.getMmPredictItem().getItemname());
+            entity.setResultstr("result");
+            mergeItemOutput.add(entity);
+            mmPredictItemDto.setMmItemOutputList(mergeItemOutput);
         }
         mmPredictItemDao.insert(predictItem);
         DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem();
@@ -160,6 +168,19 @@
         } else if (itemType != null && ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) {
             MmPredictMergeItemEntity mMmPredictMergeItem = mmPredictItemDto.getMmPredictMergeItem();
             mmPredictMergeItemService.update(mMmPredictMergeItem);
+            // 修改默认output
+            List<MmItemOutputEntity> mmItemOutputList = mmPredictItemDto.getMmItemOutputList();
+            if (CollectionUtils.isEmpty(mmItemOutputList)) {
+                mmItemOutputList = new ArrayList<>(1);
+                MmItemOutputEntity entity = new MmItemOutputEntity();
+                entity.setPointid(mmPredictItemDto.getPointId());
+                entity.setResultName(mmPredictItemDto.getMmPredictItem().getItemname());
+                entity.setResultstr("result");
+                mmItemOutputList.add(entity);
+                mmPredictItemDto.setMmItemOutputList(mmItemOutputList);
+            } else {
+                mmPredictItemDto.getMmItemOutputList().forEach(e -> e.setPointid(mmPredictItemDto.getPointId()));
+            }
         }
         DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem();
         if (!"".equals(dmModuleItem.getId()) && dmModuleItem.getId() != null) {
@@ -215,6 +236,9 @@
             mmPredictItemDto.setMmModelParamList(new ArrayList<>());
             mmPredictItemDto.setMmPredictMergeItem(new MmPredictMergeItemEntity());
             mmPredictItemDto.setMmPredictMergeItem(mmPredictMergeItemService.getByItemid(id));
+            if (!CollectionUtils.isEmpty(mmPredictItemDto.getMmItemOutputList())) {
+                mmPredictItemDto.setPointId(mmPredictItemDto.getMmItemOutputList().get(0).getPointid());
+            }
         }
         return mmPredictItemDto;
     }
@@ -258,7 +282,7 @@
     }
 
     @Override
-    public ItemVO getItemById(String itemId) {
+    public ItemVO getItemByIdFromCache(String itemId) {
         if (StringUtils.isBlank(itemId)) {
             return null;
         }
@@ -275,6 +299,17 @@
     }
 
     @Override
+    public ItemVO getItemById(String itemId) {
+        Map<String, Object> params = new HashMap<>(1);
+        params.put("ITEMID", itemId);
+        List<ItemVO> list = mmPredictItemDao.getItem(params);
+        if (CollectionUtils.isEmpty(list)) {
+            return null;
+        }
+        return list.get(0);
+    }
+
+    @Override
     public ItemVO getItemByOutPutId(String outPutId) {
         if (StringUtils.isBlank(outPutId)) {
             return null;
@@ -284,7 +319,7 @@
             return null;
         }
         String itemId = outPutById.getItemid();
-        return getItemById(itemId);
+        return getItemByIdFromCache(itemId);
     }
 
     @Override

--
Gitblit v1.9.3