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

服务区-营运管理提升综合成绩汇总表功能提交

huangchengzdm 8 лет назад
Родитель
Сommit
41e0006e89
16 измененных файлов с 897 добавлено и 12 удалено
  1. 122 0
      VisualInspection/fwq/js/statistics/dept_check_statistics.js
  2. 97 0
      VisualInspection/fwq/view/statistics/dept_check_statistics.html
  3. 13 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/gettway/StatisticsController_F.java
  4. 5 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/CommonServiceImpl.java
  5. 15 0
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/controller/FileExcelController_F.java
  6. 17 0
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/dao/FwqCheckDeptStatisticsDao.java
  7. 75 0
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/mapper/master/CheckDeptStatisticsMapper.xml
  8. 3 0
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/StatisticsService_F.java
  9. 213 11
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java
  10. 208 1
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsService_FImpl.java
  11. 61 0
      Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/ThreadTaskServiceImpl.java
  12. BIN
      Visuallnspection_fjq/visuallnspection_fjq/src/main/resources/fwq_dept_statistic.xls
  13. 45 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/bean/FwqDeptStatistic.java
  14. 3 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/service/CommonService.java
  15. 5 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/service/StatisticsService_F.java
  16. 15 0
      Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/service/ThreadTaskService_F.java

+ 122 - 0
VisualInspection/fwq/js/statistics/dept_check_statistics.js

@@ -0,0 +1,122 @@
+var year = new Date().getFullYear();
+$(function() {
+    // 公用方法,根据当前年月动态将13个月push数组
+    month_method();
+    // 公用方法,月份下拉框
+    // select_option();
+    // 回显当前年月份
+    // $(".div-month select").val(initDate);
+    $.jeDate("#month_date_from", {
+        isinitVal: true,
+        format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
+    });
+    $.jeDate("#month_date_to", {
+        isinitVal: true,
+        format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
+    });
+
+    $("#month_date_from").val("2018/04");
+    $("#month_date_to").val(moment(moment().format("YYYY/MM")).subtract(1, "month").format("YYYY/MM"));
+
+
+    $("#searchbtn").on("click", function() {
+        getdeptscore($("#month_date_from").val(), $("#month_date_to").val());
+
+    });
+
+
+    getdeptscore($("#month_date_from").val(), $("#month_date_to").val());
+
+});
+
+
+
+
+function exportExcel() {
+    var start_date = moment($("#month_date_from").val() + "-26 00:00:00").valueOf();
+    var end_date = moment($("#month_date_to").val() + "-26 00:00:00").valueOf();
+    if (start_date == '' || end_date == '') {
+        tip("请选择起止日期");
+        return;
+    }
+    window.open(getExcelServeraddr() + "f/file/dept/static/excel?start_date=" + start_date + "&end_date=" + end_date);
+}
+
+
+
+
+function getdeptscore(starttime, endtime) {
+
+    $("#table_title").html("(" + starttime + "---" + endtime + ")");
+
+    var time_m = moment(endtime).diff(moment(starttime), 'month')
+
+    var data_p = {
+        "start_date": moment(starttime + "-26 00:00:00").valueOf(),
+        "end_date": moment(endtime + "-26 00:00:00").valueOf(),
+
+    };
+
+    //获取该人员排班
+    var url = "f/statistics/dept";
+    
+    post_common_service(url, data_p, function(data) {
+
+        //     var table = '';
+
+        //先确定表格标题
+        var h_html = "<tr><th rowspan=2 style='width:30px'>序号</th><th rowspan=2 style='width:95px'>站名</th>";
+        var h_html_t = "<tr>"
+        for (var i = 0; i <= time_m; i++) {
+            h_html += "<th colspan=4 style='width:240px'>" + (moment(starttime).add(i, "month").format("MM月")) + "</th>";
+            h_html_t += "<th style='width:60px'>考核分</th><th style='width:60px'>积分</th><th style='width:60px'>累计积分</th><th style='width:60px'>排名</th>"
+        }
+        h_html += "</tr>";
+        h_html_t += "</tr>";
+        h_html += h_html_t;
+
+        $("#table_h").html(h_html)
+        $(".tb").css("width", (time_m + 1) * 4 * 60 + 125)
+            // $("#table").css("width",time_m*4*30+80)
+
+        var b_html = ""
+
+
+        //再确定表格列
+        if (Object.keys(data).length > 0) {
+            var cc = 0;
+            for (var i in data) {
+                var dd = data[i];
+                b_html += "<tr><td style='width:30px'>" + (++cc) + "</td><td style='width:95px'>" + dd[0].dept_name + "</td>"
+                var tt = moment(dd[0].time).diff(moment(starttime), 'month')
+                for (var op = 0; op < tt; op++) {
+                    b_html += "<td style='width:60px'>-</td>"
+                    b_html += "<td style='width:60px'>-</td>"
+                    b_html += "<td style='width:60px'>-</td>"
+                    b_html += "<td style='width:60px'>-</td>"
+                }
+                for (var p in dd) {
+                    var ss = dd[p];
+                    b_html += "<td style='width:60px'>" + ss.score + "</td>"
+                    b_html += "<td style='width:60px'>" + ss.integral + "</td>"
+                    b_html += "<td style='width:60px'>" + ss.total_integral + "</td>"
+                    b_html += "<td style='width:60px'>" + ss.total_ranking + "</td>"
+                }
+
+                var tt1 = moment(endtime).diff(moment(dd[dd.length - 1].time), 'month')
+                for (var op = 0; op < tt1; op++) {
+                    b_html += "<td style='width:60px'>-</td>"
+                    b_html += "<td style='width:60px'>-</td>"
+                    b_html += "<td style='width:60px'>-</td>"
+                    b_html += "<td style='width:60px'>-</td>"
+                }
+            }
+            b_html += "</tr>"
+
+        }
+
+        $("#table").html(b_html);
+
+    });
+
+}

+ 97 - 0
VisualInspection/fwq/view/statistics/dept_check_statistics.html

@@ -0,0 +1,97 @@
+<!--服务区-营运管理提升综合成绩汇总表-->
+<script src="/js/statistics/common_statistic.js?__inline"></script>
+<script src="/fwq/js/statistics/dept_check_statistics.js"></script>
+
+<style type="text/css">
+    table td,
+    table th {
+        text-align: center;
+        padding: 10px;
+        border: 1px solid #d9d9d9;
+        word-wrap: break-word;
+        padding: 0;
+        padding-top: 10px;
+        padding-bottom: 10px;
+    }
+    
+    table {
+        table-layout: fixed
+    }
+    
+    .table-title {
+        line-height: 50px;
+        text-align: center;
+    }
+    
+    .table-title span {
+        font-size: 22px;
+        color: #333;
+    }
+    
+    .table-head th {
+        border-color: #C7C6C5;
+        background-color: #d2d6de;
+    }
+    
+    .datatable {
+        background-color: rgba(0, 0, 0, 0)
+    }
+    
+    #table {
+        background-color: #fff
+    }
+    
+    .tb {
+        margin-left: auto;
+        margin-right: auto;
+    }
+</style>
+
+<div class="container-fluid ">
+    <div class="row">
+        <label class="col-sm-1" style="line-height:30px;width:80px">开始月</label>
+        <div class="div-month col-sm-1">
+            <input id="month_date_from" class="form-control form-date" type="text" placeholder="请选择" style="height:30px;">
+        </div>
+        <label class="col-sm-1" style="line-height:30px;width:80px">结束月</label>
+        <div class="div-month col-sm-1">
+            <input id="month_date_to" class="form-control form-date " type="text " placeholder="请选择 " style="height:30px; ">
+        </div>
+
+
+        <div class="col-sm-2 "><button class="btn btn-info2 col-sm-6 query-company " id="searchbtn">查询</button></div>
+        <div class="col-sm-1">
+            <button class="btn btn-primary " type="button" onclick="exportExcel()">导出Excel</button>
+        </div>
+    </div>
+
+
+</div>
+<div class="table-title"><span>营运管理提升综合成绩汇总表<span id="table_title"></span></span>
+</div>
+
+
+<div class="row">
+
+    <div class="datatable" data-checkable="false" style="margin-bottom: 0px; overflow-x: scroll;overflow-y: hidden; background: #ffffff00;" data-sortable="false">
+
+        <div class="tb" style="padding-right: 10px;">
+            <table border="0" class="table-head" width="100%" align="center" id="table_h">
+            </table>
+        </div>
+        <div class="tb" style="overflow-y: auto;height:500px;overflow-x: hidden;background:#fff">
+            <table border="0" width="100%" align="center" id="table"></table>
+
+        </div>
+        <!-- 使用一个div来显示数据表格   -->
+        <!-- <div id="scrollTable" style="height:500px;overflow:scroll;    margin-right: -10px;">
+            <table style="border-top:0;" border="0" width="100%" align="center" id="table" >
+                <tbody class="table-tbody" style="background:white; " align="center">
+
+                </tbody>
+            </table>
+        </div> -->
+    </div>
+
+</div>
+</div>

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

@@ -1,6 +1,7 @@
 package com.xintong.visualinspection.controller.gettway;
 
 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.service.StatisticsService_F;
@@ -65,4 +66,16 @@ public class StatisticsController_F extends BaseController {
         resultMap.put("totalOnsiteScore", totalOnsiteScore);
         return super.returnSuccessResult(resultMap);
     }
+
+    /**
+     * 营运管理提升综合成绩汇总表
+     *
+     * @param obj
+     * @return
+     */
+    @RequestMapping(value = "/dept")
+    public String getDeptStatistic(@RequestBody FwqDeptStatistic obj) {
+        Map<String, List<FwqDeptStatistic>> s = statisticsService_f.getDeptStatistic(obj);
+        return super.returnSuccessResult(s);
+    }
 }

+ 5 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/CommonServiceImpl.java

@@ -85,5 +85,10 @@ public class CommonServiceImpl implements CommonService {
        return period;
     }
 
+    @Override
+    public List<CheckTaskPeriod> getAllCheckTaskPeriod() {
+        return checkTaskPeriodDao.select(new CheckTaskPeriod());
+    }
+
 
 }

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

@@ -1,6 +1,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.util.DateUtil;
 import com.xintong.visualinspection.visuallnspection_fjq.service.CheckOtherService_F;
@@ -72,4 +73,18 @@ public class FileExcelController_F extends BaseController {
         return super.returnSuccessResult(null);
     }
 
+    /**
+     * 营运管理提升综合成绩汇总表导出
+     * @param req
+     * @param resp
+     * @param fwqDeptStatistic
+     * @return
+     */
+    @RequestMapping(value = "/dept/static/excel",method=RequestMethod.GET)
+    public String getDeptCheckststic(HttpServletRequest req,HttpServletResponse resp,
+                                     FwqDeptStatistic fwqDeptStatistic){
+        statisticsService_f.getDeptStatisticExcel(fwqDeptStatistic, req, resp);
+        return super.returnSuccessResult(null);
+    }
+
 }

+ 17 - 0
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/dao/FwqCheckDeptStatisticsDao.java

@@ -0,0 +1,17 @@
+package com.xintong.visualinspection.visuallnspection_fjq.dao;
+
+import com.xintong.visualinspection.bean.FwqDeptStatistic;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 文件名:FwqCheckDeptStatisticsDao
+ * 版本信息:日期:2018/5/2 Copyright 江苏省交通规划设计院 Corporation 2018 版权所有.
+ */
+@Mapper
+public interface FwqCheckDeptStatisticsDao {
+    void saveandupdate(FwqDeptStatistic ss);
+
+    List<FwqDeptStatistic> selectdepts(FwqDeptStatistic obj);
+}

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

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xintong.visualinspection.visuallnspection_fjq.dao.FwqCheckDeptStatisticsDao">
+
+    <resultMap id="BaseResultMap" type="com.xintong.visualinspection.bean.FwqDeptStatistic">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="period_id" property="period_id" jdbcType="INTEGER"/>
+        <result column="score" property="score" jdbcType="DOUBLE"/>
+        <result column="integral" property="integral" jdbcType="INTEGER"/>
+        <result column="dept_id" property="dept_id" jdbcType="INTEGER"/>
+    </resultMap>
+
+
+    <!--<select id="getOne" parameterType="java.lang.Long" resultMap="BaseResultMap" >-->
+    <!--SELECT *-->
+    <!--FROM check_dept_score-->
+    <!--WHERE id = #{id}-->
+    <!--</select>-->
+    <!---->
+    <!--<select id="getByDept" parameterType="com.xintong.visualinspection.bean.DeptStatistic" resultMap="BaseResultMap" >-->
+    <!--SELECT *-->
+    <!--FROM check_dept_score-->
+    <!--WHERE dept_id = #{dept_id} and period_id = #{period_id}-->
+    <!--</select>-->
+    <!---->
+    <!--<insert id="insert" useGeneratedKeys="true" keyProperty="id"  parameterType="com.xintong.visualinspection.bean.DeptStatistic" >-->
+    <!--<include refid="insertc"/>-->
+    <!--</insert>-->
+
+    <!--<update id="update" parameterType="com.xintong.visualinspection.bean.DeptStatistic" >-->
+    <!--<include refid="updatec"/>-->
+    <!--</update>-->
+
+    <!--<delete id="delete" parameterType="java.lang.Long" >-->
+    <!--DELETE FROM-->
+    <!--check_dept_score-->
+    <!--WHERE-->
+    <!--id =#{id}-->
+    <!--</delete>-->
+
+    <insert id="saveandupdate" useGeneratedKeys="true" keyProperty="id" parameterType="com.xintong.visualinspection.bean.FwqDeptStatistic">
+        <selectKey keyProperty="count" resultType="int" order="BEFORE">
+            select count(*) as count from check_dept_score where dept_id = #{dept_id} and period_id = #{period_id}
+        </selectKey>
+        <if test="count>0">
+            <include refid="updatec"/>
+        </if>
+        <if test="count==0">
+            <include refid="insertc"/>
+        </if>
+    </insert>
+
+    <sql id="updatec">
+        UPDATE
+        check_dept_score
+        SET
+        <if test="score != null">score = #{score},</if>
+        <if test="integral != null">integral = #{integral},</if>
+        id = id
+        WHERE
+        dept_id = #{dept_id} and period_id = #{period_id}
+    </sql>
+    <sql id="insertc">
+         INSERT INTO
+        check_dept_score
+        (dept_id,period_id,score,integral)
+        VALUES
+        (#{dept_id}, #{period_id},#{score},#{integral})
+    </sql>
+
+    <select id="selectdepts" parameterType="com.xintong.visualinspection.bean.FwqDeptStatistic" resultMap="BaseResultMap">
+      select * from check_dept_score where  period_id >= #{startperiod_id} AND period_id &lt;= #{endperiod_id}
+    </select>
+
+</mapper>

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

@@ -1,5 +1,6 @@
 package com.xintong.visualinspection.visuallnspection_fjq.service;
 
+import com.xintong.visualinspection.bean.FwqDeptStatistic;
 import com.xintong.visualinspection.bean.FwqStatisticsBean;
 
 import javax.servlet.http.HttpServletRequest;
@@ -8,4 +9,6 @@ import javax.servlet.http.HttpServletResponse;
 public interface StatisticsService_F {
 
     void getOperationInfo(FwqStatisticsBean obj, HttpServletRequest req, HttpServletResponse resp);
+
+    void getDeptStatisticExcel(FwqDeptStatistic fwqDeptStatistic, HttpServletRequest req, HttpServletResponse resp);
 }

+ 213 - 11
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java

@@ -1,17 +1,21 @@
 package com.xintong.visualinspection.visuallnspection_fjq.service.impl;
 
 import com.alibaba.dubbo.config.annotation.Reference;
+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.Organ;
 import com.xintong.visualinspection.service.CommonService;
 import com.xintong.visualinspection.service.StatisticsService_F;
+import com.xintong.visualinspection.visuallnspection_fjq.dao.FwqCheckDeptStatisticsDao;
 import com.xintong.visualinspection.visuallnspection_fjq.dao.FwqStatisticsDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -20,7 +24,7 @@ import java.util.Map;
 import java.util.Set;
 
 /**
- * 文件名:OtherCheckServiceImpl_F
+ * 文件名:StatisticsServiceImpl
  * 版本信息:日期:2017/4/7 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
  *
  * @author wenhongquan
@@ -31,7 +35,8 @@ import java.util.Set;
         version = "1.0.0",
         application = "${dubbo.application.id}",
         protocol = "${dubbo.protocol.id}",
-        registry = "${dubbo.registry.id}"
+        registry = "${dubbo.registry.id}",
+        timeout = 3000
 )
 public class StatisticsServiceImpl implements StatisticsService_F {
 
@@ -39,13 +44,14 @@ public class StatisticsServiceImpl implements StatisticsService_F {
 
     @Autowired
     private FwqStatisticsDao fwqStatisticsDao;
+    @Autowired
+    private FwqCheckDeptStatisticsDao fwqCheckDeptStatisticsDao;
 
     @Reference(version = "1.0.0",
             application = "${dubbo.application.id}",
             registry = "${dubbo.registry.address}")
     private CommonService commonService;
 
-
     @Override
     public List<FwqStatisticsBean> getOperationInfo(FwqStatisticsBean obj) {
 
@@ -67,12 +73,12 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         List<FwqStatisticsBean> onsite_beans = fwqStatisticsDao.getselectFeeStationOperationScoreDetail(obj);
 
         for (FwqStatisticsBean third_bean : third_beans) {
-            mapStationInfos.get(third_bean.getDept_id()).setThird_check_num(third_bean.getChecked_num()>1?1:third_bean.getChecked_num());
+            mapStationInfos.get(third_bean.getDept_id()).setThird_check_num(third_bean.getChecked_num() > 1 ? 1 : third_bean.getChecked_num());
             mapStationInfos.get(third_bean.getDept_id()).setThird_total_score(third_bean.getCheck_total_score());
         }
 
         for (FwqStatisticsBean onsite_bean : onsite_beans) {
-            mapStationInfos.get(onsite_bean.getDept_id()).setOnsite_check_num(onsite_bean.getChecked_num()>1?1:onsite_bean.getChecked_num());
+            mapStationInfos.get(onsite_bean.getDept_id()).setOnsite_check_num(onsite_bean.getChecked_num() > 1 ? 1 : onsite_bean.getChecked_num());
             mapStationInfos.get(onsite_bean.getDept_id()).setOnsite_total_score(onsite_bean.getCheck_total_score());
         }
         // 计算出每个收费站的总平均扣分和平均得分
@@ -86,14 +92,14 @@ public class StatisticsServiceImpl 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());
+                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.getOnsite_total_score() / 2.0 / value.getOnsite_check_num();
             }
-            value.setCheck_total_avg(df.format(avg ));
+            value.setCheck_total_avg(df.format(avg));
             // 设置平均得分
-            Float score_avg = (1000 - Float.valueOf(df.format(avg )));
+            Float score_avg = (1000 - Float.valueOf(df.format(avg)));
             value.setScore_avg(score_avg.toString());
         }
         List<FwqStatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
@@ -117,7 +123,7 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         }
         sortList = temp;
 
-        for(int j=0;j<sortList.size();j++){
+        for (int j = 0; j < sortList.size(); j++) {
             FwqStatisticsBean statisticsBean = sortList.get(j);
             // 公司排名
             if (j == 0) {
@@ -132,8 +138,204 @@ public class StatisticsServiceImpl implements StatisticsService_F {
             }
         }
 
-//        threadTaskService.saveDeptStatic(sortList,obj.getStart_date().getTime(),obj.getEnd_date().getTime());
+        CheckTaskPeriod period = commonService.getCheckTaskPeriod(obj.getStart_date().getTime(), obj.getEnd_date().getTime());
+
+        if (period != null) {
+            for (FwqStatisticsBean s : sortList) {
+                FwqDeptStatistic ss = new FwqDeptStatistic();
+                ss.setScore(Double.parseDouble(s.getScore_avg()));
+                ss.setIntegral(sortList.size() - s.getCompany_ranking2() + 1);
+                ss.setDept_id(s.getDept_id());
+                ss.setPeriod_id(period.getId());
+                fwqCheckDeptStatisticsDao.saveandupdate(ss);
+            }
+        }
 
         return sortList;
     }
+
+    @Override
+    public Map<String, List<FwqDeptStatistic>> getDeptStatistic(FwqDeptStatistic obj) {
+
+        List<CheckTaskPeriod> checkTaskPeriods = commonService.getAllCheckTaskPeriod();
+        SimpleDateFormat ff = new SimpleDateFormat("yyyy-MM");
+        SimpleDateFormat ff1 = new SimpleDateFormat("MM月");
+
+        for (CheckTaskPeriod p : checkTaskPeriods) {
+            if (obj.getStart_date() == p.getEndtime().getTime()) {
+                obj.setStartperiod_id(p.getId());
+            }
+            if (obj.getEnd_date() == p.getEndtime().getTime()) {
+                obj.setEndperiod_id(p.getId());
+            }
+        }
+        if (obj.getStart_date() > (checkTaskPeriods.get(checkTaskPeriods.size() - 1).getEndtime().getTime())) {
+            return null;
+        }
+        if (obj.getEnd_date() < (checkTaskPeriods.get(0).getEndtime().getTime())) {
+            return null;
+        }
+        if (obj.getStart_date() < (checkTaskPeriods.get(0).getEndtime().getTime())) {
+            obj.setStartperiod_id(checkTaskPeriods.get(0).getId());
+        }
+        if (obj.getEnd_date() > (checkTaskPeriods.get(checkTaskPeriods.size() - 1).getEndtime().getTime())) {
+            obj.setEndperiod_id(checkTaskPeriods.get(checkTaskPeriods.size() - 1).getId());
+        }
+
+        List<FwqDeptStatistic> deptStatistics = fwqCheckDeptStatisticsDao.selectdepts(obj);
+        Map<String, List<FwqDeptStatistic>> listMap = new HashMap<>();
+        Map<Long, List<FwqDeptStatistic>> listMap1 = new HashMap<>();
+        if (deptStatistics.size() > 0) {
+            Map<Long, Organ> deptMap = commonService.getDeptMap();
+            for (FwqDeptStatistic s : deptStatistics) {
+                //按月统计
+                if (listMap.get(s.getPeriod_id() + "") == null) {
+                    List<FwqDeptStatistic> t = new ArrayList<>();
+                    t.add(s);
+                    listMap.put(s.getPeriod_id() + "", t);
+                } else {
+                    List<FwqDeptStatistic> t = listMap.get(s.getPeriod_id() + "");
+                    t.add(s);
+                    listMap.put(s.getPeriod_id() + "", t);
+                }
+
+
+                //按部门统计
+                if (listMap1.get(s.getDept_id()) == null) {
+                    List<FwqDeptStatistic> t = new ArrayList<>();
+                    t.add(s);
+                    listMap1.put(s.getDept_id(), t);
+                } else {
+                    List<FwqDeptStatistic> t = listMap1.get(s.getDept_id());
+                    t.add(s);
+                    listMap1.put(s.getDept_id(), t);
+                }
+            }
+
+            //按月划分
+            for (CheckTaskPeriod p : checkTaskPeriods) {
+                if (p.getId() >= obj.getStartperiod_id() && p.getId() <= obj.getEndperiod_id()) {
+                    //符合要求的周期 计算得分
+                    for (Long tp : listMap1.keySet()
+                            ) {
+                        List<FwqDeptStatistic> deptStatistics1 = listMap1.get(tp);
+                        //该周期每一个部门
+                        //计算累计
+                        Integer s = 0;
+                        for (FwqDeptStatistic ss : deptStatistics1
+                                ) {
+                            if (ss.getPeriod_id() <= p.getId()) {
+                                s += ss.getIntegral();
+                            }
+                        }
+
+                        //赋值
+                        for (FwqDeptStatistic ss : deptStatistics1
+                                ) {
+                            if (ss.getPeriod_id().equals(p.getId())) {
+                                ss.setTotal_integral(s);
+                                ss.setDept_name(deptMap.get(ss.getDept_id()).getOrganname());
+                                ss.setTime(ff.format(p.getEndtime()));
+                            }
+                        }
+                    }
+
+                    //计算排名
+                    List<FwqDeptStatistic> deptStatistics1 = listMap.get(p.getId() + "");
+                    if (deptStatistics1 != null) {
+                        deptStatistics1.sort(new Comparator<FwqDeptStatistic>() {
+                            @Override
+                            public int compare(FwqDeptStatistic o1, FwqDeptStatistic o2) {
+                                return o1.getTotal_integral() > o2.getTotal_integral() ? -1 : 1;
+                            }
+                        });
+                        for (int i = 0; i < deptStatistics1.size(); i++) {
+                            deptStatistics1.get(i).setTotal_ranking(i + 1);
+                        }
+                    }
+
+                }
+            }
+
+            //排序
+            for (String i : listMap.keySet()
+                    ) {
+                listMap.get(i).sort(new Comparator<FwqDeptStatistic>() {
+                    @Override
+                    public int compare(FwqDeptStatistic o1, FwqDeptStatistic o2) {
+                        return o1.getDept_id() > o2.getDept_id() ? 1 : -1;
+                    }
+                });
+            }
+            listMap.clear();
+            for (Long s : listMap1.keySet()
+                    ) {
+                List<FwqDeptStatistic> l = listMap1.get(s);
+                l.sort(new Comparator<FwqDeptStatistic>() {
+                    @Override
+                    public int compare(FwqDeptStatistic o1, FwqDeptStatistic o2) {
+                        return o1.getPeriod_id() > o2.getPeriod_id() ? 1 : -1;
+                    }
+                });
+                listMap.put(l.get(0).getDept_id() + "", l);
+            }
+
+            if (obj.getType() != null && obj.getType().equals(1)) {
+                //excel数据
+                for (CheckTaskPeriod p : checkTaskPeriods) {
+                    if (p.getId() >= obj.getStartperiod_id() && p.getId() <= obj.getEndperiod_id()) {
+                        //符合要求的周期 计算得分
+                        for (String i : listMap.keySet()
+                                ) {
+                            //单个部门的
+                            List<FwqDeptStatistic> l = listMap.get(i);
+                            FwqDeptStatistic temp = null;
+                            if (l.size() < 1) {
+                                continue;
+                            }
+                            boolean isin = false;
+                            for (FwqDeptStatistic s : l
+                                    ) {
+                                if (s.getPeriod_id().equals(p.getId())) {
+                                    isin = true;
+                                    temp = s;
+                                    break;
+                                }
+                            }
+                            //不在里面
+                            if (!isin) {
+                                FwqDeptStatistic s = l.get(0).clone();
+                                s.setScore((double) -1);
+                                s.setPeriod_id(p.getId());
+                                s.setIntegral(-1);
+                                s.setTotal_integral(-1);
+                                s.setTotal_ranking(-1);
+                                temp = s;
+                                l.add(s);
+                            }
+
+                            temp.setMString(ff1.format(p.getEndtime()));
+                            listMap.put(i, l);
+
+                        }
+                    }
+                }
+                //再次排序
+                for (String s : listMap.keySet()
+                        ) {
+                    List<FwqDeptStatistic> l = listMap.get(s);
+                    l.sort(new Comparator<FwqDeptStatistic>() {
+                        @Override
+                        public int compare(FwqDeptStatistic o1, FwqDeptStatistic o2) {
+                            return o1.getPeriod_id() > o2.getPeriod_id() ? 1 : -1;
+                        }
+                    });
+                    listMap.put(l.get(0).getDept_id() + "", l);
+                }
+            }
+        }
+
+
+        return listMap;
+    }
 }

+ 208 - 1
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsService_FImpl.java

@@ -1,10 +1,13 @@
 package com.xintong.visualinspection.visuallnspection_fjq.service.impl;
 
 import com.alibaba.dubbo.config.annotation.Reference;
+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.Organ;
 import com.xintong.visualinspection.service.CommonService;
+import com.xintong.visualinspection.visuallnspection_fjq.dao.FwqCheckDeptStatisticsDao;
 import com.xintong.visualinspection.visuallnspection_fjq.dao.FwqStatisticsDao;
 import com.xintong.visualinspection.visuallnspection_fjq.service.StatisticsService_F;
 import org.jxls.common.Context;
@@ -24,6 +27,7 @@ import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -32,7 +36,7 @@ import java.util.Map;
 import java.util.Set;
 
 /**
- * 文件名:OtherCheckServiceImpl_F
+ * 文件名:StatisticsService_FImpl
  * 版本信息:日期:2017/4/7 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
  *
  * @author wenhongquan
@@ -46,6 +50,8 @@ public class StatisticsService_FImpl implements StatisticsService_F {
 
     @Autowired
     private FwqStatisticsDao fwqStatisticsDao;
+    @Autowired
+    private FwqCheckDeptStatisticsDao fwqCheckDeptStatisticsDao;
 
     @Reference(version = "1.0.0",
             application = "${dubbo.application.id}",
@@ -170,6 +176,207 @@ public class StatisticsService_FImpl implements StatisticsService_F {
         exportExcel("运营管理综合检查情况统计表", "fwq_operation_info", map, resp);
     }
 
+    public Map<String, List<FwqDeptStatistic>> getDeptStatistic(FwqDeptStatistic obj) {
+
+        List<CheckTaskPeriod> checkTaskPeriods = commonService.getAllCheckTaskPeriod();
+        SimpleDateFormat ff = new SimpleDateFormat("yyyy-MM");
+        SimpleDateFormat ff1 = new SimpleDateFormat("MM月");
+
+        for (CheckTaskPeriod p : checkTaskPeriods) {
+            if (obj.getStart_date() == p.getEndtime().getTime()) {
+                obj.setStartperiod_id(p.getId());
+            }
+            if (obj.getEnd_date() == p.getEndtime().getTime()) {
+                obj.setEndperiod_id(p.getId());
+            }
+        }
+        if (obj.getStart_date() > (checkTaskPeriods.get(checkTaskPeriods.size() - 1).getEndtime().getTime())) {
+            return null;
+        }
+        if (obj.getEnd_date() < (checkTaskPeriods.get(0).getEndtime().getTime())) {
+            return null;
+        }
+        if (obj.getStart_date() < (checkTaskPeriods.get(0).getEndtime().getTime())) {
+            obj.setStartperiod_id(checkTaskPeriods.get(0).getId());
+        }
+        if (obj.getEnd_date() > (checkTaskPeriods.get(checkTaskPeriods.size() - 1).getEndtime().getTime())) {
+            obj.setEndperiod_id(checkTaskPeriods.get(checkTaskPeriods.size() - 1).getId());
+        }
+
+        List<FwqDeptStatistic> deptStatistics = fwqCheckDeptStatisticsDao.selectdepts(obj);
+        Map<String, List<FwqDeptStatistic>> listMap = new HashMap<>();
+        Map<Long, List<FwqDeptStatistic>> listMap1 = new HashMap<>();
+        if (deptStatistics.size() > 0) {
+            Map<Long, Organ> deptMap = commonService.getDeptMap();
+            for (FwqDeptStatistic s : deptStatistics) {
+                //按月统计
+                if (listMap.get(s.getPeriod_id() + "") == null) {
+                    List<FwqDeptStatistic> t = new ArrayList<>();
+                    t.add(s);
+                    listMap.put(s.getPeriod_id() + "", t);
+                } else {
+                    List<FwqDeptStatistic> t = listMap.get(s.getPeriod_id() + "");
+                    t.add(s);
+                    listMap.put(s.getPeriod_id() + "", t);
+                }
+
+
+                //按部门统计
+                if (listMap1.get(s.getDept_id()) == null) {
+                    List<FwqDeptStatistic> t = new ArrayList<>();
+                    t.add(s);
+                    listMap1.put(s.getDept_id(), t);
+                } else {
+                    List<FwqDeptStatistic> t = listMap1.get(s.getDept_id());
+                    t.add(s);
+                    listMap1.put(s.getDept_id(), t);
+                }
+            }
+
+            //按月划分
+            for (CheckTaskPeriod p : checkTaskPeriods) {
+                if (p.getId() >= obj.getStartperiod_id() && p.getId() <= obj.getEndperiod_id()) {
+                    //符合要求的周期 计算得分
+                    for (Long tp : listMap1.keySet()
+                            ) {
+                        List<FwqDeptStatistic> deptStatistics1 = listMap1.get(tp);
+                        //该周期每一个部门
+                        //计算累计
+                        Integer s = 0;
+                        for (FwqDeptStatistic ss : deptStatistics1
+                                ) {
+                            if (ss.getPeriod_id() <= p.getId()) {
+                                s += ss.getIntegral();
+                            }
+                        }
+
+                        //赋值
+                        for (FwqDeptStatistic ss : deptStatistics1
+                                ) {
+                            if (ss.getPeriod_id().equals(p.getId())) {
+                                ss.setTotal_integral(s);
+                                ss.setDept_name(deptMap.get(ss.getDept_id()).getOrganname());
+                                ss.setTime(ff.format(p.getEndtime()));
+                            }
+                        }
+                    }
+
+                    //计算排名
+                    List<FwqDeptStatistic> deptStatistics1 = listMap.get(p.getId() + "");
+                    if (deptStatistics1 != null) {
+                        deptStatistics1.sort(new Comparator<FwqDeptStatistic>() {
+                            @Override
+                            public int compare(FwqDeptStatistic o1, FwqDeptStatistic o2) {
+                                return o1.getTotal_integral() > o2.getTotal_integral() ? -1 : 1;
+                            }
+                        });
+                        for (int i = 0; i < deptStatistics1.size(); i++) {
+                            deptStatistics1.get(i).setTotal_ranking(i + 1);
+                        }
+                    }
+
+                }
+            }
+
+            //排序
+            for (String i : listMap.keySet()
+                    ) {
+                listMap.get(i).sort(new Comparator<FwqDeptStatistic>() {
+                    @Override
+                    public int compare(FwqDeptStatistic o1, FwqDeptStatistic o2) {
+                        return o1.getDept_id() > o2.getDept_id() ? 1 : -1;
+                    }
+                });
+            }
+            listMap.clear();
+            for (Long s : listMap1.keySet()
+                    ) {
+                List<FwqDeptStatistic> l = listMap1.get(s);
+                l.sort(new Comparator<FwqDeptStatistic>() {
+                    @Override
+                    public int compare(FwqDeptStatistic o1, FwqDeptStatistic o2) {
+                        return o1.getPeriod_id() > o2.getPeriod_id() ? 1 : -1;
+                    }
+                });
+                listMap.put(l.get(0).getDept_id() + "", l);
+            }
+
+            if (obj.getType() != null && obj.getType().equals(1)) {
+                //excel数据
+                for (CheckTaskPeriod p : checkTaskPeriods) {
+                    if (p.getId() >= obj.getStartperiod_id() && p.getId() <= obj.getEndperiod_id()) {
+                        //符合要求的周期 计算得分
+                        for (String i : listMap.keySet()
+                                ) {
+                            //单个部门的
+                            List<FwqDeptStatistic> l = listMap.get(i);
+                            FwqDeptStatistic temp = null;
+                            if (l.size() < 1) {
+                                continue;
+                            }
+                            boolean isin = false;
+                            for (FwqDeptStatistic s : l
+                                    ) {
+                                if (s.getPeriod_id().equals(p.getId())) {
+                                    isin = true;
+                                    temp = s;
+                                    break;
+                                }
+                            }
+                            //不在里面
+                            if (!isin) {
+                                FwqDeptStatistic s = l.get(0).clone();
+                                s.setScore((double) -1);
+                                s.setPeriod_id(p.getId());
+                                s.setIntegral(-1);
+                                s.setTotal_integral(-1);
+                                s.setTotal_ranking(-1);
+                                temp = s;
+                                l.add(s);
+                            }
+
+                            temp.setMString(ff1.format(p.getEndtime()));
+                            listMap.put(i, l);
+
+                        }
+                    }
+                }
+                //再次排序
+                for (String s : listMap.keySet()
+                        ) {
+                    List<FwqDeptStatistic> l = listMap.get(s);
+                    l.sort(new Comparator<FwqDeptStatistic>() {
+                        @Override
+                        public int compare(FwqDeptStatistic o1, FwqDeptStatistic o2) {
+                            return o1.getPeriod_id() > o2.getPeriod_id() ? 1 : -1;
+                        }
+                    });
+                    listMap.put(l.get(0).getDept_id() + "", l);
+                }
+            }
+        }
+
+
+        return listMap;
+    }
+
+    @Override
+    public void getDeptStatisticExcel(FwqDeptStatistic obj, HttpServletRequest req, HttpServletResponse resp) {
+        obj.setType(1);
+        Map<String, List<FwqDeptStatistic>> listMap = this.getDeptStatistic(obj);
+        SimpleDateFormat d = new SimpleDateFormat("yyyy/MM");
+        List<Integer> temp = new ArrayList<>();
+        for(int i=1;i<=listMap.keySet().size();i++){
+            temp.add(i);
+        }
+
+        Map<String, Object> map = new HashMap<>();
+        map.put("datas", listMap);
+        map.put("list", temp);
+        map.put("title","服务区-营运管理提升综合成绩汇总表"+"("+d.format(obj.getStart_date())+"---"+d.format(obj.getEnd_date())+")");
+        exportExcel("服务区-营运管理提升综合成绩汇总表", "fwq_dept_statistic", map, resp);
+    }
+
     private void exportExcel(String fileName, String excelTemplateName, Map<String, Object> map,
                              HttpServletResponse resp) {
         String path = "./" + fileName + ".xls";

+ 61 - 0
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/ThreadTaskServiceImpl.java

@@ -0,0 +1,61 @@
+package com.xintong.visualinspection.visuallnspection_fjq.service.impl;
+
+import com.alibaba.dubbo.config.annotation.Reference;
+import com.xintong.visualinspection.bean.CheckTaskPeriod;
+import com.xintong.visualinspection.bean.FwqDeptStatistic;
+import com.xintong.visualinspection.bean.FwqStatisticsBean;
+import com.xintong.visualinspection.service.CommonService;
+import com.xintong.visualinspection.service.ThreadTaskService_F;
+import com.xintong.visualinspection.visuallnspection_fjq.dao.FwqCheckDeptStatisticsDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+
+import java.util.List;
+
+/**
+ * 文件名:ThreadTaskServiceImpl
+ * 版本信息:日期:2018/5/11 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
+ *
+ * @author huangcheng
+ * @since 2018/5/11
+ */
+@com.alibaba.dubbo.config.annotation.Service(
+        version = "1.0.0",
+        application = "${dubbo.application.id}",
+        protocol = "${dubbo.protocol.id}",
+        registry = "${dubbo.registry.id}"
+)
+public class ThreadTaskServiceImpl implements ThreadTaskService_F {
+
+    private static final Logger logger = LoggerFactory.getLogger(ThreadTaskServiceImpl.class);
+
+    @Autowired
+    private FwqCheckDeptStatisticsDao fwqCheckDeptStatisticsDao;
+
+    @Reference(version = "1.0.0",
+            application = "${dubbo.application.id}",
+            registry = "${dubbo.registry.address}")
+    private CommonService commonService;
+
+
+    @Override
+    @Async("threadExecutor")
+    public void saveDeptStatic(List<FwqStatisticsBean> statisticsBos, Long starttime, Long endtime) {
+
+        CheckTaskPeriod period = commonService.getCheckTaskPeriod(starttime, endtime);
+
+        if (period == null) {
+            return;
+        }
+        for (FwqStatisticsBean s : statisticsBos) {
+            FwqDeptStatistic ss = new FwqDeptStatistic();
+            ss.setScore(Double.parseDouble(s.getScore_avg()));
+            ss.setIntegral(statisticsBos.size() - s.getCompany_ranking2() + 1);
+            ss.setDept_id(s.getDept_id());
+            ss.setPeriod_id(period.getId());
+            fwqCheckDeptStatisticsDao.saveandupdate(ss);
+        }
+    }
+}

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


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

@@ -0,0 +1,45 @@
+package com.xintong.visualinspection.bean;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 文件名:UserStatistic
+ * 版本信息:日期:2018/2/5 Copyright 江苏省交通规划设计院 Corporation 2018 版权所有.
+ */
+@Data
+public class FwqDeptStatistic implements Cloneable,Serializable {
+    private Long id;
+    private Integer period_id;
+    private Long dept_id;
+    private Long start_date;
+    private Long end_date;
+    private Integer integral;
+    private Double score;
+    private Integer startperiod_id;
+    private Integer endperiod_id;
+    private String dept_name;
+
+    private Integer total_integral;
+    private Integer total_ranking;
+    private String time;
+
+    private Integer count;
+
+    private Integer type;
+    private String mString;
+
+    @Override
+    public FwqDeptStatistic clone() {
+        FwqDeptStatistic o = null;
+        try {
+            // Object中的clone()识别出你要复制的是哪一个对象。
+            o = (FwqDeptStatistic) super.clone();
+        } catch (CloneNotSupportedException e) {
+            System.out.println(e.toString());
+        }
+        return o;
+    }
+
+}

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

@@ -25,4 +25,7 @@ public interface CommonService {
 
     //获取周期信息
     public CheckTaskPeriod getCheckTaskPeriod(Long startDate,Long endDate);
+
+    //获取任务周期表中所有数据
+    public List<CheckTaskPeriod> getAllCheckTaskPeriod();
 }

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

@@ -1,12 +1,17 @@
 package com.xintong.visualinspection.service;
 
+import com.xintong.visualinspection.bean.FwqDeptStatistic;
 import com.xintong.visualinspection.bean.FwqStatisticsBean;
 
 import java.util.List;
+import java.util.Map;
 
 public interface StatisticsService_F {
 
     // 运营管理综合检查情况统计表
     List<FwqStatisticsBean> getOperationInfo(FwqStatisticsBean obj);
 
+    // 营运管理提升综合成绩汇总表
+    Map<String, List<FwqDeptStatistic>> getDeptStatistic(FwqDeptStatistic obj);
+
 }

+ 15 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/service/ThreadTaskService_F.java

@@ -0,0 +1,15 @@
+package com.xintong.visualinspection.service;
+
+import com.xintong.visualinspection.bean.FwqStatisticsBean;
+
+import java.util.List;
+
+/**
+ * @author huangcheng
+ * @since 2018/5/11
+ */
+public interface ThreadTaskService_F {
+
+    void saveDeptStatic(List<FwqStatisticsBean> statisticsBos, Long starttime, Long endtime);
+
+}