Commit 1fa5d34717d8bdcfbf60c044db008dc7e6fbe954

Authored by 王通
1 parent 05a9d2cb

1.线路配置中加入调度模式

src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
1   -package com.bsth.controller.realcontrol;
2   -
3   -import com.bsth.controller.BaseController;
4   -import com.bsth.entity.realcontrol.LineConfig;
5   -import com.bsth.service.realcontrol.LineConfigService;
6   -import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.web.bind.annotation.*;
8   -
9   -import java.util.Map;
10   -
11   -@RestController
12   -@RequestMapping("/lineConfig")
13   -public class LineConfigController extends BaseController<LineConfig, Integer>{
14   -
15   - @Autowired
16   - LineConfigService lineConfigService;
17   -
18   - /**
19   - * 检查是否有线路配置信息
20   - * @param codeArray
21   - * @return
22   - */
23   - @RequestMapping("/check")
24   - public Map<String, Object> check(@RequestParam String[] codeArray){
25   - return lineConfigService.check(codeArray);
26   - }
27   -
28   - /**
29   - * 初始化线路配置
30   - * @param lineCode
31   - * @return
32   - * @throws Exception
33   - */
34   - @RequestMapping("/init/{lineCode}")
35   - public Integer init(@PathVariable("lineCode") String lineCode) throws Exception{
36   - return lineConfigService.init(lineCode);
37   - }
38   -
39   - /**
40   - * 修改班次刷新时间
41   - * @param time
42   - * @param lineCode
43   - * @return
44   - */
45   - @RequestMapping(value = "/editTime", method = RequestMethod.POST)
46   - public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){
47   - return lineConfigService.editStartOptTime(time, lineCode);
48   - }
49   -
50   - /**
51   - * 修改出场时间类型
52   - * @param lineCode
53   - * @param type
54   - * @return
55   - */
56   - @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST)
57   - public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type,@RequestParam String parkCode,@RequestParam String stationCode){
58   - return lineConfigService.editOutTimeType(lineCode, type, parkCode, stationCode);
59   - }
60   -
61   - /**
62   - * 启用原线路回场
63   - * @param lineCode
64   - * @param enable
65   - * @return
66   - */
67   - @RequestMapping(value = "/enableInParkForSource", method = RequestMethod.POST)
68   - public Map<String, Object> enableInParkForSource(@RequestParam String lineCode, @RequestParam int enable){
69   - return lineConfigService.enableInParkForSource(lineCode, enable);
70   - }
71   -
72   - /**
73   - * 根据线路编码获取配置信息
74   - * @param lineCode
75   - * @return
76   - */
77   - @RequestMapping(value = "/getByLineCode")
78   - public LineConfig getByLineCode(@RequestParam String lineCode){
79   - return lineConfigService.getByLineCode(lineCode);
80   - }
81   -
82   - @RequestMapping(value = "/findByIdx")
83   - public Map<String, Object> findByIdx(@RequestParam String idx){
84   - return lineConfigService.findByIdx(idx);
85   - }
86   -
87   - /**
88   - * 到站缓冲区设置
89   - * @param lineCode
90   - * @param field
91   - * @param value
92   - * @return
93   - */
94   - @RequestMapping(value = "/bufferTimeDiff", method = RequestMethod.POST)
95   - public Map<String, Object> bufferTimeDiff(@RequestParam String lineCode, @RequestParam String field,@RequestParam String value){
96   - return lineConfigService.bufferTimeDiff(lineCode, field, value);
97   - }
98   -
99   - /**
100   - * 应急停靠设置
101   - * @param map
102   - * @return
103   - */
104   - @RequestMapping(value = "/yjtkSet", method = RequestMethod.POST)
105   - public Map<String, Object> yjtkSet(@RequestParam Map<String, String> map){
106   - //System.out.println(map);
107   - return lineConfigService.yjtkSet(map);
108   - }
109   -
110   - /**
111   - * 修改场既是站的 停车场 和 站点
112   - * @param map
113   - * @return
114   - */
115   - @RequestMapping(value = "/parkAndStationSet", method = RequestMethod.POST)
116   - public Map<String, Object> parkAndStationSet(@RequestParam Map<String, String> map){
117   - return lineConfigService.parkAndStationSet(map);
118   - }
119   -
120   - @RequestMapping(value = "/setAutoExec", method = RequestMethod.POST)
121   - public Map<String, Object> setAutoExec(@RequestParam Map<String, String> map){
122   - return lineConfigService.setAutoExec(map);
123   - }
124   -
125   - @RequestMapping(value = "/setReadReverse")
126   - public Map<String, Object> setReadReverse(@RequestParam int status,@RequestParam String lineCode){
127   - return lineConfigService.setReadReverse(status, lineCode);
128   - }
129   -}
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.realcontrol.LineConfig;
  5 +import com.bsth.service.realcontrol.LineConfigService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.*;
  8 +
  9 +import java.util.Map;
  10 +
  11 +@RestController
  12 +@RequestMapping("/lineConfig")
  13 +public class LineConfigController extends BaseController<LineConfig, Integer>{
  14 +
  15 + @Autowired
  16 + LineConfigService lineConfigService;
  17 +
  18 + /**
  19 + * 检查是否有线路配置信息
  20 + * @param codeArray
  21 + * @return
  22 + */
  23 + @RequestMapping("/check")
  24 + public Map<String, Object> check(@RequestParam String[] codeArray){
  25 + return lineConfigService.check(codeArray);
  26 + }
  27 +
  28 + /**
  29 + * 初始化线路配置
  30 + * @param lineCode
  31 + * @return
  32 + * @throws Exception
  33 + */
  34 + @RequestMapping("/init/{lineCode}")
  35 + public Integer init(@PathVariable("lineCode") String lineCode) throws Exception{
  36 + return lineConfigService.init(lineCode);
  37 + }
  38 +
  39 + /**
  40 + * 修改班次刷新时间
  41 + * @param time
  42 + * @param lineCode
  43 + * @return
  44 + */
  45 + @RequestMapping(value = "/editTime", method = RequestMethod.POST)
  46 + public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){
  47 + return lineConfigService.editStartOptTime(time, lineCode);
  48 + }
  49 +
  50 + /**
  51 + * 修改出场时间类型
  52 + * @param lineCode
  53 + * @param type
  54 + * @return
  55 + */
  56 + @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST)
  57 + public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type,@RequestParam String parkCode,@RequestParam String stationCode){
  58 + return lineConfigService.editOutTimeType(lineCode, type, parkCode, stationCode);
  59 + }
  60 +
  61 + /**
  62 + * 启用原线路回场
  63 + * @param lineCode
  64 + * @param enable
  65 + * @return
  66 + */
  67 + @RequestMapping(value = "/enableInParkForSource", method = RequestMethod.POST)
  68 + public Map<String, Object> enableInParkForSource(@RequestParam String lineCode, @RequestParam int enable){
  69 + return lineConfigService.enableInParkForSource(lineCode, enable);
  70 + }
  71 +
  72 + /**
  73 + * 根据线路编码获取配置信息
  74 + * @param lineCode
  75 + * @return
  76 + */
  77 + @RequestMapping(value = "/getByLineCode")
  78 + public LineConfig getByLineCode(@RequestParam String lineCode){
  79 + return lineConfigService.getByLineCode(lineCode);
  80 + }
  81 +
  82 + @RequestMapping(value = "/findByIdx")
  83 + public Map<String, Object> findByIdx(@RequestParam String idx){
  84 + return lineConfigService.findByIdx(idx);
  85 + }
  86 +
  87 + /**
  88 + * 到站缓冲区设置
  89 + * @param lineCode
  90 + * @param field
  91 + * @param value
  92 + * @return
  93 + */
  94 + @RequestMapping(value = "/bufferTimeDiff", method = RequestMethod.POST)
  95 + public Map<String, Object> bufferTimeDiff(@RequestParam String lineCode, @RequestParam String field,@RequestParam String value){
  96 + return lineConfigService.bufferTimeDiff(lineCode, field, value);
  97 + }
  98 +
  99 + /**
  100 + * 应急停靠设置
  101 + * @param map
  102 + * @return
  103 + */
  104 + @RequestMapping(value = "/yjtkSet", method = RequestMethod.POST)
  105 + public Map<String, Object> yjtkSet(@RequestParam Map<String, String> map){
  106 + //System.out.println(map);
  107 + return lineConfigService.yjtkSet(map);
  108 + }
  109 +
  110 + /**
  111 + * 修改场既是站的 停车场 和 站点
  112 + * @param map
  113 + * @return
  114 + */
  115 + @RequestMapping(value = "/parkAndStationSet", method = RequestMethod.POST)
  116 + public Map<String, Object> parkAndStationSet(@RequestParam Map<String, String> map){
  117 + return lineConfigService.parkAndStationSet(map);
  118 + }
  119 +
  120 + @RequestMapping(value = "/setAutoExec", method = RequestMethod.POST)
  121 + public Map<String, Object> setAutoExec(@RequestParam Map<String, String> map){
  122 + return lineConfigService.setAutoExec(map);
  123 + }
  124 +
  125 + @RequestMapping(value = "/setReadReverse")
  126 + public Map<String, Object> setReadReverse(@RequestParam int status,@RequestParam String lineCode){
  127 + return lineConfigService.setReadReverse(status, lineCode);
  128 + }
  129 +
  130 + @RequestMapping(value = "/setScheduleMode")
  131 + public Map<String, Object> setScheduleMode(@RequestParam int scheduleMode,@RequestParam String lineCode){
  132 + return lineConfigService.setScheduleMode(scheduleMode, lineCode);
  133 + }
  134 +}
... ...
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
1   -package com.bsth.entity.realcontrol;
2   -
3   -import com.bsth.entity.Line;
4   -import com.google.common.base.Splitter;
5   -import org.apache.commons.lang3.StringUtils;
6   -import org.slf4j.Logger;
7   -import org.slf4j.LoggerFactory;
8   -
9   -import javax.persistence.*;
10   -import java.util.List;
11   -
12   -/**
13   - *
14   - * @ClassName: LineConfig
15   - * @Description: TODO(线调 线路相关配置信息)
16   - * @author PanZhao
17   - * @date 2016年8月15日 下午1:57:56
18   - *
19   - */
20   -@Entity
21   -@Table(name = "bsth_c_line_config")
22   -@NamedEntityGraphs({
23   - @NamedEntityGraph(name = "lineConfig_line_80temps", attributeNodes = {
24   - @NamedAttributeNode("line")
25   - })
26   -})
27   -public class LineConfig {
28   -
29   - @Id
30   - @GeneratedValue
31   - private Integer id;
32   -
33   - @OneToOne
34   - private Line line;
35   -
36   - /** 开始运营时间 HH:mm */
37   - private String startOpt;
38   -
39   - /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */
40   - private int outConfig;
41   -
42   - /** 出站既出场 对应的停车场 , 号分割多个*/
43   - private String twinsParks;
44   -
45   - /** 出站既出场 对应的起点站 */
46   - private String twinsStations;
47   -
48   - /** 调度指令模板 */
49   - private String schDirectiveTemp;
50   -
51   - /** 识别区间调头 */
52   - private boolean readReverse;
53   -
54   - /** 原线路回场 */
55   - private boolean inParkForSource;
56   -
57   - /** 自动执行 */
58   - private boolean autoExec;
59   -
60   - /**
61   - * 到离站偏移值
62   - */
63   -
64   - //上行进站
65   - private int upInDiff;
66   - //上行出站
67   - private int upOutDiff;
68   - //下行进站
69   - private int downInDiff;
70   - //下行出站
71   - private int downOutDiff;
72   -
73   - /**
74   - * 应急停靠
75   - */
76   - private boolean enableYjtk;
77   - /** HH:mm */
78   - private String yjtkStart;
79   - /** HH:mm */
80   - private String yjtkEnd;
81   - private int upStopMinute;
82   - private int downStopMinute;
83   -
84   - /**
85   - * 使用第一个发车时间,不匹配最佳时间
86   - */
87   - private boolean lockFirstOutTime;
88   -
89   - public Integer getId() {
90   - return id;
91   - }
92   -
93   - public void setId(Integer id) {
94   - this.id = id;
95   - }
96   -
97   - public Line getLine() {
98   - return line;
99   - }
100   -
101   - public void setLine(Line line) {
102   - this.line = line;
103   - }
104   -
105   - public String getStartOpt() {
106   - return startOpt;
107   - }
108   -
109   - public void setStartOpt(String startOpt) {
110   - this.startOpt = startOpt;
111   - }
112   -
113   - public int getOutConfig() {
114   - return outConfig;
115   - }
116   -
117   - public void setOutConfig(int outConfig) {
118   - this.outConfig = outConfig;
119   - }
120   -
121   - public String getSchDirectiveTemp() {
122   - return schDirectiveTemp;
123   - }
124   -
125   - public void setSchDirectiveTemp(String schDirectiveTemp) {
126   - this.schDirectiveTemp = schDirectiveTemp;
127   - }
128   -
129   - public boolean isReadReverse() {
130   - return readReverse;
131   - }
132   -
133   - public void setReadReverse(boolean readReverse) {
134   - this.readReverse = readReverse;
135   - }
136   -
137   - public boolean isInParkForSource() {
138   - return inParkForSource;
139   - }
140   -
141   - public void setInParkForSource(boolean inParkForSource) {
142   - this.inParkForSource = inParkForSource;
143   - }
144   -
145   - public int getUpInDiff() {
146   - return upInDiff;
147   - }
148   -
149   - public void setUpInDiff(int upInDiff) {
150   - this.upInDiff = upInDiff;
151   - }
152   -
153   - public int getUpOutDiff() {
154   - return upOutDiff;
155   - }
156   -
157   - public void setUpOutDiff(int upOutDiff) {
158   - this.upOutDiff = upOutDiff;
159   - }
160   -
161   - public int getDownInDiff() {
162   - return downInDiff;
163   - }
164   -
165   - public void setDownInDiff(int downInDiff) {
166   - this.downInDiff = downInDiff;
167   - }
168   -
169   - public int getDownOutDiff() {
170   - return downOutDiff;
171   - }
172   -
173   - public void setDownOutDiff(int downOutDiff) {
174   - this.downOutDiff = downOutDiff;
175   - }
176   -
177   -
178   - public String getYjtkStart() {
179   - return yjtkStart;
180   - }
181   -
182   - public void setYjtkStart(String yjtkStart) {
183   - this.yjtkStart = yjtkStart;
184   - }
185   -
186   - public String getYjtkEnd() {
187   - return yjtkEnd;
188   - }
189   -
190   - public void setYjtkEnd(String yjtkEnd) {
191   - this.yjtkEnd = yjtkEnd;
192   - }
193   -
194   - public int getUpStopMinute() {
195   - return upStopMinute;
196   - }
197   -
198   - public void setUpStopMinute(int upStopMinute) {
199   - this.upStopMinute = upStopMinute;
200   - }
201   -
202   - public int getDownStopMinute() {
203   - return downStopMinute;
204   - }
205   -
206   - public void setDownStopMinute(int downStopMinute) {
207   - this.downStopMinute = downStopMinute;
208   - }
209   -
210   - public boolean isEnableYjtk() {
211   - return enableYjtk;
212   - }
213   -
214   - public void setEnableYjtk(boolean enableYjtk) {
215   - this.enableYjtk = enableYjtk;
216   - }
217   -
218   -
219   - public boolean isLockFirstOutTime() {
220   - return lockFirstOutTime;
221   - }
222   -
223   - public void setLockFirstOutTime(boolean lockFirstOutTime) {
224   - this.lockFirstOutTime = lockFirstOutTime;
225   - }
226   -
227   - public boolean isAutoExec() {
228   - return autoExec;
229   - }
230   -
231   - public void setAutoExec(boolean autoExec) {
232   - this.autoExec = autoExec;
233   - }
234   -
235   - public String getTwinsParks() {
236   - return twinsParks;
237   - }
238   -
239   - public void setTwinsParks(String twinsParks) {
240   - this.twinsParks = twinsParks;
241   - }
242   -
243   - public String getTwinsStations() {
244   - return twinsStations;
245   - }
246   -
247   - public void setTwinsStations(String twinsStations) {
248   - this.twinsStations = twinsStations;
249   - }
250   -
251   -
252   - @Transient
253   - Logger logger = LoggerFactory.getLogger(this.getClass());
254   -
255   -
256   - public List<String> findTwinsParkList() {
257   - try{
258   - if(StringUtils.isEmpty(this.twinsParks))
259   - return null;
260   - return Splitter.on(",").splitToList(this.twinsParks);
261   - }catch (Exception e){
262   - logger.error("", e);
263   - return null;
264   - }
265   - }
266   -}
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import com.bsth.entity.Line;
  4 +import com.google.common.base.Splitter;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +
  9 +import javax.persistence.*;
  10 +import java.util.List;
  11 +
  12 +/**
  13 + *
  14 + * @ClassName: LineConfig
  15 + * @Description: TODO(线调 线路相关配置信息)
  16 + * @author PanZhao
  17 + * @date 2016年8月15日 下午1:57:56
  18 + *
  19 + */
  20 +@Entity
  21 +@Table(name = "bsth_c_line_config")
  22 +@NamedEntityGraphs({
  23 + @NamedEntityGraph(name = "lineConfig_line_80temps", attributeNodes = {
  24 + @NamedAttributeNode("line")
  25 + })
  26 +})
  27 +public class LineConfig {
  28 +
  29 + @Id
  30 + @GeneratedValue
  31 + private Integer id;
  32 +
  33 + @OneToOne
  34 + private Line line;
  35 +
  36 + /** 开始运营时间 HH:mm */
  37 + private String startOpt;
  38 +
  39 + /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */
  40 + private int outConfig;
  41 +
  42 + /** 出站既出场 对应的停车场 , 号分割多个*/
  43 + private String twinsParks;
  44 +
  45 + /** 出站既出场 对应的起点站 */
  46 + private String twinsStations;
  47 +
  48 + /** 调度指令模板 */
  49 + private String schDirectiveTemp;
  50 +
  51 + /** 识别区间调头 */
  52 + private boolean readReverse;
  53 +
  54 + /** 原线路回场 */
  55 + private boolean inParkForSource;
  56 +
  57 + /** 自动执行 */
  58 + private boolean autoExec;
  59 +
  60 + /**
  61 + * 调度模式 0 调度系统主调 1 网关主调 2 设备主调
  62 + */
  63 + private int scheduleMode;
  64 +
  65 + /**
  66 + * 到离站偏移值
  67 + */
  68 +
  69 + //上行进站
  70 + private int upInDiff;
  71 + //上行出站
  72 + private int upOutDiff;
  73 + //下行进站
  74 + private int downInDiff;
  75 + //下行出站
  76 + private int downOutDiff;
  77 +
  78 + /**
  79 + * 应急停靠
  80 + */
  81 + private boolean enableYjtk;
  82 + /** HH:mm */
  83 + private String yjtkStart;
  84 + /** HH:mm */
  85 + private String yjtkEnd;
  86 + private int upStopMinute;
  87 + private int downStopMinute;
  88 +
  89 + /**
  90 + * 使用第一个发车时间,不匹配最佳时间
  91 + */
  92 + private boolean lockFirstOutTime;
  93 +
  94 + public Integer getId() {
  95 + return id;
  96 + }
  97 +
  98 + public void setId(Integer id) {
  99 + this.id = id;
  100 + }
  101 +
  102 + public Line getLine() {
  103 + return line;
  104 + }
  105 +
  106 + public void setLine(Line line) {
  107 + this.line = line;
  108 + }
  109 +
  110 + public String getStartOpt() {
  111 + return startOpt;
  112 + }
  113 +
  114 + public void setStartOpt(String startOpt) {
  115 + this.startOpt = startOpt;
  116 + }
  117 +
  118 + public int getOutConfig() {
  119 + return outConfig;
  120 + }
  121 +
  122 + public void setOutConfig(int outConfig) {
  123 + this.outConfig = outConfig;
  124 + }
  125 +
  126 + public String getSchDirectiveTemp() {
  127 + return schDirectiveTemp;
  128 + }
  129 +
  130 + public void setSchDirectiveTemp(String schDirectiveTemp) {
  131 + this.schDirectiveTemp = schDirectiveTemp;
  132 + }
  133 +
  134 + public boolean isReadReverse() {
  135 + return readReverse;
  136 + }
  137 +
  138 + public void setReadReverse(boolean readReverse) {
  139 + this.readReverse = readReverse;
  140 + }
  141 +
  142 + public boolean isInParkForSource() {
  143 + return inParkForSource;
  144 + }
  145 +
  146 + public void setInParkForSource(boolean inParkForSource) {
  147 + this.inParkForSource = inParkForSource;
  148 + }
  149 +
  150 + public int getUpInDiff() {
  151 + return upInDiff;
  152 + }
  153 +
  154 + public void setUpInDiff(int upInDiff) {
  155 + this.upInDiff = upInDiff;
  156 + }
  157 +
  158 + public int getUpOutDiff() {
  159 + return upOutDiff;
  160 + }
  161 +
  162 + public void setUpOutDiff(int upOutDiff) {
  163 + this.upOutDiff = upOutDiff;
  164 + }
  165 +
  166 + public int getDownInDiff() {
  167 + return downInDiff;
  168 + }
  169 +
  170 + public void setDownInDiff(int downInDiff) {
  171 + this.downInDiff = downInDiff;
  172 + }
  173 +
  174 + public int getDownOutDiff() {
  175 + return downOutDiff;
  176 + }
  177 +
  178 + public void setDownOutDiff(int downOutDiff) {
  179 + this.downOutDiff = downOutDiff;
  180 + }
  181 +
  182 +
  183 + public String getYjtkStart() {
  184 + return yjtkStart;
  185 + }
  186 +
  187 + public void setYjtkStart(String yjtkStart) {
  188 + this.yjtkStart = yjtkStart;
  189 + }
  190 +
  191 + public String getYjtkEnd() {
  192 + return yjtkEnd;
  193 + }
  194 +
  195 + public void setYjtkEnd(String yjtkEnd) {
  196 + this.yjtkEnd = yjtkEnd;
  197 + }
  198 +
  199 + public int getUpStopMinute() {
  200 + return upStopMinute;
  201 + }
  202 +
  203 + public void setUpStopMinute(int upStopMinute) {
  204 + this.upStopMinute = upStopMinute;
  205 + }
  206 +
  207 + public int getDownStopMinute() {
  208 + return downStopMinute;
  209 + }
  210 +
  211 + public void setDownStopMinute(int downStopMinute) {
  212 + this.downStopMinute = downStopMinute;
  213 + }
  214 +
  215 + public boolean isEnableYjtk() {
  216 + return enableYjtk;
  217 + }
  218 +
  219 + public void setEnableYjtk(boolean enableYjtk) {
  220 + this.enableYjtk = enableYjtk;
  221 + }
  222 +
  223 +
  224 + public boolean isLockFirstOutTime() {
  225 + return lockFirstOutTime;
  226 + }
  227 +
  228 + public void setLockFirstOutTime(boolean lockFirstOutTime) {
  229 + this.lockFirstOutTime = lockFirstOutTime;
  230 + }
  231 +
  232 + public boolean isAutoExec() {
  233 + return autoExec;
  234 + }
  235 +
  236 + public void setAutoExec(boolean autoExec) {
  237 + this.autoExec = autoExec;
  238 + }
  239 +
  240 + public int getScheduleMode() {
  241 + return scheduleMode;
  242 + }
  243 +
  244 + public void setScheduleMode(int scheduleMode) {
  245 + this.scheduleMode = scheduleMode;
  246 + }
  247 +
  248 + public String getTwinsParks() {
  249 + return twinsParks;
  250 + }
  251 +
  252 + public void setTwinsParks(String twinsParks) {
  253 + this.twinsParks = twinsParks;
  254 + }
  255 +
  256 + public String getTwinsStations() {
  257 + return twinsStations;
  258 + }
  259 +
  260 + public void setTwinsStations(String twinsStations) {
  261 + this.twinsStations = twinsStations;
  262 + }
  263 +
  264 +
  265 + @Transient
  266 + Logger logger = LoggerFactory.getLogger(this.getClass());
  267 +
  268 +
  269 + public List<String> findTwinsParkList() {
  270 + try{
  271 + if(StringUtils.isEmpty(this.twinsParks))
  272 + return null;
  273 + return Splitter.on(",").splitToList(this.twinsParks);
  274 + }catch (Exception e){
  275 + logger.error("", e);
  276 + return null;
  277 + }
  278 + }
  279 +}
... ...
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
1   -package com.bsth.service.realcontrol;
2   -
3   -import com.bsth.entity.realcontrol.LineConfig;
4   -import com.bsth.service.BaseService;
5   -
6   -import java.util.Map;
7   -
8   -public interface LineConfigService extends BaseService<LineConfig, Integer>{
9   -
10   - Map<String, Object> check(String[] codeArray);
11   -
12   - Integer init(String lineCode) throws Exception;
13   -
14   - Map<String, Object> editStartOptTime(String time, String lineCode);
15   -
16   - Map<String, Object> editOutTimeType(String lineCode, int type, String parkCode, String stationCode);
17   -
18   - LineConfig getByLineCode(String lineCode);
19   -
20   - Map<String,Object> enableInParkForSource(String lineCode, int enable);
21   -
22   - Map<String,Object> bufferTimeDiff(String lineCode, String field, String value);
23   -
24   - Map<String,Object> yjtkSet(Map<String, String> map);
25   -
26   - Map<String,Object> parkAndStationSet(Map<String, String> map);
27   -
28   - Map<String,Object> findByIdx(String idx);
29   -
30   - Map<String,Object> setAutoExec(Map<String, String> map);
31   -
32   - Map<String,Object> setReadReverse(int status, String lineCode);
33   -}
  1 +package com.bsth.service.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.LineConfig;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +import java.util.Map;
  7 +
  8 +public interface LineConfigService extends BaseService<LineConfig, Integer>{
  9 +
  10 + Map<String, Object> check(String[] codeArray);
  11 +
  12 + Integer init(String lineCode) throws Exception;
  13 +
  14 + Map<String, Object> editStartOptTime(String time, String lineCode);
  15 +
  16 + Map<String, Object> editOutTimeType(String lineCode, int type, String parkCode, String stationCode);
  17 +
  18 + LineConfig getByLineCode(String lineCode);
  19 +
  20 + Map<String,Object> enableInParkForSource(String lineCode, int enable);
  21 +
  22 + Map<String,Object> bufferTimeDiff(String lineCode, String field, String value);
  23 +
  24 + Map<String,Object> yjtkSet(Map<String, String> map);
  25 +
  26 + Map<String,Object> parkAndStationSet(Map<String, String> map);
  27 +
  28 + Map<String,Object> findByIdx(String idx);
  29 +
  30 + Map<String,Object> setAutoExec(Map<String, String> map);
  31 +
  32 + Map<String,Object> setReadReverse(int status, String lineCode);
  33 +
  34 + Map<String,Object> setScheduleMode(int status, String lineCode);
  35 +}
... ...
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
1   -package com.bsth.service.realcontrol.impl;
2   -
3   -import com.bsth.common.ResponseCode;
4   -import com.bsth.data.LineConfigData;
5   -import com.bsth.entity.realcontrol.LineConfig;
6   -import com.bsth.repository.realcontrol.LineConfigRepository;
7   -import com.bsth.service.impl.BaseServiceImpl;
8   -import com.bsth.service.realcontrol.LineConfigService;
9   -import com.google.common.base.Splitter;
10   -import org.slf4j.Logger;
11   -import org.slf4j.LoggerFactory;
12   -import org.springframework.beans.factory.annotation.Autowired;
13   -import org.springframework.stereotype.Service;
14   -
15   -import java.lang.reflect.Field;
16   -import java.util.ArrayList;
17   -import java.util.HashMap;
18   -import java.util.List;
19   -import java.util.Map;
20   -
21   -@Service
22   -public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> implements LineConfigService {
23   -
24   - @Autowired
25   - LineConfigRepository lineConfigRepository;
26   -
27   - @Autowired
28   - LineConfigData lineConfigData;
29   -
30   - Logger logger = LoggerFactory.getLogger(this.getClass());
31   -
32   - @Override
33   - public Map<String, Object> check(String[] codeArray) {
34   - Map<String, Object> rs = new HashMap<>();
35   - List<String> notArr = new ArrayList<>();
36   -
37   - for (String lineCode : codeArray) {
38   - if (null == lineConfigData.get(lineCode + ""))
39   - notArr.add(lineCode);
40   - }
41   -
42   - if (notArr.size() > 0) {
43   - rs.put("status", 1);
44   - rs.put("not", notArr);
45   - } else
46   - rs.put("status", 0);
47   - return rs;
48   - }
49   -
50   - @Override
51   - public Integer init(String lineCode) throws Exception {
52   - LineConfig conf = lineConfigData.get(lineCode);
53   -
54   - if (conf == null)
55   - lineConfigData.init(lineCode);
56   -
57   - return 1;
58   - }
59   -
60   - @Override
61   - public Map<String, Object> editStartOptTime(String time, String lineCode) {
62   - Map<String, Object> rs = new HashMap<>();
63   - try {
64   - LineConfig conf = lineConfigData.get(lineCode);
65   - conf.setStartOpt(time);
66   - lineConfigData.set(conf);
67   -
68   - rs.put("status", ResponseCode.SUCCESS);
69   - rs.put("time", time);
70   - } catch (Exception e) {
71   - rs.put("status", ResponseCode.ERROR);
72   - rs.put("msg", e.getMessage());
73   - logger.error("", e);
74   - }
75   - return rs;
76   - }
77   -
78   - @Override
79   - public Map<String, Object> editOutTimeType(String lineCode, int type, String parkCode, String stationCode) {
80   - Map<String, Object> rs = new HashMap<>();
81   - try {
82   - LineConfig conf = lineConfigData.get(lineCode);
83   -
84   - conf.setOutConfig(type);
85   - if(type == 2){
86   - conf.setTwinsParks(parkCode);
87   - conf.setTwinsStations(stationCode);
88   - }
89   - lineConfigData.set(conf);
90   -
91   - rs.put("status", ResponseCode.SUCCESS);
92   - rs.put("conf", conf);
93   - } catch (Exception e) {
94   - rs.put("status", ResponseCode.ERROR);
95   - rs.put("msg", e.getMessage());
96   - logger.error("", e);
97   - }
98   - return rs;
99   - }
100   -
101   - @Override
102   - public LineConfig getByLineCode(String lineCode) {
103   - return lineConfigData.get(lineCode);
104   - }
105   -
106   - @Override
107   - public Map<String, Object> enableInParkForSource(String lineCode, int enable) {
108   - Map<String, Object> rs = new HashMap<>();
109   - try {
110   - LineConfig conf = lineConfigData.get(lineCode);
111   -
112   - conf.setInParkForSource(enable == 1);
113   - lineConfigData.set(conf);
114   -
115   - rs.put("status", ResponseCode.SUCCESS);
116   - rs.put("enable", enable);
117   - } catch (Exception e) {
118   - rs.put("status", ResponseCode.ERROR);
119   - rs.put("msg", e.getMessage());
120   - logger.error("", e);
121   - }
122   - return rs;
123   - }
124   -
125   - @Override
126   - public Map<String, Object> bufferTimeDiff(String lineCode, String field, String value) {
127   -
128   - Map<String, Object> rs = new HashMap<>();
129   - try {
130   - LineConfig conf = lineConfigData.get(lineCode);
131   - Field f = conf.getClass().getDeclaredField(field);
132   - f.setAccessible(true);
133   - f.setInt(conf, Integer.parseInt(value));
134   -
135   - lineConfigData.set(conf);
136   -
137   - rs.put("status", ResponseCode.SUCCESS);
138   - rs.put("field", field);
139   - rs.put("value", value);
140   - } catch (Exception e) {
141   - rs.put("status", ResponseCode.ERROR);
142   - rs.put("msg", e.getMessage());
143   - logger.error("", e);
144   - }
145   - return rs;
146   - }
147   -
148   - @Override
149   - public Map<String, Object> yjtkSet(Map<String, String> map) {
150   - String lineCode = map.get("lineCode").toString();
151   - int enableYjtk = Integer.parseInt(map.get("enableYjtk").toString());
152   -
153   - Map<String, Object> rs = new HashMap<>();
154   - try {
155   - LineConfig conf = lineConfigData.get(lineCode);
156   -
157   - if(enableYjtk == 1){
158   - String yjtkStart = map.containsKey("yjtkStart") ? map.get("yjtkStart").toString() : "00:00";
159   - String yjtkEnd = map.containsKey("yjtkEnd") ? map.get("yjtkEnd").toString() : "23:59";
160   - int upStopMinute = Integer.parseInt(map.get("upStopMinute").toString());
161   - int downStopMinute = Integer.parseInt(map.get("downStopMinute").toString());
162   -
163   - conf.setEnableYjtk(true);
164   - conf.setYjtkStart(yjtkStart);
165   - conf.setYjtkEnd(yjtkEnd);
166   - conf.setUpStopMinute(upStopMinute);
167   - conf.setDownStopMinute(downStopMinute);
168   - }
169   - else
170   - conf.setEnableYjtk(false);
171   -
172   - lineConfigData.set(conf);
173   -
174   - rs.put("status", ResponseCode.SUCCESS);
175   - rs.put("conf", conf);
176   - } catch (Exception e) {
177   - rs.put("status", ResponseCode.ERROR);
178   - rs.put("msg", e.getMessage());
179   - logger.error("", e);
180   - }
181   - return rs;
182   - }
183   -
184   - @Override
185   - public Map<String, Object> parkAndStationSet(Map<String, String> map) {
186   - String lineCode = map.get("lineCode").toString();
187   - String twinsPark = map.get("twinsPark").toString();
188   - String twinsStation = map.get("twinsStation").toString();
189   -
190   - Map<String, Object> rs = new HashMap<>();
191   - try {
192   - LineConfig conf = lineConfigData.get(lineCode);
193   - conf.setTwinsParks(twinsPark);
194   - conf.setTwinsStations(twinsStation);
195   -
196   - lineConfigData.set(conf);
197   -
198   - rs.put("status", ResponseCode.SUCCESS);
199   - rs.put("conf", conf);
200   - } catch (Exception e) {
201   - rs.put("status", ResponseCode.ERROR);
202   - rs.put("msg", e.getMessage());
203   - logger.error("", e);
204   - }
205   - return rs;
206   - }
207   -
208   - @Override
209   - public Map<String, Object> findByIdx(String idx) {
210   - Map<String, Object> rs = new HashMap();
211   - try{
212   - List<LineConfig> list = new ArrayList<>();
213   - List<String> ids = Splitter.on(",").splitToList(idx);
214   -
215   - for(String id : ids){
216   - list.add(lineConfigData.get(id));
217   - }
218   -
219   - rs.put("status", ResponseCode.SUCCESS);
220   - rs.put("list", list);
221   - }catch (Exception e){
222   - rs.put("status", ResponseCode.ERROR);
223   - logger.error("", e);
224   - }
225   - return rs;
226   - }
227   -
228   - @Override
229   - public Map<String, Object> setAutoExec(Map<String, String> map) {
230   - String lineCode = map.get("lineCode").toString();
231   - boolean autoExec = Boolean.parseBoolean(map.get("autoExec").toString());
232   -
233   - Map<String, Object> rs = new HashMap<>();
234   - try {
235   - LineConfig conf = lineConfigData.get(lineCode);
236   - conf.setAutoExec(autoExec);
237   -
238   - lineConfigData.set(conf);
239   - rs.put("status", ResponseCode.SUCCESS);
240   - rs.put("conf", conf);
241   - } catch (Exception e) {
242   - rs.put("status", ResponseCode.ERROR);
243   - rs.put("msg", e.getMessage());
244   - logger.error("", e);
245   - }
246   - return rs;
247   - }
248   -
249   - @Override
250   - public Map<String, Object> setReadReverse(int status, String lineCode) {
251   - Map<String, Object> rs = new HashMap<>();
252   - try {
253   - LineConfig conf = lineConfigData.get(lineCode);
254   - conf.setReadReverse(status==1?true:false);
255   -
256   - lineConfigData.set(conf);
257   - rs.put("status", ResponseCode.SUCCESS);
258   - rs.put("conf", conf);
259   - } catch (Exception e) {
260   - rs.put("status", ResponseCode.ERROR);
261   - rs.put("msg", e.getMessage());
262   - logger.error("", e);
263   - }
264   - return rs;
265   - }
266   -}
  1 +package com.bsth.service.realcontrol.impl;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.data.LineConfigData;
  5 +import com.bsth.entity.realcontrol.LineConfig;
  6 +import com.bsth.repository.realcontrol.LineConfigRepository;
  7 +import com.bsth.service.impl.BaseServiceImpl;
  8 +import com.bsth.service.realcontrol.LineConfigService;
  9 +import com.google.common.base.Splitter;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import java.lang.reflect.Field;
  16 +import java.util.ArrayList;
  17 +import java.util.HashMap;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +
  21 +@Service
  22 +public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> implements LineConfigService {
  23 +
  24 + @Autowired
  25 + LineConfigRepository lineConfigRepository;
  26 +
  27 + @Autowired
  28 + LineConfigData lineConfigData;
  29 +
  30 + Logger logger = LoggerFactory.getLogger(this.getClass());
  31 +
  32 + @Override
  33 + public Map<String, Object> check(String[] codeArray) {
  34 + Map<String, Object> rs = new HashMap<>();
  35 + List<String> notArr = new ArrayList<>();
  36 +
  37 + for (String lineCode : codeArray) {
  38 + if (null == lineConfigData.get(lineCode + ""))
  39 + notArr.add(lineCode);
  40 + }
  41 +
  42 + if (notArr.size() > 0) {
  43 + rs.put("status", 1);
  44 + rs.put("not", notArr);
  45 + } else
  46 + rs.put("status", 0);
  47 + return rs;
  48 + }
  49 +
  50 + @Override
  51 + public Integer init(String lineCode) throws Exception {
  52 + LineConfig conf = lineConfigData.get(lineCode);
  53 +
  54 + if (conf == null)
  55 + lineConfigData.init(lineCode);
  56 +
  57 + return 1;
  58 + }
  59 +
  60 + @Override
  61 + public Map<String, Object> editStartOptTime(String time, String lineCode) {
  62 + Map<String, Object> rs = new HashMap<>();
  63 + try {
  64 + LineConfig conf = lineConfigData.get(lineCode);
  65 + conf.setStartOpt(time);
  66 + lineConfigData.set(conf);
  67 +
  68 + rs.put("status", ResponseCode.SUCCESS);
  69 + rs.put("time", time);
  70 + } catch (Exception e) {
  71 + rs.put("status", ResponseCode.ERROR);
  72 + rs.put("msg", e.getMessage());
  73 + logger.error("", e);
  74 + }
  75 + return rs;
  76 + }
  77 +
  78 + @Override
  79 + public Map<String, Object> editOutTimeType(String lineCode, int type, String parkCode, String stationCode) {
  80 + Map<String, Object> rs = new HashMap<>();
  81 + try {
  82 + LineConfig conf = lineConfigData.get(lineCode);
  83 +
  84 + conf.setOutConfig(type);
  85 + if(type == 2){
  86 + conf.setTwinsParks(parkCode);
  87 + conf.setTwinsStations(stationCode);
  88 + }
  89 + lineConfigData.set(conf);
  90 +
  91 + rs.put("status", ResponseCode.SUCCESS);
  92 + rs.put("conf", conf);
  93 + } catch (Exception e) {
  94 + rs.put("status", ResponseCode.ERROR);
  95 + rs.put("msg", e.getMessage());
  96 + logger.error("", e);
  97 + }
  98 + return rs;
  99 + }
  100 +
  101 + @Override
  102 + public LineConfig getByLineCode(String lineCode) {
  103 + return lineConfigData.get(lineCode);
  104 + }
  105 +
  106 + @Override
  107 + public Map<String, Object> enableInParkForSource(String lineCode, int enable) {
  108 + Map<String, Object> rs = new HashMap<>();
  109 + try {
  110 + LineConfig conf = lineConfigData.get(lineCode);
  111 +
  112 + conf.setInParkForSource(enable == 1);
  113 + lineConfigData.set(conf);
  114 +
  115 + rs.put("status", ResponseCode.SUCCESS);
  116 + rs.put("enable", enable);
  117 + } catch (Exception e) {
  118 + rs.put("status", ResponseCode.ERROR);
  119 + rs.put("msg", e.getMessage());
  120 + logger.error("", e);
  121 + }
  122 + return rs;
  123 + }
  124 +
  125 + @Override
  126 + public Map<String, Object> bufferTimeDiff(String lineCode, String field, String value) {
  127 +
  128 + Map<String, Object> rs = new HashMap<>();
  129 + try {
  130 + LineConfig conf = lineConfigData.get(lineCode);
  131 + Field f = conf.getClass().getDeclaredField(field);
  132 + f.setAccessible(true);
  133 + f.setInt(conf, Integer.parseInt(value));
  134 +
  135 + lineConfigData.set(conf);
  136 +
  137 + rs.put("status", ResponseCode.SUCCESS);
  138 + rs.put("field", field);
  139 + rs.put("value", value);
  140 + } catch (Exception e) {
  141 + rs.put("status", ResponseCode.ERROR);
  142 + rs.put("msg", e.getMessage());
  143 + logger.error("", e);
  144 + }
  145 + return rs;
  146 + }
  147 +
  148 + @Override
  149 + public Map<String, Object> yjtkSet(Map<String, String> map) {
  150 + String lineCode = map.get("lineCode").toString();
  151 + int enableYjtk = Integer.parseInt(map.get("enableYjtk").toString());
  152 +
  153 + Map<String, Object> rs = new HashMap<>();
  154 + try {
  155 + LineConfig conf = lineConfigData.get(lineCode);
  156 +
  157 + if(enableYjtk == 1){
  158 + String yjtkStart = map.containsKey("yjtkStart") ? map.get("yjtkStart").toString() : "00:00";
  159 + String yjtkEnd = map.containsKey("yjtkEnd") ? map.get("yjtkEnd").toString() : "23:59";
  160 + int upStopMinute = Integer.parseInt(map.get("upStopMinute").toString());
  161 + int downStopMinute = Integer.parseInt(map.get("downStopMinute").toString());
  162 +
  163 + conf.setEnableYjtk(true);
  164 + conf.setYjtkStart(yjtkStart);
  165 + conf.setYjtkEnd(yjtkEnd);
  166 + conf.setUpStopMinute(upStopMinute);
  167 + conf.setDownStopMinute(downStopMinute);
  168 + }
  169 + else
  170 + conf.setEnableYjtk(false);
  171 +
  172 + lineConfigData.set(conf);
  173 +
  174 + rs.put("status", ResponseCode.SUCCESS);
  175 + rs.put("conf", conf);
  176 + } catch (Exception e) {
  177 + rs.put("status", ResponseCode.ERROR);
  178 + rs.put("msg", e.getMessage());
  179 + logger.error("", e);
  180 + }
  181 + return rs;
  182 + }
  183 +
  184 + @Override
  185 + public Map<String, Object> parkAndStationSet(Map<String, String> map) {
  186 + String lineCode = map.get("lineCode").toString();
  187 + String twinsPark = map.get("twinsPark").toString();
  188 + String twinsStation = map.get("twinsStation").toString();
  189 +
  190 + Map<String, Object> rs = new HashMap<>();
  191 + try {
  192 + LineConfig conf = lineConfigData.get(lineCode);
  193 + conf.setTwinsParks(twinsPark);
  194 + conf.setTwinsStations(twinsStation);
  195 +
  196 + lineConfigData.set(conf);
  197 +
  198 + rs.put("status", ResponseCode.SUCCESS);
  199 + rs.put("conf", conf);
  200 + } catch (Exception e) {
  201 + rs.put("status", ResponseCode.ERROR);
  202 + rs.put("msg", e.getMessage());
  203 + logger.error("", e);
  204 + }
  205 + return rs;
  206 + }
  207 +
  208 + @Override
  209 + public Map<String, Object> findByIdx(String idx) {
  210 + Map<String, Object> rs = new HashMap();
  211 + try{
  212 + List<LineConfig> list = new ArrayList<>();
  213 + List<String> ids = Splitter.on(",").splitToList(idx);
  214 +
  215 + for(String id : ids){
  216 + list.add(lineConfigData.get(id));
  217 + }
  218 +
  219 + rs.put("status", ResponseCode.SUCCESS);
  220 + rs.put("list", list);
  221 + }catch (Exception e){
  222 + rs.put("status", ResponseCode.ERROR);
  223 + logger.error("", e);
  224 + }
  225 + return rs;
  226 + }
  227 +
  228 + @Override
  229 + public Map<String, Object> setAutoExec(Map<String, String> map) {
  230 + String lineCode = map.get("lineCode").toString();
  231 + boolean autoExec = Boolean.parseBoolean(map.get("autoExec").toString());
  232 +
  233 + Map<String, Object> rs = new HashMap<>();
  234 + try {
  235 + LineConfig conf = lineConfigData.get(lineCode);
  236 + conf.setAutoExec(autoExec);
  237 +
  238 + lineConfigData.set(conf);
  239 + rs.put("status", ResponseCode.SUCCESS);
  240 + rs.put("conf", conf);
  241 + } catch (Exception e) {
  242 + rs.put("status", ResponseCode.ERROR);
  243 + rs.put("msg", e.getMessage());
  244 + logger.error("", e);
  245 + }
  246 + return rs;
  247 + }
  248 +
  249 + @Override
  250 + public Map<String, Object> setReadReverse(int status, String lineCode) {
  251 + Map<String, Object> rs = new HashMap<>();
  252 + try {
  253 + LineConfig conf = lineConfigData.get(lineCode);
  254 + conf.setReadReverse(status==1?true:false);
  255 +
  256 + lineConfigData.set(conf);
  257 + rs.put("status", ResponseCode.SUCCESS);
  258 + rs.put("conf", conf);
  259 + } catch (Exception e) {
  260 + rs.put("status", ResponseCode.ERROR);
  261 + rs.put("msg", e.getMessage());
  262 + logger.error("", e);
  263 + }
  264 + return rs;
  265 + }
  266 +
  267 + @Override
  268 + public Map<String, Object> setScheduleMode(int scheduleMode, String lineCode) {
  269 + Map<String, Object> rs = new HashMap<>();
  270 + try {
  271 + LineConfig conf = lineConfigData.get(lineCode);
  272 + conf.setScheduleMode(scheduleMode);
  273 +
  274 + lineConfigData.set(conf);
  275 + rs.put("status", ResponseCode.SUCCESS);
  276 + rs.put("conf", conf);
  277 + } catch (Exception e) {
  278 + rs.put("status", ResponseCode.ERROR);
  279 + rs.put("msg", e.getMessage());
  280 + logger.error("", e);
  281 + }
  282 + return rs;
  283 + }
  284 +}
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/line_config/line_config.html
1   -<div id="nav-line_config-modal" class="uk-modal">
2   - <div class="uk-modal-dialog uk-modal-dialog-blank" style="overflow: hidden;">
3   - <button class="uk-modal-close uk-close" type="button"></button>
4   - <div class="uk-grid uk-flex-middle" data-uk-grid-margin>
5   - <div class="uk-width-medium-1-6 uk-height-viewport line-config-tree" data-uk-observe>
6   - <h3 class="title">线路配置</h3>
7   - <div class="uk-accordion" data-uk-accordion="{showfirst:false}" style="height:calc(100vh - 70px);overflow-y:scroll;"></div>
8   - </div>
9   - <div class="uk-width-medium-5-6 uk-height-viewport right-container" data-uk-observe>
10   - <div id="line_config_entity_panel"></div>
11   - <div id="buffer_config_panel"></div>
12   - </div>
13   - </div>
14   - </div>
15   -
16   -
17   - <script id="nav-line_config-modal-tree-temp" type="text/html">
18   - {{each array as line i}}
19   - <h3 class="uk-accordion-title" data-id="{{line.lineCode}}">{{line.name}}</h3>
20   - <div class="uk-accordion-content">
21   - <ul class="uk-list uk-list-line" id="smooth_scroll_list">
22   - <li><a data-href="#schedule_reload_time_panel" >班次更新时间</a></li>
23   - <li><a data-href="#schedule_auto_exec_panel" >班次自动执行</a></li>
24   - <li><a data-href="#out_time_type_panel" >出场时间类型</a></li>
25   - <li><a data-href="#in_park_source_panel" >原线路回场</a></li>
26   - <li><a data-href="#buffer_inOut_diff_panel">到站缓冲区设置</a></li>
27   - <li><a data-href="#emergency_stop_panel">应急停靠</a></li>
28   - <li><a class="disabled">社会加油站</a></li>
29   - <li><a class="disabled">到离站预测</a></li>
30   - <li><a class="disabled">挂牌时刻表</a></li>
31   - </ul>
32   - </div>
33   - {{/each}}
34   - </script>
35   -
36   - <script>
37   - (function () {
38   - var modal = '#nav-line_config-modal',
39   - lineConfig, activeCode;
40   -
41   - //初始化滚动条
42   - $('.right-container', modal).perfectScrollbar({suppressScrollX: true});
43   - /**
44   - * 手风琴拨动
45   - */
46   - $('.uk-accordion').on('toggle.uk.accordion', function (e, active, toggle, content) {
47   - if(active){
48   - activeCode = $(toggle).data('id');
49   - load();
50   - }
51   - });
52   -
53   - $(modal).on('init', function (e, data) {
54   - e.stopPropagation();
55   - var htmlStr = template('nav-line_config-modal-tree-temp', {array: gb_data_basic.activeLines});
56   - $('.line-config-tree .uk-accordion', modal).html(htmlStr);
57   -
58   - if(data.activeCode)
59   - activeCode = data.activeCode;
60   - else{
61   - //展开tab激活的线路
62   - var $activeTab = $('#main-tab-content>li.line_schedule.uk-active');
63   - if($activeTab.length > 0)
64   - activeCode = $activeTab.data('id');
65   - else{
66   - //展开第一个
67   - var $first = $('.uk-accordion-title:eq(0)', modal);
68   - activeCode = $first.data('id');
69   - }
70   - }
71   -
72   - setTimeout(function () {
73   - $('.uk-accordion-title[data-id='+activeCode+']', modal).trigger('click');
74   - }, 500);
75   - });
76   -
77   -
78   - var load = function () {
79   - //获取线路配置信息
80   - $.get('/lineConfig/getByLineCode', {lineCode: activeCode}, function (conf) {
81   - lineConfig = conf;
82   -
83   - loadConfigEntity();
84   - loadBufferConfig();
85   -
86   - setTimeout(function () {
87   - //更新滚动条高度
88   - $('.right-container', modal).perfectScrollbar('update');
89   - }, 500);
90   - });
91   - };
92   -
93   - //线路配置表属性设置
94   - var loadConfigEntity = function () {
95   - $.get('/real_control_v2/fragments/north/nav/line_config/line_config_entity.html', function (attrDom) {
96   - $('.right-container #line_config_entity_panel', modal)
97   - .html(attrDom)
98   - .find('#line_config_entity_wrap')
99   - .trigger('init', {lineConfig: lineConfig});
100   - });
101   - };
102   -
103   - //缓冲区设置
104   - var loadBufferConfig = function () {
105   - $.get('/real_control_v2/fragments/north/nav/line_config/buffer_config.html', function (attrDom) {
106   - $('.right-container #buffer_config_panel', modal)
107   - .html(attrDom)
108   - .find('#buffer_config_wrap')
109   - .trigger('init', {lineConfig: lineConfig});
110   - });
111   - };
112   -
113   - //瞄点
114   - $(modal).on('click', '#smooth_scroll_list>li>a', function () {
115   - var id = $(this).data('href');
116   - scrollToElement($(id, modal));
117   - });
118   -
119   - function scrollToElement(ele) {
120   - var cont = $('.right-container', modal), diff = 10;
121   - cont.animate({
122   - scrollTop: ele.offset().top - cont.offset().top + cont.scrollTop() - diff
123   - }, 300);
124   - }
125   - })();
126   - </script>
127   -</div>
  1 +<div id="nav-line_config-modal" class="uk-modal">
  2 + <div class="uk-modal-dialog uk-modal-dialog-blank" style="overflow: hidden;">
  3 + <button class="uk-modal-close uk-close" type="button"></button>
  4 + <div class="uk-grid uk-flex-middle" data-uk-grid-margin>
  5 + <div class="uk-width-medium-1-6 uk-height-viewport line-config-tree" data-uk-observe>
  6 + <h3 class="title">线路配置</h3>
  7 + <div class="uk-accordion" data-uk-accordion="{showfirst:false}" style="height:calc(100vh - 70px);overflow-y:scroll;"></div>
  8 + </div>
  9 + <div class="uk-width-medium-5-6 uk-height-viewport right-container" data-uk-observe>
  10 + <div id="line_config_entity_panel"></div>
  11 + <div id="buffer_config_panel"></div>
  12 + </div>
  13 + </div>
  14 + </div>
  15 +
  16 +
  17 + <script id="nav-line_config-modal-tree-temp" type="text/html">
  18 + {{each array as line i}}
  19 + <h3 class="uk-accordion-title" data-id="{{line.lineCode}}">{{line.name}}</h3>
  20 + <div class="uk-accordion-content">
  21 + <ul class="uk-list uk-list-line" id="smooth_scroll_list">
  22 + <li><a data-href="#schedule_mode_panel" >调度模式</a></li>
  23 + <li><a data-href="#schedule_reload_time_panel" >班次更新时间</a></li>
  24 + <li><a data-href="#schedule_auto_exec_panel" >班次自动执行</a></li>
  25 + <li><a data-href="#out_time_type_panel" >出场时间类型</a></li>
  26 + <li><a data-href="#in_park_source_panel" >原线路回场</a></li>
  27 + <li><a data-href="#buffer_inOut_diff_panel">到站缓冲区设置</a></li>
  28 + <li><a data-href="#emergency_stop_panel">应急停靠</a></li>
  29 + <li><a class="disabled">社会加油站</a></li>
  30 + <li><a class="disabled">到离站预测</a></li>
  31 + <li><a class="disabled">挂牌时刻表</a></li>
  32 + </ul>
  33 + </div>
  34 + {{/each}}
  35 + </script>
  36 +
  37 + <script>
  38 + (function () {
  39 + var modal = '#nav-line_config-modal',
  40 + lineConfig, activeCode;
  41 +
  42 + //初始化滚动条
  43 + $('.right-container', modal).perfectScrollbar({suppressScrollX: true});
  44 + /**
  45 + * 手风琴拨动
  46 + */
  47 + $('.uk-accordion').on('toggle.uk.accordion', function (e, active, toggle, content) {
  48 + if(active){
  49 + activeCode = $(toggle).data('id');
  50 + load();
  51 + }
  52 + });
  53 +
  54 + $(modal).on('init', function (e, data) {
  55 + e.stopPropagation();
  56 + var htmlStr = template('nav-line_config-modal-tree-temp', {array: gb_data_basic.activeLines});
  57 + $('.line-config-tree .uk-accordion', modal).html(htmlStr);
  58 +
  59 + if(data.activeCode)
  60 + activeCode = data.activeCode;
  61 + else{
  62 + //展开tab激活的线路
  63 + var $activeTab = $('#main-tab-content>li.line_schedule.uk-active');
  64 + if($activeTab.length > 0)
  65 + activeCode = $activeTab.data('id');
  66 + else{
  67 + //展开第一个
  68 + var $first = $('.uk-accordion-title:eq(0)', modal);
  69 + activeCode = $first.data('id');
  70 + }
  71 + }
  72 +
  73 + setTimeout(function () {
  74 + $('.uk-accordion-title[data-id='+activeCode+']', modal).trigger('click');
  75 + }, 500);
  76 + });
  77 +
  78 +
  79 + var load = function () {
  80 + //获取线路配置信息
  81 + $.get('/lineConfig/getByLineCode', {lineCode: activeCode}, function (conf) {
  82 + lineConfig = conf;
  83 +
  84 + loadConfigEntity();
  85 + loadBufferConfig();
  86 +
  87 + setTimeout(function () {
  88 + //更新滚动条高度
  89 + $('.right-container', modal).perfectScrollbar('update');
  90 + }, 500);
  91 + });
  92 + };
  93 +
  94 + //线路配置表属性设置
  95 + var loadConfigEntity = function () {
  96 + $.get('/real_control_v2/fragments/north/nav/line_config/line_config_entity.html', function (attrDom) {
  97 + $('.right-container #line_config_entity_panel', modal)
  98 + .html(attrDom)
  99 + .find('#line_config_entity_wrap')
  100 + .trigger('init', {lineConfig: lineConfig});
  101 + });
  102 + };
  103 +
  104 + //缓冲区设置
  105 + var loadBufferConfig = function () {
  106 + $.get('/real_control_v2/fragments/north/nav/line_config/buffer_config.html', function (attrDom) {
  107 + $('.right-container #buffer_config_panel', modal)
  108 + .html(attrDom)
  109 + .find('#buffer_config_wrap')
  110 + .trigger('init', {lineConfig: lineConfig});
  111 + });
  112 + };
  113 +
  114 + //瞄点
  115 + $(modal).on('click', '#smooth_scroll_list>li>a', function () {
  116 + var id = $(this).data('href');
  117 + scrollToElement($(id, modal));
  118 + });
  119 +
  120 + function scrollToElement(ele) {
  121 + var cont = $('.right-container', modal), diff = 10;
  122 + cont.animate({
  123 + scrollTop: ele.offset().top - cont.offset().top + cont.scrollTop() - diff
  124 + }, 300);
  125 + }
  126 + })();
  127 + </script>
  128 +</div>
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/line_config/line_config_entity.html
1   -<!-- 线路配置表相关属性 -->
2   -<div id="line_config_entity_wrap">
3   - <form class="uk-form"></form>
4   -
5   - <script id="line_config_entity_form-temp" type="text/html">
6   - <div id="schedule_reload_time_panel">
7   - <h2 class="btn_title_line">
8   - <a class="uk-link-reset">班次更新时间</a>
9   - </h2>
10   - <div>
11   - <div>
12   - <span class="line_name"></span>每天
13   - <div class="uk-form-icon" style="margin: 0 5px;">
14   - <i class="uk-icon-clock-o"></i>
15   - <input name="startOptInput" class="z-depth-input" value="{{startOpt}}"
16   - style="width: 151px;"
17   - type="time">
18   - </div>
19   - 更新到当日排班
20   - </div>
21   - <ul class="uk-list">
22   - <li>
23   - <small><i class="uk-icon-question-circle"></i> 所有发车时间小于该时间的班次都默认跨过24点,手动调整的实发实达均应用此规则。</small>
24   - </li>
25   - </ul>
26   - <button class="uk-button uk-button-mini" id="clearRealScheduleBtn">删除实际排班</button>
27   - <button class="uk-button uk-button-mini" id="reLoadRealScheduleBtn">重新加载实际排班</button>
28   - <button class="uk-button uk-button-mini" disabled>加载历史GPS恢复到离站</button>
29   - </div>
30   - </div>
31   -
32   - <div id="schedule_auto_exec_panel">
33   - <h2 class="btn_title_line">
34   - <a class="uk-link-reset">班次自动执行</a>
35   - </h2>
36   - <div>
37   - <div>
38   - <label>
39   - <input type="checkbox" id="enableAutoExec" {{autoExec?"checked":""}}> 启用自动班次执行
40   - </label>
41   - </div>
42   - <ul class="uk-list">
43   - <li>
44   - <small style="color: red;font-size: 14px;">1、 你必须只应该对【无固定走向且无人监管的线路】启用此项。</small>
45   - </li>
46   - <li>
47   - <small>2、启用该选项后,系统将不再依赖相关定位信号来执行班次。</small>
48   - </li>
49   - <li>
50   - <small>3、系统将在合适的时候自动填入实发实达时间,以完善报表。</small>
51   - </li>
52   - <li>
53   - <small>4、系统不会下发班次调度指令。</small>
54   - </li>
55   - </ul>
56   - </div>
57   - </div>
58   -
59   - <div id="out_time_type_panel">
60   - <h2 class="btn_title_line">
61   - <a class="uk-link-reset">出场时间类型</a>
62   - </h2>
63   - <div>
64   - 使用
65   - <select name="outParkTypeSelect" class="z-depth-input">
66   - <option {{if outConfig==0}}selected{{/if}} value=0>GPS出场</option>
67   - <option {{if outConfig==1}}selected{{/if}} value=1>请求出场</option>
68   - <option {{if outConfig==2}}selected{{/if}} value=2>出站既出场</option>
69   - </select>
70   - 时间作为进出场班次的实际时间
71   - <div class="park-and-station-wrap" style="display: {{outConfig==2?'block':'none'}}">
72   - <div class="c_2_s_list"></div>
73   - <span class="add_btn_span"><i class="uk-icon-plus"></i>添加</span>
74   - </div>
75   - <ul class="uk-list">
76   - <li>
77   - <small>1、【GPS出场】 使用GPS信号捕获出场时间</small>
78   - </li>
79   - <li>
80   - <small>2、【请求出场】 驾驶员请求出场,调度员同意后,取请求时间作为出场时间。如无请求出场,则捕获GPS时间。</small>
81   - </li>
82   - <li>
83   - <small>3、【出站既出场】 忽略出场班次,以头班车的发车时间作为出场时间。</small>
84   - </li>
85   - </ul>
86   - </div>
87   - </div>
88   -
89   - <div id="in_park_source_panel">
90   - <h2 class="btn_title_line">
91   - <a class="uk-link-reset">原线路回场</a>
92   - </h2>
93   - <div>
94   - 是否启用
95   - <select name="inParkForSourceSelect" class="z-depth-input" disabled>
96   - <option value="0">禁用</option>
97   - <option value="1">启用</option>
98   - </select>
99   -
100   - <ul class="uk-list">
101   - <li>
102   - <small><i class="uk-icon-question-circle"></i> 回场时先回起点站,然后起点站回场。</small>
103   - </li>
104   - <li>
105   - <small><i class="uk-icon-question-circle"></i> 启用该项后,回场子任务公里 = 中途站到起点站间公里 + 线路标准回场公里 。</small>
106   - </li>
107   - </ul>
108   - </div>
109   - </div>
110   - </script>
111   -
112   - <script id="park-and-station-temp" type="text/html">
113   - <div class="item">
114   - <span>停车场</span>
115   - <select class="z-depth-input" name="twinsPark">
116   - {{each parks as p i}}
117   - <option value="{{p.code}}" {{if p.code==cPark}}selected{{/if}}>{{p.name}}</option>
118   - {{/each}}
119   - </select>
120   - <span>&nbsp;既是站点</span>
121   - <select class="z-depth-input" name="twinsStation">
122   - {{each routes as r i}}
123   - <option value="{{r.stationCode}}" {{if r.stationCode==cStation}}selected{{/if}}>{{r.stationName}}
124   - </option>
125   - {{/each}}
126   - </select>
127   - {{if index>0}}
128   - <a class="uk-close uk-close-alt"></a>
129   - {{/if}}
130   - </div>
131   - </script>
132   -
133   - <script id="park-and-station-2-temp" type="text/html">
134   - <div class="item">
135   - <span>停车场</span>
136   - <select class="z-depth-input" name="twinsPark">
137   - {{each parks as p i}}
138   - <option value="{{p.code}}" {{if p.code==cPark}}selected{{/if}}>{{p.name}}</option>
139   - {{/each}}
140   - </select>
141   - <span>&nbsp;既是站点</span>
142   - <select class="z-depth-input" name="twinsStation">
143   - {{each routes as r i}}
144   - <option value="{{r.stationCode}}" {{if r.stationCode==cStation}}selected{{/if}}>{{r.stationName}}
145   - </option>
146   - {{/each}}
147   - </select>
148   - <a class="uk-close uk-close-alt"></a>
149   - </div>
150   - </script>
151   - <script>
152   - (function () {
153   -
154   - var wrap = '#line_config_entity_wrap', conf, parks, upStationRoutes;
155   -
156   - /**
157   - * 删除实际排班
158   - */
159   - var clearRealSchedule = function (e) {
160   - e.stopPropagation();
161   - var lineCode = conf.line.lineCode;
162   - var htmlStr = '<h4 style="color: red;">你确定要删除【' + conf.line.name + '】今日的实际排班?</h4><h5 style="margin-top: 15px;">今日的实际排班会被删除</h5><h5 style="margin-top: 15px;">人车、路牌、待发等相关班次调整信息会被删除。</h5><h5 style="margin-top: 15px;">调度指令和期间与设备的通讯记录被保留</h5><h5 style="margin-top: 15px;">后台日志中的人工操作痕迹被保留</h5>';
163   - alt_confirm(htmlStr, function () {
164   - show_wait_modal('正在清除数据...');
165   - gb_common.$post('/realSchedule/deleteRealSchedule', {lineCode: lineCode}, function () {
166   - //刷新班次表格
167   - gb_schedule_table.reLoadAndRefresh(lineCode);
168   - hide_wait_modal();
169   - notify_succ('删除班次成功!!!');
170   - });
171   - }, '确认删除' + conf.line.name + '的实际排班', true);
172   -
173   - return false;
174   - };
175   -
176   - /**
177   - * 重新载入实际排班
178   - */
179   - var reLoadRealSchedule = function (e) {
180   - e.stopPropagation();
181   - var lineCode = conf.line.lineCode;
182   - show_wait_modal('正在重载数据...');
183   - gb_common.$post('/realSchedule/reLoadRealSchedule', {lineCode: lineCode}, function () {
184   - //刷新班次表格
185   - gb_schedule_table.reLoadAndRefresh(lineCode);
186   - hide_wait_modal();
187   - notify_succ('重新载入班次成功');
188   - });
189   - return false;
190   - };
191   -
192   - $(wrap).on('init', function (e, data) {
193   - e.stopPropagation();
194   - conf = data.lineConfig;
195   - //停车场
196   - $.get('/basic/parks', function (rs) {
197   - parks = [];
198   - for (var code in rs) {
199   - parks.push({code: code, name: rs[code]});
200   - }
201   -
202   - parks.sort(function (a, b) {
203   - return $.trim(a.name).localeCompare($.trim(b.name), 'zh-CN');
204   - });
205   - renderPSDom();
206   - });
207   - //上行站点路由
208   - upStationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(conf.line.lineCode).sort(function (a, b) {
209   - return a.stationRouteCode - b.stationRouteCode;
210   - }), 'directions')[0];
211   -
212   - var htmlStr = template('line_config_entity_form-temp', conf);
213   - $('form', wrap).html(htmlStr);
214   -
215   - $('.line_name', '#line_config_entity_wrap').text(conf.line.name);
216   - //更新排班时间
217   - $('input[name=startOptInput]', wrap).on('change', updateStartTime);
218   - //出场时间类型
219   - $('select[name=outParkTypeSelect]', wrap).on('change', updateOutParkType);
220   - //原线路回场
221   - $('select[name=inParkForSourceSelect]', wrap).on('change', enableInParkForSource);
222   - //删除班次
223   - $('#clearRealScheduleBtn', wrap).on('click', clearRealSchedule);
224   - //重新载入实际排班
225   - $('#reLoadRealScheduleBtn', wrap).on('click', reLoadRealSchedule);
226   - $('#enableAutoExec', wrap).on('click', autoExecFun);
227   - });
228   -
229   - function changeTwinsParkAndStation() {
230   - var parks='',stations=''
231   - ,$panel = $('.park-and-station-wrap', wrap);
232   -
233   - $('select[name=twinsPark]', $panel).each(function () {
234   - parks += ($(this).val() + ',');
235   - });
236   -
237   - $('select[name=twinsStation]', $panel).each(function () {
238   - stations += ($(this).val() + ',');
239   - });
240   -
241   - if(parks.length > 0)
242   - parks = parks.substr(0, parks.length - 1);
243   - if(stations.length > 0)
244   - stations = stations.substr(0, stations.length - 1);
245   -
246   - gb_common.$post('/lineConfig/parkAndStationSet', {
247   - lineCode: conf.line.lineCode,
248   - twinsPark: parks,
249   - twinsStation: stations
250   - }, function (rs) {
251   - notify_succ('已保存!!');
252   - conf = rs.conf;
253   - });
254   - }
255   -
256   - //更新排班时间
257   - var startOptFlag;
258   -
259   - function updateStartTime() {
260   - if (startOptFlag || $(this).val() == conf.startOpt)
261   - return;
262   - startOptFlag = true;
263   - var that = this;
264   - setTimeout(function () {
265   - var timeStr = $(that).val();
266   - gb_common.$post('/lineConfig/editTime', {
267   - lineCode: conf.line.lineCode,
268   - time: timeStr
269   - }, function (rs) {
270   - notify_succ('班次更新时间调整为 ' + timeStr);
271   - conf.startOpt = rs.time;
272   - });
273   - startOptFlag = false;
274   - }, 300);
275   - }
276   -
277   - function updateOutParkType() {
278   - var type = $(this).val();
279   - var lineCode = conf.line.lineCode;
280   -
281   - var data = {lineCode: lineCode, type: type, parkCode: '', stationCode: ''};
282   - //出站既是出场
283   - if (type == 2) {
284   - //如果配置上有信息
285   - if(conf.twinsParks){
286   - data.parkCode = conf.twinsParks;
287   - data.stationCode = conf.twinsStations;
288   - }
289   - else{
290   - data.parkCode = gb_data_basic.getLineInformation(lineCode).carPark;//默认关联 线路标准停车场
291   - data.stationCode = upStationRoutes[0].stationCode;//和上行起点站
292   - }
293   - }
294   - gb_common.$post('/lineConfig/editOutTimeType', data, function (rs) {
295   - notify_succ('调整出场时间类型成功!');
296   - conf = rs.conf;
297   -
298   - //渲染场站关联dom
299   - renderPSDom();
300   - });
301   - }
302   -
303   -
304   -
305   - function enableInParkForSource() {
306   - var enable = $(this).val();
307   - gb_common.$post('/lineConfig/enableInParkForSource', {
308   - lineCode: conf.line.lineCode,
309   - enable: enable
310   - }, function () {
311   - notify_succ((enable == 1 ? '启用' : '禁用') + '原线路回场');
312   - conf.inParkForSource = enable;
313   - });
314   - }
315   -
316   - /**
317   - * 渲染场既是站dom
318   - */
319   - function renderPSDom() {
320   - var pArray = conf.twinsParks.split(','),
321   - cArray = conf.twinsStations.split(',');
322   - var htmlStr = '',
323   - $panel = $('.park-and-station-wrap', wrap);
324   -
325   - $('.c_2_s_list', $panel).html('');
326   - if(conf['outConfig']!=2){
327   - $panel.hide().find('.c_2_s_list').empty();
328   - return;
329   - }
330   -
331   - if(!conf.twinsParks)
332   - return;
333   -
334   - for(var i=0,len=pArray.length; i<len; i++){
335   - htmlStr = template('park-and-station-temp', {
336   - parks: parks,
337   - conf: conf,
338   - cPark: pArray[i],
339   - cStation: cArray[i],
340   - index: i,
341   - routes: [upStationRoutes[0], upStationRoutes[upStationRoutes.length - 1]]
342   - });
343   - $('.c_2_s_list', $panel).append(htmlStr);
344   - }
345   - $panel.show();
346   -
347   - //切换场既是站的,停车场和站点
348   - //$('select[name=twinsPark]', wrap).on('change', changeTwinsParkAndStation);
349   - //$('select[name=twinsStation]', wrap).on('change', changeTwinsParkAndStation);
350   - }
351   -
352   - /**
353   - * 自动执行
354   - */
355   - function autoExecFun(){
356   - var that = this;
357   - if(that.checked){
358   - that.checked = false;
359   - alt_confirm('<span style="color: red;font-size: 16px;">启用【' + conf.line.name + '】的自动执行功能?</span>', function () {
360   - var data = {
361   - lineCode: conf.line.lineCode,
362   - autoExec: true
363   - };
364   - gb_common.$post('/lineConfig/setAutoExec', data, function (rs) {
365   - notify_succ('启用成功!');
366   - conf = rs.conf;
367   -
368   - that.checked = true;
369   - });
370   - }, '我确定要将【' + conf.line.name + '】设置为自动执行', true);
371   - }
372   - else{
373   - that.checked = true;
374   - alt_confirm('<span style="color: red;font-size: 16px;">禁用【' + conf.line.name + '】的自动执行功能?</span>', function () {
375   - var data = {
376   - lineCode: conf.line.lineCode,
377   - autoExec: false
378   - };
379   - gb_common.$post('/lineConfig/setAutoExec', data, function (rs) {
380   - notify_succ('禁用成功!');
381   - conf = rs.conf;
382   -
383   - that.checked = false;
384   - });
385   - }, '我确定要禁用【' + conf.line.name + '】的自动执行', true);
386   - }
387   - }
388   -
389   - /**
390   - * 添加新的 场既是站
391   - */
392   - $(wrap).on('click', '.add_btn_span', function () {
393   - var htmlStr = '',
394   - $panel = $('.park-and-station-wrap', wrap);
395   -
396   - var $lastItem = $('.c_2_s_list>.item:last', $panel)
397   - ,lastTcc = $('select[name=twinsPark]', $lastItem).val()
398   - ,lastStation = $('select[name=twinsStation]', $lastItem).val();
399   -
400   - if (conf['outConfig'] == 2) {
401   - htmlStr = template('park-and-station-2-temp', {
402   - parks: parks,
403   - conf: conf,
404   - cPark: lastTcc,
405   - cStation: lastStation,
406   - routes: [upStationRoutes[0], upStationRoutes[upStationRoutes.length - 1]]
407   - });
408   - $('.c_2_s_list', $panel).append(htmlStr);
409   - }
410   - });
411   -
412   - /**
413   - * 删除 场既是站 项目
414   - */
415   - $(wrap).on('click', '.c_2_s_list .item .uk-close', function () {
416   - $(this).parents('.item').remove();
417   - changeTwinsParkAndStation();
418   - });
419   -
420   -
421   - $(wrap).on('change', 'select[name=twinsPark]', changeTwinsParkAndStation);
422   - $(wrap).on('change', 'select[name=twinsStation]', changeTwinsParkAndStation);
423   - })();
424   - </script>
  1 +<!-- 线路配置表相关属性 -->
  2 +<div id="line_config_entity_wrap">
  3 + <form class="uk-form"></form>
  4 +
  5 + <script id="line_config_entity_form-temp" type="text/html">
  6 + <div id="schedule_mode_panel">
  7 + <h2 class="btn_title_line">
  8 + <a class="uk-link-reset">调度模式</a>
  9 + </h2>
  10 + <div>
  11 + <div>
  12 + <label>
  13 + <input type="radio" id="mode_schedule" name="scheduleMode" value="0" {{scheduleMode == 0 ? "checked" : ""}} /> 常规公交&nbsp;&nbsp;
  14 + <input type="radio" id="mode_gateway" name="scheduleMode" value="1" {{scheduleMode == 1 ? "checked" : ""}} /> 民营公交&nbsp;&nbsp;
  15 + <!--<input type="radio" id="mode_device" name="scheduleMode" value="2" {{scheduleMode == 2 ? "checked" : ""}} /> 设备&nbsp;&nbsp;-->
  16 + </label>
  17 + </div>
  18 + <ul class="uk-list">
  19 + <li>
  20 + <small><i class="uk-icon-question-circle"></i> 常规公交--有调度员参与调度的模式。</small>
  21 + </li>
  22 + <li>
  23 + <small><i class="uk-icon-question-circle"></i> 民营公交--无调度员参与调度的模式。</small>
  24 + </li>
  25 + <!--<li>
  26 + <small><i class="uk-icon-question-circle"></i> 设备--以设备为主导,以设备上报的进出站数据为依据。</small>
  27 + </li>-->
  28 + </ul>
  29 + </div>
  30 + </div>
  31 +
  32 + <div id="schedule_reload_time_panel">
  33 + <h2 class="btn_title_line">
  34 + <a class="uk-link-reset">班次更新时间</a>
  35 + </h2>
  36 + <div>
  37 + <div>
  38 + <span class="line_name"></span>每天
  39 + <div class="uk-form-icon" style="margin: 0 5px;">
  40 + <i class="uk-icon-clock-o"></i>
  41 + <input name="startOptInput" class="z-depth-input" value="{{startOpt}}"
  42 + style="width: 151px;"
  43 + type="time">
  44 + </div>
  45 + 更新到当日排班
  46 + </div>
  47 + <ul class="uk-list">
  48 + <li>
  49 + <small><i class="uk-icon-question-circle"></i> 所有发车时间小于该时间的班次都默认跨过24点,手动调整的实发实达均应用此规则。</small>
  50 + </li>
  51 + </ul>
  52 + <button class="uk-button uk-button-mini" id="clearRealScheduleBtn">删除实际排班</button>
  53 + <button class="uk-button uk-button-mini" id="reLoadRealScheduleBtn">重新加载实际排班</button>
  54 + <button class="uk-button uk-button-mini" disabled>加载历史GPS恢复到离站</button>
  55 + </div>
  56 + </div>
  57 +
  58 + <div id="schedule_auto_exec_panel">
  59 + <h2 class="btn_title_line">
  60 + <a class="uk-link-reset">班次自动执行</a>
  61 + </h2>
  62 + <div>
  63 + <div>
  64 + <label>
  65 + <input type="checkbox" id="enableAutoExec" {{autoExec?"checked":""}}> 启用自动班次执行
  66 + </label>
  67 + </div>
  68 + <ul class="uk-list">
  69 + <li>
  70 + <small style="color: red;font-size: 14px;">1、 你必须只应该对【无固定走向且无人监管的线路】启用此项。</small>
  71 + </li>
  72 + <li>
  73 + <small>2、启用该选项后,系统将不再依赖相关定位信号来执行班次。</small>
  74 + </li>
  75 + <li>
  76 + <small>3、系统将在合适的时候自动填入实发实达时间,以完善报表。</small>
  77 + </li>
  78 + <li>
  79 + <small>4、系统不会下发班次调度指令。</small>
  80 + </li>
  81 + </ul>
  82 + </div>
  83 + </div>
  84 +
  85 + <div id="out_time_type_panel">
  86 + <h2 class="btn_title_line">
  87 + <a class="uk-link-reset">出场时间类型</a>
  88 + </h2>
  89 + <div>
  90 + 使用
  91 + <select name="outParkTypeSelect" class="z-depth-input">
  92 + <option {{if outConfig==0}}selected{{/if}} value=0>GPS出场</option>
  93 + <option {{if outConfig==1}}selected{{/if}} value=1>请求出场</option>
  94 + <option {{if outConfig==2}}selected{{/if}} value=2>出站既出场</option>
  95 + </select>
  96 + 时间作为进出场班次的实际时间
  97 + <div class="park-and-station-wrap" style="display: {{outConfig==2?'block':'none'}}">
  98 + <div class="c_2_s_list"></div>
  99 + <span class="add_btn_span"><i class="uk-icon-plus"></i>添加</span>
  100 + </div>
  101 + <ul class="uk-list">
  102 + <li>
  103 + <small>1、【GPS出场】 使用GPS信号捕获出场时间</small>
  104 + </li>
  105 + <li>
  106 + <small>2、【请求出场】 驾驶员请求出场,调度员同意后,取请求时间作为出场时间。如无请求出场,则捕获GPS时间。</small>
  107 + </li>
  108 + <li>
  109 + <small>3、【出站既出场】 忽略出场班次,以头班车的发车时间作为出场时间。</small>
  110 + </li>
  111 + </ul>
  112 + </div>
  113 + </div>
  114 +
  115 + <div id="in_park_source_panel">
  116 + <h2 class="btn_title_line">
  117 + <a class="uk-link-reset">原线路回场</a>
  118 + </h2>
  119 + <div>
  120 + 是否启用
  121 + <select name="inParkForSourceSelect" class="z-depth-input" disabled>
  122 + <option value="0">禁用</option>
  123 + <option value="1">启用</option>
  124 + </select>
  125 +
  126 + <ul class="uk-list">
  127 + <li>
  128 + <small><i class="uk-icon-question-circle"></i> 回场时先回起点站,然后起点站回场。</small>
  129 + </li>
  130 + <li>
  131 + <small><i class="uk-icon-question-circle"></i> 启用该项后,回场子任务公里 = 中途站到起点站间公里 + 线路标准回场公里 。</small>
  132 + </li>
  133 + </ul>
  134 + </div>
  135 + </div>
  136 + </script>
  137 +
  138 + <script id="park-and-station-temp" type="text/html">
  139 + <div class="item">
  140 + <span>停车场</span>
  141 + <select class="z-depth-input" name="twinsPark">
  142 + {{each parks as p i}}
  143 + <option value="{{p.code}}" {{if p.code==cPark}}selected{{/if}}>{{p.name}}</option>
  144 + {{/each}}
  145 + </select>
  146 + <span>&nbsp;既是站点</span>
  147 + <select class="z-depth-input" name="twinsStation">
  148 + {{each routes as r i}}
  149 + <option value="{{r.stationCode}}" {{if r.stationCode==cStation}}selected{{/if}}>{{r.stationName}}
  150 + </option>
  151 + {{/each}}
  152 + </select>
  153 + {{if index>0}}
  154 + <a class="uk-close uk-close-alt"></a>
  155 + {{/if}}
  156 + </div>
  157 + </script>
  158 +
  159 + <script id="park-and-station-2-temp" type="text/html">
  160 + <div class="item">
  161 + <span>停车场</span>
  162 + <select class="z-depth-input" name="twinsPark">
  163 + {{each parks as p i}}
  164 + <option value="{{p.code}}" {{if p.code==cPark}}selected{{/if}}>{{p.name}}</option>
  165 + {{/each}}
  166 + </select>
  167 + <span>&nbsp;既是站点</span>
  168 + <select class="z-depth-input" name="twinsStation">
  169 + {{each routes as r i}}
  170 + <option value="{{r.stationCode}}" {{if r.stationCode==cStation}}selected{{/if}}>{{r.stationName}}
  171 + </option>
  172 + {{/each}}
  173 + </select>
  174 + <a class="uk-close uk-close-alt"></a>
  175 + </div>
  176 + </script>
  177 + <script>
  178 + (function () {
  179 +
  180 + var wrap = '#line_config_entity_wrap', conf, parks, upStationRoutes;
  181 +
  182 + /**
  183 + * 删除实际排班
  184 + */
  185 + var clearRealSchedule = function (e) {
  186 + e.stopPropagation();
  187 + var lineCode = conf.line.lineCode;
  188 + var htmlStr = '<h4 style="color: red;">你确定要删除【' + conf.line.name + '】今日的实际排班?</h4><h5 style="margin-top: 15px;">今日的实际排班会被删除</h5><h5 style="margin-top: 15px;">人车、路牌、待发等相关班次调整信息会被删除。</h5><h5 style="margin-top: 15px;">调度指令和期间与设备的通讯记录被保留</h5><h5 style="margin-top: 15px;">后台日志中的人工操作痕迹被保留</h5>';
  189 + alt_confirm(htmlStr, function () {
  190 + show_wait_modal('正在清除数据...');
  191 + gb_common.$post('/realSchedule/deleteRealSchedule', {lineCode: lineCode}, function () {
  192 + //刷新班次表格
  193 + gb_schedule_table.reLoadAndRefresh(lineCode);
  194 + hide_wait_modal();
  195 + notify_succ('删除班次成功!!!');
  196 + });
  197 + }, '确认删除' + conf.line.name + '的实际排班', true);
  198 +
  199 + return false;
  200 + };
  201 +
  202 + /**
  203 + * 重新载入实际排班
  204 + */
  205 + var reLoadRealSchedule = function (e) {
  206 + e.stopPropagation();
  207 + var lineCode = conf.line.lineCode;
  208 + show_wait_modal('正在重载数据...');
  209 + gb_common.$post('/realSchedule/reLoadRealSchedule', {lineCode: lineCode}, function () {
  210 + //刷新班次表格
  211 + gb_schedule_table.reLoadAndRefresh(lineCode);
  212 + hide_wait_modal();
  213 + notify_succ('重新载入班次成功');
  214 + });
  215 + return false;
  216 + };
  217 +
  218 + $(wrap).on('init', function (e, data) {
  219 + e.stopPropagation();
  220 + conf = data.lineConfig;
  221 + //停车场
  222 + $.get('/basic/parks', function (rs) {
  223 + parks = [];
  224 + for (var code in rs) {
  225 + parks.push({code: code, name: rs[code]});
  226 + }
  227 +
  228 + parks.sort(function (a, b) {
  229 + return $.trim(a.name).localeCompare($.trim(b.name), 'zh-CN');
  230 + });
  231 + renderPSDom();
  232 + });
  233 + //上行站点路由
  234 + upStationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(conf.line.lineCode).sort(function (a, b) {
  235 + return a.stationRouteCode - b.stationRouteCode;
  236 + }), 'directions')[0];
  237 +
  238 + var htmlStr = template('line_config_entity_form-temp', conf);
  239 + $('form', wrap).html(htmlStr);
  240 +
  241 + $('.line_name', '#line_config_entity_wrap').text(conf.line.name);
  242 + //更新调度模式
  243 + $('input[name=scheduleMode]', wrap).on('change', updateScheduleMode);
  244 + //更新排班时间
  245 + $('input[name=startOptInput]', wrap).on('change', updateStartTime);
  246 + //出场时间类型
  247 + $('select[name=outParkTypeSelect]', wrap).on('change', updateOutParkType);
  248 + //原线路回场
  249 + $('select[name=inParkForSourceSelect]', wrap).on('change', enableInParkForSource);
  250 + //删除班次
  251 + $('#clearRealScheduleBtn', wrap).on('click', clearRealSchedule);
  252 + //重新载入实际排班
  253 + $('#reLoadRealScheduleBtn', wrap).on('click', reLoadRealSchedule);
  254 + $('#enableAutoExec', wrap).on('click', autoExecFun);
  255 + });
  256 +
  257 + function changeTwinsParkAndStation() {
  258 + var parks='',stations=''
  259 + ,$panel = $('.park-and-station-wrap', wrap);
  260 +
  261 + $('select[name=twinsPark]', $panel).each(function () {
  262 + parks += ($(this).val() + ',');
  263 + });
  264 +
  265 + $('select[name=twinsStation]', $panel).each(function () {
  266 + stations += ($(this).val() + ',');
  267 + });
  268 +
  269 + if(parks.length > 0)
  270 + parks = parks.substr(0, parks.length - 1);
  271 + if(stations.length > 0)
  272 + stations = stations.substr(0, stations.length - 1);
  273 +
  274 + gb_common.$post('/lineConfig/parkAndStationSet', {
  275 + lineCode: conf.line.lineCode,
  276 + twinsPark: parks,
  277 + twinsStation: stations
  278 + }, function (rs) {
  279 + notify_succ('已保存!!');
  280 + conf = rs.conf;
  281 + });
  282 + }
  283 +
  284 + function updateScheduleMode() {
  285 + var scheduleMode = $(this).val();
  286 + gb_common.$post('/lineConfig/setScheduleMode', {
  287 + lineCode: conf.line.lineCode,
  288 + scheduleMode: scheduleMode
  289 + }, function (rs) {
  290 + notify_succ('调度模式调整成功!');
  291 + conf.scheduleMode = rs.scheduleMode;
  292 + });
  293 + }
  294 +
  295 + //更新排班时间
  296 + var startOptFlag;
  297 +
  298 + function updateStartTime() {
  299 + if (startOptFlag || $(this).val() == conf.startOpt)
  300 + return;
  301 + startOptFlag = true;
  302 + var that = this;
  303 + setTimeout(function () {
  304 + var timeStr = $(that).val();
  305 + gb_common.$post('/lineConfig/editTime', {
  306 + lineCode: conf.line.lineCode,
  307 + time: timeStr
  308 + }, function (rs) {
  309 + notify_succ('班次更新时间调整为 ' + timeStr);
  310 + conf.startOpt = rs.time;
  311 + });
  312 + startOptFlag = false;
  313 + }, 300);
  314 + }
  315 +
  316 + function updateOutParkType() {
  317 + var type = $(this).val();
  318 + var lineCode = conf.line.lineCode;
  319 +
  320 + var data = {lineCode: lineCode, type: type, parkCode: '', stationCode: ''};
  321 + //出站既是出场
  322 + if (type == 2) {
  323 + //如果配置上有信息
  324 + if(conf.twinsParks){
  325 + data.parkCode = conf.twinsParks;
  326 + data.stationCode = conf.twinsStations;
  327 + }
  328 + else{
  329 + data.parkCode = gb_data_basic.getLineInformation(lineCode).carPark;//默认关联 线路标准停车场
  330 + data.stationCode = upStationRoutes[0].stationCode;//和上行起点站
  331 + }
  332 + }
  333 + gb_common.$post('/lineConfig/editOutTimeType', data, function (rs) {
  334 + notify_succ('调整出场时间类型成功!');
  335 + conf = rs.conf;
  336 +
  337 + //渲染场站关联dom
  338 + renderPSDom();
  339 + });
  340 + }
  341 +
  342 +
  343 +
  344 + function enableInParkForSource() {
  345 + var enable = $(this).val();
  346 + gb_common.$post('/lineConfig/enableInParkForSource', {
  347 + lineCode: conf.line.lineCode,
  348 + enable: enable
  349 + }, function () {
  350 + notify_succ((enable == 1 ? '启用' : '禁用') + '原线路回场');
  351 + conf.inParkForSource = enable;
  352 + });
  353 + }
  354 +
  355 + /**
  356 + * 渲染场既是站dom
  357 + */
  358 + function renderPSDom() {
  359 + var pArray = conf.twinsParks.split(','),
  360 + cArray = conf.twinsStations.split(',');
  361 + var htmlStr = '',
  362 + $panel = $('.park-and-station-wrap', wrap);
  363 +
  364 + $('.c_2_s_list', $panel).html('');
  365 + if(conf['outConfig']!=2){
  366 + $panel.hide().find('.c_2_s_list').empty();
  367 + return;
  368 + }
  369 +
  370 + if(!conf.twinsParks)
  371 + return;
  372 +
  373 + for(var i=0,len=pArray.length; i<len; i++){
  374 + htmlStr = template('park-and-station-temp', {
  375 + parks: parks,
  376 + conf: conf,
  377 + cPark: pArray[i],
  378 + cStation: cArray[i],
  379 + index: i,
  380 + routes: [upStationRoutes[0], upStationRoutes[upStationRoutes.length - 1]]
  381 + });
  382 + $('.c_2_s_list', $panel).append(htmlStr);
  383 + }
  384 + $panel.show();
  385 +
  386 + //切换场既是站的,停车场和站点
  387 + //$('select[name=twinsPark]', wrap).on('change', changeTwinsParkAndStation);
  388 + //$('select[name=twinsStation]', wrap).on('change', changeTwinsParkAndStation);
  389 + }
  390 +
  391 + /**
  392 + * 自动执行
  393 + */
  394 + function autoExecFun(){
  395 + var that = this;
  396 + if(that.checked){
  397 + that.checked = false;
  398 + alt_confirm('<span style="color: red;font-size: 16px;">启用【' + conf.line.name + '】的自动执行功能?</span>', function () {
  399 + var data = {
  400 + lineCode: conf.line.lineCode,
  401 + autoExec: true
  402 + };
  403 + gb_common.$post('/lineConfig/setAutoExec', data, function (rs) {
  404 + notify_succ('启用成功!');
  405 + conf = rs.conf;
  406 +
  407 + that.checked = true;
  408 + });
  409 + }, '我确定要将【' + conf.line.name + '】设置为自动执行', true);
  410 + }
  411 + else{
  412 + that.checked = true;
  413 + alt_confirm('<span style="color: red;font-size: 16px;">禁用【' + conf.line.name + '】的自动执行功能?</span>', function () {
  414 + var data = {
  415 + lineCode: conf.line.lineCode,
  416 + autoExec: false
  417 + };
  418 + gb_common.$post('/lineConfig/setAutoExec', data, function (rs) {
  419 + notify_succ('禁用成功!');
  420 + conf = rs.conf;
  421 +
  422 + that.checked = false;
  423 + });
  424 + }, '我确定要禁用【' + conf.line.name + '】的自动执行', true);
  425 + }
  426 + }
  427 +
  428 + /**
  429 + * 添加新的 场既是站
  430 + */
  431 + $(wrap).on('click', '.add_btn_span', function () {
  432 + var htmlStr = '',
  433 + $panel = $('.park-and-station-wrap', wrap);
  434 +
  435 + var $lastItem = $('.c_2_s_list>.item:last', $panel)
  436 + ,lastTcc = $('select[name=twinsPark]', $lastItem).val()
  437 + ,lastStation = $('select[name=twinsStation]', $lastItem).val();
  438 +
  439 + if (conf['outConfig'] == 2) {
  440 + htmlStr = template('park-and-station-2-temp', {
  441 + parks: parks,
  442 + conf: conf,
  443 + cPark: lastTcc,
  444 + cStation: lastStation,
  445 + routes: [upStationRoutes[0], upStationRoutes[upStationRoutes.length - 1]]
  446 + });
  447 + $('.c_2_s_list', $panel).append(htmlStr);
  448 + }
  449 + });
  450 +
  451 + /**
  452 + * 删除 场既是站 项目
  453 + */
  454 + $(wrap).on('click', '.c_2_s_list .item .uk-close', function () {
  455 + $(this).parents('.item').remove();
  456 + changeTwinsParkAndStation();
  457 + });
  458 +
  459 +
  460 + $(wrap).on('change', 'select[name=twinsPark]', changeTwinsParkAndStation);
  461 + $(wrap).on('change', 'select[name=twinsStation]', changeTwinsParkAndStation);
  462 + })();
  463 + </script>
425 464 </div>
426 465 \ No newline at end of file
... ...