Bläddra i källkod

chart statistics

chenrj-PC\chenrj 8 år sedan
förälder
incheckning
37dc3908c4

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

@@ -86,4 +86,9 @@ public class StatisticsBean {
     
     // 收费站名称
     private String feeStationName ;
+    
+    private User user;
+    
+    // 
+    private Integer order_type ;
 }

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/User.java

@@ -26,6 +26,8 @@ public class User implements UserDetails {
 	// 组织机构ID
 	private Integer organid;
 
+	private Integer parent_organid;
+	
 	// 组织机构ID
 	private String organname;
 	// 班次

+ 8 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/StatisticsController.java

@@ -120,4 +120,12 @@ public class StatisticsController extends BaseController {
     	return super.returnSuccessResult(returnMap);
     }
     
+    /**
+     * 获取导管中心前10名,后10名 或者收费站排名
+     */
+    @RequestMapping(value = "/stuff/score/info")
+    public String getPersonalStuffItemInfo(@RequestBody StatisticsBean obj){
+    	List<StatisticsBean> returnList=  statisticsService.getPersonalScoreInfo(obj);
+    	return super.returnSuccessResult(returnList);
+    }
 }

+ 3 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/UserInfoMapper.xml

@@ -110,6 +110,9 @@
         <if test="positionid != null and positionid != 0">and t.positionid = #{positionid} </if>
         <if test="classid != null and classid != 0">and t.classid = #{classid} </if>
         <if test="teamid != null and teamid != 0">and t.teamid = #{teamid} </if>
+        <if test="parent_organid!=null and parent_organid!=0">
+        	and t.organid in ( select id from t_sys_organ where parentid = #{parent_organid}  )
+        </if>
         <if test="position_ids != null and position_ids.size() > 0">AND
         		t.positionid in 
         		<foreach collection="position_ids" item="position_id" index="index"

+ 5 - 6
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/StatisticsMapper.xml

@@ -7,7 +7,7 @@
 			SELECT t.checked_person , t.checked_dept,ci.parent_id, ci.score  FROM check_score t 
 			LEFT JOIN check_item ci ON t.check_item_id = ci.id 
 			LEFT JOIN check_task ct ON ct.id = t.task_id
-			WHERE 1=1 and ct.check_status!=22
+			WHERE 1=1 and ct.check_status!=23
 			<if test="start_date!=null and end_date != null">
 		        AND	 ct.start_time &gt;= #{start_date} AND ct.end_time &lt;= #{end_date} AND ct.check_status != 23
 			</if>
@@ -20,7 +20,7 @@
 
     <select id="selectCheckedTimes" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
     	SELECT COUNT(1) AS checked_num , t.checked_person AS user_id FROM check_task t 
-    	WHERE 1=1 and t.check_status!=22
+    	WHERE 1=1 and t.check_status!=23
 			<if test="start_date!=null and end_date != null">
 		        AND	 t.start_time &gt;= #{start_date} AND t.end_time &lt;= #{end_date}   AND t.check_status != 23
 			</if>
@@ -32,7 +32,7 @@
     
     <select id="selectFeeStationCheckNum" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
     	SELECT COUNT(DISTINCT( t.checked_person )) AS checked_people_num , COUNT(t.checked_person) AS checked_num  ,t.checked_dept AS dept_id FROM check_task  t
-    	WHERE 1=1 and t.check_status!=22
+    	WHERE 1=1 and t.check_status!=23
     		<if test="start_date!=null and end_date != null">
 		        AND	 t.start_time &gt;= #{start_date} AND t.end_time &lt;= #{end_date}   AND t.check_status != 23
 			</if>
@@ -44,7 +44,7 @@
     		FROM check_score t 
     		LEFT JOIN check_item c ON t.check_item_id = c.id
     		LEFT JOIN check_task ct ON ct.id = t.task_id
-    		WHERE 1=1 and ct.check_status!=22
+    		WHERE 1=1 and ct.check_status!=23
     		<if test="start_date!=null and end_date != null">
 		        AND	 ct.start_time &gt;= #{start_date} AND ct.end_time &lt;= #{end_date}  AND ct.check_status != 23
 			</if>
@@ -56,7 +56,7 @@
 			SELECT  t.checked_dept,ci.parent_id, ci.score  FROM check_score t 
 			LEFT JOIN check_item ci ON t.check_item_id = ci.id
 			LEFT JOIN check_task ct ON ct.id = t.task_id
-			WHERE 1=1  and ct.check_status!=22
+			WHERE 1=1  and ct.check_status!=23
 			<if test="start_date!=null and end_date != null">
 		        AND	 ct.start_time &gt;= #{start_date} AND ct.end_time &lt;= #{end_date}  AND ct.check_status != 23
 			</if> )
@@ -188,5 +188,4 @@
 		GROUP BY m.parent_id
      </select>
      
-     
 </mapper>

+ 3 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/StatisticsService.java

@@ -51,4 +51,7 @@ public interface StatisticsService {
 	
 	// 分项具体考核情况占比
 	public Map<String,List<StatisticsBean>> get2CheckedItemScoreInfo(StatisticsBean obj);
+	
+	// 个人得分排名
+	public List<StatisticsBean> getPersonalScoreInfo(StatisticsBean obj);
 }

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

@@ -75,8 +75,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		for(int i =0 ;i<postions.length;i++){
 			positionList.add(Integer.parseInt(postions[i]));
 		}
-//		positionList.add(1);
-//		positionList.add(6);
+
 		user.setPosition_ids(positionList);
 
 		if (obj.getDept_id() != null)
@@ -739,5 +738,104 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		return map;
 	}
 
+	/**
+	 * 道管中心或者收费站考核排名
+	 */	
+	@Override
+	public List<StatisticsBean> getPersonalScoreInfo(StatisticsBean obj) {
+		
+		if(obj.getQueryType() == 1){
+			// 道管中心
+			Organ organ =new Organ();
+			organ.setParentid(obj.getDept_id().intValue());
+			List<Organ> list = departmentDao.getOrgan(organ);
+			// 将导管中心下的收费站部门id 列表放入到list中
+			obj.setDept_list(list);
+		}
+		
+		List<StatisticsBean> userLostScoreInfoList = statisticsDao.selectCheckedScoreList(obj);
+		
+		Map<Long, StatisticsBean> statisticBoMap = new HashMap<Long, StatisticsBean>();
+
+		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.getQueryType() ==2 && obj.getDept_id() != null){
+			user.setOrganid(obj.getDept_id().intValue());			
+		}else if(obj.getQueryType() ==1){
+			// 当前为道管的时候,部门id 
+			user.setParent_organid(obj.getDept_id().intValue());
+		}
+		List<User> listUserts = userInfoDao.getUsers(user);
+		for (User u : listUserts) {
+			u.setPassword(null);
+			if (u.getFee_station_name() != null) {
+				StatisticsBean tmp = new StatisticsBean();
+				tmp.setUser(u);
+				statisticBoMap.put(u.getId() + 0L, tmp);
+			}
+			u.setPosition_name(CacheUtil.getJobnameFromMap(new Long(u.getPositionid())));
+		}
+		
+		
+		for (StatisticsBean statisticsBean : userLostScoreInfoList) {
+			if (statisticBoMap.containsKey(statisticsBean.getUser_id())) {
+				StatisticsBean tmp = statisticBoMap.get(statisticsBean.getUser_id());
+				tmp.setAll_check_score(statisticsBean.getAll_check_score());
+				tmp.setChecked_num(statisticsBean.getChecked_num());
+			}
+		}
+
+		List<StatisticsBean> lists = new ArrayList<>(statisticBoMap.values());
+		// 进行排序
+		lists.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);
+					double b = o2.getAll_check_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;
+					}
+				}
+			}
+		});
+		
+		if(obj.getQueryType()==1 && obj.getOrder_type() ==0 ){
+			// 道管 正序 前10
+			return lists.subList(0, 10);
+		}else if(obj.getQueryType()==1 && obj.getOrder_type() ==1){
+			return lists.subList(lists.size()-10, lists.size());
+		}
+		
+		return lists;
+	}
+	
+	// 获取收费的进步Top5
+	public List<StatisticsBean> getPersonProgressTop5 (StatisticsBean obj){
+		
+		
+		
+		return null ;
+	}
 	
 }