|
@@ -9,13 +9,17 @@ import com.css.simulation.resource.scheduler.infrastructure.configuration.custom
|
|
|
import com.css.simulation.resource.scheduler.infrastructure.configuration.entity.NodeEntity;
|
|
|
import com.css.simulation.resource.scheduler.infrastructure.configuration.kubernetes.KubernetesConfiguration;
|
|
|
import com.css.simulation.resource.scheduler.infrastructure.configuration.minio.MinioConfiguration;
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.db.entity.AlgorithmExpandEntity;
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.db.entity.SimulationAutomaticProjectEntity;
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.db.entity.SimulationAutomaticSubprojectEntity;
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.db.entity.SimulationManualProjectEntity;
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.db.mysql.mapper.*;
|
|
|
import com.css.simulation.resource.scheduler.infrastructure.entity.PrefixEntity;
|
|
|
import com.css.simulation.resource.scheduler.infrastructure.entity.ProjectEntity;
|
|
|
import com.css.simulation.resource.scheduler.infrastructure.entity.UserEntity;
|
|
|
-import com.css.simulation.resource.scheduler.infrastructure.kubernetes.KubernetesUtil;
|
|
|
-import com.css.simulation.resource.scheduler.infrastructure.mysql.mapper.*;
|
|
|
-import com.css.simulation.resource.scheduler.infrastructure.redis.CustomRedisClient;
|
|
|
-import com.css.simulation.resource.scheduler.infrastructure.redis.RedisUtil;
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.configuration.kubernetes.KubernetesUtil;
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.db.redis.CustomRedisClient;
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.db.redis.RedisUtil;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
@@ -66,15 +70,19 @@ public class ProjectDomainService {
|
|
|
@Resource
|
|
|
private MinioConfiguration minioConfiguration;
|
|
|
@Resource
|
|
|
- private ManualProjectMapper manualProjectMapper;
|
|
|
+ private SimulationManualProjectMapper simulationManualProjectMapper;
|
|
|
@Resource
|
|
|
- private AutoSubProjectMapper autoSubProjectMapper;
|
|
|
+ private SimulationAutomaticProjectMapper simulationAutomaticProjectMapper;
|
|
|
+ @Resource
|
|
|
+ private SimulationAutomaticSubprojectMapper simulationAutomaticSubprojectMapper;
|
|
|
@Resource
|
|
|
private CustomRedisClient customRedisClient;
|
|
|
@Resource
|
|
|
private UserMapper userMapper;
|
|
|
@Resource
|
|
|
private ApiClient apiClient;
|
|
|
+ @Resource
|
|
|
+ private AlgorithmExpandMapper algorithmExpandMapper;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -320,8 +328,8 @@ public class ProjectDomainService {
|
|
|
|
|
|
|
|
|
public ProjectEntity getProjectByProjectId(String projectId) {
|
|
|
- ProjectEntity manualProjectEntity = manualProjectMapper.selectById(projectId);
|
|
|
- ProjectEntity autoSubProjectEntity = autoSubProjectMapper.selectById(projectId);
|
|
|
+ ProjectEntity manualProjectEntity = simulationManualProjectMapper.selectById(projectId);
|
|
|
+ ProjectEntity autoSubProjectEntity = simulationAutomaticSubprojectMapper.selectById(projectId);
|
|
|
if (manualProjectEntity != null) {
|
|
|
return manualProjectEntity;
|
|
|
} else if (autoSubProjectEntity != null) {
|
|
@@ -600,9 +608,9 @@ public class ProjectDomainService {
|
|
|
public PrefixEntity getRedisPrefixByProjectIdAndProjectType(String projectId, String projectType) {
|
|
|
String userId;
|
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
- userId = manualProjectMapper.selectCreateUserById(projectId);
|
|
|
+ userId = simulationManualProjectMapper.selectCreateUserById(projectId);
|
|
|
} else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
- userId = autoSubProjectMapper.selectCreateUserById(projectId);
|
|
|
+ userId = simulationAutomaticSubprojectMapper.selectCreateUserById(projectId);
|
|
|
} else {
|
|
|
throw new RuntimeException("未知的项目类型。");
|
|
|
}
|
|
@@ -802,9 +810,9 @@ public class ProjectDomainService {
|
|
|
|
|
|
public String getModelTypeByProjectIdAndProjectType(String projectId, String projectType) {
|
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
- return manualProjectMapper.selectModelTypeByProjectId(projectId);
|
|
|
+ return simulationManualProjectMapper.selectModelTypeByProjectId(projectId);
|
|
|
} else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
- return autoSubProjectMapper.selectModelTypeByProjectId(projectId);
|
|
|
+ return simulationAutomaticSubprojectMapper.selectModelTypeByProjectId(projectId);
|
|
|
} else {
|
|
|
throw new RuntimeException("未知项目类型:" + projectType);
|
|
|
}
|
|
@@ -812,9 +820,9 @@ public class ProjectDomainService {
|
|
|
|
|
|
public String getUserIdByProjectIdAndProjectType(String projectId, String projectType) {
|
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
- return manualProjectMapper.selectCreateUserById(projectId);
|
|
|
+ return simulationManualProjectMapper.selectCreateUserById(projectId);
|
|
|
} else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
- return autoSubProjectMapper.selectCreateUserById(projectId);
|
|
|
+ return simulationAutomaticSubprojectMapper.selectCreateUserById(projectId);
|
|
|
} else {
|
|
|
throw new RuntimeException("未知项目类型:" + projectType);
|
|
|
}
|
|
@@ -855,9 +863,9 @@ public class ProjectDomainService {
|
|
|
String projectDetailsVOJson = JsonUtil.beanToJson(responseBodyVO.getInfo());
|
|
|
TimeUnit.SECONDS.sleep(3);
|
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
- manualProjectMapper.updateProjectDetails(projectId, projectDetailsVOJson);
|
|
|
+ simulationManualProjectMapper.updateProjectDetails(projectId, projectDetailsVOJson);
|
|
|
} else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
- autoSubProjectMapper.updateProjectDetails(projectId, projectDetailsVOJson);
|
|
|
+ simulationAutomaticSubprojectMapper.updateProjectDetails(projectId, projectDetailsVOJson);
|
|
|
} else {
|
|
|
throw new RuntimeException("未知项目类型:" + projectType);
|
|
|
}
|
|
@@ -884,9 +892,9 @@ public class ProjectDomainService {
|
|
|
String projectReportVOJson = JsonUtil.beanToJson(responseBodyVO.getInfo());
|
|
|
TimeUnit.SECONDS.sleep(3);
|
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
- manualProjectMapper.updateProjectReport(projectId, projectReportVOJson);
|
|
|
+ simulationManualProjectMapper.updateProjectReport(projectId, projectReportVOJson);
|
|
|
} else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
- autoSubProjectMapper.updateProjectReport(projectId, projectReportVOJson);
|
|
|
+ simulationAutomaticSubprojectMapper.updateProjectReport(projectId, projectReportVOJson);
|
|
|
} else {
|
|
|
throw new RuntimeException("未知项目类型:" + projectType);
|
|
|
}
|
|
@@ -946,4 +954,26 @@ public class ProjectDomainService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 如果是算法平台算法则修改状态
|
|
|
+ * @param projectType
|
|
|
+ * @param projectId
|
|
|
+ */
|
|
|
+ public void checkAlgorithmIsExpand(String projectType, String projectId,String algorithmStatus) {
|
|
|
+ String algorithmType;
|
|
|
+ String algorithmId;
|
|
|
+ if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
+ algorithmType = simulationManualProjectMapper.selectAlgorithmTypeById(SimulationManualProjectEntity.builder().id(projectId).build());
|
|
|
+ algorithmId = simulationManualProjectMapper.selectAlgorithmById(SimulationManualProjectEntity.builder().id(projectId).build());
|
|
|
+ } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
+ String automaticProjectId = simulationAutomaticSubprojectMapper.selectParentIdById(SimulationAutomaticSubprojectEntity.builder().id(projectId).build());
|
|
|
+ algorithmType = simulationAutomaticProjectMapper.selectAlgorithmTypeById(SimulationAutomaticProjectEntity.builder().id(automaticProjectId).build());
|
|
|
+ algorithmId = simulationAutomaticProjectMapper.selectAlgorithmById(SimulationAutomaticProjectEntity.builder().id(automaticProjectId).build());
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("未知项目类型:" + projectType);
|
|
|
+ }
|
|
|
+ if(DictConstants.ALGORITHM_UPLOAD_MODE_PLATFORM.equals(algorithmType)) {
|
|
|
+ algorithmExpandMapper.updateStatusByAlgorithmId(AlgorithmExpandEntity.builder().algorithmId(algorithmId).status(algorithmStatus).build());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|