Commit f02cd88a6dc691b69ac3adef50ac330b1c3b4cd5

Authored by 廖磊
2 parents 3556aca1 bb7d840d

Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into

minhang
Showing 167 changed files with 5655 additions and 2360 deletions
... ... @@ -155,6 +155,12 @@
155 155 <version>2.1.8</version>
156 156 </dependency>
157 157  
  158 + <dependency>
  159 + <groupId>org.apache.tika</groupId>
  160 + <artifactId>tika-core</artifactId>
  161 + <version>1.7</version>
  162 + </dependency>
  163 +
158 164 <!-- pentaho kettle 依赖 -->
159 165 <dependency>
160 166 <groupId>com.pentaho.kettle</groupId>
... ...
src/main/java/com/bsth/controller/DownloadController.java
... ... @@ -2,6 +2,7 @@ package com.bsth.controller;
2 2  
3 3 import java.io.File;
4 4 import java.io.IOException;
  5 +import java.net.URLDecoder;
5 6  
6 7 import org.apache.commons.io.FileUtils;
7 8 import org.springframework.context.annotation.Scope;
... ... @@ -35,7 +36,7 @@ public class DownloadController
35 36 File file=new File(moudelPath);
36 37 HttpHeaders headers = new HttpHeaders();
37 38 String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题
38   - headers.setContentDispositionFormData("attachment", realFileName);
  39 + headers.setContentDispositionFormData("attachment", URLDecoder.decode(realFileName,"utf-8"));
39 40 headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
40 41 return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),
41 42 headers, HttpStatus.CREATED);
... ...
src/main/java/com/bsth/controller/forms/ExportController.java
... ... @@ -13,8 +13,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
13 13 import org.springframework.web.bind.annotation.RequestParam;
14 14 import org.springframework.web.bind.annotation.RestController;
15 15  
  16 +import com.bsth.data.BasicData;
16 17 import com.bsth.entity.mcy_forms.Allline;
17 18 import com.bsth.entity.mcy_forms.Changetochange;
  19 +import com.bsth.entity.mcy_forms.Daily;
18 20 import com.bsth.entity.mcy_forms.Executionrate;
19 21 import com.bsth.entity.mcy_forms.Linepasswengerflow;
20 22 import com.bsth.entity.mcy_forms.Operationservice;
... ... @@ -319,8 +321,34 @@ public class ExportController {
319 321 List<Turnoutrate> turnoutrate = formsService.turnoutrate(map);
320 322 Map<String, Object> map1 = new HashMap<String, Object>();
321 323 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  324 + String xlts="";
  325 + String zsgs="";
  326 + String jh="";
  327 + Float j=0f;
  328 + Float sj=0f;
  329 + Float qz=0f;
  330 + Float ccl=0f;
  331 + Float bcjh=0f;
  332 + String bcsj="";
  333 + Float bczxl=0f;
  334 + String gs="";
  335 + String zhgs="";
  336 +
322 337 for (Turnoutrate l : turnoutrate) {
323 338 Map<String, Object> m = new HashMap<String, Object>();
  339 +
  340 + xlts +=l.getGsgs()==""?0:String.valueOf(l.getGsgs());
  341 + zsgs +=l.getFgsgs()==""?0:String.valueOf(l.getFgsgs());
  342 + jh +=l.getXl()==""?0:String.valueOf(l.getXl());
  343 + sj +=l.getCchjh()==""?0f:Float.valueOf(l.getCchjh());
  344 + ccl +=l.getCchsj()==""?0f:Float.valueOf(l.getCchsj());
  345 + bcjh +=l.getCchqz()==""?0f:Float.valueOf(l.getCchqz());
  346 + bcsj +=l.getChl()==""?0:String.valueOf(l.getChl());
  347 + bczxl +=l.getBcjh()==""?0f:Float.valueOf(l.getBcjh());
  348 + gs +=l.getBcsj()==""?0:String.valueOf(l.getBcsj());
  349 + zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl());
  350 +
  351 +
324 352 m.put("rq", l.getRq());
325 353 m.put("gs", l.getGs());
326 354 m.put("zhgs", l.getZhgs());
... ... @@ -330,10 +358,27 @@ public class ExportController {
330 358 m.put("cchqz", l.getCchqz());
331 359 m.put("chl", l.getChl());
332 360 m.put("bcjh", l.getBcjh());
333   - m.put("bcsj", l.getBbzxl());
  361 + m.put("bcsj", l.getBcsj());
334 362 m.put("bbzxl", l.getBbzxl());
335 363 m.put("sm", l.getSm());
336 364 resList.add(m);
  365 +
  366 +
  367 +
  368 + m=new HashMap<String,Object>();
  369 + m.put("total_xlts", xlts);
  370 + m.put("total_zhgs", zsgs);
  371 + m.put("total_jh", jh);
  372 + m.put("total_sj", sj);
  373 + m.put("total_qz", ccl);
  374 + m.put("total_ccl", bcjh);
  375 + m.put("total_bcjh",bcsj);
  376 + m.put("total_bcsj", bczxl);
  377 + m.put("total_bczxl", bczxl);
  378 + m.put("total_gs", zhgs);
  379 +
  380 +
  381 + map1 = m;
337 382 }
338 383  
339 384 try {
... ... @@ -347,7 +392,7 @@ public class ExportController {
347 392 return resList;
348 393 }
349 394  
350   - //营运线路出车率统计表
  395 + //班次执行率统计表
351 396 @RequestMapping(value = "/executionrateExport", method = RequestMethod.POST)
352 397 public List<Map<String, Object>> executionrateExport(@RequestParam Map<String, Object> map) {
353 398 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
... ... @@ -356,8 +401,33 @@ public class ExportController {
356 401 List<Executionrate> executionrate = formsService.executionrate(map);
357 402 Map<String, Object> map1 = new HashMap<String, Object>();
358 403 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  404 + String xlts="";
  405 + String zsgs="";
  406 + String jh="";
  407 + Float sj=0f;
  408 + Float ccl=0f;
  409 + Float bcjh=0f;
  410 + String bcsj="";
  411 + Float bczxl=0f;
  412 + String gs="";
  413 + String zhgs="";
  414 +
  415 + Map<String, Object> m = new HashMap<String, Object>();
  416 +
359 417 for (Executionrate l : executionrate) {
360   - Map<String, Object> m = new HashMap<String, Object>();
  418 +
  419 + xlts +=l.getGsgs()==""?0:String.valueOf(l.getGsgs());
  420 + zsgs +=l.getFgsgs()==""?0:String.valueOf(l.getFgsgs());
  421 + jh +=l.getXl()==""?0:String.valueOf(l.getXl());
  422 + sj +=l.getCchjh()==""?0f:Float.valueOf(l.getCchjh());
  423 + ccl +=l.getCchsj()==""?0f:Float.valueOf(l.getCchsj());
  424 + bcsj +=l.getChl()==""?0:String.valueOf(l.getChl());
  425 + bczxl +=l.getBcjh()==""?0f:Float.valueOf(l.getBcjh());
  426 + gs +=l.getBcsj()==""?0:String.valueOf(l.getBcsj());
  427 + zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl());
  428 +
  429 +
  430 +
361 431 m.put("rq", l.getRq());
362 432 m.put("gs", l.getGs());
363 433 m.put("zhgs", l.getZhgs());
... ... @@ -366,10 +436,24 @@ public class ExportController {
366 436 m.put("cchsj", l.getCchsj());
367 437 m.put("chl", l.getChl());
368 438 m.put("bcjh", l.getBcjh());
369   - m.put("bcsj", l.getBbzxl());
  439 + m.put("bcsj", l.getBcsj());
370 440 m.put("bbzxl", l.getBbzxl());
371 441 m.put("sm", l.getSm());
372 442 resList.add(m);
  443 +
  444 +
  445 + m=new HashMap<String,Object>();
  446 + m.put("total_gs", xlts);
  447 + m.put("total_zhgs", zsgs);
  448 + m.put("total_xlts", jh);
  449 + m.put("total_jh", sj);
  450 + m.put("total_sj", ccl);
  451 + m.put("total_ccl",bcsj);
  452 + m.put("total_bcjh", bczxl);
  453 + m.put("total_bcsj", gs);
  454 + m.put("total_bczxl", zhgs);
  455 +
  456 + map1 = m;
373 457 }
374 458  
375 459 try {
... ... @@ -393,8 +477,28 @@ public class ExportController {
393 477 List<Allline> allline = formsService.allline(map);
394 478 Map<String, Object> map1 = new HashMap<String, Object>();
395 479 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  480 + Integer jh=0;
  481 + Integer sj=0;
  482 + Integer ccl=0;
  483 + Double bcjh=0.0;
  484 + String bcsj="";
  485 + Integer bczxl=0;
  486 + String gs="";
  487 + String zhgs="";
  488 + Map<String, Object> m ;
396 489 for (Allline l : allline) {
397   - Map<String, Object> m = new HashMap<String, Object>();
  490 + m = new HashMap<String, Object>();
  491 +
  492 + jh +=l.getGsgs()=="" ? 0: Integer.valueOf(l.getGsgs());
  493 + sj +=l.getFgsgs()==""?0: Integer.valueOf(l.getFgsgs());
  494 + ccl +=l.getCchjh()==""?0: Integer.valueOf(l.getCchjh());
  495 + bcjh +=l.getCchsj()==""?0: Double.valueOf(l.getCchsj());
  496 +
  497 + bcsj +=l.getChl()==""? 0:String.valueOf(l.getChl());
  498 + bczxl +=l.getBcjh()==""?0: Integer.valueOf(l.getBcjh());
  499 + gs +=l.getBcsj()==""?0: String.valueOf(l.getBcsj());
  500 + zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl());
  501 +
398 502 m.put("rq", l.getRq());
399 503 m.put("gs", l.getGs());
400 504 m.put("zhgs", l.getZhgs());
... ... @@ -403,10 +507,22 @@ public class ExportController {
403 507 m.put("cchsj", l.getCchsj());
404 508 m.put("chl", l.getChl());
405 509 m.put("bcjh", l.getBcjh());
406   - m.put("bcsj", l.getBbzxl());
  510 + m.put("bcsj", l.getBcsj());
407 511 m.put("bbzxl", l.getBbzxl());
408 512 m.put("sm", l.getSm());
409 513 resList.add(m);
  514 +
  515 + m=new HashMap<String,Object>();
  516 + m.put("total_jh", jh);
  517 + m.put("total_sj", sj);
  518 + m.put("total_ccl", ccl);
  519 + m.put("total_bcjh", bcjh);
  520 + m.put("total_bcsj", bcsj);
  521 + m.put("total_bczxl", bczxl);
  522 + m.put("total_gs", gs);
  523 + m.put("total_zhgs", zhgs);
  524 + map1 = m;
  525 +
410 526 }
411 527  
412 528 try {
... ... @@ -422,6 +538,56 @@ public class ExportController {
422 538  
423 539  
424 540  
  541 + //班次日报表
  542 + @RequestMapping(value = "/dailyExport", method = RequestMethod.POST)
  543 + public List<Map<String, Object>> dailyExport(@RequestParam Map<String, Object> map) {
  544 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  545 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  546 + ReportUtils ee = new ReportUtils();
  547 + List<Daily> allline = formsService.daily(map);
  548 +
  549 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  550 + Float zgl=0f;
  551 + Float ks=0f;
  552 + Float yh=0f;
  553 + Float bc=0f;
  554 + Map<String, Object> m ;
  555 + for (Daily d : allline) {
  556 + m = new HashMap<String, Object>();
  557 + zgl +=d.getZlc()==""?0f:Float.valueOf(d.getZlc());
  558 + ks +=d.getJzl1()==""?0f:Float.valueOf(d.getJzl1());
  559 + yh +=d.getYh()==""?0f:Float.valueOf(d.getYh());
  560 + bc +=d.getBc()==""?0f:Float.valueOf(d.getBc());
  561 + m.put("zbh", d.getZbh());
  562 + m.put("jgh",d.getJgh());
  563 + m.put("jName", d.getjName());
  564 + m.put("zlc", d.getZlc());
  565 + m.put("jzl1", d.getJzl1());
  566 + m.put("yh", d.getYh());
  567 + m.put("bc", d.getBc());
  568 +
  569 + resList.add(m);
  570 + }
  571 +
  572 + m=new HashMap<String,Object>();
  573 + m.put("total_zgl", zgl);
  574 + m.put("total_ks", ks);
  575 + m.put("total_yh", yh);
  576 + m.put("total_bc", bc);
  577 +
  578 + m.put("line", BasicData.lineCode2NameMap.get(map.get("line").toString()));
  579 + m.put("date", map.get("date").toString());
  580 + try {
  581 + listI.add(resList.iterator());
  582 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  583 + ee.excelReplace(listI, new Object[] { m }, path + "mould\\daily.xls", path + "export\\班次日报表"
  584 + + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  585 + } catch (Exception e) {
  586 + e.printStackTrace();
  587 + }
  588 + return resList;
  589 + }
  590 +
425 591  
426 592  
427 593 }
... ...
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
... ... @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
11 11  
12 12 import com.bsth.entity.mcy_forms.Allline;
13 13 import com.bsth.entity.mcy_forms.Changetochange;
  14 +import com.bsth.entity.mcy_forms.Daily;
14 15 import com.bsth.entity.mcy_forms.Executionrate;
15 16 import com.bsth.entity.mcy_forms.Linepasswengerflow;
16 17 import com.bsth.entity.mcy_forms.Operationservice;
... ... @@ -112,4 +113,12 @@ public class MCY_FormsController {
112 113  
113 114 return formsService.allline(map);
114 115 }
  116 +
  117 + // 营运线路名称统计表
  118 + @RequestMapping(value = "/daily", method = RequestMethod.POST)
  119 + public List<Daily> daily(@RequestParam Map<String, Object> map) {
  120 +
  121 + return formsService.daily(map);
  122 + }
  123 +
115 124 }
... ...
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
... ... @@ -59,4 +59,14 @@ public class RealMapController {
59 59 public Map<String, Object> findRouteAndStationByLine(@RequestParam String lineCode){
60 60 return realMapService.findRouteAndStationByLine(lineCode);
61 61 }
  62 +
  63 + /**
  64 + * 获取多个线路的路段信息(为前端越界计算提供数据)
  65 + * @param codeIdx
  66 + * @return
  67 + */
  68 + @RequestMapping(value = "/multiSectionRoute")
  69 + public Map<String, Object> multiSectionRoute(@RequestParam String codeIdx){
  70 + return realMapService.multiSectionRoute(codeIdx);
  71 + }
62 72 }
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -310,8 +310,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
310 310  
311 311 @RequestMapping(value = "/historyMessage")
312 312 public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
313   - @RequestParam String code) {
314   - return scheduleRealInfoService.historyMessage(line, date, code);
  313 + @RequestParam String code, @RequestParam String type) {
  314 + return scheduleRealInfoService.historyMessage(line, date, code, type);
315 315 }
316 316  
317 317 @RequestMapping(value="/findLine")
... ... @@ -332,14 +332,14 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
332 332  
333 333 @RequestMapping(value = "/account")
334 334 public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
335   - @RequestParam String code,@RequestParam String xlName) {
336   - return scheduleRealInfoService.account(line, date, code,xlName);
  335 + @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
  336 + return scheduleRealInfoService.account(line, date, code, xlName, type);
337 337 }
338 338  
339 339 @RequestMapping(value = "/correctForm")
340 340 public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate,
341   - @RequestParam String endDate,@RequestParam String lpName,@RequestParam String code) {
342   - return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code);
  341 + @RequestParam String endDate, @RequestParam String lpName, @RequestParam String code, @RequestParam String type) {
  342 + return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code, type);
343 343 }
344 344 /**
345 345 * @Title queryListWaybill
... ...
src/main/java/com/bsth/controller/realcontrol/SignalStateController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.data.gpsdata.SignalStateData;
  4 +import com.bsth.data.gpsdata.arrival.entity.SignalState;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestParam;
  8 +import org.springframework.web.bind.annotation.RestController;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * Created by panzhao on 2016/12/30.
  14 + */
  15 +@RestController
  16 +@RequestMapping("signalState")
  17 +public class SignalStateController {
  18 +
  19 + @Autowired
  20 + SignalStateData signalStateData;
  21 +
  22 + @RequestMapping("/multi")
  23 + public List<SignalState> findByMultiLine(@RequestParam String idx){
  24 + return signalStateData.get(idx);
  25 + }
  26 +}
... ...
src/main/java/com/bsth/controller/schedule/BController.java
... ... @@ -5,16 +5,21 @@ import com.bsth.common.ResponseCode;
5 5 import com.bsth.entity.schedule.BEntity;
6 6 import com.bsth.entity.sys.SysUser;
7 7 import com.bsth.service.schedule.BService;
8   -import com.bsth.service.schedule.ScheduleException;
  8 +import com.bsth.service.schedule.exception.ScheduleException;
9 9 import com.bsth.service.sys.SysUserService;
10 10 import com.google.common.base.Splitter;
  11 +import jxl.Sheet;
  12 +import jxl.Workbook;
  13 +import org.apache.commons.lang3.StringUtils;
11 14 import org.springframework.beans.factory.annotation.Autowired;
12 15 import org.springframework.data.domain.PageRequest;
13 16 import org.springframework.data.domain.Sort;
14 17 import org.springframework.web.bind.annotation.*;
  18 +import org.springframework.web.multipart.MultipartFile;
15 19  
  20 +import javax.servlet.http.HttpServletResponse;
16 21 import javax.servlet.http.HttpSession;
17   -import java.io.Serializable;
  22 +import java.io.*;
18 23 import java.util.*;
19 24  
20 25 /**
... ... @@ -26,7 +31,7 @@ public class BController&lt;T, ID extends Serializable&gt; {
26 31 @Autowired
27 32 private SysUserService sysUserService;
28 33  
29   - // CRUD 操作
  34 + //---------------- CRUD 操作 ----------------//
30 35 // Create操作
31 36 @RequestMapping(method = RequestMethod.POST)
32 37 public Map<String, Object> save(@RequestBody T t, HttpSession httpSession) {
... ... @@ -73,6 +78,7 @@ public class BController&lt;T, ID extends Serializable&gt; {
73 78 rtn.put("data", t);
74 79 return rtn;
75 80 }
  81 + // 查询所有操作
76 82 @RequestMapping(value = "/all", method = RequestMethod.GET)
77 83 public Map<String, Object> list(@RequestParam Map<String, Object> param) {
78 84 List<T> tList = bService.list(param);
... ... @@ -81,6 +87,7 @@ public class BController&lt;T, ID extends Serializable&gt; {
81 87 rtn.put("data", tList);
82 88 return rtn;
83 89 }
  90 + // 分页查询操作
84 91 @RequestMapping(method = RequestMethod.GET)
85 92 public Map<String, Object> list(
86 93 @RequestParam Map<String, Object> map,
... ... @@ -138,4 +145,99 @@ public class BController&lt;T, ID extends Serializable&gt; {
138 145 return rtn;
139 146 }
140 147  
  148 + //---------------- 数据服务操作 ----------------//
  149 + // 上传excel文件
  150 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  151 + public Map<String, Object> uploadFile(MultipartFile file) {
  152 + Map<String, Object> rtn = new HashMap<>();
  153 + try {
  154 + File file1 = bService.uploadFile(file.getOriginalFilename(), file.getBytes());
  155 + // excel文件名
  156 + String fileName = file1.getAbsolutePath();
  157 + // excel文件sheet
  158 + List<String> sheetnames = new ArrayList<>();
  159 + Workbook book = Workbook.getWorkbook(file1);
  160 + for (Sheet sheet : book.getSheets()) {
  161 + sheetnames.add(sheet.getName());
  162 + }
  163 +
  164 + rtn.put("status", ResponseCode.SUCCESS);
  165 + rtn.put("filename", fileName);
  166 + rtn.put("sheetnames", StringUtils.join(sheetnames, ","));
  167 + } catch (Exception exp) {
  168 + rtn.put("status", ResponseCode.ERROR);
  169 + rtn.put("msg", exp.getMessage());
  170 + }
  171 + return rtn;
  172 + }
  173 +
  174 + // 导入excel文件
  175 + @RequestMapping(value = "/importFile", method = RequestMethod.POST)
  176 + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) {
  177 + Map<String, Object> rtn = new HashMap<>();
  178 +
  179 + try {
  180 + File file = new File(String.valueOf(params.get("filename")));
  181 + if (!file.exists()) {
  182 + throw new Exception("导入文件不存在!");
  183 + }
  184 + bService.importData(file, params);
  185 +
  186 + rtn.put("status", ResponseCode.SUCCESS);
  187 + rtn.put("msg", "导入文件成功");
  188 + } catch (Exception exp) {
  189 + rtn.put("status", ResponseCode.ERROR);
  190 + rtn.put("msg", exp.getMessage());
  191 + }
  192 +
  193 + return rtn;
  194 + }
  195 +
  196 + // 上传并导入excel文件
  197 + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST)
  198 + public Map<String, Object> uploadAndImportFile(MultipartFile file) {
  199 + Map<String, Object> rtn = new HashMap<>();
  200 +
  201 + try {
  202 + File file1 = bService.uploadFile(file.getOriginalFilename(), file.getBytes());
  203 + Map<String, Object> params = new HashMap<>();
  204 + bService.importData(file1, params);
  205 +
  206 + rtn.put("status", ResponseCode.SUCCESS);
  207 + rtn.put("msg", "上传&导入文件成功");
  208 + } catch (Exception exp) {
  209 + rtn.put("status", ResponseCode.ERROR);
  210 + rtn.put("msg", exp.getMessage());
  211 + }
  212 +
  213 + return rtn;
  214 + }
  215 +
  216 + // 导出数据到xls文件
  217 + @RequestMapping(value = "/exportFile", method = RequestMethod.GET)
  218 + public void exportFile(HttpServletResponse response,
  219 + @RequestParam Map<String, Object> params) throws Exception {
  220 + File file = bService.exportData(params);
  221 + // 流输出导出文件
  222 + response.setHeader("content-type", "application/octet-stream");
  223 + response.setHeader("Content-Disposition", "attachment; filename=" + file.getName());
  224 + response.setContentType("application/octet-stream");
  225 +
  226 + OutputStream os = response.getOutputStream();
  227 + BufferedOutputStream bos = new BufferedOutputStream(os);
  228 +
  229 + InputStream is = new FileInputStream(file);
  230 + BufferedInputStream bis = new BufferedInputStream(is);
  231 +
  232 + int length = 0;
  233 + byte[] temp = new byte[1 * 1024 * 10];
  234 + while ((length = bis.read(temp)) != -1) {
  235 + bos.write(temp, 0, length);
  236 + }
  237 + bos.flush();
  238 + bis.close();
  239 + bos.close();
  240 + is.close();
  241 + }
  242 +
141 243 }
... ...
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java deleted 100644 → 0
1   -package com.bsth.controller.schedule;
2   -
3   -import com.bsth.common.ResponseCode;
4   -import com.bsth.controller.BaseController2;
5   -import com.bsth.entity.CarPark;
6   -import com.bsth.entity.LineInformation;
7   -import com.bsth.entity.StationRoute;
8   -import com.bsth.entity.schedule.GuideboardInfo;
9   -import com.bsth.entity.schedule.TTInfoDetail;
10   -import com.bsth.repository.schedule.TTInfoDetailRepository;
11   -import com.bsth.service.CarParkService;
12   -import com.bsth.service.LineInformationService;
13   -import com.bsth.service.StationRouteService;
14   -import com.bsth.service.schedule.GuideboardInfoService;
15   -import com.bsth.service.schedule.TTInfoDetailService;
16   -import com.bsth.service.schedule.utils.DataImportExportService;
17   -import com.bsth.service.schedule.utils.DataToolsProperties;
18   -import jxl.Cell;
19   -import jxl.Sheet;
20   -import jxl.Workbook;
21   -import jxl.write.Label;
22   -import jxl.write.WritableSheet;
23   -import jxl.write.WritableWorkbook;
24   -import org.apache.commons.lang3.StringUtils;
25   -import org.springframework.beans.factory.annotation.Autowired;
26   -import org.springframework.util.CollectionUtils;
27   -import org.springframework.web.bind.annotation.*;
28   -import org.springframework.web.multipart.MultipartFile;
29   -
30   -import javax.servlet.http.HttpServletResponse;
31   -import java.io.File;
32   -import java.util.*;
33   -import java.util.regex.Matcher;
34   -import java.util.regex.Pattern;
35   -
36   -/**
37   - * Created by xu on 16/7/2.
38   - */
39   -@RestController
40   -@RequestMapping("tidc")
41   -public class TTInfoDetailController extends BaseController2<TTInfoDetail, Long> {
42   - @Autowired
43   - private TTInfoDetailService ttInfoDetailService;
44   - @Autowired
45   - private CarParkService carParkService;
46   - @Autowired
47   - private LineInformationService lineInformationService;
48   - @Autowired
49   - private TTInfoDetailRepository ttInfoDetailRepository;
50   - @Autowired
51   - private DataImportExportService dataImportExportService;
52   - @Autowired
53   - private StationRouteService stationRouteService;
54   - @Autowired
55   - private GuideboardInfoService guideboardInfoService;
56   - @Autowired
57   - private DataToolsProperties dataToolsProperties;
58   -
59   - /**
60   - * 1、上传Excel文件,返回文件全路径名,工作区名称列表。
61   - * @param file
62   - * @return
63   - * @throws Exception
64   - */
65   -
66   -
67   - /**
68   - * 2、验证sheet(以后放到规则引擎里去做)。
69   - * @param filename excel文件全路径名
70   - * @param sheetname sheet名字
71   - * @param lineid 线路id
72   - * @param linename 线路名称
73   - * @return
74   - */
75   - @RequestMapping(value = "/validate/sheet", method = RequestMethod.POST)
76   - public Map<String, Object> validateSheet(String filename, String sheetname, Integer lineid, String linename) throws Exception {
77   - Map<String, Object> rtn = new HashMap<>();
78   - Workbook book = Workbook.getWorkbook(new File(filename));
79   - Sheet sheet = book.getSheet(sheetname);
80   - if (sheet.getRows() == 0 || sheet.getColumns() == 0) { // 工作区是否为空
81   - rtn.put("status", ResponseCode.ERROR);
82   - rtn.put("msg", String.format("%s 工作区没有数据!", sheetname));
83   - return rtn;
84   - } else {
85   - if (sheet.getRows() <= 1 || sheet.getColumns() <= 1) {
86   - rtn.put("status", ResponseCode.ERROR);
87   - rtn.put("msg", String.format("工作区至少包含2行2列的数据"));
88   - return rtn;
89   - } else {
90   - Cell[] cells = sheet.getRow(0); // 获取第一行数据列
91   - for (int i = 0; i < cells.length; i++) {
92   - String cell_con = cells[i].getContents();
93   -
94   - if (StringUtils.isEmpty(cell_con)) {
95   - rtn.put("status", ResponseCode.ERROR);
96   - rtn.put("msg", String.format("第1行,第%d列数据不能为空", i + 1));
97   - return rtn;
98   - } else {
99   - // 正则表达式去除数字
100   - cell_con = cell_con.replaceAll("[\\d+]", "");
101   -
102   - if (i == 0) { // 第一列必须是路牌2个字
103   - if (!"路牌".equals(cell_con.trim())) {
104   - rtn.put("status", ResponseCode.ERROR);
105   - rtn.put("msg", "第1行,第1列数据必须是路牌2个字");
106   - return rtn;
107   - }
108   - } else { // 排除出场,进场,其余内容到站点路由里查询,以各个方向的起点站为查询依据
109   - if ((!"出场".equals(cell_con.trim())) &&
110   - (!"进场".equals(cell_con.trim()))) {
111   - Map<String, Object> p1 = new HashMap<>();
112   - p1.put("line.id_eq", lineid);
113   - p1.put("stationName_eq", cell_con.trim());
114   - p1.put("stationMark_eq", "B");
115   -
116   -
117   - // TODO:这里要修改(起点站有启用撤销的标志的)
118   -
119   - List<StationRoute> stationRouteList = (List<StationRoute>) stationRouteService.list(p1);
120   - if (CollectionUtils.isEmpty(stationRouteList)) {
121   - rtn.put("status", ResponseCode.ERROR);
122   - rtn.put("msg", String.format("第1行,第%d列数据%s在%s站点路由中不是起点站", i + 1, cell_con.trim(), linename));
123   - return rtn;
124   - } else if (stationRouteList.size() > 1) {
125   - rtn.put("status", ResponseCode.ERROR);
126   - rtn.put("msg", String.format("第1行,第%d列数据%s在%s站点路由中上下行都是起点站", i + 1, cell_con.trim(), linename));
127   - return rtn;
128   - }
129   - }
130   -
131   - }
132   - }
133   - }
134   -
135   - // 验证路牌内容
136   - Map<String, Integer> gbindexmap = new HashMap<>(); // 记录每个路牌在第几行
137   - for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
138   - Cell bcell = sheet.getRow(i)[0]; // 获取第1列
139   - String bcell_con = bcell.getContents();
140   - if (StringUtils.isEmpty(bcell_con)) {
141   - rtn.put("status", ResponseCode.ERROR);
142   - rtn.put("msg", String.format("第%d行,第1列路牌无数据", i + 1));
143   - return rtn;
144   - } else if (gbindexmap.get(bcell_con.trim()) != null) {
145   - rtn.put("status", ResponseCode.ERROR);
146   - rtn.put("msg", String.format("第%d行,第1列的路牌数据与第%d行,第1列数据重复",
147   - i + 1,
148   - gbindexmap.get(bcell_con.trim())));
149   - return rtn;
150   - } else {
151   - Map<String, Object> p2 = new HashMap<>();
152   - p2.put("xl.id_eq", lineid);
153   - p2.put("lpName_eq", bcell_con.trim());
154   - List<GuideboardInfo> guideboardInfoList = (List<GuideboardInfo>) guideboardInfoService.list(p2);
155   - if (CollectionUtils.isEmpty(guideboardInfoList)) {
156   - rtn.put("status", ResponseCode.ERROR);
157   - rtn.put("msg", String.format("第%d行,第1列的路牌在%s中不存在", i + 1, linename));
158   - return rtn;
159   - } else if (guideboardInfoList.size() > 1) {
160   - rtn.put("status", ResponseCode.ERROR);
161   - rtn.put("msg", String.format("第%d行,第1列的路牌在%s中重复", i + 1, linename));
162   - return rtn;
163   - } else {
164   - gbindexmap.put(bcell_con.trim(), i + 1);
165   - }
166   - }
167   - }
168   -
169   - // 班次时间验证,正则表达式,格式hh:mm或者hhmm
170   - String el = "^(([0-1]\\d)|(2[0-4])):[0-5]\\d$"; // hh:mm格式
171   - String el2 = "^(([0-1]\\d)|(2[0-4]))[0-5]\\d$"; // hhmm格式
172   - Pattern p = Pattern.compile(el);
173   - Pattern p2 = Pattern.compile(el2);
174   -
175   - for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
176   - Cell[] bcells = sheet.getRow(i);
177   - for (int j = 1; j < bcells.length; j++) { // 从第2列开始
178   - String bcell_con = bcells[j].getContents();
179   - if (StringUtils.isNotEmpty(bcell_con)) {
180   - Matcher m = p.matcher(bcell_con.trim());
181   - Matcher m2 = p2.matcher(bcell_con.trim());
182   - if ((!m.matches()) && (!m2.matches())) {
183   - rtn.put("status", ResponseCode.ERROR);
184   - rtn.put("msg", String.format("第%d行,第%d列的发车时间格式不正确,格式应为hh:mm或hhmm", i + 1, j + 1));
185   - return rtn;
186   - }
187   - }
188   - }
189   - }
190   - }
191   -
192   - }
193   -
194   - rtn.put("status", ResponseCode.SUCCESS);
195   - return rtn;
196   - }
197   -
198   - /**
199   - * 3、验证关联的线路标准信息(以后放到规则引擎里去做)。
200   - * @param lineinfoid
201   - * @return
202   - */
203   - @RequestMapping(value = "/validate/lineinfo", method = RequestMethod.GET)
204   - public Map<String, Object> validateAssoLineInfo(Integer lineinfoid) {
205   - Map<String, Object> rtn = new HashMap<>();
206   - LineInformation lineInformation = lineInformationService.findById(lineinfoid);
207   - if (lineInformation.getUpInMileage() == null) {
208   - rtn.put("status", ResponseCode.ERROR);
209   - rtn.put("msg", "上行进场里程为空");
210   - return rtn;
211   - } else if (lineInformation.getUpInTimer() == null) {
212   - rtn.put("status", ResponseCode.ERROR);
213   - rtn.put("msg", "上行进场时间为空");
214   - return rtn;
215   - } else if (lineInformation.getUpOutMileage() == null) {
216   - rtn.put("status", ResponseCode.ERROR);
217   - rtn.put("msg", "上行出场里程为空");
218   - return rtn;
219   - } else if (lineInformation.getUpOutTimer() == null) {
220   - rtn.put("status", ResponseCode.ERROR);
221   - rtn.put("msg", "上行出场时间为空");
222   - return rtn;
223   - } else if (lineInformation.getUpMileage() == null) {
224   - rtn.put("status", ResponseCode.ERROR);
225   - rtn.put("msg", "上行班次里程为空");
226   - return rtn;
227   - } else if (lineInformation.getUpTravelTime() == null) {
228   - rtn.put("status", ResponseCode.ERROR);
229   - rtn.put("msg", "上行班次时间为空");
230   - return rtn;
231   - } else if (lineInformation.getDownInMileage() == null) {
232   - rtn.put("status", ResponseCode.ERROR);
233   - rtn.put("msg", "下行进场里程为空");
234   - return rtn;
235   - } else if (lineInformation.getDownInTimer() == null) {
236   - rtn.put("status", ResponseCode.ERROR);
237   - rtn.put("msg", "下行进场时间为空");
238   - return rtn;
239   - } else if (lineInformation.getDownOutMileage() == null) {
240   - rtn.put("status", ResponseCode.ERROR);
241   - rtn.put("msg", "下行出场里程为空");
242   - return rtn;
243   - } else if (lineInformation.getDownOutTimer() == null) {
244   - rtn.put("status", ResponseCode.ERROR);
245   - rtn.put("msg", "下行出场时间为空");
246   - return rtn;
247   - } else if (lineInformation.getDownMileage() == null) {
248   - rtn.put("status", ResponseCode.ERROR);
249   - rtn.put("msg", "下行班次里程为空");
250   - return rtn;
251   - } else if (lineInformation.getDownTravelTime() == null) {
252   - rtn.put("status", ResponseCode.ERROR);
253   - rtn.put("msg", "下行班次时间为空");
254   - return rtn;
255   - } else if (StringUtils.isEmpty(lineInformation.getCarPark())) {
256   - rtn.put("status", ResponseCode.ERROR);
257   - rtn.put("msg", "停车场必须选择");
258   - return rtn;
259   - }
260   -
261   - // 单独验证停车场信息
262   - String tcccode = lineInformation.getCarPark();
263   - Map<String, Object> p1 = new HashMap<>();
264   - p1.put("parkCode_eq", tcccode);
265   - List<CarPark> carParkList = (List<CarPark>) carParkService.list(p1);
266   - if (CollectionUtils.isEmpty(carParkList)) {
267   - rtn.put("status", ResponseCode.ERROR);
268   - rtn.put("msg", String.format("线路标准里的停车场code=%s,在停车场信息中未找到", tcccode));
269   - return rtn;
270   - } else if (carParkList.size() > 1) {
271   - rtn.put("status", ResponseCode.ERROR);
272   - rtn.put("msg", String.format("线路标准里的停车场code=%s,在停车场信息中有重复数据", tcccode));
273   - return rtn;
274   - } else {
275   - CarPark carPark = carParkList.get(0);
276   - if (StringUtils.isEmpty(carPark.getParkName())) {
277   - rtn.put("status", ResponseCode.ERROR);
278   - rtn.put("msg", String.format("线路标准里的停车场code=%s,在停车场信息中没有停车场名字", tcccode));
279   - return rtn;
280   - }
281   - }
282   -
283   - rtn.put("status", ResponseCode.SUCCESS);
284   - return rtn;
285   - }
286   -
287   - /**
288   - * 4、导入时刻表明细数据。
289   - * @param form
290   - * @return
291   - */
292   - @RequestMapping(value = "/importfile", method = RequestMethod.POST)
293   - public Map<String, Object> importTTinfo(@RequestParam Map<String, Object> form) throws Exception {
294   - Map<String, Object> rtn = new HashMap<>();
295   -
296   - // 1、修改已经上传的excel文件,在每个起点站后标示数字,表示第几个班次
297   - // 2、由于格式问题,需要把内容都转换成字符串
298   - String filename = (String) form.get("filename");
299   - List<String> colList = new ArrayList<>();
300   - Workbook workbook = Workbook.getWorkbook(new File(filename));
301   - Sheet sheet = workbook.getSheet((String) form.get("sheetname"));
302   - Cell[] cells = sheet.getRow(0);
303   - for (int i = 0; i < cells.length; i++) {
304   - if (i == 0) {
305   - colList.add(cells[i].getContents().trim());
306   - } else {
307   - colList.add(cells[i].getContents() + i);
308   - }
309   - }
310   -
311   - WritableWorkbook writableWorkbook = Workbook.createWorkbook(new File(filename + "_temp.xls"), workbook);
312   - WritableSheet sheet1 = writableWorkbook.getSheet((String) form.get("sheetname"));
313   - for (int i = 0; i < sheet1.getColumns(); i++) { // 第一行数据
314   - sheet1.addCell(new Label(i, 0, colList.get(i)));
315   - }
316   - for (int i = 1; i < sheet1.getRows(); i++) { // 第二行开始
317   - Cell[] cells1 = sheet.getRow(i);
318   - for (int j = 0; j < cells1.length; j++) {
319   - sheet1.addCell(new Label(j, i, cells1[j].getContents()));
320   - }
321   - }
322   - writableWorkbook.write();
323   - writableWorkbook.close();
324   -
325   - // 2、删除原有数据
326   - ttInfoDetailService.deleteByTtinfo(Long.valueOf(form.get("ttid").toString()));
327   -
328   - // 3、导入时刻表
329   - // 获取停车场名字
330   - LineInformation lineInformation = lineInformationService.findById(Integer.valueOf(form.get("lineinfo").toString()));
331   - Map<String, Object> p1 = new HashMap<>();
332   - p1.put("parkCode_eq", lineInformation.getCarPark());
333   - List<CarPark> carParkList = (List<CarPark>) carParkService.list(p1);
334   - String tccname = carParkList.get(0).getParkName();
335   -
336   - ttInfoDetailService.fileDataImport(
337   - new File(filename + "_temp.xls"),
338   - (String) form.get("sheetname"),
339   - (String) form.get("xlname"),
340   - (String) form.get("ttname"),
341   - tccname
342   - );
343   -
344   - return rtn;
345   - }
346   -
347   - //------------- 旧版本 --------------//
348   - @RequestMapping(value = "/dataImportExtend", method = RequestMethod.POST)
349   - public Map<String, Object> uploadDataAndImport(
350   - MultipartFile file, String xlmc, String ttinfoname) throws Exception {
351   - Map<String, Object> resultMap = new HashMap<>();
352   -
353   - try {
354   - // 查找lineinformation对象,没有报错
355   - Map<String, Object> param = new HashMap<>();
356   - param.put("line.name_eq", xlmc);
357   - Iterator<LineInformation> lineInformationIterator = lineInformationService.list(param).iterator();
358   - if (!lineInformationIterator.hasNext()) {
359   - // 没有lineinformation,报错
360   - resultMap.put("status", ResponseCode.ERROR);
361   - resultMap.put("msg", "没有lineinfomation,线路名称=" + xlmc);
362   - } else {
363   - String tcccode = lineInformationIterator.next().getCarPark();
364   - if (StringUtils.isEmpty(tcccode)) {
365   - // 没有停车场code,报错
366   - resultMap.put("status", ResponseCode.ERROR);
367   - resultMap.put("msg", "线路lineinfomation没有停车场code信息,线路名称=" + xlmc);
368   - } else {
369   - // 使用停车场code查找停车场
370   - param.clear();;
371   - param.put("parkCode_eq", tcccode);
372   - Iterator<CarPark> carParkIterator = carParkService.list(param).iterator();
373   - if (!carParkIterator.hasNext()) {
374   - // 指定的停车场code没有找到停车场信息,报错
375   - resultMap.put("status", ResponseCode.ERROR);
376   - resultMap.put("msg", "没有找到停车场信息,停车场code=" + tcccode);
377   - } else {
378   - String tccname = carParkIterator.next().getParkName();
379   - if (StringUtils.isEmpty(tccname)) {
380   - // 没有停车场名字,报错
381   - resultMap.put("status", ResponseCode.ERROR);
382   - resultMap.put("msg", "停车场信息没有停车场名字,停车场code=" + tcccode);
383   - } else {
384   - ttInfoDetailService.fileDataImport(file, xlmc, ttinfoname, tccname);
385   - resultMap.put("status", ResponseCode.SUCCESS);
386   - resultMap.put("msg", "导入成功");
387   - }
388   - }
389   - }
390   - }
391   - } catch (Exception exp) {
392   - exp.printStackTrace();
393   - throw exp;
394   - }
395   -
396   - return resultMap;
397   - }
398   -
399   - @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET)
400   - public Object getEditInfo(
401   - @PathVariable("xlid") Integer xlid,
402   - @PathVariable("ttid") Long ttid) throws Exception {
403   - // TODO:返回类型需要修正
404   - return ttInfoDetailService.getEditInfo(xlid, ttid);
405   - }
406   -
407   - @Override
408   - public TTInfoDetail findById(@PathVariable("id") Long aLong) {
409   - return ttInfoDetailRepository.findOneExtend(aLong);
410   - }
411   -
412   - @RequestMapping(value = "/bcdetail", method = RequestMethod.GET)
413   - public List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) {
414   - return ttInfoDetailRepository.findBcdetails(xlId, ttinfoId, lpId);
415   - }
416   -
417   - @Override
418   - public void dataExport(HttpServletResponse response, @RequestParam Map<String, Object> param) throws Exception {
419   - // 获取injectktr
420   - File ktrFile2 = new File(this.getClass().getResource(
421   - dataToolsProperties.getTtinfodetailOutput()).toURI());
422   - param.put("injectktrfile", ktrFile2.getAbsolutePath());
423   - param.put("ttinfoid", param.get("ttinfoid"));
424   -
425   - super.dataExport(response, param);
426   - }
427   -
428   - @Override
429   - protected String getDataExportKtrClasspath() {
430   - return dataToolsProperties.getTtinfodetailMetaoutput();
431   - }
432   -
433   - @Override
434   - protected String getDataExportFilename() {
435   - return "时刻表";
436   - }
437   -}
src/main/java/com/bsth/controller/schedule/basicinfo/CarDeviceController.java
... ... @@ -4,7 +4,7 @@ import com.bsth.common.ResponseCode;
4 4 import com.bsth.controller.schedule.BController;
5 5 import com.bsth.entity.CarDevice;
6 6 import com.bsth.service.schedule.CarDeviceService;
7   -import com.bsth.service.schedule.ScheduleException;
  7 +import com.bsth.service.schedule.exception.ScheduleException;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.web.bind.annotation.RequestMapping;
10 10 import org.springframework.web.bind.annotation.RequestMethod;
... ...
src/main/java/com/bsth/controller/schedule/basicinfo/CarsController.java
... ... @@ -4,7 +4,7 @@ import com.bsth.common.ResponseCode;
4 4 import com.bsth.controller.schedule.BController;
5 5 import com.bsth.entity.Cars;
6 6 import com.bsth.service.schedule.CarsService;
7   -import com.bsth.service.schedule.ScheduleException;
  7 +import com.bsth.service.schedule.exception.ScheduleException;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.web.bind.annotation.RequestMapping;
10 10 import org.springframework.web.bind.annotation.RequestMethod;
... ...
src/main/java/com/bsth/controller/schedule/basicinfo/EmployeeController.java
... ... @@ -4,7 +4,7 @@ import com.bsth.common.ResponseCode;
4 4 import com.bsth.controller.schedule.BController;
5 5 import com.bsth.entity.Personnel;
6 6 import com.bsth.service.schedule.EmployeeService;
7   -import com.bsth.service.schedule.ScheduleException;
  7 +import com.bsth.service.schedule.exception.ScheduleException;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.web.bind.annotation.RequestMapping;
10 10 import org.springframework.web.bind.annotation.RequestMethod;
... ...
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
... ... @@ -5,7 +5,7 @@ import com.bsth.controller.schedule.BController;
5 5 import com.bsth.entity.schedule.CarConfigInfo;
6 6 import com.bsth.repository.schedule.CarConfigInfoRepository;
7 7 import com.bsth.service.schedule.CarConfigInfoService;
8   -import com.bsth.service.schedule.ScheduleException;
  8 +import com.bsth.service.schedule.exception.ScheduleException;
9 9 import org.springframework.beans.factory.annotation.Autowired;
10 10 import org.springframework.web.bind.annotation.RequestMapping;
11 11 import org.springframework.web.bind.annotation.RequestMethod;
... ...
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
... ... @@ -5,7 +5,7 @@ import com.bsth.controller.schedule.BController;
5 5 import com.bsth.entity.schedule.EmployeeConfigInfo;
6 6 import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
7 7 import com.bsth.service.schedule.EmployeeConfigInfoService;
8   -import com.bsth.service.schedule.ScheduleException;
  8 +import com.bsth.service.schedule.exception.ScheduleException;
9 9 import org.springframework.beans.factory.annotation.Autowired;
10 10 import org.springframework.web.bind.annotation.RequestMapping;
11 11 import org.springframework.web.bind.annotation.RequestMethod;
... ...
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.java
... ... @@ -5,7 +5,7 @@ import com.bsth.controller.schedule.BController;
5 5 import com.bsth.entity.schedule.GuideboardInfo;
6 6 import com.bsth.repository.schedule.GuideboardInfoRepository;
7 7 import com.bsth.service.schedule.GuideboardInfoService;
8   -import com.bsth.service.schedule.ScheduleException;
  8 +import com.bsth.service.schedule.exception.ScheduleException;
9 9 import com.bsth.service.schedule.utils.DataToolsProperties;
10 10 import org.springframework.beans.factory.annotation.Autowired;
11 11 import org.springframework.boot.context.properties.EnableConfigurationProperties;
... ...
src/main/java/com/bsth/controller/schedule/core/TTInfoController.java
... ... @@ -3,7 +3,7 @@ package com.bsth.controller.schedule.core;
3 3 import com.bsth.common.ResponseCode;
4 4 import com.bsth.controller.schedule.BController;
5 5 import com.bsth.entity.schedule.TTInfo;
6   -import com.bsth.service.schedule.ScheduleException;
  6 +import com.bsth.service.schedule.exception.ScheduleException;
7 7 import com.bsth.service.schedule.TTInfoService;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.web.bind.annotation.RequestMapping;
... ...
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.schedule.TTInfoDetail;
  6 +import com.bsth.service.schedule.TTInfoDetailService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.PathVariable;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +import java.util.HashMap;
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by xu on 17/1/4.
  19 + */
  20 +@RestController
  21 +@RequestMapping("tidc")
  22 +public class TTInfoDetailController extends BController<TTInfoDetail, Long> {
  23 + @Autowired
  24 + private TTInfoDetailService ttInfoDetailService;
  25 +
  26 + @RequestMapping(value = "/bcdetail", method = RequestMethod.GET)
  27 + public List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) {
  28 + return ttInfoDetailService.findBcdetails(xlId, ttinfoId, lpId);
  29 + }
  30 +
  31 + /**
  32 + * 验证sheet(以后放到规则引擎里去做)。
  33 + * @param filename excel文件全路径名
  34 + * @param sheetname sheet名字
  35 + * @param lineid 线路id
  36 + * @param linename 线路名称
  37 + * @return
  38 + */
  39 + @RequestMapping(value = "/validate/sheet", method = RequestMethod.POST)
  40 + public Map<String, Object> validate_sheet(String filename, String sheetname, Integer lineid, String linename) {
  41 + Map<String, Object> rtn = new HashMap<>();
  42 + try {
  43 + ttInfoDetailService.validateExcelSheet(filename, sheetname, lineid, linename);
  44 + rtn.put("status", ResponseCode.SUCCESS);
  45 + } catch (Exception exp) {
  46 + rtn.put("status", ResponseCode.ERROR);
  47 + rtn.put("msg", exp.getMessage());
  48 + }
  49 + return rtn;
  50 + }
  51 +
  52 + /**
  53 + * 验证关联的线路标准信息(以后放到规则引擎里去做)。
  54 + * @param lineinfoid
  55 + * @return
  56 + */
  57 + @RequestMapping(value = "/validate/lineinfo", method = RequestMethod.GET)
  58 + public Map<String, Object> validate_lineInfo(Integer lineinfoid) {
  59 + Map<String, Object> rtn = new HashMap<>();
  60 + try {
  61 + ttInfoDetailService.validateAssoLineInfo(lineinfoid);
  62 + rtn.put("status", ResponseCode.SUCCESS);
  63 + } catch (Exception exp) {
  64 + rtn.put("status", ResponseCode.ERROR);
  65 + rtn.put("msg", exp.getMessage());
  66 + }
  67 + return rtn;
  68 + }
  69 +
  70 + /**
  71 + * 获取时刻表明细编辑信息。
  72 + * @param xlid 线路id
  73 + * @param ttid 时刻表id
  74 + * @return
  75 + */
  76 + @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET)
  77 + public Map<String, Object> getEditInfo(@PathVariable("xlid") Integer xlid,
  78 + @PathVariable("ttid") Long ttid) {
  79 + Map<String, Object> rtn = new HashMap<>();
  80 + try {
  81 + TTInfoDetailService.EditInfo editInfo = ttInfoDetailService.getEditInfo(xlid, ttid);
  82 + rtn.put("status", ResponseCode.SUCCESS);
  83 + rtn.put("data", editInfo);
  84 + } catch (Exception exp) {
  85 + rtn.put("status", ResponseCode.ERROR);
  86 + rtn.put("msg", exp.getMessage());
  87 + }
  88 + return rtn;
  89 + }
  90 +
  91 +}
... ...
src/main/java/com/bsth/controller/sys/DutyEmployeeController.java 0 → 100644
  1 +package com.bsth.controller.sys;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.sys.DutyEmployee;
  5 +import com.bsth.service.sys.DutyEmployeeService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * Created by panzhao on 2017/1/5.
  15 + */
  16 +@RestController
  17 +@RequestMapping("dutyEmployee")
  18 +public class DutyEmployeeController extends BaseController<DutyEmployee, Long> {
  19 +
  20 + @Autowired
  21 + DutyEmployeeService dutyEmployeeService;
  22 +
  23 + @RequestMapping(value = "queryByLineAndTime")
  24 + public List<DutyEmployee> getDutyEmployee(@RequestParam String lineCode, @RequestParam String startTime, @RequestParam String endTime) {
  25 + return dutyEmployeeService.getDutyEmployee(lineCode, startTime, endTime);
  26 + }
  27 +}
... ...
src/main/java/com/bsth/data/BasicData.java
... ... @@ -26,12 +26,12 @@ import java.util.concurrent.TimeUnit;
26 26 */
27 27 @Component
28 28 public class BasicData implements CommandLineRunner {
29   -
30   - //公司代码和公司名对照(K: 公司编码,V:公司名)
31   - public static Map<String, String> businessCodeNameMap;
32   -
33   - //分公司公司代码和分公司公司名对照(K: 公司编码+分公司编码,V:分公司公司名)
34   - public static Map<String, String> businessFgsCodeNameMap;
  29 +
  30 + //公司代码和公司名对照(K: 公司编码,V:公司名)
  31 + public static Map<String, String> businessCodeNameMap;
  32 +
  33 + //分公司公司代码和分公司公司名对照(K: 公司编码+分公司编码,V:分公司公司名)
  34 + public static Map<String, String> businessFgsCodeNameMap;
35 35  
36 36 //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号)
37 37 public static BiMap<String, String> deviceId2NbbmMap;
... ... @@ -39,27 +39,21 @@ public class BasicData implements CommandLineRunner {
39 39 //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码)
40 40 public static Map<String, String> nbbm2CompanyCodeMap;
41 41  
42   - //站点编码和名称对照,包括停车场 (K: 站点编码 ,V:站点名称)
  42 + //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称)
43 43 public static Map<String, String> stationCode2NameMap;
44 44  
45 45 //线路起终点对照(线路编码_上下行_起终点) 1024_0_B (1024上行起点)
46   - public static Map<String, String> lineSEPointMap;
  46 + //public static Map<String, String> lineSEPointMap;
47 47  
48 48 //车辆和线路对照
49 49 public static Map<String, Line> nbbm2LineMap;
50 50  
51   - //线路和用户对照 用于webSocket定向推送消息(用户进入线调时写入数据)
52   - //public static TreeMultimap<String, String> lineCode2SocketUserMap = TreeMultimap.create();
53   -
54 51 //线路ID和code 对照
55 52 public static BiMap<Integer, String> lineId2CodeMap;
56 53  
57 54 //线路编码和名称对照
58 55 public static Map<String, String> lineCode2NameMap;
59 56  
60   - //线路编码_站点编码 == 0|1 上下行
61   - //public static Map<String, Integer> lineStationUpDownMap;
62   -
63 57 //停车场
64 58 public static List<String> parkCodeList;
65 59  
... ... @@ -77,7 +71,7 @@ public class BasicData implements CommandLineRunner {
77 71 public static Map<String, String> allPerson;
78 72  
79 73 //站点名和运管处编号 对照
80   - public static Map<String,Integer> stationName2YgcNumber;
  74 + public static Map<String, Integer> stationName2YgcNumber;
81 75  
82 76  
83 77 static Logger logger = LoggerFactory.getLogger(BasicData.class);
... ... @@ -90,6 +84,10 @@ public class BasicData implements CommandLineRunner {
90 84 Application.mainServices.scheduleWithFixedDelay(dataLoader, 2, 2, TimeUnit.HOURS);
91 85 }
92 86  
  87 + public static String getStationNameByCode(String code, String prefix){
  88 + String name = stationCode2NameMap.get(code);
  89 + return name != null? name: stationCode2NameMap.get(prefix + code);
  90 + }
93 91  
94 92 @Component
95 93 public static class BasicDataLoader extends Thread {
... ... @@ -114,7 +112,7 @@ public class BasicData implements CommandLineRunner {
114 112  
115 113 @Autowired
116 114 PersonnelRepository personnelRepository;
117   -
  115 +
118 116 @Autowired
119 117 BusinessRepository businessRepository;
120 118  
... ... @@ -156,47 +154,24 @@ public class BasicData implements CommandLineRunner {
156 154 return 0;
157 155 }
158 156  
159   -
160   -/* private void loadStationRouteInfo() {
161   - Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator();
162   -
163   - Map<String, String> sePointMap = new HashMap<>();
164   - //lineSEPointMap
165   - Map<String, Integer> map = new HashMap<>();
166   -
167   - StationRoute route;
168   - while (iterator.hasNext()) {
169   - route = iterator.next();
170   - map.put(route.getLineCode() + "_" + route.getStationCode(), route.getDirections());
171   -
172   - if (route.getStationMark() != null &&
173   - (route.getStationMark().equals("B") || route.getStationMark().equals("E"))) {
174   - sePointMap.put(route.getLineCode() + "_"
175   - + route.getDirections()
176   - + "_" + route.getStationMark(), route.getStationCode());
177   - }
178   - }
179   - lineStationUpDownMap = map;
180   - lineSEPointMap = sePointMap;
181   - }*/
182   -
183 157 /**
184 158 * loadBusinessInfo
185 159 * (公司代码公司名对照)
186 160 */
187   - public void loadBusinessInfo(){
188   - Map<String, String> businessMap=new HashMap<String,String>();
189   - Map<String, String> businessFgsMap=new HashMap<String,String>();
190   - Iterator<Business> busIter=businessRepository.findAll().iterator();
191   - Business t;
192   - while(busIter.hasNext()){
193   - t=busIter.next();
194   - businessMap.put(t.getBusinessCode(), t.getBusinessName());
195   - businessFgsMap.put(t.getBusinessCode()+"_"+t.getUpCode(), t.getBusinessName());
196   - }
197   - businessCodeNameMap=businessMap;
198   - businessFgsCodeNameMap=businessFgsMap;
  161 + public void loadBusinessInfo() {
  162 + Map<String, String> businessMap = new HashMap<String, String>();
  163 + Map<String, String> businessFgsMap = new HashMap<String, String>();
  164 + Iterator<Business> busIter = businessRepository.findAll().iterator();
  165 + Business t;
  166 + while (busIter.hasNext()) {
  167 + t = busIter.next();
  168 + businessMap.put(t.getBusinessCode(), t.getBusinessName());
  169 + businessFgsMap.put(t.getBusinessCode() + "_" + t.getUpCode(), t.getBusinessName());
  170 + }
  171 + businessCodeNameMap = businessMap;
  172 + businessFgsCodeNameMap = businessFgsMap;
199 173 }
  174 +
200 175 /**
201 176 * @Title: loadDeviceInfo
202 177 * @Description: TODO(加载设备相关信息)
... ... @@ -223,13 +198,13 @@ public class BasicData implements CommandLineRunner {
223 198 */
224 199 public void loadStationInfo() {
225 200 Map<String, String> stationCode2Name = new HashMap<>();
226   - Iterator<Station> iterator = stationRepository.findAll().iterator();
227   - //站点
228   - Station station;
  201 + Iterator<StationRoute> iterator = stationRouteRepository.findAll().iterator();
  202 + StationRoute sroute;
229 203 while (iterator.hasNext()) {
230   - station = iterator.next();
231   - stationCode2Name.put(station.getStationCod(), station.getStationName());
  204 + sroute = iterator.next();
  205 + stationCode2Name.put(sroute.getLineCode() + "_" + sroute.getDirections() + "_" + sroute.getStationCode(), sroute.getStationName());
232 206 }
  207 +
233 208 //停车场
234 209 Iterator<CarPark> iterator2 = carParkRepository.findAll().iterator();
235 210  
... ... @@ -266,7 +241,7 @@ public class BasicData implements CommandLineRunner {
266 241 * @Title: loadLineInfo
267 242 * @Description: TODO(加载线路相关信息)
268 243 */
269   - public void loadLineInfo(){
  244 + public void loadLineInfo() {
270 245 Iterator<Line> iterator = lineRepository.findAll().iterator();
271 246  
272 247 Line line;
... ... @@ -276,36 +251,36 @@ public class BasicData implements CommandLineRunner {
276 251 Map<String, String> code2SHcode = new HashMap<String, String>();
277 252 Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>();
278 253  
279   - while(iterator.hasNext()){
  254 + while (iterator.hasNext()) {
280 255 line = iterator.next();
281 256 biMap.put(line.getId(), line.getLineCode());
282 257 code2name.put(line.getLineCode(), line.getName());
283   - id2SHcode.put(line.getId(),line.getShanghaiLinecode());
  258 + id2SHcode.put(line.getId(), line.getShanghaiLinecode());
284 259 code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode());
285 260  
286 261 /**
287 262 * 加载运管处的站点及序号
288 263 * 上行从1开始,下行顺序续编
289 264  
290   - List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc();
291   - if(ygcLines != null && ygcLines.size() > 0){
292   - int size = ygcLines.size();
293   - Object[] tempArray ;
294   - int num = 1;
295   - String key;
296   - String lineCode = "";
297   - for (int i = 0; i < size; i ++){
298   - tempArray = ygcLines.get(i);
299   - if(lineCode.equals("")){
300   - lineCode = tempArray[0]+"";
301   - }else if(!lineCode.equals(tempArray[0]+"")){
302   - num = 1;
303   - lineCode = tempArray[0]+"";
304   - }
305   - key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2];
306   - tempStationName2YgcNumber.put(key,num++);
307   - }
308   - }*/
  265 + List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc();
  266 + if(ygcLines != null && ygcLines.size() > 0){
  267 + int size = ygcLines.size();
  268 + Object[] tempArray ;
  269 + int num = 1;
  270 + String key;
  271 + String lineCode = "";
  272 + for (int i = 0; i < size; i ++){
  273 + tempArray = ygcLines.get(i);
  274 + if(lineCode.equals("")){
  275 + lineCode = tempArray[0]+"";
  276 + }else if(!lineCode.equals(tempArray[0]+"")){
  277 + num = 1;
  278 + lineCode = tempArray[0]+"";
  279 + }
  280 + key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2];
  281 + tempStationName2YgcNumber.put(key,num++);
  282 + }
  283 + }*/
309 284 }
310 285  
311 286 lineId2CodeMap = biMap;
... ...
src/main/java/com/bsth/data/LineConfigData.java
... ... @@ -10,6 +10,7 @@ import org.slf4j.Logger;
10 10 import org.slf4j.LoggerFactory;
11 11 import org.springframework.beans.factory.annotation.Autowired;
12 12 import org.springframework.boot.CommandLineRunner;
  13 +import org.springframework.core.annotation.Order;
13 14 import org.springframework.stereotype.Component;
14 15  
15 16 import java.util.*;
... ... @@ -23,6 +24,7 @@ import java.util.*;
23 24 *
24 25 */
25 26 @Component
  27 +@Order(value = 2)
26 28 public class LineConfigData implements CommandLineRunner {
27 29  
28 30 Logger logger = LoggerFactory.getLogger(this.getClass());
... ...
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
1 1 package com.bsth.data.arrival;
2 2  
3   -import com.bsth.data.match.Arrival2Schedule;
4 3 import com.bsth.data.schedule.DayOfSchedule;
5 4 import com.google.common.collect.ArrayListMultimap;
6 5 import com.google.common.collect.ListMultimap;
... ... @@ -59,7 +58,7 @@ public class ArrivalData_GPS implements CommandLineRunner{
59 58  
60 59 @Override
61 60 public void run() {
62   - try{
  61 + /*try{
63 62 logger.info("开始加载到离站数据, " + System.currentTimeMillis());
64 63 List<ArrivalEntity> arrSets = dataLoader.load();
65 64 if(null == arrSets || arrSets.size() == 0)
... ... @@ -86,7 +85,7 @@ public class ArrivalData_GPS implements CommandLineRunner{
86 85 Arrival2Schedule.start(carSet);
87 86 }catch(Exception e){
88 87 logger.error("", e);
89   - }
  88 + }*/
90 89 }
91 90 }
92 91  
... ...
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
1 1 package com.bsth.data.forecast;
2 2  
  3 +import com.bsth.Application;
3 4 import com.bsth.data.forecast.entity.ForecastResult;
4 5 import com.bsth.data.forecast.entity.ForecastResult.ForecastResultItem;
5 6 import com.bsth.data.forecast.entity.SimpleRoute;
... ... @@ -20,6 +21,7 @@ import java.util.ArrayList;
20 21 import java.util.HashMap;
21 22 import java.util.List;
22 23 import java.util.Map;
  24 +import java.util.concurrent.TimeUnit;
23 25  
24 26 /**
25 27 *
... ... @@ -58,7 +60,7 @@ public class ForecastRealServer implements CommandLineRunner {
58 60 @Override
59 61 public void run(String... arg0) throws Exception {
60 62 //2小时更新一次站点间耗时数据
61   - //Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS);
  63 + Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS);
62 64 }
63 65  
64 66 /**
... ... @@ -86,7 +88,7 @@ public class ForecastRealServer implements CommandLineRunner {
86 88 //终点站
87 89 String eStation = null;
88 90 //当前执行班次
89   - ScheduleRealInfo sch = dayOfSchedule.execPlanMap().get(nbbm);
  91 + ScheduleRealInfo sch = dayOfSchedule.executeCurr(nbbm);
90 92 if(null != sch)
91 93 eStation = sch.getZdzCode();
92 94  
... ...
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
... ... @@ -86,7 +86,7 @@ public class GpsEntity {
86 86 private StationRoute station;
87 87  
88 88 /** 状态 */
89   - private String signalState;
  89 + private String signalState = "normal";
90 90  
91 91 public Integer getCompanyCode() {
92 92 return companyCode;
... ...
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
... ... @@ -2,7 +2,6 @@ package com.bsth.data.gpsdata;
2 2  
3 3 import com.alibaba.fastjson.JSON;
4 4 import com.alibaba.fastjson.JSONObject;
5   -import com.bsth.Application;
6 5 import com.bsth.data.BasicData;
7 6 import com.bsth.data.forecast.ForecastRealServer;
8 7 import com.bsth.data.gpsdata.arrival.GpsRealAnalyse;
... ... @@ -26,7 +25,6 @@ import org.springframework.stereotype.Component;
26 25 import java.io.BufferedReader;
27 26 import java.io.InputStreamReader;
28 27 import java.util.*;
29   -import java.util.concurrent.TimeUnit;
30 28  
31 29 /**
32 30 * @author PanZhao
... ... @@ -67,12 +65,42 @@ public class GpsRealData implements CommandLineRunner {
67 65  
68 66 @Override
69 67 public void run(String... arg0) throws Exception {
70   - logger.info("gpsDataLoader,40,6");
71   - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 40, 6, TimeUnit.SECONDS);
  68 + logger.info("gpsDataLoader,20,5");
  69 + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS);
72 70 }
73 71  
74 72 public void put(GpsEntity gps) {
75   - gpsMap.put(gps.getDeviceId(), gps);
  73 + String device = gps.getDeviceId();
  74 + GpsEntity old = gpsMap.get(device);
  75 +
  76 + try {
  77 + if (!StringUtils.isEmpty(gps.getStopNo())) {
  78 + //站点编码改变
  79 + if (null == old || !gps.getStopNo().equals(old.getStopNo())) {
  80 + gps.setArrTime(gps.getTimestamp());
  81 + //预测到达终点时间
  82 + forecastRealServer.forecast(gps.getNbbm(), gps);
  83 + } else {
  84 + gps.setArrTime(old.getArrTime());
  85 + //不预测, 重新计算终点时间
  86 + gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm()));
  87 + }
  88 + }
  89 + } catch (Exception e) {
  90 + logger.error("", e);
  91 + }
  92 +
  93 + //刷新对照
  94 + gpsMap.put(device, gps);
  95 + if (StringUtils.isNotBlank(gps.getLineId())) {
  96 + //站点名称
  97 + gps.setStationName(getStationName(gps));
  98 + lineCode2Devices.put(gps.getLineId(), device);
  99 + }
  100 + }
  101 +
  102 + public String getStationName(GpsEntity gps) {
  103 + return BasicData.getStationNameByCode(gps.getStopNo(), gps.getLineId() + "_" + gps.getUpDown() + "_");
76 104 }
77 105  
78 106 /**
... ... @@ -94,7 +122,7 @@ public class GpsRealData implements CommandLineRunner {
94 122 for (String device : set) {
95 123 gps = gpsMap.get(device);
96 124 //过滤异常GPS数据
97   - if (gps.isAbnormal())
  125 + if (gps == null || gps.isAbnormal())
98 126 continue;
99 127  
100 128 sch = dayOfSchedule.execPlanMap().get(gps.getNbbm());
... ...
src/main/java/com/bsth/data/gpsdata/SignalStateData.java 0 → 100644
  1 +package com.bsth.data.gpsdata;
  2 +
  3 +import com.bsth.data.gpsdata.arrival.entity.SignalState;
  4 +import com.bsth.websocket.handler.SendUtils;
  5 +import com.google.common.base.Splitter;
  6 +import com.google.common.collect.ArrayListMultimap;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import java.util.ArrayList;
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * 信号状态数据
  15 + * Created by panzhao on 2016/12/30.
  16 + */
  17 +@Component
  18 +public class SignalStateData {
  19 +
  20 + @Autowired
  21 + SendUtils sendUtils;
  22 +
  23 + private static ArrayListMultimap<String, SignalState> listMultimap = ArrayListMultimap.create();
  24 +
  25 + public void put(SignalState state){
  26 + listMultimap.put(state.getLineCode(), state);
  27 + //推送到客户端
  28 + sendUtils.sendSignalState(state);
  29 + }
  30 +
  31 + public List<SignalState> get(String idx){
  32 + List<SignalState> rs = new ArrayList<>();
  33 + List<String> ids = Splitter.on(",").splitToList(idx);
  34 +
  35 + for(String lineCode : ids){
  36 + rs.addAll(listMultimap.get(lineCode));
  37 + }
  38 + return rs;
  39 + }
  40 +}
... ...
src/main/java/com/bsth/data/gpsdata/arrival/GeoCacheData.java
... ... @@ -29,8 +29,8 @@ public class GeoCacheData {
29 29  
30 30 static Logger logger = LoggerFactory.getLogger(GeoCacheData.class);
31 31  
32   - //每辆车缓存最后500条gps
33   - private static final int CACHE_SIZE = 500;
  32 + //每辆车缓存最后1000条gps
  33 + private static final int CACHE_SIZE = 1000;
34 34 private static Map<String, CircleQueue<GpsEntity>> gpsCacheMap = new HashMap<>();
35 35  
36 36 //线路路段走向
... ... @@ -75,7 +75,7 @@ public class GeoCacheData {
75 75 }
76 76 }
77 77  
78   - public static StationRoute getRouteCode(GpsEntity gps){
  78 + public static StationRoute getRouteCode(GpsEntity gps) {
79 79 return routeCodeMap.get(gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo());
80 80 }
81 81  
... ... @@ -94,6 +94,21 @@ public class GeoCacheData {
94 94 return null;
95 95 }
96 96  
  97 + public static List<StationRoute> midwayStation(String lineCode, int directions, String sCode, String eCode) {
  98 + List<StationRoute> list = getStationRoute(lineCode, directions), rs = new ArrayList<>();
  99 +
  100 + boolean flag = false;
  101 + for (StationRoute sr : list) {
  102 + if (flag)
  103 + rs.add(sr);
  104 + if (sr.getCode().equals(sCode))
  105 + flag = true;
  106 + else if (sr.getCode().equals(eCode))
  107 + break;
  108 + }
  109 + return rs;
  110 + }
  111 +
97 112 public static Polygon getTccPolygon(String code) {
98 113 return tccMap.get(code);
99 114 }
... ... @@ -191,4 +206,16 @@ public class GeoCacheData {
191 206 }
192 207 return cds;
193 208 }
  209 +
  210 + /**
  211 + * 是不是终点站
  212 + * @param lineId
  213 + * @param upDown
  214 + * @param stationCode
  215 + * @return
  216 + */
  217 + public static boolean isEndStation(String lineId, Integer upDown, String stationCode) {
  218 + StationRoute station = routeCodeMap.get(lineId + "_" + upDown + "_" + stationCode);
  219 + return station != null && station.getMark().equals("E");
  220 + }
194 221 }
195 222 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
1 1 package com.bsth.data.gpsdata.arrival;
2 2  
3 3 import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.gpsdata.GpsRealData;
4 5 import com.bsth.data.gpsdata.arrival.handlers.*;
5 6 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
6 7 import org.slf4j.Logger;
... ... @@ -33,6 +34,9 @@ public class GpsRealAnalyse {
33 34 @Autowired
34 35 ReverseSignalHandle reverseSignalHandle;
35 36  
  37 + @Autowired
  38 + GpsRealData gpsRealData;
  39 +
36 40 //50个线程
37 41 static ExecutorService threadPool = Executors.newFixedThreadPool(50);
38 42  
... ... @@ -45,6 +49,10 @@ public class GpsRealAnalyse {
45 49 try {
46 50 //等待子线程结束
47 51 count.await();
  52 +
  53 + //加入实时gps对照
  54 + for(GpsEntity gps: list)
  55 + gpsRealData.put(gps);
48 56 } catch (InterruptedException e) {
49 57 logger.error("", e);
50 58 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
1 1 package com.bsth.data.gpsdata.arrival;
2 2  
3 3 import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.gpsdata.arrival.entity.StationRoute;
4 5 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
  6 +import com.bsth.data.gpsdata.arrival.utils.GeoUtils;
  7 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  8 +
  9 +import java.util.List;
5 10  
6 11 /**
7 12 * Created by panzhao on 2016/12/27.
... ... @@ -14,64 +19,71 @@ public abstract class SignalHandle {
14 19 return prevs != null && prevs.size() > 0 && prevs.getTail() != null;
15 20 }
16 21  
  22 + protected boolean isDriftSignal(GpsEntity gps) {
  23 + return gps.getLat() == 0 || gps.getLon() == 0;
  24 + }
  25 +
17 26 /**
18 27 * 是不是异常信号
19 28 *
20 29 * @param gps
21   - * @return
22   - */
23   - protected boolean isAbnormal(GpsEntity gps) {
24   - return gps.getLat() == 0 || gps.getLon() == 0;
25   - }
  30 + * @return protected boolean isAbnormal(GpsEntity gps) {
  31 + return gps.getLat() == 0 || gps.getLon() == 0;
  32 + }*/
26 33  
27 34 /**
28 35 * 连续异常信号个数统计
29 36 *
30 37 * @param prevs
31   - * @return
  38 + * @return protected int abnormalCount(CircleQueue<GpsEntity> prevs) {
  39 + * int count = 0;
  40 + * <p>
  41 + * if (!isNotEmpty(prevs))
  42 + * return count;
  43 + * <p>
  44 + * GpsEntity[] array = (GpsEntity[]) prevs.getQueue();
  45 + * GpsEntity gps;
  46 + * for (int i = array.length - 1; i > 0; i--) {
  47 + * gps = array[i];
  48 + * <p>
  49 + * if (isAbnormal(gps))
  50 + * count++;
  51 + * else
  52 + * break;
  53 + * }
  54 + * <p>
  55 + * return count;
  56 + * }
32 57 */
33   - protected int abnormalCount(CircleQueue<GpsEntity> prevs) {
34   - int count = 0;
35 58  
36   - if (!isNotEmpty(prevs))
37   - return count;
38   -
39   - GpsEntity[] array = (GpsEntity[]) prevs.getQueue();
40   - GpsEntity gps;
41   - for (int i = array.length - 1; i > 0; i--) {
42   - gps = array[i];
43   -
44   - if (isAbnormal(gps))
45   - count++;
46   - else
47   - break;
  59 + protected void transformUpdown(GpsEntity gps, ScheduleRealInfo sch) {
  60 + int updown = Integer.parseInt(sch.getXlDir());
  61 + List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), updown);
  62 + StationRoute station = GeoUtils.gpsInStation(gps, srs);
  63 + if (station != null) {
  64 + gps.setUpDown(updown);
  65 + gps.setStopNo(station.getCode());
48 66 }
49   -
50   - return count;
51 67 }
52 68  
53 69 /**
54   - * 车辆运行轨迹(最近20分钟)
55   - * 0:上行 1:下行 -1:未知
  70 + * 是否是从异常状态恢复的第一个信号
56 71 *
57 72 * @param gps
  73 + * @param prevs
58 74 * @return
59 75 */
60   - protected int runTrack(GpsEntity gps, CircleQueue<GpsEntity> prevs) {
61   - int rs = -1, count = 0;
62   -
63   - long et = gps.getTimestamp() - (1000 * 60 * 20);
64   - Object[] array = prevs.getQueue();
65   - GpsEntity prev;
66   - for(Object obj : array){
67   - prev = (GpsEntity) obj;
68   - if(prev.getTimestamp() < et)
69   - break;
70   -
  76 + protected boolean abnormalRecovery(GpsEntity gps, CircleQueue<GpsEntity> prevs) {
  77 + if (prevs == null || prevs.size() == 0)
  78 + return false;
71 79  
  80 + GpsEntity prev = prevs.getTail();
  81 + //从漂移状态恢复
  82 + if (isDriftSignal(prev)
  83 + && !isDriftSignal(gps)) {
  84 + return true;
72 85 }
73   - //for()
74   - return 0;
75   - }
76 86  
77   -}
  87 + return false;
  88 + }
  89 +}
78 90 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/arrival/entity/RouteReverse.java
... ... @@ -5,6 +5,7 @@ package com.bsth.data.gpsdata.arrival.entity;
5 5 */
6 6 public class RouteReverse {
7 7  
  8 + private String nbbm;
8 9 //反转个数
9 10 private int count;
10 11  
... ... @@ -14,18 +15,18 @@ public class RouteReverse {
14 15 //掉头站点
15 16 private String turned;
16 17  
17   - //开始时间
18   - private long st;
19   -
20 18 //掉头时间
21 19 private long zt;
22 20  
23   - //结束时间
24   - private long et;
  21 + //检测时间
  22 + private long ct;
25 23  
26 24 //是否闭合
27 25 private boolean close;
28 26  
  27 + //信号不明确
  28 + private boolean vague;
  29 +
29 30 public int getCount() {
30 31 return count;
31 32 }
... ... @@ -50,22 +51,6 @@ public class RouteReverse {
50 51 this.turned = turned;
51 52 }
52 53  
53   - public long getSt() {
54   - return st;
55   - }
56   -
57   - public void setSt(long st) {
58   - this.st = st;
59   - }
60   -
61   - public long getEt() {
62   - return et;
63   - }
64   -
65   - public void setEt(long et) {
66   - this.et = et;
67   - }
68   -
69 54 public boolean isClose() {
70 55 return close;
71 56 }
... ... @@ -81,4 +66,28 @@ public class RouteReverse {
81 66 public void setZt(long zt) {
82 67 this.zt = zt;
83 68 }
84   -}
  69 +
  70 + public long getCt() {
  71 + return ct;
  72 + }
  73 +
  74 + public void setCt(long ct) {
  75 + this.ct = ct;
  76 + }
  77 +
  78 + public String getNbbm() {
  79 + return nbbm;
  80 + }
  81 +
  82 + public void setNbbm(String nbbm) {
  83 + this.nbbm = nbbm;
  84 + }
  85 +
  86 + public boolean isVague() {
  87 + return vague;
  88 + }
  89 +
  90 + public void setVague(boolean vague) {
  91 + this.vague = vague;
  92 + }
  93 +}
85 94 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/arrival/entity/SignalAbnormal.java 0 → 100644
  1 +package com.bsth.data.gpsdata.arrival.entity;
  2 +
  3 +/**
  4 + * 班次信号异常(漂移 或 断线)
  5 + * Created by panzhao on 2016/12/31.
  6 + */
  7 +public class SignalAbnormal {
  8 +
  9 + private Long et;
  10 +
  11 + /** drift or reconnection */
  12 + private String abnormalType;
  13 +
  14 + private Long st;
  15 +
  16 + private String nearPoint;
  17 +
  18 + private String destCode;
  19 +
  20 + private Long ct;
  21 +
  22 + //0: 发车 1:到站
  23 + private int outOrIn;
  24 +
  25 + public Long getEt() {
  26 + return et;
  27 + }
  28 +
  29 + public void setEt(Long et) {
  30 + this.et = et;
  31 + }
  32 +
  33 + public String getAbnormalType() {
  34 + return abnormalType;
  35 + }
  36 +
  37 + public void setAbnormalType(String abnormalType) {
  38 + this.abnormalType = abnormalType;
  39 + }
  40 +
  41 + public Long getSt() {
  42 + return st;
  43 + }
  44 +
  45 + public void setSt(Long st) {
  46 + this.st = st;
  47 + }
  48 +
  49 + public String getNearPoint() {
  50 + return nearPoint;
  51 + }
  52 +
  53 + public void setNearPoint(String nearPoint) {
  54 + this.nearPoint = nearPoint;
  55 + }
  56 +
  57 + public Long getCt() {
  58 + return ct;
  59 + }
  60 +
  61 + public void setCt(Long ct) {
  62 + this.ct = ct;
  63 + }
  64 +
  65 + public int getOutOrIn() {
  66 + return outOrIn;
  67 + }
  68 +
  69 + public void setOutOrIn(int outOrIn) {
  70 + this.outOrIn = outOrIn;
  71 + }
  72 +
  73 + public String getDestCode() {
  74 + return destCode;
  75 + }
  76 +
  77 + public void setDestCode(String destCode) {
  78 + this.destCode = destCode;
  79 + }
  80 +}
... ...
src/main/java/com/bsth/data/gpsdata/arrival/entity/SignalState.java 0 → 100644
  1 +package com.bsth.data.gpsdata.arrival.entity;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  5 +import org.joda.time.format.DateTimeFormat;
  6 +import org.joda.time.format.DateTimeFormatter;
  7 +
  8 +/**
  9 + * 信号状态
  10 + * Created by panzhao on 2016/12/30.
  11 + */
  12 +public class SignalState {
  13 +
  14 + private String type;
  15 +
  16 + private Long st;
  17 +
  18 + //private Long checkTime;
  19 +
  20 + private Long schId;
  21 +
  22 + private String lineCode;
  23 +
  24 + private String text;
  25 +
  26 + private RouteReverse reverse;
  27 +
  28 + private SignalAbnormal signalAbnormal;
  29 +
  30 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  31 +
  32 + /**
  33 + * 记录区间调头
  34 + *
  35 + * @param sch
  36 + * @param reverse
  37 + * @return
  38 + */
  39 + public static SignalState reverseSignalSTate(ScheduleRealInfo sch, RouteReverse reverse) {
  40 + /*if(reverse.isVague())
  41 + return null;*/
  42 +
  43 + SignalState state = new SignalState();
  44 + state.setSchId(sch.getId());
  45 + state.setType("route_reverse");
  46 + //state.setCheckTime(System.currentTimeMillis());
  47 +
  48 + String stationName = BasicData.stationCode2NameMap.get(sch.getXlBm() + "_" + sch.getXlDir() + "_" + reverse.getTurned());
  49 + state.setText(fmtHHmm.print(reverse.getZt()) + " 从 " + stationName + " 站掉头");
  50 + state.setSt(sch.getFcsjActualTime());
  51 + state.setLineCode(sch.getXlBm());
  52 + state.setReverse(reverse);
  53 + return state;
  54 + }
  55 +
  56 + public static SignalState abnormalSignalSTate(ScheduleRealInfo sch, SignalAbnormal signalAbnormal) {
  57 + SignalState state = new SignalState();
  58 + state.setSchId(sch.getId());
  59 + state.setType("abnormal_signal");
  60 + //state.setCheckTime(signalAbnormal.getCt());
  61 + state.setLineCode(sch.getXlBm());
  62 +
  63 + String text = (fmtHHmm.print(signalAbnormal.getSt()) + " ~ " + fmtHHmm.print(signalAbnormal.getEt()));
  64 + String abnormType = signalAbnormal.getAbnormalType();
  65 + if (abnormType.equals("drift"))
  66 + text += "(GPS无效)";
  67 + else if (abnormType.equals("reconnection"))
  68 + text += "(信号丢失)";
  69 +
  70 + state.setText(text);
  71 + state.setSignalAbnormal(signalAbnormal);
  72 + return state;
  73 + }
  74 +
  75 + public String getType() {
  76 + return type;
  77 + }
  78 +
  79 + public void setType(String type) {
  80 + this.type = type;
  81 + }
  82 +
  83 + public long getSchId() {
  84 + return schId;
  85 + }
  86 +
  87 + public void setSchId(long schId) {
  88 + this.schId = schId;
  89 + }
  90 +
  91 + public String getLineCode() {
  92 + return lineCode;
  93 + }
  94 +
  95 + public void setLineCode(String lineCode) {
  96 + this.lineCode = lineCode;
  97 + }
  98 +
  99 + public Long getSt() {
  100 + return st;
  101 + }
  102 +
  103 + public void setSt(Long st) {
  104 + this.st = st;
  105 + }
  106 +
  107 + public String getText() {
  108 + return text;
  109 + }
  110 +
  111 + public void setText(String text) {
  112 + this.text = text;
  113 + }
  114 +
  115 + public RouteReverse getReverse() {
  116 + return reverse;
  117 + }
  118 +
  119 + public void setReverse(RouteReverse reverse) {
  120 + this.reverse = reverse;
  121 + }
  122 +
  123 + public SignalAbnormal getSignalAbnormal() {
  124 + return signalAbnormal;
  125 + }
  126 +
  127 + public void setSignalAbnormal(SignalAbnormal signalAbnormal) {
  128 + this.signalAbnormal = signalAbnormal;
  129 + }
  130 +}
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
... ... @@ -2,23 +2,21 @@ package com.bsth.data.gpsdata.arrival.handlers;
2 2  
3 3 import com.bsth.data.LineConfigData;
4 4 import com.bsth.data.gpsdata.GpsEntity;
5   -import com.bsth.data.gpsdata.arrival.GeoCacheData;
6 5 import com.bsth.data.gpsdata.arrival.SignalHandle;
7   -import com.bsth.data.gpsdata.arrival.entity.StationRoute;
8 6 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
9   -import com.bsth.data.gpsdata.arrival.utils.GeoUtils;
  7 +import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState;
  8 +import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher;
10 9 import com.bsth.data.schedule.DayOfSchedule;
11 10 import com.bsth.entity.realcontrol.LineConfig;
12 11 import com.bsth.entity.realcontrol.ScheduleRealInfo;
13 12 import com.bsth.service.directive.DirectiveService;
14 13 import com.bsth.websocket.handler.SendUtils;
  14 +import org.apache.commons.lang3.StringUtils;
15 15 import org.slf4j.Logger;
16 16 import org.slf4j.LoggerFactory;
17 17 import org.springframework.beans.factory.annotation.Autowired;
18 18 import org.springframework.stereotype.Component;
19 19  
20   -import java.util.List;
21   -
22 20 /**
23 21 * 进出站动作处理
24 22 * Created by panzhao on 2016/12/27.
... ... @@ -40,8 +38,25 @@ public class InOutStationSignalHandle extends SignalHandle{
40 38 @Autowired
41 39 DirectiveService directiveService;
42 40  
  41 + @Autowired
  42 + ScheduleSignalState scheduleSignalState;
  43 +
  44 + @Autowired
  45 + SignalSchPlanMatcher signalSchPlanMatcher;
  46 +
  47 + private final static int MAX_BEFORE_TIME = 1000 * 60 * 72;
  48 +
43 49 @Override
44 50 public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) {
  51 + //忽略漂移信号
  52 + if(isDriftSignal(gps))
  53 + return false;
  54 +
  55 + //从异常状态恢复的第一个信号
  56 + if(abnormalRecovery(gps, prevs)){
  57 + //回溯一下之前的轨迹
  58 + scheduleSignalState.signalRetrospect(gps);
  59 + }
45 60  
46 61 if(isNotEmpty(prevs)){
47 62 GpsEntity prev = prevs.getTail();
... ... @@ -91,13 +106,23 @@ public class InOutStationSignalHandle extends SignalHandle{
91 106 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
92 107 String qdzCode = sch.getQdzCode();
93 108  
94   -
95   - //if(sch.getFcsjActual() != )
  109 + //首班出场最多提前1.2小时
  110 + if(dayOfSchedule.isFirstOut(sch) && sch.getDfsjT() - gps.getTimestamp() > MAX_BEFORE_TIME)
  111 + return;
96 112  
97 113 //起点发车
98 114 if(qdzCode != null && prev.getStopNo().equals(qdzCode)
99 115 && !willDepart(gps, prev, sch)){
100 116  
  117 + //发车班次匹配
  118 + signalSchPlanMatcher.outMatch(gps, sch);
  119 + sch = dayOfSchedule.executeCurr(gps.getNbbm());
  120 +
  121 + //实发时间不覆盖
  122 + if(StringUtils.isNotEmpty(sch.getFcsjActual()))
  123 + return;
  124 +
  125 + //实发时间
101 126 sch.setFcsjActualAll(gps.getTimestamp());
102 127 //通知客户端
103 128 sendUtils.sendFcsj(sch);
... ... @@ -108,16 +133,28 @@ public class InOutStationSignalHandle extends SignalHandle{
108 133 outStationAndOutPark(sch);
109 134 logger.info("班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
110 135 }
  136 + else if(sch.getBcType().equals("out")){
  137 + ScheduleRealInfo next = dayOfSchedule.nextSame(sch);
  138 + if(prev.getStopNo().equals(next.getQdzCode())){
  139 + //发下一个班次
  140 + dayOfSchedule.addExecPlan(next);
  141 + outStation(gps, prev);
  142 + }
  143 + }
111 144 }
112 145  
  146 +
113 147 private void outStationAndOutPark(ScheduleRealInfo sch){
114 148 LineConfig config = lineConfigData.get(sch.getXlBm());
115 149 if (config != null && config.getOutConfig() == 2) {
116 150 //出站既出场
117 151 ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
118 152 if (schPrev != null && schPrev.getBcType().equals("out")) {
119   - schPrev.setFcsjActualAll(sch.getFcsjActual());
120   - schPrev.setZdsjActualAll(sch.getFcsjActual());
  153 + schPrev.setFcsjActualAll(sch.getFcsjActualTime());
  154 + schPrev.setZdsjActualAll(sch.getFcsjActualTime());
  155 +
  156 + sendUtils.refreshSch(schPrev);
  157 + dayOfSchedule.save(schPrev);
121 158 }
122 159 }
123 160 }
... ... @@ -129,9 +166,12 @@ public class InOutStationSignalHandle extends SignalHandle{
129 166 */
130 167 private void inStation(GpsEntity gps, GpsEntity prev){
131 168 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
132   - String zdzCode = sch.getZdzCode();
133 169  
134   - if(zdzCode != null && gps.getStopNo().equals(zdzCode)){
  170 + if(gps.getStopNo().equals(sch.getZdzCode())){
  171 +
  172 + //实达时间不覆盖
  173 + if(StringUtils.isNotEmpty(sch.getZdsjActual()))
  174 + return;
135 175  
136 176 sch.setZdsjActualAll(gps.getTimestamp());
137 177 //已完成班次数
... ... @@ -142,33 +182,22 @@ public class InOutStationSignalHandle extends SignalHandle{
142 182 //持久化
143 183 dayOfSchedule.save(sch);
144 184 //下发调度指令
145   - //directiveService.send60Dispatch(next, doneSum, "到站@系统");
  185 + directiveService.send60Dispatch(next, doneSum, "到站@系统");
146 186  
147 187 //准备执行下一个班次
148 188 if (next != null) {
149 189 next.setQdzArrDatesj(sch.getZdsjActual());
150 190 dayOfSchedule.addExecPlan(next);
151   -
152 191 //进站既进场
153 192 inStationAndInPark(sch, next);
154   -
155 193 //将gps转换为下一个班次走向的站内信号
156   - int updown = Integer.parseInt(next.getXlDir());
157   - List<StationRoute> srs = GeoCacheData.getStationRoute(next.getXlBm(), updown);
158   - StationRoute station = GeoUtils.gpsInStation(gps, srs);
159   - if (station != null) {
160   - gps.setUpDown(updown);
161   - gps.setStopNo(station.getCode());
162   - }
  194 + transformUpdown(gps, sch);
163 195 }
164 196 }
165   - /* //如果出场班次计划终点时间5分钟后还未完成,检查一下车辆轨迹,是否已经在执行线路上班次
166   - else if(sch.getBcType().equals("out")
167   - && sch.getZdsj() != null
168   - && gps.getTimestamp() - sch.getZdsjT() >= 1000 * 60 * 5){
169   - logger.info("出场班次计划终点时间5分钟后还未完成");
170   -
171   - }*/
  197 + else if(sch.getFcsjActual() == null){
  198 + //有进站,但班次没有实发,向前追溯一下信号
  199 + scheduleSignalState.signalRetrospect(gps, sch);
  200 + }
172 201 }
173 202  
174 203 /**
... ... @@ -179,8 +208,11 @@ public class InOutStationSignalHandle extends SignalHandle{
179 208 LineConfig config = lineConfigData.get(sch.getXlBm());
180 209 if (next.getBcType().equals("in") &&
181 210 config != null && config.getOutConfig() == 2) {
182   - next.setFcsjActualAll(sch.getZdsjActual());
183   - next.setZdsjActualAll(sch.getZdsjActual());
  211 + next.setFcsjActualAll(sch.getZdsjActualTime());
  212 + next.setZdsjActualAll(sch.getZdsjActualTime());
  213 +
  214 + sendUtils.refreshSch(next);
  215 + dayOfSchedule.save(next);
184 216 }
185 217 }
186 218  
... ... @@ -193,7 +225,7 @@ public class InOutStationSignalHandle extends SignalHandle{
193 225 */
194 226 private boolean willDepart(GpsEntity gps, GpsEntity prev, Object task){
195 227  
196   -/* ScheduleRealInfo sch = (ScheduleRealInfo) task;
  228 + /*ScheduleRealInfo sch = (ScheduleRealInfo) task;
197 229 ScheduleRealInfo prevTask = dayOfSchedule.prev(sch);
198 230 if(prevTask == null || prevTask.getBcType().equals("out"))
199 231 return false;
... ... @@ -216,4 +248,4 @@ public class InOutStationSignalHandle extends SignalHandle{
216 248 }*/
217 249 return false;
218 250 }
219   -}
  251 +}
220 252 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/OfflineSignalHandle.java
... ... @@ -13,16 +13,17 @@ import org.springframework.stereotype.Component;
13 13 @Component
14 14 public class OfflineSignalHandle extends SignalHandle{
15 15  
16   - //断开3分钟,标记为重连信号
17   - private final static int OFFLINE_TIME = 1000 * 60 * 3;
  16 + //断开2分钟,标记为重连信号
  17 + private final static int OFFLINE_TIME = 1000 * 60 * 2;
18 18  
19 19 //断开70分钟,之前的信号不再有参考价值
20 20 private final static int CLEAR_TIME = 1000 * 60 * 70;
21 21  
22 22 @Override
23 23 public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) {
24   - //异常信号不管
25   - if(isAbnormal(gps)){
  24 + //漂移信号不管
  25 + if(isDriftSignal(gps)){
  26 + gps.setSignalState("drift");
26 27 return true;
27 28 }
28 29  
... ... @@ -39,4 +40,4 @@ public class OfflineSignalHandle extends SignalHandle{
39 40 }
40 41 return true;
41 42 }
42   -}
  43 +}
43 44 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/ReverseSignalHandle.java
1 1 package com.bsth.data.gpsdata.arrival.handlers;
2 2  
3   -import com.alibaba.fastjson.JSON;
4 3 import com.bsth.data.gpsdata.GpsEntity;
5 4 import com.bsth.data.gpsdata.arrival.GeoCacheData;
6 5 import com.bsth.data.gpsdata.arrival.SignalHandle;
7 6 import com.bsth.data.gpsdata.arrival.entity.RouteReverse;
8 7 import com.bsth.data.gpsdata.arrival.entity.StationRoute;
9 8 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
  9 +import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState;
10 10 import com.bsth.data.schedule.DayOfSchedule;
11   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
12 11 import org.slf4j.Logger;
13 12 import org.slf4j.LoggerFactory;
14 13 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -26,6 +25,9 @@ public class ReverseSignalHandle extends SignalHandle {
26 25 @Autowired
27 26 DayOfSchedule dayOfSchedule;
28 27  
  28 + @Autowired
  29 + ScheduleSignalState scheduleSignalState;
  30 +
29 31 @Override
30 32 public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) {
31 33 if (!isNotEmpty(prevs))
... ... @@ -36,17 +38,10 @@ public class ReverseSignalHandle extends SignalHandle {
36 38 if (isReverse(gps, prev)) {
37 39 RouteReverse reverse = reverseSearch(prevs, gps);
38 40  
39   - if (reverse.getCount() >= 2) {
40   - //切换到下一个班次
41   - ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
42   - if (sch.getBcType().equals("out") && sch.getZdsjT() != null && sch.getZdsjT() > gps.getTimestamp()) {
43   - return false;
44   - }
45   - dayOfSchedule.addExecPlan(dayOfSchedule.next(sch));
46   -
47   - if (reverse.isClose()) {
48   - logger.info("区间掉头,车辆:" + gps.getNbbm() + " -" + JSON.toJSONString(reverse));
49   - }
  41 + if (reverse.getCount() >= 3
  42 + && reverse.isClose()
  43 + && !GeoCacheData.isEndStation(gps.getLineId(), gps.getUpDown(), reverse.getTurned())) {
  44 + scheduleSignalState.reverseAnalyse(reverse);
50 45 }
51 46 }
52 47 return false;
... ... @@ -63,7 +58,8 @@ public class ReverseSignalHandle extends SignalHandle {
63 58 RouteReverse routeReverse = new RouteReverse();
64 59 int count = 0;
65 60 String path = "";
66   - String turned = null;
  61 + long zt = 0L;
  62 + boolean half = false;
67 63  
68 64 //当前站点
69 65 StationRoute curr = GeoCacheData.getRouteCode(gps), sr;
... ... @@ -72,22 +68,29 @@ public class ReverseSignalHandle extends SignalHandle {
72 68 for (int i = array.length - 1; i > 0; i--) {
73 69 prev = (GpsEntity) array[i];
74 70  
75   - if(!prev.getUpDown().equals(gps.getUpDown()))
  71 + if (!prev.getUpDown().equals(gps.getUpDown())
  72 + || prev.getSignalState().equals("reconnection"))
76 73 break;
77 74  
78 75 if (prev.getInstation() == 1) {
79 76 sr = GeoCacheData.getRouteCode(prev);
80 77  
81 78 if (sr.getRouteSort() > curr.getRouteSort()) {
  79 + if(half){
  80 + routeReverse.setVague(true);
  81 + }
  82 +
82 83 path += (curr.getCode() + ",");
83 84 count++;
  85 + zt = prev.getTimestamp();
84 86 } else if (sr.getRouteSort() < curr.getRouteSort()) {
85   - path += (curr.getCode() + ",");
86   - //掉头点
87   - if (turned == null)
88   - turned = prev.getStopNo();
  87 + if (routeReverse.getTurned() == null) {
  88 + routeReverse.setTurned(curr.getCode());
  89 + half = true;
  90 + }
89 91  
90   - //路径闭合
  92 + path += (curr.getCode() + ",");
  93 + //掉头前当前站
91 94 if (sr.getCode().equals(gps.getStopNo())) {
92 95 routeReverse.setClose(true);
93 96 path += sr.getCode();
... ... @@ -99,9 +102,11 @@ public class ReverseSignalHandle extends SignalHandle {
99 102 }
100 103 }
101 104  
  105 + routeReverse.setZt(zt);
102 106 routeReverse.setCount(count);
103 107 routeReverse.setDetail(path);
104   - routeReverse.setTurned(turned);
  108 + routeReverse.setCt(gps.getTimestamp());
  109 + routeReverse.setNbbm(gps.getNbbm());
105 110 return routeReverse;
106 111 }
107 112  
... ... @@ -129,4 +134,4 @@ public class ReverseSignalHandle extends SignalHandle {
129 134 }
130 135 return false;
131 136 }
132   -}
  137 +}
133 138 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/arrival/utils/CircleQueue.java
... ... @@ -105,8 +105,8 @@ public class CircleQueue&lt;T&gt; {
105 105 }
106 106 }
107 107 } else {
108   - elementDataSort = new Object[tail];
109   - for (int i = 0; i < tail; i++) {
  108 + elementDataSort = new Object[tail + 1];
  109 + for (int i = 0; i <= tail; i++) {
110 110 elementDataSort[i] = elementDataCopy[i];
111 111 }
112 112 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/utils/ScheduleSignalState.java 0 → 100644
  1 +package com.bsth.data.gpsdata.arrival.utils;
  2 +
  3 +import com.bsth.data.LineConfigData;
  4 +import com.bsth.data.gpsdata.GpsEntity;
  5 +import com.bsth.data.gpsdata.SignalStateData;
  6 +import com.bsth.data.gpsdata.arrival.GeoCacheData;
  7 +import com.bsth.data.gpsdata.arrival.entity.RouteReverse;
  8 +import com.bsth.data.gpsdata.arrival.entity.SignalAbnormal;
  9 +import com.bsth.data.gpsdata.arrival.entity.SignalState;
  10 +import com.bsth.data.schedule.DayOfSchedule;
  11 +import com.bsth.entity.realcontrol.LineConfig;
  12 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  13 +import org.slf4j.Logger;
  14 +import org.slf4j.LoggerFactory;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.stereotype.Component;
  17 +
  18 +/**
  19 + * 班次信号状态分析
  20 + * Created by panzhao on 2016/12/29.
  21 + */
  22 +@Component
  23 +public class ScheduleSignalState {
  24 +
  25 + @Autowired
  26 + DayOfSchedule dayOfSchedule;
  27 +
  28 + Logger logger = LoggerFactory.getLogger(this.getClass());
  29 +
  30 + @Autowired
  31 + LineConfigData lineConfigData;
  32 +
  33 + @Autowired
  34 + SignalStateData signalStateData;
  35 +
  36 + /**
  37 + * 路由反向分析
  38 + */
  39 + public void reverseAnalyse(RouteReverse reverse) {
  40 + ScheduleRealInfo sch = dayOfSchedule.executeCurr(reverse.getNbbm());
  41 +
  42 + String bcType = sch.getBcType();
  43 +
  44 + switch (bcType) {
  45 + case "out":
  46 + outReverseAnalyse(sch, reverse);
  47 + break;
  48 + case "normal":
  49 + normalReverseAnalyse(sch, reverse);
  50 + break;
  51 + }
  52 + }
  53 +
  54 + /**
  55 + * 出场班次路由反向分析
  56 + *
  57 + * @param sch
  58 + */
  59 + private void outReverseAnalyse(ScheduleRealInfo sch, RouteReverse reverse) {
  60 + long t = reverse.getCt();
  61 + //出场班次终点时间前,允许反向轨迹
  62 + if (sch.getZdsjT() != null && sch.getZdsjT() > t) {
  63 + return;
  64 + }
  65 +
  66 + int rt;
  67 + //从实发 到 当前时间 < 计划运送时间 * 0.9
  68 + if (sch.getFcsjActual() != null && sch.getBcsj() != null) {
  69 + rt = (int) (t - sch.getFcsjActualTime());
  70 + if (rt < sch.getBcsj() * 0.9)
  71 + return;
  72 + }
  73 +
  74 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  75 + if (next.getXlDir().equals(sch.getXlDir()))
  76 + return;
  77 +
  78 + //时间足够下一个班次待发时间运行到当前站
  79 + int runTime = reverse.getCount() * 1500 * 60;
  80 + if (next.getDfsjT() + runTime < t) {
  81 + //跳到下一个班次
  82 + dayOfSchedule.addExecPlan(next);
  83 + }
  84 + }
  85 +
  86 + /**
  87 + * 正常班次路由反向分析
  88 + *
  89 + * @param sch
  90 + * @param reverse
  91 + */
  92 + private void normalReverseAnalyse(ScheduleRealInfo sch, RouteReverse reverse) {
  93 + LineConfig conf = lineConfigData.get(sch.getXlBm());
  94 +
  95 + if (conf.isReadReverse()) {
  96 + //跳下一个班次
  97 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  98 + if (next != null)
  99 + dayOfSchedule.addExecPlan(next);
  100 +
  101 + //记录信号状态
  102 + SignalState signalState = SignalState.reverseSignalSTate(sch, reverse);
  103 + if(signalState != null)
  104 + signalStateData.put(signalState);
  105 + }
  106 + }
  107 +
  108 + public void signalRetrospect(GpsEntity gps) {
  109 + signalRetrospect(gps, dayOfSchedule.executeCurr(gps.getNbbm()));
  110 + }
  111 +
  112 + /**
  113 + * 信号追溯
  114 + *
  115 + * @param gps
  116 + * @param sch
  117 + */
  118 + public void signalRetrospect(GpsEntity gps, ScheduleRealInfo sch) {
  119 + //回放数据,是否有掉线或者漂移
  120 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  121 + if (queue == null || queue.size() == 0 /*|| gps.getInstation() == 0*/)
  122 + return;
  123 +
  124 + //起始时间点
  125 + long st = 0;
  126 + ScheduleRealInfo prev = dayOfSchedule.prev(sch);
  127 +
  128 + if (prev != null) {
  129 + if (prev.getZdsjActual() != null)
  130 + st = prev.getZdsjActualTime();
  131 + else
  132 + st = (GeoCacheData.midwayStation(gps.getLineId(), gps.getUpDown(), sch.getQdzCode(), gps.getStopNo()).size() + 1) * (1000 * 60 * 5);
  133 + }
  134 +
  135 + Object[] tempArray = queue.getQueue();
  136 + int len = tempArray.length;
  137 +
  138 + Object[] array = new Object[len + 1];
  139 + System.arraycopy(tempArray, 0, array, 0, len);
  140 + array[len] = gps;
  141 +
  142 + String gpsState = "";
  143 + GpsEntity tempGps, nearGps = null;
  144 + int i = len - 1;
  145 + for (; i >= 0; i--) {
  146 + tempGps = (GpsEntity) array[i];
  147 +
  148 + gpsState = tempGps.getSignalState();
  149 + if (gpsState.equals("truncation"))
  150 + break;
  151 + else if (gpsState.equals("drift")) {
  152 + nearGps = (GpsEntity) array[i + 1];
  153 + break;
  154 + } else if (gpsState.equals("reconnection")) {
  155 + nearGps = tempGps;
  156 + break;
  157 + }
  158 +
  159 + if (tempGps.getTimestamp() < st)
  160 + break;
  161 + }
  162 +
  163 + if (nearGps != null && i > 0) {
  164 + createSignalAbnormal(gpsState, nearGps, i, array, sch);
  165 + }
  166 + }
  167 +
  168 + private void createSignalAbnormal(String gpsState, GpsEntity nearGps, int i, Object[] array, ScheduleRealInfo sch) {
  169 + switch (gpsState) {
  170 + case "drift":
  171 + driftSignalAbnormal(nearGps, i, array, sch);
  172 + break;
  173 + case "reconnection":
  174 + offlineSignalAbnormal(nearGps, ((GpsEntity) array[i - 1]), sch);
  175 + break;
  176 + }
  177 + }
  178 +
  179 + /**
  180 + * 掉线异常状态记录
  181 + *
  182 + * @param e
  183 + * @param s
  184 + */
  185 + private void offlineSignalAbnormal(GpsEntity e, GpsEntity s, ScheduleRealInfo sch) {
  186 + long st = s.getTimestamp(), et = e.getTimestamp();
  187 +
  188 + //掉线超过10分钟才记录
  189 + if (et - st < (1000 * 60 * 10))
  190 + return;
  191 +
  192 + SignalAbnormal signalAbnormal = new SignalAbnormal();
  193 + signalAbnormal.setSt(st);
  194 + signalAbnormal.setEt(et);
  195 + signalAbnormal.setAbnormalType("reconnection");
  196 + signalAbnormal.setDestCode(sch.getQdzCode());
  197 + signalAbnormal.setOutOrIn(0);
  198 +
  199 + //截断GPS
  200 + e.setSignalState("truncation");
  201 +
  202 + //记录信号状态
  203 + SignalState signalState = SignalState.abnormalSignalSTate(sch, signalAbnormal);
  204 + signalStateData.put(signalState);
  205 + }
  206 +
  207 + /**
  208 + * 漂移异常状态记录
  209 + *
  210 + * @param nearGps
  211 + * @param i
  212 + * @param array
  213 + */
  214 + private void driftSignalAbnormal(GpsEntity nearGps, int i, Object[] array, ScheduleRealInfo sch) {
  215 + GpsEntity gps, s = null;
  216 + //找到漂移开始时间
  217 + for (; i >= 0; i--) {
  218 + gps = (GpsEntity) array[i];
  219 +
  220 + if (!gps.getSignalState().equals("drift") || i == 0
  221 + || gps.getSignalState().equals("truncation")) {
  222 + s = gps;
  223 + break;
  224 + }
  225 + }
  226 +
  227 + long st = s.getTimestamp(), et = nearGps.getTimestamp();
  228 + if (et - st < (1000 * 60 * 3))
  229 + return;
  230 + /*if (s != null){
  231 + st = s.getTimestamp();
  232 + //漂移小于3分钟
  233 + if(et - st < (1000 * 60 * 3))
  234 + return;
  235 + }*/
  236 +
  237 +
  238 + SignalAbnormal signalAbnormal = new SignalAbnormal();
  239 + signalAbnormal.setSt(st);
  240 + signalAbnormal.setEt(et);
  241 + signalAbnormal.setAbnormalType("drift");
  242 + signalAbnormal.setDestCode(sch.getQdzCode());
  243 + signalAbnormal.setOutOrIn(0);
  244 +
  245 + //截断GPS
  246 + nearGps.setSignalState("truncation");
  247 +
  248 + //记录信号状态
  249 + SignalState signalState = SignalState.abnormalSignalSTate(sch, signalAbnormal);
  250 + signalStateData.put(signalState);
  251 + }
  252 +}
0 253 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/arrival/utils/SignalSchPlanMatcher.java 0 → 100644
  1 +package com.bsth.data.gpsdata.arrival.utils;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.schedule.DayOfSchedule;
  5 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +/**
  10 + * 班次匹配器
  11 + * Created by panzhao on 2016/12/31.
  12 + */
  13 +@Component
  14 +public class SignalSchPlanMatcher {
  15 +
  16 + @Autowired
  17 + DayOfSchedule dayOfSchedule;
  18 +
  19 + /**
  20 + * 发车信号匹配
  21 + * @param outSigal
  22 + * @param sch
  23 + * @return
  24 + */
  25 + public void outMatch(GpsEntity outSigal, ScheduleRealInfo sch){
  26 + long t = outSigal.getTimestamp();
  27 + if(t < sch.getDfsjT())
  28 + return;
  29 +
  30 + //下一个相同走向的班次
  31 + ScheduleRealInfo next = dayOfSchedule.nextSame(sch);
  32 + if(next == null || !next.getQdzCode().equals(sch.getQdzCode()))
  33 + return;
  34 +
  35 + //晚于班次间隔百分之70,跳下一个班次
  36 + double s = (int) (next.getDfsjT() - sch.getDfsjT());
  37 + double r = (int) (t - sch.getDfsjT());
  38 + if(r / s > 0.7){
  39 + dayOfSchedule.addExecPlan(next);
  40 + outMatch(outSigal, next);
  41 + }
  42 + }
  43 +}
... ...
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
... ... @@ -28,7 +28,7 @@ import java.util.concurrent.Executors;
28 28 * Created by panzhao on 2016/12/24.
29 29 */
30 30 @Component
31   -public class GpsDataRecovery implements ApplicationContextAware{
  31 +public class GpsDataRecovery implements ApplicationContextAware {
32 32  
33 33 static Logger logger = LoggerFactory.getLogger(GpsDataRecovery.class);
34 34  
... ... @@ -48,7 +48,7 @@ public class GpsDataRecovery implements ApplicationContextAware{
48 48 //按车辆分组数据
49 49 ArrayListMultimap<String, GpsEntity> listMap = ArrayListMultimap.create();
50 50 for (GpsEntity gps : list) {
51   - if(gps.getNbbm() != null)
  51 + if (gps.getNbbm() != null)
52 52 listMap.put(gps.getNbbm(), gps);
53 53 }
54 54  
... ... @@ -60,6 +60,8 @@ public class GpsDataRecovery implements ApplicationContextAware{
60 60 for (String nbbm : keys) {
61 61 Collections.sort(listMap.get(nbbm), comp);
62 62 threadPool.execute(new RecoveryThread(listMap.get(nbbm), count));
  63 + /*if(nbbm.equals("W9H-003"))
  64 + new RecoveryThread(listMap.get(nbbm), count).run();*/
63 65 }
64 66  
65 67 try {
... ... @@ -124,7 +126,7 @@ public class GpsDataRecovery implements ApplicationContextAware{
124 126 reverseSignalHandle = applicationContext.getBean(ReverseSignalHandle.class);
125 127 }
126 128  
127   - public static class GpsComp implements Comparator<GpsEntity>{
  129 + public static class GpsComp implements Comparator<GpsEntity> {
128 130  
129 131 @Override
130 132 public int compare(GpsEntity g1, GpsEntity g2) {
... ... @@ -132,26 +134,28 @@ public class GpsDataRecovery implements ApplicationContextAware{
132 134 }
133 135 }
134 136  
135   - public static class RecoveryThread implements Runnable{
  137 + public static class RecoveryThread implements Runnable {
136 138 List<GpsEntity> list;
137 139 CountDownLatch count;
138 140  
139   - RecoveryThread(List<GpsEntity> list, CountDownLatch count){
  141 + RecoveryThread(List<GpsEntity> list, CountDownLatch count) {
140 142 this.list = list;
141 143 this.count = count;
142 144 }
  145 +
143 146 @Override
144 147 public void run() {
145 148 try {
146 149 //循环gps恢复数据
147 150 CircleQueue<GpsEntity> prevs;
148 151  
149   - for(GpsEntity gps : list){
  152 + for (GpsEntity gps : list) {
  153 +
150 154 prevs = GeoCacheData.getGps(gps.getNbbm());
151 155 //掉线处理
152 156 offlineSignalHandle.handle(gps, prevs);
153 157 //状态处理
154   - if(!correctSignalHandle.handle(gps, prevs))
  158 + if (!correctSignalHandle.handle(gps, prevs))
155 159 continue;
156 160 //场,站内外判断
157 161 stationInsideHandle.handle(gps, prevs);
... ... @@ -160,11 +164,12 @@ public class GpsDataRecovery implements ApplicationContextAware{
160 164 //进出站动作处理
161 165 inOutStationSignalHandle.handle(gps, prevs);
162 166 GeoCacheData.putGps(gps);
  167 +
  168 + //Thread.sleep(50);
163 169 }
164   - }catch (Exception e){
  170 + } catch (Exception e) {
165 171 logger.error("", e);
166   - }
167   - finally {
  172 + } finally {
168 173 count.countDown();
169 174 }
170 175 }
... ...
src/main/java/com/bsth/data/pilot80/PilotReport.java
... ... @@ -84,6 +84,8 @@ public class PilotReport {
84 84  
85 85 //下发调度指令
86 86 directiveService.send60Dispatch(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统");
  87 + //下发线路切换指令
  88 + directiveService.lineChange(outSch.getClZbh(), outSch.getXlBm(), "请出@系统");
87 89 /* d80.setRemarks("计划出场时间:" + outSch.getDfsj());
88 90 //当前GPS位置
89 91 GpsEntity gps = gpsRealData.get(d80.getDeviceId());
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -29,6 +29,7 @@ import org.slf4j.Logger;
29 29 import org.slf4j.LoggerFactory;
30 30 import org.springframework.beans.factory.annotation.Autowired;
31 31 import org.springframework.boot.CommandLineRunner;
  32 +import org.springframework.core.annotation.Order;
32 33 import org.springframework.stereotype.Component;
33 34  
34 35 import java.text.ParseException;
... ... @@ -43,6 +44,7 @@ import java.util.concurrent.TimeUnit;
43 44 * @date 2016年8月15日 上午10:16:12
44 45 */
45 46 @Component
  47 +@Order(value = 3)
46 48 public class DayOfSchedule implements CommandLineRunner {
47 49  
48 50 Logger logger = LoggerFactory.getLogger(this.getClass());
... ... @@ -83,6 +85,9 @@ public class DayOfSchedule implements CommandLineRunner {
83 85 @Autowired
84 86 GpsRealData gpsRealData;
85 87  
  88 + @Autowired
  89 + BasicData.BasicDataLoader basicDataLoader;
  90 +
86 91 /**
87 92 * 线路当前使用的排班的日期
88 93 */
... ... @@ -117,28 +122,24 @@ public class DayOfSchedule implements CommandLineRunner {
117 122 LineConfigData lineConfigs;
118 123  
119 124 @Autowired
120   - BasicData.BasicDataLoader dataLoader;
121   -
122   - @Autowired
123 125 GpsDataRecovery gpsDataRecovery;
124 126  
125 127 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), fmtHHmm = DateTimeFormat.forPattern("HH:mm");
126 128  
127 129 @Override
128 130 public void run(String... arg0) throws Exception {
129   - //加载基础数据
130   - dataLoader.loadAllData();
  131 + basicDataLoader.loadAllData();
131 132 //从数据库恢复排班
132   - dataRecovery();
  133 + //dataRecovery();
133 134  
134 135 //翻班线程
135   -// Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
  136 + Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
136 137 //入库
137 138 // Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
138 139 //首班出场指令补发器
139 140 // Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS);
140 141 //班次误点扫描
141   - Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
  142 +// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
142 143  
143 144 //每天凌晨2点20提交数据到运管处
144 145 long diff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis();
... ... @@ -224,15 +225,8 @@ public class DayOfSchedule implements CommandLineRunner {
224 225 reCalcExecPlan(nbbm);
225 226 }
226 227  
227   - //是否是出站即出场
228   - LineConfig conf = lineConfigData.get(lineCode);
229   - if (conf.getOutConfig() == 2) {
230   - for (String nbbm : cars)
231   - schAttrCalculator.connectOutSchedule(nbbmScheduleMap.get(nbbm));
232   - }
233   -
234 228 // 页面 翻班通知
235   - sendUtils.shiftSchedule(lineCode);
  229 + //sendUtils.shiftSchedule(lineCode);
236 230 } catch (Exception e) {
237 231 logger.error("", e);
238 232 return -1;
... ... @@ -503,6 +497,41 @@ public class DayOfSchedule implements CommandLineRunner {
503 497 }
504 498  
505 499 /**
  500 + * 下一个相同走向的班次
  501 + * @param sch
  502 + * @return
  503 + */
  504 + public ScheduleRealInfo nextSame(ScheduleRealInfo sch){
  505 + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
  506 + int outConfig = -1;
  507 + LineConfig config = lineConfigData.get(sch.getXlBm());
  508 + if (config != null)
  509 + outConfig = config.getOutConfig();
  510 +
  511 + boolean flag = false;
  512 + ScheduleRealInfo next = null;
  513 + for (ScheduleRealInfo temp : list) {
  514 + if (temp.getId() == sch.getId()) {
  515 + flag = true;
  516 + continue;
  517 + }
  518 + //忽略烂班
  519 + if (temp.isDestroy())
  520 + continue;
  521 +
  522 + //出站既出场,忽略出场班次
  523 + if (outConfig == 2 && temp.getBcType().equals("out"))
  524 + continue;
  525 +
  526 + if (flag && temp.getXlDir().equals(sch.getXlDir())) {
  527 + next = temp;
  528 + break;
  529 + }
  530 + }
  531 + return next;
  532 + }
  533 +
  534 + /**
506 535 * 上一个班次
507 536 *
508 537 * @param sch
... ... @@ -527,6 +556,18 @@ public class DayOfSchedule implements CommandLineRunner {
527 556 return prev;
528 557 }
529 558  
  559 + /**
  560 + * 是否是首班出场
  561 + * @param sch
  562 + * @return
  563 + */
  564 + public boolean isFirstOut(ScheduleRealInfo sch){
  565 + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
  566 + if(list.get(0) == sch && sch.getBcType().equals("out"))
  567 + return true;
  568 + return false;
  569 + }
  570 +
530 571 public void put(ScheduleRealInfo sch) {
531 572 schAttrCalculator
532 573 .calcRealDate(sch)
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -62,13 +62,13 @@ public class SchAttrCalculator {
62 62 sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getDfsj()));
63 63  
64 64 //實發時間
65   - if(sch.getFcsjActual() != null &&
  65 + if(StringUtils.isNotEmpty(sch.getFcsjActual()) &&
66 66 sch.getFcsjActual().compareTo(conf.getStartOpt()) < 0){
67 67 sch.setFcsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getFcsjActual()) + DAY_TIME);
68 68 }
69 69  
70 70 //實際終點時間
71   - if(sch.getZdsjActual() != null &&
  71 + if(StringUtils.isNotEmpty(sch.getZdsjActual()) &&
72 72 sch.getZdsjActual().compareTo(conf.getStartOpt()) < 0){
73 73 sch.setZdsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getZdsjActual()) + DAY_TIME);
74 74 }
... ... @@ -162,34 +162,6 @@ public class SchAttrCalculator {
162 162  
163 163 return updateList;
164 164 }
165   -
166   - /**
167   - *
168   - * @Title: connectOutSchedule
169   - * @Description: TODO(关联出场班次)
170   - */
171   - public void connectOutSchedule(List<ScheduleRealInfo> list){
172   - Collections.sort(list, new ScheduleComparator.FCSJ());
173   -
174   - int len = list.size();
175   - if(len == 0)
176   - return;
177   -
178   - ScheduleRealInfo prve = list.get(0), curr;
179   - for(int i = 1; i < len; i ++){
180   - curr = list.get(i);
181   -
182   - //出站即出场关联
183   - if(prve.getBcType().equals("out") && prve.getJhlc() == null)
184   - curr.setTwinsSch(prve);
185   -
186   - //进站即进场关联
187   - if(curr.getBcType().equals("in") && curr.getJhlc() == null)
188   - prve.setTwinsSch(curr);
189   -
190   - prve = curr;
191   - }
192   - }
193 165  
194 166 public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException {
195 167 sch.setFcsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsj()));
... ...
src/main/java/com/bsth/entity/CarPark.java
1 1 package com.bsth.entity;
2 2  
3   -import java.util.Date;
  3 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 4  
5   -import javax.persistence.Column;
6   -import javax.persistence.Entity;
7   -import javax.persistence.GeneratedValue;
8   -import javax.persistence.Id;
9   -import javax.persistence.Table;
  5 +import javax.persistence.*;
  6 +import java.util.Date;
10 7  
11 8  
12 9 /**
... ... @@ -25,6 +22,7 @@ import javax.persistence.Table;
25 22  
26 23 @Entity
27 24 @Table(name = "bsth_c_car_park")
  25 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
28 26 public class CarPark {
29 27  
30 28 @Id
... ...
src/main/java/com/bsth/entity/Cars.java
... ... @@ -23,7 +23,7 @@ import java.util.Date;
23 23  
24 24 @Entity
25 25 @Table(name = "bsth_c_cars")
26   -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"})
  26 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
27 27 public class Cars extends BEntity implements Serializable {
28 28  
29 29 /** 主键Id */
... ...
src/main/java/com/bsth/entity/Line.java
... ... @@ -24,7 +24,7 @@ import java.util.Date;
24 24  
25 25 @Entity
26 26 @Table(name = "bsth_c_line")
27   -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"})
  27 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
28 28 public class Line implements Serializable {
29 29  
30 30 @Id
... ...
src/main/java/com/bsth/entity/Personnel.java
... ... @@ -21,7 +21,7 @@ import javax.persistence.*;
21 21  
22 22 @Entity
23 23 @Table(name = "bsth_c_personnel")
24   -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"})
  24 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
25 25 public class Personnel extends BEntity {
26 26  
27 27 /** 主键Id */
... ...
src/main/java/com/bsth/entity/Station.java
1 1 package com.bsth.entity;
2 2  
3   -import java.util.Date;
  3 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 4  
5 5 import javax.persistence.Column;
6 6 import javax.persistence.Entity;
7   -import javax.persistence.GeneratedValue;
8   -import javax.persistence.GenerationType;
9 7 import javax.persistence.Id;
10 8 import javax.persistence.Table;
  9 +import java.util.Date;
11 10  
12 11  
13 12 /**
... ... @@ -26,6 +25,7 @@ import javax.persistence.Table;
26 25  
27 26 @Entity
28 27 @Table(name = "bsth_c_station")
  28 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
29 29 public class Station {
30 30  
31 31 @Id
... ...
src/main/java/com/bsth/entity/mcy_forms/Daily.java 0 → 100644
  1 +package com.bsth.entity.mcy_forms;
  2 +
  3 +public class Daily {
  4 +
  5 + private String rq;//日期
  6 +
  7 + public String getRq() {
  8 + return rq;
  9 + }
  10 +
  11 + public void setRq(String rq) {
  12 + this.rq = rq;
  13 + }
  14 +
  15 + private String zbh;//车牌号
  16 +
  17 + private String jgh;//员工号
  18 +
  19 + private String jName;//驾驶员
  20 +
  21 + private String zlc;//里程
  22 +
  23 + private String jzl1;//空驶公里
  24 +
  25 + private String yh;//油耗
  26 +
  27 + private String bc;//班次
  28 +
  29 + public String getZbh() {
  30 + return zbh;
  31 + }
  32 +
  33 + public void setZbh(String zbh) {
  34 + this.zbh = zbh;
  35 + }
  36 +
  37 + public String getJgh() {
  38 + return jgh;
  39 + }
  40 +
  41 + public void setJgh(String jgh) {
  42 + this.jgh = jgh;
  43 + }
  44 +
  45 + public String getjName() {
  46 + return jName;
  47 + }
  48 +
  49 + public void setjName(String jName) {
  50 + this.jName = jName;
  51 + }
  52 +
  53 + public String getZlc() {
  54 + return zlc;
  55 + }
  56 +
  57 + public void setZlc(String zlc) {
  58 + this.zlc = zlc;
  59 + }
  60 +
  61 + public String getJzl1() {
  62 + return jzl1;
  63 + }
  64 +
  65 + public void setJzl1(String jzl1) {
  66 + this.jzl1 = jzl1;
  67 + }
  68 +
  69 + public String getYh() {
  70 + return yh;
  71 + }
  72 +
  73 + public void setYh(String yh) {
  74 + this.yh = yh;
  75 + }
  76 +
  77 + public String getBc() {
  78 + return bc;
  79 + }
  80 +
  81 + public void setBc(String bc) {
  82 + this.bc = bc;
  83 + }
  84 +
  85 +
  86 +
  87 +
  88 +
  89 +}
... ...
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
... ... @@ -53,6 +53,9 @@ public class LineConfig {
53 53 /** 调度指令模板 */
54 54 private String schDirectiveTemp;
55 55  
  56 + /** 识别区间调头 */
  57 + private boolean readReverse;
  58 +
56 59 @OneToMany(cascade = CascadeType.ALL)
57 60 private Set<D80ReplyTemp> d80Temps = new HashSet<>();
58 61  
... ... @@ -140,4 +143,12 @@ public class LineConfig {
140 143 public void setD80Temps(Set<D80ReplyTemp> d80Temps) {
141 144 this.d80Temps = d80Temps;
142 145 }
  146 +
  147 + public boolean isReadReverse() {
  148 + return readReverse;
  149 + }
  150 +
  151 + public void setReadReverse(boolean readReverse) {
  152 + this.readReverse = readReverse;
  153 + }
143 154 }
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -94,11 +94,6 @@ public class ScheduleRealInfo {
94 94 * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
95 95 */
96 96 private String bcType;
97   -
98   - /** 出站即出场 , 关联的进出场班次 */
99   - @JsonIgnore
100   - @Transient
101   - private ScheduleRealInfo twinsSch;
102 97  
103 98 /** 创建人 */
104 99 @JsonIgnore
... ... @@ -258,21 +253,6 @@ public class ScheduleRealInfo {
258 253 this.ccno = ccno;
259 254 }
260 255  
261   - public static DateTimeFormatter getFmtHHmm() {
262   - return fmtHHmm;
263   - }
264   -
265   - public static void setFmtHHmm(DateTimeFormatter fmtHHmm) {
266   - ScheduleRealInfo.fmtHHmm = fmtHHmm;
267   - }
268   -
269   - public static DateTimeFormatter getFmtyyyyMMddHHmm() {
270   - return fmtyyyyMMddHHmm;
271   - }
272   -
273   - public static void setFmtyyyyMMddHHmm(DateTimeFormatter fmtyyyyMMddHHmm) {
274   - ScheduleRealInfo.fmtyyyyMMddHHmm = fmtyyyyMMddHHmm;
275   - }
276 256  
277 257 /** ----------------
278 258 @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
... ... @@ -804,13 +784,13 @@ public class ScheduleRealInfo {
804 784 this.opDirectiveState = opDirectiveState;
805 785 }
806 786  
807   - public ScheduleRealInfo getTwinsSch() {
  787 +/* public ScheduleRealInfo getTwinsSch() {
808 788 return twinsSch;
809 789 }
810 790  
811 791 public void setTwinsSch(ScheduleRealInfo twinsSch) {
812 792 this.twinsSch = twinsSch;
813   - }
  793 + }*/
814 794  
815 795 public boolean isLate() {
816 796 return late;
... ...
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
... ... @@ -19,7 +19,7 @@ import java.util.Date;
19 19 @NamedAttributeNode("cl")
20 20 })
21 21 })
22   -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"})
  22 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
23 23 public class CarConfigInfo extends BEntity implements Serializable {
24 24  
25 25 /** 主健Id */
... ...
src/main/java/com/bsth/entity/schedule/EmployeeConfigInfo.java
... ... @@ -22,7 +22,7 @@ import java.io.Serializable;
22 22 @NamedAttributeNode("xl")
23 23 })
24 24 })
25   -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"})
  25 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
26 26 public class EmployeeConfigInfo extends BEntity implements Serializable {
27 27  
28 28 /** 主键Id */
... ...
src/main/java/com/bsth/entity/schedule/GuideboardInfo.java
... ... @@ -15,7 +15,7 @@ import javax.persistence.*;
15 15 @NamedAttributeNode("xl")
16 16 })
17 17 })
18   -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"})
  18 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
19 19 public class GuideboardInfo extends BEntity {
20 20  
21 21 /** 主键Id */
... ...
src/main/java/com/bsth/entity/schedule/TTInfo.java
1 1 package com.bsth.entity.schedule;
2 2  
3 3 import com.bsth.entity.Line;
  4 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 5  
5 6 import javax.persistence.*;
6 7 import java.util.Date;
... ... @@ -17,6 +18,7 @@ import java.util.Date;
17 18 @NamedAttributeNode("updateBy")
18 19 })
19 20 })
  21 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
20 22 public class TTInfo extends BEntity {
21 23  
22 24 /** 主键Id */
... ...
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
... ... @@ -3,6 +3,7 @@ package com.bsth.entity.schedule;
3 3 import com.bsth.entity.CarPark;
4 4 import com.bsth.entity.Line;
5 5 import com.bsth.entity.Station;
  6 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6 7  
7 8 import javax.persistence.*;
8 9  
... ... @@ -21,6 +22,7 @@ import javax.persistence.*;
21 22 @NamedAttributeNode("tcc")
22 23 })
23 24 })
  25 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
24 26 public class TTInfoDetail extends BEntity {
25 27  
26 28 /** 主健Id */
... ...
src/main/java/com/bsth/entity/sys/DutyEmployee.java 0 → 100644
  1 +package com.bsth.entity.sys;
  2 +
  3 +import javax.persistence.*;
  4 +
  5 +/**
  6 + * 当班调度员
  7 + * Created by panzhao on 2017/1/5.
  8 + */
  9 +@Entity
  10 +@Table(name = "bsth_c_sys_duty_employee")
  11 +public class DutyEmployee {
  12 +
  13 + @Id
  14 + @GeneratedValue
  15 + private Long id;
  16 +
  17 + /**
  18 + * 员工ID
  19 + */
  20 + private Integer uId;
  21 +
  22 + /**
  23 + * 员工姓名
  24 + */
  25 + private String uName;
  26 +
  27 + /**
  28 + * 线路编码 ,号分割多个
  29 + */
  30 + private String codeIdx;
  31 +
  32 + /**
  33 + * 登入线调时间
  34 + */
  35 + private Long ts;
  36 +
  37 + /**
  38 + * 是否主调模式进入
  39 + */
  40 + private boolean main;
  41 +
  42 + public Integer getuId() {
  43 + return uId;
  44 + }
  45 +
  46 + public void setuId(Integer uId) {
  47 + this.uId = uId;
  48 + }
  49 +
  50 + public String getuName() {
  51 + return uName;
  52 + }
  53 +
  54 + public void setuName(String uName) {
  55 + this.uName = uName;
  56 + }
  57 +
  58 + public String getCodeIdx() {
  59 + return codeIdx;
  60 + }
  61 +
  62 + public void setCodeIdx(String codeIdx) {
  63 + this.codeIdx = codeIdx;
  64 + }
  65 +
  66 + public Long getTs() {
  67 + return ts;
  68 + }
  69 +
  70 + public void setTs(Long ts) {
  71 + this.ts = ts;
  72 + }
  73 +
  74 + public boolean isMain() {
  75 + return main;
  76 + }
  77 +
  78 + public void setMain(boolean main) {
  79 + this.main = main;
  80 + }
  81 +
  82 + public Long getId() {
  83 + return id;
  84 + }
  85 +
  86 + public void setId(Long id) {
  87 + this.id = id;
  88 + }
  89 +}
... ...
src/main/java/com/bsth/entity/sys/SessionLog.java deleted 100644 → 0
1   -package com.bsth.entity.sys;
2   -
3   -import java.util.Date;
4   -
5   -import javax.persistence.Column;
6   -import javax.persistence.Entity;
7   -import javax.persistence.GeneratedValue;
8   -import javax.persistence.GenerationType;
9   -import javax.persistence.Id;
10   -import javax.persistence.ManyToOne;
11   -import javax.persistence.Table;
12   -
13   -/**
14   - *
15   - * @ClassName: SessionLog
16   - * @Description: TODO(session日志)
17   - * @author PanZhao
18   - * @date 2016年7月20日 下午4:46:27
19   - *
20   - */
21   -@Entity
22   -@Table(name = "bsth_c_sys_sessionlog")
23   -public class SessionLog {
24   -
25   - @Id
26   - @GeneratedValue(strategy = GenerationType.IDENTITY)
27   - private Integer id;
28   -
29   - @ManyToOne
30   - private SysUser user;
31   -
32   - /** 登录时间 */
33   - private Date loginDate;
34   -
35   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
36   - private Date createDate;
37   -
38   - /** 登出时间 */
39   - private Date logoutDate;
40   -
41   - /** 登出方式 0:主动登出, -1:其他 */
42   - private int logoutType;
43   -
44   - /** 登录IP */
45   - private String ip;
46   -
47   - public Integer getId() {
48   - return id;
49   - }
50   -
51   - public void setId(Integer id) {
52   - this.id = id;
53   - }
54   -
55   - public SysUser getUser() {
56   - return user;
57   - }
58   -
59   - public void setUser(SysUser user) {
60   - this.user = user;
61   - }
62   -
63   - public Date getLoginDate() {
64   - return loginDate;
65   - }
66   -
67   - public void setLoginDate(Date loginDate) {
68   - this.loginDate = loginDate;
69   - }
70   -
71   - public Date getCreateDate() {
72   - return createDate;
73   - }
74   -
75   - public void setCreateDate(Date createDate) {
76   - this.createDate = createDate;
77   - }
78   -
79   - public Date getLogoutDate() {
80   - return logoutDate;
81   - }
82   -
83   - public void setLogoutDate(Date logoutDate) {
84   - this.logoutDate = logoutDate;
85   - }
86   -
87   - public int getLogoutType() {
88   - return logoutType;
89   - }
90   -
91   - public void setLogoutType(int logoutType) {
92   - this.logoutType = logoutType;
93   - }
94   -
95   - public String getIp() {
96   - return ip;
97   - }
98   -
99   - public void setIp(String ip) {
100   - this.ip = ip;
101   - }
102   -}
src/main/java/com/bsth/entity/sys/SignControl.java deleted 100644 → 0
1   -package com.bsth.entity.sys;
2   -
3   -import java.util.Date;
4   -
5   -import javax.persistence.Entity;
6   -import javax.persistence.GeneratedValue;
7   -import javax.persistence.GenerationType;
8   -import javax.persistence.Id;
9   -import javax.persistence.ManyToOne;
10   -import javax.persistence.Table;
11   -
12   -/**
13   - *
14   - * @ClassName: SignControl
15   - * @Description: TODO(进出线调记录)
16   - * @author PanZhao
17   - * @date 2016年7月20日 下午4:50:50
18   - *
19   - */
20   -@Entity
21   -@Table(name = "bsth_c_sys_sign")
22   -public class SignControl {
23   -
24   - @Id
25   - @GeneratedValue(strategy = GenerationType.IDENTITY)
26   - private Integer id;
27   -
28   - @ManyToOne
29   - private SessionLog session;
30   -
31   - /** 登出线调时间 */
32   - private Date outDate;
33   -
34   - /** 在线时长 */
35   - private Long onLineTimel;
36   -
37   - /** 0: 主调模式, 1:监控模式 */
38   - private int signType;
39   -
40   - /** 用户名 */
41   - private String userName;
42   -
43   - public Integer getId() {
44   - return id;
45   - }
46   -
47   - public void setId(Integer id) {
48   - this.id = id;
49   - }
50   -
51   - public SessionLog getSession() {
52   - return session;
53   - }
54   -
55   - public void setSession(SessionLog session) {
56   - this.session = session;
57   - }
58   -
59   - public Date getOutDate() {
60   - return outDate;
61   - }
62   -
63   - public void setOutDate(Date outDate) {
64   - this.outDate = outDate;
65   - }
66   -
67   - public Long getOnLineTimel() {
68   - return onLineTimel;
69   - }
70   -
71   - public void setOnLineTimel(Long onLineTimel) {
72   - this.onLineTimel = onLineTimel;
73   - }
74   -
75   - public int getSignType() {
76   - return signType;
77   - }
78   -
79   - public void setSignType(int signType) {
80   - this.signType = signType;
81   - }
82   -
83   - public String getUserName() {
84   - return userName;
85   - }
86   -
87   - public void setUserName(String userName) {
88   - this.userName = userName;
89   - }
90   -}
src/main/java/com/bsth/entity/sys/SysUser.java
... ... @@ -9,7 +9,8 @@ import java.util.Set;
9 9  
10 10 @Entity
11 11 @Table(name = "bsth_c_sys_user")
12   -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"})
  12 +//@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"})
  13 +@JsonIgnoreProperties(ignoreUnknown = true)
13 14 public class SysUser {
14 15  
15 16 @Id
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -32,7 +32,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
32 32  
33 33 //把sum(addMileage) 替换为0 数据表去掉了 add_mileage 字段
34 34 @Query(value="select new map(clZbh as clZbh,jGh as jGh,jName as jName,sum(jhlc) as zgl,"
35   - + " 0 as ksgl,count(jName) as bcs) from ScheduleRealInfo s where"
  35 + + "0 as ksgl,count(jName) as bcs) from ScheduleRealInfo s where"
36 36 + " s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by clZbh,jGh,jName")
37 37 List<Map<String, Object>> dailyInfo(String line,String date);
38 38  
... ... @@ -71,7 +71,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
71 71 @Query(value="select count(jName) from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and sflj != 0")
72 72 int findLjbc(String jName,String clZbh,String lpName);
73 73  
74   - @Query(value="SELECT c.company,r.request_code,FROM_UNIXTIME(r.timestamp/1000,'%Y-%m-%d %T'),c.inside_code FROM bsth_v_report_80 r LEFT JOIN bsth_c_cars c ON c.equipment_code = r.device_id where FROM_UNIXTIME(r.timestamp/1000,'%Y-%m-%d') = ?2 and r.line_id like %?1% and c.inside_code like %?3%",nativeQuery=true)
  74 + @Query(value="SELECT c.company,r.request_code,FROM_UNIXTIME(r.timestamp/1000,'%Y-%m-%d %T'),c.inside_code FROM bsth_v_report_80 r LEFT JOIN bsth_c_cars c ON c.equipment_code = r.device_id where FROM_UNIXTIME(r.timestamp/1000,'%Y-%m-%d') = ?2 and r.line_id = ?1 and c.inside_code = ?3",nativeQuery=true)
75 75 List<Object[]> account(String line,String date,String code);
76 76  
77 77 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDate >= str_to_date(?2,'%Y-%m-%d') "
... ...
src/main/java/com/bsth/repository/schedule/TTInfoDetailRepository.java
... ... @@ -34,7 +34,10 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon
34 34 @Query("select cc from TTInfoDetail cc where cc.id=?1")
35 35 TTInfoDetail findOneExtend(Long aLong);
36 36  
37   - void deleteByTtinfoId(Long ttid);
  37 +// TODO:在findOne中 @EntityGraph 无效
  38 +// @EntityGraph(value = "tTInfoDetail_xl_lp_qdz_zdz_tcc", type = EntityGraph.EntityGraphType.FETCH)
  39 +// @Override
  40 +// TTInfoDetail findOne(Long aLong);
38 41  
39 42 @Query(value = "select max(tt.fcno) as mx from bsth_c_s_ttinfo_detail tt where tt.xl =?1 and tt.ttinfo =?2", nativeQuery = true)
40 43 Long findMaxFcno(Integer xlid, Long ttinfoid);
... ... @@ -44,6 +47,6 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon
44 47  
45 48 @Modifying
46 49 @Query(value = "delete from TTInfoDetail t where t.ttinfo.id = ?1")
47   - void deleteByTtinfo(Long ttinfoid);
  50 + void deleteByTtinfoIdWithModify(Long ttinfoid);
48 51  
49 52 }
... ...
src/main/java/com/bsth/repository/sys/DutyEmployeeRepository.java 0 → 100644
  1 +package com.bsth.repository.sys;
  2 +
  3 +import com.bsth.entity.sys.DutyEmployee;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.data.jpa.repository.Query;
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * Created by panzhao on 2017/1/5.
  12 + */
  13 +@Repository
  14 +public interface DutyEmployeeRepository extends BaseRepository<DutyEmployee, Long>{
  15 +
  16 + @Query("select t from DutyEmployee t where t.codeIdx like %?1% and t.ts > ?2 and t.ts < ?3")
  17 + List<DutyEmployee> findByLineAndTime(String lineCode, long st, long et);
  18 +}
... ...
src/main/java/com/bsth/repository/sys/SessionLogRepository.java deleted 100644 → 0
1   -package com.bsth.repository.sys;
2   -
3   -import org.springframework.stereotype.Repository;
4   -
5   -import com.bsth.entity.sys.SessionLog;
6   -import com.bsth.repository.BaseRepository;
7   -
8   -@Repository
9   -public interface SessionLogRepository extends BaseRepository<SessionLog, Integer>{
10   -
11   -}
src/main/java/com/bsth/service/forms/ExportService.java
... ... @@ -2,6 +2,7 @@ package com.bsth.service.forms;
2 2  
3 3 import java.util.List;
4 4  
  5 +import com.bsth.entity.mcy_forms.Daily;
5 6 import com.bsth.entity.mcy_forms.Linepasswengerflow;
6 7 import com.bsth.entity.mcy_forms.Operationservice;
7 8 import com.bsth.entity.mcy_forms.Shifday;
... ... @@ -28,6 +29,6 @@ public interface ExportService {
28 29 public void operationservice(String startDate, String endDate, String lpName,
29 30 List<Operationservice> resList);
30 31  
31   -
  32 +
32 33  
33 34 }
... ...
src/main/java/com/bsth/service/forms/FormsService.java
... ... @@ -5,6 +5,7 @@ import java.util.Map;
5 5  
6 6 import com.bsth.entity.mcy_forms.Allline;
7 7 import com.bsth.entity.mcy_forms.Changetochange;
  8 +import com.bsth.entity.mcy_forms.Daily;
8 9 import com.bsth.entity.mcy_forms.Executionrate;
9 10 import com.bsth.entity.mcy_forms.Linepasswengerflow;
10 11 import com.bsth.entity.mcy_forms.Operationservice;
... ... @@ -39,4 +40,6 @@ public interface FormsService {
39 40 public List<Executionrate> executionrate(Map<String, Object> map);
40 41  
41 42 public List<Allline> allline(Map<String, Object> map);
  43 +
  44 + public List<Daily> daily(Map<String, Object> map);
42 45 }
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -25,6 +25,7 @@ import com.bsth.entity.mcy_forms.Vehicleloading;
25 25 import com.bsth.entity.mcy_forms.Waybillday;
26 26 import com.bsth.entity.mcy_forms.Allline;
27 27 import com.bsth.entity.mcy_forms.Changetochange;
  28 +import com.bsth.entity.mcy_forms.Daily;
28 29 import com.bsth.entity.mcy_forms.Executionrate;
29 30 import com.bsth.service.forms.CommonService;
30 31 import com.bsth.service.forms.FormsService;
... ... @@ -615,8 +616,8 @@ public class FormsServiceImpl implements FormsService {
615 616 tu.setRq(rq);
616 617 tu.setGs(arg0.getString("gs_name").toString());
617 618 tu.setZhgs(arg0.getString("fgs_name").toString());
618   - //tu.setXl(arg0.getString("xlgs"));这个是根据公司判断线路有几条
619   - tu.setXl(arg0.getString("sxl"));
  619 + tu.setXl(arg0.getString("xlgs"));//这个是根据公司判断线路有几条
  620 + //tu.setXl(arg0.getString("sxl"));
620 621 tu.setXlmc(arg0.getString("sxl"));
621 622 tu.setCchjh(arg0.getString("jcl").toString());
622 623 tu.setCchsj(arg0.getString("scl").toString());
... ... @@ -708,4 +709,46 @@ public class FormsServiceImpl implements FormsService {
708 709  
709 710 return list;
710 711 }
  712 +
  713 + @Override
  714 + public List<Daily> daily(Map<String, Object> map) {
  715 +
  716 + String sql ="select r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
  717 + + " from bsth_c_s_sp_info_real r LEFT JOIN bsth_c_ylb y ON r.cl_zbh = y.nbbm "
  718 + + " WHERE 1 = 1"
  719 + + " and r.xl_bm='" + map.get("line").toString() + "'"
  720 + + " and to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"')"
  721 + + " AND r.gs_bm is not null";
  722 +
  723 + if(map.get("gsdmDaily").toString()!=""){
  724 + sql+=" and r.gs_bm='"+map.get("gsdmDaily").toString()+"'";
  725 + }
  726 + if(map.get("fgsdmDaily").toString()!=""){
  727 + sql+=" and r.fgs_bm='"+map.get("fgsdmDaily").toString()+"'";
  728 + }
  729 + sql += " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
  730 +
  731 + List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() {
  732 + @Override
  733 + public Daily mapRow(ResultSet arg0, int arg1) throws SQLException {
  734 + Daily daily = new Daily();
  735 + daily.setRq(arg0.getString("schedule_date_str"));
  736 + daily.setZbh(arg0.getString("cl_zbh"));
  737 + daily.setJgh(arg0.getString("j_gh"));
  738 + daily.setjName(arg0.getString("j_name"));
  739 + daily.setYh(arg0.getString("YH"));
  740 + return daily;
  741 + }
  742 + });
  743 +
  744 + for(int i=0;i<list.size();i++){
  745 + Daily d=list.get(i);
  746 + Map<String, Object> maps = new HashMap<>();
  747 + maps = commonService.findKMBC2(d.getJgh(),d.getZbh(),d.getRq());
  748 + d.setJzl1(maps.get("ksgl").toString());
  749 + d.setZlc(maps.get("realMileage").toString());
  750 + d.setBc(maps.get("sjbc").toString());
  751 + }
  752 + return list;
  753 + }
711 754 }
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -58,7 +58,7 @@ public class GpsServiceImpl implements GpsService {
58 58  
59 59 int dayOfYear = sCal.get(Calendar.DAY_OF_YEAR);
60 60 /*
61   - * if(dayOfYear != eCal.get(Calendar.DAY_OF_YEAR)){
  61 + * if(dayOfYear != eCal.get(Calendar.DAY_OF_YEAR)){
62 62 * System.out.println("暂时不支持跨天查询..."); return null; }
63 63 */
64 64  
... ... @@ -195,7 +195,7 @@ public class GpsServiceImpl implements GpsService {
195 195 inv = inv.substring(0, inv.length() - 1);
196 196  
197 197 // 查询到离站数据
198   - //Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear/* 30 */, st, et, inv);
  198 + Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear/* 30 */, st, et, inv);
199 199  
200 200 String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS from bsth_c_gps_info where days_year=? and device_id in ("
201 201 + inv + ") and ts > ? and ts < ?";
... ... @@ -239,11 +239,12 @@ public class GpsServiceImpl implements GpsService {
239 239 inOutStop = rs.getInt("INOUT_STOP");
240 240 map.put("inout_stop", inOutStop);
241 241  
242   - /*analyse = arrivalMap.get(rs.getString("DEVICE_ID") + "_" + rs.getLong("TS"));
243   - if (analyse != null) {
244   - map.put("inout_stop_info", analyse);
245   - map.put("inout_stop", analyse.getInOut());
246   - }*/
  242 + arrival = arrivalMap.get(rs.getString("DEVICE_ID") + "_" + rs.getLong("TS"));
  243 + if (arrival != null) {
  244 + map.put("inout_stop_info", arrival);
  245 + map.put("inout_stop", arrival.getInOut());
  246 + }
  247 +
247 248 map.put("nbbm", BasicData.deviceId2NbbmMap.get(rs.getString("DEVICE_ID")));
248 249 map.put("state", 0);
249 250 // 上下行
... ... @@ -272,11 +273,17 @@ public class GpsServiceImpl implements GpsService {
272 273  
273 274 rs = ps.executeQuery();
274 275 ArrivalEntity arr;
275   - int inOut;
  276 + int inOut, updown;
  277 + String prefix, stationName, lineId;
276 278 while (rs.next()) {
277   - arr = new ArrivalEntity(rs.getString("DEVICE_ID"), rs.getLong("TS"), rs.getString("LINE_ID"),
278   - rs.getInt("UP_DOWN"), rs.getString("STOP_NO"), rs.getInt("IN_OUT"), rs.getLong("CREATE_DATE"),
279   - rs.getInt("WEEKS_YEAR"), BasicData.stationCode2NameMap.get(rs.getString("STOP_NO")));
  279 + lineId = rs.getString("LINE_ID");
  280 + updown = rs.getInt("UP_DOWN");
  281 + prefix = lineId + "_" + updown + "_";
  282 + stationName = BasicData.getStationNameByCode(rs.getString("STOP_NO"), prefix);
  283 +
  284 + arr = new ArrivalEntity(rs.getString("DEVICE_ID"), rs.getLong("TS"), lineId,
  285 + updown, rs.getString("STOP_NO"), rs.getInt("IN_OUT"), rs.getLong("CREATE_DATE"),
  286 + rs.getInt("WEEKS_YEAR"), stationName);
280 287  
281 288 // 设备号_时间戳_进出状态 为key
282 289 // 反转进出状态
... ... @@ -382,7 +389,7 @@ public class GpsServiceImpl implements GpsService {
382 389  
383 390 gpsRealData.remove(device);
384 391 rs.put("status", ResponseCode.SUCCESS);
385   - }catch (Exception e){
  392 + } catch (Exception e) {
386 393 rs.put("status", ResponseCode.ERROR);
387 394 }
388 395 return rs;
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
... ... @@ -14,7 +14,6 @@ import com.bsth.repository.schedule.*;
14 14 import com.bsth.service.TrafficManageService;
15 15 import com.bsth.util.TimeUtils;
16 16 import com.bsth.util.db.DBUtils_MS;
17   -import com.bsth.webService.trafficManage.geotool.services.Internal;
18 17 import com.bsth.webService.trafficManage.geotool.services.InternalPortType;
19 18 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
20 19 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
... ... @@ -105,7 +104,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
105 104  
106 105  
107 106 // 运管处接口
108   - private InternalPortType portType = new Internal().getInternalHttpSoap11Endpoint();
  107 + private InternalPortType portType = null;//new Internal().getInternalHttpSoap11Endpoint();
109 108 private WebServiceSoap ssop ;
110 109 {
111 110 try {
... ...
src/main/java/com/bsth/service/realcontrol/RealMapService.java
... ... @@ -13,4 +13,6 @@ public interface RealMapService {
13 13 Map<String,Object> findRouteByLine(String lineCode);
14 14  
15 15 Map<String,Object> findRouteAndStationByLine(String lineCode);
  16 +
  17 + Map<String,Object> multiSectionRoute(String codeIdx);
16 18 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -65,7 +65,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
65 65  
66 66 List<Map<String,Object>> dailyInfo(String line,String date,String type);
67 67  
68   - List<Object[]> historyMessage(String line,String date,String code);
  68 + List<Object[]> historyMessage(String line,String date,String code, String type);
69 69  
70 70 Map<Integer, Integer> trustStatus(String lineCodes);
71 71  
... ... @@ -93,9 +93,9 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
93 93  
94 94 List<Map<String,String>> findLpName(String lpName);
95 95  
96   - List<Map<String,Object>> account(String line,String date,String code,String xlName);
  96 + List<Map<String,Object>> account(String line,String date,String code,String xlName, String type);
97 97  
98   - List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
  98 + List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code, String type);
99 99  
100 100 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String type);
101 101  
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
... ... @@ -17,65 +17,65 @@ import javax.transaction.Transactional;
17 17 import java.util.Map;
18 18  
19 19 @Service
20   -public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService{
  20 +public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService {
21 21  
22 22 /*@Autowired
23   - ScheduleRealInfoServiceImpl scheduleRealInfoService;*/
24   -
25   - @Autowired
26   - ScheduleRealInfoRepository scheduleRealInfoRepository;
27   -
28   - @Autowired
29   - ChildTaskPlanRepository childTaskPlanRepository;
30   -
31   - @Autowired
32   - DayOfSchedule dayOfSchedule;
33   -
34   - @Autowired
35   - Arrival2Schedule arrival2Schedule;
36   -
37   - @Autowired
38   - JdbcTemplate jdbcTemplate;
39   -
40   - @Transactional
41   - @Override
42   - public Map<String, Object> save(ChildTaskPlan t) {
43   - Map<String, Object> rs;
44   - //保存起终点名称
45   - Map<String, String> map = BasicData.stationCode2NameMap;
46   -
47   - t.setStartStationName(map.get(t.getStartStation()));
48   - t.setEndStationName(map.get(t.getEndStation()));
49   - //先持久化子任务
50   - rs = super.save(t);
51   - //再关联主任务
52   - ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
53   - sch.getcTasks().add(t);
54   - dayOfSchedule.save(sch);
55   -
56   - rs.put("t", sch);
57   -
58   - if(sch.getZdsjActual() == null)
59   - arrival2Schedule.removeExpect(sch.getClZbh());
60   - return rs;
61   - }
62   -
63   - @Override
64   - public Map<String, Object> delete(Long id) {
65   - Map<String, Object> rs;
66   -
67   - ChildTaskPlan cPlan = childTaskPlanRepository.findOne(id);
68   - //解除和主任务关联
69   - ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());
70   - sch.getcTasks().remove(cPlan);
71   - //删除关联表数据
72   - jdbcTemplate.execute("delete from bsth_c_s_sp_info_real_c_tasks where bsth_c_s_sp_info_real="+sch.getId()+" and c_tasks="+cPlan.getId());
73   -
74   - //删除子任务
75   - rs = super.delete(id);
76   - dayOfSchedule.save(sch);
77   -
78   - rs.put("t", sch);
79   - return rs;
80   - }
  23 + ScheduleRealInfoServiceImpl scheduleRealInfoService;*/
  24 +
  25 + @Autowired
  26 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  27 +
  28 + @Autowired
  29 + ChildTaskPlanRepository childTaskPlanRepository;
  30 +
  31 + @Autowired
  32 + DayOfSchedule dayOfSchedule;
  33 +
  34 + @Autowired
  35 + Arrival2Schedule arrival2Schedule;
  36 +
  37 + @Autowired
  38 + JdbcTemplate jdbcTemplate;
  39 +
  40 + @Transactional
  41 + @Override
  42 + public Map<String, Object> save(ChildTaskPlan t) {
  43 + ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
  44 + Map<String, Object> rs;
  45 + //保存起终点名称
  46 + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
  47 +
  48 + t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
  49 + t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
  50 + //先持久化子任务
  51 + rs = super.save(t);
  52 + //再关联主任务
  53 + sch.getcTasks().add(t);
  54 + dayOfSchedule.save(sch);
  55 +
  56 + rs.put("t", sch);
  57 +
  58 + if (sch.getZdsjActual() == null)
  59 + arrival2Schedule.removeExpect(sch.getClZbh());
  60 + return rs;
  61 + }
  62 +
  63 + @Override
  64 + public Map<String, Object> delete(Long id) {
  65 + Map<String, Object> rs;
  66 +
  67 + ChildTaskPlan cPlan = childTaskPlanRepository.findOne(id);
  68 + //解除和主任务关联
  69 + ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());
  70 + sch.getcTasks().remove(cPlan);
  71 + //删除关联表数据
  72 + jdbcTemplate.execute("delete from bsth_c_s_sp_info_real_c_tasks where bsth_c_s_sp_info_real=" + sch.getId() + " and c_tasks=" + cPlan.getId());
  73 +
  74 + //删除子任务
  75 + rs = super.delete(id);
  76 + dayOfSchedule.save(sch);
  77 +
  78 + rs.put("t", sch);
  79 + return rs;
  80 + }
81 81 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
... ... @@ -122,7 +122,7 @@ public class RealMapServiceImpl implements RealMapService {
122 122 rs.put("section", secList);
123 123  
124 124 //查询站点信息
125   - sql="select r.STATION_NAME,r.STATION_ROUTE_CODE,r.LINE_CODE,r.STATION_CODE,r.STATION_MARK,s.G_LONX,s.G_LATY, r.DIRECTIONS from bsth_c_stationroute r INNER JOIN bsth_c_station s on r.station=s.id and r.line_code=? and r.destroy=0";
  125 + sql = "select r.STATION_NAME,r.STATION_ROUTE_CODE,r.LINE_CODE,r.STATION_CODE,r.STATION_MARK,s.G_LONX,s.G_LATY, r.DIRECTIONS from bsth_c_stationroute r INNER JOIN bsth_c_station s on r.station=s.id and r.line_code=? and r.destroy=0";
126 126 List<Map<String, Object>> stationList = jdbcTemplate.queryForList(sql, lineCode);
127 127 rs.put("station", stationList);
128 128  
... ... @@ -134,6 +134,31 @@ public class RealMapServiceImpl implements RealMapService {
134 134 return rs;
135 135 }
136 136  
  137 + @Override
  138 + public Map<String, Object> multiSectionRoute(String codeIdx) {
  139 + Map<String, Object> rs = new HashMap<>();
  140 + try {
  141 + List<String> idArray = Splitter.on(",").splitToList(codeIdx);
  142 + //拼接in语句
  143 + String inStr = "";
  144 + for (String code : idArray) {
  145 + inStr += (",'" + code + "'");
  146 + }
  147 + inStr = " (" + inStr.substring(1) + ")";
  148 +
  149 + String sql = "SELECT r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,s.SECTION_NAME,ST_AsText (s.GSECTION_VECTOR) AS GSECTION_VECTOR,r.DIRECTIONS FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s ON r.section = s.id WHERE r.line_code in " + inStr + " AND r.destroy = 0 order by r.line_code, r.directions,r.sectionroute_code";
  150 +
  151 + List<Map<String, Object>> secList = jdbcTemplate.queryForList(sql);
  152 + rs.put("section", secList);
  153 + rs.put("status", ResponseCode.SUCCESS);
  154 + } catch (DataAccessException e) {
  155 + logger.error("", e);
  156 + rs.put("status", ResponseCode.ERROR);
  157 + }
  158 +
  159 + return rs;
  160 + }
  161 +
137 162 /**
138 163 * wgs 坐标数组转 百度
139 164 *
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -46,6 +46,7 @@ import org.slf4j.LoggerFactory;
46 46 import org.springframework.beans.factory.annotation.Autowired;
47 47 import org.springframework.stereotype.Service;
48 48  
  49 +import java.net.URLEncoder;
49 50 import java.text.DecimalFormat;
50 51 import java.text.ParseException;
51 52 import java.text.SimpleDateFormat;
... ... @@ -286,6 +287,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
286 287 t.setCreateBy(user);
287 288 t.setSflj(true);
288 289 t.setLate(false);
  290 + t.setDfsj(t.getFcsj());
289 291 t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
290 292  
291 293  
... ... @@ -293,8 +295,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
293 295 t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60);
294 296  
295 297 //起终点名称
296   - t.setQdzName(BasicData.stationCode2NameMap.get(t.getQdzCode()));
297   - t.setZdzName(BasicData.stationCode2NameMap.get(t.getZdzCode()));
  298 + String prefix = t.getXlBm() + "_" + t.getXlDir() + "_";
  299 + t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix));
  300 + t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix));
298 301  
299 302 //计算班次实际时间
300 303 schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t);
... ... @@ -617,7 +620,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
617 620 }
618 621  
619 622 @Override
620   - public List<Object[]> historyMessage(String line, String date, String code) {
  623 + public List<Object[]> historyMessage(String line, String date, String code, String type) {
621 624 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
622 625 long d= 0;
623 626 long t=0;
... ... @@ -639,6 +642,36 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
639 642 obj[4] = BasicData.lineCode2NameMap.get(line);
640 643 }
641 644 }
  645 +
  646 + if(type != null && type.length() != 0 && type.equals("export")){
  647 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  648 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  649 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  650 + Map<String,Object> m = new HashMap<String, Object>();
  651 + ReportUtils ee = new ReportUtils();
  652 + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
  653 + for(int i = 0; i < list.size(); i++){
  654 + Map<String, Object> map = new HashMap<String, Object>();
  655 + Object[] obj = list.get(i);
  656 + map.put("num", i + 1);
  657 + map.put("line", obj[4]);
  658 + map.put("clZbh", obj[0]);
  659 + map.put("sender", obj[1]);
  660 + map.put("date", obj[3]);
  661 + map.put("text", obj[2]);
  662 + newList.add(map);
  663 + }
  664 + try {
  665 + listI.add(newList.iterator());
  666 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  667 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\historyMessage.xls",
  668 + path+"export\\调度历史消息" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  669 + } catch (Exception e) {
  670 + // TODO: handle exception
  671 + e.printStackTrace();
  672 + }
  673 + }
  674 +
642 675 return list;
643 676 }
644 677  
... ... @@ -1218,13 +1251,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1218 1251  
1219 1252 @Override
1220 1253 public List<Map<String, Object>> account(String line, String date,
1221   - String code,String xlName) {
  1254 + String code,String xlName, String type) {
1222 1255 List<Object[]> lsitObj = scheduleRealInfoRepository.account(line,date,code);
1223 1256 List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
1224 1257 Map<String,Object> map;
  1258 + int i = 1;
1225 1259 for(Object[] obj : lsitObj){
1226 1260 if(obj != null){
1227 1261 map = new HashMap<String,Object>();
  1262 + map.put("num", i++);
1228 1263 map.put("xlName", xlName);
1229 1264 map.put("clZbh", obj[3]);
1230 1265 map.put("company", obj[0]);
... ... @@ -1233,13 +1268,65 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1233 1268 listMap.add(map);
1234 1269 }
1235 1270 }
  1271 +
  1272 + if(type != null && type.length() != 0 && type.equals("export")){
  1273 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1274 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1275 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1276 + Map<String,Object> m = new HashMap<String, Object>();
  1277 + ReportUtils ee = new ReportUtils();
  1278 + Map<String, Object> typeMap = new HashMap<String, Object>();
  1279 + typeMap.put("0xA1", "请求恢复运营");
  1280 + typeMap.put("0xA2", "申请调档");
  1281 + typeMap.put("0xA3", "出场请求");
  1282 + typeMap.put("0xA5", "进场请求");
  1283 + typeMap.put("0xA7", "加油请求");
  1284 + typeMap.put("0x50", "车辆故障");
  1285 + typeMap.put("0x70", "路阻报告");
  1286 + typeMap.put("0x60", "事故报告");
  1287 + typeMap.put("0x11", "扣证纠纷");
  1288 + typeMap.put("0x12", "报警");
  1289 + for(Map<String, Object> map1 : listMap){
  1290 + map1.put("requestText", typeMap.get(map1.get("requestType")));
  1291 + }
  1292 + try {
  1293 + listI.add(listMap.iterator());
  1294 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1295 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\account.xls",
  1296 + path+"export\\驾驶员请求台账" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1297 + } catch (Exception e) {
  1298 + // TODO: handle exception
  1299 + e.printStackTrace();
  1300 + }
  1301 + }
  1302 +
1236 1303 return listMap;
1237 1304 }
1238 1305  
1239 1306 @Override
1240 1307 public List<ScheduleRealInfo> correctForm(String line, String startDate,
1241   - String endDate, String lpName, String code) {
  1308 + String endDate, String lpName, String code, String type) {
1242 1309 List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line,startDate,endDate,lpName,code);
  1310 +
  1311 + if(type != null && type.length() != 0 && type.equals("export")){
  1312 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1313 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1314 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1315 + Map<String,Object> m = new HashMap<String, Object>();
  1316 + ReportUtils ee = new ReportUtils();
  1317 + m.put("startDate", startDate);
  1318 + m.put("endDate", endDate);
  1319 + try {
  1320 + listI.add(list.iterator());
  1321 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1322 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\correctForm.xls",
  1323 + path+"export\\" + URLEncoder.encode("修正报表", "UTF-8") + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  1324 + } catch (Exception e) {
  1325 + // TODO: handle exception
  1326 + e.printStackTrace();
  1327 + }
  1328 + }
  1329 +
1243 1330 return list;
1244 1331 }
1245 1332  
... ...
src/main/java/com/bsth/service/schedule/BService.java
1 1 package com.bsth.service.schedule;
2 2  
  3 +import com.bsth.service.schedule.exception.ScheduleException;
  4 +import com.bsth.service.schedule.utils.DataToolsService;
3 5 import org.springframework.data.domain.Page;
4 6 import org.springframework.data.domain.Pageable;
5 7  
... ... @@ -10,8 +12,8 @@ import java.util.Map;
10 12 /**
11 13 * 基础service接口。
12 14 */
13   -public interface BService<T, ID extends Serializable> {
14   - // CRUD 操作
  15 +public interface BService<T, ID extends Serializable> extends DataToolsService {
  16 + //---------------- CRUD 操作 ----------------//
15 17 // Create,Update操作
16 18 T save(T t);
17 19 <S extends T> List<S> bulkSave(List<S> entities); // 批量保存(TODO:待测试)
... ... @@ -22,4 +24,5 @@ public interface BService&lt;T, ID extends Serializable&gt; {
22 24 List<T> list(Map<String, Object> param);
23 25 // Delete操作
24 26 void delete(ID id) throws ScheduleException;
  27 +
25 28 }
... ...
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.CarConfigInfo;
  4 +import com.bsth.service.schedule.exception.ScheduleException;
4 5  
5 6 /**
6 7 * Created by xu on 16/5/9.
... ...
src/main/java/com/bsth/service/schedule/CarDeviceService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.CarDevice;
  4 +import com.bsth.service.schedule.exception.ScheduleException;
4 5  
5 6 /**
6 7 * Created by xu on 16/12/15.
... ...
src/main/java/com/bsth/service/schedule/CarsService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.Cars;
  4 +import com.bsth.service.schedule.exception.ScheduleException;
4 5  
5 6 /**
6 7 * Created by xu on 16/12/8.
... ...
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.EmployeeConfigInfo;
  4 +import com.bsth.service.schedule.exception.ScheduleException;
4 5  
5 6 /**
6 7 * Created by xu on 16/5/10.
... ...
src/main/java/com/bsth/service/schedule/EmployeeService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.Personnel;
  4 +import com.bsth.service.schedule.exception.ScheduleException;
4 5  
5 6 /**
6 7 * Created by xu on 16/12/15.
... ...
src/main/java/com/bsth/service/schedule/GuideboardInfoService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.GuideboardInfo;
  4 +import com.bsth.service.schedule.exception.ScheduleException;
4 5  
5 6 /**
6 7 * Created by xu on 16/5/11.
... ...
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import java.math.BigDecimal;
  4 +import java.net.URLEncoder;
4 5 import java.sql.ResultSet;
5 6 import java.sql.SQLException;
6 7 import java.text.DecimalFormat;
... ... @@ -463,7 +464,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
463 464 listI.add(resList.iterator());
464 465 String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
465 466 ee.excelReplace(listI, new Object[] { m }, path+"mould\\workDaily.xls",
466   - path+"export\\营运服务日报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  467 + path+"export\\营运服务日报表"+ sdfSimple.format(sdfMonth.parse(date))+".xls");
467 468 } catch (Exception e) {
468 469 // TODO: handle exception
469 470 e.printStackTrace();
... ... @@ -937,7 +938,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
937 938 tempMap.put("sjfcFirst0", "/");
938 939 tempMap.put("delayFirst0", "/");
939 940 }
940   - if(moban0.getZdsjActual() != null){
  941 + if(moban0.getFcsjActual() != null){
941 942 String[] split = moban0.getFcsjActual().split(":");
942 943 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
943 944 long delay = moban0.getFcsjT() - min;
... ... @@ -963,7 +964,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
963 964 tempMap.put("sjfcFirst1", "/");
964 965 tempMap.put("delayFirst1", "/");
965 966 }
966   - if(moban1.getZdsjActual() != null){
  967 + if(moban1.getFcsjActual() != null){
967 968 String[] split = moban1.getFcsjActual().split(":");
968 969 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
969 970 long delay = moban1.getFcsjT() - min;
... ...
src/main/java/com/bsth/service/schedule/TTInfoDetailService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4   -import com.bsth.service.BaseService;
  4 +import com.bsth.service.schedule.exception.ScheduleException;
5 5 import org.apache.commons.lang3.StringUtils;
6   -import org.springframework.web.multipart.MultipartFile;
7 6  
8   -import java.io.File;
9 7 import java.util.ArrayList;
10 8 import java.util.List;
11 9  
12 10 /**
13 11 * Created by xu on 16/7/2.
14 12 */
15   -public interface TTInfoDetailService extends BaseService<TTInfoDetail, Long> {
16   -
17   - void deleteByTtinfo(Long ttinfoid);
  13 +public interface TTInfoDetailService extends BService<TTInfoDetail, Long> {
18 14  
19 15 /**
20 16 * 发车信息内部类。
... ... @@ -34,7 +30,12 @@ public interface TTInfoDetailService extends BaseService&lt;TTInfoDetail, Long&gt; {
34 30 public FcInfo() {
35 31 }
36 32  
37   - public FcInfo(String ttdid_str, String bc_type, String fcsj, String xldir, String isfb) {
  33 + public FcInfo(
  34 + String ttdid_str,
  35 + String bc_type,
  36 + String fcsj,
  37 + String xldir,
  38 + String isfb) {
38 39 this.ttdid = StringUtils.isEmpty(ttdid_str) ? null : Long.valueOf(ttdid_str);
39 40 this.bc_type = bc_type;
40 41 this.fcsj = fcsj;
... ... @@ -98,6 +99,9 @@ public interface TTInfoDetailService extends BaseService&lt;TTInfoDetail, Long&gt; {
98 99 /** 内容数据 */
99 100 private List<List<FcInfo>> contents = new ArrayList<>();
100 101  
  102 + /** 营运描述 */
  103 + private String yy_desc;
  104 +
101 105 public List<String> getHeader() {
102 106 return header;
103 107 }
... ... @@ -113,6 +117,14 @@ public interface TTInfoDetailService extends BaseService&lt;TTInfoDetail, Long&gt; {
113 117 public void setContents(List<List<FcInfo>> contents) {
114 118 this.contents = contents;
115 119 }
  120 +
  121 + public String getYy_desc() {
  122 + return yy_desc;
  123 + }
  124 +
  125 + public void setYy_desc(String yy_desc) {
  126 + this.yy_desc = yy_desc;
  127 + }
116 128 }
117 129  
118 130 /**
... ... @@ -121,22 +133,28 @@ public interface TTInfoDetailService extends BaseService&lt;TTInfoDetail, Long&gt; {
121 133 * @param ttid 时刻表id
122 134 * @return
123 135 */
124   - EditInfo getEditInfo(Integer xlid, Long ttid) throws Exception;
  136 + EditInfo getEditInfo(Integer xlid, Long ttid) throws ScheduleException;
  137 +
  138 + /**
  139 + * 验证sheet(以后放到规则引擎里去做)。
  140 + * @param filename excel文件全路径名
  141 + * @param sheetname sheet名字
  142 + * @param lineid 线路id
  143 + */
  144 + void validateExcelSheet(
  145 + String filename,
  146 + String sheetname,
  147 + Integer lineid,
  148 + String linename) throws ScheduleException;
125 149  
126 150 /**
127   - * 上传并导入数据,和DataImportExportService的同名方法有差别。
128   - * @param datafile form上传文件
129   - * @param xlmc 线路名称
130   - * @param ttinfoname 时刻表名字
131   - * @param tccname 停车场名字
132   - * @throws Exception
  151 + * 验证关联的线路标准信息(以后放到规则引擎里去做)。
  152 + * @param lineinfoid 线路id
133 153 */
134   - void fileDataImport(MultipartFile datafile,
135   - String xlmc,
136   - String ttinfoname,
137   - String tccname) throws Exception;
  154 + void validateAssoLineInfo(Integer lineinfoid) throws ScheduleException;
138 155  
139   - void fileDataImport(File file, String sheetname, String xlmc, String ttinfoname, String tccname) throws Exception;
  156 + // TODO:这个方法可以用通用方法解决,以后改
  157 + List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId);
140 158  
141 159  
142 160 }
... ...
src/main/java/com/bsth/service/schedule/TTInfoDetailServiceImpl.java deleted 100644 → 0
1   -package com.bsth.service.schedule;
2   -
3   -import com.bsth.entity.schedule.TTInfoDetail;
4   -import com.bsth.repository.schedule.TTInfoDetailRepository;
5   -import com.bsth.service.impl.BaseServiceImpl;
6   -import com.bsth.service.schedule.utils.DataImportExportService;
7   -import com.bsth.service.schedule.utils.DataToolsProperties;
8   -import jxl.Sheet;
9   -import jxl.Workbook;
10   -import org.apache.commons.lang3.StringUtils;
11   -import org.joda.time.DateTime;
12   -import org.pentaho.di.trans.Trans;
13   -import org.pentaho.di.trans.TransMeta;
14   -import org.springframework.beans.factory.annotation.Autowired;
15   -import org.springframework.boot.context.properties.EnableConfigurationProperties;
16   -import org.springframework.stereotype.Service;
17   -import org.springframework.transaction.annotation.Isolation;
18   -import org.springframework.transaction.annotation.Propagation;
19   -import org.springframework.transaction.annotation.Transactional;
20   -import org.springframework.web.multipart.MultipartFile;
21   -
22   -import java.io.File;
23   -import java.util.ArrayList;
24   -import java.util.Arrays;
25   -import java.util.List;
26   -
27   -/**
28   - * Created by xu on 16/7/2.
29   - */
30   -@Service
31   -@EnableConfigurationProperties(DataToolsProperties.class)
32   -public class TTInfoDetailServiceImpl extends BaseServiceImpl<TTInfoDetail, Long> implements TTInfoDetailService {
33   - @Autowired
34   - private DataImportExportService dataImportExportService;
35   - @Autowired
36   - private DataToolsProperties dataToolsProperties;
37   - @Autowired
38   - private TTInfoDetailRepository ttInfoDetailRepository;
39   -
40   - @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
41   - @Override
42   - public void deleteByTtinfo(Long ttinfoid) {
43   - ttInfoDetailRepository.deleteByTtinfo(ttinfoid);
44   - }
45   -
46   - /**
47   - * 获取待编辑的数据。
48   - * @param xlid 线路id
49   - * @param ttid 时刻表id
50   - * @return
51   - */
52   - @Override
53   - public EditInfo getEditInfo(Integer xlid, Long ttid) throws Exception {
54   - // 1、使用ktr转换获取输出文件
55   - // 1.1、获取转换用ktr
56   - File ktrFile = new File(this.getClass().getResource(
57   - dataToolsProperties.getTtinfodetailForeditktr()).toURI());
58   - TransMeta transMeta = new TransMeta(ktrFile.getAbsolutePath());
59   - Trans trans = new Trans(transMeta);
60   -// trans.setLogLevel(LogLevel.DEBUG);
61   - // 1.2、设定命名参数,TODO:之后还要添加其他命名参数
62   - String outputFilePath = "ttinfodetail_" + new DateTime().toString("yyyy-MM-dd_HH-mm-ss");
63   - trans.setParameterValue("tempfilepath", dataToolsProperties.getTransTempdir() + File.separator + outputFilePath); // 数据输出文件路径
64   - trans.setParameterValue("xlid", String.valueOf(xlid));
65   - trans.setParameterValue("ttid", String.valueOf(ttid));
66   - // 1.3、执行转换
67   - trans.execute(null);
68   - // 1.4、等待转换结束
69   - trans.waitUntilFinished();
70   -
71   - // 1.5、判定ktr错误数,注意这种错误代表部分数据错误,不会终止转换执行,一般设计ktr的时候,会有错误输出文件,TODO:以后考虑使用日志实时输出
72   - if (trans.getErrors() > 0) {
73   - throw new Exception("转换数据部分错误,请查看相关错误输出文件!");
74   - }
75   -
76   - // 1.6、获取最大的发车数,用于输出数据的数量
77   - Long maxfcno = ttInfoDetailRepository.findMaxFcno(xlid, ttid);
78   - if (maxfcno == null)
79   - return new EditInfo();
80   -
81   - // 2、读取ktr生成的excel数据,组织编辑用数据返回
82   - // 2-1、读取Excel文件
83   - Workbook book = Workbook.getWorkbook(new File(dataToolsProperties.getTransTempdir() +
84   - File.separator + outputFilePath + ".xls"));
85   - Sheet sheet = book.getSheet(0);
86   - EditInfo editInfo = new EditInfo();
87   - // 2-2、处理数据
88   - String[] headarrays = new String[maxfcno.intValue() + 1];
89   - headarrays[0] = "路牌";
90   - for (int r = 1; r < sheet.getRows(); r++) {
91   - List<FcInfo> fcInfos = new ArrayList<>();
92   - // 每行第一列都是路牌
93   - fcInfos.add(new FcInfo(null, null, sheet.getCell(0, r).getContents(), null, null)); // 用fcsj放置路牌显示
94   - for (int c = 1; c <= maxfcno * 6; ) {
95   - String ttdid_str = sheet.getCell(c, r).getContents(); // 时刻表明细id
96   - String fcsj = sheet.getCell(c + 1, r).getContents(); // 发车时间
97   - String fzdname = sheet.getCell(c + 2, r).getContents(); // 发车站点名称
98   - String bctype = sheet.getCell(c + 3, r).getContents(); // 班次类型
99   - String xldir = sheet.getCell(c + 4, r).getContents(); // 线路上下行
100   - String isfb = sheet.getCell(c + 5, r).getContents(); // 是否分班
101   -
102   - FcInfo fcInfo = new FcInfo(ttdid_str, bctype, fcsj, xldir, isfb);
103   -
104   - if (StringUtils.isNotEmpty(fzdname))
105   - headarrays[(int)(c / 6) + 1] = fzdname;
106   - fcInfos.add(fcInfo);
107   -
108   - c += 6;
109   - }
110   - editInfo.getContents().add(fcInfos);
111   - }
112   - editInfo.getHeader().addAll(Arrays.asList(headarrays));
113   -
114   - return editInfo;
115   - }
116   -
117   - @Override
118   - /**
119   - * 上传并导入数据,和DataImportExportService的同名方法有差别。
120   - * @param datafile form上传文件
121   - * @param xlmc 线路名称
122   - * @param ttinfoname 时刻表名字
123   - * @param tccname 停车场名字
124   - * @throws Exception
125   - */
126   - public void fileDataImport(MultipartFile datafile,
127   - String xlmc,
128   - String ttinfoname,
129   - String tccname) throws Exception {
130   - // 上传数据文件
131   - File uploadFile = dataImportExportService.uploadFile(datafile);
132   - fileDataImport(uploadFile, "工作表1", xlmc, ttinfoname, tccname);
133   -
134   - }
135   -
136   - @Override
137   - public void fileDataImport(File uploadFile, String sheetname, String xlmc, String ttinfoname, String tccname) throws Exception {
138   - // 1、上传数据文件
139   - System.out.println("线路名称:" + xlmc);
140   - System.out.println("时刻表名称:" + ttinfoname);
141   - System.out.println("停车场名字:" + tccname);
142   - System.out.println("时刻表明细上传文件:" + uploadFile);
143   -
144   - // 2、jexcelapi读取excel文件
145   - Workbook book = Workbook.getWorkbook(uploadFile);
146   - Sheet sheet = book.getSheet(0);
147   - List<String> columnames = new ArrayList<>();
148   - for (int i = 0; i < sheet.getColumns(); i++) { // 获取第一行,数据,作为列名
149   - columnames.add(sheet.getCell(i, 0).getContents());
150   - }
151   -
152   - System.out.println("表头1:" + StringUtils.join(columnames.toArray(), ","));
153   -
154   - // 2、使用kettle运行封装数据导入逻辑的ktr转换文件
155   - // 2.1、初始化kettle(组件初始化已经做了)
156   - // 2.2、创建转换元数据,转换
157   - File ktrFile = new File(this.getClass().getResource(
158   - dataToolsProperties.getTtinfodetailMetadatainputktr()).toURI());
159   - File ktrFile2 = new File(this.getClass().getResource(
160   - dataToolsProperties.getTtinfodetailDatainputktr()).toURI());
161   - TransMeta transMeta = new TransMeta(ktrFile.getAbsolutePath());
162   - Trans trans = new Trans(transMeta);
163   - // 2.3、设定命名参数,用于指定数据文件,注意每个ktr必须都有以下指定的命名参数
164   - trans.setParameterValue("injectktrfile", ktrFile2.getAbsolutePath()); // 注入元数据的ktr文件
165   - trans.setParameterValue("filepath", uploadFile.getAbsolutePath()); // 指定导入数据文件的位置
166   - trans.setParameterValue("sheetname", sheetname); // sheet工作区的名字
167   - trans.setParameterValue("erroroutputdir", dataToolsProperties.getTransErrordir()); // ktr转换错误输出目录
168   - trans.setParameterValue("xlname", xlmc); // 线路名称
169   - trans.setParameterValue("ttinfoname", ttinfoname); // 时刻表名称
170   - trans.setParameterValue("tccname", tccname); // 停车场名字
171   - trans.setParameterValue("excelfieldnames", StringUtils.join(columnames.toArray(), ",")); // 时刻表excel输入字段名,以逗号连接
172   - columnames.remove(0);
173   - trans.setParameterValue("normalizefieldnames", StringUtils.join(columnames.toArray(), ",")); // 数据范式化字段名,以逗号连接
174   -
175   - // TODO:可以考虑设定日志输出
176   - // 2.4、执行转换
177   - trans.execute(null);
178   - // 2.5、等待转换结束
179   - trans.waitUntilFinished();
180   -
181   - // 3、判定ktr错误数,注意这种错误代表部分数据错误,不会终止转换执行,一般设计ktr的时候,会有错误输出文件,TODO:以后考虑使用日志实时输出
182   - if (trans.getErrors() > 0) {
183   - throw new Exception("转换数据部分错误,请查看相关错误输出文件!");
184   - }
185   - }
186   -}
src/main/java/com/bsth/service/schedule/TTInfoService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.TTInfo;
  4 +import com.bsth.service.schedule.exception.ScheduleException;
4 5  
5 6 /**
6 7 * Created by xu on 16/5/12.
... ...
src/main/java/com/bsth/service/schedule/ScheduleException.java renamed to src/main/java/com/bsth/service/schedule/exception/ScheduleException.java
1   -package com.bsth.service.schedule;
  1 +package com.bsth.service.schedule.exception;
2 2  
3 3 /**
4 4 * Created by xu on 16/12/5.
... ...
src/main/java/com/bsth/service/schedule/impl/BServiceImpl.java
... ... @@ -3,16 +3,19 @@ package com.bsth.service.schedule.impl;
3 3 import com.bsth.entity.search.CustomerSpecs;
4 4 import com.bsth.repository.BaseRepository;
5 5 import com.bsth.service.schedule.BService;
6   -import com.bsth.service.schedule.ScheduleException;
  6 +import com.bsth.service.schedule.exception.ScheduleException;
  7 +import com.bsth.service.schedule.utils.DataToolsService;
7 8 import org.slf4j.Logger;
8 9 import org.slf4j.LoggerFactory;
9 10 import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.beans.factory.annotation.Qualifier;
10 12 import org.springframework.beans.factory.annotation.Value;
11 13 import org.springframework.data.domain.Page;
12 14 import org.springframework.data.domain.Pageable;
13 15 import org.springframework.data.jpa.domain.Specification;
14 16  
15 17 import javax.persistence.EntityManager;
  18 +import java.io.File;
16 19 import java.io.Serializable;
17 20 import java.util.ArrayList;
18 21 import java.util.List;
... ... @@ -29,6 +32,10 @@ public class BServiceImpl&lt;T, ID extends Serializable&gt; implements BService&lt;T, ID&gt;
29 32 @Value("${hibernate.jdbc.batch_size}")
30 33 private int batchSize;
31 34  
  35 + @Autowired
  36 + @Qualifier(value = "dataToolsServiceImpl")
  37 + private DataToolsService dataToolsService;
  38 +
32 39 /** 日志记录器 */
33 40 protected Logger logger = LoggerFactory.getLogger(this.getClass());
34 41  
... ... @@ -108,4 +115,19 @@ public class BServiceImpl&lt;T, ID extends Serializable&gt; implements BService&lt;T, ID&gt;
108 115  
109 116 baseRepository.delete(id);
110 117 }
  118 +
  119 + @Override
  120 + public File uploadFile(String filename, byte[] filedata) throws ScheduleException {
  121 + return dataToolsService.uploadFile(filename, filedata);
  122 + }
  123 +
  124 + @Override
  125 + public void importData(File file, Map<String, Object> params) throws ScheduleException {
  126 + dataToolsService.importData(file, params);
  127 + }
  128 +
  129 + @Override
  130 + public File exportData(Map<String, Object> params) throws ScheduleException {
  131 + return dataToolsService.exportData(params);
  132 + }
111 133 }
... ...
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
... ... @@ -3,7 +3,7 @@ package com.bsth.service.schedule.impl;
3 3 import com.bsth.entity.schedule.CarConfigInfo;
4 4 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
5 5 import com.bsth.service.schedule.CarConfigInfoService;
6   -import com.bsth.service.schedule.ScheduleException;
  6 +import com.bsth.service.schedule.exception.ScheduleException;
7 7 import com.bsth.service.schedule.ScheduleRule1FlatService;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.stereotype.Service;
... ...
src/main/java/com/bsth/service/schedule/impl/CarDeviceServiceImpl.java
... ... @@ -4,7 +4,7 @@ import com.bsth.entity.CarDevice;
4 4 import com.bsth.entity.Cars;
5 5 import com.bsth.service.CarsService;
6 6 import com.bsth.service.schedule.CarDeviceService;
7   -import com.bsth.service.schedule.ScheduleException;
  7 +import com.bsth.service.schedule.exception.ScheduleException;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.stereotype.Service;
10 10 import org.springframework.transaction.annotation.Transactional;
... ...
src/main/java/com/bsth/service/schedule/impl/CarsServiceImpl.java
... ... @@ -2,19 +2,91 @@ package com.bsth.service.schedule.impl;
2 2  
3 3 import com.bsth.entity.Cars;
4 4 import com.bsth.service.schedule.CarsService;
5   -import com.bsth.service.schedule.ScheduleException;
  5 +import com.bsth.service.schedule.exception.ScheduleException;
  6 +import com.bsth.service.schedule.utils.DataToolsProperties;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.boot.context.properties.EnableConfigurationProperties;
6 11 import org.springframework.stereotype.Service;
7 12 import org.springframework.transaction.annotation.Transactional;
8 13 import org.springframework.util.CollectionUtils;
9 14  
  15 +import java.io.File;
  16 +import java.io.PrintWriter;
  17 +import java.io.StringWriter;
10 18 import java.util.HashMap;
11 19 import java.util.Map;
12 20  
13 21 /**
14 22 * Created by xu on 16/12/8.
15 23 */
  24 +@EnableConfigurationProperties(DataToolsProperties.class)
16 25 @Service(value = "carsServiceImpl_sc")
17 26 public class CarsServiceImpl extends BServiceImpl<Cars, Integer> implements CarsService {
  27 + /** 日志记录器 */
  28 + private static final Logger LOGGER = LoggerFactory.getLogger(CarsServiceImpl.class);
  29 +
  30 + @Autowired
  31 + private DataToolsProperties dataToolsProperties;
  32 +
  33 + @Override
  34 + public void importData(File file, Map<String, Object> params) throws ScheduleException {
  35 + try {
  36 + LOGGER.info("//---------------- 导入车辆基础信息 start... ----------------//");
  37 + // 创建ktr转换所需参数
  38 + Map<String, Object> ktrParms = new HashMap<>();
  39 + File ktrFile = new File(this.getClass().getResource(
  40 + dataToolsProperties.getCarsDatainputktr()).toURI());
  41 +
  42 + // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径
  43 + ktrParms.put("transpath", ktrFile.getAbsolutePath());
  44 + ktrParms.put("filepath", file.getAbsolutePath());
  45 + ktrParms.put("erroroutputdir", dataToolsProperties.getTransErrordir());
  46 +
  47 + super.importData(file, ktrParms);
  48 +
  49 + LOGGER.info("//---------------- 导入车辆基础信息 success... ----------------//");
  50 + } catch (Exception exp) {
  51 + LOGGER.info("//---------------- 导入车辆基础信息 failed... ----------------//");
  52 +
  53 + StringWriter sw = new StringWriter();
  54 + exp.printStackTrace(new PrintWriter(sw));
  55 + LOGGER.info(sw.toString());
  56 +
  57 + throw new ScheduleException(exp.getMessage());
  58 + }
  59 + }
  60 +
  61 + @Override
  62 + public File exportData(Map<String, Object> params) throws ScheduleException {
  63 + try {
  64 + LOGGER.info("//---------------- 导出车辆基础信息 start... ----------------//");
  65 + // 创建ktr转换所需参数
  66 + Map<String, Object> ktrParms = new HashMap<>();
  67 + File ktrFile = new File(this.getClass().getResource(
  68 + dataToolsProperties.getCarsDataoutputktr()).toURI());
  69 +
  70 + // 通用参数,转换文件路径,excel输出文件名
  71 + ktrParms.put("transpath", ktrFile.getAbsolutePath());
  72 + ktrParms.put("filename", "车辆基础信息_download-");
  73 +
  74 + File file = super.exportData(ktrParms);
  75 +
  76 + LOGGER.info("//---------------- 导出车辆基础信息 success... ----------------//");
  77 +
  78 + return file;
  79 +
  80 + } catch (Exception exp) {
  81 + LOGGER.info("//---------------- 导出车辆基础信息 failed... ----------------//");
  82 +
  83 + StringWriter sw = new StringWriter();
  84 + exp.printStackTrace(new PrintWriter(sw));
  85 + LOGGER.info(sw.toString());
  86 +
  87 + throw new ScheduleException(exp.getMessage());
  88 + }
  89 + }
18 90  
19 91 @Override
20 92 @Transactional
... ...
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
... ... @@ -3,7 +3,7 @@ package com.bsth.service.schedule.impl;
3 3 import com.bsth.entity.schedule.EmployeeConfigInfo;
4 4 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
5 5 import com.bsth.service.schedule.EmployeeConfigInfoService;
6   -import com.bsth.service.schedule.ScheduleException;
  6 +import com.bsth.service.schedule.exception.ScheduleException;
7 7 import com.bsth.service.schedule.ScheduleRule1FlatService;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.stereotype.Service;
... ...
src/main/java/com/bsth/service/schedule/impl/EmployeeServiceImpl.java
... ... @@ -2,19 +2,92 @@ package com.bsth.service.schedule.impl;
2 2  
3 3 import com.bsth.entity.Personnel;
4 4 import com.bsth.service.schedule.EmployeeService;
5   -import com.bsth.service.schedule.ScheduleException;
  5 +import com.bsth.service.schedule.exception.ScheduleException;
  6 +import com.bsth.service.schedule.utils.DataToolsProperties;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.boot.context.properties.EnableConfigurationProperties;
6 11 import org.springframework.stereotype.Service;
7 12 import org.springframework.transaction.annotation.Transactional;
8 13 import org.springframework.util.CollectionUtils;
9 14  
  15 +import java.io.File;
  16 +import java.io.PrintWriter;
  17 +import java.io.StringWriter;
10 18 import java.util.HashMap;
11 19 import java.util.Map;
12 20  
13 21 /**
14 22 * Created by xu on 16/12/15.
15 23 */
  24 +@EnableConfigurationProperties(DataToolsProperties.class)
16 25 @Service
17 26 public class EmployeeServiceImpl extends BServiceImpl<Personnel, Integer> implements EmployeeService {
  27 + /** 日志记录器 */
  28 + private static final Logger LOGGER = LoggerFactory.getLogger(EmployeeServiceImpl.class);
  29 +
  30 + @Autowired
  31 + private DataToolsProperties dataToolsProperties;
  32 +
  33 + @Override
  34 + public void importData(File file, Map<String, Object> params) throws ScheduleException {
  35 + try {
  36 + LOGGER.info("//---------------- 导入人员基础信息 start... ----------------//");
  37 + // 创建ktr转换所需参数
  38 + Map<String, Object> ktrParms = new HashMap<>();
  39 + File ktrFile = new File(this.getClass().getResource(
  40 + dataToolsProperties.getEmployeesDatainputktr()).toURI());
  41 +
  42 + // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径
  43 + ktrParms.put("transpath", ktrFile.getAbsolutePath());
  44 + ktrParms.put("filepath", file.getAbsolutePath());
  45 + ktrParms.put("erroroutputdir", dataToolsProperties.getTransErrordir());
  46 +
  47 + super.importData(file, ktrParms);
  48 +
  49 + LOGGER.info("//---------------- 导入人员基础信息 success... ----------------//");
  50 + } catch (Exception exp) {
  51 + LOGGER.info("//---------------- 导入人员基础信息 failed... ----------------//");
  52 +
  53 + StringWriter sw = new StringWriter();
  54 + exp.printStackTrace(new PrintWriter(sw));
  55 + LOGGER.info(sw.toString());
  56 +
  57 + throw new ScheduleException(exp.getMessage());
  58 + }
  59 + }
  60 +
  61 + @Override
  62 + public File exportData(Map<String, Object> params) throws ScheduleException {
  63 + try {
  64 + LOGGER.info("//---------------- 导出人员基础信息 start... ----------------//");
  65 + // 创建ktr转换所需参数
  66 + Map<String, Object> ktrParms = new HashMap<>();
  67 + File ktrFile = new File(this.getClass().getResource(
  68 + dataToolsProperties.getEmployeesDataoutputktr()).toURI());
  69 +
  70 + // 通用参数,转换文件路径,excel输出文件名
  71 + ktrParms.put("transpath", ktrFile.getAbsolutePath());
  72 + ktrParms.put("filename", "人员基础信息_download-");
  73 +
  74 + File file = super.exportData(ktrParms);
  75 +
  76 + LOGGER.info("//---------------- 导出人员基础信息 success... ----------------//");
  77 +
  78 + return file;
  79 +
  80 + } catch (Exception exp) {
  81 + LOGGER.info("//---------------- 导出人员基础信息 failed... ----------------//");
  82 +
  83 + StringWriter sw = new StringWriter();
  84 + exp.printStackTrace(new PrintWriter(sw));
  85 + LOGGER.info(sw.toString());
  86 +
  87 + throw new ScheduleException(exp.getMessage());
  88 + }
  89 + }
  90 +
18 91 @Override
19 92 @Transactional
20 93 public void validate_gh(Personnel personnel) throws ScheduleException {
... ...
src/main/java/com/bsth/service/schedule/impl/GuideboardInfoServiceImpl.java
... ... @@ -3,7 +3,7 @@ package com.bsth.service.schedule.impl;
3 3 import com.bsth.entity.schedule.GuideboardInfo;
4 4 import com.bsth.entity.schedule.TTInfoDetail;
5 5 import com.bsth.service.schedule.GuideboardInfoService;
6   -import com.bsth.service.schedule.ScheduleException;
  6 +import com.bsth.service.schedule.exception.ScheduleException;
7 7 import com.bsth.service.schedule.TTInfoDetailService;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.stereotype.Service;
... ...
src/main/java/com/bsth/service/schedule/impl/RerunServiceImpl.java
... ... @@ -2,7 +2,7 @@ package com.bsth.service.schedule.impl;
2 2  
3 3 import com.bsth.entity.schedule.rule.RerunRule;
4 4 import com.bsth.service.schedule.RerunService;
5   -import com.bsth.service.schedule.ScheduleException;
  5 +import com.bsth.service.schedule.exception.ScheduleException;
6 6 import org.springframework.stereotype.Service;
7 7 import org.springframework.transaction.annotation.Transactional;
8 8  
... ...
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.CarPark;
  4 +import com.bsth.entity.LineInformation;
  5 +import com.bsth.entity.StationRoute;
  6 +import com.bsth.entity.schedule.GuideboardInfo;
  7 +import com.bsth.entity.schedule.TTInfoDetail;
  8 +import com.bsth.repository.schedule.TTInfoDetailRepository;
  9 +import com.bsth.service.CarParkService;
  10 +import com.bsth.service.LineInformationService;
  11 +import com.bsth.service.StationRouteService;
  12 +import com.bsth.service.schedule.GuideboardInfoService;
  13 +import com.bsth.service.schedule.TTInfoDetailService;
  14 +import com.bsth.service.schedule.exception.ScheduleException;
  15 +import com.bsth.service.schedule.utils.DataToolsProperties;
  16 +import jxl.Cell;
  17 +import jxl.Sheet;
  18 +import jxl.Workbook;
  19 +import jxl.write.Label;
  20 +import jxl.write.WritableSheet;
  21 +import jxl.write.WritableWorkbook;
  22 +import org.apache.commons.lang3.StringUtils;
  23 +import org.joda.time.DateTime;
  24 +import org.slf4j.Logger;
  25 +import org.slf4j.LoggerFactory;
  26 +import org.springframework.beans.factory.annotation.Autowired;
  27 +import org.springframework.boot.context.properties.EnableConfigurationProperties;
  28 +import org.springframework.stereotype.Service;
  29 +import org.springframework.util.CollectionUtils;
  30 +
  31 +import java.io.File;
  32 +import java.io.PrintWriter;
  33 +import java.io.StringWriter;
  34 +import java.util.*;
  35 +import java.util.regex.Matcher;
  36 +import java.util.regex.Pattern;
  37 +
  38 +/**
  39 + * Created by xu on 17/1/3.
  40 + */
  41 +@Service
  42 +@EnableConfigurationProperties(DataToolsProperties.class)
  43 +public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> implements TTInfoDetailService {
  44 + /** 日志记录器 */
  45 + private static final Logger LOGGER = LoggerFactory.getLogger(TTInfoDetailServiceImpl.class);
  46 +
  47 + @Autowired
  48 + private GuideboardInfoService guideboardInfoService;
  49 + @Autowired
  50 + private StationRouteService stationRouteService;
  51 + @Autowired
  52 + private LineInformationService lineInformationService;
  53 + @Autowired
  54 + private CarParkService carParkService;
  55 + @Autowired
  56 + private TTInfoDetailRepository ttInfoDetailRepository;
  57 + @Autowired
  58 + private DataToolsProperties dataToolsProperties;
  59 +
  60 + @Override
  61 + public TTInfoDetail findById(Long aLong) {
  62 + return ttInfoDetailRepository.findOneExtend(aLong);
  63 + }
  64 +
  65 + @Override
  66 + public void importData(
  67 + File file,
  68 + Map<String, Object> params) throws ScheduleException {
  69 +
  70 + try {
  71 + LOGGER.info("//---------------- 导入时刻表明细 start... ----------------//");
  72 +
  73 + String filename = file.getAbsolutePath(); // xls文件名
  74 + String sheetname = String.valueOf(params.get("sheetname")); // sheet名字
  75 + Long ttid = Long.valueOf(String.valueOf(params.get("ttid"))); // 时刻表id
  76 + Long xlid = Long.valueOf(String.valueOf(params.get("xlid"))); // 线路id
  77 + Integer lineid = Integer.valueOf(String.valueOf(params.get("lineinfo"))); // 线路标准id
  78 + String xlname = String.valueOf(params.get("xlname")); // 线路名字
  79 + String ttname = String.valueOf(params.get("ttname")); // 时刻表名字
  80 +
  81 + LOGGER.info("参数1, xls文件名={},sheet名字={}", filename, sheetname);
  82 + LOGGER.info("参数2, 线路id={},线路名字={}", xlid, xlname);
  83 + LOGGER.info("参数3, 时刻表id={},时刻表名字={}", ttid, ttname);
  84 +
  85 + LOGGER.info("转换xls文件格式成文本格式...");
  86 + // 1、修改已经上传的excel文件,在每个起点站后标示数字,表示第几个班次
  87 + // 2、由于格式问题,需要把内容都转换成字符串
  88 + List<String> colList = new ArrayList<>();
  89 + Workbook workbook = Workbook.getWorkbook(new File(filename));
  90 + Sheet sheet = workbook.getSheet(sheetname);
  91 + Cell[] cells = sheet.getRow(0);
  92 + for (int i = 0; i < cells.length; i++) {
  93 + if (i == 0) {
  94 + colList.add(cells[i].getContents().trim());
  95 + } else {
  96 + colList.add(cells[i].getContents() + i);
  97 + }
  98 + }
  99 +
  100 + File fileCal = new File(filename + "_stringType.xls");
  101 + WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal, workbook);
  102 + WritableSheet sheet1 = writableWorkbook.getSheet(sheetname);
  103 + for (int i = 0; i < sheet1.getColumns(); i++) { // 第一行数据
  104 + sheet1.addCell(new Label(i, 0, colList.get(i)));
  105 + }
  106 + for (int i = 1; i < sheet1.getRows(); i++) { // 第二行开始
  107 + Cell[] cells1 = sheet.getRow(i);
  108 + for (int j = 0; j < cells1.length; j++) {
  109 + sheet1.addCell(new Label(j, i, cells1[j].getContents()));
  110 + }
  111 + }
  112 + writableWorkbook.write();
  113 + writableWorkbook.close();
  114 +
  115 + // 2、删除原有数据
  116 + // 操作在ktr内部执行
  117 +
  118 + // 3、导入时刻表
  119 + // 获取停车场名字
  120 + LOGGER.info("获取停车场名字...");
  121 + LineInformation lineInformation = lineInformationService.findById(lineid);
  122 + Map<String, Object> p1 = new HashMap<>();
  123 + p1.put("parkCode_eq", lineInformation.getCarPark());
  124 + List<CarPark> carParkList = (List<CarPark>) carParkService.list(p1);
  125 + String tccname = carParkList.get(0).getParkName();
  126 + LOGGER.info("停车场名字={}", tccname);
  127 +
  128 +
  129 + // 计算表头参数
  130 + Workbook book = Workbook.getWorkbook(fileCal);
  131 + Sheet sheet_exp = book.getSheet(sheetname);
  132 + List<String> columnames = new ArrayList<>();
  133 + for (int i = 0; i < sheet_exp.getColumns(); i++) { // 获取第一行,数据,作为列名
  134 + columnames.add(sheet_exp.getCell(i, 0).getContents());
  135 + }
  136 + LOGGER.info("表头={}", StringUtils.join(columnames.toArray(), ","));
  137 +
  138 + // 创建ktr转换所需参数
  139 + Map<String, Object> ktrParms = new HashMap<>();
  140 + File ktrFile = new File(this.getClass().getResource(
  141 + dataToolsProperties.getTtinfodetailMetadatainputktr()).toURI());
  142 + File ktrFile2 = new File(this.getClass().getResource(
  143 + dataToolsProperties.getTtinfodetailDatainputktr()).toURI());
  144 +
  145 + // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径
  146 + ktrParms.put("transpath", ktrFile.getAbsolutePath());
  147 + ktrParms.put("filepath", fileCal.getAbsolutePath());
  148 + ktrParms.put("erroroutputdir", dataToolsProperties.getTransErrordir());
  149 +
  150 + // 附加参数
  151 + ktrParms.put("injectktrfile", ktrFile2.getAbsolutePath()); // 注入元数据的ktr文件
  152 + ktrParms.put("sheetname", sheetname); // sheet工作区的名字
  153 + ktrParms.put("xlname", xlname); // 线路名称
  154 + ktrParms.put("ttinfoname", ttname); // 时刻表名称
  155 + ktrParms.put("ttid", ttid.intValue()); // 时刻表id
  156 + ktrParms.put("tccname", tccname); // 停车场名字
  157 + ktrParms.put("excelfieldnames", StringUtils.join(columnames.toArray(), ",")); // 时刻表excel输入字段名,以逗号连接
  158 + columnames.remove(0);
  159 + ktrParms.put("normalizefieldnames", StringUtils.join(columnames.toArray(), ",")); // 数据范式化字段名,以逗号连接
  160 +
  161 + super.importData(fileCal, ktrParms);
  162 +
  163 + LOGGER.info("//---------------- 导入时刻表明细 success... ----------------//");
  164 + } catch (Exception exp) {
  165 + LOGGER.info("//---------------- 导入时刻表明细 failed... ----------------//");
  166 +
  167 + StringWriter sw = new StringWriter();
  168 + exp.printStackTrace(new PrintWriter(sw));
  169 + LOGGER.info(sw.toString());
  170 +
  171 + throw new ScheduleException(exp.getMessage());
  172 + }
  173 + }
  174 +
  175 + @Override
  176 + public File exportData(Map<String, Object> params) throws ScheduleException {
  177 + try {
  178 + LOGGER.info("//---------------- 导出时刻表明细 start... ----------------//");
  179 +
  180 + // 创建ktr转换所需参数
  181 + Map<String, Object> ktrParms = new HashMap<>();
  182 + File ktrFile = new File(this.getClass().getResource(
  183 + dataToolsProperties.getTtinfodetailMetaoutput()).toURI());
  184 + File ktrFile2 = new File(this.getClass().getResource(
  185 + dataToolsProperties.getTtinfodetailOutput()).toURI());
  186 +
  187 + // 通用参数,转换文件路径,excel输出文件名
  188 + ktrParms.put("transpath", ktrFile.getAbsolutePath());
  189 + ktrParms.put("filename", String.format("时刻表_(id=%s)_download-", String.valueOf(params.get("ttinfoid"))));
  190 +
  191 + // 附加参数
  192 + ktrParms.put("injectktrfile", ktrFile2.getAbsolutePath()); // 注入元数据的ktr文件
  193 + ktrParms.put("ttinfoid", String.valueOf(params.get("ttinfoid")));
  194 +
  195 + File file = super.exportData(ktrParms);
  196 +
  197 + LOGGER.info("//---------------- 导出时刻表明细 success... ----------------//");
  198 +
  199 + return file;
  200 + } catch (Exception exp) {
  201 + LOGGER.info("//---------------- 导出时刻表明细 failed... ----------------//");
  202 +
  203 + StringWriter sw = new StringWriter();
  204 + exp.printStackTrace(new PrintWriter(sw));
  205 + LOGGER.info(sw.toString());
  206 +
  207 + throw new ScheduleException(exp.getMessage());
  208 + }
  209 + }
  210 +
  211 + @Override
  212 + public EditInfo getEditInfo(Integer xlid, Long ttid) throws ScheduleException {
  213 + try {
  214 + LOGGER.info("//---------------- 时刻表编辑用数据输出 start... ----------------//");
  215 +
  216 + // 创建ktr转换所需参数
  217 + Map<String, Object> ktrParms = new HashMap<>();
  218 + File ktrFile = new File(this.getClass().getResource(
  219 + dataToolsProperties.getTtinfodetailForeditktr()).toURI());
  220 +
  221 + // 通用参数,转换文件路径,excel输出文件名,错误输出文件路径
  222 + ktrParms.put("transpath", ktrFile.getAbsolutePath());
  223 + ktrParms.put("filename", "todo");
  224 +
  225 + // 附加参数
  226 + String outputFilePath = String.format("ttinfodetail_(id=%s)_foredit-%s",
  227 + String.valueOf(ttid), new DateTime().toString("yyyyMMddHHmmss"));
  228 +
  229 + ktrParms.put("tempfilepath", dataToolsProperties.getTransTempdir() + File.separator + outputFilePath); // 数据输出文件路径
  230 + ktrParms.put("xlid", String.valueOf(xlid));
  231 + ktrParms.put("ttid", String.valueOf(ttid));
  232 +
  233 + super.exportData(ktrParms);
  234 +
  235 + // 1.6、获取最大的发车数,用于输出数据的数量
  236 + Long maxfcno = ttInfoDetailRepository.findMaxFcno(xlid, ttid);
  237 + if (maxfcno == null)
  238 + return new EditInfo();
  239 +
  240 + // 2、读取ktr生成的excel数据,组织编辑用数据返回
  241 + // 2-1、读取Excel文件
  242 + Workbook book = Workbook.getWorkbook(new File(dataToolsProperties.getTransTempdir() +
  243 + File.separator + outputFilePath + ".xls"));
  244 + Sheet sheet = book.getSheet(0);
  245 + EditInfo editInfo = new EditInfo();
  246 + // 2-2、处理数据
  247 + int all_bc = 0; // 总班次
  248 + double all_lc_ks = 0; // 总空驶里程
  249 + double all_lc_yy = 0; // 总营运里程
  250 +
  251 + String[] headarrays = new String[maxfcno.intValue() + 3];
  252 + headarrays[0] = "路牌";
  253 + headarrays[maxfcno.intValue() + 1] = "空驶班次/空驶里程";
  254 + headarrays[maxfcno.intValue() + 2] = "运营班次/运营里程";
  255 +
  256 + for (int r = 1; r < sheet.getRows(); r++) {
  257 + List<FcInfo> fcInfos = new ArrayList<>();
  258 + // 每行第一列都是路牌
  259 + fcInfos.add(new FcInfo(null, null, sheet.getCell(0, r).getContents(), null, null)); // 用fcsj放置路牌显示
  260 +
  261 + int bc_ks = 0; // 空驶班次
  262 + int bc_yy = 0; // 营运班次
  263 + double lc_ks = 0; // 空驶里程
  264 + double lc_yy = 0; // 营运里程
  265 +
  266 + for (int c = 1; c <= maxfcno * 7; ) {
  267 + String ttdid_str = sheet.getCell(c, r).getContents(); // 时刻表明细id
  268 + String fcsj = sheet.getCell(c + 1, r).getContents(); // 发车时间
  269 + String jhlc = sheet.getCell(c + 2, r).getContents(); // 计划里程
  270 + String fzdname = sheet.getCell(c + 3, r).getContents(); // 发车站点名称
  271 + String bctype = sheet.getCell(c + 4, r).getContents(); // 班次类型
  272 + String xldir = sheet.getCell(c + 5, r).getContents(); // 线路上下行
  273 + String isfb = sheet.getCell(c + 6, r).getContents(); // 是否分班
  274 +
  275 + FcInfo fcInfo = new FcInfo(ttdid_str, bctype, fcsj, xldir, isfb);
  276 +
  277 + if (StringUtils.isNotEmpty(fzdname))
  278 + headarrays[(int)(c / 7) + 1] = fzdname;
  279 + fcInfos.add(fcInfo);
  280 +
  281 + c += 7;
  282 +
  283 + // 计算班次里程
  284 + if (StringUtils.isNotEmpty(jhlc)) {
  285 + if ("in".equals(bctype) || "out".equals(bctype)) {
  286 + bc_ks += 1;
  287 + lc_ks += Double.valueOf(jhlc);
  288 +
  289 + all_bc += 1;
  290 + all_lc_ks += Double.valueOf(jhlc);
  291 +
  292 + } else {
  293 + bc_yy += 1;
  294 + lc_yy += Double.valueOf(jhlc);
  295 +
  296 + all_bc += 1;
  297 + all_lc_yy += Double.valueOf(jhlc);
  298 + }
  299 + }
  300 +
  301 + }
  302 +
  303 + // 添加一列 空驶班次/空驶里程,fcsj放置数据
  304 + fcInfos.add(new FcInfo(null, null, String.format("%d/%.2f", bc_ks, lc_ks), null, null));
  305 +
  306 + // 添加一列 营运班次/营运里程,fcsj放置数据
  307 + fcInfos.add(new FcInfo(null, null, String.format("%d/%.2f", bc_yy, lc_yy), null, null));
  308 +
  309 + editInfo.getContents().add(fcInfos);
  310 + }
  311 + editInfo.getHeader().addAll(Arrays.asList(headarrays));
  312 +
  313 + editInfo.setYy_desc(String.format("班次=%d,空驶里程=%.2f,营运里程=%.2f", all_bc, all_lc_ks, all_lc_yy));
  314 +
  315 + LOGGER.info("//---------------- 时刻表编辑用数据输出 success... ----------------//");
  316 +
  317 + return editInfo;
  318 + } catch (Exception exp) {
  319 + LOGGER.info("//---------------- 时刻表编辑用数据输出 failed... ----------------//");
  320 +
  321 + StringWriter sw = new StringWriter();
  322 + exp.printStackTrace(new PrintWriter(sw));
  323 + LOGGER.info(sw.toString());
  324 +
  325 + throw new ScheduleException(exp.getMessage());
  326 + }
  327 + }
  328 +
  329 +
  330 +
  331 + @Override
  332 + public void validateExcelSheet(String filename, String sheetname, Integer lineid, String linename) throws ScheduleException {
  333 + try {
  334 + Workbook book = Workbook.getWorkbook(new File(filename));
  335 + Sheet sheet = book.getSheet(sheetname);
  336 + if (sheet.getRows() == 0 || sheet.getColumns() == 0) { // 工作区是否为空
  337 + throw new Exception(String.format("%s 工作区没有数据!", sheetname));
  338 + } else {
  339 + if (sheet.getRows() <= 1 || sheet.getColumns() <= 1) {
  340 + throw new Exception(String.format("工作区至少包含2行2列的数据"));
  341 + } else {
  342 + Cell[] cells = sheet.getRow(0); // 获取第一行数据列
  343 + for (int i = 0; i < cells.length; i++) {
  344 + String cell_con = cells[i].getContents();
  345 +
  346 + if (StringUtils.isEmpty(cell_con)) {
  347 + throw new Exception(String.format("第1行,第%d列数据不能为空", i + 1));
  348 + } else {
  349 + // 正则表达式去除数字
  350 + cell_con = cell_con.replaceAll("[\\d+]", "");
  351 +
  352 + if (i == 0) { // 第一列必须是路牌2个字
  353 + if (!"路牌".equals(cell_con.trim())) {
  354 + throw new Exception("第1行,第1列数据必须是路牌2个字");
  355 + }
  356 + } else { // 排除出场,进场,其余内容到站点路由里查询,以各个方向的起点站为查询依据
  357 + if ((!"出场".equals(cell_con.trim())) &&
  358 + (!"进场".equals(cell_con.trim()))) {
  359 + Map<String, Object> p1 = new HashMap<>();
  360 + p1.put("line.id_eq", lineid);
  361 + p1.put("stationName_eq", cell_con.trim());
  362 + p1.put("stationMark_eq", "B");
  363 +
  364 +
  365 + // TODO:这里要修改(起点站有启用撤销的标志的)
  366 +
  367 + List<StationRoute> stationRouteList = (List<StationRoute>) stationRouteService.list(p1);
  368 + if (CollectionUtils.isEmpty(stationRouteList)) {
  369 + throw new Exception(String.format("第1行,第%d列数据%s在%s站点路由中不是起点站", i + 1, cell_con.trim(), linename));
  370 + } else if (stationRouteList.size() > 1) {
  371 + throw new Exception(String.format("第1行,第%d列数据%s在%s站点路由中上下行都是起点站", i + 1, cell_con.trim(), linename));
  372 + }
  373 + }
  374 +
  375 + }
  376 + }
  377 + }
  378 +
  379 + // 验证路牌内容
  380 + Map<String, Integer> gbindexmap = new HashMap<>(); // 记录每个路牌在第几行
  381 + for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
  382 + Cell bcell = sheet.getRow(i)[0]; // 获取第1列
  383 + String bcell_con = bcell.getContents();
  384 + if (StringUtils.isEmpty(bcell_con)) {
  385 + throw new Exception(String.format("第%d行,第1列路牌无数据", i + 1));
  386 + } else if (gbindexmap.get(bcell_con.trim()) != null) {
  387 + throw new Exception(String.format("第%d行,第1列的路牌数据与第%d行,第1列数据重复",
  388 + i + 1,
  389 + gbindexmap.get(bcell_con.trim())));
  390 + } else {
  391 + Map<String, Object> p2 = new HashMap<>();
  392 + p2.put("xl.id_eq", lineid);
  393 + p2.put("lpName_eq", bcell_con.trim());
  394 + List<GuideboardInfo> guideboardInfoList = (List<GuideboardInfo>) guideboardInfoService.list(p2);
  395 + if (CollectionUtils.isEmpty(guideboardInfoList)) {
  396 + throw new Exception(String.format("第%d行,第1列的路牌在%s中不存在", i + 1, linename));
  397 + } else if (guideboardInfoList.size() > 1) {
  398 + throw new Exception(String.format("第%d行,第1列的路牌在%s中重复", i + 1, linename));
  399 + } else {
  400 + gbindexmap.put(bcell_con.trim(), i + 1);
  401 + }
  402 + }
  403 + }
  404 +
  405 + // 班次时间验证,正则表达式,格式hh:mm或者hhmm
  406 + String el = "^(([0-1]\\d)|(2[0-4])):[0-5]\\d$"; // hh:mm格式
  407 + String el2 = "^(([0-1]\\d)|(2[0-4]))[0-5]\\d$"; // hhmm格式
  408 + Pattern p = Pattern.compile(el);
  409 + Pattern p2 = Pattern.compile(el2);
  410 +
  411 + for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
  412 + Cell[] bcells = sheet.getRow(i);
  413 + for (int j = 1; j < bcells.length; j++) { // 从第2列开始
  414 + String bcell_con = bcells[j].getContents();
  415 + if (StringUtils.isNotEmpty(bcell_con)) {
  416 + Matcher m = p.matcher(bcell_con.trim());
  417 + Matcher m2 = p2.matcher(bcell_con.trim());
  418 + if ((!m.matches()) && (!m2.matches())) {
  419 + throw new Exception(String.format("第%d行,第%d列的发车时间格式不正确,格式应为hh:mm或hhmm", i + 1, j + 1));
  420 + }
  421 + }
  422 + }
  423 + }
  424 + }
  425 +
  426 + }
  427 + } catch (Exception exp) {
  428 + throw new ScheduleException(exp.getMessage());
  429 + }
  430 +
  431 + }
  432 +
  433 + @Override
  434 + public void validateAssoLineInfo(Integer lineinfoid) throws ScheduleException {
  435 + LineInformation lineInformation = lineInformationService.findById(lineinfoid);
  436 + if (lineInformation.getUpInMileage() == null) {
  437 + throw new ScheduleException("上行进场里程为空");
  438 + } else if (lineInformation.getUpInTimer() == null) {
  439 + throw new ScheduleException("上行进场时间为空");
  440 + } else if (lineInformation.getUpOutMileage() == null) {
  441 + throw new ScheduleException("上行出场里程为空");
  442 + } else if (lineInformation.getUpOutTimer() == null) {
  443 + throw new ScheduleException("上行出场时间为空");
  444 + } else if (lineInformation.getUpMileage() == null) {
  445 + throw new ScheduleException("上行班次里程为空");
  446 + } else if (lineInformation.getUpTravelTime() == null) {
  447 + throw new ScheduleException("上行班次时间为空");
  448 + } else if (lineInformation.getDownInMileage() == null) {
  449 + throw new ScheduleException("下行进场里程为空");
  450 + } else if (lineInformation.getDownInTimer() == null) {
  451 + throw new ScheduleException("下行进场时间为空");
  452 + } else if (lineInformation.getDownOutMileage() == null) {
  453 + throw new ScheduleException("下行出场里程为空");
  454 + } else if (lineInformation.getDownOutTimer() == null) {
  455 + throw new ScheduleException("下行出场时间为空");
  456 + } else if (lineInformation.getDownMileage() == null) {
  457 + throw new ScheduleException("下行班次里程为空");
  458 + } else if (lineInformation.getDownTravelTime() == null) {
  459 + throw new ScheduleException("下行班次时间为空");
  460 + } else if (StringUtils.isEmpty(lineInformation.getCarPark())) {
  461 + throw new ScheduleException("停车场必须选择");
  462 + }
  463 +
  464 + // 单独验证停车场信息
  465 + String tcccode = lineInformation.getCarPark();
  466 + Map<String, Object> p1 = new HashMap<>();
  467 + p1.put("parkCode_eq", tcccode);
  468 + List<CarPark> carParkList = (List<CarPark>) carParkService.list(p1);
  469 + if (CollectionUtils.isEmpty(carParkList)) {
  470 + throw new ScheduleException(String.format("线路标准里的停车场code=%s,在停车场信息中未找到", tcccode));
  471 + } else if (carParkList.size() > 1) {
  472 + throw new ScheduleException(String.format("线路标准里的停车场code=%s,在停车场信息中有重复数据", tcccode));
  473 + } else {
  474 + CarPark carPark = carParkList.get(0);
  475 + if (StringUtils.isEmpty(carPark.getParkName())) {
  476 + throw new ScheduleException(String.format("线路标准里的停车场code=%s,在停车场信息中没有停车场名字", tcccode));
  477 + }
  478 + }
  479 +
  480 + }
  481 +
  482 + @Override
  483 + public List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) {
  484 + return ttInfoDetailRepository.findBcdetails(xlId, ttinfoId, lpId);
  485 + }
  486 +}
... ...
src/main/java/com/bsth/service/schedule/impl/TTInfoServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
3 3 import com.bsth.entity.schedule.TTInfo;
4   -import com.bsth.service.schedule.ScheduleException;
  4 +import com.bsth.service.schedule.exception.ScheduleException;
5 5 import com.bsth.service.schedule.TTInfoService;
6 6 import org.apache.commons.lang3.StringUtils;
7 7 import org.springframework.stereotype.Service;
... ...
src/main/java/com/bsth/service/schedule/utils/DataToolsService.java 0 → 100644
  1 +package com.bsth.service.schedule.utils;
  2 +
  3 +import com.bsth.service.schedule.exception.ScheduleException;
  4 +
  5 +import java.io.File;
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * 数据服务接口。
  10 + */
  11 +public interface DataToolsService {
  12 + //----------------- 数据服务操作 --------------//
  13 + // 上传文件
  14 + File uploadFile(String filename, byte[] filedata) throws ScheduleException;
  15 + // 导入数据
  16 + void importData(File file, Map<String, Object> params) throws ScheduleException;
  17 + // 导出数据
  18 + File exportData(Map<String, Object> params) throws ScheduleException;
  19 +}
... ...
src/main/java/com/bsth/service/schedule/utils/DataToolsServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.utils;
  2 +
  3 +import com.bsth.service.schedule.exception.ScheduleException;
  4 +import com.google.common.io.Files;
  5 +import org.apache.tika.Tika;
  6 +import org.joda.time.DateTime;
  7 +import org.pentaho.di.core.KettleEnvironment;
  8 +import org.pentaho.di.core.logging.KettleLogStore;
  9 +import org.pentaho.di.core.logging.LoggingBuffer;
  10 +import org.pentaho.di.core.logging.LoggingRegistry;
  11 +import org.pentaho.di.core.util.EnvUtil;
  12 +import org.pentaho.di.trans.Trans;
  13 +import org.pentaho.di.trans.TransMeta;
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
  16 +import org.springframework.beans.factory.InitializingBean;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.boot.context.properties.EnableConfigurationProperties;
  19 +import org.springframework.stereotype.Service;
  20 +
  21 +import java.io.File;
  22 +import java.io.PrintWriter;
  23 +import java.io.StringWriter;
  24 +import java.util.HashMap;
  25 +import java.util.Map;
  26 +import java.util.Properties;
  27 +
  28 +/**
  29 + * Created by xu on 17/1/3.
  30 + */
  31 +@Service
  32 +@EnableConfigurationProperties(DataToolsProperties.class)
  33 +public class DataToolsServiceImpl implements DataToolsService, InitializingBean {
  34 + /** 日志记录器 */
  35 + private static final Logger LOGGER = LoggerFactory.getLogger(DataToolsServiceImpl.class);
  36 +
  37 + @Autowired
  38 + private DataToolsProperties dataToolsProperties;
  39 +
  40 + /**
  41 + * 自定义kettle环境初始化定义。
  42 + */
  43 + private void ktrEnvironmentInit() throws Exception {
  44 + // 由于kettle.properties可能没有(没有安装过kettle),
  45 + // 导致 EnvUtil.environmentInit() 报找不到kettle.properties文件
  46 + // 所以这里重写 EnvUtil.environmentInit() 方法
  47 +
  48 + if (Thread.currentThread().getContextClassLoader() == null) {
  49 + Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
  50 + }
  51 +
  52 + // 获取配置文件
  53 + File file = new File(getClass().getResource(dataToolsProperties.getKettleProperties()).toURI());
  54 + Properties kettleProperties = EnvUtil.readProperties(file.getAbsolutePath());
  55 + EnvUtil.applyKettleProperties(kettleProperties);
  56 + System.getProperties().put("Internal.Cluster.Size", "1");
  57 + System.getProperties().put("Internal.Slave.Transformation.Number", "0");
  58 + System.getProperties().put("Internal.Slave.Server.Name", "slave-trans-name");
  59 + System.getProperties().put("Internal.Step.CopyNr", "0");
  60 + System.getProperties().put("Internal.Step.Name", "step-name");
  61 + System.getProperties().put("Internal.Step.Partition.ID", "partition-id");
  62 + System.getProperties().put("Internal.Step.Partition.Number", "0");
  63 + System.getProperties().put("Internal.Step.Unique.Count", "1");
  64 + System.getProperties().put("Internal.Step.Unique.Number", "0");
  65 + if (!kettleProperties.containsKey("vfs.sftp.org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder.USER_DIR_IS_ROOT")) {
  66 + System.getProperties().put("vfs.sftp.org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder.USER_DIR_IS_ROOT", "false");
  67 + }
  68 +
  69 + }
  70 +
  71 + @Override
  72 + public void afterPropertiesSet() throws Exception {
  73 + // 初始化kettle环境(自定义)
  74 + ktrEnvironmentInit();
  75 +
  76 + // 添加全局ktr变量,并覆盖原来的设置
  77 + Map<String, String> kvars = new HashMap<>();
  78 + kvars.put("v_db_ip", dataToolsProperties.getKvarsDbip());
  79 + kvars.put("v_db_uname", dataToolsProperties.getKvarsDbuname());
  80 + kvars.put("v_db_pwd", dataToolsProperties.getKvarsDbpwd());
  81 + kvars.put("v_db_dname", dataToolsProperties.getKvarsDbdname());
  82 + EnvUtil.applyKettleProperties(kvars, true);
  83 + KettleEnvironment.init();
  84 + }
  85 +
  86 + @Override
  87 + public File uploadFile(String filename, byte[] filedata) throws ScheduleException {
  88 + // 上传文件
  89 + try {
  90 + LOGGER.info("start uploadFile...originalFilename={}", filename);
  91 + File newFile = new File(dataToolsProperties.getFileuploadDir() + File.separator +
  92 + filename + "-upload-" + new DateTime().toString("yyyyMMddHHmmss") + ".xls");
  93 + // TODO:判定是否excel数据
  94 + Tika tika = new Tika();
  95 + String type = tika.detect(filedata);
  96 + // application/x-tika-msoffice
  97 + LOGGER.info("文件格式={}", type);
  98 + if ("application/vnd.ms-excel".equals(type) || "application/x-tika-msoffice".equals(type)) {
  99 + // .xls 2007的格式
  100 + Files.write(filedata, newFile);
  101 + } else if ("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(type)) {
  102 + // .xlsx 2007之后的格式
  103 + throw new Exception("暂时不支持.xlsx格式文件!");
  104 + } else {
  105 + // 非excel文件
  106 + throw new Exception("非.xls格式文件!");
  107 + }
  108 +
  109 + LOGGER.info("uploadFile success...newFilename={}", newFile.getAbsolutePath());
  110 +
  111 + return newFile;
  112 + } catch (Exception exp) {
  113 + LOGGER.info("uploadFile failed...stackTrace...");
  114 +
  115 + StringWriter sw = new StringWriter();
  116 + exp.printStackTrace(new PrintWriter(sw));
  117 + LOGGER.info(sw.toString());
  118 +
  119 + throw new ScheduleException("上传文件错误!");
  120 + }
  121 + }
  122 +
  123 + @Override
  124 + public void importData(File file, Map<String, Object> params) throws ScheduleException {
  125 + // 导入数据
  126 + String transLogId = "";
  127 + String transMetaLogId = "";
  128 + try {
  129 + LOGGER.info("start importData...originalFilename={}", file.getAbsolutePath());
  130 + // 检查参数
  131 + String transpath = String.valueOf(params.get("transpath"));
  132 + if ("null".equals(transpath)) {
  133 + throw new Exception(
  134 + "没有指定transpath参数值,无法确定ktr转换文件!");
  135 + }
  136 + File ktrFile = new File(transpath);
  137 + // 设置文件路径,错误输出文件路径参数
  138 + params.put("filepath", file.getAbsolutePath());
  139 + params.put("erroroutputdir", dataToolsProperties.getTransErrordir());
  140 +
  141 + // 2、使用kettle运行封装数据导入逻辑的ktr转换文件
  142 + // 2.1、初始化kettle(组件初始化已经做了)
  143 + // 2.2、创建转换元数据,转换
  144 + TransMeta transMeta = new TransMeta(ktrFile.getAbsolutePath());
  145 + Trans trans = new Trans(transMeta);
  146 + // 2.3、设定命名参数,用于指定数据文件,注意每个ktr必须都有以下指定的命名参数
  147 + for (String key : params.keySet()) {
  148 + trans.setParameterValue(key, String.valueOf(params.get(key)));
  149 + }
  150 + // 2.4、执行转换
  151 + trans.execute(null);
  152 + // 2.5、等待转换结束
  153 + trans.waitUntilFinished();
  154 +
  155 + // 获取日志
  156 + transLogId = trans.getLogChannelId();
  157 + transMetaLogId = transMeta.getLogChannelId();
  158 +
  159 + LoggingBuffer loggingBuffer = KettleLogStore.getAppender();
  160 + StringBuffer stringBuffer = loggingBuffer.getBuffer(
  161 + trans.getLogChannelId(), false
  162 + );
  163 + if (trans.getErrors() > 0) {
  164 + throw new Exception(stringBuffer.toString());
  165 + }
  166 + LOGGER.info(stringBuffer.toString());
  167 + LOGGER.info("importData success...");
  168 +
  169 + } catch (Exception exp) {
  170 + LOGGER.info("importData failed...statckTrace...");
  171 +
  172 + StringWriter sw = new StringWriter();
  173 + exp.printStackTrace(new PrintWriter(sw));
  174 + LOGGER.info(sw.toString());
  175 +
  176 + throw new ScheduleException("导入数据错误!");
  177 + } finally {
  178 + // 清除日志操作
  179 + KettleLogStore.discardLines(transLogId, true);
  180 + KettleLogStore.discardLines(transMetaLogId, true);
  181 + LoggingRegistry.getInstance().removeIncludingChildren(transLogId);
  182 + }
  183 + }
  184 +
  185 + @Override
  186 + public File exportData(Map<String, Object> params) throws ScheduleException {
  187 + // 导出数据
  188 + String transLogId = "";
  189 + String transMetaLogId = "";
  190 + try {
  191 + LOGGER.info("start exportData...");
  192 + // 检查参数
  193 + String filename = String.valueOf(params.get("filename"));
  194 + if ("null".equals(filename)) {
  195 + filename = "temp";
  196 + }
  197 + String transpath = String.valueOf(params.get("transpath"));
  198 + if ("null".equals(transpath)) {
  199 + throw new Exception(
  200 + "没有指定transpath参数值,无法确定ktr转换文件!");
  201 + }
  202 + File ktrFile = new File(transpath);
  203 + // 设置文件路径参数
  204 + String filepath = dataToolsProperties.getFileoutputDir() +
  205 + File.separator +
  206 + filename +
  207 + new DateTime().toString("yyyyMMddHHmmss") + ".xls";
  208 + params.put("filepath", filepath);
  209 +
  210 + // 2、使用kettle运行封装数据导入逻辑的ktr转换文件
  211 + // 2.1、初始化kettle(组件初始化已经做了)
  212 + // 2.2、创建转换元数据,转换
  213 + TransMeta transMeta = new TransMeta(ktrFile.getAbsolutePath());
  214 + Trans trans = new Trans(transMeta);
  215 + // 2.3、设定命名参数,用于指定数据文件,注意每个ktr必须都有以下指定的命名参数
  216 + for (String key : params.keySet()) {
  217 + trans.setParameterValue(key, String.valueOf(params.get(key)));
  218 + }
  219 + // 2.4、执行转换
  220 + trans.execute(null);
  221 + // 2.5、等待转换结束
  222 + trans.waitUntilFinished();
  223 +
  224 + // 获取日志
  225 + transLogId = trans.getLogChannelId();
  226 + transMetaLogId = transMeta.getLogChannelId();
  227 +
  228 + LoggingBuffer loggingBuffer = KettleLogStore.getAppender();
  229 + StringBuffer stringBuffer = loggingBuffer.getBuffer(
  230 + trans.getLogChannelId(), false
  231 + );
  232 + if (trans.getErrors() > 0) {
  233 + throw new Exception(stringBuffer.toString());
  234 + }
  235 + LOGGER.info(stringBuffer.toString());
  236 + LOGGER.info("exportData success...");
  237 +
  238 + return new File(filepath);
  239 + } catch (Exception exp) {
  240 + LOGGER.info("exportData failed...statckTrace...");
  241 +
  242 + StringWriter sw = new StringWriter();
  243 + exp.printStackTrace(new PrintWriter(sw));
  244 + LOGGER.info(sw.toString());
  245 +
  246 + throw new ScheduleException("导出数据错误!");
  247 + } finally {
  248 + // 清除日志操作
  249 + KettleLogStore.discardLines(transLogId, true);
  250 + KettleLogStore.discardLines(transMetaLogId, true);
  251 + LoggingRegistry.getInstance().removeIncludingChildren(transLogId);
  252 + }
  253 + }
  254 +}
... ...
src/main/java/com/bsth/service/sys/DutyEmployeeService.java 0 → 100644
  1 +package com.bsth.service.sys;
  2 +
  3 +import com.bsth.entity.sys.DutyEmployee;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/1/5.
  10 + */
  11 +public interface DutyEmployeeService extends BaseService<DutyEmployee, Long> {
  12 +
  13 + List<DutyEmployee> getDutyEmployee(String lineCode, String startTime, String endTime);
  14 +}
... ...
src/main/java/com/bsth/service/sys/impl/DutyEmployeeServiceImpl.java 0 → 100644
  1 +package com.bsth.service.sys.impl;
  2 +
  3 +import com.bsth.entity.sys.DutyEmployee;
  4 +import com.bsth.repository.sys.DutyEmployeeRepository;
  5 +import com.bsth.service.impl.BaseServiceImpl;
  6 +import com.bsth.service.sys.DutyEmployeeService;
  7 +import org.joda.time.format.DateTimeFormat;
  8 +import org.joda.time.format.DateTimeFormatter;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * Created by panzhao on 2017/1/5.
  17 + */
  18 +@Service
  19 +public class DutyEmployeeServiceImpl extends BaseServiceImpl<DutyEmployee, Long> implements DutyEmployeeService {
  20 +
  21 + @Autowired
  22 + DutyEmployeeRepository dutyEmployeeRepository;
  23 +
  24 + @Override
  25 + public Map<String, Object> save(DutyEmployee dutyEmployee) {
  26 + //登入时间,当前时间 - 10分钟
  27 + dutyEmployee.setTs(System.currentTimeMillis() - (1000 * 60 * 10));
  28 + return super.save(dutyEmployee);
  29 + }
  30 +
  31 +
  32 + /**
  33 + * 获取当班调度
  34 + *
  35 + * @param lineCode 线路编码
  36 + * @param startTime 开始时间 yyyy-MM-ddHH:mm
  37 + * @param endTime 结束时间 yyyy-MM-ddHH:mm
  38 + * @return
  39 + */
  40 + public List<DutyEmployee> getDutyEmployee(String lineCode, String startTime, String endTime) {
  41 + DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  42 + return dutyEmployeeRepository.findByLineAndTime(lineCode + ",", fmtyyyyMMddHHmm.parseMillis(startTime), fmtyyyyMMddHHmm.parseMillis(endTime));
  43 + }
  44 +}
... ...
src/main/java/com/bsth/websocket/handler/SendUtils.java
1 1 package com.bsth.websocket.handler;
2 2  
3   -import java.text.SimpleDateFormat;
4   -import java.util.ArrayList;
5   -import java.util.Date;
6   -import java.util.HashMap;
7   -import java.util.List;
8   -import java.util.Map;
9   -
10   -import org.slf4j.Logger;
11   -import org.slf4j.LoggerFactory;
12   -import org.springframework.beans.factory.annotation.Autowired;
13   -import org.springframework.stereotype.Component;
14   -
15 3 import com.alibaba.fastjson.JSONObject;
16 4 import com.bsth.data.BasicData;
17 5 import com.bsth.data.LineConfigData;
18   -import com.bsth.data.schedule.DayOfSchedule;
  6 +import com.bsth.data.gpsdata.arrival.entity.SignalState;
19 7 import com.bsth.entity.directive.D80;
20 8 import com.bsth.entity.realcontrol.ScheduleRealInfo;
21 9 import com.fasterxml.jackson.core.JsonProcessingException;
22 10 import com.fasterxml.jackson.databind.ObjectMapper;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +import java.text.SimpleDateFormat;
  17 +import java.util.*;
23 18  
24 19 @Component
25 20 public class SendUtils{
... ... @@ -40,7 +35,7 @@ public class SendUtils{
40 35 */
41 36 public void sendFcsj(ScheduleRealInfo sch) {
42 37 //处理出站即出场的班次
43   - connectOutSchTime(sch);
  38 + //connectOutSchTime(sch);
44 39  
45 40 Map<String, Object> map = new HashMap<>();
46 41 map.put("fn", "faChe");
... ... @@ -86,7 +81,7 @@ public class SendUtils{
86 81 */
87 82 public void sendZdsj(ScheduleRealInfo sch, ScheduleRealInfo nextSch, int finish) {
88 83 //处理进站即进场的班次
89   - connectInSchTime(sch);
  84 + //connectInSchTime(sch);
90 85  
91 86 Map<String, Object> map = new HashMap<>();
92 87 map.put("fn", "zhongDian");
... ... @@ -103,12 +98,30 @@ public class SendUtils{
103 98 logger.error("", e);
104 99 }
105 100 }
  101 +
  102 + /**
  103 + * 推送班次信号状态
  104 + * @param state
  105 + */
  106 + public void sendSignalState(SignalState state){
  107 + Map<String, Object> map = new HashMap<>();
  108 + map.put("fn", "signal_state");
  109 + map.put("data", state);
  110 +
  111 + ObjectMapper mapper = new ObjectMapper();
  112 +
  113 + try {
  114 + socketHandler.sendMessageToLine(state.getLineCode(), mapper.writeValueAsString(map));
  115 + } catch (Exception e) {
  116 + logger.error("", e);
  117 + }
  118 + }
106 119  
107 120 /**
108 121 *
109 122 * @Title: shiftSchedule
110 123 * @Description: TODO(线路翻班通知)
111   - */
  124 +
112 125 public void shiftSchedule(String lineCode){
113 126 Map<String, Object> map = new HashMap<>();
114 127 map.put("fn", "systemNotice");
... ... @@ -124,7 +137,7 @@ public class SendUtils{
124 137 logger.error("", e);
125 138 }
126 139 }
127   -
  140 + */
128 141 /**
129 142 *
130 143 * @Title: sendDirectiveToPage
... ... @@ -157,39 +170,4 @@ public class SendUtils{
157 170 list.add(sch);
158 171 refreshSch(list);
159 172 }
160   -
161   -
162   - //出站即出场
163   - public void connectOutSchTime(ScheduleRealInfo sch){
164   - try{
165   - ScheduleRealInfo twins = sch.getTwinsSch();
166   - if(twins != null
167   - && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2
168   - && twins.getBcType().equals("out")){
169   -
170   - twins.setFcsjActualAll(sch.getFcsjActualTime());
171   - //刷新关联的出场班次
172   - //refreshSch(twins);
173   - }
174   - }catch(Exception e){
175   - logger.error("", e);
176   - }
177   - }
178   -
179   - //进站即出场
180   - public void connectInSchTime(ScheduleRealInfo sch){
181   - try{
182   - ScheduleRealInfo twins = sch.getTwinsSch();
183   - if(twins != null
184   - && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2
185   - && twins.getBcType().equals("in")){
186   -
187   - twins.setZdsjActualAll(sch.getZdsjActualTime());
188   - //刷新关联的出场班次
189   - //refreshSch(twins);
190   - }
191   - }catch(Exception e){
192   - logger.error("", e);
193   - }
194   - }
195 173 }
... ...
src/main/resources/datatools/config-prod.properties
... ... @@ -15,11 +15,11 @@ datatools.kvars_dbdname=control
15 15  
16 16 # 3、上传数据配置信息
17 17 # 上传文件目录配置(根据不同的环境需要修正)
18   -datatools.fileupload_dir=/opt/bsth_control_u_d_files
  18 +datatools.fileupload_dir=/home/bsth_control_u_d_files
19 19 # ktr转换文件,中配置的错误输出目录(根据不同的环境需要修正)
20   -datatools.trans_errordir=/opt/bsth_control_u_d_files/erroroutput
  20 +datatools.trans_errordir=/home/bsth_control_u_d_files/erroroutput
21 21 # 临时输出文件目录
22   -datatools.trans_tempdir=/opt/bsth_control_u_d_files/temp
  22 +datatools.trans_tempdir=/home/bsth_control_u_d_files/temp
23 23  
24 24 ##---------------------------- 导入数据ktr ----------------------------##
25 25 # 测试temp的ktr转换文件
... ... @@ -49,7 +49,7 @@ datatools.employeesconfig_datainputktr=/datatools/ktrs/employeesConfigDataInput.
49 49  
50 50 # 4、数据导出配置信息
51 51 # 导出数据文件目录配置(根据不同的环境需要修正)
52   -datatools.fileoutput_dir=/opt/bsth_control_u_d_files
  52 +datatools.fileoutput_dir=/home/bsth_control_u_d_files
53 53  
54 54 ##---------------------------- 导出数据ktr -----------------------------##
55 55 # 车辆信息导出ktr转换
... ...
src/main/resources/datatools/ktrs/ttinfodetailDataInput.ktr
... ... @@ -1182,7 +1182,7 @@
1182 1182 <name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</name>
1183 1183 <type>ExcelInput</type>
1184 1184 <description/>
1185   - <distribute>Y</distribute>
  1185 + <distribute>N</distribute>
1186 1186 <custom_distribution/>
1187 1187 <copies>1</copies>
1188 1188 <partitioning>
... ... @@ -1837,6 +1837,12 @@
1837 1837 <condition>&#x3d;</condition>
1838 1838 <name2/>
1839 1839 </key>
  1840 + <key>
  1841 + <name>iscanceled</name>
  1842 + <field>is_cancel</field>
  1843 + <condition>&#x3d;</condition>
  1844 + <name2/>
  1845 + </key>
1840 1846 <value>
1841 1847 <name>id</name>
1842 1848 <rename>lpid</rename>
... ... @@ -2662,6 +2668,18 @@
2662 2668 </step>
2663 2669  
2664 2670 <step_error_handling>
  2671 + <error>
  2672 + <source_step>&#x63d2;&#x5165;&#x2f;&#x66f4;&#x65b0;bsth_c_s_ttinfo_detail</source_step>
  2673 + <target_step>Excel&#x8f93;&#x51fa;</target_step>
  2674 + <is_enabled>Y</is_enabled>
  2675 + <nr_valuename>c1</nr_valuename>
  2676 + <descriptions_valuename>c2</descriptions_valuename>
  2677 + <fields_valuename>c3</fields_valuename>
  2678 + <codes_valuename>c4</codes_valuename>
  2679 + <max_errors/>
  2680 + <max_pct_errors/>
  2681 + <min_pct_rows/>
  2682 + </error>
2665 2683 </step_error_handling>
2666 2684 <slave-step-copy-partition-distribution>
2667 2685 </slave-step-copy-partition-distribution>
... ...
src/main/resources/datatools/ktrs/ttinfodetailMetaData.ktr
... ... @@ -37,7 +37,7 @@
37 37 <parameter>
38 38 <name>sheetname</name>
39 39 <default_value>&#x5de5;&#x4f5c;&#x8868;1</default_value>
40   - <description/>
  40 + <description>xls sheet&#x540d;&#x5b57;</description>
41 41 </parameter>
42 42 <parameter>
43 43 <name>tccname</name>
... ... @@ -45,6 +45,11 @@
45 45 <description>&#x505c;&#x8f66;&#x573a;&#x540d;&#x5b57;</description>
46 46 </parameter>
47 47 <parameter>
  48 + <name>ttid</name>
  49 + <default_value>1</default_value>
  50 + <description>&#x65f6;&#x523b;&#x8868;id</description>
  51 + </parameter>
  52 + <parameter>
48 53 <name>ttinfoname</name>
49 54 <default_value>&#x8868;2</default_value>
50 55 <description>&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;</description>
... ... @@ -133,6 +138,7 @@
133 138 <data_tablespace/>
134 139 <index_tablespace/>
135 140 <attributes>
  141 + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
136 142 <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
137 143 <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
138 144 <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
... ... @@ -294,13 +300,14 @@
294 300 <hop> <from>&#x83b7;&#x53d6;&#x505c;&#x8f66;&#x573a;&#x540d;&#x79f0;</from><to>&#x589e;&#x52a0;&#x505c;&#x8f66;&#x573a;&#x540d;&#x79f0;metadata</to><enabled>Y</enabled> </hop>
295 301 <hop> <from>&#x589e;&#x52a0;&#x505c;&#x8f66;&#x573a;&#x540d;&#x79f0;metadata</from><to>&#x66ff;&#x6362;&#x505c;&#x8f66;&#x5382;&#x540d;&#x5b57; </to><enabled>Y</enabled> </hop>
296 302 <hop> <from>&#x66ff;&#x6362;&#x505c;&#x8f66;&#x5382;&#x540d;&#x5b57; </from><to>&#x505c;&#x8f66;&#x573a;&#x540d;&#x79f0;metadata&#x5b57;&#x6bb5;</to><enabled>Y</enabled> </hop>
297   - <hop> <from>&#x83b7;&#x53d6;&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;&#x540d;&#x79f0;</from><to>&#x589e;&#x52a0;&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;metadata</to><enabled>Y</enabled> </hop>
  303 + <hop> <from>&#x83b7;&#x53d6;&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;</from><to>&#x589e;&#x52a0;&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;metadata</to><enabled>Y</enabled> </hop>
298 304 <hop> <from>&#x589e;&#x52a0;&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;metadata</from><to>&#x66ff;&#x6362;&#x65f6;&#x523b;&#x8868;&#x540d;&#x5b57;</to><enabled>Y</enabled> </hop>
299 305 <hop> <from>&#x66ff;&#x6362;&#x65f6;&#x523b;&#x8868;&#x540d;&#x5b57;</from><to>&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;metadata&#x5b57;&#x6bb5;</to><enabled>Y</enabled> </hop>
300 306 <hop> <from>&#x7ebf;&#x8def;&#x540d;&#x79f0;metadata&#x5b57;&#x6bb5;</from><to>&#x5408;&#x5e76;&#x589e;&#x52a0;&#x5e38;&#x91cf;&#x6570;&#x636e;metadata</to><enabled>Y</enabled> </hop>
301 307 <hop> <from>&#x505c;&#x8f66;&#x573a;&#x540d;&#x79f0;metadata&#x5b57;&#x6bb5;</from><to>&#x5408;&#x5e76;&#x589e;&#x52a0;&#x5e38;&#x91cf;&#x6570;&#x636e;metadata</to><enabled>Y</enabled> </hop>
302 308 <hop> <from>&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;metadata&#x5b57;&#x6bb5;</from><to>&#x5408;&#x5e76;&#x589e;&#x52a0;&#x5e38;&#x91cf;&#x6570;&#x636e;metadata</to><enabled>Y</enabled> </hop>
303 309 <hop> <from>&#x5408;&#x5e76;&#x589e;&#x52a0;&#x5e38;&#x91cf;&#x6570;&#x636e;metadata</from><to>ETL&#x5143;&#x6570;&#x636e;&#x6ce8;&#x5165;</to><enabled>Y</enabled> </hop>
  310 + <hop> <from>&#x83b7;&#x53d6;&#x65f6;&#x523b;&#x8868;id</from><to>&#x5220;&#x9664;&#x4e4b;&#x524d;&#x7684;&#x660e;&#x7ec6;&#x4fe1;&#x606f;</to><enabled>Y</enabled> </hop>
304 311 </order>
305 312 <step>
306 313 <name>ETL&#x5143;&#x6570;&#x636e;&#x6ce8;&#x5165;</name>
... ... @@ -343,56 +350,6 @@
343 350 <target_detail>Y</target_detail>
344 351 <source_step>&#x83b7;&#x53d6;excel&#x6587;&#x4ef6;&#x540d;</source_step>
345 352 <source_field>filepath_</source_field>
346   - </mapping> <mapping> <target_step_name>&#x884c;&#x8f6c;&#x5217;</target_step_name>
347   - <target_attribute_key>NAME</target_attribute_key>
348   - <target_detail>Y</target_detail>
349   - <source_step>&#x5217;&#x62c6;&#x5206;&#x4e3a;&#x591a;&#x884c; 2</source_step>
350   - <source_field>fieldName</source_field>
351   - </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
352   - <target_attribute_key>NAME</target_attribute_key>
353   - <target_detail>Y</target_detail>
354   - <source_step>&#x589e;&#x52a0;excel&#x5b57;&#x6bb5;&#x5176;&#x4ed6;&#x5143;&#x6570;&#x636e;</source_step>
355   - <source_field>fieldname</source_field>
356   - </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
357   - <target_attribute_key>SHEET_NAME</target_attribute_key>
358   - <target_detail>Y</target_detail>
359   - <source_step>&#x83b7;&#x53d6;excel&#x6587;&#x4ef6;&#x540d;</source_step>
360   - <source_field>sheetname_</source_field>
361   - </mapping> <mapping> <target_step_name>&#x589e;&#x52a0;&#x65f6;&#x523b;&#x8868;&#x540d;&#x5b57;&#xff0c;&#x7ebf;&#x8def;&#x540d;&#x5b57;&#xff0c;&#x505c;&#x8f66;&#x573a;&#x540d;&#x5b57;</target_step_name>
362   - <target_attribute_key>NAME</target_attribute_key>
363   - <target_detail>Y</target_detail>
364   - <source_step>&#x5408;&#x5e76;&#x589e;&#x52a0;&#x5e38;&#x91cf;&#x6570;&#x636e;metadata</source_step>
365   - <source_field>col_name</source_field>
366   - </mapping> <mapping> <target_step_name>Excel&#x8f93;&#x5165;</target_step_name>
367   - <target_attribute_key>NAME</target_attribute_key>
368   - <target_detail>Y</target_detail>
369   - <source_step>&#x5217;&#x62c6;&#x5206;&#x4e3a;&#x591a;&#x884c;</source_step>
370   - <source_field>fieldName</source_field>
371   - </mapping> <mapping> <target_step_name>Excel&#x8f93;&#x5165;</target_step_name>
372   - <target_attribute_key>TRIM_TYPE</target_attribute_key>
373   - <target_detail>Y</target_detail>
374   - <source_step>&#x5217;&#x62c6;&#x5206;&#x4e3a;&#x591a;&#x884c;</source_step>
375   - <source_field>trim_type</source_field>
376   - </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
377   - <target_attribute_key>REPEAT</target_attribute_key>
378   - <target_detail>Y</target_detail>
379   - <source_step>&#x589e;&#x52a0;excel&#x5b57;&#x6bb5;&#x5176;&#x4ed6;&#x5143;&#x6570;&#x636e;</source_step>
380   - <source_field>repeat</source_field>
381   - </mapping> <mapping> <target_step_name>&#x73ed;&#x6b21;&#x6570;&#x636e;&#x8303;&#x5f0f;&#x5316;</target_step_name>
382   - <target_attribute_key>NORMALISED</target_attribute_key>
383   - <target_detail>Y</target_detail>
384   - <source_step>&#x589e;&#x52a0;normalize&#x5143;&#x6570;&#x636e;</source_step>
385   - <source_field>valuefield</source_field>
386   - </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
387   - <target_attribute_key>FORMAT</target_attribute_key>
388   - <target_detail>Y</target_detail>
389   - <source_step>&#x589e;&#x52a0;excel&#x5b57;&#x6bb5;&#x5176;&#x4ed6;&#x5143;&#x6570;&#x636e;</source_step>
390   - <source_field>format</source_field>
391   - </mapping> <mapping> <target_step_name>&#x73ed;&#x6b21;&#x6570;&#x636e;&#x8303;&#x5f0f;&#x5316;</target_step_name>
392   - <target_attribute_key>VALUE</target_attribute_key>
393   - <target_detail>Y</target_detail>
394   - <source_step>&#x589e;&#x52a0;normalize&#x5143;&#x6570;&#x636e;</source_step>
395   - <source_field>nfieldname</source_field>
396 353 </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
397 354 <target_attribute_key>PRECISION</target_attribute_key>
398 355 <target_detail>Y</target_detail>
... ... @@ -418,6 +375,16 @@
418 375 <target_detail>Y</target_detail>
419 376 <source_step>&#x5408;&#x5e76;&#x589e;&#x52a0;&#x5e38;&#x91cf;&#x6570;&#x636e;metadata</source_step>
420 377 <source_field>col_type</source_field>
  378 + </mapping> <mapping> <target_step_name>&#x884c;&#x8f6c;&#x5217;</target_step_name>
  379 + <target_attribute_key>NAME</target_attribute_key>
  380 + <target_detail>Y</target_detail>
  381 + <source_step>&#x5217;&#x62c6;&#x5206;&#x4e3a;&#x591a;&#x884c; 2</source_step>
  382 + <source_field>fieldName</source_field>
  383 + </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
  384 + <target_attribute_key>NAME</target_attribute_key>
  385 + <target_detail>Y</target_detail>
  386 + <source_step>&#x589e;&#x52a0;excel&#x5b57;&#x6bb5;&#x5176;&#x4ed6;&#x5143;&#x6570;&#x636e;</source_step>
  387 + <source_field>fieldname</source_field>
421 388 </mapping> <mapping> <target_step_name>&#x73ed;&#x6b21;&#x6570;&#x636e;&#x8303;&#x5f0f;&#x5316;</target_step_name>
422 389 <target_attribute_key>NAME</target_attribute_key>
423 390 <target_detail>Y</target_detail>
... ... @@ -429,20 +396,60 @@
429 396 <source_step>&#x589e;&#x52a0;excel&#x5b57;&#x6bb5;&#x5176;&#x4ed6;&#x5143;&#x6570;&#x636e;</source_step>
430 397 <source_field>length</source_field>
431 398 </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
  399 + <target_attribute_key>SHEET_NAME</target_attribute_key>
  400 + <target_detail>Y</target_detail>
  401 + <source_step>&#x83b7;&#x53d6;excel&#x6587;&#x4ef6;&#x540d;</source_step>
  402 + <source_field>sheetname_</source_field>
  403 + </mapping> <mapping> <target_step_name>&#x589e;&#x52a0;&#x65f6;&#x523b;&#x8868;&#x540d;&#x5b57;&#xff0c;&#x7ebf;&#x8def;&#x540d;&#x5b57;&#xff0c;&#x505c;&#x8f66;&#x573a;&#x540d;&#x5b57;</target_step_name>
  404 + <target_attribute_key>NAME</target_attribute_key>
  405 + <target_detail>Y</target_detail>
  406 + <source_step>&#x5408;&#x5e76;&#x589e;&#x52a0;&#x5e38;&#x91cf;&#x6570;&#x636e;metadata</source_step>
  407 + <source_field>col_name</source_field>
  408 + </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
432 409 <target_attribute_key>TYPE</target_attribute_key>
433 410 <target_detail>Y</target_detail>
434 411 <source_step>&#x589e;&#x52a0;excel&#x5b57;&#x6bb5;&#x5176;&#x4ed6;&#x5143;&#x6570;&#x636e;</source_step>
435 412 <source_field>fieldtype</source_field>
  413 + </mapping> <mapping> <target_step_name>Excel&#x8f93;&#x5165;</target_step_name>
  414 + <target_attribute_key>NAME</target_attribute_key>
  415 + <target_detail>Y</target_detail>
  416 + <source_step>&#x5217;&#x62c6;&#x5206;&#x4e3a;&#x591a;&#x884c;</source_step>
  417 + <source_field>fieldName</source_field>
436 418 </mapping> <mapping> <target_step_name>&#x884c;&#x8f6c;&#x5217;</target_step_name>
437 419 <target_attribute_key>VALUE</target_attribute_key>
438 420 <target_detail>Y</target_detail>
439 421 <source_step>&#x5217;&#x62c6;&#x5206;&#x4e3a;&#x591a;&#x884c; 2</source_step>
440 422 <source_field>fieldName</source_field>
  423 + </mapping> <mapping> <target_step_name>Excel&#x8f93;&#x5165;</target_step_name>
  424 + <target_attribute_key>TRIM_TYPE</target_attribute_key>
  425 + <target_detail>Y</target_detail>
  426 + <source_step>&#x5217;&#x62c6;&#x5206;&#x4e3a;&#x591a;&#x884c;</source_step>
  427 + <source_field>trim_type</source_field>
441 428 </mapping> <mapping> <target_step_name>&#x884c;&#x8f6c;&#x5217;</target_step_name>
442 429 <target_attribute_key>NORMALISED</target_attribute_key>
443 430 <target_detail>Y</target_detail>
444 431 <source_step>&#x5217;&#x62c6;&#x5206;&#x4e3a;&#x591a;&#x884c; 2</source_step>
445 432 <source_field>value</source_field>
  433 + </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
  434 + <target_attribute_key>REPEAT</target_attribute_key>
  435 + <target_detail>Y</target_detail>
  436 + <source_step>&#x589e;&#x52a0;excel&#x5b57;&#x6bb5;&#x5176;&#x4ed6;&#x5143;&#x6570;&#x636e;</source_step>
  437 + <source_field>repeat</source_field>
  438 + </mapping> <mapping> <target_step_name>&#x73ed;&#x6b21;&#x6570;&#x636e;&#x8303;&#x5f0f;&#x5316;</target_step_name>
  439 + <target_attribute_key>NORMALISED</target_attribute_key>
  440 + <target_detail>Y</target_detail>
  441 + <source_step>&#x589e;&#x52a0;normalize&#x5143;&#x6570;&#x636e;</source_step>
  442 + <source_field>valuefield</source_field>
  443 + </mapping> <mapping> <target_step_name>&#x73ed;&#x6b21;&#x6570;&#x636e;&#x8303;&#x5f0f;&#x5316;</target_step_name>
  444 + <target_attribute_key>VALUE</target_attribute_key>
  445 + <target_detail>Y</target_detail>
  446 + <source_step>&#x589e;&#x52a0;normalize&#x5143;&#x6570;&#x636e;</source_step>
  447 + <source_field>nfieldname</source_field>
  448 + </mapping> <mapping> <target_step_name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x4fe1;&#x606f;Excel&#x8f93;&#x5165;</target_step_name>
  449 + <target_attribute_key>FORMAT</target_attribute_key>
  450 + <target_detail>Y</target_detail>
  451 + <source_step>&#x589e;&#x52a0;excel&#x5b57;&#x6bb5;&#x5176;&#x4ed6;&#x5143;&#x6570;&#x636e;</source_step>
  452 + <source_field>format</source_field>
446 453 </mapping> <mapping> <target_step_name>Excel&#x8f93;&#x5165;</target_step_name>
447 454 <target_attribute_key>PRECISION</target_attribute_key>
448 455 <target_detail>Y</target_detail>
... ... @@ -1100,7 +1107,7 @@
1100 1107 </step>
1101 1108  
1102 1109 <step>
1103   - <name>&#x83b7;&#x53d6;&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;&#x540d;&#x79f0;</name>
  1110 + <name>&#x83b7;&#x53d6;&#x65f6;&#x523b;&#x8868;&#x540d;&#x79f0;</name>
1104 1111 <type>GetVariable</type>
1105 1112 <description/>
1106 1113 <distribute>Y</distribute>
... ... @@ -1217,6 +1224,72 @@
1217 1224 </GUI>
1218 1225 </step>
1219 1226  
  1227 + <step>
  1228 + <name>&#x83b7;&#x53d6;&#x65f6;&#x523b;&#x8868;id</name>
  1229 + <type>GetVariable</type>
  1230 + <description/>
  1231 + <distribute>Y</distribute>
  1232 + <custom_distribution/>
  1233 + <copies>1</copies>
  1234 + <partitioning>
  1235 + <method>none</method>
  1236 + <schema_name/>
  1237 + </partitioning>
  1238 + <fields>
  1239 + <field>
  1240 + <name>ttid_</name>
  1241 + <variable>&#x24;&#x7b;ttid&#x7d;</variable>
  1242 + <type>Integer</type>
  1243 + <format/>
  1244 + <currency/>
  1245 + <decimal/>
  1246 + <group/>
  1247 + <length>-1</length>
  1248 + <precision>-1</precision>
  1249 + <trim_type>none</trim_type>
  1250 + </field>
  1251 + </fields>
  1252 + <cluster_schema/>
  1253 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  1254 + <xloc>427</xloc>
  1255 + <yloc>26</yloc>
  1256 + <draw>Y</draw>
  1257 + </GUI>
  1258 + </step>
  1259 +
  1260 + <step>
  1261 + <name>&#x5220;&#x9664;&#x4e4b;&#x524d;&#x7684;&#x660e;&#x7ec6;&#x4fe1;&#x606f;</name>
  1262 + <type>ExecSQL</type>
  1263 + <description/>
  1264 + <distribute>Y</distribute>
  1265 + <custom_distribution/>
  1266 + <copies>1</copies>
  1267 + <partitioning>
  1268 + <method>none</method>
  1269 + <schema_name/>
  1270 + </partitioning>
  1271 + <connection>bus_control_variable</connection>
  1272 + <execute_each_row>Y</execute_each_row>
  1273 + <single_statement>N</single_statement>
  1274 + <replace_variables>N</replace_variables>
  1275 + <quoteString>N</quoteString>
  1276 + <sql>delete from bsth_c_s_ttinfo_detail where ttinfo &#x3d; &#x3f;</sql>
  1277 + <set_params>N</set_params>
  1278 + <insert_field/>
  1279 + <update_field/>
  1280 + <delete_field/>
  1281 + <read_field/>
  1282 + <arguments>
  1283 + <argument><name>ttid_</name></argument>
  1284 + </arguments>
  1285 + <cluster_schema/>
  1286 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  1287 + <xloc>627</xloc>
  1288 + <yloc>26</yloc>
  1289 + <draw>Y</draw>
  1290 + </GUI>
  1291 + </step>
  1292 +
1220 1293 <step_error_handling>
1221 1294 </step_error_handling>
1222 1295 <slave-step-copy-partition-distribution>
... ...
src/main/resources/datatools/ktrs/ttinfodetailoutputforedit.ktr
... ... @@ -345,6 +345,11 @@
345 345 <format/>
346 346 </field>
347 347 <field>
  348 + <name>fcno1_jhlc</name>
  349 + <type>None</type>
  350 + <format/>
  351 + </field>
  352 + <field>
348 353 <name>fcno1_zdname</name>
349 354 <type>String</type>
350 355 <format/>
... ... @@ -375,6 +380,11 @@
375 380 <format/>
376 381 </field>
377 382 <field>
  383 + <name>fcno2_jhlc</name>
  384 + <type>None</type>
  385 + <format/>
  386 + </field>
  387 + <field>
378 388 <name>fcno2_zdname</name>
379 389 <type>String</type>
380 390 <format/>
... ... @@ -405,6 +415,11 @@
405 415 <format/>
406 416 </field>
407 417 <field>
  418 + <name>fcno3_jhlc</name>
  419 + <type>None</type>
  420 + <format/>
  421 + </field>
  422 + <field>
408 423 <name>fcno3_zdname</name>
409 424 <type>String</type>
410 425 <format/>
... ... @@ -435,6 +450,11 @@
435 450 <format/>
436 451 </field>
437 452 <field>
  453 + <name>fcno5_jhlc</name>
  454 + <type>None</type>
  455 + <format/>
  456 + </field>
  457 + <field>
438 458 <name>fcno4_zdname</name>
439 459 <type>String</type>
440 460 <format/>
... ... @@ -465,6 +485,11 @@
465 485 <format/>
466 486 </field>
467 487 <field>
  488 + <name>fcno5_jhlc_1</name>
  489 + <type>None</type>
  490 + <format/>
  491 + </field>
  492 + <field>
468 493 <name>fcno5_zdname</name>
469 494 <type>String</type>
470 495 <format/>
... ... @@ -495,6 +520,11 @@
495 520 <format/>
496 521 </field>
497 522 <field>
  523 + <name>fcno6_jhlc</name>
  524 + <type>None</type>
  525 + <format/>
  526 + </field>
  527 + <field>
498 528 <name>fcno6_zdname</name>
499 529 <type>String</type>
500 530 <format/>
... ... @@ -525,6 +555,11 @@
525 555 <format/>
526 556 </field>
527 557 <field>
  558 + <name>fcno7_jhlc</name>
  559 + <type>None</type>
  560 + <format/>
  561 + </field>
  562 + <field>
528 563 <name>fcno7_zdname</name>
529 564 <type>String</type>
530 565 <format/>
... ... @@ -555,6 +590,11 @@
555 590 <format/>
556 591 </field>
557 592 <field>
  593 + <name>fcno8_jhlc</name>
  594 + <type>None</type>
  595 + <format/>
  596 + </field>
  597 + <field>
558 598 <name>fcno8_zdname</name>
559 599 <type>String</type>
560 600 <format/>
... ... @@ -585,6 +625,11 @@
585 625 <format/>
586 626 </field>
587 627 <field>
  628 + <name>fcno9_jhlc</name>
  629 + <type>None</type>
  630 + <format/>
  631 + </field>
  632 + <field>
588 633 <name>fcno9_zdname</name>
589 634 <type>String</type>
590 635 <format/>
... ... @@ -615,6 +660,11 @@
615 660 <format/>
616 661 </field>
617 662 <field>
  663 + <name>fcno10_jhlc</name>
  664 + <type>None</type>
  665 + <format/>
  666 + </field>
  667 + <field>
618 668 <name>fcno10_zdname</name>
619 669 <type>String</type>
620 670 <format/>
... ... @@ -645,6 +695,11 @@
645 695 <format/>
646 696 </field>
647 697 <field>
  698 + <name>fcno11_jhlc</name>
  699 + <type>None</type>
  700 + <format/>
  701 + </field>
  702 + <field>
648 703 <name>fcno11_zdname</name>
649 704 <type>String</type>
650 705 <format/>
... ... @@ -675,6 +730,11 @@
675 730 <format/>
676 731 </field>
677 732 <field>
  733 + <name>fcno12_jhlc</name>
  734 + <type>None</type>
  735 + <format/>
  736 + </field>
  737 + <field>
678 738 <name>fcno12_zdname</name>
679 739 <type>String</type>
680 740 <format/>
... ... @@ -705,6 +765,11 @@
705 765 <format/>
706 766 </field>
707 767 <field>
  768 + <name>fcno13_jhlc</name>
  769 + <type>None</type>
  770 + <format/>
  771 + </field>
  772 + <field>
708 773 <name>fcno13_zdname</name>
709 774 <type>String</type>
710 775 <format/>
... ... @@ -735,6 +800,11 @@
735 800 <format/>
736 801 </field>
737 802 <field>
  803 + <name>fcno14_jhlc</name>
  804 + <type>None</type>
  805 + <format/>
  806 + </field>
  807 + <field>
738 808 <name>fcno14_zdname</name>
739 809 <type>String</type>
740 810 <format/>
... ... @@ -765,6 +835,11 @@
765 835 <format/>
766 836 </field>
767 837 <field>
  838 + <name>fcno15_jhlc</name>
  839 + <type>None</type>
  840 + <format/>
  841 + </field>
  842 + <field>
768 843 <name>fcno15_zdname</name>
769 844 <type>String</type>
770 845 <format/>
... ... @@ -795,6 +870,11 @@
795 870 <format/>
796 871 </field>
797 872 <field>
  873 + <name>fcno16_jhlc</name>
  874 + <type>None</type>
  875 + <format/>
  876 + </field>
  877 + <field>
798 878 <name>fcno16_zdname</name>
799 879 <type>String</type>
800 880 <format/>
... ... @@ -825,6 +905,11 @@
825 905 <format/>
826 906 </field>
827 907 <field>
  908 + <name>fcno17_jhlc</name>
  909 + <type>None</type>
  910 + <format/>
  911 + </field>
  912 + <field>
828 913 <name>fcno17_zdname</name>
829 914 <type>String</type>
830 915 <format/>
... ... @@ -855,6 +940,11 @@
855 940 <format/>
856 941 </field>
857 942 <field>
  943 + <name>fcno18_jhlc</name>
  944 + <type>None</type>
  945 + <format/>
  946 + </field>
  947 + <field>
858 948 <name>fcno18_zdname</name>
859 949 <type>String</type>
860 950 <format/>
... ... @@ -885,6 +975,11 @@
885 975 <format/>
886 976 </field>
887 977 <field>
  978 + <name>fcno19_jhlc</name>
  979 + <type>None</type>
  980 + <format/>
  981 + </field>
  982 + <field>
888 983 <name>fcno19_zdname</name>
889 984 <type>String</type>
890 985 <format/>
... ... @@ -915,6 +1010,11 @@
915 1010 <format/>
916 1011 </field>
917 1012 <field>
  1013 + <name>fcno20_jhlc</name>
  1014 + <type>None</type>
  1015 + <format/>
  1016 + </field>
  1017 + <field>
918 1018 <name>fcno20_zdname</name>
919 1019 <type>String</type>
920 1020 <format/>
... ... @@ -945,6 +1045,11 @@
945 1045 <format/>
946 1046 </field>
947 1047 <field>
  1048 + <name>fcno21_jhlc</name>
  1049 + <type>None</type>
  1050 + <format/>
  1051 + </field>
  1052 + <field>
948 1053 <name>fcno21_zdname</name>
949 1054 <type>String</type>
950 1055 <format/>
... ... @@ -975,6 +1080,11 @@
975 1080 <format/>
976 1081 </field>
977 1082 <field>
  1083 + <name>fcno22_jhlc</name>
  1084 + <type>None</type>
  1085 + <format/>
  1086 + </field>
  1087 + <field>
978 1088 <name>fcno22_zdname</name>
979 1089 <type>String</type>
980 1090 <format/>
... ... @@ -1005,6 +1115,11 @@
1005 1115 <format/>
1006 1116 </field>
1007 1117 <field>
  1118 + <name>fcno23_jhlc</name>
  1119 + <type>None</type>
  1120 + <format/>
  1121 + </field>
  1122 + <field>
1008 1123 <name>fcno23_zdname</name>
1009 1124 <type>String</type>
1010 1125 <format/>
... ... @@ -1035,6 +1150,11 @@
1035 1150 <format/>
1036 1151 </field>
1037 1152 <field>
  1153 + <name>fcno24_jhlc</name>
  1154 + <type>None</type>
  1155 + <format/>
  1156 + </field>
  1157 + <field>
1038 1158 <name>fcno24_zdname</name>
1039 1159 <type>String</type>
1040 1160 <format/>
... ... @@ -1065,6 +1185,11 @@
1065 1185 <format/>
1066 1186 </field>
1067 1187 <field>
  1188 + <name>fcno25_jhlc</name>
  1189 + <type>None</type>
  1190 + <format/>
  1191 + </field>
  1192 + <field>
1068 1193 <name>fcno25_zdname</name>
1069 1194 <type>String</type>
1070 1195 <format/>
... ... @@ -1095,6 +1220,11 @@
1095 1220 <format/>
1096 1221 </field>
1097 1222 <field>
  1223 + <name>fcno26_jhlc</name>
  1224 + <type>None</type>
  1225 + <format/>
  1226 + </field>
  1227 + <field>
1098 1228 <name>fcno26_zdname</name>
1099 1229 <type>String</type>
1100 1230 <format/>
... ... @@ -1125,6 +1255,11 @@
1125 1255 <format/>
1126 1256 </field>
1127 1257 <field>
  1258 + <name>fcno27_jhlc</name>
  1259 + <type>None</type>
  1260 + <format/>
  1261 + </field>
  1262 + <field>
1128 1263 <name>fcno27_zdname</name>
1129 1264 <type>String</type>
1130 1265 <format/>
... ... @@ -1155,6 +1290,11 @@
1155 1290 <format/>
1156 1291 </field>
1157 1292 <field>
  1293 + <name>fcno28_jhlc</name>
  1294 + <type>None</type>
  1295 + <format/>
  1296 + </field>
  1297 + <field>
1158 1298 <name>fcno28_zdname</name>
1159 1299 <type>String</type>
1160 1300 <format/>
... ... @@ -1185,6 +1325,11 @@
1185 1325 <format/>
1186 1326 </field>
1187 1327 <field>
  1328 + <name>fcno29_jhlc</name>
  1329 + <type>None</type>
  1330 + <format/>
  1331 + </field>
  1332 + <field>
1188 1333 <name>fcno29_zdname</name>
1189 1334 <type>String</type>
1190 1335 <format/>
... ... @@ -1215,6 +1360,11 @@
1215 1360 <format/>
1216 1361 </field>
1217 1362 <field>
  1363 + <name>fcno30_jhlc</name>
  1364 + <type>None</type>
  1365 + <format/>
  1366 + </field>
  1367 + <field>
1218 1368 <name>fcno30_zdname</name>
1219 1369 <type>String</type>
1220 1370 <format/>
... ... @@ -1245,6 +1395,11 @@
1245 1395 <format/>
1246 1396 </field>
1247 1397 <field>
  1398 + <name>fcno31_jhlc</name>
  1399 + <type>None</type>
  1400 + <format/>
  1401 + </field>
  1402 + <field>
1248 1403 <name>fcno31_zdname</name>
1249 1404 <type>String</type>
1250 1405 <format/>
... ... @@ -1275,6 +1430,11 @@
1275 1430 <format/>
1276 1431 </field>
1277 1432 <field>
  1433 + <name>fcno32_jhlc</name>
  1434 + <type>None</type>
  1435 + <format/>
  1436 + </field>
  1437 + <field>
1278 1438 <name>fcno32_zdname</name>
1279 1439 <type>String</type>
1280 1440 <format/>
... ... @@ -1305,6 +1465,11 @@
1305 1465 <format/>
1306 1466 </field>
1307 1467 <field>
  1468 + <name>fcno33_jhlc</name>
  1469 + <type>None</type>
  1470 + <format/>
  1471 + </field>
  1472 + <field>
1308 1473 <name>fcno33_zdname</name>
1309 1474 <type>String</type>
1310 1475 <format/>
... ... @@ -1335,6 +1500,11 @@
1335 1500 <format/>
1336 1501 </field>
1337 1502 <field>
  1503 + <name>fcno34_jhlc</name>
  1504 + <type>None</type>
  1505 + <format/>
  1506 + </field>
  1507 + <field>
1338 1508 <name>fcno34_zdname</name>
1339 1509 <type>String</type>
1340 1510 <format/>
... ... @@ -1365,6 +1535,11 @@
1365 1535 <format/>
1366 1536 </field>
1367 1537 <field>
  1538 + <name>fcno35_jhlc</name>
  1539 + <type>None</type>
  1540 + <format/>
  1541 + </field>
  1542 + <field>
1368 1543 <name>fcno35_zdname</name>
1369 1544 <type>String</type>
1370 1545 <format/>
... ... @@ -1457,6 +1632,20 @@
1457 1632 <target_aggregation_type>-</target_aggregation_type>
1458 1633 </field>
1459 1634 <field>
  1635 + <field_name>jhlc</field_name>
  1636 + <key_value>1</key_value>
  1637 + <target_name>fcno1_jhlc</target_name>
  1638 + <target_type>String</target_type>
  1639 + <target_format/>
  1640 + <target_length>-1</target_length>
  1641 + <target_precision>-1</target_precision>
  1642 + <target_decimal_symbol/>
  1643 + <target_grouping_symbol/>
  1644 + <target_currency_symbol/>
  1645 + <target_null_string/>
  1646 + <target_aggregation_type>-</target_aggregation_type>
  1647 + </field>
  1648 + <field>
1460 1649 <field_name>fczdName</field_name>
1461 1650 <key_value>1</key_value>
1462 1651 <target_name>fcno1_zdname</target_name>
... ... @@ -1541,6 +1730,20 @@
1541 1730 <target_aggregation_type>-</target_aggregation_type>
1542 1731 </field>
1543 1732 <field>
  1733 + <field_name>jhlc</field_name>
  1734 + <key_value>2</key_value>
  1735 + <target_name>fcno2_jhlc</target_name>
  1736 + <target_type>String</target_type>
  1737 + <target_format/>
  1738 + <target_length>-1</target_length>
  1739 + <target_precision>-1</target_precision>
  1740 + <target_decimal_symbol/>
  1741 + <target_grouping_symbol/>
  1742 + <target_currency_symbol/>
  1743 + <target_null_string/>
  1744 + <target_aggregation_type>-</target_aggregation_type>
  1745 + </field>
  1746 + <field>
1544 1747 <field_name>fczdName</field_name>
1545 1748 <key_value>2</key_value>
1546 1749 <target_name>fcno2_zdname</target_name>
... ... @@ -1625,6 +1828,20 @@
1625 1828 <target_aggregation_type>-</target_aggregation_type>
1626 1829 </field>
1627 1830 <field>
  1831 + <field_name>jhlc</field_name>
  1832 + <key_value>3</key_value>
  1833 + <target_name>fcno3_jhlc</target_name>
  1834 + <target_type>String</target_type>
  1835 + <target_format/>
  1836 + <target_length>-1</target_length>
  1837 + <target_precision>-1</target_precision>
  1838 + <target_decimal_symbol/>
  1839 + <target_grouping_symbol/>
  1840 + <target_currency_symbol/>
  1841 + <target_null_string/>
  1842 + <target_aggregation_type>-</target_aggregation_type>
  1843 + </field>
  1844 + <field>
1628 1845 <field_name>fczdName</field_name>
1629 1846 <key_value>3</key_value>
1630 1847 <target_name>fcno3_zdname</target_name>
... ... @@ -1709,6 +1926,20 @@
1709 1926 <target_aggregation_type>-</target_aggregation_type>
1710 1927 </field>
1711 1928 <field>
  1929 + <field_name>jhlc</field_name>
  1930 + <key_value>4</key_value>
  1931 + <target_name>fcno5_jhlc</target_name>
  1932 + <target_type>String</target_type>
  1933 + <target_format/>
  1934 + <target_length>-1</target_length>
  1935 + <target_precision>-1</target_precision>
  1936 + <target_decimal_symbol/>
  1937 + <target_grouping_symbol/>
  1938 + <target_currency_symbol/>
  1939 + <target_null_string/>
  1940 + <target_aggregation_type>-</target_aggregation_type>
  1941 + </field>
  1942 + <field>
1712 1943 <field_name>fczdName</field_name>
1713 1944 <key_value>4</key_value>
1714 1945 <target_name>fcno4_zdname</target_name>
... ... @@ -1793,6 +2024,20 @@
1793 2024 <target_aggregation_type>-</target_aggregation_type>
1794 2025 </field>
1795 2026 <field>
  2027 + <field_name>jhlc</field_name>
  2028 + <key_value>5</key_value>
  2029 + <target_name>fcno5_jhlc</target_name>
  2030 + <target_type>String</target_type>
  2031 + <target_format/>
  2032 + <target_length>-1</target_length>
  2033 + <target_precision>-1</target_precision>
  2034 + <target_decimal_symbol/>
  2035 + <target_grouping_symbol/>
  2036 + <target_currency_symbol/>
  2037 + <target_null_string/>
  2038 + <target_aggregation_type>-</target_aggregation_type>
  2039 + </field>
  2040 + <field>
1796 2041 <field_name>fczdName</field_name>
1797 2042 <key_value>5</key_value>
1798 2043 <target_name>fcno5_zdname</target_name>
... ... @@ -1877,6 +2122,20 @@
1877 2122 <target_aggregation_type>-</target_aggregation_type>
1878 2123 </field>
1879 2124 <field>
  2125 + <field_name>jhlc</field_name>
  2126 + <key_value>6</key_value>
  2127 + <target_name>fcno6_jhlc</target_name>
  2128 + <target_type>String</target_type>
  2129 + <target_format/>
  2130 + <target_length>-1</target_length>
  2131 + <target_precision>-1</target_precision>
  2132 + <target_decimal_symbol/>
  2133 + <target_grouping_symbol/>
  2134 + <target_currency_symbol/>
  2135 + <target_null_string/>
  2136 + <target_aggregation_type>-</target_aggregation_type>
  2137 + </field>
  2138 + <field>
1880 2139 <field_name>fczdName</field_name>
1881 2140 <key_value>6</key_value>
1882 2141 <target_name>fcno6_zdname</target_name>
... ... @@ -1961,6 +2220,20 @@
1961 2220 <target_aggregation_type>-</target_aggregation_type>
1962 2221 </field>
1963 2222 <field>
  2223 + <field_name>jhlc</field_name>
  2224 + <key_value>7</key_value>
  2225 + <target_name>fcno7_jhlc</target_name>
  2226 + <target_type>String</target_type>
  2227 + <target_format/>
  2228 + <target_length>-1</target_length>
  2229 + <target_precision>-1</target_precision>
  2230 + <target_decimal_symbol/>
  2231 + <target_grouping_symbol/>
  2232 + <target_currency_symbol/>
  2233 + <target_null_string/>
  2234 + <target_aggregation_type>-</target_aggregation_type>
  2235 + </field>
  2236 + <field>
1964 2237 <field_name>fczdName</field_name>
1965 2238 <key_value>7</key_value>
1966 2239 <target_name>fcno7_zdname</target_name>
... ... @@ -2045,6 +2318,20 @@
2045 2318 <target_aggregation_type>-</target_aggregation_type>
2046 2319 </field>
2047 2320 <field>
  2321 + <field_name>jhlc</field_name>
  2322 + <key_value>8</key_value>
  2323 + <target_name>fcno8_jhlc</target_name>
  2324 + <target_type>String</target_type>
  2325 + <target_format/>
  2326 + <target_length>-1</target_length>
  2327 + <target_precision>-1</target_precision>
  2328 + <target_decimal_symbol/>
  2329 + <target_grouping_symbol/>
  2330 + <target_currency_symbol/>
  2331 + <target_null_string/>
  2332 + <target_aggregation_type>-</target_aggregation_type>
  2333 + </field>
  2334 + <field>
2048 2335 <field_name>fczdName</field_name>
2049 2336 <key_value>8</key_value>
2050 2337 <target_name>fcno8_zdname</target_name>
... ... @@ -2129,6 +2416,20 @@
2129 2416 <target_aggregation_type>-</target_aggregation_type>
2130 2417 </field>
2131 2418 <field>
  2419 + <field_name>jhlc</field_name>
  2420 + <key_value>9</key_value>
  2421 + <target_name>fcno9_jhlc</target_name>
  2422 + <target_type>String</target_type>
  2423 + <target_format/>
  2424 + <target_length>-1</target_length>
  2425 + <target_precision>-1</target_precision>
  2426 + <target_decimal_symbol/>
  2427 + <target_grouping_symbol/>
  2428 + <target_currency_symbol/>
  2429 + <target_null_string/>
  2430 + <target_aggregation_type>-</target_aggregation_type>
  2431 + </field>
  2432 + <field>
2132 2433 <field_name>fczdName</field_name>
2133 2434 <key_value>9</key_value>
2134 2435 <target_name>fcno9_zdname</target_name>
... ... @@ -2213,6 +2514,20 @@
2213 2514 <target_aggregation_type>-</target_aggregation_type>
2214 2515 </field>
2215 2516 <field>
  2517 + <field_name>jhlc</field_name>
  2518 + <key_value>10</key_value>
  2519 + <target_name>fcno10_jhlc</target_name>
  2520 + <target_type>String</target_type>
  2521 + <target_format/>
  2522 + <target_length>-1</target_length>
  2523 + <target_precision>-1</target_precision>
  2524 + <target_decimal_symbol/>
  2525 + <target_grouping_symbol/>
  2526 + <target_currency_symbol/>
  2527 + <target_null_string/>
  2528 + <target_aggregation_type>-</target_aggregation_type>
  2529 + </field>
  2530 + <field>
2216 2531 <field_name>fczdName</field_name>
2217 2532 <key_value>10</key_value>
2218 2533 <target_name>fcno10_zdname</target_name>
... ... @@ -2297,6 +2612,20 @@
2297 2612 <target_aggregation_type>-</target_aggregation_type>
2298 2613 </field>
2299 2614 <field>
  2615 + <field_name>jhlc</field_name>
  2616 + <key_value>11</key_value>
  2617 + <target_name>fcno11_jhlc</target_name>
  2618 + <target_type>String</target_type>
  2619 + <target_format/>
  2620 + <target_length>-1</target_length>
  2621 + <target_precision>-1</target_precision>
  2622 + <target_decimal_symbol/>
  2623 + <target_grouping_symbol/>
  2624 + <target_currency_symbol/>
  2625 + <target_null_string/>
  2626 + <target_aggregation_type>-</target_aggregation_type>
  2627 + </field>
  2628 + <field>
2300 2629 <field_name>fczdName</field_name>
2301 2630 <key_value>11</key_value>
2302 2631 <target_name>fcno11_zdname</target_name>
... ... @@ -2381,6 +2710,20 @@
2381 2710 <target_aggregation_type>-</target_aggregation_type>
2382 2711 </field>
2383 2712 <field>
  2713 + <field_name>jhlc</field_name>
  2714 + <key_value>12</key_value>
  2715 + <target_name>fcno12_jhlc</target_name>
  2716 + <target_type>String</target_type>
  2717 + <target_format/>
  2718 + <target_length>-1</target_length>
  2719 + <target_precision>-1</target_precision>
  2720 + <target_decimal_symbol/>
  2721 + <target_grouping_symbol/>
  2722 + <target_currency_symbol/>
  2723 + <target_null_string/>
  2724 + <target_aggregation_type>-</target_aggregation_type>
  2725 + </field>
  2726 + <field>
2384 2727 <field_name>fczdName</field_name>
2385 2728 <key_value>12</key_value>
2386 2729 <target_name>fcno12_zdname</target_name>
... ... @@ -2465,9 +2808,9 @@
2465 2808 <target_aggregation_type>-</target_aggregation_type>
2466 2809 </field>
2467 2810 <field>
2468   - <field_name>fczdName</field_name>
  2811 + <field_name>jhlc</field_name>
2469 2812 <key_value>13</key_value>
2470   - <target_name>fcno13_zdname</target_name>
  2813 + <target_name>fcno13_jhlc</target_name>
2471 2814 <target_type>String</target_type>
2472 2815 <target_format/>
2473 2816 <target_length>-1</target_length>
... ... @@ -2479,9 +2822,9 @@
2479 2822 <target_aggregation_type>-</target_aggregation_type>
2480 2823 </field>
2481 2824 <field>
2482   - <field_name>bc_type</field_name>
  2825 + <field_name>fczdName</field_name>
2483 2826 <key_value>13</key_value>
2484   - <target_name>fcno13_bctype</target_name>
  2827 + <target_name>fcno13_zdname</target_name>
2485 2828 <target_type>String</target_type>
2486 2829 <target_format/>
2487 2830 <target_length>-1</target_length>
... ... @@ -2493,7 +2836,21 @@
2493 2836 <target_aggregation_type>-</target_aggregation_type>
2494 2837 </field>
2495 2838 <field>
2496   - <field_name>xl_dir</field_name>
  2839 + <field_name>bc_type</field_name>
  2840 + <key_value>13</key_value>
  2841 + <target_name>fcno13_bctype</target_name>
  2842 + <target_type>String</target_type>
  2843 + <target_format/>
  2844 + <target_length>-1</target_length>
  2845 + <target_precision>-1</target_precision>
  2846 + <target_decimal_symbol/>
  2847 + <target_grouping_symbol/>
  2848 + <target_currency_symbol/>
  2849 + <target_null_string/>
  2850 + <target_aggregation_type>-</target_aggregation_type>
  2851 + </field>
  2852 + <field>
  2853 + <field_name>xl_dir</field_name>
2497 2854 <key_value>13</key_value>
2498 2855 <target_name>fcno13_xldir</target_name>
2499 2856 <target_type>String</target_type>
... ... @@ -2549,6 +2906,20 @@
2549 2906 <target_aggregation_type>-</target_aggregation_type>
2550 2907 </field>
2551 2908 <field>
  2909 + <field_name>jhlc</field_name>
  2910 + <key_value>14</key_value>
  2911 + <target_name>fcno14_jhlc</target_name>
  2912 + <target_type>String</target_type>
  2913 + <target_format/>
  2914 + <target_length>-1</target_length>
  2915 + <target_precision>-1</target_precision>
  2916 + <target_decimal_symbol/>
  2917 + <target_grouping_symbol/>
  2918 + <target_currency_symbol/>
  2919 + <target_null_string/>
  2920 + <target_aggregation_type>-</target_aggregation_type>
  2921 + </field>
  2922 + <field>
2552 2923 <field_name>fczdName</field_name>
2553 2924 <key_value>14</key_value>
2554 2925 <target_name>fcno14_zdname</target_name>
... ... @@ -2633,6 +3004,20 @@
2633 3004 <target_aggregation_type>-</target_aggregation_type>
2634 3005 </field>
2635 3006 <field>
  3007 + <field_name>jhlc</field_name>
  3008 + <key_value>15</key_value>
  3009 + <target_name>fcno15_jhlc</target_name>
  3010 + <target_type>String</target_type>
  3011 + <target_format/>
  3012 + <target_length>-1</target_length>
  3013 + <target_precision>-1</target_precision>
  3014 + <target_decimal_symbol/>
  3015 + <target_grouping_symbol/>
  3016 + <target_currency_symbol/>
  3017 + <target_null_string/>
  3018 + <target_aggregation_type>-</target_aggregation_type>
  3019 + </field>
  3020 + <field>
2636 3021 <field_name>fczdName</field_name>
2637 3022 <key_value>15</key_value>
2638 3023 <target_name>fcno15_zdname</target_name>
... ... @@ -2717,6 +3102,20 @@
2717 3102 <target_aggregation_type>-</target_aggregation_type>
2718 3103 </field>
2719 3104 <field>
  3105 + <field_name>jhlc</field_name>
  3106 + <key_value>16</key_value>
  3107 + <target_name>fcno16_jhlc</target_name>
  3108 + <target_type>String</target_type>
  3109 + <target_format/>
  3110 + <target_length>-1</target_length>
  3111 + <target_precision>-1</target_precision>
  3112 + <target_decimal_symbol/>
  3113 + <target_grouping_symbol/>
  3114 + <target_currency_symbol/>
  3115 + <target_null_string/>
  3116 + <target_aggregation_type>-</target_aggregation_type>
  3117 + </field>
  3118 + <field>
2720 3119 <field_name>fczdName</field_name>
2721 3120 <key_value>16</key_value>
2722 3121 <target_name>fcno16_zdname</target_name>
... ... @@ -2801,6 +3200,20 @@
2801 3200 <target_aggregation_type>-</target_aggregation_type>
2802 3201 </field>
2803 3202 <field>
  3203 + <field_name>jhlc</field_name>
  3204 + <key_value>17</key_value>
  3205 + <target_name>fcno17_jhlc</target_name>
  3206 + <target_type>String</target_type>
  3207 + <target_format/>
  3208 + <target_length>-1</target_length>
  3209 + <target_precision>-1</target_precision>
  3210 + <target_decimal_symbol/>
  3211 + <target_grouping_symbol/>
  3212 + <target_currency_symbol/>
  3213 + <target_null_string/>
  3214 + <target_aggregation_type>-</target_aggregation_type>
  3215 + </field>
  3216 + <field>
2804 3217 <field_name>fczdName</field_name>
2805 3218 <key_value>17</key_value>
2806 3219 <target_name>fcno17_zdname</target_name>
... ... @@ -2885,6 +3298,20 @@
2885 3298 <target_aggregation_type>-</target_aggregation_type>
2886 3299 </field>
2887 3300 <field>
  3301 + <field_name>jhlc</field_name>
  3302 + <key_value>18</key_value>
  3303 + <target_name>fcno18_jhlc</target_name>
  3304 + <target_type>String</target_type>
  3305 + <target_format/>
  3306 + <target_length>-1</target_length>
  3307 + <target_precision>-1</target_precision>
  3308 + <target_decimal_symbol/>
  3309 + <target_grouping_symbol/>
  3310 + <target_currency_symbol/>
  3311 + <target_null_string/>
  3312 + <target_aggregation_type>-</target_aggregation_type>
  3313 + </field>
  3314 + <field>
2888 3315 <field_name>fczdName</field_name>
2889 3316 <key_value>18</key_value>
2890 3317 <target_name>fcno18_zdname</target_name>
... ... @@ -2969,6 +3396,20 @@
2969 3396 <target_aggregation_type>-</target_aggregation_type>
2970 3397 </field>
2971 3398 <field>
  3399 + <field_name>jhlc</field_name>
  3400 + <key_value>19</key_value>
  3401 + <target_name>fcno19_jhlc</target_name>
  3402 + <target_type>String</target_type>
  3403 + <target_format/>
  3404 + <target_length>-1</target_length>
  3405 + <target_precision>-1</target_precision>
  3406 + <target_decimal_symbol/>
  3407 + <target_grouping_symbol/>
  3408 + <target_currency_symbol/>
  3409 + <target_null_string/>
  3410 + <target_aggregation_type>-</target_aggregation_type>
  3411 + </field>
  3412 + <field>
2972 3413 <field_name>fczdName</field_name>
2973 3414 <key_value>19</key_value>
2974 3415 <target_name>fcno19_zdname</target_name>
... ... @@ -3053,6 +3494,20 @@
3053 3494 <target_aggregation_type>-</target_aggregation_type>
3054 3495 </field>
3055 3496 <field>
  3497 + <field_name>jhlc</field_name>
  3498 + <key_value>20</key_value>
  3499 + <target_name>fcno20_jhlc</target_name>
  3500 + <target_type>String</target_type>
  3501 + <target_format/>
  3502 + <target_length>-1</target_length>
  3503 + <target_precision>-1</target_precision>
  3504 + <target_decimal_symbol/>
  3505 + <target_grouping_symbol/>
  3506 + <target_currency_symbol/>
  3507 + <target_null_string/>
  3508 + <target_aggregation_type>-</target_aggregation_type>
  3509 + </field>
  3510 + <field>
3056 3511 <field_name>fczdName</field_name>
3057 3512 <key_value>20</key_value>
3058 3513 <target_name>fcno20_zdname</target_name>
... ... @@ -3137,6 +3592,20 @@
3137 3592 <target_aggregation_type>-</target_aggregation_type>
3138 3593 </field>
3139 3594 <field>
  3595 + <field_name>jhlc</field_name>
  3596 + <key_value>21</key_value>
  3597 + <target_name>fcno21_jhlc</target_name>
  3598 + <target_type>String</target_type>
  3599 + <target_format/>
  3600 + <target_length>-1</target_length>
  3601 + <target_precision>-1</target_precision>
  3602 + <target_decimal_symbol/>
  3603 + <target_grouping_symbol/>
  3604 + <target_currency_symbol/>
  3605 + <target_null_string/>
  3606 + <target_aggregation_type>-</target_aggregation_type>
  3607 + </field>
  3608 + <field>
3140 3609 <field_name>fczdName</field_name>
3141 3610 <key_value>21</key_value>
3142 3611 <target_name>fcno21_zdname</target_name>
... ... @@ -3221,6 +3690,20 @@
3221 3690 <target_aggregation_type>-</target_aggregation_type>
3222 3691 </field>
3223 3692 <field>
  3693 + <field_name>jhlc</field_name>
  3694 + <key_value>22</key_value>
  3695 + <target_name>fcno22_jhlc</target_name>
  3696 + <target_type>String</target_type>
  3697 + <target_format/>
  3698 + <target_length>-1</target_length>
  3699 + <target_precision>-1</target_precision>
  3700 + <target_decimal_symbol/>
  3701 + <target_grouping_symbol/>
  3702 + <target_currency_symbol/>
  3703 + <target_null_string/>
  3704 + <target_aggregation_type>-</target_aggregation_type>
  3705 + </field>
  3706 + <field>
3224 3707 <field_name>fczdName</field_name>
3225 3708 <key_value>22</key_value>
3226 3709 <target_name>fcno22_zdname</target_name>
... ... @@ -3305,6 +3788,20 @@
3305 3788 <target_aggregation_type>-</target_aggregation_type>
3306 3789 </field>
3307 3790 <field>
  3791 + <field_name>jhlc</field_name>
  3792 + <key_value>23</key_value>
  3793 + <target_name>fcno23_jhlc</target_name>
  3794 + <target_type>String</target_type>
  3795 + <target_format/>
  3796 + <target_length>-1</target_length>
  3797 + <target_precision>-1</target_precision>
  3798 + <target_decimal_symbol/>
  3799 + <target_grouping_symbol/>
  3800 + <target_currency_symbol/>
  3801 + <target_null_string/>
  3802 + <target_aggregation_type>-</target_aggregation_type>
  3803 + </field>
  3804 + <field>
3308 3805 <field_name>fczdName</field_name>
3309 3806 <key_value>23</key_value>
3310 3807 <target_name>fcno23_zdname</target_name>
... ... @@ -3389,6 +3886,20 @@
3389 3886 <target_aggregation_type>-</target_aggregation_type>
3390 3887 </field>
3391 3888 <field>
  3889 + <field_name>jhlc</field_name>
  3890 + <key_value>24</key_value>
  3891 + <target_name>fcno24_jhlc</target_name>
  3892 + <target_type>String</target_type>
  3893 + <target_format/>
  3894 + <target_length>-1</target_length>
  3895 + <target_precision>-1</target_precision>
  3896 + <target_decimal_symbol/>
  3897 + <target_grouping_symbol/>
  3898 + <target_currency_symbol/>
  3899 + <target_null_string/>
  3900 + <target_aggregation_type>-</target_aggregation_type>
  3901 + </field>
  3902 + <field>
3392 3903 <field_name>fczdName</field_name>
3393 3904 <key_value>24</key_value>
3394 3905 <target_name>fcno24_zdname</target_name>
... ... @@ -3473,6 +3984,20 @@
3473 3984 <target_aggregation_type>-</target_aggregation_type>
3474 3985 </field>
3475 3986 <field>
  3987 + <field_name>jhlc</field_name>
  3988 + <key_value>25</key_value>
  3989 + <target_name>fcno25_jhlc</target_name>
  3990 + <target_type>String</target_type>
  3991 + <target_format/>
  3992 + <target_length>-1</target_length>
  3993 + <target_precision>-1</target_precision>
  3994 + <target_decimal_symbol/>
  3995 + <target_grouping_symbol/>
  3996 + <target_currency_symbol/>
  3997 + <target_null_string/>
  3998 + <target_aggregation_type>-</target_aggregation_type>
  3999 + </field>
  4000 + <field>
3476 4001 <field_name>fczdName</field_name>
3477 4002 <key_value>25</key_value>
3478 4003 <target_name>fcno25_zdname</target_name>
... ... @@ -3557,6 +4082,20 @@
3557 4082 <target_aggregation_type>-</target_aggregation_type>
3558 4083 </field>
3559 4084 <field>
  4085 + <field_name>jhlc</field_name>
  4086 + <key_value>26</key_value>
  4087 + <target_name>fcno26_jhlc</target_name>
  4088 + <target_type>String</target_type>
  4089 + <target_format/>
  4090 + <target_length>-1</target_length>
  4091 + <target_precision>-1</target_precision>
  4092 + <target_decimal_symbol/>
  4093 + <target_grouping_symbol/>
  4094 + <target_currency_symbol/>
  4095 + <target_null_string/>
  4096 + <target_aggregation_type>-</target_aggregation_type>
  4097 + </field>
  4098 + <field>
3560 4099 <field_name>fczdName</field_name>
3561 4100 <key_value>26</key_value>
3562 4101 <target_name>fcno26_zdname</target_name>
... ... @@ -3641,6 +4180,20 @@
3641 4180 <target_aggregation_type>-</target_aggregation_type>
3642 4181 </field>
3643 4182 <field>
  4183 + <field_name>jhlc</field_name>
  4184 + <key_value>27</key_value>
  4185 + <target_name>fcno27_jhlc</target_name>
  4186 + <target_type>String</target_type>
  4187 + <target_format/>
  4188 + <target_length>-1</target_length>
  4189 + <target_precision>-1</target_precision>
  4190 + <target_decimal_symbol/>
  4191 + <target_grouping_symbol/>
  4192 + <target_currency_symbol/>
  4193 + <target_null_string/>
  4194 + <target_aggregation_type>-</target_aggregation_type>
  4195 + </field>
  4196 + <field>
3644 4197 <field_name>fczdName</field_name>
3645 4198 <key_value>27</key_value>
3646 4199 <target_name>fcno27_zdname</target_name>
... ... @@ -3725,6 +4278,20 @@
3725 4278 <target_aggregation_type>-</target_aggregation_type>
3726 4279 </field>
3727 4280 <field>
  4281 + <field_name>jhlc</field_name>
  4282 + <key_value>28</key_value>
  4283 + <target_name>fcno28_jhlc</target_name>
  4284 + <target_type>String</target_type>
  4285 + <target_format/>
  4286 + <target_length>-1</target_length>
  4287 + <target_precision>-1</target_precision>
  4288 + <target_decimal_symbol/>
  4289 + <target_grouping_symbol/>
  4290 + <target_currency_symbol/>
  4291 + <target_null_string/>
  4292 + <target_aggregation_type>-</target_aggregation_type>
  4293 + </field>
  4294 + <field>
3728 4295 <field_name>fczdName</field_name>
3729 4296 <key_value>28</key_value>
3730 4297 <target_name>fcno28_zdname</target_name>
... ... @@ -3809,6 +4376,20 @@
3809 4376 <target_aggregation_type>-</target_aggregation_type>
3810 4377 </field>
3811 4378 <field>
  4379 + <field_name>jhlc</field_name>
  4380 + <key_value>29</key_value>
  4381 + <target_name>fcno29_jhlc</target_name>
  4382 + <target_type>String</target_type>
  4383 + <target_format/>
  4384 + <target_length>-1</target_length>
  4385 + <target_precision>-1</target_precision>
  4386 + <target_decimal_symbol/>
  4387 + <target_grouping_symbol/>
  4388 + <target_currency_symbol/>
  4389 + <target_null_string/>
  4390 + <target_aggregation_type>-</target_aggregation_type>
  4391 + </field>
  4392 + <field>
3812 4393 <field_name>fczdName</field_name>
3813 4394 <key_value>29</key_value>
3814 4395 <target_name>fcno29_zdname</target_name>
... ... @@ -3893,6 +4474,20 @@
3893 4474 <target_aggregation_type>-</target_aggregation_type>
3894 4475 </field>
3895 4476 <field>
  4477 + <field_name>jhlc</field_name>
  4478 + <key_value>30</key_value>
  4479 + <target_name>fcno30_jhlc</target_name>
  4480 + <target_type>String</target_type>
  4481 + <target_format/>
  4482 + <target_length>-1</target_length>
  4483 + <target_precision>-1</target_precision>
  4484 + <target_decimal_symbol/>
  4485 + <target_grouping_symbol/>
  4486 + <target_currency_symbol/>
  4487 + <target_null_string/>
  4488 + <target_aggregation_type>-</target_aggregation_type>
  4489 + </field>
  4490 + <field>
3896 4491 <field_name>fczdName</field_name>
3897 4492 <key_value>30</key_value>
3898 4493 <target_name>fcno30_zdname</target_name>
... ... @@ -3977,6 +4572,20 @@
3977 4572 <target_aggregation_type>-</target_aggregation_type>
3978 4573 </field>
3979 4574 <field>
  4575 + <field_name>jhlc</field_name>
  4576 + <key_value>31</key_value>
  4577 + <target_name>fcno31_jhlc</target_name>
  4578 + <target_type>String</target_type>
  4579 + <target_format/>
  4580 + <target_length>-1</target_length>
  4581 + <target_precision>-1</target_precision>
  4582 + <target_decimal_symbol/>
  4583 + <target_grouping_symbol/>
  4584 + <target_currency_symbol/>
  4585 + <target_null_string/>
  4586 + <target_aggregation_type>-</target_aggregation_type>
  4587 + </field>
  4588 + <field>
3980 4589 <field_name>fczdName</field_name>
3981 4590 <key_value>31</key_value>
3982 4591 <target_name>fcno31_zdname</target_name>
... ... @@ -4061,6 +4670,20 @@
4061 4670 <target_aggregation_type>-</target_aggregation_type>
4062 4671 </field>
4063 4672 <field>
  4673 + <field_name>jhlc</field_name>
  4674 + <key_value>32</key_value>
  4675 + <target_name>fcno32_jhlc</target_name>
  4676 + <target_type>String</target_type>
  4677 + <target_format/>
  4678 + <target_length>-1</target_length>
  4679 + <target_precision>-1</target_precision>
  4680 + <target_decimal_symbol/>
  4681 + <target_grouping_symbol/>
  4682 + <target_currency_symbol/>
  4683 + <target_null_string/>
  4684 + <target_aggregation_type>-</target_aggregation_type>
  4685 + </field>
  4686 + <field>
4064 4687 <field_name>fczdName</field_name>
4065 4688 <key_value>32</key_value>
4066 4689 <target_name>fcno32_zdname</target_name>
... ... @@ -4145,6 +4768,20 @@
4145 4768 <target_aggregation_type>-</target_aggregation_type>
4146 4769 </field>
4147 4770 <field>
  4771 + <field_name>jhlc</field_name>
  4772 + <key_value>33</key_value>
  4773 + <target_name>fcno33_jhlc</target_name>
  4774 + <target_type>String</target_type>
  4775 + <target_format/>
  4776 + <target_length>-1</target_length>
  4777 + <target_precision>-1</target_precision>
  4778 + <target_decimal_symbol/>
  4779 + <target_grouping_symbol/>
  4780 + <target_currency_symbol/>
  4781 + <target_null_string/>
  4782 + <target_aggregation_type>-</target_aggregation_type>
  4783 + </field>
  4784 + <field>
4148 4785 <field_name>fczdName</field_name>
4149 4786 <key_value>33</key_value>
4150 4787 <target_name>fcno33_zdname</target_name>
... ... @@ -4229,6 +4866,20 @@
4229 4866 <target_aggregation_type>-</target_aggregation_type>
4230 4867 </field>
4231 4868 <field>
  4869 + <field_name>jhlc</field_name>
  4870 + <key_value>34</key_value>
  4871 + <target_name>fcno34_jhlc</target_name>
  4872 + <target_type>String</target_type>
  4873 + <target_format/>
  4874 + <target_length>-1</target_length>
  4875 + <target_precision>-1</target_precision>
  4876 + <target_decimal_symbol/>
  4877 + <target_grouping_symbol/>
  4878 + <target_currency_symbol/>
  4879 + <target_null_string/>
  4880 + <target_aggregation_type>-</target_aggregation_type>
  4881 + </field>
  4882 + <field>
4232 4883 <field_name>fczdName</field_name>
4233 4884 <key_value>34</key_value>
4234 4885 <target_name>fcno34_zdname</target_name>
... ... @@ -4313,6 +4964,20 @@
4313 4964 <target_aggregation_type>-</target_aggregation_type>
4314 4965 </field>
4315 4966 <field>
  4967 + <field_name>jhlc</field_name>
  4968 + <key_value>35</key_value>
  4969 + <target_name>fcno35_jhlc</target_name>
  4970 + <target_type>String</target_type>
  4971 + <target_format/>
  4972 + <target_length>-1</target_length>
  4973 + <target_precision>-1</target_precision>
  4974 + <target_decimal_symbol/>
  4975 + <target_grouping_symbol/>
  4976 + <target_currency_symbol/>
  4977 + <target_null_string/>
  4978 + <target_aggregation_type>-</target_aggregation_type>
  4979 + </field>
  4980 + <field>
4316 4981 <field_name>fczdName</field_name>
4317 4982 <key_value>35</key_value>
4318 4983 <target_name>fcno35_zdname</target_name>
... ... @@ -4451,6 +5116,10 @@
4451 5116 <rename/>
4452 5117 <length>-2</length>
4453 5118 <precision>-2</precision>
  5119 + </field> <field> <name>jhlc</name>
  5120 + <rename/>
  5121 + <length>-2</length>
  5122 + <precision>-2</precision>
4454 5123 </field> <select_unspecified>N</select_unspecified>
4455 5124 </fields> <cluster_schema/>
4456 5125 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
... ... @@ -4511,6 +5180,10 @@
4511 5180 <rename/>
4512 5181 <length>-2</length>
4513 5182 <precision>-2</precision>
  5183 + </field> <field> <name>jhlc</name>
  5184 + <rename/>
  5185 + <length>-2</length>
  5186 + <precision>-2</precision>
4514 5187 </field> <select_unspecified>N</select_unspecified>
4515 5188 </fields> <cluster_schema/>
4516 5189 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
... ... @@ -4755,7 +5428,7 @@
4755 5428 <schema_name/>
4756 5429 </partitioning>
4757 5430 <connection>bus_control_variable</connection>
4758   - <sql>select &#xa;t.id as id&#xa;, g.lp_name as lp&#xa;, g.xl as xl&#xa;, qdz&#xa;, zdz&#xa;, tcc&#xa;, fcsj&#xa;, bc_type &#xa;, bcs&#xa;, fcno&#xa;, xl_dir&#xa;, isfb&#xa;from bsth_c_s_ttinfo_detail t left join &#xa;bsth_c_s_gbi g on t.lp &#x3d; g.id &#xa;where &#xa;g.xl &#x3d; &#x3f; and&#xa;t.ttinfo &#x3d; &#x3f; &#xa;order by t.bcs asc</sql>
  5431 + <sql>select &#xa;t.id as id&#xa;, g.lp_name as lp&#xa;, g.xl as xl&#xa;, qdz&#xa;, zdz&#xa;, tcc&#xa;, fcsj&#xa;, jhlc&#xa;, bc_type &#xa;, bcs&#xa;, fcno&#xa;, xl_dir&#xa;, isfb&#xa;from bsth_c_s_ttinfo_detail t left join &#xa;bsth_c_s_gbi g on t.lp &#x3d; g.id &#xa;where &#xa;g.xl &#x3d; &#x3f; and&#xa;t.ttinfo &#x3d; &#x3f; &#xa;order by t.bcs asc</sql>
4759 5432 <limit>0</limit>
4760 5433 <lookup>&#x83b7;&#x53d6;&#x53d8;&#x91cf;</lookup>
4761 5434 <execute_each_row>N</execute_each_row>
... ...
src/main/resources/logback.xml
... ... @@ -106,6 +106,48 @@
106 106 <appender-ref ref="TRAFFIC" />
107 107 </logger>
108 108  
  109 + <!-- schedule 数据工具操作日志 -->
  110 + <appender name="DATATOOLS"
  111 + class="ch.qos.logback.core.rolling.RollingFileAppender">
  112 + <file>${LOG_BASE}/schedule/datatools/datatools.log</file>
  113 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  114 + <fileNamePattern>${LOG_BASE}/schedule/datatools/datatools-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  115 + <timeBasedFileNamingAndTriggeringPolicy
  116 + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  117 + <maxFileSize>100MB</maxFileSize>
  118 + </timeBasedFileNamingAndTriggeringPolicy>
  119 + </rollingPolicy>
  120 +
  121 + <layout class="ch.qos.logback.classic.PatternLayout">
  122 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%file:%line] %-5level -%msg%n
  123 + </pattern>
  124 + </layout>
  125 + </appender>
  126 + <!-- schedule 时刻表操作日志 -->
  127 + <appender name="TIMETABLE"
  128 + class="ch.qos.logback.core.rolling.RollingFileAppender">
  129 + <file>${LOG_BASE}/schedule/timetable/timetable.log</file>
  130 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  131 + <fileNamePattern>${LOG_BASE}/schedule/timetable/timetable-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  132 + <timeBasedFileNamingAndTriggeringPolicy
  133 + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  134 + <maxFileSize>100MB</maxFileSize>
  135 + </timeBasedFileNamingAndTriggeringPolicy>
  136 + </rollingPolicy>
  137 +
  138 + <layout class="ch.qos.logback.classic.PatternLayout">
  139 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%file:%line] %-5level -%msg%n
  140 + </pattern>
  141 + </layout>
  142 + </appender>
  143 + <logger name="com.bsth.service.schedule.impl.TTInfoDetailServiceImpl" level="INFO" additivity="false" >
  144 + <appender-ref ref="TIMETABLE" />
  145 + </logger>
  146 + <logger name="com.bsth.service.schedule.utils.DataToolsServiceImpl" level="INFO" additivity="false" >
  147 + <appender-ref ref="TIMETABLE" />
  148 + <appender-ref ref="DATATOOLS" />
  149 + </logger>
  150 +
109 151 <!-- 日志输出级别 -->
110 152 <root level="info">
111 153 <appender-ref ref="STDOUT" />
... ...
src/main/resources/static/index.html
1 1 <!DOCTYPE html>
2 2 <html lang="zh">
3 3 <head>
4   -<meta name="renderer" content="webkit" />
5   -<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
6   -<meta charset="UTF-8">
7   -<title>调度系统</title>
8   -
9   -<meta http-equiv="Pragma" content="no-cache">
10   -<meta http-equiv="Cache-control" content="no-cache">
11   -<meta http-equiv="Cache" content="no-cache">
12   -
13   -<!-- Font Awesome 图标字体 -->
14   -<link href="/metronic_v4.5.4/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
15   -<!-- Bootstrap style -->
16   -<link href="/metronic_v4.5.4/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
17   -<!-- jsTree 数插件 -->
18   -<link href="/metronic_v4.5.4/plugins/jstree/dist/themes/default/style.min.css" rel="stylesheet" type="text/css" />
19   -<!-- MULTI-select 多选下拉框美化 -->
20   -<link href="/metronic_v4.5.4/plugins/jquery-multi-select/css/multi-select.css" rel="stylesheet" type="text/css" />
21   -
22   -<!-- editable -->
23   -<link href="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css" rel="stylesheet" type="text/css" />
24   -<!-- METRONIC style -->
25   -<link href="/metronic_v4.5.4/layout4/css/themes/light.min.css" rel="stylesheet" type="text/css" id="style_color" />
26   -<link href="/metronic_v4.5.4/css/components.css" rel="stylesheet" type="text/css" />
27   -<link href="/metronic_v4.5.4/css/plugins.css" rel="stylesheet" type="text/css" />
28   -<link href="/metronic_v4.5.4/layout4/css/layout.min.css" rel="stylesheet" type="text/css" />
29   -<link href="/metronic_v4.5.4/layout4/css/custom.min.css" rel="stylesheet" type="text/css" />
30   -<!-- select2 下拉框插件 -->
31   -<link href="/metronic_v4.5.4/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
32   -<link href="/metronic_v4.5.4/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
33   -<!-- layer 弹层 插件 -->
34   -<link href="/assets/plugins/layer-v2.4/layer/skin/layer.css" rel="stylesheet" type="text/css" />
35   -<!-- fileinput 上传 插件 -->
36   -<link href="/assets/plugins/fileinput/css/fileinput.min.css" rel="stylesheet" type="text/css" />
37   -<!-- iCheck 单选框和复选框 -->
38   -<link href="/metronic_v4.5.4/plugins/icheck/skins/all.css" rel="stylesheet" type="text/css" />
39   -<!-- 日期控件 -->
40   -<link href="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" />
41   -<!-- table 表格控件 -->
42   -<link rel="stylesheet" href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" type="text/css" />
43   -
44   -<!-- handsontable样式 -->
45   -<link rel="stylesheet" href="/assets/bower_components/handsontable/dist/handsontable.full.css"/>
46   -<!-- schedule计划调度AngularJS模块主css -->
47   -<link rel="stylesheet" href="/pages/scheduleApp/module/common/main.css" type="text/css"/>
48   -
49   -<style type="text/css">
50   -.searchForm{
51   -
52   -}
53   -.searchForm .form-group .control-label{
54   - padding-right: 0px;
55   - text-align: right;
56   - margin-top: 7px;
57   -}
58   -.searchForm .form-group>div{
59   - padding-left: 10px;
60   - padding-right: 0px;
61   -}
62   -.searchForm .row>div{
63   - padding-left: 0px;
64   - padding-right: 0px;
65   - padding: 5px 0 5px 0;
66   - width: 270px;
67   - display: inline-block;
68   -}
69   -.searchForm .form-actions{
70   -
71   -}
72   -tr.row-active td {
73   - border-bottom: 1px solid blue!important;
74   - color: blue;
75   -}
76   -.ms-container .ms-selectable li.ms-elem-selectable, .ms-container .ms-selection li.ms-elem-selection {
77   - font-size: 14px;
78   -}
79   -.ms-container .ms-selectable li.ms-elem-selectable, .ms-container .ms-selection li.ms-elem-selection{
80   - padding: 6px 26px;
81   -}
82   -.ms-container .ms-list{
83   - height: 306px;
84   -}
85   -.ms-container .ms-selectable, .ms-container .ms-selection{
86   - width: 47%;
87   -}
88   -.ms-container {
89   - width: 470px;
90   - margin: auto;
91   -}
92   -.multi-custom-header-left{
93   - text-align: center;
94   - padding: 7px;
95   - color: #3B3F51;
96   -}
97   -.multi-custom-header-right{
98   - text-align: center;
99   - padding: 7px;
100   - font-weight: bold;
101   - color: #36C6D3;
102   -}
103   -.mt-element-list .list-simple.mt-list-container ul > .mt-list-item > .list-item-content {
104   - padding: 0 55px 0 0px;
105   -}
106   -.mt-element-list .list-simple.mt-list-container ul > .mt-list-item {
107   - padding: 3.3px 0;
108   -}
109   -
110   -#route-container{
111   - display: none;
112   -}
113   -
114   -.page-content.active{
115   - display: block !important;
116   -}
117   -
118   -.page-header.navbar .page-logo .logo-default {
119   - margin: 0;
120   -}
121   -.page-header.navbar .top-menu .navbar-nav>li.dropdown.open .dropdown-toggle {
122   - background-color: #284a99;
123   -}
124   -.page-header.navbar .page-logo{
125   - padding-right: 10px;
126   -}
127   -
128   -.page-logo .logo-default.logo-default-text{
129   - font-weight: 600;
130   - color: white !important;
131   - margin-top: 19px !important;
132   - font-size: 24px;
133   - text-decoration: none;
134   -}
135   -.page-logo .logo-default.logo-default-text:HOVER{
136   - color: #dedede !important;
137   -}
138   -
139   -</style>
140   -
141   -<!-- ocLazyLoading载入文件的位置 -->
142   -<link id="ng_load_plugins_before" />
  4 + <meta name="renderer" content="webkit"/>
  5 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  6 + <meta charset="UTF-8">
  7 + <title>调度系统</title>
  8 +
  9 + <meta http-equiv="Pragma" content="no-cache">
  10 + <meta http-equiv="Cache-control" content="no-cache">
  11 + <meta http-equiv="Cache" content="no-cache">
  12 +
  13 + <!-- Font Awesome 图标字体 -->
  14 + <link href="/metronic_v4.5.4/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
  15 + <!-- Bootstrap style -->
  16 + <link href="/metronic_v4.5.4/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
  17 + <!-- jsTree 数插件 -->
  18 + <link href="/metronic_v4.5.4/plugins/jstree/dist/themes/default/style.min.css" rel="stylesheet" type="text/css"/>
  19 + <!-- MULTI-select 多选下拉框美化 -->
  20 + <link href="/metronic_v4.5.4/plugins/jquery-multi-select/css/multi-select.css" rel="stylesheet" type="text/css"/>
  21 +
  22 + <!-- editable -->
  23 + <link href="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css"
  24 + rel="stylesheet" type="text/css"/>
  25 + <!-- METRONIC style -->
  26 + <link href="/metronic_v4.5.4/layout4/css/themes/light.min.css" rel="stylesheet" type="text/css" id="style_color"/>
  27 + <link href="/metronic_v4.5.4/css/components.css" rel="stylesheet" type="text/css"/>
  28 + <link href="/metronic_v4.5.4/css/plugins.css" rel="stylesheet" type="text/css"/>
  29 + <link href="/metronic_v4.5.4/layout4/css/layout.min.css" rel="stylesheet" type="text/css"/>
  30 + <link href="/metronic_v4.5.4/layout4/css/custom.min.css" rel="stylesheet" type="text/css"/>
  31 + <!-- select2 下拉框插件 -->
  32 + <link href="/metronic_v4.5.4/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css"/>
  33 + <link href="/metronic_v4.5.4/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css"/>
  34 + <!-- layer 弹层 插件 -->
  35 + <link href="/assets/plugins/layer-v2.4/layer/skin/layer.css" rel="stylesheet" type="text/css"/>
  36 + <!-- fileinput 上传 插件 -->
  37 + <link href="/assets/plugins/fileinput/css/fileinput.min.css" rel="stylesheet" type="text/css"/>
  38 + <!-- iCheck 单选框和复选框 -->
  39 + <link href="/metronic_v4.5.4/plugins/icheck/skins/all.css" rel="stylesheet" type="text/css"/>
  40 + <!-- 日期控件 -->
  41 + <link href="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/css/bootstrap-datetimepicker.min.css"
  42 + rel="stylesheet" type="text/css"/>
  43 + <!-- table 表格控件 -->
  44 + <link rel="stylesheet" href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"
  45 + type="text/css"/>
  46 +
  47 + <!-- handsontable样式 -->
  48 + <link rel="stylesheet" href="/assets/bower_components/handsontable/dist/handsontable.full.css"/>
  49 + <!-- schedule计划调度AngularJS模块主css -->
  50 + <link rel="stylesheet" href="/pages/scheduleApp/module/common/main.css" type="text/css"/>
  51 +
  52 + <style type="text/css">
  53 + .searchForm {
  54 +
  55 + }
  56 +
  57 + .searchForm .form-group .control-label {
  58 + padding-right: 0px;
  59 + text-align: right;
  60 + margin-top: 7px;
  61 + }
  62 +
  63 + .searchForm .form-group > div {
  64 + padding-left: 10px;
  65 + padding-right: 0px;
  66 + }
  67 +
  68 + .searchForm .row > div {
  69 + padding-left: 0px;
  70 + padding-right: 0px;
  71 + padding: 5px 0 5px 0;
  72 + width: 270px;
  73 + display: inline-block;
  74 + }
  75 +
  76 + .searchForm .form-actions {
  77 +
  78 + }
  79 +
  80 + tr.row-active td {
  81 + border-bottom: 1px solid blue !important;
  82 + color: blue;
  83 + }
  84 +
  85 + .ms-container .ms-selectable li.ms-elem-selectable, .ms-container .ms-selection li.ms-elem-selection {
  86 + font-size: 14px;
  87 + }
  88 +
  89 + .ms-container .ms-selectable li.ms-elem-selectable, .ms-container .ms-selection li.ms-elem-selection {
  90 + padding: 6px 26px;
  91 + }
  92 +
  93 + .ms-container .ms-list {
  94 + height: 306px;
  95 + }
  96 +
  97 + .ms-container .ms-selectable, .ms-container .ms-selection {
  98 + width: 47%;
  99 + }
  100 +
  101 + .ms-container {
  102 + width: 470px;
  103 + margin: auto;
  104 + }
  105 +
  106 + .multi-custom-header-left {
  107 + text-align: center;
  108 + padding: 7px;
  109 + color: #3B3F51;
  110 + }
  111 +
  112 + .multi-custom-header-right {
  113 + text-align: center;
  114 + padding: 7px;
  115 + font-weight: bold;
  116 + color: #36C6D3;
  117 + }
  118 +
  119 + .mt-element-list .list-simple.mt-list-container ul > .mt-list-item > .list-item-content {
  120 + padding: 0 55px 0 0px;
  121 + }
  122 +
  123 + .mt-element-list .list-simple.mt-list-container ul > .mt-list-item {
  124 + padding: 3.3px 0;
  125 + }
  126 +
  127 + #route-container {
  128 + display: none;
  129 + }
  130 +
  131 + .page-content.active {
  132 + display: block !important;
  133 + }
  134 +
  135 + .page-header.navbar .page-logo .logo-default {
  136 + margin: 0;
  137 + }
  138 +
  139 + .page-header.navbar .top-menu .navbar-nav > li.dropdown.open .dropdown-toggle {
  140 + background-color: #284a99;
  141 + }
  142 +
  143 + .page-header.navbar .page-logo {
  144 + padding-right: 10px;
  145 + }
  146 +
  147 + .page-logo .logo-default.logo-default-text {
  148 + font-weight: 600;
  149 + color: white !important;
  150 + margin-top: 19px !important;
  151 + font-size: 24px;
  152 + text-decoration: none;
  153 + }
  154 +
  155 + .page-logo .logo-default.logo-default-text:HOVER {
  156 + color: #dedede !important;
  157 + }
  158 +
  159 + </style>
  160 +
  161 + <!-- ocLazyLoading载入文件的位置 -->
  162 + <link id="ng_load_plugins_before"/>
143 163  
144 164 </head>
145 165 <body class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo page-sidebar-fixed">
146   - <div class="page-header navbar navbar-fixed-top" style="background: linear-gradient(to bottom ,#124e78, #125688);">
147   - <div class="page-header-inner ">
148   - <!-- LOGO -->
149   - <div class="page-logo">
150   - <a href="index.html" class="logo-default logo-default-text" > 闵行公交调度系统 </a>
151   - <div class="menu-toggler sidebar-toggler">
152   - </div>
153   - </div>
154   - <!-- END LOGO -->
155   - <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse"> </a>
156   - <div class="page-top">
157   - <div class="top-menu">
158   - <ul class="nav navbar-nav pull-right">
159   - <!-- 信息通知区 -->
160   - <li class="dropdown dropdown-extended dropdown-notification dropdown-dark" id="header_notification_bar">
161   - <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
162   - <i class="fa fa-bell"></i>
163   - <span class="badge badge-success"> 0 </span>
164   - </a>
165   - <ul class="dropdown-menu" style="max-width: 345px;width: 345px;">
166   - <li class="external">
167   - <h3>今日 <span class="bold">0 条</span> 通知</h3>
168   - <a href="javascript:;">查看全部</a>
169   - </li>
170   - <li>
171   - <ul class="dropdown-menu-list scroller" style="height: 250px;" data-handle-color="#637283">
172   - </ul>
173   - </li>
174   - </ul>
175   - </li>
176   - <li class="dropdown dropdown-user dropdown-dark">
177   - <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
178   - <span id="indexTopUName" class="username username-hide-on-mobile" style="vertical-align: middle;"> <i class="fa fa-user"></i></span>
179   - </a>
180   - <ul class="dropdown-menu dropdown-menu-default">
181   - <li>
182   - <a href="javascript:;">
183   - <i class="fa fa-user"></i> 我的信息 </a>
184   - </li>
185   - <li>
186   - <a href="javascript:;" id="changePWD">
187   - <i class="fa fa-unlock-alt"></i> 修改密码</a>
188   - </li>
189   - <li class="divider"> </li>
190   - <li>
191   - <a href="javascript:;">
192   - <i class="fa fa-lock"></i> 锁屏 </a>
193   - </li>
194   - <li>
195   - <a href="/logout">
196   - <i class="fa fa-key"></i> 注销登陆 </a>
197   - </li>
198   - </ul>
199   - </li>
200   - </ul>
201   - </div>
  166 +<div class="page-header navbar navbar-fixed-top" style="background: linear-gradient(to bottom ,#124e78, #125688);">
  167 + <div class="page-header-inner ">
  168 + <!-- LOGO -->
  169 + <div class="page-logo">
  170 + <a href="index.html" class="logo-default logo-default-text"> 闵行公交调度系统 </a>
  171 + <div class="menu-toggler sidebar-toggler">
202 172 </div>
203 173 </div>
204   - </div>
205   - <div class="page-container">
206   - <div class="page-sidebar-wrapper">
207   - <div class="page-sidebar navbar-collapse collapse">
208   - <ul class="page-sidebar-menu page-sidebar-menu-fixed" data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" id="leftMenuSidebar">
  174 + <!-- END LOGO -->
  175 + <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse"
  176 + data-target=".navbar-collapse"> </a>
  177 + <div class="page-top">
  178 + <div class="top-menu">
  179 + <ul class="nav navbar-nav pull-right">
  180 + <!-- 信息通知区 -->
  181 + <li class="dropdown dropdown-extended dropdown-notification dropdown-dark"
  182 + id="header_notification_bar">
  183 + <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown"
  184 + data-close-others="true">
  185 + <i class="fa fa-bell"></i>
  186 + <span class="badge badge-success"> 0 </span>
  187 + </a>
  188 + <ul class="dropdown-menu" style="max-width: 345px;width: 345px;">
  189 + <li class="external">
  190 + <h3>今日 <span class="bold">0 条</span> 通知</h3>
  191 + <a href="javascript:;">查看全部</a>
  192 + </li>
  193 + <li>
  194 + <ul class="dropdown-menu-list scroller" style="height: 250px;"
  195 + data-handle-color="#637283">
  196 + </ul>
  197 + </li>
  198 + </ul>
  199 + </li>
  200 + <li class="dropdown dropdown-user dropdown-dark">
  201 + <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown"
  202 + data-close-others="true">
  203 + <span id="indexTopUName" class="username username-hide-on-mobile"
  204 + style="vertical-align: middle;"> <i class="fa fa-user"></i></span>
  205 + </a>
  206 + <ul class="dropdown-menu dropdown-menu-default">
  207 + <li>
  208 + <a href="javascript:;">
  209 + <i class="fa fa-user"></i> 我的信息 </a>
  210 + </li>
  211 + <li>
  212 + <a href="javascript:;" id="changePWD">
  213 + <i class="fa fa-unlock-alt"></i> 修改密码</a>
  214 + </li>
  215 + <li class="divider"></li>
  216 + <li>
  217 + <a href="javascript:;">
  218 + <i class="fa fa-lock"></i> 锁屏 </a>
  219 + </li>
  220 + <li>
  221 + <a href="/logout">
  222 + <i class="fa fa-key"></i> 注销登陆 </a>
  223 + </li>
  224 + </ul>
  225 + </li>
209 226 </ul>
210 227 </div>
211 228 </div>
212   - <div class="page-content-wrapper">
213   - <div id="pjax-container" class="page-content"></div>
214   -
215   - <div id="route-container">
216   - <div ng-app="ScheduleApp">
217   - <div ng-controller="ScheduleAppController">
218   -
219   - <!-- loading widget -->
220   - <div id="loadingWidget" class="flyover mask" loading-widget>
221   - <div class="alert alert-info">
222   - <strong>载入中......</strong>
223   - </div>
224   - </div>
225   -
226   - <div ui-view class="fade-in-up"> </div>
  229 + </div>
  230 +</div>
  231 +<div class="page-container">
  232 + <div class="page-sidebar-wrapper">
  233 + <div class="page-sidebar navbar-collapse collapse">
  234 + <ul class="page-sidebar-menu page-sidebar-menu-fixed" data-keep-expanded="false" data-auto-scroll="true"
  235 + data-slide-speed="200" id="leftMenuSidebar">
  236 + </ul>
  237 + </div>
  238 + </div>
  239 + <div class="page-content-wrapper">
  240 + <div id="pjax-container" class="page-content"></div>
  241 +
  242 + <div id="route-container">
  243 + <div ng-app="ScheduleApp">
  244 + <div ng-controller="ScheduleAppController">
  245 +
  246 + <!-- loading widget -->
  247 + <div id="loadingWidget" class="flyover mask" loading-widget>
  248 + <div class="alert alert-info">
  249 + <strong>载入中......</strong>
227 250 </div>
228 251 </div>
  252 +
  253 + <div ui-view class="fade-in-up"></div>
229 254 </div>
230   - </div>
  255 + </div>
  256 + </div>
231 257 </div>
  258 +</div>
232 259  
233 260 <script id="menu_list_temp" type="text/html">
234   -{{each list as group i}}
235   - <li class="heading">
236   - <h3 class="uppercase">{{group.name}}</h3>
237   - </li>
238   - {{each group.children as dir j}}
239   - <li class="nav-item">
240   - <a href="javascript:;" class="nav-link nav-toggle ">
241   - <i class="{{dir.icon}}"></i>
242   - <span class="title">{{dir.name}}</span>
243   - <span class="arrow"></span>
244   - </a>
245   - <ul class="sub-menu">
246   - {{each dir.children as module s}}
247   - <li class="nav-item ">
248   - {{if module.container=="pjax-container"}}
249   - <a href="/pages/{{module.path}}" class="nav-link " data-pjax>
250   - <span class="title">{{module.name}}</span>
251   - </a>
252   - {{else}}
253   - <a href="{{module.path}}" class="nav-link " data-angularjs>
254   - <span class="title">{{module.name}}</span>
255   - </a>
256   - {{/if}}
257   - </li>
258   - {{/each}}
259   - </ul>
260   - </li>
261   - {{/each}}
262   -{{/each}}
  261 + {{each list as group i}}
  262 + <li class="heading">
  263 + <h3 class="uppercase">{{group.name}}</h3>
  264 + </li>
  265 + {{each group.children as dir j}}
  266 + <li class="nav-item">
  267 + <a href="javascript:;" class="nav-link nav-toggle ">
  268 + <i class="{{dir.icon}}"></i>
  269 + <span class="title">{{dir.name}}</span>
  270 + <span class="arrow"></span>
  271 + </a>
  272 + <ul class="sub-menu">
  273 + {{each dir.children as module s}}
  274 + <li class="nav-item ">
  275 + {{if module.container=="pjax-container"}}
  276 + <a href="/pages/{{module.path}}" class="nav-link " data-pjax>
  277 + <span class="title">{{module.name}}</span>
  278 + </a>
  279 + {{else}}
  280 + <a href="{{module.path}}" class="nav-link " data-angularjs>
  281 + <span class="title">{{module.name}}</span>
  282 + </a>
  283 + {{/if}}
  284 + </li>
  285 + {{/each}}
  286 + </ul>
  287 + </li>
  288 + {{/each}}
  289 + {{/each}}
263 290  
264 291 </script>
265 292 <!-- jQuery -->
... ... @@ -272,24 +299,24 @@ tr.row-active td {
272 299 <script src="/metronic_v4.5.4/scripts/app.min.js" data-exclude=1></script>
273 300 <script src="/metronic_v4.5.4/layout4/scripts/layout.min.js" data-exclude=1></script>
274 301 <!-- 虚拟滚动条 -->
275   -<script src="/metronic_v4.5.4/plugins/jquery-slimscroll/jquery.slimscroll.min.js" ></script>
  302 +<script src="/metronic_v4.5.4/plugins/jquery-slimscroll/jquery.slimscroll.min.js"></script>
276 303 <!-- jsTree 树插件 -->
277   -<script src="/metronic_v4.5.4/plugins/jstree/dist/jstree.min.js" ></script>
  304 +<script src="/metronic_v4.5.4/plugins/jstree/dist/jstree.min.js"></script>
278 305 <!-- bootstrap-hover-dropDown -->
279   -<script src="/metronic_v4.5.4/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" ></script>
  306 +<script src="/metronic_v4.5.4/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"></script>
280 307 <!-- jquery.validate 表单验证 -->
281 308 <script src="/metronic_v4.5.4/plugins/jquery-validation/js/jquery.validate.min.js"></script>
282 309 <script src="/metronic_v4.5.4/plugins/jquery-validation/js/localization/messages_zh.js"></script>
283 310 <!-- 向导式插件 -->
284 311 <script src="/metronic_v4.5.4//plugins/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script>
285 312 <!-- iCheck 单选框和复选框 -->
286   -<script src="/metronic_v4.5.4/plugins/icheck/icheck.min.js" ></script>
  313 +<script src="/metronic_v4.5.4/plugins/icheck/icheck.min.js"></script>
287 314 <!-- select2 下拉框 -->
288   -<script src="/metronic_v4.5.4/plugins/select2/js/select2.full.min.js" ></script>
  315 +<script src="/metronic_v4.5.4/plugins/select2/js/select2.full.min.js"></script>
289 316 <!-- MULTI SELECT 多选下拉框 -->
290   -<script src="/metronic_v4.5.4/plugins/jquery-multi-select/js/jquery.multi-select.js" ></script>
  317 +<script src="/metronic_v4.5.4/plugins/jquery-multi-select/js/jquery.multi-select.js"></script>
291 318 <!-- editable.js -->
292   -<script src="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js" ></script>
  319 +<script src="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js"></script>
293 320 <!-- PJAX -->
294 321 <script src="/assets/plugins/jquery.pjax.js"></script>
295 322 <!-- layer 弹层 -->
... ... @@ -313,7 +340,7 @@ tr.row-active td {
313 340  
314 341 <script src="/assets/plugins/pinyin.js"></script>
315 342 <!-- 日期控件 -->
316   -<script src="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/js/bootstrap-datetimepicker.min.js" ></script>
  343 +<script src="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/js/bootstrap-datetimepicker.min.js"></script>
317 344 <!-- 表格控件 -->
318 345 <!-- 统计图控件 -->
319 346 <!--<script src="/assets/global/getEchart.js"></script>
... ... @@ -322,130 +349,139 @@ tr.row-active td {
322 349 <script src="/assets/js/dictionary.js"></script>
323 350  
324 351 <script data-exclude=1>
325   -//初始打开的片段地址
326   -var initFragment = "^_^initFragment^_^";
327   -//静态文件目录
328   -var dir = '/pages/';
329   -//片段容器
330   -var pjaxContainer = '#pjax-container'
331   - ,angJsContainer = '#route-container';
332   -
333   -$(function(){
334   - $.get('/user/currentUser', function(user){
335   - $('#indexTopUName').text(user.userName);
336   - });
337   -
338   - //带 data-pjax 的链接由pjax加载
339   - $(document).pjax('a[data-pjax]', pjaxContainer);
340   -
341   - //pjax左菜单点击事件
342   - $(document).on('click','#leftMenuSidebar a[data-pjax]', function(){
343   - $('#leftMenuSidebar li.nav-item.active').removeClass('active');
344   - $(this).parent().addClass('active');
345   - showPjax();
346   - });
347   -
348   - //angularjs左菜单点击事件
349   - $(document).on('click','#leftMenuSidebar a[data-angularjs]', function(){
350   - $('#leftMenuSidebar li.nav-item.active').removeClass('active');
351   - $(this).parent().addClass('active');
352   - showAngJs();
353   - });
354   -
355   - //加载左菜单栏
356   - $get('/module/findByCurrentUser', null,
357   - function(ms){
358   - var treeArray = createTreeData(ms);
359   - treeArray.sort(function(a, b){
360   - return a.createDate - b.createDate;
361   - });
362   - var menuHtml = template('menu_list_temp', {list: treeArray});
363   - $('#leftMenuSidebar').html(menuHtml);
364   -
365   - //----------- 检查URL ----------------
366   - var h = location.hash;
367   - if(initFragment && initFragment != ''){
368   - showPjax();
369   - //普通片段
370   - loadPage(initFragment);
371   - //选中菜单
372   - $.each($('#leftMenuSidebar a'), function(i, item){
373   - if(urlPattern($(item).attr('href'), initFragment)){
374   - activeLeftMenu(item);
375   - }
376   - });
377   - }else if(h){
378   - //angularjs片段
379   - showAngJs();
380   - //选中菜单
381   - $.each($('#leftMenuSidebar a'), function(i, item){
382   - if($(item).attr('href') == h){
383   - activeLeftMenu(item);
384   - }
385   - });
386   - }
387   - else{
388   - //加载主页
389   - loadPage('/pages/home.html');
390   - }
391   - });
392   -
393   - //修改密码
394   - $('#changePWD').on('click', function(){
395   - $.get('/pages/permission/user/changePWD.html', function(content){
396   - layer.open({
397   - type: 1,
398   - area: ['600px','360px'],
399   - content: content,
400   - title : '修改密码',
401   - shift: 5,
402   - scrollbar: false,
403   - success: function(){
404   - }
405   - });
406   - });
407   - });
408   -});
409   -
410   - //modal关闭时销毁dom
411   - $(document).on('hidden.bs.modal', '.modal', function(){
412   - $(this).remove();
413   - });
414   -
415   - //pjax加载完成事件
416   - $(document).on('pjax:success', function(){
417   - var dicts = $(pjaxContainer).find('.nt-dictionary');
418   - dictionaryUtils.transformDom(dicts);
419   - });
420   -
421   - function loadPage(url){
422   - $.pjax({url: url, container: pjaxContainer})
423   - }
424   -
425   - function urlPattern(a , b){
426   - var r;
427   - try {
428   - r = a.substring(0, a.lastIndexOf('/')) == b.substring(0, b.lastIndexOf('/'));
429   - } catch (e) {
430   - r = false;
431   - }
432   - return r;
433   - }
434   -
435   - function showPjax(){
436   - $(angJsContainer).removeClass('page-content active').hide();
437   - $(pjaxContainer).addClass('page-content active');
438   - }
439   -
440   - function showAngJs(){
441   - $(pjaxContainer).html('').removeClass('page-content active').hide();
442   - $(angJsContainer).addClass('page-content active');
443   - }
444   -
445   - function activeLeftMenu(item){
446   - $(item).parent('.nav-item').addClass('active').parent('.sub-menu').show().parent().addClass('open');
447   - }
448   -
  352 + //初始打开的片段地址
  353 + var initFragment = "^_^initFragment^_^";
  354 + //静态文件目录
  355 + var dir = '/pages/';
  356 + //片段容器
  357 + var pjaxContainer = '#pjax-container'
  358 + , angJsContainer = '#route-container';
  359 +
  360 + $(function () {
  361 + $.get('/user/currentUser', function (user) {
  362 + $('#indexTopUName').text(user.userName);
  363 + });
  364 +
  365 + //带 data-pjax 的链接由pjax加载
  366 + $(document).pjax('a[data-pjax]', pjaxContainer);
  367 +
  368 + //pjax左菜单点击事件
  369 + $(document).on('click', '#leftMenuSidebar a[data-pjax]', function () {
  370 + setTitle(this);
  371 +
  372 + $('#leftMenuSidebar li.nav-item.active').removeClass('active');
  373 + $(this).parent().addClass('active');
  374 + showPjax();
  375 + });
  376 +
  377 + //angularjs左菜单点击事件
  378 + $(document).on('click', '#leftMenuSidebar a[data-angularjs]', function () {
  379 + setTitle(this);
  380 +
  381 + $('#leftMenuSidebar li.nav-item.active').removeClass('active');
  382 + $(this).parent().addClass('active');
  383 + showAngJs();
  384 + });
  385 +
  386 + //加载左菜单栏
  387 + $get('/module/findByCurrentUser', null,
  388 + function (ms) {
  389 + var treeArray = createTreeData(ms);
  390 + treeArray.sort(function (a, b) {
  391 + return a.createDate - b.createDate;
  392 + });
  393 + var menuHtml = template('menu_list_temp', {list: treeArray});
  394 + $('#leftMenuSidebar').html(menuHtml);
  395 +
  396 + //----------- 检查URL ----------------
  397 + var h = location.hash;
  398 + if (initFragment && initFragment != '') {
  399 + showPjax();
  400 + //普通片段
  401 + loadPage(initFragment);
  402 + //选中菜单
  403 + $.each($('#leftMenuSidebar a'), function (i, item) {
  404 + if (urlPattern($(item).attr('href'), initFragment)) {
  405 + activeLeftMenu(item);
  406 + }
  407 + });
  408 + } else if (h) {
  409 + //angularjs片段
  410 + showAngJs();
  411 + //选中菜单
  412 + $.each($('#leftMenuSidebar a'), function (i, item) {
  413 + if ($(item).attr('href') == h) {
  414 + activeLeftMenu(item);
  415 + }
  416 + });
  417 + }
  418 + else {
  419 + //加载主页
  420 + loadPage('/pages/home.html');
  421 + }
  422 + });
  423 +
  424 + //修改密码
  425 + $('#changePWD').on('click', function () {
  426 + $.get('/pages/permission/user/changePWD.html', function (content) {
  427 + layer.open({
  428 + type: 1,
  429 + area: ['600px', '360px'],
  430 + content: content,
  431 + title: '修改密码',
  432 + shift: 5,
  433 + scrollbar: false,
  434 + success: function () {
  435 + }
  436 + });
  437 + });
  438 + });
  439 + });
  440 +
  441 + //modal关闭时销毁dom
  442 + $(document).on('hidden.bs.modal', '.modal', function () {
  443 + $(this).remove();
  444 + });
  445 +
  446 + //pjax加载完成事件
  447 + $(document).on('pjax:success', function () {
  448 + var dicts = $(pjaxContainer).find('.nt-dictionary');
  449 + dictionaryUtils.transformDom(dicts);
  450 + });
  451 +
  452 + function loadPage(url) {
  453 + $.pjax({url: url, container: pjaxContainer})
  454 + }
  455 +
  456 + function urlPattern(a, b) {
  457 + var r;
  458 + try {
  459 + r = a.substring(0, a.lastIndexOf('/')) == b.substring(0, b.lastIndexOf('/'));
  460 + } catch (e) {
  461 + r = false;
  462 + }
  463 + return r;
  464 + }
  465 +
  466 + function showPjax() {
  467 + $(angJsContainer).removeClass('page-content active').hide();
  468 + $(pjaxContainer).addClass('page-content active');
  469 + }
  470 +
  471 + function showAngJs() {
  472 + $(pjaxContainer).html('').removeClass('page-content active').hide();
  473 + $(angJsContainer).addClass('page-content active');
  474 + }
  475 +
  476 + function activeLeftMenu(item) {
  477 + $(item).parent('.nav-item').addClass('active').parent('.sub-menu').show().parent().addClass('open');
  478 + setTitle(item);
  479 + }
  480 +
  481 + function setTitle(menuItem){
  482 + document.title = $('span.title', menuItem).text();
  483 + }
  484 +
449 485 </script>
450 486 <!-- d3 -->
451 487 <script src="/assets/js/d3.min.js" data-exclude=1></script>
... ... @@ -478,8 +514,10 @@ $(function(){
478 514 <!-- 百度 -->
479 515 <script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT" data-exclude=1></script>
480 516 <script src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js" data-exclude=1></script>
481   -<script type="text/javascript" src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js" data-exclude=1></script>
482   -<script type="text/javascript" src="http://api.map.baidu.com/library/RichMarker/1.2/src/RichMarker_min.js " data-exclude=1></script>
  517 +<script type="text/javascript" src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"
  518 + data-exclude=1></script>
  519 +<script type="text/javascript" src="http://api.map.baidu.com/library/RichMarker/1.2/src/RichMarker_min.js "
  520 + data-exclude=1></script>
483 521 <script src="/assets/js/baidu/TextIconOverlay.js" data-exclude=1></script>
484 522 <script src="/assets/js/baidu//MarkerClusterer.js" data-exclude=1></script>
485 523 <!-- 高德 -->
... ...
src/main/resources/static/pages/forms/mould/account.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/allline.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/daily.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/executionrate.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/historyMessage.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/turnoutrate.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/account.html
... ... @@ -70,6 +70,9 @@
70 70  
71 71 <script>
72 72 $(function(){
  73 + $("#export").attr('disabled',"true");
  74 +
  75 +
73 76 var reqCodeMap = {"0xA1": '请求恢复运营', "0xA2": '申请调档', "0xA3": '出场请求', "0xA5": '进场请求', "0xA7": '加油请求', "0x50": '车辆故障', "0x70": '路阻报告', "0x60": '事故报告', "0x11": '扣证纠纷', "0x12" : '报警'};
74 77 // 关闭左侧栏
75 78 if (!$('body').hasClass('page-sidebar-closed'))
... ... @@ -130,14 +133,19 @@
130 133 }
131 134 }
132 135 });
133   -
  136 +
  137 + var line = $("#line").val();
  138 + var xlName = $("#select2-line-container").html();
  139 + var date = $("#date").val();
  140 + var code = $("#code").val();
134 141 $("#query").on("click",function(){
135   - var line = $("#line").val();
136   - var xlName = $("#select2-line-container").html();
137   - var date = $("#date").val();
138   - var code = $("#code").val();
  142 + line = $("#line").val();
  143 + xlName = $("#select2-line-container").html();
  144 + date = $("#date").val();
  145 + code = $("#code").val();
  146 + var type = "query";
139 147 $(".hidden").removeClass("hidden");
140   - $post('/realSchedule/account',{line:line,date:date,code:code,xlName:xlName},function(result){
  148 + $post('/realSchedule/account',{line:line,date:date,code:code,xlName:xlName,type:type},function(result){
141 149 $.each(result, function(i, obj) {
142 150 obj.requestType = reqCodeMap[obj.requestType];
143 151 });
... ... @@ -145,8 +153,22 @@
145 153 var tbodyHtml = template('list_account',{list:result});
146 154 // 把渲染好的模版html文本追加到表格中
147 155 $('#forms tbody').html(tbodyHtml);
  156 +
  157 + if(result.length == 0)
  158 + $("#export").attr('disabled',"true");
  159 + else
  160 + $("#export").removeAttr("disabled");
  161 +
148 162 });
149   - });
  163 + });
  164 +
  165 + $("#export").on("click",function(){
  166 + var type = "export";
  167 + $get('/realSchedule/account', {line:line,date:date,code:code,xlName:xlName,type:type}, function(result){
  168 + window.open("/downloadFile/download?fileName=驾驶员请求台账"+moment(date).format("YYYYMMDD"));
  169 + });
  170 + });
  171 +
150 172 });
151 173 </script>
152 174 <script type="text/html" id="list_account">
... ...
src/main/resources/static/pages/forms/statement/correctForm.html
... ... @@ -49,7 +49,7 @@
49 49 </div>
50 50 <div class="form-group">
51 51 <input class="btn btn-default" type="button" id="query" value="筛选"/>
52   - <input class="btn btn-default" type="button" id="export" value="导出"/>
  52 +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
53 53 </div>
54 54 </form>
55 55 </div>
... ... @@ -67,7 +67,8 @@
67 67 <td rowspan="2">线路名</td>
68 68 <td rowspan="2">路牌</td>
69 69 <td rowspan="2">车号</td>
70   - <td colspan="2">车号</td>
  70 + <td rowspan="2">司机</td>
  71 + <td rowspan="2">售票员</td>
71 72 <td colspan="2">发车时间</td>
72 73 <td colspan="2">结束时间</td>
73 74 <td rowspan="2">修改人</td>
... ... @@ -75,8 +76,6 @@
75 76 <td rowspan="2">备注</td>
76 77 </tr>
77 78 <tr>
78   - <td>司机</td>
79   - <td>售票员</td>
80 79 <td>计划</td>
81 80 <td>实际</td>
82 81 <td>计划</td>
... ... @@ -97,7 +96,10 @@
97 96 </div>
98 97  
99 98 <script>
100   - $(function(){
  99 + $(function(){
  100 + $("#export").attr('disabled',"true");
  101 +
  102 +
101 103 // 关闭左侧栏
102 104 if (!$('body').hasClass('page-sidebar-closed'))
103 105 $('.menu-toggler.sidebar-toggler').click();
... ... @@ -196,14 +198,20 @@
196 198 }
197 199 }
198 200 });
199   -
  201 +
  202 + var line = $("#line").val();
  203 + var startDate = $("#startDate").val();
  204 + var endDate = $("#endDate").val();
  205 + var lpName = $("#lpName").val();
  206 + var code = $("#code").val();
200 207 $("#query").on("click",function(){
201   - var line = $("#line").val();
202   - var startDate = $("#startDate").val();
203   - var endDate = $("#endDate").val();
204   - var lpName = $("#lpName").val();
205   - var code = $("#code").val();
206   - $post("/realSchedule/correctForm",{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code},function(result){
  208 + line = $("#line").val();
  209 + startDate = $("#startDate").val();
  210 + endDate = $("#endDate").val();
  211 + lpName = $("#lpName").val();
  212 + code = $("#code").val();
  213 + var type = "query";
  214 + $post("/realSchedule/correctForm",{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code,type:type},function(result){
207 215 $("#sDate").text(startDate);
208 216 $("#eDate").text(endDate);
209 217 var temp = {};
... ... @@ -228,8 +236,22 @@
228 236  
229 237 /* var list_correctForm_statistics = template('list_correctForm_statistics',temp);
230 238 $('#forms .list_correctForm_statistics').html(list_correctForm_statistics); */
  239 +
  240 + if(result.length == 0)
  241 + $("#export").attr('disabled',"true");
  242 + else
  243 + $("#export").removeAttr("disabled");
  244 +
231 245 });
232   - });
  246 + });
  247 +
  248 + $("#export").on("click",function(){
  249 + var type = "export";
  250 + $get('/realSchedule/correctForm',{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code,type:type},function(result){
  251 + window.open("/downloadFile/download?fileName=修正报表"+moment(startDate).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  252 + });
  253 + });
  254 +
233 255 });
234 256 </script>
235 257 <script type="text/html" id="list_correctForm">
... ...
src/main/resources/static/pages/forms/statement/daily.html
... ... @@ -26,7 +26,15 @@
26 26 <div class="col-md-12">
27 27 <div class="portlet light porttlet-fit bordered">
28 28 <div class="portlet-title">
29   - <form class="form-inline" action="">
  29 + <form class="form-inline" action="">
  30 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_daily">
  31 + <span class="item-label" style="width: 80px;">公司: </span>
  32 + <select class="form-control" name="company" id="gsdmDaily" style="width: 140px;"></select>
  33 + </div>
  34 + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_daily">
  35 + <span class="item-label" style="width: 80px;">分公司: </span>
  36 + <select class="form-control" name="subCompany" id="fgsdmDaily" style="width: 140px;"></select>
  37 + </div>
30 38 <div style="display: inline-block;">
31 39 <span class="item-label" style="width: 80px;">线路: </span>
32 40 <select class="form-control" name="line" id="line" style="width: 180px;"></select>
... ... @@ -64,15 +72,15 @@
64 72 <td>班次</td>
65 73 </tr>
66 74 </thead>
67   - <tbody class="dailyInfo">
  75 + <tbody id="tbody">
68 76  
69 77 </tbody>
70 78 <tr>
71 79 <td colspan="3">小计</td>
72 80 <td><span id="total_zgl">&nbsp;</span></td>
73   - <td><span id="total_ksgl">&nbsp;</span></td>
  81 + <td><span id="total_ks">&nbsp;</span></td>
74 82 <td><span id="total_yh">&nbsp;</span></td>
75   - <td><span id="total_bcs">&nbsp;</span></td>
  83 + <td><span id="total_bc">&nbsp;</span></td>
76 84 </tr>
77 85 </table>
78 86 </div>
... ... @@ -82,7 +90,9 @@
82 90 </div>
83 91  
84 92 <script>
85   - $(function(){
  93 + $(function(){
  94 + var reqCodeMap = {"0xA1": '请求恢复运营', "0xA2": '申请调档', "0xA3": '出场请求', "0xA5": '进场请求', "0xA7": '加油请求', "0x50": '车辆故障', "0x70": '路阻报告', "0x60": '事故报告', "0x11": '扣证纠纷', "0x12" : '报警'};
  95 +
86 96 // 关闭左侧栏
87 97 if (!$('body').hasClass('page-sidebar-closed'))
88 98 $('.menu-toggler.sidebar-toggler').click();
... ... @@ -92,6 +102,42 @@
92 102 locale : 'zh-cn'
93 103 });
94 104  
  105 + var obj = [];
  106 + $.get('/user/companyData', function(result){
  107 + obj = result;
  108 + var options = '';
  109 + for(var i = 0; i < obj.length; i++){
  110 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  111 + }
  112 +
  113 + if(obj.length ==0){
  114 + $("#gsdmDiv_daily").css('display','none');
  115 + $('#gsdmDiv_daily').css('display','none');
  116 + }else if(obj.length ==1){
  117 + $("#fgsdmDiv_daily").css('display','none');
  118 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  119 + $('#fgsdmDiv_daily').css('display','none');
  120 + }
  121 + $('#gsdmDaily').html(options);
  122 + updateCompany();
  123 + });
  124 +
  125 + $("#gsdmDaily").on("change",updateCompany);
  126 + function updateCompany(){
  127 + var company = $('#gsdmDaily').val();
  128 + var options = '';
  129 + for(var i = 0; i < obj.length; i++){
  130 + if(obj[i].companyCode == company){
  131 + var children = obj[i].children;
  132 + for(var j = 0; j < children.length; j++){
  133 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  134 + }
  135 + }
  136 + }
  137 + $('#fgsdmDaily').html(options);
  138 + }
  139 +
  140 +
95 141 $.get('/basic/lineCode2Name',function(result){
96 142 var data=[];
97 143  
... ... @@ -101,50 +147,82 @@
101 147 initPinYinSelect2('#line',data,'');
102 148  
103 149 })
104   - var line;
105   - var date;
106   - $("#query").on("click",function(){
107   - line = $("#line").val();
108   - var lineName=$("#select2-line-container").html();
109   - date = $("#date").val();
110   - $get('/realSchedule/dailyInfo',{line:line,date:date,type:'query'},function(result){
111   - $("#form_line").text(lineName);
112   - $("#form_date").text(date);
113   - var total_zgl = 0,total_ksgl = 0,total_yh = 0,total_bcs = 0;
114   - $.each(result, function(i, obj) {
115   - total_zgl = Number(obj.zgl)+Number(total_zgl);
116   - total_ksgl = Number(obj.ksgl)+Number(total_ksgl);
117   - total_yh = Number(0)+Number(total_yh);
118   - total_bcs = Number(obj.bcs)+Number(total_bcs);
119   - });
120   - $("#total_zgl").text(total_zgl.toFixed(2));
121   - $("#total_ksgl").text(total_ksgl.toFixed(2));
122   - $("#total_yh").text(total_yh.toFixed(2));
123   - $("#total_bcs").text(total_bcs);
124   -
125   - // 把数据填充到模版中
126   - var tbodyHtml = template('dailyInfo',{list:result});
127   - // 把渲染好的模版html文本追加到表格中
128   - $('#forms .dailyInfo').html(tbodyHtml);
129   - });
  150 +
  151 + var line;
  152 + var date;
  153 + var gsdmDaily;
  154 + var fgsdmDaily;
  155 + $("#query").on("click",function(){
  156 +
  157 + line = $("#line").val();
  158 + var lineName=$("#select2-line-container").html();
  159 + date = $("#date").val();
  160 + gsdmDaily=$("#gsdmDaily").val();
  161 + fgsdmDaily = $("#fgsdmDaily").val();
  162 +
  163 + $post('/mcy_forms/daily',{gsdmDaily:gsdmDaily,fgsdmDaily:fgsdmDaily, line:line,date:date,type:'query'},function(result){
  164 + $("#form_line").text(lineName);
  165 + $("#form_date").text(date);
  166 + // 把数据填充到模版中
  167 + var tbodyHtml = template('dailyInfo',{list:result});
  168 + // 把渲染好的模版html文本追加到表格中
  169 + $('#tbody').html(tbodyHtml);
  170 + line = $("#line").val();
  171 +
  172 + startDate = $("#startDate").val();
  173 + endDate = $("#endDate").val();
  174 + $("#sDate").text(startDate);
  175 + $("#eDate").text(endDate);
  176 +
  177 + var total_zgl = 0,total_ks = 0;
  178 + var total_yh = 0,total_bc = 0;
  179 +
  180 + $.each(result, function(i, obj) {
  181 + total_zgl +=Number(obj.zlc);
  182 + total_ks +=Number(obj.jzl1);
  183 + total_yh += Number(obj.yh);
  184 + total_bc += Number(obj.bc);
  185 +
  186 + });
  187 + $("#total_zgl").text(total_zgl.toFixed(2));
  188 + $("#total_ks").text(total_ks.toFixed(2));
  189 + $("#total_yh").text(total_yh.toFixed(2));
  190 + $("#total_bc").text(total_bc.toFixed(2));
  191 +
  192 + var temp = {};
  193 + var today_account = 0;
  194 +
  195 + temp["line"] = $("#line").text();
  196 + $.each(result, function(i, obj) {
  197 + if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){
  198 + today_account++;
  199 + }
  200 + obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss");
  201 + });
  202 + })
  203 + });
  204 +
  205 + $("#export").on("click",function(){
  206 + line = $("#line").val();
  207 + date = $("#date").val();
  208 + gsdmDaily=$("#gsdmDaily").val();
  209 + fgsdmDaily = $("#fgsdmDaily").val();
  210 + $post('/mcy_export/dailyExport',{gsdmDaily:gsdmDaily,fgsdmDaily:fgsdmDaily,line:line,date:date,type:'export'},function(result){
  211 + window.open("/downloadFile/download?fileName=班次日报表"+moment(date).format("YYYYMMDD"));
130 212 });
131   - $("#export").on("click",function(){
132   - $get('/realSchedule/dailyInfo',{line:line,date:date,type:'export'},function(result){
133   - window.open("/downloadFile/download?fileName=班次日报"+moment(date).format("YYYYMMDD"));
134   - });
135   - });
136   - });
  213 + });
  214 +});
137 215 </script>
138 216 <script type="text/html" id="dailyInfo">
139 217 {{each list as obj i}}
140 218 <tr>
141   - <td>{{obj.clZbh}}</td>
142   - <td>{{obj.jGh}}</td>
  219 + <td>{{obj.zbh}}</td>
  220 + <td>{{obj.jgh}}</td>
143 221 <td>{{obj.jName}}</td>
144   - <td>{{obj.zgl}}</td>
145   - <td>{{obj.ksgl}}</td>
146   - <td>0</td>
147   - <td>{{obj.bcs}}</td>
  222 + <td>{{obj.zlc}}</td>
  223 + <td>{{obj.jzl1}}</td>
  224 + <td>{{obj.yh}}</td>
  225 + <td>{{obj.bc}}</td>
148 226 </tr>
149 227 {{/each}}
150 228 {{if list.length == 0}}
... ...
src/main/resources/static/pages/forms/statement/historyMessage.html
... ... @@ -69,7 +69,9 @@
69 69 </div>
70 70  
71 71 <script>
72   - $(function(){
  72 + $(function(){
  73 + $('#export').attr('disabled', "true");
  74 +
73 75 // 关闭左侧栏
74 76 if (!$('body').hasClass('page-sidebar-closed'))
75 77 $('.menu-toggler.sidebar-toggler').click();
... ... @@ -127,21 +129,35 @@
127 129 }
128 130 }
129 131 });
130   -
  132 +
  133 + var line = $("#line").val();
  134 + var date = $("#date").val();
  135 + var code = $("#code").val();
131 136 $("#query").on("click",function(){
132   - var line = $("#line").val();
133   - var date = $("#date").val();
134   - var code = $("#code").val();
  137 + line = $("#line").val();
  138 + date = $("#date").val();
  139 + code = $("#code").val();
  140 + var type = "query";
135 141 $(".hidden").removeClass("hidden");
136 142 $get('/realSchedule/historyMessage',{line:line,date:date,code:code},function(result){
137 143 // 把数据填充到模版中
138 144 var tbodyHtml = template('list_history',{list:result});
139 145 // 把渲染好的模版html文本追加到表格中
140 146 $('#forms tbody').html(tbodyHtml);
  147 +
  148 + if(result.length == 0)
  149 + $("#export").attr('disabled',"true");
  150 + else
  151 + $("#export").removeAttr("disabled");
  152 +
141 153 });
142 154 });
  155 +
143 156 $("#export").on("click",function(){
144   - $('#forms').tableExport({ type: 'excel', escape: 'false',filename:'(2016-02-29_2016-03-06)'});
  157 + var type = "export";
  158 + $get('/realSchedule/historyMessage', {line:line,date:date,code:code,type:type}, function(result){
  159 + window.open("/downloadFile/download?fileName=调度历史消息"+moment(date).format("YYYYMMDD"));
  160 + });
145 161 });
146 162  
147 163 });
... ...
src/main/resources/static/pages/forms/statement/jobSummary.html
... ... @@ -37,7 +37,7 @@
37 37 </div>
38 38 <div class="form-group">
39 39 <input class="btn btn-default" type="button" id="query" value="查询"/>
40   - <input class="btn btn-default" type="button" id="export" value="导出"/>
  40 +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
41 41 </div>
42 42 </form>
43 43 </div>
... ...
src/main/resources/static/pages/forms/statement/scheduleDaily.html
... ... @@ -37,7 +37,7 @@
37 37 </div>
38 38 <div class="form-group">
39 39 <input class="btn btn-default" type="button" id="query" value="查询"/>
40   - <input class="btn btn-default" type="button" id="export" value="导出"/>
  40 +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
41 41 </div>
42 42 </form>
43 43 </div>
... ...
src/main/resources/static/pages/forms/statement/statisticsDaily .html
... ... @@ -37,7 +37,7 @@
37 37 </div>
38 38 <div class="form-group">
39 39 <input class="btn btn-default" type="button" id="query" value="查询"/>
40   - <input class="btn btn-default" type="button" id="export" value="导出"/>
  40 +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
41 41 </div>
42 42 </form>
43 43 </div>
... ...
src/main/resources/static/pages/forms/statement/waybill.html
... ... @@ -39,7 +39,7 @@
39 39 <input class="btn btn-default" type="button" id="query" value="查询"/>
40 40 <input class="btn btn-default" type="button" id="export" value="导出"/>
41 41 <input class="btn btn-default" type="button" id="print" value="打印"/>
42   - <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/>
  42 +<!-- <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/> -->
43 43 </div>
44 44 </form>
45 45 </div>
... ...
src/main/resources/static/pages/mforms/alllines/allline.html
... ... @@ -230,8 +230,7 @@
230 230 var total_bcjh = 0, total_bcsj = 0, total_bczxl = 0;
231 231 var total_gs = 0;
232 232 var total_zhgs = 0;
233   - $
234   - .each(
  233 + $.each(
235 234 result,
236 235 function(i, obj) {
237 236 total_gs += Number(obj.gsgs);
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/module.js
... ... @@ -147,7 +147,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;BusInfoManageToolsCtrl&#39;, [&#39;$modalInsta
147 147  
148 148 // 上传文件组件
149 149 self.uploader = new FileUploader({
150   - url: "/cars/dataImport",
  150 + url: "/cars_sc/uploadAndImportFile",
151 151 filters: [] // 用于过滤文件,比如只允许导入excel
152 152 });
153 153 self.uploader.onAfterAddingFile = function(fileItem)
... ... @@ -159,7 +159,16 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;BusInfoManageToolsCtrl&#39;, [&#39;$modalInsta
159 159 };
160 160 self.uploader.onSuccessItem = function(fileItem, response, status, headers)
161 161 {
162   - console.info('onSuccessItem', fileItem, response, status, headers);
  162 + if (response.status == "SUCCESS") {
  163 + console.info('onSuccessItem', fileItem, response, status, headers);
  164 + } else {
  165 + fileItem.isSuccess = false;
  166 + fileItem.isCancel = false;
  167 + fileItem.isError = true;
  168 +
  169 + alert(response.msg);
  170 + }
  171 +
163 172 };
164 173 self.uploader.onErrorItem = function(fileItem, response, status, headers)
165 174 {
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/service.js
... ... @@ -59,14 +59,14 @@ angular.module(&#39;ScheduleApp&#39;).factory(
59 59 }
60 60 ),
61 61 dataTools: $resource(
62   - '/cars/:type',
  62 + '/cars_sc/:type',
63 63 {},
64 64 {
65 65 dataExport: {
66 66 method: 'GET',
67 67 responseType: "arraybuffer",
68 68 params: {
69   - type: "dataExport"
  69 + type: "exportFile"
70 70 },
71 71 transformResponse: function(data, headers){
72 72 return {data : data};
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js
... ... @@ -146,7 +146,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;EmployInfoManageToolsCtrl&#39;, [&#39;$modalIn
146 146  
147 147 // 上传文件组件
148 148 self.uploader = new FileUploader({
149   - url: "/personnel/dataImport",
  149 + url: "/ee/uploadAndImportFile",
150 150 filters: [] // 用于过滤文件,比如只允许导入excel
151 151 });
152 152 self.uploader.onAfterAddingFile = function(fileItem)
... ... @@ -158,7 +158,15 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;EmployInfoManageToolsCtrl&#39;, [&#39;$modalIn
158 158 };
159 159 self.uploader.onSuccessItem = function(fileItem, response, status, headers)
160 160 {
161   - console.info('onSuccessItem', fileItem, response, status, headers);
  161 + if (response.status == "SUCCESS") {
  162 + console.info('onSuccessItem', fileItem, response, status, headers);
  163 + } else {
  164 + fileItem.isSuccess = false;
  165 + fileItem.isCancel = false;
  166 + fileItem.isError = true;
  167 +
  168 + alert(response.msg);
  169 + }
162 170 };
163 171 self.uploader.onErrorItem = function(fileItem, response, status, headers)
164 172 {
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/service.js
... ... @@ -41,14 +41,14 @@ angular.module(&#39;ScheduleApp&#39;).factory(
41 41 ),
42 42  
43 43 dataTools: $resource(
44   - '/personnel/:type',
  44 + '/ee/:type',
45 45 {},
46 46 {
47 47 dataExport: {
48 48 method: 'GET',
49 49 responseType: "arraybuffer",
50 50 params: {
51   - type: "dataExport"
  51 + type: "exportFile"
52 52 },
53 53 transformResponse: function(data, headers){
54 54 return {data : data};
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -60,14 +60,14 @@ angular.module(&#39;ScheduleApp&#39;).factory(
60 60 }
61 61 ),
62 62 dataTools: $resource(
63   - '/cars/:type',
  63 + '/cars_sc/:type',
64 64 {},
65 65 {
66 66 dataExport: {
67 67 method: 'GET',
68 68 responseType: "arraybuffer",
69 69 params: {
70   - type: "dataExport"
  70 + type: "exportFile"
71 71 },
72 72 transformResponse: function(data, headers){
73 73 return {data : data};
... ... @@ -163,14 +163,14 @@ angular.module(&#39;ScheduleApp&#39;).factory(
163 163 ),
164 164  
165 165 dataTools: $resource(
166   - '/personnel/:type',
  166 + '/ee/:type',
167 167 {},
168 168 {
169 169 dataExport: {
170 170 method: 'GET',
171 171 responseType: "arraybuffer",
172 172 params: {
173   - type: "dataExport"
  173 + type: "exportFile"
174 174 },
175 175 transformResponse: function(data, headers){
176 176 return {data : data};
... ... @@ -533,15 +533,31 @@ angular.module(&#39;ScheduleApp&#39;).factory(
533 533 {order: 'createDate', direction: 'DESC', id: '@id'},
534 534 {
535 535 get: {
536   - method: 'GET'
  536 + method: 'GET',
  537 + transformResponse: function(rs) {
  538 + var dst = angular.fromJson(rs);
  539 + if (dst.status == 'SUCCESS') {
  540 + return dst.data;
  541 + } else {
  542 + return dst; // 业务错误留给控制器处理
  543 + }
  544 + }
537 545 },
538 546 save: {
539   - method: 'POST'
  547 + method: 'POST',
  548 + transformResponse: function(rs) {
  549 + var dst = angular.fromJson(rs);
  550 + if (dst.status == 'SUCCESS') {
  551 + return dst.data;
  552 + } else {
  553 + return dst; // 业务错误留给控制器处理
  554 + }
  555 + }
540 556 }
541 557 }
542 558 ),
543 559 import: $resource(
544   - '/tidc/importfile',
  560 + '/tidc/importFile',
545 561 {},
546 562 {
547 563 do: {
... ... @@ -564,7 +580,15 @@ angular.module(&#39;ScheduleApp&#39;).factory(
564 580 {},
565 581 {
566 582 list: {
567   - method: 'GET'
  583 + method: 'GET',
  584 + transformResponse: function(rs) {
  585 + var dst = angular.fromJson(rs);
  586 + if (dst.status == 'SUCCESS') {
  587 + return dst.data;
  588 + } else {
  589 + return dst; // 业务错误留给控制器处理
  590 + }
  591 + }
568 592 }
569 593 }
570 594 ),
... ... @@ -586,7 +610,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
586 610 method: 'GET',
587 611 responseType: "arraybuffer",
588 612 params: {
589   - type: "dataExportExt"
  613 + type: "exportFile"
590 614 },
591 615 transformResponse: function(data, headers){
592 616 return {data : data};
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/edit.html
... ... @@ -76,19 +76,19 @@
76 76 searchexp="this.insideCode"
77 77 required >
78 78 </sa-Select5>
79   - <input type="hidden" name="cl_h" ng-model="ctrl.busConfigForSave.cl.id"
80   - remote-Validation
81   - remotevtype="cc_cars"
82   - remotevparam="{{ {'id_eq': ctrl.busConfigForSave.id, 'xl.id_eq': ctrl.busConfigForSave.xl.id, 'xl.name_eq': ctrl.busConfigForSave.xl.name, 'cl.id_eq': ctrl.busConfigForSave.cl.id} | json}}"
83   - />
  79 + <!--<input type="hidden" name="cl_h" ng-model="ctrl.busConfigForSave.cl.id"-->
  80 + <!--remote-Validation-->
  81 + <!--remotevtype="cc_cars"-->
  82 + <!--remotevparam="{{ {'id_eq': ctrl.busConfigForSave.id, 'xl.id_eq': ctrl.busConfigForSave.xl.id, 'xl.name_eq': ctrl.busConfigForSave.xl.name, 'cl.id_eq': ctrl.busConfigForSave.cl.id} | json}}"-->
  83 + <!--/>-->
84 84 </div>
85 85 <!-- 隐藏块,显示验证信息 -->
86 86 <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">
87 87 车辆必须选择
88 88 </div>
89   - <div class="alert alert-danger well-sm" ng-show="myForm.cl_h.$error.remote">
90   - {{$remote_msg}}
91   - </div>
  89 + <!--<div class="alert alert-danger well-sm" ng-show="myForm.cl_h.$error.remote">-->
  90 + <!--{{$remote_msg}}-->
  91 + <!--</div>-->
92 92 </div>
93 93  
94 94 <div class="form-group has-success has-feedback">
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/form.html
... ... @@ -76,19 +76,19 @@
76 76 searchexp="this.insideCode"
77 77 required >
78 78 </sa-Select5>
79   - <input type="hidden" name="cl_h" ng-model="ctrl.busConfigForSave.cl.id"
80   - remote-Validation
81   - remotevtype="cc_cars"
82   - remotevparam="{{ {'xl.id_eq': ctrl.busConfigForSave.xl.id, 'xl.name_eq': ctrl.busConfigForSave.xl.name, 'cl.id_eq': ctrl.busConfigForSave.cl.id} | json}}"
83   - />
  79 + <!--<input type="hidden" name="cl_h" ng-model="ctrl.busConfigForSave.cl.id"-->
  80 + <!--remote-Validation-->
  81 + <!--remotevtype="cc_cars"-->
  82 + <!--remotevparam="{{ {'xl.id_eq': ctrl.busConfigForSave.xl.id, 'xl.name_eq': ctrl.busConfigForSave.xl.name, 'cl.id_eq': ctrl.busConfigForSave.cl.id} | json}}"-->
  83 + <!--/>-->
84 84 </div>
85 85 <!-- 隐藏块,显示验证信息 -->
86 86 <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">
87 87 车辆必须选择
88 88 </div>
89   - <div class="alert alert-danger well-sm" ng-show="myForm.cl_h.$error.remote">
90   - {{$remote_msg}}
91   - </div>
  89 + <!--<div class="alert alert-danger well-sm" ng-show="myForm.cl_h.$error.remote">-->
  90 + <!--{{$remote_msg}}-->
  91 + <!--</div>-->
92 92 </div>
93 93  
94 94 <div class="form-group has-success has-feedback">
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/edit.html
... ... @@ -89,19 +89,19 @@
89 89 searchexp="this.personnelName + '<' + this.jobCode + '>'"
90 90 required >
91 91 </sa-Select5>
92   - <input type="hidden" name="jsy_h" ng-model="ctrl.employeeConfigForSave.jsy.id"
93   - remote-Validation
94   - remotevtype="ec_jsy"
95   - remotevparam="{{ {'id_eq': ctrl.employeeConfigForSave.id, 'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'jsy.id_eq': ctrl.employeeConfigForSave.jsy.id} | json}}"
96   - />
  92 + <!--<input type="hidden" name="jsy_h" ng-model="ctrl.employeeConfigForSave.jsy.id"-->
  93 + <!--remote-Validation-->
  94 + <!--remotevtype="ec_jsy"-->
  95 + <!--remotevparam="{{ {'id_eq': ctrl.employeeConfigForSave.id, 'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'jsy.id_eq': ctrl.employeeConfigForSave.jsy.id} | json}}"-->
  96 + <!--/>-->
97 97 </div>
98 98 <!-- 隐藏块,显示验证信息 -->
99 99 <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required">
100 100 驾驶员必须选择
101 101 </div>
102   - <div class="alert alert-danger well-sm" ng-show="myForm.jsy_h.$error.remote">
103   - {{$remote_msg}}
104   - </div>
  102 + <!--<div class="alert alert-danger well-sm" ng-show="myForm.jsy_h.$error.remote">-->
  103 + <!--{{$remote_msg}}-->
  104 + <!--</div>-->
105 105 </div>
106 106  
107 107 <div class="form-group">
... ... @@ -119,16 +119,16 @@
119 119 searchexp="this.personnelName + '<' + this.jobCode + '>'"
120 120 >
121 121 </sa-Select5>
122   - <input type="hidden" name="spy_h" ng-model="ctrl.employeeConfigForSave.spy.id"
123   - remote-Validation
124   - remotevtype="ec_spy"
125   - remotevparam="{{ {'id_eq': ctrl.employeeConfigForSave.id, 'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'spy.id_eq': ctrl.employeeConfigForSave.spy.id} | json}}"
126   - />
  122 + <!--<input type="hidden" name="spy_h" ng-model="ctrl.employeeConfigForSave.spy.id"-->
  123 + <!--remote-Validation-->
  124 + <!--remotevtype="ec_spy"-->
  125 + <!--remotevparam="{{ {'id_eq': ctrl.employeeConfigForSave.id, 'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'spy.id_eq': ctrl.employeeConfigForSave.spy.id} | json}}"-->
  126 + <!--/>-->
127 127 </div>
128 128 <!-- 隐藏块,显示验证信息 -->
129   - <div class="alert alert-danger well-sm" ng-show="myForm.spy_h.$error.remote">
130   - {{$remote_msg}}
131   - </div>
  129 + <!--<div class="alert alert-danger well-sm" ng-show="myForm.spy_h.$error.remote">-->
  130 + <!--{{$remote_msg}}-->
  131 + <!--</div>-->
132 132 </div>
133 133  
134 134 <!-- 其他form-group -->
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/form.html
... ... @@ -89,19 +89,19 @@
89 89 searchexp="this.personnelName + '<' + this.jobCode + '>'"
90 90 required >
91 91 </sa-Select5>
92   - <input type="hidden" name="jsy_h" ng-model="ctrl.employeeConfigForSave.jsy.id"
93   - remote-Validation
94   - remotevtype="ec_jsy"
95   - remotevparam="{{ {'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'jsy.id_eq': ctrl.employeeConfigForSave.jsy.id} | json}}"
96   - />
  92 + <!--<input type="hidden" name="jsy_h" ng-model="ctrl.employeeConfigForSave.jsy.id"-->
  93 + <!--remote-Validation-->
  94 + <!--remotevtype="ec_jsy"-->
  95 + <!--remotevparam="{{ {'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'jsy.id_eq': ctrl.employeeConfigForSave.jsy.id} | json}}"-->
  96 + <!--/>-->
97 97 </div>
98 98 <!-- 隐藏块,显示验证信息 -->
99 99 <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required">
100 100 驾驶员必须选择
101 101 </div>
102   - <div class="alert alert-danger well-sm" ng-show="myForm.jsy_h.$error.remote">
103   - {{$remote_msg}}
104   - </div>
  102 + <!--<div class="alert alert-danger well-sm" ng-show="myForm.jsy_h.$error.remote">-->
  103 + <!--{{$remote_msg}}-->
  104 + <!--</div>-->
105 105 </div>
106 106  
107 107 <div class="form-group">
... ... @@ -119,16 +119,16 @@
119 119 searchexp="this.personnelName + '<' + this.jobCode + '>'"
120 120 >
121 121 </sa-Select5>
122   - <input type="hidden" name="spy_h" ng-model="ctrl.employeeConfigForSave.spy.id"
123   - remote-Validation
124   - remotevtype="ec_spy"
125   - remotevparam="{{ {'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'spy.id_eq': ctrl.employeeConfigForSave.spy.id} | json}}"
126   - />
  122 + <!--<input type="hidden" name="spy_h" ng-model="ctrl.employeeConfigForSave.spy.id"-->
  123 + <!--remote-Validation-->
  124 + <!--remotevtype="ec_spy"-->
  125 + <!--remotevparam="{{ {'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'spy.id_eq': ctrl.employeeConfigForSave.spy.id} | json}}"-->
  126 + <!--/>-->
127 127 </div>
128 128 <!-- 隐藏块,显示验证信息 -->
129   - <div class="alert alert-danger well-sm" ng-show="myForm.spy_h.$error.remote">
130   - {{$remote_msg}}
131   - </div>
  129 + <!--<div class="alert alert-danger well-sm" ng-show="myForm.spy_h.$error.remote">-->
  130 + <!--{{$remote_msg}}-->
  131 + <!--</div>-->
132 132 </div>
133 133  
134 134 <!-- 其他form-group -->
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html
... ... @@ -126,6 +126,22 @@
126 126 </div>
127 127  
128 128 </div>
  129 + <div class="form-group has-success has-feedback">
  130 + <label class="col-md-3 control-label">班次类型:</label>
  131 + <div class="col-md-7">
  132 + <sa-Select3 model="ctrl.TimeTableDetailForSave"
  133 + name="bcType"
  134 + placeholder="请选择班次类型..."
  135 + dcvalue="{{ctrl.TimeTableDetailForSave.bcType}}"
  136 + dcname="bcType"
  137 + icname="code"
  138 + icnames="name"
  139 + datatype="ScheduleType"
  140 + >
  141 + </sa-Select3>
  142 + </div>
  143 +
  144 + </div>
129 145  
130 146 </div>
131 147  
... ... @@ -148,3 +164,4 @@
148 164  
149 165  
150 166 </div>
  167 +
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit.html
... ... @@ -74,6 +74,7 @@
74 74 </div>
75 75  
76 76 <div class="portlet-body">
  77 + <h3><span ng-bind="ctrl.getYYDesc()"></span></h3>
77 78 <!--<div ng-view></div>-->
78 79 <div class="fixDiv">
79 80 <table style="width: 2000px" class="table table-striped table-bordered table-hover table-checkable order-column">
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/form.html
... ... @@ -118,7 +118,7 @@
118 118 required >
119 119 </sa-Select5>
120 120 <input type="hidden" name="sheetname_h" ng-model="ctrl.ttInfoDetailManageForForm.sheetvaliddesc"
121   - remote-Validationt2
  121 + remote-Validation
122 122 remotevtype="sheet"
123 123 remotevparam="{{ {
124 124 'filename': ctrl.ttInfoDetailManageForForm.filename,
... ... @@ -132,7 +132,7 @@
132 132 工作区必须选择
133 133 </div>
134 134 <div class="alert alert-danger well-sm" ng-show="myForm.sheetname_h.$error.remote">
135   - {{ctrl.ttInfoDetailManageForForm.sheetvaliddesc}}
  135 + {{$remote_msg}}
136 136 </div>
137 137 </div>
138 138  
... ... @@ -152,7 +152,7 @@
152 152 required >
153 153 </sa-Select5>
154 154 <input type="hidden" name="lineinfo_h" ng-model="ctrl.ttInfoDetailManageForForm.lineinfo"
155   - remote-Validationt2
  155 + remote-Validation
156 156 remotevtype="sheetli"
157 157 remotevparam="{{ {'lineinfoid': ctrl.ttInfoDetailManageForForm.lineinfo} | json}}"/>
158 158 </div>
... ... @@ -161,9 +161,7 @@
161 161 线路标准必须选择
162 162 </div>
163 163 <div class="alert alert-danger well-sm" ng-show="myForm.lineinfo_h.$error.remote">
164   - {{ctrl.ttInfoDetailManageForForm.lineinfovaliddesc}}
165   -
166   - 上下行出场进场里程时间必须填写,上下行班次里程时间必须填写,停车场必须填写
  164 + {{$remote_msg}}
167 165 </div>
168 166 </div>
169 167  
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/module.js
... ... @@ -89,13 +89,26 @@ angular.module(&#39;ScheduleApp&#39;).controller(
89 89 };
90 90 self.uploader.onSuccessItem = function(fileItem, response, status, headers)
91 91 {
92   - self.sheetnames = response.sheetnames;
93   - self.ttInfoDetailManageForForm.filename = response.fileName;
94   - console.info('onSuccessItem', fileItem, response, status, headers);
  92 + if (response.status == "SUCCESS") {
  93 + self.sheetnames = [];
  94 + var sheetNames = response.sheetnames.split(",");
  95 + for (var i = 0; i < sheetNames.length; i++) {
  96 + self.sheetnames.push({name: sheetNames[i]});
  97 + }
  98 + self.ttInfoDetailManageForForm.filename = response.filename;
  99 + console.info('onSuccessItem', fileItem, response, status, headers);
  100 + } else {
  101 + self.sheetnames = [];
  102 + fileItem.isSuccess = false;
  103 + fileItem.isCancel = false;
  104 + fileItem.isError = true;
  105 +
  106 + alert(response.msg);
  107 + }
  108 +
95 109 };
96 110 self.uploader.onErrorItem = function(fileItem, response, status, headers)
97 111 {
98   - alert("error");
99 112 self.sheetnames = [];
100 113 console.info('onErrorItem', fileItem, response, status, headers);
101 114 };
... ... @@ -105,10 +118,11 @@ angular.module(&#39;ScheduleApp&#39;).controller(
105 118 self.submit = function() {
106 119 service.importDetail(self.ttInfoDetailManageForForm).then(
107 120 function(result) {
108   - $state.go("ttInfoManage");
109   - },
110   - function(result) {
111   - alert("出错啦!");
  121 + if (result.status == 'SUCCESS') {
  122 + $state.go("ttInfoManage");
  123 + } else {
  124 + alert(result.msg);
  125 + }
112 126 }
113 127 );
114 128 };
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js
... ... @@ -13,7 +13,8 @@ angular.module(&#39;ScheduleApp&#39;).factory(
13 13 // 时刻表信息
14 14 var editInfo = {
15 15 detailHeads: [], // 时刻表头信息
16   - detailInfos: [] // 时刻表明细信息
  16 + detailInfos: [], // 时刻表明细信息
  17 + yydesc: "" // 营运汇总描述
17 18 };
18 19  
19 20 return {
... ... @@ -32,18 +33,24 @@ angular.module(&#39;ScheduleApp&#39;).factory(
32 33 refreshEditInfo: function(xlid, ttid) {
33 34 editInfo = {
34 35 detailHeads: [], // 时刻表头信息
35   - detailInfos: [] // 时刻表明细信息
  36 + detailInfos: [], // 时刻表明细信息
  37 + yydesc: "" // 营运汇总描述
36 38 };
37 39  
38 40 service.edit.list({xlid: xlid, ttid: ttid}, function(result) {
39   - editInfo.detailHeads = result.header;
40   - editInfo.detailInfos = result.contents;
41   -
42   - // detailInfos里添加是否选中的flag
43   - for (var i = 0; i < editInfo.detailInfos.length; i++) {
44   - for (var j = 0; j < editInfo.detailInfos[i].length; j++) {
45   - editInfo.detailInfos[i][j].sel = false;
  41 + if (result.status != 'ERROR') {
  42 + editInfo.detailHeads = result.header;
  43 + editInfo.detailInfos = result.contents;
  44 + editInfo.yydesc = result.yy_desc;
  45 +
  46 + // detailInfos里添加是否选中的flag
  47 + for (var i = 0; i < editInfo.detailInfos.length; i++) {
  48 + for (var j = 0; j < editInfo.detailInfos[i].length; j++) {
  49 + editInfo.detailInfos[i][j].sel = false;
  50 + }
46 51 }
  52 + } else {
  53 + alert(result.msg);
47 54 }
48 55 });
49 56 },
... ... @@ -76,26 +83,40 @@ angular.module(&#39;ScheduleApp&#39;).factory(
76 83 for (var n = 0; n < ttinfodetailIds.length; n++) {
77 84 (function(index) {
78 85 queryClass.get({id: ttinfodetailIds[index].ttdid}, function(value) {
79   - for (var key in updateObject) {
80   - if (updateObject[key]) {
81   - value[key] = updateObject[key];
  86 + if (value.status == 'ERROR') {
  87 + error_counts ++;
  88 + if (success_counts + error_counts == ttinfodetailIds.length) {
  89 + deferred.reject();
  90 + }
  91 + } else {
  92 + for (var key in updateObject) {
  93 + if (updateObject[key]) {
  94 + value[key] = updateObject[key];
  95 + }
82 96 }
83 97 }
84 98 value.$save(function() {
85   - // 赋值(上下行,发车时间,班次类型)
86   - if (value.fcsj) {
87   - ttinfodetailIds[index].fcsj = value.fcsj;
88   - }
89   - if (value.xlDir) {
90   - ttinfodetailIds[index].xldir = value.xlDir;
91   - }
92   - if (value.bcType) {
93   - ttinfodetailIds[index].bc_type = value.bcType;
94   - }
95   -
96   - success_counts ++;
97   - if (success_counts + error_counts == ttinfodetailIds.length) {
98   - deferred.resolve();
  99 + if (value.status == 'ERROR') {
  100 + error_counts ++;
  101 + if (success_counts + error_counts == ttinfodetailIds.length) {
  102 + deferred.reject();
  103 + }
  104 + } else {
  105 + // 赋值(上下行,发车时间,班次类型)
  106 + if (value.fcsj) {
  107 + ttinfodetailIds[index].fcsj = value.fcsj;
  108 + }
  109 + if (value.xlDir) {
  110 + ttinfodetailIds[index].xldir = value.xlDir;
  111 + }
  112 + if (value.bcType) {
  113 + ttinfodetailIds[index].bc_type = value.bcType;
  114 + }
  115 +
  116 + success_counts ++;
  117 + if (success_counts + error_counts == ttinfodetailIds.length) {
  118 + deferred.resolve();
  119 + }
99 120 }
100 121 }, function() {
101 122 error_counts ++;
... ... @@ -147,6 +168,9 @@ angular.module(&#39;ScheduleApp&#39;).controller(
147 168 self.getDetailInfos = function() {
148 169 return service.getEditInfo().detailInfos;
149 170 };
  171 + self.getYYDesc = function() {
  172 + return service.getEditInfo().yydesc;
  173 + };
150 174  
151 175 // 刷新时刻表数据
152 176 self.refresh = function() {
... ... @@ -337,7 +361,6 @@ angular.module(&#39;ScheduleApp&#39;).controller(
337 361 delete self.TimeTableDetailForSave.zdz;
338 362  
339 363 service.editInfos(self.TimeTableDetailForSave).then(function() {
340   - alert("批量更新成功!");
341 364 $state.go("ttInfoDetailManage_edit", {
342 365 xlid: self.xlid,
343 366 ttid: self.ttid,
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/module.js
... ... @@ -50,7 +50,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
50 50 */
51 51 dataExport: function(ttinfoid) {
52 52 var param = {};
53   - param.type = 'dataExportExt';
  53 + param.type = 'exportFile';
54 54 param.ttinfoid = ttinfoid;
55 55 return dservice.dataTools.dataExport(param).$promise;
56 56 }
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/service.js
... ... @@ -54,15 +54,31 @@ angular.module(&#39;ScheduleApp&#39;).factory(
54 54 {order: 'createDate', direction: 'DESC', id: '@id'},
55 55 {
56 56 get: {
57   - method: 'GET'
  57 + method: 'GET',
  58 + transformResponse: function(rs) {
  59 + var dst = angular.fromJson(rs);
  60 + if (dst.status == 'SUCCESS') {
  61 + return dst.data;
  62 + } else {
  63 + return dst; // 业务错误留给控制器处理
  64 + }
  65 + }
58 66 },
59 67 save: {
60   - method: 'POST'
  68 + method: 'POST',
  69 + transformResponse: function(rs) {
  70 + var dst = angular.fromJson(rs);
  71 + if (dst.status == 'SUCCESS') {
  72 + return dst.data;
  73 + } else {
  74 + return dst; // 业务错误留给控制器处理
  75 + }
  76 + }
61 77 }
62 78 }
63 79 ),
64 80 import: $resource(
65   - '/tidc/importfile',
  81 + '/tidc/importFile',
66 82 {},
67 83 {
68 84 do: {
... ... @@ -85,7 +101,15 @@ angular.module(&#39;ScheduleApp&#39;).factory(
85 101 {},
86 102 {
87 103 list: {
88   - method: 'GET'
  104 + method: 'GET',
  105 + transformResponse: function(rs) {
  106 + var dst = angular.fromJson(rs);
  107 + if (dst.status == 'SUCCESS') {
  108 + return dst.data;
  109 + } else {
  110 + return dst; // 业务错误留给控制器处理
  111 + }
  112 + }
89 113 }
90 114 }
91 115 ),
... ... @@ -107,7 +131,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
107 131 method: 'GET',
108 132 responseType: "arraybuffer",
109 133 params: {
110   - type: "dataExportExt"
  134 + type: "exportFile"
111 135 },
112 136 transformResponse: function(data, headers){
113 137 return {data : data};
... ...
src/main/resources/static/real_control_v2/css/line_schedule.css
... ... @@ -55,7 +55,7 @@
55 55 padding: 0;
56 56 }
57 57  
58   -.line_schedule .schedule-wrap i.uk-icon-question-circle{
  58 +.line_schedule .schedule-wrap .header-title i.uk-icon-question-circle{
59 59 cursor: pointer;
60 60 font-size: 14px;
61 61 color: #cccaca;
... ... @@ -528,6 +528,7 @@ div.drop-rail[data-type=&quot;car&quot;]:before {
528 528  
529 529 dl.relevance-active dd:nth-child(n+2) {
530 530 background: #f1efef !important;
  531 + color: #333;
531 532 }
532 533  
533 534 dl.relevance-active.intimity dd:nth-child(n+2) {
... ... @@ -684,15 +685,17 @@ label.destroy-sch small{
684 685 border-bottom: 0;
685 686 }
686 687  
687   -i.add-temp-sch-icon{
688   - float: right;
689   - font-size: 18px;
690   - cursor: pointer;
691   - color: #4592b8;
692   - margin: 10px 15px 0;
  688 +.add-temp-sch-icon{
  689 + float: right;
  690 + margin: 0 3px 0;
  691 + padding: 0;
  692 + font-size: 13px;
  693 + text-decoration: underline;
693 694 }
694   -i.add-temp-sch-icon:hover{
695   - color: #2d7091;
  695 +
  696 +.add-temp-lp-icon{
  697 + cursor: pointer;
  698 + margin-left: 5px;
696 699 }
697 700  
698 701  
... ... @@ -1022,4 +1025,43 @@ dd.fcsjActualCell div.last-sch-sunken span._badge{
1022 1025 .ct_table>.ct_table_body dl.dl-last-sch:hover div.last-sch-sunken,
1023 1026 .ct_table>.ct_table_body dl.dl-last-sch.context-menu-active div.last-sch-sunken{
1024 1027 background: #f5fbff;
  1028 +}
  1029 +
  1030 +dd.fcsjActualCell{
  1031 + position: relative;
  1032 +}
  1033 +
  1034 +i.signal_state_icon{
  1035 + position: absolute;
  1036 + right: 5px;
  1037 + top: 7px;
  1038 + box-shadow: 0px 0px 11px 0 rgba(0, 0, 0, 0.2), -1px 3px 8px 0 rgba(0, 0, 0, 0.19);
  1039 + text-indent: 0;
  1040 + border-radius: 15px;
  1041 + cursor: pointer;
  1042 +}
  1043 +
  1044 +i.signal_state_icon.uk-icon-question-circle{
  1045 + color: #e85252 !important;
  1046 +}
  1047 +
  1048 +i.signal_state_icon.uk-icon-reply{
  1049 + color: #4134e3 !important;
  1050 + box-shadow: none;
  1051 +}
  1052 +
  1053 +.child-task-status{
  1054 + float: right;
  1055 + font-size: 13px;
  1056 +}
  1057 +
  1058 +.child-task-status.fail{
  1059 + color: red;
  1060 + text-shadow: red 0px 0px 20px;
  1061 +}
  1062 +
  1063 +.child-task-status.fail span.calc-detail{
  1064 + font-family: Consolas,monospace,serif;
  1065 + white-space: nowrap;
  1066 + font-size: 14px;
1025 1067 }
1026 1068 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -165,8 +165,8 @@ svg.line-chart g.item:nth-last-child(3)&gt;text {
165 165 }
166 166  
167 167 svg.line-chart g.gps-wrap>rect {
168   - width: 28px;
169   - height: 24px;
  168 + width: 34px;
  169 + height: 18px;
170 170 /*fill: #fff;*/
171 171 rx: 4px;
172 172 cursor: pointer;
... ... @@ -188,7 +188,7 @@ svg.line-chart g.gps-wrap&gt;rect.hover {
188 188  
189 189 svg.line-chart g.gps-wrap>text {
190 190 font-size: 13px;
191   - transform: translate(3px, 17px);
  191 + transform: translate(2px, 14px);
192 192 pointer-events: none;
193 193 }
194 194  
... ...
src/main/resources/static/real_control_v2/fragments/home/tooltip.html
... ... @@ -19,11 +19,12 @@
19 19 </div>
20 20 <div>
21 21 <span class="field">速度:</span>{{speed}}</div>
22   - <hr>
  22 + <div>
  23 + <span class="field">时间:</span>{{dateStr}}</div>
  24 + {{if expectStopTime!=null}}
23 25 <div>
24 26 预计 {{expectStopTime}} 分钟到达终点</div>
25   - <!-- <hr> -->
26   - <!-- <div class="subtitle">更新时间: 10:34.26</div> -->
  27 + {{/if}}
27 28 <div class="tip_map_wrap"></div>
28 29 </div>
29 30 </div>
... ... @@ -43,12 +44,15 @@
43 44 <div>
44 45 <span class="field">设备:</span>{{gps.deviceId}}
45 46 </div>
46   - <div>
  47 + <div style="color: #747272;">
  48 + {{gps.dateStr}}
  49 + </div>
  50 + <!--<div>
47 51 <span class="field">进站时间:</span>?
48 52 </div>
49 53 <div>
50 54 <span class="field">计划发出:</span>?
51   - </div>
  55 + </div>-->
52 56  
53 57 </div>
54 58 </div>
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/add_temp_sch.html
... ... @@ -13,7 +13,8 @@
13 13 <div class="uk-form-row">
14 14 <label class="uk-form-label">班次类型</label>
15 15 <div class="uk-form-controls">
16   - <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}" data-group=ScheduleType></select>
  16 + <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}"
  17 + data-group=ScheduleType></select>
17 18 </div>
18 19 </div>
19 20 </div>
... ... @@ -22,8 +23,8 @@
22 23 <label class="uk-form-label">上下行</label>
23 24 <div class="uk-form-controls">
24 25 <select name="xlDir">
25   - <option value="0">上行</option>
26   - <option value="1">下行</option>
  26 + <option value="0">上行</option>
  27 + <option value="1">下行</option>
27 28 </select>
28 29 </div>
29 30 </div>
... ... @@ -35,7 +36,7 @@
35 36 <label class="uk-form-label">起点站</label>
36 37 <div class="uk-form-controls">
37 38 <select name="qdzCode" required>
38   - </select>
  39 + </select>
39 40 </div>
40 41 </div>
41 42 </div>
... ... @@ -44,7 +45,7 @@
44 45 <label class="uk-form-label">终点站</label>
45 46 <div class="uk-form-controls">
46 47 <select name="zdzCode" required>
47   - </select>
  48 + </select>
48 49 </div>
49 50 </div>
50 51 </div>
... ... @@ -82,7 +83,8 @@
82 83 <div class="uk-form-row">
83 84 <label class="uk-form-label">里程</label>
84 85 <div class="uk-form-controls">
85   - <input type="text" name="jhlc" value="{{jhlc}}" max=222 data-fv-lessthan-inclusive="false" required>
  86 + <input type="text" name="jhlc" value="{{jhlc}}" max=222 data-fv-lessthan-inclusive="false"
  87 + required>
86 88 </div>
87 89 </div>
88 90 </div>
... ... @@ -90,7 +92,8 @@
90 92 <div class="uk-grid">
91 93 <div class="uk-width-1-2">
92 94 <div class="uk-form-row">
93   - <label class="uk-form-label">驾驶员 <!--<i class="uk-icon-question-circle" data-uk-tooltip title="如果有驾驶员未提示,请至后台“基础信息 -人员信息”里纠正该员工的“工种”类别 "></i>--></label>
  95 + <label class="uk-form-label">驾驶员
  96 + <!--<i class="uk-icon-question-circle" data-uk-tooltip title="如果有驾驶员未提示,请至后台“基础信息 -人员信息”里纠正该员工的“工种”类别 "></i>--></label>
94 97 <div class="uk-form-controls">
95 98 <div class="uk-autocomplete uk-form jsy-autocom">
96 99 <input type="text" value="{{jGh}}/{{jName}}" name="jsy" required>
... ... @@ -116,101 +119,139 @@
116 119 </script>
117 120  
118 121 <script>
119   - (function() {
  122 + (function () {
120 123 var modal = '#schedule-addsch-modal',
121   - sch, stationRoutes, parks, information;
122   - $(modal).on('init', function(e, data) {
  124 + sch, stationRoutes, parks, information;
  125 +
  126 + var normalInfo = [];
  127 + $(modal).on('init', function (e, data) {
123 128 sch = data.sch;
  129 + //normal 班次里程和耗时
  130 + var list = gb_common.get_vals(gb_schedule_table.findScheduleByLine(sch.xlBm));
  131 + var upPlan = getNormalSch(list, 0)
  132 + , downPlan = getNormalSch(list, 1);
  133 + normalInfo[0] = {time: upPlan.bcsj, mileage: upPlan.jhlc};
  134 + normalInfo[1] = {time: downPlan.bcsj, mileage: downPlan.jhlc};
  135 +
  136 +
124 137 var formHtml = template('schedule-addsch-form-temp', sch);
125 138 $('form', modal).html(formHtml);
126 139 //字典转换
127 140 dictionaryUtils.transformDom($('.nt-dictionary', modal));
128 141  
129 142 //----------- Autocomplete --------------
130   - $.get('/basic/cars', function(rs) {
  143 + $.get('/basic/cars', function (rs) {
131 144 //车辆
132 145 gb_common.carAutocomplete($('.car-autocom', modal), rs);
133 146 });
134   - //$.get('/basic/all_personnel', function(rs) {
135   - //驾驶员
136   - gb_common.personAutocomplete($('.jsy-autocom', modal));
137   - //售票员
138   - gb_common.personAutocomplete($('.spy-autocom', modal));
139   - //});
  147 + //驾驶员
  148 + gb_common.personAutocomplete($('.jsy-autocom', modal));
  149 +
  150 + //售票员
  151 + gb_common.personAutocomplete($('.spy-autocom', modal));
140 152  
141 153 //站点路由
142   - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function(a, b){
143   - return a.stationRouteCode-b.stationRouteCode;
  154 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  155 + return a.stationRouteCode - b.stationRouteCode;
144 156 }), 'directions');
145 157 //停车场
146   - $.get('/basic/parks', function(rs){
147   - parks=rs;
  158 + $.get('/basic/parks', function (rs) {
  159 + parks = rs;
148 160 });
149 161 //线路标准
150   - information=gb_data_basic.getLineInformation(sch.xlBm);
  162 + information = gb_data_basic.getLineInformation(sch.xlBm);
151 163  
152 164 //submit
153 165 var f = $('form', modal).formValidation(gb_form_validation_opts);
154   - f.on('success.form.fv', function(e) {
  166 + f.on('success.form.fv', function (e) {
155 167 disabled_submit_btn(this);
156 168 e.preventDefault();
157 169 var data = $(this).serializeJSON();
158   - data.xlBm=sch.xlBm;
159   - data.xlName=sch.xlName;
160   - data.lpName=sch.lpName;
  170 + data.xlBm = sch.xlBm;
  171 + data.xlName = sch.xlName;
  172 + data.lpName = sch.lpName;
161 173 //拆分驾驶员工号和姓名
162 174 data.jGh = data.jsy.split('/')[0];
163 175 data.jName = data.jsy.split('/')[1];
164 176 delete data.jsy;
165 177 //拆分售票员工号和姓名
166   - if(data.sGh != null){
167   - data.sGh = data.spy.split('/')[0];
168   - data.sName = data.spy.split('/')[1];
169   - delete data.spy;
  178 + if (data.sGh != null) {
  179 + data.sGh = data.spy.split('/')[0];
  180 + data.sName = data.spy.split('/')[1];
  181 + delete data.spy;
170 182 }
171 183  
172   - gb_common.$post('/realSchedule', data, function(rs){
173   - //插入
174   - gb_schedule_table.insertSchedule(rs.t, rs.ts);
175   - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: rs.t});
176   - UIkit.modal(modal).hide();
177   - notify_succ('新增临加班次成功');
  184 + gb_common.$post('/realSchedule', data, function (rs) {
  185 + //插入
  186 + gb_schedule_table.insertSchedule(rs.t, rs.ts);
  187 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: rs.t});
  188 + UIkit.modal(modal).hide();
  189 + notify_succ('新增临加班次成功');
178 190 });
179 191 });
180 192  
181 193 //班次类型 和 上下行切换
182   - $('[name=bcType],[name=xlDir]', f).on('change', function(){
183   - var bcType_e=$('[name=bcType]', f)
184   - , xlDir_e=$('[name=xlDir]', f);
185   -
186   - var routes=stationRoutes[xlDir_e.val()]
187   - ,lastCode=routes[routes.length-1].stationCode
188   - ,opts='',park_opts='';
189   - //station options
190   - $.each(routes, function(){
191   - opts+='<option value="'+this.stationCode+'">'+this.stationName+'</option>'
192   - });
193   - //park options
194   - for(var code in parks)
195   - park_opts+='<option value="'+code+'">'+parks[code]+'</option>';
196   -
197   - var qdz=$('[name=qdzCode]', f),zdz=$('[name=zdzCode]', f);
198   - switch (bcType_e.val()) {
199   - case 'out':
200   - qdz.html(park_opts).val(information.carPark);
201   - zdz.html(opts);
202   - break;
203   - case 'in':
204   - qdz.html(opts);
205   - zdz.html(park_opts).val(information.carPark);
206   - break;
207   - default:
208   - qdz.html(opts);
209   - zdz.html(opts).val(lastCode);
210   - }
  194 + $('[name=bcType],[name=xlDir]', f).on('change', function () {
  195 + var bcType_e = $('[name=bcType]', f)
  196 + , xlDir_e = $('[name=xlDir]', f);
  197 +
  198 + var routes = stationRoutes[xlDir_e.val()]
  199 + , lastCode = routes[routes.length - 1].stationCode
  200 + , opts = '', park_opts = '';
  201 + //station options
  202 + $.each(routes, function () {
  203 + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'
  204 + });
  205 + //park options
  206 + for (var code in parks)
  207 + park_opts += '<option value="' + code + '">' + parks[code] + '</option>';
  208 +
  209 + var qdz = $('[name=qdzCode]', f), zdz = $('[name=zdzCode]', f);
  210 + var time, mileage;
  211 + switch (bcType_e.val()) {
  212 + case 'out':
  213 + qdz.html(park_opts).val(information.carPark);
  214 + zdz.html(opts);
  215 + //出场结束时间
  216 + time = xlDir_e.val() == 0 ? information.upOutTimer : information.downOutTimer;
  217 + mileage = xlDir_e.val() == 0 ? information.upOutMileage : information.downOutMileage;
  218 + break;
  219 + case 'in':
  220 + qdz.html(opts);
  221 + zdz.html(park_opts).val(information.carPark);
  222 + //进场结束时间
  223 + time = xlDir_e.val() == 0 ? information.upInTimer : information.downInTimer;
  224 + mileage = xlDir_e.val() == 0 ? information.upInMileage : information.downInMileage;
  225 + break;
  226 + default:
  227 + qdz.html(opts);
  228 + zdz.html(opts).val(lastCode);
  229 + time = xlDir_e.val() == 0?normalInfo[0].time:normalInfo[1].time;
  230 + mileage = xlDir_e.val() == 0?normalInfo[0].mileage:normalInfo[1].mileage;
  231 + }
  232 +
  233 + setEndTime(time);
  234 + $('[name=jhlc]', f).val(mileage);
211 235 }).trigger('change');
212 236  
  237 +
  238 + function setEndTime(diff) {
  239 + var et = moment($('[name=fcsj]', f).val(), 'HH:mm').add(diff, 'minutes').format('HH:mm');
  240 + $('[name=zdsj]', f).val(et);
  241 + }
213 242 });
  243 +
  244 + function getNormalSch(list, updown) {
  245 + var sch;
  246 + $.each(list, function () {
  247 + if (this.bcType == 'normal' && this.xlDir == updown) {
  248 + sch = this;
  249 + return false;
  250 + }
  251 + });
  252 +
  253 + return sch;
  254 + }
214 255 })();
215 256 </script>
216 257 </div>
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/bc_type_major.html
... ... @@ -15,7 +15,7 @@
15 15 </div>
16 16 <div class="uk-width-1-2">
17 17 <div class="uk-form-row">
18   - <label class="uk-form-label" style="width: 75px;">放站至</label>
  18 + <label class="uk-form-label" style="width: 75px;">放站至</label>
19 19 <div class="uk-form-controls" style="margin-left: 75px;">
20 20 <select name="endStation">
21 21 </select>
... ... @@ -53,11 +53,31 @@
53 53  
54 54 var remarks;
55 55 function refreshDirectiveStr() {
  56 +
  57 + var $qdz = $('[name=startStation]')
  58 + , $zdz = $('[name=endStation]');
56 59 //指令内容
57   - var qdzName = $('[name=startStation]').find("option:selected").text()
58   - , zdzName = $('[name=endStation]').find("option:selected").text();
59   - remarks=' 由 ' + qdzName + ' 放站至 ' + zdzName;
60   - $('[name=directiveStr]', modal).text('班次:'+sch.dfsj+remarks).trigger('input');
  60 + var qdzName = $qdz.find("option:selected").text()
  61 + , zdzName = $zdz.find("option:selected").text();
  62 +
  63 + //只修改起点
  64 + if(sch.qdzCode != $qdz.val() && sch.zdzCode == $zdz.val()){
  65 + remarks = ' 从 '+ sch.qdzName +' 待客至 ' + qdzName + ' ,放站至 ' + zdzName;
  66 + }
  67 + //只修改终点
  68 + else if(sch.qdzCode == $qdz.val() && sch.zdzCode != $zdz.val()){
  69 + remarks = ' 从 '+ sch.qdzName +' 放站至 ' + zdzName + ' 开始待客';
  70 + }
  71 + //起终点都改变
  72 + else if(sch.qdzCode != $qdz.val() && sch.zdzCode != $zdz.val()){
  73 + remarks = ' 从 '+ qdzName +' 放站至 ' + zdzName + ' 开始待客';
  74 + }
  75 + //起终点都不改变
  76 + else if(sch.qdzCode == $qdz.val() && sch.zdzCode == $zdz.val()){
  77 + remarks = ' 从 '+ qdzName +' 放站至 ' + zdzName;
  78 + }
  79 +
  80 + $('[name=directiveStr]', modal).text('班次:' + sch.dfsj + remarks).trigger('input');
61 81 }
62 82  
63 83 $('[name=startStation]', modal).on('change', function () {
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/bc_type_venting.html
... ... @@ -6,7 +6,7 @@
6 6 <div class="uk-grid">
7 7 <div class="uk-width-1-2">
8 8 <div class="uk-form-row">
9   - <label class="uk-form-label" style="width: 75px;"></label>
  9 + <label class="uk-form-label" style="width: 75px;">起点</label>
10 10 <div class="uk-form-controls" style="margin-left: 75px;">
11 11 <select name="startStation">
12 12 </select>
... ... @@ -15,7 +15,7 @@
15 15 </div>
16 16 <div class="uk-width-1-2">
17 17 <div class="uk-form-row">
18   - <label class="uk-form-label" style="width: 75px;">直放至</label>
  18 + <label class="uk-form-label" style="width: 75px;">终点</label>
19 19 <div class="uk-form-controls" style="margin-left: 75px;">
20 20 <select name="endStation">
21 21 </select>
... ... @@ -53,12 +53,30 @@
53 53  
54 54 var remarks;
55 55 function refreshDirectiveStr() {
  56 + var $qdz = $('[name=startStation]')
  57 + , $zdz = $('[name=endStation]');
56 58 //指令内容
57   - var qdzName = $('[name=startStation]').find("option:selected").text()
58   - , zdzName = $('[name=endStation]').find("option:selected").text();
  59 + var qdzName = $qdz.find("option:selected").text()
  60 + , zdzName = $zdz.find("option:selected").text();
59 61  
60   - remarks=' 由 ' + qdzName + ' 直放至 ' + zdzName;
61   - $('[name=directiveStr]', modal).text('班次:'+sch.dfsj+ remarks).trigger('input');
  62 + //只修改起点
  63 + if(sch.qdzCode != $qdz.val() && sch.zdzCode == $zdz.val()){
  64 + remarks = ' 从 '+ sch.qdzName +' 待客至 ' + qdzName + ' ,直放至 ' + zdzName;
  65 + }
  66 + //只修改终点
  67 + else if(sch.qdzCode == $qdz.val() && sch.zdzCode != $zdz.val()){
  68 + remarks = ' 从 '+ sch.qdzName +' 直放至 ' + zdzName + ' 开始待客';
  69 + }
  70 + //起终点都改变
  71 + else if(sch.qdzCode != $qdz.val() && sch.zdzCode != $zdz.val()){
  72 + remarks = ' 从 '+ qdzName +' 直放至 ' + zdzName + ' 开始待客';
  73 + }
  74 + //起终点都不改变
  75 + else if(sch.qdzCode == $qdz.val() && sch.zdzCode == $zdz.val()){
  76 + remarks = ' 从 '+ qdzName +' 直放至 ' + zdzName;
  77 + }
  78 +
  79 + $('[name=directiveStr]', modal).text('班次:' + sch.dfsj + remarks).trigger('input');
62 80 }
63 81  
64 82 $('[name=startStation]', modal).on('change', function () {
... ... @@ -98,7 +116,7 @@
98 116 f.on('success.form.fv', function (e) {
99 117 e.preventDefault();
100 118 var data = $(this).serializeJSON();
101   - // notify_wait('准备下发指令')
  119 + // notify_wait('准备下发指令')
102 120 //下发指令
103 121 $.post('/directive/phrase', {nbbm: sch.clZbh, text: data.directiveStr}, function (rs) {
104 122 if (rs == 0) {
... ... @@ -128,7 +146,10 @@
128 146  
129 147 function changeBcType() {
130 148 //将班次类型调整为直放
131   - gb_common.$post('/realSchedule/changeBcType/'+sch.id, {bcType: 'venting', remarks: remarks}, function(rs){
  149 + gb_common.$post('/realSchedule/changeBcType/' + sch.id, {
  150 + bcType: 'venting',
  151 + remarks: remarks
  152 + }, function (rs) {
132 153 UIkit.modal(modal).hide();
133 154 gb_schedule_table.updateSchedule(rs.t);
134 155 //触发父容器刷新事件
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
... ... @@ -18,13 +18,17 @@
18 18 <div class="uk-form-row">
19 19 <label class="uk-form-label" style="width: 50px;">路牌</label>
20 20 <div class="uk-form-controls" style="margin-left: 51px;">
21   - <select name="lpName"></select>
  21 + <select name="lpName" style="width: 120px;"></select>
  22 + <i class="uk-icon-plus add-temp-lp-icon" title="临加路牌" data-uk-tooltip></i>
22 23 </div>
23 24 </div>
24 25 </div>
25 26 <div class="uk-width-1-3">
26 27 <div class="uk-form-row">
27   - <i class="uk-icon-plus add-temp-sch-icon" title="新增临加班次" data-uk-tooltip></i>
  28 + <!--<i class="uk-icon-plus add-temp-sch-icon" title="新增临加班次" data-uk-tooltip></i>-->
  29 + <!--<button class="uk-button uk-button-primary add-temp-sch-icon">临加班次</button>-->
  30 + <!--<a class="uk-button add-temp-sch-icon"><i class="uk-icon-plus"></i> 临加班次</a>-->
  31 + <a class="uk-button uk-button-link add-temp-sch-icon"> 临加班次</a>
28 32 </div>
29 33 </div>
30 34 </div>
... ... @@ -51,7 +55,9 @@
51 55 </div>
52 56  
53 57 <div class="uk-panel uk-panel-box uk-panel-box-secondary" style="padding-bottom: 0;">
54   - <h3 class="uk-panel-title">子任务列表</h3>
  58 + <h3 class="uk-panel-title" id="childTaskTitle">
  59 + 子任务列表
  60 + </h3>
55 61 <div class="ct_table_wrap ct_table_no_border" style="height: 142px;">
56 62 <div class="ct_table sub-task-table">
57 63 <div class="ct_table_head">
... ... @@ -131,6 +137,12 @@
131 137 </dl>
132 138 {{/each}}
133 139 </script>
  140 +
  141 + <script id="sub_task-fail-status-temp" type="text/html">
  142 + <div class="child-task-status fail"><i class="uk-icon-times-circle"></i> 营运里程 与主任务不符,请检查子任务
  143 + <span class="calc-detail">{{calcs}}</span></div>
  144 + </script>
  145 +
134 146 <script>
135 147 (function () {
136 148 var modal_opts = {center: false, bgclose: false, modal: false}
... ... @@ -140,6 +152,7 @@
140 152 s_t_body = '.sub-task-table .ct_table_body',
141 153 folder = '/real_control_v2/fragments/line_schedule/context_menu',
142 154 sch, schList, lp2SchMap;
  155 +
143 156 $(modal).on('init', function (e, data) {
144 157 sch = data.sch;
145 158  
... ... @@ -163,10 +176,16 @@
163 176  
164 177 //路牌下拉框
165 178 $('[name=lpName]', f).on('change', function () {
166   - var list = lp2SchMap[$(this).val()].sort(gb_schedule_table.schedule_sort),
167   - htmlBody = template('schedule-main-table-temp', {
168   - list: list
169   - });
  179 + var list = [];
  180 +
  181 + try {
  182 + list = lp2SchMap[$(this).val()].sort(gb_schedule_table.schedule_sort);
  183 +
  184 + } catch (e) {
  185 + }
  186 + var htmlBody = template('schedule-main-table-temp', {
  187 + list: list
  188 + });
170 189 $(m_t_body, modal).html(htmlBody);
171 190 $(s_t_body, modal).empty();
172 191 });
... ... @@ -218,7 +237,7 @@
218 237 if (opts && opts.sch) {
219 238 selectedDl(opts.sch);
220 239 }
221   - }
  240 + };
222 241  
223 242 //刷新子任务表格
224 243 var sub_task_update = function () {
... ... @@ -230,7 +249,30 @@
230 249 tbody.html(htmlStr);
231 250 //字典转换
232 251 dictionaryUtils.transformDom($('.nt-dictionary', tbody));
233   - }
  252 +
  253 + //检查子任务营运里程
  254 + $('#childTaskTitle .child-task-status', modal).remove();
  255 + var i = 0;
  256 + if (sch.cTasks.length == 0)
  257 + return;
  258 + var sum = 0, calcs = '';
  259 + $.each(sch.cTasks, function () {
  260 + if (this.mileageType == 'service') {
  261 + sum = gb_common.accAdd(sum, this.mileage);
  262 + calcs += (' + ' + this.mileage);
  263 + i++;
  264 + }
  265 + });
  266 + //公里与主任务不符合
  267 + if (sum != sch.jhlc) {
  268 + if (i > 1)
  269 + calcs += ('=' + sum);
  270 + calcs += (' ≠ ' + sch.jhlc);
  271 + calcs = calcs.substr(3);
  272 + var htmlStr = template('sub_task-fail-status-temp', {calcs: calcs});
  273 + $('#childTaskTitle', modal).append(htmlStr);
  274 + }
  275 + };
234 276  
235 277 //新增临加
236 278 var add_temp_sch = function () {
... ... @@ -241,7 +283,7 @@
241 283 open_modal(folder + '/add_temp_sch.html', {
242 284 sch: sch
243 285 }, modal_opts);
244   - }
  286 + };
245 287  
246 288 //删除临加班次
247 289 var remove_sch = function () {
... ... @@ -254,7 +296,6 @@
254 296 //前端数据更新
255 297 gb_schedule_table.updateSchedule(rs.ts);
256 298 gb_schedule_table.deheteSchedule(rs.delete);
257   - //m_s_table_update();
258 299 $('.main-schedule-table', modal).trigger('refresh');
259 300 });
260 301 }, '确定删除');
... ... @@ -359,6 +400,21 @@
359 400 gb_ct_table.fixedHead($('.ct_table_wrap', modal));
360 401  
361 402 $('.add-temp-sch-icon', modal).on('click', add_temp_sch);
  403 + //临加路牌
  404 + $('.add-temp-lp-icon', modal).on('click', function () {
  405 + var index = 0, max;
  406 + for (var lp in lp2SchMap) {
  407 + if (lp.indexOf('临') != -1) {
  408 + max = lp.substr(lp.indexOf('临') + 1);
  409 + if (!isNaN(max))
  410 + index = parseInt(max);
  411 + }
  412 + }
  413 +
  414 + var lpName = '临' + (index + 1);
  415 + lp2SchMap[lpName] = [];
  416 + $('[name=lpName]', f).append('<option value="' + lpName + '">' + lpName + '</option>').val(lpName).trigger('change');
  417 + });
362 418  
363 419 function sub_task_sort(a, b) {
364 420 return a.id - b.id;
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
... ... @@ -83,7 +83,7 @@
83 83 <dd data-sort-val={{sch.dfsjT}} dbclick dbclick-type="dfsj" dbclick-val="{{sch.dfsj}}">
84 84 {{sch.dfsj}}
85 85 </dd>
86   - <dd class="
  86 + <dd data-uk-observe class="
87 87 {{if sch.status==-1}}
88 88 tl-qrlb
89 89 {{else if sch.status==2}}
... ... @@ -130,7 +130,7 @@
130 130 </script>
131 131  
132 132 <script id="line-schedule-sfsj-temp" type="text/html">
133   - <dd class="
  133 + <dd data-uk-observe class="
134 134 {{if status==-1}}
135 135 tl-qrlb
136 136 {{else if status==2}}
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/signal_state_config.html 0 → 100644
  1 +<div class="uk-modal ct-form-modal" id="signal_state_config-modal">
  2 + <div class="uk-modal-dialog" style="width: 530px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>信号标记设置</h2></div>
  6 +
  7 + <p style="border-bottom: 1px solid #efefef;color: grey;padding-bottom: 9px;">
  8 + <small>
  9 + <i class="uk-icon-question-circle"> </i>
  10 + 设置项将会保存在本地客户端,清理缓存和更换电脑会重置.</small>
  11 + </p>
  12 + <form class="uk-form uk-form-horizontal">
  13 + <div class="uk-grid">
  14 + <div class="uk-width-2-3 uk-container-center">
  15 + <div class="uk-form-row">
  16 + <label class="uk-form-label">是否启用</label>
  17 + <div class="uk-form-controls">
  18 + <select name="enable">
  19 + <option value="1">启用</option>
  20 + <option value="0">禁用</option>
  21 + </select>
  22 + </div>
  23 + </div>
  24 + </div>
  25 + </div>
  26 +
  27 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  28 + <button type="button" class="uk-button uk-modal-close">取消</button>
  29 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  30 + </div>
  31 + </form>
  32 + </div>
  33 +
  34 + <script>
  35 + (function() {
  36 + var modal = '#signal_state_config-modal';
  37 + var f = $('form', modal);
  38 +
  39 + $(modal).on('init', function(e, data) {
  40 + var val = gb_signal_state.isEnable()?1:0;
  41 + $('[name=enable]', f).val(val);
  42 + });
  43 +
  44 + f.formValidation(gb_form_validation_opts);
  45 + f.on('success.form.fv', function(e) {
  46 + e.preventDefault();
  47 + var data = $(this).serializeJSON();
  48 +
  49 + if(data.enable=='1')
  50 + gb_signal_state.enable();
  51 + else
  52 + gb_signal_state.disable();
  53 +
  54 + UIkit.modal(modal).hide();
  55 + });
  56 +
  57 + })();
  58 + </script>
  59 +</div>
0 60 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/js/data/data_gps.js
... ... @@ -15,12 +15,6 @@ var gb_data_gps = (function() {
15 15 };
16 16  
17 17 var refresh = function(cb) {
18   - /*$.get('/gps/real/line', {
19   - lineCodes: gb_data_basic.line_idx
20   - }, function(rs) {
21   - refreshData(rs);
22   - cb();
23   - });*/
24 18 $.ajax({
25 19 url: '/gps/real/line',
26 20 data:{lineCodes: gb_data_basic.line_idx},
... ... @@ -30,7 +24,7 @@ var gb_data_gps = (function() {
30 24 },
31 25 error: function (xr, t) {
32 26 notify_err('刷新GPS失败,稍后重试' + t);
33   - //cb();
  27 + cb();
34 28 }
35 29 });
36 30 };
... ... @@ -50,9 +44,9 @@ var gb_data_gps = (function() {
50 44 upArr.push(this);
51 45 } else
52 46 addArr.push(this);
53   - //起终点 拼接方向标识
54   - if(this.sEPoint)
55   - this.stopNo=this.stopNo+'_'+this.upDown;
  47 +
  48 + //时间格式化
  49 + this.dateStr = moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss');
56 50 realData[this.deviceId] = this;
57 51 });
58 52  
... ... @@ -84,15 +78,15 @@ var gb_data_gps = (function() {
84 78 rs.push(realData[device]);
85 79 }
86 80 return rs;
87   - }
  81 + };
88 82  
89 83 var findOne = function(deviceId){
90 84 return realData[deviceId];
91   - }
  85 + };
92 86  
93 87 var findGpsByNbbm = function(nbbm){
94 88 return realData[gb_data_basic.nbbm2deviceMap()[nbbm]];
95   - }
  89 + };
96 90  
97 91 return {
98 92 fixedTimeRefresh: fixedTimeRefresh,
... ...
src/main/resources/static/real_control_v2/js/data/gps_abnormal.js 0 → 100644
  1 +/** gps 信号异常状态,无效 | 越界 | 超速 */
  2 +
  3 +var gb_gps_abnormal = (function () {
  4 +
  5 + //按线路分组的路段数据
  6 + var allRoads;
  7 +
  8 + //gps无效
  9 + var gpsInvalid = function (gps) {
  10 + return gps.lat == 0 || gps.lon == 0;
  11 + };
  12 +
  13 + //越界
  14 + var gpsOutOfBounds = function (gps) {
  15 + var roads = allRoads[gps.lineId + '_' + gps.upDown];
  16 + if (!roads)
  17 + return;
  18 +
  19 + //最短距离
  20 + var min, distance;
  21 + $.each(roads, function () {
  22 + distance = minDistanceFromRoad(this.pos, gps);
  23 + if(!min || min > distance)
  24 + min = distance;
  25 + });
  26 +
  27 + //console.log('最短距离', min, gps);
  28 + };
  29 +
  30 + /**
  31 + * 初始化数据
  32 + */
  33 + var initData = function () {
  34 + //获取线路路段数据
  35 + gb_common.$get('/realMap/multiSectionRoute', {codeIdx: gb_data_basic.line_idx}, function (rs) {
  36 + var list = [];
  37 + $.each(rs.section, function () {
  38 + list.push({
  39 + line: this['LINE_CODE'],
  40 + updown: this['DIRECTIONS'],
  41 + pos: parseCoords(this['GSECTION_VECTOR']),
  42 + route_code: this['SECTIONROUTE_CODE'],
  43 + code: this['SECTION_CODE'],
  44 + name: this['SECTION_NAME']
  45 + });
  46 + });
  47 + //按线路_走向 分组数据
  48 + allRoads = groupByLineAndUpdown(list);
  49 + console.log('路段数据', allRoads);
  50 + });
  51 + };
  52 +
  53 + function minDistanceFromRoad(pos, gps){
  54 + var distance, min;
  55 + var len = pos.length - 1;
  56 + for(var i = 0; i < len; i ++){
  57 + distance = geolib.getDistanceFromLine({
  58 + latitude: gps.lat,
  59 + longitude: gps.lon
  60 + }, pos[i], pos[i + 1]);
  61 +
  62 + if(!min || min > distance)
  63 + min = distance;
  64 + }
  65 +
  66 + return min;
  67 + }
  68 +
  69 + function groupByLineAndUpdown(list) {
  70 + var rs = {},
  71 + key;
  72 + $.each(list, function () {
  73 + key = this.line + '_' + this.updown;
  74 + if (!rs[key])
  75 + rs[key] = [];
  76 +
  77 + rs[key].push(this);
  78 + });
  79 +
  80 + return rs;
  81 + }
  82 +
  83 + function parseCoords(str) {
  84 + var array = str.substr(11, str.length - 2).split(','), rs = [], temps;
  85 + $.each(array, function (i, coords) {
  86 + temps = coords.split(' ');
  87 + rs.push({
  88 + latitude: parseFloat(temps[1]),
  89 + longitude: parseFloat(temps[0])
  90 + });
  91 + });
  92 +
  93 + return rs;
  94 + }
  95 +
  96 + return {
  97 + initData: initData,
  98 + check: function (gps) {
  99 + if(!allRoads){
  100 + return;
  101 + }
  102 +
  103 + gpsOutOfBounds(gps);
  104 + }
  105 + }
  106 +})();
0 107 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
... ... @@ -93,6 +93,11 @@
93 93 "id": 3.1,
94 94 "text": "TTS",
95 95 "event": "tts_config"
  96 + },
  97 + {
  98 + "id": 3.2,
  99 + "text": "信号标记",
  100 + "event": "signal_state"
96 101 }
97 102 ]
98 103 }
... ...
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
1 1 /* line schedule table context menu*/
2 2  
3   -var gb_schedule_context_menu = (function() {
  3 +var gb_schedule_context_menu = (function () {
4 4  
5 5 var modal_opts = {
6 6 center: false,
... ... @@ -8,35 +8,38 @@ var gb_schedule_context_menu = (function() {
8 8 },
9 9 folder = '/real_control_v2/fragments/line_schedule/context_menu';
10 10 var callbackHandler = {
11   - dftz: function(sch) {
  11 + dftz: function (sch) {
12 12 open_modal(folder + '/dftz.html', {
13 13 sch: sch
14 14 }, modal_opts);
15 15 },
16   - multi_tzrc: function(schArray) {
  16 + multi_tzrc: function (schArray) {
17 17 open_modal(folder + '/multi_tzrc.html', {
18 18 list: schArray
19 19 }, modal_opts);
20 20 },
21   - multi_dftz: function(schArray) {
  21 + multi_dftz: function (schArray) {
  22 + var list = schArray.filter(function (sch) {
  23 + return sch.bcType != 'out' && sch.bcType != 'in' && sch.fcsjActual == null;
  24 + });
22 25 open_modal(folder + '/multi_dftz.html', {
23   - list: schArray
  26 + list: list
24 27 }, modal_opts);
25 28 },
26   - jhlb: function(sch) {
  29 + jhlb: function (sch) {
27 30 open_modal(folder + '/jhlb.html', {
28 31 sch: sch
29 32 }, modal_opts);
30 33 },
31   - cxlb: function(sch) {
  34 + cxlb: function (sch) {
32 35 if (!sch.destroy)
33 36 return notify_err('烂掉的班次才能执行此操作!');
34 37  
35 38 var content = '<h3>确定要撤销<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>的烂班设置?</h3>'
36   - alt_confirm(content, function() {
  39 + alt_confirm(content, function () {
37 40 gb_common.$post('/realSchedule/revokeDestroy', {
38 41 id: sch.id
39   - }, function(rs) {
  42 + }, function (rs) {
40 43 gb_schedule_table.updateSchedule(rs.t);
41 44 notify_succ('撤销烂班操作成功!');
42 45  
... ... @@ -45,20 +48,20 @@ var gb_schedule_context_menu = (function() {
45 48 });
46 49 }, '确认撤销');
47 50 },
48   - sftz: function(sch) {
  51 + sftz: function (sch) {
49 52 open_modal(folder + '/sftz.html', {
50 53 sch: sch
51 54 }, modal_opts);
52 55 },
53   - cxsf: function(sch) {
  56 + cxsf: function (sch) {
54 57 if (!sch.fcsjActual)
55 58 return notify_err('车辆未实发,无法执行该操作!');
56 59  
57 60 var content = '<h3>确定要撤销<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>的实发时间?</h3>'
58   - alt_confirm(content, function() {
  61 + alt_confirm(content, function () {
59 62 gb_common.$post('/realSchedule/revokeRealOutgo', {
60 63 id: sch.id
61   - }, function(rs) {
  64 + }, function (rs) {
62 65 gb_schedule_table.updateSchedule(rs.ts);
63 66 notify_succ('撤销实发操作成功!');
64 67 //calc 应发未发
... ... @@ -66,27 +69,27 @@ var gb_schedule_context_menu = (function() {
66 69 });
67 70 }, '确认撤销实发');
68 71 },
69   - fcxxwt: function(sch) {
  72 + fcxxwt: function (sch) {
70 73 open_modal(folder + '/fcxxwt.html', {
71 74 sch: sch
72 75 }, modal_opts);
73 76 },
74   - lj_zrw: function(sch) {
  77 + lj_zrw: function (sch) {
75 78 open_modal(folder + '/lj_zrw.html', {
76 79 sch: sch
77 80 }, modal_opts);
78 81 },
79   - tzrc: function(sch) {
  82 + tzrc: function (sch) {
80 83 open_modal(folder + '/tzrc.html', {
81 84 sch: sch
82 85 }, modal_opts);
83 86 },
84   - zlcf: function(sch) {
  87 + zlcf: function (sch) {
85 88 var text = sch.clZbh + '重发调度指令? [路牌: ' + sch.lpName + ' 计划时间:' + sch.fcsj + ' 待发时间:' + sch.dfsj + ']';
86   - alt_confirm(text, function() {
  89 + alt_confirm(text, function () {
87 90 //走短语下发
88 91 $.post('/directive/dispatch', {id: sch.id},
89   - function(code) {
  92 + function (code) {
90 93 if (code == 0)
91 94 notify_succ('发送指令成功');
92 95 else
... ... @@ -95,12 +98,12 @@ var gb_schedule_context_menu = (function() {
95 98 }, '确定下发指令');
96 99 },
97 100 jgtz: function (schArray) {
98   - var idArr=[];
99   - $.each(schArray, function(){
100   - idArr.push(this.id);
  101 + var idArr = [];
  102 + $.each(schArray, function () {
  103 + idArr.push(this.id);
101 104 });
102   - var elem = UIkit.modal.prompt('请输入间隔(分钟)',0, function(newValue) {
103   - if (!isNaN(newValue) && newValue>0) {
  105 + var elem = UIkit.modal.prompt('请输入间隔(分钟)', 0, function (newValue) {
  106 + if (!isNaN(newValue) && newValue > 0) {
104 107 gb_common.$post_arr('/realSchedule/spaceAdjust', {ids: idArr, space: newValue}, function (rs) {
105 108 //刷新数据
106 109 gb_schedule_table.updateSchedule(rs.ts);
... ... @@ -120,7 +123,7 @@ var gb_schedule_context_menu = (function() {
120 123 $.contextMenu({
121 124 selector: '.line_schedule .ct_table_body dl:not([class="drag-active"])',
122 125 className: 'schedule-ct-menu',
123   - callback: function(key, options) {
  126 + callback: function (key, options) {
124 127 var $tbody = options.$trigger.parent(),
125 128 id = $('.context-menu-active', $tbody).data('id'),
126 129 lineCode = $tbody.parents('li.line_schedule').data('id'),
... ... @@ -166,13 +169,13 @@ var gb_schedule_context_menu = (function() {
166 169 $.contextMenu({
167 170 selector: '.line_schedule .ct_table_body dl.drag-active',
168 171 className: 'schedule-ct-menu',
169   - callback: function(key, options) {
  172 + callback: function (key, options) {
170 173 var $tbody = options.$trigger.parent(),
171 174 lineCode = $tbody.parents('li.line_schedule').data('id'),
172 175 schArray = [],
173 176 all = gb_schedule_table.findScheduleByLine(lineCode);
174 177  
175   - $tbody.find('dl.drag-active').each(function() {
  178 + $tbody.find('dl.drag-active').each(function () {
176 179 schArray.push(all[$(this).data('id')]);
177 180 });
178 181  
... ... @@ -190,4 +193,6 @@ var gb_schedule_context_menu = (function() {
190 193 }
191 194 }
192 195 });
  196 +
  197 + return callbackHandler;
193 198 })();
... ...
src/main/resources/static/real_control_v2/js/line_schedule/dbclick.js
... ... @@ -67,15 +67,23 @@ var gb_schedule_table_dbclick = (function() {
67 67 'cancel': {
68 68 name: '取消',
69 69 icon: "delete"
70   - },
71   - 'save': {
72   - name: '保存',
73   - icon: "edit"
74 70 }
75 71 }
76 72 });
  73 +
  74 + var sfsjCellClick = function (elem) {
  75 + elem.dblclick(function () {
  76 +
  77 + var id = $(this).parent().data('id'),
  78 + lineCode = $(this).parents('li.line_schedule').data('id');
  79 +
  80 + var sch = gb_schedule_table.findScheduleByLine(lineCode)[id];
  81 + gb_schedule_context_menu.fcxxwt(sch);
  82 + });
  83 + };
77 84  
78 85 return {
79   - init: init
  86 + init: init,
  87 + sfsjCellClick:sfsjCellClick
80 88 };
81 89 })();
... ...
src/main/resources/static/real_control_v2/js/line_schedule/layout.js
... ... @@ -22,7 +22,7 @@ var gb_line_layout = (function() {
22 22 };
23 23  
24 24 //图例icon tootip
25   - $(document).on('mouseenter', '.schedule-wrap i.uk-icon-question-circle', function() {
  25 + $(document).on('mouseenter', '.schedule-wrap .header-title i.uk-icon-question-circle', function() {
26 26 $(this).qtip({
27 27 show: {
28 28 ready: true,
... ...
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
... ... @@ -108,6 +108,9 @@ var gb_schedule_table = (function () {
108 108 }
109 109 });
110 110 });
  111 +
  112 + //双击
  113 + gb_schedule_table_dbclick.sfsjCellClick($('dd.fcsjActualCell'));
111 114 }
112 115  
113 116 //重置序号
... ... @@ -192,20 +195,20 @@ var gb_schedule_table = (function () {
192 195 if (!isArray(schArr))
193 196 schArr = [schArr];
194 197  
195   - var tMaps={};
  198 + var tMaps = {};
196 199 $.each(schArr, function () {
197 200 line2Schedule[this.xlBm][this.id] = this;
198 201 updateDom(this);
199 202 //线路_车辆 过滤重复数据
200   - tMaps[this.xlBm+'_'+this.clZbh]=1;
  203 + tMaps[this.xlBm + '_' + this.clZbh] = 1;
201 204 });
202 205  
203   - /* //重新标记末班
204   - var ts=[];
205   - for(var k in tMaps){
206   - ts = k.split('_');
207   - markerLastByNbbm(ts[0], ts[1]);
208   - }*/
  206 + /* //重新标记末班
  207 + var ts=[];
  208 + for(var k in tMaps){
  209 + ts = k.split('_');
  210 + markerLastByNbbm(ts[0], ts[1]);
  211 + }*/
209 212 };
210 213  
211 214 //update dom
... ... @@ -218,10 +221,10 @@ var gb_schedule_table = (function () {
218 221 //车辆自编号
219 222 $(dds[2]).replaceWith(temps['line-schedule-nbbm-temp'](sch));
220 223 //if (sch.qdzArrDateJH)
221   - $(dds[3]).text(sch.qdzArrDateJH?sch.qdzArrDateJH:'');
  224 + $(dds[3]).text(sch.qdzArrDateJH ? sch.qdzArrDateJH : '');
222 225  
223 226 //if (sch.qdzArrDateSJ)
224   - $(dds[4]).text(sch.qdzArrDateSJ?sch.qdzArrDateSJ:'');
  227 + $(dds[4]).text(sch.qdzArrDateSJ ? sch.qdzArrDateSJ : '');
225 228  
226 229 //计发时间
227 230 $(dds[5]).replaceWith(temps['line-schedule-fcsj-temp'](sch));
... ... @@ -229,15 +232,19 @@ var gb_schedule_table = (function () {
229 232  
230 233 //实发时间
231 234 calc_sch_real_shift(sch);
232   - var sfsjDd = temps['line-schedule-sfsj-temp'](sch);
  235 + var sfsjDd = $(temps['line-schedule-sfsj-temp'](sch));
  236 + //双击
  237 + gb_schedule_table_dbclick.sfsjCellClick(sfsjDd);
233 238 $(dds[7]).replaceWith(sfsjDd);
234 239 if (sch.remarks)
235 240 $(dds[8]).html('<span title="' + sch.remarks + '" data-uk-tooltip="{pos:\'top-left\'}">' + sch.remarks + '</span>');
236 241 else
237 242 $(dds[8]).html('');
238 243  
  244 + //信号状态标记
  245 + gb_signal_state.marker_sch(sch);
239 246 //班次是车辆的最后一班
240   - if(dl.hasClass('dl-last-sch'))
  247 + if (dl.hasClass('dl-last-sch'))
241 248 markerLastSch([sch]);
242 249 };
243 250  
... ... @@ -418,13 +425,13 @@ var gb_schedule_table = (function () {
418 425  
419 426 //清除线路下指定班次的 末班标记
420 427 var removeMarkers = function (lineCode, array) {
421   - var idx=[];
  428 + var idx = [];
422 429 $.each(array, function () {
423 430 idx.push(this.id);
424 431 });
425 432  
426   - $('dl.dl-last-sch','li.line_schedule[data-id=' + lineCode + ']').each(function () {
427   - if($(this).hasClass('dl-last-sch') && idx.indexOf($(this).data('id'))){
  433 + $('dl.dl-last-sch', 'li.line_schedule[data-id=' + lineCode + ']').each(function () {
  434 + if ($(this).hasClass('dl-last-sch') && idx.indexOf($(this).data('id'))) {
428 435 $(this).removeClass('dl-last-sch').find('.last-sch-sunken').remove();
429 436 }
430 437 });
... ... @@ -446,6 +453,7 @@ var gb_schedule_table = (function () {
446 453 return car_yfwf_map[lineCode];
447 454 },
448 455 scroToDl: scroToDl,
449   - reset_drag_active_all: reset_drag_active_all
  456 + reset_drag_active_all: reset_drag_active_all,
  457 + getDl: getDl
450 458 };
451 459 })();
... ...
src/main/resources/static/real_control_v2/js/main.js
1   -//主调和监控模式
2   -var operationMode = window.localStorage.getItem('operationMode');
3   -if(operationMode == 0){
4   - $('body>.north').addClass('monitor');
5   - $(document).on('ajaxSend', interceptPOST);
6   -}
7   -else
8   - $('body>.north').addClass('main');
9   -
10   -//拦截POST请求
11   -function interceptPOST(e, xhr, t){
12   - if(t && (t.method == 'POST' || t.type == 'POST')){
13   - console.log(e, xhr, t);
14   - xhr.abort();
15   - notify_err('监控模式!');
16   - }
17   -}
18 1  
19 2 /* main js */
20 3 var gb_main_ep = new EventProxy(),
21   - res_load_ep = EventProxy.create('load_data_basic', 'load_tab', 'load_home_layout', 'load_home_line_panel', function() {
  4 + res_load_ep = EventProxy.create('load_data_basic', 'load_tab', 'load_home_layout', 'load_home_line_panel', function () {
22 5 var eq = gb_main_ep;
23 6 // basic data end
24 7 eq.once('data-basic', g_emit('tab'));
25 8 // tabs
26   - eq.once('tab', function() {
  9 + eq.once('tab', function () {
27 10 gb_tabs.init(
28 11 g_emit('home-layout')
29 12 );
30 13 });
31 14 //home layout
32   - eq.once('home-layout', function() {
  15 + eq.once('home-layout', function () {
33 16 gb_home_layout.layout(
34 17 g_emit('home-line-panel')
35 18 );
36 19 });
37 20 //home line panel
38   - eq.once('home-line-panel', function() {
  21 + eq.once('home-line-panel', function () {
39 22 gb_home_line_panel.init(g_emit('gps-time-refresh'));
40 23 });
41 24  
42 25 //start fixed time refresh gps
43   - eq.once('gps-time-refresh', function() {
  26 + eq.once('gps-time-refresh', function () {
44 27 gb_data_gps.fixedTimeRefresh();
45 28 g_emit('line-schedule-layout')();
46 29 });
47 30  
48 31 //line schedule layout
49   - eq.once('line-schedule-layout', function() {
  32 + eq.once('line-schedule-layout', function () {
50 33 gb_line_layout.layout(g_emit('render-sch-table'));
51 34 });
52 35  
53 36 //render schedule table
54   - eq.once('render-sch-table', function() {
55   - gb_schedule_table.show(function(){
56   - //搜索框
57   - gb_sch_search.init();
  37 + eq.once('render-sch-table', function () {
  38 + gb_schedule_table.show(function () {
  39 + //搜索框
  40 + gb_sch_search.init();
  41 + //加载信号状态
  42 + gb_signal_state.init();
58 43 });
59 44  
60   - //嵌入地图页面
61   - $('li.map-panel','#main-tab-content').load('/real_control_v2/mapmonitor/real.html');
  45 + //初始化gps异常判定
  46 + //gb_gps_abnormal.initData();
62 47  
63   - showUpdateDescription();
  48 + //嵌入地图页面
  49 + $('li.map-panel', '#main-tab-content').load('/real_control_v2/mapmonitor/real.html');
  50 + //弹出更新说明
  51 + //showUpdateDescription();
64 52 });
65 53  
66 54 function g_emit(id) {
67 55 console.log('g_emit [' + id + ']');
68   - return function() {
  56 + return function () {
69 57 console.log('eq.emitLater(' + id + ')');
70 58 return eq.emitLater(id);
71 59 };
... ... @@ -73,17 +61,17 @@ var gb_main_ep = new EventProxy(),
73 61 });
74 62  
75 63 //modal hide remove dom
76   -$(document).on('hide.uk.modal', '.uk-modal', function() {
  64 +$(document).on('hide.uk.modal', '.uk-modal', function () {
77 65 $(this).remove();
78 66 });
79 67  
80 68 $(document).on('click', '.ct-bottom-drawer-close', function () {
81   - $(this).parents('.ct-bottom-drawer').removeClass('open');
  69 + $(this).parents('.ct-bottom-drawer').removeClass('open');
82 70 });
83 71  
84 72 function connectArr(arr, separator, transFun) {
85 73 var rs = '';
86   - $.each(arr, function(i, item) {
  74 + $.each(arr, function (i, item) {
87 75 if (transFun)
88 76 item = transFun(item);
89 77 rs += (separator + item);
... ... @@ -102,26 +90,26 @@ var gb_form_validation_opts = {
102 90 };
103 91  
104 92  
105   -var notify_wait = function(t) {
  93 +var notify_wait = function (t) {
106 94 UIkit.notify("<i class='uk-icon-spinner uk-icon-spin'></i> " + t, {
107 95 status: 'info'
108 96 });
109 97 };
110 98  
111   -var notify_succ = function(t) {
  99 +var notify_succ = function (t) {
112 100 UIkit.notify("<i class='uk-icon-check'></i> " + t, {
113 101 status: 'success'
114 102 });
115 103 };
116 104  
117   -var notify_err = function(t) {
  105 +var notify_err = function (t) {
118 106 UIkit.notify("<i class='uk-icon-times'></i> " + t, {
119 107 status: 'danger'
120 108 });
121 109 };
122 110  
123   -var alt_confirm = function(content, succ, okBtn) {
124   - var modalEl = UIkit.modal.confirm(content, function() {
  111 +var alt_confirm = function (content, succ, okBtn) {
  112 + var modalEl = UIkit.modal.confirm(content, function () {
125 113 succ && succ();
126 114 modalEl.hide();
127 115 }, {
... ... @@ -129,15 +117,15 @@ var alt_confirm = function(content, succ, okBtn) {
129 117 Ok: okBtn,
130 118 Cancel: '取消'
131 119 }
132   - ,center: true
  120 + , center: true
133 121 });
134 122 };
135 123  
136   -var isArray = function(obj) {
  124 +var isArray = function (obj) {
137 125 return Object.prototype.toString.call(obj) === '[object Array]';
138 126 };
139 127  
140   -var notify_err_form = function(t, form) {
  128 +var notify_err_form = function (t, form) {
141 129 $('.uk-alert-danger', form).remove();
142 130 $('.uk-modal-footer', form).before('<div class="uk-alert uk-alert-danger" data-uk-alert="">' +
143 131 '<a href="" class="uk-alert-close uk-close"></a>' +
... ... @@ -147,29 +135,29 @@ var notify_err_form = function(t, form) {
147 135 enable_submit_btn(form);
148 136 };
149 137  
150   -var enable_submit_btn = function(form) {
  138 +var enable_submit_btn = function (form) {
151 139 var subBtn = $('button[type=submit]', form);
152 140 if (subBtn) {
153 141 subBtn.removeClass('disabled').removeAttr('disabled');
154 142 }
155 143 }
156 144  
157   -var disabled_submit_btn = function(form) {
  145 +var disabled_submit_btn = function (form) {
158 146 var subBtn = $('button[type=submit]', form);
159 147 if (subBtn) {
160   - subBtn.addClass('disabled').attr('disabled','disabled');
  148 + subBtn.addClass('disabled').attr('disabled', 'disabled');
161 149 }
162 150 };
163 151  
164   -var show_modal = function(id, dom) {
  152 +var show_modal = function (id, dom) {
165 153 $(document.body).append(dom);
166 154 return UIkit.modal(id, {
167 155 bgclose: false
168 156 }).show();
169 157 };
170 158  
171   -var open_modal = function(pageUrl, data, opt) {
172   - $.get(pageUrl, function(dom) {
  159 +var open_modal = function (pageUrl, data, opt) {
  160 + $.get(pageUrl, function (dom) {
173 161 if (!$(dom).hasClass('uk-modal')) {
174 162 alert('无效的dom片段!');
175 163 return;
... ... @@ -188,20 +176,20 @@ var open_modal = function(pageUrl, data, opt) {
188 176  
189 177 function showUpdateDescription() {
190 178 //更新说明
191   - var updateDescription={
  179 + var updateDescription = {
192 180 date: '2016-12-20',
193 181 text: '<h5>1、回场子任务开放使用。</h5>'
194 182 };
195 183  
196 184 var storage = window.localStorage
197   - ,key = 'update_' + updateDescription.date;
  185 + , key = 'update_' + updateDescription.date;
198 186 var text = storage.getItem(key);
199   - if(!text){
200   - var modal = '<div class="uk-modal" id="update-description-modal">'+
201   - ' <div class="uk-modal-dialog">'+
202   - ' <a class="uk-modal-close uk-close"></a>'+
203   - ' <div class="uk-modal-header">'+
204   - ' <h2>'+updateDescription.date+' 更新说明</h2></div>'+updateDescription.text+
  187 + if (!text) {
  188 + var modal = '<div class="uk-modal" id="update-description-modal">' +
  189 + ' <div class="uk-modal-dialog">' +
  190 + ' <a class="uk-modal-close uk-close"></a>' +
  191 + ' <div class="uk-modal-header">' +
  192 + ' <h2>' + updateDescription.date + ' 更新说明</h2></div>' + updateDescription.text +
205 193 ' </div>';
206 194  
207 195 show_modal('#update-description-modal', modal);
... ...
src/main/resources/static/real_control_v2/js/north/toolbar.js
1 1 /* main.html north toolbar js */
2 2  
3   -var gb_northToolbar = (function() {
  3 +var gb_northToolbar = (function () {
4 4  
5   - var modal_opts={center: true,bgclose: false};
6   - var currentUser;
  5 + var modal_opts = {center: true, bgclose: false};
  6 + var currentUser;
7 7  
8   - $.get('/real_control_v2/fragments/north/toolbar.html', function(temp){
9   - ep.emit("template", temp);
10   - });
  8 + $.get('/real_control_v2/fragments/north/toolbar.html', function (temp) {
  9 + ep.emit("template", temp);
  10 + });
  11 +
  12 + $.get('/real_control_v2/js/data/json/north_toolbar.json', function (data) {
  13 + ep.emit("data", data);
  14 + });
11 15  
12   - $.get('/real_control_v2/js/data/json/north_toolbar.json', function(data){
13   - ep.emit("data", data);
14   - });
  16 + //当前用户信息
  17 + $.get('/user/currentUser', function (user) {
  18 + ep.emit("user", user);
  19 + });
15 20  
16   - //当前用户信息
17   - $.get('/user/currentUser', function(user){
18   - ep.emit("user", user);
19   - });
  21 + var ep = EventProxy.create("template", "data", "user", function (temp, data, user) {
  22 + currentUser = user;
  23 + var t = $('#north-toolbar-temp', temp).html()
  24 + , htmlStr = template.render(t)({list: data, user: currentUser});
  25 + $('.north .north-toolbar').html(htmlStr);
20 26  
21   - var ep = EventProxy.create("template", "data", "user" , function (temp, data, user) {
22   - currentUser=user;
23   - var t = $('#north-toolbar-temp', temp).html()
24   - ,htmlStr = template.render(t)({list: data, user: currentUser});
25   - $('.north .north-toolbar').html(htmlStr);
  27 + //exit
  28 + $('.north .north-toolbar .exit-system').on('click', function () {
  29 + //关闭websocket 连接
  30 + gb_sch_websocket.sock.close();
  31 + window.location.href = '/pages/control/lineallot/allot.html';
  32 + });
  33 + });
26 34  
27   - //exit
28   - $('.north .north-toolbar .exit-system').on('click', function(){
29   - //关闭websocket 连接
30   - gb_sch_websocket.sock.close();
31   - window.location.href='/pages/control/lineallot/allot.html';
  35 + $(document).on('click', '#north_toolbar_panel li.event a', function () {
  36 + var event = $(this).data('event');
  37 + handler[event] && handler[event]();
32 38 });
33   - });
34 39  
35   - $(document).on('click', '#north_toolbar_panel li.event a', function(){
36   - var event = $(this).data('event');
37   - handler[event] && handler[event]();
38   - });
  40 + var handler = {
  41 + // device report list
  42 + device_report: function () {
  43 + open_modal('/real_control_v2/fragments/north/nav/report_80.html', {}, modal_opts);
  44 + },
  45 + directive_history: function () {
  46 + open_modal('/real_control_v2/fragments/north/nav/directive_history.html', {}, modal_opts);
  47 + },
  48 + tts_config: function () {
  49 + open_modal('/real_control_v2/fragments/north/nav/tts_config.html', {}, modal_opts);
  50 + },
  51 + all_devices: function () {
  52 + open_modal('/real_control_v2/fragments/north/nav/all_devices.html', {}, modal_opts);
  53 + },
  54 + device_online_rate: function () {
  55 + open_modal('/real_control_v2/fragments/north/nav/charts/device_online_rate.html', {}, modal_opts);
  56 + },
  57 + turnout_rate: function () {
  58 + open_modal('/real_control_v2/fragments/north/nav/charts/car_out_rate.html', {}, modal_opts);
  59 + },
  60 + s_e_punctuality_rate: function () {
  61 + open_modal('/real_control_v2/fragments/north/nav/charts/strat_end_punctuality_rate.html', {}, modal_opts);
  62 + },
  63 + s_e_punctuality_rate_line: function () {
  64 + open_modal('/real_control_v2/fragments/north/nav/charts/s_e_punctuality_rate_line.html', {}, modal_opts);
  65 + },
  66 + history_sch_maintain: function () {
  67 + open_modal('/real_control_v2/fragments/north/nav/history_sch_maintain.html', {}, {
  68 + center: false,
  69 + bgclose: false
  70 + });
  71 + },
  72 + sch_exec_rate: function () {
  73 + open_modal('/real_control_v2/fragments/north/nav/charts/sch_exec_rate.html', {}, modal_opts);
  74 + },
  75 + gps_play_back: function () {
  76 + gb_map_play_back.initParams();
  77 + },
  78 + signal_state: function () {
  79 + open_modal('/real_control_v2/fragments/north/nav/signal_state_config.html', {}, modal_opts);
  80 + }
  81 + }
39 82  
40   - var handler = {
41   - // device report list
42   - device_report: function(){
43   - open_modal('/real_control_v2/fragments/north/nav/report_80.html', {}, modal_opts);
44   - },
45   - directive_history: function(){
46   - open_modal('/real_control_v2/fragments/north/nav/directive_history.html', {}, modal_opts);
47   - },
48   - tts_config: function(){
49   - open_modal('/real_control_v2/fragments/north/nav/tts_config.html', {}, modal_opts);
50   - },
51   - all_devices: function(){
52   - open_modal('/real_control_v2/fragments/north/nav/all_devices.html', {}, modal_opts);
53   - },
54   - device_online_rate: function(){
55   - open_modal('/real_control_v2/fragments/north/nav/charts/device_online_rate.html', {}, modal_opts);
56   - },
57   - turnout_rate: function () {
58   - open_modal('/real_control_v2/fragments/north/nav/charts/car_out_rate.html', {}, modal_opts);
59   - },
60   - s_e_punctuality_rate: function () {
61   - open_modal('/real_control_v2/fragments/north/nav/charts/strat_end_punctuality_rate.html', {}, modal_opts);
62   - },
63   - s_e_punctuality_rate_line: function () {
64   - open_modal('/real_control_v2/fragments/north/nav/charts/s_e_punctuality_rate_line.html', {}, modal_opts);
65   - },
66   - history_sch_maintain: function () {
67   - open_modal('/real_control_v2/fragments/north/nav/history_sch_maintain.html', {}, {center: false,bgclose: false});
68   - },
69   - sch_exec_rate: function () {
70   - open_modal('/real_control_v2/fragments/north/nav/charts/sch_exec_rate.html', {}, modal_opts);
71   - },
72   - gps_play_back: function () {
73   - gb_map_play_back.initParams();
  83 + return {
  84 + user: function () {
  85 + return currentUser;
  86 + }
74 87 }
75   - }
76 88 })();
... ...
src/main/resources/static/real_control_v2/js/signal_state/signal_state.js 0 → 100644
  1 +/**
  2 + * 班次 GPS信号状态
  3 + * @type {{}}
  4 + */
  5 +var gb_signal_state = (function () {
  6 + var storage = window.localStorage;
  7 +
  8 + $(document).on('click', 'i.signal_state_icon', function (e) {
  9 + e.stopPropagation();
  10 + });
  11 +
  12 + var signal_state_data = {};
  13 + var enable = true;
  14 + //读取本地状态
  15 + var locStatus = storage.getItem("signal_state_enable");
  16 + if (locStatus && locStatus=='0')
  17 + enable = false;
  18 +
  19 + var init = function () {
  20 + $.get('/signalState/multi', {idx: gb_data_basic.line_idx}, function (rs) {
  21 + //按班次ID分组
  22 + signal_state_data = gb_common.groupBy(rs, 'schId');
  23 +
  24 + for (var schId in signal_state_data) {
  25 + multi_render(signal_state_data[schId]);
  26 + }
  27 + });
  28 + };
  29 +
  30 + var multi_render = function (list) {
  31 + if (!enable)
  32 + return;
  33 +
  34 + if (!list || list.length == 0)
  35 + return;
  36 + var line = list[0].lineCode
  37 + , schId = list[0].schId;
  38 +
  39 + var sch = gb_schedule_table.findScheduleByLine(line)[schId];
  40 + var dl = gb_schedule_table.getDl(sch);
  41 + var icon = 'question-circle';
  42 + var t = '';
  43 + $.each(list, function () {
  44 + t += (this.text + '<br>');
  45 + });
  46 +
  47 + if (list.length == 1 && list[0].type == 'route_reverse')
  48 + icon = 'reply';
  49 +
  50 + var dd = $('dd.fcsjActualCell', dl);
  51 + var se = $('i.signal_state_icon', dd);
  52 + if (se && se.length > 0)
  53 + se.remove();
  54 +
  55 + dd.append('<i data-uk-tooltip title="' + t + '" class="uk-icon-' + icon + ' signal_state_icon"></i>');
  56 + };
  57 +
  58 + var put = function (obj) {
  59 + if (!signal_state_data[obj.schId]) {
  60 + signal_state_data[obj.schId] = [];
  61 + }
  62 +
  63 + signal_state_data[obj.schId].push(obj);
  64 + multi_render(signal_state_data[obj.schId]);
  65 + };
  66 +
  67 + var marker_sch = function (sch) {
  68 + var list = signal_state_data[sch.id];
  69 + if (list) {
  70 + multi_render(list);
  71 + }
  72 + };
  73 +
  74 + var clearAll = function () {
  75 + $('.signal_state_icon').remove();
  76 + };
  77 +
  78 + return {
  79 + init: init,
  80 + put: put,
  81 + marker_sch: marker_sch,
  82 + isEnable: function () {
  83 + return enable;
  84 + },
  85 + disable: function () {
  86 + enable = false;
  87 + storage.setItem("signal_state_enable", 0);
  88 +
  89 + clearAll();
  90 + },
  91 + enable: function () {
  92 + enable = true;
  93 + storage.setItem("signal_state_enable", 1);
  94 + for (var schId in signal_state_data) {
  95 + multi_render(signal_state_data[schId]);
  96 + }
  97 + }
  98 + };
  99 +})();
0 100 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/js/utils/dispatch_pattern.js 0 → 100644
  1 +/** 调度模式 */
  2 +
  3 +//主调和监控模式
  4 +var operationMode = window.localStorage.getItem('operationMode');
  5 +if (operationMode == 0) {
  6 + $('body>.north').addClass('monitor');
  7 + $(document).on('ajaxSend', interceptPOST);
  8 +}
  9 +else
  10 + $('body>.north').addClass('main');
  11 +
  12 +//拦截POST请求
  13 +function interceptPOST(e, xhr, t) {
  14 + if (t && (t.method == 'POST' || t.type == 'POST')) {
  15 + console.log(e, xhr, t);
  16 + xhr.abort();
  17 + notify_err('监控模式!');
  18 + }
  19 +}
  20 +
  21 +
  22 +//10分钟后提交当班调度数据
  23 +setTimeout(function () {
  24 + var user = gb_northToolbar.user();
  25 + var data = {
  26 + uId: user.id,
  27 + uName: user.userName,
  28 + codeIdx: gb_data_basic.line_idx + ',',
  29 + main: operationMode
  30 + };
  31 +
  32 + gb_common.$post('/dutyEmployee', data);
  33 +}, 1000 * 60 * 10);
0 34 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/js/utils/svg_chart.js
1 1 /* 线路模拟图 */
2 2  
3   -var gb_svg_chart = (function() {
  3 +var gb_svg_chart = (function () {
4 4  
5 5 //chart height
6 6 var chart_height = 123;
... ... @@ -11,22 +11,22 @@ var gb_svg_chart = (function() {
11 11 //svg namespace
12 12 var svgns = 'http://www.w3.org/2000/svg';
13 13  
14   - var calc_text_y = function(t) {
  14 + var calc_text_y = function (t) {
15 15 return (chart_height - (chart_height / t_max_size * t.length)) / 2 + 5;
16 16 },
17   - cat_text = function(t) {
  17 + cat_text = function (t) {
18 18 return t.length > t_max_size ? t.substr(0, t_max_size) : t;
19 19 },
20   - get_width = function(wrap) {
  20 + get_width = function (wrap) {
21 21 return wrap.actual('outerWidth');
22 22 },
23   - get_height = function(wrap) {
  23 + get_height = function (wrap) {
24 24 var h = wrap.actual('outerHeight');
25 25 //隐藏元素取最外层的高度
26 26 return h < 20 ? wrap.parent().actual('outerHeight') - 2 : h;
27 27 }
28 28  
29   - var draw_line = function(lineCode, wrap) {
  29 + var draw_line = function (lineCode, wrap) {
30 30  
31 31 var data = gb_svg_data_convert.mergeRoute(gb_data_basic.stationRoutes(lineCode)),
32 32 len = data.length;
... ... @@ -36,22 +36,22 @@ var gb_svg_chart = (function() {
36 36 //x scale
37 37 ,
38 38 xScale = d3.scale.linear().range([x_padd, w - x_padd]).domain([0, len - 1]),
39   - cx = function(d, i) {
  39 + cx = function (d, i) {
40 40 return xScale(i);
41 41 },
42   - cy = function() {
  42 + cy = function () {
43 43 return (h - chart_height) / 2;
44 44 },
45   - ty = function(d) {
  45 + ty = function (d) {
46 46 return cy() + calc_text_y(cat_text(d.name[0]));
47 47 }
48 48 //line generator
49 49 ,
50 50 upLine = d3.svg.line().x(xScale).y(cy),
51   - downLine = d3.svg.line().x(xScale).y(function() {
  51 + downLine = d3.svg.line().x(xScale).y(function () {
52 52 return cy() + chart_height
53 53 }),
54   - multi_text = function(d, i, that) {
  54 + multi_text = function (d, i, that) {
55 55  
56 56 var dText = document.createElementNS(svgns, 'text'),
57 57 t = cat_text(d.name[1]);
... ... @@ -82,14 +82,14 @@ var gb_svg_chart = (function() {
82 82 'station_link': true
83 83 };
84 84 items.append('path').classed(p_clzz)
85   - .attr('d', function(d, i) {
  85 + .attr('d', function (d, i) {
86 86 return i < len - 1 ? upLine([i, i + 1]) : '';
87 87 });
88 88  
89 89 //down station link path
90 90 p_clzz.down = true;
91 91 items.append('path').classed(p_clzz)
92   - .attr('d', function(d, i) {
  92 + .attr('d', function (d, i) {
93 93 return i < len - 1 ? downLine([i, i + 1]) : '';
94 94 });
95 95  
... ... @@ -97,40 +97,44 @@ var gb_svg_chart = (function() {
97 97 var c_clzz = {
98 98 'station_circle': true
99 99 };
100   - items.select(function (d) {return d.type!=1?this:null;})
  100 + items.select(function (d) {
  101 + return d.type != 1 ? this : null;
  102 + })
101 103 .append('circle').classed(c_clzz)
102 104 .attr('cx', cx)
103 105 .attr('cy', cy)
104   - .attr('data-id', function(d) {
  106 + .attr('data-id', function (d) {
105 107 return d.id[0];
106 108 });
107 109  
108 110 //down circle
109 111 c_clzz.down = true;
110   - items.select(function (d) {return d.type!=0?this:null;})
  112 + items.select(function (d) {
  113 + return d.type != 0 ? this : null;
  114 + })
111 115 .append('circle').classed(c_clzz)
112 116 .attr('cx', cx)
113   - .attr('cy', function(d, i) {
  117 + .attr('cy', function (d, i) {
114 118 return cy(d, i) + chart_height;
115 119 })
116   - .attr('data-id', function(d) {
117   - return d.type==1?d.id[0]:d.id[1];
  120 + .attr('data-id', function (d) {
  121 + return d.type == 1 ? d.id[0] : d.id[1];
118 122 });
119 123  
120 124 //station name text
121 125 items.append('text').classed({
122   - 'station_text': true,
123   - 'up': function(d) {
124   - return d.type == 3 ? true : false;
125   - }
126   - })
127   - .text(function(d) {
  126 + 'station_text': true,
  127 + 'up': function (d) {
  128 + return d.type == 3 ? true : false;
  129 + }
  130 + })
  131 + .text(function (d) {
128 132 return cat_text(d.name[0]);
129 133 })
130   - .attr('title', function(d) {
  134 + .attr('title', function (d) {
131 135 return d.name[0];
132 136 })
133   - .attr('x', function(d, i) {
  137 + .attr('x', function (d, i) {
134 138 return d.type == 3 ? multi_text(d, i, this) : cx(d, i)
135 139 })
136 140 .attr('y', ty);
... ... @@ -149,90 +153,95 @@ var gb_svg_chart = (function() {
149 153 // ----- draw gps ------
150 154 //gps 按线路站点分组后的下标映射
151 155 var line_gps_index = {};
152   - var get_circle = function(dataId, svg) {
  156 + var get_circle = function (dataId, svg) {
153 157 try {
154 158 var circle = $('.station_circle[data-id=' + dataId + ']', svg);
155 159 if (circle.length == 0)
156 160 circle = null;
157   - }catch (e){
  161 + } catch (e) {
158 162 console.log('get_circle error! station_circle data-id:' + dataId);
159 163 return null;
160 164 }
161 165 return circle;
162 166 },
163   - gx = function(gps, svg) {
164   - var circle = get_circle(gps.stopNo, svg);
  167 + gx = function (gps, svg) {
  168 + var circle = get_circle(gps.stopNo + '_' + gps.upDown, svg);
165 169 if (!circle) return -100;
166 170  
167 171 return circle.attr('cx') - 14;
168 172 },
169   - gy = function(gps, svg) {
170   - var circle = get_circle(gps.stopNo, svg);
  173 + gy = function (gps, svg) {
  174 + var circle = get_circle(gps.stopNo + '_' + gps.upDown, svg);
171 175 if (!circle) return -100;
172 176  
173 177 var cy = parseInt(circle.attr('cy')),
174   - index = line_gps_index[gps.lineId][gps.stopNo][gps.deviceId];
  178 + index = line_gps_index[gps.lineId][gps.stopNo + '_' + gps.upDown][gps.deviceId];
175 179  
176   - return gps.upDown == 0 ? cy - 31 - (index * 28) : cy + 7 + (index * 28);
  180 + return gps.upDown == 0 ? cy - 25 - (index * 21) : cy + 7 + (index * 21);
177 181 },
178   - ups_gps = function(d) {
  182 + ups_gps = function (d) {
179 183 return d.gpsUps;
180 184 },
181   - downs_gps = function(d) {
  185 + downs_gps = function (d) {
182 186 return d.gpsDowns;
183 187 },
184   - gps_index_mapp = function(data) {
  188 + gps_index_mapp = function (data) {
185 189 var rs = {};
186   - var dataGroupStop = gb_common.groupBy(data, 'stopNo');
  190 + var dataGroupStop = gb_svg_data_convert.groupByStationAndUpdown(data);
187 191 for (var stopNo in dataGroupStop) {
188 192 rs[stopNo] = {};
189   - $.each(dataGroupStop[stopNo], function(i, gps) {
  193 + $.each(dataGroupStop[stopNo], function (i, gps) {
190 194 rs[stopNo][gps.deviceId] = i;
191 195 });
192 196 }
193 197 return rs;
194 198 },
195   - g_text = function(d) {
196   - var len = (d.nbbm == false ? 0 : d.nbbm.length);
197   - return len > 3 ? d.nbbm.substr(len - 3) : d.nbbm;
  199 + g_text = function (d) {
  200 + var len = (d.nbbm == false ? 0 : d.nbbm.length)
  201 + , t = len > 3 ? d.nbbm.substr(len - 3) : d.nbbm;
  202 +
  203 + if (d.nbbm.indexOf('-') > 0) {
  204 + t = d.nbbm.substr(d.nbbm.indexOf('-') - 1, 1) + t;
  205 + }
  206 + return t;
198 207 },
199   - gps_key = function(d) {
  208 + gps_key = function (d) {
200 209 return d.deviceId;
201 210 },
202   - gps_update_point = function(e, svg) {
203   - e.transition().attr('x', function(d) {
204   - return gx(d, svg);
205   - })
206   - .attr('y', function(d) {
  211 + gps_update_point = function (e, svg) {
  212 + e.transition().attr('x', function (d) {
  213 + return gx(d, svg);
  214 + })
  215 + .attr('y', function (d) {
207 216 return gy(d, svg);
208 217 })
209   - .attr('updown', function(d) {
  218 + .attr('updown', function (d) {
210 219 return d.upDown;
211 220 });
212 221 //update tip position
213 222 gb_svg_tooltip.update(e);
214 223 },
215   - rct_id = function(d) {
  224 + rct_id = function (d) {
216 225 return 'rct_' + d.deviceId;
217 226 },
218   - tx_id = function(d) {
  227 + tx_id = function (d) {
219 228 return 'tx_' + d.deviceId;
220 229 }
221 230  
222   - var setGps = function(lineCode) {
  231 + var setGps = function (lineCode) {
223 232 var svgs = $('.line-chart[data-code=' + lineCode + ']'),
224 233 data = gb_data_gps.gpsByLineCode(lineCode);
225 234  
226   - var list=[];
  235 + var list = [];
227 236 //过滤无站点字段的数据
228   - $.each(data, function(){
229   - if(!this.stopNo || this.stopNo=='')
  237 + $.each(data, function () {
  238 + if (!this.stopNo || this.stopNo == '')
230 239 return true;
231 240 list.push(this);
232 241 });
233 242  
234 243 line_gps_index[lineCode] = gps_index_mapp(list);
235   - $.each(svgs, function() {
  244 + $.each(svgs, function () {
236 245 //绘制gps
237 246 draw_gps(this, list);
238 247 //聚合gps
... ... @@ -241,7 +250,7 @@ var gb_svg_chart = (function() {
241 250  
242 251 };
243 252  
244   - var draw_gps = function(svg, data) {
  253 + var draw_gps = function (svg, data) {
245 254 //remove merge_hide class
246 255 $('.merge_hide', svg).removeAttr('class');
247 256  
... ... @@ -256,22 +265,22 @@ var gb_svg_chart = (function() {
256 265 gps_update_point(ts, svg);
257 266 };
258 267  
259   - var marker_clusterer = function(svg, lineCode) {
260   - //debugger
  268 + var marker_clusterer = function (svg, lineCode) {
  269 + //debugger
261 270 var gpsArr, idxMapp = line_gps_index[lineCode];
262   - //svgs = $('.line-chart[data-code=' + lineCode + ']');
  271 + //svgs = $('.line-chart[data-code=' + lineCode + ']');
263 272 for (var stopNo in idxMapp) {
264 273 gpsArr = gb_common.get_keys(idxMapp[stopNo]);
265 274 //remove old merger point
266 275 $('g[_id=' + 'merger_' + stopNo + ']', svg).remove();
267 276 if (gpsArr.length <= 2)
268   - continue;
  277 + continue;
269 278  
270 279 marker_clusterer_merge(svg, stopNo, gpsArr);
271 280 }
272 281 }
273 282  
274   - var marker_clusterer_merge = function(svg, stopNo, gpsArr) {
  283 + var marker_clusterer_merge = function (svg, stopNo, gpsArr) {
275 284 //stop circle
276 285 var circle = get_circle(stopNo, svg);
277 286 if (!circle) return;
... ... @@ -282,7 +291,7 @@ var gb_svg_chart = (function() {
282 291  
283 292 var svg = d3.select(svg);
284 293 //hide old element
285   - $.each(gpsArr, function(i, d) {
  294 + $.each(gpsArr, function (i, d) {
286 295 $('rect[_id=rct_' + d + '],text[_id=tx_' + d + ']').attr('class', 'merge_hide');
287 296 });
288 297  
... ... @@ -292,7 +301,7 @@ var gb_svg_chart = (function() {
292 301 });
293 302 //merge rect
294 303 mergerG.append('rect').attr('x', x - 12)
295   - .attr('y', function() {
  304 + .attr('y', function () {
296 305 return isDown ? y + 7 : y - 32;
297 306 });
298 307 //merge text
... ...
src/main/resources/static/real_control_v2/js/utils/svg_chart_map.js
... ... @@ -37,14 +37,15 @@ var gb_svg_map_util = (function () {
37 37  
38 38 var drawStationMarker = function (routeItem) {
39 39 var station = routeItem.station,
  40 + name = routeItem.stationName,
40 41 coord = TransGPS.wgsToBD(station.gLaty, station.gLonx);
41 42  
42 43 var marker = new BMap.Marker(new BMap.Point(coord.lng, coord.lat));
43 44  
44 45 //label
45   - var offsetX = Math.abs(station.stationName.length / 2 * 12),
  46 + var offsetX = Math.abs(name.length / 2 * 12),
46 47 offsetY = -20,
47   - label = new BMap.Label(station.stationName, {
  48 + label = new BMap.Label(name, {
48 49 offset: new BMap.Size(-offsetX, offsetY)
49 50 });
50 51  
... ...
src/main/resources/static/real_control_v2/js/utils/svg_chart_tooltip.js
... ... @@ -13,6 +13,7 @@ var gb_svg_tooltip = (function () {
13 13 if (rect.attr('aria-describedby'))
14 14 return;
15 15 var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]);
  16 + console.log('gps', gps);
16 17 $(this).qtip({
17 18 show: {
18 19 ready: true,
... ... @@ -151,7 +152,7 @@ var gb_svg_tooltip = (function () {
151 152 function searchByStop(list, stop) {
152 153 var rs = [];
153 154 $.each(list, function () {
154   - if (this.stopNo == stop)
  155 + if ((this.stopNo + '_' + this.upDown) == stop)
155 156 rs.push(this);
156 157 });
157 158 return rs;
... ...
src/main/resources/static/real_control_v2/js/utils/svg_data_convert.js
... ... @@ -29,7 +29,7 @@ var gb_svg_data_convert = (function() {
29 29 var dIndex = station_indexof(down, upS, j);
30 30 if (dIndex == -1) {
31 31 op.type = 0;
32   - op.id = [upS.stationCode, -1];
  32 + op.id = [get_station_code(upS), -1];
33 33 //占位
34 34 down.splice(j, 0, {});
35 35 } else {
... ... @@ -38,7 +38,7 @@ var gb_svg_data_convert = (function() {
38 38 data.push({
39 39 name: [temp.stationName],
40 40 type: 1,
41   - id: [temp.stationCode]
  41 + id: [get_station_code(temp)]
42 42 });
43 43 }
44 44 //delete
... ... @@ -103,14 +103,30 @@ var gb_svg_data_convert = (function() {
103 103 };
104 104  
105 105 var get_station_code=function (station) {
106   - if(station.stationMark=='B' || station.stationMark=='E')
  106 + /*if(station.stationMark=='B' || station.stationMark=='E')
107 107 return station.stationCode+'_'+station.directions;
108 108 else
109   - return station.stationCode;
  109 + return station.stationCode;*/
  110 + return station.stationCode+'_'+station.directions;
110 111 };
111 112  
112 113 var nvl_get = function(list, index) {
113 114 return list[index] == null ? {} : list[index];
114 115 };
115   - return {mergeRoute: mergeRoute};
  116 +
  117 + var groupByStationAndUpdown = function (data) {
  118 + //gb_common.groupBy(data, 'stopNo')
  119 + var rs = {},
  120 + key;
  121 + $.each(data, function () {
  122 + key = this['stopNo'] + '_' + this['upDown'];
  123 + if (!rs[key])
  124 + rs[key] = [];
  125 +
  126 + rs[key].push(this);
  127 + });
  128 +
  129 + return rs;
  130 + };
  131 + return {mergeRoute: mergeRoute, groupByStationAndUpdown: groupByStationAndUpdown};
116 132 })();
... ...
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
... ... @@ -26,7 +26,7 @@ var gb_sch_websocket = (function () {
26 26 var data = {
27 27 operCode: 'register_line',
28 28 idx: gb_data_basic.line_idx
29   - }
  29 + };
30 30 schSock.send(JSON.stringify(data));
31 31 console.log('regListen....', data);
32 32 }
... ... @@ -45,21 +45,21 @@ var gb_sch_websocket = (function () {
45 45 var calcUntreated = function (lineCode) {
46 46 var size = $('li.line_schedule[data-id=' + lineCode + '] .sys-mailbox .sys-mail-item').length;
47 47 $('#badge_untreated_num_' + lineCode).text(size);
48   - }
  48 + };
49 49  
50 50 var calcUntreatedAll = function () {
51 51 $('#main-tab-content li.line_schedule').each(function () {
52 52 calcUntreated($(this).data('id'));
53 53 });
54   - }
  54 + };
55 55  
56 56  
57 57 //80协议上报
58 58 var report80 = function (msg) {
59 59 msg.dateStr = moment(msg.timestamp).format('HH:mm');
60 60 msg.text = gb_common.reqCode80[msg.data.requestCode];
61   - if(!msg.text)
62   - msg.text='(未知的请求码 '+msg.data.requestCode+')';
  61 + if (!msg.text)
  62 + msg.text = '(未知的请求码 ' + msg.data.requestCode + ')';
63 63  
64 64 var $item = $(temps['sys-note-80-temp'](msg));
65 65 findMailBox(msg.data.lineId).prepend($item);
... ... @@ -68,7 +68,7 @@ var gb_sch_websocket = (function () {
68 68 gb_tts.speak(ttsMsg, msg.data.lineId);
69 69  
70 70 calcUntreated(msg.data.lineId);
71   - }
  71 + };
72 72  
73 73 var waitRemoves = [];
74 74 //车辆发出
... ... @@ -89,11 +89,12 @@ var gb_sch_websocket = (function () {
89 89 gb_schedule_table.calc_yfwf_num(msg.t.xlBm);
90 90  
91 91 calcUntreated(msg.t.xlBm);
92   - }
  92 + };
93 93  
94 94 //到达终点
95 95 var zhongDian = function (msg) {
96 96 gb_schedule_table.updateSchedule(msg.t);
  97 + gb_schedule_table.updateSchedule(msg.nt);
97 98 msg.domId = 'zhongDian_' + msg.t.id + '_' + parseInt(Math.random() * 10000);
98 99  
99 100 var $item = $(temps['sys-note-42_1-temp'](msg));
... ... @@ -107,20 +108,20 @@ var gb_sch_websocket = (function () {
107 108 gb_tts.speak(ttsMsg, msg.t.xlBm);
108 109  
109 110 calcUntreated(msg.t.xlBm);
110   - }
  111 + };
111 112  
112 113 //服务器通知刷新班次
113 114 var refreshSch = function (msg) {
114 115 gb_schedule_table.updateSchedule(msg.ts);
115 116 /*//重新计算应发未发
116   - var idx={};
117   - $.each(msg.ts, function(i, t){
118   - if(idx[t.xlBm])
119   - return true;
120   - gb_schedule_table.calc_yfwf_num(t.xlBm);
121   - idx[t.xlBm]=1;
122   - });*/
123   - }
  117 + var idx={};
  118 + $.each(msg.ts, function(i, t){
  119 + if(idx[t.xlBm])
  120 + return true;
  121 + gb_schedule_table.calc_yfwf_num(t.xlBm);
  122 + idx[t.xlBm]=1;
  123 + });*/
  124 + };
124 125  
125 126 //80消息确认
126 127 var d80Confirm = function (msg) {
... ... @@ -129,12 +130,17 @@ var gb_sch_websocket = (function () {
129 130 calcUntreated(msg.lineId);
130 131 //重新计算应发未发
131 132 gb_schedule_table.calc_yfwf_num(msg.lineId);
132   - }
  133 + };
133 134  
134 135 //指令状态改变
135   - var directiveStatus = function(msg){
  136 + var directiveStatus = function (msg) {
136 137 gb_schedule_table.updateSchedule(msg.t);
137   - }
  138 + };
  139 +
  140 + //班次信号状态
  141 + var signalState = function (msg) {
  142 + gb_signal_state.put(msg.data);
  143 + };
138 144  
139 145 var msgHandle = {
140 146 report80: report80,
... ... @@ -142,8 +148,9 @@ var gb_sch_websocket = (function () {
142 148 zhongDian: zhongDian,
143 149 refreshSch: refreshSch,
144 150 d80Confirm: d80Confirm,
145   - directive: directiveStatus
146   - }
  151 + directive: directiveStatus,
  152 + signal_state: signalState
  153 + };
147 154  
148 155 function currentSecond() {
149 156 return Date.parse(new Date()) / 1000;
... ... @@ -167,15 +174,15 @@ var gb_sch_websocket = (function () {
167 174 $(this).parents('.sys-note-42').remove();
168 175  
169 176 var size = $(this).parents('.sys-mailbox').find('.sys-mail-item').length
170   - ,lineCode = $(this).parents('li.line_schedule').data('id');
  177 + , lineCode = $(this).parents('li.line_schedule').data('id');
171 178  
172 179 $('#badge_untreated_num_' + lineCode).text(size);
173 180 });
174 181  
175 182 //42消息点击
176 183 $(document).on('click', '.sys-mailbox .sys-note-42', function () {
177   - var lineCode=$(this).parents('li.line_schedule').data('id')
178   - ,id=$(this).data('id');
  184 + var lineCode = $(this).parents('li.line_schedule').data('id')
  185 + , id = $(this).data('id');
179 186 var sch = gb_schedule_table.findScheduleByLine(lineCode)[id];
180 187 var dl = gb_schedule_table.scroToDl(sch);
181 188 //高亮
... ... @@ -205,7 +212,7 @@ var gb_sch_websocket = (function () {
205 212 notify_succ(rs.msg);
206 213 cb && cb();
207 214 });
208   - }
  215 + };
209 216  
210 217  
211 218 //定时到离站信使清理掉
... ...
src/main/resources/static/real_control_v2/main.html
... ... @@ -107,6 +107,7 @@
107 107 <!-- 数据 -->
108 108 <script src="/real_control_v2/js/data/data_basic.js"></script>
109 109 <script src="/real_control_v2/js/data/data_gps.js"></script>
  110 + <script src="/real_control_v2/js/data/gps_abnormal.js"></script>
110 111 <!-- 线路模拟图 -->
111 112 <script src="/real_control_v2/js/utils/svg_chart.js"></script>
112 113 <script src="/real_control_v2/js/utils/svg_data_convert.js"></script>
... ... @@ -142,6 +143,9 @@
142 143 <script src="/real_control_v2/assets/echarts-3/echarts.js"></script>
143 144 <!-- Geolib -->
144 145 <script src="/real_control_v2/geolib/geolib.js"></script>
  146 +
  147 + <script src="/real_control_v2/js/signal_state/signal_state.js"></script>
  148 + <script src="/real_control_v2/js/utils/dispatch_pattern.js"></script>
145 149 </body>
146 150  
147 151 </html>
... ...
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
... ... @@ -96,7 +96,7 @@ input[type=checkbox].disabled{
96 96 .real_bottom_panel{
97 97  
98 98 position: absolute !important;
99   - height: 256px;
  99 + height: 192px;
100 100 bottom: 2px !important;
101 101 background: #fff;
102 102 box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
... ...
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback/run.html
... ... @@ -148,10 +148,14 @@
148 148 var logs = [];
149 149 for (var i = 0; i <= ei; i++) {
150 150 trailArray.push(new BMap.Point(gpsArray[i].bd_lon, gpsArray[i].bd_lat));
151   - if(i > 0 && logs[logs.length - 1].road.ROAD_CODE == gpsArray[i].road.ROAD_CODE)
152   - logs.pop();
153   -
154   - logs.push(gpsArray[i]);
  151 + try {
  152 + if(i > 0 && logs[logs.length - 1].road.ROAD_CODE == gpsArray[i].road.ROAD_CODE)
  153 + logs.pop();
  154 + }
  155 + catch (e){}
  156 +
  157 + if(gpsArray[i].road)
  158 + logs.push(gpsArray[i]);
155 159 }
156 160 trailPolyline.setPath(trailArray);
157 161  
... ... @@ -302,6 +306,9 @@
302 306 gb_ct_table.fixedHead(logWrap);
303 307  
304 308 function logWrite(gps, prve) {
  309 + if(!gps.road || !gps.road.ROAD_CODE)
  310 + return;
  311 +
305 312 var code = gps.road.ROAD_CODE;
306 313 if (!prve || code != prve.road.ROAD_CODE) {
307 314 logPanel.append('<dl data-code="' + code + '" ><dd>' + gps.timeStr + '</dd><dd>' + gps.speed + '</dd><dd>' + gps.road.ROAD_NAME + '</dd><dd>正常</dd></dl>');
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/map/iMap.js
... ... @@ -44,7 +44,7 @@ var gb_map_imap = (function () {
44 44 return mapProxy;
45 45 },
46 46 calcGpsMarkerWidth: function (nbbm) {
47   - var width = 0;
  47 + /* var width = 0;
48 48 $.each(nbbm.split(''), function () {
49 49 if (!isNaN(this))
50 50 width += 7;//icon_num_width[this];
... ... @@ -52,8 +52,8 @@ var gb_map_imap = (function () {
52 52 width += 10;
53 53 else
54 54 width += 16;
55   - });
56   - return width;
  55 + });*/
  56 + return nbbm.length * 9.8;
57 57 }
58 58 };
59 59  
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
... ... @@ -394,7 +394,7 @@ var gb_map_baidu = (function(){
394 394 //线路名
395 395 gps.lineName = gb_data_basic.lineCode2NameAll()[gps.lineId];
396 396 //时间
397   - gps.dateStr = moment(gps.timestamp).format('YYYY-MM-DD HH:mm:ss');
  397 + //gps.dateStr = moment(gps.timestamp).format('YYYY-MM-DD HH:mm:ss');
398 398  
399 399 marker.infoWindow.setContent(gb_map_overlay_mge.map_gps_win_temp(gps));
400 400 map.openInfoWindow(marker.infoWindow, marker.point);
... ...
src/test/java/com/bsth/service/schedule/rules/Test.java 0 → 100644
  1 +package com.bsth.service.schedule.rules;
  2 +
  3 +import org.apache.tika.Tika;
  4 +
  5 +import java.io.File;
  6 +
  7 +/**
  8 + * Created by xu on 17/1/3.
  9 + */
  10 +public class Test {
  11 + public static void main(String[] args) throws Exception {
  12 + Tika tika = new Tika();
  13 + File file = new File("/Users/xu/Downloads/排班规则练习1.xls");
  14 +
  15 + // application/vnd.ms-excel
  16 + // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  17 +
  18 + String detecttype = tika.detect(file);
  19 + System.out.println(detecttype);
  20 +
  21 + }
  22 +}
... ...