From 826d35df6a24f08bc281ab93adcdd71ea381c67b Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期五, 13 十二月 2024 11:03:43 +0800
Subject: [PATCH] py文件重新上传后,修改预测项和调度项setting的pyFile

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/dao/StScheduleModelSettingDao.java                  |    2 ++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmModelArithSettingsService.java             |    2 ++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java    |    5 +++++
 iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmModelArithSettings.xml                                             |    3 +++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java                     |   13 +++++++++++++
 iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm                                                                 |    1 -
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java |    5 +++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dao/MmModelArithSettingsDao.java                     |    3 +++
 iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/StScheduleModelSettingDao.xml                                        |    7 +++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelSettingService.java          |    2 ++
 10 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dao/MmModelArithSettingsDao.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dao/MmModelArithSettingsDao.java
index 002bcd6..82b30a0 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dao/MmModelArithSettingsDao.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dao/MmModelArithSettingsDao.java
@@ -4,6 +4,7 @@
 import com.iailab.framework.tenant.core.db.dynamic.TenantDS;
 import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -30,4 +31,6 @@
      * @param list
      */
     void insertList(List<MmModelArithSettingsEntity> list);
+
+    void updatePyFile(@Param("likeValue") String likeValue,@Param("value") String value);
 }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmModelArithSettingsService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmModelArithSettingsService.java
index e26bfe7..dff36f4 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmModelArithSettingsService.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmModelArithSettingsService.java
@@ -13,4 +13,6 @@
     void saveList(List<MmModelArithSettingsEntity> list);
 
     List<MmModelArithSettingsEntity> getByModelId(String modelId);
+
+    void updatePyFile(String pyModule, String fileName);
 }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java
index 8059a9f..fafb596 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java
@@ -53,4 +53,9 @@
         modelIdMap.put(modelId, list);
         return list;
     }
+
+    @Override
+    public void updatePyFile(String pyModule, String fileName) {
+        baseMapper.updatePyFile(pyModule + "." + fileName.substring(0,fileName.lastIndexOf("_")),pyModule + "." + fileName);
+    }
 }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/dao/StScheduleModelSettingDao.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/dao/StScheduleModelSettingDao.java
index 6bd43c5..bb02cdc 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/dao/StScheduleModelSettingDao.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/dao/StScheduleModelSettingDao.java
@@ -4,6 +4,7 @@
 import com.iailab.framework.tenant.core.db.dynamic.TenantDS;
 import com.iailab.module.model.mcs.sche.entity.StScheduleModelSettingEntity;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * @author PanZhibao
@@ -13,4 +14,5 @@
 @TenantDS
 @Mapper
 public interface StScheduleModelSettingDao extends BaseMapperX<StScheduleModelSettingEntity> {
+    void updatePyFile(@Param("likeValue") String likeValue, @Param("value") String value);
 }
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelSettingService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelSettingService.java
index d396d0d..29590b0 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelSettingService.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelSettingService.java
@@ -18,4 +18,6 @@
     void deleteByModelId(String modelId);
 
     void saveList(String modelId, List<StScheduleModelSettingSaveReqVO> saveList);
+
+    void updatePyFile(String pyModule, String fileName);
 }
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java
index d21da80..c348b78 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java
@@ -53,4 +53,9 @@
             baseDao.insert(entity);
         }
     }
+
+    @Override
+    public void updatePyFile(String pyModule, String fileName) {
+        baseDao.updatePyFile(pyModule + "." + fileName.substring(0,fileName.lastIndexOf("_")),pyModule + "." + fileName);
+    }
 }
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
index 51e677b..f141bdf 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
@@ -14,6 +14,8 @@
 import com.iailab.framework.security.core.util.SecurityFrameworkUtils;
 import com.iailab.framework.tenant.core.context.TenantContextHolder;
 import com.iailab.module.infra.api.config.ConfigApi;
+import com.iailab.module.model.mcs.pre.service.MmModelArithSettingsService;
+import com.iailab.module.model.mcs.sche.service.StScheduleModelSettingService;
 import com.iailab.module.model.mpk.common.MdkConstant;
 import com.iailab.module.model.mpk.common.utils.CmdUtils;
 import com.iailab.module.model.mpk.common.utils.DllUtils;
@@ -67,6 +69,12 @@
 
     @Autowired
     private ProjectPackageHistoryModelService projectPackageHistoryModelService;
+
+    @Autowired
+    private MmModelArithSettingsService mmModelArithSettingsService;
+
+    @Autowired
+    private StScheduleModelSettingService stScheduleModelSettingService;
 
     @Autowired
     private ConfigApi configApi;
@@ -204,6 +212,11 @@
             }
         }
 
+        // 修改预测项pyFile参数
+        mmModelArithSettingsService.updatePyFile(dto.getPyModule(),fileName);
+        // 修改调度项pyFile参数
+        stScheduleModelSettingService.updatePyFile(dto.getPyModule(),fileName);
+
         MpkFileEntity entity = ConvertUtils.sourceToTarget(dto, MpkFileEntity.class);
         entity.setUpdater(SecurityFrameworkUtils.getLoginUserId());
         entity.setUpdateDate(new Date());
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmModelArithSettings.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmModelArithSettings.xml
index 822a969..1aa314a 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmModelArithSettings.xml
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmModelArithSettings.xml
@@ -2,6 +2,9 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
 <mapper namespace="com.iailab.module.model.mcs.pre.dao.MmModelArithSettingsDao">
+    <update id="updatePyFile">
+        update t_mm_model_arith_settings set value = #{value} where `key` = 'pyFile' and `value` like CONCAT(#{likeValue},'%')
+    </update>
     <select id="getMmModelArithSettings" resultType="com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity"
             parameterType="map">
         SELECT
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/StScheduleModelSettingDao.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/StScheduleModelSettingDao.xml
new file mode 100644
index 0000000..48e93df
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/StScheduleModelSettingDao.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.iailab.module.model.mcs.sche.dao.StScheduleModelSettingDao">
+    <update id="updatePyFile">
+        update t_st_schedule_model_setting set value = #{value} where `key` = 'pyFile' and `value` like CONCAT(#{likeValue},'%')
+    </update>
+</mapper>
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm
index 1025477..ddf78cf 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm
@@ -23,7 +23,6 @@
 		jstring keyJString = env->NewStringUTF("pyFile");
 		jobject javaValueObj = env->CallObjectMethod(settings, getMID, keyJString);
 		const char* strValue = env->GetStringUTFChars((jstring)javaValueObj, NULL);
-		cout << strValue << endl;
 
 		PyObject* pModule = create_py_module(strValue);
 		/*PyObject* pModule = create_py_module("${pyModule}.${pyName}");*/

--
Gitblit v1.9.3