Commit 00367cba460a8a5cb062b0e3658d8033481a86e1

Authored by 潘钊
1 parent 39852177

update...

src/main/java/com/bsth/controller/realcontrol/RealChartsController.java
@@ -3,6 +3,7 @@ package com.bsth.controller.realcontrol; @@ -3,6 +3,7 @@ package com.bsth.controller.realcontrol;
3 import com.bsth.service.realcontrol.RealChartsService; 3 import com.bsth.service.realcontrol.RealChartsService;
4 import com.bsth.service.realcontrol.dto.CarOutRate; 4 import com.bsth.service.realcontrol.dto.CarOutRate;
5 import com.bsth.service.realcontrol.dto.DeviceOnlineRate; 5 import com.bsth.service.realcontrol.dto.DeviceOnlineRate;
  6 +import com.bsth.service.realcontrol.dto.ScheduleExecRate;
6 import com.bsth.service.realcontrol.dto.StratEndPunctualityRate; 7 import com.bsth.service.realcontrol.dto.StratEndPunctualityRate;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RequestMapping;
@@ -32,13 +33,18 @@ public class RealChartsController { @@ -32,13 +33,18 @@ public class RealChartsController {
32 return realChartsService.carOutRate(month, idx); 33 return realChartsService.carOutRate(month, idx);
33 } 34 }
34 35
35 - @RequestMapping("stratEndPunctualityRate") 36 +/* @RequestMapping("stratEndPunctualityRate")
36 public List<StratEndPunctualityRate> stratEndPunctualityRate(@RequestParam String idx, @RequestParam String month){ 37 public List<StratEndPunctualityRate> stratEndPunctualityRate(@RequestParam String idx, @RequestParam String month){
37 return realChartsService.stratEndPunctualityRate(month, idx); 38 return realChartsService.stratEndPunctualityRate(month, idx);
38 - } 39 + }*/
39 40
40 @RequestMapping("sePunctualityRateLine") 41 @RequestMapping("sePunctualityRateLine")
41 public List<StratEndPunctualityRate> sePunctualityRateLine(@RequestParam String idx, @RequestParam String month){ 42 public List<StratEndPunctualityRate> sePunctualityRateLine(@RequestParam String idx, @RequestParam String month){
42 return realChartsService.sePunctualityRateLine(month, idx); 43 return realChartsService.sePunctualityRateLine(month, idx);
43 } 44 }
  45 +
  46 + @RequestMapping("scheduleExecRates")
  47 + public List<ScheduleExecRate> scheduleExecRates(@RequestParam String idx, @RequestParam String date){
  48 + return realChartsService.scheduleExecRates(date, idx);
  49 + }
44 } 50 }
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
@@ -51,7 +51,7 @@ public class SchAttrCalculator { @@ -51,7 +51,7 @@ public class SchAttrCalculator {
51 51
52 52
53 if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){ 53 if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){
54 - sch.setFcsjAll(sch.getFcsjT() + DAY_TIME); 54 + sch.setFcsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getFcsj()) + DAY_TIME);
55 } 55 }
56 56
57 sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT())); 57 sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT()));
src/main/java/com/bsth/service/realcontrol/RealChartsService.java
@@ -2,6 +2,7 @@ package com.bsth.service.realcontrol; @@ -2,6 +2,7 @@ package com.bsth.service.realcontrol;
2 2
3 import com.bsth.service.realcontrol.dto.CarOutRate; 3 import com.bsth.service.realcontrol.dto.CarOutRate;
4 import com.bsth.service.realcontrol.dto.DeviceOnlineRate; 4 import com.bsth.service.realcontrol.dto.DeviceOnlineRate;
  5 +import com.bsth.service.realcontrol.dto.ScheduleExecRate;
5 import com.bsth.service.realcontrol.dto.StratEndPunctualityRate; 6 import com.bsth.service.realcontrol.dto.StratEndPunctualityRate;
6 7
7 import java.util.List; 8 import java.util.List;
@@ -15,7 +16,9 @@ public interface RealChartsService { @@ -15,7 +16,9 @@ public interface RealChartsService {
15 16
16 List<CarOutRate> carOutRate(String month, String idx); 17 List<CarOutRate> carOutRate(String month, String idx);
17 18
18 - List<StratEndPunctualityRate> stratEndPunctualityRate(String month, String idx); 19 + /*List<StratEndPunctualityRate> stratEndPunctualityRate(String month, String idx);*/
19 20
20 List<StratEndPunctualityRate> sePunctualityRateLine(String month, String idx); 21 List<StratEndPunctualityRate> sePunctualityRateLine(String month, String idx);
  22 +
  23 + List<ScheduleExecRate> scheduleExecRates(String date, String idx);
21 } 24 }
src/main/java/com/bsth/service/realcontrol/dto/ScheduleExecRate.java 0 → 100644
  1 +package com.bsth.service.realcontrol.dto;
  2 +
  3 +/**
  4 + * 班次执行率DTO
  5 + * Created by panzhao on 2016/11/14.
  6 + */
  7 +public class ScheduleExecRate {
  8 +
  9 + private long id;
  10 + private String dfsj;
  11 + private String fcsjActual;
  12 + private String zdsj;
  13 + private String zdsjActual;
  14 + private int status;
  15 + private String lineCode;
  16 +
  17 + public long getId() {
  18 + return id;
  19 + }
  20 +
  21 + public void setId(long id) {
  22 + this.id = id;
  23 + }
  24 +
  25 + public String getDfsj() {
  26 + return dfsj;
  27 + }
  28 +
  29 + public void setDfsj(String dfsj) {
  30 + this.dfsj = dfsj;
  31 + }
  32 +
  33 + public String getFcsjActual() {
  34 + return fcsjActual;
  35 + }
  36 +
  37 + public void setFcsjActual(String fcsjActual) {
  38 + this.fcsjActual = fcsjActual;
  39 + }
  40 +
  41 + public String getZdsj() {
  42 + return zdsj;
  43 + }
  44 +
  45 + public void setZdsj(String zdsj) {
  46 + this.zdsj = zdsj;
  47 + }
  48 +
  49 + public String getZdsjActual() {
  50 + return zdsjActual;
  51 + }
  52 +
  53 + public void setZdsjActual(String zdsjActual) {
  54 + this.zdsjActual = zdsjActual;
  55 + }
  56 +
  57 + public int getStatus() {
  58 + return status;
  59 + }
  60 +
  61 + public void setStatus(int status) {
  62 + this.status = status;
  63 + }
  64 +
  65 + public String getLineCode() {
  66 + return lineCode;
  67 + }
  68 +
  69 + public void setLineCode(String lineCode) {
  70 + this.lineCode = lineCode;
  71 + }
  72 +}
src/main/java/com/bsth/service/realcontrol/dto/StratEndPunctualityRate.java
@@ -10,17 +10,17 @@ public class StratEndPunctualityRate { @@ -10,17 +10,17 @@ public class StratEndPunctualityRate {
10 10
11 private String lineCode; 11 private String lineCode;
12 12
13 - private String nbbm;  
14 -  
15 //首班时间 06:00/06:01 13 //首班时间 06:00/06:01
16 private String startTime; 14 private String startTime;
17 15
18 //末班时间 20:30/20:31 16 //末班时间 20:30/20:31
19 private String endTime; 17 private String endTime;
20 18
21 - //末班真实执行日期  
22 - private String etRealExecDate; 19 + //上下行
  20 + private int updown;
23 21
  22 + //真实执行日期
  23 + private String etRealExecDate;
24 24
25 public String getDateStr() { 25 public String getDateStr() {
26 return dateStr; 26 return dateStr;
@@ -38,14 +38,6 @@ public class StratEndPunctualityRate { @@ -38,14 +38,6 @@ public class StratEndPunctualityRate {
38 this.lineCode = lineCode; 38 this.lineCode = lineCode;
39 } 39 }
40 40
41 - public String getNbbm() {  
42 - return nbbm;  
43 - }  
44 -  
45 - public void setNbbm(String nbbm) {  
46 - this.nbbm = nbbm;  
47 - }  
48 -  
49 public String getStartTime() { 41 public String getStartTime() {
50 return startTime; 42 return startTime;
51 } 43 }
@@ -62,6 +54,14 @@ public class StratEndPunctualityRate { @@ -62,6 +54,14 @@ public class StratEndPunctualityRate {
62 this.endTime = endTime; 54 this.endTime = endTime;
63 } 55 }
64 56
  57 + public int getUpdown() {
  58 + return updown;
  59 + }
  60 +
  61 + public void setUpdown(int updown) {
  62 + this.updown = updown;
  63 + }
  64 +
65 public String getEtRealExecDate() { 65 public String getEtRealExecDate() {
66 return etRealExecDate; 66 return etRealExecDate;
67 } 67 }
src/main/java/com/bsth/service/realcontrol/impl/RealChartsServiceImpl.java
@@ -4,10 +4,7 @@ import com.bsth.data.BasicData; @@ -4,10 +4,7 @@ import com.bsth.data.BasicData;
4 import com.bsth.data.LineConfigData; 4 import com.bsth.data.LineConfigData;
5 import com.bsth.entity.realcontrol.LineConfig; 5 import com.bsth.entity.realcontrol.LineConfig;
6 import com.bsth.service.realcontrol.RealChartsService; 6 import com.bsth.service.realcontrol.RealChartsService;
7 -import com.bsth.service.realcontrol.dto.CarOutRate;  
8 -import com.bsth.service.realcontrol.dto.DeviceOnlineRate;  
9 -import com.bsth.service.realcontrol.dto.RealOnline;  
10 -import com.bsth.service.realcontrol.dto.StratEndPunctualityRate; 7 +import com.bsth.service.realcontrol.dto.*;
11 import com.bsth.util.db.DBUtils_MS; 8 import com.bsth.util.db.DBUtils_MS;
12 import com.google.common.base.Splitter; 9 import com.google.common.base.Splitter;
13 import org.apache.commons.lang3.StringUtils; 10 import org.apache.commons.lang3.StringUtils;
@@ -37,7 +34,8 @@ public class RealChartsServiceImpl implements RealChartsService { @@ -37,7 +34,8 @@ public class RealChartsServiceImpl implements RealChartsService {
37 LineConfigData lineConfigData; 34 LineConfigData lineConfigData;
38 35
39 36
40 - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); 37 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd")
  38 + ,fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
41 39
42 private final static long DAY_TIME = 1000 * 60 * 60 * 24L; 40 private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
43 /** 41 /**
@@ -164,7 +162,7 @@ public class RealChartsServiceImpl implements RealChartsService { @@ -164,7 +162,7 @@ public class RealChartsServiceImpl implements RealChartsService {
164 * @param idx 162 * @param idx
165 * @return 163 * @return
166 */ 164 */
167 - @Override 165 +/* @Override
168 public List<StratEndPunctualityRate> stratEndPunctualityRate(String month, String idx) { 166 public List<StratEndPunctualityRate> stratEndPunctualityRate(String month, String idx) {
169 List<String> idArray = Splitter.on(",").splitToList(idx); 167 List<String> idArray = Splitter.on(",").splitToList(idx);
170 //拼接in语句 168 //拼接in语句
@@ -208,7 +206,7 @@ public class RealChartsServiceImpl implements RealChartsService { @@ -208,7 +206,7 @@ public class RealChartsServiceImpl implements RealChartsService {
208 } 206 }
209 }); 207 });
210 return list; 208 return list;
211 - } 209 + }*/
212 210
213 @Override 211 @Override
214 public List<StratEndPunctualityRate> sePunctualityRateLine(String month, String idx) { 212 public List<StratEndPunctualityRate> sePunctualityRateLine(String month, String idx) {
@@ -220,10 +218,7 @@ public class RealChartsServiceImpl implements RealChartsService { @@ -220,10 +218,7 @@ public class RealChartsServiceImpl implements RealChartsService {
220 } 218 }
221 inStr = " (" + inStr.substring(1) + ")"; 219 inStr = " (" + inStr.substring(1) + ")";
222 220
223 - String sql = "select SCHEDULE_DATE_STR,XL_BM, min(sj) as STARTDATE, max(sj) as ENDDATE " +  
224 - "from (select SCHEDULE_DATE_STR,dfsj, concat_ws('/',dfsj, fcsj_actual) as sj,XL_BM from bsth_c_s_sp_info_real " +  
225 - "where schedule_date_str like :month and bc_type='normal' and dfsj is not null and xl_bm in "+inStr+") t group by SCHEDULE_DATE_STR,XL_BM";  
226 - 221 + String sql = "select min(DFSJ) as STARTDATE,max(DFSJ) as ENDDATE,SCHEDULE_DATE_STR,XL_BM,XL_DIR,REAL_EXEC_DATE from (SELECT SCHEDULE_DATE_STR,concat_ws('_',concat_ws('/', dfsj, fcsj_actual),fcno) AS DFSJ,XL_BM,XL_DIR,REAL_EXEC_DATE FROM bsth_c_s_sp_info_real WHERE schedule_date_str LIKE :month AND bc_type = 'normal' AND dfsj IS NOT NULL AND xl_bm IN "+inStr+") t group by SCHEDULE_DATE_STR,XL_BM,XL_DIR,REAL_EXEC_DATE";
227 MapSqlParameterSource parameters = new MapSqlParameterSource(); 222 MapSqlParameterSource parameters = new MapSqlParameterSource();
228 parameters.addValue("month", month+"-%"); 223 parameters.addValue("month", month+"-%");
229 224
@@ -235,10 +230,11 @@ public class RealChartsServiceImpl implements RealChartsService { @@ -235,10 +230,11 @@ public class RealChartsServiceImpl implements RealChartsService {
235 obj.setDateStr(rs.getString("SCHEDULE_DATE_STR")); 230 obj.setDateStr(rs.getString("SCHEDULE_DATE_STR"));
236 obj.setStartTime(rs.getString("STARTDATE")); 231 obj.setStartTime(rs.getString("STARTDATE"));
237 obj.setEndTime(rs.getString("ENDDATE")); 232 obj.setEndTime(rs.getString("ENDDATE"));
238 - obj.setEtRealExecDate(obj.getDateStr()); 233 + obj.setUpdown(rs.getInt("XL_DIR"));
  234 + obj.setEtRealExecDate(rs.getString("REAL_EXEC_DATE"));
239 235
240 - if(obj.getEndTime().length() == 11){  
241 - //末班真实执行日期 236 + if(obj.getEndTime().length() >= 11){
  237 + //末班真实执行日期,末班可能跨过12点。
242 LineConfig conf =lineConfigData.get(obj.getLineCode()); 238 LineConfig conf =lineConfigData.get(obj.getLineCode());
243 String fcsjActual=obj.getEndTime().split("/")[1]; 239 String fcsjActual=obj.getEndTime().split("/")[1];
244 240
@@ -247,7 +243,40 @@ public class RealChartsServiceImpl implements RealChartsService { @@ -247,7 +243,40 @@ public class RealChartsServiceImpl implements RealChartsService {
247 obj.setEtRealExecDate(fmtyyyyMMdd.print(fmtyyyyMMdd.parseMillis(obj.getEtRealExecDate()) + DAY_TIME)); 243 obj.setEtRealExecDate(fmtyyyyMMdd.print(fmtyyyyMMdd.parseMillis(obj.getEtRealExecDate()) + DAY_TIME));
248 } 244 }
249 } 245 }
  246 + return obj;
  247 + }
  248 + });
  249 + return list;
  250 + }
  251 +
  252 + @Override
  253 + public List<ScheduleExecRate> scheduleExecRates(String date, String idx) {
  254 + List<String> idArray = Splitter.on(",").splitToList(idx);
  255 + //拼接in语句
  256 + String inStr = "";
  257 + for (String code : idArray) {
  258 + inStr += (",'" + code+"'");
  259 + }
  260 + inStr = " (" + inStr.substring(1) + ")";
250 261
  262 + String sql = "SELECT ID,DFSJ,FCSJ_ACTUAL,ZDSJ,ZDSJ_ACTUAL,`STATUS`,XL_BM FROM bsth_c_s_sp_info_real WHERE schedule_date_str=:date AND concat_ws('', real_exec_date, dfsj)<:cdate and xl_bm in "+inStr+" ORDER BY dfsj";
  263 +
  264 + MapSqlParameterSource parameters = new MapSqlParameterSource();
  265 + parameters.addValue("date", date);
  266 + parameters.addValue("cdate", fmtyyyyMMddHHmm.print(new Date().getTime()));
  267 +
  268 +
  269 + List<ScheduleExecRate> list = jdbcTemplate.query(sql, parameters, new RowMapper<ScheduleExecRate>() {
  270 + @Override
  271 + public ScheduleExecRate mapRow(ResultSet rs, int rowNum) throws SQLException {
  272 + ScheduleExecRate obj = new ScheduleExecRate();
  273 + obj.setId(rs.getLong("ID"));
  274 + obj.setDfsj(rs.getString("DFSJ"));
  275 + obj.setFcsjActual(rs.getString("FCSJ_ACTUAL"));
  276 + obj.setZdsj(rs.getString("ZDSJ"));
  277 + obj.setZdsjActual(rs.getString("ZDSJ_ACTUAL"));
  278 + obj.setStatus(rs.getInt("STATUS"));
  279 + obj.setLineCode(rs.getString("XL_BM"));
251 return obj; 280 return obj;
252 } 281 }
253 }); 282 });
src/main/resources/static/pages/control/lineallot/allot.html
@@ -163,8 +163,8 @@ @@ -163,8 +163,8 @@
163 <a href="javascript:;" class="btn btn-lg blue gotoControl red" data-status=1> 163 <a href="javascript:;" class="btn btn-lg blue gotoControl red" data-status=1>
164 <i class="fa fa-power-off"></i> 主调模式 </a> 164 <i class="fa fa-power-off"></i> 主调模式 </a>
165 165
166 - <!-- <a href="javascript:;" id="monitor" class="btn btn-lg grey gotoControl" data-status=0>  
167 - <i class="fa fa-tv"></i> 监控模式 </a> --> 166 + <a href="javascript:;" id="monitor" class="btn btn-lg grey gotoControl" data-status=0>
  167 + <i class="fa fa-tv"></i> 监控模式 </a>
168 &nbsp; 168 &nbsp;
169 <a href="javascript:;" id="resetBtn" style="left: 120px;color: #3598DC;"> 169 <a href="javascript:;" id="resetBtn" style="left: 120px;color: #3598DC;">
170 <i class="fa fa-history"></i> 重置</a> 170 <i class="fa fa-history"></i> 重置</a>
src/main/resources/static/real_control_v2/css/main.css
@@ -302,4 +302,4 @@ canvas.crosshair-layer { @@ -302,4 +302,4 @@ canvas.crosshair-layer {
302 li.map-panel{ 302 li.map-panel{
303 height: 100%; 303 height: 100%;
304 position: relative; 304 position: relative;
305 -} 305 +}
306 \ No newline at end of file 306 \ No newline at end of file
src/main/resources/static/real_control_v2/css/north.css
1 .north { 1 .north {
2 - background: linear-gradient(to right, #082F4A, #125688, #0a3f64); 2 + background: linear-gradient(to right ,#595959, #7b7b7b,#595959);
3 height: 120px; 3 height: 120px;
4 position: relative; 4 position: relative;
  5 + transition: all .3s ease;
  6 +}
  7 +
  8 +.north.main {
  9 + background: linear-gradient(to right, #082F4A, #125688, #0a3f64);
  10 +}
  11 +
  12 +.north.scok-colse {
  13 + background: linear-gradient(to right, #924040, #ce6262, #924040) !important;
  14 +}
  15 +
  16 +.north.scok-colse:before {
  17 + content: "长连接被断开,你将无法收到服务器推送的发车、到站信息。请刷新页面以重建连接!";
  18 + position: absolute;
  19 + padding: 5px 10px 5px 14px;
  20 + background: #414141;
  21 + color: #f9f9f9;
  22 + border-radius: 20px 0 0 20px;
  23 + z-index: 5;
  24 + left: 270px;
  25 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
  26 + border: 1px solid #caaaaa;
  27 + font-size: 13px;
5 } 28 }
6 29
7 .north .north-logo { 30 .north .north-logo {
src/main/resources/static/real_control_v2/fragments/north/nav/charts/s_e_punctuality_rate_line.html
@@ -61,56 +61,46 @@ @@ -61,56 +61,46 @@
61 //实发准点率 -dfsj 待发时间戳(秒),sfsj 实发时间戳(秒) 61 //实发准点率 -dfsj 待发时间戳(秒),sfsj 实发时间戳(秒)
62 function calcPunctuality(dfsj, sfsj){ 62 function calcPunctuality(dfsj, sfsj){
63 var diff=(dfsj-sfsj)/60; 63 var diff=(dfsj-sfsj)/60;
64 - var rs=0;  
65 if(diff > 0){ 64 if(diff > 0){
66 if(diff <= 1) 65 if(diff <= 1)
67 - rs=1;  
68 - else  
69 - rs=(10 - (diff - 1)) / 10; 66 + return true;
70 } 67 }
71 else{ 68 else{
72 - if(Math.abs(diff) < 3)  
73 - rs=1;  
74 - else  
75 - rs=(10 - (Math.abs(diff) - 3)) / 10; 69 + if(Math.abs(diff) <= 3)
  70 + return true;
76 } 71 }
77 72
78 - return rs<0?0:rs; 73 + return false;
79 } 74 }
80 75
81 //计算准点率 76 //计算准点率
82 function calcPunctualityRate(data){ 77 function calcPunctualityRate(data){
83 - var line2Reate={}, seff, eeff, fs="YYYY-MM-DDHH:mm"; 78 + var line2Reate={}, eff, fs="YYYY-MM-DDHH:mm";
84 for(var lineCode in data){ 79 for(var lineCode in data){
85 - seff=0;  
86 - eeff=0; 80 + eff=0;
87 $.each(data[lineCode], function(){ 81 $.each(data[lineCode], function(){
88 //首班时间 82 //首班时间
89 - if(this.startTime.length == 11){ 83 + if(this.startTime.length >= 11){
90 var arr=this.startTime.split('/'); 84 var arr=this.startTime.split('/');
91 - var sDfsj=moment(this.etRealExecDate+arr[0], fs).format('X'),  
92 - sSfsj=moment(this.etRealExecDate+arr[1], fs).format('X'); 85 + var dfsj=moment(this.etRealExecDate+arr[0], fs).format('X'),
  86 + sfsj=moment(this.etRealExecDate+arr[1], fs).format('X');
93 87
94 - seff=calcPunctuality(sDfsj, sSfsj); 88 + if(calcPunctuality(dfsj, sfsj))
  89 + eff+=25;
95 } 90 }
96 - else  
97 - this.s_isPunctuality=-1; 91 +
98 //末班时间 92 //末班时间
99 - if(this.endTime.length == 11){ 93 + if(this.endTime.length >= 11){
100 var arr=this.endTime.split('/'); 94 var arr=this.endTime.split('/');
101 - var eDfsj=moment(this.etRealExecDate+arr[0], fs).format('X'),  
102 - eSfsj=moment(this.etRealExecDate+arr[1], fs).format('X'); 95 + var dfsj=moment(this.etRealExecDate+arr[0], fs).format('X'),
  96 + sfsj=moment(this.etRealExecDate+arr[1], fs).format('X');
103 97
104 - eeff=calcPunctuality(eDfsj, eSfsj); 98 + if(calcPunctuality(dfsj, sfsj))
  99 + eff+=25;
105 } 100 }
106 - else  
107 - this.e_isPunctuality=-1;  
108 }); 101 });
109 102
110 - line2Reate[lineCode]={  
111 - seff: (seff*100).toFixed(2),  
112 - eeff: (eeff*100).toFixed(2)  
113 - }; 103 + line2Reate[lineCode]={eff: eff};
114 } 104 }
115 105
116 return line2Reate; 106 return line2Reate;
@@ -165,26 +155,17 @@ @@ -165,26 +155,17 @@
165 //lineCode再次分组,计算准点率 155 //lineCode再次分组,计算准点率
166 var line2Reate=calcPunctualityRate(gb_common.groupBy(groupList[date],'lineCode')); 156 var line2Reate=calcPunctualityRate(gb_common.groupBy(groupList[date],'lineCode'));
167 157
168 - sData=[], eData=[]; 158 + sData=[];
169 //subData=[]; 159 //subData=[];
170 $.each(lineCodeArr, function(i, code){ 160 $.each(lineCodeArr, function(i, code){
171 sData.push({ 161 sData.push({
172 - value: line2Reate[code]?line2Reate[code].seff:0,  
173 - date:date,  
174 - lineCode: code  
175 - });  
176 -  
177 - eData.push({  
178 - value: line2Reate[code]?line2Reate[code].eeff:0, 162 + value: line2Reate[code]?line2Reate[code].eff:0,
179 date:date, 163 date:date,
180 lineCode: code 164 lineCode: code
181 }); 165 });
182 }); 166 });
183 167
184 data.push({ 168 data.push({
185 - legend: {  
186 - data: ['首班', '末班']  
187 - },  
188 grid: {x: 30, x2: 5, height: 390, y: 94, y2: 50}, 169 grid: {x: 30, x2: 5, height: 390, y: 94, y2: 50},
189 tooltip: { 170 tooltip: {
190 'trigger': 'axis', 171 'trigger': 'axis',
@@ -206,21 +187,16 @@ @@ -206,21 +187,16 @@
206 }, 187 },
207 title: { 188 title: {
208 text: date + '首末班次准点率', 189 text: date + '首末班次准点率',
209 - subtext: '线路首末班发车数据(快1慢3准点,差值每分钟降10点)' 190 + subtext: '线路上下行首末班,4个班次,每个班次25%(快1慢3准点)'
210 }, 191 },
211 - text: date + '发车率',  
212 series: [{ 192 series: [{
213 - name: '首班', 193 + name: '准点率',
214 type: 'bar', 194 type: 'bar',
215 data: sData 195 data: sData
216 - },  
217 - {  
218 - name: '末班',  
219 - type: 'bar',  
220 - data: eData  
221 - }] 196 + }]
222 }); 197 });
223 } 198 }
  199 + console.log(data);
224 200
225 $('.load-panel', modal).hide(); 201 $('.load-panel', modal).hide();
226 $('#countBtn', modal).removeAttr('disabled'); 202 $('#countBtn', modal).removeAttr('disabled');
src/main/resources/static/real_control_v2/fragments/north/nav/charts/sch_exec_rate.html 0 → 100644
  1 +<div class="uk-modal" id="sch-exec-rate-modal">
  2 + <div class="uk-modal-dialog" style="width: 1200px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>班次执行率</h2></div>
  6 +
  7 + <div class="uk-panel uk-panel-box uk-panel-box-primary" style="margin-bottom: 10px;">
  8 + <form class="uk-form search-form">
  9 + <fieldset data-uk-margin>
  10 + <div class="uk-form-icon">
  11 + <i class="uk-icon-calendar"></i>
  12 + <input type="date" id="dateInput">
  13 + </div>
  14 + <button class="uk-button" id="countBtn">统计</button>
  15 + </fieldset>
  16 + </form>
  17 + </div>
  18 +
  19 + <div class="chart-wrap" style="height: 570px;">
  20 +
  21 + </div>
  22 +
  23 + <div class="load-panel">
  24 + <i class="uk-icon-spinner uk-icon-spin"></i>
  25 + 正在汇总数据
  26 + </div>
  27 + </div>
  28 +
  29 + <script>
  30 + (function () {
  31 +
  32 + var modal = '#sch-exec-rate-modal';
  33 + var chartObj;
  34 +
  35 + var option = {
  36 + color: ['#3398DB'],
  37 + tooltip: {
  38 + trigger: 'axis',
  39 + axisPointer: {
  40 + type: 'shadow'
  41 + }
  42 + },
  43 + grid: {
  44 + left: '3%',
  45 + right: '4%',
  46 + bottom: '3%',
  47 + containLabel: true
  48 + },
  49 + xAxis: [
  50 + {
  51 + type: 'category',
  52 + axisTick: {
  53 + alignWithLabel: true
  54 + }
  55 + }
  56 + ],
  57 + yAxis: [
  58 + {
  59 + type: 'value',
  60 + min: 0,
  61 + max: 100,
  62 + name: '执行率'
  63 + }
  64 + ],
  65 + series: [
  66 + {
  67 + name: '班次执行率',
  68 + type: 'bar',
  69 + barWidth: '60%'
  70 + }
  71 + ]
  72 + };
  73 +
  74 +
  75 + $(modal).on('init', function (e, data) {
  76 + //默认当天
  77 + var m = moment().format('YYYY-MM-DD');
  78 + $('#dateInput', modal).val(m);
  79 +
  80 + chartObj = echarts.init($('.chart-wrap', modal)[0]);
  81 + chartObj.on('click', chartObjClickHandler);
  82 + renderChart();
  83 +
  84 + });
  85 +
  86 +
  87 + $('#countBtn', modal).on('click', function () {
  88 + try {
  89 + renderChart();
  90 + } catch (e) {
  91 + console.log(e);
  92 + }
  93 + return false;
  94 + });
  95 +
  96 + //计算执行率
  97 + function calcSchExecRate(list) {
  98 + if (!list)
  99 + return 0;
  100 + var eff = 0;
  101 + $.each(list, function () {
  102 + if (this.status >= 1)
  103 + eff++;
  104 + });
  105 + return (eff / list.length * 100).toFixed(2);
  106 + }
  107 +
  108 + var renderData;
  109 +
  110 + function renderChart() {
  111 + //xAxis data
  112 + var xAxisData = [], lineCodeArr = [];
  113 + $.each(gb_data_basic.activeLines, function () {
  114 + xAxisData.push(this.name);
  115 + lineCodeArr.push(this.lineCode);
  116 + });
  117 + option.xAxis[0].data = xAxisData;
  118 +
  119 + $.get('/realCharts/scheduleExecRates', {
  120 + idx: gb_data_basic.line_idx,
  121 + date: $('#dateInput', modal).val()
  122 + }, function (rs) {
  123 + //console.log(rs);
  124 + //按线路分组
  125 + var groupData = gb_common.groupBy(rs, 'lineCode');
  126 +
  127 + renderData = groupData;
  128 + var data = [];
  129 +
  130 + for (var i = 0, code; code = lineCodeArr[i++];) {
  131 + //计算执行率
  132 + var eff = calcSchExecRate(groupData[code]);
  133 + data.push({value: eff, lineCode: code});
  134 + }
  135 +
  136 + option.series[0].data = data;
  137 + chartObj.setOption(option);
  138 + });
  139 + }
  140 +
  141 + function chartObjClickHandler(obj) {
  142 + if (obj.componentType != 'series' || obj.componentSubType != 'bar')
  143 + return;
  144 +
  145 + var list = renderData[obj.data.lineCode];
  146 + list = list.filter(function (obj) {
  147 + if(obj.status<1)
  148 + return 1;
  149 + else
  150 + return 0;
  151 + });
  152 +
  153 + $.get('/real_control_v2/fragments/north/nav/charts/sch_exec_rate_detail.html', function (htmlStr) {
  154 + $(document.body).append(htmlStr);
  155 + var detailModal = '#sch-exec-rate-detail-modal';
  156 + var elem = UIkit.modal(detailModal, {bgclose: true, modal: false}).show();
  157 + $(detailModal).trigger('init', {list: list});
  158 + })
  159 + }
  160 + })();
  161 + </script>
  162 +</div>
src/main/resources/static/real_control_v2/fragments/north/nav/charts/sch_exec_rate_detail.html 0 → 100644
  1 +<div class="uk-modal" id="sch-exec-rate-detail-modal">
  2 + <div class="uk-modal-dialog" style="width: 350px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div style="margin:5px 0 -18px;">
  5 + <table class="ct-fixed-table uk-table uk-table-hover">
  6 + <thead>
  7 + <tr>
  8 + <th style="width: 40%;">线路</th>
  9 + <th style="width: 30%;">待发</th>
  10 + <th style="width: 30%;">状态</th>
  11 + </tr>
  12 + </thead>
  13 + <tbody>
  14 + </tbody>
  15 + </table>
  16 + </div>
  17 + </div>
  18 +
  19 + <script id="sch-exec-rate-detail-table-temp" type="text/html">
  20 + {{each list as obj i}}
  21 + <tr>
  22 + <td>{{obj.lineName}}</td>
  23 + <td>{{obj.dfsj}}</td>
  24 + <td>
  25 + {{if obj.status==-1}}
  26 + <span style="color: red;">烂班</span>
  27 + {{else if obj.status==1}}
  28 + 正在执行
  29 + {{else if obj.status==2}}
  30 + 已执行
  31 + {{/if}}
  32 + </td>
  33 + </tr>
  34 + {{/each}}
  35 + </script>
  36 +
  37 + <script>
  38 + (function() {
  39 + var modal = '#sch-exec-rate-detail-modal';
  40 +
  41 + $(modal).on('init', function(e, data) {
  42 + var code2Name = gb_data_basic.lineCode2NameAll();
  43 + $.each(data.list, function(){
  44 + this.lineName=code2Name[this.lineCode];
  45 + });
  46 +
  47 + var tbodys=template('sch-exec-rate-detail-table-temp', {list: data.list});
  48 + $('table tbody', modal).html(tbodys);
  49 + });
  50 + })();
  51 + </script>
  52 +</div>
src/main/resources/static/real_control_v2/fragments/north/nav/charts/strat_end_punctuality_rate_dateil.html
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <tr> 7 <tr>
8 <th style="width: 14%;">日期</th> 8 <th style="width: 14%;">日期</th>
9 <th style="width: 14%;">线路</th> 9 <th style="width: 14%;">线路</th>
10 - <th style="width: 14%;">车辆</th> 10 + <th style="width: 14%;">上下行</th>
11 <th style="width: 23%;">首班</th> 11 <th style="width: 23%;">首班</th>
12 <th style="width: 23%;">末班</th> 12 <th style="width: 23%;">末班</th>
13 </tr> 13 </tr>
@@ -23,7 +23,13 @@ @@ -23,7 +23,13 @@
23 <tr> 23 <tr>
24 <td>{{obj.dateStr}}</td> 24 <td>{{obj.dateStr}}</td>
25 <td>{{obj.lineName}}</td> 25 <td>{{obj.lineName}}</td>
26 - <td>{{obj.nbbm}}</td> 26 + <td>
  27 + {{if obj.updown==0}}
  28 + 上行
  29 + {{else if obj.updown==1}}
  30 + 下行
  31 + {{/if}}
  32 + </td>
27 <td> 33 <td>
28 {{obj.startTime}} 34 {{obj.startTime}}
29 </td> 35 </td>
@@ -44,15 +50,13 @@ @@ -44,15 +50,13 @@
44 var code2Name = gb_data_basic.lineCode2NameAll(); 50 var code2Name = gb_data_basic.lineCode2NameAll();
45 $.each(data.list, function(){ 51 $.each(data.list, function(){
46 this.lineName=code2Name[this.lineCode]; 52 this.lineName=code2Name[this.lineCode];
  53 + if(this.startTime.indexOf('_'))
  54 + this.startTime=this.startTime.split('_')[0];
  55 + if(this.endTime.indexOf('_'))
  56 + this.endTime=this.endTime.split('_')[0];
47 }); 57 });
48 58
49 - /*data.list.sort(function(a, b){  
50 - if(!a.firstOut)  
51 - return -1;  
52 - if(!b.firstOut)  
53 - return 1;  
54 - return a.firstOut.localeCompare(b.firstOut);  
55 - });*/ 59 +
56 60
57 var tbodys=template('s-e-punctuality-rate-dateil-table-temp', {list: data.list}); 61 var tbodys=template('s-e-punctuality-rate-dateil-table-temp', {list: data.list});
58 $('table tbody', modal).html(tbodys); 62 $('table tbody', modal).html(tbodys);
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch_maintain.html
@@ -87,7 +87,12 @@ @@ -87,7 +87,12 @@
87 {{if sch.cTasks.length > 0}} 87 {{if sch.cTasks.length > 0}}
88 <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span> 88 <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span>
89 {{/if}}</dd> 89 {{/if}}</dd>
90 - <dd>{{sch.dfsj}}</dd> 90 + <dd>
  91 + {{sch.dfsj}}
  92 + {{if sch.status==-1}}
  93 + <span class="uk-badge uk-badge-danger">烂班</span>
  94 + {{/if}}
  95 + </dd>
91 <dd>{{sch.fcsjActual}}</dd> 96 <dd>{{sch.fcsjActual}}</dd>
92 <dd>{{sch.zdsjActual}}</dd> 97 <dd>{{sch.zdsjActual}}</dd>
93 <dd title="{{sch.remarks}}">{{sch.remarks}}</dd> 98 <dd title="{{sch.remarks}}">{{sch.remarks}}</dd>
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
@@ -195,7 +195,7 @@ var gb_schedule_table = (function() { @@ -195,7 +195,7 @@ var gb_schedule_table = (function() {
195 }).on('mouseup', function() { 195 }).on('mouseup', function() {
196 drag_strat = null; 196 drag_strat = null;
197 }).on('mouseover', seq_nos, function() { 197 }).on('mouseover', seq_nos, function() {
198 - if (drag_strat) { 198 + if (drag_strat != null) {
199 var e = parseInt($(this).text()), 199 var e = parseInt($(this).text()),
200 dls = $(this).parents('.ct_table_body').find('dl'); 200 dls = $(this).parents('.ct_table_body').find('dl');
201 201
@@ -276,6 +276,8 @@ var gb_schedule_table = (function() { @@ -276,6 +276,8 @@ var gb_schedule_table = (function() {
276 cont.animate({ 276 cont.animate({
277 scrollTop: dl.offset().top - cont.offset().top + cont.scrollTop() - diff 277 scrollTop: dl.offset().top - cont.offset().top + cont.scrollTop() - diff
278 }, 500); 278 }, 500);
  279 +
  280 + return dl;
279 } 281 }
280 282
281 var reset_drag_active_all = function(dd) { 283 var reset_drag_active_all = function(dd) {
@@ -322,6 +324,8 @@ var gb_schedule_table = (function() { @@ -322,6 +324,8 @@ var gb_schedule_table = (function() {
322 insertSchedule: insertSchedule, 324 insertSchedule: insertSchedule,
323 schedule_sort: schedule_sort, 325 schedule_sort: schedule_sort,
324 calc_yfwf_num: calc_yfwf_num, 326 calc_yfwf_num: calc_yfwf_num,
325 - car_yfwf_map: function(lineCode){return car_yfwf_map[lineCode];} 327 + car_yfwf_map: function(lineCode){return car_yfwf_map[lineCode];},
  328 + scroToDl: scroToDl,
  329 + reset_drag_active_all: reset_drag_active_all
326 }; 330 };
327 })(); 331 })();
src/main/resources/static/real_control_v2/js/main.js
  1 +//主调和监控模式
  2 +var operationMode = window.localStorage.getItem('operationMode');
  3 +if(operationMode == 0){
  4 + $('body>.north').addClass('monitor');
  5 + $(document).on('ajaxSend', interceptPOST);
  6 +}
  7 +else
  8 + $('body>.north').addClass('main');
  9 +
  10 +//拦截POST请求
  11 +function interceptPOST(e, xhr, t){
  12 + if(t && (t.method == 'POST' || t.type == 'POST')){
  13 + console.log(e, xhr, t);
  14 + xhr.abort();
  15 + notify_err('监控模式!');
  16 + }
  17 +}
  18 +
1 /* main js */ 19 /* main js */
2 var gb_main_ep = new EventProxy(), 20 var gb_main_ep = new EventProxy(),
3 res_load_ep = EventProxy.create('load_data_basic', 'load_tab', 'load_home_layout', 'load_home_line_panel', function() { 21 res_load_ep = EventProxy.create('load_data_basic', 'load_tab', 'load_home_layout', 'load_home_line_panel', function() {
@@ -159,4 +177,4 @@ var open_modal = function(pageUrl, data, opt) { @@ -159,4 +177,4 @@ var open_modal = function(pageUrl, data, opt) {
159 if (data) 177 if (data)
160 $(id).trigger('init', data); 178 $(id).trigger('init', data);
161 }); 179 });
162 -} 180 +};
src/main/resources/static/real_control_v2/js/north/toolbar.js
@@ -65,6 +65,9 @@ var gb_northToolbar = (function() { @@ -65,6 +65,9 @@ var gb_northToolbar = (function() {
65 }, 65 },
66 history_sch_maintain: function () { 66 history_sch_maintain: function () {
67 open_modal('/real_control_v2/fragments/north/nav/history_sch_maintain.html', {}, {center: false,bgclose: false}); 67 open_modal('/real_control_v2/fragments/north/nav/history_sch_maintain.html', {}, {center: false,bgclose: false});
  68 + },
  69 + sch_exec_rate: function () {
  70 + open_modal('/real_control_v2/fragments/north/nav/charts/sch_exec_rate.html', {}, modal_opts);
68 } 71 }
69 } 72 }
70 })(); 73 })();
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
@@ -33,10 +33,9 @@ var gb_sch_websocket = (function () { @@ -33,10 +33,9 @@ var gb_sch_websocket = (function () {
33 33
34 //断开 34 //断开
35 schSock.onclose = function (e) { 35 schSock.onclose = function (e) {
36 - alert('和服务器连接断开....');  
37 - console.log('和服务器连接断开....');  
38 - regListen();  
39 - 36 + //alert('和服务器连接断开, code:' + e.code);
  37 + console.log('和服务器连接断开....', e);
  38 + $('body>.north').addClass('scok-colse');
40 }; 39 };
41 40
42 41
@@ -175,7 +174,13 @@ var gb_sch_websocket = (function () { @@ -175,7 +174,13 @@ var gb_sch_websocket = (function () {
175 174
176 //42消息点击 175 //42消息点击
177 $(document).on('click', '.sys-mailbox .sys-note-42', function () { 176 $(document).on('click', '.sys-mailbox .sys-note-42', function () {
178 - alert($(this).data('id')); 177 + var lineCode=$(this).parents('li.line_schedule').data('id')
  178 + ,id=$(this).data('id');
  179 + var sch = gb_schedule_table.findScheduleByLine(lineCode)[id];
  180 + var dl = gb_schedule_table.scroToDl(sch);
  181 + //高亮
  182 + gb_schedule_table.reset_drag_active_all(dl);
  183 + dl.addClass('relevance-active intimity');
179 }); 184 });
180 185
181 //80同意 186 //80同意