Răsfoiți Sursa

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

* 'master' of http://git_xt.jsxt.jsjtyxt.com/wenhongquan/VisualInspection:
  tt
  tt
温红权 8 ani în urmă
părinte
comite
04fc95e9f4

+ 8 - 1
VisualInspection/js/statistics/assess_ranking.js

@@ -763,6 +763,12 @@ function exportExcel() {
     var end_date = $("#end-time").val();
     var start_score = $("#start-score").val();
     var end_score = $("#end-score").val();
+    var parent_dept_id = $("#center-manager").val();
+    var max_score =  $("#end-score").val() ;
+    var min_score = $("#start-score").val() ;
+    var min_check_num = $("#start-num").val() ;
+    var max_check_num = $("#end-num").val() ;
+    var position_id = $("#jobSelect").val() ;
     var flag = param_method(start_score, end_score);
     if (flag == false) {
         return;
@@ -780,7 +786,8 @@ function exportExcel() {
     }
     if (!dept_id) dept_id = "";
     window.open(getserveraddr() + "/file/employee/order?dept_id=" + dept_id +
-        "&start_date=" + start_date + "&end_date=" + end_date + "&start_score=" + start_score + "&end_score=" + end_score);
+        "&start_date=" + start_date + "&end_date=" + end_date + "&start_score=" + start_score + "&end_score=" + end_score +"&parent_dept_id="+ parent_dept_id+
+        "&max_score="+max_score+"&min_score="+min_score+"&min_check_num="+min_check_num+"&max_check_num="+max_check_num+"&position_id="+position_id );
 }
 
 

+ 3 - 2
VisualInspection/js/statistics/change_attendance.js

@@ -123,9 +123,10 @@ function getFsWorkInfo(flag){
  * @param {*} seq 
  */
 function getTableContent(obj,seq){
-    var days = getDaysByDate(GV("#sel_month")+"/01");
+    var days = getDaysByDate1(GV("#sel_month")+"/01");
     var map_class = {};
     for(var z=0; z < obj.subStatisticsFsWork.length ;z++){
+            // console.log(obj.subStatisticsFsWork[z])
         if(obj.subStatisticsFsWork[z].check_id !=undefined){
             map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] = 2;
         }else{
@@ -179,7 +180,7 @@ function getTableContent(obj,seq){
  */
 function monthChange(){
     $(".m28").show();
-    $(".m"+getDaysByDate(GV("#sel_month")+"/01")).hide();
+    $(".m"+getDaysByDate1(GV("#sel_month")+"/01")).hide();
 }
 
 function setVisit(){

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

@@ -126,7 +126,7 @@ $(function(){
  * @param {*} seq 
  */
 function getTableContent(obj,seq){
-    var days = getDaysByDate(GV("#sel_month")+"/01");
+    var days = getDaysByDate1(GV("#sel_month")+"/01");
     var map_class = {};
     for(var z=0; z < obj.subStatisticsFsWork.length ;z++){
         if(obj.subStatisticsFsWork[z].check_id !=undefined){
@@ -184,7 +184,7 @@ function getTableContent(obj,seq){
  */
 function monthChange(){
     $(".m28").show();
-    $(".m"+getDaysByDate(GV("#sel_month")+'/01')).hide();
+    $(".m"+getDaysByDate1(GV("#sel_month")+'/01')).hide();
 }
 
 function setVisit(){

+ 28 - 0
VisualInspection/js/statistics/common_statistic.js

@@ -150,6 +150,34 @@ function getDays(mouth,datet){
  * param: datet String 年份
  * return:days( 28,29,30,31 )
  */
+function getDaysByDate1(datet){
+    //构造当前日期对象
+    var date = new Date(datet);
+    //获取年份
+    var year = date.getFullYear();
+    var mouth = date.getMonth();
+    //定义当月的天数;
+    var days ;
+    //当月份为二月时,根据闰年还是非闰年判断天数
+    if(mouth == 2){
+            days= year % 4 == 0 ? 29 : 28;
+    }
+    else if(mouth == 1 || mouth == 3 || mouth == 5 || mouth == 7 || mouth == 8 || mouth == 10 || mouth == 12){
+        //月份为:1,3,5,7,8,10,12 时,为大月.则天数为31;
+        days= 31;
+    }
+    else{
+        days= 30;   
+    }
+    return days ;
+}
+
+
+/**
+ * 根据月份,判断当前月份天数
+ * param: datet String 年份
+ * return:days( 28,29,30,31 )
+ */
 function getDaysByDate(datet){
     //构造当前日期对象
     var date = new Date(datet);

+ 19 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/StatisticsBeanBO.java

@@ -0,0 +1,19 @@
+package com.xintong.visualinspection.bean;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper=false)
+public class StatisticsBeanBO extends StatisticsBean {
+
+	private Integer max_score ;
+	
+	private Integer min_score ;
+	
+	private Integer min_check_num ;
+	
+	private Integer max_check_num ;
+	
+	private Integer position_id ;
+}

+ 23 - 5
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/FileExcelController.java

@@ -2,6 +2,7 @@ package com.xintong.visualinspection.controller;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.xintong.visualinspection.bean.CheckAppealStatistic;
 import com.xintong.visualinspection.bean.StatisticsBean;
+import com.xintong.visualinspection.bean.StatisticsBeanBO;
 import com.xintong.visualinspection.service.StatisticsService;
 import com.xintong.visualinspection.util.DateUtil;
 
@@ -41,17 +43,29 @@ public class FileExcelController extends BaseController {
     @RequestMapping(value = "/employee/order",method=RequestMethod.GET)
     public String getEmployeeOrder(HttpServletRequest req,HttpServletResponse resp,
     		@RequestParam Long dept_id,
+    		@RequestParam Long parent_dept_id ,
+    		@RequestParam Integer max_score ,
+    		@RequestParam Integer min_score ,
+    		@RequestParam Integer min_check_num ,
+    		@RequestParam Integer max_check_num ,
+    		@RequestParam Integer position_id ,
     		@RequestParam String start_date,@RequestParam String end_date,
     		@RequestParam String start_score,@RequestParam String end_score){
-    	StatisticsBean obj = new StatisticsBean();
+    	StatisticsBeanBO obj = new StatisticsBeanBO();
     
 		Date start =  DateUtil.strParseDate(start_date);
 		Date end =  DateUtil.strParseDate(end_date);
 		obj.setDept_id(dept_id);
+		obj.setParent_dept_id(parent_dept_id);
 		obj.setStart_date(start);
 		obj.setEnd_date(end);
 		obj.setStart_score(start_score);
 		obj.setEnd_score(end_score);
+		obj.setMax_score(max_score);
+		obj.setMin_score(min_score);
+		obj.setMax_check_num(max_check_num);
+		obj.setMin_check_num(min_check_num);
+		obj.setPosition_id(position_id);
 		
     	statisticsService.getEmployeeCheckedInfo(obj, req, resp);
     	return super.returnSuccessResult(null);
@@ -97,7 +111,7 @@ public class FileExcelController extends BaseController {
      */
     @RequestMapping(value = "/appeal/info",method=RequestMethod.GET)
     public String getAppealStatisticExcel(HttpServletRequest req,HttpServletResponse resp,
-    		@RequestParam Integer month,
+    		@RequestParam String month,
     		@RequestParam(required=false) Integer centerId,
     		@RequestParam(required=false) Integer deptId){
     	CheckAppealStatistic obj = new CheckAppealStatistic();
@@ -106,9 +120,13 @@ public class FileExcelController extends BaseController {
     	}else if(centerId!=null){
     		obj.setParent_dept_id(centerId);
     	}
-    	obj.setStart_time(DateUtil.strParseDate("2017-"+(month-1)+"-25 23:00:00"));
-    	obj.setEnd_time(DateUtil.strParseDate("2017-"+month+"-25 23:00:00"));
-    	statisticsService.getExcelAppealInfo(obj,month.toString(), req, resp);
+    	Calendar c = Calendar.getInstance();
+    	Date time = DateUtil.strParseDate(month+"/25 23:00:00","yyyy/MM/dd HH:mm:ss");
+    	c.setTime(time);
+    	c.add(Calendar.MONTH,-1);
+    	obj.setStart_time(c.getTime());
+    	obj.setEnd_time(time);
+    	statisticsService.getExcelAppealInfo(obj, month.replaceAll("/", "") , req, resp);
     	return super.returnSuccessResult(null);
     }
     

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

@@ -67,5 +67,7 @@ public interface StatisticsDao  {
 	
 	public List<TaskAndScore> selectMList(TaskAndScore obj);
 	
+	public Integer selectCheckedNum(StatisticsBean obj);
+	
 	
 }

+ 25 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/StatisticsMapper.xml

@@ -27,6 +27,28 @@
     </select>
     
     
+    <select id="selectCheckedNum" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="java.lang.Integer" >
+    	
+    	select sum(num) AS num from (
+    	SELECT COUNT(DISTINCT ct.checked_person) as num FROM check_task ct 
+    		WHERE ct.check_status != 22 
+    		<if test="dept_id!=null">
+	    		AND ct.checked_dept = #{dept_id} 
+    		</if>
+    		<if test="dept_list!=null and queryType == 1 and dept_list.size()>0 ">
+	    		AND	ct.checked_dept IN
+			    	<foreach item="obj"  collection="dept_list" open="("
+			            separator="," close=")">
+			            #{obj.id}  
+			         </foreach>
+	    	</if>
+			<if test="mth!=null and mth!=''">
+				AND monthfunc (ct.start_time) = #{mth}
+				AND monthfunc (ct.end_time) = #{mth}
+			</if>
+			GROUP BY ct.checked_dept
+			) u
+    </select>
     
 
     <select id="selectCheckedTimes" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
@@ -405,10 +427,13 @@
     <resultMap id="statisticsFsWork" type="com.xintong.visualinspection.bean.StatisticsFsWork">
         <id property="user_id" column="user_id"/>
         <collection property="subStatisticsFsWork" ofType="com.xintong.visualinspection.bean.StatisticsFsWork">
+            <id property="id" column="id" />
+            <result property="start_time" column="start_time" />
             <result column="work_date" property="work_date"/>
             <result property="dept_id" column="dept_id"/>
             <result property="class_type" column="class_type"/>
             <result property="check_id" column="check_id"/>
+            <result property="end_time" column="end_time" />
             <result property="work_days" column="work_days" />
             <result property="work_minutes" column="work_minutes"/>
         </collection>

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

@@ -484,6 +484,34 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		List<StatisticsBo> listStatistic = getEmployeeCheckedInfo(obj);
 		double start_score = Double.parseDouble(obj.getStart_score());
 		double end_score = Double.parseDouble(obj.getEnd_score());
+		
+		StatisticsBeanBO objs = (StatisticsBeanBO)obj ;
+		
+		for (Iterator<StatisticsBo> it = listStatistic.iterator(); it.hasNext();) {
+			StatisticsBo st = it.next();
+			boolean flag = false ;
+			if(objs.getMax_check_num()!=null  &&  st.getChecked_num()>objs.getMax_check_num() ){
+				flag =true ;
+			}
+			if(objs.getMin_check_num()!=null  &&  st.getChecked_num()<objs.getMin_check_num() ){
+				flag =true ;
+			}
+			double score = (st.getChecked_num() != 0) ? 1000 - (st.getCheck_all_score() / (st.getChecked_num())) :1000;
+			if(objs.getMin_score()!=null  &&  score<objs.getMin_score() ){
+				flag =true ;
+			}
+			if(objs.getMax_score()!=null  &&  score>objs.getMax_score()){
+				flag =true ;
+			}
+			if(objs.getPosition_id()!=null  &&  st.getUser().getPositionid() != objs.getPosition_id()+0 ){
+				flag =true ;
+			}
+			if(flag){
+				it.remove();
+			}
+		}
+		
+		
 		// 处理数据
 		int j = 1;
 		for (Iterator<StatisticsBo> it = listStatistic.iterator(); it.hasNext();) {
@@ -870,28 +898,16 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		int people_num = 0;
 		StatisticsBean returnObj = new 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]));
-//		}
-//		// 检查人数 和 检查次数
-//		obj.setPosition_ids(positionList);
-//		// 检索受检人数
-//		List<StatisticsBean> checkedNumList =  statisticsDao.selectFeeStationCheckNum(obj);
-		
 		if (obj.getQueryType() == 0) {
 			// 公司
 			// 公司总人数
-			List<StatisticsBean> feeStationList = userInfoDao.getUsersCountList();
-			if (feeStationList != null && feeStationList.size() > 0) {
-				for (StatisticsBean sta : feeStationList) {
-					people_num += sta.getPeople_num();
-				}
-			}
+//			List<StatisticsBean> feeStationList = userInfoDao.getUsersCountList();
+//			if (feeStationList != null && feeStationList.size() > 0) {
+//				for (StatisticsBean sta : feeStationList) {
+//					people_num += sta.getPeople_num();
+//				}
+//			}
+			people_num = statisticsDao.selectCheckedNum(obj);
 		} else if (obj.getQueryType() == 1) {
 			// 道管中心
 			Organ organ = new Organ();
@@ -902,18 +918,20 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			List<Organ> list = departmentDao.getOrgan(organ);
 			// 将导管中心下的收费站部门id 列表放入到list中
 			obj.setDept_list(list);
-
-			people_num = userInfoDao.getUsersCenterManageCount(obj);
+			obj.setDept_id(null);
+			people_num = statisticsDao.selectCheckedNum(obj);
+//			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> 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();
+//					}
+//				}
+//			}
+			people_num = statisticsDao.selectCheckedNum(obj);
 		}
 
 		List<StatisticsBean> userLostScoreInfoList = statisticsDao.selectCheckedScoreList(obj);

+ 10 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/util/DateUtil.java

@@ -20,4 +20,14 @@ public class DateUtil {
 		}
 		return null;
 	}
+	
+	public static Date strParseDate(String strDate,String format){
+		SimpleDateFormat sdf = new SimpleDateFormat(format);
+		try {
+			return sdf.parse(strDate);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
 }