|
@@ -4,6 +4,7 @@ import api.common.pojo.common.ResponseBodyVO;
|
|
|
import api.common.pojo.constants.DictConstants;
|
|
|
import api.common.pojo.param.MinioParameter;
|
|
|
import api.common.pojo.param.algorithm.AlgorithmParameter;
|
|
|
+import api.common.pojo.param.project.SimulationManualProjectParam;
|
|
|
import api.common.pojo.param.system.DictParam;
|
|
|
import api.common.pojo.po.algorithm.AlgorithmPO;
|
|
|
import api.common.pojo.vo.algorithm.AlgorithmVO;
|
|
@@ -18,6 +19,7 @@ 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.SchedulerService;
|
|
|
+import com.css.simulation.resource.project.service.SimulationProjectService;
|
|
|
import com.css.simulation.resource.system.service.DictService;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -39,6 +41,9 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
|
DictService dictService;
|
|
|
GitConfiguration gitConfiguration;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SimulationProjectService simulationProjectService;
|
|
|
+
|
|
|
@Autowired
|
|
|
public AlgorithmServiceImpl(AlgoPlatformService algoPlatformService,
|
|
|
SchedulerService schedulerService,
|
|
@@ -261,11 +266,29 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
|
if (runningProjectVos != null && runningProjectVos.size() > 0) {
|
|
|
StringBuffer stringBuffer = new StringBuffer("");
|
|
|
for (RunningProjectVO vo : runningProjectVos) {
|
|
|
- String projectId = vo.getProjectId();
|
|
|
- stringBuffer.append(projectId + ",");
|
|
|
+ //2022/10/08,删除算法将停止所有使用该算法的正在运行中的工作项目
|
|
|
+ //子项目
|
|
|
+ SimulationManualProjectParam voparam = new SimulationManualProjectParam();
|
|
|
+ voparam.setId(vo.getId());
|
|
|
+ voparam.setNowRunState(DictConstants.PROJECT_TERMINATED);
|
|
|
+ simulationProjectService.updateProjectNowRunState(voparam);
|
|
|
+ }
|
|
|
+
|
|
|
+ //父项目
|
|
|
+ List<RunningProjectVO> runningParentProjectVos = algorithmMapper.selectRunningProjectParent(algorithmId);
|
|
|
+ if (runningParentProjectVos != null && runningParentProjectVos.size() > 0) {
|
|
|
+
|
|
|
+ for (RunningProjectVO voParent : runningParentProjectVos) {
|
|
|
+ SimulationManualProjectParam voparamParent = new SimulationManualProjectParam();
|
|
|
+ stringBuffer.append(voParent.getProjectId() + ",");
|
|
|
+ voparamParent.setId(voParent.getId());
|
|
|
+ voparamParent.setAutomaticRunState("1");
|
|
|
+ simulationProjectService.updateAutomaticRunState(voparamParent);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
String substring = stringBuffer.substring(0, stringBuffer.lastIndexOf(","));
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "已被工作ID:" + substring + " 应用,无法删除!");
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, "该算法已绑定ID:" + substring + " 自动运行项目,删除后该项目将停止自动运行");
|
|
|
} else {
|
|
|
int i = algorithmMapper.deleteByid(param);
|
|
|
if (i > 0) {
|
|
@@ -278,6 +301,27 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResponseBodyVO deleteCheck(AlgorithmParameter param) {
|
|
|
+ if (isEmpty(param.getId())) {
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
+ } else {
|
|
|
+ String algorithmId = param.getId();
|
|
|
+ List<RunningProjectVO> runningParentProjectVos = algorithmMapper.selectRunningProjectParent(algorithmId);
|
|
|
+ if (runningParentProjectVos != null && runningParentProjectVos.size() > 0) {
|
|
|
+ StringBuffer stringBuffer = new StringBuffer("");
|
|
|
+ for (RunningProjectVO voParent : runningParentProjectVos) {
|
|
|
+ stringBuffer.append(voParent.getProjectId() + ",");
|
|
|
+ }
|
|
|
+
|
|
|
+ String substring = stringBuffer.substring(0, stringBuffer.lastIndexOf(","));
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, "该算法已绑定ID:" + substring + " 自动运行项目,删除后该项目将停止自动运行");
|
|
|
+ } else {
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,"该算法未绑定自动运行项目");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public ResponseBodyVO selectDetailsById(String algorithmId) {
|
|
|
if (isEmpty(algorithmId)) {
|