比较结果按层级升序
This commit is contained in:
parent
13fd8df3f4
commit
24edba0da3
|
|
@ -255,6 +255,54 @@ public class CompareReportService {
|
||||||
compareFunc, queryType,
|
compareFunc, queryType,
|
||||||
ReportConstant.SymbolEnum.NULL_R);
|
ReportConstant.SymbolEnum.NULL_R);
|
||||||
|
|
||||||
|
|
||||||
|
// 比较器排序
|
||||||
|
Collections.sort(compareReportVOList, new Comparator<CompareReportVO>() {
|
||||||
|
@Override
|
||||||
|
public int compare(CompareReportVO p1, CompareReportVO p2) {
|
||||||
|
|
||||||
|
ForwardReportVO item1Left= p1.getLeft();
|
||||||
|
ForwardReportVO item1Right= p1.getRight();
|
||||||
|
|
||||||
|
ForwardReportVO item2Left= p2.getLeft();
|
||||||
|
ForwardReportVO item2Right= p2.getRight();
|
||||||
|
|
||||||
|
int left=0,right=0;
|
||||||
|
|
||||||
|
if (Objects.isNull(item1Left)){
|
||||||
|
left=item1Right.getLevelNum().intValue();
|
||||||
|
}
|
||||||
|
if (Objects.isNull(item1Right)){
|
||||||
|
left=item1Left.getLevelNum().intValue();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(item1Left) && Objects.nonNull(item1Right)){
|
||||||
|
|
||||||
|
left= Math.min(item1Left.getLevelNum(),item1Right.getLevelNum());
|
||||||
|
|
||||||
|
}
|
||||||
|
if (Objects.isNull(item2Left)){
|
||||||
|
right=item2Right.getLevelNum().intValue();
|
||||||
|
}
|
||||||
|
if (Objects.isNull(item2Right)){
|
||||||
|
right=item2Left.getLevelNum().intValue();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(item2Left) && Objects.nonNull(item2Right)){
|
||||||
|
|
||||||
|
right= Math.min(item2Left.getLevelNum(),item2Right.getLevelNum());
|
||||||
|
|
||||||
|
}
|
||||||
|
int diff = left -right;
|
||||||
|
if(diff>0){
|
||||||
|
return 1;
|
||||||
|
}else if( diff<0){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return compareReportVOList;
|
return compareReportVOList;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue