Commit 58a9b563a9c9fec43a1135440313002d51bbaef6
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into minhang
Showing
38 changed files
with
1208 additions
and
267 deletions
src/main/java/com/bsth/controller/forecast/SampleController.java
0 → 100644
| 1 | +package com.bsth.controller.forecast; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 4 | +import org.springframework.web.bind.annotation.RestController; | |
| 5 | + | |
| 6 | +import com.bsth.controller.BaseController; | |
| 7 | +import com.bsth.entity.forecast.Sample; | |
| 8 | + | |
| 9 | +@RestController | |
| 10 | +@RequestMapping("sample") | |
| 11 | +public class SampleController extends BaseController<Sample, Long>{ | |
| 12 | + | |
| 13 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
| ... | ... | @@ -34,4 +34,9 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ |
| 34 | 34 | public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){ |
| 35 | 35 | return lineConfigService.editStartOptTime(time, lineCode); |
| 36 | 36 | } |
| 37 | + | |
| 38 | + @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST) | |
| 39 | + public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type){ | |
| 40 | + return lineConfigService.editOutTimeType(lineCode, type); | |
| 41 | + } | |
| 37 | 42 | } | ... | ... |
src/main/java/com/bsth/data/match/Arrival2Schedule.java
src/main/java/com/bsth/data/pilot80/PilotReport.java
| ... | ... | @@ -283,7 +283,7 @@ public class PilotReport { |
| 283 | 283 | |
| 284 | 284 | public void clear(String lineCode){ |
| 285 | 285 | logger.info("清除 80数据 before: " + d80MultiMap.size()); |
| 286 | - d80MultiMap.removeAll(lineCode); | |
| 286 | + d80MultiMap.removeAll(Integer.parseInt(lineCode)); | |
| 287 | 287 | logger.info("清除 80数据 after: " + d80MultiMap.size()); |
| 288 | 288 | } |
| 289 | 289 | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -25,6 +25,9 @@ import com.alibaba.fastjson.JSONArray; |
| 25 | 25 | import com.bsth.Application; |
| 26 | 26 | import com.bsth.data.LineConfigData; |
| 27 | 27 | import com.bsth.data.directive.FirstScheduleCheckThread; |
| 28 | +import com.bsth.data.schedule.thread.ScheduleLateThread; | |
| 29 | +import com.bsth.data.schedule.thread.SchedulePstThread; | |
| 30 | +import com.bsth.data.schedule.thread.ScheduleRefreshThread; | |
| 28 | 31 | import com.bsth.entity.realcontrol.LineConfig; |
| 29 | 32 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 30 | 33 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| ... | ... | @@ -62,15 +65,11 @@ public class DayOfSchedule implements CommandLineRunner { |
| 62 | 65 | public static LinkedList<ScheduleRealInfo> pstBuffer; |
| 63 | 66 | |
| 64 | 67 | // 排序器 |
| 65 | - private static ScheduleComparator.FCNO schNoComparator; | |
| 66 | - //private static ScheduleComparator.FCSJ schFcsjComparator; | |
| 68 | + private static ScheduleComparator.FCSJ schFCSJComparator; | |
| 67 | 69 | |
| 68 | 70 | @Autowired |
| 69 | 71 | LineConfigData lineConfigData; |
| 70 | 72 | |
| 71 | - /*@Autowired | |
| 72 | - ScheduleRealInfoService scheduleRealService;*/ | |
| 73 | - | |
| 74 | 73 | @Autowired |
| 75 | 74 | ScheduleRealInfoRepository schRepository; |
| 76 | 75 | |
| ... | ... | @@ -90,7 +89,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 90 | 89 | nbbmScheduleMap = ArrayListMultimap.create(); |
| 91 | 90 | id2SchedulMap = new HashMap<>(); |
| 92 | 91 | pstBuffer = new LinkedList<>(); |
| 93 | - schNoComparator = new ScheduleComparator.FCNO(); | |
| 92 | + schFCSJComparator = new ScheduleComparator.FCSJ(); | |
| 94 | 93 | currSchDateMap = new HashMap<>(); |
| 95 | 94 | nbbm2SEStationMap = TreeMultimap.create(); |
| 96 | 95 | } |
| ... | ... | @@ -103,6 +102,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 103 | 102 | |
| 104 | 103 | @Autowired |
| 105 | 104 | FirstScheduleCheckThread firstScheduleCheckThread; |
| 105 | + | |
| 106 | + @Autowired | |
| 107 | + ScheduleLateThread scheduleLateThread; | |
| 106 | 108 | |
| 107 | 109 | @Override |
| 108 | 110 | public void run(String... arg0) throws Exception { |
| ... | ... | @@ -112,6 +114,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 112 | 114 | Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); |
| 113 | 115 | //首班出场指令补发器 |
| 114 | 116 | Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 60, 60, TimeUnit.SECONDS); |
| 117 | + //班次误点扫描 | |
| 118 | + Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); | |
| 115 | 119 | } |
| 116 | 120 | |
| 117 | 121 | public Map<String, String> getCurrSchDate() { |
| ... | ... | @@ -167,11 +171,18 @@ public class DayOfSchedule implements CommandLineRunner { |
| 167 | 171 | //添加到缓存 |
| 168 | 172 | putAll(list); |
| 169 | 173 | |
| 170 | - //计算“起点站应到”时间 | |
| 171 | 174 | Set<String> cars = searchAllCars(list); |
| 175 | + //计算“起点站应到”时间 | |
| 172 | 176 | for(String nbbm : cars) |
| 173 | 177 | schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); |
| 174 | 178 | |
| 179 | + //是否是出站即出场 | |
| 180 | + LineConfig conf = lineConfigData.get(lineCode); | |
| 181 | + if(conf.getOutConfig() == 2){ | |
| 182 | + for(String nbbm : cars) | |
| 183 | + schAttrCalculator.connectOutSchedule(nbbmScheduleMap.get(nbbm)); | |
| 184 | + } | |
| 185 | + | |
| 175 | 186 | // 页面 翻班通知 |
| 176 | 187 | sendUtils.shiftSchedule(lineCode); |
| 177 | 188 | } catch (Exception e) { |
| ... | ... | @@ -265,6 +276,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 265 | 276 | * @Description: TODO(从计划排班表加载数据) |
| 266 | 277 | */ |
| 267 | 278 | public List<ScheduleRealInfo> loadPlanSch(String lineCode, String schDate) { |
| 279 | + logger.info("从计划排班表恢复排班,lineCode: " + lineCode + ", schDate: " + schDate); | |
| 268 | 280 | List<ScheduleRealInfo> realList = new ArrayList<>(); |
| 269 | 281 | |
| 270 | 282 | try { |
| ... | ... | @@ -290,6 +302,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 290 | 302 | logger.error("loadPlanSch... 计算终点时间失败..."); |
| 291 | 303 | } |
| 292 | 304 | } |
| 305 | + //计划里程为0,直接清空 | |
| 306 | + if(sch.getJhlc() != null && sch.getJhlc() == 0) | |
| 307 | + sch.setJhlc(null); | |
| 293 | 308 | } |
| 294 | 309 | } catch (Exception e) { |
| 295 | 310 | logger.error("", e); |
| ... | ... | @@ -418,28 +433,6 @@ public class DayOfSchedule implements CommandLineRunner { |
| 418 | 433 | return next; |
| 419 | 434 | } |
| 420 | 435 | |
| 421 | - /** | |
| 422 | - * | |
| 423 | - * @Title: prveRealSch | |
| 424 | - * @Description: TODO(获取上一个已实际发出的班次) | |
| 425 | - */ | |
| 426 | -/* public ScheduleRealInfo prveSjfc(ScheduleRealInfo sch) { | |
| 427 | - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | |
| 428 | - // 排序 | |
| 429 | - Collections.sort(list, schNoComparator); | |
| 430 | - | |
| 431 | - ScheduleRealInfo prve = null; | |
| 432 | - | |
| 433 | - int i = list.indexOf(sch); | |
| 434 | - for (; i >= 0; i--){ | |
| 435 | - if (list.get(i).getFcsjActual() != null){ | |
| 436 | - prve = list.get(i); | |
| 437 | - break; | |
| 438 | - } | |
| 439 | - } | |
| 440 | - return prve; | |
| 441 | - }*/ | |
| 442 | - | |
| 443 | 436 | public void put(ScheduleRealInfo sch) { |
| 444 | 437 | schAttrCalculator |
| 445 | 438 | .calcRealDate(sch) |
| ... | ... | @@ -466,7 +459,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 466 | 459 | public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) { |
| 467 | 460 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); |
| 468 | 461 | // 排序 |
| 469 | - Collections.sort(list, schNoComparator); | |
| 462 | + Collections.sort(list, schFCSJComparator); | |
| 470 | 463 | |
| 471 | 464 | List<ScheduleRealInfo> rs = new ArrayList<>(); |
| 472 | 465 | ScheduleRealInfo temp; |
| ... | ... | @@ -554,33 +547,6 @@ public class DayOfSchedule implements CommandLineRunner { |
| 554 | 547 | pstBuffer.add(sch); |
| 555 | 548 | } |
| 556 | 549 | |
| 557 | - /** | |
| 558 | - * | |
| 559 | - * @Title: outSch | |
| 560 | - * @Description: TODO(出场班次) | |
| 561 | - */ | |
| 562 | -/* public List<ScheduleRealInfo> outSch(String nbbm){ | |
| 563 | - List<ScheduleRealInfo> all = nbbmScheduleMap.get(nbbm) | |
| 564 | - ,outList = new ArrayList<>(); | |
| 565 | - | |
| 566 | - for(ScheduleRealInfo sch : all){ | |
| 567 | - if(sch.getBcType().equals("out")) | |
| 568 | - outList.add(sch); | |
| 569 | - } | |
| 570 | - return outList; | |
| 571 | - } | |
| 572 | - | |
| 573 | - public ScheduleRealInfo nextOut(String nbbm){ | |
| 574 | - List<ScheduleRealInfo> list = outSch(nbbm); | |
| 575 | - Collections.sort(list, schNoComparator); | |
| 576 | - ScheduleRealInfo sch = null; | |
| 577 | - for(ScheduleRealInfo temp : list){ | |
| 578 | - if(temp.getFcsjActual() == null) | |
| 579 | - sch = temp; | |
| 580 | - } | |
| 581 | - | |
| 582 | - return sch; | |
| 583 | - }*/ | |
| 584 | 550 | |
| 585 | 551 | /** |
| 586 | 552 | * |
| ... | ... | @@ -590,7 +556,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 590 | 556 | public ScheduleRealInfo nextByBcType(String nbbm, String bcType){ |
| 591 | 557 | List<ScheduleRealInfo> list = findByBcType(nbbm, bcType); |
| 592 | 558 | |
| 593 | - Collections.sort(list, schNoComparator); | |
| 559 | + Collections.sort(list, schFCSJComparator); | |
| 594 | 560 | ScheduleRealInfo sch = null; |
| 595 | 561 | for(ScheduleRealInfo temp : list){ |
| 596 | 562 | if(temp.getFcsjActual() == null) |
| ... | ... | @@ -623,4 +589,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 623 | 589 | public Set<String> allCar(){ |
| 624 | 590 | return nbbmScheduleMap.keySet(); |
| 625 | 591 | } |
| 592 | + | |
| 593 | + public Collection<ScheduleRealInfo> findAll(){ | |
| 594 | + return nbbmScheduleMap.values(); | |
| 595 | + } | |
| 626 | 596 | } | ... | ... |
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
| ... | ... | @@ -87,7 +87,7 @@ public class SchAttrCalculator { |
| 87 | 87 | * @Description: TODO(计算班次的起点应到时间,list 必须是同一辆车的班次) |
| 88 | 88 | */ |
| 89 | 89 | public void calcQdzTimePlan(List<ScheduleRealInfo> list){ |
| 90 | - Collections.sort(list, new ScheduleComparator.FCNO()); | |
| 90 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | |
| 91 | 91 | |
| 92 | 92 | int len = list.size(); |
| 93 | 93 | if(len == 0) |
| ... | ... | @@ -102,6 +102,34 @@ public class SchAttrCalculator { |
| 102 | 102 | prve = curr; |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | + | |
| 106 | + /** | |
| 107 | + * | |
| 108 | + * @Title: connectOutSchedule | |
| 109 | + * @Description: TODO(关联出场班次) | |
| 110 | + */ | |
| 111 | + public void connectOutSchedule(List<ScheduleRealInfo> list){ | |
| 112 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | |
| 113 | + | |
| 114 | + int len = list.size(); | |
| 115 | + if(len == 0) | |
| 116 | + return; | |
| 117 | + | |
| 118 | + ScheduleRealInfo prve = list.get(0), curr; | |
| 119 | + for(int i = 1; i < len; i ++){ | |
| 120 | + curr = list.get(i); | |
| 121 | + | |
| 122 | + //出站即出场关联 | |
| 123 | + if(prve.getBcType().equals("out") && prve.getJhlc() == null) | |
| 124 | + curr.setTwinsSch(prve); | |
| 125 | + | |
| 126 | + //进站即进场关联 | |
| 127 | + if(curr.getBcType().equals("in") && curr.getJhlc() == null) | |
| 128 | + prve.setTwinsSch(curr); | |
| 129 | + | |
| 130 | + prve = curr; | |
| 131 | + } | |
| 132 | + } | |
| 105 | 133 | |
| 106 | 134 | public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { |
| 107 | 135 | sch.setFcsjT(DateUtils.sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime()); | ... | ... |
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
| ... | ... | @@ -14,18 +14,18 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 14 | 14 | */ |
| 15 | 15 | public class ScheduleComparator { |
| 16 | 16 | |
| 17 | - public static class FCNO implements Comparator<ScheduleRealInfo>{ | |
| 17 | +/* public static class FCNO implements Comparator<ScheduleRealInfo>{ | |
| 18 | 18 | @Override |
| 19 | 19 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { |
| 20 | 20 | return s1.getFcno() - s2.getFcno(); |
| 21 | 21 | } |
| 22 | - } | |
| 22 | + }*/ | |
| 23 | 23 | |
| 24 | 24 | public static class FCSJ implements Comparator<ScheduleRealInfo>{ |
| 25 | 25 | |
| 26 | 26 | @Override |
| 27 | 27 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { |
| 28 | - return (int) (s1.getFcsjT() - s2.getFcsjT()); | |
| 28 | + return (int) (s1.getDfsjT() - s2.getDfsjT()); | |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | } | ... | ... |
src/main/java/com/bsth/data/schedule/thread/ScheduleLateThread.java
0 → 100644
| 1 | +package com.bsth.data.schedule.thread; | |
| 2 | + | |
| 3 | + | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.Collections; | |
| 6 | +import java.util.Comparator; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | + | |
| 12 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 13 | +import com.bsth.data.schedule.ScheduleComparator; | |
| 14 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 15 | +import com.bsth.websocket.handler.SendUtils; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * | |
| 19 | + * @ClassName: ScheduleLateThread | |
| 20 | + * @Description: TODO(班次误点扫描线程) | |
| 21 | + * @author PanZhao | |
| 22 | + * @date 2016年8月31日 下午3:09:02 | |
| 23 | + * | |
| 24 | + */ | |
| 25 | +@Component | |
| 26 | +public class ScheduleLateThread extends Thread{ | |
| 27 | + | |
| 28 | + @Autowired | |
| 29 | + DayOfSchedule dayOfSchedule; | |
| 30 | + | |
| 31 | + @Autowired | |
| 32 | + SendUtils sendUtils; | |
| 33 | + | |
| 34 | + private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.FCSJ(); | |
| 35 | + | |
| 36 | + @Override | |
| 37 | + public void run() { | |
| 38 | + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()); | |
| 39 | + Collections.sort(all, cpm); | |
| 40 | + | |
| 41 | + long t = System.currentTimeMillis(); | |
| 42 | + int size = all.size(); | |
| 43 | + | |
| 44 | + ScheduleRealInfo sch; | |
| 45 | + for(int i = 0; i < size; i ++){ | |
| 46 | + sch = all.get(i); | |
| 47 | + if(sch.getDfsjT() > t) | |
| 48 | + break; | |
| 49 | + | |
| 50 | + if(sch.getStatus() == 0 && sch.getFcsjActual() == null){ | |
| 51 | + //应发未发 | |
| 52 | + sch.setLate(true); | |
| 53 | + //通知客户端 | |
| 54 | + sendUtils.refreshSch(sch); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + } | |
| 58 | +} | ... | ... |
src/main/java/com/bsth/data/schedule/SchedulePstThread.java renamed to src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
| 1 | -package com.bsth.data.schedule; | |
| 1 | +package com.bsth.data.schedule.thread; | |
| 2 | 2 | |
| 3 | 3 | import java.util.LinkedList; |
| 4 | 4 | |
| 5 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 6 | import org.springframework.stereotype.Component; |
| 7 | 7 | |
| 8 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 8 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | 10 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 10 | 11 | ... | ... |
src/main/java/com/bsth/data/schedule/ScheduleRefreshThread.java renamed to src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| 1 | -package com.bsth.data.schedule; | |
| 1 | +package com.bsth.data.schedule.thread; | |
| 2 | 2 | |
| 3 | 3 | import java.util.Collection; |
| 4 | 4 | import java.util.Set; |
| ... | ... | @@ -13,6 +13,7 @@ import com.bsth.data.LineConfigData; |
| 13 | 13 | import com.bsth.data.arrival.ArrivalData_GPS; |
| 14 | 14 | import com.bsth.data.directive.DayOfDirectives; |
| 15 | 15 | import com.bsth.data.pilot80.PilotReport; |
| 16 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 16 | 17 | import com.bsth.entity.realcontrol.LineConfig; |
| 17 | 18 | |
| 18 | 19 | /** | ... | ... |
src/main/java/com/bsth/entity/forecast/Sample.java
0 → 100644
| 1 | +package com.bsth.entity.forecast; | |
| 2 | + | |
| 3 | + | |
| 4 | +import javax.persistence.Entity; | |
| 5 | +import javax.persistence.GeneratedValue; | |
| 6 | +import javax.persistence.Id; | |
| 7 | +import javax.persistence.Table; | |
| 8 | +import javax.persistence.Transient; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * | |
| 12 | + * @ClassName: Sample | |
| 13 | + * @Description: TODO(站点耗时预测样本) | |
| 14 | + * @author PanZhao | |
| 15 | + * @date 2016年8月31日 上午9:50:49 | |
| 16 | + * | |
| 17 | + */ | |
| 18 | +@Entity | |
| 19 | +@Table(name = "bsth_forecast_sample") | |
| 20 | +public class Sample { | |
| 21 | + | |
| 22 | + @Id | |
| 23 | + @GeneratedValue | |
| 24 | + private Long id; | |
| 25 | + | |
| 26 | + private Integer lineCode; | |
| 27 | + | |
| 28 | + // 开始时间 | |
| 29 | + private String sDate; | |
| 30 | + @Transient | |
| 31 | + private Long sTime; | |
| 32 | + | |
| 33 | + // 结束时间 | |
| 34 | + private String eDate; | |
| 35 | + @Transient | |
| 36 | + private Long eTime; | |
| 37 | + | |
| 38 | + // 开始站点 | |
| 39 | + private String sStation; | |
| 40 | + | |
| 41 | + // 结束站点 | |
| 42 | + private String eStation; | |
| 43 | + | |
| 44 | + // 0:gps分析生成, 1:人工录入 | |
| 45 | + private int type; | |
| 46 | + | |
| 47 | + private String tag; | |
| 48 | + | |
| 49 | + //行驶时间 | |
| 50 | + private Float runTime; | |
| 51 | + | |
| 52 | + private int updown; | |
| 53 | + | |
| 54 | + public Long getId() { | |
| 55 | + return id; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setId(Long id) { | |
| 59 | + this.id = id; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public String getsDate() { | |
| 63 | + return sDate; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setsDate(String sDate) { | |
| 67 | + this.sDate = sDate; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public Long getsTime() { | |
| 71 | + return sTime; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setsTime(Long sTime) { | |
| 75 | + this.sTime = sTime; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String geteDate() { | |
| 79 | + return eDate; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void seteDate(String eDate) { | |
| 83 | + this.eDate = eDate; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public Long geteTime() { | |
| 87 | + return eTime; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void seteTime(Long eTime) { | |
| 91 | + this.eTime = eTime; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public String getsStation() { | |
| 95 | + return sStation; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setsStation(String sStation) { | |
| 99 | + this.sStation = sStation; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public String geteStation() { | |
| 103 | + return eStation; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void seteStation(String eStation) { | |
| 107 | + this.eStation = eStation; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public int getType() { | |
| 111 | + return type; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setType(int type) { | |
| 115 | + this.type = type; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public String getTag() { | |
| 119 | + return tag; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setTag(String tag) { | |
| 123 | + this.tag = tag; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public Float getRunTime() { | |
| 127 | + return runTime; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setRunTime(Float runTime) { | |
| 131 | + this.runTime = runTime; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public Integer getLineCode() { | |
| 135 | + return lineCode; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void setLineCode(Integer lineCode) { | |
| 139 | + this.lineCode = lineCode; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public int getUpdown() { | |
| 143 | + return updown; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void setUpdown(int updown) { | |
| 147 | + this.updown = updown; | |
| 148 | + } | |
| 149 | +} | ... | ... |
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
| ... | ... | @@ -55,10 +55,10 @@ public class LineConfig { |
| 55 | 55 | /** 托管状态 */ |
| 56 | 56 | private boolean trust; |
| 57 | 57 | |
| 58 | - /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 */ | |
| 58 | + /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */ | |
| 59 | 59 | private int outConfig; |
| 60 | 60 | |
| 61 | - /** 进场时间设置 0:真实进场(设备进入缓冲区时间) 1:请求进场时间 */ | |
| 61 | + /** 进场时间设置 0:真实进场(设备进入缓冲区时间) 1:请求进场时间 2:出站即出场*/ | |
| 62 | 62 | private int inConfig; |
| 63 | 63 | |
| 64 | 64 | /** 短语模板 , 号分隔多个 */ | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -102,19 +102,10 @@ public class ScheduleRealInfo { |
| 102 | 102 | */ |
| 103 | 103 | private String bcType; |
| 104 | 104 | |
| 105 | - /** 设备请求出场或进场时间(班次为 出场或进场 时,该字段可能有值) | |
| 106 | - private Long devRequestTime;*/ | |
| 107 | - | |
| 108 | - /** 停车场既首发站 */ | |
| 109 | - @Transient | |
| 110 | - private boolean parkIsFirstStation; | |
| 111 | - /** 首发站既停车场 */ | |
| 112 | - @Transient | |
| 113 | - private boolean firstStationIsPark; | |
| 114 | - /** 与其共享发车时间的进出场班次 */ | |
| 105 | + /** 出站即出场 , 关联的进出场班次 */ | |
| 115 | 106 | @JsonIgnore |
| 116 | 107 | @Transient |
| 117 | - private ScheduleRealInfo twins; | |
| 108 | + private ScheduleRealInfo twinsSch; | |
| 118 | 109 | |
| 119 | 110 | /** 创建人 */ |
| 120 | 111 | @JsonIgnore |
| ... | ... | @@ -149,7 +140,7 @@ public class ScheduleRealInfo { |
| 149 | 140 | private boolean sflj; |
| 150 | 141 | |
| 151 | 142 | /** 是否误点*/ |
| 152 | - private boolean isLate; | |
| 143 | + private boolean late; | |
| 153 | 144 | |
| 154 | 145 | /**实际里程*/ |
| 155 | 146 | private Float realMileage; |
| ... | ... | @@ -468,14 +459,6 @@ public class ScheduleRealInfo { |
| 468 | 459 | this.status = status; |
| 469 | 460 | } |
| 470 | 461 | |
| 471 | - public boolean isLate() { | |
| 472 | - return isLate; | |
| 473 | - } | |
| 474 | - | |
| 475 | - public void setLate(boolean isLate) { | |
| 476 | - this.isLate = isLate; | |
| 477 | - } | |
| 478 | - | |
| 479 | 462 | public Float getRealMileage() { |
| 480 | 463 | return realMileage; |
| 481 | 464 | } |
| ... | ... | @@ -539,35 +522,6 @@ public class ScheduleRealInfo { |
| 539 | 522 | } |
| 540 | 523 | } |
| 541 | 524 | |
| 542 | - /** | |
| 543 | - * @throws ParseException | |
| 544 | - * | |
| 545 | - * @Title: syncTime | |
| 546 | - * @Description: TODO(根据计发时间,计算待发时间和终点时间) | |
| 547 | - * @param 设定文件 | |
| 548 | - * @return void 返回类型 | |
| 549 | - * @throws | |
| 550 | - | |
| 551 | - public void syncTime(){ | |
| 552 | - try{ | |
| 553 | - this.setDfsj(this.getFcsj()); | |
| 554 | - //发车时间戳 | |
| 555 | - this.setFcsjT(sdfyyyyMMddHHmm.parse(this.realExecDate + " " + this.getFcsj()).getTime()); | |
| 556 | - //待发时间戳 | |
| 557 | - this.setDfsjT(this.getFcsjT()); | |
| 558 | - //计算终点时间 | |
| 559 | - calcEndTime(); | |
| 560 | - | |
| 561 | - if(this.fcsjActual != null) | |
| 562 | - this.setFcsjActualAll(this.fcsjActual); | |
| 563 | - | |
| 564 | - if(this.zdsjActual != null) | |
| 565 | - this.setZdsjActualAll(this.zdsjActual); | |
| 566 | - }catch(Exception e){ | |
| 567 | - e.printStackTrace(); | |
| 568 | - } | |
| 569 | - } */ | |
| 570 | - | |
| 571 | 525 | public void calcEndTime(){ |
| 572 | 526 | //计划终点时间 |
| 573 | 527 | if(this.getBcsj() != null){ |
| ... | ... | @@ -671,21 +625,6 @@ public class ScheduleRealInfo { |
| 671 | 625 | calcStatus(); |
| 672 | 626 | } |
| 673 | 627 | |
| 674 | - //和依赖班次同步发车时间 | |
| 675 | -/* public void synchroFcsj(){ | |
| 676 | - if(this.isFirstStationIsPark() || this.isParkIsFirstStation()){ | |
| 677 | - ScheduleRealInfo twinsSch = this.twins; | |
| 678 | - if(null != twinsSch){ | |
| 679 | - //有关联的出场班次 | |
| 680 | - twinsSch.setFcsjActual(this.fcsjActual); | |
| 681 | - twinsSch.setFcsjActualTime(this.fcsjActualTime); | |
| 682 | - if(null != twinsSch.getSjfcModel()) | |
| 683 | - twinsSch.getSjfcModel().setPersonTime(this.fcsjActualTime); | |
| 684 | - twinsSch.calcStatus(); | |
| 685 | - } | |
| 686 | - } | |
| 687 | - }*/ | |
| 688 | - | |
| 689 | 628 | /** |
| 690 | 629 | * |
| 691 | 630 | * @Title: setFcsjActualAll |
| ... | ... | @@ -718,19 +657,6 @@ public class ScheduleRealInfo { |
| 718 | 657 | } |
| 719 | 658 | } |
| 720 | 659 | |
| 721 | - //和依赖的进场班次同步终点时间 | |
| 722 | -/* public void synchroZdsj(){ | |
| 723 | - if(this.isFirstStationIsPark()){ | |
| 724 | - ScheduleRealInfo twinsSch = this.twins; | |
| 725 | - if(null != twinsSch && twinsSch.getBcType().equals("in")){ | |
| 726 | - //有关联的进场班次 | |
| 727 | - twinsSch.setFcsjActual(this.zdsjActual); | |
| 728 | - twinsSch.setFcsjActualTime(this.zdsjActualTime); | |
| 729 | - twinsSch.calcStatus(); | |
| 730 | - } | |
| 731 | - } | |
| 732 | - }*/ | |
| 733 | - | |
| 734 | 660 | public Long getSpId() { |
| 735 | 661 | return spId; |
| 736 | 662 | } |
| ... | ... | @@ -755,9 +681,9 @@ public class ScheduleRealInfo { |
| 755 | 681 | if(StringUtils.isNotBlank(this.fcsjActual)){ |
| 756 | 682 | this.status = 1; |
| 757 | 683 | |
| 758 | - //进出场班次并且没有终点时间的 | |
| 684 | + //进出场班次并且没有计划里程的 | |
| 759 | 685 | if((this.bcType.equals("out") || this.bcType.equals("in")) |
| 760 | - && this.zdsj == null){ | |
| 686 | + && this.jhlc == null){ | |
| 761 | 687 | this.status = 2; |
| 762 | 688 | } |
| 763 | 689 | } |
| ... | ... | @@ -792,60 +718,12 @@ public class ScheduleRealInfo { |
| 792 | 718 | public void setScheduleDateStr(String scheduleDateStr) { |
| 793 | 719 | this.scheduleDateStr = scheduleDateStr; |
| 794 | 720 | } |
| 795 | - | |
| 796 | - public boolean isParkIsFirstStation() { | |
| 797 | - return parkIsFirstStation; | |
| 798 | - } | |
| 799 | - | |
| 800 | - public void setParkIsFirstStation(boolean parkIsFirstStation) { | |
| 801 | - this.parkIsFirstStation = parkIsFirstStation; | |
| 802 | - } | |
| 803 | - | |
| 804 | -/* public ScheduleRealInfo getTwins() { | |
| 805 | - return twins; | |
| 806 | - } | |
| 807 | - | |
| 808 | - public void setTwins(ScheduleRealInfo twins) { | |
| 809 | - this.twins = twins; | |
| 810 | - } | |
| 811 | - | |
| 812 | - public boolean isFirstStationIsPark() { | |
| 813 | - return firstStationIsPark; | |
| 814 | - } | |
| 815 | - | |
| 816 | - public void setFirstStationIsPark(boolean firstStationIsPark) { | |
| 817 | - this.firstStationIsPark = firstStationIsPark; | |
| 818 | - }*/ | |
| 819 | - | |
| 820 | - | |
| 821 | - /*public boolean statusTostart(){ | |
| 822 | - return this.getFcsjActual() == null | |
| 823 | - && this.getSjfcModel().getTime() != null; | |
| 824 | - } | |
| 825 | - | |
| 826 | - public boolean statusToEnd(){ | |
| 827 | - return this.getZdsjActual() == null | |
| 828 | - && this.getSjddModel().getTime() != null; | |
| 829 | - } | |
| 830 | - | |
| 831 | - public void revokeRealOutgo() { | |
| 832 | - //this.setStatus(0); | |
| 833 | - this.setFcsjActual(null); | |
| 834 | - this.setFcsjActualTime(null); | |
| 835 | - if(null != this.getSjfcModel()) | |
| 836 | - this.getSjfcModel().resetNull(); | |
| 837 | - this.calcStatus(); | |
| 838 | - }*/ | |
| 839 | 721 | |
| 840 | 722 | public void clearFcsjActual(){ |
| 841 | 723 | this.setFcsjActual(null); |
| 842 | 724 | this.setFcsjActualTime(null); |
| 843 | 725 | this.calcStatus(); |
| 844 | 726 | } |
| 845 | - | |
| 846 | -/* public boolean existDependent() { | |
| 847 | - return this.isFirstStationIsPark() || this.parkIsFirstStation; | |
| 848 | - }*/ | |
| 849 | 727 | |
| 850 | 728 | //清除实际终点时间 |
| 851 | 729 | public void clearZdsjActual(){ |
| ... | ... | @@ -862,4 +740,20 @@ public class ScheduleRealInfo { |
| 862 | 740 | public void setOpDirectiveState(Integer opDirectiveState) { |
| 863 | 741 | this.opDirectiveState = opDirectiveState; |
| 864 | 742 | } |
| 743 | + | |
| 744 | + public ScheduleRealInfo getTwinsSch() { | |
| 745 | + return twinsSch; | |
| 746 | + } | |
| 747 | + | |
| 748 | + public void setTwinsSch(ScheduleRealInfo twinsSch) { | |
| 749 | + this.twinsSch = twinsSch; | |
| 750 | + } | |
| 751 | + | |
| 752 | + public boolean isLate() { | |
| 753 | + return late; | |
| 754 | + } | |
| 755 | + | |
| 756 | + public void setLate(boolean late) { | |
| 757 | + this.late = late; | |
| 758 | + } | |
| 865 | 759 | } | ... | ... |
src/main/java/com/bsth/repository/forecast/SampleRepository.java
0 → 100644
| 1 | +package com.bsth.repository.forecast; | |
| 2 | + | |
| 3 | +import org.springframework.stereotype.Repository; | |
| 4 | + | |
| 5 | +import com.bsth.entity.forecast.Sample; | |
| 6 | +import com.bsth.repository.BaseRepository; | |
| 7 | + | |
| 8 | +@Repository | |
| 9 | +public interface SampleRepository extends BaseRepository<Sample, Long>{ | |
| 10 | + | |
| 11 | +} | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveService.java
| ... | ... | @@ -4,9 +4,6 @@ package com.bsth.service.directive; |
| 4 | 4 | import java.util.List; |
| 5 | 5 | import java.util.Map; |
| 6 | 6 | |
| 7 | -import org.springframework.data.domain.Page; | |
| 8 | -import org.springframework.data.domain.PageRequest; | |
| 9 | - | |
| 10 | 7 | import com.bsth.entity.directive.D60; |
| 11 | 8 | import com.bsth.entity.directive.D64; |
| 12 | 9 | import com.bsth.entity.directive.D80; | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -40,6 +40,8 @@ import com.bsth.security.util.SecurityUtils; |
| 40 | 40 | import com.bsth.service.impl.BaseServiceImpl; |
| 41 | 41 | import com.bsth.util.DateUtils; |
| 42 | 42 | import com.bsth.websocket.handler.RealControlSocketHandler; |
| 43 | +import com.fasterxml.jackson.core.JsonProcessingException; | |
| 44 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 43 | 45 | import com.google.common.base.Splitter; |
| 44 | 46 | |
| 45 | 47 | @Service |
| ... | ... | @@ -165,10 +167,17 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 165 | 167 | */ |
| 166 | 168 | @Override |
| 167 | 169 | public void sendD60ToPage(ScheduleRealInfo sch) { |
| 168 | - JSONObject json = new JSONObject(); | |
| 169 | - json.put("fn", "directive"); | |
| 170 | - json.put("t", sch); | |
| 171 | - socketHandler.sendMessageToLine(sch.getXlBm(), json.toJSONString()); | |
| 170 | + Map<String, Object> map = new HashMap<>(); | |
| 171 | + map.put("fn", sch); | |
| 172 | + map.put("t", sch); | |
| 173 | + | |
| 174 | + ObjectMapper mapper = new ObjectMapper(); | |
| 175 | + | |
| 176 | + try { | |
| 177 | + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map)); | |
| 178 | + } catch (JsonProcessingException e) { | |
| 179 | + logger.error("", e); | |
| 180 | + } | |
| 172 | 181 | } |
| 173 | 182 | |
| 174 | 183 | @Override |
| ... | ... | @@ -244,7 +253,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 244 | 253 | logger.error("没有设备号对照的车辆:" + nbbm); |
| 245 | 254 | return null; |
| 246 | 255 | } |
| 247 | - // 根据当前确定 上下行和营运状态 | |
| 256 | + // 根据当前GPS确定 上下行和营运状态 | |
| 248 | 257 | Integer upDown = null, state = null; |
| 249 | 258 | if (null == sch) { |
| 250 | 259 | GpsEntity gpsData = gpsRealDataBuffer.findByDeviceId(deviceId); | ... | ... |
src/main/java/com/bsth/service/forecast/SampleService.java
0 → 100644
src/main/java/com/bsth/service/forecast/SampleServiceImpl.java
0 → 100644
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
| ... | ... | @@ -64,4 +64,18 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> |
| 64 | 64 | rs.put("time", time); |
| 65 | 65 | return rs; |
| 66 | 66 | } |
| 67 | + | |
| 68 | + @Override | |
| 69 | + public Map<String, Object> editOutTimeType(String lineCode, int type) { | |
| 70 | + Map<String, Object> rs = new HashMap<>(); | |
| 71 | + LineConfig conf = lineConfigData.get(lineCode); | |
| 72 | + | |
| 73 | + conf.setOutConfig(type); | |
| 74 | + conf.setInConfig(type); | |
| 75 | + lineConfigData.set(conf); | |
| 76 | + | |
| 77 | + rs.put("status", ResponseCode.SUCCESS); | |
| 78 | + rs.put("type", type); | |
| 79 | + return rs; | |
| 80 | + } | |
| 67 | 81 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -712,7 +712,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 712 | 712 | } |
| 713 | 713 | else{ |
| 714 | 714 | // 按发车时间排序 |
| 715 | - Collections.sort(list, new ScheduleComparator.FCNO()); | |
| 715 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | |
| 716 | 716 | |
| 717 | 717 | // 以第一个实际发车/待发时间为起点,调整间隔 |
| 718 | 718 | sch = list.get(0); | ... | ... |
src/main/java/com/bsth/service/sys/impl/ModuleServiceImpl.java
| 1 | 1 | package com.bsth.service.sys.impl; |
| 2 | 2 | |
| 3 | 3 | import java.util.ArrayList; |
| 4 | +import java.util.Collections; | |
| 5 | +import java.util.Comparator; | |
| 4 | 6 | import java.util.HashMap; |
| 5 | 7 | import java.util.HashSet; |
| 6 | 8 | import java.util.List; |
| ... | ... | @@ -8,6 +10,8 @@ import java.util.Map; |
| 8 | 10 | import java.util.Set; |
| 9 | 11 | |
| 10 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | +import org.springframework.data.domain.Sort; | |
| 14 | +import org.springframework.data.domain.Sort.Direction; | |
| 11 | 15 | import org.springframework.stereotype.Service; |
| 12 | 16 | |
| 13 | 17 | import com.bsth.common.ResponseCode; |
| ... | ... | @@ -60,7 +64,7 @@ public class ModuleServiceImpl extends BaseServiceImpl<Module, Integer> implemen |
| 60 | 64 | SysUser user = SecurityUtils.getCurrentUser(); |
| 61 | 65 | Set<Role> roles = user.getRoles(); |
| 62 | 66 | |
| 63 | - List<Module> all = (List<Module>) moduleRepository.findAll() | |
| 67 | + List<Module> all = (List<Module>) moduleRepository.findAll(new Sort(Direction.ASC, "id")) | |
| 64 | 68 | ,results = new ArrayList<>(); |
| 65 | 69 | |
| 66 | 70 | Map<Integer, Module> map = new HashMap<>(); | ... | ... |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| ... | ... | @@ -14,6 +14,7 @@ import org.springframework.stereotype.Component; |
| 14 | 14 | |
| 15 | 15 | import com.alibaba.fastjson.JSONObject; |
| 16 | 16 | import com.bsth.data.BasicData; |
| 17 | +import com.bsth.data.LineConfigData; | |
| 17 | 18 | import com.bsth.data.schedule.DayOfSchedule; |
| 18 | 19 | import com.bsth.entity.directive.D80; |
| 19 | 20 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| ... | ... | @@ -24,6 +25,9 @@ public class SendUtils{ |
| 24 | 25 | |
| 25 | 26 | @Autowired |
| 26 | 27 | private RealControlSocketHandler socketHandler; |
| 28 | + | |
| 29 | + @Autowired | |
| 30 | + LineConfigData lineConfigData; | |
| 27 | 31 | |
| 28 | 32 | private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| 29 | 33 | |
| ... | ... | @@ -33,17 +37,19 @@ public class SendUtils{ |
| 33 | 37 | * @throws JsonProcessingException |
| 34 | 38 | * TODO(推送发车信息) |
| 35 | 39 | */ |
| 36 | - public void sendFcsj(ScheduleRealInfo schedule) { | |
| 37 | - | |
| 40 | + public void sendFcsj(ScheduleRealInfo sch) { | |
| 41 | + //处理出站即出场的班次 | |
| 42 | + connectOutSchTime(sch); | |
| 43 | + | |
| 38 | 44 | Map<String, Object> map = new HashMap<>(); |
| 39 | 45 | map.put("fn", "faChe"); |
| 40 | - map.put("t", schedule); | |
| 46 | + map.put("t", sch); | |
| 41 | 47 | map.put("dataStr", sdf.format(new Date())); |
| 42 | 48 | |
| 43 | 49 | ObjectMapper mapper = new ObjectMapper(); |
| 44 | 50 | |
| 45 | 51 | try { |
| 46 | - socketHandler.sendMessageToLine(schedule.getXlBm(), mapper.writeValueAsString(map)); | |
| 52 | + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map)); | |
| 47 | 53 | } catch (Exception e) { |
| 48 | 54 | logger.error("", e); |
| 49 | 55 | } |
| ... | ... | @@ -77,11 +83,13 @@ public class SendUtils{ |
| 77 | 83 | * @throws NumberFormatException @Title: sendFcsj @Description: |
| 78 | 84 | * TODO(推送到达终点时间) @param @param schedule 班次 @throws |
| 79 | 85 | */ |
| 80 | - public void sendZdsj(ScheduleRealInfo schedule, ScheduleRealInfo nextSch, int finish) { | |
| 86 | + public void sendZdsj(ScheduleRealInfo sch, ScheduleRealInfo nextSch, int finish) { | |
| 87 | + //处理进站即进场的班次 | |
| 88 | + connectInSchTime(sch); | |
| 81 | 89 | |
| 82 | 90 | Map<String, Object> map = new HashMap<>(); |
| 83 | 91 | map.put("fn", "zhongDian"); |
| 84 | - map.put("t", schedule); | |
| 92 | + map.put("t", sch); | |
| 85 | 93 | map.put("nt", nextSch); |
| 86 | 94 | map.put("finish", finish); |
| 87 | 95 | map.put("dataStr", sdf.format(new Date())); |
| ... | ... | @@ -89,7 +97,7 @@ public class SendUtils{ |
| 89 | 97 | ObjectMapper mapper = new ObjectMapper(); |
| 90 | 98 | |
| 91 | 99 | try { |
| 92 | - socketHandler.sendMessageToLine(schedule.getXlBm(), mapper.writeValueAsString(map)); | |
| 100 | + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map)); | |
| 93 | 101 | } catch (Exception e) { |
| 94 | 102 | logger.error("", e); |
| 95 | 103 | } |
| ... | ... | @@ -141,5 +149,38 @@ public class SendUtils{ |
| 141 | 149 | refreshSch(list); |
| 142 | 150 | } |
| 143 | 151 | |
| 144 | - //public void sendReportOutTime(ScheduleRealInfo sch) | |
| 152 | + | |
| 153 | + //出站即出场 | |
| 154 | + public void connectOutSchTime(ScheduleRealInfo sch){ | |
| 155 | + try{ | |
| 156 | + ScheduleRealInfo twins = sch.getTwinsSch(); | |
| 157 | + if(twins != null | |
| 158 | + && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2 | |
| 159 | + && twins.getBcType().equals("out")){ | |
| 160 | + | |
| 161 | + twins.setFcsjActualAll(sch.getFcsjActualTime()); | |
| 162 | + //刷新关联的出场班次 | |
| 163 | + refreshSch(twins); | |
| 164 | + } | |
| 165 | + }catch(Exception e){ | |
| 166 | + logger.error("", e); | |
| 167 | + } | |
| 168 | + } | |
| 169 | + | |
| 170 | + //进站即出场 | |
| 171 | + public void connectInSchTime(ScheduleRealInfo sch){ | |
| 172 | + try{ | |
| 173 | + ScheduleRealInfo twins = sch.getTwinsSch(); | |
| 174 | + if(twins != null | |
| 175 | + && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2 | |
| 176 | + && twins.getBcType().equals("in")){ | |
| 177 | + | |
| 178 | + twins.setZdsjActualAll(sch.getZdsjActualTime()); | |
| 179 | + //刷新关联的出场班次 | |
| 180 | + refreshSch(twins); | |
| 181 | + } | |
| 182 | + }catch(Exception e){ | |
| 183 | + logger.error("", e); | |
| 184 | + } | |
| 185 | + } | |
| 145 | 186 | } | ... | ... |
src/main/resources/application.properties
src/main/resources/datatools/config-dev.properties
| ... | ... | @@ -4,13 +4,13 @@ |
| 4 | 4 | datatools.kettle_properties=/datatools/kettle.properties |
| 5 | 5 | # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正) |
| 6 | 6 | #数据库ip地址 |
| 7 | -datatools.kvars_dbip=127.0.0.1 | |
| 7 | +datatools.kvars_dbip=192.168.168.201 | |
| 8 | 8 | #数据库用户名 |
| 9 | 9 | datatools.kvars_dbuname=root |
| 10 | 10 | #数据库密码 |
| 11 | -datatools.kvars_dbpwd= | |
| 11 | +datatools.kvars_dbpwd=123456 | |
| 12 | 12 | #数据库库名 |
| 13 | -datatools.kvars_dbdname=control | |
| 13 | +datatools.kvars_dbdname=mh_control | |
| 14 | 14 | |
| 15 | 15 | # 3、上传数据配置信息 |
| 16 | 16 | # 上传文件目录配置(根据不同的环境需要修正) | ... | ... |
src/main/resources/ms-jdbc.properties
| 1 | -#ms.mysql.driver= com.mysql.jdbc.Driver | |
| 2 | -#ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 3 | -#ms.mysql.username= root | |
| 4 | -#ms.mysql.password= panzhao | |
| 5 | - | |
| 6 | 1 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 7 | -ms.mysql.url= jdbc:mysql://192.168.168.171:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 2 | +ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 8 | 3 | ms.mysql.username= root |
| 9 | -ms.mysql.password= root2jsp | |
| 10 | 4 | \ No newline at end of file |
| 5 | +ms.mysql.password= panzhao | |
| 6 | + | |
| 7 | +#ms.mysql.driver= com.mysql.jdbc.Driver | |
| 8 | +#ms.mysql.url= jdbc:mysql://192.168.168.171:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 9 | +#ms.mysql.username= root | |
| 10 | +#ms.mysql.password= root2jsp | |
| 11 | 11 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/control/line/css/lineControl.css
| ... | ... | @@ -2554,6 +2554,8 @@ span.nt-coord:before{ |
| 2554 | 2554 | margin: 8px 0; |
| 2555 | 2555 | } |
| 2556 | 2556 | |
| 2557 | + | |
| 2558 | + | |
| 2557 | 2559 | tr.linjia td:nth-child(1):AFTER { |
| 2558 | 2560 | content: "\f173"; |
| 2559 | 2561 | font: normal normal normal 14px/1 FontAwesome; |
| ... | ... | @@ -2565,6 +2567,21 @@ tr.linjia td:nth-child(1):AFTER { |
| 2565 | 2567 | padding: 1px 3px 1px 3px; |
| 2566 | 2568 | background: #e7505a; |
| 2567 | 2569 | border-radius: 15px; |
| 2570 | + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12); | |
| 2571 | +} | |
| 2572 | + | |
| 2573 | +tr.child_task td:nth-child(1):AFTER{ | |
| 2574 | + content: "Z"; | |
| 2575 | + font: normal normal normal 14px/1 FontAwesome; | |
| 2576 | + position: absolute; | |
| 2577 | + right: 1px; | |
| 2578 | + bottom: 2px; | |
| 2579 | + color: #ffffff; | |
| 2580 | + padding: 1px 3px 1px 3px; | |
| 2581 | + background: #3598dc; | |
| 2582 | + border-radius: 15px; | |
| 2583 | + font-weight: bold; | |
| 2584 | + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12); | |
| 2568 | 2585 | } |
| 2569 | 2586 | |
| 2570 | 2587 | .device_event_str{ | ... | ... |
src/main/resources/static/pages/control/line/js/data.js
| ... | ... | @@ -197,10 +197,6 @@ var _data = (function(){ |
| 197 | 197 | if(!lineLpMap[lineCode][this.lpName]) |
| 198 | 198 | lineLpMap[lineCode][this.lpName] = []; |
| 199 | 199 | lineLpMap[lineCode][this.lpName].push(this); |
| 200 | - //车辆 ——> 班次数组 | |
| 201 | - /*if(!clSchMap[this.clZbh]) | |
| 202 | - clSchMap[this.clZbh] = []; | |
| 203 | - clSchMap[this.clZbh].push(this);*/ | |
| 204 | 200 | }); |
| 205 | 201 | |
| 206 | 202 | //按发车时间排序 | ... | ... |
src/main/resources/static/pages/control/line/js/rightMenu.js
| ... | ... | @@ -571,14 +571,15 @@ var _menu = (function() { |
| 571 | 571 | var params = $('form#schinfoFineTune').serializeJSON(); |
| 572 | 572 | |
| 573 | 573 | if(!customFormValidate('form#schinfoFineTune'))return; |
| 574 | - | |
| 574 | + | |
| 575 | + var loadIndex = layer.msg('操作中...', {icon: 16}); | |
| 575 | 576 | $post('/realSchedule/schInfoFineTune', params, function(rs){ |
| 576 | 577 | layer.close(index); |
| 578 | + layer.close(loadIndex); | |
| 579 | + | |
| 577 | 580 | if(rs.ts) |
| 578 | 581 | _alone.refreshScheduleArray(rs.ts); |
| 579 | 582 | |
| 580 | - /*if(rs.nextSch) | |
| 581 | - _alone.refreshSchedule(rs.nextSch);*/ | |
| 582 | 583 | }); |
| 583 | 584 | }); |
| 584 | 585 | } | ... | ... |
src/main/resources/static/pages/control/line/temps/alone_tp.html
| ... | ... | @@ -104,7 +104,7 @@ |
| 104 | 104 | <!-- 班次table --> |
| 105 | 105 | <script id="alone_plan_table_temp" type="text/html"> |
| 106 | 106 | {{each list as item i}} |
| 107 | -<tr data-id={{item.id}} class="{{if item.sflj}}linjia{{/if}}"> | |
| 107 | +<tr data-id={{item.id}} class="{{if item.sflj}}linjia{{/if}} {{if item.cTasks.length > 0}} child_task {{/if}}"> | |
| 108 | 108 | <td name="lineNo"></td> |
| 109 | 109 | <td data-name="lpName"><a href="javascript:;">{{item.lpName}}</a></td> |
| 110 | 110 | |
| ... | ... | @@ -138,7 +138,8 @@ |
| 138 | 138 | |
| 139 | 139 | {{else if item.status == 1}} |
| 140 | 140 | <td data-name="sjfcsj" class="tl-zzzx sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td> |
| 141 | - | |
| 141 | +{{else if item.status == 0 && item.late}} | |
| 142 | + <td data-name="sjfcsj" class="tl-wd sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td> | |
| 142 | 143 | {{else }} |
| 143 | 144 | <td data-name="sjfcsj" class="sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td> |
| 144 | 145 | {{/if}} | ... | ... |
src/main/resources/static/pages/control/lineConfig/config.html
| ... | ... | @@ -211,23 +211,14 @@ butto.line-config-btn:active{ |
| 211 | 211 | </div> |
| 212 | 212 | </section> |
| 213 | 213 | |
| 214 | - <!--<section> | |
| 215 | - <h3>出场时间</h3> | |
| 216 | - | |
| 217 | - <div class="settings-row" > | |
| 218 | - <p > 使用 <a href="javascript:;" data-type="select" id="outTimeType"></a> 作为出场班次的实际时间。</p> | |
| 219 | - </div> | |
| 220 | - </section> | |
| 221 | ---> | |
| 222 | -<!-- | |
| 223 | 214 | <section> |
| 224 | - <h3>进场时间</h3> | |
| 215 | + <h3>班次进出场时间</h3> | |
| 225 | 216 | |
| 226 | 217 | <div class="settings-row" > |
| 227 | - <p > 使用 <a href="javascript:;" data-type="select" id="inTimeType"></a> 作为进场班次的实际时间。</p> | |
| 218 | + <p > 使用 <a href="javascript:;" data-type="select" id="outTimeType"></a> 时间作为出场班次的实际时间。</p> | |
| 228 | 219 | </div> |
| 229 | 220 | </section> |
| 230 | ---> | |
| 221 | + | |
| 231 | 222 | </form> |
| 232 | 223 | </script> |
| 233 | 224 | |
| ... | ... | @@ -305,7 +296,6 @@ butto.line-config-btn:active{ |
| 305 | 296 | //运营开始时间 |
| 306 | 297 | $('#startOptTimeLink').editable({ |
| 307 | 298 | type: 'time', |
| 308 | - title:'修改线路运营开始时间', | |
| 309 | 299 | placement: 'right', |
| 310 | 300 | display: false, |
| 311 | 301 | validate: function(value){ |
| ... | ... | @@ -316,42 +306,41 @@ butto.line-config-btn:active{ |
| 316 | 306 | }) |
| 317 | 307 | .on('save', function(e, params) { |
| 318 | 308 | var index = showLoad('提交数据...'); |
| 319 | - var lineCode = $('.line_config_tree li.selected').data('code'); | |
| 320 | - $post('/lineConfig/editTime', {lineCode: lineCode, time: params.newValue} | |
| 309 | + $post('/lineConfig/editTime', {lineCode: getLineCode(), time: params.newValue} | |
| 321 | 310 | ,function(rs){ |
| 322 | 311 | layer.close(index); |
| 323 | 312 | $('#startOptTimeLink').text(rs.time); |
| 324 | 313 | }); |
| 325 | 314 | }); |
| 326 | 315 | |
| 327 | -/* //出场时间类型 | |
| 316 | + //进出场时间类型 | |
| 328 | 317 | $('#outTimeType').editable({ |
| 329 | 318 | value: conf.outConfig, |
| 330 | 319 | inputclass: 'form-control', |
| 331 | 320 | placement: 'right', |
| 332 | 321 | source: [{ |
| 333 | 322 | value: 0, |
| 334 | - text: '离开缓冲区时间' | |
| 323 | + text: 'gps出场' | |
| 335 | 324 | }, { |
| 336 | 325 | value: 1, |
| 337 | - text: '请求出场时间' | |
| 338 | - }] | |
| 339 | - }); | |
| 340 | - | |
| 341 | - //进场时间类型 | |
| 342 | - $('#inTimeType').editable({ | |
| 343 | - value: conf.inConfig, | |
| 344 | - inputclass: 'form-control', | |
| 345 | - placement: 'right', | |
| 346 | - source: [{ | |
| 347 | - value: 0, | |
| 348 | - text: '离开缓冲区时间' | |
| 326 | + text: '请求出场' | |
| 349 | 327 | }, { |
| 350 | - value: 1, | |
| 351 | - text: '请求进场时间' | |
| 328 | + value: 2, | |
| 329 | + text: '出站即出场' | |
| 352 | 330 | }] |
| 353 | - }); */ | |
| 354 | - | |
| 331 | + }) | |
| 332 | + .on('save', function(e, params) { | |
| 333 | + var index = showLoad('提交数据...'); | |
| 334 | + $post('/lineConfig/editOutTimeType', {lineCode: lineCode, type: params.newValue} | |
| 335 | + ,function(rs){ | |
| 336 | + layer.close(index); | |
| 337 | + $('#outTimeType').val(rs.type); | |
| 338 | + }); | |
| 339 | + }); | |
| 340 | + } | |
| 341 | + | |
| 342 | + function getLineCode(){ | |
| 343 | + return $('.line_config_tree li.selected').data('code'); | |
| 355 | 344 | } |
| 356 | 345 | }(); |
| 357 | 346 | </script> |
| 358 | 347 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forecast/gps/gpsMain.html
0 → 100644
src/main/resources/static/pages/forecast/real/realForecast.html
0 → 100644
src/main/resources/static/pages/forecast/sample/css/main.css
0 → 100644
| 1 | +#lineConfigPanel{ | |
| 2 | + background: #fff; | |
| 3 | + overflow: hidden; | |
| 4 | + font-family: 'Segoe UI',Arial,'Microsoft Yahei',sans-serif !important; | |
| 5 | + min-width: 1392px; | |
| 6 | +} | |
| 7 | + | |
| 8 | +#lineConfigPanel h1{ | |
| 9 | + -webkit-margin-start: 23px; | |
| 10 | + color: rgb(92, 97, 102); | |
| 11 | + margin-bottom: 1em; | |
| 12 | + margin-top: 21px; | |
| 13 | + font-size: 1.5em; | |
| 14 | +} | |
| 15 | + | |
| 16 | +#lineConfigPanel .line_config_tree ul { | |
| 17 | + list-style-type: none; | |
| 18 | + padding: 0; | |
| 19 | + height: 100% !important; | |
| 20 | +} | |
| 21 | + | |
| 22 | +#lineConfigPanel .line_config_tree ul li{ | |
| 23 | + -webkit-border-start: 6px solid transparent; | |
| 24 | + -webkit-padding-start: 18px; | |
| 25 | + -webkit-user-select: none; | |
| 26 | + cursor: pointer; | |
| 27 | +} | |
| 28 | + | |
| 29 | +#lineConfigPanel .line_config_tree ul li.selected{ | |
| 30 | + -webkit-border-start-color: #1bbc9b; | |
| 31 | + cursor: default; | |
| 32 | + pointer-events: none; | |
| 33 | +} | |
| 34 | + | |
| 35 | +#lineConfigPanel .line_config_tree ul li button{ | |
| 36 | + background-color: white; | |
| 37 | + border: 0; | |
| 38 | + color: #999; | |
| 39 | + cursor: pointer; | |
| 40 | + font: inherit; | |
| 41 | + line-height: 1.417em; | |
| 42 | + margin: 6px 0; | |
| 43 | + padding: 0; | |
| 44 | +} | |
| 45 | + | |
| 46 | +#lineConfigPanel .line_config_tree ul li.selected button{ | |
| 47 | + color: #1bbc9b; | |
| 48 | +} | |
| 49 | + | |
| 50 | +#lineConfigPanel #trafficChart{ | |
| 51 | + display: inline-block; | |
| 52 | + width: calc(100% - 152px); | |
| 53 | + vertical-align: top; | |
| 54 | + height: 100%; | |
| 55 | +} | |
| 56 | + | |
| 57 | +#lineConfigPanel #trafficChart .sample_tags{ | |
| 58 | + width: 100%; | |
| 59 | + height: 65px; | |
| 60 | + text-align: right; | |
| 61 | + padding: 20px 40px 0; | |
| 62 | +} | |
| 63 | + | |
| 64 | +#lineConfigPanel #trafficChart .sample_tags a.tag{ | |
| 65 | + display: inline-block; | |
| 66 | + line-height: 1; | |
| 67 | + vertical-align: baseline; | |
| 68 | + background-color: #E8E8E8; | |
| 69 | + padding: .5833em .833em; | |
| 70 | + color: rgba(0,0,0,.6); | |
| 71 | + text-transform: none; | |
| 72 | + font-weight: 700; | |
| 73 | + border: 0 solid transparent; | |
| 74 | + border-radius: .28571429rem !important; | |
| 75 | + -webkit-transition: background .1s ease; | |
| 76 | + transition: background .1s ease; | |
| 77 | + font-size: .85714286rem; | |
| 78 | + margin: .8em .5em .5em 0; | |
| 79 | + font-weight: 400; | |
| 80 | +} | |
| 81 | + | |
| 82 | +#lineConfigPanel #trafficChart svg{ | |
| 83 | + width: 100%; | |
| 84 | + height: calc(100% - 65px); | |
| 85 | +} | |
| 86 | + | |
| 87 | +#lineConfigPanel #trafficChart svg circle{ | |
| 88 | + fill: #b9b7b7; | |
| 89 | + r: 6; | |
| 90 | + stroke: rgb(253, 253, 253); | |
| 91 | + stroke-width: 3; | |
| 92 | +} | |
| 93 | + | |
| 94 | +#lineConfigPanel #trafficChart svg path{ | |
| 95 | + stroke-width: 6.4px; | |
| 96 | + opacity: 0.9; | |
| 97 | + stroke: #b2afaf; | |
| 98 | + cursor: pointer; | |
| 99 | +} | |
| 100 | + | |
| 101 | +#lineConfigPanel #trafficChart svg path.active{ | |
| 102 | + stroke: #1bbc9b; | |
| 103 | +} | |
| 104 | + | |
| 105 | +#lineConfigPanel #trafficChart svg text{ | |
| 106 | + font-size: 85%; | |
| 107 | + fill: #6b6666; | |
| 108 | + font-weight: bold; | |
| 109 | +} | |
| 110 | + | |
| 111 | +#lineConfigPanel #trafficChart .sample_tags a.tag.active{ | |
| 112 | + background-color: #1bbc9b; | |
| 113 | + color: white; | |
| 114 | +} | |
| 115 | + | |
| 116 | +.line_config_tree{ | |
| 117 | + width: 155px; | |
| 118 | + float: left; | |
| 119 | + height: 100%; | |
| 120 | +} | |
| 121 | + | |
| 122 | +#lineConfigPanel .slimScrollBar{ | |
| 123 | + border-radius: 7px !important; | |
| 124 | + background: rgb(176, 173, 173) !important; | |
| 125 | + width: 4px !important; | |
| 126 | +} | |
| 127 | + | |
| 128 | +.line_config_content{ | |
| 129 | + width: calc(100% - 155px); | |
| 130 | + float: left; | |
| 131 | + height: 100%; | |
| 132 | +} | |
| 133 | + | |
| 134 | +.line_config_content .body{ | |
| 135 | + height: 100% !important; | |
| 136 | + overflow: auto; | |
| 137 | + color: rgb(48, 57, 66); | |
| 138 | + overflow: hidden; | |
| 139 | +} | |
| 140 | + | |
| 141 | +.left_station_route{ | |
| 142 | + height: 100%; | |
| 143 | + width: 147px; | |
| 144 | + display: inline-block; | |
| 145 | + padding-top: 7px; | |
| 146 | +} | |
| 147 | + | |
| 148 | + .left_station_route ul{ | |
| 149 | + list-style-type: none; | |
| 150 | + padding-left: 0; | |
| 151 | +} | |
| 152 | + | |
| 153 | +.left_station_route ul li{ | |
| 154 | + -webkit-user-select: none; | |
| 155 | + margin: 8px 0; | |
| 156 | +} | |
| 157 | + | |
| 158 | +.left_station_route ul.list li:FIRST-CHILD { | |
| 159 | + margin-top: 0px; | |
| 160 | +} | |
| 161 | + | |
| 162 | +.left_station_route .tabbable-line ul li div{ | |
| 163 | + padding-left: 10px; | |
| 164 | + display: block; | |
| 165 | + white-space: nowrap; | |
| 166 | + overflow: hidden; | |
| 167 | + text-overflow: ellipsis; | |
| 168 | +} | |
| 169 | + | |
| 170 | +.left_station_route .tabbable-line ul li div a{ | |
| 171 | + color: #605f5f; | |
| 172 | + text-decoration: none; | |
| 173 | +} | |
| 174 | + | |
| 175 | +.left_station_route ul.list li:FIRST-CHILD div a{ | |
| 176 | + cursor: default; | |
| 177 | + color: #bbbaba; | |
| 178 | +} | |
| 179 | + | |
| 180 | +.left_station_route .tabbable-line .tab-content{ | |
| 181 | + height: 100% !important; | |
| 182 | + padding: 20px 0 0; | |
| 183 | +} | |
| 184 | + | |
| 185 | +rect.station_rect{ | |
| 186 | + fill: #949595; | |
| 187 | + height: 24px; | |
| 188 | + rx: 3px; | |
| 189 | +} | |
| 190 | + | |
| 191 | +rect.f_rect{ | |
| 192 | + height: 20px; | |
| 193 | + fill: #32c2a5; | |
| 194 | + rx: 3px; | |
| 195 | +} | |
| 196 | + | |
| 197 | +#lineConfigPanel #trafficChart svg text.f_text{ | |
| 198 | + fill: #ffffff; | |
| 199 | +} | |
| 200 | + | |
| 201 | +.select2-container--open{ | |
| 202 | + z-index: 100000000; | |
| 203 | +} | |
| 0 | 204 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forecast/sample/js/svg.js
0 → 100644
| 1 | +var sampleSvg = (function(){ | |
| 2 | + | |
| 3 | + var rowNum = 5 | |
| 4 | + ,itemWidth = 240 | |
| 5 | + , rowHeight = 130 | |
| 6 | + , _count | |
| 7 | + , margin | |
| 8 | + , _opt | |
| 9 | + , svg | |
| 10 | + , _data; | |
| 11 | + | |
| 12 | + var stationMapp = {}; | |
| 13 | + //路由 | |
| 14 | + var routes; | |
| 15 | + //X比例尺 | |
| 16 | + var scaleX = function(d, i){ | |
| 17 | + var r = parseInt(i / rowNum) | |
| 18 | + ,x = (i % rowNum) * itemWidth; | |
| 19 | + | |
| 20 | + if(r % 2 != 0) | |
| 21 | + x = itemWidth * (rowNum - 1) - x ; | |
| 22 | + return x + margin; | |
| 23 | + } | |
| 24 | + //Y 比例尺 | |
| 25 | + var scaleY = function(d, i){ | |
| 26 | + return (parseInt(i / rowNum)) * rowHeight + 60; | |
| 27 | + }; | |
| 28 | + | |
| 29 | + var dx = function(d){return d.cx;}; | |
| 30 | + var dy = function(d){return d.cy;}; | |
| 31 | + var text = function(d){return d.stationName;} | |
| 32 | + var transform = function(d, i){ | |
| 33 | + var size = d.stationName.length | |
| 34 | + ,dx = size / 2 * 12 | |
| 35 | + ,dy = -15; | |
| 36 | + | |
| 37 | + if((i + 1) % rowNum == 1 && i != 0) | |
| 38 | + dy += 40; | |
| 39 | + return 'translate(-'+dx+', '+dy+')'; | |
| 40 | + } | |
| 41 | + | |
| 42 | + var line = d3.svg.line().x(function(d) { | |
| 43 | + return d.cx; | |
| 44 | + }).y(function(d) { | |
| 45 | + return d.cy; | |
| 46 | + }); | |
| 47 | + | |
| 48 | + var dataId = function(d, i){ | |
| 49 | + if(i >= _count - 1) | |
| 50 | + return null; | |
| 51 | + else | |
| 52 | + return _opt.rts[i + 1].stationCode; | |
| 53 | + } | |
| 54 | + | |
| 55 | + function draw(opt){ | |
| 56 | + $('#trafficChart svg').remove(); | |
| 57 | + svg = d3.select('#trafficChart').append('svg'); | |
| 58 | + //容器宽度 | |
| 59 | + var width = $('#trafficChart svg').width(); | |
| 60 | + margin = (width - (rowNum - 1) * itemWidth) / 2; | |
| 61 | + var rts = opt.rts | |
| 62 | + _count = rts.length; | |
| 63 | + _opt = opt; | |
| 64 | + routes = rts; | |
| 65 | + //附加坐标 | |
| 66 | + $.each(rts , function(i, obj){ | |
| 67 | + obj.cx = scaleX(obj, i); | |
| 68 | + obj.cy = scaleY(obj, i); | |
| 69 | + stationMapp[obj.stationCode] = obj.stationName; | |
| 70 | + }); | |
| 71 | + | |
| 72 | + //画线 | |
| 73 | + svg.selectAll('path').data(rts) | |
| 74 | + .enter().append('path') | |
| 75 | + .attr('d', function(d, i){ | |
| 76 | + if(i == _count - 1) | |
| 77 | + return; | |
| 78 | + return line([d, rts[i + 1]]); | |
| 79 | + }) | |
| 80 | + .attr('data-id', dataId) | |
| 81 | + .attr('data-group', function(d, i){return dataId(d, i - 1) + '_' + dataId(null, i)}) | |
| 82 | + .on('click', function(){popAddModal($(this).data('id'))}); | |
| 83 | + | |
| 84 | + //画点 | |
| 85 | + svg.selectAll('circle').data(rts) | |
| 86 | + .enter().append('circle') | |
| 87 | + .attr('cx', dx) | |
| 88 | + .attr('cy', dy) | |
| 89 | + | |
| 90 | + //站点名 | |
| 91 | + drawText(rts); | |
| 92 | + //显示tags | |
| 93 | + showTags(); | |
| 94 | + } | |
| 95 | + | |
| 96 | + $('#trafficChart').on('click', '.sample_tags a.tag', function(){ | |
| 97 | + $('.sample_tags a.tag.active').removeClass('active'); | |
| 98 | + $(this).addClass('active'); | |
| 99 | + var tag = $(this).text(); | |
| 100 | + clearRunTimeE(); | |
| 101 | + //show | |
| 102 | + showRunTimeE(_data[tag]) | |
| 103 | + | |
| 104 | + }); | |
| 105 | + | |
| 106 | + function showRunTimeE(rs){ | |
| 107 | + //改变path颜色 | |
| 108 | + $.each(rs, function(){ | |
| 109 | + var group = this.sStation + '_' + this.eStation | |
| 110 | + ,path = $('#trafficChart path[data-group='+group+']') | |
| 111 | + ,d = path.attr('d'); | |
| 112 | + this.cp = analysePath(d); | |
| 113 | + path.attr('class', 'active') | |
| 114 | + .attr('data-sid', this.id); | |
| 115 | + }); | |
| 116 | + | |
| 117 | + //背景 | |
| 118 | + svg.selectAll('.f_rect') | |
| 119 | + .data(rs).enter().append('rect') | |
| 120 | + .attr('x', function(d){return d.cp[0]}) | |
| 121 | + .attr('y', function(d){return d.cp[1]}) | |
| 122 | + .attr('transform', 'translate(-4, -14)') | |
| 123 | + .attr('width', function(d){ | |
| 124 | + return (d.runTime + '').length * 7 + 20; | |
| 125 | + }) | |
| 126 | + .classed('f_rect', true); | |
| 127 | + | |
| 128 | + //时间text | |
| 129 | + svg.selectAll('.f_text') | |
| 130 | + .data(rs).enter().append('text') | |
| 131 | + .attr('x', function(d){return d.cp[0]}) | |
| 132 | + .attr('y', function(d){return d.cp[1]}) | |
| 133 | + .attr('class', 'f_text') | |
| 134 | + .text(function(d){return d.runTime + 'm'}); | |
| 135 | + } | |
| 136 | + | |
| 137 | + | |
| 138 | + function clearRunTimeE(){ | |
| 139 | + $('#trafficChart path.active').removeAttr('class'); | |
| 140 | + $('.f_rect,.f_text').remove(); | |
| 141 | + } | |
| 142 | + | |
| 143 | + function showTags(){ | |
| 144 | + //查询 耗时信息 | |
| 145 | + $.get('/sample/all', {'lineCode_eq': _opt.lineCode, 'updown_eq': _opt.updown}, function(rs){ | |
| 146 | + //按tag分组数据 | |
| 147 | + _data = {}; | |
| 148 | + var tags = '';// | |
| 149 | + $.each(rs, function(i, d){ | |
| 150 | + if(!_data[d.tag]){ | |
| 151 | + _data[d.tag] = []; | |
| 152 | + tags += '<a class="tag">'+d.tag+'</a>'; | |
| 153 | + } | |
| 154 | + _data[d.tag].push(d); | |
| 155 | + }); | |
| 156 | + $('#trafficChart .sample_tags').html(tags); | |
| 157 | + //选中第一个tag | |
| 158 | + $('#trafficChart .sample_tags a.tag:eq(0)').click(); | |
| 159 | + }); | |
| 160 | + } | |
| 161 | + | |
| 162 | + function drawText(rts){ | |
| 163 | + svg.selectAll('text').data(rts) | |
| 164 | + .enter().append('text') | |
| 165 | + .attr('x', dx) | |
| 166 | + .attr('y', dy) | |
| 167 | + .attr('transform', transform) | |
| 168 | + .text(text) | |
| 169 | + } | |
| 170 | + | |
| 171 | + var tagRange = {'早高峰': {s: '06:31', e: '08:30'}, '平峰': {s: '08:31', e: '16:00'}, '晚高峰': {s: '16:01', e: '18:00'}}; | |
| 172 | + function popAddModal(id){ | |
| 173 | + //var eid = id ,sid = prve(id); | |
| 174 | + //if(!sid)return; | |
| 175 | + | |
| 176 | + //var opts = {sid: sid, eid: eid, sName: stationMapp[sid], eName: stationMapp[eid]}; | |
| 177 | + $.get('/pages/forecast/sample/modal.html', function(rs){ | |
| 178 | + var index = layer.open({ | |
| 179 | + type: 1, | |
| 180 | + area: '550px', | |
| 181 | + content: rs, | |
| 182 | + shift: 5, | |
| 183 | + // title: '...', | |
| 184 | + success: function(){ | |
| 185 | + $('#forecast_sample_modal').trigger('init', {_opt: _opt, _data: _data, id: id}); | |
| 186 | + /*$("#addSampleForm select[name=tag]").select2({ | |
| 187 | + maximumSelectionLength: 1, | |
| 188 | + tags: true | |
| 189 | + }) | |
| 190 | + .on('change', function(){ | |
| 191 | + var t = $(this).val(); | |
| 192 | + if(tagRange[t]){ | |
| 193 | + $("#addSampleForm input[name=sDate]").val(tagRange[t].s); | |
| 194 | + $("#addSampleForm input[name=eDate]").val(tagRange[t].e); | |
| 195 | + } | |
| 196 | + }); | |
| 197 | + | |
| 198 | + //提交 | |
| 199 | + $('#addSampleForm .confirm').on('click', function(){ | |
| 200 | + if(customFormValidate('#addSampleForm')){ | |
| 201 | + console.log(_opt); | |
| 202 | + var param = $('#addSampleForm').serializeJSON(); | |
| 203 | + param.lineCode = _opt.lineCode; | |
| 204 | + param.updown = _opt.updown; | |
| 205 | + $post('/sample', param, function(){layer.close(index);}); | |
| 206 | + } | |
| 207 | + });*/ | |
| 208 | + } | |
| 209 | + }); | |
| 210 | + }); | |
| 211 | + } | |
| 212 | + | |
| 213 | + | |
| 214 | + var drawObject = { | |
| 215 | + draw: draw , | |
| 216 | + popAddModal: popAddModal | |
| 217 | + } | |
| 218 | + | |
| 219 | + //分析path d 路径中间点 | |
| 220 | + function analysePath(d){ | |
| 221 | + d = d.replace('M', ''); | |
| 222 | + var sp = d.split('L')[0].split(',') | |
| 223 | + ,ep = d.split('L')[1].split(',') | |
| 224 | + ,cp = []; | |
| 225 | + sp[0] = parseInt(sp[0]); | |
| 226 | + sp[1] = parseInt(sp[1]); | |
| 227 | + ep[0] = parseInt(ep[0]); | |
| 228 | + ep[1] = parseInt(ep[1]); | |
| 229 | + | |
| 230 | + cp = sp; | |
| 231 | + var diff; | |
| 232 | + if(sp[0] != ep[0]){ | |
| 233 | + diff = Math.abs(sp[0] - ep[0]) / 2 - 16; | |
| 234 | + cp[0] = sp[0] > ep[0]?ep[0]+diff:sp[0]+diff; | |
| 235 | + cp[1] -= 10; | |
| 236 | + } | |
| 237 | + else if(sp[1] != ep[1]){ | |
| 238 | + diff = Math.abs(sp[1] - ep[1]) / 2; | |
| 239 | + cp[1] = sp[1] > ep[1]?ep[1]+diff:sp[1]+diff; | |
| 240 | + | |
| 241 | + cp[0] += 10; | |
| 242 | + } | |
| 243 | + return cp; | |
| 244 | + } | |
| 245 | + | |
| 246 | + /** | |
| 247 | + * 自定义表单校验 | |
| 248 | + */ | |
| 249 | + function customFormValidate(f){ | |
| 250 | + var rs = true; | |
| 251 | + //所有可见的项 | |
| 252 | + var es = $('input,select', f); | |
| 253 | + | |
| 254 | + for(var i = 0, e; e = es[i++];){ | |
| 255 | + if($(e).attr('required') && ( $(e).val() == null || $(e).val() == '')){ | |
| 256 | + if($(e).hasClass('select2-hidden-accessible')) | |
| 257 | + $(e).next().find('.select2-selection').addClass('custom-val-error'); | |
| 258 | + else | |
| 259 | + $(e).addClass('custom-val-error'); | |
| 260 | + rs = false; | |
| 261 | + } | |
| 262 | + else{ | |
| 263 | + if($(e).hasClass('select2-hidden-accessible')) | |
| 264 | + $(e).next().find('.select2-selection').removeClass('custom-val-error'); | |
| 265 | + else | |
| 266 | + $(e).removeClass('custom-val-error'); | |
| 267 | + } | |
| 268 | + } | |
| 269 | + | |
| 270 | + if(!rs){ | |
| 271 | + layer.alert('数据完整性校验失败,请检查输入项', {icon: 2, title: '操作失败', shift: 5}); | |
| 272 | + } | |
| 273 | + return rs; | |
| 274 | + } | |
| 275 | + return drawObject; | |
| 276 | +})(); | |
| 0 | 277 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forecast/sample/main.html
0 → 100644
| 1 | +<link href="/pages/forecast/sample/css/main.css" rel="stylesheet" type="text/css" /> | |
| 2 | +<div id="lineConfigPanel"> | |
| 3 | + <div class="line_config_tree" > | |
| 4 | + <h1 >线路</h1> | |
| 5 | + <ul></ul> | |
| 6 | + </div> | |
| 7 | + | |
| 8 | + <div class="line_config_content"> | |
| 9 | + <div class="body "> | |
| 10 | + <div class="left_station_route"> | |
| 11 | + <div class="tabbable-line" style="height: 100%;"> | |
| 12 | + <ul class="nav nav-tabs "> | |
| 13 | + <li class="active"><a href="#tab_up" data-toggle="tab" | |
| 14 | + aria-expanded="true"> 上 行 </a></li> | |
| 15 | + <li class=""><a href="#tab_down" data-toggle="tab" | |
| 16 | + aria-expanded="false"> 下 行 </a></li> | |
| 17 | + </ul> | |
| 18 | + <div class="tab-content" > | |
| 19 | + <div class="tab-pane active" id="tab_up"> | |
| 20 | + <ul class="list"> | |
| 21 | + </ul> | |
| 22 | + </div> | |
| 23 | + <div class="tab-pane" id="tab_down"> | |
| 24 | + <ul class="list"> | |
| 25 | + </ul> | |
| 26 | + </div> | |
| 27 | + </div> | |
| 28 | + </div> | |
| 29 | + </div> | |
| 30 | + | |
| 31 | + <div id="trafficChart" > | |
| 32 | + <div class="sample_tags"></div> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 35 | + </div> | |
| 36 | +</div> | |
| 37 | + | |
| 38 | +<script id="forecast_sample_tree_item_temp" type="text/html"> | |
| 39 | +{{each array as line }} | |
| 40 | +<li data-code={{line.lineCode}}> | |
| 41 | + <button>{{line.name}}</button> | |
| 42 | +</li> | |
| 43 | +{{/each}} | |
| 44 | +</script> | |
| 45 | + | |
| 46 | +<script id="forecast_sample_route_temp" type="text/html"> | |
| 47 | +{{each list as route i}} | |
| 48 | +<li> | |
| 49 | + <div> <a class="sample_route_item" data-id="{{route.stationCode}}">{{route.stationName}}</a><div> | |
| 50 | +</li> | |
| 51 | +{{/each}} | |
| 52 | +</script> | |
| 53 | + | |
| 54 | +<script src="/pages/forecast/sample/js/svg.js"></script> | |
| 55 | +<script> | |
| 56 | +!function(){ | |
| 57 | + //站点路由信息 | |
| 58 | + var routes = {}; | |
| 59 | + | |
| 60 | + var $panel = $('#lineConfigPanel') | |
| 61 | + ,$body = $('.line_config_content .body'); | |
| 62 | + var h = $('.page-container>.page-sidebar-wrapper>.page-sidebar').height(); | |
| 63 | + $panel.css('height', h - 18); | |
| 64 | + | |
| 65 | + //线路滚动条 | |
| 66 | + $('.line_config_tree ul').slimscroll({ | |
| 67 | + height : 'calc(100% - 68px)', | |
| 68 | + alwaysVisible : true, | |
| 69 | + opacity : .8 | |
| 70 | + }); | |
| 71 | + | |
| 72 | + //路由 | |
| 73 | + $('.left_station_route .tab-content').slimscroll({ | |
| 74 | + height : 'calc(100% - 46px)', | |
| 75 | + opacity : .8 | |
| 76 | + }); | |
| 77 | + | |
| 78 | + //上下行切换事件 | |
| 79 | + $('.left_station_route .tabbable-line ul li').on('click', function(){setTimeout(drawSvg, 300);}); | |
| 80 | + | |
| 81 | + $get('/line/all', {destroy_eq:0}, function(rs){ | |
| 82 | + var itemsHtml = template('forecast_sample_tree_item_temp', {array: rs}); | |
| 83 | + $('.line_config_tree ul').html(itemsHtml) | |
| 84 | + .find('li:eq(0)').click(); | |
| 85 | + }); | |
| 86 | + | |
| 87 | + $panel.on('click', '.line_config_tree li', function(){ | |
| 88 | + $('.line_config_tree li.selected').removeClass('selected'); | |
| 89 | + $(this).addClass('selected'); | |
| 90 | + | |
| 91 | + //显示路由信息 | |
| 92 | + showRouteInfo(); | |
| 93 | + }); | |
| 94 | + | |
| 95 | + function showRouteInfo(){ | |
| 96 | + $.get('/stationroute/all', {'line.lineCode_eq': getLineCode(), 'destroy_eq': 0} | |
| 97 | + ,function(rs){ | |
| 98 | + rs.sort(function(a, b){ | |
| 99 | + return a.stationRouteCode - b.stationRouteCode; | |
| 100 | + }); | |
| 101 | + var temp = 'forecast_sample_route_temp'; | |
| 102 | + //上下行分组 | |
| 103 | + var ups = [],downs = []; | |
| 104 | + $.each(rs, function(){ | |
| 105 | + if(this.directions == 0) | |
| 106 | + ups.push(this); | |
| 107 | + else | |
| 108 | + downs.push(this); | |
| 109 | + }); | |
| 110 | + | |
| 111 | + $('#tab_up ul').html(template(temp, {list: ups})); | |
| 112 | + $('#tab_down ul').html(template(temp, {list: downs})); | |
| 113 | + | |
| 114 | + routes.ups = ups; | |
| 115 | + routes.downs = downs; | |
| 116 | + | |
| 117 | + drawSvg(); | |
| 118 | + }); | |
| 119 | + } | |
| 120 | + | |
| 121 | + function showLoad(text){ | |
| 122 | + return layer.msg(text, {icon: 16, time: 0, shade: 0.3}); | |
| 123 | + } | |
| 124 | + | |
| 125 | + function getUpdown(){ | |
| 126 | + var activePanel = $('.left_station_route .tab-content .tab-pane.active') | |
| 127 | + ,updown = -1 | |
| 128 | + ,id = activePanel.attr('id'); | |
| 129 | + | |
| 130 | + if(id == 'tab_up') | |
| 131 | + updown = 0; | |
| 132 | + else if(id == 'tab_down') | |
| 133 | + updown = 1; | |
| 134 | + | |
| 135 | + return updown; | |
| 136 | + } | |
| 137 | + | |
| 138 | + function getLineCode(){ | |
| 139 | + return $('.line_config_tree li.selected').data('code'); | |
| 140 | + } | |
| 141 | + | |
| 142 | + function drawSvg(){ | |
| 143 | + //绘制svg | |
| 144 | + var rts = [], updown = getUpdown(); | |
| 145 | + if(updown === 0) | |
| 146 | + rts = routes.ups; | |
| 147 | + else if(updown === 1) | |
| 148 | + rts = routes.downs; | |
| 149 | + sampleSvg.draw({lineCode: getLineCode(), rts: rts, updown: getUpdown()}); | |
| 150 | + } | |
| 151 | + | |
| 152 | + $('#lineConfigPanel').on('click', '.sample_route_item', function(){ | |
| 153 | + sampleSvg.popAddModal($(this).data('id')); | |
| 154 | + }) | |
| 155 | +}(); | |
| 156 | +</script> | |
| 0 | 157 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forecast/sample/modal.html
0 → 100644
| 1 | +<div id="forecast_sample_modal"> | |
| 2 | +</div> | |
| 3 | + | |
| 4 | +<script id="forecast_addSample_temp" type="text/html"> | |
| 5 | +<form class="form-horizontal" role="form" style="padding: 35px 25px;" id="addSampleForm"> | |
| 6 | + <input type="hidden" name="sStation" value="{{sid}}"/> | |
| 7 | + <input type="hidden" name="eStation" value="{{eid}}"/> | |
| 8 | + <div class="form-body"> | |
| 9 | + <div class="form-group"> | |
| 10 | + <label class="col-md-3 control-label">开始站:</label> | |
| 11 | + <div class="col-md-9"> | |
| 12 | + <input type="text" class="form-control " value="{{sName}}" readonly> | |
| 13 | + </div> | |
| 14 | + </div> | |
| 15 | + <div class="form-group"> | |
| 16 | + <label class="col-md-3 control-label">截止站:</label> | |
| 17 | + <div class="col-md-9"> | |
| 18 | + <input type="text" class="form-control" value="{{eName}}" readonly> | |
| 19 | + </div> | |
| 20 | + </div> | |
| 21 | + <div class="form-group"> | |
| 22 | + <label class="col-md-3 control-label">标签:</label> | |
| 23 | + <div class="col-md-9"> | |
| 24 | + <select class="form-control" name="tag" multiple required> | |
| 25 | + <option value="早高峰">早高峰</option> | |
| 26 | + <option value="平峰">平峰</option> | |
| 27 | + <option value="晚高峰">晚高峰</option> | |
| 28 | + </select> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | + <div class="form-group"> | |
| 32 | + <label class="col-md-3 control-label">时段:</label> | |
| 33 | + <div class="col-md-4" style="padding-right: 0;"> | |
| 34 | + <input type="time" class="form-control" name="sDate" required> | |
| 35 | + </div> | |
| 36 | + <div class="col-md-1" style="margin-top: 10px;font-size: 85%;color: gray;">至</div> | |
| 37 | + <div class="col-md-4" style="padding-left: 0;"> | |
| 38 | + <input type="time" class="form-control" name="eDate" required> | |
| 39 | + </div> | |
| 40 | + </div> | |
| 41 | + <div class="form-group"> | |
| 42 | + <label class="col-md-3 control-label">耗时(分):</label> | |
| 43 | + <div class="col-md-9"> | |
| 44 | + <input type="number" class="form-control" name="runTime" required> | |
| 45 | + </div> | |
| 46 | + </div> | |
| 47 | + </div> | |
| 48 | +<br> | |
| 49 | + <div class="form-actions"> | |
| 50 | + <div class="row"> | |
| 51 | + <div class="col-md-offset-4 col-md-8"> | |
| 52 | + <button type="button" class="btn green confirm"><i class="fa fa-check"></i> 提交</button> | |
| 53 | + <button type="button" class="btn layui-layer-close">取消</button> | |
| 54 | + </div> | |
| 55 | + </div> | |
| 56 | + </div> | |
| 57 | +</form> | |
| 58 | +</script> | |
| 59 | + | |
| 60 | +<script> | |
| 61 | +!function(){ | |
| 62 | + var _data,_opt,id; | |
| 63 | + | |
| 64 | + | |
| 65 | + $('#forecast_sample_modal').on('init', function(e, rs){ | |
| 66 | + _data = rs._data; | |
| 67 | + _opt = rs._opt; | |
| 68 | + id = rs.id; | |
| 69 | + //console.log(rs); | |
| 70 | + }); | |
| 71 | + | |
| 72 | + | |
| 73 | + function prve(that){ | |
| 74 | + for(var i = 0; i < _opt.rts.length; i ++){ | |
| 75 | + if(routes[i].stationCode == that){ | |
| 76 | + if(i == 0) | |
| 77 | + return null; | |
| 78 | + return routes[i - 1].stationCode; | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 82 | + return null; | |
| 83 | + } | |
| 84 | +}(); | |
| 85 | +</script> | |
| 0 | 86 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/permission/user/list.html
| ... | ... | @@ -133,7 +133,7 @@ |
| 133 | 133 | {{obj.lastLoginDate}} |
| 134 | 134 | </td> |
| 135 | 135 | <td> |
| 136 | - <a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}"><i class="fa fa-edit"></i> 编辑</a> | |
| 136 | + <a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a> | |
| 137 | 137 | </td> |
| 138 | 138 | </tr> |
| 139 | 139 | {{/each}} | ... | ... |