wenhongquan hace 8 años
padre
commit
3e6c4a9db0

+ 139 - 0
VisualInspection/js/statistics/dept_check_statistics.js

@@ -0,0 +1,139 @@
+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("2017/07");
+    $("#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());
+
+    });
+
+
+
+
+});
+
+
+
+
+
+
+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 + "-25 23:00:00").valueOf(),
+        "end_date": moment(endtime + "-25 23:00:00").valueOf(),
+
+    };
+
+    //获取该人员排班
+    var url = "/statistics/dept";
+
+    post_common_service(url, data_p, function (data) {
+
+        //     var table = '';
+
+        //先确定表格标题
+        var h_html = "<tr><th rowspan=2 style='width:"+(10*100/(time_m*4*30+80))+"%'>序号</th><th rowspan=2 style='width:"+(70*100/(time_m*4*30+80))+"%'>站名</th>";
+        var h_html_t = "<tr>"
+        for (var i = 0; i <= time_m; i++) {
+            h_html += "<th colspan=4>" + (moment(starttime).add(i, "month").format("MM月")) + "</th>";
+            h_html_t += "<th style='width:"+(30*100/(time_m*4*30+80))+"%'>考核分</th><th style='width:"+(30*100/(time_m*4*30+80))+"%'>积分</th><th style='width:"+(30*100/(time_m*4*30+80))+"%'>累计积分</th><th style='width:"+(30*100/(time_m*4*30+80))+"%'>排名</th>"
+        }
+        h_html += "</tr>";
+        h_html_t += "</tr>";
+        h_html += h_html_t;
+
+        $("#table_h").html(h_html)
+        // $("#table_h").css("width",time_m*4*30+80)
+        // $("#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:"+(10*100/(time_m*4*30+80))+"%'>" + (++cc) + "</td><td style='width:"+(70*100/(time_m*4*30+80))+"%'>" + 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:"+(30*100/(time_m*4*30+80))+"%'>-</td>"
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>-</td>"
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>-</td>"
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>-</td>"
+                }
+                for (var p in dd) {
+                    var ss = dd[p];
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>" + ss.score + "</td>"
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>" + ss.integral + "</td>"
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>" + ss.total_integral + "</td>"
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>" + 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:"+(30*100/(time_m*4*30+80))+"%'>-</td>"
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>-</td>"
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>-</td>"
+                    b_html += "<td style='width:"+(30*100/(time_m*4*30+80))+"%'>-</td>"
+                }
+            }
+            b_html += "</tr>"
+
+
+
+        }
+
+
+        $("#table").html(b_html);
+
+
+        //     $("#totlapeople").html(data.length);
+        //     for (var i in data) {
+        //         var ss = data[i];
+        //         var dat = "";
+        //         for (var j in ss.userStatistics) {
+        //             var po = ss.userStatistics[j];
+        //             dat += po.p_str + "月、";
+        //         }
+        //         dat = dat.substring(0, dat.length - 1);
+        //         table += "<tr><td width='5%;'>" + (parseInt(i) + 1) + "</td><td width='10%;'>" + ss.user.workno + "</td><td width='15%;'>" + ss.dept + "</td><td width='10%;'><a href='JavaScript:void(0)' onclick='jumpuser(\"" + ss.user.id + "\",\"" + ss.user.organid + "\")'>" + ss.user.truename + "</a></td><td width='60%;'>" + dat + "</td></tr>";
+
+
+        //     }
+
+
+
+        //     $(".table-tbody").html(table);
+        //     $('[data-toggle="tooltip"]').tooltip();
+        //     $("tr:gt(0):odd").css("background", "#EFEFEF");
+
+
+
+    });
+
+
+
+
+}

+ 0 - 1
VisualInspection/js/statistics/user_check_statistics.js

@@ -56,7 +56,6 @@ function getscore(starttime, endtime, limitnumber, limitscore, limitscore2) {
     post_common_service(url, data_p, function(data) {
 
         var table = '';
-        console.log(data.length)
         $("#totlapeople").html(data.length);
         for (var i in data) {
             var ss = data[i];

+ 103 - 0
VisualInspection/view/statistics/dept_check_statistics.html

@@ -0,0 +1,103 @@
+<script src="/js/statistics/common_statistic.js?__inline"></script>
+<script src="/js/statistics/dept_check_statistics.js">
+</script>
+<style type="text/css">
+    table td,
+    table th {
+        text-align: center;
+        padding: 10px;
+        border: 1px solid #d9d9d9
+    }
+    
+    .table-title {
+        line-height: 50px;
+        text-align: center;
+    }
+    
+    .table-title span {
+        font-size: 22px;
+        color: #333;
+    }
+    
+    .table-head {
+        background-color: #EBF3FD;
+        margin-top: 10px;
+        width: 100%;
+    }
+    
+    .table-head table {
+        border: 1px solid #C7C6C5;
+    }
+    
+    #scrollTable table {
+        border: 1px solid #C7C6C5;
+    }
+    
+    .table-head table tr th {
+        font-size: 12px;
+        color: #333;
+        text-align: center;
+        border: 1px solid #C7C6C5;
+    }
+    
+    .table-tbody tr td {
+        height: 43px;
+    }
+    
+    table {
+        border-color: #d9d9d9;
+    }
+    
+    .div-score {
+        float: left;
+        padding-top: 6px;
+    }
+    
+    .special-style td {
+        border: 1px solid #c7c6c5;
+    }
+</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>
+
+
+</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;margin-right:10px;    background: #ffffff00;" data-sortable="false">
+       
+        <div class="table-head">
+            <table border="0" width="100%" align="center" style="margin-right:10px;" id="table_h">
+                <thead class="table-thead" align="center">
+                   
+                </thead>
+            </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>

+ 7 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/DeptStatistic.java

@@ -15,6 +15,13 @@ public class DeptStatistic {
     private Double 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;
 

+ 8 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/StatisticsController.java

@@ -398,5 +398,13 @@ public class StatisticsController extends BaseController {
 		if(s==null) throw new BusinessException(20001,"发生错误");
 		return super.returnSuccessResult();
 	}
+
+	@RequestMapping(value = "/dept")
+	public String getDeptStatistic(@RequestBody DeptStatistic obj){
+		Map<String,List<DeptStatistic>> s=statisticsService.getDeptStatistic(obj);
+		if(s==null) throw new BusinessException(20002,"参数不对");
+		return super.returnSuccessResult(s);
+	}
+
     
 }

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

@@ -121,6 +121,9 @@ public interface StatisticsService {
 	public Object addcheckSExUser(StatisticExUser statisticExUser);
 	public Object deletecheckSExUser(StatisticExUser statisticExUser);
 
+	//获取连续月部门积分
+	public Map<String,List<DeptStatistic>> getDeptStatistic(DeptStatistic obj);
+
 
 
 

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

@@ -17,9 +17,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import com.xintong.visualinspection.bean.*;
-import com.xintong.visualinspection.dao.master.CheckOtherDao;
-import com.xintong.visualinspection.dao.master.CheckTaskPeriodDao;
-import com.xintong.visualinspection.dao.master.CheckUserStatisticsDao;
+import com.xintong.visualinspection.dao.master.*;
 import com.xintong.visualinspection.pojo.StatisiticPojo;
 import com.xintong.visualinspection.pojo.StatisticExUser;
 import com.xintong.visualinspection.pojo.UserRankingData;
@@ -32,7 +30,6 @@ import org.springframework.stereotype.Service;
 
 import com.xintong.visualinspection.dao.cluster.DepartmentDao;
 import com.xintong.visualinspection.dao.cluster.UserInfoDao;
-import com.xintong.visualinspection.dao.master.StatisticsDao;
 import com.xintong.visualinspection.service.BaseService;
 import com.xintong.visualinspection.service.StatisticsService;
 import com.xintong.visualinspection.util.CacheUtil;
@@ -66,6 +63,9 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
     @Autowired
     private CheckUserStatisticsDao checkUserStatisticsDao;
 
+	@Autowired
+	private CheckDeptStatisticsDao checkDeptStatisticsDao;
+
     @Autowired
     private ThreadTaskService threadTaskService;
 
@@ -2574,5 +2574,134 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		return "";
 	}
 
+	@Override
+	public Map<String, List<DeptStatistic>> getDeptStatistic(DeptStatistic obj) {
+		List<CheckTaskPeriod> checkTaskPeriods = checkTaskPeriodDao.select(new CheckTaskPeriod());
+
+		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  null;
+		}
+		if(obj.getEnd_date()<(checkTaskPeriods.get(0).getEndtime().getTime()- 1 * 1000 * 60 * 60)){
+			return  null;
+		}
+		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<DeptStatistic> deptStatistics = checkDeptStatisticsDao.selectdepts(obj);
+		if(deptStatistics.size()<1) return null;
+		Map<String,List<DeptStatistic>> listMap = new HashMap<>();
+		Map<Long,List<DeptStatistic>> listMap1 = new HashMap<>();
+		for (DeptStatistic s :deptStatistics
+			 ) {
+
+			//按月统计
+			if(listMap.get(s.getPeriod_id()+"")==null){
+				List<DeptStatistic> t = new ArrayList<>();
+				t.add(s);
+				listMap.put(s.getPeriod_id()+"",t);
+			}else{
+				List<DeptStatistic> t = listMap.get(s.getPeriod_id()+"");
+				t.add(s);
+				listMap.put(s.getPeriod_id()+"",t);
+			}
+
+
+            //按部门统计
+			if(listMap1.get(s.getDept_id())==null){
+				List<DeptStatistic> t = new ArrayList<>();
+				t.add(s);
+				listMap1.put(s.getDept_id(),t);
+			}else{
+				List<DeptStatistic> 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<DeptStatistic> deptStatistics1 = listMap1.get(tp);
+					//该周期每一个部门
+					//计算累计
+					Integer s = 0;
+					for (DeptStatistic ss:deptStatistics1
+						 ) {
+						if(ss.getPeriod_id()<=p.getId()){
+                           s+=ss.getIntegral();
+						}
+					}
+					SimpleDateFormat ff = new SimpleDateFormat("yyyy-MM");
+					//赋值
+					for (DeptStatistic ss:deptStatistics1
+							) {
+						if(ss.getPeriod_id()==p.getId()){
+							ss.setTotal_integral(s);
+							ss.setDept_name(CacheUtil.getOrgannameFromMap(ss.getDept_id()));
+							ss.setTime(ff.format(p.getEndtime()));
+						}
+					}
+				}
+
+				//计算排名
+				List<DeptStatistic> deptStatistics1 = listMap.get(p.getId()+"");
+				if(deptStatistics1!=null) {
+					deptStatistics1.sort(new Comparator<DeptStatistic>() {
+						@Override
+						public int compare(DeptStatistic o1, DeptStatistic 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<DeptStatistic>() {
+				@Override
+				public int compare(DeptStatistic o1, DeptStatistic o2) {
+					return o1.getDept_id()>o2.getDept_id()?1:-1;
+				}
+			});
+		}
+		listMap.clear();
+		for (Long s:listMap1.keySet()
+			 ) {
+			List<DeptStatistic> l = listMap1.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;
+	}
+
 
 }

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 22144 - 10501
VisualInspection_server/visual/visual.log


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio