修复流程模版及分析项库故障

This commit is contained in:
daiqy88
2025-12-22 08:58:25 +08:00
parent bf26f136c0
commit 864c8b1f0a
6 changed files with 97 additions and 9 deletions

View File

@@ -78,7 +78,7 @@ public class FlowController implements ISimulationFlowFeignClient {
@SysLog("查询流程模版")
@PostMapping("/queryFlowTemplate")
public SdmResponse queryFlowTemplate(@RequestBody @Validated GetFlowTemplateReq req) {
return IFlowService.getReleaseFlowTemplateByCondition(req.templateType,req.templateName,req.approveType,req.beginTime,req.endTime,req.creator,req.current,req.size,req.type,req.templateStatus);
return IFlowService.getReleaseFlowTemplateByCondition(req.templateType,req.templateName,req.approveType,req.createTime,req.creator,req.current,req.size,req.type,req.templateStatus);
}
/**

View File

@@ -5,6 +5,8 @@ import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.req.system.LaunchApproveReq;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public interface IFlowService {
@@ -49,12 +51,11 @@ public interface IFlowService {
* @param templateType
* @param templateName
* @param approveType
* @param beginTime
* @param endTime
* @param createTime
* @param creator
* @return
*/
SdmResponse getReleaseFlowTemplateByCondition(String templateType,String templateName,int approveType,String beginTime,String endTime,long creator,int current,int size,int type,int templateStatus);
SdmResponse getReleaseFlowTemplateByCondition(String templateType, String templateName, int approveType, List<String> createTime, long creator, int current, int size, int type, int templateStatus);
/**

View File

@@ -153,6 +153,10 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
{
response = SdmResponse.failed("添加流程模版草稿失败");
}
/*else
{
bindFLowTemplateAndTask(flowTemplate.templateCode,flowTemplate.simulationPoolInfoList);
}*/
return response;
}
@@ -268,7 +272,7 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
}
@Override
public SdmResponse getReleaseFlowTemplateByCondition(String templateType,String templateName,int approveType,String beginTime,String endTime,long creator,int current,int size,int type,int templateStatus) {
public SdmResponse getReleaseFlowTemplateByCondition(String templateType,String templateName,int approveType,List<String> createTime,long creator,int current,int size,int type,int templateStatus) {
SdmResponse response = SdmResponse.success();
long tenantId = ThreadLocalContext.getTenantId();
String condition = "true";
@@ -279,7 +283,7 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
if(templateName != null && !templateName.isEmpty())
{
condition += " AND templateName='"+templateName+"' ";
condition += " AND templateName LIKE '%"+templateName+"%' ";
}
if(templateStatus >= 0)
@@ -304,7 +308,16 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
condition += " AND creator="+userId;
}
String beginTime = "";
String endTime = "";
if(!createTime.isEmpty())
{
beginTime = createTime.get(0);
if(createTime.size() > 1)
{
endTime = createTime.get(1);
}
}
String timeCondition = Tools.timeRange("createTime",beginTime,endTime);
if(!timeCondition.isEmpty())
{

View File

@@ -63,9 +63,9 @@ public class SimuluationTaskPoolController implements ISimuluationTaskPoolFeignC
@GetMapping(value = "/getTaskPoolPerformance")
@ResponseBody
SdmResponse getSimulationTaskToolPerformance(@RequestParam String poolName)
SdmResponse getSimulationTaskToolPerformance(@RequestParam String poolName,@RequestParam String version)
{
return service.getSimulationPoolPerformance(poolName);
return service.getSimulationPoolPerformanceByVersion(poolName,version);
}
@GetMapping(value = "/getTaskPoolVersions")

View File

@@ -31,6 +31,8 @@ public interface ISimulationTaskPoolService {
SdmResponse getSimulationPoolPerformance(String poolName);
SdmResponse getSimulationPoolPerformanceByVersion(String poolName,String version);
SdmResponse getSimulationPoolTasks(String poolName,String version);
SdmResponse<Map<String, TaskBaseInfo>> getSimulationTasksByPoolId(long poolId);

View File

@@ -712,6 +712,77 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
return response;
}
/**
* 遍历节点下所有的性能指标
* @param node
* @param performances
*/
private void traverseNodePerformance(JSONObject node,List<TaskPoolPerformance> performances)
{
JSONArray children = node.getJSONArray("children");
if(children == null)
return;
for(int index=0; index<children.size(); index++)
{
JSONObject child = children.getJSONObject(index);
String levelType = child.getString("levelType");
if(levelType == null)
continue;
if(levelType.equals("node"))
{
traverseNodePerformance(child,performances);
}
else if(levelType.equals("task"))
{
ObjectMapper objectMapper = new ObjectMapper();
TaskPoolItem taskPoolItem = objectMapper.convertValue(child,TaskPoolItem.class);
JSONArray performancesArray = child.getJSONArray("children");
if(performancesArray == null)
continue;
for(int i=0; i<performancesArray.size(); i++)
{
JSONObject performanceObject = performancesArray.getJSONObject(i);
TaskPoolPerformance performance = objectMapper.convertValue(performanceObject,TaskPoolPerformance.class);
performance.taskName = taskPoolItem.nodeName;
performance.standard = taskPoolItem.standard;
performance.pId = taskPoolItem.id;
performance.pUuid = taskPoolItem.uuid;
performances.add(performance);
}
}
}
}
/**
* 查询分析库版本中的所有指标
* @param poolName
* @param version
* @return
*/
public SdmResponse getSimulationPoolPerformanceByVersion(String poolName,String version)
{
SdmResponse response = new SdmResponse();
String poolContents = mapper.queryTaskPoolVersionContent(poolName,version);
List<TaskPoolPerformance> performances = new ArrayList<>();
try {
JSONObject taskTreeObject = JSONObject.parseObject(poolContents);
JSONArray nodeArray = taskTreeObject.getJSONArray("nodes");
if(nodeArray != null)
{
for(int i = 0; i < nodeArray.size(); i++)
{
JSONObject nodeObject = nodeArray.getJSONObject(i);
traverseNodePerformance(nodeObject,performances);
}
}
}catch (Exception e) {
e.printStackTrace();
}
response.setData(performances);
return response;
}
/**
* 获取分析库中所有指标
* @param poolName
@@ -1475,6 +1546,7 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
mapper.addTaskPoolBreif(currPoolBrief);
poolVersion.poolId = currPoolBrief.id;
TaskPoolTree poolTree = (TaskPoolTree) treeRespond.getData();
poolTree.poolBrief = currPoolBrief;
poolVersion.versionContents = JSONObject.toJSONString(poolTree);
mapper.addTaskPoolVersion(poolVersion);
}