浏览代码

修改bug

chenrj-PC\chenrj 8 年之前
父节点
当前提交
597bfdb637

+ 2 - 1
VisualInspection/js/statistics/business_promotion_feedback.js

@@ -200,7 +200,7 @@ function getEmployeeInfosClick(url, param, start_score, end_score, start_num, en
                     "<td width='4%;'>" + filter(data[i].check_x_score, '0') + "</td><td width='4%'>" + filter(data[i].check_s_num, '0') + "</td><td width='4%;'>" +
                     filter(data[i].check_s_score, '0') + "</td><td width='4%;'>" + filter(data[i].check_all_num, '0') + "</td>" +
                     "<td width='4%;'>" +  filter(data[i].check_all_score, '0') + "</td><td width='4%;'>" + filterSlash(filterByZeroHandle(data[i].check_score_avg, '0'), filter(data[i].checked_num  + data[i].check_t_num  + data[i].check_x_num + data[i].check_s_num, '0')) + "</td>" +
-                    "<td width='4%;'>" + filterSlash(score, filter(data[i].score + data[i].check_t_score + data[i].check_x_score + data[i].check_s_score, '0')) + "</td>" + "<td width='4%;'>" + "</td></tr>";
+                    "<td width='4%;'>" + filterSlash(score.toFixed(2), filter(data[i].score + data[i].check_t_score + data[i].check_x_score + data[i].check_s_score, '0')) + "</td>" + "<td width='4%;'>" + "</td></tr>";
                 count++;
             }
         }
@@ -298,6 +298,7 @@ function getItemScore(obj, check_item_name) {
  * @param {*} default_display_value
  */
 function filterByZeroHandle(value, default_display_value) {
+    debugger
     if (isNaN(value)) {
         return default_display_value;
     } else {

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

@@ -85,4 +85,29 @@ public class StatisticsBo {
 		}	
     }
     
+    public int compareTo2(StatisticsBo o2){
+    	double a = 1000.0 ,b=1000.0 ;
+    	int a_c = this.getCheck_all_num() ;
+    	int b_c = o2.getCheck_all_num();
+		if(a_c!=0 ){
+			a = (this.getCheck_all_score()) / (a_c+0.00);
+		}
+		if(b_c!=0){
+			b = (o2.getCheck_all_score()) /(b_c+0.00);
+		}
+	
+		if (a > b ) {
+			return 1;
+		} else if (a < b) {
+			return -1;
+		} else {
+			if(a_c == 0 && b_c!=0 ){
+				return -1 ;
+			}else if(b_c ==0 && a_c != 0){
+				return 1;
+			}else{
+				return 0;
+			}
+		}	
+    }
 }

+ 23 - 7
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/StatisticsMapper.xml

@@ -40,10 +40,25 @@
 
 	
    <select id="selectBFStatistics" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
-	SELECT x.user_id,x.dept_id,IFNULL(x.checked_num,0)+IFNULL(o1.check_a_num,0) checked_num,IFNULL(x.score,0)+IFNULL(o1.check_a_score,0) score,o2.check_t_num,o2.check_t_score,o3.check_x_num,o3.check_x_score,o4.check_s_num,o4.check_s_score  
+	SELECT y.user_id,y.dept_id,IFNULL(x.checked_num,0)+IFNULL(o1.check_a_num,0) checked_num,IFNULL(x.score,0)+IFNULL(o1.check_a_score,0) score,o2.check_t_num,o2.check_t_score,o3.check_x_num,o3.check_x_score,o4.check_s_num,o4.check_s_score  
 		,IFNULL(x.checked_num,0)+IFNULL(o1.check_a_num,0)+IFNULL(o2.check_t_num,0)+IFNULL(o3.check_x_num,0)+IFNULL(o4.check_s_num,0) check_all_num
 		,IFNULL(x.score,0)+IFNULL(o1.check_a_score,0)+IFNULL(o2.check_t_score,0)+IFNULL(o3.check_x_score,0)+IFNULL(o4.check_s_score,0) check_all_score
-		FROM(SELECT  u.checked_person AS user_id , u.checked_dept AS dept_id,count(1) AS checked_num,sum(u.score) AS score  FROM (
+		FROM
+		
+		 ( select ORGANID AS dept_id , id AS user_id from t_sys_users t where 1=1  
+		  <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=",">
+                #{position_id}
+            </foreach>
+        </if>
+		  <if test="dept_id!=null">
+			AND t.ORGANID =#{dept_id}			
+		</if>
+		  ) y LEFT JOIN
+		
+		(SELECT  u.checked_person AS user_id , u.checked_dept AS dept_id,count(1) AS checked_num,sum(u.score) AS score  FROM (
 		SELECT t.checked_person , t.checked_dept,ci.parent_id, t.check_item_score AS 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
@@ -55,11 +70,12 @@
 			AND t.checked_dept =#{dept_id}			
 		</if>
 		 ) 
-		u LEFT JOIN check_item s ON u.parent_id = s.id GROUP  BY checked_person)x
-		LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_a_num,SUM(check_score) check_a_score FROM other_check WHERE check_type = 1 GROUP BY user_id,dept_id)  o1 ON o1.user_id = x.user_id AND x.dept_id = o1.dept_id
-		LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_t_num,SUM(check_score) check_t_score FROM other_check WHERE check_type = 2 GROUP BY user_id,dept_id)  o2 ON o2.user_id = x.user_id AND x.dept_id = o2.dept_id
-		LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_x_num,SUM(check_score) check_x_score FROM other_check WHERE check_type = 3 GROUP BY user_id,dept_id)  o3 ON o3.user_id = x.user_id AND x.dept_id = o3.dept_id
-		LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_s_num,SUM(check_score) check_s_score FROM other_check WHERE check_type = 4 GROUP BY user_id,dept_id)  o4 ON o4.user_id = x.user_id AND x.dept_id = o4.dept_id
+		u LEFT JOIN check_item s ON u.parent_id = s.id GROUP  BY checked_person) x
+		ON y.user_id = x.user_id AND y.dept_id =  x.dept_id
+		LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_a_num,SUM(check_score) check_a_score FROM other_check WHERE check_type = 1 GROUP BY user_id,dept_id)  o1 ON o1.user_id = y.user_id AND y.dept_id = o1.dept_id
+		LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_t_num,SUM(check_score) check_t_score FROM other_check WHERE check_type = 2 GROUP BY user_id,dept_id)  o2 ON o2.user_id = y.user_id AND y.dept_id = o2.dept_id
+		LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_x_num,SUM(check_score) check_x_score FROM other_check WHERE check_type = 3 GROUP BY user_id,dept_id)  o3 ON o3.user_id = y.user_id AND y.dept_id = o3.dept_id
+		LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_s_num,SUM(check_score) check_s_score FROM other_check WHERE check_type = 4 GROUP BY user_id,dept_id)  o4 ON o4.user_id = y.user_id AND y.dept_id = o4.dept_id
 		
 		
     </select>

+ 12 - 10
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -2044,6 +2044,16 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 
 	@Override
 	public List<StatisticsBo> getBusinessFeedbackInfo(StatisticsBean obj) {
+		
+		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);
+		
 		// 查看是否有部门id
 		Long organId = obj.getDept_id();
 		// 道管中心 id
@@ -2051,6 +2061,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 //		obj.setParent_dept_id(null);
 //		obj.setDept_id(null);
 		// 将检索出来的数据放到如map中
+		obj.setPosition_ids(positionList);
 		List<StatisticsBean> list = statisticsDao.selectBFStatistics(obj);
 
 //		List<StatisticsBean> timesList = statisticsDao.selectCheckedTimes(obj);
@@ -2058,15 +2069,6 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		Map<Long, StatisticsBo> statisticBoMap = new HashMap<Long, StatisticsBo>();
 
 		// 检索收费站的人员
-		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.getDept_id() != null) {
 			user.setOrganid(obj.getDept_id().intValue());
 		}
@@ -2108,7 +2110,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		lists.sort(new Comparator<StatisticsBo>() {
 			@Override
 			public int compare(StatisticsBo o1, StatisticsBo o2) {
-				return o1.compareTo(o2);
+				return o1.compareTo2(o2);
 			}
 		});