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

公司总览功能完成开发

huangchengzdm 8 лет назад
Родитель
Сommit
c33deefbd6

+ 50 - 160
VisualInspection/fwq/js/statistics/total_company_statistics.js

@@ -74,15 +74,15 @@ $(function() {
         init_company_year_assess(select_month.split('/')[0], select_month.split('/')[1]);
         // 查询图二
         //	init_company_points_assess("statistics/lost/score/rate",select_month+'');
-        init_company_points_assess("statistics/score/info", select_month.split('/')[0], select_month.split('/')[1]);
+        init_company_points_assess("f/statistics/score/info", select_month.split('/')[0], select_month.split('/')[1]);
         // 查询图三
-        init_road_manager_score_rank_three("statistics/score/center/manage/info", select_month + '');
+        init_road_manager_score_rank_three("f/statistics/score/center/manage/info", select_month + '');
         // 查询图四
-        init_stationAll_rank_four("statistics/score/tollgate/info", select_month + '');
+        init_stationAll_rank_four("f/statistics/score/tollgate/info", select_month + '');
         // 查询图五
-        init_server_check_type_five("statistics/lost/itemscore/rate", select_month + "");
+        init_server_check_type_five("f/statistics/lost/itemscore/rate", select_month + "");
         // 查询图六
-        init_each_people_points_six("statistics/lost/twice/itemscore/rate", select_month + "");
+        init_each_people_points_six("f/statistics/lost/twice/itemscore/rate", select_month + "");
     }
     /**
      * 初始化图一
@@ -102,12 +102,12 @@ $(function() {
 
 
         var param = {
-            "start_date": (parseInt(y) - 1) + "-" + m + "-25" + " 23:00:00",
-            "end_date": y + "-" + (m) + "-25" + " 23:00:00"
+            "start_date": (parseInt(y) - 1) + "-" + m + "-26" + " 00:00:00",
+            "end_date": y + "-" + (m) + "-26" + " 00:00:00"
         }
 
 
-        initRqueset("statistics/score/year/info", param, 1);
+        initRqueset("f/statistics/score/year/info", param, 1);
 
     }
     // init_company_year_assess();
@@ -123,8 +123,8 @@ $(function() {
             starty = parseInt(y) - 1;
         }
         var param = {
-            "start_date": starty + '-' + (startm >= 10 ? startm : ("0" + startm)) + '-25 23:00:00',
-            "end_date": y + '-' + mon + '-25 23:00:00'
+            "start_date": starty + '-' + (startm >= 10 ? startm : ("0" + startm)) + '-26 00:00:00',
+            "end_date": y + '-' + mon + '-26 00:00:00'
         }
         initRqueset(url, param, 2);
     }
@@ -226,15 +226,14 @@ $(function() {
     }
 
 
-    function pushDate(data, names, appendname) {
+    function pushDate(data, organArray, names, appendname) {
         var temp = [0, 0, 0];
         for (var i = 0; i < data.list.length; i++) {
-            if (i < 7) {
+            if (i < organArray[0]) {
                 temp[0] += data.list[i][names];
-
-            } else if (i < 13) {
+            } else if (i < organArray[1]) {
                 temp[1] += data.list[i][names];
-            } else if (i < 21) {
+            } else if (i < organArray[2]) {
                 temp[2] += data.list[i][names];
             }
         }
@@ -315,6 +314,16 @@ $(function() {
             else
                 min_year = eval("Math.min(" + array_year_score.toString() + ")").toFixed(0) - 10;
         } else if (type == 2) {
+            // 获得各个道管下面所有服务区的数量
+            debugger
+            var organList = data.organList;
+            var organArray = new Array();
+            var organCount = 0;
+            for (h=0;h<organList.length;h++) {
+                organCount += organList[h].sacount;
+                organArray.push(organCount);
+            }
+
             array_points2 = [];
             array_points = [];
             // console.log(data);
@@ -327,13 +336,12 @@ $(function() {
 
                 // 满分
                 for (var i = 0; i < data.list.length; i++) {
-                    if (i < 7) {
-                        temp[0] += data.list[i].checked_people_num - data.list[i].score_fifteen - data.list[i].score_fifty - data.list[i].score_over_fifty;
-
-                    } else if (i < 13) {
-                        temp[1] += data.list[i].checked_people_num - data.list[i].score_fifteen - data.list[i].score_fifty - data.list[i].score_over_fifty;
-                    } else if (i < 21) {
-                        temp[2] += data.list[i].checked_people_num - data.list[i].score_fifteen - data.list[i].score_fifty - data.list[i].score_over_fifty;
+                    if (i < organArray[0]) {
+                        temp[0] += data.list[i].checked_num - data.list[i].score_fifteen - data.list[i].score_fifty - data.list[i].score_over_fifty;
+                    } else if (i < organArray[1]) {
+                        temp[1] += data.list[i].checked_num - data.list[i].score_fifteen - data.list[i].score_fifty - data.list[i].score_over_fifty;
+                    } else if (i < organArray[2]) {
+                        temp[2] += data.list[i].checked_num - data.list[i].score_fifteen - data.list[i].score_fifty - data.list[i].score_over_fifty;
                     }
                 }
                 if (temp[0] != 0) {
@@ -345,9 +353,9 @@ $(function() {
                 if (temp[2] != 0) {
                     array_points2.push({ "value": temp[2], "name": '南通道管', "itemStyle": { "normal": { "color": '#008080' } } });
                 }
-                pushDate(data, 'score_fifteen', '0-15分');
-                pushDate(data, 'score_fifty', '15-50分');
-                pushDate(data, 'score_over_fifty', '50分以上');
+                pushDate(data, organArray, 'score_fifteen', '0-15分');
+                pushDate(data, organArray, 'score_fifty', '15-50分');
+                pushDate(data, organArray, 'score_over_fifty', '50分以上');
             } else {
                 array_points.length = 0;
             }
@@ -442,7 +450,7 @@ $(function() {
             // array_points_name.length = 0;
             // array_points_pre.length = 0;
             // arrar_points_month.length = 0;
-            if (data != '' && data.Pmth.length != 0 || data.Tmth.length != 0) {
+            if (data != '' && data.list.Pmth.length != 0 || data.list.Tmth.length != 0) {
                 data_each_people_points(data);
             } else {
                 // array_points_name.length = 0;
@@ -454,19 +462,14 @@ $(function() {
 
     function data_each_people_points(data) {
         var flag = false;
-        var name = ['环境卫生', '仪容仪表着装', '表情', '动作', '文明用语', '工作纪律及行为举止', '便民服务', '安全管理']
+        var name = data.itemList;
         array_all_name = name;
         // array_all_deptname = ["连云港道管", "盐城道管", "南通道管"];
-        var Tmth = data.Tmth;
-        var Pmth = data.Pmth;
-        // var Ntemp = new Array();
-        // var Ptemp = new Array();
-        // var Ttemp = new Array();
+        var Tmth = data.list.Tmth;
+        var Pmth = data.list.Pmth;
 
         for (var i = 0; i < name.length; i++) {
-            //     var temp_map_m = new HashMap();
-            //     var temp_map_p = new HashMap();
-
+            
             for (var j = 0; j < Tmth.length; j++) {
                 flag = false;
                 if (array_all_deptname.length > 0) {
@@ -528,60 +531,7 @@ $(function() {
                     }
                 }
             }
-
-            //     map_month_data.set(name[i], temp_map_m)
-            //     map_pre_data.set(name[i], temp_map_p)
-        }
-        // console.log(Tmth)
-        // console.log(map_month_data)
-
-
-        // flag = true;
-        // if (Tmth.length > 0) {
-        //     for (var j = 0; j < Tmth.length; j++) {
-        //         if (name[i] == Tmth[j].name && Tmth[j].all_check_score != null) {
-        //             //		Ttemp[i] = filter_handler(Tmth[j].all_check_score,Tmth[j].checked_num,Tmth[j].people_num,0);
-        //             Ttemp[i] = Tmth[j].all_check_score;
-        //             break;
-        //         } else {
-        //             Ttemp[i] = 0;
-        //         }
-        //     }
-        // } else {
-        //     Ttemp[i] = 0;
-        // }
-        // if (Pmth.length > 0) {
-        //     for (var m = 0; m < Pmth.length; m++) {
-        //         if (name[i] == Pmth[m].name && Pmth[m].all_check_score != null) {
-        //             //	Ptemp[i] = filter_handler(Pmth[m].all_check_score,Pmth[m].checked_num,Pmth[m].people_num,0);
-        //             Ptemp[i] = Pmth[m].all_check_score;
-        //             break;
-        //         } else {
-        //             Ptemp[i] = 0;
-        //         }
-        //     }
-        // } else {
-        //     Ptemp[i] = 0;
-        // }
-        // if (Ttemp[i] == 0 && Ptemp[i] == 0) {
-        //     name[i] = "";
-        //     flag = null;
-        // }
-        // if (name[i] != "") {
-        //     if (name[i] == '仪容仪表着装') {
-        //         name[i] = '仪表';
-        //     }
-        //     if (name[i] == '工作纪律及行为举止') {
-        //         name[i] = '行为';
-        //     }
-        //     array_points_name.push(name[i]);
-        // }
-
-        // if (flag) {
-        //     array_points_pre.push(Ptemp[i]);
-        //     arrar_points_month.push(Ttemp[i]);
-        // }
-        // }
+        }       
     }
 
     /**
@@ -631,11 +581,9 @@ $(function() {
                 check_type = ec.init(document.getElementById('server-check-type'), theme);
                 people_points = ec.init(document.getElementById('each-people-points'));
 
-
-                points_assess.on(ecConfig.EVENT.CLICK, point_c)
-                score_rank.on(ecConfig.EVENT.CLICK, score_c)
-                stationAll_rank.on(ecConfig.EVENT.CLICK, station_c)
-
+                // points_assess.on(ecConfig.EVENT.CLICK, point_c)
+                // score_rank.on(ecConfig.EVENT.CLICK, score_c)
+                // stationAll_rank.on(ecConfig.EVENT.CLICK, station_c)
 
             }
         );
@@ -712,68 +660,10 @@ $(function() {
      * 图二
      */
     function company_points_assess_two() {
-        /*option = {
-        	tooltip : {
-        		trigger: 'item',
-        		formatter:  "公司考核扣分占比 <br/>{b} : {c}人 ({d}%)"
-        	},
-        	noDataLoadingOption :{
-        	text: '暂无数据',
-        	effect:'bubble',
-        	effectOption : {
-        		effect: {
-        			n: 0 //气泡个数为0
-        		}
-        	},
-        	textStyle: {
-        		fontSize: 20,
-        		fontFamily:'cursive',
-        		fontWeight: 'bold'
-        	}
-        	},
-        	toolbox: {
-        		show : true,
-        		feature : {
-
-        			magicType : {
-
-        				type: ['pie', 'funnel'],
-        				option: {
-        					funnel: {
-        						x: '25%',
-        						width: '50%',
-        						funnelAlign: 'left',
-        						max: 1548
-        					}
-        				}
-        			},
-        		}
-        	},
-        	calculable : true,
-        	series : [
-        		{
-        			name:'访问来源',
-        			type:'pie',
-        			radius : '55%',
-        			center: ['50%', '50%'],
-        			data:array_points,
-        			itemStyle:{
-        			normal:{
-        				label:{
-        					show: true,
-        				    formatter: '{b} :\n{c}人 ({d}%)'
-        				},
-        				labelLine :{show:true}
-        				}
-        			}
-        		}
-        	]
-        };*/
-
         option = {
             tooltip: {
                 trigger: 'item',
-                formatter: "公司考核扣分占比 <br/>{b} : {c} ({d}%)"
+                formatter: "公司考核扣分占比 <br/>{b} : {c}次 ({d}%)"
             },
 
             toolbox: {
@@ -796,7 +686,7 @@ $(function() {
                         normal: {
                             label: {
                                 show: true,
-                                formatter: '{b}:\n{c}({d}%)',
+                                formatter: '{b}:\n{c}({d}%)',
                                 textStyle: {
                                     alias: 'center',
                                     fontSize: 10,
@@ -829,7 +719,7 @@ $(function() {
                         normal: {
                             label: {
                                 show: false,
-                                formatter: '{b}:{c}({d}%)'
+                                formatter: '{b}:{c}({d}%)'
                             },
                             labelLine: {
                                 show: false
@@ -932,7 +822,7 @@ $(function() {
                 }
             },
             legend: {
-                data: ['公司全体收费站得分']
+                data: ['公司全体服务区得分']
             },
             calculable: true,
             xAxis: [{
@@ -948,7 +838,7 @@ $(function() {
                 max: 1000
             }],
             series: [{
-                name: '公司全体收费站得分',
+                name: '公司全体服务区得分',
                 type: 'bar',
                 data: array_allStation_score_temp,
                 itemStyle: {
@@ -1337,7 +1227,7 @@ function point_c(param) {
 
         $.zui.store.set('store_param_' + current_url, pdata);
         isnew = false;
-        changePage("/view/statistics/assess_situation.html");
+        changePage("/fwq/view/statistics/assess_situation.html");
 
     }
 }
@@ -1357,7 +1247,7 @@ function score_c(param) {
 
         $.zui.store.set('store_param_' + current_url, pdata);
         isnew = false;
-        changePage("/view/statistics/road_manage_statistics.html");
+        changePage("/fwq/view/statistics/road_manage_statistics.html");
     }
 }
 
@@ -1390,6 +1280,6 @@ function station_c(param) {
         $.zui.store.set('page_data_param_station_p', param.data.name);
         $.zui.store.set('store_param_' + current_url, pdata);
         isnew = false;
-        changePage("/view/statistics/toll_station_statistics.html");
+        changePage("/fwq/view/statistics/toll_station_statistics.html");
     }
 }

+ 0 - 2
VisualInspection/fwq/view/statistics/total_company_statistics.html

@@ -3,8 +3,6 @@
 <script src="/fwq/js/statistics/total_company_statistics.js"></script>
 <link rel="stylesheet" type="text/css" href="/css/statistics/total_company_statistics.css">
 <div class="container-fluid statistic-panel">
-    <!--<div class="row-1"><span>公司统计</span></div>
-    <div class="line-1"></div>-->
     <div class="row">
         <div class="div-month col-sm-1">
             <!--<select>-->

+ 77 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/gettway/StatisticsController_F.java

@@ -168,4 +168,81 @@ public class StatisticsController_F extends BaseController {
         List<FwqStatisticsBean> returnList=  statisticsService_f.getOneCheckedItemInfo(obj);
         return super.returnSuccessResult(returnList);
     }
+
+    /**
+     * 公司总览--->12个月考核得分总体
+     */
+    @RequestMapping(value = "/score/year/info")
+    public String selectYearScoreChange(@RequestBody FwqStatisticsBean obj){
+        List<FwqStatisticsBean> lists=  statisticsService_f.getYearScoreChange(obj);
+        return super.returnSuccessResult(lists);
+    }
+
+    /**
+     * 公司总览--->公司考核扣分情况占比
+     * @param obj
+     * @return
+     */
+    @RequestMapping(value = "/score/info")
+    public String getScoreInfo(@RequestBody FwqStatisticsBean obj){
+        List<FwqStatisticsBean> lists=  statisticsService_f.getFeeStationCheckedScore(obj);
+        int totalcheckedCount=0,total0=0,total15=0,total50=0,totalOver50=0,totalAll = 0;
+        for(FwqStatisticsBean bean:lists){
+            totalcheckedCount+=bean.getChecked_num();
+            total0+=(bean.getChecked_num()-bean.getScore_fifteen()-bean.getScore_fifty()-bean.getScore_over_fifty());
+            total15+=bean.getScore_fifteen();
+            total50+=bean.getScore_fifty();
+            totalOver50+=bean.getScore_over_fifty();
+            totalAll+=bean.getAll_check_score();
+        }
+        Map<String,Object> resultMap = new HashMap<>();
+        resultMap.put("list", lists);
+        resultMap.put("totalcheckedCount", totalcheckedCount);
+        resultMap.put("total0", total0);
+        resultMap.put("total15", total15);
+        resultMap.put("total50", total50);
+        resultMap.put("totalOver50", totalOver50);
+        resultMap.put("totalAll", totalAll);
+        resultMap.put("organList", departmentDao.getOrganToSaCount());
+        return super.returnSuccessResult(resultMap);
+    }
+
+    /**
+     * 公司总览--->道管中心得分排名
+     */
+    @RequestMapping(value = "/score/center/manage/info")
+    public String selectCentermanageScoreChange(@RequestBody FwqStatisticsBean obj){
+        List<FwqStatisticsBean> lists=  statisticsService_f.getCenterManageScoreInfo(obj);
+        return super.returnSuccessResult(lists);
+    }
+
+    /**
+     * 公司总览--->公司全体服务区排名
+     */
+    @RequestMapping(value = "/score/tollgate/info")
+    public String selectTollgateScoreChange(@RequestBody FwqStatisticsBean obj){
+        List<FwqStatisticsBean> lists=  statisticsService_f.getFeeStationScoreInfo(obj);
+        return super.returnSuccessResult(lists);
+    }
+
+    /**
+     * 公司总览--->温馨服务检查问题类别占比
+     */
+    @RequestMapping(value = "/lost/itemscore/rate")
+    public String getCheckedItemInfoRate(@RequestBody FwqStatisticsBean obj){
+        List<FwqStatisticsBean> returnList=  statisticsService_f.getCheckedItemScoreInfo(obj);
+        return super.returnSuccessResult(returnList);
+    }
+
+    /**
+     * 公司总览--->各个问题类别的扣分情况
+     */
+    @RequestMapping(value = "/lost/twice/itemscore/rate")
+    public String getTwiceCheckedItemInfoRate(@RequestBody FwqStatisticsBean obj){
+        Map<String,Object> resultMap = new HashMap<>();
+        Map<String,List<FwqStatisticsBean>> returnMap=  statisticsService_f.get2CheckedItemScoreInfo(obj);
+        resultMap.put("itemList", commonService.getCheckItemName(28L));
+        resultMap.put("list", returnMap);
+        return super.returnSuccessResult(resultMap);
+    }
 }

+ 9 - 1
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/dao/FwqStatisticsDao.java

@@ -19,11 +19,19 @@ public interface FwqStatisticsDao {
 
     List<FwqStatisticsBean> selectStatistics(FwqStatisticsBean obj);
 
-    FwqStatisticsBean selectCheckedTimes(FwqStatisticsBean obj);
+    List<FwqStatisticsBean> selectCheckedTimes(FwqStatisticsBean obj);
 
     List<FwqStatisticsBean> selectOneCheckedDetailInfo(FwqStatisticsBean obj);
 
     List<FwqStatisticsBean> selectOneCheckedInfoData(FwqStatisticsBean obj);
 
     List<FwqStatisticsBean> selectOneCheckedItemInfo(FwqStatisticsBean obj);
+
+    List<FwqStatisticsBean> selectYearScoreInfo(FwqStatisticsBean obj);
+
+    List<FwqStatisticsBean> selectFeeStationCheckedScore(FwqStatisticsBean obj);
+
+    List<FwqStatisticsBean> selectFeeStationScoreInfo(FwqStatisticsBean obj);
+
+    List<FwqStatisticsBean> selectCheckedItemScoreInfo(FwqStatisticsBean obj);
 }

+ 132 - 1
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/mapper/master/StatisticsMapper.xml

@@ -81,7 +81,10 @@
     <select id="selectCheckedTimes" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
             resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
         SELECT COUNT(1) AS checked_num , t.checked_dept dept_id FROM view_check_task t
-        WHERE t.checked_dept =#{dept_id}
+        WHERE 1=1
+        <if test="dept_id != null and dept_id != ''">
+            AND t.checked_dept =#{dept_id}
+        </if>
         <if test="start_date!=null and end_date != null">
             AND t.start_time &gt;= #{start_date} AND t.end_time &lt; #{end_date}
         </if>
@@ -173,6 +176,76 @@
         ) a where a.all_check_score is not null
     </select>
 
+    <select id="selectYearScoreInfo" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
+            resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
+        SELECT
+        sum(tab.checkd_all_score) AS all_check_score,
+        sum(tab.checked_num)      AS checked_num,
+        tab.mth
+        FROM (
+        <include refid="selectAllCheckedInfoAllCheck"/>
+        ) tab
+        WHERE 1=1
+        <if test="dept_list!=null and queryType == 1 and dept_list.size()>0 ">
+            AND tab.checked_dept IN
+            <foreach item="obj" collection="dept_list" open="("
+                     separator="," close=")">
+                #{obj.id}
+            </foreach>
+        </if>
+        <if test="dept_id!=null and queryType ==2">
+            AND tab.checked_dept=#{dept_id}
+        </if>
+        GROUP BY tab.mth
+    </select>
+
+    <select id="selectFeeStationCheckedScore" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
+            resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
+        SELECT
+        IFNULL(sum(ct.check_item_score), 0) AS score,
+        t.checked_dept                      AS dept_id
+        FROM view_check_task t
+        LEFT JOIN check_score ct ON t.id = ct.task_id
+        WHERE 1 = 1
+        <if test="start_date!=null and end_date != null">
+            AND t.start_time &gt;= #{start_date} AND t.end_time &lt; #{end_date}
+        </if>
+        <if test="period_id !=null and period_id != '' ">
+            AND t.period_id =  #{period_id}
+        </if>
+        GROUP BY t.checked_dept
+    </select>
+
+    <select id="selectFeeStationScoreInfo" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
+            resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
+        SELECT
+        sum(tab.checkd_all_score) AS all_check_score,
+        sum(tab.checked_num)      AS checked_num,
+        tab.checked_dept          AS dept_id
+        FROM (
+        <include refid="selectAllCheckedInfoAllCheck"/>
+        ) tab
+        WHERE 1=1
+        GROUP BY tab.checked_dept
+    </select>
+
+    <select id="selectCheckedItemScoreInfo" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
+            resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
+        SELECT
+          count(DISTINCT m.task_id)   AS checked_num,
+          sum(m.check_item_score)     AS all_check_score,
+          m.check_item_id,
+          m.checked_dept              AS dept_id
+        FROM view_check_task t INNER JOIN
+          check_score m ON t.id = m.task_id
+        WHERE 1=1
+        AND monthfunc(t.start_time) = #{mth}
+        GROUP BY  m.check_item_id,m.checked_dept
+        ORDER BY m.checked_dept
+    </select>
+
+
+
     <sql id="selectOneAllCheckedInfoData">
         SELECT
         check_num_t.checked_num,
@@ -227,6 +300,64 @@
         AND check_num_t.mth = checked_score_t.mth
     </sql>
 
+    <!--包含未扣分的-->
+    <sql id="selectAllCheckedInfoAllCheck">
+        SELECT
+        check_num_t.checked_num,
+        check_num_t.mth,
+        IFNULL(checked_score_t.checkd_all_score, 0) AS checkd_all_score,
+        check_num_t.checked_dept
+        FROM
+        (
+        SELECT
+        COUNT(t.checked_dept)   AS checked_num,
+        monthfunc(t.start_time) AS mth,
+        t.id,
+        t.checked_dept
+        FROM
+        view_check_task t
+        WHERE
+        t.checked_dept 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
+        t.checked_dept,
+        mth
+        ) check_num_t
+        LEFT JOIN (
+        SELECT
+        monthfunc(t.start_time) AS mth,
+        sum(m.check_item_score) AS checkd_all_score,
+        m.*
+        FROM
+        check_score m INNER JOIN
+        (SELECT *
+        FROM view_check_task t
+        WHERE 1 = 1
+        <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, m.checked_dept
+        ) checked_score_t ON checked_score_t.checked_dept = check_num_t.checked_dept
+        AND check_num_t.mth = checked_score_t.mth
+    </sql>
+
 </mapper>
 
 

+ 325 - 5
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java

@@ -33,7 +33,7 @@ import java.util.Set;
  * 文件名:StatisticsServiceImpl
  * 版本信息:日期:2017/4/7 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
  *
- * @author wenhongquan
+ * @author huangcheng
  * @date 2018/05/02
  */
 
@@ -599,7 +599,7 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         }
 
         // 查询服务区受检次数
-        FwqStatisticsBean timesList = fwqStatisticsDao.selectCheckedTimes(obj);
+        List<FwqStatisticsBean> timesList = fwqStatisticsDao.selectCheckedTimes(obj);
 
         Map<Long, FwqStatisticsBo> statisticBoMap = new HashMap<>();
 
@@ -638,9 +638,11 @@ public class StatisticsServiceImpl implements StatisticsService_F {
             }
         }
 
-        if (statisticBoMap.containsKey(timesList.getDept_id())) {
-            FwqStatisticsBo tmp = statisticBoMap.get(timesList.getDept_id());
-            tmp.setChecked_num(timesList.getChecked_num());
+        for (FwqStatisticsBean statisticsBean : timesList) {
+            if (statisticBoMap.containsKey(statisticsBean.getDept_id())) {
+                FwqStatisticsBo tmp = statisticBoMap.get(statisticsBean.getDept_id());
+                tmp.setChecked_num(statisticsBean.getChecked_num());
+            }
         }
 
         List<FwqStatisticsBo> lists = new ArrayList<>(statisticBoMap.values());
@@ -731,4 +733,322 @@ public class StatisticsServiceImpl implements StatisticsService_F {
 
         return lists;
     }
+
+    @Override
+    public List<FwqStatisticsBean> getYearScoreChange(FwqStatisticsBean obj) {
+        // 道管中心
+//        if (obj.getQueryType() != null && obj.getQueryType() == 1) {
+//            // 检索当前导管中心下的deptid
+//            Organ organ = new Organ();
+//            if (obj.getDept_id() == null) {
+//                return null;
+//            }
+//            organ.setParentid(obj.getDept_id().intValue());
+//
+//            List<Organ> list = departmentDao.getOrgan(organ);
+//            // 将导管中心下的收费站部门id 列表放入到list中
+//            obj.setDept_list(list);
+//        }
+
+        // Constant t = CodeUtil.getCodeByFlagAndValue("feestation_check_jobs",
+        // "1");
+        // String[] postions = t.getCode_name().split(",");
+        // 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> listCheckNum =
+        // statisticsDao.selectFeeStationCheckNum(obj);
+
+        return fwqStatisticsDao.selectYearScoreInfo(obj);
+
+    }
+
+    @Override
+    public List<FwqStatisticsBean> getFeeStationCheckedScore(FwqStatisticsBean obj) {
+
+        Map<Long, FwqStatisticsBean> mapStationInfos = new HashMap<>();
+        // 获得所有服务区数据,将服务区数据保存在map中
+        List<FeeStation> saList = commonService.getAllDeptByLayer("SA");
+        for (FeeStation sta : saList) {
+            FwqStatisticsBean obj2 = new FwqStatisticsBean();
+            obj2.setDept_id(Long.valueOf(sta.getDeptid()));
+            obj2.setName(sta.getName());
+            // 30:连云港道管;31:盐城道管;32:南通道管
+            if ("30".equals(sta.getParentid())) {
+                obj2.setId(1);
+            } else if ("31".equals(sta.getParentid())) {
+                obj2.setId(2);
+            } else if ("32".equals(sta.getParentid())) {
+                obj2.setId(3);
+            }
+            mapStationInfos.put(Long.valueOf(sta.getDeptid()), obj2);
+        }
+
+        if(obj.getStart_date()!=null && obj.getEnd_date()!=null){
+            CheckTaskPeriod p = commonService.getCheckTaskPeriod(obj.getStart_date().getTime(), obj.getEnd_date().getTime());
+            if(p!=null){
+                obj.setPeriod_id(p.getId());
+            }
+        }
+
+        // 检查次数
+        List<FwqStatisticsBean> listCheckNum = fwqStatisticsDao.selectFeeStationCheckNum(obj);
+        for (FwqStatisticsBean sta : listCheckNum) {
+            if (mapStationInfos.containsKey(sta.getDept_id())) {
+                mapStationInfos.get(sta.getDept_id()).setChecked_num(sta.getChecked_num());
+            }
+        }
+
+        List<FwqStatisticsBo> list = getEmployeeCheckedInfo(obj);
+        Map<Integer, FwqStatisticsBo> listmap = new HashMap<>();
+        for (FwqStatisticsBo b : list) {
+            listmap.put(b.getDept_id().intValue(), b);
+        }
+
+        List<FwqStatisticsBean> listCheckedScore = fwqStatisticsDao.selectFeeStationCheckedScore(obj);
+        for (FwqStatisticsBean sta : listCheckedScore) {
+            if (mapStationInfos.containsKey(sta.getDept_id())) {
+
+                FwqStatisticsBean statis = mapStationInfos.get(sta.getDept_id());
+                statis.setAll_check_score(statis.getAll_check_score() + sta.getScore());
+
+                FwqStatisticsBo b = listmap.get(sta.getDept_id().intValue());
+
+                if (b == null || b.getCheck_score_avg() == null) {
+                    continue;
+                }
+                double sc = Double.parseDouble(b.getCheck_score_avg());
+                if (sc == 0) {
+                    statis.setScore(statis.getScore() + 1);
+                } else if (sc <= 15) {
+                    statis.setScore_fifteen(statis.getScore_fifteen() + 1);
+                } else if (sc <= 50) {
+                    statis.setScore_fifty(statis.getScore_fifty() + 1);
+                } else {
+                    statis.setScore_over_fifty(statis.getScore_over_fifty() + 1);
+                }
+            }
+        }
+
+        List<FwqStatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
+
+        sortList.sort(new Comparator<FwqStatisticsBean>() {
+            @Override
+            public int compare(FwqStatisticsBean o1, FwqStatisticsBean o2) {
+                if (o1.getId() > o2.getId()) {
+                    return 1;
+                } else if (o1.getId().equals(o2.getId())) {
+                    if (o1.getChecked_num() != 0 && o2.getChecked_num() != 0) {
+                        if (o1.getAll_check_score() / (o1.getChecked_num() + 0.0) > o2.getAll_check_score()
+                                / (o2.getChecked_num() + 0.0)) {
+                            return 1;
+                        } else if (o1.getAll_check_score() / (o1.getChecked_num() + 0.0) < o2.getAll_check_score()
+                                / (o2.getChecked_num() + 0.0)) {
+                            return -1;
+                        } else {
+                            return 0;
+                        }
+                    } else {
+                        if (o1.getChecked_num() == 0) {
+                            return -1;
+                        } else if (o2.getChecked_num() == 0) {
+                            return 1;
+                        } else {
+                            return 0;
+                        }
+                    }
+                } else {
+                    return -1;
+                }
+            }
+        });
+
+        return sortList;
+    }
+
+    @Override
+    public List<FwqStatisticsBean> getCenterManageScoreInfo(FwqStatisticsBean obj) {
+        // 道管中心
+        List<FwqStatisticsBean> centerManageList = new ArrayList<>();
+        for (int i = 0; i < 3; i++) {
+            FwqStatisticsBean e = new FwqStatisticsBean();
+            centerManageList.add(e);
+        }
+
+        List<FwqStatisticsBean> scoreList = reFeeStationScoreInfo(obj);
+        Map<Long, FwqStatisticsBean> centerManageMap = new HashMap<>();
+        for (FwqStatisticsBean sta : scoreList) {
+            if (!centerManageMap.containsKey(sta.getDept_id())) {
+                centerManageMap.put(sta.getDept_id(), sta);
+            }
+        }
+
+        // 获取所有的服务区
+        List<FwqStatisticsBean> lists = new ArrayList<>();
+        List<FeeStation> saList = commonService.getAllDeptByLayer("SA");
+        for (FeeStation sta : saList) {
+            FwqStatisticsBean obj2 = new FwqStatisticsBean();
+            obj2.setDept_id(Long.valueOf(sta.getDeptid()));
+            obj2.setName(sta.getName());
+            obj2.setParent_dept_id(Long.valueOf(sta.getParentid()));
+            lists.add(obj2);
+        }
+
+        for (FwqStatisticsBean sta : lists) {
+            if (sta.getParent_dept_id() == 30) {
+                centerManageList.get(0).setAll_check_score(centerManageList.get(0).getAll_check_score()
+                        + centerManageMap.get(sta.getDept_id()).getAll_check_score());
+                centerManageList.get(0).setChecked_num(centerManageList.get(0).getChecked_num()
+                        + centerManageMap.get(sta.getDept_id()).getChecked_num());
+                centerManageList.get(0).setFeeStationName("连云港");
+            } else if (sta.getParent_dept_id() == 31) {
+                centerManageList.get(1).setAll_check_score(centerManageList.get(1).getAll_check_score()
+                        + centerManageMap.get(sta.getDept_id()).getAll_check_score());
+                centerManageList.get(1).setChecked_num(centerManageList.get(1).getChecked_num()
+                        + centerManageMap.get(sta.getDept_id()).getChecked_num());
+                centerManageList.get(1).setFeeStationName("盐城");
+            } else if (sta.getParent_dept_id() == 32){
+                centerManageList.get(2).setAll_check_score(centerManageList.get(2).getAll_check_score()
+                        + centerManageMap.get(sta.getDept_id()).getAll_check_score());
+                centerManageList.get(2).setChecked_num(centerManageList.get(2).getChecked_num()
+                        + centerManageMap.get(sta.getDept_id()).getChecked_num());
+                centerManageList.get(2).setFeeStationName("南通");
+            }
+        }
+
+        // 进行排序
+        centerManageList.sort(new Comparator<FwqStatisticsBean>() {
+            @Override
+            public int compare(FwqStatisticsBean o1, FwqStatisticsBean o2) {
+                return o1.compareTo(o2);
+            }
+        });
+
+        return centerManageList;
+    }
+
+    @Override
+    public List<FwqStatisticsBean> getFeeStationScoreInfo(FwqStatisticsBean obj) {
+        List<FwqStatisticsBean> scoreList = reFeeStationScoreInfo(obj);
+
+        scoreList.sort(new Comparator<FwqStatisticsBean>() {
+            @Override
+            public int compare(FwqStatisticsBean o1, FwqStatisticsBean o2) {
+                return o1.compareTo(o2);
+            }
+        });
+
+        return scoreList;
+    }
+
+    @Override
+    public List<FwqStatisticsBean> getCheckedItemScoreInfo(FwqStatisticsBean obj) {
+        List<FwqStatisticsBean> list = fwqStatisticsDao.selectCheckedItemScoreInfo(obj);
+        Map<Long, Item> itemMap = commonService.getItemMap();
+        Map<Long, Organ> deptMap = commonService.getDeptMap();
+        for (FwqStatisticsBean sta : list) {
+            sta.setItem_id(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
+            sta.setName(itemMap.get(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id()).getName());
+            sta.setParent_dept_id(deptMap.get(sta.getDept_id()).getParentid().longValue());
+        }
+        for (int i = 0; i < list.size(); i++) {
+            for (int j = list.size() - 1; j > i; j--) {
+                if (list.get(j).getDept_id().equals(list.get(i).getDept_id()) && list.get(j).getItem_id().equals(list.get(i).getItem_id())) {
+                    list.get(i).setAll_check_score(list.get(i).getAll_check_score() + list.get(j).getAll_check_score());
+                    list.get(i).setChecked_num(list.get(i).getChecked_num() + list.get(j).getChecked_num());
+                    list.remove(j);
+                }
+            }
+        }
+
+        return list;
+    }
+
+    @Override
+    public Map<String, List<FwqStatisticsBean>> get2CheckedItemScoreInfo(FwqStatisticsBean obj) {
+
+        Map<String, List<FwqStatisticsBean>> map = new HashMap<>();
+        List<FwqStatisticsBean> objList = fwqStatisticsDao.selectCheckedItemScoreInfo(obj);
+        Map<Long, Item> itemMap = commonService.getItemMap();
+        Map<Long, Organ> deptMap = commonService.getDeptMap();
+        for (FwqStatisticsBean sta : objList) {
+            sta.setItem_id(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
+            sta.setName(itemMap.get(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id()).getName());
+            sta.setFeeStationName(deptMap.get(sta.getDept_id()).getOrganname());
+            sta.setPfeeStationName(deptMap.get(deptMap.get(sta.getDept_id()).getParentid().longValue()).getOrganname());
+            sta.setParent_dept_id(deptMap.get(sta.getDept_id()).getParentid().longValue());
+        }
+        for (int i = 0; i < objList.size(); i++) {
+            for (int j = objList.size() - 1; j > i; j--) {
+                if (objList.get(j).getDept_id().equals(objList.get(i).getDept_id()) && objList.get(j).getItem_id().equals(objList.get(i).getItem_id())) {
+                    objList.get(i).setAll_check_score(objList.get(i).getAll_check_score() + objList.get(j).getAll_check_score());
+                    objList.get(i).setChecked_num(objList.get(i).getChecked_num() + objList.get(j).getChecked_num());
+                    objList.remove(j);
+                }
+            }
+        }
+
+        map.put("Tmth", objList);
+        obj.setMth(obj.getPrev_mth());
+        objList = fwqStatisticsDao.selectCheckedItemScoreInfo(obj);
+
+        for (FwqStatisticsBean sta : objList) {
+            sta.setItem_id(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
+            sta.setName(itemMap.get(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id()).getName());
+            sta.setFeeStationName(deptMap.get(sta.getDept_id()).getOrganname());
+            sta.setPfeeStationName(deptMap.get(deptMap.get(sta.getDept_id()).getParentid().longValue()).getOrganname());
+            sta.setParent_dept_id(deptMap.get(sta.getDept_id()).getParentid().longValue());
+        }
+        for (int i = 0; i < objList.size(); i++) {
+            for (int j = objList.size() - 1; j > i; j--) {
+                if (objList.get(j).getDept_id().equals(objList.get(i).getDept_id()) && objList.get(j).getItem_id().equals(objList.get(i).getItem_id())) {
+                    objList.get(i).setAll_check_score(objList.get(i).getAll_check_score() + objList.get(j).getAll_check_score());
+                    objList.get(i).setChecked_num(objList.get(i).getChecked_num() + objList.get(j).getChecked_num());
+                    objList.remove(j);
+                }
+            }
+        }
+
+        map.put("Pmth", objList);
+
+        return map;
+    }
+
+    private List<FwqStatisticsBean> reFeeStationScoreInfo(FwqStatisticsBean obj) {
+        List<FwqStatisticsBean> scoreList = fwqStatisticsDao.selectFeeStationScoreInfo(obj);
+        Map<Long, FwqStatisticsBean> feeStationMap = new HashMap<>();
+
+        for (FwqStatisticsBean feeObj : scoreList) {
+            if (!feeStationMap.containsKey(feeObj.getDept_id())) {
+                feeStationMap.put(feeObj.getDept_id(), feeObj);
+            }
+        }
+        // 需要补充的
+        List<FwqStatisticsBean> reList = new ArrayList<>();
+
+        // 获取所有的服务区
+        List<FwqStatisticsBean> feeStationList = new ArrayList<>();
+        List<FeeStation> saList = commonService.getAllDeptByLayer("SA");
+        for (FeeStation sta : saList) {
+            FwqStatisticsBean obj2 = new FwqStatisticsBean();
+            obj2.setDept_id(Long.valueOf(sta.getDeptid()));
+            obj2.setName(sta.getName());
+            feeStationList.add(obj2);
+        }
+        for (FwqStatisticsBean sta : feeStationList) {
+            if (feeStationMap.containsKey(sta.getDept_id())) {
+                feeStationMap.get(sta.getDept_id()).setFeeStationName(sta.getName());
+            } else {
+                sta.setAll_check_score(0);
+                sta.setChecked_num(0);
+                sta.setFeeStationName(sta.getName());
+                reList.add(sta);
+            }
+        }
+        scoreList.addAll(reList);
+        return scoreList;
+    }
 }

+ 17 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/service/StatisticsService_F.java

@@ -32,4 +32,21 @@ public interface StatisticsService_F {
 
     List<FwqStatisticsBo> getEmployeeCheckedInfo(FwqStatisticsBean obj);
 
+    // 公司12个月考核得分总体变化趋势
+    List<FwqStatisticsBean> getYearScoreChange(FwqStatisticsBean obj);
+
+    List<FwqStatisticsBean> getFeeStationCheckedScore(FwqStatisticsBean obj);
+
+    // 道管中心得分排名
+    List<FwqStatisticsBean> getCenterManageScoreInfo(FwqStatisticsBean obj);
+
+    // 公司全体服务区排名
+    List<FwqStatisticsBean> getFeeStationScoreInfo(FwqStatisticsBean obj);
+
+    // 温馨服务检查问题类别占比
+    List<FwqStatisticsBean> getCheckedItemScoreInfo(FwqStatisticsBean obj);
+
+    // 各个问题类别的扣分情况
+    Map<String,List<FwqStatisticsBean>> get2CheckedItemScoreInfo(FwqStatisticsBean obj);
+
 }