root 2 anni fa
parent
commit
3135e95953

+ 5 - 6
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/ctrl/AlgorithmCtrl.java

@@ -7,12 +7,11 @@ import api.common.pojo.param.algorithm.AlgorithmParameter;
 import com.css.simulation.resource.algorithm.service.AlgorithmService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
 
 import java.io.IOException;
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
 import java.util.Map;
 
 /**
@@ -129,10 +128,10 @@ public class AlgorithmCtrl {
      */
     @RequestMapping("getGitVersion")
     @ResponseBody
-    public ResponseBodyVO getGitVersion(@RequestBody AlgorithmParameter param) throws IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
+    public ResponseBodyVO<String> getGitVersion(@RequestBody AlgorithmParameter param) {
         String id = param.getId();
         String gitVersion = service.getGitVersion(id);
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,"请求成功", gitVersion);
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,"请求成功", gitVersion);
     }
 
 }

+ 2 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/serviceImpl/AlgorithmServiceImpl.java

@@ -262,9 +262,10 @@ public class AlgorithmServiceImpl implements AlgorithmService {
     public String getGitVersion(String algorithmId) {
         AlgorithmPO algorithmPO = algorithmMapper.selectDetailsById(algorithmId);
         String gitUrl = algorithmPO.getGitUrl();
+        String replace = gitUrl.replace(gitConfiguration.getName(), gitConfiguration.getUrl());
         String gitUserName = algorithmPO.getGitUserName();
         String gitPassword = algorithmPO.getGitPassword();
-        return JgitUtil.getLastCommitTimestamp(gitUrl, gitUserName, gitPassword,
+        return JgitUtil.getLastCommitTimestamp(replace, gitUserName, gitPassword,
                 gitConfiguration.getTempDirectory() + StringUtil.getRandomEightBitUUID()) + "";
     }
 

+ 7 - 8
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -23,7 +23,6 @@ import com.css.simulation.resource.algorithm.mapper.AlgorithmMapper;
 import com.css.simulation.resource.algorithm.service.AlgorithmService;
 import com.css.simulation.resource.common.utils.AuthUtil;
 import com.css.simulation.resource.common.utils.PageUtil;
-import com.css.simulation.resource.configuration.git.GitConfiguration;
 import com.css.simulation.resource.feign.AlgoPlatformService;
 import com.css.simulation.resource.feign.FileDownService;
 import com.css.simulation.resource.feign.MonitorService;
@@ -3698,7 +3697,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
     public ResponseBodyVO updateAutomaticRunState(SimulationManualProjectParam param) {
         String id = param.getId();
         String automaticRunState = param.getAutomaticRunState();
-        Optional.ofNullable(id).orElseThrow(() -> new RuntimeException("id不能为空。"));
+        Optional.ofNullable(id).orElseThrow(() -> new RuntimeException("id 不能为空。"));
         Optional.ofNullable(automaticRunState).orElseThrow(() -> new RuntimeException("自动运行状态不能为空。"));
 
         //1 修改父项目停用状态
@@ -4157,12 +4156,12 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         p.setProjectId(po.getId());
         // 停止任务
         ResponseBodyVO stop = monitorService.stop(p);
-        boolean status = stop.isStatus();
-        if (!status) {
-            //定时任务启动失败,抛出异常
-            log.info("自动运行项目停止失败:" + po.getId());
-            throw new RuntimeException("自动运行项目停止失败:" + po.getId());
-        }
+//        boolean status = stop.isStatus();
+//        if (!status) {
+//            //定时任务关闭失败,抛出异常
+//            log.info("自动运行项目停止失败:" + po.getId());
+//            throw new RuntimeException("自动运行项目停止失败:" + po.getId());
+//        }
     }
 
     /**

+ 28 - 5
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScenePackageService.java

@@ -421,7 +421,7 @@ public class ScenePackageService {
                 };
 
                 //泛化模板
-                String sceneGeneralizationIds=vo.getSceneGeneralizationIds();
+               /* String sceneGeneralizationIds=vo.getSceneGeneralizationIds();
                 if(ObjectUtil.isNotNull(sceneGeneralizationIds)){
                     List<String> sceneGeneralizationIdList=Arrays.asList(sceneGeneralizationIds.split(","));
                     SceneGeneralTemplatePO sceneGeneralTemplatePO=new SceneGeneralTemplatePO();
@@ -433,9 +433,9 @@ public class ScenePackageService {
                         sceneGeneralTemplatePOSy.setShare("1");
                         //是否已存在
                         if(ObjectUtil.isNotNull(sceneGeneralTemplatePOByName)){
-                          /* if(!sceneNaturalPOByName.getShare().equals("1")){
+                          *//* if(!sceneNaturalPOByName.getShare().equals("1")){
 
-                           }*/
+                           }*//*
                             sceneGeneralTemplatePOSy.setId(sceneGeneralTemplatePOByName.getId());
                             sceneGeneralTemplatePOSy.setModifyTime(TimeUtil.getNowForMysql());
                             sceneGeneralTemplatePOSy.setModifyUserId(AuthUtil.getCurrentUserId());
@@ -449,8 +449,31 @@ public class ScenePackageService {
                             sceneGeneralTemplateMapper.saveSceneGeneralTemplate(sceneGeneralTemplatePOSy);
                         }
                     }
-                };
-
+                };*/
+                //泛化
+                String templateId=vo.getTemplateId();
+                if(ObjectUtil.isNotNull(templateId)){
+                    SceneGeneralTemplatePO sceneGeneralTemplatePO=new SceneGeneralTemplatePO();
+                    sceneGeneralTemplatePO.setShare("1");
+                    SceneGeneralTemplatePO sceneGeneralTemplatePOSy = sceneGeneralTemplateMapper.querySceneGeneralTemplateById(templateId);
+                    sceneGeneralTemplatePO.setSceneId(sceneGeneralTemplatePOSy.getSceneId());
+                    SceneGeneralTemplatePO sceneGeneralTemplatePOByName=  sceneGeneralTemplateMapper.querySceneGeneralTemplateByName(sceneGeneralTemplatePO);
+                    sceneGeneralTemplatePOSy.setShare("1");
+                    //是否已存在
+                    if(ObjectUtil.isNotNull(sceneGeneralTemplatePOByName)){
+                    sceneGeneralTemplatePOSy.setId(sceneGeneralTemplatePOByName.getId());
+                    sceneGeneralTemplatePOSy.setModifyTime(TimeUtil.getNowForMysql());
+                    sceneGeneralTemplatePOSy.setModifyUserId(AuthUtil.getCurrentUserId());
+                    sceneGeneralTemplateMapper.updateSceneGeneralTemplate(sceneGeneralTemplatePOSy);
+                }else{
+                    sceneGeneralTemplatePOSy.setId(StringUtil.getRandomUUID());
+                    sceneGeneralTemplatePOSy.setCreateTime(TimeUtil.getNowForMysql());
+                    sceneGeneralTemplatePOSy.setCreateUserId(AuthUtil.getCurrentUserId());
+                    sceneGeneralTemplatePOSy.setModifyTime(TimeUtil.getNowForMysql());
+                    sceneGeneralTemplatePOSy.setModifyUserId("");
+                    sceneGeneralTemplateMapper.saveSceneGeneralTemplate(sceneGeneralTemplatePOSy);
+                }
+                }
 
             }
             if (ObjectUtil.isNotNull(set)) {

+ 2 - 2
simulation-resource-server/src/main/resources/mapper/scene/SystemScenePackageMapper.xml

@@ -74,10 +74,10 @@
             and username like CONCAT('%',#{userName,jdbcType=VARCHAR},'%')
         </if>
         <if test="yearMax != null and yearMax != ''">
-            and #{yearMax,jdbcType=VARCHAR} &gt; modify_time
+            and #{yearMax,jdbcType=VARCHAR} &gt; a.modify_time
         </if>
         <if test="yearMin != null and yearMin != ''">
-            and #{yearMin,jdbcType=VARCHAR} &lt; modify_time
+            and #{yearMin,jdbcType=VARCHAR} &lt; a.modify_time
         </if>
 
         GROUP BY a.username