Procházet zdrojové kódy

Merge branch 'master' of http://git_xt.git.topm.win:8080/wenhongquan/VisualInspection

minitiger před 9 roky
rodič
revize
9c1088e225

+ 5 - 0
VisualInspection/js/config.js

@@ -16,6 +16,9 @@ function getserveraddr(){
     }else if(base_ui_url.indexOf("localhost")!=-1){
         return "http://localhost:8089/"
     }
+    else if(base_ui_url.indexOf("192.168.8.236")!=-1){
+        return "http://192.168.8.236:8089/"
+    }
     else{
         return "http://10.112.0.199:8089/"
     }
@@ -23,6 +26,8 @@ function getserveraddr(){
 function getImageaddr(){
     if(base_ui_url.indexOf("topm.win")!=-1){
         return "http://file_yanhai.git.topm.win:8080/";
+    }else if(base_ui_url.indexOf("192.168.8.236")!=-1){
+        return "http://192.168.8.236/"
     }
     else{
         return "http://10.112.0.199/"

+ 360 - 0
VisualInspection/js/lib/sonic.js

@@ -0,0 +1,360 @@
+/*
+ * Sonic 0.3
+ * --
+ * https://github.com/padolsey/Sonic
+ */
+
+(function(){
+
+	var emptyFn = function(){};
+
+	function Sonic(d) {
+
+		this.converter = d.converter;
+
+		this.data = d.path || d.data;
+		this.imageData = [];
+
+		this.multiplier = d.multiplier || 1;
+		this.padding = d.padding || 0;
+
+		this.fps = d.fps || 25;
+
+		this.stepsPerFrame = ~~d.stepsPerFrame || 1;
+		this.trailLength = d.trailLength || 1;
+		this.pointDistance = d.pointDistance || .05;
+
+		this.domClass = d.domClass || 'sonic';
+
+		this.backgroundColor = d.backgroundColor || 'rgba(0,0,0,0)';
+		this.fillColor = d.fillColor;
+		this.strokeColor = d.strokeColor;
+
+		this.stepMethod = typeof d.step == 'string' ?
+			stepMethods[d.step] :
+			d.step || stepMethods.square;
+
+		this._setup = d.setup || emptyFn;
+		this._teardown = d.teardown || emptyFn;
+		this._preStep = d.preStep || emptyFn;
+
+		this.pixelRatio = d.pixelRatio || null;
+
+		this.width = d.width;
+		this.height = d.height;
+
+		this.fullWidth = this.width + 2 * this.padding;
+		this.fullHeight = this.height + 2 * this.padding;
+
+		this.domClass = d.domClass || 'sonic';
+
+		this.setup();
+
+	}
+
+	var argTypes = Sonic.argTypes = {
+		DIM: 1,
+		DEGREE: 2,
+		RADIUS: 3,
+		OTHER: 0
+	};
+
+	var argSignatures = Sonic.argSignatures = {
+		arc: [1, 1, 3, 2, 2, 0],
+		bezier: [1, 1, 1, 1, 1, 1, 1, 1],
+		line: [1,1,1,1]
+	};
+
+	var pathMethods = Sonic.pathMethods = {
+		bezier: function(t, p0x, p0y, p1x, p1y, c0x, c0y, c1x, c1y) {
+			
+		    t = 1-t;
+
+		    var i = 1-t,
+		        x = t*t,
+		        y = i*i,
+		        a = x*t,
+		        b = 3 * x * i,
+		        c = 3 * t * y,
+		        d = y * i;
+
+		    return [
+		        a * p0x + b * c0x + c * c1x + d * p1x,
+		        a * p0y + b * c0y + c * c1y + d * p1y
+		    ]
+
+		},
+		arc: function(t, cx, cy, radius, start, end) {
+
+		    var point = (end - start) * t + start;
+
+		    var ret = [
+		        (Math.cos(point) * radius) + cx,
+		        (Math.sin(point) * radius) + cy
+		    ];
+
+		    ret.angle = point;
+		    ret.t = t;
+
+		    return ret;
+
+		},
+		line: function(t, sx, sy, ex, ey) {
+			return [
+				(ex - sx) * t + sx,
+				(ey - sy) * t + sy
+			]
+		}
+	};
+
+	var stepMethods = Sonic.stepMethods = {
+		
+		square: function(point, i, f, color, alpha) {
+			this._.fillRect(point.x - 3, point.y - 3, 6, 6);
+		},
+
+		fader: function(point, i, f, color, alpha) {
+
+			this._.beginPath();
+
+			if (this._last) {
+				this._.moveTo(this._last.x, this._last.y);
+			}
+
+			this._.lineTo(point.x, point.y);
+			this._.closePath();
+			this._.stroke();
+
+			this._last = point;
+
+		}
+
+	}
+
+	Sonic.prototype = {
+
+		calculatePixelRatio: function(){
+
+			var devicePixelRatio = window.devicePixelRatio || 1;
+			var backingStoreRatio = this._.webkitBackingStorePixelRatio
+					|| this._.mozBackingStorePixelRatio
+					|| this._.msBackingStorePixelRatio
+					|| this._.oBackingStorePixelRatio
+					|| this._.backingStorePixelRatio
+					|| 1;
+
+			return devicePixelRatio / backingStoreRatio;
+		},
+
+		setup: function() {
+
+			var args,
+				type,
+				method,
+				value,
+				data = this.data;
+
+			this.canvas = document.createElement('canvas');
+			this._ = this.canvas.getContext('2d');
+
+			if(this.pixelRatio == null){
+				this.pixelRatio = this.calculatePixelRatio();
+			}
+
+			this.canvas.className = this.domClass;
+
+			if(this.pixelRatio != 1){
+
+				this.canvas.style.height = this.fullHeight + 'px';
+				this.canvas.style.width = this.fullWidth + 'px';
+
+				this.fullHeight *= this.pixelRatio;
+				this.fullWidth  *= this.pixelRatio;
+
+				this.canvas.height = this.fullHeight;
+				this.canvas.width = this.fullWidth;
+
+				this._.scale(this.pixelRatio, this.pixelRatio);
+
+			}   else{
+
+				this.canvas.height = this.fullHeight;
+				this.canvas.width = this.fullWidth;
+
+			}
+
+			this.points = [];
+
+			for (var i = -1, l = data.length; ++i < l;) {
+
+				args = data[i].slice(1);
+				method = data[i][0];
+
+				if (method in argSignatures) for (var a = -1, al = args.length; ++a < al;) {
+
+					type = argSignatures[method][a];
+					value = args[a];
+
+					switch (type) {
+						case argTypes.RADIUS:
+							value *= this.multiplier;
+							break;
+						case argTypes.DIM:
+							value *= this.multiplier;
+							value += this.padding;
+							break;
+						case argTypes.DEGREE:
+							value *= Math.PI/180;
+							break;
+					};
+
+					args[a] = value;
+
+				}
+
+				args.unshift(0);
+
+				for (var r, pd = this.pointDistance, t = pd; t <= 1; t += pd) {
+					
+					// Avoid crap like 0.15000000000000002
+					t = Math.round(t*1/pd) / (1/pd);
+
+					args[0] = t;
+
+					r = pathMethods[method].apply(null, args);
+
+					this.points.push({
+						x: r[0],
+						y: r[1],
+						progress: t
+					});
+
+				}
+
+			}
+
+			this.frame = 0;
+
+			if (this.converter && this.converter.setup) {
+				this.converter.setup(this);
+			}
+
+		},
+
+		prep: function(frame) {
+
+			if (frame in this.imageData) {
+				return;
+			}
+
+			this._.clearRect(0, 0, this.fullWidth, this.fullHeight);
+			this._.fillStyle = this.backgroundColor;
+			this._.fillRect(0, 0, this.fullWidth, this.fullHeight);
+
+			var points = this.points,
+				pointsLength = points.length,
+				pd = this.pointDistance,
+				point,
+				index,
+				frameD;
+
+			this._setup();
+
+			for (var i = -1, l = pointsLength*this.trailLength; ++i < l && !this.stopped;) {
+
+				index = frame + i;
+
+				point = points[index] || points[index - pointsLength];
+
+				if (!point) continue;
+
+				this.alpha = Math.round(1000*(i/(l-1)))/1000;
+
+				this._.globalAlpha = this.alpha;
+
+				if (this.fillColor) {
+					this._.fillStyle = this.fillColor;
+				}
+				if (this.strokeColor) {
+					this._.strokeStyle = this.strokeColor;
+				}
+
+				frameD = frame/(this.points.length-1);
+				indexD = i/(l-1);
+
+				this._preStep(point, indexD, frameD);
+				this.stepMethod(point, indexD, frameD);
+
+			} 
+
+			this._teardown();
+
+			this.imageData[frame] = (
+				this._.getImageData(0, 0, this.fullWidth, this.fullWidth)
+			);
+
+			return true;
+
+		},
+
+		draw: function() {
+			
+			if (!this.prep(this.frame)) {
+
+				this._.clearRect(0, 0, this.fullWidth, this.fullWidth);
+
+				this._.putImageData(
+					this.imageData[this.frame],
+					0, 0
+				);
+
+			}
+
+			if (this.converter && this.converter.step) {
+				this.converter.step(this);
+			}
+
+			if (!this.iterateFrame()) {
+				if (this.converter && this.converter.teardown) {
+					this.converter.teardown(this);
+					this.converter = null;
+				}
+			}
+
+		},
+
+		iterateFrame: function() {
+			
+			this.frame += this.stepsPerFrame;
+			
+			if (this.frame >= this.points.length) {
+				this.frame = 0;
+				return false;
+			}
+
+			return true;
+
+		},
+
+		play: function() {
+
+			this.stopped = false;
+
+			var hoc = this;
+
+			this.timer = setInterval(function(){
+				hoc.draw();
+			}, 1000 / this.fps);
+
+		},
+		stop: function() {
+
+			this.stopped = true;
+			this.timer && clearInterval(this.timer);
+
+		}
+	};
+
+	window.Sonic = Sonic;
+
+}());

+ 11 - 1
VisualInspection/js/mytask/check.js

@@ -48,7 +48,17 @@ function initCheck() {
         //查询评分情况
         queryCheckScores();
         //查询录像播放列表
-        queryVideoList();
+        var videos = $.checkTask.video_id.split(','); 
+        if(videos[0]){
+            curVideo = videos[0]; 
+             queryVideoList();
+         }else{
+              callFunc("showvideoview", "false");
+            layer.msg('该处暂无视屏!', {
+                    time: 2000, //20s后自动关闭
+            });
+             callFunc("stop", "");
+         }
     }
      $("select#video_list").change(function(){
         playVideo($(this).val());

+ 23 - 2
VisualInspection/js/statistics/assess_ranking.js

@@ -55,7 +55,7 @@ function getEmployeeInfos(url,param){
                 +"<td width='67px;'>"+getItemScore(data[i], '仪容仪表')+"</td><td width='67px;'>"+getItemScore(data[i], '表情')+"</td>"
                 +"<td width='67px;'>"+getItemScore(data[i], '动作')+"</td><td width='67px;'>"+getItemScore(data[i], '文明用语')+"</td>"
                 +"<td width='67px;'>"+ getItemScore(data[i], '工作纪律') +"</td><td width='67px;'>"+data[i].check_all_score+"</td>"
-                +"<td width='67px;'>"+filter(data[i].checked_num,'0')+"</td><td width='67px;'>"+average(data[i])+"</td>"
+                +"<td width='67px;'>"+filter(data[i].checked_num,'0')+"</td><td width='67px;'>"+filterByZeroHandle(average(data[i]).toFixed(2),'0')+"</td>"
                 +"<td width='75px;'>"+"</td><td>"+"</td></tr>";
         }
        $(".table-tbody").append(strTbody);   
@@ -104,6 +104,27 @@ function getItemScore(obj, check_item_name){
     return 0 ;
 }
 
+function filterByZeroHandle(value , default_display_value){
+        if(isNaN(value)|| value=='0.00'){
+            return default_display_value ;
+        }else{
+            return value ;
+        }
+       
+}
 
-
+function exportExcel(){
+    var start_date = $("#start-time").val();
+    var end_date = $("#end-time").val();
+    var dept_id = $("#fsList").val();
+    if(start_date==null||start_date==''||start_date==undefined||end_date==null||end_date==''||end_date==undefined){
+        tip("请选择起止日期");
+        return ;
+    }else{
+        start_date += " 00:00:00";
+        end_date += " 00:00:00";
+    }
+    window.open("http://localhost:8089/file/employee/order?dept_id="+dept_id+"&start_date="+start_date+"&end_date="+end_date);
+    //window.location.href="http://localhost:8089/file/employee/order?id="+dept_id+"&start="+start_date+"&end="+end_date;
+}
 

+ 0 - 2
VisualInspection/js/util/video.js

@@ -10,14 +10,12 @@ function doAction(func){
 function queryVideoList(){
 
     var videos = $.checkTask.video_id.split(',');
-    curVideo = videos[0];
 
     if(curVideo) {
         s1 = $.checkTask.start_time.replace(/-/g,"/");
         var startTime = new Date(s1).getTime()/1000;
         s1 = $.checkTask.end_time.replace(/-/g,"/");
         var endTime = new Date(s1).getTime()/1000;
-     
         //获取摄像头信息
         VideoGetById(curVideo,function(data){
             if(data!=null && typeof(data)!="undefined"){

+ 105 - 91
VisualInspection/view/mytask/check.html

@@ -1,10 +1,11 @@
+<script type="text/javascript" src="/js/lib/sonic.js?__inline"></script>
 <div class="container-fluid ">
     <div class="row">
         <form class="form-horizontal">
             <div class="form-group">
-                <label for="exampleInputAccount1" class="col-sm-1" >收费站</label>
+                <label for="exampleInputAccount1" class="col-sm-1">收费站</label>
                 <div class="col-sm-2">
-                    <select class="form-control"  id="fsList" disabled="disabled">
+                    <select class="form-control" id="fsList" disabled="disabled">
                         
                     </select>
                 </div>
@@ -29,91 +30,90 @@
     <div class="row">
         <div class="col-sm-6">
             <div id="dashboard" class="dashboard dashboard-draggable" data-height="300">
-            <section class="row">
-                <div class="col-md-12">
-                <div class="panel" data-id="1">
-                    <!--<div class="panel-heading">
+                <section class="row">
+                    <div class="col-md-12">
+                        <div class="panel" data-id="1">
+                            <!--<div class="panel-heading">
                     <i class="icon icon-list"></i>
                     <span class="title">面板标题</span>
                     </div>-->
-                    
-                    <div class="panel-body" style="padding:5px;">
-                        <ul class="nav nav-secondary">
-                            <li class="active"><a data-tab href="#tabContent1" bbb="0">收费亭</a></li>
-                            <li><a data-tab href="#tabContent2" bbb="1">车道</a></li>
-                            <li><a data-tab href="#tabContent3" bbb="2">广场</a></li>
-                        </ul>      
-                        <div class="tab-content" id="tabcontent" style="height:400px;">
-                            <div class="tab-pane active" id="tabContent1" class="col-sm-12">
-                            </div>
-                            <div class="tab-pane" id="tabContent2" class="col-sm-12">
-                            </div>
-                            <div class="tab-pane" id="tabContent3" class="col-sm-12">
-                            </div>
-                        </div>
-                        <div class="row" class="col-md-12" style="padding:5px;margin-top:5px;text-align:center">
-                            <input id="ex1" class="col-md-12"  type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="0"/>
-                        </div>
-                        <div class="row" style="padding:0 10px;margin-top:5px;text-align:center">
-                            <select class="form-control" id="video_list" style="width:200px;float:left;"></select>
-                            <div class="btn-group" style="float:right;">
-                                <button type="button" class="btn btn-info" onclick="doAction('start')"><i class="icon icon-play-circle icon-2x"></i></button>
-                                <button type="button" class="btn btn-info" onclick="doAction('stop')"><i class="icon icon-pause icon-2x"></i></button>
-                                <button type="button" class="btn btn-info" onclick="doAction('fast')"><i class="icon icon-forward icon-2x"></i></button>
-                                <button type="button" class="btn btn-info" onclick="doAction('slow')"><i class="icon icon-backward icon-2x"></i></button>
-                                <button type="button" class="btn btn-success" onclick="doAction('screenshot')"><i class="icon icon-camera icon-2x"></i></button>
+
+                            <div class="panel-body" style="padding:5px;">
+                                <ul class="nav nav-secondary">
+                                    <li class="active"><a data-tab href="#tabContent1" bbb="0">收费亭</a></li>
+                                    <li><a data-tab href="#tabContent2" bbb="1">车道</a></li>
+                                    <li><a data-tab href="#tabContent3" bbb="2">广场</a></li>
+                                </ul>
+                                <div class="tab-content" id="tabcontent" style="height:400px;text-align: center;background:rgba(ff,ff,ff,0.0);">
+                                    <p style="padding-top:100px;font-size:20px">加载中...</p>
+                                    <!--<i class="icon icon-spin icon-spinner  icon-5x" style="margin-top:100px"></i>-->
+                                </div>
+                                <div class="row" class="col-md-12" style="padding:5px;margin-top:5px;text-align:center">
+                                    <input id="ex1" class="col-md-12" type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="0"
+                                    />
+                                </div>
+                                <div class="row" style="padding:0 10px;margin-top:5px;text-align:center">
+                                    <select class="form-control" id="video_list" style="width:200px;float:left;"></select>
+                                    <div class="btn-group" style="float:right;">
+                                        <button type="button" class="btn btn-info" onclick="doAction('start')"><i class="icon icon-play-circle icon-2x"></i></button>
+                                        <button type="button" class="btn btn-info" onclick="doAction('stop')"><i class="icon icon-pause icon-2x"></i></button>
+                                        <button type="button" class="btn btn-info" onclick="doAction('fast')"><i class="icon icon-forward icon-2x"></i></button>
+                                        <button type="button" class="btn btn-info" onclick="doAction('slow')"><i class="icon icon-backward icon-2x"></i></button>
+                                        <button type="button" class="btn btn-success" onclick="doAction('screenshot')"><i class="icon icon-camera icon-2x"></i></button>
+                                    </div>
+                                </div>
+                                <!--<hr>-->
+
                             </div>
                         </div>
-                        <!--<hr>-->
-                       
-                        </div>
-                    </div>
                     </div>
                 </section>
                
                 
             </div>
-            
+
         </div>
         <div class="col-sm-6">
             <div id="score_datatable" style="height:350px;" data-checkable="true" data-sortable="true"></div>
             <div class="row">
                 <div id="dashboard" class="dashboard dashboard-draggable" data-height="300">
-                <div class="row" id="appeal_div" style="padding:10px;">
-                    <h3>申诉基本信息</h3>
-                    <div>
-                        <table style="width:100%;">
-                            <tr>
-                                <td width="20%">申诉时间:<label id="appeal_time"></label></td>
-                                <td width="20%">申诉原因:<label id="appeal_reason"></label></td>
-                            </tr>
-                            <tr>
-                                <td width="20%">附件:<div class="file-list" id="appeal_file_list"></div></td>
-                            </tr>
-                        </table>
+                    <div class="row" id="appeal_div" style="padding:10px;">
+                        <h3>申诉基本信息</h3>
+                        <div>
+                            <table style="width:100%;">
+                                <tr>
+                                    <td width="20%">申诉时间:<label id="appeal_time"></label></td>
+                                    <td width="20%">申诉原因:<label id="appeal_reason"></label></td>
+                                </tr>
+                                <tr>
+                                    <td width="20%">附件:
+                                        <div class="file-list" id="appeal_file_list"></div>
+                                    </td>
+                                </tr>
+                            </table>
+                        </div>
                     </div>
-                </div>
-                <div class="row" class="col-sm-11" style="margin:5px;">
-                    <button class="btn btn-primary" type="button" onclick="clearAllImg()" style="margin-right:10px;">清空</button>
-                    <button class="btn btn-danger" type="button"  onclick="showScore()" style="margin-right:10px;">评分</button>
-                    <button id="saveEditBtn" class="btn btn-warning" type="button"  onclick="saveEdit()" style="margin-right:10px;display:none;">保存修改</button>
-                    <form id="form1" runat="server" method="post" enctype="multipart/form-data" style="float:left;margin-right:10px;"> 
-                        <div> 
-                            <button id="box" class="btn btn-primary" type="button">上传</button>
-                            <div style="display:none;"> 
-                            <input type="file" name="_f" id="_f" /> 
-                            </div> 
+                    <div class="row" class="col-sm-11" style="margin:5px;">
+                        <button class="btn btn-primary" type="button" onclick="clearAllImg()" style="margin-right:10px;">清空</button>
+                        <button class="btn btn-danger" type="button" onclick="showScore()" style="margin-right:10px;">评分</button>
+                        <button id="saveEditBtn" class="btn btn-warning" type="button" onclick="saveEdit()" style="margin-right:10px;display:none;">保存修改</button>
+                        <form id="form1" runat="server" method="post" enctype="multipart/form-data" style="float:left;margin-right:10px;">
+                            <div>
+                                <button id="box" class="btn btn-primary" type="button">上传</button>
+                                <div style="display:none;">
+                                    <input type="file" name="_f" id="_f" />
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                    <div class="panel">
+                        <div class="panel-body" style="padding:5px;" class="col-sm-12">
+                            <div id="img_container" class="cards cards-borderless col-sm-12" style="height:100px;overflow:auto;">
+                            </div>
                         </div>
-                    </form>                     
-                </div>
-                <div class="panel">
-                    <div class="panel-body" style="padding:5px;" class="col-sm-12">
-                        <div id="img_container" class="cards cards-borderless col-sm-12" style="height:100px;overflow:auto;">
-                        </div>                      
                     </div>
                 </div>
-            </div>
-                
+
             </div>
             <div class="row" style="margin-top:5px;">
                 <div class="col-sm-10" id="btn_task">
@@ -134,14 +134,14 @@
     </div>
 </div>
 <div id="form-div" style="display:none;text-align:center;">
-    <link rel="import" href="/view/mytask/changePerson.html?__inline">   
-</div> 
+    <link rel="import" href="/view/mytask/changePerson.html?__inline">
+</div>
 <div id="items-div" style="display:none;text-align:center;">
-   <ul id="items_tree" class="ztree"></ul>  
+    <ul id="items_tree" class="ztree"></ul>
 </div>
 <div id="score-detail-div" style="display:none;text-align:center;">
-  <link rel="import" href="/view/mytask/scoreDetail.html?__inline"> 
-</div> 
+    <link rel="import" href="/view/mytask/scoreDetail.html?__inline">
+</div>
 <!-- 对话框HTML -->
 <div class="modal fade" id="validSubmitWin">
     <div class="modal-dialog">
@@ -151,7 +151,7 @@
                 <h4 class="modal-title">无效申请</h4>
             </div>
             <div class="modal-body">
-                <form  class="form-horizontal">
+                <form class="form-horizontal">
                     <label for="exampleInputAccount1" class="col-sm-2">无效原因</label>
                     <div class="form-group">
                         <input class="col-sm-3" type="text" id="valid-reason" class="form-control" placeholder="原因">
@@ -171,7 +171,7 @@
             <div class="form-group">
                 <label class="col-md-4 col-sm-2">原因</label>
                 <div class="col-md-6 col-sm-10">
-                        <input type="text" class="form-control" id="apply_reason" placeholder="">
+                    <input type="text" class="form-control" id="apply_reason" placeholder="">
                 </div>
             </div>
         </div>
@@ -179,23 +179,36 @@
 </div>
 <script>
     var curVideo;
-    $(document).ready(function() {
+    $(document).ready(function () {
         initCheck();
-        $('[data-tab]').on('shown.zui.tab', function(e) {
+
+
+        $('[data-tab]').on('shown.zui.tab', function (e) {
             // console.log('当前被激活的标签页', $(e.target).attr('bbb'));
             // console.log('上一个标签页', e.relatedTarget);
-            var i = $(e.target).attr('bbb');           
-            var videos = $.checkTask.video_id.split(',');     
-            if(videos[i]) curVideo = videos[i];
-            queryVideoList();
+            var i = $(e.target).attr('bbb');
+            var videos = $.checkTask.video_id.split(',');
+
+            if (videos[i] != "" && videos[i] && typeof (videos[i]) != "undefined") {
+                curVideo = videos[i];
+                queryVideoList();
+            } else {
+                callFunc("showvideoview", "false");
+                layer.msg('暂无视屏!', {
+                    time: 2000, //20s后自动关闭
+                });
+                callFunc("stop", "");
+            }
+
         });
-       
+
+
     });
 
-    $("#box").click(function () { 
-        return $("#_f").click(); 
-    }); 
-    $("#_f").change(function() {
+    $("#box").click(function () {
+        return $("#_f").click();
+    });
+    $("#_f").change(function () {
         UpladFile();
     });
 
@@ -206,11 +219,12 @@
         // var form = new FormData();
         // form.append("name", "hooyes");                        // 可以增加表单数据
         // form.append("file", fileObj);                           // 文件对象
-        uploadFile(fileObj, "file", function(data) {
-           
-           addPic(base_image_server_url+data.path);
-        }, function(error) {
+        uploadFile(fileObj, "file", function (data) {
+
+            addPic(base_image_server_url + data.path);
+        }, function (error) {
             console.log(error)
         });
     }
-</script>
+
+</script>

+ 1 - 1
VisualInspection/view/statistics/emp_ranking.html

@@ -20,7 +20,7 @@
                     <button class="btn btn-primary " type="button" onclick="queryEmpClick()">查询</button>
                 </div>
                 <div class="col-sm-6">
-                    <button class="btn btn-primary " type="button" >导出Excel</button>
+                    <button class="btn btn-primary " type="button" onclick="exportExcel()">导出Excel</button>
                 </div>
             </div>
         </form>

+ 4 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/StatisticsBo.java

@@ -25,4 +25,8 @@ public class StatisticsBo {
     
     private User user;
     
+    //private Integer[] emp_assess;
+    
+    private int check_score_avg;
+    
 }

+ 17 - 3
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/FileExcelController.java

@@ -1,5 +1,8 @@
 package com.xintong.visualinspection.controller;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
@@ -9,10 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.xintong.visualinspection.bean.StatisticsBean;
-import com.xintong.visualinspection.bean.StatisticsBo;
 import com.xintong.visualinspection.service.StatisticsService;
 
 /**
@@ -34,8 +37,19 @@ public class FileExcelController extends BaseController {
      * @since  1.0.0
      */
     @RequestMapping(value = "/employee/order",method=RequestMethod.GET)
-    public String getEmployeeOrder(HttpServletRequest req,HttpServletResponse resp){
-    	 statisticsService.getEmployeeCheckedInfo(new StatisticsBean(), req, resp);
+    public String getEmployeeOrder(HttpServletRequest req,HttpServletResponse resp,@RequestParam Long dept_id,@RequestParam String start_date,@RequestParam String end_date){
+    	StatisticsBean obj = new StatisticsBean();
+    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" );
+    	try {
+			Date start = sdf.parse(start_date);
+			Date end = sdf.parse(end_date);
+			obj.setDept_id(dept_id);
+			obj.setStart_date(start);
+			obj.setEnd_date(end);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+    	statisticsService.getEmployeeCheckedInfo(obj, req, resp);
     	return super.returnSuccessResult(null);
     }
     

+ 4 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/StatisticsMapper.xml

@@ -4,7 +4,7 @@
     
     <select id="selectStatistics" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
     	SELECT  u.checked_person AS user_id , u.checked_dept AS dept_id ,u.parent_id AS item_id ,sum(u.score) AS score ,s.name  FROM (
-			SELECT t.checked_person , t.checked_dept,ci.parent_id, t.score  FROM check_score t 
+			SELECT t.checked_person , t.checked_dept,ci.parent_id, ci.score  FROM check_score t 
 			LEFT JOIN check_item ci ON t.check_item_id = ci.id
 			WHERE 1=1 
 			<if test="start_date!=null and end_date != null">
@@ -39,8 +39,8 @@
     </select>
     
     <select id="selectFeeStationCheckedScore" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
-    	SELECT sum(t.score) AS score ,t.checked_dept AS dept_id 
-    		FROM check_score t 
+    	SELECT sum(c.score) AS score ,t.checked_dept AS dept_id 
+    		FROM check_score t LEFT JOIN check_item c ON t.check_item_id = c.id
     		WHERE 1=1
     		<if test="start_date!=null and end_date != null">
 		        AND	 t.update_time &gt;= #{start_date} AND t.update_time &lt;= #{end_date} 
@@ -50,7 +50,7 @@
     
     <select id="selectFeeStationCheckedPersonScoreDetail" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
     	    SELECT  u.checked_dept AS dept_id ,u.parent_id AS item_id ,sum(u.score) AS score ,s.name  FROM (
-			SELECT  t.checked_dept,ci.parent_id, t.score  FROM check_score t 
+			SELECT  t.checked_dept,ci.parent_id, ci.score  FROM check_score t 
 			LEFT JOIN check_item ci ON t.check_item_id = ci.id
 			WHERE 1=1
 			<if test="start_date!=null and end_date != null">

+ 92 - 79
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -32,88 +32,88 @@ import com.xintong.visualinspection.service.BaseService;
 import com.xintong.visualinspection.service.StatisticsService;
 
 /**
- * 文件名:StatisticsServiceImpl
- * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
+ * 文件名:StatisticsServiceImpl 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation
+ * 2017 版权所有.
  */
 @Service
 public class StatisticsServiceImpl extends BaseService implements StatisticsService {
 
-    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(StatisticsServiceImpl.class);
-
-    @Autowired
-    private StatisticsDao statisticsDao ;
-    
-    @Autowired
-    private DepartmentDao departmentDao ;
-    
-    @Autowired
-    private UserInfoDao userInfoDao;
-    
+	private static final org.slf4j.Logger logger = LoggerFactory.getLogger(StatisticsServiceImpl.class);
+
+	@Autowired
+	private StatisticsDao statisticsDao;
+
+	@Autowired
+	private DepartmentDao departmentDao;
+
+	@Autowired
+	private UserInfoDao userInfoDao;
+
 	@Override
 	public List<StatisticsBo> getEmployeeCheckedInfo(StatisticsBean obj) {
 		// 查看是否有部门id
 		Long organId = obj.getDept_id();
 		// 将检索出来的数据放到如map中
 		List<StatisticsBean> list = statisticsDao.selectStatistics(obj);
-		
+
 		List<StatisticsBean> timesList = statisticsDao.selectCheckedTimes(obj);
-		
-		Map<Long,StatisticsBo> statisticBoMap = new HashMap<Long,StatisticsBo>();
-		
+
+		Map<Long, StatisticsBo> statisticBoMap = new HashMap<Long, StatisticsBo>();
+
 		User user = new User();
 		user.setPositionid(1);
-		if(obj.getDept_id()!=null)
+		if (obj.getDept_id() != null)
 			user.setOrganid(obj.getDept_id().intValue());
 		List<User> listUserts = userInfoDao.getUsers(user);
-		for(User u:listUserts){
-			if(u.getFee_station_name()!=null){
+		for (User u : listUserts) {
+			if (u.getFee_station_name() != null) {
 				StatisticsBo tmp = new StatisticsBo();
 				tmp.setUser(u);
-				statisticBoMap.put(u.getId()+0L, tmp);				
+				statisticBoMap.put(u.getId() + 0L, tmp);
 			}
 		}
-		
-//		for(User user:CacheUtil.userMap.values()){
-//			if(user.getPositionid() ==1){
-//				if(organId ==null ||  user.getOrganid()+0L == organId+0L ){
-//					StatisticsBo tmp = new StatisticsBo();
-//					tmp.setUser(user);
-//					statisticBoMap.put(user.getId()+0L,tmp);
-//				}
-//			}
-//		}
-		
-		for( StatisticsBean statisticsBean : list ){
-			if(statisticBoMap.containsKey(statisticsBean.getUser_id())){
+
+		// for(User user:CacheUtil.userMap.values()){
+		// if(user.getPositionid() ==1){
+		// if(organId ==null || user.getOrganid()+0L == organId+0L ){
+		// StatisticsBo tmp = new StatisticsBo();
+		// tmp.setUser(user);
+		// statisticBoMap.put(user.getId()+0L,tmp);
+		// }
+		// }
+		// }
+
+		for (StatisticsBean statisticsBean : list) {
+			if (statisticBoMap.containsKey(statisticsBean.getUser_id())) {
 				StatisticsBo tmp = statisticBoMap.get(statisticsBean.getUser_id());
-				if(statisticsBean.getName()!=null && statisticsBean.getScore()!=null){
+				if (statisticsBean.getName() != null && statisticsBean.getScore() != null) {
 					tmp.getChecked_socre_name().add(statisticsBean.getName());
 					tmp.getChecked_score().add(statisticsBean.getScore());
-					tmp.setCheck_all_score(tmp.getCheck_all_score()+statisticsBean.getScore() );					
+					tmp.setCheck_all_score(tmp.getCheck_all_score() + statisticsBean.getScore());
 				}
 			}
 		}
-		
-		for(StatisticsBean statisticsBean : timesList){
-			if(statisticBoMap.containsKey(statisticsBean.getUser_id())){
+
+		for (StatisticsBean statisticsBean : timesList) {
+			if (statisticBoMap.containsKey(statisticsBean.getUser_id())) {
 				StatisticsBo tmp = statisticBoMap.get(statisticsBean.getUser_id());
 				tmp.setChecked_num(statisticsBean.getChecked_num());
 			}
 		}
-		
+
 		List<StatisticsBo> lists = new ArrayList<>(statisticBoMap.values());
 		// 进行排序
 		lists.sort(new Comparator<StatisticsBo>() {
 			@Override
 			public int compare(StatisticsBo o1, StatisticsBo o2) {
-				if(o1.getCheck_all_score() >= o2.getCheck_all_score() ){
+				if (o1.getCheck_all_score() >= o2.getCheck_all_score()) {
 					return 1;
-				}else{
-					return -1 ;
+				} else {
+					return -1;
 				}
 			}
 		});
-	
+
 		return lists;
 	}
 
@@ -121,35 +121,35 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 	public List<StatisticsBean> getFeeStationCheckedScore(StatisticsBean obj) {
 		// 获取收费站信息收费站人数
 		List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(obj);
-		Map<Long,StatisticsBean> mapStationInfos = new HashMap<>();
-		for(StatisticsBean sta:lists){
+		Map<Long, StatisticsBean> mapStationInfos = new HashMap<>();
+		for (StatisticsBean sta : lists) {
 			mapStationInfos.put(sta.getDept_id(), sta);
 		}
-		
+
 		// 检查人数 和 检查次数
 		List<StatisticsBean> listCheckNum = statisticsDao.selectFeeStationCheckNum(obj);
-		for(StatisticsBean sta:listCheckNum){
-			if(mapStationInfos.containsKey(sta.getDept_id())){
+		for (StatisticsBean sta : listCheckNum) {
+			if (mapStationInfos.containsKey(sta.getDept_id())) {
 				mapStationInfos.get(sta.getDept_id()).setChecked_num(sta.getChecked_num());
 				mapStationInfos.get(sta.getDept_id()).setChecked_people_num(sta.getChecked_people_num());
 			}
 		}
-		
+
 		List<StatisticsBean> listCheckedScore = statisticsDao.selectFeeStationCheckedScore(obj);
-		for(StatisticsBean sta:listCheckedScore){
-			if(mapStationInfos.containsKey(sta.getDept_id())){
+		for (StatisticsBean sta : listCheckedScore) {
+			if (mapStationInfos.containsKey(sta.getDept_id())) {
 				StatisticsBean statis = mapStationInfos.get(sta.getDept_id());
-				statis.setAll_check_score( statis.getAll_check_score()+sta.getScore());
-				if(sta.getScore() <= 15){
-					statis.setScore_fifteen(statis.getScore_fifteen()+1);
-				}else if(sta.getScore()<=50){
-					statis.setScore_fifty(statis.getScore_fifty()+1);
-				}else{
-					statis.setScore_over_fifty(statis.getScore_over_fifty()+1);
+				statis.setAll_check_score(statis.getAll_check_score() + sta.getScore());
+				if (sta.getScore() <= 15) {
+					statis.setScore_fifteen(statis.getScore_fifteen() + 1);
+				} else if (sta.getScore() <= 50) {
+					statis.setScore_fifty(statis.getScore_fifty() + 1);
+				} else {
+					statis.setScore_over_fifty(statis.getScore_over_fifty() + 1);
 				}
 			}
 		}
-		
+
 		return new ArrayList<>(mapStationInfos.values());
 	}
 
@@ -158,32 +158,32 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 
 		// 获取收费站信息收费站人数
 		List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(obj);
-		Map<Long,StatisticsBean> mapStationInfos = new HashMap<>();
-		for(StatisticsBean sta:lists){
+		Map<Long, StatisticsBean> mapStationInfos = new HashMap<>();
+		for (StatisticsBean sta : lists) {
 			mapStationInfos.put(sta.getDept_id(), sta);
 		}
-		
-		//  检查人数 和 检查次数
+
+		// 检查人数 和 检查次数
 		List<StatisticsBean> listCheckNum = statisticsDao.selectFeeStationCheckNum(obj);
-		for(StatisticsBean sta:listCheckNum){
-			if(mapStationInfos.containsKey(sta.getDept_id())){
+		for (StatisticsBean sta : listCheckNum) {
+			if (mapStationInfos.containsKey(sta.getDept_id())) {
 				mapStationInfos.get(sta.getDept_id()).setChecked_num(sta.getChecked_num());
 				mapStationInfos.get(sta.getDept_id()).setChecked_people_num(sta.getChecked_people_num());
 			}
 		}
-		
+
 		List<StatisticsBean> listCheckedScore = statisticsDao.selectFeeStationCheckedPersonScoreDetail(obj);
-		for(StatisticsBean sta:listCheckedScore){
-			if(mapStationInfos.containsKey(sta.getDept_id())){
+		for (StatisticsBean sta : listCheckedScore) {
+			if (mapStationInfos.containsKey(sta.getDept_id())) {
 				StatisticsBean statis = mapStationInfos.get(sta.getDept_id());
-				statis.setAll_check_score( statis.getAll_check_score()+sta.getScore());
+				statis.setAll_check_score(statis.getAll_check_score() + sta.getScore());
 				statis.getChecked_socre_name().add(sta.getName());
 				statis.getChecked_score().add(sta.getScore());
 			}
 		}
-		
+
 		return new ArrayList<>(mapStationInfos.values());
-	
+
 	}
 
 	@Override
@@ -191,9 +191,22 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		// 检索数据
 		List<StatisticsBo> listStatistic = getEmployeeCheckedInfo(obj);
 		// 处理数据
-		// todo ...   
-		
-		
+		//Integer[] emp_assess = new Integer[listStatistic.size()];
+		for (int i = 0; i < listStatistic.size(); i++) {
+			StatisticsBo st = new StatisticsBo();
+			st = listStatistic.get(i);
+			try {
+				st.setCheck_score_avg(listStatistic.get(i).getCheck_all_score() 
+						/ listStatistic.get(i).getChecked_num());
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+			/*List<Integer> checked_score_list = st.getChecked_score();
+			for (int j = 0; j < checked_score_list.size(); i++) {
+				emp_assess[j] = checked_score_list.get(i);
+			}*/
+		}
+
 		String path = "D:/file20170606.xls";
 		try (InputStream is = this.getClass().getResourceAsStream("/employee_order.xls")) {
 			try (OutputStream os = new FileOutputStream(path)) {
@@ -222,7 +235,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			toClient.write(buffer);
 			toClient.flush();
 			toClient.close();
-		}catch(Exception e){
+		} catch (Exception e) {
 			logger.error(e.toString());
 		}
 	}
@@ -230,13 +243,13 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 	@Override
 	public void getFeeStationCheckedScore(StatisticsBean obj, HttpServletRequest req, HttpServletResponse resp) {
 		// TODO Auto-generated method stub
-		
+
 	}
 
 	@Override
 	public void getFeeStationCheckItemScore(StatisticsBean obj, HttpServletRequest req, HttpServletResponse resp) {
 		// TODO Auto-generated method stub
-		
+
 	}
-    
+
 }

+ 8 - 8
VisualInspection_server/src/main/resources/application.properties

@@ -2,8 +2,8 @@ server.port=8089
 spring.thymeleaf.cache=false
 context.listener.classes=com.xintong.SystemInit
 
-master.datasource.url = jdbc:mysql://10.112.0.199:3306/visualinspection?useUnicode=true&characterEncoding=utf-8
-#master.datasource.url = jdbc:mysql://git.topm.win:6381/visualinspection?useUnicode=true&characterEncoding=utf-8
+#master.datasource.url = jdbc:mysql://10.112.0.199:3306/visualinspection?useUnicode=true&characterEncoding=utf-8
+master.datasource.url = jdbc:mysql://git.topm.win:6381/visualinspection?useUnicode=true&characterEncoding=utf-8
 #master.datasource.url = jdbc:mysql://192.168.8.236:3306/visualinspection?useUnicode=true&characterEncoding=utf-8
 master.datasource.username = root
 master.datasource.password = root
@@ -11,8 +11,8 @@ master.datasource.driver-class-name = com.mysql.jdbc.Driver
 master.mapper-locations=classpath:com/xintong/visualinspection/mapper/master/*.xml
 
 ## \u7528\u6237\u6570\u636e\u6e90\u914d\u7f6e
-cluster.datasource.url=jdbc:mysql://10.112.0.199:3306/yanhai?useUnicode=true&characterEncoding=utf8
-#cluster.datasource.url=jdbc:mysql://git.topm.win:6381/yanhai?useUnicode=true&characterEncoding=utf8
+#cluster.datasource.url=jdbc:mysql://10.112.0.199:3306/yanhai?useUnicode=true&characterEncoding=utf8
+cluster.datasource.url=jdbc:mysql://git.topm.win:6381/yanhai?useUnicode=true&characterEncoding=utf8
 cluster.datasource.username=root
 cluster.datasource.password=root
 cluster.datasource.driver-class-name = com.mysql.jdbc.Driver
@@ -53,11 +53,11 @@ spring.datasource.useGlobalDataSourceStat=true
 # Redis\u6570\u636e\u5e93\u7d22\u5f15\uff08\u9ed8\u8ba4\u4e3a0\uff09
 spring.redis.database=0  
 # Redis\u670d\u52a1\u5668\u5730\u5740
-spring.redis.host=10.112.0.199
-#spring.redis.host=git.topm.win
+#spring.redis.host=10.112.0.199
+spring.redis.host=git.topm.win
 # Redis\u670d\u52a1\u5668\u8fde\u63a5\u7aef\u53e3
-#spring.redis.port=6380
-spring.redis.port=6379 
+spring.redis.port=6380
+#spring.redis.port=6379 
 # Redis\u670d\u52a1\u5668\u8fde\u63a5\u5bc6\u7801\uff08\u9ed8\u8ba4\u4e3a\u7a7a\uff09
 spring.redis.password=xintong
 # \u8fde\u63a5\u6c60\u6700\u5927\u8fde\u63a5\u6570\uff08\u4f7f\u7528\u8d1f\u503c\u8868\u793a\u6ca1\u6709\u9650\u5236\uff09

binární
VisualInspection_server/src/main/resources/employee_order.xls