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

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

* 'master' of http://git_xt.jsxt.jsjtyxt.com/wenhongquan/VisualInspection:
  tt
  tt
  tt
温红权 8 лет назад
Родитель
Сommit
8b17b45922

+ 11 - 6
VisualInspection/js/statistics/change_attendance.js

@@ -21,7 +21,7 @@ $(function(){
         getFsEmployee(GV("#fs_station"),function(obj){
             $("#fs_employee").html(obj);
             // 检索
-            getFsWorkInfo();
+            getFsWorkInfo(0);
         });
     });
 
@@ -40,7 +40,7 @@ $(function(){
 
     // 根据月份确定天数
     monthChange();
-     $("#month_name").html( $("#sel_month").find("option:selected").text());
+     $("#month_name").html( GV("#sel_month"));
 
 
     // 收费站中心选择
@@ -74,8 +74,8 @@ $(function(){
 
     // 查询
     $("#searchBtn").click(function(){        
-        $("#month_name").html( $("#sel_month").find("option:selected").text()  )
-        getFsWorkInfo();
+        $("#month_name").html( GV("#sel_month") )
+        getFsWorkInfo(1);
     })
     // end
 })
@@ -84,7 +84,7 @@ $(function(){
  * 检索出勤明细数据
  * @param {*} param 
  */
-function getFsWorkInfo(){
+function getFsWorkInfo(flag){
 
     var param = {
            "start_time": timeTranslate( GV("#sel_month") ) ,
@@ -100,6 +100,9 @@ function getFsWorkInfo(){
     }
 
     post_common_service("statistics/fs/unregular/work/info",param,function(data){
+        if(flag == 0 && $("#ca-a-table").children().length > 0 ){
+            return ;
+        }
         // 月份变化
         monthChange();
         $("#ca-a-table").empty();
@@ -126,7 +129,9 @@ function getTableContent(obj,seq){
         if(obj.subStatisticsFsWork[z].check_id !=undefined){
             map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] = 2;
         }else{
-            map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] = 1;
+            if(  map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] == null ){
+                map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] = 1;
+            }
         }
     }
     var class_html = [];

+ 14 - 7
VisualInspection/js/statistics/common_attendance.js

@@ -26,7 +26,7 @@ $(function(){
         getFsEmployee(GV("#fs_station"),function(obj){
             $("#fs_employee").html(obj);
             // 检索
-            getFsWorkInfo();
+            getFsWorkInfo(0);
         });
     });
 
@@ -36,13 +36,13 @@ $(function(){
     //     $("#sel_month").append('<option value= "'+ months[i]  +'">'+ months[i] +'</option>');
     // }
 
-
     // 当前月份初始化
     // $("#sel_month").val(months[months.length-1 ]);
 
     // 根据月份确定天数
     monthChange();
-     $("#month_name").html( $("#sel_month").find("option:selected").text());
+ 
+     $("#month_name").html( GV("#sel_month"));
 
 
     // 收费站中心选择
@@ -76,8 +76,8 @@ $(function(){
 
     // 查询
     $("#searchBtn").click(function(){        
-        $("#month_name").html( $("#sel_month").find("option:selected").text()  )
-        getFsWorkInfo();
+        $("#month_name").html( GV("#sel_month") )
+        getFsWorkInfo(1);
     })
     // end
 
@@ -85,7 +85,7 @@ $(function(){
      * 检索出勤明细数据
      * @param {*} param 
      */
-    function getFsWorkInfo(){
+    function getFsWorkInfo(flag){
 
         var param = {
             "start_time": timeTranslate( GV("#sel_month") ) ,
@@ -101,6 +101,9 @@ $(function(){
         }
 
         post_common_service("statistics/fs/work/info",param,function(data){
+            if(flag == 0 && $("#c-a-tbody").children().length > 0 ){
+                return ;
+            }
             // 月份变化
             monthChange();
             $("#c-a-tbody").empty();
@@ -127,9 +130,13 @@ function getTableContent(obj,seq){
     var map_class = {};
     for(var z=0; z < obj.subStatisticsFsWork.length ;z++){
         if(obj.subStatisticsFsWork[z].check_id !=undefined){
+           
             map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] = 2;
+        
         }else{
-            map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] = 1;
+            if(  map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] == null ){
+                map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] = 1;
+            }
         }
     }
     var class_html = [];

+ 2 - 2
VisualInspection/js/statistics/toll_station_statistics.js

@@ -78,7 +78,7 @@ $(function(){
         // 查询图四
 		init_people_score_rank("statistics/stuff/score/info",select_month+'',select_station);
         // 查询图五
-		console.log(select_month+","+select_station);
+		// console.log(select_month+","+select_station);
 		init_server_check_type("statistics/lost/itemscore/rate",select_month+"",select_station);
         // 查询图六
 		init_each_people_points("statistics/lost/twice/itemscore/rate",select_month+"",select_station);
@@ -93,7 +93,7 @@ $(function(){
 			"dept_id":select_station,
 			"queryType":2
 		}		
-		console.log(param);
+		// console.log(param);
 		initRqueset(url,param,1);
 	}
 	

+ 54 - 58
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/StatisticsMapper.xml

@@ -20,11 +20,10 @@
          
     <select id="selectMList"  parameterType="com.xintong.visualinspection.pojo.TaskAndScore" resultType="com.xintong.visualinspection.pojo.TaskAndScore">
    
-    SELECT * from check_task a LEFT JOIN check_score b on a.id=b.task_id where
-          a.monitor_user_id != -1 and a.monitor_user_id != 0 and 
-       a.start_time &gt;= #{start_time} and a.end_time &lt; #{end_time} and a.check_status !=22
-    
-    
+	    SELECT * from check_task a LEFT JOIN check_score b on a.id=b.task_id where
+	          a.monitor_user_id != -1 and a.monitor_user_id != 0 and 
+	       a.start_time &gt;= #{start_time} and a.end_time &lt; #{end_time} and a.check_status !=22
+	    
     </select>
     
     
@@ -97,29 +96,27 @@
 			check_num_t.checked_num , checked_score_t.mth, checked_score_t.checkd_all_score , checked_score_t.checked_person,checked_score_t.checked_dept
 		FROM
 			(
-				SELECT
-					monthfunc (t.start_time) AS mth,
-					sum(m.check_item_score) AS checkd_all_score,
-					t.*
-				FROM
-					check_task t,
-					check_score m
-				WHERE
-					t.id = m.task_id
-				AND t.check_status != 22
-				AND t.checked_person IS NOT NULL
-				<if test="start_date !=null">
-					AND t.start_time >= #{start_date}
-				</if>
-				<if test="end_date !=null">
-					AND t.end_time &lt; #{end_date}
-				</if>
-				<if test="mth!=null and mth!=''">
-					AND monthfunc (t.start_time) =#{mth}
-				</if>
-				GROUP BY
-					mth,
-					t.checked_person
+			SELECT 
+					monthfunc (t.start_time) AS mth, 
+				sum(m.check_item_score) AS checkd_all_score,t.* 
+				FROM 
+				check_score m INNER JOIN 
+				( select * From check_task t 
+						where t.check_status != 22 
+						<if test="start_date !=null">
+							AND t.start_time >= #{start_date}
+						</if>
+						<if test="end_date !=null">
+							AND t.end_time &lt; #{end_date}
+						</if> 
+						<if test="mth!=null and mth!=''">
+							AND monthfunc (t.start_time) =#{mth}
+						</if>
+						  ) t  
+			ON m.task_id = t.id
+				WHERE 1=1
+					GROUP BY mth , t.checked_person
+					
 			) checked_score_t
 		LEFT JOIN (
 			SELECT
@@ -179,7 +176,8 @@
      </sql>
      
      <select id="selectCheckedScoreList" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
-     	SELECT tab.checkd_all_score AS all_check_score,tab.checked_person AS user_id , tab.checked_dept AS dept_id ,tab.checked_num  FROM (  <include refid="selectAllCheckedInfo"/> ) tab 
+     	SELECT tab.checkd_all_score AS all_check_score,tab.checked_person AS user_id , tab.checked_dept AS dept_id ,tab.checked_num  
+     		FROM (  <include refid="selectAllCheckedInfo"/> ) tab 
      	WHERE 1=1 
      	<if test="dept_list!=null and queryType == 1 and dept_list.size()>0 ">
     		AND	tab.checked_dept IN
@@ -194,7 +192,7 @@
      </select>
      
      <select id="selectCheckedItemScoreInfo" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
-     	SELECT count(m.check_item_score) AS checked_num , sum(m.check_item_score) AS all_check_score , m.parent_id,m.check_item_name AS name FROM check_task t INNER JOIN
+     	SELECT count(DISTINCT m.task_id) AS checked_num , sum(m.check_item_score) AS all_check_score , m.parent_id,m.check_item_name AS name FROM check_task t INNER JOIN
 		(
 			select ci.name AS check_item_name , t.* FROM
 			(  SELECT ci.parent_id, t.* from check_score t LEFT JOIN check_item  ci ON t.check_item_id = ci.id
@@ -223,36 +221,34 @@
 			check_num_t.checked_num , checked_score_t.mth, checked_score_t.checkd_all_score AS all_check_score , checked_score_t.checked_person,checked_score_t.checked_dept
 			FROM
 			(
-				SELECT
-					monthfunc (t.start_time) AS mth,
-					sum(m.check_item_score) AS checkd_all_score,
-					t.*
-				FROM
-					check_task t,
-					check_score m
-				WHERE
-					t.id = m.task_id
-				AND t.check_status != 22
-				AND t.checked_person IS NOT NULL
-				<if test="start_date !=null">
-					AND t.start_time >= #{start_date}
-				</if>
-				<if test="end_date !=null">
-					AND t.end_time &lt; #{end_date}
-				</if>
-				<if test="user_id !=null ">
-					AND m.checked_person = #{user_id}
-				</if>
-				GROUP BY mth
+				SELECT 
+					monthfunc (t.start_time) AS mth, 
+				sum(m.check_item_score) AS checkd_all_score,t.* 
+				FROM 
+				check_score m INNER JOIN 
+				( select * From check_task t 
+						where t.check_status != 22 
+						<if test="start_date !=null">
+							AND t.start_time >= #{start_date}
+						</if>
+						<if test="end_date !=null">
+							AND t.end_time &lt; #{end_date}
+						</if>   ) t  
+			ON m.task_id = t.id
+				WHERE 1=1
+					<if test="user_id !=null ">
+						AND m.checked_person = #{user_id}
+					</if>
+					GROUP BY mth
+				
 			) checked_score_t
 		LEFT JOIN (
 			SELECT
-				COUNT(t.checked_person) AS checked_num,
+				COUNT( t.id) AS checked_num,
 				t.checked_person,
-				monthfunc (t.start_time) AS mth,
-				t.id
+				monthfunc (t.start_time) AS mth
 			FROM
-				check_task t
+				check_task t 
 			WHERE
 				t.checked_person IS NOT NULL
 			AND t.check_status != 22
@@ -275,7 +271,7 @@
      </select>
      
      <select id="selectOneCheckedItemInfo" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
-     	SELECT count(m.check_item_score) AS checked_num , sum(m.check_item_score) AS all_check_score , m.parent_id,m.check_item_name AS name FROM check_task t INNER JOIN
+     	SELECT count(DISTINCT m.task_id) AS checked_num , sum(m.check_item_score) AS all_check_score , m.parent_id,m.check_item_name AS name FROM check_task t INNER JOIN
 		(
 			select ci.name AS check_item_name , t.* FROM
 			(  SELECT ci.parent_id, t.* from check_score t LEFT JOIN check_item  ci ON t.check_item_id = ci.id
@@ -302,10 +298,10 @@
      		LEFT JOIN (SELECT ci.* ,cp.name AS parent_name FROM check_item  ci LEFT JOIN check_item cp ON ci.parent_id = cp.id) ci ON ci.id = cs.check_item_id  
      		where   t.check_status !=22
      		<if test="queryType!=null and queryType==0">
-     			AND   t.checked_person = #{user_id}
+     			AND   cs.checked_person = #{user_id}
      		</if>
      		<if test="queryType!=null and queryType==1 and user_id!=null and user_id!=''">
-     			AND  t.checkman = #{user_id}
+     			AND  cs.checkman = #{user_id}
      		</if>
      		<if test="start_date !=null and end_date !=null and queryType ==1">
      			AND t.check_time >= #{start_date} AND t.check_time &lt; #{end_date}

+ 43 - 3
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -101,6 +101,10 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 	public List<StatisticsBo> getEmployeeCheckedInfo(StatisticsBean obj) {
 		// 查看是否有部门id
 		Long organId = obj.getDept_id();
+		// 道管中心 id
+		Long parent_dept_id = obj.getParent_dept_id() ;
+		obj.setParent_dept_id(null);
+		obj.setDept_id(null);
 		// 将检索出来的数据放到如map中
 
 
@@ -264,7 +268,17 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
             }
             
 		}
-		return lists;
+		// 这边进行赛选一下;
+		List<StatisticsBo> reList = new ArrayList<>();
+		for(int i=0; i<lists.size(); i++ ){
+			if(parent_dept_id ==null || lists.get(i).getUser().getParent_organid() == parent_dept_id+0 ){
+				if(organId ==null || lists.get(i).getUser().getOrganid() == organId+0){
+					reList.add(lists.get(i));
+				}
+			}
+		}
+		
+		return reList;
 	}
 
 	@Override
@@ -1006,18 +1020,44 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		obj.setQueryType(2);
 		List<StatisticsBean> t_mthList = getPersonalScoreInfo(obj);
 		Map<Integer, StatisticsBean> t_map = new HashMap<>();
+		
+		int seq =0 ;
+		
 		for (int i = 0; i < t_mthList.size(); i++) {
-			t_mthList.get(i).setRanking(i);
+			if( i == 0 ){
+				seq = 0 	;		
+			}else{
+				if(t_mthList.get(i).compare2To(t_mthList.get(i-1)) == 0){
+					 ;
+				}else{
+					seq = i ;
+				}
+			}
+			t_mthList.get(i).setRanking(seq);	
 			t_map.put(t_mthList.get(i).getUser().getId(), t_mthList.get(i));
 		}
+		
+		 seq = 0 ;
 		// 查询上一个月
 		obj.setMth(obj.getPrev_mth());
 		List<StatisticsBean> prev_mthList = getPersonalScoreInfo(obj);
 		for (int i = 0; i < prev_mthList.size(); i++) {
 			Integer uid = prev_mthList.get(i).getUser().getId();
+			if(i == 0 ){
+				;
+			}else{
+				if(prev_mthList.get(i).compare2To(prev_mthList.get(i-1))==0){
+					;
+				}else{
+					seq = i ;
+				}
+			}
+			
 			if (t_map.containsKey(uid)) {
-				t_map.get(uid).setRanking_change(i - t_map.get(uid).getRanking());
+				t_map.get(uid).setRanking_change(seq - t_map.get(uid).getRanking());
 			}
+			
+			
 		}
 
 		// 这边按照名词变化进行排名