Commit dac2883f052574502cb7578456cb94aef9ecc59e

Authored by 潘钊
2 parents 199420f8 5f1d7d9b

Merge branch 'minhang' into pudong

Showing 22 changed files with 723 additions and 310 deletions
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
@@ -79,6 +79,11 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ @@ -79,6 +79,11 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{
79 return lineConfigService.getByLineCode(lineCode); 79 return lineConfigService.getByLineCode(lineCode);
80 } 80 }
81 81
  82 + @RequestMapping(value = "/findByIdx")
  83 + public Map<String, Object> findByIdx(@RequestParam String idx){
  84 + return lineConfigService.findByIdx(idx);
  85 + }
  86 +
82 /** 87 /**
83 * 到站缓冲区设置 88 * 到站缓冲区设置
84 * @param lineCode 89 * @param lineCode
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
@@ -17,273 +17,291 @@ import java.util.Collections; @@ -17,273 +17,291 @@ import java.util.Collections;
17 import java.util.List; 17 import java.util.List;
18 18
19 /** 19 /**
20 - * 20 + * @author PanZhao
21 * @ClassName: SchAttrCalculator 21 * @ClassName: SchAttrCalculator
22 * @Description: TODO(班次相关属性计算器) 22 * @Description: TODO(班次相关属性计算器)
23 - * @author PanZhao  
24 * @date 2016年8月15日 下午4:40:26 23 * @date 2016年8月15日 下午4:40:26
25 - *  
26 */ 24 */
27 @Component 25 @Component
28 public class SchAttrCalculator { 26 public class SchAttrCalculator {
29 27
30 - @Autowired  
31 - LineConfigData lineConfigData;  
32 -  
33 - private final static long DAY_TIME = 1000 * 60 * 60 * 24L;  
34 -  
35 - Logger logger = LoggerFactory.getLogger(this.getClass());  
36 -  
37 - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd")  
38 - ,fmtHHmm = DateTimeFormat.forPattern("HH:mm")  
39 - ,fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");  
40 -  
41 - /**  
42 - * @Title: calcRealDate  
43 - * @Description: TODO(计算班次的真实执行日期)  
44 - */  
45 - public SchAttrCalculator calcRealDate(ScheduleRealInfo sch) {  
46 - LineConfig conf = lineConfigData.get(sch.getXlBm());  
47 -  
48 - try {  
49 - if (null == sch.getFcsjT())  
50 - calcFcsjTime(sch);  
51 -  
52 - //计发時間  
53 - if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){  
54 - sch.setFcsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getFcsj()) + DAY_TIME);  
55 - }  
56 -  
57 - //待发時間  
58 - if(sch.getDfsj().compareTo(conf.getStartOpt()) < 0){  
59 - sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getDfsj()) + DAY_TIME);  
60 - }  
61 - else  
62 - sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getDfsj()));  
63 -  
64 - //实发時間  
65 - if(StringUtils.isNotEmpty(sch.getFcsjActual()) &&  
66 - sch.getFcsjActual().compareTo(conf.getStartOpt()) < 0){  
67 - sch.setFcsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getFcsjActual()) + DAY_TIME);  
68 - }  
69 -  
70 - //实际终点時間  
71 - if(StringUtils.isNotEmpty(sch.getZdsjActual()) &&  
72 - sch.getZdsjActual().compareTo(conf.getStartOpt()) < 0){  
73 - sch.setZdsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getZdsjActual()) + DAY_TIME);  
74 - }  
75 -  
76 - sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT()));  
77 - } catch (Exception e) {  
78 - logger.error("", e);  
79 - }  
80 - return this;  
81 - }  
82 -  
83 - /**  
84 - *  
85 - * @Title: calcAllTimeByFcsj  
86 - * @Description: TODO(根据发车时间字符串计算 (计发时间,终点时间,待发时间))  
87 - */  
88 - public SchAttrCalculator calcAllTimeByFcsj(ScheduleRealInfo sch) {  
89 - try {  
90 - // 生成时间戳  
91 - calcTimestamp(sch);  
92 -  
93 - // 计划终点时间  
94 - if (sch.getBcsj() != null) {  
95 - sch.setZdsjT(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000));  
96 - sch.setZdsj(fmtHHmm.print(sch.getZdsjT()));  
97 - }  
98 - } catch (ParseException e) {  
99 - logger.error("", e);  
100 - }  
101 - return this;  
102 - }  
103 -  
104 - /**  
105 - *  
106 - * @Title: calcQdzTimePlan  
107 - * @Description: TODO(计算班次的起点应到时间)  
108 - */  
109 - public void calcQdzTimePlan(List<ScheduleRealInfo> list){  
110 - Collections.sort(list, new ScheduleComparator.FCSJ());  
111 -  
112 - int len = list.size();  
113 - if(len == 0)  
114 - return;  
115 -  
116 - ScheduleRealInfo prve = list.get(0), curr;  
117 - for(int i = 1; i < len; i ++){  
118 - curr = list.get(i);  
119 -  
120 - if(isJoin(prve, curr)){  
121 - curr.setQdzArrDatejh(prve.getZdsj());  
122 - if(StringUtils.isNotEmpty(prve.getZdsjActual()))  
123 - curr.setQdzArrDatesj(prve.getZdsjActual());  
124 - }  
125 - prve = curr;  
126 - }  
127 - }  
128 -  
129 - private boolean isJoin(ScheduleRealInfo prve, ScheduleRealInfo curr) {  
130 - return prve.getZdzName().equals(curr.getQdzName())//名称相等  
131 - || prve.getZdzCode().equals(curr.getQdzCode())//编码相等  
132 - || prve.getZdzName().startsWith(curr.getQdzName())//起始包括  
133 - || curr.getQdzName().startsWith(prve.getZdzName());//起始包括  
134 - }  
135 -  
136 - /**  
137 - *  
138 - * @Title: updateQdzTimePlan  
139 - * @Description: TODO(更新班次的起点应到时间) 并返回被更新的班次  
140 - */  
141 - public List<ScheduleRealInfo> updateQdzTimePlan(List<ScheduleRealInfo> list){  
142 - Collections.sort(list, new ScheduleComparator.FCSJ());  
143 -  
144 - List<ScheduleRealInfo> updateList = new ArrayList<>();  
145 - int len = list.size();  
146 - if(len == 0)  
147 - return updateList;  
148 -  
149 - ScheduleRealInfo prve = list.get(0), curr;  
150 - for(int i = 1; i < len; i ++){  
151 - curr = list.get(i);  
152 -  
153 - if(prve.getZdzName().equals(curr.getQdzName())  
154 - || prve.getZdzCode().equals(curr.getQdzCode())){  
155 -  
156 - if(curr.getQdzArrDatejh() != null && prve.getZdsj().equals(curr.getQdzArrDatejh())){  
157 - prve = curr;  
158 - continue;  
159 - }  
160 -  
161 - curr.setQdzArrDatejh(prve.getZdsj());  
162 - updateList.add(curr);  
163 - }  
164 - else{  
165 - curr.setQdzArrDatejh(null);  
166 - updateList.add(curr);  
167 - }  
168 - prve = curr;  
169 - }  
170 -  
171 - return updateList;  
172 - }  
173 -  
174 - public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException {  
175 - sch.setFcsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsj()));  
176 - return this;  
177 - }  
178 -  
179 - public void calcTimestamp(ScheduleRealInfo sch) throws ParseException{  
180 - //计发时间  
181 - if(sch.getFcsjT() == null)  
182 - calcFcsjTime(sch);  
183 -  
184 - //待发时间  
185 - if(sch.getDfsj() == null)  
186 - sch.setDfsjAll(sch.getFcsjT());  
187 - if(sch.getDfsjT() == null)  
188 - sch.setDfsjAll(sch.getDfsj());  
189 -  
190 - //实发时间戳  
191 - if(sch.getFcsjActualTime() == null && sch.getFcsjActual() != null)  
192 - sch.setFcsjActualAll(sch.getFcsjActual());  
193 -  
194 - //实达时间戳  
195 - if(sch.getZdsjActualTime() == null && sch.getZdsjActual() != null)  
196 - sch.setZdsjActualAll(sch.getZdsjActual());  
197 - }  
198 -  
199 - /**  
200 - * 计算当前要执行的班次  
201 - * @param list  
202 - * @return  
203 - */  
204 - public ScheduleRealInfo calcCurrentExecSch(List<ScheduleRealInfo> list){  
205 - String lineCode = list.get(0).getXlBm();  
206 - LineConfig conf = lineConfigData.get(lineCode);  
207 - long t = System.currentTimeMillis();  
208 - int outConfig = -1;  
209 - //限定出站既出场的停车场  
210 - String park = null;  
211 - if(conf != null){  
212 - outConfig = conf.getOutConfig();  
213 - park = conf.getTwinsPark();  
214 - }  
215 - boolean limitPark = StringUtils.isNotEmpty(park);  
216 -  
217 - for(ScheduleRealInfo sch : list){  
218 - //如果是出站既出场,忽略出场班次  
219 - if(outConfig == 2 && sch.getBcType().equals("out")  
220 - && (!limitPark || park.equals(sch.getQdzCode())))  
221 - continue;  
222 -  
223 - //忽略烂班  
224 - if(sch.isDestroy())  
225 - continue;  
226 -  
227 - //已执行  
228 - if(StringUtils.isNotEmpty(sch.getZdsjActual()))  
229 - continue;  
230 -  
231 - if(Math.abs((t - sch.getDfsjT())) > 1000 * 60 * 60){  
232 - //差值较大,倒着找看有没有更合适的  
233 - ScheduleRealInfo schReverse = calcCurrentExecSchReverse(list, outConfig, limitPark, park);  
234 - if(null != schReverse && !schReverse.getId().equals(sch.getId())){  
235 - logger.info("calc_current_exec_sch_reverse... -" + schReverse.getId());  
236 - return suitableExecSch(schReverse, sch, t);  
237 - }  
238 - }  
239 - return sch;  
240 - }  
241 - return null;  
242 - }  
243 -  
244 - /**  
245 - * 反转匹配一个班次  
246 - * @param list  
247 - * @param outConfig  
248 - * @param limitPark  
249 - * @param park  
250 - * @return  
251 - */  
252 - private ScheduleRealInfo calcCurrentExecSchReverse(List<ScheduleRealInfo> list, int outConfig, boolean limitPark, String park){  
253 - ScheduleRealInfo near = null;  
254 - for(ScheduleRealInfo sch : list){  
255 - //如果是出站既出场,忽略出场班次  
256 - if(outConfig == 2 && isInout(sch)  
257 - && (!limitPark || park.equals(sch.getQdzCode()) || park.equals(sch.getZdzCode())))  
258 - continue;  
259 -  
260 - //忽略烂班  
261 - if(sch.isDestroy())  
262 - continue;  
263 -  
264 - if(StringUtils.isNotEmpty(sch.getZdsjActual())){  
265 - near = null;  
266 - continue;  
267 - }  
268 -  
269 - if(null == near)  
270 - near = sch;  
271 - }  
272 - return near;  
273 - }  
274 -  
275 - /**  
276 - * 比较2个班次,谁是指定时间更合适执行的  
277 - * @param schReverse  
278 - * @param sch  
279 - * @param t  
280 - * @return  
281 - */  
282 - private ScheduleRealInfo suitableExecSch(ScheduleRealInfo schReverse, ScheduleRealInfo sch, long t){  
283 - return Math.abs(t - schReverse.getDfsjT()) > Math.abs(t - sch.getDfsjT())?sch: schReverse;  
284 - }  
285 -  
286 - private boolean isInout(ScheduleRealInfo sch){  
287 - return sch.getBcType().equals("out") || sch.getBcType().equals("in");  
288 - } 28 + @Autowired
  29 + LineConfigData lineConfigData;
  30 +
  31 + private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
  32 +
  33 + Logger logger = LoggerFactory.getLogger(this.getClass());
  34 +
  35 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), fmtHHmm = DateTimeFormat.forPattern("HH:mm"), fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  36 +
  37 + /**
  38 + * @Title: calcRealDate
  39 + * @Description: TODO(计算班次的真实执行日期)
  40 + */
  41 + public SchAttrCalculator calcRealDate(ScheduleRealInfo sch) {
  42 + LineConfig conf = lineConfigData.get(sch.getXlBm());
  43 +
  44 + try {
  45 + if (null == sch.getFcsjT())
  46 + calcFcsjTime(sch);
  47 +
  48 + String rq = sch.getScheduleDateStr();
  49 + //计发時間
  50 + sch.setFcsjAll(getTime(rq, sch.getFcsj(), conf));
  51 +
  52 + //待发時間
  53 + sch.setDfsjAll(getTime(rq, sch.getDfsj(), conf));
  54 + /*if (sch.getDfsj().compareTo(conf.getStartOpt()) < 0) {
  55 + sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + sch.getDfsj()) + DAY_TIME);
  56 + } else
  57 + sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + sch.getDfsj()));*/
  58 +
  59 + //实发時間
  60 + sch.setFcsjActualAll(getTime(rq, sch.getFcsjActual(), conf));
  61 + /*if (StringUtils.isNotEmpty(sch.getFcsjActual()) &&
  62 + sch.getFcsjActual().compareTo(conf.getStartOpt()) < 0) {
  63 + sch.setFcsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + sch.getFcsjActual()) + DAY_TIME);
  64 + }*/
  65 +
  66 + //实际终点時間
  67 + sch.setZdsjActualAll(getTime(rq, sch.getZdsjActual(), conf));
  68 + /*if (StringUtils.isNotEmpty(sch.getZdsjActual()) &&
  69 + sch.getZdsjActual().compareTo(conf.getStartOpt()) < 0) {
  70 + sch.setZdsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + sch.getZdsjActual()) + DAY_TIME);
  71 + }*/
  72 +
  73 + sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT()));
  74 + } catch (Exception e) {
  75 + logger.error("", e);
  76 + }
  77 + return this;
  78 + }
  79 +
  80 + public Long getTime(String rq, String timeStr, LineConfig conf) {
  81 + Long t = null;
  82 + if (StringUtils.isNotEmpty(timeStr)) {
  83 + t = fmtyyyyMMddHHmm.parseMillis(rq + timeStr);
  84 + if(timeStr.compareTo(conf.getStartOpt()) < 0)
  85 + return t + DAY_TIME;
  86 + }
  87 + return t;
  88 + }
  89 +
  90 + /**
  91 + * @Title: calcAllTimeByFcsj
  92 + * @Description: TODO(根据发车时间字符串计算 (计发时间,终点时间,待发时间))
  93 + */
  94 + public SchAttrCalculator calcAllTimeByFcsj(ScheduleRealInfo sch) {
  95 + try {
  96 + // 生成时间戳
  97 + calcTimestamp(sch);
  98 +
  99 + // 计划终点时间
  100 + if (sch.getBcsj() != null) {
  101 + sch.setZdsjT(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000));
  102 + sch.setZdsj(fmtHHmm.print(sch.getZdsjT()));
  103 + }
  104 + } catch (ParseException e) {
  105 + logger.error("", e);
  106 + }
  107 + return this;
  108 + }
  109 +
  110 + /**
  111 + * @Title: calcQdzTimePlan
  112 + * @Description: TODO(计算班次的起点应到时间)
  113 + */
  114 + public void calcQdzTimePlan(List<ScheduleRealInfo> list) {
  115 + Collections.sort(list, new ScheduleComparator.FCSJ());
  116 +
  117 + int len = list.size();
  118 + if (len == 0)
  119 + return;
  120 +
  121 + ScheduleRealInfo prve = list.get(0), curr;
  122 + for (int i = 1; i < len; i++) {
  123 + curr = list.get(i);
  124 +
  125 + if (isJoin(prve, curr)) {
  126 + curr.setQdzArrDatejh(prve.getZdsj());
  127 + if (StringUtils.isNotEmpty(prve.getZdsjActual()))
  128 + curr.setQdzArrDatesj(prve.getZdsjActual());
  129 + }
  130 + prve = curr;
  131 + }
  132 + }
  133 +
  134 + private boolean isJoin(ScheduleRealInfo prve, ScheduleRealInfo curr) {
  135 + return prve.getZdzName().equals(curr.getQdzName())//名称相等
  136 + || prve.getZdzCode().equals(curr.getQdzCode())//编码相等
  137 + || prve.getZdzName().startsWith(curr.getQdzName())//起始包括
  138 + || curr.getQdzName().startsWith(prve.getZdzName());//起始包括
  139 + }
  140 +
  141 + /**
  142 + * @Title: updateQdzTimePlan
  143 + * @Description: TODO(更新班次的起点应到时间) 并返回被更新的班次
  144 + */
  145 + public List<ScheduleRealInfo> updateQdzTimePlan(List<ScheduleRealInfo> list) {
  146 + Collections.sort(list, new ScheduleComparator.FCSJ());
  147 +
  148 + List<ScheduleRealInfo> updateList = new ArrayList<>();
  149 + int len = list.size();
  150 + if (len == 0)
  151 + return updateList;
  152 +
  153 + ScheduleRealInfo prve = list.get(0), curr;
  154 + for (int i = 1; i < len; i++) {
  155 + curr = list.get(i);
  156 +
  157 + if (prve.getZdzName().equals(curr.getQdzName())
  158 + || prve.getZdzCode().equals(curr.getQdzCode())) {
  159 +
  160 + if (curr.getQdzArrDatejh() != null && prve.getZdsj().equals(curr.getQdzArrDatejh())) {
  161 + prve = curr;
  162 + continue;
  163 + }
  164 +
  165 + curr.setQdzArrDatejh(prve.getZdsj());
  166 + updateList.add(curr);
  167 + } else {
  168 + curr.setQdzArrDatejh(null);
  169 + updateList.add(curr);
  170 + }
  171 + prve = curr;
  172 + }
  173 +
  174 + return updateList;
  175 + }
  176 +
  177 + public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException {
  178 + sch.setFcsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsj()));
  179 + return this;
  180 + }
  181 +
  182 + public void calcTimestamp(ScheduleRealInfo sch) throws ParseException {
  183 + //计发时间
  184 + if (sch.getFcsjT() == null)
  185 + calcFcsjTime(sch);
  186 +
  187 + //待发时间
  188 + if (sch.getDfsj() == null)
  189 + sch.setDfsjAll(sch.getFcsjT());
  190 + if (sch.getDfsjT() == null)
  191 + sch.setDfsjAll(sch.getDfsj());
  192 +
  193 + //实发时间戳
  194 + if (sch.getFcsjActualTime() == null && sch.getFcsjActual() != null)
  195 + sch.setFcsjActualAll(sch.getFcsjActual());
  196 +
  197 + //实达时间戳
  198 + if (sch.getZdsjActualTime() == null && sch.getZdsjActual() != null)
  199 + sch.setZdsjActualAll(sch.getZdsjActual());
  200 + }
  201 +
  202 + /**
  203 + * 计算当前要执行的班次
  204 + *
  205 + * @param list
  206 + * @return
  207 + */
  208 + public ScheduleRealInfo calcCurrentExecSch(List<ScheduleRealInfo> list) {
  209 + String lineCode = list.get(0).getXlBm();
  210 + LineConfig conf = lineConfigData.get(lineCode);
  211 + long t = System.currentTimeMillis();
  212 + int outConfig = -1;
  213 + //限定出站既出场的停车场
  214 + String park = null;
  215 + if (conf != null) {
  216 + outConfig = conf.getOutConfig();
  217 + park = conf.getTwinsPark();
  218 + }
  219 + boolean limitPark = StringUtils.isNotEmpty(park);
  220 +
  221 + for (ScheduleRealInfo sch : list) {
  222 + //如果是出站既出场,忽略出场班次
  223 + if (outConfig == 2 && sch.getBcType().equals("out")
  224 + && (!limitPark || park.equals(sch.getQdzCode())))
  225 + continue;
  226 +
  227 + //忽略烂班
  228 + if (sch.isDestroy())
  229 + continue;
  230 +
  231 + //已执行
  232 + if (StringUtils.isNotEmpty(sch.getZdsjActual()))
  233 + continue;
  234 +
  235 + if (Math.abs((t - sch.getDfsjT())) > 1000 * 60 * 60) {
  236 + //差值较大,倒着找看有没有更合适的
  237 + ScheduleRealInfo schReverse = calcCurrentExecSchReverse(list, outConfig, limitPark, park);
  238 + if (null != schReverse && !schReverse.getId().equals(sch.getId())) {
  239 + logger.info("calc_current_exec_sch_reverse... -" + schReverse.getId());
  240 + return suitableExecSch(schReverse, sch, t);
  241 + }
  242 + }
  243 + return sch;
  244 + }
  245 + return null;
  246 + }
  247 +
  248 + /**
  249 + * 反转匹配一个班次
  250 + *
  251 + * @param list
  252 + * @param outConfig
  253 + * @param limitPark
  254 + * @param park
  255 + * @return
  256 + */
  257 + private ScheduleRealInfo calcCurrentExecSchReverse(List<ScheduleRealInfo> list, int outConfig, boolean limitPark, String park) {
  258 + ScheduleRealInfo near = null;
  259 + for (ScheduleRealInfo sch : list) {
  260 + //如果是出站既出场,忽略出场班次
  261 + if (outConfig == 2 && isInout(sch)
  262 + && (!limitPark || park.equals(sch.getQdzCode()) || park.equals(sch.getZdzCode())))
  263 + continue;
  264 +
  265 + //忽略烂班
  266 + if (sch.isDestroy())
  267 + continue;
  268 +
  269 + if (StringUtils.isNotEmpty(sch.getZdsjActual())) {
  270 + near = null;
  271 + continue;
  272 + }
  273 +
  274 + if (null == near)
  275 + near = sch;
  276 + }
  277 + return near;
  278 + }
  279 +
  280 + /**
  281 + * 比较2个班次,谁是指定时间更合适执行的
  282 + *
  283 + * @param schReverse
  284 + * @param sch
  285 + * @param t
  286 + * @return
  287 + */
  288 + private ScheduleRealInfo suitableExecSch(ScheduleRealInfo schReverse, ScheduleRealInfo sch, long t) {
  289 + return Math.abs(t - schReverse.getDfsjT()) > Math.abs(t - sch.getDfsjT()) ? sch : schReverse;
  290 + }
  291 +
  292 + private boolean isInout(ScheduleRealInfo sch) {
  293 + return sch.getBcType().equals("out") || sch.getBcType().equals("in");
  294 + }
  295 +
  296 + /**
  297 + *
  298 + * @param fcsjT
  299 + * @param zdsjT
  300 + */
  301 + public boolean isValid(Long fcsjT, Long zdsjT) {
  302 + if(null != fcsjT && null != zdsjT)
  303 + return fcsjT < zdsjT;
  304 +
  305 + return true;
  306 + }
289 } 307 }
src/main/java/com/bsth/data/schedule/edit_logs/FormLogger.java
@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
16 16
17 import java.util.Date; 17 import java.util.Date;
  18 +import java.util.LinkedList;
18 19
19 /** 20 /**
20 * 为报表写入相关的班次修改记录 21 * 为报表写入相关的班次修改记录
@@ -27,9 +28,12 @@ public class FormLogger { @@ -27,9 +28,12 @@ public class FormLogger {
27 28
28 Logger log = LoggerFactory.getLogger(this.getClass()); 29 Logger log = LoggerFactory.getLogger(this.getClass());
29 30
  31 + static LinkedList<Changetochange> ccPsts = new LinkedList<>();
  32 +
30 @Autowired 33 @Autowired
31 ChangetochangeRepository changetochangeRepository; 34 ChangetochangeRepository changetochangeRepository;
32 35
  36 +
33 /** 37 /**
34 * 换人换车情况表 38 * 换人换车情况表
35 */ 39 */
@@ -70,7 +74,9 @@ public class FormLogger { @@ -70,7 +74,9 @@ public class FormLogger {
70 if(StringUtils.isNotEmpty(newJsy)) 74 if(StringUtils.isNotEmpty(newJsy))
71 cc.setSjgh(newJsy); 75 cc.setSjgh(newJsy);
72 76
73 - changetochangeRepository.save(cc); 77 + //改异步入库
  78 + ccPsts.add(cc);
  79 + //changetochangeRepository.save(cc);
74 }catch (Exception e){ 80 }catch (Exception e){
75 log.error("纪录换人换车情况表", e); 81 log.error("纪录换人换车情况表", e);
76 } 82 }
@@ -82,4 +88,13 @@ public class FormLogger { @@ -82,4 +88,13 @@ public class FormLogger {
82 cpc.setJsy(jsy); 88 cpc.setJsy(jsy);
83 saveChangetochange(sch, cpc); 89 saveChangetochange(sch, cpc);
84 } 90 }
  91 +
  92 + public void saveDb(){
  93 + Changetochange cc;
  94 + for(int i = 0; i < 1000; i ++){
  95 + cc = ccPsts.poll();
  96 + if(null != cc)
  97 + changetochangeRepository.save(cc);
  98 + }
  99 + }
85 } 100 }
src/main/java/com/bsth/data/schedule/edit_logs/SeiPstThread.java
@@ -23,6 +23,9 @@ public class SeiPstThread extends Thread{ @@ -23,6 +23,9 @@ public class SeiPstThread extends Thread{
23 23
24 Logger log = LoggerFactory.getLogger(this.getClass()); 24 Logger log = LoggerFactory.getLogger(this.getClass());
25 25
  26 + @Autowired
  27 + FormLogger formLogger;
  28 +
26 @Override 29 @Override
27 public void run() { 30 public void run() {
28 try{ 31 try{
@@ -40,6 +43,9 @@ public class SeiPstThread extends Thread{ @@ -40,6 +43,9 @@ public class SeiPstThread extends Thread{
40 } 43 }
41 44
42 repository.save(pstList); 45 repository.save(pstList);
  46 +
  47 + //报表结构化日志入库
  48 + formLogger.saveDb();
43 }catch (Exception e){ 49 }catch (Exception e){
44 log.error("", e); 50 log.error("", e);
45 } 51 }
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -718,8 +718,12 @@ public class ScheduleRealInfo { @@ -718,8 +718,12 @@ public class ScheduleRealInfo {
718 * @throws 718 * @throws
719 */ 719 */
720 public void setFcsjActualAll(Long t){ 720 public void setFcsjActualAll(Long t){
  721 +
721 this.fcsjActualTime = t; 722 this.fcsjActualTime = t;
722 - this.fcsjActual = fmtHHmm.print(t); 723 + if(null == t)
  724 + this.fcsjActual = null;
  725 + else
  726 + this.fcsjActual = fmtHHmm.print(t);
723 727
724 //更新班次状态 728 //更新班次状态
725 calcStatus(); 729 calcStatus();
@@ -733,7 +737,11 @@ public class ScheduleRealInfo { @@ -733,7 +737,11 @@ public class ScheduleRealInfo {
733 */ 737 */
734 public void setZdsjActualAll(Long t){ 738 public void setZdsjActualAll(Long t){
735 this.zdsjActualTime = t; 739 this.zdsjActualTime = t;
736 - this.zdsjActual = fmtHHmm.print(t); 740 +
  741 + if(null == t)
  742 + this.zdsjActual = null;
  743 + else
  744 + this.zdsjActual = fmtHHmm.print(t);
737 745
738 //更新班次状态 746 //更新班次状态
739 calcStatus(); 747 calcStatus();
src/main/java/com/bsth/entity/traffic/VehicleInoutStop.java 0 → 100644
  1 +package com.bsth.entity.traffic;
  2 +
  3 +import com.bsth.entity.Cars;
  4 +import com.bsth.entity.Line;
  5 +
  6 +import javax.persistence.*;
  7 +import java.util.Date;
  8 +
  9 +/**
  10 + *
  11 + * @ClassName: VehicleInoutStop(车载上报停靠站信息)
  12 + *
  13 + * @Description: TODO(线路标准信息)
  14 + *
  15 + * @Author bsth@zq
  16 + *
  17 + * @Date 2017-9-18 9:34:39
  18 + *
  19 + * @Version 公交调度系统BS版 0.1
  20 + *
  21 + */
  22 +@Entity
  23 +@Table(name = "bsth_c_shreal")
  24 +public class VehicleInoutStop {
  25 +
  26 + @Id
  27 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  28 + private Integer id;
  29 +
  30 + @ManyToOne
  31 + private Line line;
  32 +
  33 + @ManyToOne
  34 + private Cars cars;
  35 +
  36 + // 站点序号
  37 + private Integer stop;
  38 +
  39 + // 营运状态
  40 + private Integer serviceState;
  41 +
  42 + // 上下行
  43 + private Integer upDown;
  44 +
  45 + // 进出站/站内外
  46 + private Integer inOutStop;
  47 +
  48 + // 上报时间
  49 + private Date reportDate;
  50 +
  51 + public Integer getId() {
  52 + return id;
  53 + }
  54 +
  55 + public void setId(Integer id) {
  56 + this.id = id;
  57 + }
  58 +
  59 + public Line getLine() {
  60 + return line;
  61 + }
  62 +
  63 + public void setLine(Line line) {
  64 + this.line = line;
  65 + }
  66 +
  67 + public Cars getCars() {
  68 + return cars;
  69 + }
  70 +
  71 + public void setCars(Cars cars) {
  72 + this.cars = cars;
  73 + }
  74 +
  75 + public Integer getStop() {
  76 + return stop;
  77 + }
  78 +
  79 + public void setStop(Integer stop) {
  80 + this.stop = stop;
  81 + }
  82 +
  83 + public Integer getServiceState() {
  84 + return serviceState;
  85 + }
  86 +
  87 + public void setServiceState(Integer serviceState) {
  88 + this.serviceState = serviceState;
  89 + }
  90 +
  91 + public Integer getUpDown() {
  92 + return upDown;
  93 + }
  94 +
  95 + public void setUpDown(Integer upDown) {
  96 + this.upDown = upDown;
  97 + }
  98 +
  99 + public Integer getInOutStop() {
  100 + return inOutStop;
  101 + }
  102 +
  103 + public void setInOutStop(Integer inOutStop) {
  104 + this.inOutStop = inOutStop;
  105 + }
  106 +
  107 + public Date getReportDate() {
  108 + return reportDate;
  109 + }
  110 +
  111 + public void setReportDate(Date reportDate) {
  112 + this.reportDate = reportDate;
  113 + }
  114 +}
src/main/java/com/bsth/repository/traffic/VehicleInoutStopRepository.java 0 → 100644
  1 +package com.bsth.repository.traffic;
  2 +
  3 +import com.bsth.entity.traffic.VehicleInoutStop;
  4 +import com.bsth.repository.BaseRepository;
  5 +
  6 +public interface VehicleInoutStopRepository extends BaseRepository<VehicleInoutStop, Integer> {
  7 +}
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
@@ -24,4 +24,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{ @@ -24,4 +24,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{
24 Map<String,Object> yjtkSet(Map<String, String> map); 24 Map<String,Object> yjtkSet(Map<String, String> map);
25 25
26 Map<String,Object> parkAndStationSet(Map<String, String> map); 26 Map<String,Object> parkAndStationSet(Map<String, String> map);
  27 +
  28 + Map<String,Object> findByIdx(String idx);
27 } 29 }
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
@@ -6,6 +6,7 @@ import com.bsth.entity.realcontrol.LineConfig; @@ -6,6 +6,7 @@ import com.bsth.entity.realcontrol.LineConfig;
6 import com.bsth.repository.realcontrol.LineConfigRepository; 6 import com.bsth.repository.realcontrol.LineConfigRepository;
7 import com.bsth.service.impl.BaseServiceImpl; 7 import com.bsth.service.impl.BaseServiceImpl;
8 import com.bsth.service.realcontrol.LineConfigService; 8 import com.bsth.service.realcontrol.LineConfigService;
  9 +import com.google.common.base.Splitter;
9 import org.slf4j.Logger; 10 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
@@ -203,4 +204,24 @@ public class LineConfigServiceImpl extends BaseServiceImpl&lt;LineConfig, Integer&gt; @@ -203,4 +204,24 @@ public class LineConfigServiceImpl extends BaseServiceImpl&lt;LineConfig, Integer&gt;
203 } 204 }
204 return rs; 205 return rs;
205 } 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 + }
206 } 227 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -259,7 +259,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -259,7 +259,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
259 } 259 }
260 260
261 //调整班次类型 261 //调整班次类型
262 - if (StringUtils.isNotEmpty(bcType)) { 262 + if (StringUtils.isNotEmpty(bcType) && !bcType.equals(schedule.getBcType())) {
  263 + if((schedule.getBcType().equals("major")
  264 + || schedule.getBcType().equals("venting"))
  265 + && bcType.equals("normal")){
  266 + //清空备注
  267 + schedule.setRemarks("");
  268 + }
263 schedule.setBcType(bcType); 269 schedule.setBcType(bcType);
264 } 270 }
265 271
@@ -1271,8 +1277,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1271,8 +1277,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1271 @Override 1277 @Override
1272 public Map<String, Object> spaceAdjust(Long[] ids, Integer space) { 1278 public Map<String, Object> spaceAdjust(Long[] ids, Integer space) {
1273 1279
1274 - List<ScheduleRealInfo> list = new ArrayList<>(), updateList = new ArrayList<>();  
1275 - Map<String, Object> rs = new HashMap<>(); 1280 + List<ScheduleRealInfo> list = new ArrayList<>(), ts = new ArrayList<>(), tempTs = null;
  1281 + Map<String, Object> rs = new HashMap<>(), tempRs = new HashMap<>();
1276 try { 1282 try {
1277 ScheduleRealInfo sch, next; 1283 ScheduleRealInfo sch, next;
1278 for (Long id : ids) { 1284 for (Long id : ids) {
@@ -1297,12 +1303,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1297,12 +1303,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1297 sch = list.get(i); 1303 sch = list.get(i);
1298 1304
1299 //调整待发 1305 //调整待发
1300 - outgoAdjust(sch.getId(), null, fmtHHmm.print(st), null, "3"); 1306 + tempRs = outgoAdjust(sch.getId(), null, fmtHHmm.print(st), null, "3");
  1307 +
  1308 + if(null != tempRs && tempRs.get("ts") != null)
  1309 + tempTs = (List<ScheduleRealInfo>) tempRs.get("ts");
  1310 +
  1311 + ts.addAll(tempTs);
1301 } 1312 }
1302 1313
1303 rs.put("status", ResponseCode.SUCCESS); 1314 rs.put("status", ResponseCode.SUCCESS);
1304 //返回最后一个班次,页面会全量刷新 1315 //返回最后一个班次,页面会全量刷新
1305 - rs.put("t", sch); 1316 + rs.put("ts", ts);
1306 } 1317 }
1307 1318
1308 } catch (Exception e) { 1319 } catch (Exception e) {
@@ -1393,6 +1404,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1393,6 +1404,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1393 sch.setsName(""); 1404 sch.setsName("");
1394 } 1405 }
1395 1406
  1407 + LineConfig config = lineConfigData.get(sch.getXlBm());
1396 /** 1408 /**
1397 * 调整实发 1409 * 调整实发
1398 */ 1410 */
@@ -1400,13 +1412,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1400,13 +1412,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1400 if (StringUtils.isNotBlank(fcsjActual) 1412 if (StringUtils.isNotBlank(fcsjActual)
1401 && !fcsjActual.equals(sch.getFcsjActual())) { 1413 && !fcsjActual.equals(sch.getFcsjActual())) {
1402 1414
1403 - LineConfig config = lineConfigData.get(sch.getXlBm());  
1404 - long t = 0L; 1415 + //long t = 0L;
1405 //小于线路开始运营时间,则默认跨过24点 1416 //小于线路开始运营时间,则默认跨过24点
1406 - if (fcsjActual.compareTo(config.getStartOpt()) < 0) 1417 + long t = schAttrCalculator.getTime(sch.getScheduleDateStr(), fcsjActual, config);
  1418 + /* if (fcsjActual.compareTo(config.getStartOpt()) < 0)
1407 t = fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME) + fcsjActual); 1419 t = fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME) + fcsjActual);
1408 else 1420 else
1409 - t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual); 1421 + t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual);*/
1410 1422
1411 fLog.log("调整实发时间", sch.getFcsjActual(), fcsjActual); 1423 fLog.log("调整实发时间", sch.getFcsjActual(), fcsjActual);
1412 sch.setFcsjActualAll(t); 1424 sch.setFcsjActualAll(t);
@@ -1430,7 +1442,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1430,7 +1442,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1430 1442
1431 //调整实达 1443 //调整实达
1432 fLog.log("调整实达时间", sch.getZdsjActual(), zdsjActual); 1444 fLog.log("调整实达时间", sch.getZdsjActual(), zdsjActual);
1433 - sch.setZdsjActualAll(zdsjActual); 1445 +
  1446 + long t = schAttrCalculator.getTime(sch.getScheduleDateStr(), zdsjActual, config);
  1447 + sch.setZdsjActualAll(t);
1434 //路牌下一班起点到达时间 1448 //路牌下一班起点到达时间
1435 ScheduleRealInfo next = dayOfSchedule.nextByLp2(sch); 1449 ScheduleRealInfo next = dayOfSchedule.nextByLp2(sch);
1436 if (null != next) { 1450 if (null != next) {
@@ -1439,15 +1453,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1439,15 +1453,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1439 ts.add(next); 1453 ts.add(next);
1440 } 1454 }
1441 1455
1442 -/* try{  
1443 - //车辆下一个要执行的班次  
1444 - ScheduleRealInfo carNext = dayOfSchedule.next(sch);  
1445 - if(carNext != null && !carNext.getXlBm().equals(sch.getXlBm())){  
1446 - DirectivePushQueue.put64(carNext.getClZbh(), carNext.getXlBm(), "套跑@系统");  
1447 - fLog.log("下发线路切换指令", sch.getXlName(), carNext.getXlName());  
1448 - }  
1449 - }catch (Exception e){logger.error("", e);}*/  
1450 -  
1451 //重新计算车辆执行班次 1456 //重新计算车辆执行班次
1452 dayOfSchedule.reCalcExecPlan(sch.getClZbh()); 1457 dayOfSchedule.reCalcExecPlan(sch.getClZbh());
1453 } else if(StringUtils.isNotEmpty(sch.getZdsjActual()) && StringUtils.isEmpty(zdsjActual)){ 1458 } else if(StringUtils.isNotEmpty(sch.getZdsjActual()) && StringUtils.isEmpty(zdsjActual)){
@@ -3012,9 +3017,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3012,9 +3017,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3012 Set<ScheduleRealInfo> set = new HashSet<>(); 3017 Set<ScheduleRealInfo> set = new HashSet<>();
3013 3018
3014 ScheduleRealInfo sch; 3019 ScheduleRealInfo sch;
  3020 + StringBuilder sb = new StringBuilder();
3015 3021
3016 String jGh = null,jName,sGh,sName; 3022 String jGh = null,jName,sGh,sName;
3017 for (ChangePersonCar cpc : cpcs) { 3023 for (ChangePersonCar cpc : cpcs) {
  3024 + sb = new StringBuilder();
3018 3025
3019 sch = dayOfSchedule.get(cpc.getSchId()); 3026 sch = dayOfSchedule.get(cpc.getSchId());
3020 if (sch == null) 3027 if (sch == null)
@@ -3048,7 +3055,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3048,7 +3055,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3048 //日志记录 3055 //日志记录
3049 ScheduleModifyLogger.tzrc(sch, cpc); 3056 ScheduleModifyLogger.tzrc(sch, cpc);
3050 3057
  3058 + //换驾驶员
3051 if (StringUtils.isNotEmpty(cpc.getJsy())) { 3059 if (StringUtils.isNotEmpty(cpc.getJsy())) {
  3060 + if(!jGh.equals(sch.getjGh()))
  3061 + sb.append(sch.getjGh() + " 换 " + jGh + ";");
3052 //换驾驶员 3062 //换驾驶员
3053 if(persoChange(sch, jGh)) 3063 if(persoChange(sch, jGh))
3054 set.add(sch); 3064 set.add(sch);
@@ -3063,6 +3073,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3063,6 +3073,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3063 rs.put("status", ResponseCode.ERROR); 3073 rs.put("status", ResponseCode.ERROR);
3064 return rs; 3074 return rs;
3065 } 3075 }
  3076 +
  3077 + if(!sGh.equals(sch.getsGh()))
  3078 + sb.append(sch.getsGh() + " 换 " + sGh + ";");
3066 if(persoChangeSPY(sch, sGh)) 3079 if(persoChangeSPY(sch, sGh))
3067 set.add(sch); 3080 set.add(sch);
3068 } 3081 }
@@ -3073,10 +3086,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3073,10 +3086,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3073 3086
3074 //换车 3087 //换车
3075 if (StringUtils.isNotEmpty(cpc.getClZbh()) && !cpc.getClZbh().equals(sch.getClZbh())) { 3088 if (StringUtils.isNotEmpty(cpc.getClZbh()) && !cpc.getClZbh().equals(sch.getClZbh())) {
  3089 + sb.append(sch.getClZbh() + " 换 " + cpc.getClZbh() + ";");
3076 set.add(sch); 3090 set.add(sch);
3077 set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh())); 3091 set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh()));
3078 } 3092 }
3079 3093
  3094 + if(sb.length() > 0)
  3095 + sch.setRemarks(sb.toString());
  3096 +
3080 dayOfSchedule.save(sch); 3097 dayOfSchedule.save(sch);
3081 set.add(sch); 3098 set.add(sch);
3082 3099
src/main/java/com/bsth/service/traffic/VehicleInoutStopService.java 0 → 100644
  1 +package com.bsth.service.traffic;
  2 +
  3 +import com.bsth.entity.traffic.VehicleInoutStop;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +
  7 +/**
  8 + * 时刻模板上传日志
  9 + */
  10 +public interface VehicleInoutStopService extends BaseService<VehicleInoutStop,Integer> {
  11 +
  12 +}
src/main/java/com/bsth/service/traffic/impl/VehicleInoutStopServiceImpl.java 0 → 100644
  1 +package com.bsth.service.traffic.impl;
  2 +
  3 +import com.bsth.entity.traffic.VehicleInoutStop;
  4 +import com.bsth.service.impl.BaseServiceImpl;
  5 +import com.bsth.service.traffic.VehicleInoutStopService;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +/**
  11 + *
  12 + * @ClassName: TrafficManageServiceImpl(运管处接口service业务层实现类)
  13 + *
  14 + * @Extends : BaseService
  15 + *
  16 + * @Description:
  17 + *
  18 + * @Author bsth@zq
  19 + *
  20 + * @Date 2016年10月28日 上午9:21:17
  21 + *
  22 + * @Version 公交调度系统BS版 0.1
  23 + *
  24 + */
  25 +
  26 +@Service
  27 +public class VehicleInoutStopServiceImpl extends BaseServiceImpl<VehicleInoutStop,Integer> implements VehicleInoutStopService {
  28 +
  29 + Logger logger = LoggerFactory.getLogger(this.getClass());
  30 +
  31 +}
src/main/resources/static/pages/control/lineallot/allot.html
1 <style> 1 <style>
2 .line-select { 2 .line-select {
3 border: 1px solid #ddd; 3 border: 1px solid #ddd;
4 - height: 350px; 4 + height: 310px;
5 margin-top: 15px; 5 margin-top: 15px;
6 box-shadow: 0 2px 5px 0 rgba(221, 221, 221, 0.24), 0 2px 10px 0 rgba(221, 221, 221, 0.24); 6 box-shadow: 0 2px 5px 0 rgba(221, 221, 221, 0.24), 0 2px 10px 0 rgba(221, 221, 221, 0.24);
7 } 7 }
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 .line-select-cont { 35 .line-select-cont {
36 text-align: left; 36 text-align: left;
37 overflow: auto; 37 overflow: auto;
38 - height: 270px; 38 + height: 230px;
39 padding-right: 0px; 39 padding-right: 0px;
40 } 40 }
41 41
@@ -267,7 +267,7 @@ @@ -267,7 +267,7 @@
267 var htmlStr = template('line_select_cont_temp', {list: newArray}); 267 var htmlStr = template('line_select_cont_temp', {list: newArray});
268 $('.line-select-body').html(htmlStr) 268 $('.line-select-body').html(htmlStr)
269 .slimscroll({//滚动条 269 .slimscroll({//滚动条
270 - height: '270px' 270 + height: '230px'
271 }); 271 });
272 272
273 //映射 273 //映射
src/main/resources/static/real_control_v2/css/main.css
@@ -1663,4 +1663,31 @@ ul.left_tabs_lg li{ @@ -1663,4 +1663,31 @@ ul.left_tabs_lg li{
1663 1663
1664 #schedule-tzrc-modal dl.active input[type=checkbox]:before{ 1664 #schedule-tzrc-modal dl.active input[type=checkbox]:before{
1665 color: #ffffff; 1665 color: #ffffff;
  1666 +}
  1667 +
  1668 +.sch-search-autocom input{
  1669 + padding: 0 !important;
  1670 + height: 100% !important;
  1671 +}
  1672 +
  1673 +label.blue_checkbox{
  1674 + margin-left: 12px;
  1675 +}
  1676 +
  1677 +label.blue_checkbox>input{
  1678 + width: 17px !important;
  1679 + height: 17px !important;
  1680 +}
  1681 +
  1682 +label.blue_checkbox>input:checked:before,
  1683 +label.blue_checkbox>input:indeterminate:before{
  1684 + line-height: 15px !important;
  1685 +}
  1686 +
  1687 +dd.disabled{
  1688 + color: #b5b3b3;
  1689 +}
  1690 +
  1691 +dl.active>dd.disabled{
  1692 + color: #ececec;
1666 } 1693 }
1667 \ No newline at end of file 1694 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/bc_type_major.html
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 <div class="uk-form-row"> 41 <div class="uk-form-row">
42 <div class="uk-form-controls" style="margin-left: 0;"> 42 <div class="uk-form-controls" style="margin-left: 0;">
43 <label style="color: #827f7f;font-size: 13px;"> 43 <label style="color: #827f7f;font-size: 13px;">
44 - <input class="i-cbox" type="checkbox" name="sendDirective" checked> 44 + <input class="i-cbox" type="checkbox" name="sendDirective" >
45 下发调度指令 45 下发调度指令
46 </label> 46 </label>
47 </div> 47 </div>
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 </div> 50 </div>
51 <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> 51 <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
52 <button type="button" class="uk-button uk-modal-close">取消</button> 52 <button type="button" class="uk-button uk-modal-close">取消</button>
53 - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-send"></i> &nbsp;确认调整并下发指令 53 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-send"></i> &nbsp;确认调整
54 </button> 54 </button>
55 </div> 55 </div>
56 </form> 56 </form>
@@ -183,7 +183,9 @@ @@ -183,7 +183,9 @@
183 UIkit.modal(modal).hide(); 183 UIkit.modal(modal).hide();
184 gb_schedule_table.updateSchedule(rs.t); 184 gb_schedule_table.updateSchedule(rs.t);
185 //触发父容器刷新事件 185 //触发父容器刷新事件
186 - $(parentModal).trigger('init', {sch: rs.t}); 186 + //$(parentModal).trigger('init', {sch: rs.t});
  187 + //关闭
  188 + UIkit.modal(parentModal).hide();
187 notify_succ('调整放站成功'); 189 notify_succ('调整放站成功');
188 }); 190 });
189 } 191 }
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/bc_type_venting.html
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 <div class="uk-form-row"> 41 <div class="uk-form-row">
42 <div class="uk-form-controls" style="margin-left: 0;"> 42 <div class="uk-form-controls" style="margin-left: 0;">
43 <label style="color: #827f7f;font-size: 13px;"> 43 <label style="color: #827f7f;font-size: 13px;">
44 - <input class="i-cbox" type="checkbox" name="sendDirective" checked> 44 + <input class="i-cbox" type="checkbox" name="sendDirective" >
45 下发调度指令 45 下发调度指令
46 </label> 46 </label>
47 </div> 47 </div>
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 </div> 50 </div>
51 <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> 51 <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
52 <button type="button" class="uk-button uk-modal-close">取消</button> 52 <button type="button" class="uk-button uk-modal-close">取消</button>
53 - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-send"></i> &nbsp;确认调整并下发指令 53 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-send"></i> &nbsp;确认调整
54 </button> 54 </button>
55 </div> 55 </div>
56 </form> 56 </form>
@@ -180,7 +180,9 @@ @@ -180,7 +180,9 @@
180 UIkit.modal(modal).hide(); 180 UIkit.modal(modal).hide();
181 gb_schedule_table.updateSchedule(rs.t); 181 gb_schedule_table.updateSchedule(rs.t);
182 //触发父容器刷新事件 182 //触发父容器刷新事件
183 - $(parentModal).trigger('init', {sch: rs.t}); 183 + //$(parentModal).trigger('init', {sch: rs.t});
  184 + //关闭
  185 + UIkit.modal(parentModal).hide();
184 notify_succ('调整直发成功'); 186 notify_succ('调整直发成功');
185 }); 187 });
186 } 188 }
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
@@ -191,6 +191,12 @@ @@ -191,6 +191,12 @@
191 e.preventDefault(); 191 e.preventDefault();
192 var data = $(this).serializeJSON(); 192 var data = $(this).serializeJSON();
193 193
  194 + //校验实发实达时间
  195 + if(!validation_s_e_Time(data)){
  196 + notify_err("实发时间不能晚于实达时间!");
  197 + return;
  198 + }
  199 +
194 if(!data.adjustExps && (data.status==-1 200 if(!data.adjustExps && (data.status==-1
195 || (data.jhlc==0 && sch.bcType != 'in' && sch.bcType != 'out'))){ 201 || (data.jhlc==0 && sch.bcType != 'in' && sch.bcType != 'out'))){
196 notify_err("当前操作需要选择调整原因!"); 202 notify_err("当前操作需要选择调整原因!");
@@ -280,6 +286,27 @@ @@ -280,6 +286,27 @@
280 }) 286 })
281 }); 287 });
282 }); 288 });
  289 +
  290 + function validation_s_e_Time(data) {
  291 + var config = gb_data_line_config.get(sch.xlBm);
  292 + var st = get_time(sch.scheduleDateStr, data.fcsjActual, config);
  293 + var et = get_time(sch.scheduleDateStr, data.zdsjActual, config);
  294 + if(st && et && st > et)
  295 + return false;
  296 + return true;
  297 + }
  298 +
  299 + var DAY_TIME = 1000 * 60 * 60 * 24;
  300 + function get_time(rq, timeStr, config) {
  301 + var t = null;
  302 + if(timeStr){
  303 + t = moment(rq + timeStr, 'YYYY-MM-DDHH:mm');
  304 + if(timeStr.localeCompare(config.startOpt) < 0)
  305 + return t + DAY_TIME;
  306 + }
  307 +
  308 + return t;
  309 + }
283 })(); 310 })();
284 </script> 311 </script>
285 </div> 312 </div>
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_range_turn.html
@@ -218,8 +218,8 @@ @@ -218,8 +218,8 @@
218 } 218 }
219 if(this.checked){ 219 if(this.checked){
220 //烂班2 烂全程 220 //烂班2 烂全程
221 - $f('startStation', df2).val(sch.zdzCode);  
222 - $f('endStation', df2).val(sch.qdzCode); 221 + $f('startStation', df2).val(nextSch.qdzCode);
  222 + $f('endStation', df2).val(nextSch.zdzCode);
223 $f('mileage', df2).val(nextSch.jhlcOrig); 223 $f('mileage', df2).val(nextSch.jhlcOrig);
224 $f('startDate', df2).val(nextSch.dfsj); 224 $f('startDate', df2).val(nextSch.dfsj);
225 $f('endDate', df2).val(nextSch.zdsj); 225 $f('endDate', df2).val(nextSch.zdsj);
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/tzrc.html
@@ -47,10 +47,13 @@ @@ -47,10 +47,13 @@
47 <div class="uk-width-1-2"> 47 <div class="uk-width-1-2">
48 <div class="uk-form-row"> 48 <div class="uk-form-row">
49 <label class="uk-form-label">车辆</label> 49 <label class="uk-form-label">车辆</label>
50 - <div class="uk-form-controls">  
51 - <div class="uk-autocomplete uk-form car-autocom"> 50 + <div class="uk-form-controls" >
  51 + <div class="uk-autocomplete uk-form car-autocom" style="width: 77%;">
52 <input type="text" value="" name="clZbh" required> 52 <input type="text" value="" name="clZbh" required>
53 </div> 53 </div>
  54 + <label class="blue_checkbox cl_enable_key_label">
  55 + <input type="checkbox" checked>
  56 + </label>
54 </div> 57 </div>
55 </div> 58 </div>
56 </div> 59 </div>
@@ -58,9 +61,12 @@ @@ -58,9 +61,12 @@
58 <div class="uk-form-row"> 61 <div class="uk-form-row">
59 <label class="uk-form-label">驾驶员 </label> 62 <label class="uk-form-label">驾驶员 </label>
60 <div class="uk-form-controls"> 63 <div class="uk-form-controls">
61 - <div class="uk-autocomplete uk-form jsy-autocom"> 64 + <div class="uk-autocomplete uk-form jsy-autocom" style="width: 77%;">
62 <input type="text" value="" name="jsy" required> 65 <input type="text" value="" name="jsy" required>
63 </div> 66 </div>
  67 + <label class="blue_checkbox jsy_enable_key_label">
  68 + <input type="checkbox" checked>
  69 + </label>
64 </div> 70 </div>
65 </div> 71 </div>
66 </div> 72 </div>
@@ -77,7 +83,7 @@ @@ -77,7 +83,7 @@
77 </div> 83 </div>
78 </div> 84 </div>
79 </div> 85 </div>
80 - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> 86 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;position: relative;">
81 <button type="button" class="uk-button uk-modal-close">取消</button> 87 <button type="button" class="uk-button uk-modal-close">取消</button>
82 <button type="submit" class="uk-button uk-button-primary" ><i class="uk-icon-check"></i> &nbsp;保存 88 <button type="submit" class="uk-button uk-button-primary" ><i class="uk-icon-check"></i> &nbsp;保存
83 </button> 89 </button>
@@ -107,7 +113,7 @@ @@ -107,7 +113,7 @@
107 <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span> 113 <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span>
108 {{/if}} 114 {{/if}}
109 </dd> 115 </dd>
110 - <dd>{{sch.clZbh}}</dd> 116 + <dd data-old="{{sch.clZbh}}">{{sch.clZbh}}</dd>
111 <dd data-old="{{sch.jGh}}/{{sch.jName}}">{{sch.jGh}}/{{sch.jName}}</dd> 117 <dd data-old="{{sch.jGh}}/{{sch.jName}}">{{sch.jGh}}/{{sch.jName}}</dd>
112 <dd data-old="{{sch.sGh}}/{{sch.sName}}">{{sch.sGh}}/{{sch.sName}}</dd> 118 <dd data-old="{{sch.sGh}}/{{sch.sName}}">{{sch.sGh}}/{{sch.sName}}</dd>
113 <dd> 119 <dd>
@@ -168,8 +174,6 @@ @@ -168,8 +174,6 @@
168 if(!$(this).hasClass('active')){ 174 if(!$(this).hasClass('active')){
169 $(this).addClass('active'); 175 $(this).addClass('active');
170 cbox.checked = true; 176 cbox.checked = true;
171 - //var lineCode = $('[name=lineSelect]', modal).val();  
172 - //var sch = gb_schedule_table.findScheduleByLine(lineCode)[$(this).data('id')];  
173 renderCell(); 177 renderCell();
174 } 178 }
175 else{ 179 else{
@@ -178,8 +182,10 @@ @@ -178,8 +182,10 @@
178 //$(this).find('dd[data-old]').text() 182 //$(this).find('dd[data-old]').text()
179 var $jsyCell = $($($(this).find('dd')[2])); 183 var $jsyCell = $($($(this).find('dd')[2]));
180 var $spyCell = $($($(this).find('dd')[3])); 184 var $spyCell = $($($(this).find('dd')[3]));
  185 + var $clCell = $($($(this).find('dd')[1]));
181 $jsyCell.text($jsyCell.data('old')); 186 $jsyCell.text($jsyCell.data('old'));
182 $spyCell.text($spyCell.data('old')); 187 $spyCell.text($spyCell.data('old'));
  188 + $clCell.text($clCell.data('old'));
183 } 189 }
184 }); 190 });
185 191
@@ -213,6 +219,7 @@ @@ -213,6 +219,7 @@
213 var f = $('form.tzrc_form', modal); 219 var f = $('form.tzrc_form', modal);
214 f.on('submit', function (e) { 220 f.on('submit', function (e) {
215 e.stopPropagation(); 221 e.stopPropagation();
  222 + $('[type=submit]', f).attr('disabled', 'disabled');
216 223
217 var checkeds = $('.sch-tzrc-table .ct_table_body input[type=checkbox]:checked', modal); 224 var checkeds = $('.sch-tzrc-table .ct_table_body input[type=checkbox]:checked', modal);
218 if (checkeds.length == 0) 225 if (checkeds.length == 0)
@@ -247,7 +254,7 @@ @@ -247,7 +254,7 @@
247 * 驾驶员/售票员文本框改变事件 254 * 驾驶员/售票员文本框改变事件
248 */ 255 */
249 var renderRunFlag; 256 var renderRunFlag;
250 - $('input[name=jsy],input[name=spy]', modal).on('input change', function () { 257 + $('input[name=jsy],input[name=spy],input[name=clZbh]', modal).on('input change', function () {
251 if(renderRunFlag) 258 if(renderRunFlag)
252 return; 259 return;
253 renderRunFlag = true; 260 renderRunFlag = true;
@@ -256,16 +263,37 @@ @@ -256,16 +263,37 @@
256 renderRunFlag = false; 263 renderRunFlag = false;
257 }, 200); 264 }, 200);
258 }); 265 });
  266 +
  267 + $('.jsy_enable_key_label', modal).on('click', function () {
  268 + var checked = $('input[type=checkbox]', this)[0].checked;
  269 + if(checked)
  270 + enableJsy();
  271 + else
  272 + disabledJsy();
  273 + });
  274 +
  275 + $('.cl_enable_key_label', modal).on('click', function () {
  276 + var checked = $('input[type=checkbox]', this)[0].checked;
  277 + if(checked)
  278 + enableCl();
  279 + else
  280 + disabledCl();
  281 + });
259 }); 282 });
260 283
261 -  
262 function renderCell() { 284 function renderCell() {
263 - var jsy = $('input[name=jsy]', modal).val(); 285 + var jsy = $('input[name=jsy]:enabled', modal).val();
264 var spy = $('input[name=spy]', modal).val(); 286 var spy = $('input[name=spy]', modal).val();
  287 + var nbbm = $('input[name=clZbh]:enabled', modal).val();
265 $('.sch-tzrc-table .ct_table_body>dl.active').each(function () { 288 $('.sch-tzrc-table .ct_table_body>dl.active').each(function () {
266 var jsyCell = $(this).find('dd')[2]; 289 var jsyCell = $(this).find('dd')[2];
267 var spyCell = $(this).find('dd')[3]; 290 var spyCell = $(this).find('dd')[3];
268 - $(jsyCell).text(jsy); 291 + var clCell = $(this).find('dd')[1];
  292 +
  293 + if(jsy)
  294 + $(jsyCell).text(jsy);
  295 + if(nbbm)
  296 + $(clCell).text(nbbm);
269 $(spyCell).text(spy); 297 $(spyCell).text(spy);
270 }); 298 });
271 } 299 }
@@ -300,6 +328,43 @@ @@ -300,6 +328,43 @@
300 $('.sch-tzrc-table .ct_table_body>dl', modal).each(function () { 328 $('.sch-tzrc-table .ct_table_body>dl', modal).each(function () {
301 $(this).removeClass('active'); 329 $(this).removeClass('active');
302 $('input[type=checkbox]',this)[0].checked = false; 330 $('input[type=checkbox]',this)[0].checked = false;
  331 +
  332 + $.each($('dd', this), function () {
  333 + if($(this).data('old'))
  334 + $(this).text($(this).data('old'));
  335 + });
  336 + });
  337 + }
  338 +
  339 + function disabledJsy() {
  340 + $('[name=jsy]',modal).attr('disabled', 'disabled');
  341 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  342 + var jsyCell = $(this).find('dd')[2];
  343 + $(jsyCell).addClass('disabled').text($(jsyCell).data('old'));
  344 + });
  345 + }
  346 +
  347 + function enableJsy() {
  348 + $('[name=jsy]',modal).removeAttr('disabled');
  349 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  350 + var jsyCell = $(this).find('dd')[2];
  351 + $(jsyCell).removeClass('disabled').text($(jsyCell).data('old'));
  352 + });
  353 + }
  354 +
  355 + function disabledCl() {
  356 + $('[name=clZbh]',modal).attr('disabled', 'disabled');
  357 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  358 + var clCell = $(this).find('dd')[1];
  359 + $(clCell).addClass('disabled').text($(clCell).data('old'));
  360 + });
  361 + }
  362 +
  363 + function enableCl() {
  364 + $('[name=clZbh]',modal).removeAttr('disabled');
  365 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  366 + var clCell = $(this).find('dd')[1];
  367 + $(clCell).removeClass('disabled').text($(clCell).data('old'));
303 }); 368 });
304 } 369 }
305 })(); 370 })();
src/main/resources/static/real_control_v2/js/data/data_line_config.js 0 → 100644
  1 +/**
  2 + * 线路配置信息
  3 + * @type {{}}
  4 + */
  5 +var gb_data_line_config = (function () {
  6 +
  7 + var lineConfigMap;
  8 +
  9 + var storage = window.localStorage;
  10 + var activeLines = JSON.parse(storage.getItem('lineControlItems'));
  11 + var line_idx = (function () {
  12 + var str = '';
  13 + for (var i = 0, item; item = activeLines[i++];) {
  14 + str += (',' + item.lineCode);
  15 + }
  16 + return str.substr(1);
  17 + })();
  18 +
  19 + gb_common.$get('/lineConfig/findByIdx', {idx: line_idx}, function (rs) {
  20 + lineConfigMap = {};
  21 + $.each(rs.list, function () {
  22 + lineConfigMap[this.line.lineCode] = this;
  23 + });
  24 +
  25 + console.log('lineConfigMap', lineConfigMap);
  26 + });
  27 +
  28 + return {
  29 + get: function (lineCode) {
  30 + return lineConfigMap[lineCode];
  31 + }
  32 + };
  33 +})();
0 \ No newline at end of file 34 \ No newline at end of file
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
@@ -153,10 +153,10 @@ var gb_schedule_context_menu = (function () { @@ -153,10 +153,10 @@ var gb_schedule_context_menu = (function () {
153 if (!isNaN(newValue) && newValue > 0) { 153 if (!isNaN(newValue) && newValue > 0) {
154 gb_common.$post_arr('/realSchedule/spaceAdjust', {ids: idArr, space: newValue}, function (rs) { 154 gb_common.$post_arr('/realSchedule/spaceAdjust', {ids: idArr, space: newValue}, function (rs) {
155 //刷新数据 155 //刷新数据
156 - if(rs.t){  
157 - gb_schedule_table.reLoadAndRefresh(rs.t.xlBm);  
158 - }  
159 - //gb_schedule_table.updateSchedule(rs.ts); 156 + //if(rs.t){
  157 + // gb_schedule_table.reLoadAndRefresh(rs.t.xlBm);
  158 + //}
  159 + gb_schedule_table.updateSchedule(rs.ts);
160 notify_succ('调整间隔成功!'); 160 notify_succ('调整间隔成功!');
161 }); 161 });
162 } else 162 } else
src/main/resources/static/real_control_v2/main.html
@@ -167,6 +167,7 @@ @@ -167,6 +167,7 @@
167 <script src="/real_control_v2/js/data/data_basic.js" merge="custom_js"></script> 167 <script src="/real_control_v2/js/data/data_basic.js" merge="custom_js"></script>
168 <script src="/real_control_v2/js/data/data_gps.js" merge="custom_js"></script> 168 <script src="/real_control_v2/js/data/data_gps.js" merge="custom_js"></script>
169 <script src="/real_control_v2/js/data/gps_abnormal.js" merge="custom_js"></script> 169 <script src="/real_control_v2/js/data/gps_abnormal.js" merge="custom_js"></script>
  170 +<script src="/real_control_v2/js/data/data_line_config.js" merge="custom_js"></script>
170 <!-- 线路模拟图 --> 171 <!-- 线路模拟图 -->
171 <script src="/real_control_v2/js/utils/svg_chart.js" merge="custom_js"></script> 172 <script src="/real_control_v2/js/utils/svg_chart.js" merge="custom_js"></script>
172 <script src="/real_control_v2/js/utils/svg_data_convert.js" merge="custom_js"></script> 173 <script src="/real_control_v2/js/utils/svg_data_convert.js" merge="custom_js"></script>