Commit 775e453449cda7780244295e960ead46118a023e

Authored by 潘钊
2 parents 117dc2a5 be97e34e

Merge branch 'minhang' into pudong

Showing 46 changed files with 1089 additions and 1294 deletions

Too many changes to show.

To preserve performance only 46 of 136 files are displayed.

@@ -155,6 +155,12 @@ @@ -155,6 +155,12 @@
155 <version>2.1.8</version> 155 <version>2.1.8</version>
156 </dependency> 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 <!-- pentaho kettle 依赖 --> 164 <!-- pentaho kettle 依赖 -->
159 <dependency> 165 <dependency>
160 <groupId>com.pentaho.kettle</groupId> 166 <groupId>com.pentaho.kettle</groupId>
src/main/java/com/bsth/controller/DownloadController.java
@@ -2,6 +2,7 @@ package com.bsth.controller; @@ -2,6 +2,7 @@ package com.bsth.controller;
2 2
3 import java.io.File; 3 import java.io.File;
4 import java.io.IOException; 4 import java.io.IOException;
  5 +import java.net.URLDecoder;
5 6
6 import org.apache.commons.io.FileUtils; 7 import org.apache.commons.io.FileUtils;
7 import org.springframework.context.annotation.Scope; 8 import org.springframework.context.annotation.Scope;
@@ -35,7 +36,7 @@ public class DownloadController @@ -35,7 +36,7 @@ public class DownloadController
35 File file=new File(moudelPath); 36 File file=new File(moudelPath);
36 HttpHeaders headers = new HttpHeaders(); 37 HttpHeaders headers = new HttpHeaders();
37 String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 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 headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 40 headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
40 return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), 41 return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),
41 headers, HttpStatus.CREATED); 42 headers, HttpStatus.CREATED);
src/main/java/com/bsth/controller/oil/YlbController.java
@@ -106,24 +106,24 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -106,24 +106,24 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
106 @RequestParam(defaultValue = "DESC") String direction){ 106 @RequestParam(defaultValue = "DESC") String direction){
107 107
108 Direction d; 108 Direction d;
109 - try { 109 +// try {
110 String rq=map.get("rq").toString(); 110 String rq=map.get("rq").toString();
111 if(!(rq=="")){ 111 if(!(rq=="")){
112 -  
113 - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");  
114 - Calendar calendar = new GregorianCalendar();  
115 - calendar.setTime(sdf.parse(rq));  
116 - calendar.add(calendar.DATE,1);  
117 - Date date=calendar.getTime();  
118 - map.put("rq_ge", rq);  
119 - map.put("rq_le", sdf.format(date));  
120 - System.out.println(rq);  
121 - System.out.println(sdf.format(date));  
122 - }  
123 - } catch (ParseException e) {  
124 - // TODO Auto-generated catch block  
125 - e.printStackTrace(); 112 +//
  113 +// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  114 +// Calendar calendar = new GregorianCalendar();
  115 +// calendar.setTime(sdf.parse(rq));
  116 +// calendar.add(calendar.DATE,1);
  117 +// Date date=calendar.getTime();
  118 + map.put("rq_eq", rq);
  119 +// map.put("rq_lt", sdf.format(date));
  120 +// System.out.println(rq);
  121 +// System.out.println(sdf.format(date));
126 } 122 }
  123 +// } catch (ParseException e) {
  124 +// // TODO Auto-generated catch block
  125 +// e.printStackTrace();
  126 +// }
127 if(null != direction && direction.equals("ASC")) 127 if(null != direction && direction.equals("ASC"))
128 d = Direction.ASC; 128 d = Direction.ASC;
129 else 129 else
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
@@ -59,4 +59,14 @@ public class RealMapController { @@ -59,4 +59,14 @@ public class RealMapController {
59 public Map<String, Object> findRouteAndStationByLine(@RequestParam String lineCode){ 59 public Map<String, Object> findRouteAndStationByLine(@RequestParam String lineCode){
60 return realMapService.findRouteAndStationByLine(lineCode); 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
@@ -36,35 +36,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -36,35 +36,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
36 36
37 /** 37 /**
38 * 38 *
39 - * 改由通过 websocket 注册监听!!!  
40 - *  
41 - * @Title: registerLine @Description: TODO(注册线路,后续才能收到数据推送) @param @param  
42 - * lineCodes @throws  
43 - * 用GET 防止监控模式下被拦截  
44 -  
45 - @RequestMapping(value = "/registerLine", method = RequestMethod.GET)  
46 - public int registerLine(@RequestParam String lineCodes) {  
47 - List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(lineCodes);  
48 - String userName = SecurityUtils.getCurrentUser().getUserName();  
49 - // 注销之前的绑定  
50 - for (String line : list)  
51 - BasicData.lineCode2SocketUserMap.get(line).remove(userName);  
52 - // 重新绑定  
53 - for (String line : list)  
54 - BasicData.lineCode2SocketUserMap.put(line, userName);  
55 -  
56 - return 0;  
57 - }*/  
58 -  
59 - /**  
60 - *  
61 * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id 39 * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
62 * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws 40 * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
63 */ 41 */
64 @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST) 42 @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
65 public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks, 43 public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
66 - @RequestParam String dfsj/*, String clZbh, String jsy, String spy*/) {  
67 - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj/*, clZbh, jsy, spy*/); 44 + @RequestParam String dfsj,@RequestParam String bcType) {
  45 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType);
68 } 46 }
69 47
70 /** 48 /**
@@ -125,19 +103,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -125,19 +103,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
125 public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) { 103 public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
126 return scheduleRealInfoService.sreachVehic(nbbm); 104 return scheduleRealInfoService.sreachVehic(nbbm);
127 } 105 }
128 -  
129 - /**  
130 - *  
131 - * @Title: adjust @Description: TODO(调整人车) @param @param id  
132 - * 班次ID @param @param nbbm 内部编码 @param @param jsy 驾驶员 @param @param spy  
133 - * 售票员 @throws  
134 -  
135 - @RequestMapping(value = "/adjust", method = RequestMethod.POST)  
136 - public Map<String, Object> adjust(@RequestParam Long id, String nbbm, String jsy,  
137 - String spy, Integer revertLine, Integer borrowLine, String borrowTimeStr, String revertTimeStr) {  
138 - return scheduleRealInfoService.adjust(id, nbbm, jsy, spy, revertLine, borrowLine, borrowTimeStr, revertTimeStr);  
139 - }  
140 - */  
141 /** 106 /**
142 * 107 *
143 * @Title: realOutAdjust 108 * @Title: realOutAdjust
@@ -338,8 +303,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -338,8 +303,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
338 303
339 @RequestMapping(value = "/correctForm") 304 @RequestMapping(value = "/correctForm")
340 public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate, 305 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); 306 + @RequestParam String endDate, @RequestParam String lpName, @RequestParam String code, @RequestParam String type) {
  307 + return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code, type);
343 } 308 }
344 /** 309 /**
345 * @Title queryListWaybill 310 * @Title queryListWaybill
@@ -427,4 +392,14 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -427,4 +392,14 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
427 } 392 }
428 return rs; 393 return rs;
429 } 394 }
  395 +
  396 + @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
  397 + public Map<String, Object> svgAttr(@RequestParam String jsonStr){
  398 + return scheduleRealInfoService.svgAttr(jsonStr);
  399 + }
  400 +
  401 + @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
  402 + public Map<String, Object> findSvgAttr(@RequestParam String idx){
  403 + return scheduleRealInfoService.findSvgAttr(idx);
  404 + }
430 } 405 }
src/main/java/com/bsth/controller/schedule/BController.java
@@ -5,16 +5,21 @@ import com.bsth.common.ResponseCode; @@ -5,16 +5,21 @@ import com.bsth.common.ResponseCode;
5 import com.bsth.entity.schedule.BEntity; 5 import com.bsth.entity.schedule.BEntity;
6 import com.bsth.entity.sys.SysUser; 6 import com.bsth.entity.sys.SysUser;
7 import com.bsth.service.schedule.BService; 7 import com.bsth.service.schedule.BService;
8 -import com.bsth.service.schedule.ScheduleException; 8 +import com.bsth.service.schedule.exception.ScheduleException;
9 import com.bsth.service.sys.SysUserService; 9 import com.bsth.service.sys.SysUserService;
10 import com.google.common.base.Splitter; 10 import com.google.common.base.Splitter;
  11 +import jxl.Sheet;
  12 +import jxl.Workbook;
  13 +import org.apache.commons.lang3.StringUtils;
11 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.data.domain.PageRequest; 15 import org.springframework.data.domain.PageRequest;
13 import org.springframework.data.domain.Sort; 16 import org.springframework.data.domain.Sort;
14 import org.springframework.web.bind.annotation.*; 17 import org.springframework.web.bind.annotation.*;
  18 +import org.springframework.web.multipart.MultipartFile;
15 19
  20 +import javax.servlet.http.HttpServletResponse;
16 import javax.servlet.http.HttpSession; 21 import javax.servlet.http.HttpSession;
17 -import java.io.Serializable; 22 +import java.io.*;
18 import java.util.*; 23 import java.util.*;
19 24
20 /** 25 /**
@@ -26,7 +31,7 @@ public class BController&lt;T, ID extends Serializable&gt; { @@ -26,7 +31,7 @@ public class BController&lt;T, ID extends Serializable&gt; {
26 @Autowired 31 @Autowired
27 private SysUserService sysUserService; 32 private SysUserService sysUserService;
28 33
29 - // CRUD 操作 34 + //---------------- CRUD 操作 ----------------//
30 // Create操作 35 // Create操作
31 @RequestMapping(method = RequestMethod.POST) 36 @RequestMapping(method = RequestMethod.POST)
32 public Map<String, Object> save(@RequestBody T t, HttpSession httpSession) { 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,6 +78,7 @@ public class BController&lt;T, ID extends Serializable&gt; {
73 rtn.put("data", t); 78 rtn.put("data", t);
74 return rtn; 79 return rtn;
75 } 80 }
  81 + // 查询所有操作
76 @RequestMapping(value = "/all", method = RequestMethod.GET) 82 @RequestMapping(value = "/all", method = RequestMethod.GET)
77 public Map<String, Object> list(@RequestParam Map<String, Object> param) { 83 public Map<String, Object> list(@RequestParam Map<String, Object> param) {
78 List<T> tList = bService.list(param); 84 List<T> tList = bService.list(param);
@@ -81,6 +87,7 @@ public class BController&lt;T, ID extends Serializable&gt; { @@ -81,6 +87,7 @@ public class BController&lt;T, ID extends Serializable&gt; {
81 rtn.put("data", tList); 87 rtn.put("data", tList);
82 return rtn; 88 return rtn;
83 } 89 }
  90 + // 分页查询操作
84 @RequestMapping(method = RequestMethod.GET) 91 @RequestMapping(method = RequestMethod.GET)
85 public Map<String, Object> list( 92 public Map<String, Object> list(
86 @RequestParam Map<String, Object> map, 93 @RequestParam Map<String, Object> map,
@@ -138,4 +145,99 @@ public class BController&lt;T, ID extends Serializable&gt; { @@ -138,4 +145,99 @@ public class BController&lt;T, ID extends Serializable&gt; {
138 return rtn; 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,7 +4,7 @@ import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.CarDevice; 5 import com.bsth.entity.CarDevice;
6 import com.bsth.service.schedule.CarDeviceService; 6 import com.bsth.service.schedule.CarDeviceService;
7 -import com.bsth.service.schedule.ScheduleException; 7 +import com.bsth.service.schedule.exception.ScheduleException;
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RequestMethod; 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,7 +4,7 @@ import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.Cars; 5 import com.bsth.entity.Cars;
6 import com.bsth.service.schedule.CarsService; 6 import com.bsth.service.schedule.CarsService;
7 -import com.bsth.service.schedule.ScheduleException; 7 +import com.bsth.service.schedule.exception.ScheduleException;
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RequestMethod; 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,7 +4,7 @@ import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.Personnel; 5 import com.bsth.entity.Personnel;
6 import com.bsth.service.schedule.EmployeeService; 6 import com.bsth.service.schedule.EmployeeService;
7 -import com.bsth.service.schedule.ScheduleException; 7 +import com.bsth.service.schedule.exception.ScheduleException;
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RequestMethod; 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,7 +5,7 @@ import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.schedule.CarConfigInfo; 5 import com.bsth.entity.schedule.CarConfigInfo;
6 import com.bsth.repository.schedule.CarConfigInfoRepository; 6 import com.bsth.repository.schedule.CarConfigInfoRepository;
7 import com.bsth.service.schedule.CarConfigInfoService; 7 import com.bsth.service.schedule.CarConfigInfoService;
8 -import com.bsth.service.schedule.ScheduleException; 8 +import com.bsth.service.schedule.exception.ScheduleException;
9 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.web.bind.annotation.RequestMapping; 10 import org.springframework.web.bind.annotation.RequestMapping;
11 import org.springframework.web.bind.annotation.RequestMethod; 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,7 +5,7 @@ import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.schedule.EmployeeConfigInfo; 5 import com.bsth.entity.schedule.EmployeeConfigInfo;
6 import com.bsth.repository.schedule.EmployeeConfigInfoRepository; 6 import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
7 import com.bsth.service.schedule.EmployeeConfigInfoService; 7 import com.bsth.service.schedule.EmployeeConfigInfoService;
8 -import com.bsth.service.schedule.ScheduleException; 8 +import com.bsth.service.schedule.exception.ScheduleException;
9 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.web.bind.annotation.RequestMapping; 10 import org.springframework.web.bind.annotation.RequestMapping;
11 import org.springframework.web.bind.annotation.RequestMethod; 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,7 +5,7 @@ import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.schedule.GuideboardInfo; 5 import com.bsth.entity.schedule.GuideboardInfo;
6 import com.bsth.repository.schedule.GuideboardInfoRepository; 6 import com.bsth.repository.schedule.GuideboardInfoRepository;
7 import com.bsth.service.schedule.GuideboardInfoService; 7 import com.bsth.service.schedule.GuideboardInfoService;
8 -import com.bsth.service.schedule.ScheduleException; 8 +import com.bsth.service.schedule.exception.ScheduleException;
9 import com.bsth.service.schedule.utils.DataToolsProperties; 9 import com.bsth.service.schedule.utils.DataToolsProperties;
10 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.boot.context.properties.EnableConfigurationProperties; 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,7 +3,7 @@ package com.bsth.controller.schedule.core;
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.schedule.TTInfo; 5 import com.bsth.entity.schedule.TTInfo;
6 -import com.bsth.service.schedule.ScheduleException; 6 +import com.bsth.service.schedule.exception.ScheduleException;
7 import com.bsth.service.schedule.TTInfoService; 7 import com.bsth.service.schedule.TTInfoService;
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.web.bind.annotation.RequestMapping; 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
@@ -261,26 +261,26 @@ public class BasicData implements CommandLineRunner { @@ -261,26 +261,26 @@ public class BasicData implements CommandLineRunner {
261 /** 261 /**
262 * 加载运管处的站点及序号 262 * 加载运管处的站点及序号
263 * 上行从1开始,下行顺序续编 263 * 上行从1开始,下行顺序续编
264 -  
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 - }*/ 264 + */
  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 + }
284 } 284 }
285 285
286 lineId2CodeMap = biMap; 286 lineId2CodeMap = biMap;
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
1 -package com.bsth.data.gpsdata.arrival.handlers;  
2 -  
3 -import com.bsth.data.LineConfigData;  
4 -import com.bsth.data.gpsdata.GpsEntity;  
5 -import com.bsth.data.gpsdata.arrival.SignalHandle;  
6 -import com.bsth.data.gpsdata.arrival.utils.CircleQueue;  
7 -import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState;  
8 -import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher;  
9 -import com.bsth.data.schedule.DayOfSchedule;  
10 -import com.bsth.entity.realcontrol.LineConfig;  
11 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
12 -import com.bsth.service.directive.DirectiveService;  
13 -import com.bsth.websocket.handler.SendUtils;  
14 -import org.apache.commons.lang3.StringUtils;  
15 -import org.slf4j.Logger;  
16 -import org.slf4j.LoggerFactory;  
17 -import org.springframework.beans.factory.annotation.Autowired;  
18 -import org.springframework.stereotype.Component;  
19 -  
20 -/**  
21 - * 进出站动作处理  
22 - * Created by panzhao on 2016/12/27.  
23 - */  
24 -@Component  
25 -public class InOutStationSignalHandle extends SignalHandle{  
26 -  
27 - Logger logger = LoggerFactory.getLogger(this.getClass());  
28 -  
29 - @Autowired  
30 - DayOfSchedule dayOfSchedule;  
31 -  
32 - @Autowired  
33 - LineConfigData lineConfigData;  
34 -  
35 - @Autowired  
36 - SendUtils sendUtils;  
37 -  
38 - @Autowired  
39 - DirectiveService directiveService;  
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 -  
49 - @Override  
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 - }  
60 -  
61 - if(isNotEmpty(prevs)){  
62 - GpsEntity prev = prevs.getTail();  
63 - if(isOutStation(gps, prev))  
64 - outStation(gps, prev);  
65 -  
66 -  
67 - if(isInStation(gps, prev))  
68 - inStation(gps, prev);  
69 - }  
70 -  
71 - return true;  
72 - }  
73 -  
74 - private boolean isOutStation(GpsEntity gps, GpsEntity prev){  
75 - //从站内到站外  
76 - if(prev.getInstation() > 0 && gps.getInstation() == 0)  
77 - return true;  
78 -  
79 - //从站内到另一个站内  
80 - if(prev.getInstation() > 0 && gps.getInstation() > 0  
81 - && !prev.getStopNo().equals(gps.getStopNo()))  
82 - return true;  
83 - return false;  
84 - }  
85 -  
86 - private boolean isInStation(GpsEntity gps, GpsEntity prev){  
87 - //从站外到站内  
88 - if(prev.getInstation() == 0 && gps.getInstation() > 0  
89 - /*&& !prev.getStopNo().equals(gps.getStopNo())*/){  
90 - return true;  
91 - }  
92 -  
93 - //从站内到另一个站内  
94 - if(prev.getInstation() > 0 && gps.getInstation() > 0  
95 - && !prev.getStopNo().equals(gps.getStopNo()))  
96 - return true;  
97 - return false;  
98 - }  
99 -  
100 - /**  
101 - * 出站  
102 - * @param gps 当前点  
103 - * @param prev 上一个点  
104 - */  
105 - private void outStation(GpsEntity gps, GpsEntity prev) {  
106 - ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());  
107 - String qdzCode = sch.getQdzCode();  
108 -  
109 - //首班出场最多提前1.2小时  
110 - if(dayOfSchedule.isFirstOut(sch) && sch.getDfsjT() - gps.getTimestamp() > MAX_BEFORE_TIME)  
111 - return;  
112 -  
113 - //起点发车  
114 - if(qdzCode != null && prev.getStopNo().equals(qdzCode)  
115 - && !willDepart(gps, prev, sch)){  
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 - //实发时间  
126 - sch.setFcsjActualAll(gps.getTimestamp());  
127 - //通知客户端  
128 - sendUtils.sendFcsj(sch);  
129 - //持久化  
130 - dayOfSchedule.save(sch);  
131 -  
132 - //出站既出场  
133 - outStationAndOutPark(sch);  
134 - logger.info("班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());  
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 - }  
144 - }  
145 -  
146 -  
147 - private void outStationAndOutPark(ScheduleRealInfo sch){  
148 - LineConfig config = lineConfigData.get(sch.getXlBm());  
149 - if (config != null && config.getOutConfig() == 2) {  
150 - //出站既出场  
151 - ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);  
152 - if (schPrev != null && schPrev.getBcType().equals("out")) {  
153 - schPrev.setFcsjActualAll(sch.getFcsjActualTime());  
154 - schPrev.setZdsjActualAll(sch.getFcsjActualTime());  
155 -  
156 - sendUtils.refreshSch(schPrev);  
157 - }  
158 - }  
159 - }  
160 -  
161 - /**  
162 - * 进站  
163 - * @param gps 当前点  
164 - * @param prev 上一个点  
165 - */  
166 - private void inStation(GpsEntity gps, GpsEntity prev){  
167 - ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());  
168 -  
169 - if(gps.getStopNo().equals(sch.getZdzCode())){  
170 -  
171 - //实达时间不覆盖  
172 - if(StringUtils.isNotEmpty(sch.getZdsjActual()))  
173 - return;  
174 -  
175 - sch.setZdsjActualAll(gps.getTimestamp());  
176 - //已完成班次数  
177 - int doneSum = dayOfSchedule.doneSum(sch.getClZbh());  
178 - ScheduleRealInfo next = dayOfSchedule.next(sch);  
179 - //通知客户端  
180 - sendUtils.sendZdsj(sch, next, doneSum);  
181 - //持久化  
182 - dayOfSchedule.save(sch);  
183 - //下发调度指令  
184 - directiveService.send60Dispatch(next, doneSum, "到站@系统");  
185 -  
186 - //准备执行下一个班次  
187 - if (next != null) {  
188 - next.setQdzArrDatesj(sch.getZdsjActual());  
189 - dayOfSchedule.addExecPlan(next);  
190 - //进站既进场  
191 - inStationAndInPark(sch, next);  
192 - //将gps转换为下一个班次走向的站内信号  
193 - transformUpdown(gps, sch);  
194 - }  
195 - }  
196 - else if(sch.getFcsjActual() == null){  
197 - //有进站,但班次没有实发,向前追溯一下信号  
198 - scheduleSignalState.signalRetrospect(gps, sch);  
199 - }  
200 - }  
201 -  
202 - /**  
203 - * 进站既进场  
204 - * @param sch  
205 - */  
206 - private void inStationAndInPark(ScheduleRealInfo sch, ScheduleRealInfo next){  
207 - LineConfig config = lineConfigData.get(sch.getXlBm());  
208 - if (next.getBcType().equals("in") &&  
209 - config != null && config.getOutConfig() == 2) {  
210 - next.setFcsjActualAll(sch.getZdsjActualTime());  
211 - next.setZdsjActualAll(sch.getZdsjActualTime());  
212 -  
213 - sendUtils.refreshSch(next);  
214 - }  
215 - }  
216 -  
217 - /**  
218 - * 发车漂移判定(这里出现的误判,由车辆到达中途站的时候补偿)  
219 - * @param gps  
220 - * @param prev  
221 - * @param task  
222 - * @return  
223 - */  
224 - private boolean willDepart(GpsEntity gps, GpsEntity prev, Object task){  
225 -  
226 - /*ScheduleRealInfo sch = (ScheduleRealInfo) task;  
227 - ScheduleRealInfo prevTask = dayOfSchedule.prev(sch);  
228 - if(prevTask == null || prevTask.getBcType().equals("out"))  
229 - return false;  
230 -  
231 - //计划停站时间  
232 - int stopTimePlan = (int) (sch.getDfsjT() - prevTask.getZdsjT());  
233 -  
234 - if(stopTimePlan < 1000 * 60 * 10)  
235 - return false;  
236 -  
237 - //实际停站时间  
238 - if(prevTask.getZdsjActual() != null){  
239 - int actualTime = (int) (gps.getTimestamp() - prevTask.getZdsjActualTime());  
240 -  
241 - if(actualTime < stopTimePlan * 0.8){  
242 - logger.info("漂移判定");  
243 -  
244 - return true;  
245 - }  
246 - }*/  
247 - return false;  
248 - } 1 +package com.bsth.data.gpsdata.arrival.handlers;
  2 +
  3 +import com.bsth.data.LineConfigData;
  4 +import com.bsth.data.gpsdata.GpsEntity;
  5 +import com.bsth.data.gpsdata.arrival.SignalHandle;
  6 +import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
  7 +import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState;
  8 +import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher;
  9 +import com.bsth.data.schedule.DayOfSchedule;
  10 +import com.bsth.entity.realcontrol.LineConfig;
  11 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  12 +import com.bsth.service.directive.DirectiveService;
  13 +import com.bsth.websocket.handler.SendUtils;
  14 +import org.apache.commons.lang3.StringUtils;
  15 +import org.slf4j.Logger;
  16 +import org.slf4j.LoggerFactory;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.stereotype.Component;
  19 +
  20 +/**
  21 + * 进出站动作处理
  22 + * Created by panzhao on 2016/12/27.
  23 + */
  24 +@Component
  25 +public class InOutStationSignalHandle extends SignalHandle{
  26 +
  27 + Logger logger = LoggerFactory.getLogger(this.getClass());
  28 +
  29 + @Autowired
  30 + DayOfSchedule dayOfSchedule;
  31 +
  32 + @Autowired
  33 + LineConfigData lineConfigData;
  34 +
  35 + @Autowired
  36 + SendUtils sendUtils;
  37 +
  38 + @Autowired
  39 + DirectiveService directiveService;
  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 +
  49 + @Override
  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 + }
  60 +
  61 + if(isNotEmpty(prevs)){
  62 + GpsEntity prev = prevs.getTail();
  63 + if(isOutStation(gps, prev))
  64 + outStation(gps, prev);
  65 +
  66 +
  67 + if(isInStation(gps, prev))
  68 + inStation(gps, prev);
  69 + }
  70 +
  71 + return true;
  72 + }
  73 +
  74 + private boolean isOutStation(GpsEntity gps, GpsEntity prev){
  75 + //从站内到站外
  76 + if(prev.getInstation() > 0 && gps.getInstation() == 0)
  77 + return true;
  78 +
  79 + //从站内到另一个站内
  80 + if(prev.getInstation() > 0 && gps.getInstation() > 0
  81 + && !prev.getStopNo().equals(gps.getStopNo()))
  82 + return true;
  83 + return false;
  84 + }
  85 +
  86 + private boolean isInStation(GpsEntity gps, GpsEntity prev){
  87 + //从站外到站内
  88 + if(prev.getInstation() == 0 && gps.getInstation() > 0
  89 + /*&& !prev.getStopNo().equals(gps.getStopNo())*/){
  90 + return true;
  91 + }
  92 +
  93 + //从站内到另一个站内
  94 + if(prev.getInstation() > 0 && gps.getInstation() > 0
  95 + && !prev.getStopNo().equals(gps.getStopNo()))
  96 + return true;
  97 + return false;
  98 + }
  99 +
  100 + /**
  101 + * 出站
  102 + * @param gps 当前点
  103 + * @param prev 上一个点
  104 + */
  105 + private void outStation(GpsEntity gps, GpsEntity prev) {
  106 + ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
  107 + String qdzCode = sch.getQdzCode();
  108 +
  109 + //首班出场最多提前1.2小时
  110 + if(dayOfSchedule.isFirstOut(sch) && sch.getDfsjT() - gps.getTimestamp() > MAX_BEFORE_TIME)
  111 + return;
  112 +
  113 + //起点发车
  114 + if(qdzCode != null && prev.getStopNo().equals(qdzCode)
  115 + && !willDepart(gps, prev, sch)){
  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 + //实发时间
  126 + sch.setFcsjActualAll(gps.getTimestamp());
  127 + //通知客户端
  128 + sendUtils.sendFcsj(sch);
  129 + //持久化
  130 + dayOfSchedule.save(sch);
  131 +
  132 + //出站既出场
  133 + outStationAndOutPark(sch);
  134 + logger.info("班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
  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 + }
  144 + }
  145 +
  146 +
  147 + private void outStationAndOutPark(ScheduleRealInfo sch){
  148 + LineConfig config = lineConfigData.get(sch.getXlBm());
  149 + if (config != null && config.getOutConfig() == 2) {
  150 + //出站既出场
  151 + ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
  152 + if (schPrev != null && schPrev.getBcType().equals("out")) {
  153 + schPrev.setFcsjActualAll(sch.getFcsjActualTime());
  154 + schPrev.setZdsjActualAll(sch.getFcsjActualTime());
  155 +
  156 + sendUtils.refreshSch(schPrev);
  157 + dayOfSchedule.save(schPrev);
  158 + }
  159 + }
  160 + }
  161 +
  162 + /**
  163 + * 进站
  164 + * @param gps 当前点
  165 + * @param prev 上一个点
  166 + */
  167 + private void inStation(GpsEntity gps, GpsEntity prev){
  168 + ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
  169 +
  170 + if(gps.getStopNo().equals(sch.getZdzCode())){
  171 +
  172 + //进场最多提前1.2小时
  173 + if(sch.getBcType().equals("in") && sch.getZdsjT() - gps.getTimestamp() > MAX_BEFORE_TIME)
  174 + return;
  175 +
  176 + //实达时间不覆盖
  177 + if(StringUtils.isNotEmpty(sch.getZdsjActual()))
  178 + return;
  179 +
  180 + sch.setZdsjActualAll(gps.getTimestamp());
  181 + //已完成班次数
  182 + int doneSum = dayOfSchedule.doneSum(sch.getClZbh());
  183 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  184 + //通知客户端
  185 + sendUtils.sendZdsj(sch, next, doneSum);
  186 + //持久化
  187 + dayOfSchedule.save(sch);
  188 + //下发调度指令
  189 + directiveService.send60Dispatch(next, doneSum, "到站@系统");
  190 +
  191 + //准备执行下一个班次
  192 + if (next != null) {
  193 + next.setQdzArrDatesj(sch.getZdsjActual());
  194 + dayOfSchedule.addExecPlan(next);
  195 + //进站既进场
  196 + inStationAndInPark(sch, next);
  197 + //将gps转换为下一个班次走向的站内信号
  198 + transformUpdown(gps, sch);
  199 + }
  200 + }
  201 + else if(sch.getFcsjActual() == null){
  202 + //有进站,但班次没有实发,向前追溯一下信号
  203 + scheduleSignalState.signalRetrospect(gps, sch);
  204 + }
  205 + }
  206 +
  207 + /**
  208 + * 进站既进场
  209 + * @param sch
  210 + */
  211 + private void inStationAndInPark(ScheduleRealInfo sch, ScheduleRealInfo next){
  212 + LineConfig config = lineConfigData.get(sch.getXlBm());
  213 + if (next.getBcType().equals("in") &&
  214 + config != null && config.getOutConfig() == 2) {
  215 + next.setFcsjActualAll(sch.getZdsjActualTime());
  216 + next.setZdsjActualAll(sch.getZdsjActualTime());
  217 +
  218 + sendUtils.refreshSch(next);
  219 + dayOfSchedule.save(next);
  220 + }
  221 + }
  222 +
  223 + /**
  224 + * 发车漂移判定(这里出现的误判,由车辆到达中途站的时候补偿)
  225 + * @param gps
  226 + * @param prev
  227 + * @param task
  228 + * @return
  229 + */
  230 + private boolean willDepart(GpsEntity gps, GpsEntity prev, Object task){
  231 +
  232 + /*ScheduleRealInfo sch = (ScheduleRealInfo) task;
  233 + ScheduleRealInfo prevTask = dayOfSchedule.prev(sch);
  234 + if(prevTask == null || prevTask.getBcType().equals("out"))
  235 + return false;
  236 +
  237 + //计划停站时间
  238 + int stopTimePlan = (int) (sch.getDfsjT() - prevTask.getZdsjT());
  239 +
  240 + if(stopTimePlan < 1000 * 60 * 10)
  241 + return false;
  242 +
  243 + //实际停站时间
  244 + if(prevTask.getZdsjActual() != null){
  245 + int actualTime = (int) (gps.getTimestamp() - prevTask.getZdsjActualTime());
  246 +
  247 + if(actualTime < stopTimePlan * 0.8){
  248 + logger.info("漂移判定");
  249 +
  250 + return true;
  251 + }
  252 + }*/
  253 + return false;
  254 + }
249 } 255 }
250 \ No newline at end of file 256 \ No newline at end of file
src/main/java/com/bsth/data/gpsdata/arrival/utils/ScheduleSignalState.java
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 - } 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 } 252 }
253 \ No newline at end of file 253 \ No newline at end of file
src/main/java/com/bsth/data/pilot80/PilotReport.java
@@ -84,6 +84,8 @@ public class PilotReport { @@ -84,6 +84,8 @@ public class PilotReport {
84 84
85 //下发调度指令 85 //下发调度指令
86 directiveService.send60Dispatch(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统"); 86 directiveService.send60Dispatch(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统");
  87 + //下发线路切换指令
  88 + directiveService.lineChange(outSch.getClZbh(), outSch.getXlBm(), "请出@系统");
87 /* d80.setRemarks("计划出场时间:" + outSch.getDfsj()); 89 /* d80.setRemarks("计划出场时间:" + outSch.getDfsj());
88 //当前GPS位置 90 //当前GPS位置
89 GpsEntity gps = gpsRealData.get(d80.getDeviceId()); 91 GpsEntity gps = gpsRealData.get(d80.getDeviceId());
src/main/java/com/bsth/entity/CarPark.java
1 package com.bsth.entity; 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,6 +22,7 @@ import javax.persistence.Table;
25 22
26 @Entity 23 @Entity
27 @Table(name = "bsth_c_car_park") 24 @Table(name = "bsth_c_car_park")
  25 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
28 public class CarPark { 26 public class CarPark {
29 27
30 @Id 28 @Id
src/main/java/com/bsth/entity/Cars.java
@@ -23,7 +23,7 @@ import java.util.Date; @@ -23,7 +23,7 @@ import java.util.Date;
23 23
24 @Entity 24 @Entity
25 @Table(name = "bsth_c_cars") 25 @Table(name = "bsth_c_cars")
26 -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"}) 26 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
27 public class Cars extends BEntity implements Serializable { 27 public class Cars extends BEntity implements Serializable {
28 28
29 /** 主键Id */ 29 /** 主键Id */
src/main/java/com/bsth/entity/Line.java
@@ -24,7 +24,7 @@ import java.util.Date; @@ -24,7 +24,7 @@ import java.util.Date;
24 24
25 @Entity 25 @Entity
26 @Table(name = "bsth_c_line") 26 @Table(name = "bsth_c_line")
27 -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"}) 27 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
28 public class Line implements Serializable { 28 public class Line implements Serializable {
29 29
30 @Id 30 @Id
src/main/java/com/bsth/entity/Personnel.java
@@ -21,7 +21,7 @@ import javax.persistence.*; @@ -21,7 +21,7 @@ import javax.persistence.*;
21 21
22 @Entity 22 @Entity
23 @Table(name = "bsth_c_personnel") 23 @Table(name = "bsth_c_personnel")
24 -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"}) 24 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
25 public class Personnel extends BEntity { 25 public class Personnel extends BEntity {
26 26
27 /** 主键Id */ 27 /** 主键Id */
src/main/java/com/bsth/entity/Station.java
1 package com.bsth.entity; 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; 5 import javax.persistence.Column;
6 import javax.persistence.Entity; 6 import javax.persistence.Entity;
7 -import javax.persistence.GeneratedValue;  
8 -import javax.persistence.GenerationType;  
9 import javax.persistence.Id; 7 import javax.persistence.Id;
10 import javax.persistence.Table; 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,6 +25,7 @@ import javax.persistence.Table;
26 25
27 @Entity 26 @Entity
28 @Table(name = "bsth_c_station") 27 @Table(name = "bsth_c_station")
  28 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
29 public class Station { 29 public class Station {
30 30
31 @Id 31 @Id
src/main/java/com/bsth/entity/realcontrol/SvgAttribute.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +
  7 +/**
  8 + * 主页SVG模拟图属性设置
  9 + * Created by panzhao on 2017/1/6.
  10 + */
  11 +@Entity
  12 +@Table(name = "bsth_c_svg_attr")
  13 +public class SvgAttribute {
  14 +
  15 + @Id
  16 + private String lineCode;
  17 +
  18 + /**
  19 + * 要隐藏的站点编码 , 号分割多个
  20 + */
  21 + private String hideStations;
  22 +
  23 + /**
  24 + * 站点别名 json对象字符串
  25 + */
  26 + private String nicknames;
  27 +
  28 + public String getLineCode() {
  29 + return lineCode;
  30 + }
  31 +
  32 + public void setLineCode(String lineCode) {
  33 + this.lineCode = lineCode;
  34 + }
  35 +
  36 + public String getHideStations() {
  37 + return hideStations;
  38 + }
  39 +
  40 + public void setHideStations(String hideStations) {
  41 + this.hideStations = hideStations;
  42 + }
  43 +
  44 + public String getNicknames() {
  45 + return nicknames;
  46 + }
  47 +
  48 + public void setNicknames(String nicknames) {
  49 + this.nicknames = nicknames;
  50 + }
  51 +}
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
@@ -19,7 +19,7 @@ import java.util.Date; @@ -19,7 +19,7 @@ import java.util.Date;
19 @NamedAttributeNode("cl") 19 @NamedAttributeNode("cl")
20 }) 20 })
21 }) 21 })
22 -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"}) 22 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
23 public class CarConfigInfo extends BEntity implements Serializable { 23 public class CarConfigInfo extends BEntity implements Serializable {
24 24
25 /** 主健Id */ 25 /** 主健Id */
src/main/java/com/bsth/entity/schedule/EmployeeConfigInfo.java
@@ -22,7 +22,7 @@ import java.io.Serializable; @@ -22,7 +22,7 @@ import java.io.Serializable;
22 @NamedAttributeNode("xl") 22 @NamedAttributeNode("xl")
23 }) 23 })
24 }) 24 })
25 -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"}) 25 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
26 public class EmployeeConfigInfo extends BEntity implements Serializable { 26 public class EmployeeConfigInfo extends BEntity implements Serializable {
27 27
28 /** 主键Id */ 28 /** 主键Id */
src/main/java/com/bsth/entity/schedule/GuideboardInfo.java
@@ -15,7 +15,7 @@ import javax.persistence.*; @@ -15,7 +15,7 @@ import javax.persistence.*;
15 @NamedAttributeNode("xl") 15 @NamedAttributeNode("xl")
16 }) 16 })
17 }) 17 })
18 -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"}) 18 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
19 public class GuideboardInfo extends BEntity { 19 public class GuideboardInfo extends BEntity {
20 20
21 /** 主键Id */ 21 /** 主键Id */
src/main/java/com/bsth/entity/schedule/TTInfo.java
1 package com.bsth.entity.schedule; 1 package com.bsth.entity.schedule;
2 2
3 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
  4 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 5
5 import javax.persistence.*; 6 import javax.persistence.*;
6 import java.util.Date; 7 import java.util.Date;
@@ -17,6 +18,7 @@ import java.util.Date; @@ -17,6 +18,7 @@ import java.util.Date;
17 @NamedAttributeNode("updateBy") 18 @NamedAttributeNode("updateBy")
18 }) 19 })
19 }) 20 })
  21 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
20 public class TTInfo extends BEntity { 22 public class TTInfo extends BEntity {
21 23
22 /** 主键Id */ 24 /** 主键Id */
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
@@ -3,6 +3,7 @@ package com.bsth.entity.schedule; @@ -3,6 +3,7 @@ package com.bsth.entity.schedule;
3 import com.bsth.entity.CarPark; 3 import com.bsth.entity.CarPark;
4 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
5 import com.bsth.entity.Station; 5 import com.bsth.entity.Station;
  6 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6 7
7 import javax.persistence.*; 8 import javax.persistence.*;
8 9
@@ -21,6 +22,7 @@ import javax.persistence.*; @@ -21,6 +22,7 @@ import javax.persistence.*;
21 @NamedAttributeNode("tcc") 22 @NamedAttributeNode("tcc")
22 }) 23 })
23 }) 24 })
  25 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
24 public class TTInfoDetail extends BEntity { 26 public class TTInfoDetail extends BEntity {
25 27
26 /** 主健Id */ 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,7 +9,8 @@ import java.util.Set;
9 9
10 @Entity 10 @Entity
11 @Table(name = "bsth_c_sys_user") 11 @Table(name = "bsth_c_sys_user")
12 -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"}) 12 +//@JsonIgnoreProperties(value={"hibernateLazyInitializer","handlers","fieldHandler"})
  13 +@JsonIgnoreProperties(ignoreUnknown = true)
13 public class SysUser { 14 public class SysUser {
14 15
15 @Id 16 @Id
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -110,7 +110,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -110,7 +110,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
110 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") 110 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
111 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); 111 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
112 112
113 - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh") 113 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY realExecDate,fcsj,xlBm,clZbh")
114 List<Map<String,Object>> yesterdayDataList(String line,String date); 114 List<Map<String,Object>> yesterdayDataList(String line,String date);
115 115
116 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") 116 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
src/main/java/com/bsth/repository/realcontrol/SvgAttributeRepository.java 0 → 100644
  1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.SvgAttribute;
  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/8.
  12 + */
  13 +@Repository
  14 +public interface SvgAttributeRepository extends BaseRepository<SvgAttribute, String> {
  15 + @Query("select s from SvgAttribute s where s.lineCode in ?1")
  16 + List<SvgAttribute> findSvgAttr(List<String> lineCodes);
  17 +}
src/main/java/com/bsth/repository/schedule/TTInfoDetailRepository.java
@@ -34,7 +34,10 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon @@ -34,7 +34,10 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon
34 @Query("select cc from TTInfoDetail cc where cc.id=?1") 34 @Query("select cc from TTInfoDetail cc where cc.id=?1")
35 TTInfoDetail findOneExtend(Long aLong); 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 @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) 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 Long findMaxFcno(Integer xlid, Long ttinfoid); 43 Long findMaxFcno(Integer xlid, Long ttinfoid);
@@ -44,6 +47,6 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon @@ -44,6 +47,6 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon
44 47
45 @Modifying 48 @Modifying
46 @Query(value = "delete from TTInfoDetail t where t.ttinfo.id = ?1") 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/impl/StationRouteServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
3 -import java.io.ByteArrayInputStream;  
4 -import java.io.File;  
5 -import java.io.InputStream;  
6 -import java.text.DecimalFormat;  
7 -import java.util.ArrayList;  
8 -import java.util.HashMap;  
9 -import java.util.List;  
10 -import java.util.Map;  
11 -import java.util.Properties;  
12 -  
13 -import org.springframework.beans.factory.annotation.Autowired;  
14 -import org.springframework.data.jpa.repository.EntityGraph;  
15 -import org.springframework.stereotype.Service;  
16 -  
17 -import com.alibaba.fastjson.JSON;  
18 -import com.alibaba.fastjson.JSONArray;  
19 -import com.alibaba.fastjson.serializer.PropertyFilter;  
20 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
21 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
22 import com.bsth.entity.Station; 5 import com.bsth.entity.Station;
@@ -30,7 +13,14 @@ import com.bsth.util.FTPClientUtils; @@ -30,7 +13,14 @@ import com.bsth.util.FTPClientUtils;
30 import com.bsth.util.PackTarGZUtils; 13 import com.bsth.util.PackTarGZUtils;
31 import com.bsth.util.db.DBUtils_MS; 14 import com.bsth.util.db.DBUtils_MS;
32 import com.google.common.base.Splitter; 15 import com.google.common.base.Splitter;
33 -import com.google.common.collect.Lists; 16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.stereotype.Service;
  18 +
  19 +import java.io.ByteArrayInputStream;
  20 +import java.io.File;
  21 +import java.io.InputStream;
  22 +import java.text.DecimalFormat;
  23 +import java.util.*;
34 24
35 /** 25 /**
36 * 26 *
@@ -985,6 +975,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -985,6 +975,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
985 List<String> idx = Splitter.on(',').splitToList(lineIds); 975 List<String> idx = Splitter.on(',').splitToList(lineIds);
986 //路由 976 //路由
987 List<StationRoute> list = new ArrayList<>(); 977 List<StationRoute> list = new ArrayList<>();
  978 +
  979 +
988 /** 980 /**
989 * in 查询符 无法和 @EntityGraph 同时配合使用,这可能是一个bug 981 * in 查询符 无法和 @EntityGraph 同时配合使用,这可能是一个bug
990 * 暂时只能循环单线路查询 982 * 暂时只能循环单线路查询
@@ -993,9 +985,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -993,9 +985,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
993 for(String id : idx){ 985 for(String id : idx){
994 list.addAll(repository.findByLineCode(id)); 986 list.addAll(repository.findByLineCode(id));
995 } 987 }
996 - 988 +
  989 + for(StationRoute sr : list){
  990 + sr.setLine(null);
  991 + }
997 //过滤部分字段 992 //过滤部分字段
998 - String jsonStr = JSON.toJSONString(list, new PropertyFilter() { 993 + /*String jsonStr = JSON.toJSONString(list, new PropertyFilter() {
999 994
1000 @Override 995 @Override
1001 public boolean apply(Object object, String name, Object value) { 996 public boolean apply(Object object, String name, Object value) {
@@ -1003,10 +998,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -1003,10 +998,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1003 return false; 998 return false;
1004 return true; 999 return true;
1005 } 1000 }
1006 - }); 1001 + });*/
1007 1002
1008 rs.put("status", ResponseCode.SUCCESS); 1003 rs.put("status", ResponseCode.SUCCESS);
1009 - rs.put("list", jsonStr); 1004 + rs.put("list", list);
1010 }catch(Exception e){ 1005 }catch(Exception e){
1011 logger.error("", e); 1006 logger.error("", e);
1012 rs.put("status", ResponseCode.ERROR); 1007 rs.put("status", ResponseCode.ERROR);
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -390,36 +390,44 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -390,36 +390,44 @@ public class TrafficManageServiceImpl implements TrafficManageService{
390 Map<String,Object> map = new HashMap<String,Object>(); 390 Map<String,Object> map = new HashMap<String,Object>();
391 for(Map<String,Object> schRealInfo:listGroup){ 391 for(Map<String,Object> schRealInfo:listGroup){
392 if(schRealInfo != null){ 392 if(schRealInfo != null){
  393 + map.put("insideCode_eq", schRealInfo.get("clZbh")+"");
  394 + Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map));
  395 + /**
  396 + * 如果car==null,则说明该车辆是从线调中换车功能中加进去的,
  397 + * 在cars基础信息中查不到车辆的信息,所以忽略该车辆
  398 + */
  399 + if(car == null){
  400 + continue;
  401 + }
393 //计算总公里和空驶公里,营运公里=总公里-空驶公里 402 //计算总公里和空驶公里,营运公里=总公里-空驶公里
394 double totalKilometers = 0,emptyKilometers =0; 403 double totalKilometers = 0,emptyKilometers =0;
395 sf.append("<LCYH>"); 404 sf.append("<LCYH>");
396 - map.put("insideCode_eq", schRealInfo.get("clZbh")+"");  
397 - Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map));  
398 -// Cars car = carsRepository.findCarByClzbh(schRealInfo.getClZbh());  
399 sf.append("<RQ>"+date+"</RQ>"); 405 sf.append("<RQ>"+date+"</RQ>");
400 sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>"); 406 sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>");
401 sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); 407 sf.append("<CPH>"+car.getCarPlate()+"</CPH>");
402 - for(ScheduleRealInfo scheduleRealInfo:list){  
403 - if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("clZbh")+"")  
404 - .equals(scheduleRealInfo.getClZbh())){  
405 - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();  
406 - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班  
407 - if(childTaskPlans.isEmpty()){  
408 - if(scheduleRealInfo.getStatus() == 2){  
409 - totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();  
410 - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")  
411 - || scheduleRealInfo.getBcType().equals("venting")){  
412 - emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); 408 + if(list != null && list.size() > 0){
  409 + for(ScheduleRealInfo scheduleRealInfo:list){
  410 + if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("clZbh")+"")
  411 + .equals(scheduleRealInfo.getClZbh())){
  412 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  413 + //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
  414 + if(childTaskPlans.isEmpty()){
  415 + if(scheduleRealInfo.getStatus() == 2){
  416 + totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
  417 + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  418 + || scheduleRealInfo.getBcType().equals("venting")){
  419 + emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
  420 + }
413 } 421 }
414 - }  
415 - }else{  
416 - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
417 - while(it.hasNext()){  
418 - ChildTaskPlan childTaskPlan = it.next();  
419 - if(!childTaskPlan.isDestroy()){  
420 - totalKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();  
421 - if(childTaskPlan.getMileageType().equals("empty")){  
422 - emptyKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();; 422 + }else{
  423 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  424 + while(it.hasNext()){
  425 + ChildTaskPlan childTaskPlan = it.next();
  426 + if(!childTaskPlan.isDestroy()){
  427 + totalKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();
  428 + if(childTaskPlan.getMileageType().equals("empty")){
  429 + emptyKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();;
  430 + }
423 } 431 }
424 } 432 }
425 } 433 }
@@ -604,8 +612,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -604,8 +612,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
604 schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzName())).append("</ZDXH>"); 612 schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzName())).append("</ZDXH>");
605 sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); 613 sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>");
606 sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); 614 sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>");
607 - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(  
608 - schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzName())).append("</ZDXH>"); 615 + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
  616 + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzName())).append("</DDXH>");
609 sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) 617 sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj()))
610 .append("</JHDDSJ>"); 618 .append("</JHDDSJ>");
611 sBuffer.append("</BC>"); 619 sBuffer.append("</BC>");
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -132,7 +132,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -132,7 +132,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
132 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); 132 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
133 t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); 133 t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
134 t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); 134 t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
135 - t.setRq(dBefore); 135 + t.setRq(sdf.parse(rq));
136 repository.save(t); 136 repository.save(t);
137 result = "success"; 137 result = "success";
138 } catch (Exception e) { 138 } catch (Exception e) {
src/main/java/com/bsth/service/realcontrol/RealMapService.java
@@ -13,4 +13,6 @@ public interface RealMapService { @@ -13,4 +13,6 @@ public interface RealMapService {
13 Map<String,Object> findRouteByLine(String lineCode); 13 Map<String,Object> findRouteByLine(String lineCode);
14 14
15 Map<String,Object> findRouteAndStationByLine(String lineCode); 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
@@ -15,7 +15,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -15,7 +15,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
15 15
16 Map<String, Collection<ScheduleRealInfo>> findByLines(String lines); 16 Map<String, Collection<ScheduleRealInfo>> findByLines(String lines);
17 17
18 - Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj/*,String nbbm,String jsy,String spy*/); 18 + Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType);
19 19
20 Map<String, Object> destroy(String idsStr/*, int spaceAdjust*/, String remarks, String reason/*, int spaceNum*/); 20 Map<String, Object> destroy(String idsStr/*, int spaceAdjust*/, String remarks, String reason/*, int spaceNum*/);
21 21
@@ -95,7 +95,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -95,7 +95,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
95 95
96 List<Map<String,Object>> account(String line,String date,String code,String xlName, String type); 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 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String type); 100 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String type);
101 101
@@ -128,4 +128,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -128,4 +128,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
128 Map<String,Object> changeBcType(Long id, String bcType, String remarks); 128 Map<String,Object> changeBcType(Long id, String bcType, String remarks);
129 129
130 Map<String,Object> historySave(ScheduleRealInfo sch); 130 Map<String,Object> historySave(ScheduleRealInfo sch);
  131 +
  132 + Map<String,Object> svgAttr(String jsonStr);
  133 +
  134 + Map<String,Object> findSvgAttr(String idx);
131 } 135 }
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
@@ -122,7 +122,7 @@ public class RealMapServiceImpl implements RealMapService { @@ -122,7 +122,7 @@ public class RealMapServiceImpl implements RealMapService {
122 rs.put("section", secList); 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 List<Map<String, Object>> stationList = jdbcTemplate.queryForList(sql, lineCode); 126 List<Map<String, Object>> stationList = jdbcTemplate.queryForList(sql, lineCode);
127 rs.put("station", stationList); 127 rs.put("station", stationList);
128 128
@@ -134,6 +134,31 @@ public class RealMapServiceImpl implements RealMapService { @@ -134,6 +134,31 @@ public class RealMapServiceImpl implements RealMapService {
134 return rs; 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 * wgs 坐标数组转 百度 163 * wgs 坐标数组转 百度
139 * 164 *