Browse Source

考核问题管理功能(除导出未完成)

huangchengzdm 8 years ago
parent
commit
08922b2e15
13 changed files with 730 additions and 6 deletions
  1. 384 0
      VisualInspection/fwq/js/statistics/assess_type.js
  2. 2 2
      VisualInspection/fwq/js/statistics/operation_management_integration.js
  3. 100 0
      VisualInspection/fwq/view/statistics/assess_type.html
  4. 19 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/FwqNum.java
  5. 48 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/gettway/StatisticsController_F.java
  6. 10 3
      VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/cluster/DepartmentDao.java
  7. 12 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/DepartmentMapper.xml
  8. 4 0
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/dao/FwqStatisticsDao.java
  9. 35 1
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/mapper/master/StatisticsMapper.xml
  10. 110 0
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java
  11. 2 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/bean/FwqStatisticsBean.java
  12. 3 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/service/StatisticsService_F.java
  13. 1 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/util/CacheUtil.java

+ 384 - 0
VisualInspection/fwq/js/statistics/assess_type.js

@@ -0,0 +1,384 @@
+var lianyungang_Station = new Array;
+var yancheng_Station = new Array;
+var nantong_Station = new Array;
+var r1 = new Array();
+var r2 = new Array();
+var r3 = new Array();
+var rank = new Array();
+var itemArray = new Array();
+/**
+ * 点击查询
+ */
+function queryTypeClick() {
+    //每次点击前清空表格数据
+    $(".table-tbody").empty('');
+    var start_date = $("#start-time").val();
+    var end_date = $("#end-time").val();
+    if (start_date == null || start_date == '' || start_date == undefined ||
+        end_date == null || end_date == '' || end_date == undefined) {
+        tip("请选择起止日期");
+        return;
+    } else {
+        start_date += " 00:00:00";
+        end_date += " 23:59:59";
+    }
+    var startStr = start_date.replace(/-/g, '/');
+    var endStr = end_date.replace(/-/g, '/');
+    var start = new Date(startStr);
+    //开始日期取前一天的23:00
+    // start.setDate(start.getDate() - 1);
+    start_date = start.Format("yyyy-MM-dd HH:mm:ss");
+    var end = new Date(endStr);
+    if (start > end) {
+        tip("开始时间不能比结束时间大");
+        return;
+    }
+    var param = {
+        "dept_id": $("#fsList").val(),
+        "start_date": start_date,
+        "end_date": end_date,
+    }
+    var url = "f/statistics/score/item/info";
+    var strTbody = '';
+    post_common_service(url, param, function(data) {
+        // 管道中心受检人平均每人次扣分
+        check_people_avg(data);
+    }, function(error) {
+        return "";
+    });
+}
+
+/**
+ * 表格初始化
+ */
+function initQueryType() {
+    // 默认初始化前一周查所有
+    var tdaytime = moment();
+    var start_time = "";
+    var end_time = "";
+    if (tdaytime.get('D') >= 26) {
+        start_time = tdaytime.set('date', 26).format("YYYY-MM-DD");
+        tdaytime = moment();
+        end_time = tdaytime.set('date', 26).add(1, 'M').format("YYYY-MM-DD");
+    } else {
+        start_time = tdaytime.set('date', 26).subtract(1, 'M').format("YYYY-MM-DD");
+        tdaytime = moment();
+        end_time = tdaytime.set('date', 26).format("YYYY-MM-DD");
+
+    }
+
+    // 默认初始化时间页面回显
+    $("#start-time").val(start_time);
+    $("#end-time").val(end_time);
+    var start_date = start_time + " 00:00:00";
+    var end_date = end_time + " 00:00:00";
+    var start = new Date(start_date);
+    //开始日期取前一天的23:00
+    // start.setDate(start.getDate() - 1);
+    start_date = start.Format("yyyy-MM-dd HH:mm:ss");
+    var param = {
+        "start_date": start_date,
+        "end_date": end_date,
+    }
+    var url = "f/statistics/score/item/info";
+    var strTbody = '';
+
+    post_common_service(url, param, function(data) {
+        // 管道中心受检人平均每人次扣分
+        check_people_avg(data);
+    }, function(error) {
+        return "";
+    });
+
+}
+
+/**
+ * 表头拼接及数据传入
+ * @param {*} data
+ */
+function getHeadHtml(data) {
+    var strHead = "";
+    itemArray = data.itemList;
+    var colspanNum = data.itemList.length + 1;
+    strHead += "<tr><th rowspan='2' width='6%'>道管整体排名</th><th rowspan='2' width='6%'>道管</th><th rowspan='2' width='6%'>管道内服务区排名</th>";
+    strHead += "<th rowspan='2' width='10%'>服务区</th><th rowspan='2' width='6%'>受检次数</th>";
+    strHead += "<th colspan=" + colspanNum + " height='40px'>存在问题扣分详情</th><th rowspan='2' width='6%'>管道中心受检服务区平均扣分(千分制)</th></tr><tr>";
+    for(var i=0;i<data.itemList.length;i++){
+        strHead += "<th width='55px'>"+data.itemList[i]+"</th>";
+    }
+    strHead += "<th width='55px'>扣分合计</th></tr>";
+    return strHead;
+}
+
+/**
+ * 表格拼接及数据传入
+ * @param {*} data
+ * @param {*} i
+ * @param {*} avg
+ */
+function gethtml(data, i, organList, avg, lists) {
+    var strTbody = "";
+    debugger;
+    if (i == 0 || i == organList[0] || i == organList[1]) {
+
+        var ranking;
+        var name = "";
+        var rowspan = 0;
+        order = 1;
+        if (i == 0) {
+            name = "连云港";
+            rowspan = organList[0];
+            ranking = rank[i];
+            for (var i = 0; i < lists.length; i++) {
+                if (avg > lists[i]) {
+                    order = order + 1;
+                }
+            }
+        } else if (i == organList[0]) {
+            name = "盐城";
+            rowspan = organList[1]-organList[0];
+            ranking = rank[i];
+            for (var i = 0; i < lists.length; i++) {
+                if (avg > lists[i]) {
+                    order = order + 1;
+                }
+            }
+        } else if (i == organList[1]) {
+            name = "南通";
+            rowspan = organList[2]-organList[1];
+            ranking = rank[i];
+            for (var i = 0; i < lists.length; i++) {
+                if (avg > lists[i]) {
+                    order = order + 1;
+                }
+            }
+        }
+        strTbody += "<tr><td rowspan=" + rowspan + " width='6%'>" + order + "</td><td rowspan=" + rowspan + " width='6%'>" + name + "</td>";
+        strTbody += "<td width='6%'>" + ranking + "</td><td width='10%'>" + data.name + "</td><td width='6%'>" + filter(data.checked_num, '0');
+        for (var i=0;i<itemArray.length;i++) {
+            strTbody += "</td><td width='55px'>" + getItemScore(data, itemArray[i]);
+        }
+        strTbody += "</td><td width='55px'>" + data.all_check_score + "</td><td rowspan=" + rowspan + " width='6%'>" + avg + "</td>";
+        strTbody += "</tr>";
+    } else {
+        strTbody += "<tr><td>" + rank[i] + "</td>";
+        strTbody += "<td>" + data.name + "</td><td>" + filter(data.checked_num, '0');
+        for (var i=0;i<itemArray.length;i++) {
+            strTbody += "</td><td>" + getItemScore(data, itemArray[i]);
+        }
+        strTbody += "</td><td>" + data.all_check_score + "</td>";
+        strTbody += "</tr>";
+
+    }
+    return strTbody;
+}
+
+function getTotalHtml(data) {
+    var html = "<tr><td>合计</td><td></td><td></td><td></td><td>" + data.totalcheckedCount;
+        for (var i=0;i<itemArray.length;i++) {
+            html += "</td><td>" + getTotalScore(data, itemArray[i]);
+        }
+        html += "</td><td>" + data.totalAll + "</td><td>-</td></tr>";
+    return html;
+}
+
+/**
+ * 获取扣分合计
+ * @param {*} obj
+ * @param {*} check_item_name
+ */
+function getTotalScore(data, check_item_name) {
+    for (var i in data) {
+        // console.log(i);
+        if (i.indexOf(check_item_name) > -1) {
+            return data[i];
+        }
+    }
+    return 0;
+}
+/**
+ * 管道中心受检服务区平均扣分
+ * @param {*} data
+ */
+function check_people_avg(data) {
+    var list = data.list;
+    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);
+    }
+    var dataArray = new Array();
+    var sum = 0;
+    var sum1 = 0;
+    var id = 1;
+    for (k = 0; k < list.length; k++) {
+        sum = parseFloat(sum) + parseFloat(filterByZeroHandle(list[k].all_check_score, '0'));
+        sum1 = parseFloat(sum1) + parseFloat(filterByZeroHandle(list[k].checked_num, '0'));
+        if (k == organArray[0]-1) {
+            dataArray.push(filterJudge(sum, sum1));
+            sum = 0;
+            sum1 = 0;
+        }
+        if (k == organArray[1]-1) {
+            dataArray.push(filterJudge(sum, sum1));
+            sum = 0;
+            sum1 = 0;
+        }
+        if (k == organArray[2]-1) {
+            dataArray.push(filterJudge(sum, sum1));
+            sum = 0;
+            sum1 = 0;
+        }
+    }
+
+    // 组装表格头部
+    $(".table-thead")[0].innerHTML = getHeadHtml(data);
+
+    // 道管下的服务区排名
+    ranking_method(list,organArray);
+    debugger;
+    for (i = 0; i < list.length; i++) {
+        if (i == 0) {
+            $(".table-tbody").append(gethtml(list[i], i, organArray, dataArray[0], dataArray));
+        } else if (i == organArray[0]) {
+            $(".table-tbody").append(gethtml(list[i], i, organArray, dataArray[1], dataArray));
+        } else if (i == organArray[1]) {
+            $(".table-tbody").append(gethtml(list[i], i, organArray, dataArray[2], dataArray));
+        } else {
+            $(".table-tbody").append(gethtml(list[i], i, organArray));
+        }
+    }
+    $(".table-tbody").append(getTotalHtml(data));
+}
+/**
+ * 道管下的服务区排名
+ * @param {*} data
+ */
+function ranking_method(data,organArray) {
+    //清空数组
+    lianyungang_Station.length = 0;
+    yancheng_Station.length = 0;
+    nantong_Station.length = 0;
+    r1.length = 0;
+    r2.length = 0;
+    r3.length = 0;
+    rank.length = 0;
+    // 把收费站得分分别添加到3个数组
+    for (i = 0; i < data.length; i++) {
+        if (i >= 0 && i <= organArray[0]-1)
+            lianyungang_Station.push(filterByZeroHandle(filterJudge(data[i].all_check_score, data[i].checked_num), '0'));
+        else if (i > organArray[0]-1 && i <= organArray[1]-1)
+            yancheng_Station.push(filterByZeroHandle(filterJudge(data[i].all_check_score, data[i].checked_num), '0'));
+        else
+            nantong_Station.push(filterByZeroHandle(filterJudge(data[i].all_check_score, data[i].checked_num), '0'));
+    }
+    // 得分转化为3个排名数组
+    for (var i = 1; i <= 3; i++) {
+        station_rank(i);
+    }
+    // 将3个排名数组合并成一个数组
+    rank = r1.concat(r2).concat(r3);
+}
+
+/**
+ * 排名
+ */
+function station_rank_method(array, rank) {
+    rank[0] = 1;
+    for (var i = 1; i < array.length; i++) {
+        if (array[i - 1] == array[i]) {
+            rank[i] = rank[i - 1];
+        } else {
+            rank[i] = i + 1;
+        }
+    }
+}
+
+/**
+ * 得分转化为排名
+ * @param {*} type
+ */
+function station_rank(type) {
+    if (type == 1) {
+        station_rank_method(lianyungang_Station, r1);
+    } else if (type == 2) {
+        station_rank_method(yancheng_Station, r2);
+    } else if (type == 3) {
+        station_rank_method(nantong_Station, r3);
+    }
+}
+
+/**
+ * 过滤undefined
+ * @param {*} value
+ * @param {*} default_display_value
+ */
+function filter(value, default_display_value) {
+    if (value != '' && value != undefined) {
+        return value;
+    } else if (default_display_value != undefined) {
+        return default_display_value;
+    } else {
+        return "";
+    }
+}
+
+/**
+ * 获取扣分详情
+ * @param {*} obj
+ * @param {*} check_item_name
+ */
+function getItemScore(obj, check_item_name) {
+    var names = obj.checked_socre_name;
+    var scores = obj.checked_score;
+
+    for (var i = 0; i < names.length; i++) {
+        if (names[i] != null && names[i].indexOf(check_item_name) > -1) {
+            return scores[i];
+        }
+    }
+    return 0;
+}
+
+/**
+ * 过滤除数为0和保留二位小数时出现的0.00
+ * @param {*} value
+ * @param {*} default_display_value
+ */
+function filterByZeroHandle(value, default_display_value) {
+    if (isNaN(value)) {
+        return default_display_value;
+    } else {
+        if ((value + '').endsWith('.00')) {
+            return value.substring(0, value.length - 3);
+        }
+        return value;
+    }
+}
+
+function filterJudge(num1, num2) {
+    if (num2 == 0) {
+        return 0;
+    } else {
+        return (num1 / num2).toFixed(2);
+    }
+}
+
+function exportExcel() {
+    var start_date = $("#start-time").val();
+    var end_date = $("#end-time").val();
+    if (start_date == '' || end_date == '') {
+        tip("请选择起止日期");
+        return;
+    } else {
+        start_date += " 00:00:00";
+        end_date += " 23:59:59";
+        var start = new Date(start_date);
+        //开始日期取前一天的23:00
+        // start.setDate(start.getDate() - 1);
+        start_date = start.Format("yyyy-MM-dd HH:mm:ss");
+    }
+    window.open(getserveraddr() + "f/file/score/item/info?start_date=" + start_date + "&end_date=" + end_date);
+}

+ 2 - 2
VisualInspection/fwq/js/statistics/operation_management_integration.js

@@ -19,7 +19,7 @@ function queryTypeClick() {
         return;
     } else {
         start_date += " 00:00:00";
-        end_date += " 00:00:00";
+        end_date += " 23:59:59";
     }
     var startStr = start_date.replace(/-/g, '/');
     var endStr = end_date.replace(/-/g, '/');
@@ -199,7 +199,7 @@ function exportExcel() {
         return;
     } else {
         start_date += " 00:00:00";
-        end_date += " 00:00:00";
+        end_date += " 23:59:59";
         var start = new Date(start_date);
         //开始日期取前一天的23:00
         // start.setDate(start.getDate() - 1);

+ 100 - 0
VisualInspection/fwq/view/statistics/assess_type.html

@@ -0,0 +1,100 @@
+<!--考核问题分布报表-->
+<script src="/fwq/js/statistics/assess_type.js?__inline"></script>
+<link rel="stylesheet" type="text/css" href="/css/statistics/assess_situation.css?__inline">
+<div class="container-fluid ">
+    <div class="form-div">
+        <form  class="form-horizontal">
+            <div class="form-group">
+                <div  class="form-group col-sm-5">
+                    <label class="col-sm-2">查询日期</label>
+                    <div class="col-sm-5">
+                        <input type="text" id="start-time" class="form-control form-date" placeholder="开始日期">
+                    </div>
+                    <div class="col-sm-5">
+                        <input type="text" id="end-time" class="form-control form-date" placeholder="结束日期">
+                    </div>
+                </div>
+                <div  class="form-group col-sm-3">
+                    <div class="col-sm-6">
+                        <button class="btn btn-info2" type="button" onclick="queryTypeClick()">查询</button>
+                    </div>
+                    <div class="col-sm-6">
+                        <button class="btn btn-info3" type="button" onclick="exportExcel()" >导出Excel</button>
+                    </div>
+                </div>
+            </div>    
+        </form>
+    </div>
+    <div class="table-title"><span>温馨服务检查情况统计表</span></div>
+
+    <div class="row">
+          <!-- 使用一个div来显示数据表格 -->
+          <div class="datatable" data-checkable="false" data-sortable="false"  style="margin-bottom:0px;">
+              <div class="table-head" >
+                  <table border="1" width="100%" height="90px" align="center">
+                    <thead class="table-thead">
+                        <!-- <tr>
+                        <th rowspan="2" width="6%">道管整体排名</th>
+                        <th rowspan="2" width="6%">道管</th>
+                        <th rowspan="2" width="6%">管道内服务区排名</th>
+                        <th rowspan="2" width="8%">服务区</th>
+                        <th rowspan="2" width="6%">收费值机岗位人数</th>
+                        <th rowspan="2" width="6%">受检人数</th>
+                        <th rowspan="2" width="6%">受检次数</th>
+                        <th colspan="9" height="40px">存在问题扣分详情</th>
+                        <th rowspan="2" width="6%">受检人平均每人次扣分(千分制)</th>
+                        <th rowspan="2" width="6%">管道中心受检服务区平均扣分(千分制)</th>
+                        </tr>
+                        <tr>
+                        <th width="54px">环境卫生</th><th width="54px">仪容仪表</th><th width="54px">表情</th>
+                        <th width="54px">收费动作</th><th width="54px">文明用语</th><th width="54px">工作纪律</th>
+                        <th width="54px">便民服务</th><th width="54px">安全管理</th><th>扣分合计</th>
+                        </tr> -->
+                    </thead>
+                </table>
+            </div>
+          </div>
+          <div id="scrollTable" style="overflow:auto;margin-right:-10px;">
+              <div class="table-head" style="margin:0px;">
+                  <table border="1" width="100%" height="90px" align="center" style="border-top:0px;">
+                    <tbody class="table-tbody" style="background:white" align="center">
+               
+                    </tbody>
+                  </table></div>
+          </div>
+    </div>
+</div>
+<script>
+   
+    $(document).ready(function() {
+        // 设置滚动表格的高度
+        $("#scrollTable").height($(window).height() - 300);
+        // 仅选择日期
+        $("#start-time").datetimepicker(
+        {
+            language:  "zh-CN",
+            weekStart: 1,
+            todayBtn:  1,
+            autoclose: 1,
+            todayHighlight: 1,
+            startView: 2,
+            minView: 2,
+            forceParse: 0,
+            format: "yyyy-mm-dd"
+        });
+        // 仅选择日期
+        $("#end-time").datetimepicker(
+        {
+            language:  "zh-CN",
+            weekStart: 1,
+            todayBtn:  1,
+            autoclose: 1,
+            todayHighlight: 1,
+            startView: 2,
+            minView: 2,
+            forceParse: 0,
+            format: "yyyy-mm-dd"
+        });
+        initQueryType();
+    });
+</script>

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

@@ -0,0 +1,19 @@
+package com.xintong.visualinspection.bean;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author huangcheng
+ * @since 2018/5/14
+ */
+@Data
+public class FwqNum implements Serializable {
+    // 道管id
+    private Long parentid;
+    // 道管名称
+    private String organname;
+    // 服务区数量
+    private Integer sacount;
+}

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

@@ -4,7 +4,10 @@ import com.alibaba.dubbo.config.annotation.Reference;
 import com.xintong.visualinspection.bean.FwqDeptStatistic;
 import com.xintong.visualinspection.bean.FwqStatisticsBean;
 import com.xintong.visualinspection.controller.BaseController;
+import com.xintong.visualinspection.dao.cluster.DepartmentDao;
+import com.xintong.visualinspection.service.CommonService;
 import com.xintong.visualinspection.service.StatisticsService_F;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -26,6 +29,14 @@ public class StatisticsController_F extends BaseController {
             registry = "${dubbo.registry.address}")
     private StatisticsService_F statisticsService_f;
 
+    @Reference(version = "1.0.0",
+            application = "${dubbo.application.id}",
+            registry = "${dubbo.registry.address}")
+    private CommonService commonService;
+
+    @Autowired
+    private DepartmentDao departmentDao;
+
     /**
      * 公司12个月考核得分总体变化趋势分析
      */
@@ -78,4 +89,41 @@ public class StatisticsController_F extends BaseController {
         Map<String, List<FwqDeptStatistic>> s = statisticsService_f.getDeptStatistic(obj);
         return super.returnSuccessResult(s);
     }
+
+    /**
+     * 考核问题分布报表
+     * @param obj
+     * @return
+     */
+    @RequestMapping(value = "/score/item/info")
+    public String getScoreItemInfo(@RequestBody FwqStatisticsBean obj){
+        List<FwqStatisticsBean> lists=  statisticsService_f.getFeeStationCheckItemScore(obj);
+        int totalcheckedCount=0,
+                totalAll=0;
+        Map<String,Integer> scoreTypeMap = new HashMap<>();
+        for(FwqStatisticsBean bean:lists){
+            totalcheckedCount+=bean.getChecked_num();
+            totalAll+=bean.getAll_check_score();
+            List<String> names = bean.getChecked_socre_name();
+            List<Integer> scores = bean.getChecked_score();
+            for(int i=0;i<names.size();i++){
+                Integer score = scoreTypeMap.get(names.get(i));
+                if(score==null) {
+                    score = 0;
+                }
+                score+=scores.get(i);
+                if(names.get(i)!=null){
+                    scoreTypeMap.put(names.get(i), score);
+                }
+            }
+        }
+        Map<String,Object> resultMap = new HashMap<>();
+        resultMap.put("list", lists);
+        resultMap.put("totalcheckedCount", totalcheckedCount);
+        resultMap.put("totalAll", totalAll);
+        resultMap.put("organList", departmentDao.getOrganToSaCount());
+        resultMap.put("itemList", commonService.getCheckItemName(28L));
+        resultMap.putAll(scoreTypeMap);
+        return super.returnSuccessResult(resultMap);
+    }
 }

+ 10 - 3
VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/cluster/DepartmentDao.java

@@ -1,10 +1,15 @@
 package com.xintong.visualinspection.dao.cluster;
 
-import java.util.List;
-
-import com.xintong.visualinspection.bean.*;
+import com.xintong.visualinspection.bean.FeeStation;
+import com.xintong.visualinspection.bean.FwqNum;
+import com.xintong.visualinspection.bean.Organ;
+import com.xintong.visualinspection.bean.StatisticsBean;
+import com.xintong.visualinspection.bean.User;
+import com.xintong.visualinspection.bean.WreckerGroup;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+
 /**
  * 文件名:UserInfoDao
  * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
@@ -23,4 +28,6 @@ public interface DepartmentDao  {
     public FeeStation getFsBydeptId(Integer id);
     
     public List<StatisticsBean> selectFeeStationGroup(User obj);
+
+    List<FwqNum> getOrganToSaCount();
 }

+ 12 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/DepartmentMapper.xml

@@ -135,6 +135,18 @@
         	</if>
 			AND s.ORGAN_ID IS NOT NULL GROUP BY s.ORGAN_ID
 	</select>
+
+    <select id="getOrganToSaCount" resultType="com.xintong.visualinspection.bean.FwqNum">
+        SELECT
+          so.PARENTID,
+          replace(so2.ORGANNAME,'道管中心','') as ORGANNAME,
+          count(sa.NAME) AS sacount
+        FROM t_br_layer_service_area sa LEFT JOIN t_sys_organ so ON sa.ORGAN_ID = so.ID
+          LEFT JOIN t_sys_organ so2 ON so.PARENTID = so2.ID
+          WHERE so.status = 0
+        GROUP BY so.PARENTID
+        ORDER BY PARENTID
+    </select>
     
    
     

+ 4 - 0
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/dao/FwqStatisticsDao.java

@@ -12,4 +12,8 @@ import java.util.List;
 @Mapper
 public interface FwqStatisticsDao {
     List<FwqStatisticsBean> getselectFeeStationOperationScoreDetail(FwqStatisticsBean obj);
+
+    List<FwqStatisticsBean> selectFeeStationCheckNum(FwqStatisticsBean obj);
+
+    List<FwqStatisticsBean> selectFeeStationCheckedPersonScoreDetail(FwqStatisticsBean obj);
 }

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

@@ -14,12 +14,46 @@
         WHERE
         o.check_type = #{check_type}
         <if test="start_date!=null and end_date != null">
-            AND o.check_time &gt;= #{start_date} AND o.check_time &lt; #{end_date}
+            AND o.check_time &gt;= #{start_date} AND o.check_time &lt;= #{end_date}
         </if>
         GROUP BY
         dept_id
     </select>
 
+    <select id="selectFeeStationCheckNum" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
+            resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
+        SELECT
+        COUNT(t.checked_dept) AS checked_num,
+        t.checked_dept AS dept_id
+        FROM view_check_task t
+        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="selectFeeStationCheckedPersonScoreDetail"
+            parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
+            resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
+        SELECT
+        t.checked_dept     AS dept_id,
+        t.check_item_id,
+        t.check_item_score AS score
+        FROM check_score t
+        LEFT JOIN view_check_task ct ON ct.id = t.task_id
+        WHERE t.check_item_score IS NOT NULL
+        <if test="start_date!=null and end_date != null">
+            AND ct.start_time &gt;= #{start_date} AND ct.end_time &lt;= #{end_date}
+        </if>
+        <if test="period_id != null and period_id != ''">
+            AND ct.period_id = #{period_id}
+        </if>
+    </select>
+
 </mapper>
 
 

+ 110 - 0
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java

@@ -5,6 +5,7 @@ import com.xintong.visualinspection.bean.CheckTaskPeriod;
 import com.xintong.visualinspection.bean.FeeStation;
 import com.xintong.visualinspection.bean.FwqDeptStatistic;
 import com.xintong.visualinspection.bean.FwqStatisticsBean;
+import com.xintong.visualinspection.bean.Item;
 import com.xintong.visualinspection.bean.Organ;
 import com.xintong.visualinspection.service.CommonService;
 import com.xintong.visualinspection.service.StatisticsService_F;
@@ -338,4 +339,113 @@ public class StatisticsServiceImpl implements StatisticsService_F {
 
         return listMap;
     }
+
+    @Override
+    public List<FwqStatisticsBean> getFeeStationCheckItemScore(FwqStatisticsBean obj) {
+
+        // 获得所有服务区数据
+        List<FeeStation> saList = commonService.getAllDeptByLayer("SA");
+        Map<Long, Item> itemMap = commonService.getItemMap();
+        Map<Long, FwqStatisticsBean> mapStationInfos = new HashMap<>();
+        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());
+//                mapStationInfos.get(sta.getDept_id()).setChecked_people_num(sta.getChecked_people_num());
+            }
+        }
+
+        List<FwqStatisticsBean> listCheckedScore = fwqStatisticsDao.selectFeeStationCheckedPersonScoreDetail(obj);
+
+        // 处理同一个服务区中,如果item的parent_id是一样的话,将这些数据结合在一起
+        for (FwqStatisticsBean sta : listCheckedScore) {
+            sta.setItem_id(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
+        }
+        for (int i = 0; i < listCheckedScore.size(); i++) {
+            for (int j = listCheckedScore.size() - 1; j > i; j--) {
+                if (listCheckedScore.get(j).getDept_id().equals(listCheckedScore.get(i).getDept_id()) && listCheckedScore.get(j).getItem_id().equals(listCheckedScore.get(i).getItem_id())) {
+                    listCheckedScore.get(i).setScore(listCheckedScore.get(i).getScore() + listCheckedScore.get(j).getScore());
+                    listCheckedScore.remove(j);
+                }
+            }
+        }
+
+        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());
+                // 组装扣分类型内容
+                if (itemMap.get(sta.getCheck_item_id().longValue()).getParent_id() != null) {
+                    sta.setId(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
+                    if (itemMap.get(sta.getCheck_item_id().longValue()).getScore() == null) {
+                        sta.setName(itemMap.get(sta.getCheck_item_id().longValue()).getName());
+                    } else {
+                        sta.setName(itemMap.get(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id()).getName());
+                    }
+                }
+                statis.getChecked_socre_name().add(sta.getName());
+                statis.getChecked_score().add(sta.getScore());
+                statis.getChecked_score_ids().add(sta.getId());
+            }
+        }
+
+        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;
+
+    }
 }

+ 2 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/bean/FwqStatisticsBean.java

@@ -47,6 +47,8 @@ public class FwqStatisticsBean implements Serializable {
 
     private int score;
 
+    private Integer check_item_id;
+
     private Integer item_id;
 
     private int checked_num;

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

@@ -14,4 +14,7 @@ public interface StatisticsService_F {
     // 营运管理提升综合成绩汇总表
     Map<String, List<FwqDeptStatistic>> getDeptStatistic(FwqDeptStatistic obj);
 
+    // 考核问题分布报表数据
+    List<FwqStatisticsBean> getFeeStationCheckItemScore(FwqStatisticsBean obj);
+
 }

+ 1 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/util/CacheUtil.java

@@ -97,6 +97,7 @@ public class CacheUtil {
         List<Long> list = new ArrayList<Long>();
         list.add(26L);// 第三方暗访
         list.add(27L);// 现场检查
+        list.add(28L);// 服务区考核办法
         for (Long id : list) {
             List<String> itemList = itemService.getCheckItemName(id);
             CacheUtil.itemNameMap.put(id, itemList);