chenrj-PC\chenrj пре 8 година
родитељ
комит
c0cd2df359

+ 24 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/StatisticsBean.java

@@ -113,4 +113,28 @@ public class StatisticsBean {
     private String check_task_name ;
     
     private String check_task_time_name ;
+    
+    // 比较大小 1 小 , -1 大
+    public int compareTo(StatisticsBean o2){
+    	if(this.getChecked_num()!=0 && o2.getChecked_num()!=0){
+			double a = this.getAll_check_score() / (this.getChecked_num()+0.00) / this.getPeople_num();
+			double b = o2.getAll_check_score() /(o2.getChecked_num()+0.00) / o2.getPeople_num();
+			if (a > b ) {
+				return 1;
+			} else if (a < b) {
+				return -1;
+			} else {
+				return 0;
+			}	
+		}else{
+			if(this.getChecked_num() == 0){
+				return -1 ;
+			}else if(o2.getChecked_num() ==0){
+				return 1;
+			}else{
+				return 0;
+			}
+		}
+    }
+    
 }

+ 11 - 22
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -69,16 +69,14 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 
 		Map<Long, StatisticsBo> statisticBoMap = new HashMap<Long, StatisticsBo>();
 
+		// 检索收费站的人员
 		Constant t =  CodeUtil.getCodeByFlagAndValue("feestation_check_jobs", "1");
-		
 		String[] postions = t.getCode_name().split(",");
-		
 		User user = new User();
 		List<Integer> positionList = new ArrayList<Integer>();
 		for(int i =0 ;i<postions.length;i++){
 			positionList.add(Integer.parseInt(postions[i]));
 		}
-
 		user.setPosition_ids(positionList);
 
 		if (obj.getDept_id() != null)
@@ -105,6 +103,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			}
 		}
 
+		
 		for (StatisticsBean statisticsBean : timesList) {
 			if (statisticBoMap.containsKey(statisticsBean.getUser_id())) {
 				StatisticsBo tmp = statisticBoMap.get(statisticsBean.getUser_id());
@@ -146,6 +145,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			
 			// 公司排名
 			lists.get(i).setCompany_ranking(i+1);
+			
 		}
 		
 		return lists;
@@ -583,6 +583,13 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			}
 		}
 		
+		resultList.sort(new Comparator<StatisticsBean>() {
+			@Override
+			public int compare(StatisticsBean o1, StatisticsBean o2) {
+				return o1.compareTo(o2);
+			}
+		});
+		
 		return resultList;
 	}
 	
@@ -652,25 +659,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		centerManageList.sort(new Comparator<StatisticsBean>() {
 			@Override
 			public int compare(StatisticsBean o1, StatisticsBean o2) {
-				if(o1.getChecked_num()!=0 && o2.getChecked_num()!=0){
-					double a = o1.getAll_check_score() / (o1.getChecked_num()+0.00) / o1.getPeople_num();
-					double b = o2.getAll_check_score() /(o2.getChecked_num()+0.00) / o2.getPeople_num();
-					if (a > b ) {
-						return 1;
-					} else if (a < b) {
-						return -1;
-					} else {
-						return 0;
-					}	
-				}else{
-					if(o1.getChecked_num() == 0){
-						return -1 ;
-					}else if(o2.getChecked_num() ==0){
-						return 1;
-					}else{
-						return 0;
-					}
-				}
+				return o1.compareTo(o2);
 			}
 		});
 		

BIN
VisualInspection_server/src/main/resources/employee_order.xls