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

+ 2 - 2
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/DepartmentMapper.xml

@@ -90,11 +90,11 @@
         id =#{id} or parentid=#{id}
     </delete>
 
-	<select id="selectFeeStationGroup" resultType="com.xintong.visualinspection.bean.StatisticsBean"  >
+	<select id="selectFeeStationGroup" parameterType="com.xintong.visualinspection.bean.User" resultType="com.xintong.visualinspection.bean.StatisticsBean"  >
 		SELECT COUNT(1) AS people_num,s.ORGAN_ID AS dept_id, s.name from t_sys_users t 
 			       LEFT JOIN t_br_layer_fee_station s ON t.ORGANID = s.ORGAN_ID
 			WHERE 1=1 
-			<if test="position_ids != null and position_ids.size() > 0">AND
+			<if test="position_ids != null and position_ids.size() > 0">
         		AND t.positionid in 
         		<foreach collection="position_ids" item="position_id" index="index"
 		            open="(" close=")" separator=",">

+ 26 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -636,6 +636,32 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			i++ ;
 		}
 		
+		// 进行排序
+		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 centerManageList;
 	}