From 5b952f77058a9da5af5e143a6c2c7ba195aa736d Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期二, 26 十一月 2024 16:08:10 +0800
Subject: [PATCH] 预测消息配置

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

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelParamServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelParamServiceImpl.java
index 4c79982..023d4d6 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelParamServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelParamServiceImpl.java
@@ -2,8 +2,6 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.iailab.framework.common.service.impl.BaseServiceImpl;
-import com.iailab.module.model.mcs.pre.dao.MmModelArithSettingsDao;
 import com.iailab.module.model.mcs.pre.dao.MmModelParamDao;
 import com.iailab.module.model.mcs.pre.entity.MmModelParamEntity;
 import com.iailab.module.model.mcs.pre.service.MmModelParamService;
@@ -11,9 +9,8 @@
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author PanZhibao
@@ -24,6 +21,8 @@
 
     @Autowired
     private MmModelParamDao mmModelParamDao;
+
+    private static Map<String, List<MmModelParamEntity>> modelInputParamMap = new ConcurrentHashMap<>();
     
     @Override
     public void saveList(List<MmModelParamEntity> list) {
@@ -34,9 +33,31 @@
             item.setId(UUID.randomUUID().toString());
             mmModelParamDao.insert(item);
         });
+
+        // 清空缓存
+        clearCache();
     }
 
     @Override
+    public void clearCache() {
+        modelInputParamMap.clear();
+    }
+
+    @Override
+    public List<MmModelParamEntity> getByModelidFromCatch(String modelId) {
+        if (!modelInputParamMap.containsKey(modelId)) {
+            List<MmModelParamEntity> list = getByModelid(modelId);
+            if (list != null) {
+                modelInputParamMap.put(modelId, list);
+            } else {
+                return null;
+            }
+        }
+        return modelInputParamMap.get(modelId);
+    }
+
+
+    @Override
     public List<MmModelParamEntity> getByModelid(String modelid) {
         QueryWrapper<MmModelParamEntity> queryWrapper = new QueryWrapper();
         queryWrapper.eq("modelid", modelid);

--
Gitblit v1.9.3