Commit 0be569ef53e5c5aca790ad2b152d4035a9c86088

Authored by 潘钊
1 parent 37f94c0d

update

src/main/java/com/bsth/data/summary/entity/FastAndSlow.java
@@ -273,4 +273,12 @@ public class FastAndSlow { @@ -273,4 +273,12 @@ public class FastAndSlow {
273 public void setT(Long t) { 273 public void setT(Long t) {
274 this.t = t; 274 this.t = t;
275 } 275 }
  276 +
  277 + public boolean isSlow() {
  278 + return this.fcsjSlow>0 || this.dfsjSlow>0 || this.zdsjSlow>0 || this.zdsjDfSlow>0;
  279 + }
  280 +
  281 + public boolean isFast() {
  282 + return this.fcsjFast>0 || this.dfsjFast>0 || this.zdsjFast>0 || this.zdsjDfFast>0;
  283 + }
276 } 284 }
src/main/java/com/bsth/data/summary/service/impl/FastAndSlowServiceImpl.java
@@ -3,11 +3,46 @@ package com.bsth.data.summary.service.impl; @@ -3,11 +3,46 @@ package com.bsth.data.summary.service.impl;
3 import com.bsth.data.summary.entity.FastAndSlow; 3 import com.bsth.data.summary.entity.FastAndSlow;
4 import com.bsth.data.summary.service.FastAndSlowService; 4 import com.bsth.data.summary.service.FastAndSlowService;
5 import com.bsth.service.impl.BaseServiceImpl; 5 import com.bsth.service.impl.BaseServiceImpl;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
6 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
7 9
  10 +import java.util.ArrayList;
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +
8 /** 14 /**
9 * Created by panzhao on 2017/10/24. 15 * Created by panzhao on 2017/10/24.
10 */ 16 */
11 @Service 17 @Service
12 public class FastAndSlowServiceImpl extends BaseServiceImpl<FastAndSlow, Long> implements FastAndSlowService { 18 public class FastAndSlowServiceImpl extends BaseServiceImpl<FastAndSlow, Long> implements FastAndSlowService {
  19 +
  20 + Logger logger = LoggerFactory.getLogger(this.getClass());
  21 +
  22 + @Override
  23 + public Iterable<FastAndSlow> list(Map<String, Object> map) {
  24 + List<FastAndSlow> list = (List) super.list(map);
  25 +
  26 + try{
  27 + List rsList = new ArrayList();
  28 + String type = String.valueOf(map.get("type"));
  29 + if("-1".equals(type)){//慢误
  30 + for(FastAndSlow fas : list){
  31 + if(fas.isSlow())
  32 + rsList.add(fas);
  33 + }
  34 + return rsList;
  35 + }
  36 + else if("1".equals(type)){//快误
  37 + for(FastAndSlow fas : list){
  38 + if(fas.isFast())
  39 + rsList.add(fas);
  40 + }
  41 + return rsList;
  42 + }
  43 + }catch (Exception e){
  44 + logger.error("", e);
  45 + }
  46 + return list;
  47 + }
13 } 48 }
src/main/resources/static/pages/summary/fast_and_slow/data.html
1 <div class="ct_data_body_wrap"> 1 <div class="ct_data_body_wrap">
2 <div class="uk-card uk-card-default uk-card-body ct_rq_left"> 2 <div class="uk-card uk-card-default uk-card-body ct_rq_left">
3 - <ul uk-scrollspy-nav="closest: li; scroll: true; " class="uk-nav uk-nav-default tm-nav uk-nav-parent-icon"></ul> 3 + <ul uk-scrollspy-nav="closest: li; scroll: true; offset: 285" class="uk-nav uk-nav-default tm-nav uk-nav-parent-icon"></ul>
4 </div> 4 </div>
5 5
6 <div class="uk-card uk-card-default uk-card-body ct_right_tables" > 6 <div class="uk-card uk-card-default uk-card-body ct_right_tables" >
@@ -15,9 +15,7 @@ @@ -15,9 +15,7 @@
15 15
16 <script id="fast_and_slow_right_body_temp" type="text/html"> 16 <script id="fast_and_slow_right_body_temp" type="text/html">
17 <div> 17 <div>
18 - {{each listMap as obj k}}  
19 - <h2 id="table_{{k}}">{{k}}</h2>  
20 - <div class="data_table_wrap"> 18 + <div class="data_table_wrap head">
21 <table cellspacing="1" class="data_table"> 19 <table cellspacing="1" class="data_table">
22 <col /> 20 <col />
23 <col width="14%"/> 21 <col width="14%"/>
@@ -65,11 +63,33 @@ @@ -65,11 +63,33 @@
65 <td>快</td> 63 <td>快</td>
66 <td>慢</td> 64 <td>慢</td>
67 </tr> 65 </tr>
  66 + </table>
  67 + </div>
  68 + {{each listMap as obj k}}
  69 + <div class="data_table_wrap data" id="table_{{k}}">
  70 + <table cellspacing="1" class="data_table">
  71 + <col />
  72 + <col width="14%"/>
  73 + <col width="4%"/>
  74 + <col width="6%"/>
  75 + <col width="6%"/>
  76 + <col width="6%"/>
  77 + <col width="5%"/>
  78 + <col width="5%"/>
  79 + <col width="5%"/>
  80 + <col width="5%"/>
  81 + <col width="6%"/>
  82 + <col width="6%"/>
  83 + <col width="6%"/>
  84 + <col width="5%"/>
  85 + <col width="5%"/>
  86 + <col width="5%"/>
  87 + <col width="5%"/>
68 {{each listMap[k] as obj i}} 88 {{each listMap[k] as obj i}}
69 <tr> 89 <tr>
70 <td>{{i+1}}</td> 90 <td>{{i+1}}</td>
71 <td>{{obj.stationName}}</td> 91 <td>{{obj.stationName}}</td>
72 - <td>{{obj.upDown==0?"上行":"下行"}}</td> 92 + <td class="cell_dir_{{obj.upDown}}">{{obj.upDown==0?"上行":"下行"}}</td>
73 <td>{{obj.fcsj}}</td> 93 <td>{{obj.fcsj}}</td>
74 <td>{{obj.dfsj}}</td> 94 <td>{{obj.dfsj}}</td>
75 <td>{{obj.fcsjActual}}</td> 95 <td>{{obj.fcsjActual}}</td>
@@ -87,13 +107,21 @@ @@ -87,13 +107,21 @@
87 </tr> 107 </tr>
88 {{/each}} 108 {{/each}}
89 <tr> 109 <tr>
90 - <td rowspan="2">合计:</td>  
91 - <td colspan="8" class="count_col">上行(计划快误点:12 累计时间:50 待发快误点:15 累计时间:70)</td>  
92 - <td colspan="8" class="count_col">下行(计划快误点:12 累计时间:50 待发快误点:15 累计时间:70)</td> 110 + <td rowspan="4">合计:</td>
  111 + <td colspan="8" class="count_col">发车:上行(计划快误点:<a class="c_c_0">{{countMap[k][0]['fast'][0]}}</a> &nbsp;累计时间:<a class="c_c_0">{{timeCountMap[k][0]['fast'][0]}}</a> &nbsp;待发快误点:<a class="c_c_0">{{countMap[k][0]['fast'][1]}}</a> &nbsp;累计时间:<a class="c_c_0">{{timeCountMap[k][0]['fast'][1]}}</a>)</td>
  112 + <td colspan="8" class="count_col">发车:下行(计划快误点:<a class="c_c_1">{{countMap[k][1]['fast'][0]}}</a> &nbsp;累计时间:<a class="c_c_1">{{timeCountMap[k][1]['fast'][0]}}</a> 待发快误点:<a class="c_c_1">{{countMap[k][1]['fast'][1]}}</a> &nbsp;累计时间:<a class="c_c_1">{{timeCountMap[k][1]['fast'][1]}}</a>)</td>
  113 + </tr>
  114 + <tr>
  115 + <td colspan="8" class="count_col">发车:上行(计划慢误点:<a class="c_c_0">{{countMap[k][0]['slow'][0]}}</a> &nbsp;累计时间:<a class="c_c_0">{{timeCountMap[k][0]['slow'][0]}}</a> &nbsp;待发慢误点:<a class="c_c_0">{{countMap[k][0]['slow'][1]}}</a> &nbsp;累计时间:<a class="c_c_0">{{timeCountMap[k][0]['slow'][1]}}</a>)</td>
  116 + <td colspan="8" class="count_col">发车:下行(计划慢误点:<a class="c_c_1">{{countMap[k][1]['slow'][0]}}</a> &nbsp;累计时间:<a class="c_c_1">{{timeCountMap[k][1]['slow'][0]}}</a> &nbsp;待发慢误点:<a class="c_c_1">{{countMap[k][1]['slow'][1]}}</a> &nbsp;累计时间:<a class="c_c_1">{{timeCountMap[k][1]['slow'][1]}}</a>)</td>
93 </tr> 117 </tr>
94 <tr> 118 <tr>
95 - <td colspan="8" class="count_col">上行(计划快误点:12 累计时间:50 待发快误点:15 累计时间:70)</td>  
96 - <td colspan="8" class="count_col">下行(计划快误点:12 累计时间:50 待发快误点:15 累计时间:70)</td> 119 + <td colspan="8" class="count_col">到达:上行(计划快误点:<a class="c_c_0">{{countMap[k][0]['fast'][2]}}</a> &nbsp;累计时间:<a class="c_c_0">{{timeCountMap[k][0]['fast'][2]}}</a> &nbsp;待发快误点:<a class="c_c_0">{{countMap[k][0]['fast'][3]}}</a> &nbsp;累计时间:<a class="c_c_0">{{timeCountMap[k][0]['fast'][3]}}</a>)</td>
  120 + <td colspan="8" class="count_col">到达:下行(计划快误点:<a class="c_c_1">{{countMap[k][1]['fast'][2]}}</a> &nbsp;累计时间:<a class="c_c_1">{{timeCountMap[k][1]['fast'][2]}}</a> &nbsp;待发快误点:<a class="c_c_1">{{countMap[k][1]['fast'][3]}}</a> &nbsp;累计时间:<a class="c_c_1">{{timeCountMap[k][1]['fast'][3]}}</a>)</td>
  121 + </tr>
  122 + <tr>
  123 + <td colspan="8" class="count_col">到达:上行(计划慢误点:<a class="c_c_0">{{countMap[k][0]['slow'][2]}}</a> &nbsp;累计时间:<a class="c_c_0">{{timeCountMap[k][0]['slow'][2]}}</a> &nbsp;待发慢误点:<a class="c_c_0">{{countMap[k][0]['slow'][3]}}</a> &nbsp;累计时间:<a class="c_c_0">{{timeCountMap[k][0]['slow'][3]}}</a>)</td>
  124 + <td colspan="8" class="count_col">到达:下行(计划慢误点:<a class="c_c_1">{{countMap[k][1]['slow'][2]}}</a> &nbsp;累计时间:<a class="c_c_1">{{timeCountMap[k][1]['slow'][2]}}</a> &nbsp;待发慢误点:<a class="c_c_1">{{countMap[k][1]['slow'][3]}}</a> &nbsp;累计时间:<a class="c_c_1">{{timeCountMap[k][1]['slow'][3]}}</a>)</td>
97 </tr> 125 </tr>
98 </table> 126 </table>
99 </div> 127 </div>
@@ -104,17 +132,64 @@ @@ -104,17 +132,64 @@
104 <script> 132 <script>
105 (function () { 133 (function () {
106 var wrap = '.ct_data_body_wrap', 134 var wrap = '.ct_data_body_wrap',
107 - listMap; 135 + listMap, countMap={}, timeCountMap={};
108 136
109 $(wrap).on('init', function (e, data) { 137 $(wrap).on('init', function (e, data) {
110 e.stopPropagation(); 138 e.stopPropagation();
111 listMap = data.listMap; 139 listMap = data.listMap;
112 140
  141 + //统计
  142 + for(var rq in listMap){
  143 + /**
  144 + * 2017-10-20:[{fast: [发车, 待发, 计划终点,待发终点], slow: [发车, 待发, 计划终点,待发终点]},{}]
  145 + */
  146 + countMap[rq]=[{fast:[0,0,0,0], slow:[0,0,0,0]}, {fast:[0,0,0,0], slow:[0,0,0,0]}];
  147 + timeCountMap[rq]=[{fast:[0,0,0,0], slow:[0,0,0,0]}, {fast:[0,0,0,0], slow:[0,0,0,0]}];
  148 + for(var i=0,obj;obj=listMap[rq][i++];){
  149 + countDetail(countMap[rq], obj);
  150 + sumTime(timeCountMap[rq], obj);
  151 + }
  152 + }
  153 +
113 //左侧日期list 154 //左侧日期list
114 $('.ct_rq_left>ul',wrap).html(template('fast_and_slow_left_rq_temp', {listMap: listMap})); 155 $('.ct_rq_left>ul',wrap).html(template('fast_and_slow_left_rq_temp', {listMap: listMap}));
115 //右侧 156 //右侧
116 - $('.ct_right_tables',wrap).html(template('fast_and_slow_right_body_temp', {listMap: listMap})); 157 + $('.ct_right_tables',wrap).html(template('fast_and_slow_right_body_temp', {listMap: listMap, countMap: countMap, timeCountMap: timeCountMap}));
117 }); 158 });
  159 +
  160 +
  161 + function countDetail(json, obj) {
  162 + var i = obj.upDown;
  163 + if(obj.fcsjFast)
  164 + json[i]['fast'][0]++;
  165 + if(obj.dfsjFast)
  166 + json[i]['fast'][1]++;
  167 + if(obj.zdsjFast)
  168 + json[i]['fast'][2]++;
  169 + if(obj.zdsjDfFast)
  170 + json[i]['fast'][3]++;
  171 +
  172 + if(obj.fcsjSlow)
  173 + json[i]['slow'][0]++;
  174 + if(obj.dfsjSlow)
  175 + json[i]['slow'][1]++;
  176 + if(obj.zdsjSlow)
  177 + json[i]['slow'][2]++;
  178 + if(obj.zdsjDfSlow)
  179 + json[i]['slow'][3]++;
  180 + }
  181 +
  182 + function sumTime(json, obj) {
  183 + var i = obj.upDown;
  184 + json[i]['fast'][0]+=obj.fcsjFast;
  185 + json[i]['fast'][1]+=obj.dfsjFast;
  186 + json[i]['fast'][2]+=obj.zdsjFast;
  187 + json[i]['fast'][3]+=obj.zdsjDfFast;
  188 + json[i]['slow'][0]+=obj.fcsjSlow;
  189 + json[i]['slow'][1]+=obj.dfsjSlow;
  190 + json[i]['slow'][2]+=obj.zdsjSlow;
  191 + json[i]['slow'][3]+=obj.zdsjDfSlow;
  192 + }
118 })(); 193 })();
119 </script> 194 </script>
120 </div> 195 </div>
121 \ No newline at end of file 196 \ No newline at end of file
src/main/resources/static/pages/summary/fast_and_slow/main.html
@@ -121,7 +121,8 @@ @@ -121,7 +121,8 @@
121 top: 15px; 121 top: 15px;
122 } 122 }
123 .uk-nav-default>li.uk-active>a { 123 .uk-nav-default>li.uk-active>a {
124 - color: #222; 124 + color: blue;
  125 + font-weight: 600;
125 } 126 }
126 127
127 .data_table_wrap{ 128 .data_table_wrap{
@@ -134,6 +135,7 @@ @@ -134,6 +135,7 @@
134 text-align: center; 135 text-align: center;
135 font-size: 14px; 136 font-size: 14px;
136 table-layout: fixed; 137 table-layout: fixed;
  138 + color: #000;
137 } 139 }
138 140
139 .ct_right_tables table td{ 141 .ct_right_tables table td{
@@ -148,14 +150,26 @@ @@ -148,14 +150,26 @@
148 text-align: left; 150 text-align: left;
149 height: 40px; 151 height: 40px;
150 text-indent:15px; 152 text-indent:15px;
  153 + font-size: 14px !important;
  154 + font-weight: 400;
151 } 155 }
152 156
153 - .ct_right_tables table tr:nth-child(-n+3) td{ 157 + .data_table_wrap.head{
  158 + position: fixed;
  159 + width: calc(100% - 300px);
  160 + top: 155px;
  161 + padding-top: 25px;
  162 + background: #fff;
  163 + }
  164 +
  165 + .ct_right_tables .data_table_wrap.head table tr:nth-child(-n+3) td{
154 background: #ededed; 166 background: #ededed;
155 } 167 }
156 168
157 .ct_right_tables table tr:nth-last-child(1) td, 169 .ct_right_tables table tr:nth-last-child(1) td,
158 - .ct_right_tables table tr:nth-last-child(2) td{ 170 + .ct_right_tables table tr:nth-last-child(2) td,
  171 + .ct_right_tables table tr:nth-last-child(3) td,
  172 + .ct_right_tables table tr:nth-last-child(4) td{
159 background: #ededed; 173 background: #ededed;
160 } 174 }
161 175
@@ -167,6 +181,33 @@ @@ -167,6 +181,33 @@
167 z-index: 2; 181 z-index: 2;
168 padding-top: 25px; 182 padding-top: 25px;
169 } 183 }
  184 +
  185 + .ct_right_tables h2{
  186 + margin-bottom: 10px;
  187 + }
  188 +
  189 + .data_table_wrap:nth-child(2) {
  190 + margin-top: 91px;
  191 + }
  192 +
  193 + .cell_dir_0{
  194 + color: #0000ff96;
  195 + font-weight: 600;
  196 + font-size: 12px;
  197 + }
  198 + .cell_dir_1{
  199 + color: #ff00009e;
  200 + font-weight: 600;
  201 + font-size: 12px;
  202 + }
  203 +
  204 + .count_col .c_c_0{
  205 + color: #0000ffe0;
  206 + }
  207 +
  208 + .count_col .c_c_1{
  209 + color: #ff0000d1;
  210 + }
170 </style> 211 </style>
171 </head> 212 </head>
172 213
@@ -203,18 +244,18 @@ @@ -203,18 +244,18 @@
203 </label> 244 </label>
204 </div> 245 </div>
205 <div class="ct_field"> 246 <div class="ct_field">
206 - <label><input class="uk-radio" type="radio" name="type" checked> 全部</label>&nbsp;  
207 - <label><input class="uk-radio" type="radio" name="type"> 快误</label>&nbsp;  
208 - <label><input class="uk-radio" type="radio" name="type"> 慢误</label> 247 + <label><input class="uk-radio" type="radio" name="type" value="0" checked> 全部</label>&nbsp;
  248 + <label><input class="uk-radio" type="radio" name="type" value="1"> 快误</label>&nbsp;
  249 + <label><input class="uk-radio" type="radio" name="type" value="-1"> 慢误</label>
209 </div> 250 </div>
210 <div class="ct_field"> 251 <div class="ct_field">
211 <button class="uk-button uk-button-primary search"><i uk-icon="icon: search"></i>搜索</button> 252 <button class="uk-button uk-button-primary search"><i uk-icon="icon: search"></i>搜索</button>
212 </div> 253 </div>
213 <div class="ct_field ct_field_bottom"> 254 <div class="ct_field ct_field_bottom">
214 - <button class="uk-button uk-button-text" style="padding: 0 5px;">导出数据</button> 255 + <button class="uk-button uk-button-text export_excel" style="padding: 0 5px;">导出数据</button>
215 </div> 256 </div>
216 <div class="ct_field ct_field_bottom"> 257 <div class="ct_field ct_field_bottom">
217 - <span uk-icon="icon: question" title="快1慢3不算误点,排除进出场班次" uk-tooltip="pos: bottom"></span> 258 + <span uk-icon="icon: question" title="快1慢3; 排除进出场班次" uk-tooltip="pos: bottom"></span>
218 </div> 259 </div>
219 </form> 260 </form>
220 </div> 261 </div>
@@ -260,7 +301,7 @@ @@ -260,7 +301,7 @@
260 //日期选择框 301 //日期选择框
261 var fs='YYYY-MM-DD' 302 var fs='YYYY-MM-DD'
262 , ets=moment().format(fs) 303 , ets=moment().format(fs)
263 - , sts=moment().subtract(7, 'days').format(fs); 304 + , sts=moment().subtract(5, 'days').format(fs);
264 flatpickr('.ct_search_form_wrap [name=rq]', { 305 flatpickr('.ct_search_form_wrap [name=rq]', {
265 mode: "range", dateFormat: "Y-m-d","locale": "zh", defaultDate: [sts, ets] 306 mode: "range", dateFormat: "Y-m-d","locale": "zh", defaultDate: [sts, ets]
266 }); 307 });
@@ -323,6 +364,15 @@ @@ -323,6 +364,15 @@
323 * 点击搜索 364 * 点击搜索
324 */ 365 */
325 $('.search', f).on('click', function () { 366 $('.search', f).on('click', function () {
  367 + var params = serializeFormJSON();
  368 + $.get('/summary/fastAndSlow/all', params, function (rs) {
  369 + //按日期分组
  370 + var listMap = groupBy(rs, 'rq');
  371 + $('.ct_data_body_wrap').trigger('init', {listMap: listMap});
  372 + });
  373 + });
  374 +
  375 + function serializeFormJSON() {
326 var data = f.serializeJSON(); 376 var data = f.serializeJSON();
327 if(!data.rq) 377 if(!data.rq)
328 return UIkit.notification('你必须选择时间范围!', 'danger'); 378 return UIkit.notification('你必须选择时间范围!', 'danger');
@@ -330,13 +380,8 @@ @@ -330,13 +380,8 @@
330 var sDate = data.rq.substr(0, 10), 380 var sDate = data.rq.substr(0, 10),
331 eDate = data.rq.substr(13); 381 eDate = data.rq.substr(13);
332 382
333 - var params = {lineCode_eq: data.lineCode_eq, rq_ge: sDate, rq_le: eDate, order: 't'};  
334 - $.get('/summary/fastAndSlow/all', params, function (rs) {  
335 - //按日期分组  
336 - var listMap = groupBy(rs, 'rq');  
337 - $('.ct_data_body_wrap').trigger('init', {listMap: listMap});  
338 - });  
339 - }); 383 + return {lineCode_eq: data.lineCode_eq, rq_ge: sDate, rq_le: eDate, order: 't',type: data.type};
  384 + }
340 385
341 f.on('submit', function (e) { 386 f.on('submit', function (e) {
342 return false; 387 return false;
@@ -355,6 +400,14 @@ @@ -355,6 +400,14 @@
355 400
356 return rs; 401 return rs;
357 }; 402 };
  403 +
  404 + /**
  405 + * 导出
  406 + */
  407 + $('.export_excel').on('click', function () {
  408 + var params = serializeFormJSON();
  409 +
  410 + });
358 })(); 411 })();
359 </script> 412 </script>
360 </body> 413 </body>