Browse Source

员工排名报表增加公司、道管和收费站排名

chenrj-PC\chenrj 8 years ago
parent
commit
e5b835bc20

+ 28 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/StatisticsBo.java

@@ -4,6 +4,8 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import org.mockito.internal.matchers.CompareTo;
+
 import lombok.Data;
 
 /**
@@ -31,4 +33,30 @@ public class StatisticsBo {
     
     private String check_score;
     
+    // 公司排名
+    private Integer company_ranking;
+    // 道管排名
+    private Integer center_ranking;
+    
+    // 收费站排名
+    private Integer fee_station_ranking;
+    
+    // 比较大小 1 小 , -1 大
+    public int compareTo(StatisticsBo o2){
+    	double a = 1000.0 ,b=1000.0 ;
+		if(this.getChecked_num()!=0 ){
+			a = this.getCheck_all_score() / (this.getChecked_num()+0.00);
+		}
+		if(o2.getChecked_num()!=0){
+			b = o2.getCheck_all_score()/(o2.getChecked_num()+0.00);
+		}
+		if (a > b ) {
+			return 1;
+		} else if (a < b) {
+			return -1;
+		} else {
+			return 0;
+		}	
+    }
+    
 }

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

@@ -102,8 +102,9 @@
     
     <select id="getUsers" parameterType="com.xintong.visualinspection.bean.User" resultMap="BaseResultMap"  >
         SELECT
-        t.* , fs.name AS fee_station_name
+        t.* , fs.name AS fee_station_name,tso.parentid AS parent_organid
         FROM t_sys_users t LEFT JOIN t_br_layer_fee_station fs ON t.organid = fs.organ_id
+        LEFT JOIN t_sys_organ tso ON t.organid = tso.id
         where 1=1 and t.status>0 
         <if test="organid != null and organid != 0">and t.organid = #{organid} </if>
         <if test="username != null">and t.username = #{username} </if>

+ 29 - 20
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -117,28 +117,37 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		lists.sort(new Comparator<StatisticsBo>() {
 			@Override
 			public int compare(StatisticsBo o1, StatisticsBo o2) {
-				if(o1.getChecked_num()!=0 && o2.getChecked_num()!=0){
-					double a = o1.getCheck_all_score() / (o1.getChecked_num()+0.00);
-					double b = o2.getCheck_all_score()/(o2.getChecked_num()+0.00);
-					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);
 			}
 		});
-
+		// 道管Map
+		Map<String,Integer> center_ranking = new HashMap<>();
+		center_ranking.put("30",1);
+		center_ranking.put("31",1);
+		center_ranking.put("32",1);
+		
+		Map<String,Integer> fee_ranking= new HashMap<>();
+		// 这边需要对道管和收费站内的员工进行排名
+		List<FeeStation> list_feeStation = departmentDao.getAllFS();
+		for(FeeStation fee: list_feeStation){
+			fee_ranking.put(fee.getDeptid(), 1);
+		}
+		
+		for(int i=0;i<lists.size();i++){
+			// 累计道管排名
+			String centerId= lists.get(i).getUser().getParent_organid().toString();
+			lists.get(i).setCenter_ranking(center_ranking.get(centerId));
+			center_ranking.put(centerId,center_ranking.get(centerId) +1 );
+
+			// 累计收费站的排名
+			String feeStationId= lists.get(i).getUser().getOrganid().toString();
+			lists.get(i).setFee_station_ranking(fee_ranking.get(feeStationId));
+			fee_ranking.put(feeStationId, fee_ranking.get(feeStationId)+1);
+			
+			// 公司排名
+			lists.get(i).setCompany_ranking(i+1);
+		}
+		
 		return lists;
 	}