parent
e5d1e6e68b
commit
09798b8d51
|
@ -911,6 +911,24 @@ public class AtuPlanTaskApiServiceImpl extends AbstractExcelService<AtuPlanTask>
|
||||||
TaskCaseStepDetailDto detailDto) {
|
TaskCaseStepDetailDto detailDto) {
|
||||||
// 获取脚本执行结果信息
|
// 获取脚本执行结果信息
|
||||||
Map<String, StepExecuteResult> stepResultMap = new HashMap<>();
|
Map<String, StepExecuteResult> stepResultMap = new HashMap<>();
|
||||||
|
|
||||||
|
JSONArray commands = scriptJson.getJSONArray(MsgConstant.COMMANDS);
|
||||||
|
Map<String, String> groupMap = new HashMap<>();
|
||||||
|
for (Object command : commands) {
|
||||||
|
cn.hutool.json.JSONObject commandJson = JSONUtil.parseObj(command);
|
||||||
|
String commandName = commandJson.getStr(MsgConstant.COMMAND);
|
||||||
|
if ("group".equalsIgnoreCase(commandName)) {
|
||||||
|
String groupStepId = commandJson.getStr(MsgConstant.ID);
|
||||||
|
Object children = commandJson.get(MsgConstant.CHILDREN);
|
||||||
|
cn.hutool.json.JSONArray childrenArray = JSONUtil.parseArray(children);
|
||||||
|
for (Object child : childrenArray) {
|
||||||
|
cn.hutool.json.JSONObject childJson = JSONUtil.parseObj(child);
|
||||||
|
String childId = childJson.getStr(MsgConstant.ID);
|
||||||
|
groupMap.put(childId, groupStepId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String stepId = "";
|
String stepId = "";
|
||||||
if (StrUtil.isNotEmpty(execResultFile)) {
|
if (StrUtil.isNotEmpty(execResultFile)) {
|
||||||
// 读取结果文件信息
|
// 读取结果文件信息
|
||||||
|
@ -928,7 +946,8 @@ public class AtuPlanTaskApiServiceImpl extends AbstractExcelService<AtuPlanTask>
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
StepExecuteResult stepExecuteResult = JSONUtil.toBean(line, StepExecuteResult.class);
|
StepExecuteResult stepExecuteResult = JSONUtil.toBean(line, StepExecuteResult.class);
|
||||||
processStepResult(stepExecuteResult, stepResultMap, "");
|
String groupId = groupMap.get(stepExecuteResult.getStepId());
|
||||||
|
processStepResult(stepExecuteResult, stepResultMap, groupId);
|
||||||
if (stepExecuteResult.getStepId() != null && stepExecuteResult.getStepId().startsWith("3e9da7b7c")) { // 用于只输出对应异常数据的详情,可以删除判断,每一个查询进行输出,日志增多而已
|
if (stepExecuteResult.getStepId() != null && stepExecuteResult.getStepId().startsWith("3e9da7b7c")) { // 用于只输出对应异常数据的详情,可以删除判断,每一个查询进行输出,日志增多而已
|
||||||
stepId = stepExecuteResult.getStepId();
|
stepId = stepExecuteResult.getStepId();
|
||||||
stepResultMap.forEach((key, value) -> {
|
stepResultMap.forEach((key, value) -> {
|
||||||
|
@ -948,7 +967,7 @@ public class AtuPlanTaskApiServiceImpl extends AbstractExcelService<AtuPlanTask>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONArray commands = JSONUtil.parseArray(scriptJson.get(MsgConstant.COMMANDS));
|
commands.forEach(one -> checkGroup(stepResultMap, one));
|
||||||
List<TaskCaseStepDetailDto> resultList = processStepData(commands, stepResultMap, scriptJson, detailDto, 0, false, false, "");
|
List<TaskCaseStepDetailDto> resultList = processStepData(commands, stepResultMap, scriptJson, detailDto, 0, false, false, "");
|
||||||
if (StringUtils.isNotBlank(stepId)) {
|
if (StringUtils.isNotBlank(stepId)) {
|
||||||
for (TaskCaseStepDetailDto dto : resultList) { // 用于只输出对应异常数据的详情,可以删除判断,每一个查询进行输出,日志增多而已
|
for (TaskCaseStepDetailDto dto : resultList) { // 用于只输出对应异常数据的详情,可以删除判断,每一个查询进行输出,日志增多而已
|
||||||
|
@ -958,6 +977,30 @@ public class AtuPlanTaskApiServiceImpl extends AbstractExcelService<AtuPlanTask>
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkGroup(Map<String, StepExecuteResult> stepResultMap, Object command) {
|
||||||
|
cn.hutool.json.JSONObject commandJson = JSONUtil.parseObj(command);
|
||||||
|
String commandStr = commandJson.getStr(MsgConstant.COMMAND);
|
||||||
|
String groupStepId = commandJson.getStr(MsgConstant.ID);
|
||||||
|
if ("group".equalsIgnoreCase(commandStr)) {
|
||||||
|
Object children = commandJson.get(MsgConstant.CHILDREN);
|
||||||
|
if (null != children) {
|
||||||
|
cn.hutool.json.JSONArray childrenArray = JSONUtil.parseArray(children);
|
||||||
|
childrenArray.forEach(child -> {
|
||||||
|
cn.hutool.json.JSONObject childJson = JSONUtil.parseObj(child);
|
||||||
|
String childId = childJson.getStr(MsgConstant.ID);
|
||||||
|
StepExecuteResult stepExecuteResult = stepResultMap.get(String.format("%s.%s", groupStepId, childId));
|
||||||
|
if (null != stepExecuteResult && stepExecuteResult.isExecuted()) {
|
||||||
|
StepExecuteResult groupResult = new StepExecuteResult();
|
||||||
|
groupResult.setExecuted(true);
|
||||||
|
groupResult.setStepId(groupStepId);
|
||||||
|
stepResultMap.put(groupStepId, groupResult);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 步骤执行结果处理
|
* 步骤执行结果处理
|
||||||
*
|
*
|
||||||
|
@ -1092,14 +1135,16 @@ public class AtuPlanTaskApiServiceImpl extends AbstractExcelService<AtuPlanTask>
|
||||||
stepDetailDto.setExecResult(childSuccess);
|
stepDetailDto.setExecResult(childSuccess);
|
||||||
stepDetailDto.setExecuted(childExecuted);
|
stepDetailDto.setExecuted(childExecuted);
|
||||||
// 处理子步骤
|
// 处理子步骤
|
||||||
if (PlanConstant.GROUP_COMMAND.equals(commandStr)) {
|
// if (PlanConstant.GROUP_COMMAND.equals(commandStr)) {
|
||||||
// 分区步骤结果特殊处理,分区下的步骤执行结果不在分区步骤的childResult中
|
// // 分区步骤结果特殊处理,分区下的步骤执行结果不在分区步骤的childResult中
|
||||||
stepDetailDto.setStepList(processStepData(commandJson.getJSONArray(MsgConstant.CHILDREN), stepResultMap,
|
// stepDetailDto.setStepList(processStepData(commandJson.getJSONArray(MsgConstant.CHILDREN), stepResultMap,
|
||||||
scriptJson, stepDetailDto, num, childSuccess, childExecuted, ""));
|
// scriptJson, stepDetailDto, num, childSuccess, childExecuted, ""));
|
||||||
} else {
|
// } else {
|
||||||
|
// stepDetailDto.setStepList(processStepData(commandJson.getJSONArray(MsgConstant.CHILDREN), stepResultMap,
|
||||||
|
// scriptJson, stepDetailDto, num, childSuccess, childExecuted, stepId));
|
||||||
|
// }
|
||||||
stepDetailDto.setStepList(processStepData(commandJson.getJSONArray(MsgConstant.CHILDREN), stepResultMap,
|
stepDetailDto.setStepList(processStepData(commandJson.getJSONArray(MsgConstant.CHILDREN), stepResultMap,
|
||||||
scriptJson, stepDetailDto, num, childSuccess, childExecuted, stepId));
|
scriptJson, stepDetailDto, num, childSuccess, childExecuted, stepId));
|
||||||
}
|
|
||||||
// 判断是否内部组件
|
// 判断是否内部组件
|
||||||
if (ObjectUtil.equal(PlanConstant.INTERNAL_COMPONENT_LIB, componentLib)) {
|
if (ObjectUtil.equal(PlanConstant.INTERNAL_COMPONENT_LIB, componentLib)) {
|
||||||
if (ObjectUtil.equal(PlanConstant.INTERFACE_STEP_TYPE, stepType) ||
|
if (ObjectUtil.equal(PlanConstant.INTERFACE_STEP_TYPE, stepType) ||
|
||||||
|
|
Loading…
Reference in New Issue