fix: UI报告无结果
This commit is contained in:
parent
28d297fc08
commit
19c53e94b0
|
@ -17,4 +17,5 @@ public class ApiScenarioReportBaseInfoDTO {
|
||||||
private String rspCode;
|
private String rspCode;
|
||||||
private long rspTime;
|
private long rspTime;
|
||||||
private String uiImg;
|
private String uiImg;
|
||||||
|
private Boolean isNotStep;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package io.metersphere.api.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class UiScenarioReportBaseInfoDTO extends ApiScenarioReportBaseInfoDTO {
|
||||||
|
private Boolean isNotStep = false;
|
||||||
|
private String uiImg;
|
||||||
|
}
|
|
@ -99,7 +99,8 @@ public class ApiScenarioReportResultService {
|
||||||
RequestResult result = JSONObject.parseObject(value.toJSONString(), RequestResult.class);
|
RequestResult result = JSONObject.parseObject(value.toJSONString(), RequestResult.class);
|
||||||
ApiScenarioReportBaseInfoDTO baseInfo = getBaseInfo(result);
|
ApiScenarioReportBaseInfoDTO baseInfo = getBaseInfo(result);
|
||||||
baseInfo.setRspTime(result.getEndTime() - result.getStartTime());
|
baseInfo.setRspTime(result.getEndTime() - result.getStartTime());
|
||||||
baseInfo.setUiImg(result.getUrl());
|
baseInfo.setIsNotStep(value.getBooleanValue("isNotStep"));
|
||||||
|
baseInfo.setUiImg(value.getString("uiImg"));
|
||||||
report.setBaseInfo(JSONObject.toJSONString(baseInfo));
|
report.setBaseInfo(JSONObject.toJSONString(baseInfo));
|
||||||
report.setContent(value.toJSONString().getBytes(StandardCharsets.UTF_8));
|
report.setContent(value.toJSONString().getBytes(StandardCharsets.UTF_8));
|
||||||
return report;
|
return report;
|
||||||
|
|
|
@ -506,20 +506,16 @@ public class ApiScenarioReportStructureService {
|
||||||
|
|
||||||
private ApiScenarioReportDTO getReport(String reportId,boolean selectContent) {
|
private ApiScenarioReportDTO getReport(String reportId,boolean selectContent) {
|
||||||
List<ApiScenarioReportResultWithBLOBs> reportResults = null;
|
List<ApiScenarioReportResultWithBLOBs> reportResults = null;
|
||||||
ApiScenarioReport report = scenarioReportMapper.selectByPrimaryKey(reportId);
|
if(selectContent){
|
||||||
if (report.getReportType() != null && report.getReportType().startsWith("UI")) {
|
|
||||||
ApiScenarioReportResultExample example = new ApiScenarioReportResultExample();
|
ApiScenarioReportResultExample example = new ApiScenarioReportResultExample();
|
||||||
example.createCriteria().andReportIdEqualTo(reportId);
|
example.createCriteria().andReportIdEqualTo(reportId);
|
||||||
reportResults = reportResultMapper.selectByExampleWithBLOBs(example);
|
reportResults = reportResultMapper.selectByExampleWithBLOBs(example);
|
||||||
removeUiResultIfNotStep(reportResults);
|
} else {
|
||||||
}else if(selectContent){
|
|
||||||
ApiScenarioReportResultExample example = new ApiScenarioReportResultExample();
|
|
||||||
example.createCriteria().andReportIdEqualTo(reportId);
|
|
||||||
reportResults = reportResultMapper.selectByExampleWithBLOBs(example);
|
|
||||||
}else {
|
|
||||||
reportResults = this.selectBaseInfoResultByReportId(reportId);
|
reportResults = this.selectBaseInfoResultByReportId(reportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeUiResultIfNotStep(reportResults, reportId);
|
||||||
|
|
||||||
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
||||||
structureExample.createCriteria().andReportIdEqualTo(reportId);
|
structureExample.createCriteria().andReportIdEqualTo(reportId);
|
||||||
List<ApiScenarioReportStructureWithBLOBs> reportStructureWithBLOBs = mapper.selectByExampleWithBLOBs(structureExample);
|
List<ApiScenarioReportStructureWithBLOBs> reportStructureWithBLOBs = mapper.selectByExampleWithBLOBs(structureExample);
|
||||||
|
@ -575,16 +571,19 @@ public class ApiScenarioReportStructureService {
|
||||||
*
|
*
|
||||||
* @param reportResults
|
* @param reportResults
|
||||||
*/
|
*/
|
||||||
private void removeUiResultIfNotStep(List<ApiScenarioReportResultWithBLOBs> reportResults) {
|
private void removeUiResultIfNotStep(List<ApiScenarioReportResultWithBLOBs> reportResults, String reportId) {
|
||||||
if(CollectionUtils.isNotEmpty(reportResults)){
|
ApiScenarioReport report = scenarioReportMapper.selectByPrimaryKey(reportId);
|
||||||
Iterator<ApiScenarioReportResultWithBLOBs> iterator = reportResults.iterator();
|
if (report.getReportType() != null && report.getReportType().startsWith("UI")) {
|
||||||
while (iterator.hasNext()) {
|
if(CollectionUtils.isNotEmpty(reportResults)){
|
||||||
ApiScenarioReportResultWithBLOBs item = iterator.next();
|
Iterator<ApiScenarioReportResultWithBLOBs> iterator = reportResults.iterator();
|
||||||
String result = new String(item.getContent(), StandardCharsets.UTF_8);
|
while (iterator.hasNext()) {
|
||||||
if (StringUtils.isNotBlank(result)) {
|
ApiScenarioReportResultWithBLOBs item = iterator.next();
|
||||||
Boolean isNoStep = JSONObject.parseObject(result).getBoolean("isNotStep");
|
String baseInfo = item.getBaseInfo();
|
||||||
if (BooleanUtils.isTrue(isNoStep)) {
|
if (StringUtils.isNotBlank(baseInfo)) {
|
||||||
iterator.remove();
|
Boolean isNoStep = JSONObject.parseObject(baseInfo).getBoolean("isNotStep");
|
||||||
|
if (BooleanUtils.isTrue(isNoStep)) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue