Commit 0be569ef53e5c5aca790ad2b152d4035a9c86088
1 parent
37f94c0d
update
Showing
4 changed files
with
199 additions
and
28 deletions
src/main/java/com/bsth/data/summary/entity/FastAndSlow.java
| ... | ... | @@ -273,4 +273,12 @@ public class FastAndSlow { |
| 273 | 273 | public void setT(Long t) { |
| 274 | 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 | 3 | import com.bsth.data.summary.entity.FastAndSlow; |
| 4 | 4 | import com.bsth.data.summary.service.FastAndSlowService; |
| 5 | 5 | import com.bsth.service.impl.BaseServiceImpl; |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 6 | 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 | 15 | * Created by panzhao on 2017/10/24. |
| 10 | 16 | */ |
| 11 | 17 | @Service |
| 12 | 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 | 1 | <div class="ct_data_body_wrap"> |
| 2 | 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 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="uk-card uk-card-default uk-card-body ct_right_tables" > |
| ... | ... | @@ -15,9 +15,7 @@ |
| 15 | 15 | |
| 16 | 16 | <script id="fast_and_slow_right_body_temp" type="text/html"> |
| 17 | 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 | 19 | <table cellspacing="1" class="data_table"> |
| 22 | 20 | <col /> |
| 23 | 21 | <col width="14%"/> |
| ... | ... | @@ -65,11 +63,33 @@ |
| 65 | 63 | <td>快</td> |
| 66 | 64 | <td>慢</td> |
| 67 | 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 | 88 | {{each listMap[k] as obj i}} |
| 69 | 89 | <tr> |
| 70 | 90 | <td>{{i+1}}</td> |
| 71 | 91 | <td>{{obj.stationName}}</td> |
| 72 | - <td>{{obj.upDown==0?"上行":"下行"}}</td> | |
| 92 | + <td class="cell_dir_{{obj.upDown}}">{{obj.upDown==0?"上行":"下行"}}</td> | |
| 73 | 93 | <td>{{obj.fcsj}}</td> |
| 74 | 94 | <td>{{obj.dfsj}}</td> |
| 75 | 95 | <td>{{obj.fcsjActual}}</td> |
| ... | ... | @@ -87,13 +107,21 @@ |
| 87 | 107 | </tr> |
| 88 | 108 | {{/each}} |
| 89 | 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> 累计时间:<a class="c_c_0">{{timeCountMap[k][0]['fast'][0]}}</a> 待发快误点:<a class="c_c_0">{{countMap[k][0]['fast'][1]}}</a> 累计时间:<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> 累计时间:<a class="c_c_1">{{timeCountMap[k][1]['fast'][0]}}</a> 待发快误点:<a class="c_c_1">{{countMap[k][1]['fast'][1]}}</a> 累计时间:<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> 累计时间:<a class="c_c_0">{{timeCountMap[k][0]['slow'][0]}}</a> 待发慢误点:<a class="c_c_0">{{countMap[k][0]['slow'][1]}}</a> 累计时间:<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> 累计时间:<a class="c_c_1">{{timeCountMap[k][1]['slow'][0]}}</a> 待发慢误点:<a class="c_c_1">{{countMap[k][1]['slow'][1]}}</a> 累计时间:<a class="c_c_1">{{timeCountMap[k][1]['slow'][1]}}</a>)</td> | |
| 93 | 117 | </tr> |
| 94 | 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> 累计时间:<a class="c_c_0">{{timeCountMap[k][0]['fast'][2]}}</a> 待发快误点:<a class="c_c_0">{{countMap[k][0]['fast'][3]}}</a> 累计时间:<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> 累计时间:<a class="c_c_1">{{timeCountMap[k][1]['fast'][2]}}</a> 待发快误点:<a class="c_c_1">{{countMap[k][1]['fast'][3]}}</a> 累计时间:<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> 累计时间:<a class="c_c_0">{{timeCountMap[k][0]['slow'][2]}}</a> 待发慢误点:<a class="c_c_0">{{countMap[k][0]['slow'][3]}}</a> 累计时间:<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> 累计时间:<a class="c_c_1">{{timeCountMap[k][1]['slow'][2]}}</a> 待发慢误点:<a class="c_c_1">{{countMap[k][1]['slow'][3]}}</a> 累计时间:<a class="c_c_1">{{timeCountMap[k][1]['slow'][3]}}</a>)</td> | |
| 97 | 125 | </tr> |
| 98 | 126 | </table> |
| 99 | 127 | </div> |
| ... | ... | @@ -104,17 +132,64 @@ |
| 104 | 132 | <script> |
| 105 | 133 | (function () { |
| 106 | 134 | var wrap = '.ct_data_body_wrap', |
| 107 | - listMap; | |
| 135 | + listMap, countMap={}, timeCountMap={}; | |
| 108 | 136 | |
| 109 | 137 | $(wrap).on('init', function (e, data) { |
| 110 | 138 | e.stopPropagation(); |
| 111 | 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 | 154 | //左侧日期list |
| 114 | 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 | 194 | </script> |
| 120 | 195 | </div> |
| 121 | 196 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/summary/fast_and_slow/main.html
| ... | ... | @@ -121,7 +121,8 @@ |
| 121 | 121 | top: 15px; |
| 122 | 122 | } |
| 123 | 123 | .uk-nav-default>li.uk-active>a { |
| 124 | - color: #222; | |
| 124 | + color: blue; | |
| 125 | + font-weight: 600; | |
| 125 | 126 | } |
| 126 | 127 | |
| 127 | 128 | .data_table_wrap{ |
| ... | ... | @@ -134,6 +135,7 @@ |
| 134 | 135 | text-align: center; |
| 135 | 136 | font-size: 14px; |
| 136 | 137 | table-layout: fixed; |
| 138 | + color: #000; | |
| 137 | 139 | } |
| 138 | 140 | |
| 139 | 141 | .ct_right_tables table td{ |
| ... | ... | @@ -148,14 +150,26 @@ |
| 148 | 150 | text-align: left; |
| 149 | 151 | height: 40px; |
| 150 | 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 | 166 | background: #ededed; |
| 155 | 167 | } |
| 156 | 168 | |
| 157 | 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 | 173 | background: #ededed; |
| 160 | 174 | } |
| 161 | 175 | |
| ... | ... | @@ -167,6 +181,33 @@ |
| 167 | 181 | z-index: 2; |
| 168 | 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 | 211 | </style> |
| 171 | 212 | </head> |
| 172 | 213 | |
| ... | ... | @@ -203,18 +244,18 @@ |
| 203 | 244 | </label> |
| 204 | 245 | </div> |
| 205 | 246 | <div class="ct_field"> |
| 206 | - <label><input class="uk-radio" type="radio" name="type" checked> 全部</label> | |
| 207 | - <label><input class="uk-radio" type="radio" name="type"> 快误</label> | |
| 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> | |
| 248 | + <label><input class="uk-radio" type="radio" name="type" value="1"> 快误</label> | |
| 249 | + <label><input class="uk-radio" type="radio" name="type" value="-1"> 慢误</label> | |
| 209 | 250 | </div> |
| 210 | 251 | <div class="ct_field"> |
| 211 | 252 | <button class="uk-button uk-button-primary search"><i uk-icon="icon: search"></i>搜索</button> |
| 212 | 253 | </div> |
| 213 | 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 | 256 | </div> |
| 216 | 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 | 259 | </div> |
| 219 | 260 | </form> |
| 220 | 261 | </div> |
| ... | ... | @@ -260,7 +301,7 @@ |
| 260 | 301 | //日期选择框 |
| 261 | 302 | var fs='YYYY-MM-DD' |
| 262 | 303 | , ets=moment().format(fs) |
| 263 | - , sts=moment().subtract(7, 'days').format(fs); | |
| 304 | + , sts=moment().subtract(5, 'days').format(fs); | |
| 264 | 305 | flatpickr('.ct_search_form_wrap [name=rq]', { |
| 265 | 306 | mode: "range", dateFormat: "Y-m-d","locale": "zh", defaultDate: [sts, ets] |
| 266 | 307 | }); |
| ... | ... | @@ -323,6 +364,15 @@ |
| 323 | 364 | * 点击搜索 |
| 324 | 365 | */ |
| 325 | 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 | 376 | var data = f.serializeJSON(); |
| 327 | 377 | if(!data.rq) |
| 328 | 378 | return UIkit.notification('你必须选择时间范围!', 'danger'); |
| ... | ... | @@ -330,13 +380,8 @@ |
| 330 | 380 | var sDate = data.rq.substr(0, 10), |
| 331 | 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 | 386 | f.on('submit', function (e) { |
| 342 | 387 | return false; |
| ... | ... | @@ -355,6 +400,14 @@ |
| 355 | 400 | |
| 356 | 401 | return rs; |
| 357 | 402 | }; |
| 403 | + | |
| 404 | + /** | |
| 405 | + * 导出 | |
| 406 | + */ | |
| 407 | + $('.export_excel').on('click', function () { | |
| 408 | + var params = serializeFormJSON(); | |
| 409 | + | |
| 410 | + }); | |
| 358 | 411 | })(); |
| 359 | 412 | </script> |
| 360 | 413 | </body> | ... | ... |