Просмотр исходного кода

Merge branch 'master' of http://git_xt.jsxt.jsjtyxt.com/wenhongquan/VisualInspection

minitiger 8 лет назад
Родитель
Сommit
d6b912864e

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

@@ -81,6 +81,14 @@ public class StatisticsBean {
     // 月份
     private String mth ;
     
+    // 上月
+    private String prev_mth ;
+    
     // 收费站名称
     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;
 	// 班次

+ 28 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/StatisticsController.java

@@ -1,6 +1,7 @@
 package com.xintong.visualinspection.controller;
 
 import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -93,7 +94,7 @@ public class StatisticsController extends BaseController {
     
     
     /**
-     * 考核粘粉情况比
+     * 考核扣分情况比
      */
     @RequestMapping(value = "/lost/score/rate")
     public String getCheckedInfoRate(@RequestBody StatisticsBean obj){
@@ -101,4 +102,30 @@ public class StatisticsController extends BaseController {
     	return super.returnSuccessResult(returnObj);
     }
     
+    /**
+     * 考核扣分项情况比
+     */
+    @RequestMapping(value = "/lost/itemscore/rate")
+    public String getCheckedItemInfoRate(@RequestBody StatisticsBean obj){
+    	List<StatisticsBean> returnList=  statisticsService.getCheckedItemScoreInfo(obj);
+    	return super.returnSuccessResult(returnList);
+    }
+    
+    /**
+     * 考核扣分项两次占比
+     */
+    @RequestMapping(value = "/lost/twice/itemscore/rate")
+    public String getTwiceCheckedItemInfoRate(@RequestBody StatisticsBean obj){
+    	Map<String,List<StatisticsBean>> returnMap=  statisticsService.get2CheckedItemScoreInfo(obj);
+    	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);
+    }
 }

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/master/StatisticsDao.java

@@ -28,4 +28,6 @@ public interface StatisticsDao  {
 	public List<StatisticsBean> selectFeeStationScoreInfo(StatisticsBean obj);
 	
 	public List<StatisticsBean> selectCheckedScoreList(StatisticsBean obj);
+	
+	public List<StatisticsBean> selectCheckedItemScoreInfo(StatisticsBean obj);
 }

+ 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}
 			</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} 
 			</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}
 			</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}
 			</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}
 			</if> )
@@ -188,5 +188,4 @@
 		GROUP BY m.parent_id
      </select>
      
-     
 </mapper>

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

@@ -1,6 +1,7 @@
 package com.xintong.visualinspection.service;
 
 import java.util.List;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -44,4 +45,13 @@ public interface StatisticsService {
 	
 	// 考核扣分情况占比
 	public StatisticsBean getCheckedScoreInfo(StatisticsBean obj);
+	
+	// 分项考核情况占比
+	public List<StatisticsBean> getCheckedItemScoreInfo(StatisticsBean obj);
+	
+	// 分项具体考核情况占比
+	public Map<String,List<StatisticsBean>> get2CheckedItemScoreInfo(StatisticsBean obj);
+	
+	// 个人得分排名
+	public List<StatisticsBean> getPersonalScoreInfo(StatisticsBean obj);
 }

+ 177 - 5
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)
@@ -462,7 +461,6 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			}
 		}
 		
-		
 		List<StatisticsBean> lists = statisticsDao.selectYearScoreInfo(obj);
 		for(StatisticsBean sta:lists){
 			sta.setPeople_num(people_num);
@@ -654,9 +652,9 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		List<StatisticsBean> userLostScoreInfoList = statisticsDao.selectCheckedScoreList(obj);
 		
 		for (StatisticsBean sta : userLostScoreInfoList) {
-			if (sta.getAll_check_score()  <= 15) {
+			if (sta.getAll_check_score() / sta.getChecked_num()  <= 15) {
 				returnObj.setScore_fifteen(returnObj.getScore_fifteen() + 1);
-			} else if (sta.getAll_check_score() <= 50) {
+			} else if (sta.getAll_check_score()/sta.getChecked_num() <= 50) {
 				returnObj.setScore_fifty(returnObj.getScore_fifty() + 1);
 			} else {
 				returnObj.setScore_over_fifty(returnObj.getScore_over_fifty() + 1);
@@ -666,4 +664,178 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		
 		return returnObj;
 	}
+
+	@Override
+	public List<StatisticsBean> getCheckedItemScoreInfo(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);
+		}else if(obj.getQueryType() ==2){
+			// 收费站
+		}
+		return statisticsDao.selectCheckedItemScoreInfo(obj);
+	}
+
+	@Override
+	public Map<String, List<StatisticsBean>> get2CheckedItemScoreInfo(StatisticsBean obj) {
+		
+		Map<String,List<StatisticsBean>> map = new HashMap<>();
+		
+		int people_num = 0 ;
+		
+		if(obj.getQueryType() ==0){
+			// 公司
+			// 公司总人数
+			List<StatisticsBean> feeStationList = userInfoDao.getUsersCountList();
+			if(feeStationList!=null && feeStationList.size()>0){
+				for(StatisticsBean sta : feeStationList){
+					people_num += sta.getPeople_num();
+				}
+			}
+		}else 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);
+			
+			people_num = userInfoDao.getUsersCenterManageCount(obj);
+		}else if(obj.getQueryType() == 2){
+			// 收费站
+			List<StatisticsBean> feeStationList = userInfoDao.getUsersCountList();
+			if(feeStationList!=null && feeStationList.size()>0){
+				for(StatisticsBean sta : feeStationList){
+					if(obj.getDept_id()+0L == sta.getDept_id()){
+						people_num = sta.getPeople_num();
+					}
+				}
+			}
+		}
+		
+		List<StatisticsBean> objList = statisticsDao.selectCheckedItemScoreInfo(obj);
+		
+		for(int i=0;i < objList.size();i++){
+			objList.get(0).setPeople_num(people_num);
+		}
+		
+		map.put("Tmth",objList ) ;
+		
+		obj.setMth(obj.getPrev_mth());
+		
+		objList = statisticsDao.selectCheckedItemScoreInfo(obj);
+		
+		for(int i=0;i < objList.size();i++){
+			objList.get(0).setPeople_num(people_num);
+		}
+		
+		map.put("Pmth",objList );
+		
+		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 ;
+	}
+	
 }