Skip to content

Commit

Permalink
fix:remove the diffDetail in SubSceneInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
rchen9 committed Oct 16, 2024
1 parent a6a0b56 commit 8bd84ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ public class SceneReportService {
*/
public void report(CaseSummary caseSummary) {
SceneInfo sceneInfo = SceneInfo.builder().code(caseSummary.getCode())
.categoryKey(caseSummary.categoryKey())
.planId(caseSummary.getPlanId()).planItemId(caseSummary.getPlanItemId())
.summary(caseSummary).build();
.categoryKey(caseSummary.categoryKey()).planId(caseSummary.getPlanId())
.planItemId(caseSummary.getPlanItemId()).summary(caseSummary).build();
sceneInfoRepository.save(sceneInfo);
}

Expand Down Expand Up @@ -104,9 +103,8 @@ public QuerySceneInfoResponseType querySceneInfo(String planId, String planItemI
QuerySceneInfoResponseType response = new QuerySceneInfoResponseType();
List<SceneInfo> sceneInfos = queryCompleteSceneInfo(planId, planItemId);
sceneInfos = checkDuplicateScene(sceneInfos);
List<QuerySceneInfoResponseType.SceneInfoType> sceneInfoTypes =
sceneInfos.stream().map(SceneInfoMapper.INSTANCE::contractFromDto)
.collect(Collectors.toList());
List<QuerySceneInfoResponseType.SceneInfoType> sceneInfoTypes = sceneInfos.stream()
.map(SceneInfoMapper.INSTANCE::contractFromDto).collect(Collectors.toList());

// to set recordTime and replayTime
Map<String, QuerySceneInfoResponseType.SubSceneInfoType> subSceneInfoTypeMap = new HashMap<>();
Expand All @@ -119,8 +117,7 @@ public QuerySceneInfoResponseType querySceneInfo(String planId, String planItemI
if (MapUtils.isNotEmpty(subSceneInfoTypeMap)) {
List<CompareResultDto> dtos = replayCompareResultRepository.queryCompareResults(planId,
Collections.singletonList(planItemId), new ArrayList<>(subSceneInfoTypeMap.keySet()),
null,
Arrays.asList(RECORD_ID, RECORD_TIME, REPLAY_TIME));
null, Arrays.asList(RECORD_ID, RECORD_TIME, REPLAY_TIME));
for (CompareResultDto dto : dtos) {
String recordId = dto.getRecordId();
QuerySceneInfoResponseType.SubSceneInfoType subSceneInfoType = subSceneInfoTypeMap.get(
Expand Down Expand Up @@ -186,15 +183,14 @@ public List<SceneInfo> queryCompleteSceneInfo(String planId, String planItemId)

Map<String, SubSceneInfo> recordIdToSubSceneInfoMap = new HashMap<>();
sceneInfos.forEach(item -> {

List<SubSceneInfo> subScenes = item.getSubScenes();
if (CollectionUtils.isEmpty(subScenes)) {
Map<String, SubSceneInfo> subSceneInfoMap = item.getSubSceneInfoMap();
if (MapUtils.isEmpty(subSceneInfoMap)) {
return;
}
subScenes.forEach(subSceneInfo -> recordIdToSubSceneInfoMap.put(subSceneInfo.getRecordId(),
subSceneInfo));


subSceneInfoMap.forEach(
(groupKey, subSceneInfo) -> recordIdToSubSceneInfoMap.put(subSceneInfo.getRecordId(),
subSceneInfo)
);
});
List<String> recordIds = new ArrayList<>(recordIdToSubSceneInfoMap.keySet());
List<CaseSummary> caseSummaries = caseSummaryRepository.queryCaseSummary(planId, planItemId,
Expand Down Expand Up @@ -223,15 +219,13 @@ private boolean passCases(String planId, String planItemId, String groupKey) {
LOGGER.info("All the scenes has been passed");
// query other cases in the same subScene
List<CaseSummary> caseSummaryList = caseSummaryRepository.query(planId, planItemId);
List<String> recordIds =
caseSummaryList.stream()
.filter(caseSummary -> String.valueOf(caseSummary.groupKey()).equals(groupKey))
.map(CaseSummary::getRecordId).collect(Collectors.toList());
List<String> recordIds = caseSummaryList.stream()
.filter(caseSummary -> String.valueOf(caseSummary.groupKey()).equals(groupKey))
.map(CaseSummary::getRecordId).collect(Collectors.toList());

// update compareResult
List<CompareResultDto> compareResultList = replayCompareResultRepository.queryCompareResults(
planId,
Collections.singletonList(planItemId), recordIds, null,
planId, Collections.singletonList(planItemId), recordIds, null,
Arrays.asList(RECORD_ID, RECORD_TIME, REPLAY_TIME));
for (CompareResultDto compareResult : compareResultList) {
compareResult.setDiffResultCode(DiffResultCode.COMPARED_WITHOUT_DIFFERENCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public List<CaseSummary> query(String planId, String planItemId) {
@Override
public List<CaseSummary> queryCaseSummary(String planId, String planItemId,
List<String> recordIds) {
if (CollectionUtils.isNotEmpty(recordIds)) {
if (CollectionUtils.isEmpty(recordIds)) {
return Collections.emptyList();
}
Query query = Query.query(Criteria.where(PLAN_ID).is(planId).and(PLAN_ITEM_ID)
Expand Down

0 comments on commit 8bd84ce

Please sign in to comment.