Commit 1146232f3d202fe9a7458a02379daada380ca65b

Authored by 潘钊
2 parents 885ed459 3a8e2b47

Merge branch 'minhang' into pudong

Showing 37 changed files with 2090 additions and 325 deletions
@@ -292,6 +292,13 @@ @@ -292,6 +292,13 @@
292 <artifactId>mina-core</artifactId> 292 <artifactId>mina-core</artifactId>
293 <version>2.0.13</version> 293 <version>2.0.13</version>
294 </dependency> 294 </dependency>
  295 +
  296 + <dependency>
  297 + <groupId>com.google.protobuf</groupId>
  298 + <artifactId>protobuf-java</artifactId>
  299 + <version>3.3.0</version>
  300 + </dependency>
  301 +
295 </dependencies> 302 </dependencies>
296 303
297 <dependencyManagement> 304 <dependencyManagement>
src/main/java/com/bsth/Application.java
@@ -10,6 +10,8 @@ import org.springframework.context.annotation.Bean; @@ -10,6 +10,8 @@ import org.springframework.context.annotation.Bean;
10 import org.springframework.context.annotation.Primary; 10 import org.springframework.context.annotation.Primary;
11 import org.springframework.transaction.annotation.EnableTransactionManagement; 11 import org.springframework.transaction.annotation.EnableTransactionManagement;
12 12
  13 +import java.util.Calendar;
  14 +import java.util.Date;
13 import java.util.concurrent.Executors; 15 import java.util.concurrent.Executors;
14 import java.util.concurrent.ScheduledExecutorService; 16 import java.util.concurrent.ScheduledExecutorService;
15 17
src/main/java/com/bsth/XDApplication.java
@@ -125,7 +125,7 @@ public class XDApplication implements CommandLineRunner { @@ -125,7 +125,7 @@ public class XDApplication implements CommandLineRunner {
125 //检查班次误点 125 //检查班次误点
126 sexec.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); 126 sexec.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS);
127 //调度指令延迟入库 127 //调度指令延迟入库
128 - sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); 128 + sexec.scheduleWithFixedDelay(directivesPstThread, 180, 100, TimeUnit.SECONDS);
129 129
130 //运管处静态数据提交 130 //运管处静态数据提交
131 log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); 131 log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处");
src/main/java/com/bsth/controller/gps/GpsController.java
@@ -4,11 +4,15 @@ import com.bsth.data.BasicData; @@ -4,11 +4,15 @@ import com.bsth.data.BasicData;
4 import com.bsth.data.gpsdata.GpsEntity; 4 import com.bsth.data.gpsdata.GpsEntity;
5 import com.bsth.data.gpsdata.GpsRealData; 5 import com.bsth.data.gpsdata.GpsRealData;
6 import com.bsth.service.gps.GpsService; 6 import com.bsth.service.gps.GpsService;
  7 +import com.bsth.service.gps.entity.GpsSpeed;
7 import com.google.common.base.Splitter; 8 import com.google.common.base.Splitter;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.web.bind.annotation.*; 10 import org.springframework.web.bind.annotation.*;
10 11
11 import javax.servlet.http.HttpServletResponse; 12 import javax.servlet.http.HttpServletResponse;
  13 +
  14 +import java.text.ParseException;
  15 +import java.util.ArrayList;
12 import java.util.List; 16 import java.util.List;
13 import java.util.Map; 17 import java.util.Map;
14 18
@@ -179,4 +183,13 @@ public class GpsController { @@ -179,4 +183,13 @@ public class GpsController {
179 @RequestParam(defaultValue = "DESC") String direction){ 183 @RequestParam(defaultValue = "DESC") String direction){
180 return gpsService.safeDrivList(map , page, size, order, direction); 184 return gpsService.safeDrivList(map , page, size, order, direction);
181 } 185 }
  186 +
  187 + @RequestMapping(value = "/findPosition", method = RequestMethod.GET)
  188 + public List<GpsSpeed> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException {
  189 + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle);
  190 + List<GpsSpeed> listGpsSpeed = new ArrayList<GpsSpeed>();
  191 + listGpsSpeed = gpsService.findPosition(deviceid,startdate,enddate);
  192 + return listGpsSpeed;
  193 + }
  194 +
182 } 195 }
src/main/java/com/bsth/controller/sys/IntervalController.java 0 → 100644
  1 +package com.bsth.controller.sys;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import com.alibaba.fastjson.JSON;
  12 +import com.bsth.entity.sys.Interval;
  13 +import com.bsth.service.sys.IntervalService;
  14 +
  15 +@RestController
  16 +@RequestMapping("interval")
  17 +public class IntervalController {
  18 +
  19 + @Autowired
  20 + IntervalService intervalService;
  21 +
  22 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  23 + public Map<String, Object> save(@RequestParam String array){
  24 + return intervalService.saveList(JSON.parseArray(array, Interval.class));
  25 + }
  26 +}
src/main/java/com/bsth/data/Station2ParkBuffer.java
@@ -2,6 +2,7 @@ package com.bsth.data; @@ -2,6 +2,7 @@ package com.bsth.data;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.entity.realcontrol.ChildTaskPlan; 4 import com.bsth.entity.realcontrol.ChildTaskPlan;
  5 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
5 import com.bsth.entity.realcontrol.StationToPark; 6 import com.bsth.entity.realcontrol.StationToPark;
6 import com.bsth.repository.realcontrol.StationToParkRepository; 7 import com.bsth.repository.realcontrol.StationToParkRepository;
7 import com.bsth.util.Arith; 8 import com.bsth.util.Arith;
@@ -28,14 +29,13 @@ public class Station2ParkBuffer implements CommandLineRunner { @@ -28,14 +29,13 @@ public class Station2ParkBuffer implements CommandLineRunner {
28 29
29 private static ArrayListMultimap listMultimap; 30 private static ArrayListMultimap listMultimap;
30 31
31 - private static Set<StationToPark> pstBuff; 32 + private static Set<StationToPark> pstBuff = new HashSet<>();
32 33
33 static Logger log = LoggerFactory.getLogger(Station2ParkBuffer.class); 34 static Logger log = LoggerFactory.getLogger(Station2ParkBuffer.class);
34 35
35 @Override 36 @Override
36 public void run(String... strings) throws Exception { 37 public void run(String... strings) throws Exception {
37 listMultimap = ArrayListMultimap.create(); 38 listMultimap = ArrayListMultimap.create();
38 - pstBuff = new HashSet<>();  
39 Iterator<StationToPark> iterator = stationToParkRepository.findAll().iterator(); 39 Iterator<StationToPark> iterator = stationToParkRepository.findAll().iterator();
40 StationToPark stp; 40 StationToPark stp;
41 while (iterator.hasNext()) { 41 while (iterator.hasNext()) {
@@ -102,6 +102,47 @@ public class Station2ParkBuffer implements CommandLineRunner { @@ -102,6 +102,47 @@ public class Station2ParkBuffer implements CommandLineRunner {
102 } 102 }
103 } 103 }
104 104
  105 + public static void put(ScheduleRealInfo sch){
  106 + try{
  107 + String type = sch.getBcType();
  108 + String lineCode = sch.getXlBm(), sName, eName;
  109 +
  110 + if (type.equals("in")) {
  111 + sName = sch.getQdzName();
  112 + eName = sch.getZdzName();
  113 + } else if (type.equals("out")) {
  114 + eName = sch.getQdzName();
  115 + sName = sch.getZdzName();
  116 + } else
  117 + return;
  118 +
  119 + long dt = sch.getZdsjT() - sch.getDfsjT();
  120 + Float time = Float.parseFloat(String.valueOf(Arith.div(Arith.div(dt, 1000), 60)));
  121 + Float mileage = Float.parseFloat(sch.getJhlc().toString());
  122 +
  123 + StationToPark stp = get(lineCode, sName, eName);
  124 + if (stp == null) {
  125 + stp = new StationToPark();
  126 + stp.setLineCode(lineCode);
  127 + stp.setStationName(sName);
  128 + stp.setParkName(eName);
  129 + listMultimap.put(lineCode, stp);
  130 + }
  131 +
  132 + if (type.equals("in")) {
  133 + stp.setTime1(time);
  134 + stp.setMileage1(mileage);
  135 + } else {
  136 + stp.setTime2(time);
  137 + stp.setMileage2(mileage);
  138 + }
  139 +
  140 + pstBuff.add(stp);
  141 + }catch (Exception e){
  142 + log.error("", e);
  143 + }
  144 + }
  145 +
105 public static Float calcMinute(ChildTaskPlan ctask) { 146 public static Float calcMinute(ChildTaskPlan ctask) {
106 long t = 0; 147 long t = 0;
107 148
src/main/java/com/bsth/data/directive/DirectiveCreator.java
@@ -42,7 +42,7 @@ public class DirectiveCreator { @@ -42,7 +42,7 @@ public class DirectiveCreator {
42 * @return Directive60 返回类型 42 * @return Directive60 返回类型
43 * @throws 43 * @throws
44 */ 44 */
45 - public D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state) { 45 + public D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state,String lineCode) {
46 Long timestamp = System.currentTimeMillis(); 46 Long timestamp = System.currentTimeMillis();
47 47
48 Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm)); 48 Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm));
@@ -66,6 +66,7 @@ public class DirectiveCreator { @@ -66,6 +66,7 @@ public class DirectiveCreator {
66 data.setCompanyCode(company); 66 data.setCompanyCode(company);
67 data.setMsgId(msgId); 67 data.setMsgId(msgId);
68 directive.setData(data); 68 directive.setData(data);
  69 + directive.setLineCode(lineCode);
69 long serviceState; 70 long serviceState;
70 try { 71 try {
71 serviceState = Consts.SERVICE_STATE[upDown][state]; 72 serviceState = Consts.SERVICE_STATE[upDown][state];
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
@@ -47,6 +47,10 @@ public class DirectivesPstThread extends Thread { @@ -47,6 +47,10 @@ public class DirectivesPstThread extends Thread {
47 if(d60.isDispatch()){ 47 if(d60.isDispatch()){
48 ScheduleRealInfo sch = d60.getSch(); 48 ScheduleRealInfo sch = d60.getSch();
49 //如果关联的班次已经不存在了,放弃入库 49 //如果关联的班次已经不存在了,放弃入库
  50 + if(sch.isDeleted()){
  51 + logger.warn("save 指令,发现 deleted=true 的班次,id=" + sch.getId());
  52 + continue;
  53 + }
50 if(dayOfSchedule.get(sch.getId()) == null){ 54 if(dayOfSchedule.get(sch.getId()) == null){
51 logger.warn("班次:" + sch.getId() + "不存在了,调度指令放弃入库。"); 55 logger.warn("班次:" + sch.getId() + "不存在了,调度指令放弃入库。");
52 continue; 56 continue;
src/main/java/com/bsth/data/pilot80/PilotReport.java
@@ -189,7 +189,7 @@ public class PilotReport { @@ -189,7 +189,7 @@ public class PilotReport {
189 } 189 }
190 190
191 public boolean isEmpty(Double v) { 191 public boolean isEmpty(Double v) {
192 - return v == null || v.equals(0); 192 + return v == null || v.equals(0.0);
193 } 193 }
194 194
195 public void defaultReply(String nbbm, short requestCode, boolean agree) { 195 public void defaultReply(String nbbm, short requestCode, boolean agree) {
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -944,8 +944,11 @@ public class DayOfSchedule { @@ -944,8 +944,11 @@ public class DayOfSchedule {
944 ScheduleRealInfo sch = schAttrCalculator.calcCurrentExecSch(list); 944 ScheduleRealInfo sch = schAttrCalculator.calcCurrentExecSch(list);
945 carExecutePlanMap.put(nbbm, sch); 945 carExecutePlanMap.put(nbbm, sch);
946 946
947 - if(sch==null) 947 + if(sch==null){
  948 + logger.info("车辆" + nbbm + "无可执行任务,切换至非营运状态");
  949 + DirectivePushQueue.put6003(nbbm, 1, Integer.parseInt(sch.getXlDir()), null, "系统");
948 return; 950 return;
  951 + }
949 try { 952 try {
950 GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); 953 GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm));
951 if(gps != null && gps.isOnline()){ 954 if(gps != null && gps.isOnline()){
src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
@@ -36,6 +36,11 @@ public class SchedulePstThread extends Thread { @@ -36,6 +36,11 @@ public class SchedulePstThread extends Thread {
36 if (null == schedule) 36 if (null == schedule)
37 break; 37 break;
38 38
  39 + if(schedule.isDeleted()){
  40 + logger.error("save 发现 deleted=true 的班次,id: " + schedule.getId());
  41 + continue;
  42 + }
  43 +
39 try { 44 try {
40 scheduleRepository.save(schedule); 45 scheduleRepository.save(schedule);
41 } 46 }
src/main/java/com/bsth/entity/directive/D60.java
@@ -62,6 +62,11 @@ public class D60 extends Directive { @@ -62,6 +62,11 @@ public class D60 extends Directive {
62 private boolean isDispatch; 62 private boolean isDispatch;
63 63
64 /** 64 /**
  65 + * 线路编码
  66 + */
  67 + private String lineCode;
  68 +
  69 + /**
65 * 相关联的班次 70 * 相关联的班次
66 */ 71 */
67 @JsonIgnore 72 @JsonIgnore
@@ -84,6 +89,14 @@ public class D60 extends Directive { @@ -84,6 +89,14 @@ public class D60 extends Directive {
84 this.reply47Time = reply47Time; 89 this.reply47Time = reply47Time;
85 } 90 }
86 91
  92 + public String getLineCode() {
  93 + return lineCode;
  94 + }
  95 +
  96 + public void setLineCode(String lineCode) {
  97 + this.lineCode = lineCode;
  98 + }
  99 +
87 @Embeddable 100 @Embeddable
88 public static class D60Data { 101 public static class D60Data {
89 // 公司代码 102 // 公司代码
src/main/java/com/bsth/entity/excep/Speeding.java
@@ -52,6 +52,33 @@ public class Speeding { @@ -52,6 +52,33 @@ public class Speeding {
52 private Float lat; 52 private Float lat;
53 53
54 /** 54 /**
  55 + * 超速结束时的经度
  56 + */
  57 + private Float endlon;
  58 +
  59 + public Float getEndlon() {
  60 + return endlon;
  61 + }
  62 +
  63 + public void setEndlon(Float endlon) {
  64 + this.endlon = endlon;
  65 + }
  66 +
  67 + public Float getEndlat() {
  68 + return endlat;
  69 + }
  70 +
  71 + public void setEndlat(Float endlat) {
  72 + this.endlat = endlat;
  73 + }
  74 +
  75 + /**
  76 + * 超速结束时的纬度
  77 + */
  78 + private Float endlat;
  79 +
  80 +
  81 + /**
55 * 速度 82 * 速度
56 */ 83 */
57 private Float speed; 84 private Float speed;
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -204,6 +204,11 @@ public class ScheduleRealInfo { @@ -204,6 +204,11 @@ public class ScheduleRealInfo {
204 @Transient 204 @Transient
205 private int fcpSn; 205 private int fcpSn;
206 206
  207 + /** 标记班次已被删除 */
  208 + @Transient
  209 + @JsonIgnore
  210 + private boolean deleted;
  211 +
207 public boolean isDfAuto() { 212 public boolean isDfAuto() {
208 return dfAuto; 213 return dfAuto;
209 } 214 }
@@ -912,4 +917,12 @@ public class ScheduleRealInfo { @@ -912,4 +917,12 @@ public class ScheduleRealInfo {
912 public boolean _isInout(){ 917 public boolean _isInout(){
913 return this.getBcType().equals("out") || this.getBcType().equals("in"); 918 return this.getBcType().equals("out") || this.getBcType().equals("in");
914 } 919 }
  920 +
  921 + public boolean isDeleted() {
  922 + return deleted;
  923 + }
  924 +
  925 + public void setDeleted(boolean deleted) {
  926 + this.deleted = deleted;
  927 + }
915 } 928 }
src/main/java/com/bsth/entity/sys/Interval.java 0 → 100644
  1 +package com.bsth.entity.sys;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Column;
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.GeneratedValue;
  8 +import javax.persistence.GenerationType;
  9 +import javax.persistence.Id;
  10 +import javax.persistence.Table;
  11 +
  12 +
  13 +@Entity
  14 +@Table(name = "bsth_c_interval")
  15 +public class Interval {
  16 +
  17 + @Id
  18 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  19 + private Integer id;
  20 +
  21 + /** 大间隔等级 */
  22 + private String level;
  23 + /** 高峰*/
  24 + private Integer peak;
  25 + public Integer getPeak() {
  26 + return peak;
  27 + }
  28 +
  29 + public void setPeak(Integer peak) {
  30 + this.peak = peak;
  31 + }
  32 +
  33 + public Integer getTrough() {
  34 + return trough;
  35 + }
  36 +
  37 + public void setTrough(Integer trough) {
  38 + this.trough = trough;
  39 + }
  40 +
  41 +
  42 + public Integer getCreateBy() {
  43 + return createBy;
  44 + }
  45 +
  46 + public void setCreateBy(Integer createBy) {
  47 + this.createBy = createBy;
  48 + }
  49 +
  50 + public Date getCreateDate() {
  51 + return createDate;
  52 + }
  53 +
  54 + public void setCreateDate(Date createDate) {
  55 + this.createDate = createDate;
  56 + }
  57 +
  58 + public Integer getUpdateBy() {
  59 + return updateBy;
  60 + }
  61 +
  62 + public void setUpdateBy(Integer updateBy) {
  63 + this.updateBy = updateBy;
  64 + }
  65 +
  66 + public Date getUpdateDate() {
  67 + return updateDate;
  68 + }
  69 +
  70 + public void setUpdateDate(Date updateDate) {
  71 + this.updateDate = updateDate;
  72 + }
  73 +
  74 + /** 低谷 */
  75 + private Integer trough;
  76 +
  77 + @Column(name = "create_by")
  78 + private Integer createBy;
  79 +
  80 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  81 + private Date createDate;
  82 +
  83 + @Column(name = "update_by")
  84 + private Integer updateBy;
  85 +
  86 + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  87 + private Date updateDate;
  88 +
  89 + public Integer getId() {
  90 + return id;
  91 + }
  92 +
  93 + public void setId(Integer id) {
  94 + this.id = id;
  95 + }
  96 +
  97 + public String getLevel() {
  98 + return level;
  99 + }
  100 +
  101 + public void setLevel(String level) {
  102 + this.level = level;
  103 + }
  104 +
  105 +}
src/main/java/com/bsth/repository/sys/IntervalRepository.java 0 → 100644
  1 +package com.bsth.repository.sys;
  2 +
  3 +
  4 +import org.springframework.stereotype.Repository;
  5 +import com.bsth.entity.sys.Interval;
  6 +import com.bsth.repository.BaseRepository;
  7 +
  8 +@Repository
  9 +public interface IntervalRepository extends BaseRepository<Interval, Integer> {
  10 +
  11 +}
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
@@ -119,6 +119,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -119,6 +119,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
119 119
120 d60 = new DirectiveCreator().createD60_01(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir()) 120 d60 = new DirectiveCreator().createD60_01(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir())
121 , 0, new Date(alarmTime)); 121 , 0, new Date(alarmTime));
  122 +
  123 + d60.setLineCode(sch.getXlBm());
122 } catch (Exception e) { 124 } catch (Exception e) {
123 logger.error("生成调度指令时出现异常", e); 125 logger.error("生成调度指令时出现异常", e);
124 return -1; 126 return -1;
@@ -190,7 +192,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -190,7 +192,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
190 logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); 192 logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown);
191 193
192 String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); 194 String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运");
193 - D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state); 195 + D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state, null);
194 196
195 if (null == d60) 197 if (null == d60)
196 return -1; 198 return -1;
@@ -257,6 +259,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -257,6 +259,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
257 public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) { 259 public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) {
258 260
259 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); 261 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  262 + String lineCode = null;
260 if (null == deviceId) { 263 if (null == deviceId) {
261 logger.error("没有设备号对照的车辆:" + nbbm); 264 logger.error("没有设备号对照的车辆:" + nbbm);
262 return null; 265 return null;
@@ -281,13 +284,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -281,13 +284,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
281 } else { 284 } else {
282 upDown = gpsData.getUpDown(); 285 upDown = gpsData.getUpDown();
283 state = gpsData.getState(); 286 state = gpsData.getState();
  287 + lineCode = gpsData.getLineId();
284 } 288 }
285 } else { 289 } else {
286 upDown = Byte.parseByte(sch.getXlDir()); 290 upDown = Byte.parseByte(sch.getXlDir());
287 state = 0; 291 state = 0;
288 } 292 }
289 293
290 - return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state); 294 + return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state, lineCode);
291 } 295 }
292 296
293 @Override 297 @Override
src/main/java/com/bsth/service/excep/impl/SpeedingServiceImpl.java
@@ -9,6 +9,7 @@ import java.text.SimpleDateFormat; @@ -9,6 +9,7 @@ import java.text.SimpleDateFormat;
9 import java.util.ArrayList; 9 import java.util.ArrayList;
10 import java.util.Date; 10 import java.util.Date;
11 import java.util.HashMap; 11 import java.util.HashMap;
  12 +import java.util.Iterator;
12 import java.util.List; 13 import java.util.List;
13 import java.util.Map; 14 import java.util.Map;
14 15
@@ -24,6 +25,8 @@ import com.bsth.service.excep.SpeedingService; @@ -24,6 +25,8 @@ import com.bsth.service.excep.SpeedingService;
24 import com.bsth.util.EchartConver; 25 import com.bsth.util.EchartConver;
25 import com.bsth.util.PageHelper; 26 import com.bsth.util.PageHelper;
26 import com.bsth.util.PageObject; 27 import com.bsth.util.PageObject;
  28 +import com.bsth.util.TransGPS;
  29 +import com.bsth.util.TransGPS.Location;
27 import com.bsth.util.db.DBUtils_MS; 30 import com.bsth.util.db.DBUtils_MS;
28 import com.github.abel533.echarts.Option; 31 import com.github.abel533.echarts.Option;
29 import com.google.gson.Gson; 32 import com.google.gson.Gson;
@@ -39,7 +42,7 @@ public class SpeedingServiceImpl implements SpeedingService { @@ -39,7 +42,7 @@ public class SpeedingServiceImpl implements SpeedingService {
39 ResultSet rs = null; 42 ResultSet rs = null;
40 int page=Integer.parseInt(map.get("page").toString()); 43 int page=Integer.parseInt(map.get("page").toString());
41 List<Speeding> list=new ArrayList<Speeding>(); 44 List<Speeding> list=new ArrayList<Speeding>();
42 - String sql="select * from bsth_c_speeding where 1=1 "; 45 + String sql="select * from bsth_c_speeding where speed > 60 ";
43 Object line=map.get("line"); 46 Object line=map.get("line");
44 Object nbbm=map.get("nbbm"); 47 Object nbbm=map.get("nbbm");
45 Object updown=map.get("updown"); 48 Object updown=map.get("updown");
@@ -83,7 +86,6 @@ public class SpeedingServiceImpl implements SpeedingService { @@ -83,7 +86,6 @@ public class SpeedingServiceImpl implements SpeedingService {
83 86
84 } 87 }
85 88
86 -  
87 /*sql +=" order by id limit ?,?";*/ 89 /*sql +=" order by id limit ?,?";*/
88 90
89 91
@@ -104,17 +106,23 @@ public class SpeedingServiceImpl implements SpeedingService { @@ -104,17 +106,23 @@ public class SpeedingServiceImpl implements SpeedingService {
104 } 106 }
105 107
106 static List<Speeding> resultSet2Set(ResultSet rs) throws SQLException{ 108 static List<Speeding> resultSet2Set(ResultSet rs) throws SQLException{
107 - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); 109 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
108 List<Speeding> list=new ArrayList<Speeding>(); 110 List<Speeding> list=new ArrayList<Speeding>();
109 Speeding speeding; 111 Speeding speeding;
  112 + Float lon, lat;
  113 + Location location;
110 while(rs.next()){ 114 while(rs.next()){
  115 + lon = rs.getFloat("lon");
  116 + lat = rs.getFloat("lat");
  117 + location = TransGPS.LocationMake(lon, lat);
  118 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location));
111 speeding=new Speeding(); 119 speeding=new Speeding();
112 speeding.setId(Integer.valueOf(rs.getObject("id").toString())); 120 speeding.setId(Integer.valueOf(rs.getObject("id").toString()));
113 - speeding.setLat(Float.valueOf(rs.getObject("lat").toString())); 121 + speeding.setLon((float)location.getLng());
  122 + speeding.setLat((float)location.getLat());
114 speeding.setLine(Integer.valueOf(rs.getObject("line").toString())); 123 speeding.setLine(Integer.valueOf(rs.getObject("line").toString()));
115 //run 时注解 124 //run 时注解
116 speeding.setLineName(BasicData.lineCode2NameMap.get(speeding.getLine().toString())); 125 speeding.setLineName(BasicData.lineCode2NameMap.get(speeding.getLine().toString()));
117 - speeding.setLon(Float.valueOf(rs.getObject("lon").toString()));  
118 speeding.setSpeed(Float.valueOf(rs.getObject("speed").toString())); 126 speeding.setSpeed(Float.valueOf(rs.getObject("speed").toString()));
119 speeding.setTimestamp((Long.valueOf(rs.getObject("timestamp").toString()))); 127 speeding.setTimestamp((Long.valueOf(rs.getObject("timestamp").toString())));
120 speeding.setTimestampDate(sdf.format(new Date(speeding.getTimestamp()))); 128 speeding.setTimestampDate(sdf.format(new Date(speeding.getTimestamp())));
@@ -127,14 +135,12 @@ public class SpeedingServiceImpl implements SpeedingService { @@ -127,14 +135,12 @@ public class SpeedingServiceImpl implements SpeedingService {
127 135
128 @Override 136 @Override
129 public PageObject<Speeding> Pagequery(Map<String, Object> map) { 137 public PageObject<Speeding> Pagequery(Map<String, Object> map) {
130 - String sql="select count(*) record from bsth_c_speeding where 1=1 "; 138 +/* String sql="select count(*) record from bsth_c_speeding where 1=1 ";
131 Object line=map.get("line"); 139 Object line=map.get("line");
132 Object nbbm=map.get("nbbm"); 140 Object nbbm=map.get("nbbm");
133 Object updown=map.get("updown"); 141 Object updown=map.get("updown");
134 Object startDate=map.get("startDate"); 142 Object startDate=map.get("startDate");
135 Object endDate=map.get("endDate"); 143 Object endDate=map.get("endDate");
136 - //时间转换  
137 - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
138 144
139 if(line!=null){ 145 if(line!=null){
140 sql +=" and line like'%"+line.toString().trim()+"%'"; 146 sql +=" and line like'%"+line.toString().trim()+"%'";
@@ -186,14 +192,17 @@ public class SpeedingServiceImpl implements SpeedingService { @@ -186,14 +192,17 @@ public class SpeedingServiceImpl implements SpeedingService {
186 e.printStackTrace(); 192 e.printStackTrace();
187 }finally { 193 }finally {
188 DBUtils_MS.close(rs, ps, conn); 194 DBUtils_MS.close(rs, ps, conn);
189 - } 195 + }*/
190 196
  197 + //时间转换
  198 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
191 List<Speeding> list=findAll(map); 199 List<Speeding> list=findAll(map);
192 List<Speeding> listResult = new ArrayList<Speeding>(); 200 List<Speeding> listResult = new ArrayList<Speeding>();
193 int curPage;//页码 201 int curPage;//页码
194 int pageData;//每页的记录条数 202 int pageData;//每页的记录条数
195 int start;//起始数据下标 203 int start;//起始数据下标
196 int totalPage;//总页数 204 int totalPage;//总页数
  205 + int totalData = 0;
197 if(list.size()>1){ 206 if(list.size()>1){
198 Speeding speedingNow;//下标为i的车 207 Speeding speedingNow;//下标为i的车
199 Speeding speedingLast;//下标为i-1的车 208 Speeding speedingLast;//下标为i-1的车
@@ -206,11 +215,20 @@ public class SpeedingServiceImpl implements SpeedingService { @@ -206,11 +215,20 @@ public class SpeedingServiceImpl implements SpeedingService {
206 strLast = speedingLast.getVehicle()+speedingLast.getLine()+speedingLast.getUpDown(); 215 strLast = speedingLast.getVehicle()+speedingLast.getLine()+speedingLast.getUpDown();
207 //同一车辆同一线路同一方向并且该记录的超速的开始时间减去上一条超速记录的结束时间小于等于10s,证明该车超速。//PS:祛除数据库中的重复发送数据 216 //同一车辆同一线路同一方向并且该记录的超速的开始时间减去上一条超速记录的结束时间小于等于10s,证明该车超速。//PS:祛除数据库中的重复发送数据
208 if(strNow.equals(strLast) && Math.abs(speedingNow.getTimestamp()-speedingLast.getTimestamp())<=10*1000 && (speedingNow.getTimestamp()-speedingLast.getTimestamp()!=0)){ 217 if(strNow.equals(strLast) && Math.abs(speedingNow.getTimestamp()-speedingLast.getTimestamp())<=10*1000 && (speedingNow.getTimestamp()-speedingLast.getTimestamp()!=0)){
209 - speedingLast.setEndtimestamp(speedingNow.getTimestamp()); 218 + speedingLast.setEndtimestamp(speedingNow.getTimestamp());//设置结束时间时间戳
210 speedingLast.setEndtimestampDate(sdf.format(new Date(speedingNow.getTimestamp())));//设置结束时间 219 speedingLast.setEndtimestampDate(sdf.format(new Date(speedingNow.getTimestamp())));//设置结束时间
  220 + speedingLast.setEndlon(speedingNow.getLon());//设置结束时的经度
  221 + speedingLast.setEndlat(speedingNow.getLat());//设置结束时的纬度
211 listResult.add(speedingLast); 222 listResult.add(speedingLast);
212 } 223 }
213 } 224 }
  225 + Iterator<Speeding> speedIt = listResult.iterator();
  226 + while(speedIt.hasNext()){
  227 + Speeding speeding = speedIt.next();
  228 + if(speeding.getEndtimestamp()-speeding.getTimestamp()<=1000){
  229 + speedIt.remove();
  230 + }
  231 + }
214 232
215 totalData = listResult.size();//总记录条数。 233 totalData = listResult.size();//总记录条数。
216 if(map.get("curPage") == null || map.get("curPage").equals("0")){ 234 if(map.get("curPage") == null || map.get("curPage").equals("0")){
src/main/java/com/bsth/service/gps/GpsService.java
1 package com.bsth.service.gps; 1 package com.bsth.service.gps;
2 2
  3 +import com.bsth.data.gpsdata.GpsEntity;
3 import com.bsth.service.gps.entity.GpsOutbound_DTO; 4 import com.bsth.service.gps.entity.GpsOutbound_DTO;
  5 +import com.bsth.service.gps.entity.GpsSpeed;
4 import com.bsth.service.gps.entity.GpsSpeed_DTO; 6 import com.bsth.service.gps.entity.GpsSpeed_DTO;
5 7
6 import javax.servlet.http.HttpServletResponse; 8 import javax.servlet.http.HttpServletResponse;
  9 +
  10 +import java.text.ParseException;
7 import java.util.List; 11 import java.util.List;
8 import java.util.Map; 12 import java.util.Map;
9 13
@@ -38,4 +42,7 @@ public interface GpsService { @@ -38,4 +42,7 @@ public interface GpsService {
38 void abnormalExcel(String nbbm, long st, long et, HttpServletResponse resp); 42 void abnormalExcel(String nbbm, long st, long et, HttpServletResponse resp);
39 43
40 void arrivalExcel(String nbbm, long st, long et, HttpServletResponse resp); 44 void arrivalExcel(String nbbm, long st, long et, HttpServletResponse resp);
  45 +
  46 + List<GpsSpeed> findPosition(String deviceid, String startdate,
  47 + String enddate) throws ParseException;
41 } 48 }
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -45,6 +45,8 @@ import java.sql.Connection; @@ -45,6 +45,8 @@ import java.sql.Connection;
45 import java.sql.PreparedStatement; 45 import java.sql.PreparedStatement;
46 import java.sql.ResultSet; 46 import java.sql.ResultSet;
47 import java.text.DecimalFormat; 47 import java.text.DecimalFormat;
  48 +import java.text.ParseException;
  49 +import java.text.SimpleDateFormat;
48 import java.util.*; 50 import java.util.*;
49 51
50 @Service 52 @Service
@@ -981,4 +983,57 @@ public class GpsServiceImpl implements GpsService { @@ -981,4 +983,57 @@ public class GpsServiceImpl implements GpsService {
981 } 983 }
982 return true; 984 return true;
983 } 985 }
  986 +
  987 + @Override
  988 + public List<GpsSpeed> findPosition(String deviceid, String startdate,
  989 + String enddate) throws ParseException{
  990 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  991 + Calendar c = Calendar.getInstance();
  992 + Date date = sdf.parse(startdate);
  993 + c.setTime(date);
  994 + int daysYear = c.get(Calendar.DAY_OF_YEAR);//获取当前是今年的第几天。
  995 +
  996 + long startTime = sdf.parse(startdate).getTime();
  997 + long endTime = sdf.parse(enddate).getTime();
  998 +
  999 + String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,speed_gps from bsth_c_gps_info where days_year=? and device_id=? and ts >= ? and ts <= ?" +
  1000 + " ORDER BY TS ";
  1001 + Connection conn = null;
  1002 + PreparedStatement ps = null;
  1003 + ResultSet rs = null;
  1004 + List<GpsSpeed> listResult = new ArrayList<GpsSpeed>();
  1005 + GpsSpeed gpsSpeed = null;
  1006 + try {
  1007 + conn = DBUtils_MS.getConnection();
  1008 + ps = conn.prepareStatement(sql);
  1009 + ps.setInt(1, daysYear);
  1010 + ps.setString(2, deviceid);
  1011 + ps.setLong(3,startTime);
  1012 + ps.setLong(4,endTime);
  1013 + rs = ps.executeQuery();
  1014 + Float lon, lat;
  1015 + Location location;
  1016 + while (rs.next()) {
  1017 + gpsSpeed = new GpsSpeed();
  1018 + // to 百度坐标
  1019 + lon = rs.getFloat("LON");
  1020 + lat = rs.getFloat("LAT");
  1021 + location = TransGPS.LocationMake(lon, lat);
  1022 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location));
  1023 + gpsSpeed.setVehicle(rs.getString("device_id"));
  1024 + gpsSpeed.setLon((float)location.getLng());
  1025 + gpsSpeed.setLat((float)location.getLat());
  1026 + gpsSpeed.setSpeed(rs.getFloat("speed_gps"));
  1027 + gpsSpeed.setTimestamp(rs.getLong("TS"));
  1028 + // 上下行
  1029 + listResult.add(gpsSpeed);
  1030 + }
  1031 + } catch (Exception e) {
  1032 + e.printStackTrace();
  1033 + } finally {
  1034 + DBUtils_MS.close(rs, ps, conn);
  1035 + }
  1036 + return listResult;
  1037 +
  1038 + }
984 } 1039 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -10,6 +10,7 @@ import com.bsth.controller.realcontrol.dto.DfsjChange; @@ -10,6 +10,7 @@ import com.bsth.controller.realcontrol.dto.DfsjChange;
10 import com.bsth.controller.realcontrol.dto.LpData; 10 import com.bsth.controller.realcontrol.dto.LpData;
11 import com.bsth.data.BasicData; 11 import com.bsth.data.BasicData;
12 import com.bsth.data.LineConfigData; 12 import com.bsth.data.LineConfigData;
  13 +import com.bsth.data.Station2ParkBuffer;
13 import com.bsth.data.schedule.DayOfSchedule; 14 import com.bsth.data.schedule.DayOfSchedule;
14 import com.bsth.data.schedule.SchAttrCalculator; 15 import com.bsth.data.schedule.SchAttrCalculator;
15 import com.bsth.data.schedule.ScheduleComparator; 16 import com.bsth.data.schedule.ScheduleComparator;
@@ -590,6 +591,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -590,6 +591,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
590 //重新计算车辆当前执行班次 591 //重新计算车辆当前执行班次
591 dayOfSchedule.reCalcExecPlan(t.getClZbh()); 592 dayOfSchedule.reCalcExecPlan(t.getClZbh());
592 593
  594 + //记录站到场历时数据
  595 + Station2ParkBuffer.put(t);
593 596
594 rs.put("ts", ts); 597 rs.put("ts", ts);
595 rs.put("t", t); 598 rs.put("t", t);
@@ -640,8 +643,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -640,8 +643,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
640 Map<String, Object> rs = new HashMap<>(); 643 Map<String, Object> rs = new HashMap<>();
641 rs.put("status", ResponseCode.ERROR); 644 rs.put("status", ResponseCode.ERROR);
642 645
  646 + ScheduleRealInfo sch = null;
643 try { 647 try {
644 - ScheduleRealInfo sch = dayOfSchedule.get(id); 648 + sch = dayOfSchedule.get(id);
645 if (sch == null) { 649 if (sch == null) {
646 rs.put("msg", "无效的id号"); 650 rs.put("msg", "无效的id号");
647 return rs; 651 return rs;
@@ -652,6 +656,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -652,6 +656,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
652 return rs; 656 return rs;
653 } 657 }
654 658
  659 + sch.setDeleted(true);
655 //解除和调度指令的外键约束 660 //解除和调度指令的外键约束
656 jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); 661 jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id);
657 662
@@ -671,9 +676,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -671,9 +676,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
671 rs.put("ts", ts); 676 rs.put("ts", ts);
672 rs.put("delete", sch); 677 rs.put("delete", sch);
673 } 678 }
  679 + else
  680 + sch.setDeleted(false);
674 }catch (Exception e){ 681 }catch (Exception e){
675 logger.error("", e); 682 logger.error("", e);
676 rs.put("msg", e.getMessage()); 683 rs.put("msg", e.getMessage());
  684 + sch.setDeleted(false);
677 } 685 }
678 686
679 return rs; 687 return rs;
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
@@ -157,7 +157,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -157,7 +157,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
157 } else { 157 } else {
158 Cell[] cells = sheet.getRow(0); // 获取第一行数据列 158 Cell[] cells = sheet.getRow(0); // 获取第一行数据列
159 for (int i = 0; i < cells.length; i++) { 159 for (int i = 0; i < cells.length; i++) {
160 - String cell_con = cells[i].getContents(); 160 + String cell_con = StringUtils.trimToEmpty(cells[i].getContents()); // trimToEmpty
161 161
162 if (StringUtils.isEmpty(cell_con)) { 162 if (StringUtils.isEmpty(cell_con)) {
163 throw new Exception(String.format("第1行,第%d列数据不能为空", i + 1)); 163 throw new Exception(String.format("第1行,第%d列数据不能为空", i + 1));
@@ -199,7 +199,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -199,7 +199,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
199 Map<String, Integer> gbindexmap = new HashMap<>(); // 记录每个路牌在第几行 199 Map<String, Integer> gbindexmap = new HashMap<>(); // 记录每个路牌在第几行
200 for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据 200 for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
201 Cell bcell = sheet.getRow(i)[0]; // 获取第1列 201 Cell bcell = sheet.getRow(i)[0]; // 获取第1列
202 - String bcell_con = bcell.getContents(); 202 + String bcell_con = StringUtils.trimToEmpty(bcell.getContents()); // trimToEmpty
203 if (StringUtils.isEmpty(bcell_con)) { 203 if (StringUtils.isEmpty(bcell_con)) {
204 throw new Exception(String.format("第%d行,第1列路牌无数据", i + 1)); 204 throw new Exception(String.format("第%d行,第1列路牌无数据", i + 1));
205 } else if (gbindexmap.get(bcell_con.trim()) != null) { 205 } else if (gbindexmap.get(bcell_con.trim()) != null) {
@@ -233,7 +233,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -233,7 +233,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
233 for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据 233 for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
234 Cell[] bcells = sheet.getRow(i); 234 Cell[] bcells = sheet.getRow(i);
235 for (int j = 1; j < bcells.length; j++) { // 从第2列开始 235 for (int j = 1; j < bcells.length; j++) { // 从第2列开始
236 - String bcell_con = bcells[j].getContents(); 236 + String bcell_con = StringUtils.trimToEmpty(bcells[j].getContents()); // trimToEmpty
237 if (StringUtils.isNotEmpty(bcell_con)) { 237 if (StringUtils.isNotEmpty(bcell_con)) {
238 Matcher m1 = p1.matcher(bcell_con.trim()); 238 Matcher m1 = p1.matcher(bcell_con.trim());
239 Matcher m2 = p2.matcher(bcell_con.trim()); 239 Matcher m2 = p2.matcher(bcell_con.trim());
src/main/java/com/bsth/service/sys/IntervalService.java 0 → 100644
  1 +package com.bsth.service.sys;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.sys.Interval;
  7 +import com.bsth.service.BaseService;
  8 +
  9 +public interface IntervalService extends BaseService<Interval, Integer> {
  10 +
  11 + Map<String, Object> saveList(List<Interval> parseArray);
  12 +
  13 +}
src/main/java/com/bsth/service/sys/impl/IntervalServiceImpl.java 0 → 100644
  1 +package com.bsth.service.sys.impl;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +import com.bsth.common.ResponseCode;
  13 +import com.bsth.entity.sys.Interval;
  14 +import com.bsth.repository.sys.IntervalRepository;
  15 +import com.bsth.service.impl.BaseServiceImpl;
  16 +import com.bsth.service.sys.IntervalService;
  17 +
  18 +@Service
  19 +public class IntervalServiceImpl extends BaseServiceImpl<Interval, Integer> implements IntervalService {
  20 +
  21 + @Autowired
  22 + IntervalRepository intervalRepository;
  23 +
  24 + Logger logger = LoggerFactory.getLogger(this.getClass());
  25 +
  26 + @Override
  27 + public Map<String, Object> saveList(List<Interval> parseArray) {
  28 + Map<String, Object> map = new HashMap<>();
  29 + try{
  30 + intervalRepository.save(parseArray);
  31 + map.put("status", ResponseCode.SUCCESS);
  32 + }catch(Exception e){
  33 + map.put("status", ResponseCode.ERROR);
  34 + logger.error("", e);
  35 + }
  36 + return map;
  37 + }
  38 +
  39 +}
src/main/resources/static/pages/base/interval/list.html 0 → 100644
  1 +<!-- <link href="/pages/base/line/css/animate.css" rel="stylesheet" type="text/css" />
  2 +<link href="/pages/base/line/css/tipso.css" rel="stylesheet" type="text/css" /> -->
  3 +<!-- 片段标题 START -->
  4 +<div class="page-head">
  5 + <div class="page-title">
  6 + <h1>大间隔信息</h1>
  7 + </div>
  8 +</div>
  9 +<!-- 片段标题 END -->
  10 +
  11 +<!-- 线路信息导航栏组件 START -->
  12 +<ul class="page-breadcrumb breadcrumb">
  13 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  15 + <li><span class="active">大间隔信息</span></li>
  16 +</ul>
  17 +<!-- 线路信息导航栏组件 END -->
  18 +
  19 +<div class="row">
  20 + <div class="col-md-12">
  21 + <div class="portlet light porttlet-fit bordered">
  22 + <div class="portlet-title">
  23 + <div class="tipso-animation">
  24 + </div>
  25 + <div class="caption">
  26 + <i class="fa fa-info-circle font-dark"></i>
  27 + <span class="caption-subject font-dark sbold uppercase">线路信息</span>
  28 + </div>
  29 + <div class="actions">
  30 + <div class="btn-group btn-group-devided" data-toggle="buttons">
  31 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加线路</a>
  32 + </div>
  33 + </div>
  34 + </div>
  35 + <div class="portlet-body">
  36 + <div class="table-container" style="margin-top: 10px">
  37 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_line">
  38 + <thead>
  39 + <tr role="row" class="heading">
  40 + <th >#</th>
  41 + <th >序号</th>
  42 + <th >大间隔ID</th>
  43 + <th >大间隔等级</th>
  44 + <th >高峰间隔时间</th>
  45 + <th >低谷间隔时间</th>
  46 + <th >操作</th>
  47 + </tr>
  48 + <tr role="row" class="filter">
  49 + <td>#</td>
  50 + <td></td>
  51 + <td></td>
  52 + <td></td>
  53 + <td></td>
  54 + <td></td>
  55 + <td>
  56 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
  57 + <i class="fa fa-search"></i> 搜索
  58 + </button>
  59 +
  60 + <button class="btn btn-sm red btn-outline filter-cancel" id="notification-trigger">
  61 + <i class="fa fa-times"></i> 重置
  62 + </button>
  63 + </td>
  64 + </tr>
  65 + </thead>
  66 + <tbody></tbody>
  67 + </table>
  68 + <div style="text-align: right;">
  69 + <ul id="pagination" class="pagination"></ul>
  70 + </div>
  71 + </div>
  72 + </div>
  73 + </div>
  74 + </div>
  75 +</div>
  76 +<script type="text/html" id="line_list_temp">
  77 + {{each list as obj i }}
  78 + <tr>
  79 + <td style="vertical-align: middle;">
  80 + <input type="checkbox" class="group-checkable icheck" value="{{obj.name}}" id="{{obj.id}}" data-id="{{obj.id}}" data-lineName="{{obj.name}}">
  81 + </td>
  82 + <td style="vertical-align: middle;">
  83 + {{(list.page*10)+(i+1)}}
  84 + </td>
  85 + <td>
  86 + {{obj.lineCode}}
  87 + </td>
  88 + <td>
  89 + {{obj.name}}
  90 + </td>
  91 + <td>
  92 + {{if obj.nature == 'lj'}}
  93 + 路救
  94 + {{else if obj.nature == 'bc'}}
  95 + 备车
  96 + {{else if obj.nature == 'dbc'}}
  97 + 定班车
  98 + {{else if obj.nature == 'yxl'}}
  99 + 夜宵路
  100 + {{else if obj.nature == 'cgxl'}}
  101 + 常规线路
  102 + {{else if obj.nature == 'gjxl'}}
  103 + 过江线路
  104 + {{else if obj.nature == 'csbs'}}
  105 + 穿梭巴士
  106 + {{else if obj.nature == 'tyxl'}}
  107 + 特约线路
  108 + {{else if obj.nature == 'qt'}}
  109 + 其他
  110 + {{else if obj.nature == 'cctxl'}}
  111 + 村村通线路
  112 + {{/if}}
  113 + </td>
  114 + <td>
  115 + {{if obj.level == '1'}}
  116 + 一级线路
  117 + {{else if obj.level == '2'}}
  118 + 二级线路
  119 + {{else if obj.level == '0'}}
  120 + 未知等级
  121 + {{/if}}
  122 + </td>
  123 + <td>
  124 + {{obj.shanghaiLinecode}}
  125 + </td>
  126 + <td>
  127 + {{if obj.destroy == 1}}
  128 + <span style="font-weight: bold; color: red; padding: 5px; background-color: #FFE4E1; margin: 5px; font-size: 9px;border-radius: 4px;">撤销</span>
  129 + {{else if obj.destroy == 0}}
  130 + <span style="font-weight: bold; color: #07824e; padding: 5px; background-color: #FFE4E1; margin: 5px; font-size: 9px;border-radius: 4px;">运营</span>
  131 + {{/if}}
  132 + </td>
  133 + <td>
  134 + <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a>
  135 + </td>
  136 + <td>
  137 + <a href="/pages/base/stationroute/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a>
  138 + </td>
  139 + <td>
  140 + <a href="details.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a>
  141 + <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a>
  142 + </td>
  143 + </tr>
  144 + {{/each}}
  145 + {{if list.length == 0}}
  146 + <tr>
  147 + <td colspan=13><h6 class="muted">没有找到相关数据</h6></td>
  148 + </tr>
  149 + {{/if}}
  150 +</script>
  151 +<!-- <script src="/pages/base/line/js/tipso.js"></script> -->
  152 +<!-- 线路信息片段JS模块 -->
  153 +<script src="/pages/base/line/js/line-list-table.js"></script>
0 \ No newline at end of file 154 \ No newline at end of file
src/main/resources/static/pages/excep/js/outboundmap-load.js
@@ -8,7 +8,6 @@ $(function(){ @@ -8,7 +8,6 @@ $(function(){
8 8
9 // 获取参数线路ID 9 // 获取参数线路ID
10 var no = $.url().param('no'); 10 var no = $.url().param('no');
11 - var up = $.url().param('up');  
12 var paramArr = new Array(); 11 var paramArr = new Array();
13 paramArr = no.split(",");// 在每个逗号(,)处进行分解。 12 paramArr = no.split(",");// 在每个逗号(,)处进行分解。
14 /*paramArr[0]:id 13 /*paramArr[0]:id
src/main/resources/static/pages/excep/js/speeding-map.js 0 → 100644
  1 +/**
  2 + * 百度地图
  3 + *
  4 + * - - - - - -》init:地图初始化
  5 + *
  6 + * - - - - - -》lineInfoPanl:从百度地图抓去站点与路段数据
  7 + *
  8 + * - - - - - -》getDistanceAndDuration:获取距离与时间
  9 + *
  10 + * - - - - - -》pointsPolygon:地图画多边行
  11 + *
  12 + * - - - - - -》pointsCircle:画圆
  13 + *
  14 + * - - - - - -》localSearchFromAdreesToPoint:根据地理名称获取百度经纬度坐标
  15 + *
  16 + * - - - - - -》drawingUpline:在地图上画出上行线路走向
  17 + *
  18 + * - - - - - -》stationsNameToPoints:站点名称获取百度坐标(手动规划)
  19 + *
  20 + * - - - - - -》getDistanceAndTotime:根据坐标点获取两点之间的时间与距离(手动规划)
  21 + *
  22 + * - - - - - -》getSectionListPlonly:根据坐标点获取两点之间的折线路段(手动规划)
  23 + */
  24 +
  25 +var SpeedingMap = function () {
  26 +
  27 + /** WorldsBMap 全局变量定义 mapBValue:地图对象;polygon:多边形;polyUpline:走向折线;circle:圆 *//*
  28 + var mapBValue = '';polygon='',polyUpline='',circle='',iseditStatus = false;*/
  29 +
  30 + var Bmap = {
  31 +
  32 + init : function() {
  33 + // 设置中心点,
  34 + var CENTER_POINT = {lng : 121.528733,lat : 31.237425};
  35 +
  36 + // 百度API Key
  37 + var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT';
  38 +
  39 + // 初始化百度地图
  40 + mapBValue = new BMap.Map("speedingMap");
  41 +
  42 + //中心点和缩放级别
  43 + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);
  44 +
  45 + //启用地图拖拽事件,默认启用(可不写)
  46 + mapBValue.enableDragging();
  47 +
  48 + //启用地图滚轮放大缩小
  49 + mapBValue.enableScrollWheelZoom();
  50 +
  51 + //禁用鼠标双击放大
  52 + mapBValue.disableDoubleClickZoom();
  53 +
  54 + //启用键盘上下左右键移动地图
  55 + mapBValue.enableKeyboard();
  56 +
  57 + return mapBValue;
  58 + },
  59 +
  60 + /** 获取地图对象 @return 地图对象map */
  61 + getmapBValue : function() {
  62 +
  63 + return mapBValue;
  64 +
  65 + },
  66 +
  67 + /* drawTravelRoute:function(data){
  68 + var driving = Bmap.DrivingRoute(map, {renderOptions:{map: map}})
  69 +
  70 + }*/
  71 +
  72 + }
  73 +
  74 + return Bmap;
  75 +
  76 +}();
0 \ No newline at end of file 77 \ No newline at end of file
src/main/resources/static/pages/excep/speedingListmh.html
@@ -146,7 +146,10 @@ @@ -146,7 +146,10 @@
146 {{(obj.endtimestamp-obj.timestamp)/1000}}秒 146 {{(obj.endtimestamp-obj.timestamp)/1000}}秒
147 </td> 147 </td>
148 <td> 148 <td>
149 - <a class="btn default blue-stripe btn-sm lookTrajectory" data-pjax> 149 + <a class="btn default blue-stripe btn-sm lookTrajectory" data-vehicle ="{{obj.vehicle}}"
  150 + data-startdate="{{obj.timestampDate}}" data-enddate="{{obj.endtimestampDate}}"
  151 + data-lon="{{obj.lon}}" data-lat="{{obj.lat}}"
  152 + data-endlon="{{obj.endlon}}" data-endlat="{{obj.endlat}}" >
150 查看轨迹 153 查看轨迹
151 </a> 154 </a>
152 </td> 155 </td>
@@ -162,6 +165,8 @@ @@ -162,6 +165,8 @@
162 {{/if}} 165 {{/if}}
163 </script> 166 </script>
164 167
  168 +<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script>
  169 +
165 <script> 170 <script>
166 $(function(){ 171 $(function(){
167 var page = 0, initPagination; 172 var page = 0, initPagination;
@@ -185,7 +190,20 @@ $(function(){ @@ -185,7 +190,20 @@ $(function(){
185 var parameter = new Object(); 190 var parameter = new Object();
186 parameter.endDate = $("input[name='endDate']")[0].value; 191 parameter.endDate = $("input[name='endDate']")[0].value;
187 parameter.startDate = $("input[name='startDate']")[0].value; 192 parameter.startDate = $("input[name='startDate']")[0].value;
188 - jsDoQuery(parameter,true); 193 +
  194 + //搜索线路
  195 + $.get('/basic/lineCode2Name',function(result){
  196 + var data=[];
  197 + data.push({id: " ", text: "全部线路"});
  198 + for(var code in result){
  199 + data.push({id: code, text: result[code]});
  200 + }
  201 + initPinYinSelect2($('#line'),data,function(ldmcSelector) {
  202 + ldmcSelector.select2("val",data[1].id);//因为数据量太大,所以默认一条线路作为查询参数
  203 + });
  204 + parameter.line = data[1].id;
  205 + jsDoQuery(parameter,true);
  206 + });
189 207
190 //时间戳转换为年月日 208 //时间戳转换为年月日
191 function timeToData(time){ 209 function timeToData(time){
@@ -223,7 +241,7 @@ $(function(){ @@ -223,7 +241,7 @@ $(function(){
223 /* 241 /*
224 * 获取数据 p: 要提交的参数, pagination: 是否重新分页 242 * 获取数据 p: 要提交的参数, pagination: 是否重新分页
225 */ 243 */
226 - function jsDoQuery(p, pagination){ 244 + function jsDoQuery(p, pagination){
227 var params = {}; 245 var params = {};
228 if(p) 246 if(p)
229 params = p; 247 params = p;
@@ -243,7 +261,27 @@ $(function(){ @@ -243,7 +261,27 @@ $(function(){
243 } 261 }
244 layer.close(i); 262 layer.close(i);
245 $(".lookTrajectory").click(function(){ 263 $(".lookTrajectory").click(function(){
246 - layer.alert("暂未开放此功能!"); 264 + var vehicle = $(this).data('vehicle');
  265 + var startDate = $(this).data('startdate');
  266 + var endDate = $(this).data('enddate');
  267 + var lon = $(this).data('lon');
  268 + var lat = $(this).data('lat');
  269 + var endLon = $(this).data('endlon');
  270 + var endLat = $(this).data('endlat');
  271 + var storage = window.localStorage;
  272 + storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat);
  273 + $.get('/pages/excep/speedingMap.html?',function (result) {
  274 + layer.open({
  275 + type: 1,
  276 + title:'<i class="uk-icon-play-circle"></i>轨迹回放',
  277 + shadeClose: true,
  278 + shade: true,
  279 + scrollbar: false,
  280 + maxmin: false, //开启最大化最小化按钮
  281 + area: ['100%', '100%'],
  282 + content:result,//内容
  283 + });
  284 + });
247 }) 285 })
248 }); 286 });
249 } 287 }
@@ -307,17 +345,6 @@ $(function(){ @@ -307,17 +345,6 @@ $(function(){
307 $('tr.filter .filter-submit').click(); 345 $('tr.filter .filter-submit').click();
308 }); 346 });
309 }); 347 });
310 -  
311 - //搜索线路  
312 - $.get('/basic/lineCode2Name',function(result){  
313 - var data=[];  
314 - data.push({id: " ", text: "全部线路"});  
315 - for(var code in result){  
316 - data.push({id: code, text: result[code]});  
317 - }  
318 - initPinYinSelect2('#line',data,'');  
319 -  
320 - });  
321 348
322 $("#line").on("change",initXl); 349 $("#line").on("change",initXl);
323 function initXl(){ 350 function initXl(){
@@ -334,6 +361,7 @@ $(&#39;#nbbm&#39;).select2({ @@ -334,6 +361,7 @@ $(&#39;#nbbm&#39;).select2({
334 xlbm:$('#line').val()}; 361 xlbm:$('#line').val()};
335 }, 362 },
336 processResults: function (data) { 363 processResults: function (data) {
  364 + console.log(data);
337 return { 365 return {
338 results: data 366 results: data
339 }; 367 };
@@ -370,7 +398,6 @@ $(&#39;#nbbm&#39;).select2({ @@ -370,7 +398,6 @@ $(&#39;#nbbm&#39;).select2({
370 398
371 //改变状态 399 //改变状态
372 function changeEnabled(id,enabled){ 400 function changeEnabled(id,enabled){
373 - debugger  
374 $get('/user/changeEnabled',{id:id,enabled:enabled},function(result){ 401 $get('/user/changeEnabled',{id:id,enabled:enabled},function(result){
375 jsDoQuery(null, true); 402 jsDoQuery(null, true);
376 }) 403 })
src/main/resources/static/pages/excep/speedingMap.html 0 → 100644
  1 +<style>
  2 + .play_back-layer .layui-layer-title{
  3 + height: 36px;
  4 + border-bottom: none;
  5 + }
  6 +</style>
  7 +
  8 +<div id="titleMap">
  9 +<button id="run" style="margin-left:10px" class="btn btn-sm green btn-outline filter-submit margin-bottom">运行</button>
  10 +</div>
  11 +<div id="speedingMap">
  12 +</div>
  13 +<style type="text/css">
  14 +
  15 +#speedingMap{
  16 + width: 100%;
  17 + border: 2px solid #fdfdfd;
  18 + height: calc(100% - 30px);
  19 + overflow: hidden;
  20 +}
  21 +</style>
  22 +<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script>
  23 +<script type="text/javascript" src="/pages/excep/js/speeding-map.js"></script>
  24 +<script type="text/javascript">
  25 +$(function(){
  26 + var dataArr = window.localStorage.zbhAndDate.split(",");//获取页面传递过来的车辆自编号以及超速起始时间和超速结束时间
  27 + var vehicle = dataArr[0];
  28 + var startdate = dataArr[1];
  29 + var enddate = dataArr[2];
  30 + var lon = dataArr[3];//起点经度
  31 + var lat = dataArr[4];//起点纬度
  32 + var endLon = dataArr[5];//终点经度
  33 + var endLat = dataArr[6];//终点纬度
  34 + var Points = [];
  35 + $.ajax({
  36 + type: "GET",
  37 + async:false,
  38 + url: '/gps/findPosition',
  39 + data: {vehicle:vehicle,startdate:startdate,enddate:enddate},
  40 + success: function(data){
  41 + console.log("123"+data);
  42 + $.each(data,function(i,item){
  43 + console.log(item);
  44 + if(item.lon>1 && item.lat>1){
  45 + var point = new BMap.Point(item.lon,item.lat);
  46 + Points.push(point);
  47 + }
  48 + });
  49 + }
  50 + });
  51 + setTimeout(function(){
  52 + var map = SpeedingMap.init();//创建地图
  53 + var myP1 = new BMap.Point(lon,lat); //起点
  54 + var myP2 = new BMap.Point(endLon,endLat); //终点
  55 + map.centerAndZoom(myP1,18);//地图中心点坐标
  56 + console.log(Points);
  57 + var polyline = new BMap.Polyline(Points, {strokeColor:"blue", strokeWeight:5, strokeOpacity:0.5}); //创建折线
  58 + var myIcon = new BMap.Icon("/pages/excep/img/bus.png", new BMap.Size(32, 70), {//小车图片
  59 + imageOffset: new BMap.Size(5,20) //图片的偏移量。为了是图片底部中心对准坐标点。
  60 + });
  61 + $(document).on('click', '#run', function() {
  62 + map.clearOverlays();//清空上一次的轨迹
  63 + map.addOverlay(polyline);//增加折线
  64 + var paths = Points.length;//获得有几个点
  65 + var carMk = new BMap.Marker(Points[0],{icon:myIcon});
  66 + map.addOverlay(carMk);
  67 + i=0;
  68 + function resetMkPoint(i){
  69 + carMk.setPosition(Points[i]);
  70 + if(i < paths){
  71 + setTimeout(function(){
  72 + i++;
  73 + resetMkPoint(i);
  74 + },100);
  75 + }
  76 + }
  77 + setTimeout(function(){
  78 + resetMkPoint(0);
  79 + },100)
  80 + });
  81 + });
  82 +}, 100);
  83 +</script>
  84 +
  85 +
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/add_temp_sch.html
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 <div class="uk-form-row"> 30 <div class="uk-form-row">
31 <label class="uk-form-label">班次类型</label> 31 <label class="uk-form-label">班次类型</label>
32 <div class="uk-form-controls"> 32 <div class="uk-form-controls">
33 - <select class="form-control nt-dictionary" required name="bcType" data-code="{{bcType}}" 33 + <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}"
34 data-group=ScheduleType></select> 34 data-group=ScheduleType></select>
35 </div> 35 </div>
36 </div> 36 </div>
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 <div class="uk-form-row"> 52 <div class="uk-form-row">
53 <label class="uk-form-label">起点站</label> 53 <label class="uk-form-label">起点站</label>
54 <div class="uk-form-controls"> 54 <div class="uk-form-controls">
55 - <select name="qdzCode" required> 55 + <select name="qdzCode" >
56 </select> 56 </select>
57 </div> 57 </div>
58 </div> 58 </div>
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 <div class="uk-form-row"> 61 <div class="uk-form-row">
62 <label class="uk-form-label">终点站</label> 62 <label class="uk-form-label">终点站</label>
63 <div class="uk-form-controls"> 63 <div class="uk-form-controls">
64 - <select name="zdzCode" required> 64 + <select name="zdzCode" >
65 </select> 65 </select>
66 </div> 66 </div>
67 </div> 67 </div>
@@ -156,7 +156,7 @@ @@ -156,7 +156,7 @@
156 <div class="uk-form-row"> 156 <div class="uk-form-row">
157 <label class="uk-form-label">班次类型</label> 157 <label class="uk-form-label">班次类型</label>
158 <div class="uk-form-controls"> 158 <div class="uk-form-controls">
159 - <select class="form-control nt-dictionary" name="bcType" required data-code="{{bcType}}" 159 + <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}"
160 data-group=ScheduleType></select> 160 data-group=ScheduleType></select>
161 </div> 161 </div>
162 </div> 162 </div>
@@ -178,7 +178,7 @@ @@ -178,7 +178,7 @@
178 <div class="uk-form-row"> 178 <div class="uk-form-row">
179 <label class="uk-form-label">起点站</label> 179 <label class="uk-form-label">起点站</label>
180 <div class="uk-form-controls"> 180 <div class="uk-form-controls">
181 - <select name="qdzCode" required> 181 + <select name="qdzCode" >
182 </select> 182 </select>
183 </div> 183 </div>
184 </div> 184 </div>
@@ -187,7 +187,7 @@ @@ -187,7 +187,7 @@
187 <div class="uk-form-row"> 187 <div class="uk-form-row">
188 <label class="uk-form-label">终点站</label> 188 <label class="uk-form-label">终点站</label>
189 <div class="uk-form-controls"> 189 <div class="uk-form-controls">
190 - <select name="zdzCode" required> 190 + <select name="zdzCode" >
191 </select> 191 </select>
192 </div> 192 </div>
193 </div> 193 </div>
@@ -274,7 +274,7 @@ @@ -274,7 +274,7 @@
274 <div class="uk-form-row"> 274 <div class="uk-form-row">
275 <label class="uk-form-label">班次类型</label> 275 <label class="uk-form-label">班次类型</label>
276 <div class="uk-form-controls"> 276 <div class="uk-form-controls">
277 - <select class="form-control nt-dictionary" name="bcType" required data-code="{{bcType}}" 277 + <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}"
278 data-group=ScheduleType></select> 278 data-group=ScheduleType></select>
279 </div> 279 </div>
280 </div> 280 </div>
@@ -296,7 +296,7 @@ @@ -296,7 +296,7 @@
296 <div class="uk-form-row"> 296 <div class="uk-form-row">
297 <label class="uk-form-label">起点站</label> 297 <label class="uk-form-label">起点站</label>
298 <div class="uk-form-controls"> 298 <div class="uk-form-controls">
299 - <select name="qdzCode" required> 299 + <select name="qdzCode" >
300 </select> 300 </select>
301 </div> 301 </div>
302 </div> 302 </div>
@@ -305,7 +305,7 @@ @@ -305,7 +305,7 @@
305 <div class="uk-form-row"> 305 <div class="uk-form-row">
306 <label class="uk-form-label">终点站</label> 306 <label class="uk-form-label">终点站</label>
307 <div class="uk-form-controls"> 307 <div class="uk-form-controls">
308 - <select name="zdzCode" required> 308 + <select name="zdzCode" >
309 </select> 309 </select>
310 </div> 310 </div>
311 </div> 311 </div>
@@ -425,7 +425,7 @@ @@ -425,7 +425,7 @@
425 <div class="uk-form-row"> 425 <div class="uk-form-row">
426 <label class="uk-form-label">起点站</label> 426 <label class="uk-form-label">起点站</label>
427 <div class="uk-form-controls"> 427 <div class="uk-form-controls">
428 - <select name="qdzCode" required> 428 + <select name="qdzCode" >
429 </select> 429 </select>
430 </div> 430 </div>
431 </div> 431 </div>
@@ -434,7 +434,7 @@ @@ -434,7 +434,7 @@
434 <div class="uk-form-row"> 434 <div class="uk-form-row">
435 <label class="uk-form-label">终点站</label> 435 <label class="uk-form-label">终点站</label>
436 <div class="uk-form-controls"> 436 <div class="uk-form-controls">
437 - <select name="zdzCode" required> 437 + <select name="zdzCode" >
438 </select> 438 </select>
439 </div> 439 </div>
440 </div> 440 </div>
@@ -524,11 +524,14 @@ @@ -524,11 +524,14 @@
524 <script> 524 <script>
525 (function () { 525 (function () {
526 var modal = '#schedule-addsch-modal', 526 var modal = '#schedule-addsch-modal',
527 - sch, stationRoutes, parks, information,carsArray; 527 + sch, stationRoutes, parks, information,carsArray, st_park_data;
528 528
529 $(modal).on('init', function (e, data) { 529 $(modal).on('init', function (e, data) {
530 e.stopPropagation(); 530 e.stopPropagation();
531 sch = data.sch; 531 sch = data.sch;
  532 +
  533 + //站到场数据
  534 + st_park_data = gb_data_basic.get_stat_park_data()[sch.xlBm];
532 //站点路由 535 //站点路由
533 stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { 536 stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
534 return a.stationRouteCode - b.stationRouteCode; 537 return a.stationRouteCode - b.stationRouteCode;
@@ -537,6 +540,8 @@ @@ -537,6 +540,8 @@
537 parks = gb_data_basic.simpleParksArray(); 540 parks = gb_data_basic.simpleParksArray();
538 //线路标准 541 //线路标准
539 information = gb_data_basic.getLineInformation(sch.xlBm); 542 information = gb_data_basic.getLineInformation(sch.xlBm);
  543 + //停车场排序,常用的放前面
  544 + parks = sort_parks(parks, information, st_park_data);
540 //车辆信息 545 //车辆信息
541 carsArray = gb_data_basic.carsArray(); 546 carsArray = gb_data_basic.carsArray();
542 547
@@ -579,8 +584,10 @@ @@ -579,8 +584,10 @@
579 opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' 584 opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'
580 }); 585 });
581 //park options 586 //park options
582 - for (var code in parks)  
583 - park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; 587 + for(var i=0,p;p=parks[i++];)
  588 + park_opts += '<option value="' + p.code + '">' + p.name + '</option>';
  589 + /*for (var code in parks)
  590 + park_opts += '<option value="' + code + '">' + parks[code] + '</option>';*/
584 591
585 var qdz = $('[name=qdzCode]', f), zdz = $('[name=zdzCode]', f); 592 var qdz = $('[name=qdzCode]', f), zdz = $('[name=zdzCode]', f);
586 var time, mileage; 593 var time, mileage;
@@ -922,8 +929,10 @@ @@ -922,8 +929,10 @@
922 929
923 //park options 930 //park options
924 var park_opts; 931 var park_opts;
925 - for (var code in parks)  
926 - park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; 932 + for(var i=0,p;p=parks[i++];)
  933 + park_opts += '<option value="' + p.code + '">' + p.name + '</option>';
  934 + /*for (var code in parks)
  935 + park_opts += '<option value="' + code + '">' + parks[code] + '</option>';*/
927 $('[name=qdzCode]', f).html(park_opts); 936 $('[name=qdzCode]', f).html(park_opts);
928 $('[name=zdzCode]', f).html(park_opts); 937 $('[name=zdzCode]', f).html(park_opts);
929 if(sch.bcType=='in'){ 938 if(sch.bcType=='in'){
@@ -981,6 +990,44 @@ @@ -981,6 +990,44 @@
981 } 990 }
982 } 991 }
983 992
  993 +
  994 + /**
  995 + * 停车场排序
  996 + * @param parks 停车场 code 2 name
  997 + * @param information 线路标准
  998 + * @param st_park_data 站到场
  999 + */
  1000 + function sort_parks(parks, information, st_park_data) {
  1001 + var array = [], names=[];
  1002 + for(var code in parks){
  1003 + array.push({code: code, name: parks[code]});
  1004 + }
  1005 +
  1006 + if(st_park_data && st_park_data.length > 0){
  1007 + $.each(st_park_data, function () {
  1008 + names.push(this.parkName);
  1009 + });
  1010 + }
  1011 +
  1012 + //debugger
  1013 + array.sort(function (a, b) {
  1014 + if(a.code==information.carPark)
  1015 + return -1;
  1016 + if(b.code==information.carPark)
  1017 + return 1;
  1018 +
  1019 + var ai = names.indexOf(a.name),
  1020 + bi = names.indexOf(b.name);
  1021 +
  1022 + if(ai!=-1 && bi==-1)
  1023 + return -1;
  1024 + else if(ai==-1 && bi!=-1)
  1025 + return 1;
  1026 + else
  1027 + return a.name.localeCompare(b.name);
  1028 + });
  1029 + return array;
  1030 + }
984 })(); 1031 })();
985 </script> 1032 </script>
986 </div> 1033 </div>
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
@@ -303,10 +303,10 @@ @@ -303,10 +303,10 @@
303 var xlBm = $('[name=lineSelect]', f).val(); 303 var xlBm = $('[name=lineSelect]', f).val();
304 var xlName = $('[name=lineSelect]', f).find("option:selected").text(); 304 var xlName = $('[name=lineSelect]', f).find("option:selected").text();
305 var lpName = $('[name=lpName]', f).val(); 305 var lpName = $('[name=lpName]', f).val();
306 - sch = {xlBm: xlBm,xlName: xlName, lpName: lpName}; 306 + sch = {xlBm: xlBm,xlName: xlName, lpName: lpName, zdsj: moment().format('HH:mm')};
307 } 307 }
308 308
309 - open_modal(folder + '/add_temp_sch.html', { 309 + open_modal(folder + '/temp_sch/main.html', {
310 sch: sch 310 sch: sch
311 }, modal_opts); 311 }, modal_opts);
312 }; 312 };
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/add_temp_sch_old.html renamed to src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/temp_sch/add_normal.html
1 -<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-addsch-modal">  
2 - <div class="uk-modal-dialog">  
3 - <a href="" class="uk-modal-close uk-close"></a>  
4 - <div class="uk-modal-header">  
5 - <h2>新增临加班次</h2></div>  
6 - <form class="uk-form uk-form-horizontal">  
7 - </form>  
8 - </div>  
9 -  
10 - <script id="schedule-addsch-form-temp" type="text/html">  
11 - <div class="uk-grid">  
12 - <div class="uk-width-1-2">  
13 - <div class="uk-form-row">  
14 - <label class="uk-form-label">班次类型</label>  
15 - <div class="uk-form-controls">  
16 - <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}"  
17 - data-group=ScheduleType></select>  
18 - </div>  
19 - </div>  
20 - </div>  
21 - <div class="uk-width-1-2">  
22 - <div class="uk-form-row">  
23 - <label class="uk-form-label">上下行</label>  
24 - <div class="uk-form-controls">  
25 - <select name="xlDir">  
26 - <option value="0">上行</option>  
27 - <option value="1">下行</option>  
28 - </select>  
29 - </div>  
30 - </div>  
31 - </div>  
32 - </div>  
33 - <div class="uk-grid">  
34 - <div class="uk-width-1-2">  
35 - <div class="uk-form-row">  
36 - <label class="uk-form-label">起点站</label>  
37 - <div class="uk-form-controls">  
38 - <select name="qdzCode" required>  
39 - </select>  
40 - </div>  
41 - </div>  
42 - </div>  
43 - <div class="uk-width-1-2">  
44 - <div class="uk-form-row">  
45 - <label class="uk-form-label">终点站</label>  
46 - <div class="uk-form-controls">  
47 - <select name="zdzCode" required>  
48 - </select>  
49 - </div>  
50 - </div>  
51 - </div>  
52 - </div>  
53 - <div class="uk-grid">  
54 - <div class="uk-width-1-2">  
55 - <div class="uk-form-row">  
56 - <label class="uk-form-label">开始时间</label>  
57 - <div class="uk-form-controls">  
58 - <input type="time" value="{{zdsj}}" name="fcsj" required>  
59 - </div>  
60 - </div>  
61 - </div>  
62 - <div class="uk-width-1-2">  
63 - <div class="uk-form-row">  
64 - <label class="uk-form-label">结束时间</label>  
65 - <div class="uk-form-controls">  
66 - <input type="time" name="zdsj" required>  
67 - </div>  
68 - </div>  
69 - </div>  
70 - </div>  
71 - <div class="uk-grid">  
72 - <div class="uk-width-1-2">  
73 - <div class="uk-form-row">  
74 - <label class="uk-form-label">车辆</label>  
75 - <div class="uk-form-controls">  
76 - <div class="uk-autocomplete uk-form car-autocom">  
77 - <input type="text" value="{{clZbh}}" name="clZbh" required>  
78 - </div>  
79 - </div>  
80 - </div>  
81 - </div>  
82 - <div class="uk-width-1-2">  
83 - <div class="uk-form-row">  
84 - <label class="uk-form-label">里程</label>  
85 - <div class="uk-form-controls">  
86 - <input type="text" name="jhlc" value="{{jhlc}}" max=222 data-fv-lessthan-inclusive="false"  
87 - required>  
88 - </div>  
89 - </div>  
90 - </div>  
91 - </div>  
92 - <div class="uk-grid">  
93 - <div class="uk-width-1-2">  
94 - <div class="uk-form-row">  
95 - <label class="uk-form-label">驾驶员  
96 - <!--<i class="uk-icon-question-circle" data-uk-tooltip title="如果有驾驶员未提示,请至后台“基础信息 -人员信息”里纠正该员工的“工种”类别 "></i>--></label>  
97 - <div class="uk-form-controls">  
98 - <div class="uk-autocomplete uk-form jsy-autocom">  
99 - <input type="text" value="{{jGh}}/{{jName}}" name="jsy" required>  
100 - </div>  
101 - </div>  
102 - </div>  
103 - </div>  
104 - <div class="uk-width-1-2">  
105 - <div class="uk-form-row">  
106 - <label class="uk-form-label">售票员</label>  
107 - <div class="uk-form-controls">  
108 - <div class="uk-autocomplete uk-form spy-autocom">  
109 - <input type="text" name="spy" value="{{sGh}}/{{sName}}">  
110 - </div>  
111 - </div>  
112 - </div>  
113 - </div>  
114 - </div>  
115 - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">  
116 - <button type="button" class="uk-button uk-modal-close">取消</button>  
117 - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>  
118 - </div>  
119 - </script>  
120 -  
121 - <script>  
122 - (function () {  
123 - var modal = '#schedule-addsch-modal',  
124 - sch, stationRoutes, parks, information;  
125 -  
126 - var normalInfo = [];  
127 - $(modal).on('init', function (e, data) {  
128 - e.stopPropagation();  
129 - sch = data.sch;  
130 - //normal 班次里程和耗时  
131 - var list = gb_common.get_vals(gb_schedule_table.findScheduleByLine(sch.xlBm));  
132 - var upPlan = getNormalSch(list, 0)  
133 - , downPlan = getNormalSch(list, 1);  
134 - normalInfo[0] = {time: upPlan.bcsj, mileage: upPlan.jhlc};  
135 - normalInfo[1] = {time: downPlan.bcsj, mileage: downPlan.jhlc};  
136 -  
137 -  
138 - var formHtml = template('schedule-addsch-form-temp', sch);  
139 - $('form', modal).html(formHtml);  
140 - //字典转换  
141 - dictionaryUtils.transformDom($('.nt-dictionary', modal));  
142 -  
143 - //----------- Autocomplete --------------  
144 - $.get('/basic/cars', function (rs) {  
145 - //车辆  
146 - gb_common.carAutocomplete($('.car-autocom', modal), rs);  
147 - });  
148 - //驾驶员  
149 - gb_common.personAutocomplete($('.jsy-autocom', modal));  
150 -  
151 - //售票员  
152 - gb_common.personAutocomplete($('.spy-autocom', modal));  
153 -  
154 - //站点路由  
155 - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {  
156 - return a.stationRouteCode - b.stationRouteCode;  
157 - }), 'directions');  
158 - //停车场  
159 - $.get('/basic/parks', function (rs) {  
160 - parks = rs;  
161 - });  
162 - //线路标准  
163 - information = gb_data_basic.getLineInformation(sch.xlBm);  
164 -  
165 - //submit  
166 - var f = $('form', modal).formValidation(gb_form_validation_opts);  
167 - f.on('success.form.fv', function (e) {  
168 - disabled_submit_btn(this);  
169 - e.preventDefault();  
170 - var data = $(this).serializeJSON();  
171 - data.xlBm = sch.xlBm;  
172 - data.xlName = sch.xlName;  
173 - data.lpName = sch.lpName;  
174 - //拆分驾驶员工号和姓名  
175 - data.jGh = data.jsy.split('/')[0];  
176 - data.jName = data.jsy.split('/')[1];  
177 - delete data.jsy;  
178 - //拆分售票员工号和姓名  
179 - if (data.sGh != null) {  
180 - data.sGh = data.spy.split('/')[0];  
181 - data.sName = data.spy.split('/')[1];  
182 - delete data.spy;  
183 - }  
184 -  
185 - //公司信息  
186 - var line = gb_data_basic.findLineByCodes([data.xlBm]);  
187 - if(line && line.length > 0){  
188 - line = line[0];  
189 - data.gsBm = line.company;  
190 - data.fgsBm = line.brancheCompany;  
191 - }  
192 -  
193 - gb_common.$post('/realSchedule', data, function (rs) {  
194 - //插入  
195 - gb_schedule_table.insertSchedule(rs.t, rs.ts);  
196 - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: rs.t});  
197 - UIkit.modal(modal).hide();  
198 - notify_succ('新增临加班次成功');  
199 - });  
200 - });  
201 -  
202 - //班次类型 和 上下行切换  
203 - $('[name=bcType],[name=xlDir]', f).on('change', function () {  
204 - var bcType_e = $('[name=bcType]', f)  
205 - , xlDir_e = $('[name=xlDir]', f);  
206 -  
207 - var routes = stationRoutes[xlDir_e.val()]  
208 - , lastCode = routes[routes.length - 1].stationCode  
209 - , opts = '', park_opts = '';  
210 - //station options  
211 - $.each(routes, function () {  
212 - opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'  
213 - });  
214 - //park options  
215 - for (var code in parks)  
216 - park_opts += '<option value="' + code + '">' + parks[code] + '</option>';  
217 -  
218 - var qdz = $('[name=qdzCode]', f), zdz = $('[name=zdzCode]', f);  
219 - var time, mileage;  
220 - switch (bcType_e.val()) {  
221 - case 'out':  
222 - qdz.html(park_opts).val(information.carPark);  
223 - zdz.html(opts);  
224 - //出场结束时间  
225 - time = xlDir_e.val() == 0 ? information.upOutTimer : information.downOutTimer;  
226 - mileage = xlDir_e.val() == 0 ? information.upOutMileage : information.downOutMileage;  
227 - break;  
228 - case 'in':  
229 - qdz.html(opts);  
230 - zdz.html(park_opts).val(information.carPark);  
231 - //进场结束时间  
232 - time = xlDir_e.val() == 0 ? information.upInTimer : information.downInTimer;  
233 - mileage = xlDir_e.val() == 0 ? information.upInMileage : information.downInMileage;  
234 - break;  
235 - default:  
236 - qdz.html(opts);  
237 - zdz.html(opts).val(lastCode);  
238 - time = xlDir_e.val() == 0?normalInfo[0].time:normalInfo[1].time;  
239 - mileage = xlDir_e.val() == 0?normalInfo[0].mileage:normalInfo[1].mileage;  
240 - }  
241 -  
242 - setEndTime(time);  
243 - $('[name=jhlc]', f).val(mileage);  
244 - }).trigger('change');  
245 -  
246 -  
247 - function setEndTime(diff) {  
248 - var et = moment($('[name=fcsj]', f).val(), 'HH:mm').add(diff, 'minutes').format('HH:mm');  
249 - $('[name=zdsj]', f).val(et);  
250 - }  
251 - });  
252 -  
253 - function getNormalSch(list, updown) {  
254 - var sch;  
255 - $.each(list, function () {  
256 - if (this.bcType == 'normal' && this.xlDir == updown) {  
257 - sch = this;  
258 - return false;  
259 - }  
260 - });  
261 -  
262 - return sch;  
263 - }  
264 - })();  
265 - </script>  
266 -</div> 1 +<!-- 临加班次form -->
  2 +<script id="add_normal_sch-form-temp" type="text/html">
  3 + <form class="uk-form uk-form-horizontal add-sch-form">
  4 + <div class="uk-grid">
  5 + <div class="uk-width-1-2">
  6 + <div class="uk-form-row">
  7 + <label class="uk-form-label">班次类型</label>
  8 + <div class="uk-form-controls">
  9 + <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}"
  10 + data-group=ScheduleType></select>
  11 + </div>
  12 + </div>
  13 + </div>
  14 + <div class="uk-width-1-2">
  15 + <div class="uk-form-row">
  16 + <label class="uk-form-label">上下行</label>
  17 + <div class="uk-form-controls">
  18 + <select name="xlDir">
  19 + <option value="0">上行</option>
  20 + <option value="1">下行</option>
  21 + </select>
  22 + </div>
  23 + </div>
  24 + </div>
  25 + </div>
  26 + <div class="uk-grid">
  27 + <div class="uk-width-1-2">
  28 + <div class="uk-form-row">
  29 + <label class="uk-form-label">起点站</label>
  30 + <div class="uk-form-controls">
  31 + <select name="qdzCode">
  32 + </select>
  33 + </div>
  34 + </div>
  35 + </div>
  36 + <div class="uk-width-1-2">
  37 + <div class="uk-form-row">
  38 + <label class="uk-form-label">终点站</label>
  39 + <div class="uk-form-controls">
  40 + <select name="zdzCode">
  41 + </select>
  42 + </div>
  43 + </div>
  44 + </div>
  45 + </div>
  46 + <div class="uk-grid">
  47 + <div class="uk-width-1-2">
  48 + <div class="uk-form-row">
  49 + <label class="uk-form-label">开始时间</label>
  50 + <div class="uk-form-controls">
  51 + <input type="time" value="{{zdsjActual==null?zdsj:zdsjActual}}" name="fcsj" required>
  52 + </div>
  53 + </div>
  54 + </div>
  55 + <div class="uk-width-1-2">
  56 + <div class="uk-form-row">
  57 + <label class="uk-form-label">结束时间</label>
  58 + <div class="uk-form-controls">
  59 + <input type="time" name="zdsj" required>
  60 + </div>
  61 + </div>
  62 + </div>
  63 + </div>
  64 + <div class="uk-grid">
  65 + <div class="uk-width-1-2">
  66 + <div class="uk-form-row">
  67 + <label class="uk-form-label">车辆</label>
  68 + <div class="uk-form-controls">
  69 + <div class="uk-autocomplete uk-form car-autocom">
  70 + <input type="text" value="{{clZbh}}" name="clZbh" required>
  71 + </div>
  72 + </div>
  73 + </div>
  74 + </div>
  75 + <div class="uk-width-1-2">
  76 + <div class="uk-form-row">
  77 + <label class="uk-form-label">里程</label>
  78 + <div class="uk-form-controls">
  79 + <input type="text" name="jhlc" value="{{jhlc}}" max=222 data-fv-lessthan-inclusive="false"
  80 + required>
  81 + </div>
  82 + </div>
  83 + </div>
  84 + </div>
  85 + <div class="uk-grid">
  86 + <div class="uk-width-1-2">
  87 + <div class="uk-form-row">
  88 + <label class="uk-form-label">驾驶员</label>
  89 + <div class="uk-form-controls">
  90 + <div class="uk-autocomplete uk-form jsy-autocom">
  91 + <input type="text" value="{{jGh}}/{{jName}}" name="jsy" required>
  92 + </div>
  93 + </div>
  94 + </div>
  95 + </div>
  96 + <div class="uk-width-1-2">
  97 + <div class="uk-form-row">
  98 + <label class="uk-form-label">售票员</label>
  99 + <div class="uk-form-controls">
  100 + <div class="uk-autocomplete uk-form spy-autocom">
  101 + <input type="text" name="spy" value="{{sGh}}/{{sName}}">
  102 + </div>
  103 + </div>
  104 + </div>
  105 + </div>
  106 + </div>
  107 + <div class="uk-grid">
  108 + <div class="uk-width-1-1">
  109 + <div class="uk-form-row">
  110 + <label class="uk-form-label">备注</label>
  111 + <div class="uk-form-controls">
  112 + <div class="uk-autocomplete uk-form remarks-autocom">
  113 + <input type="text" name="remarks">
  114 + </div>
  115 + </div>
  116 + </div>
  117 + </div>
  118 + </div>
  119 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  120 + <span class="ct_line_lp_badge"></span>
  121 + <button type="button" class="uk-button uk-modal-close">取消</button>
  122 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存
  123 + </button>
  124 + </div>
  125 + </form>
  126 +</script>
  127 +<script>
  128 + (function () {
  129 + var wrap = '#schedule-addsch-modal .normalCont', sch, nf, submitFun;
  130 +
  131 + $(wrap).on('init', function (e, data) {
  132 + e.stopPropagation();
  133 + sch = data.sch;
  134 + submitFun = data.submitFun;
  135 +
  136 + nf = addForm();
  137 + //提交
  138 + nf.on('success.form.fv', function (e) {
  139 + e.preventDefault();
  140 +
  141 + disabled_submit_btn(nf);
  142 + var data = nf.serializeJSON();
  143 + submitFun(data, function (rs) {
  144 + //前端数据更新
  145 + gb_schedule_table.insertSchedule(rs.t, rs.ts);
  146 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: rs.t});
  147 + try {
  148 + if(rs.t.bcType=='in' || rs.t.bcType=='out')
  149 + gb_data_basic.reload_stat_park_data();
  150 + }catch (e){
  151 + console.log(e);}
  152 + UIkit.modal('#schedule-addsch-modal').hide();
  153 + });
  154 + });
  155 + $('.ct_line_lp_badge', nf).html(sch.xlName + ',&nbsp;'+sch.lpName);
  156 + });
  157 +
  158 + function addForm() {
  159 + var htmlStr = template('add_normal_sch-form-temp', sch);
  160 + var f = $(htmlStr);
  161 + $(wrap).append(f);
  162 + //字典转换
  163 + dictionaryUtils.transformDom($('.nt-dictionary', f));
  164 + //validation
  165 + f.formValidation({framework: 'uikit', locale: 'zh_CN'});
  166 + //autocomp
  167 + f.trigger('init-autoCom');
  168 +
  169 + $f('bcType', f).trigger('change');
  170 + return f;
  171 + }
  172 +
  173 + function $f(name, f) {
  174 + return $('[name=' + name + ']', f);
  175 + }
  176 + })();
  177 +</script>
267 \ No newline at end of file 178 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/temp_sch/add_park_to_park.html 0 → 100644
  1 +<!-- 临加场到场班次form -->
  2 +<script id="add_park_to_park_sch-form-temp" type="text/html">
  3 + <form class="uk-form uk-form-horizontal">
  4 + <div class="uk-grid">
  5 + <div class="uk-width-1-2">
  6 + <div class="uk-form-row">
  7 + <label class="uk-form-label">班次类型</label>
  8 + <div class="uk-form-controls">
  9 + <select class="form-control" name="bcType">
  10 + <option value="in">进场</option>
  11 + </select>
  12 + </div>
  13 + </div>
  14 + </div>
  15 + <div class="uk-width-1-2">
  16 + <div class="uk-form-row">
  17 + <label class="uk-form-label">上下行</label>
  18 + <div class="uk-form-controls">
  19 + <select name="xlDir">
  20 + <option value="0">上行</option>
  21 + <option value="1">下行</option>
  22 + </select>
  23 + </div>
  24 + </div>
  25 + </div>
  26 + </div>
  27 + <div class="uk-grid">
  28 + <div class="uk-width-1-2">
  29 + <div class="uk-form-row">
  30 + <label class="uk-form-label">起点站</label>
  31 + <div class="uk-form-controls">
  32 + <select name="qdzCode">
  33 + </select>
  34 + </div>
  35 + </div>
  36 + </div>
  37 + <div class="uk-width-1-2">
  38 + <div class="uk-form-row">
  39 + <label class="uk-form-label">终点站</label>
  40 + <div class="uk-form-controls">
  41 + <select name="zdzCode">
  42 + </select>
  43 + </div>
  44 + </div>
  45 + </div>
  46 + </div>
  47 + <div class="uk-grid">
  48 + <div class="uk-width-1-2">
  49 + <div class="uk-form-row">
  50 + <label class="uk-form-label">开始时间</label>
  51 + <div class="uk-form-controls">
  52 + <input type="time" value="{{zdsjActual==null?zdsj:zdsjActual}}" name="fcsj" required>
  53 + </div>
  54 + </div>
  55 + </div>
  56 + <div class="uk-width-1-2">
  57 + <div class="uk-form-row">
  58 + <label class="uk-form-label">结束时间</label>
  59 + <div class="uk-form-controls">
  60 + <input type="time" name="zdsj" required>
  61 + </div>
  62 + </div>
  63 + </div>
  64 + </div>
  65 + <div class="uk-grid">
  66 + <div class="uk-width-1-2">
  67 + <div class="uk-form-row">
  68 + <label class="uk-form-label">车辆</label>
  69 + <div class="uk-form-controls">
  70 + <div class="uk-autocomplete uk-form car-autocom">
  71 + <input type="text" value="{{clZbh}}" name="clZbh" required>
  72 + </div>
  73 + </div>
  74 + </div>
  75 + </div>
  76 + <div class="uk-width-1-2">
  77 + <div class="uk-form-row">
  78 + <label class="uk-form-label">里程</label>
  79 + <div class="uk-form-controls">
  80 + <input type="text" name="jhlc" value="{{jhlc}}" max=222 data-fv-lessthan-inclusive="false"
  81 + required>
  82 + </div>
  83 + </div>
  84 + </div>
  85 + </div>
  86 + <div class="uk-grid">
  87 + <div class="uk-width-1-2">
  88 + <div class="uk-form-row">
  89 + <label class="uk-form-label">驾驶员</label>
  90 + <div class="uk-form-controls">
  91 + <div class="uk-autocomplete uk-form jsy-autocom">
  92 + <input type="text" value="{{jGh}}/{{jName}}" name="jsy" required>
  93 + </div>
  94 + </div>
  95 + </div>
  96 + </div>
  97 + <div class="uk-width-1-2">
  98 + <div class="uk-form-row">
  99 + <label class="uk-form-label">售票员</label>
  100 + <div class="uk-form-controls">
  101 + <div class="uk-autocomplete uk-form spy-autocom">
  102 + <input type="text" name="spy" value="{{sGh}}/{{sName}}">
  103 + </div>
  104 + </div>
  105 + </div>
  106 + </div>
  107 + </div>
  108 + <div class="uk-grid">
  109 + <div class="uk-width-1-1">
  110 + <div class="uk-form-row">
  111 + <label class="uk-form-label">备注</label>
  112 + <div class="uk-form-controls">
  113 + <div class="uk-autocomplete uk-form remarks-autocom">
  114 + <input type="text" name="remarks">
  115 + </div>
  116 + </div>
  117 + </div>
  118 + </div>
  119 + </div>
  120 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  121 + <span class="ct_line_lp_badge"></span>
  122 + <button type="button" class="uk-button uk-modal-close">取消</button>
  123 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存
  124 + </button>
  125 + </div>
  126 + </form>
  127 +</script>
  128 +
  129 +<script>
  130 + (function () {
  131 + var wrap = '#schedule-addsch-modal .parkToParkCont', sch, nf, submitFun,parks,carsArray;
  132 +
  133 + $(wrap).on('init', function (e, data) {
  134 + e.stopPropagation();
  135 + sch = data.sch;
  136 + submitFun = data.submitFun;
  137 + parks = data.parks;
  138 + carsArray = data.carsArray;
  139 +
  140 + nf = addForm();
  141 + //提交
  142 + nf.on('success.form.fv', function (e) {
  143 + e.preventDefault();
  144 +
  145 + disabled_submit_btn(nf);
  146 + var data = nf.serializeJSON();
  147 + submitFun(data, function (rs) {
  148 + //前端数据更新
  149 + gb_schedule_table.insertSchedule(rs.t, rs.ts);
  150 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: rs.t});
  151 + try {
  152 + if(rs.t.bcType=='in' || rs.t.bcType=='out')
  153 + gb_data_basic.reload_stat_park_data();
  154 + }catch (e){
  155 + console.log(e);}
  156 + UIkit.modal('#schedule-addsch-modal').hide();
  157 + });
  158 + });
  159 + $('.ct_line_lp_badge', nf).html(sch.xlName + ',&nbsp;'+sch.lpName);
  160 + $f('zdzCode',nf).trigger('change');
  161 + });
  162 +
  163 + function addForm() {
  164 + var htmlStr = template('add_park_to_park_sch-form-temp', sch);
  165 + var f = $(htmlStr);
  166 + $(wrap).append(f);
  167 + //字典转换
  168 + dictionaryUtils.transformDom($('.nt-dictionary', f));
  169 + //validation
  170 + f.formValidation({framework: 'uikit', locale: 'zh_CN'});
  171 + //autocomp
  172 + initAutoComp(f);
  173 +
  174 + //起终点都是停车场
  175 + var park_opts;
  176 + for(var i=0,p;p=parks[i++];)
  177 + park_opts += '<option value="' + p.code + '">' + p.name + '</option>';
  178 + $f('qdzCode', f).html(park_opts);
  179 + $f('zdzCode', f).html(park_opts);
  180 +
  181 + if(sch.bcType=='in'){
  182 + $f('qdzCode', f).val(sch.zdzCode);
  183 + //选中的也是场到场班次
  184 + if(gb_data_basic.getCarparkByCode(sch.qdzCode) != null){
  185 + //默认做返程
  186 + $f('zdzCode', f).val(sch.qdzCode);
  187 + $f('remarks', f).val(sch.remarks);
  188 + $f('jhlc', f).val(sch.jhlc);
  189 + //时间
  190 + var zdsj = moment(sch.zdsj, 'HH:mm').add('minutes', sch.bcsj).format('HH:mm');
  191 + $f('zdsj', f).val(zdsj);
  192 + }
  193 + }
  194 + return f;
  195 + }
  196 +
  197 + function $f(name, f) {
  198 + return $('[name=' + name + ']', f);
  199 + }
  200 +
  201 + function initAutoComp(f) {
  202 + //车辆
  203 + if(carsArray)
  204 + gb_common.carAutocomplete($('.car-autocom', f), carsArray);
  205 + //驾驶员
  206 + gb_common.personAutocomplete($('.jsy-autocom', f));
  207 + //售票员
  208 + gb_common.personAutocomplete($('.spy-autocom', f));
  209 + //备注补全
  210 + gb_common.remarksAutocomplete($('.remarks-autocom', f));
  211 + }
  212 +
  213 + })();
  214 +</script>
0 \ No newline at end of file 215 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/temp_sch/add_two_way.html 0 → 100644
  1 +<!-- 线路上往返临加班次 -->
  2 +<script id="add_toAndFro_sch-form-temp" type="text/html">
  3 + <form class="uk-form uk-form-horizontal add-sch-form one_form">
  4 + <div class="uk-grid">
  5 + <div class="uk-width-1-2">
  6 + <div class="uk-form-row">
  7 + <label class="uk-form-label">班次类型</label>
  8 + <div class="uk-form-controls">
  9 + <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}"
  10 + data-group=ScheduleType></select>
  11 + </div>
  12 + </div>
  13 + </div>
  14 + <div class="uk-width-1-2">
  15 + <div class="uk-form-row">
  16 + <label class="uk-form-label">上下行</label>
  17 + <div class="uk-form-controls">
  18 + <select name="xlDir">
  19 + <option value="0">上行</option>
  20 + <option value="1">下行</option>
  21 + </select>
  22 + </div>
  23 + </div>
  24 + </div>
  25 + </div>
  26 + <div class="uk-grid">
  27 + <div class="uk-width-1-2">
  28 + <div class="uk-form-row">
  29 + <label class="uk-form-label">起点站</label>
  30 + <div class="uk-form-controls">
  31 + <select name="qdzCode" >
  32 + </select>
  33 + </div>
  34 + </div>
  35 + </div>
  36 + <div class="uk-width-1-2">
  37 + <div class="uk-form-row">
  38 + <label class="uk-form-label">终点站</label>
  39 + <div class="uk-form-controls">
  40 + <select name="zdzCode" >
  41 + </select>
  42 + </div>
  43 + </div>
  44 + </div>
  45 + </div>
  46 + <div class="uk-grid">
  47 + <div class="uk-width-1-2">
  48 + <div class="uk-form-row">
  49 + <label class="uk-form-label">开始时间</label>
  50 + <div class="uk-form-controls">
  51 + <input type="time" value="{{zdsj}}" name="fcsj" required>
  52 + </div>
  53 + </div>
  54 + </div>
  55 + <div class="uk-width-1-2">
  56 + <div class="uk-form-row">
  57 + <label class="uk-form-label">结束时间</label>
  58 + <div class="uk-form-controls">
  59 + <input type="time" name="zdsj" required>
  60 + </div>
  61 + </div>
  62 + </div>
  63 + </div>
  64 + <div class="uk-grid">
  65 + <div class="uk-width-1-2">
  66 + <div class="uk-form-row">
  67 + <label class="uk-form-label">车辆</label>
  68 + <div class="uk-form-controls">
  69 + <div class="uk-autocomplete uk-form car-autocom">
  70 + <input type="text" value="{{clZbh}}" name="clZbh" required>
  71 + </div>
  72 + </div>
  73 + </div>
  74 + </div>
  75 + <div class="uk-width-1-2">
  76 + <div class="uk-form-row">
  77 + <label class="uk-form-label">里程</label>
  78 + <div class="uk-form-controls">
  79 + <input type="text" name="jhlc" value="{{jhlc}}" max=222 data-fv-lessthan-inclusive="false"
  80 + required>
  81 + </div>
  82 + </div>
  83 + </div>
  84 + </div>
  85 + <div class="uk-grid">
  86 + <div class="uk-width-1-2">
  87 + <div class="uk-form-row">
  88 + <label class="uk-form-label">驾驶员</label>
  89 + <div class="uk-form-controls">
  90 + <div class="uk-autocomplete uk-form jsy-autocom">
  91 + <input type="text" value="{{jGh}}/{{jName}}" name="jsy" required>
  92 + </div>
  93 + </div>
  94 + </div>
  95 + </div>
  96 + <div class="uk-width-1-2">
  97 + <div class="uk-form-row">
  98 + <label class="uk-form-label">售票员</label>
  99 + <div class="uk-form-controls">
  100 + <div class="uk-autocomplete uk-form spy-autocom">
  101 + <input type="text" name="spy" value="{{sGh}}/{{sName}}">
  102 + </div>
  103 + </div>
  104 + </div>
  105 + </div>
  106 + </div>
  107 + <div class="uk-grid">
  108 + <div class="uk-width-1-1">
  109 + <div class="uk-form-row">
  110 + <label class="uk-form-label">备注</label>
  111 + <div class="uk-form-controls">
  112 + <div class="uk-autocomplete uk-form remarks-autocom">
  113 + <input type="text" name="remarks">
  114 + </div>
  115 + </div>
  116 + </div>
  117 + </div>
  118 + </div>
  119 + </form>
  120 + <hr style="margin-top: 35px;">
  121 + <form class="uk-form uk-form-horizontal add-sch-form two_form">
  122 + <div class="uk-grid">
  123 + <div class="uk-width-1-2">
  124 + <div class="uk-form-row">
  125 + <label class="uk-form-label">班次类型</label>
  126 + <div class="uk-form-controls">
  127 + <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}"
  128 + data-group=ScheduleType></select>
  129 + </div>
  130 + </div>
  131 + </div>
  132 + <div class="uk-width-1-2">
  133 + <div class="uk-form-row">
  134 + <label class="uk-form-label">上下行</label>
  135 + <div class="uk-form-controls">
  136 + <select name="xlDir">
  137 + <option value="0">上行</option>
  138 + <option value="1">下行</option>
  139 + </select>
  140 + </div>
  141 + </div>
  142 + </div>
  143 + </div>
  144 + <div class="uk-grid">
  145 + <div class="uk-width-1-2">
  146 + <div class="uk-form-row">
  147 + <label class="uk-form-label">起点站</label>
  148 + <div class="uk-form-controls">
  149 + <select name="qdzCode" >
  150 + </select>
  151 + </div>
  152 + </div>
  153 + </div>
  154 + <div class="uk-width-1-2">
  155 + <div class="uk-form-row">
  156 + <label class="uk-form-label">终点站</label>
  157 + <div class="uk-form-controls">
  158 + <select name="zdzCode" >
  159 + </select>
  160 + </div>
  161 + </div>
  162 + </div>
  163 + </div>
  164 + <div class="uk-grid">
  165 + <div class="uk-width-1-2">
  166 + <div class="uk-form-row">
  167 + <label class="uk-form-label">开始时间</label>
  168 + <div class="uk-form-controls">
  169 + <input type="time" value="{{zdsj}}" name="fcsj" required>
  170 + </div>
  171 + </div>
  172 + </div>
  173 + <div class="uk-width-1-2">
  174 + <div class="uk-form-row">
  175 + <label class="uk-form-label">结束时间</label>
  176 + <div class="uk-form-controls">
  177 + <input type="time" name="zdsj" required>
  178 + </div>
  179 + </div>
  180 + </div>
  181 + </div>
  182 + <div class="uk-grid">
  183 + <div class="uk-width-1-2">
  184 + <div class="uk-form-row">
  185 + <label class="uk-form-label">车辆</label>
  186 + <div class="uk-form-controls">
  187 + <div class="uk-autocomplete uk-form car-autocom">
  188 + <input type="text" value="{{clZbh}}" name="clZbh" required>
  189 + </div>
  190 + </div>
  191 + </div>
  192 + </div>
  193 + <div class="uk-width-1-2">
  194 + <div class="uk-form-row">
  195 + <label class="uk-form-label">里程</label>
  196 + <div class="uk-form-controls">
  197 + <input type="text" name="jhlc" value="{{jhlc}}" max=222 data-fv-lessthan-inclusive="false"
  198 + required>
  199 + </div>
  200 + </div>
  201 + </div>
  202 + </div>
  203 + <div class="uk-grid">
  204 + <div class="uk-width-1-2">
  205 + <div class="uk-form-row">
  206 + <label class="uk-form-label">驾驶员</label>
  207 + <div class="uk-form-controls">
  208 + <div class="uk-autocomplete uk-form jsy-autocom">
  209 + <input type="text" value="{{jGh}}/{{jName}}" name="jsy" required>
  210 + </div>
  211 + </div>
  212 + </div>
  213 + </div>
  214 + <div class="uk-width-1-2">
  215 + <div class="uk-form-row">
  216 + <label class="uk-form-label">售票员</label>
  217 + <div class="uk-form-controls">
  218 + <div class="uk-autocomplete uk-form spy-autocom">
  219 + <input type="text" name="spy" value="{{sGh}}/{{sName}}">
  220 + </div>
  221 + </div>
  222 + </div>
  223 + </div>
  224 + </div>
  225 + <div class="uk-grid">
  226 + <div class="uk-width-1-1">
  227 + <div class="uk-form-row">
  228 + <label class="uk-form-label">备注</label>
  229 + <div class="uk-form-controls">
  230 + <div class="uk-autocomplete uk-form remarks-autocom">
  231 + <input type="text" name="remarks">
  232 + </div>
  233 + </div>
  234 + </div>
  235 + </div>
  236 + </div>
  237 + </form>
  238 +
  239 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  240 + <span class="ct_line_lp_badge" ></span>
  241 + <button type="button" class="uk-button uk-modal-close">取消</button>
  242 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  243 + </div>
  244 +</script>
  245 +
  246 +<script>
  247 + (function () {
  248 + var wrap = '#schedule-addsch-modal .toAndFroCont', sch, f1, f2, submitFun, stationRoutes;
  249 +
  250 + $(wrap).on('init', function (e, data) {
  251 + e.stopPropagation();
  252 + sch = data.sch;
  253 + submitFun = data.submitFun;
  254 + stationRoutes = data.stationRoutes;
  255 +
  256 + var htmlStr = template('add_toAndFro_sch-form-temp', sch);
  257 + $(wrap).append(htmlStr);
  258 + //字典转换
  259 + dictionaryUtils.transformDom($('.nt-dictionary', wrap));
  260 + //validation
  261 + $('.add-sch-form', wrap).formValidation({framework: 'uikit', locale: 'zh_CN'}).trigger('init-autoCom');
  262 + $('.add-sch-form [name=bcType]', wrap).trigger('change');
  263 +
  264 + f1 = $('.add-sch-form.one_form', wrap);
  265 + f2 = $('.add-sch-form.two_form', wrap);
  266 +
  267 + //默认1备注同步到2
  268 + $f('remarks', f1).on('input', function () {
  269 + $f('remarks', f2).val($(this).val());
  270 + });
  271 + //默认1备注同步到2
  272 + $('.remarks-autocom', f1).on('selectitem.uk.autocomplete', function (e, data, acobject) {
  273 + $f('remarks', f2).val(data.value);
  274 + });
  275 + //表单同步
  276 + $(f1).on('ct_callback', synchroFormData).trigger('ct_callback');
  277 + //修改1结束时间
  278 + $f('zdsj',f1).on('input', synchroFormData);
  279 + $('.ct_line_lp_badge', wrap).html(sch.xlName + ',&nbsp;'+sch.lpName);
  280 +
  281 + //表单校验提交相关
  282 + var dataArray;
  283 + var fs = $('.add-sch-form', wrap);
  284 + fs.on('success.form.fv', function (e) {
  285 + e.preventDefault();
  286 + dataArray.push($(this).serializeJSON());
  287 + $(this).data('valid', true);
  288 + if (allValidSuccess()) {
  289 + //开始post
  290 + var i = 0;
  291 + var inArr = [];
  292 + var upArr = [];
  293 + (function () {
  294 + var f = arguments.callee;
  295 + if (i >= dataArray.length) {
  296 + //前端数据更新
  297 + var last = inArr.pop();
  298 + gb_schedule_table.insertSchedule(last, upArr);
  299 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: last});
  300 +
  301 + try {
  302 + if(last.bcType=='in' || last.bcType=='out')
  303 + gb_data_basic.reload_stat_park_data();
  304 + }catch (e){
  305 + console.log(e);}
  306 + UIkit.modal('#schedule-addsch-modal').hide();
  307 + return;
  308 + }
  309 + submitFun(dataArray[i], function (rs) {
  310 + inArr.push(rs.t);
  311 + upArr = upArr.concat(rs.ts);
  312 + upArr.push(rs.t);
  313 + i++;
  314 + f();
  315 + });
  316 + })();
  317 + }
  318 + });
  319 + //提交
  320 + $('[type=submit]', wrap).on('click', function () {
  321 + $(this).addClass('disabled').attr('disabled', 'disabled');
  322 + dataArray = [];
  323 + fs.data('valid', false);
  324 + fs.formValidation('validate');
  325 + });
  326 + });
  327 +
  328 + function $f(name, f) {
  329 + return $('[name=' + name + ']', f);
  330 + }
  331 +
  332 + function allValidSuccess() {
  333 + var flag = true;
  334 + $('form.add-sch-form:visible', wrap).each(function (i, f) {
  335 + if (!$(f).data('valid')) {
  336 + flag = false;
  337 + return false;
  338 + }
  339 + });
  340 + return flag;
  341 + }
  342 +
  343 + /**
  344 + * 同步2个表单的数据
  345 + */
  346 + var bcTypes = {'normal': 'normal', 'region': 'region', 'out': 'in', 'in': 'out'};
  347 + var synchroFormData = function () {
  348 + //同步班次类型
  349 + var type = $f('bcType', f1).val();
  350 + if (bcTypes[type])
  351 + $f('bcType', f2).val(bcTypes[type]).trigger('change');
  352 + var updown = $f('xlDir', f1).val();
  353 +
  354 + //1 结束时间 = 2 开始时间
  355 + $f('fcsj', f2).val($f('zdsj', f1).val());
  356 + if (type != 'out' && type != 'in') {
  357 + //走向
  358 + $f('xlDir', f2).val(updown == 0 ? 1 : 0).trigger('change');
  359 +
  360 + //第一个表单终点 = 第二个起点
  361 + var oneZdName = $('[name=zdzCode] option:selected', f1).text();
  362 + $f('qdzCode', f2).val(searchParallelStation(oneZdName, updown == 0 ? 1 : 0));
  363 + //第一个表单起点 = 第二个终点
  364 + var oneQdName = $('[name=qdzCode] option:selected', f1).text();
  365 + $f('zdzCode', f2).val(searchParallelStation(oneQdName, updown == 0 ? 1 : 0)).trigger('change');
  366 + }
  367 + else {
  368 + //进出场走向相同
  369 + $f('xlDir', f2).val(updown).trigger('change');
  370 + //第一个表单终点 = 第二个起点
  371 + $f('qdzCode', f2).val($f('zdzCode', f1).val());
  372 + //第一个表单起点 = 第二个终点
  373 + $f('zdzCode', f2).val($f('qdzCode', f1).val()).trigger('change');
  374 + }
  375 + };
  376 +
  377 +
  378 + //返回另一个走向对应的站点
  379 + function searchParallelStation(stationName, updown) {
  380 + var routes = stationRoutes[updown]
  381 + , len = routes.length;
  382 +
  383 + for (var i = 0; i < len; i++) {
  384 + if (routes[i].stationName == stationName)
  385 + return routes[i].stationCode;
  386 + }
  387 + }
  388 + })();
  389 +</script>
0 \ No newline at end of file 390 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/temp_sch/main.html 0 → 100644
  1 +<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-addsch-modal">
  2 + <div class="uk-modal-dialog" style="width: 800px;">
  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-grid">
  8 + <div class="uk-width-1-4">
  9 + <ul data-uk-switcher="{connect:'#tempScheduleContent'}" class="uk-nav uk-nav-side left_tabs_lg">
  10 + <li data-handle="normal"><a>1、临加班次</a></li>
  11 + <li data-handle="toAndFro"><a>2、往返</a></li>
  12 + <li data-handle="parkToPark"><a>3、场到场</a></li>
  13 + </ul>
  14 + </div>
  15 + <div class="uk-width-3-4">
  16 + <ul id="tempScheduleContent" class="uk-switcher">
  17 + <li class="normalCont"></li>
  18 + <li class="toAndFroCont"></li>
  19 + <li class="parkToParkCont"></li>
  20 + </ul>
  21 + </div>
  22 + </div>
  23 + </div>
  24 +
  25 + <script>
  26 + (function () {
  27 + var modal = '#schedule-addsch-modal',
  28 + sch, stationRoutes, parks, information, carsArray, st_park_data;
  29 +
  30 + $(modal).on('init', function (e, data) {
  31 + e.stopPropagation();
  32 + sch = data.sch;
  33 + //站到场数据
  34 + st_park_data = gb_data_basic.get_stat_park_data()[sch.xlBm];
  35 + //站点路由
  36 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  37 + return a.stationRouteCode - b.stationRouteCode;
  38 + }), 'directions');
  39 + //停车场
  40 + parks = gb_data_basic.simpleParksArray();
  41 + //线路标准
  42 + information = gb_data_basic.getLineInformation(sch.xlBm);
  43 + //停车场排序,常用的放前面
  44 + parks = sort_parks(parks, information, st_park_data);
  45 + //车辆信息
  46 + carsArray = gb_data_basic.carsArray();
  47 +
  48 + var st_doms = gb_schedule_context_menu.get_add_sch_doms();
  49 + //normal
  50 + $('.normalCont', modal).html(st_doms.normal_dom)
  51 + .trigger('init', {sch: sch, submitFun: submit_temp_schedule_form});
  52 +
  53 + //to and fro
  54 + $('.toAndFroCont', modal).html(st_doms.two_way_dom)
  55 + .trigger('init', {sch: sch, submitFun: submit_temp_schedule_form, stationRoutes: stationRoutes});
  56 +
  57 + //park to park
  58 + $('.parkToParkCont', modal).html(st_doms.park_to_park_dom)
  59 + .trigger('init', {sch: sch, submitFun: submit_temp_schedule_form, parks: parks, carsArray: carsArray});
  60 + });
  61 +
  62 + //init-autoCom
  63 + $(modal).on('init-autoCom', '.add-sch-form', function () {
  64 + //车辆
  65 + if(carsArray)
  66 + gb_common.carAutocomplete($('.car-autocom', this), carsArray);
  67 + //驾驶员
  68 + gb_common.personAutocomplete($('.jsy-autocom', this));
  69 + //售票员
  70 + gb_common.personAutocomplete($('.spy-autocom', this));
  71 + //备注补全
  72 + gb_common.remarksAutocomplete($('.remarks-autocom', this));
  73 + });
  74 +
  75 + //班次类型 和 上下行 切换事件
  76 + $(modal).on('change', '.add-sch-form [name=bcType],.add-sch-form [name=xlDir]', reCalcInputs_type);
  77 + //起终点站改变事件
  78 + $(modal).on('change', '[name=qdzCode],[name=zdzCode]', reCalcInputs_station);
  79 + //开始时间和公里改变
  80 + $(modal).on('input', '.add-sch-form [name=fcsj],.add-sch-form [name=jhlc]', reCalcEndTime);
  81 +
  82 +
  83 + function reCalcInputs_type() {
  84 + var f = $(this).parents('.add-sch-form');
  85 + var bcType_e = $('[name=bcType]', f)
  86 + , xlDir_e = $('[name=xlDir]', f);
  87 +
  88 + var routes = stationRoutes[xlDir_e.val()]
  89 + , lastCode = routes[routes.length - 1].stationCode
  90 + , opts = '', park_opts = '';
  91 + //station options
  92 + $.each(routes, function () {
  93 + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'
  94 + });
  95 + //park options
  96 + for(var i=0,p;p=parks[i++];)
  97 + park_opts += '<option value="' + p.code + '">' + p.name + '</option>';
  98 +
  99 + var qdz = $('[name=qdzCode]', f), zdz = $('[name=zdzCode]', f);
  100 + //var time, mileage;
  101 + switch (bcType_e.val()) {
  102 + case 'out':
  103 + qdz.html(park_opts).val(information.carPark);
  104 + zdz.html(opts);
  105 + break;
  106 + case 'in':
  107 + qdz.html(opts);
  108 + zdz.html(park_opts).val(information.carPark);
  109 + break;
  110 + default:
  111 + qdz.html(opts);
  112 + zdz.html(opts).val(lastCode);
  113 + }
  114 +
  115 + zdz.trigger('change');
  116 + f.trigger('ct_callback');
  117 + }
  118 +
  119 + function reCalcInputs_station() {
  120 + var f = $(this).parents('form'),
  121 + bcType = $('[name=bcType]', f).val(),
  122 + qdzCode = $('[name=qdzCode]', f).val(),
  123 + zdzCode =$('[name=zdzCode]', f).val(),
  124 + startDate = $('[name=fcsj]', f).val(),
  125 + upDown = $('[name=xlDir]', f).val(), mileage, time;
  126 +
  127 + //从站到场里获取数据
  128 + var stp = search_st_park(f);
  129 + if(stp){
  130 + mileage=bcType=='in'?stp['mileage1']:stp['mileage2'];
  131 + time=bcType=='in'?stp['time1']:stp['time2'];
  132 + }
  133 + else{
  134 + switch (upDown + '_' + bcType) {
  135 + case '0_out'://上行出场
  136 + mileage = information.upOutMileage;
  137 + time = information.upOutTimer;
  138 + break;
  139 + case '1_out'://下行出场
  140 + mileage = information.downOutMileage;
  141 + time = information.downOutTimer;
  142 + break;
  143 + case '0_in'://上行进场
  144 + mileage = information.upInMileage;
  145 + time = information.upInTimer;
  146 + break;
  147 + case '1_in'://下行进场
  148 + mileage = information.downInMileage;
  149 + time = information.downInTimer;
  150 + break;
  151 + default:
  152 +
  153 + var qc_time=upDown==0?information.upTravelTime:information.downTravelTime,
  154 + qc_mileage=upDown==0?information.upMileage:information.downMileage;
  155 + if(is_normal_sch(f)){
  156 + bcType='normal';
  157 + mileage=qc_mileage;
  158 + }
  159 + else{
  160 + bcType='region';
  161 + mileage = calcMileage(stationRoutes[upDown], qdzCode, zdzCode);
  162 + }
  163 +
  164 + time = gb_common.mul(gb_common.accDiv(qc_time, qc_mileage), mileage);
  165 + $('[name=bcType]', f).val(bcType);
  166 + }
  167 + }
  168 +
  169 + $('[name=jhlc]', f).val(mileage);
  170 + var et = moment(startDate, 'HH:mm').add(time, 'minutes');
  171 + $f('zdsj', f).val(et.format('HH:mm'));
  172 + f.trigger('ct_callback');
  173 + }
  174 +
  175 +
  176 + function reCalcEndTime() {
  177 + var f = $(this).parents('.add-sch-form')
  178 + , startDate = $f('fcsj', f).val()//开始时间
  179 + , mileage = $f('jhlc', f).val()//公里
  180 + , type2 = $f('bcType', f).val(),//班次类型
  181 + upDown = $('[name=xlDir]', f).val();
  182 + if (!startDate || !mileage)
  183 + return;
  184 +
  185 + var time;
  186 + //从站到场里获取数据
  187 + var stp = search_st_park(f);
  188 + if(stp){
  189 + time=type2=='in'?stp['time1']:stp['time2'];
  190 + }
  191 + else{
  192 + if (type2 == 'in')
  193 + time = upDown == 0 ? information.upInTimer : information.downInTimer;
  194 + else if (type2 == 'out')
  195 + time = upDown == 0 ? information.upOutTimer : information.downOutTimer;
  196 + else{
  197 + var qc_time=upDown==0?information.upTravelTime:information.downTravelTime,
  198 + qc_mileage=upDown==0?information.upMileage:information.downMileage;
  199 +
  200 + time = gb_common.mul(gb_common.accDiv(qc_time, qc_mileage), mileage);
  201 + }
  202 + }
  203 +
  204 + var et = moment(startDate, 'HH:mm').add(time, 'minutes');
  205 + $f('zdsj', f).val(et.format('HH:mm'));
  206 + f.trigger('ct_callback');
  207 + }
  208 +
  209 + function is_normal_sch(f) {
  210 + var qdzCode = $('[name=qdzCode]', f).val(),
  211 + zdzCode =$('[name=zdzCode]', f).val(),
  212 + upDown = $('[name=xlDir]', f).val(),
  213 + rts = stationRoutes[upDown];
  214 +
  215 + if(rts[0].stationCode == qdzCode
  216 + && rts[rts.length - 1].stationCode == zdzCode)
  217 + return true;
  218 + else
  219 + return false;
  220 + }
  221 +
  222 + function isInOut(bcType) {
  223 + return bcType=='in' || bcType=='out';
  224 + }
  225 +
  226 + /**
  227 + * 计算线路上站点间公里
  228 + */
  229 + function calcMileage(rts, s, e) {
  230 + var mileage = 0, flag, code;
  231 + $.each(rts, function () {
  232 + code = this['stationCode'];
  233 + if (flag)
  234 + mileage = gb_common.accAdd(mileage, this.distances);
  235 + if (code == s)
  236 + flag = true;
  237 + if (code == e)
  238 + return false;
  239 + });
  240 + return mileage;
  241 + }
  242 +
  243 + function search_st_park(f) {
  244 + if(!st_park_data)
  245 + return;
  246 + var stp;
  247 + var qdSelect=$f('qdzCode', f)[0],zdSelect=$f('zdzCode', f)[0];
  248 +
  249 + var qdzName=qdSelect.options[qdSelect.options.selectedIndex].text,
  250 + zdzName=zdSelect.options[zdSelect.options.selectedIndex].text,
  251 + type2 = $f('bcType', f).val();
  252 +
  253 + if(!isInOut(type2))
  254 + return;
  255 +
  256 + $.each(st_park_data, function () {
  257 + if((type2=='in' && this.stationName==qdzName && this.parkName==zdzName)
  258 + || (type2=='out' && this.stationName==zdzName && this.parkName==qdzName)){
  259 + stp = this;
  260 + return false;
  261 + }
  262 + });
  263 +
  264 + return stp;
  265 + }
  266 +
  267 + /**
  268 + * 停车场排序
  269 + * @param parks 停车场 code 2 name
  270 + * @param information 线路标准
  271 + * @param st_park_data 站到场
  272 + */
  273 + function sort_parks(parks, information, st_park_data) {
  274 + var array = [], names=[];
  275 + for(var code in parks){
  276 + array.push({code: code, name: parks[code]});
  277 + }
  278 +
  279 + if(st_park_data && st_park_data.length > 0){
  280 + $.each(st_park_data, function () {
  281 + names.push(this.parkName);
  282 + });
  283 + }
  284 +
  285 + //debugger
  286 + array.sort(function (a, b) {
  287 + if(a.code==information.carPark)
  288 + return -1;
  289 + if(b.code==information.carPark)
  290 + return 1;
  291 +
  292 + var ai = names.indexOf(a.name),
  293 + bi = names.indexOf(b.name);
  294 +
  295 + if(ai!=-1 && bi==-1)
  296 + return -1;
  297 + else if(ai==-1 && bi!=-1)
  298 + return 1;
  299 + else
  300 + return a.name.localeCompare(b.name);
  301 + });
  302 + return array;
  303 + }
  304 +
  305 + function $f(name, f) {
  306 + return $('[name=' + name + ']', f);
  307 + }
  308 +
  309 + /**
  310 + * 提交表单
  311 + */
  312 + function submit_temp_schedule_form(data, cb) {
  313 + data.xlBm = sch.xlBm;
  314 + data.xlName = sch.xlName;
  315 + data.lpName = sch.lpName;
  316 + //拆分驾驶员工号和姓名
  317 + data.jGh = data.jsy.split('/')[0];
  318 + data.jName = data.jsy.split('/')[1];
  319 + delete data.jsy;
  320 + //拆分售票员工号和姓名
  321 + if (data.spy != '') {
  322 + data.sGh = data.spy.split('/')[0];
  323 + data.sName = data.spy.split('/')[1];
  324 + delete data.spy;
  325 + }
  326 +
  327 + //公司信息
  328 + var line = gb_data_basic.findLineByCodes([data.xlBm]);
  329 + if(line && line.length > 0){
  330 + line = line[0];
  331 + data.gsBm = line.company;
  332 + data.fgsBm = line.brancheCompany;
  333 + }
  334 +
  335 + gb_common.$post('/realSchedule', data, function (rs) {
  336 + notify_succ('新增临加班次成功');
  337 + cb && cb(rs);
  338 + });
  339 + }
  340 + })();
  341 + </script>
  342 +</div>
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
@@ -19,10 +19,25 @@ var gb_schedule_context_menu = (function () { @@ -19,10 +19,25 @@ var gb_schedule_context_menu = (function () {
19 $.get(folder + '/sub_task_v2/add_range_turn.html', function (dom) { 19 $.get(folder + '/sub_task_v2/add_range_turn.html', function (dom) {
20 st_doms.range_dom=dom; 20 st_doms.range_dom=dom;
21 }); 21 });
  22 + //提前缓存临加的片段页面
  23 + var add_sch_doms={};
  24 + $.get(folder + '/temp_sch/add_normal.html', function (dom) {
  25 + add_sch_doms.normal_dom=dom;
  26 + });
  27 + $.get(folder + '/temp_sch/add_two_way.html', function (dom) {
  28 + add_sch_doms.two_way_dom=dom;
  29 + });
  30 + $.get(folder + '/temp_sch/add_park_to_park.html', function (dom) {
  31 + add_sch_doms.park_to_park_dom=dom;
  32 + });
  33 +
22 34
23 var callbackHandler = { 35 var callbackHandler = {
24 get_st_doms: function () { 36 get_st_doms: function () {
25 - return st_doms; 37 + return st_doms;
  38 + },
  39 + get_add_sch_doms: function () {
  40 + return add_sch_doms;
26 }, 41 },
27 dftz: function (sch) { 42 dftz: function (sch) {
28 open_modal(folder + '/dftz.html', { 43 open_modal(folder + '/dftz.html', {
@@ -247,7 +262,7 @@ var gb_schedule_context_menu = (function () { @@ -247,7 +262,7 @@ var gb_schedule_context_menu = (function () {
247 }); 262 });
248 }, 263 },
249 add_temp_sch: function (sch) { 264 add_temp_sch: function (sch) {
250 - open_modal(folder + '/add_temp_sch.html', { 265 + open_modal(folder + '/temp_sch/main.html', {
251 sch: sch 266 sch: sch
252 }, modal_opts); 267 }, modal_opts);
253 }, 268 },
src/main/resources/timetable.proto 0 → 100644
  1 +syntax = "proto3";
  2 +
  3 +package timetable;
  4 +
  5 +option java_package = "com.bsth.service.schedule.utils";
  6 +option java_outer_classname = "TimeTableProto";
  7 +
  8 +
  9 +// 描述时刻表的google的二进制protobuf描述
  10 +// 目前用在备份时刻表的信息
  11 +// 备份的时刻表表(TODO:)
  12 +
  13 +message TTInfo {
  14 + uint64 id = 1; // 时刻表id
  15 + string name = 2; // 时刻表名字
  16 +
  17 + uint32 xl = 3; // 线路id
  18 + string xlName = 4; // 线路名称
  19 + string xlDir = 5; // 线路上下行
  20 +
  21 + uint64 qyrq = 6; // 启用日期
  22 + bool isEnableDisTemplate = 7; // 是否启用调度模版
  23 + bool isCancel = 8; // 是否删除(标记)
  24 +
  25 + string ruleDays = 9; // 常规有效日(1-7表示星期一到星期日,多个用逗号隔开)
  26 + string specialDays = 10; // 特殊有效日期(格式:2001-01-01,多个用逗号隔开)
  27 +
  28 + uint32 createUser = 11; // 创建用户id
  29 + string createUserName = 12; // 创建用户姓名
  30 + uint32 updateUser = 13; // 更新用户id
  31 + string updateUserName = 14; // 更新用户姓名
  32 + uint64 createDate = 15; // 创建日期
  33 + uint64 updateDate = 16; // 更新日期
  34 +
  35 + // list
  36 + repeated TTInfoDetail bcInfo = 17;
  37 +}
  38 +
  39 +message TTInfoDetail {
  40 + uint64 id = 1; // 班次明细id
  41 + // TODO:时刻表主对象关联
  42 + uint32 xl = 2; // 线路id
  43 + string xlName = 3; // 线路名字
  44 +
  45 + uint64 lp = 4; // 路牌id
  46 + string lpName = 5; // 路牌名字
  47 +
  48 + uint32 fcno = 6; // 发车顺序号
  49 + string xlDir = 7; // 线路方向
  50 +
  51 + string qdzCode = 8; // 起站点代码(bsth_c_station,bsth_c_car_park 里的编码)
  52 + string qdzName = 9; // 起站点名字(bsth_c_stationroute,bsth_c_car_park里的名字)
  53 + string zdzCode = 10; // 终点站代码(bsth_c_station,bsth_c_car_park 里的编码)
  54 + string zdzName = 11; // 终点站名字(bsth_c_stationroute,bsth_c_car_park里的名字)
  55 +
  56 + string fcsj = 12; // 发车时间(格式 HH:mm)
  57 + uint32 bcs = 13; // 对应班次数
  58 + double jhlc = 14; // 计划里程
  59 + uint32 bcsj = 15; // 班次历时
  60 +
  61 + string bcType = 16; // 班次类型 字典type=ScheduleType
  62 +
  63 + bool isFB = 17; // 是否分班(表示这个班次是否是晚班班次,就是换另外一个驾驶员开)
  64 + bool isTS = 18; // 是否停驶(表示此班次执行完成,停在终点站,不进场)
  65 + string remark = 19; // 备注
  66 +
  67 +}
  68 +
  69 +
  70 +
  71 +
  72 +
  73 +
  74 +
  75 +
  76 +
  77 +
  78 +
  79 +
  80 +
  81 +
  82 +
  83 +
  84 +
  85 +
  86 +
  87 +
  88 +
  89 +
  90 +
  91 +
  92 +