温红权 8 лет назад
Родитель
Сommit
58d8303b50

+ 20 - 9
VisualInspection/js/statistics/dept_check_statistics.js

@@ -1,5 +1,5 @@
 var year = new Date().getFullYear();
-$(function () {
+$(function() {
     // 公用方法,根据当前年月动态将13个月push数组
     month_method();
     // 公用方法,月份下拉框
@@ -19,19 +19,30 @@ $(function () {
     $("#month_date_to").val(moment(moment().format("YYYY/MM")).subtract(1, "month").format("YYYY/MM"));
 
 
-    $("#searchbtn").on("click", function () {
+    $("#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() + "-25 23:00:00").valueOf();
+    var end_date = moment($("#month_date_to").val() + "-25 23:00:00").valueOf();
+    if (start_date == '' || end_date == '') {
+        tip("请选择起止日期");
+        return;
+    }
+    window.open(getserveraddr() + "/file/dept/static/excel?start_date=" + start_date + "&end_date=" + end_date);
+}
+
+
 
 
 function getdeptscore(starttime, endtime) {
@@ -49,7 +60,7 @@ function getdeptscore(starttime, endtime) {
     //获取该人员排班
     var url = "/statistics/dept";
 
-    post_common_service(url, data_p, function (data) {
+    post_common_service(url, data_p, function(data) {
 
         //     var table = '';
 
@@ -65,11 +76,11 @@ function getdeptscore(starttime, endtime) {
         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)
+        $(".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) {
@@ -92,7 +103,7 @@ function getdeptscore(starttime, endtime) {
                     b_html += "<td style='width:60px'>" + ss.total_ranking + "</td>"
                 }
 
-                var tt1 = moment(endtime).diff(moment(dd[dd.length-1].time), 'month')
+                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>"
@@ -137,4 +148,4 @@ function getdeptscore(starttime, endtime) {
 
 
 
-}
+}

+ 23 - 21
VisualInspection/view/statistics/dept_check_statistics.html

@@ -1,6 +1,3 @@
-
-<script src="/js/lib/eleFixed.min.js"></script>
-
 <script src="/js/statistics/common_statistic.js?__inline"></script>
 <script src="/js/statistics/dept_check_statistics.js"></script>
 
@@ -11,13 +8,13 @@
         padding: 10px;
         border: 1px solid #d9d9d9;
         word-wrap: break-word;
-        padding:0;
+        padding: 0;
         padding-top: 10px;
         padding-bottom: 10px;
-        
     }
-    table{
-       table-layout: fixed
+    
+    table {
+        table-layout: fixed
     }
     
     .table-title {
@@ -34,18 +31,19 @@
         border-color: #C7C6C5;
         background-color: #d2d6de;
     }
-
-    .datatable{
-        background-color: rgba(0,0,0,0)
+    
+    .datatable {
+        background-color: rgba(0, 0, 0, 0)
     }
-    #table{
+    
+    #table {
         background-color: #fff
     }
-    .tb{
-        margin-left:auto;margin-right:auto;
+    
+    .tb {
+        margin-left: auto;
+        margin-right: auto;
     }
-  
-
 </style>
 
 <div class="container-fluid ">
@@ -59,26 +57,30 @@
             <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="table-title"><span>营运管理提升综合成绩汇总表<span id="table_title"></span></span>
+</div>
 
 
-<div class="row" >
+<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>
- 
+            <table border="0" width="100%" align="center" id="table"></table>
+
         </div>
         <!-- 使用一个div来显示数据表格   -->
         <!-- <div id="scrollTable" style="height:500px;overflow:scroll;    margin-right: -10px;">

+ 16 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/DeptStatistic.java

@@ -7,7 +7,7 @@ import lombok.Data;
  * 版本信息:日期:2018/2/5 Copyright 江苏省交通规划设计院 Corporation 2018 版权所有.
  */
 @Data
-public class DeptStatistic {
+public class DeptStatistic implements Cloneable {
     private Long id;
     private Integer period_id;
     private Long dept_id;
@@ -25,4 +25,19 @@ public class DeptStatistic {
 
     private Integer count;
 
+    private Integer type;
+    private String mString;
+
+    @Override
+    public DeptStatistic clone() {
+        DeptStatistic o = null;
+        try {
+            // Object中的clone()识别出你要复制的是哪一个对象。
+            o = (DeptStatistic) super.clone();
+        } catch (CloneNotSupportedException e) {
+            System.out.println(e.toString());
+        }
+        return o;
+    }
+
 }

+ 8 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/FileExcelController.java

@@ -9,6 +9,7 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.xintong.visualinspection.bean.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,10 +17,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.xintong.visualinspection.bean.CheckAppealStatistic;
-import com.xintong.visualinspection.bean.CheckOther;
-import com.xintong.visualinspection.bean.StatisticsBean;
-import com.xintong.visualinspection.bean.StatisticsBeanBO;
 import com.xintong.visualinspection.service.CheckOtherService;
 import com.xintong.visualinspection.service.StatisticsService;
 import com.xintong.visualinspection.util.DateUtil;
@@ -223,5 +220,12 @@ public class FileExcelController extends BaseController {
         checkOtherService.getexcel(checkOther, req, resp);
         return super.returnSuccessResult(null);
     }
+
+    @RequestMapping(value = "/dept/static/excel",method=RequestMethod.GET)
+    public String getDeptCheckststic(HttpServletRequest req,HttpServletResponse resp,
+                                      DeptStatistic deptStatistic){
+        statisticsService.getDeptStatisticExcel(deptStatistic, req, resp);
+        return super.returnSuccessResult(null);
+    }
     
 }

+ 1 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/StatisticsService.java

@@ -123,6 +123,7 @@ public interface StatisticsService {
 
 	//获取连续月部门积分
 	public Map<String,List<DeptStatistic>> getDeptStatistic(DeptStatistic obj);
+    public void getDeptStatisticExcel(DeptStatistic obj,HttpServletRequest req,HttpServletResponse resp);
 
 
 

+ 76 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -2590,6 +2590,8 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 	@Override
 	public Map<String, List<DeptStatistic>> getDeptStatistic(DeptStatistic obj) {
 		List<CheckTaskPeriod> checkTaskPeriods = checkTaskPeriodDao.select(new CheckTaskPeriod());
+        SimpleDateFormat ff = new SimpleDateFormat("yyyy-MM");
+        SimpleDateFormat ff1 = new SimpleDateFormat("MM月");
 
 		for (CheckTaskPeriod p : checkTaskPeriods) {
 			if (obj.getStart_date() + 1 * 1000 * 60 * 60 == p.getEndtime().getTime()) {
@@ -2613,7 +2615,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		}
 
 		List<DeptStatistic> deptStatistics = checkDeptStatisticsDao.selectdepts(obj);
-		if(deptStatistics.size()<1) return null;
+		if(deptStatistics.size()<1){return null;}
 		Map<String,List<DeptStatistic>> listMap = new HashMap<>();
 		Map<Long,List<DeptStatistic>> listMap1 = new HashMap<>();
 		for (DeptStatistic s :deptStatistics
@@ -2661,11 +2663,11 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
                            s+=ss.getIntegral();
 						}
 					}
-					SimpleDateFormat ff = new SimpleDateFormat("yyyy-MM");
+
 					//赋值
 					for (DeptStatistic ss:deptStatistics1
 							) {
-						if(ss.getPeriod_id()==p.getId()){
+						if(ss.getPeriod_id().equals(p.getId())){
 							ss.setTotal_integral(s);
 							ss.setDept_name(CacheUtil.getOrgannameFromMap(ss.getDept_id()));
 							ss.setTime(ff.format(p.getEndtime()));
@@ -2713,8 +2715,78 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			listMap.put(l.get(0).getDept_id()+"",l);
 		}
 
-		return  listMap;
+        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<DeptStatistic> l = listMap.get(i);
+                        DeptStatistic temp = null;
+                        if(l.size()<1){continue;}
+                        boolean isin = false;
+                        for (DeptStatistic s:l
+                                ) {
+                            if(s.getPeriod_id().equals(p.getId())){
+                                isin = true;
+                                temp = s;break;
+                            }
+                        }
+                        //不在里面
+                        if(!isin){
+                            DeptStatistic 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<DeptStatistic> l = listMap.get(s);
+                l.sort(new Comparator<DeptStatistic>() {
+                    @Override
+                    public int compare(DeptStatistic o1, DeptStatistic o2) {
+                        return o1.getPeriod_id()> o2.getPeriod_id()?1:-1;
+                    }
+                });
+                listMap.put(l.get(0).getDept_id()+"",l);
+            }
+        }
+
+
+        return  listMap;
 	}
 
+    @Override
+    public void getDeptStatisticExcel(DeptStatistic obj,HttpServletRequest req,HttpServletResponse resp) {
+	    obj.setType(1);
+        Map<String, List<DeptStatistic>> 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<String, Object>();
+        map.put("datas", listMap);
+        map.put("list", temp);
+        map.put("title","营运管理提升综合成绩汇总表"+"("+d.format(obj.getStart_date())+"---"+d.format(obj.getEnd_date())+")");
+        exportExcel("营运管理提升综合成绩汇总表", "dept_statistic", map, resp);
+
+    }
+
 
 }

BIN
VisualInspection_server/src/main/resources/appeal_info.xls


BIN
VisualInspection_server/src/main/resources/business_feedback.xls


BIN
VisualInspection_server/src/main/resources/data_platform.xls


BIN
VisualInspection_server/src/main/resources/dept_statistic.xls


BIN
VisualInspection_server/src/main/resources/duty_check.xls


BIN
VisualInspection_server/src/main/resources/operation_info.xls


BIN
VisualInspection_server/src/main/resources/other_check_info_anfang.xls


BIN
VisualInspection_server/src/main/resources/other_check_info_teqing.xls


BIN
VisualInspection_server/src/main/resources/solve_traffic.xls


BIN
VisualInspection_server/src/main/resources/special_check.xls


BIN
VisualInspection_server/src/main/resources/third_check.xls