chenrj-PC\chenrj 8 лет назад
Родитель
Сommit
d24a0737b2

+ 59 - 2
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -115,7 +115,15 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		// 获取收费站信息收费站人数
 		List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(obj);
 		Map<Long, StatisticsBean> mapStationInfos = new HashMap<>();
+		int i = 0;
 		for (StatisticsBean sta : lists) {
+			if(i++ <7){
+				sta.setId(1);
+			}else if(i++ < 13){
+				sta.setId(2);
+			}else{
+				sta.setId(3);
+			}
 			mapStationInfos.put(sta.getDept_id(), sta);
 		}
 
@@ -143,7 +151,28 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			}
 		}
 
-		return new ArrayList<>(mapStationInfos.values());
+		List<StatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
+		
+		sortList.sort(new Comparator<StatisticsBean>() {
+			@Override
+			public int compare(StatisticsBean o1, StatisticsBean o2) {
+				if(o1.getId()> o2.getId()){
+					return 1;
+				}else if(o1.getId() == o2.getId()){
+					if(o1.getAll_check_score() > o2.getAll_check_score()){
+						return 1;
+					}else if(o1.getAll_check_score() < o2.getAll_check_score()){
+						return -1;
+					}else{
+						return 0 ;
+					}
+				}else{
+					return -1 ;
+				}
+			}
+		});
+		
+		return sortList;
 	}
 
 	@Override
@@ -152,7 +181,15 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		// 获取收费站信息收费站人数
 		List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(obj);
 		Map<Long, StatisticsBean> mapStationInfos = new HashMap<>();
+		int i = 0;
 		for (StatisticsBean sta : lists) {
+			if(i++ <7){
+				sta.setId(1);
+			}else if(i++ < 13){
+				sta.setId(2);
+			}else{
+				sta.setId(3);
+			}
 			mapStationInfos.put(sta.getDept_id(), sta);
 		}
 
@@ -175,7 +212,27 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			}
 		}
 
-		return new ArrayList<>(mapStationInfos.values());
+		List<StatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
+		sortList.sort(new Comparator<StatisticsBean>() {
+			@Override
+			public int compare(StatisticsBean o1, StatisticsBean o2) {
+				if(o1.getId()> o2.getId()){
+					return 1;
+				}else if(o1.getId() == o2.getId()){
+					if(o1.getAll_check_score() > o2.getAll_check_score()){
+						return 1;
+					}else if(o1.getAll_check_score() < o2.getAll_check_score()){
+						return -1;
+					}else{
+						return 0 ;
+					}
+				}else{
+					return -1 ;
+				}
+			}
+		});
+		
+		return sortList;
 
 	}