From c9e48bd2dff2b5766589024cf7264189b5f2a05c Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期五, 03 一月 2025 14:03:33 +0800
Subject: [PATCH] cpp释放java占用内存

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java
index bf9930d..0511350 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java
@@ -52,7 +52,8 @@
     private SampleConstructor sampleConstructor;
 
     @Override
-    public ScheduleResultVO doSchedule(String schemeCode, Date scheduleTime, Map<Integer, Integer> dynamicDataLength) throws ModelInvokeException {
+    public ScheduleResultVO doSchedule(String schemeCode, Date scheduleTime, Map<Integer, Integer> dynamicDataLength,
+                                       Map<String, String> dynamicSettings) throws ModelInvokeException {
         ScheduleResultVO scheduleResult = new ScheduleResultVO();
         StScheduleSchemeEntity scheduleScheme = stScheduleSchemeService.getByCode(schemeCode);
         StScheduleModelEntity scheduleModel = stScheduleModelService.get(scheduleScheme.getModelId());
@@ -73,7 +74,7 @@
             }
 
             IAILModel newModelBean = composeNewModelBean(scheduleModel);
-            HashMap<String, Object> settings = getScheduleSettingsByModelId(modelId);
+            HashMap<String, Object> settings = getScheduleSettingsByModelId(modelId, dynamicSettings);
             if (settings == null) {
                 log.error("模型setting不存在,modelId=" + modelId);
                 return null;
@@ -127,13 +128,22 @@
      * 根据模型id获取参数map
      *
      * @param modelId
+     * @param dynamicSettings
      * @return
      */
-    private HashMap<String, Object> getScheduleSettingsByModelId(String modelId) {
+    private HashMap<String, Object> getScheduleSettingsByModelId(String modelId, Map<String, String> dynamicSettings) {
         List<StScheduleModelSettingEntity> list = stScheduleModelSettingService.getByModelId(modelId);
         if (CollectionUtils.isEmpty(list)) {
             return null;
         }
+        //如果输入参数中包含setting,则覆盖默认的setting
+        if (!CollectionUtils.isEmpty(dynamicSettings)){
+            list.forEach(setting -> {
+                if (dynamicSettings.containsKey(setting.getKey())) {
+                    setting.setValue(dynamicSettings.get(setting.getKey()));
+                }
+            });
+        }
         HashMap<String, Object> result = new HashMap<>();
         for (StScheduleModelSettingEntity entry : list) {
             String valueType = entry.getValuetype().trim(); //去除两端空格

--
Gitblit v1.9.3