工况库删除添加版本参数,工况库获取添加绑定仿真流程模版名称

This commit is contained in:
daiqy88
2026-01-05 17:02:08 +08:00
parent d08b641d99
commit bd9c510189
4 changed files with 38 additions and 9 deletions

View File

@@ -85,9 +85,9 @@ public class SimuluationTaskPoolController implements ISimuluationTaskPoolFeignC
@GetMapping(value = "/cleanTaskPool")
@ResponseBody
SdmResponse cleanSimulationTaskPool(@RequestParam String poolName)
SdmResponse cleanSimulationTaskPool(@RequestParam String poolName,@RequestParam String version)
{
return service.cleanTaskPool(poolName);
return service.cleanTaskPool(poolName,version);
}
@GetMapping(value = "/getAllTaskPool")

View File

@@ -29,6 +29,9 @@ public interface SimulationPoolMapper {
@Delete("DELETE FROM simulation_pool_versions WHERE poolName=#{poolName}")
int deleteTaskPoolVersion(@Param("poolName")String poolName);
@Delete("DELETE FROM simulation_pool_versions WHERE poolName=#{poolName} AND poolVersion=#{version}")
int deleteTaskPoolSingleVersion(@Param("poolName")String poolName,@Param("version")String version);
@Select("SELECT * FROM simulation_pool_versions WHERE poolName=#{poolName} AND poolVersion=#{version}")
List<TaskPoolVersion> queryTaskPoolVersion(@Param("poolName")String poolName,@Param("version")String version);

View File

@@ -44,7 +44,7 @@ public interface ISimulationTaskPoolService {
SdmResponse getTaskPoolVersions(String poolName);
SdmResponse cleanTaskPool(String poolName);
SdmResponse cleanTaskPool(String poolName,String version);
SdmResponse getAllTaskPool(boolean bCurrent);

View File

@@ -434,6 +434,7 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
JSONObject poolJson = JSONObject.parseObject(contents);
List<SimulatePoolTaskFlowTemplateRelate> templateRelates = mapper.queryTaskFlowRelateByPoolVersion(poolName,version);
Map<String,String> taskFlowMap = new HashMap<>();
Map<String,String> taskFlowNameMap = new HashMap<>();
Map<String,FlowTemplateResp> validFlowTemplateMap = new HashMap<>();
SdmResponse<List<FlowTemplateResp>> validFlowTemplates = simulationFlowFeignClient.queryValidFlowTemplateInfo();
if(validFlowTemplates.isSuccess()) {
@@ -448,15 +449,20 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
{
if(!validFlowTemplateMap.containsKey(relate.flowCode))
continue;
FlowTemplateResp flowTemplate = validFlowTemplateMap.get(relate.flowCode);
String flowTemplates = taskFlowMap.get(relate.taskUuid);
String flowTemplateNames = taskFlowNameMap.get(relate.taskUuid);
if(flowTemplates == null)
{
taskFlowMap.put(relate.taskUuid,relate.flowCode);
taskFlowNameMap.put(relate.taskUuid,flowTemplate.templateName);
}
else
{
flowTemplates += ";"+relate.flowCode;
flowTemplateNames += ";"+flowTemplate.templateName;
taskFlowMap.put(relate.taskUuid,flowTemplates);
taskFlowNameMap.put(relate.taskUuid,flowTemplateNames);
}
}
//获取分析项与知识库关系
@@ -477,7 +483,7 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
for(int i=0;i<nodeArray.size();i++)
{
JSONObject node = nodeArray.getJSONObject(i);
searchNodeAndBindTasks(node, stardardMap, taskFlowMap);
searchNodeAndBindTasks(node, stardardMap, taskFlowMap,taskFlowNameMap);
}
return poolJson.toJSONString();
}
@@ -488,7 +494,7 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
* @param stardardMap
* @param taskFlowMap
*/
private void searchNodeAndBindTasks(JSONObject nodeObject,Map<String, List<FileMetadataInfoResp>> stardardMap,Map<String,String> taskFlowMap)
private void searchNodeAndBindTasks(JSONObject nodeObject,Map<String, List<FileMetadataInfoResp>> stardardMap,Map<String,String> taskFlowMap,Map<String,String> taskFlowNameMap)
{
JSONArray children = nodeObject.getJSONArray("children");
if(children == null || children.isEmpty())
@@ -501,11 +507,11 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
continue;
if(levelType.equalsIgnoreCase("node"))
{
searchNodeAndBindTasks(child,stardardMap,taskFlowMap);
searchNodeAndBindTasks(child,stardardMap,taskFlowMap,taskFlowNameMap);
}
else if(levelType.equalsIgnoreCase("task"))
{
bindTaskRelate(child,stardardMap,taskFlowMap);
bindTaskRelate(child,stardardMap,taskFlowMap,taskFlowNameMap);
}
}
}
@@ -516,16 +522,21 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
* @param stardardMap
* @param taskFlowMap
*/
private void bindTaskRelate(JSONObject taskObject,Map<String, List<FileMetadataInfoResp>> stardardMap,Map<String,String> taskFlowMap)
private void bindTaskRelate(JSONObject taskObject,Map<String, List<FileMetadataInfoResp>> stardardMap,Map<String,String> taskFlowMap,Map<String,String> taskFlowNameMap)
{
String taskUuid = taskObject.getString("uuid");
if(taskUuid == null)
return;
String flowTemplate = taskFlowMap.get(taskUuid);
String flowTemplateNames = taskFlowNameMap.get(taskUuid);
if(flowTemplate != null)
{
taskObject.put("flowTemplate",flowTemplate);
}
if(flowTemplateNames != null)
{
taskObject.put("flowTemplateNames",flowTemplateNames);
}
List<FileMetadataInfoResp> fileMetas = stardardMap.get(taskUuid);
if(fileMetas != null && !fileMetas.isEmpty())
{
@@ -1029,6 +1040,22 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
return response;
}
/**
* 根据版本删除分析项库
* @param poolName
* @param version
* @return
*/
public SdmResponse cleanTaskPool(String poolName,String version)
{
SdmResponse response = SdmResponse.success();
if(mapper.deleteTaskPoolSingleVersion(poolName,version) < 0)
{
response = SdmResponse.failed("删除分析项库版本失败");
}
return response;
}
/**
*清理分析项库
* @param poolName
@@ -1512,7 +1539,6 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
}
}
}
}
response.setData(poolBriefs);
return response;