Quellcode durchsuchen

需求修改,bug修复

huangchengzdm vor 7 Jahren
Ursprung
Commit
b19b69d5fc
16 geänderte Dateien mit 415 neuen und 82 gelöschten Zeilen
  1. 1 1
      VisualInspection/fwq/js/statistics/dept_check_statistics.js
  2. 35 9
      VisualInspection/fwq/js/statistics/service_area_check_statistics.js
  3. 8 5
      VisualInspection/fwq/js/statistics/service_area_data_statistics.js
  4. 8 7
      VisualInspection/fwq/view/statistics/operation_management_integration.html
  5. 13 3
      VisualInspection/fwq/view/statistics/service_area_check_statistics.html
  6. 15 0
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/controller/FileExcelController_F.java
  7. 3 2
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/mapper/master/CheckDeptStatisticsMapper.xml
  8. 140 35
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/mapper/master/StatisticsMapper.xml
  9. 7 0
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/StatisticsService_F.java
  10. 38 15
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java
  11. 140 5
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsService_FImpl.java
  12. BIN
      Visuallnspection_fjq/visuallnspection_fjq/src/main/resources/fwq_user_statistic.xls
  13. 3 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/bean/FwqDeptStatistic.java
  14. 2 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/bean/FwqStatisticsBean.java
  15. 1 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/pojo/fwq/FwqStatisiticPojo.java
  16. 1 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/pojo/fwq/ServiceAreaStatistic.java

+ 1 - 1
VisualInspection/fwq/js/statistics/dept_check_statistics.js

@@ -15,7 +15,7 @@ $(function() {
         format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
     });
 
-    $("#month_date_from").val("2018/04");
+    $("#month_date_from").val("2018/07");
     $("#month_date_to").val(getCurrentTimeFormat());
 
 

+ 35 - 9
VisualInspection/fwq/js/statistics/service_area_check_statistics.js

@@ -15,7 +15,7 @@ $(function() {
         format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
     });
 
-    $("#month_date_from").val("2018-04");
+    $("#month_date_from").val("2018-07");
     $("#month_date_to").val(getCurrentTimeFormat());
 
 
@@ -30,16 +30,10 @@ $(function() {
         getscore($("#month_date_from").val(), $("#month_date_to").val(), m_s, s_s, e_s);
     });
 
-
     getscore("2018-04", moment(moment().format("YYYY-MM")).subtract(1, "month").format("YYYY-MM"), 3, 985, 1000);
 
-
-
 });
 
-
-
-
 function getscore(starttime, endtime, limitnumber, limitscore, limitscore2) {
 
     var data_p = {
@@ -47,12 +41,13 @@ function getscore(starttime, endtime, limitnumber, limitscore, limitscore2) {
         "end_date": moment(endtime + "-25 23:00:00").valueOf(),
         "limitnumber": limitnumber,
         "limitscore": limitscore,
-        "limitscore2": limitscore2
+        "limitscore2": limitscore2,
+        "sctype": $("#score_select").val()
     };
 
     //获取该人员排班
     var url = "f/statistics/user/score";
-
+    
     post_common_service(url, data_p, function(data) {
 
         var table = '';
@@ -96,4 +91,35 @@ function jumpuser(deptid) {
     isnew = false;
     changePage(url);
 
+}
+
+function exportExcel() {
+    var s_s = $("#start-score").val();
+    var e_s = $("#end-score").val();
+    var m_s = $("#month_number").val();
+    if (!isRealNum(s_s) || !isRealNum(e_s) || !isRealNum(m_s)) {
+        layer.msg('参数有错误!');
+        return;
+    }
+    var starttime = $("#month_date_from").val();
+    var endtime = $("#month_date_to").val();
+    var limitnumber = m_s,
+        limitscore = s_s,
+        limitscore2 = e_s;
+    var data_p = {
+        "start_date": moment(starttime + "-25 23:00:00").valueOf(),
+        "end_date": moment(endtime + "-25 23:00:00").valueOf(),
+        "limitnumber": limitnumber,
+        "limitscore": limitscore,
+        "limitscore2": limitscore2,
+        "sctype": $("#score_select").val()
+    };
+    var addr = "";
+    for (var i in data_p) {
+        if (data_p[i] == null || data_p[i] == "") continue;
+        addr += "&" + i + "=" + data_p[i];
+    }
+    addr = addr.substr(1, addr.length - 1);
+    
+    window.open(getExcelServeraddr() + "f/file/user/static/excel?" + addr);
 }

+ 8 - 5
VisualInspection/fwq/js/statistics/service_area_data_statistics.js

@@ -77,7 +77,7 @@ $(function() {
         }
         var url_t = "f/statistics/employee/order/detail"
         post_common_service(url_t, data_t, function(res) {
-
+            
             $("#c_com_ranking").html("-");
             $("#c_score_ranking").html("-");         
             $("#l_com_ranking").html("-");
@@ -106,10 +106,13 @@ $(function() {
                     // if (dept_r != 0) {
                     //     $("#c_dept_ranking").html($("#c_dept_ranking").html() + "<i style='margin-left:10px;color:" + (dept_r > 0 ? "red" : "#0aef3d") + "' class='icon icon-long-arrow-" + (dept_r > 0 ? "down" : "up") + "'>" + Math.abs(dept_r) + "</i>");
                     // }
-                    var com_r = p_c.company_ranking - p_l.company_ranking;
-                    if (com_r != 0) {
-                        $("#c_com_ranking").html($("#c_com_ranking").html() + "<i style='margin-left:10px;color:" + (com_r > 0 ? "red" : "#0aef3d") + "' class='icon icon-long-arrow-" + (com_r > 0 ? "down" : "up") + "'>" + Math.abs(com_r) + "</i>");
-                    }
+                    if (typeof(p_c.company_ranking) != undefined && p_c.company_ranking != null && typeof(p_l.company_ranking) != undefined && p_l.company_ranking != null) {
+                        var com_r = p_c.company_ranking - p_l.company_ranking;
+                        if (com_r != 0) {
+                            $("#c_com_ranking").html($("#c_com_ranking").html() + "<i style='margin-left:10px;color:" + (com_r > 0 ? "red" : "#0aef3d") + "' class='icon icon-long-arrow-" + (com_r > 0 ? "down" : "up") + "'>" + Math.abs(com_r) + "</i>");
+                        }
+                    } 
+               
                     // var road_r = p_c.center_ranking - p_l.center_ranking;
                     // if (road_r != 0) {
                     //     $("#c_road_ranking").html($("#c_road_ranking").html() + "<i style='margin-left:10px;color:" + (road_r > 0 ? "red" : "#0aef3d") + "' class='icon icon-long-arrow-" + (road_r > 0 ? "down" : "up") + "'>" + Math.abs(road_r) + "</i>");

+ 8 - 7
VisualInspection/fwq/view/statistics/operation_management_integration.html

@@ -30,17 +30,18 @@
                  <thead>
                         <tr>
                         <!--<th rowspan="3" width="6%">排名</th><th rowspan="3" width="6%">道管</th>-->
-                        <th rowspan="3" width="8%">排名</th>
+                        <th rowspan="2" width="8%">排名</th>
                         <!--<th rowspan="3" width="6%">道管内排名</th>-->
-                        <th rowspan="3" width="8%">服务区</th><th colspan="4" width="24%" height="40px">温馨服务</th>
-                        <th colspan="2" width="12%" height="40px">现场检查</th><th rowspan="3" width="8%">总平均扣分</th>
+                        <th rowspan="2" width="8%">服务区</th>
+                        <!-- <th colspan="4" width="24%" height="40px">温馨服务</th> -->
+                        <th colspan="2" width="12%" height="40px">视频检查</th>
+                        <th colspan="2" width="12%" height="40px">第三方暗访</th>
+                        <th colspan="2" width="12%" height="40px">现场检查</th>
+                        <th rowspan="3" width="8%">总平均扣分</th>
                         <th rowspan="3" width="8%">平均得分</th>
                         </tr>
                         <tr> 
-                        <th colspan="2">公司检查</th><th colspan="2">第三方暗访</th>
-                        <th rowspan="2" width="54px">受检次数</th><th rowspan="2" width="54px">扣分合计</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>
                         </tr>

+ 13 - 3
VisualInspection/fwq/view/statistics/service_area_check_statistics.html

@@ -70,8 +70,15 @@
         </div>
 
         <label class="col-sm-1" style="line-height:30px;width:80px">连续月数</label>
-        <div class="div-month col-sm-2">
-            <input id="month_number" type="number" placeholder="请输入0以上的整数" style="height:30px;padding:5px " value="3" />
+        <div class="div-month col-sm-1">
+            <input id="month_number" type="number" placeholder="请输入0以上的整数" style="height:30px;padding:5px;width:80px" value="3" />
+        </div>
+        <label class="col-sm-1" style="line-height:30px;width:80px">得分类型</label>
+        <div class="div-month col-sm-1">
+            <select class="form-control score-select" id="score_select">
+            <option value="2">综合得分</option>
+            <option value="1" selected>温馨服务</option>
+            </select>
         </div>
         <div class="form-group col-sm-3">
             <label for="exampleInputAccount1" class="col-sm-4" style="line-height:30px;width:80px">得分区间</label>
@@ -83,7 +90,10 @@
                 <input type="text" id="end-score" class="form-control form-date" value="1000">
             </div>
         </div>
-        <div class="col-sm-2 "><button class="btn btn-info2 col-sm-6 query-company " id="searchbtn">查询</button></div>
+        <div class="col-sm-2 ">
+            <button class="btn btn-info2 col-sm-6 query-company " id="searchbtn">查询</button>
+            <button class="btn btn-info2 col-sm-6 query-company " onclick="exportExcel()">导出</button>
+        </div>
     </div>
 
 

+ 15 - 0
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/controller/FileExcelController_F.java

@@ -3,6 +3,7 @@ package com.xintong.visualinspection.visuallnspection_fjq.controller;
 import com.xintong.visualinspection.bean.FwqCheckOther;
 import com.xintong.visualinspection.bean.FwqDeptStatistic;
 import com.xintong.visualinspection.bean.FwqStatisticsBean;
+import com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic;
 import com.xintong.visualinspection.util.DateUtil;
 import com.xintong.visualinspection.visuallnspection_fjq.service.CheckOtherService_F;
 import com.xintong.visualinspection.visuallnspection_fjq.service.StatisticsService_F;
@@ -102,4 +103,18 @@ public class FileExcelController_F extends BaseController {
         return super.returnSuccessResult(null);
     }
 
+    /**
+     * 服务区连续月报表
+     * @param req
+     * @param resp
+     * @param obj
+     * @return
+     */
+    @RequestMapping(value = "/user/static/excel",method=RequestMethod.GET)
+    public String getUserStatistic(HttpServletRequest req,HttpServletResponse resp,
+                                   ServiceAreaStatistic obj){
+        statisticsService_f.getFwqStatistic(obj, req, resp);
+        return super.returnSuccessResult(null);
+    }
+
 }

+ 3 - 2
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/mapper/master/CheckDeptStatisticsMapper.xml

@@ -55,6 +55,7 @@
         check_dept_score
         SET
         <if test="score != null">score = #{score},</if>
+        <if test="scoreWxfw != null">score_wxfw = #{scoreWxfw},</if>
         <if test="integral != null">integral = #{integral},</if>
         id = id
         WHERE
@@ -63,9 +64,9 @@
     <sql id="insertc">
          INSERT INTO
         check_dept_score
-        (dept_id,period_id,score,integral)
+        (dept_id,period_id,score,score_wxfw,integral)
         VALUES
-        (#{dept_id}, #{period_id},#{score},#{integral})
+        (#{dept_id}, #{period_id},#{score},#{scoreWxfw},#{integral})
     </sql>
 
     <select id="selectdepts" parameterType="com.xintong.visualinspection.bean.FwqDeptStatistic" resultMap="BaseResultMap">

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

@@ -23,7 +23,8 @@
     <select id="selectFeeStationCheckNum" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
             resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
         SELECT
-        COUNT(t.checked_dept) AS checked_num,
+        /*COUNT(t.checked_dept) AS checked_num,*/
+        15 AS checked_num,
         t.checked_dept AS dept_id
         FROM view_check_task t
         WHERE 1=1
@@ -80,7 +81,11 @@
 
     <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
+        SELECT
+            /*COUNT(1) AS checked_num, */
+            15 AS checked_num,
+            t.checked_dept dept_id
+        FROM view_check_task t
         WHERE 1=1
         <if test="dept_id != null and dept_id != ''">
             AND t.checked_dept =#{dept_id}
@@ -155,7 +160,8 @@
         a.*
         FROM (
         SELECT
-        count(t.id)     AS checked_num,
+        /*count(t.id)     AS checked_num,*/
+        15     AS checked_num,
         sum(cs.check_item_score) AS all_check_score,
         cs.check_item_id,
         cs.checked_dept as dept_id
@@ -179,24 +185,30 @@
     <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
+        sum(a.all_check_score) AS all_check_score,
+        sum(a.checked_num)     AS checked_num,
+        a.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
+            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
+            GROUP BY tab.mth
+            UNION ALL
+            SELECT
+            sum(tab2.checkd_all_score) AS all_check_score,
+            sum(tab2.checked_num)      AS checked_num,
+            tab2.mth
+            FROM (
+            <include refid="selectAllOtherCheckedInfoAllCheck"/>
+            ) tab2
+            GROUP BY tab2.mth
+        ) a
+        GROUP BY a.mth
     </select>
 
     <select id="selectFeeStationCheckedScore" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
@@ -219,20 +231,36 @@
     <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
+        sum(a.all_check_score) AS all_check_score,
+        sum(a.checked_num)     AS checked_num,
+        a.dept_id AS dept_id
         FROM (
-        <include refid="selectAllCheckedInfoAllCheck"/>
-        ) tab
-        WHERE 1=1
-        GROUP BY tab.checked_dept
+            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
+            GROUP BY tab.checked_dept
+            UNION ALL
+            SELECT
+            sum(tab2.checkd_all_score) AS all_check_score,
+            sum(tab2.checked_num)      AS checked_num,
+            tab2.dept_id AS dept_id
+            FROM (
+            <include refid="selectAllOtherCheckedInfoAllCheck"/>
+            ) tab2
+          GROUP BY tab2.dept_id
+          ) a
+        GROUP BY a.dept_id;
     </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,
+          /*count(DISTINCT m.task_id)   AS checked_num,*/
+          15   AS checked_num,
           sum(m.check_item_score)     AS all_check_score,
           m.check_item_id,
           m.checked_dept              AS dept_id
@@ -244,13 +272,27 @@
         ORDER BY m.checked_dept
     </select>
 
-    <select id="selectlimituser"   parameterType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic" resultType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic">
-
+    <select id="selectlimituser" parameterType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic" resultType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic">
         select a.* from (
-        <include refid="selectc"/>
+        <choose>
+            <when test="sctype != null &amp;&amp; sctype != '' &amp;&amp; sctype == 2 ">
+                <include refid="selectc"/>
+            </when>
+            <otherwise>
+                <include refid="selectcwxfw"/>
+            </otherwise>
+        </choose>
         ) a where a.dept_id IN ( select d.dept_id from  (select p.dept_id,
-        COUNT(dept_id) AS COUNT from (<include refid="selectc"/>) p GROUP BY p.dept_id ) d where d.count >= #{limitnumber} )
-
+        COUNT(dept_id) AS COUNT from (
+        <choose>
+            <when test="sctype != null &amp;&amp; sctype != '' &amp;&amp; sctype == 2 ">
+                <include refid="selectc"/>
+            </when>
+            <otherwise>
+                <include refid="selectcwxfw"/>
+            </otherwise>
+        </choose>
+        ) p GROUP BY p.dept_id ) d where d.count >= #{limitnumber} )
     </select>
 
     <sql id="selectc">
@@ -264,6 +306,17 @@
         GROUP BY dept_id, period_id
     </sql>
 
+    <sql id="selectcwxfw">
+        SELECT *
+        FROM
+        check_dept_score AS user_total_score
+        WHERE
+        period_id >= #{startperiod_id}
+        AND period_id &lt;= #{endperiod_id}
+        AND score_wxfw >= #{limitscore} AND score_wxfw &lt;= #{limitscore2}
+        GROUP BY dept_id, period_id
+    </sql>
+
 
     <sql id="selectOneAllCheckedInfoData">
         SELECT
@@ -274,7 +327,8 @@
         FROM
         (
         SELECT
-        COUNT(t.id)             AS checked_num,
+        /*COUNT(t.id)             AS checked_num,*/
+        15             AS checked_num,
         monthfunc(t.start_time) AS mth,
         t.checked_dept
         FROM
@@ -329,7 +383,8 @@
         FROM
         (
         SELECT
-        COUNT(t.checked_dept)   AS checked_num,
+        /*COUNT(t.checked_dept)   AS checked_num,*/
+        15   AS checked_num,
         monthfunc(t.start_time) AS mth,
         t.id,
         t.checked_dept
@@ -377,6 +432,56 @@
         AND check_num_t.mth = checked_score_t.mth
     </sql>
 
+    <!--第三方扣分-包含未扣分的-->
+    <sql id="selectAllOtherCheckedInfoAllCheck">
+        SELECT
+        other_check_num_t.checked_num,
+        other_check_num_t.mth,
+        IFNULL(other_checked_score_t.checkd_all_score, 0) AS checkd_all_score,
+        other_check_num_t.dept_id
+        FROM
+        (
+        SELECT
+        COUNT(oc.dept_id)  AS checked_num,
+        oc.check_time_name AS mth,
+        oc.dept_id
+        FROM
+        other_check oc
+        WHERE 1=1
+        <if test="start_date !=null">
+            AND oc.check_time >= #{start_date}
+        </if>
+        <if test="end_date !=null">
+            AND oc.check_time &lt; #{end_date}
+        </if>
+        <if test="mth!=null and mth!=''">
+            AND oc.check_time_name =#{mth}
+        </if>
+        GROUP BY
+        oc.dept_id,
+        oc.check_time_name
+        ) other_check_num_t
+        LEFT JOIN (
+        SELECT
+        oc.check_time_name  AS mth,
+        sum(oc.check_score) AS checkd_all_score,
+        dept_id
+        FROM other_check oc
+        WHERE 1 = 1
+        <if test="start_date !=null">
+            AND oc.check_time >= #{start_date}
+        </if>
+        <if test="end_date !=null">
+            AND oc.check_time &lt; #{end_date}
+        </if>
+        <if test="mth!=null and mth!=''">
+            AND oc.check_time_name =#{mth}
+        </if>
+        GROUP BY mth, oc.dept_id
+        ) other_checked_score_t ON other_checked_score_t.dept_id = other_check_num_t.dept_id
+        AND other_check_num_t.mth = other_checked_score_t.mth
+    </sql>
+
 </mapper>
 
 

+ 7 - 0
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/StatisticsService_F.java

@@ -2,9 +2,12 @@ package com.xintong.visualinspection.visuallnspection_fjq.service;
 
 import com.xintong.visualinspection.bean.FwqDeptStatistic;
 import com.xintong.visualinspection.bean.FwqStatisticsBean;
+import com.xintong.visualinspection.pojo.fwq.FwqStatisiticPojo;
+import com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 public interface StatisticsService_F {
 
@@ -13,4 +16,8 @@ public interface StatisticsService_F {
     void getDeptStatisticExcel(FwqDeptStatistic fwqDeptStatistic, HttpServletRequest req, HttpServletResponse resp);
 
     void getFeeStationCheckItemScore(FwqStatisticsBean obj, HttpServletRequest req, HttpServletResponse resp);
+
+    List<FwqStatisiticPojo> getFwqStatistic(ServiceAreaStatistic obj);
+
+    void getFwqStatistic(ServiceAreaStatistic obj, HttpServletRequest req, HttpServletResponse resp);
 }

+ 38 - 15
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java

@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
@@ -83,7 +84,9 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         List<FwqStatisticsBean> onsite_beans = fwqStatisticsDao.getselectFeeStationOperationScoreDetail(obj);
 
         for (FwqStatisticsBean company_bean : company_beans) {
-            mapStationInfos.get(company_bean.getDept_id()).setCompany_check_num(company_bean.getChecked_num());
+//            mapStationInfos.get(company_bean.getDept_id()).setCompany_check_num(company_bean.getChecked_num());
+            // 公司稽查固定15次稽查
+            mapStationInfos.get(company_bean.getDept_id()).setCompany_check_num(15);
             mapStationInfos.get(company_bean.getDept_id()).setCompany_total_score(company_bean.getAll_check_score());
         }
         for (FwqStatisticsBean third_bean : third_beans) {
@@ -101,20 +104,24 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         DecimalFormat df = new DecimalFormat("0.00");
         for (Map.Entry<Long, FwqStatisticsBean> station : stationInfos) {
             float avg = 0;
+            float avgWxfw = 0;
             FwqStatisticsBean value = station.getValue();
             value.setThird_check_num(1);
             value.setOnsite_check_num(1);
             // 设置总平均扣分
             if (value.getCompany_check_num() > 0 || value.getThird_check_num() > 0) {
-                avg += (value.getCompany_total_score() + value.getThird_total_score()) / 2.0 / (value.getCompany_check_num() + value.getThird_check_num());
-            }
-            if (value.getOnsite_check_num() > 0) {
-                avg += value.getOnsite_total_score() / 2.0 / value.getOnsite_check_num();
+                avgWxfw += value.getCompany_total_score() / 15.0;
+                avg += value.getCompany_total_score() / 15.0 * 0.3 + value.getThird_total_score() * 0.4 + value.getOnsite_total_score() * 0.3;
             }
+//            if (value.getOnsite_check_num() > 0) {
+//                avg += value.getOnsite_total_score() / 2.0 / value.getOnsite_check_num();
+//            }
             value.setCheck_total_avg(df.format(avg));
             // 设置平均得分
             Float score_avg = (1000 - Float.valueOf(df.format(avg)));
+            Float score_wxfw_avg = (1000-Float.valueOf(df.format(avgWxfw)));
             value.setScore_avg(score_avg.toString());
+            value.setScore_wxfw_avg(score_wxfw_avg.toString());
         }
         List<FwqStatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
         sortList.sort(new Comparator<FwqStatisticsBean>() {
@@ -158,6 +165,7 @@ public class StatisticsServiceImpl implements StatisticsService_F {
             for (FwqStatisticsBean s : sortList) {
                 FwqDeptStatistic ss = new FwqDeptStatistic();
                 ss.setScore(Double.parseDouble(s.getScore_avg()));
+                ss.setScoreWxfw(Double.parseDouble(s.getScore_wxfw_avg()));
                 ss.setIntegral(sortList.size() - s.getCompany_ranking2() + 1);
                 ss.setDept_id(s.getDept_id());
                 ss.setPeriod_id(period.getId());
@@ -406,11 +414,15 @@ public class StatisticsServiceImpl implements StatisticsService_F {
 
         // 处理同一个服务区中,如果item的parent_id是一样的话,将这些数据结合在一起
         for (FwqStatisticsBean sta : listCheckedScore) {
-            sta.setItem_id(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
+            Item item = itemMap.get(sta.getCheck_item_id().longValue());
+            if (item != null) {
+                sta.setItem_id(item.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())) {
+                if (listCheckedScore.get(j).getDept_id() != null && listCheckedScore.get(j).getDept_id().equals(listCheckedScore.get(i).getDept_id()) && listCheckedScore.get(j).getItem_id() != null && 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);
                 }
@@ -476,8 +488,13 @@ public class StatisticsServiceImpl implements StatisticsService_F {
     @Override
     public FwqRankingData getEmployeeRankingData(FwqStatisticsBean obj) {
         FwqRankingData data = new FwqRankingData();
-
-        CheckTaskPeriod lastTaskPeriod = commonService.getCheckTaskPeriod(obj.getStart_date().getTime()+1 * 1000 * 60 * 60, obj.getEnd_date().getTime()+1 * 1000 * 60 * 60);
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(obj.getStart_date());
+        cal.add(Calendar.MONTH, -1);
+        Calendar cal2 = Calendar.getInstance();
+        cal2.setTime(obj.getEnd_date());
+        cal2.add(Calendar.MONTH, -1);
+        CheckTaskPeriod lastTaskPeriod = commonService.getCheckTaskPeriod(cal.getTime().getTime()+1 * 1000 * 60 * 60, cal2.getTime().getTime()+1 * 1000 * 60 * 60);
         if (lastTaskPeriod != null) {
             FwqStatisticsBean temp = new FwqStatisticsBean();
             temp.setStart_date(new Date(lastTaskPeriod.getStarttime().getTime() - 1 * 1000 * 60 * 60));
@@ -606,11 +623,14 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         Map<Long, Organ> deptMap = commonService.getDeptMap();
         // 将list中的数据找到项目的父项目,然后去除重复的
         for (FwqStatisticsBean sta : list) {
-            sta.setItem_id(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
+            Item item = itemMap.get(sta.getCheck_item_id().longValue());
+            if (item != null) {
+                sta.setItem_id(item.getParent_id().intValue());
+            }
         }
         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())) {
+                if (list.get(j).getDept_id().equals(list.get(i).getDept_id()) && list.get(j).getItem_id() != null && list.get(j).getItem_id().equals(list.get(i).getItem_id())) {
                     list.get(i).setScore(list.get(i).getScore() + list.get(j).getScore());
                     list.remove(j);
                 }
@@ -643,7 +663,7 @@ public class StatisticsServiceImpl implements StatisticsService_F {
             if (statisticBoMap.containsKey(statisticsBean.getDept_id())) {
                 FwqStatisticsBo tmp = statisticBoMap.get(statisticsBean.getDept_id());
                 // 组装扣分类型内容
-                if (itemMap.get(statisticsBean.getCheck_item_id().longValue()).getParent_id() != null) {
+                if (itemMap.get(statisticsBean.getCheck_item_id().longValue()) != null && itemMap.get(statisticsBean.getCheck_item_id().longValue()).getParent_id() != null) {
                     statisticsBean.setId(itemMap.get(statisticsBean.getCheck_item_id().longValue()).getParent_id().intValue());
                     if (itemMap.get(statisticsBean.getCheck_item_id().longValue()).getScore() == null) {
                         statisticsBean.setName(itemMap.get(statisticsBean.getCheck_item_id().longValue()).getName());
@@ -990,15 +1010,18 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         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());
+            Item item = itemMap.get(sta.getCheck_item_id().longValue());
+            if (item != null) {
+                sta.setItem_id(item.getParent_id().intValue());
+                sta.setName(itemMap.get(item.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())) {
+                if (objList.get(j).getDept_id() != null && objList.get(j).getDept_id().equals(objList.get(i).getDept_id()) && objList.get(j).getItem_id() != null && 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);

+ 140 - 5
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsService_FImpl.java

@@ -7,6 +7,8 @@ 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.pojo.fwq.FwqStatisiticPojo;
+import com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic;
 import com.xintong.visualinspection.service.CommonService;
 import com.xintong.visualinspection.visuallnspection_fjq.dao.FwqCheckDeptStatisticsDao;
 import com.xintong.visualinspection.visuallnspection_fjq.dao.FwqStatisticsDao;
@@ -81,7 +83,7 @@ public class StatisticsService_FImpl implements StatisticsService_F {
         List<FwqStatisticsBean> onsite_beans = fwqStatisticsDao.getselectFeeStationOperationScoreDetail(obj);
 
         for (FwqStatisticsBean company_bean : company_beans) {
-            mapStationInfos.get(company_bean.getDept_id()).setCompany_check_num(company_bean.getChecked_num());
+            mapStationInfos.get(company_bean.getDept_id()).setCompany_check_num(15);
             mapStationInfos.get(company_bean.getDept_id()).setCompany_total_score(company_bean.getAll_check_score());
         }
         for (FwqStatisticsBean third_bean : third_beans) {
@@ -104,11 +106,9 @@ public class StatisticsService_FImpl implements StatisticsService_F {
             value.setOnsite_check_num(1);
             // 设置总平均扣分
             if (value.getCompany_check_num() > 0 || value.getThird_check_num() > 0) {
-                avg += (value.getCompany_total_score() + value.getThird_total_score()) / 2.0 / (value.getCompany_check_num() + value.getThird_check_num());
-            }
-            if (value.getOnsite_check_num() > 0) {
-                avg += value.getOnsite_total_score() / 2.0 / value.getOnsite_check_num();
+                avg += value.getCompany_total_score() / 15.0 * 0.3 + value.getThird_total_score() * 0.4 + value.getOnsite_total_score() * 0.3;
             }
+
             value.setCheck_total_avg(df.format(avg));
             // 设置平均得分
             Float score_avg = (1000 - Float.valueOf(df.format(avg)));
@@ -584,6 +584,141 @@ public class StatisticsService_FImpl implements StatisticsService_F {
         exportExcel("温馨服务检查情况统计表", "fwq_checked_item_info", map, resp);
     }
 
+    @Override
+    public List<FwqStatisiticPojo> getFwqStatistic(ServiceAreaStatistic obj) {
+
+        List<CheckTaskPeriod> checkTaskPeriods = commonService.getAllCheckTaskPeriod();
+        Map<Long, Organ> deptMap = commonService.getDeptMap();
+
+        for (CheckTaskPeriod p : checkTaskPeriods) {
+            if (obj.getStart_date() + 1 * 1000 * 60 * 60 == p.getEndtime().getTime()) {
+                obj.setStartperiod_id(p.getId());
+            }
+            if (obj.getEnd_date() + 1 * 1000 * 60 * 60 == p.getEndtime().getTime()) {
+                obj.setEndperiod_id(p.getId());
+            }
+        }
+        if (obj.getStart_date() > (checkTaskPeriods.get(checkTaskPeriods.size() - 1).getEndtime().getTime() - 1 * 1000 * 60 * 60)) {
+            return new ArrayList<>();
+        }
+        if (obj.getEnd_date() < (checkTaskPeriods.get(0).getEndtime().getTime() - 1 * 1000 * 60 * 60)) {
+            return new ArrayList<>();
+        }
+        if (obj.getStart_date() < (checkTaskPeriods.get(0).getEndtime().getTime() - 1 * 1000 * 60 * 60)) {
+            obj.setStartperiod_id(checkTaskPeriods.get(0).getId());
+        }
+        if (obj.getEnd_date() > (checkTaskPeriods.get(checkTaskPeriods.size() - 1).getEndtime().getTime() - 1 * 1000 * 60 * 60)) {
+            obj.setEndperiod_id(checkTaskPeriods.get(checkTaskPeriods.size() - 1).getId());
+        }
+
+        List<CheckTaskPeriod> temp_p = new ArrayList<>();
+        for (CheckTaskPeriod p : checkTaskPeriods) {
+            if (p.getId() >= obj.getStartperiod_id() && p.getId() <= obj.getEndperiod_id()) {
+                temp_p.add(p);
+            }
+        }
+
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM");
+        //获取满足条件的服务区
+        List<ServiceAreaStatistic> fwqStatistics = fwqStatisticsDao.selectlimituser(obj);
+
+        HashMap<Integer, List<ServiceAreaStatistic>> usm = new HashMap<>();
+
+        for (ServiceAreaStatistic c : fwqStatistics
+                ) {
+            List<ServiceAreaStatistic> s = usm.get(c.getDept_id());
+            if (s == null) {
+                s = new ArrayList<>();
+            }
+            s.add(c);
+            usm.put(c.getDept_id(), s);
+            for (CheckTaskPeriod p : checkTaskPeriods) {
+                if (c.getPeriod_id().equals(p.getId())) {
+                    c.setP_str(simpleDateFormat.format(p.getEndtime()));
+                }
+            }
+        }
+
+        List<FwqStatisiticPojo> fwq_ids = new ArrayList<>();
+
+        //判断是否连续
+        for (Integer k : usm.keySet()) {
+            List<ServiceAreaStatistic> user_temp = new ArrayList<>();
+            boolean isM = false;
+
+            List<ServiceAreaStatistic> pp = new ArrayList<>();
+            //获取得分
+            List<ServiceAreaStatistic> ll = usm.get(k);
+            int count = 0;
+            for (CheckTaskPeriod p : temp_p) {
+                boolean isfond = false;
+                for (ServiceAreaStatistic s : ll) {
+                    if (s.getPeriod_id().equals(p.getId())) {
+                        isfond = true;
+                        pp.add(s);
+                        break;
+                    }
+                }
+                if (isfond) {
+                    count++;
+                    if (count >= obj.getLimitnumber()) {
+                        isM = true;
+                        user_temp.addAll(pp);
+                        pp.clear();
+                    }
+                } else {
+                    if (count >= obj.getLimitnumber()) {
+                        isM = true;
+                        user_temp.addAll(pp);
+                    }
+                    count = 0;
+                    pp.clear();
+                }
+            }
+
+            if (isM) {
+                FwqStatisiticPojo p = new FwqStatisiticPojo();
+                p.setDept_id(k.longValue());
+                p.setDept(deptMap.get(k.longValue()).getOrganname());
+                p.setFwqStatistics(user_temp);
+                fwq_ids.add(p);
+            }
+        }
+
+        for (FwqStatisiticPojo s:fwq_ids ) {
+            String dat = "";
+            for (ServiceAreaStatistic statistic : s.getFwqStatistics()) {
+                dat += statistic.getP_str() + "月、";
+            }
+            dat = dat.substring(0, dat.length() - 1);
+            s.setDes(dat);
+        }
+
+        return fwq_ids;
+    }
+
+    @Override
+    public void getFwqStatistic(ServiceAreaStatistic obj, HttpServletRequest req, HttpServletResponse resp) {
+        List<FwqStatisiticPojo> list = this.getFwqStatistic(obj);
+        SimpleDateFormat d = new SimpleDateFormat("yyyy/MM");
+        String name = "";
+        if ("2".equals(obj.getSctype())) {
+            name = "综合得分";
+        } else if ("1".equals(obj.getSctype())) {
+            name = "温馨服务得分";
+        }
+        List<Integer> temp = new ArrayList<>();
+        for (int i = 1; i <= list.size(); i++) {
+            temp.add(i);
+        }
+
+        Map<String, Object> map = new HashMap<>();
+        map.put("list", temp);
+        map.put("datas", list);
+        map.put("title", "服务区" + name + "连续月统计" + "(" + d.format(obj.getStart_date()) + "---" + d.format(obj.getEnd_date()) + ")");
+        exportExcel("服务区连续月统计", "fwq_user_statistic", map, resp);
+    }
+
     private void exportExcel(String fileName, String excelTemplateName, Map<String, Object> map,
                              HttpServletResponse resp) {
         String path = "./" + fileName + ".xls";

BIN
Visuallnspection_fjq/visuallnspection_fjq/src/main/resources/fwq_user_statistic.xls


+ 3 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/bean/FwqDeptStatistic.java

@@ -16,7 +16,10 @@ public class FwqDeptStatistic implements Cloneable,Serializable {
     private Long start_date;
     private Long end_date;
     private Integer integral;
+    // 综合得分
     private Double score;
+    // 温馨服务得分
+    private Double scoreWxfw;
     private Integer startperiod_id;
     private Integer endperiod_id;
     private String dept_name;

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

@@ -71,6 +71,8 @@ public class FwqStatisticsBean implements Serializable {
     // 平均得分
     private String score_avg;
 
+    private String score_wxfw_avg;
+
     // 平均人均扣分
     private float check_score_avg;
 

+ 1 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/pojo/fwq/FwqStatisiticPojo.java

@@ -13,5 +13,6 @@ import java.util.List;
 public class FwqStatisiticPojo implements Serializable{
     private Long dept_id;
     private String dept;
+    private String des;
     private List<ServiceAreaStatistic> fwqStatistics;
 }

+ 1 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/pojo/fwq/ServiceAreaStatistic.java

@@ -26,6 +26,7 @@ public class ServiceAreaStatistic implements Serializable {
     private String p_str;
 
     private Integer count;
+    private String sctype;
 
 //    public void setUserTotalScore(){
 //        this.user_total_score = 1000 - user_total_score/(user_check_num*1.00);