Commit 31bd935227cf09edc23e4df22e3905039087689b

Authored by 潘钊
2 parents 1b8a5ac1 7f3e723b

Merge branch 'minhang' into pudong

# Conflicts:
#	src/main/resources/ms-jdbc.properties
Showing 54 changed files with 3100 additions and 782 deletions

Too many changes to show.

To preserve performance only 54 of 827 files are displayed.

@@ -225,6 +225,12 @@ @@ -225,6 +225,12 @@
225 <artifactId>spring-boot-devtools</artifactId> 225 <artifactId>spring-boot-devtools</artifactId>
226 <optional>true</optional> 226 <optional>true</optional>
227 </dependency>--> 227 </dependency>-->
  228 + <dependency>
  229 + <groupId>com.vividsolutions</groupId>
  230 + <artifactId>jts</artifactId>
  231 + <version>1.13</version>
  232 + </dependency>
  233 +
228 </dependencies> 234 </dependencies>
229 235
230 <dependencyManagement> 236 <dependencyManagement>
src/main/java/com/bsth/controller/BaseController2.java
@@ -187,9 +187,11 @@ public class BaseController2&lt;T, ID extends Serializable&gt; { @@ -187,9 +187,11 @@ public class BaseController2&lt;T, ID extends Serializable&gt; {
187 } 187 }
188 188
189 System.out.println(outputfile.getName()); 189 System.out.println(outputfile.getName());
  190 + System.out.println(outputfile.getAbsolutePath());
  191 +
190 String filePath = outputfile.getAbsolutePath(); 192 String filePath = outputfile.getAbsolutePath();
191 - String fp[] = filePath.split(File.separator);  
192 - String fileName = fp[fp.length - 1]; 193 +// String fp[] = filePath.split(File.separator);
  194 +// String fileName = fp[fp.length - 1];
193 195
194 // TODO:使用ktr获取导出数据 196 // TODO:使用ktr获取导出数据
195 197
src/main/java/com/bsth/controller/BusIntervalController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.service.BusIntervalService;
  13 +
  14 +@RestController
  15 +@RequestMapping("busInterval")
  16 +public class BusIntervalController {
  17 +
  18 + @Autowired
  19 + private BusIntervalService busIntervalService;
  20 +
  21 + @RequestMapping(value = "/getDir", method = RequestMethod.GET)
  22 + public List<Map<String,Object>> getDir(@RequestParam Map<String, Object> map){
  23 + return busIntervalService.getDir(map);
  24 + }
  25 +
  26 + @RequestMapping(value = "/interval", method = RequestMethod.GET)
  27 + public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){
  28 + return busIntervalService.interval(map);
  29 + }
  30 +
  31 + @RequestMapping(value = "/timeAndSpeed", method = RequestMethod.GET)
  32 + public Map<String,Object> timeAndSpeed(@RequestParam Map<String, Object> map){
  33 + return busIntervalService.timeAndSpeed(map);
  34 + }
  35 +
  36 + @RequestMapping(value = "/lineTimeAnaliy", method = RequestMethod.GET)
  37 + public List<Map<String,Object>> lineTimeAnaliy(@RequestParam Map<String, Object> map){
  38 + return busIntervalService.lineTimeAnaliy(map);
  39 + }
  40 +
  41 + @RequestMapping(value = "/lbStatuAnaly", method = RequestMethod.GET)
  42 + public List<Map<String,Object>> lbStatuAnaly(@RequestParam Map<String, Object> map){
  43 + return busIntervalService.lbStatuAnaly(map);
  44 + }
  45 +
  46 + @RequestMapping(value = "/correctStatis", method = RequestMethod.GET)
  47 + public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){
  48 + return busIntervalService.correctStatis(map);
  49 + }
  50 +
  51 +}
src/main/java/com/bsth/controller/forms/ExportController.java
@@ -13,12 +13,15 @@ import org.springframework.web.bind.annotation.RequestMethod; @@ -13,12 +13,15 @@ import org.springframework.web.bind.annotation.RequestMethod;
13 import org.springframework.web.bind.annotation.RequestParam; 13 import org.springframework.web.bind.annotation.RequestParam;
14 import org.springframework.web.bind.annotation.RestController; 14 import org.springframework.web.bind.annotation.RestController;
15 15
  16 +import com.bsth.entity.mcy_forms.Allline;
16 import com.bsth.entity.mcy_forms.Changetochange; 17 import com.bsth.entity.mcy_forms.Changetochange;
  18 +import com.bsth.entity.mcy_forms.Executionrate;
17 import com.bsth.entity.mcy_forms.Linepasswengerflow; 19 import com.bsth.entity.mcy_forms.Linepasswengerflow;
18 import com.bsth.entity.mcy_forms.Operationservice; 20 import com.bsth.entity.mcy_forms.Operationservice;
19 import com.bsth.entity.mcy_forms.Shifday; 21 import com.bsth.entity.mcy_forms.Shifday;
20 import com.bsth.entity.mcy_forms.Shiftuehiclemanth; 22 import com.bsth.entity.mcy_forms.Shiftuehiclemanth;
21 import com.bsth.entity.mcy_forms.Singledata; 23 import com.bsth.entity.mcy_forms.Singledata;
  24 +import com.bsth.entity.mcy_forms.Turnoutrate;
22 import com.bsth.entity.mcy_forms.Vehicleloading; 25 import com.bsth.entity.mcy_forms.Vehicleloading;
23 import com.bsth.entity.mcy_forms.Waybillday; 26 import com.bsth.entity.mcy_forms.Waybillday;
24 import com.bsth.service.forms.ExportService; 27 import com.bsth.service.forms.ExportService;
@@ -28,33 +31,31 @@ import com.bsth.util.ReportUtils; @@ -28,33 +31,31 @@ import com.bsth.util.ReportUtils;
28 @RestController 31 @RestController
29 @RequestMapping("mcy_export") 32 @RequestMapping("mcy_export")
30 public class ExportController { 33 public class ExportController {
31 - 34 +
32 @Autowired 35 @Autowired
33 FormsService formsService; 36 FormsService formsService;
34 37
35 @Autowired 38 @Autowired
36 ExportService exportService; 39 ExportService exportService;
37 -  
38 - //行车路单日报表  
39 - @RequestMapping(value = "/waybilldayExport",method = RequestMethod.POST)  
40 - public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map){ 40 +
  41 + // 行车路单日报表
  42 + @RequestMapping(value = "/waybilldayExport", method = RequestMethod.POST)
  43 + public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map) {
41 List<Waybillday> waybillday = formsService.waybillday(map); 44 List<Waybillday> waybillday = formsService.waybillday(map);
42 exportService.waybillday(map.get("date").toString(), waybillday); 45 exportService.waybillday(map.get("date").toString(), waybillday);
43 return waybillday; 46 return waybillday;
44 } 47 }
45 -  
46 -  
47 - //线路客流量报表  
48 - @RequestMapping(value = "/linepasswengerflowExport",method = RequestMethod.POST)  
49 - public List<Map<String, Object>> linepasswengerflowExport(@RequestParam Map<String, Object> map){  
50 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
51 - sdfSimple = new SimpleDateFormat("yyyyMMdd"); 48 +
  49 + // 线路客流量报表
  50 + @RequestMapping(value = "/linepasswengerflowExport", method = RequestMethod.POST)
  51 + public List<Map<String, Object>> linepasswengerflowExport(@RequestParam Map<String, Object> map) {
  52 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
52 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 53 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
53 ReportUtils ee = new ReportUtils(); 54 ReportUtils ee = new ReportUtils();
54 List<Linepasswengerflow> linepasswengerflow = formsService.linepasswengerflow(map); 55 List<Linepasswengerflow> linepasswengerflow = formsService.linepasswengerflow(map);
55 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 56 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
56 - int i=1;  
57 - for(Linepasswengerflow l : linepasswengerflow){ 57 + int i = 1;
  58 + for (Linepasswengerflow l : linepasswengerflow) {
58 Map<String, Object> m = new HashMap<String, Object>(); 59 Map<String, Object> m = new HashMap<String, Object>();
59 m.put("i", i); 60 m.put("i", i);
60 m.put("stationName", l.getStationName()); 61 m.put("stationName", l.getStationName());
@@ -62,78 +63,76 @@ public class ExportController { @@ -62,78 +63,76 @@ public class ExportController {
62 m.put("2", " "); 63 m.put("2", " ");
63 resList.add(m); 64 resList.add(m);
64 i++; 65 i++;
65 - }  
66 -  
67 - try { 66 + }
  67 +
  68 +
  69 +
  70 + try {
68 listI.add(resList.iterator()); 71 listI.add(resList.iterator());
69 - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";  
70 - ee.excelReplace(listI, new Object[] { map }, path+"mould\\linepassengerflow.xls",  
71 - path+"export\\线路客流量报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");  
72 - } catch (Exception e) {  
73 - e.printStackTrace();  
74 - } 72 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  73 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\linepasswengerflow.xls",
  74 + path + "export\\线路客流量报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  75 + } catch (Exception e) {
  76 + e.printStackTrace();
  77 + }
75 return resList; 78 return resList;
76 } 79 }
77 80
78 -  
79 -  
80 - //班次车辆人员日统计  
81 - @RequestMapping(value = "/shifdayExport",method = RequestMethod.POST)  
82 - public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map){  
83 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
84 - sdfSimple = new SimpleDateFormat("yyyyMMdd"); 81 + // 班次车辆人员日统计
  82 + @RequestMapping(value = "/shifdayExport", method = RequestMethod.POST)
  83 + public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) {
  84 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
85 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 85 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
86 ReportUtils ee = new ReportUtils(); 86 ReportUtils ee = new ReportUtils();
87 List<Shifday> shifday = formsService.shifday(map); 87 List<Shifday> shifday = formsService.shifday(map);
88 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 88 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
89 - for(Shifday l : shifday){ 89 + for (Shifday l : shifday) {
90 Map<String, Object> m = new HashMap<String, Object>(); 90 Map<String, Object> m = new HashMap<String, Object>();
91 - m.put("jName",l.getjName()); 91 + m.put("jName", l.getjName());
92 m.put("sName", l.getsName()); 92 m.put("sName", l.getsName());
93 m.put("lpName", l.getLpName()); 93 m.put("lpName", l.getLpName());
94 m.put("carPlate", l.getCarPlate()); 94 m.put("carPlate", l.getCarPlate());
95 m.put("jhlc", l.getJhlc()); 95 m.put("jhlc", l.getJhlc());
96 - //m.put("sjjhlc", l.getSjjhlc()); 96 + // m.put("sjjhlc", l.getSjjhlc());
97 m.put("yygl", l.getYygl()); 97 m.put("yygl", l.getYygl());
98 m.put("emptMileage", l.getEmptMileage()); 98 m.put("emptMileage", l.getEmptMileage());
99 m.put("remMileage", l.getRemMileage()); 99 m.put("remMileage", l.getRemMileage());
100 m.put("addMileage", l.getAddMileage()); 100 m.put("addMileage", l.getAddMileage());
101 m.put("totalm", l.getTotalm()); 101 m.put("totalm", l.getTotalm());
102 m.put("jhbc", l.getJhbc()); 102 m.put("jhbc", l.getJhbc());
103 - //m.put("sjjhbc", l.getSjjhbc()); 103 + // m.put("sjjhbc", l.getSjjhbc());
104 m.put("cjbc", l.getCjbc()); 104 m.put("cjbc", l.getCjbc());
105 m.put("ljbc", l.getLjbc()); 105 m.put("ljbc", l.getLjbc());
106 m.put("sjbc", l.getSjbc()); 106 m.put("sjbc", l.getSjbc());
107 resList.add(m); 107 resList.add(m);
108 - }  
109 -  
110 - try { 108 + }
  109 +
  110 + try {
111 listI.add(resList.iterator()); 111 listI.add(resList.iterator());
112 - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";  
113 - ee.excelReplace(listI, new Object[] { map }, path+"mould\\shifday.xls",  
114 - path+"export\\班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");  
115 - } catch (Exception e) {  
116 - e.printStackTrace();  
117 - } 112 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  113 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\shifday.xls",
  114 + path + "export\\班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  115 + } catch (Exception e) {
  116 + e.printStackTrace();
  117 + }
118 return resList; 118 return resList;
119 } 119 }
120 -  
121 - //班次车辆人员月统计  
122 - @RequestMapping(value = "/shiftuehiclemanthExport",method = RequestMethod.POST)  
123 - public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map){  
124 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
125 - sdfSimple = new SimpleDateFormat("yyyyMMdd"); 120 +
  121 + // 班次车辆人员月统计
  122 + @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.POST)
  123 + public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map) {
  124 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
126 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 125 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
127 ReportUtils ee = new ReportUtils(); 126 ReportUtils ee = new ReportUtils();
128 List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map); 127 List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map);
129 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 128 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
130 - int i=1;  
131 - for(Shiftuehiclemanth l : shiftuehiclemanth){ 129 + int i = 1;
  130 + for (Shiftuehiclemanth l : shiftuehiclemanth) {
132 Map<String, Object> m = new HashMap<String, Object>(); 131 Map<String, Object> m = new HashMap<String, Object>();
133 m.put("i", i); 132 m.put("i", i);
134 - m.put("jName",l.getjName() ); 133 + m.put("jName", l.getjName());
135 m.put("jhlc", l.getJhlc()); 134 m.put("jhlc", l.getJhlc());
136 - m.put("emptMileage",l.getEmptMileage() ); 135 + m.put("emptMileage", l.getEmptMileage());
137 m.put("remMileage", l.getRemMileage()); 136 m.put("remMileage", l.getRemMileage());
138 m.put("addMileage", l.getAddMileage()); 137 m.put("addMileage", l.getAddMileage());
139 m.put("totalm", l.getTotalm()); 138 m.put("totalm", l.getTotalm());
@@ -142,39 +141,37 @@ public class ExportController { @@ -142,39 +141,37 @@ public class ExportController {
142 m.put("sjbc", l.getSjbc()); 141 m.put("sjbc", l.getSjbc());
143 resList.add(m); 142 resList.add(m);
144 i++; 143 i++;
145 - }  
146 -  
147 - try { 144 + }
  145 +
  146 + try {
148 listI.add(resList.iterator()); 147 listI.add(resList.iterator());
149 -  
150 - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";  
151 - ee.excelReplace(listI, new Object[] { map }, path+"mould\\shiftuehiclemanth.xls",  
152 - path+"export\\班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");  
153 -  
154 - } catch (Exception e) {  
155 - e.printStackTrace();  
156 - }  
157 - 148 +
  149 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  150 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\shiftuehiclemanth.xls", path
  151 + + "export\\班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  152 +
  153 + } catch (Exception e) {
  154 + e.printStackTrace();
  155 + }
  156 +
158 return resList; 157 return resList;
159 } 158 }
160 -  
161 159
162 - //路单数据报表  
163 - @RequestMapping(value = "/singledataExport",method = RequestMethod.POST)  
164 - public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map){  
165 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
166 - sdfSimple = new SimpleDateFormat("yyyyMMdd"); 160 + // 路单数据报表
  161 + @RequestMapping(value = "/singledataExport", method = RequestMethod.POST)
  162 + public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map) {
  163 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
167 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 164 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
168 ReportUtils ee = new ReportUtils(); 165 ReportUtils ee = new ReportUtils();
169 List<Singledata> singledata = formsService.singledata(map); 166 List<Singledata> singledata = formsService.singledata(map);
170 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 167 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
171 - int i=1;  
172 - for(Singledata l : singledata){ 168 + int i = 1;
  169 + for (Singledata l : singledata) {
173 Map<String, Object> m = new HashMap<String, Object>(); 170 Map<String, Object> m = new HashMap<String, Object>();
174 m.put("i", i); 171 m.put("i", i);
175 - m.put("rQ",l.getrQ()); 172 + m.put("rQ", l.getrQ());
176 m.put("gS", l.getgS()); 173 m.put("gS", l.getgS());
177 - m.put("xL",l.getxL() ); 174 + m.put("xL", l.getxL());
178 m.put("clzbh", l.getClzbh()); 175 m.put("clzbh", l.getClzbh());
179 m.put("jsy", l.getJsy()); 176 m.put("jsy", l.getJsy());
180 m.put("jName", l.getjName()); 177 m.put("jName", l.getjName());
@@ -184,43 +181,43 @@ public class ExportController { @@ -184,43 +181,43 @@ public class ExportController {
184 m.put("emptMileage", l.getEmptMileage()); 181 m.put("emptMileage", l.getEmptMileage());
185 m.put("hyl", l.getHyl()); 182 m.put("hyl", l.getHyl());
186 m.put("jzl", l.getJzl()); 183 m.put("jzl", l.getJzl());
187 - m.put("unyyyl",l.getUnyyyl()); 184 + m.put("unyyyl", l.getUnyyyl());
188 m.put("jhjl", l.getJhjl()); 185 m.put("jhjl", l.getJhjl());
189 resList.add(m); 186 resList.add(m);
190 i++; 187 i++;
191 - }  
192 -  
193 - try { 188 + }
  189 +
  190 + try {
194 listI.add(resList.iterator()); 191 listI.add(resList.iterator());
195 - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";  
196 - ee.excelReplace(listI, new Object[] { map }, path+"mould\\singledata.xls",  
197 - path+"export\\路单报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");  
198 - } catch (Exception e) {  
199 - e.printStackTrace();  
200 - }  
201 - 192 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  193 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\singledata.xls",
  194 + path + "export\\路单数据" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  195 + } catch (Exception e) {
  196 + e.printStackTrace();
  197 + }
  198 +
202 return resList; 199 return resList;
203 } 200 }
204 -  
205 - //车辆加注  
206 - @RequestMapping(value = "/vehicleloadingExport",method = RequestMethod.POST)  
207 - public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map){  
208 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
209 - sdfSimple = new SimpleDateFormat("yyyyMMdd"); 201 +
  202 + // 车辆加注
  203 + @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.POST)
  204 + public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) {
  205 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
210 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 206 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
211 ReportUtils ee = new ReportUtils(); 207 ReportUtils ee = new ReportUtils();
212 - List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(), map.get("date").toString()); 208 + List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("gsdmVehic").toString(),map.get("fgsdmVehic").toString(),map.get("line").toString(),
  209 + map.get("data").toString());
213 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 210 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
214 - int i=1;  
215 - for(Vehicleloading l : vehicleloading){ 211 + int i = 1;
  212 + for (Vehicleloading l : vehicleloading) {
216 Map<String, Object> m = new HashMap<String, Object>(); 213 Map<String, Object> m = new HashMap<String, Object>();
217 m.put("i", i); 214 m.put("i", i);
218 m.put("rQ", l.getrQ()); 215 m.put("rQ", l.getrQ());
219 m.put("gS", l.getgS()); 216 m.put("gS", l.getgS());
220 m.put("xL", l.getxL()); 217 m.put("xL", l.getxL());
221 m.put("clzbh", l.getClzbh()); 218 m.put("clzbh", l.getClzbh());
222 - m.put("hyl", l.getHyl());  
223 m.put("jzl", l.getJzl()); 219 m.put("jzl", l.getJzl());
  220 + m.put("hyl", l.getHyl());
224 m.put("ls", l.getLs()); 221 m.put("ls", l.getLs());
225 m.put("jhlc", l.getJhlc()); 222 m.put("jhlc", l.getJhlc());
226 m.put("unyyyl", l.getUnyyyl()); 223 m.put("unyyyl", l.getUnyyyl());
@@ -228,96 +225,203 @@ public class ExportController { @@ -228,96 +225,203 @@ public class ExportController {
228 m.put("sjbc", l.getSjbc()); 225 m.put("sjbc", l.getSjbc());
229 resList.add(m); 226 resList.add(m);
230 i++; 227 i++;
231 - }  
232 -  
233 - try { 228 + }
  229 +
  230 + try {
234 listI.add(resList.iterator()); 231 listI.add(resList.iterator());
235 - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";  
236 - ee.excelReplace(listI, new Object[] { map }, path+"mould\\vehicleloading.xls",  
237 - path+"export\\车辆加注" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");  
238 - } catch (Exception e) {  
239 - e.printStackTrace();  
240 - } 232 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  233 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\vehicleloading.xls",
  234 + path + "export\\车辆加注" + sdfSimple.format(sdfMonth.parse(map.get("dat").toString())) + ".xls");
  235 + } catch (Exception e) {
  236 + e.printStackTrace();
  237 + }
241 return resList; 238 return resList;
242 } 239 }
243 -  
244 - //运营服务阶段报表  
245 - @RequestMapping(value = "/operationserviceExport",method = RequestMethod.POST)  
246 - public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map){  
247 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
248 - sdfSimple = new SimpleDateFormat("yyyyMMdd"); 240 +
  241 + // 运营服务阶段报表
  242 + @RequestMapping(value = "/operationserviceExport", method = RequestMethod.POST)
  243 + public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map) {
  244 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
249 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 245 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
250 ReportUtils ee = new ReportUtils(); 246 ReportUtils ee = new ReportUtils();
251 List<Operationservice> operationservice = formsService.operationservice(map); 247 List<Operationservice> operationservice = formsService.operationservice(map);
252 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 248 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
253 - int i=1;  
254 - for(Operationservice l : operationservice){  
255 - Map<String, Object> m = new HashMap<String, Object>();  
256 - m.put("i", i);  
257 - m.put("xlName", l.getXlName());  
258 - m.put("jzl", l.getJzl());  
259 - m.put("xhl", l.getXhl());  
260 - m.put("xsgl", l.getXsgl());  
261 - m.put("emptMileage", l.getEmptMileage());  
262 - m.put("sjbc", l.getSjbc());  
263 - resList.add(m);  
264 - i++; 249 + int i = 1;
  250 + for (Operationservice l : operationservice) {
  251 + Map<String, Object> m = new HashMap<String, Object>();
  252 + m.put("i", i);
  253 + m.put("xlName", l.getXlName());
  254 + m.put("jzl", l.getJzl());
  255 + m.put("xhl", l.getXhl());
  256 + m.put("xsgl", l.getXsgl());
  257 + m.put("emptMileage", l.getEmptMileage());
  258 + m.put("sjbc", l.getSjbc());
  259 + resList.add(m);
  260 + i++;
  261 + }
  262 +
  263 + try {
  264 + listI.add(resList.iterator());
  265 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  266 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\operationservice.xls", path + "export\\运营服务阶段报表"
  267 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  268 + } catch (Exception e) {
  269 + e.printStackTrace();
  270 + }
  271 + return resList;
  272 + }
  273 +
  274 + // 换人换车情况日统计
  275 + @RequestMapping(value = "/changetochangeExport", method = RequestMethod.POST)
  276 + public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map) {
  277 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  278 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  279 + ReportUtils ee = new ReportUtils();
  280 + List<Changetochange> changetochange = formsService.changetochange(map);
  281 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  282 + for (Changetochange l : changetochange) {
  283 + Map<String, Object> m = new HashMap<String, Object>();
  284 + m.put("rq", l.getRq());
  285 + m.put("gs", l.getGs());
  286 + m.put("fgs", l.getFgs());
  287 + m.put("xl", l.getXl());
  288 + m.put("lp", l.getLp());
  289 + m.put("fssj", l.getFssj());
  290 + m.put("xgsj", l.getXgsj());
  291 + m.put("pcch", l.getPcch());
  292 + m.put("pcry", l.getPcry());
  293 + m.put("jhch", l.getJhch());
  294 + m.put("jhgh", l.getJhgh());
  295 + m.put("sjch", l.getSjch());
  296 + m.put("sjgh", l.getSjgh());
  297 + m.put("yy", l.getYy());
  298 + m.put("xgr", l.getXgr());
  299 + resList.add(m);
265 } 300 }
266 - 301 +
267 try { 302 try {
268 listI.add(resList.iterator()); 303 listI.add(resList.iterator());
269 - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";  
270 - ee.excelReplace(listI, new Object[] { map }, path+"mould\\operationservice.xls",  
271 - path+"export\\运营服务阶段报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");  
272 - } catch (Exception e) {  
273 - e.printStackTrace();  
274 - } 304 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  305 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\changetochange.xls", path + "export\\换人换车情况日统计"
  306 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  307 + } catch (Exception e) {
  308 + e.printStackTrace();
  309 + }
275 return resList; 310 return resList;
276 } 311 }
277 -  
278 312
279 - //换人换车情况日统计  
280 - @RequestMapping(value = "/changetochangeExport",method = RequestMethod.POST)  
281 - public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map){  
282 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
283 - sdfSimple = new SimpleDateFormat("yyyyMMdd");  
284 - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();  
285 - ReportUtils ee = new ReportUtils();  
286 - List<Changetochange> changetochange = formsService.changetochange(map);  
287 - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();  
288 - for(Changetochange l : changetochange){ 313 + // 营运线路出车率统计表
  314 + @RequestMapping(value = "/turnoutrateExport", method = RequestMethod.POST)
  315 + public List<Map<String, Object>> turnoutrateExport(@RequestParam Map<String, Object> map) {
  316 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  317 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  318 + ReportUtils ee = new ReportUtils();
  319 + List<Turnoutrate> turnoutrate = formsService.turnoutrate(map);
  320 + Map<String, Object> map1 = new HashMap<String, Object>();
  321 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  322 + for (Turnoutrate l : turnoutrate) {
289 Map<String, Object> m = new HashMap<String, Object>(); 323 Map<String, Object> m = new HashMap<String, Object>();
290 - m.put("rq",l.getRq());  
291 - m.put("gs",l.getGs());  
292 - m.put("fgs",l.getFgs());  
293 - m.put("xl",l.getXl());  
294 - m.put("lp",l.getLp());  
295 - m.put("fssj",l.getFssj());  
296 - m.put("xgsj",l.getXgsj());  
297 - m.put("pcch",l.getPcch());  
298 - m.put("pcry",l.getPcry());  
299 - m.put("jhch",l.getJhch());  
300 - m.put("jhgh",l.getJhgh());  
301 - m.put("sjch",l.getSjch());  
302 - m.put("sjgh",l.getSjgh());  
303 - m.put("yy",l.getYy());  
304 - m.put("xgr",l.getXgr()); 324 + m.put("rq", l.getRq());
  325 + m.put("gs", l.getGs());
  326 + m.put("zhgs", l.getZhgs());
  327 + m.put("xl", l.getXl());
  328 + m.put("cchjh", l.getCchjh());
  329 + m.put("cchsj", l.getCchsj());
  330 + m.put("cchqz", l.getCchqz());
  331 + m.put("chl", l.getChl());
  332 + m.put("bcjh", l.getBcjh());
  333 + m.put("bcsj", l.getBbzxl());
  334 + m.put("bbzxl", l.getBbzxl());
  335 + m.put("sm", l.getSm());
305 resList.add(m); 336 resList.add(m);
306 - }  
307 -  
308 - try {  
309 - listI.add(resList.iterator());  
310 - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";  
311 - ee.excelReplace(listI, new Object[] { map }, path+"mould\\changetochange.xls",  
312 - path+"export\\换人换车情况日统计" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");  
313 - } catch (Exception e) {  
314 - e.printStackTrace();  
315 - }  
316 - return resList;  
317 } 337 }
318 -  
319 - 338 +
  339 + try {
  340 + listI.add(resList.iterator());
  341 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  342 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould\\turnoutrate.xls", path + "export\\营运线路出车率统计表"
  343 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  344 + } catch (Exception e) {
  345 + e.printStackTrace();
  346 + }
  347 + return resList;
  348 + }
  349 +
  350 + //营运线路出车率统计表
  351 + @RequestMapping(value = "/executionrateExport", method = RequestMethod.POST)
  352 + public List<Map<String, Object>> executionrateExport(@RequestParam Map<String, Object> map) {
  353 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  354 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  355 + ReportUtils ee = new ReportUtils();
  356 + List<Executionrate> executionrate = formsService.executionrate(map);
  357 + Map<String, Object> map1 = new HashMap<String, Object>();
  358 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  359 + for (Executionrate l : executionrate) {
  360 + Map<String, Object> m = new HashMap<String, Object>();
  361 + m.put("rq", l.getRq());
  362 + m.put("gs", l.getGs());
  363 + m.put("zhgs", l.getZhgs());
  364 + m.put("xl", l.getXl());
  365 + m.put("cchjh", l.getCchjh());
  366 + m.put("cchsj", l.getCchsj());
  367 + m.put("chl", l.getChl());
  368 + m.put("bcjh", l.getBcjh());
  369 + m.put("bcsj", l.getBbzxl());
  370 + m.put("bbzxl", l.getBbzxl());
  371 + m.put("sm", l.getSm());
  372 + resList.add(m);
  373 + }
  374 +
  375 + try {
  376 + listI.add(resList.iterator());
  377 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  378 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould\\executionrate.xls", path + "export\\班次执行率统计表"
  379 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  380 + } catch (Exception e) {
  381 + e.printStackTrace();
  382 + }
  383 + return resList;
  384 + }
  385 +
320 386
  387 + ////营运线路名称统计表
  388 + @RequestMapping(value = "/alllineExport", method = RequestMethod.POST)
  389 + public List<Map<String, Object>> alllineExport(@RequestParam Map<String, Object> map) {
  390 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  391 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  392 + ReportUtils ee = new ReportUtils();
  393 + List<Allline> allline = formsService.allline(map);
  394 + Map<String, Object> map1 = new HashMap<String, Object>();
  395 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  396 + for (Allline l : allline) {
  397 + Map<String, Object> m = new HashMap<String, Object>();
  398 + m.put("rq", l.getRq());
  399 + m.put("gs", l.getGs());
  400 + m.put("zhgs", l.getZhgs());
  401 + m.put("xl", l.getXl());
  402 + m.put("cchjh", l.getCchjh());
  403 + m.put("cchsj", l.getCchsj());
  404 + m.put("chl", l.getChl());
  405 + m.put("bcjh", l.getBcjh());
  406 + m.put("bcsj", l.getBbzxl());
  407 + m.put("bbzxl", l.getBbzxl());
  408 + m.put("sm", l.getSm());
  409 + resList.add(m);
  410 + }
  411 +
  412 + try {
  413 + listI.add(resList.iterator());
  414 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  415 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould\\allline.xls", path + "export\\营运线路名称统计表"
  416 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  417 + } catch (Exception e) {
  418 + e.printStackTrace();
  419 + }
  420 + return resList;
  421 + }
321 422
322 423
  424 +
  425 +
  426 +
323 } 427 }
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
@@ -9,12 +9,15 @@ import org.springframework.web.bind.annotation.RequestMethod; @@ -9,12 +9,15 @@ import org.springframework.web.bind.annotation.RequestMethod;
9 import org.springframework.web.bind.annotation.RequestParam; 9 import org.springframework.web.bind.annotation.RequestParam;
10 import org.springframework.web.bind.annotation.RestController; 10 import org.springframework.web.bind.annotation.RestController;
11 11
  12 +import com.bsth.entity.mcy_forms.Allline;
12 import com.bsth.entity.mcy_forms.Changetochange; 13 import com.bsth.entity.mcy_forms.Changetochange;
  14 +import com.bsth.entity.mcy_forms.Executionrate;
13 import com.bsth.entity.mcy_forms.Linepasswengerflow; 15 import com.bsth.entity.mcy_forms.Linepasswengerflow;
14 import com.bsth.entity.mcy_forms.Operationservice; 16 import com.bsth.entity.mcy_forms.Operationservice;
15 import com.bsth.entity.mcy_forms.Shifday; 17 import com.bsth.entity.mcy_forms.Shifday;
16 import com.bsth.entity.mcy_forms.Shiftuehiclemanth; 18 import com.bsth.entity.mcy_forms.Shiftuehiclemanth;
17 import com.bsth.entity.mcy_forms.Singledata; 19 import com.bsth.entity.mcy_forms.Singledata;
  20 +import com.bsth.entity.mcy_forms.Turnoutrate;
18 import com.bsth.entity.mcy_forms.Vehicleloading; 21 import com.bsth.entity.mcy_forms.Vehicleloading;
19 import com.bsth.entity.mcy_forms.Waybillday; 22 import com.bsth.entity.mcy_forms.Waybillday;
20 import com.bsth.service.forms.FormsService; 23 import com.bsth.service.forms.FormsService;
@@ -23,77 +26,90 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService; @@ -23,77 +26,90 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService;
23 @RestController 26 @RestController
24 @RequestMapping("mcy_forms") 27 @RequestMapping("mcy_forms")
25 public class MCY_FormsController { 28 public class MCY_FormsController {
26 - 29 +
27 @Autowired 30 @Autowired
28 FormsService formsService; 31 FormsService formsService;
29 - 32 +
30 @Autowired 33 @Autowired
31 ScheduleRealInfoService scheduleRealInfoService; 34 ScheduleRealInfoService scheduleRealInfoService;
32 -  
33 - //行车路单日报表  
34 - @RequestMapping(value = "/waybillday",method = RequestMethod.POST)  
35 - public List<Waybillday> waybillday(@RequestParam Map<String, Object> map){  
36 -  
37 -  
38 -// scheduleRealInfoService.findKMBC(jName, clZbh, lpName, date) 35 +
  36 + // 行车路单日报表
  37 +
  38 + @RequestMapping(value = "/waybillday", method = RequestMethod.POST)
  39 + public List<Waybillday> waybillday(@RequestParam Map<String, Object> map) {
  40 +
  41 + // scheduleRealInfoService.findKMBC(jName, clZbh, lpName, date)
39 return formsService.waybillday(map); 42 return formsService.waybillday(map);
40 } 43 }
41 -  
42 - @RequestMapping(value = "/waybilldayExcel")  
43 - public List<Waybillday> dailyInfo(@RequestParam Map<String, Object> map) {  
44 - return formsService.waybilldayExcel(map);  
45 - }  
46 -  
47 -  
48 - //线路客流量报表  
49 - @RequestMapping(value = "/linepasswengerflow",method = RequestMethod.POST)  
50 - public List<Linepasswengerflow> linepasswengerflow(@RequestParam Map<String, Object> map){  
51 - 44 +
  45 + // 线路客流量报表
  46 +
  47 + @RequestMapping(value = "/linepasswengerflow", method = RequestMethod.POST)
  48 + public List<Linepasswengerflow> linepasswengerflow(@RequestParam Map<String, Object> map) {
  49 +
52 return formsService.linepasswengerflow(map); 50 return formsService.linepasswengerflow(map);
53 } 51 }
54 -  
55 -  
56 -  
57 - //班次车辆人员月报表  
58 - @RequestMapping(value = "/shiftuehiclemanth",method = RequestMethod.POST)  
59 - public List<Shiftuehiclemanth> shiftuehiclemanth(@RequestParam Map<String, Object> map){  
60 - 52 +
  53 + // 班次车辆人员月报表
  54 + @RequestMapping(value = "/shiftuehiclemanth", method = RequestMethod.POST)
  55 + public List<Shiftuehiclemanth> shiftuehiclemanth(@RequestParam Map<String, Object> map) {
  56 +
61 return formsService.shiftuehiclemanth(map); 57 return formsService.shiftuehiclemanth(map);
62 } 58 }
63 -  
64 -  
65 - //班次车辆人员日统计  
66 - @RequestMapping(value = "/shifday",method = RequestMethod.POST)  
67 - public List<Shifday> shifday(@RequestParam Map<String, Object> map){  
68 - 59 +
  60 + // 班次车辆人员日统计
  61 + @RequestMapping(value = "/shifday", method = RequestMethod.POST)
  62 + public List<Shifday> shifday(@RequestParam Map<String, Object> map) {
  63 +
69 return formsService.shifday(map); 64 return formsService.shifday(map);
70 } 65 }
71 -  
72 - //换人换车情况统计表  
73 - @RequestMapping(value = "/changetochange",method = RequestMethod.POST)  
74 - public List<Changetochange> changetochange(@RequestParam Map<String, Object> map){  
75 - 66 +
  67 + // 换人换车情况统计表
  68 + @RequestMapping(value = "/changetochange", method = RequestMethod.POST)
  69 + public List<Changetochange> changetochange(@RequestParam Map<String, Object> map) {
  70 +
76 return formsService.changetochange(map); 71 return formsService.changetochange(map);
77 } 72 }
78 -  
79 - //路单数据  
80 - @RequestMapping(value = "/singledata",method = RequestMethod.POST)  
81 - public List<Singledata> singledata(@RequestParam Map<String, Object> map){  
82 - 73 +
  74 + // 路单数据
  75 + @RequestMapping(value = "/singledata", method = RequestMethod.POST)
  76 + public List<Singledata> singledata(@RequestParam Map<String, Object> map) {
  77 +
83 return formsService.singledata(map); 78 return formsService.singledata(map);
84 - }  
85 -  
86 - //车辆加注  
87 - @RequestMapping(value = "/vehicleloading",method = RequestMethod.POST)  
88 - public List<Vehicleloading> vehicleloading(@RequestParam String line ,@RequestParam String data){  
89 - return formsService.vehicleloading(line,data);  
90 } 79 }
91 - //运营服务阶段报表  
92 - @RequestMapping(value = "/operationservice",method = RequestMethod.POST)  
93 - public List<Operationservice> operationservice(@RequestParam Map<String, Object> map){  
94 - 80 +
  81 + // 车辆加注
  82 + @RequestMapping(value = "/vehicleloading", method = RequestMethod.POST)
  83 + public List<Vehicleloading> vehicleloading(@RequestParam String gsdmVehic, @RequestParam String fgsdmVehic,
  84 + @RequestParam String line, @RequestParam String data) {
  85 + return formsService.vehicleloading(gsdmVehic, fgsdmVehic, line, data);
  86 + }
  87 +
  88 + // 运营服务阶段报表
  89 + @RequestMapping(value = "/operationservice", method = RequestMethod.POST)
  90 + public List<Operationservice> operationservice(@RequestParam Map<String, Object> map) {
  91 +
95 return formsService.operationservice(map); 92 return formsService.operationservice(map);
96 } 93 }
97 -  
98 - 94 +
  95 + // 营运线路出车率统计表
  96 + @RequestMapping(value = "/turnoutrate", method = RequestMethod.POST)
  97 + public List<Turnoutrate> turnoutrate(@RequestParam Map<String, Object> map) {
  98 +
  99 + return formsService.turnoutrate(map);
  100 + }
  101 +
  102 + // 班次执行率统计表
  103 + @RequestMapping(value = "/executionrate", method = RequestMethod.POST)
  104 + public List<Executionrate> executionrate(@RequestParam Map<String, Object> map) {
  105 +
  106 + return formsService.executionrate(map);
  107 + }
  108 +
  109 + // 营运线路名称统计表
  110 + @RequestMapping(value = "/allline", method = RequestMethod.POST)
  111 + public List<Allline> allline(@RequestParam Map<String, Object> map) {
  112 +
  113 + return formsService.allline(map);
  114 + }
99 } 115 }
src/main/java/com/bsth/controller/gps/GpsController.java
1 package com.bsth.controller.gps; 1 package com.bsth.controller.gps;
2 2
3 -import java.util.List;  
4 -import java.util.Map;  
5 -  
6 -import org.springframework.beans.factory.annotation.Autowired;  
7 -import org.springframework.web.bind.annotation.*;  
8 -  
9 import com.bsth.data.BasicData; 3 import com.bsth.data.BasicData;
10 import com.bsth.data.gpsdata.GpsEntity; 4 import com.bsth.data.gpsdata.GpsEntity;
11 import com.bsth.data.gpsdata.GpsRealData; 5 import com.bsth.data.gpsdata.GpsRealData;
12 import com.bsth.service.gps.GpsService; 6 import com.bsth.service.gps.GpsService;
13 import com.google.common.base.Splitter; 7 import com.google.common.base.Splitter;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.*;
  10 +
  11 +import java.util.List;
  12 +import java.util.Map;
14 13
15 @RestController 14 @RestController
16 @RequestMapping("gps") 15 @RequestMapping("gps")
@@ -70,7 +69,7 @@ public class GpsController { @@ -70,7 +69,7 @@ public class GpsController {
70 return gpsService.history(nbbmArray, st, et); 69 return gpsService.history(nbbmArray, st, et);
71 } 70 }
72 71
73 - /*@RequestMapping(value = "/arrival/ram") 72 + /*@RequestMapping(value = "/analyse/ram")
74 public List<ArrivalInfo> ramData(@RequestParam String nbbm) { 73 public List<ArrivalInfo> ramData(@RequestParam String nbbm) {
75 return ArrivalDataBuffer.allMap.get(nbbm); 74 return ArrivalDataBuffer.allMap.get(nbbm);
76 }*/ 75 }*/
@@ -84,4 +83,9 @@ public class GpsController { @@ -84,4 +83,9 @@ public class GpsController {
84 public Map<String, Object> findBuffAeraByCode(@RequestParam String code,@RequestParam String type){ 83 public Map<String, Object> findBuffAeraByCode(@RequestParam String code,@RequestParam String type){
85 return gpsService.findBuffAeraByCode(code, type); 84 return gpsService.findBuffAeraByCode(code, type);
86 } 85 }
  86 +
  87 + @RequestMapping(value = "/findRoadSpeed")
  88 + public Map<String, Object> findRoadSpeed(@RequestParam String lineCode){
  89 + return gpsService.findRoadSpeed(lineCode);
  90 + }
87 } 91 }
src/main/java/com/bsth/controller/oil/CwjyController.java
@@ -5,7 +5,6 @@ import java.util.Date; @@ -5,7 +5,6 @@ import java.util.Date;
5 import java.util.Map; 5 import java.util.Map;
6 6
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
8 -import org.springframework.web.bind.annotation.PathVariable;  
9 import org.springframework.web.bind.annotation.RequestMapping; 8 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RequestMethod; 9 import org.springframework.web.bind.annotation.RequestMethod;
11 import org.springframework.web.bind.annotation.RequestParam; 10 import org.springframework.web.bind.annotation.RequestParam;
@@ -62,5 +61,4 @@ public class CwjyController extends BaseController&lt;Cwjy, Integer&gt;{ @@ -62,5 +61,4 @@ public class CwjyController extends BaseController&lt;Cwjy, Integer&gt;{
62 return map; 61 return map;
63 } 62 }
64 63
65 -  
66 } 64 }
src/main/java/com/bsth/controller/oil/CylController.java
@@ -22,7 +22,6 @@ public class CylController extends BaseController&lt;Cyl, Integer&gt;{ @@ -22,7 +22,6 @@ public class CylController extends BaseController&lt;Cyl, Integer&gt;{
22 @RequestMapping(value = "/save",method = RequestMethod.POST) 22 @RequestMapping(value = "/save",method = RequestMethod.POST)
23 public Map<String, Object> saveYlb(Cyl t){ 23 public Map<String, Object> saveYlb(Cyl t){
24 // SysUser user = SecurityUtils.getCurrentUser(); 24 // SysUser user = SecurityUtils.getCurrentUser();
25 - t.setGsdm("77");  
26 t.setUpdatetime(new Date()); 25 t.setUpdatetime(new Date());
27 /*SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); 26 /*SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
28 try { 27 try {
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
1 package com.bsth.controller.realcontrol; 1 package com.bsth.controller.realcontrol;
2 2
3 -import java.util.HashMap;  
4 -import java.util.List;  
5 -import java.util.Map;  
6 -  
7 -import org.springframework.web.bind.annotation.RequestMapping;  
8 -import org.springframework.web.bind.annotation.RestController;  
9 -  
10 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
11 import com.alibaba.fastjson.serializer.PropertyFilter; 4 import com.alibaba.fastjson.serializer.PropertyFilter;
12 import com.bsth.data.BasicData; 5 import com.bsth.data.BasicData;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RestController;
  8 +
  9 +import java.util.HashMap;
  10 +import java.util.List;
  11 +import java.util.Map;
13 12
14 @RestController 13 @RestController
15 @RequestMapping("/basic") 14 @RequestMapping("/basic")
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
@@ -23,16 +23,40 @@ public class RealMapController { @@ -23,16 +23,40 @@ public class RealMapController {
23 * 根据线路获取站点路由及空间数据 23 * 根据线路获取站点路由及空间数据
24 */ 24 */
25 @RequestMapping(value = "/stationSpatialData") 25 @RequestMapping(value = "/stationSpatialData")
26 - public Map<String, Object> stationSpatialData(@RequestParam String idx){ 26 + public Map<String, Object> stationSpatialData(@RequestParam String idx) {
27 return realMapService.stationSpatialData(idx); 27 return realMapService.stationSpatialData(idx);
28 } 28 }
29 29
30 /** 30 /**
31 * 停车场 31 * 停车场
  32 + *
32 * @return 33 * @return
33 */ 34 */
34 @RequestMapping(value = "/carParkSpatialData") 35 @RequestMapping(value = "/carParkSpatialData")
35 - public Map<String, Object> carParkSpatialData(){ 36 + public Map<String, Object> carParkSpatialData() {
36 return realMapService.carParkSpatialData(); 37 return realMapService.carParkSpatialData();
37 } 38 }
  39 +
  40 +
  41 + /**
  42 + * @param @param lineCode
  43 + * @throws
  44 + * @Title: findRouteByLine
  45 + * @Description: TODO(获取线路的站点,路段路由)
  46 + */
  47 + @RequestMapping(value = "/findRouteByLine")
  48 + public Map<String, Object> findRouteByLine(@RequestParam String lineCode) {
  49 + return realMapService.findRouteByLine(lineCode);
  50 + }
  51 +
  52 +
  53 + /**
  54 + * 获取线路的路段路由 和 站点路由信息 (为前端站间距计算提供数据源)
  55 + * @param lineCode
  56 + * @return
  57 + */
  58 + @RequestMapping(value = "/findRouteAndStationByLine")
  59 + public Map<String, Object> findRouteAndStationByLine(@RequestParam String lineCode){
  60 + return realMapService.findRouteAndStationByLine(lineCode);
  61 + }
38 } 62 }
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -74,8 +74,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -74,8 +74,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
74 @RequestMapping(value = "/destroy", method = RequestMethod.POST) 74 @RequestMapping(value = "/destroy", method = RequestMethod.POST)
75 public Map<String, Object> destroy(@RequestParam String idsStr 75 public Map<String, Object> destroy(@RequestParam String idsStr
76 /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, 76 /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
77 - @RequestParam String remarks/*, @RequestParam String reason, @RequestParam(defaultValue = "0") int spaceNum*/) {  
78 - return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks/*, reason, spaceNum*/); 77 + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
  78 + return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks, adjustExps/*, spaceNum*/);
79 } 79 }
80 80
81 /** 81 /**
@@ -351,7 +351,15 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -351,7 +351,15 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
351 @RequestMapping(value="/queryListWaybill") 351 @RequestMapping(value="/queryListWaybill")
352 public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName 352 public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
353 ,@RequestParam String date){ 353 ,@RequestParam String date){
354 - return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date); 354 + String type="fqp";
  355 + return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,type);
  356 + }
  357 +
  358 + @RequestMapping(value="/queryListWaybillQp")
  359 + public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  360 + ,@RequestParam String date){
  361 + String type="qp";
  362 + return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,type);
355 } 363 }
356 364
357 @RequestMapping(value="/statisticsDaily") 365 @RequestMapping(value="/statisticsDaily")
src/main/java/com/bsth/controller/schedule/BController.java 0 → 100644
  1 +package com.bsth.controller.schedule;
  2 +
  3 +import com.bsth.common.Constants;
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.entity.schedule.BEntity;
  6 +import com.bsth.entity.sys.SysUser;
  7 +import com.bsth.service.schedule.BService;
  8 +import com.bsth.service.schedule.ScheduleException;
  9 +import com.bsth.service.sys.SysUserService;
  10 +import com.google.common.base.Splitter;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.data.domain.PageRequest;
  13 +import org.springframework.data.domain.Sort;
  14 +import org.springframework.web.bind.annotation.*;
  15 +
  16 +import javax.servlet.http.HttpSession;
  17 +import java.io.Serializable;
  18 +import java.util.*;
  19 +
  20 +/**
  21 + * 基础控制器。
  22 + */
  23 +public class BController<T, ID extends Serializable> {
  24 + @Autowired
  25 + protected BService<T, ID> bService;
  26 + @Autowired
  27 + private SysUserService sysUserService;
  28 +
  29 + // CRUD 操作
  30 + // Create操作
  31 + @RequestMapping(method = RequestMethod.POST)
  32 + public Map<String, Object> save(@RequestBody T t, HttpSession httpSession) {
  33 + // 判定T是否是BEntity的子类,增加新的字段
  34 + String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME));
  35 + SysUser sysUser = sysUserService.findByUserName(userName);
  36 + BEntity t_b = null;
  37 + if (t instanceof BEntity) {
  38 + t_b = (BEntity) t;
  39 + t_b.setCreateBy(sysUser);
  40 + t_b.setCreateDate(new Date());
  41 + }
  42 +
  43 + T t_saved = bService.save(t_b == null ? t : (T) t_b);
  44 + Map<String, Object> rtn = new HashMap<>();
  45 + rtn.put("status", ResponseCode.SUCCESS);
  46 + rtn.put("data", t_saved);
  47 + return rtn;
  48 + }
  49 + // Update操作
  50 + @RequestMapping(value="/{id}", method = RequestMethod.POST)
  51 + public Map<String, Object> update(@RequestBody T t, HttpSession httpSession) {
  52 + String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME));
  53 + SysUser sysUser = sysUserService.findByUserName(userName);
  54 + BEntity t_b = null;
  55 + if (t instanceof BEntity) {
  56 + t_b = (BEntity) t;
  57 + t_b.setUpdateBy(sysUser);
  58 + t_b.setUpdateDate(new Date());
  59 + }
  60 +
  61 + T t_updated = bService.save(t_b == null ? t : (T) t_b);
  62 + Map<String, Object> rtn = new HashMap<>();
  63 + rtn.put("status", ResponseCode.SUCCESS);
  64 + rtn.put("data", t_updated);
  65 + return rtn;
  66 + }
  67 + // Research操作
  68 + @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  69 + public Map<String, Object> findById(@PathVariable("id") ID id) {
  70 + T t = bService.findById(id);
  71 + Map<String, Object> rtn = new HashMap<>();
  72 + rtn.put("status", ResponseCode.SUCCESS);
  73 + rtn.put("data", t);
  74 + return rtn;
  75 + }
  76 + @RequestMapping(value = "/all", method = RequestMethod.GET)
  77 + public Map<String, Object> list(@RequestParam Map<String, Object> param) {
  78 + List<T> tList = bService.list(param);
  79 + Map<String, Object> rtn = new HashMap<>();
  80 + rtn.put("status", ResponseCode.SUCCESS);
  81 + rtn.put("data", tList);
  82 + return rtn;
  83 + }
  84 + @RequestMapping(method = RequestMethod.GET)
  85 + public Map<String, Object> list(
  86 + @RequestParam Map<String, Object> map,
  87 + @RequestParam(defaultValue = "0") int page,
  88 + @RequestParam(defaultValue = "10") int size,
  89 + @RequestParam(defaultValue = "id") String order,
  90 + @RequestParam(defaultValue = "DESC") String direction) {
  91 + // 允许多个字段排序,order可以写单个字段,也可以写多个字段
  92 + // 多个字段格式:{col1},{col2},{col3},....,{coln}
  93 + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order);
  94 + // 多字段排序:DESC,ASC...
  95 + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction);
  96 +
  97 + Map<String, Object> rtn = new HashMap<>();
  98 +
  99 + if (order_dirs.size() == 1) { // 所有字段采用一种排序
  100 + rtn.put("status", ResponseCode.SUCCESS);
  101 + if (order_dirs.get(0).equals("ASC")) {
  102 + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.ASC, order_columns))));
  103 + } else {
  104 + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.DESC, order_columns))));
  105 + }
  106 + } else if (order_columns.size() == order_dirs.size()) {
  107 + List<Sort.Order> orderList = new ArrayList<>();
  108 + for (int i = 0; i < order_columns.size(); i++) {
  109 + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) {
  110 + orderList.add(new Sort.Order(Sort.Direction.ASC, order_columns.get(i)));
  111 + } else {
  112 + orderList.add(new Sort.Order(Sort.Direction.DESC, order_columns.get(i)));
  113 + }
  114 + }
  115 + rtn.put("status", ResponseCode.SUCCESS);
  116 + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(orderList))));
  117 + } else {
  118 + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致");
  119 + }
  120 +
  121 + return rtn;
  122 +
  123 + }
  124 +
  125 + // Delete操作
  126 + @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
  127 + public Map<String, Object> delete(@PathVariable("id") ID id, HttpSession httpSession) {
  128 + Map<String, Object> rtn = new HashMap<>();
  129 + try {
  130 + // 由于种种原因,这里不保存用户和操作时间了
  131 + bService.delete(id);
  132 + rtn.put("status", ResponseCode.SUCCESS);
  133 + } catch (ScheduleException exp) {
  134 + rtn.put("status", ResponseCode.ERROR);
  135 + rtn.put("msg", exp.getMessage());
  136 + }
  137 +
  138 + return rtn;
  139 + }
  140 +
  141 +}
src/main/java/com/bsth/controller/schedule/CarConfigInfoController.java deleted 100644 → 0
1 -package com.bsth.controller.schedule;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.entity.schedule.CarConfigInfo;  
5 -import com.bsth.repository.schedule.CarConfigInfoRepository;  
6 -import com.bsth.service.schedule.utils.DataToolsProperties;  
7 -import org.springframework.beans.factory.annotation.Autowired;  
8 -import org.springframework.boot.context.properties.EnableConfigurationProperties;  
9 -import org.springframework.web.bind.annotation.*;  
10 -  
11 -import java.util.List;  
12 -import java.util.Map;  
13 -  
14 -/**  
15 - * Created by xu on 16/5/9.  
16 - */  
17 -@RestController  
18 -@RequestMapping("cci")  
19 -@EnableConfigurationProperties(DataToolsProperties.class)  
20 -public class CarConfigInfoController extends BaseController<CarConfigInfo, Long> {  
21 - @Autowired  
22 - private DataToolsProperties dataToolsProperties;  
23 - @Autowired  
24 - private CarConfigInfoRepository carConfigInfoRepository;  
25 -  
26 - @Override  
27 - protected String getDataImportKtrClasspath() {  
28 - return dataToolsProperties.getCarsconfigDatainputktr();  
29 - }  
30 -  
31 - @Override  
32 - public CarConfigInfo findById(@PathVariable("id") Long aLong) {  
33 - return carConfigInfoRepository.findOneExtend(aLong);  
34 - }  
35 -  
36 - /**  
37 - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody  
38 - * @Title: save  
39 - * @Description: TODO(持久化对象)  
40 - * @param @param t  
41 - * @param @return 设定文件  
42 - * @return Map<String,Object> {status: 1(成功),-1(失败)}  
43 - * @throws  
44 - */  
45 - @RequestMapping(method = RequestMethod.POST)  
46 - public Map<String, Object> save(@RequestBody CarConfigInfo t){  
47 - return baseService.save(t);  
48 - }  
49 -  
50 - @RequestMapping(value = "/cars", method = RequestMethod.GET)  
51 - public List<Map<String, Object>> findCarConfigCars() {  
52 - return carConfigInfoRepository.findCarConfigCars();  
53 - }  
54 -  
55 - @RequestMapping(value = "/cars2", method = RequestMethod.GET)  
56 - public List<Map<String, Object>> findCarsFromConfig() {  
57 - return carConfigInfoRepository.findCarsFromConfig();  
58 - }  
59 -}  
src/main/java/com/bsth/controller/schedule/EmployeeConfigInfoController.java deleted 100644 → 0
1 -package com.bsth.controller.schedule;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.entity.schedule.EmployeeConfigInfo;  
5 -import com.bsth.repository.schedule.EmployeeConfigInfoRepository;  
6 -import com.bsth.service.schedule.utils.DataToolsProperties;  
7 -import org.springframework.beans.factory.annotation.Autowired;  
8 -import org.springframework.boot.context.properties.EnableConfigurationProperties;  
9 -import org.springframework.web.bind.annotation.*;  
10 -  
11 -import java.util.List;  
12 -import java.util.Map;  
13 -  
14 -/**  
15 - * Created by xu on 16/5/10.  
16 - */  
17 -@RestController  
18 -@RequestMapping("eci")  
19 -@EnableConfigurationProperties(DataToolsProperties.class)  
20 -public class EmployeeConfigInfoController extends BaseController<EmployeeConfigInfo, Long> {  
21 - @Autowired  
22 - private DataToolsProperties dataToolsProperties;  
23 - @Autowired  
24 - private EmployeeConfigInfoRepository employeeConfigInfoRepository;  
25 -  
26 - @Override  
27 - protected String getDataImportKtrClasspath() {  
28 - return dataToolsProperties.getEmployeesconfigDatainputktr();  
29 - }  
30 -  
31 - @Override  
32 - public EmployeeConfigInfo findById(@PathVariable("id") Long aLong) {  
33 - return employeeConfigInfoRepository.findOneExtend(aLong);  
34 - }  
35 -  
36 - /**  
37 - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody  
38 - * @Title: save  
39 - * @Description: TODO(持久化对象)  
40 - * @param @param t  
41 - * @param @return 设定文件  
42 - * @return Map<String,Object> {status: 1(成功),-1(失败)}  
43 - * @throws  
44 - */  
45 - @RequestMapping(method = RequestMethod.POST)  
46 - public Map<String, Object> save(@RequestBody EmployeeConfigInfo t){  
47 - return baseService.save(t);  
48 - }  
49 -  
50 - @RequestMapping(value = "/jsy", method = RequestMethod.GET)  
51 - public List<Map<String, Object>> findJsyFromConfig() {  
52 - return employeeConfigInfoRepository.findJsyFromConfig();  
53 - }  
54 -  
55 - @RequestMapping(value = "/spy", method = RequestMethod.GET)  
56 - public List<Map<String, Object>> findSpyFromConfig() {  
57 - return employeeConfigInfoRepository.findSpyFromConfig();  
58 - }  
59 -}  
src/main/java/com/bsth/controller/schedule/GuideboardInfoController.java deleted 100644 → 0
1 -package com.bsth.controller.schedule;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.entity.schedule.GuideboardInfo;  
5 -import com.bsth.repository.schedule.GuideboardInfoRepository;  
6 -import com.bsth.service.schedule.utils.DataToolsProperties;  
7 -import org.springframework.beans.factory.annotation.Autowired;  
8 -import org.springframework.boot.context.properties.EnableConfigurationProperties;  
9 -import org.springframework.web.bind.annotation.PathVariable;  
10 -import org.springframework.web.bind.annotation.RequestMapping;  
11 -import org.springframework.web.bind.annotation.RequestMethod;  
12 -import org.springframework.web.bind.annotation.RestController;  
13 -  
14 -import java.util.List;  
15 -import java.util.Map;  
16 -  
17 -/**  
18 - * Created by xu on 16/5/11.  
19 - */  
20 -@RestController  
21 -@RequestMapping("gic")  
22 -@EnableConfigurationProperties(DataToolsProperties.class)  
23 -public class GuideboardInfoController extends BaseController<GuideboardInfo, Long> {  
24 - @Autowired  
25 - private DataToolsProperties dataToolsProperties;  
26 - @Autowired  
27 - private GuideboardInfoRepository guideboardInfoRepository;  
28 -  
29 - @Override  
30 - protected String getDataImportKtrClasspath() {  
31 - return dataToolsProperties.getGuideboardsDatainputktr();  
32 - }  
33 -  
34 - @Override  
35 - public GuideboardInfo findById(@PathVariable("id") Long aLong) {  
36 - return guideboardInfoRepository.findOneExtend(aLong);  
37 - }  
38 -  
39 -  
40 - @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET)  
41 - public List<Map<String, Object>> findLpName(Long ttid) {  
42 - return guideboardInfoRepository.findLpName(ttid);  
43 - }  
44 -}  
src/main/java/com/bsth/controller/schedule/PeopleCarPlanController.java
@@ -20,33 +20,33 @@ public class PeopleCarPlanController { @@ -20,33 +20,33 @@ public class PeopleCarPlanController {
20 private PeopleCarPlanService peopleCarPlanService; 20 private PeopleCarPlanService peopleCarPlanService;
21 21
22 @RequestMapping(value = "/queryPeopleCar", method = RequestMethod.GET) 22 @RequestMapping(value = "/queryPeopleCar", method = RequestMethod.GET)
23 - public List<Map<String,Object>> queryPeopleCar(@RequestParam String line, @RequestParam String date, @RequestParam String type){  
24 - return peopleCarPlanService.queryPeopleCar(line, date, type); 23 + public List<Map<String,Object>> queryPeopleCar(@RequestParam Map<String, Object> map){
  24 + return peopleCarPlanService.queryPeopleCar(map);
25 } 25 }
26 26
27 @RequestMapping(value="/workDaily", method = RequestMethod.GET) 27 @RequestMapping(value="/workDaily", method = RequestMethod.GET)
28 - public List<Map<String,Object>> workDaily(@RequestParam String line, @RequestParam String date, @RequestParam String type){  
29 - return peopleCarPlanService.workDaily(line, date, type); 28 + public List<Map<String,Object>> workDaily(@RequestParam Map<String, Object> map){
  29 + return peopleCarPlanService.workDaily(map);
30 } 30 }
31 31
32 @RequestMapping(value="/scheduleAnaly", method = RequestMethod.GET) 32 @RequestMapping(value="/scheduleAnaly", method = RequestMethod.GET)
33 - public Map<String, Object> scheduleAnaly(@RequestParam String page, @RequestParam String line, @RequestParam String startDate, @RequestParam String endDate, @RequestParam String model, @RequestParam String type){  
34 - return peopleCarPlanService.scheduleAnaly(page, line, startDate, endDate, model, type); 33 + public Map<String, Object> scheduleAnaly(@RequestParam Map<String, Object> map){
  34 + return peopleCarPlanService.scheduleAnaly(map);
35 } 35 }
36 36
37 @RequestMapping(value="/getModel", method = RequestMethod.GET) 37 @RequestMapping(value="/getModel", method = RequestMethod.GET)
38 - public List<Map<String,Object>> getModel(@RequestParam String line, @RequestParam String startDate, @RequestParam String endDate){  
39 - return peopleCarPlanService.getModel(line, startDate, endDate); 38 + public List<Map<String,Object>> getModel(@RequestParam Map<String, Object> map){
  39 + return peopleCarPlanService.getModel(map);
40 } 40 }
41 41
42 @RequestMapping(value="/firstAndLastBus", method = RequestMethod.GET) 42 @RequestMapping(value="/firstAndLastBus", method = RequestMethod.GET)
43 - public List<Map<String,Object>> firstAndLastBus(@RequestParam String line, @RequestParam String date, @RequestParam String type){  
44 - return peopleCarPlanService.firstAndLastBus(line, date, type); 43 + public List<Map<String,Object>> firstAndLastBus(@RequestParam Map<String, Object> map){
  44 + return peopleCarPlanService.firstAndLastBus(map);
45 } 45 }
46 46
47 @RequestMapping(value="/commandState", method = RequestMethod.GET) 47 @RequestMapping(value="/commandState", method = RequestMethod.GET)
48 - public List<Map<String,Object>> commandState(@RequestParam String line, @RequestParam String date, @RequestParam String code){  
49 - return peopleCarPlanService.commandState(line, date, code); 48 + public List<Map<String,Object>> commandState(@RequestParam Map<String, Object> map){
  49 + return peopleCarPlanService.commandState(map);
50 } 50 }
51 51
52 } 52 }
src/main/java/com/bsth/controller/schedule/RerunController.java deleted 100644 → 0
1 -package com.bsth.controller.schedule;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.entity.schedule.rule.RerunRule;  
5 -import com.bsth.repository.schedule.RerunRuleRepository;  
6 -import org.springframework.beans.factory.annotation.Autowired;  
7 -import org.springframework.web.bind.annotation.*;  
8 -  
9 -import java.util.Map;  
10 -  
11 -/**  
12 - * Created by xu on 16/10/20.  
13 - */  
14 -@RestController  
15 -@RequestMapping("rms")  
16 -public class RerunController extends BaseController<RerunRule, Long> {  
17 -  
18 - @Autowired  
19 - private RerunRuleRepository rerunRuleRepository;  
20 -  
21 - @Override  
22 - public RerunRule findById(@PathVariable("id") Long aLong) {  
23 - return rerunRuleRepository.findOneExtend(aLong);  
24 - }  
25 -  
26 - /**  
27 - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody  
28 - * @Title: save  
29 - * @Description: TODO(持久化对象)  
30 - * @param @param t  
31 - * @param @return 设定文件  
32 - * @return Map<String,Object> {status: 1(成功),-1(失败)}  
33 - * @throws  
34 - */  
35 - @RequestMapping(method = RequestMethod.POST)  
36 - public Map<String, Object> save(@RequestBody RerunRule t){  
37 - return baseService.save(t);  
38 - }  
39 -  
40 -  
41 -}  
src/main/java/com/bsth/controller/schedule/TTInfoController.java deleted 100644 → 0
1 -package com.bsth.controller.schedule;  
2 -  
3 -import com.bsth.controller.BaseController2;  
4 -import com.bsth.entity.schedule.TTInfo;  
5 -import com.bsth.repository.schedule.TTInfoDetailRepository;  
6 -import com.bsth.repository.schedule.TTInfoRepository;  
7 -import com.bsth.service.schedule.utils.DataToolsProperties;  
8 -import org.springframework.beans.factory.annotation.Autowired;  
9 -import org.springframework.boot.context.properties.EnableConfigurationProperties;  
10 -import org.springframework.data.domain.Page;  
11 -import org.springframework.web.bind.annotation.*;  
12 -  
13 -import java.util.Map;  
14 -  
15 -/**  
16 - * Created by xu on 16/5/12.  
17 - */  
18 -@RestController  
19 -@RequestMapping("tic")  
20 -@EnableConfigurationProperties(DataToolsProperties.class)  
21 -public class TTInfoController extends BaseController2<TTInfo, Long> {  
22 - @Autowired  
23 - private DataToolsProperties dataToolsProperties;  
24 - @Autowired  
25 - private TTInfoRepository ttInfoRepository;  
26 - @Autowired  
27 - private TTInfoDetailRepository ttInfoDetailRepository;  
28 -  
29 - @Override  
30 - protected String getDataImportKtrClasspath() {  
31 - return dataToolsProperties.getTtinfoDatainputktr();  
32 - }  
33 -  
34 - @Override  
35 - public TTInfo findById(@PathVariable("id") Long aLong) {  
36 - return ttInfoRepository.findOneExtend(aLong);  
37 - }  
38 -  
39 - /**  
40 - * 验证。  
41 - * @param map  
42 - * @return  
43 - */  
44 - @RequestMapping(value = "/validate/equale", method = RequestMethod.GET)  
45 - public Map<String, Object> validateData(@RequestParam Map<String, Object> map) {  
46 - // 一般比较自编号是否重复  
47 - return baseService.validateEquale(map);  
48 - }  
49 -  
50 - @Override  
51 - public Page<TTInfo> list(@RequestParam Map<String, Object> map, @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "10") int size, @RequestParam(defaultValue = "id") String order, @RequestParam(defaultValue = "DESC") String direction) {  
52 - // 如果有isCancel键值,将其值变成boolean  
53 - if (map.get("isCancel_eq") != null)  
54 - map.put("isCancel_eq", new Boolean(map.get("isCancel_eq").toString()));  
55 -  
56 - return super.list(map, page, size, order, direction);  
57 - }  
58 -}  
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java
@@ -113,6 +113,9 @@ public class TTInfoDetailController extends BaseController2&lt;TTInfoDetail, Long&gt; @@ -113,6 +113,9 @@ public class TTInfoDetailController extends BaseController2&lt;TTInfoDetail, Long&gt;
113 p1.put("stationName_eq", cell_con.trim()); 113 p1.put("stationName_eq", cell_con.trim());
114 p1.put("stationMark_eq", "B"); 114 p1.put("stationMark_eq", "B");
115 115
  116 +
  117 + // TODO:这里要修改(起点站有启用撤销的标志的)
  118 +
116 List<StationRoute> stationRouteList = (List<StationRoute>) stationRouteService.list(p1); 119 List<StationRoute> stationRouteList = (List<StationRoute>) stationRouteService.list(p1);
117 if (CollectionUtils.isEmpty(stationRouteList)) { 120 if (CollectionUtils.isEmpty(stationRouteList)) {
118 rtn.put("status", ResponseCode.ERROR); 121 rtn.put("status", ResponseCode.ERROR);
src/main/java/com/bsth/controller/schedule/basicinfo/CarDeviceController.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.CarDevice;
  6 +import com.bsth.service.schedule.CarDeviceService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by xu on 16/12/15.
  19 + */
  20 +@RestController(value = "carDeviceController_sc")
  21 +@RequestMapping("cde_sc")
  22 +public class CarDeviceController extends BController<CarDevice, Long> {
  23 + @Autowired
  24 + private CarDeviceService carDeviceService;
  25 +
  26 + @RequestMapping(value = "/validate_qyrq", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_qyrq(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 +
  30 + try {
  31 + // 启用日期验证
  32 + CarDevice carDevice = new CarDevice(
  33 + param.get("id_eq"),
  34 + param.get("xl_eq"),
  35 + param.get("cl_eq"),
  36 + param.get("qyrq_eq")
  37 + );
  38 + carDeviceService.validate_qyrq(carDevice);
  39 + rtn.put("status", ResponseCode.SUCCESS);
  40 + } catch (ScheduleException exp) {
  41 + rtn.put("status", ResponseCode.ERROR);
  42 + rtn.put("msg", exp.getMessage());
  43 + }
  44 +
  45 + return rtn;
  46 + }
  47 +
  48 +}
src/main/java/com/bsth/controller/schedule/basicinfo/CarsController.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.Cars;
  6 +import com.bsth.service.schedule.CarsService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * 车辆基础信息controller
  19 + */
  20 +@RestController(value = "carsController_sc")
  21 +@RequestMapping("cars_sc")
  22 +public class CarsController extends BController<Cars, Integer> {
  23 + @Autowired
  24 + private CarsService carsService;
  25 +
  26 + @RequestMapping(value = "/validate_zbh", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_zbh(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 + try {
  30 + // 自编号验证
  31 + Cars cars = new Cars(
  32 + param.get("id_eq"),
  33 + param.get("insideCode_eq"),
  34 + null,
  35 + null,
  36 + null);
  37 + carsService.validate_nbbh(cars);
  38 + rtn.put("status", ResponseCode.SUCCESS);
  39 + } catch (ScheduleException exp) {
  40 + rtn.put("status", ResponseCode.ERROR);
  41 + rtn.put("msg", exp.getMessage());
  42 + }
  43 + return rtn;
  44 + }
  45 +
  46 + @RequestMapping(value = "/validate_clbh", method = RequestMethod.GET)
  47 + public Map<String, Object> validate_clbh(@RequestParam Map<String, Object> param) {
  48 + Map<String, Object> rtn = new HashMap<>();
  49 + try {
  50 + // 车辆编号验证
  51 + Cars cars = new Cars(
  52 + param.get("id_eq"),
  53 + null,
  54 + param.get("carCode_eq"),
  55 + null,
  56 + null);
  57 + carsService.validate_clbh(cars);
  58 + rtn.put("status", ResponseCode.SUCCESS);
  59 + } catch (ScheduleException exp) {
  60 + rtn.put("status", ResponseCode.ERROR);
  61 + rtn.put("msg", exp.getMessage());
  62 + }
  63 + return rtn;
  64 + }
  65 +
  66 + @RequestMapping(value = "/validate_cph", method = RequestMethod.GET)
  67 + public Map<String, Object> validate_cph(@RequestParam Map<String, Object> param) {
  68 + Map<String, Object> rtn = new HashMap<>();
  69 + try {
  70 + // 车牌号验证
  71 + Cars cars = new Cars(
  72 + param.get("id_eq"),
  73 + null,
  74 + null,
  75 + param.get("carPlate_eq"),
  76 + null);
  77 + carsService.validate_cph(cars);
  78 + rtn.put("status", ResponseCode.SUCCESS);
  79 + } catch (ScheduleException exp) {
  80 + rtn.put("status", ResponseCode.ERROR);
  81 + rtn.put("msg", exp.getMessage());
  82 + }
  83 + return rtn;
  84 + }
  85 +
  86 + @RequestMapping(value = "/validate_sbbh", method = RequestMethod.GET)
  87 + public Map<String, Object> validate_sbbh(@RequestParam Map<String, Object> param) {
  88 + Map<String, Object> rtn = new HashMap<>();
  89 + try {
  90 + // 设备编号验证
  91 + Cars cars = new Cars(
  92 + param.get("id_eq"),
  93 + null,
  94 + null,
  95 + null,
  96 + param.get("equipmentCode_eq")
  97 + );
  98 + carsService.validate_sbbh(cars);
  99 + rtn.put("status", ResponseCode.SUCCESS);
  100 + } catch (ScheduleException exp) {
  101 + rtn.put("status", ResponseCode.ERROR);
  102 + rtn.put("msg", exp.getMessage());
  103 + }
  104 + return rtn;
  105 + }
  106 +}
src/main/java/com/bsth/controller/schedule/basicinfo/EmployeeController.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.Personnel;
  6 +import com.bsth.service.schedule.EmployeeService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * 人员基础信息Controller
  19 + */
  20 +@RestController
  21 +@RequestMapping("ee")
  22 +public class EmployeeController extends BController<Personnel, Integer> {
  23 + @Autowired
  24 + private EmployeeService employeeService;
  25 +
  26 + @RequestMapping(value = "/validate_gh", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_gh(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 + try {
  30 + // 工号验证
  31 + Personnel personnel = new Personnel(
  32 + param.get("id_eq"),
  33 + param.get("companyCode_eq"),
  34 + param.get("jobCode_eq")
  35 + );
  36 + employeeService.validate_gh(personnel);
  37 + rtn.put("status", ResponseCode.SUCCESS);
  38 + } catch (ScheduleException exp) {
  39 + rtn.put("status", ResponseCode.ERROR);
  40 + rtn.put("msg", exp.getMessage());
  41 + }
  42 +
  43 + return rtn;
  44 + }
  45 +}
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.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.CarConfigInfo;
  6 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  7 +import com.bsth.service.schedule.CarConfigInfoService;
  8 +import com.bsth.service.schedule.ScheduleException;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import java.util.HashMap;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +
  19 +/**
  20 + * Created by xu on 16/5/9.
  21 + */
  22 +@RestController
  23 +@RequestMapping("cci")
  24 +public class CarConfigInfoController extends BController<CarConfigInfo, Long> {
  25 + @Autowired
  26 + private CarConfigInfoRepository carConfigInfoRepository;
  27 + @Autowired
  28 + private CarConfigInfoService carConfigInfoService;
  29 +
  30 +
  31 + @RequestMapping(value = "/cars", method = RequestMethod.GET)
  32 + public List<Map<String, Object>> findCarConfigCars() {
  33 + return carConfigInfoRepository.findCarConfigCars();
  34 + }
  35 +
  36 + @RequestMapping(value = "/cars2", method = RequestMethod.GET)
  37 + public List<Map<String, Object>> findCarsFromConfig() {
  38 + return carConfigInfoRepository.findCarsFromConfig();
  39 + }
  40 +
  41 + @RequestMapping(value = "/validate_cars", method = RequestMethod.GET)
  42 + public Map<String, Object> validate_cars(@RequestParam Map<String, Object> param) {
  43 + Map<String, Object> rtn = new HashMap<>();
  44 + try {
  45 + // 车辆重复配置验证
  46 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  47 + param.get("id_eq"),
  48 + param.get("xl.id_eq"),
  49 + param.get("xl.name_eq"),
  50 + param.get("cl.id_eq")
  51 + );
  52 + carConfigInfoService.validate_cars(carConfigInfo);
  53 + rtn.put("status", ResponseCode.SUCCESS);
  54 + } catch (ScheduleException exp) {
  55 + rtn.put("status", ResponseCode.ERROR);
  56 + rtn.put("msg", exp.getMessage());
  57 + }
  58 +
  59 + return rtn;
  60 + }
  61 +}
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.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.EmployeeConfigInfo;
  6 +import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
  7 +import com.bsth.service.schedule.EmployeeConfigInfoService;
  8 +import com.bsth.service.schedule.ScheduleException;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import java.util.HashMap;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +
  19 +/**
  20 + * Created by xu on 16/5/10.
  21 + */
  22 +@RestController
  23 +@RequestMapping("eci")
  24 +public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo, Long> {
  25 + @Autowired
  26 + private EmployeeConfigInfoRepository employeeConfigInfoRepository;
  27 + @Autowired
  28 + private EmployeeConfigInfoService employeeConfigInfoService;
  29 +
  30 + @RequestMapping(value = "/jsy", method = RequestMethod.GET)
  31 + public List<Map<String, Object>> findJsyFromConfig() {
  32 + return employeeConfigInfoRepository.findJsyFromConfig();
  33 + }
  34 +
  35 + @RequestMapping(value = "/spy", method = RequestMethod.GET)
  36 + public List<Map<String, Object>> findSpyFromConfig() {
  37 + return employeeConfigInfoRepository.findSpyFromConfig();
  38 + }
  39 +
  40 +
  41 +
  42 + @RequestMapping(value = "/validate_jsy", method = RequestMethod.GET)
  43 + public Map<String, Object> validate_jsy(@RequestParam Map<String, Object> param) {
  44 + Map<String, Object> rtn = new HashMap<>();
  45 + try {
  46 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  47 + param.get("id_eq"),
  48 + param.get("xl.id_eq"),
  49 + param.get("xl.name_eq"),
  50 + param.get("jsy.id_eq"),
  51 + null
  52 + );
  53 + employeeConfigInfoService.validate_jsy(employeeConfigInfo);
  54 + rtn.put("status", ResponseCode.SUCCESS);
  55 + } catch (ScheduleException exp) {
  56 + rtn.put("status", ResponseCode.ERROR);
  57 + rtn.put("msg", exp.getMessage());
  58 + }
  59 +
  60 + return rtn;
  61 + }
  62 +
  63 + @RequestMapping(value = "/validate_spy", method = RequestMethod.GET)
  64 + public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) {
  65 + Map<String, Object> rtn = new HashMap<>();
  66 + try {
  67 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  68 + param.get("id_eq"),
  69 + param.get("xl.id_eq"),
  70 + param.get("xl.name_eq"),
  71 + null,
  72 + param.get("spy.id_eq")
  73 + );
  74 + employeeConfigInfoService.validate_spy(employeeConfigInfo);
  75 + rtn.put("status", ResponseCode.SUCCESS);
  76 + } catch (ScheduleException exp) {
  77 + rtn.put("status", ResponseCode.ERROR);
  78 + rtn.put("msg", exp.getMessage());
  79 + }
  80 + return rtn;
  81 + }
  82 +}
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.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.GuideboardInfo;
  6 +import com.bsth.repository.schedule.GuideboardInfoRepository;
  7 +import com.bsth.service.schedule.GuideboardInfoService;
  8 +import com.bsth.service.schedule.ScheduleException;
  9 +import com.bsth.service.schedule.utils.DataToolsProperties;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.boot.context.properties.EnableConfigurationProperties;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestMethod;
  14 +import org.springframework.web.bind.annotation.RequestParam;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +
  17 +import java.util.HashMap;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +
  21 +/**
  22 + * 路牌管理控制器。
  23 + */
  24 +@RestController
  25 +@RequestMapping("gic")
  26 +@EnableConfigurationProperties(DataToolsProperties.class)
  27 +public class GuideboardInfoController extends BController<GuideboardInfo, Long> {
  28 + @Autowired
  29 + private GuideboardInfoService guideboardInfoService;
  30 +// @Autowired
  31 +// private DataToolsProperties dataToolsProperties;
  32 + @Autowired
  33 + private GuideboardInfoRepository guideboardInfoRepository;
  34 +//
  35 +// @Override
  36 +// protected String getDataImportKtrClasspath() {
  37 +// return dataToolsProperties.getGuideboardsDatainputktr();
  38 +// }
  39 +//
  40 +// @Override
  41 +// public GuideboardInfo findById(@PathVariable("id") Long aLong) {
  42 +// return guideboardInfoRepository.findOneExtend(aLong);
  43 +// }
  44 +//
  45 +//
  46 + @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET)
  47 + public List<Map<String, Object>> findLpName(Long ttid) {
  48 + return guideboardInfoRepository.findLpName(ttid);
  49 + }
  50 +
  51 + @RequestMapping(value = "/validate_lpno", method = RequestMethod.GET)
  52 + public Map<String, Object> validate_lpno(@RequestParam Map<String, Object> param) {
  53 + Map<String, Object> rtn = new HashMap<>();
  54 + try {
  55 + // 路牌编号验证
  56 + GuideboardInfo guideboardInfo = new GuideboardInfo(
  57 + param.get("id_eq"),
  58 + param.get("xl.id_eq"),
  59 + param.get("lpNo_eq"),
  60 + null
  61 + );
  62 + guideboardInfoService.validate_lpno(guideboardInfo);
  63 + rtn.put("status", ResponseCode.SUCCESS);
  64 + } catch (ScheduleException exp) {
  65 + rtn.put("status", ResponseCode.ERROR);
  66 + rtn.put("msg", exp.getMessage());
  67 + }
  68 + return rtn;
  69 + }
  70 +
  71 + @RequestMapping(value = "/validate_lpname", method = RequestMethod.GET)
  72 + public Map<String, Object> validate_lpname(@RequestParam Map<String, Object> param) {
  73 + Map<String, Object> rtn = new HashMap<>();
  74 + try {
  75 + // 路牌名称验证
  76 + GuideboardInfo guideboardInfo = new GuideboardInfo(
  77 + param.get("id_eq"),
  78 + param.get("xl.id_eq"),
  79 + null,
  80 + param.get("lpName_eq")
  81 + );
  82 + guideboardInfoService.validate_lpname(guideboardInfo);
  83 + rtn.put("status", ResponseCode.SUCCESS);
  84 + } catch (ScheduleException exp) {
  85 + rtn.put("status", ResponseCode.ERROR);
  86 + rtn.put("msg", exp.getMessage());
  87 + }
  88 + return rtn;
  89 + }
  90 +}
src/main/java/com/bsth/controller/schedule/core/RerunController.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.bsth.controller.schedule.BController;
  4 +import com.bsth.entity.schedule.rule.RerunRule;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * Created by xu on 16/10/20.
  10 + */
  11 +@RestController
  12 +@RequestMapping("rms")
  13 +public class RerunController extends BController<RerunRule, Long> {
  14 +
  15 +
  16 +}
src/main/java/com/bsth/controller/schedule/core/TTInfoController.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.TTInfo;
  6 +import com.bsth.service.schedule.ScheduleException;
  7 +import com.bsth.service.schedule.TTInfoService;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by xu on 16/12/20.
  19 + */
  20 +@RestController(value = "tTInfoController_ec")
  21 +@RequestMapping(value = "tic_ec")
  22 +public class TTInfoController extends BController<TTInfo, Long> {
  23 + @Autowired
  24 + private TTInfoService ttInfoService;
  25 +
  26 + @RequestMapping(value = "/validate_name", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_name(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 + try {
  30 + // 名字重复验证
  31 + TTInfo ttInfo = new TTInfo(
  32 + param.get("id_eq"),
  33 + param.get("xl.id_eq"),
  34 + param.get("name_eq"),
  35 + param.get("rule_days_eq"),
  36 + param.get("special_days_eq")
  37 + );
  38 + ttInfoService.validate_name(ttInfo);
  39 + rtn.put("status", ResponseCode.SUCCESS);
  40 + } catch (ScheduleException exp) {
  41 + rtn.put("status", ResponseCode.ERROR);
  42 + rtn.put("msg", exp.getMessage());
  43 + }
  44 +
  45 + return rtn;
  46 + }
  47 +
  48 + @RequestMapping(value = "/validate_n_d", method = RequestMethod.GET)
  49 + public Map<String, Object> validate_n_d(@RequestParam Map<String, Object> param) {
  50 + Map<String, Object> rtn = new HashMap<>();
  51 + try {
  52 + // 常规有效日重复验证
  53 + TTInfo ttInfo = new TTInfo(
  54 + param.get("id_eq"),
  55 + param.get("xl.id_eq"),
  56 + param.get("name_eq"),
  57 + param.get("rule_days_eq"),
  58 + param.get("special_days_eq")
  59 + );
  60 + ttInfoService.validate_n_d(ttInfo);
  61 + rtn.put("status", ResponseCode.SUCCESS);
  62 + } catch (ScheduleException exp) {
  63 + rtn.put("status", ResponseCode.ERROR);
  64 + rtn.put("msg", exp.getMessage());
  65 + }
  66 + return rtn;
  67 + }
  68 +
  69 + @RequestMapping(value = "/validate_s_d", method = RequestMethod.GET)
  70 + public Map<String, Object> validate_s_d(@RequestParam Map<String, Object> param) {
  71 + Map<String, Object> rtn = new HashMap<>();
  72 + try {
  73 + // 特殊有效日重复判定
  74 + TTInfo ttInfo = new TTInfo(
  75 + param.get("id_eq"),
  76 + param.get("xl.id_eq"),
  77 + param.get("name_eq"),
  78 + param.get("rule_days_eq"),
  79 + param.get("special_days_eq")
  80 + );
  81 + ttInfoService.validate_s_d(ttInfo);
  82 + rtn.put("status", ResponseCode.SUCCESS);
  83 + } catch (ScheduleException exp) {
  84 + rtn.put("status", ResponseCode.ERROR);
  85 + rtn.put("msg", exp.getMessage());
  86 + }
  87 + return rtn;
  88 + }
  89 +
  90 +}
  91 +
  92 +//
  93 +//@Autowired
  94 +//private DataToolsProperties dataToolsProperties;
  95 +//@Autowired
  96 +//private TTInfoRepository ttInfoRepository;
  97 +//@Autowired
  98 +//private TTInfoDetailRepository ttInfoDetailRepository;
  99 +//
  100 +// @Override
  101 +// protected String getDataImportKtrClasspath() {
  102 +// return dataToolsProperties.getTtinfoDatainputktr();
  103 +// }
  104 +//
  105 +// @Override
  106 +// public TTInfo findById(@PathVariable("id") Long aLong) {
  107 +// return ttInfoRepository.findOneExtend(aLong);
  108 +// }
  109 +//
  110 +// /**
  111 +// * 验证。
  112 +// * @param map
  113 +// * @return
  114 +// */
  115 +// @RequestMapping(value = "/validate/equale", method = RequestMethod.GET)
  116 +// public Map<String, Object> validateData(@RequestParam Map<String, Object> map) {
  117 +// // 一般比较自编号是否重复
  118 +// return baseService.validateEquale(map);
  119 +// }
  120 +//
  121 +// @Override
  122 +// public Page<TTInfo> list(@RequestParam Map<String, Object> map, @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "10") int size, @RequestParam(defaultValue = "id") String order, @RequestParam(defaultValue = "DESC") String direction) {
  123 +// // 如果有isCancel键值,将其值变成boolean
  124 +// if (map.get("isCancel_eq") != null)
  125 +// map.put("isCancel_eq", new Boolean(map.get("isCancel_eq").toString()));
  126 +//
  127 +// return super.list(map, page, size, order, direction);
  128 +// }
0 \ No newline at end of file 129 \ No newline at end of file
src/main/java/com/bsth/data/BasicData.java
1 package com.bsth.data; 1 package com.bsth.data;
2 2
3 import com.bsth.Application; 3 import com.bsth.Application;
  4 +import com.bsth.data.gpsdata.analyse.GeoCacheData;
4 import com.bsth.entity.*; 5 import com.bsth.entity.*;
5 import com.bsth.entity.schedule.CarConfigInfo; 6 import com.bsth.entity.schedule.CarConfigInfo;
6 import com.bsth.repository.*; 7 import com.bsth.repository.*;
@@ -25,6 +26,12 @@ import java.util.concurrent.TimeUnit; @@ -25,6 +26,12 @@ import java.util.concurrent.TimeUnit;
25 */ 26 */
26 @Component 27 @Component
27 public class BasicData implements CommandLineRunner { 28 public class BasicData implements CommandLineRunner {
  29 +
  30 + //公司代码和公司名对照(K: 公司编码,V:公司名)
  31 + public static Map<String, String> businessCodeNameMap;
  32 +
  33 + //分公司公司代码和分公司公司名对照(K: 公司编码+分公司编码,V:分公司公司名)
  34 + public static Map<String, String> businessFgsCodeNameMap;
28 35
29 //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号) 36 //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号)
30 public static BiMap<String, String> deviceId2NbbmMap; 37 public static BiMap<String, String> deviceId2NbbmMap;
@@ -51,7 +58,7 @@ public class BasicData implements CommandLineRunner { @@ -51,7 +58,7 @@ public class BasicData implements CommandLineRunner {
51 public static Map<String, String> lineCode2NameMap; 58 public static Map<String, String> lineCode2NameMap;
52 59
53 //线路编码_站点编码 == 0|1 上下行 60 //线路编码_站点编码 == 0|1 上下行
54 - public static Map<String, Integer> lineStationUpDownMap; 61 + //public static Map<String, Integer> lineStationUpDownMap;
55 62
56 //停车场 63 //停车场
57 public static List<String> parkCodeList; 64 public static List<String> parkCodeList;
@@ -80,7 +87,7 @@ public class BasicData implements CommandLineRunner { @@ -80,7 +87,7 @@ public class BasicData implements CommandLineRunner {
80 87
81 @Override 88 @Override
82 public void run(String... arg0) throws Exception { 89 public void run(String... arg0) throws Exception {
83 - Application.mainServices.scheduleWithFixedDelay(dataLoader, 0, 1, TimeUnit.HOURS); 90 + Application.mainServices.scheduleWithFixedDelay(dataLoader, 2, 2, TimeUnit.HOURS);
84 } 91 }
85 92
86 93
@@ -107,6 +114,12 @@ public class BasicData implements CommandLineRunner { @@ -107,6 +114,12 @@ public class BasicData implements CommandLineRunner {
107 114
108 @Autowired 115 @Autowired
109 PersonnelRepository personnelRepository; 116 PersonnelRepository personnelRepository;
  117 +
  118 + @Autowired
  119 + BusinessRepository businessRepository;
  120 +
  121 + @Autowired
  122 + GeoCacheData geoCacheData;
110 123
111 124
112 @Override 125 @Override
@@ -129,9 +142,13 @@ public class BasicData implements CommandLineRunner { @@ -129,9 +142,13 @@ public class BasicData implements CommandLineRunner {
129 //车辆和线路映射信息 142 //车辆和线路映射信息
130 loadNbbm2LineInfo(); 143 loadNbbm2LineInfo();
131 //站点路由信息 144 //站点路由信息
132 - loadStationRouteInfo(); 145 + //loadStationRouteInfo();
133 //人员信息 146 //人员信息
134 loadPersonnelInfo(); 147 loadPersonnelInfo();
  148 + //公司信息
  149 + loadBusinessInfo();
  150 +
  151 + geoCacheData.loadData();
135 logger.info("加载基础数据成功!,"); 152 logger.info("加载基础数据成功!,");
136 } catch (Exception e) { 153 } catch (Exception e) {
137 logger.error("加载基础数据时出现异常,", e); 154 logger.error("加载基础数据时出现异常,", e);
@@ -140,7 +157,7 @@ public class BasicData implements CommandLineRunner { @@ -140,7 +157,7 @@ public class BasicData implements CommandLineRunner {
140 } 157 }
141 158
142 159
143 - private void loadStationRouteInfo() { 160 +/* private void loadStationRouteInfo() {
144 Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator(); 161 Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator();
145 162
146 Map<String, String> sePointMap = new HashMap<>(); 163 Map<String, String> sePointMap = new HashMap<>();
@@ -161,9 +178,26 @@ public class BasicData implements CommandLineRunner { @@ -161,9 +178,26 @@ public class BasicData implements CommandLineRunner {
161 } 178 }
162 lineStationUpDownMap = map; 179 lineStationUpDownMap = map;
163 lineSEPointMap = sePointMap; 180 lineSEPointMap = sePointMap;
164 - } 181 + }*/
165 182
166 /** 183 /**
  184 + * loadBusinessInfo
  185 + * (公司代码公司名对照)
  186 + */
  187 + public void loadBusinessInfo(){
  188 + Map<String, String> businessMap=new HashMap<String,String>();
  189 + Map<String, String> businessFgsMap=new HashMap<String,String>();
  190 + Iterator<Business> busIter=businessRepository.findAll().iterator();
  191 + Business t;
  192 + while(busIter.hasNext()){
  193 + t=busIter.next();
  194 + businessMap.put(t.getBusinessCode(), t.getBusinessName());
  195 + businessFgsMap.put(t.getBusinessCode()+"_"+t.getUpCode(), t.getBusinessName());
  196 + }
  197 + businessCodeNameMap=businessMap;
  198 + businessFgsCodeNameMap=businessFgsMap;
  199 + }
  200 + /**
167 * @Title: loadDeviceInfo 201 * @Title: loadDeviceInfo
168 * @Description: TODO(加载设备相关信息) 202 * @Description: TODO(加载设备相关信息)
169 */ 203 */
@@ -252,7 +286,7 @@ public class BasicData implements CommandLineRunner { @@ -252,7 +286,7 @@ public class BasicData implements CommandLineRunner {
252 /** 286 /**
253 * 加载运管处的站点及序号 287 * 加载运管处的站点及序号
254 * 上行从1开始,下行顺序续编 288 * 上行从1开始,下行顺序续编
255 - */ 289 +
256 List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc(); 290 List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc();
257 if(ygcLines != null && ygcLines.size() > 0){ 291 if(ygcLines != null && ygcLines.size() > 0){
258 int size = ygcLines.size(); 292 int size = ygcLines.size();
@@ -271,7 +305,7 @@ public class BasicData implements CommandLineRunner { @@ -271,7 +305,7 @@ public class BasicData implements CommandLineRunner {
271 key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2]; 305 key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2];
272 tempStationName2YgcNumber.put(key,num++); 306 tempStationName2YgcNumber.put(key,num++);
273 } 307 }
274 - } 308 + }*/
275 } 309 }
276 310
277 lineId2CodeMap = biMap; 311 lineId2CodeMap = biMap;
src/main/java/com/bsth/data/arrival/AnalyseData.java
1 package com.bsth.data.arrival; 1 package com.bsth.data.arrival;
2 2
3 -import java.util.ArrayList;  
4 -import java.util.Collections;  
5 -import java.util.List;  
6 -import java.util.Set;  
7 -  
8 import org.slf4j.Logger; 3 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 4 import org.slf4j.LoggerFactory;
10 import org.springframework.stereotype.Component; 5 import org.springframework.stereotype.Component;
11 6
12 -import com.bsth.data.BasicData; 7 +import java.util.ArrayList;
  8 +import java.util.Collections;
  9 +import java.util.List;
  10 +import java.util.Set;
13 11
14 /** 12 /**
15 * 13 *
@@ -98,14 +96,15 @@ public class AnalyseData { @@ -98,14 +96,15 @@ public class AnalyseData {
98 } 96 }
99 97
100 private boolean effective(ArrivalEntity arr){ 98 private boolean effective(ArrivalEntity arr){
101 - //停车场 99 + /*//停车场
102 if(BasicData.parkCodeList.contains(arr.getStopNo())){ 100 if(BasicData.parkCodeList.contains(arr.getStopNo())){
103 arr.setTcc(true); 101 arr.setTcc(true);
104 return true; 102 return true;
105 } 103 }
106 - 104 +
107 Integer upDown = BasicData.lineStationUpDownMap.get(arr.getLineCode() + "_" + arr.getStopNo()); 105 Integer upDown = BasicData.lineStationUpDownMap.get(arr.getLineCode() + "_" + arr.getStopNo());
108 -  
109 - return arr.getUpDown() == upDown || BasicData.parkCodeList.contains(arr.getStopNo()); 106 +
  107 + return arr.getUpDown() == upDown || BasicData.parkCodeList.contains(arr.getStopNo());*/
  108 + return false;
110 } 109 }
111 } 110 }
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
1 package com.bsth.data.forecast; 1 package com.bsth.data.forecast;
2 2
3 -import java.text.DecimalFormat;  
4 -import java.util.ArrayList;  
5 -import java.util.HashMap;  
6 -import java.util.List;  
7 -import java.util.Map;  
8 -import java.util.concurrent.TimeUnit;  
9 -  
10 -import org.slf4j.Logger;  
11 -import org.slf4j.LoggerFactory;  
12 -import org.springframework.beans.factory.annotation.Autowired;  
13 -import org.springframework.boot.CommandLineRunner;  
14 -import org.springframework.stereotype.Component;  
15 -  
16 -import com.bsth.Application;  
17 import com.bsth.data.forecast.entity.ForecastResult; 3 import com.bsth.data.forecast.entity.ForecastResult;
18 import com.bsth.data.forecast.entity.ForecastResult.ForecastResultItem; 4 import com.bsth.data.forecast.entity.ForecastResult.ForecastResultItem;
19 import com.bsth.data.forecast.entity.SimpleRoute; 5 import com.bsth.data.forecast.entity.SimpleRoute;
@@ -23,6 +9,17 @@ import com.bsth.data.gpsdata.GpsRealData; @@ -23,6 +9,17 @@ import com.bsth.data.gpsdata.GpsRealData;
23 import com.bsth.data.schedule.DayOfSchedule; 9 import com.bsth.data.schedule.DayOfSchedule;
24 import com.bsth.entity.realcontrol.ScheduleRealInfo; 10 import com.bsth.entity.realcontrol.ScheduleRealInfo;
25 import com.google.common.collect.ArrayListMultimap; 11 import com.google.common.collect.ArrayListMultimap;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.boot.CommandLineRunner;
  16 +import org.springframework.stereotype.Component;
  17 +
  18 +import java.text.DecimalFormat;
  19 +import java.util.ArrayList;
  20 +import java.util.HashMap;
  21 +import java.util.List;
  22 +import java.util.Map;
26 23
27 /** 24 /**
28 * 25 *
@@ -61,7 +58,7 @@ public class ForecastRealServer implements CommandLineRunner { @@ -61,7 +58,7 @@ public class ForecastRealServer implements CommandLineRunner {
61 @Override 58 @Override
62 public void run(String... arg0) throws Exception { 59 public void run(String... arg0) throws Exception {
63 //2小时更新一次站点间耗时数据 60 //2小时更新一次站点间耗时数据
64 - Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS); 61 + //Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS);
65 } 62 }
66 63
67 /** 64 /**
@@ -73,7 +70,7 @@ public class ForecastRealServer implements CommandLineRunner { @@ -73,7 +70,7 @@ public class ForecastRealServer implements CommandLineRunner {
73 /* public void forecast(String nbbm){ 70 /* public void forecast(String nbbm){
74 logger.info("预测," + nbbm); 71 logger.info("预测," + nbbm);
75 //当前执行班次 72 //当前执行班次
76 - ScheduleRealInfo sch = dayOfSchedule.execPlamMap().get(nbbm); 73 + ScheduleRealInfo sch = dayOfSchedule.execPlanMap().get(nbbm);
77 if(null == sch) 74 if(null == sch)
78 return; 75 return;
79 76
@@ -89,7 +86,7 @@ public class ForecastRealServer implements CommandLineRunner { @@ -89,7 +86,7 @@ public class ForecastRealServer implements CommandLineRunner {
89 //终点站 86 //终点站
90 String eStation = null; 87 String eStation = null;
91 //当前执行班次 88 //当前执行班次
92 - ScheduleRealInfo sch = dayOfSchedule.execPlamMap().get(nbbm); 89 + ScheduleRealInfo sch = dayOfSchedule.execPlanMap().get(nbbm);
93 if(null != sch) 90 if(null != sch)
94 eStation = sch.getZdzCode(); 91 eStation = sch.getZdzCode();
95 92
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
1 package com.bsth.data.gpsdata; 1 package com.bsth.data.gpsdata;
2 2
  3 +import com.bsth.data.gpsdata.analyse.StationRoute;
  4 +import com.fasterxml.jackson.annotation.JsonIgnore;
  5 +
3 /** 6 /**
4 * 7 *
5 * @ClassName: GpsRealData 8 * @ClassName: GpsRealData
@@ -58,21 +61,32 @@ public class GpsEntity { @@ -58,21 +61,32 @@ public class GpsEntity {
58 /** 预计到达终点时间 */ 61 /** 预计到达终点时间 */
59 private Float expectStopTime; 62 private Float expectStopTime;
60 63
61 - /** 设备是否在线 */ 64 + /** 设备是否在线
62 private boolean online; 65 private boolean online;
63 - 66 + */
64 /** 当前执行班次ID */ 67 /** 当前执行班次ID */
65 private Long schId; 68 private Long schId;
66 69
67 /** 是否异常数据 */ 70 /** 是否异常数据 */
68 private boolean abnormal; 71 private boolean abnormal;
69 -  
70 - private int valid; 72 +/*
  73 + private int valid;*/
71 74
72 private int version; 75 private int version;
73 76
74 - /** 是否起终点站 */ 77 + /** 是否起终点站
75 private boolean sEPoint; 78 private boolean sEPoint;
  79 + */
  80 +
  81 + /** 站内 */
  82 + private boolean instation;
  83 +
  84 + /** 站点信息,站内时有值 */
  85 + @JsonIgnore
  86 + private StationRoute station;
  87 +
  88 + /** 状态 */
  89 + private String state2;
76 90
77 public Integer getCompanyCode() { 91 public Integer getCompanyCode() {
78 return companyCode; 92 return companyCode;
@@ -178,14 +192,6 @@ public class GpsEntity { @@ -178,14 +192,6 @@ public class GpsEntity {
178 this.stationName = stationName; 192 this.stationName = stationName;
179 } 193 }
180 194
181 - public boolean isOnline() {  
182 - return online;  
183 - }  
184 -  
185 - public void setOnline(boolean online) {  
186 - this.online = online;  
187 - }  
188 -  
189 public long getArrTime() { 195 public long getArrTime() {
190 return arrTime; 196 return arrTime;
191 } 197 }
@@ -218,35 +224,44 @@ public class GpsEntity { @@ -218,35 +224,44 @@ public class GpsEntity {
218 this.schId = schId; 224 this.schId = schId;
219 } 225 }
220 226
221 - public boolean isAbnormal() {  
222 - return abnormal; 227 +
  228 + public int getVersion() {
  229 + return version;
223 } 230 }
224 231
225 - public void setAbnormal(boolean abnormal) {  
226 - this.abnormal = abnormal; 232 + public void setVersion(int version) {
  233 + this.version = version;
227 } 234 }
228 235
229 - public int getValid() {  
230 - return valid; 236 + public boolean isInstation() {
  237 + return instation;
231 } 238 }
232 239
233 - public void setValid(int valid) {  
234 - this.valid = valid; 240 + public void setInstation(boolean instation) {
  241 + this.instation = instation;
235 } 242 }
236 243
237 - public int getVersion() {  
238 - return version; 244 + public StationRoute getStation() {
  245 + return station;
239 } 246 }
240 247
241 - public void setVersion(int version) {  
242 - this.version = version; 248 + public void setStation(StationRoute station) {
  249 + this.station = station;
  250 + }
  251 +
  252 + public boolean isAbnormal() {
  253 + return abnormal;
  254 + }
  255 +
  256 + public void setAbnormal(boolean abnormal) {
  257 + this.abnormal = abnormal;
243 } 258 }
244 259
245 - public boolean issEPoint() {  
246 - return sEPoint; 260 + public String getState2() {
  261 + return state2;
247 } 262 }
248 263
249 - public void setsEPoint(boolean sEPoint) {  
250 - this.sEPoint = sEPoint; 264 + public void setState2(String state2) {
  265 + this.state2 = state2;
251 } 266 }
252 } 267 }
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject; @@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
5 import com.bsth.Application; 5 import com.bsth.Application;
6 import com.bsth.data.BasicData; 6 import com.bsth.data.BasicData;
7 import com.bsth.data.forecast.ForecastRealServer; 7 import com.bsth.data.forecast.ForecastRealServer;
  8 +import com.bsth.data.gpsdata.analyse.GpsAnalyse;
  9 +import com.bsth.data.gpsdata.recovery.GpsDataRecovery;
8 import com.bsth.data.schedule.DayOfSchedule; 10 import com.bsth.data.schedule.DayOfSchedule;
9 import com.bsth.entity.realcontrol.ScheduleRealInfo; 11 import com.bsth.entity.realcontrol.ScheduleRealInfo;
10 import com.bsth.util.ConfigUtil; 12 import com.bsth.util.ConfigUtil;
@@ -55,6 +57,9 @@ public class GpsRealData implements CommandLineRunner{ @@ -55,6 +57,9 @@ public class GpsRealData implements CommandLineRunner{
55 57
56 @Autowired 58 @Autowired
57 ForecastRealServer forecastRealServer; 59 ForecastRealServer forecastRealServer;
  60 +
  61 +
  62 +
58 /** 63 /**
59 * 构造函数 64 * 构造函数
60 */ 65 */
@@ -67,13 +72,17 @@ public class GpsRealData implements CommandLineRunner{ @@ -67,13 +72,17 @@ public class GpsRealData implements CommandLineRunner{
67 @Override 72 @Override
68 public void run(String... arg0) throws Exception { 73 public void run(String... arg0) throws Exception {
69 logger.info("gpsDataLoader,20,6"); 74 logger.info("gpsDataLoader,20,6");
70 - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); 75 + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 40, 20, TimeUnit.SECONDS);
71 } 76 }
72 77
73 public GpsEntity add(GpsEntity gps) { 78 public GpsEntity add(GpsEntity gps) {
74 String device = gps.getDeviceId(); 79 String device = gps.getDeviceId();
75 GpsEntity old = gpsMap.get(device); 80 GpsEntity old = gpsMap.get(device);
76 81
  82 + //分析gps
  83 + if(isAvailable(gps) && (old == null || old.getTimestamp() != gps.getTimestamp()))
  84 + GpsAnalyse.start(gps);
  85 +
77 if(!StringUtils.isEmpty(gps.getStopNo())){ 86 if(!StringUtils.isEmpty(gps.getStopNo())){
78 //定时定距数据附带站点编码改变 87 //定时定距数据附带站点编码改变
79 if(null == old || !gps.getStopNo().equals(old.getStopNo())){ 88 if(null == old || !gps.getStopNo().equals(old.getStopNo())){
@@ -94,6 +103,11 @@ public class GpsRealData implements CommandLineRunner{ @@ -94,6 +103,11 @@ public class GpsRealData implements CommandLineRunner{
94 return gps; 103 return gps;
95 } 104 }
96 105
  106 + public boolean isAvailable(GpsEntity gps){
  107 + return StringUtils.isNotEmpty(gps.getLineId()) &&
  108 + dayOfSchedule.getCurrSchDate().containsKey(gps.getLineId());
  109 + }
  110 +
97 /** 111 /**
98 * 112 *
99 * @Title: get @Description: TODO(设备号获取GPS) 113 * @Title: get @Description: TODO(设备号获取GPS)
@@ -118,7 +132,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -118,7 +132,7 @@ public class GpsRealData implements CommandLineRunner{
118 if(gps.isAbnormal()) 132 if(gps.isAbnormal())
119 continue; 133 continue;
120 134
121 - sch = dayOfSchedule.execPlamMap().get(gps.getNbbm()); 135 + sch = dayOfSchedule.execPlanMap().get(gps.getNbbm());
122 if(null != sch) 136 if(null != sch)
123 gps.setSchId(sch.getId()); 137 gps.setSchId(sch.getId());
124 rs.add(gps); 138 rs.add(gps);
@@ -161,6 +175,11 @@ public class GpsRealData implements CommandLineRunner{ @@ -161,6 +175,11 @@ public class GpsRealData implements CommandLineRunner{
161 @Override 175 @Override
162 public void run() { 176 public void run() {
163 try{ 177 try{
  178 + //如果正在恢复数据
  179 + if(GpsDataRecovery.run){
  180 + return;
  181 + }
  182 +
164 load(); 183 load();
165 }catch(Exception e){ 184 }catch(Exception e){
166 logger.error("", e); 185 logger.error("", e);
@@ -207,21 +226,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -207,21 +226,7 @@ public class GpsRealData implements CommandLineRunner{
207 gpsRealData.add(gps); 226 gpsRealData.add(gps);
208 227
209 //纠正走向 228 //纠正走向
210 - correctUpdown(gps);  
211 - /*if(issEPoint(gps))  
212 - continue;  
213 -  
214 - //如果走向未知,尝试根据站点纠正走向  
215 - if(gps.getUpDown() == -1){  
216 - updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());  
217 - if(updown != null)  
218 - gps.setUpDown(updown);  
219 - }  
220 - //如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向  
221 - updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());  
222 - if(updown != null && !gps.getUpDown().equals(updown)){  
223 - gps.setUpDown(updown);  
224 - }*/ 229 + //correctUpdown(gps);
225 } 230 }
226 } else 231 } else
227 logger.error("result is null"); 232 logger.error("result is null");
@@ -240,7 +245,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -240,7 +245,7 @@ public class GpsRealData implements CommandLineRunner{
240 * 是否是起终点 245 * 是否是起终点
241 * @param gps 246 * @param gps
242 * @return 247 * @return
243 - */ 248 +
244 public boolean isSEPoint(GpsEntity gps){ 249 public boolean isSEPoint(GpsEntity gps){
245 String key = gps.getLineId()+"_"+gps.getUpDown()+"_" 250 String key = gps.getLineId()+"_"+gps.getUpDown()+"_"
246 ,stationCode; 251 ,stationCode;
@@ -261,29 +266,19 @@ public class GpsRealData implements CommandLineRunner{ @@ -261,29 +266,19 @@ public class GpsRealData implements CommandLineRunner{
261 } 266 }
262 } 267 }
263 return false; 268 return false;
264 - } 269 + }*/
265 270
266 /** 271 /**
267 * 纠正上下行 272 * 纠正上下行
268 * @param gps 273 * @param gps
269 - */ 274 +
270 public void correctUpdown(GpsEntity gps){ 275 public void correctUpdown(GpsEntity gps){
271 Integer updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); 276 Integer updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
272 if(updown != null && !updown.equals(gps.getUpDown())) 277 if(updown != null && !updown.equals(gps.getUpDown()))
273 gps.setUpDown(updown); 278 gps.setUpDown(updown);
274 - /*//如果走向未知,尝试根据站点纠正走向  
275 - if(gps.getUpDown() == -1){  
276 -  
277 - }*/  
278 279
279 if(isSEPoint(gps)) 280 if(isSEPoint(gps))
280 return; 281 return;
281 -  
282 - /*//如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向  
283 - updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());  
284 - if(updown != null && !gps.getUpDown().equals(updown)){  
285 - gps.setUpDown(updown);  
286 - }*/  
287 - } 282 + }*/
288 } 283 }
289 } 284 }
src/main/java/com/bsth/data/gpsdata/analyse/CircleQueue.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import java.util.Arrays;
  4 +
  5 +/**
  6 + * 循环队列
  7 + * Created by panzhao on 2016/12/23.
  8 + */
  9 +public class CircleQueue<T> {
  10 +
  11 + /**
  12 + * (循环队列)数组的容量
  13 + */
  14 + public int capacity;
  15 +
  16 + /**
  17 + * 数组:保存循环队列的元素
  18 + */
  19 + public Object[] elementData;
  20 +
  21 + /**
  22 + * 队头(先进先出)
  23 + */
  24 + public int head = 0;
  25 +
  26 + /**
  27 + * 队尾
  28 + */
  29 + public int tail = 0;
  30 +
  31 + /**
  32 + * 以指定长度的数组来创建循环队列
  33 + *
  34 + * @param initSize
  35 + */
  36 + public CircleQueue(final int initSize) {
  37 + capacity = initSize;
  38 + elementData = new Object[capacity];
  39 + }
  40 +
  41 + /**
  42 + * 获取循环队列的大小(包含元素的个数)
  43 + */
  44 + public int size() {
  45 + if (isEmpty()) {
  46 + return 0;
  47 + } else if (isFull()) {
  48 + return capacity;
  49 + } else {
  50 + return tail + 1;
  51 + }
  52 + }
  53 +
  54 + /**
  55 + * 插入队尾一个元素
  56 + */
  57 + public void add(final T element) {
  58 + if (isEmpty()) {
  59 + elementData[0] = element;
  60 + } else if (isFull()) {
  61 + elementData[head] = element;
  62 + head++;
  63 + tail++;
  64 + head = head == capacity ? 0 : head;
  65 + tail = tail == capacity ? 0 : tail;
  66 + } else {
  67 + elementData[tail + 1] = element;
  68 + tail++;
  69 + }
  70 + }
  71 +
  72 + public boolean isEmpty() {
  73 + return tail == head && tail == 0 && elementData[tail] == null;
  74 + }
  75 +
  76 + public boolean isFull() {
  77 + return head != 0 && head - tail == 1 || head == 0 && tail == capacity - 1;
  78 + }
  79 +
  80 + public void clear() {
  81 + Arrays.fill(elementData, null);
  82 + head = 0;
  83 + tail = 0;
  84 + }
  85 +
  86 + /**
  87 + * @return 取 循环队列里的值(先进的index=0)
  88 + */
  89 + public Object[] getQueue() {
  90 + final Object[] elementDataSort = new Object[capacity];
  91 + final Object[] elementDataCopy = elementData.clone();
  92 + if (isEmpty()) {
  93 + } else if (isFull()) {
  94 + int indexMax = capacity;
  95 + int indexSort = 0;
  96 + for (int i = head; i < indexMax;) {
  97 + elementDataSort[indexSort] = elementDataCopy[i];
  98 + indexSort++;
  99 + i++;
  100 + if (i == capacity) {
  101 + i = 0;
  102 + indexMax = head;
  103 + }
  104 + }
  105 + } else {
  106 + for (int i = 0; i < tail; i++) {
  107 + elementDataSort[i] = elementDataCopy[i];
  108 + }
  109 + }
  110 + return elementDataSort;
  111 + }
  112 +
  113 + public T getTail(){
  114 + return elementData[tail] == null?null:(T)elementData[tail];
  115 + }
  116 +}
0 \ No newline at end of file 117 \ No newline at end of file
src/main/java/com/bsth/data/gpsdata/analyse/GeoCacheData.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.google.common.collect.ArrayListMultimap;
  5 +import com.vividsolutions.jts.geom.Coordinate;
  6 +import com.vividsolutions.jts.geom.GeometryFactory;
  7 +import com.vividsolutions.jts.geom.LineString;
  8 +import com.vividsolutions.jts.geom.Polygon;
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.jdbc.core.JdbcTemplate;
  14 +import org.springframework.jdbc.core.RowMapper;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +import java.sql.ResultSet;
  18 +import java.sql.SQLException;
  19 +import java.util.*;
  20 +
  21 +/**
  22 + * Created by panzhao on 2016/12/23.
  23 + */
  24 +@Component
  25 +public class GeoCacheData {
  26 +
  27 + static Logger logger = LoggerFactory.getLogger(GeoCacheData.class);
  28 +
  29 + //每辆车缓存最后200条gps
  30 + private static final int CACHE_SIZE = 200;
  31 + private static Map<String, CircleQueue<GpsEntity>> gpsCacheMap = new HashMap<>();
  32 +
  33 + //线路路段走向
  34 + private static ArrayListMultimap<String, LineString> sectionCacheMap;
  35 +
  36 + //线路站点路由
  37 + private static ArrayListMultimap<String, StationRoute> stationCacheMap;
  38 +
  39 + //停车场
  40 + public static Map<String, Polygon> tccMap;
  41 +
  42 + @Autowired
  43 + JdbcTemplate jdbcTemplate;
  44 +
  45 + public static CircleQueue<GpsEntity> getGps(String nbbm) {
  46 + return gpsCacheMap.get(nbbm);
  47 + }
  48 +
  49 + public static void putGps(GpsEntity gps) {
  50 + CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getNbbm());
  51 + if (queue == null) {
  52 + //第一个点从站内开始
  53 + if(!gps.isInstation())
  54 + return;
  55 +
  56 + queue = new CircleQueue<>(CACHE_SIZE);
  57 + gpsCacheMap.put(gps.getNbbm(), queue);
  58 + }
  59 + queue.add(gps);
  60 + }
  61 +
  62 + public static List<StationRoute> getStationRoute(String lineCode, int directions) {
  63 + return stationCacheMap.get(lineCode + "_" + directions);
  64 + }
  65 +
  66 + public static StationRoute getStation(String lineCode, int directions, String code) {
  67 + List<StationRoute> list = getStationRoute(lineCode, directions);
  68 +
  69 + for (StationRoute sr : list) {
  70 + if (sr.getCode().equals(code)) {
  71 + return sr;
  72 + }
  73 + }
  74 + return null;
  75 + }
  76 +
  77 + public static Polygon getTccPolygon(String code){
  78 + return tccMap.get(code);
  79 + }
  80 +
  81 + public void loadData() {
  82 + final GeometryFactory geometryFactory = new GeometryFactory();
  83 + //加载站点路由
  84 + String sql = "select r.LINE_CODE,r.DIRECTIONS,r.STATION_CODE,r.STATION_MARK,s.SHAPES_TYPE,s.G_LONX,s.G_LATY,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID,s.RADIUS, r.STATION_ROUTE_CODE from bsth_c_stationroute r left join bsth_c_station s on r.station=s.id where r.destroy=0 order by r.station_route_code";
  85 + List<StationRoute> routeList = jdbcTemplate.query(sql, new RowMapper<StationRoute>() {
  86 + @Override
  87 + public StationRoute mapRow(ResultSet rs, int rowNum) throws SQLException {
  88 + StationRoute sRoute = new StationRoute();
  89 + sRoute.setCode(rs.getString("STATION_CODE"));
  90 + sRoute.setLineCode(rs.getString("LINE_CODE"));
  91 + sRoute.setDirections(rs.getInt("DIRECTIONS"));
  92 + sRoute.setPoint(geometryFactory.createPoint(new Coordinate(rs.getFloat("G_LATY"), rs.getFloat("G_LONX"))));
  93 + sRoute.setRadius(rs.getFloat("RADIUS"));
  94 + sRoute.setRouteSort(rs.getInt("STATION_ROUTE_CODE"));
  95 + sRoute.setMark(rs.getString("STATION_MARK"));
  96 +
  97 + String shapesType = rs.getString("SHAPES_TYPE");
  98 + //多边形电子围栏
  99 + if (StringUtils.isNotEmpty(shapesType) && shapesType.equals("d")) {
  100 + geometryFactory.createPolygon(parsePolygon(rs.getString("G_POLYGON_GRID")));
  101 + }
  102 + return sRoute;
  103 + }
  104 + });
  105 + //按线路和走向分组
  106 + if (routeList.size() > 0) {
  107 + ArrayListMultimap<String, StationRoute> tempMap = ArrayListMultimap.create();
  108 + for (StationRoute sr : routeList) {
  109 + tempMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr);
  110 + }
  111 +
  112 + StationRouteComp srCom = new StationRouteComp();
  113 + //连接路由
  114 + Set<String> set = tempMap.keySet();
  115 + for (String key : set) {
  116 + Collections.sort(tempMap.get(key), srCom);
  117 + connectStationRoute(tempMap.get(key));
  118 + }
  119 +
  120 + stationCacheMap = tempMap;
  121 + }
  122 +
  123 + //加载停车场数据
  124 + sql = "select PARK_CODE, ST_AsText(G_PARK_POINT) as G_PARK_POINT from bsth_c_car_park where park_code is not null and b_park_point is not null";
  125 + List<Map<String, Object>> tccList = jdbcTemplate.queryForList(sql);
  126 + Map<String, Polygon> tccTempMap = new HashMap<>();
  127 +
  128 + Polygon polygon;
  129 + for (Map<String, Object> tMap : tccList) {
  130 +
  131 + try {
  132 + polygon = geometryFactory.createPolygon(parsePolygon(tMap.get("G_PARK_POINT").toString()));
  133 + tccTempMap.put(tMap.get("PARK_CODE").toString()
  134 + , polygon);
  135 + } catch (Exception e) {
  136 + logger.error("停车场:" + tMap.get("PARK_CODE") , e);
  137 + }
  138 + }
  139 +
  140 + if(tccTempMap.size() > 0)
  141 + tccMap = tccTempMap;
  142 + }
  143 +
  144 + private void connectStationRoute(List<StationRoute> list) {
  145 + int size = list.size();
  146 + StationRoute sr = null;
  147 + for (int i = 0; i < size; i++) {
  148 + sr = list.get(i);
  149 + //上一个
  150 + if (i > 0)
  151 + sr.setPrve(list.get(i - 1));
  152 + //下一个
  153 + if (i < size - 1)
  154 + sr.setNext(list.get(i + 1));
  155 + }
  156 + }
  157 +
  158 + public Coordinate[] parsePolygon(String polygonStr) {
  159 + String[] coords = polygonStr.substring(9, polygonStr.length() - 2).split(","), temps;
  160 +
  161 + Coordinate[] cds = new Coordinate[coords.length];
  162 + int len = coords.length;
  163 + for (int i = 0; i < len; i++) {
  164 + temps = coords[i].split(" ");
  165 + cds[i] = new Coordinate(Float.parseFloat(temps[1]), Float.parseFloat(temps[0]));
  166 + }
  167 + return cds;
  168 + }
  169 +
  170 +}
0 \ No newline at end of file 171 \ No newline at end of file
src/main/java/com/bsth/data/gpsdata/analyse/GpsAnalyse.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.gpsdata.analyse.components.GpsArrival;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +
  8 +import java.util.concurrent.ExecutorService;
  9 +import java.util.concurrent.Executors;
  10 +
  11 +/**
  12 + * 分析gps状态信息
  13 + * Created by panzhao on 2016/12/23.
  14 + */
  15 +public class GpsAnalyse {
  16 +
  17 + static Logger logger = LoggerFactory.getLogger(GpsAnalyse.class);
  18 +
  19 + //线程池
  20 + static ExecutorService threadPool = Executors.newFixedThreadPool(50);
  21 +
  22 + public static void start(GpsEntity gps) {
  23 + threadPool.execute(new ArrivalMatchThread(gps));
  24 + }
  25 +
  26 + public static class ArrivalMatchThread implements Runnable {
  27 +
  28 + private GpsEntity gps;
  29 +
  30 + public ArrivalMatchThread(GpsEntity gps) {
  31 + this.gps = gps;
  32 + }
  33 +
  34 + @Override
  35 + public void run() {
  36 + GpsArrival.arrival(gps);
  37 + }
  38 + }
  39 +}
0 \ No newline at end of file 40 \ No newline at end of file
src/main/java/com/bsth/data/gpsdata/analyse/StationRoute.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import com.vividsolutions.jts.geom.Point;
  4 +import com.vividsolutions.jts.geom.Polygon;
  5 +
  6 +/**
  7 + * Created by panzhao on 2016/12/23.
  8 + */
  9 +public class StationRoute {
  10 +
  11 + /**
  12 + * 线路编码
  13 + */
  14 + private String lineCode;
  15 +
  16 + /**
  17 + * 上下行
  18 + */
  19 + private int directions;
  20 +
  21 + /**
  22 + * 站点编码
  23 + */
  24 + private String code;
  25 +
  26 + /**
  27 + * 路由顺序
  28 + */
  29 + private int routeSort;
  30 +
  31 + /**
  32 + * 站点位置
  33 + */
  34 + private Point point;
  35 +
  36 + /**
  37 + * 圆形半径
  38 + */
  39 + private Float radius;
  40 +
  41 + /**
  42 + * 多边形电子围栏
  43 + */
  44 + private Polygon polygon;
  45 +
  46 + /**
  47 + * 站点标记
  48 + */
  49 + private String mark;
  50 +
  51 + /**
  52 + * 下一站
  53 + */
  54 + private StationRoute next;
  55 +
  56 + /**
  57 + * 上一站
  58 + */
  59 + private StationRoute prve;
  60 +
  61 + public String getCode() {
  62 + return code;
  63 + }
  64 +
  65 + public void setCode(String code) {
  66 + this.code = code;
  67 + }
  68 +
  69 + public int getRouteSort() {
  70 + return routeSort;
  71 + }
  72 +
  73 + public void setRouteSort(int routeSort) {
  74 + this.routeSort = routeSort;
  75 + }
  76 +
  77 + public Point getPoint() {
  78 + return point;
  79 + }
  80 +
  81 + public void setPoint(Point point) {
  82 + this.point = point;
  83 + }
  84 +
  85 + public Float getRadius() {
  86 + return radius;
  87 + }
  88 +
  89 + public void setRadius(Float radius) {
  90 + this.radius = radius;
  91 + }
  92 +
  93 + public Polygon getPolygon() {
  94 + return polygon;
  95 + }
  96 +
  97 + public void setPolygon(Polygon polygon) {
  98 + this.polygon = polygon;
  99 + }
  100 +
  101 + public String getLineCode() {
  102 + return lineCode;
  103 + }
  104 +
  105 + public void setLineCode(String lineCode) {
  106 + this.lineCode = lineCode;
  107 + }
  108 +
  109 + public int getDirections() {
  110 + return directions;
  111 + }
  112 +
  113 + public void setDirections(int directions) {
  114 + this.directions = directions;
  115 + }
  116 +
  117 + public StationRoute getNext() {
  118 + return next;
  119 + }
  120 +
  121 + public void setNext(StationRoute next) {
  122 + this.next = next;
  123 + }
  124 +
  125 + public StationRoute getPrve() {
  126 + return prve;
  127 + }
  128 +
  129 + public void setPrve(StationRoute prve) {
  130 + this.prve = prve;
  131 + }
  132 +
  133 + public String getMark() {
  134 + return mark;
  135 + }
  136 +
  137 + public void setMark(String mark) {
  138 + this.mark = mark;
  139 + }
  140 +}
  141 +
src/main/java/com/bsth/data/gpsdata/analyse/StationRouteComp.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import java.util.Comparator;
  4 +
  5 +/**
  6 + * Created by panzhao on 2016/12/24.
  7 + */
  8 +public class StationRouteComp implements Comparator<StationRoute>{
  9 + @Override
  10 + public int compare(StationRoute s1, StationRoute s2) {
  11 + return s1.getRouteSort() - s2.getRouteSort();
  12 + }
  13 +}
src/main/java/com/bsth/data/gpsdata/analyse/components/GpsArrival.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse.components;
  2 +
  3 +import com.bsth.data.LineConfigData;
  4 +import com.bsth.data.gpsdata.GpsEntity;
  5 +import com.bsth.data.gpsdata.analyse.CircleQueue;
  6 +import com.bsth.data.gpsdata.analyse.GeoCacheData;
  7 +import com.bsth.data.gpsdata.analyse.StationRoute;
  8 +import com.bsth.data.gpsdata.analyse.util.GeoUtils;
  9 +import com.bsth.data.schedule.DayOfSchedule;
  10 +import com.bsth.entity.realcontrol.LineConfig;
  11 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.BeansException;
  15 +import org.springframework.context.ApplicationContext;
  16 +import org.springframework.context.ApplicationContextAware;
  17 +import org.springframework.stereotype.Component;
  18 +
  19 +import java.util.List;
  20 +
  21 +/**
  22 + * gps 到离站判断
  23 + * Created by panzhao on 2016/12/24.
  24 + */
  25 +@Component
  26 +public class GpsArrival implements ApplicationContextAware {
  27 +
  28 + static Logger logger = LoggerFactory.getLogger(GpsArrival.class);
  29 +
  30 + static DayOfSchedule dayOfSchedule;
  31 +
  32 + static LineConfigData lineConfigData;
  33 +
  34 + public static void arrival(GpsEntity gps) {
  35 +
  36 + if (gps.getLat() == 0 || gps.getLon() == 0) {
  37 + //logger.error("无效的gps");
  38 + return;
  39 + }
  40 +
  41 + Object task = DayOfSchedule.executeCurr(gps.getNbbm());
  42 + if (task == null)
  43 + return;
  44 + if (task.getClass().isAssignableFrom(ScheduleRealInfo.class)) {
  45 + ScheduleRealInfo sch = (ScheduleRealInfo) task;
  46 + //和班次同步走向
  47 + gps.setUpDown(Integer.parseInt(sch.getXlDir()));
  48 +
  49 + //出场
  50 + if (sch.getBcType().equals("out")) {
  51 + outCarpark(gps, sch);
  52 + }
  53 + else if (sch.getBcType().equals("normal"))
  54 + normalInOut(gps, sch);
  55 + else if(sch.getBcType().equals("in")){
  56 + inCarpark(gps, sch);
  57 + }
  58 + }
  59 +
  60 + GeoCacheData.putGps(gps);
  61 + }
  62 +
  63 + /**
  64 + * 正常班次
  65 + *
  66 + * @param gps
  67 + * @param sch
  68 + */
  69 + private static void normalInOut(GpsEntity gps, ScheduleRealInfo sch) {
  70 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  71 + GpsEntity prev = null;
  72 + if (queue != null)
  73 + prev = queue.getTail();
  74 +
  75 + List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), gps.getUpDown());
  76 + StationRoute station = GeoUtils.gpsInStation(gps, srs);
  77 +
  78 + if (station != null) {
  79 + //站内
  80 + gps.setStopNo(station.getCode());
  81 + gps.setInstation(true);
  82 + stationInside(gps, prev, sch);
  83 + } else {
  84 + //站外
  85 + stationOutside(gps, prev, sch);
  86 + }
  87 + }
  88 +
  89 + /**
  90 + * GPS在站点内
  91 + *
  92 + * @param gps
  93 + * @param prev
  94 + * @param sch
  95 + */
  96 + private static void stationInside(GpsEntity gps, GpsEntity prev, ScheduleRealInfo sch) {
  97 + if(prev == null)
  98 + return;
  99 +
  100 + if (gps.getStopNo().equals(sch.getZdzCode()) && sch.getZdsjActual() == null) {
  101 + //到终点站
  102 + arriveEnd(sch, gps);
  103 + return;
  104 + }
  105 +
  106 + //上一个点在站外
  107 + if(!prev.isInstation())
  108 + return;
  109 + //超过 (待发时间 + 90%的单程运送时间),还在起点站。默认烂一圈
  110 + if (prev.getStopNo().equals(gps.getStopNo())){
  111 + if(gps.getStopNo().equals(sch.getQdzCode())
  112 + && gps.getTimestamp() > sch.getDfsjT() + (sch.getBcsj() * 60 * 1000 * 0.9)){
  113 +
  114 + ScheduleRealInfo next = dayOfSchedule.next(dayOfSchedule.next(sch));
  115 + dayOfSchedule.addExecPlan(next);
  116 + }
  117 + return;
  118 + }
  119 +
  120 + //发车
  121 + if (prev.getStopNo().equals(sch.getQdzCode())) {
  122 + busWillDepart(sch, gps);
  123 + return;
  124 + }
  125 +
  126 + //中途站
  127 + StationRoute prevStation = GeoCacheData.getStation(prev.getLineId(), prev.getUpDown(), prev.getStopNo());
  128 + StationRoute currStation = GeoCacheData.getStation(gps.getLineId(), gps.getUpDown(), gps.getStopNo());
  129 + if (currStation.getRouteSort() < prevStation.getRouteSort()) {
  130 + //开始下一个班次
  131 + finishPlan(sch);
  132 +
  133 + logger.info("路由反向。。。。。。:" + gps.getTimestamp());
  134 + //为班次补上实际时间
  135 +
  136 + }
  137 + }
  138 +
  139 + /**
  140 + * GPS在站点外
  141 + *
  142 + * @param gps
  143 + * @param prev
  144 + * @param sch
  145 + */
  146 + private static void stationOutside(GpsEntity gps, GpsEntity prev, ScheduleRealInfo sch) {
  147 + if(prev == null)
  148 + return;
  149 +
  150 + gps.setStopNo(prev.getStopNo());
  151 + if (prev.isInstation() && prev.getStopNo().equals(sch.getQdzCode())) {
  152 + //发车
  153 + busWillDepart(sch, gps);
  154 + return;
  155 + }
  156 + }
  157 +
  158 + /**
  159 + * 公交车起点发出
  160 + */
  161 + final static long DRIFT_VAL_TIME = 1000 * 60 * 10;
  162 + //班次最大差值1小时
  163 + final static long MAX_DIFF = 1000 * 60 * 60;
  164 + private static void busWillDepart(ScheduleRealInfo sch, GpsEntity gps) {
  165 + //实发时间不覆盖
  166 + if (sch.getFcsjActual() == null && Math.abs(gps.getTimestamp() - sch.getDfsjT()) < MAX_DIFF) {
  167 +
  168 + //提前10分钟以上发出,判断一下是否是漂移
  169 + if(sch.getDfsjT() - gps.getTimestamp() > DRIFT_VAL_TIME){
  170 + ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
  171 + if(schPrev != null && schPrev.getZdsjActual() != null){
  172 + //计划停站时间
  173 + long stopTimeJH = sch.getDfsjT() - schPrev.getZdsjT();
  174 + //实际停站时间
  175 + long actualStopTime = gps.getTimestamp() - schPrev.getZdsjActualTime();
  176 + /*
  177 + 没停够计划百分之60的,算漂移
  178 + (这里出现的误判,由程序在车辆到中途站的时候进行补偿)
  179 + */
  180 + if(stopTimeJH * 0.6 < actualStopTime){
  181 + logger.info("漂移.... 车辆:" + gps.getNbbm() + " ts: " + gps.getTimestamp());
  182 + return;
  183 + }
  184 + }
  185 + }
  186 +
  187 + LineConfig config = lineConfigData.get(sch.getXlBm());
  188 + if(config != null && config.getOutConfig() == 2){
  189 + //出站既出场
  190 + ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
  191 + if(schPrev.getBcType().equals("out")){
  192 + schPrev.setFcsjActualAll(schPrev.getDfsjT());
  193 + schPrev.setZdsjActualAll(schPrev.getZdsjT());
  194 + }
  195 + }
  196 +
  197 + sch.setFcsjActualAll(gps.getTimestamp());
  198 + logger.info("(站外)班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
  199 + }
  200 + }
  201 +
  202 + /**
  203 + * 公交车到达终点
  204 + *
  205 + * @param sch
  206 + * @param gps
  207 + */
  208 + private static void arriveEnd(ScheduleRealInfo sch, GpsEntity gps) {
  209 + sch.setZdsjActualAll(gps.getTimestamp());
  210 + ScheduleRealInfo next = finishPlan(sch);
  211 + logger.info("班次:" + sch.getDfsj() + "到达终点, 时间:" + sch.getZdsjActual());
  212 +
  213 + if (next == null)
  214 + return;
  215 +
  216 + //将gps转换为下一个班次走向的站内信号
  217 + int updown = Integer.parseInt(next.getXlDir());
  218 + List<StationRoute> srs = GeoCacheData.getStationRoute(next.getXlBm(), updown);
  219 + StationRoute station = GeoUtils.gpsInStation(gps, srs);
  220 + if (station != null) {
  221 + gps.setUpDown(updown);
  222 + gps.setStopNo(station.getCode());
  223 + }
  224 + }
  225 +
  226 + /**
  227 + * 出场班次
  228 + *
  229 + * @param gps
  230 + * @param sch
  231 + */
  232 + private static void outCarpark(GpsEntity gps, ScheduleRealInfo sch) {
  233 + String carpark = GeoUtils.gpsInCarpark(gps);
  234 + if (carpark != null) {
  235 + gps.setInstation(true);
  236 + gps.setStopNo(carpark);
  237 + return; // 还在场内
  238 + }
  239 +
  240 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  241 + if (queue == null)
  242 + return;
  243 + //上一个gps
  244 + GpsEntity prev = queue.getTail();
  245 +
  246 + if (carpark == null && prev.isInstation() && prev.getStopNo().equals(sch.getQdzCode())) {
  247 + gps.setStopNo(prev.getStopNo());
  248 + //停车场发出
  249 + busWillDepart(sch, gps);
  250 + return;
  251 + }
  252 +
  253 + List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), gps.getUpDown());
  254 + StationRoute station = GeoUtils.gpsInStation(gps, srs);
  255 +
  256 + if (station != null && station.getCode().equals(sch.getZdzCode())) {
  257 + gps.setStopNo(station.getCode());
  258 + //到达终点
  259 + arriveEnd(sch, gps);
  260 + }
  261 + }
  262 +
  263 +
  264 + /**
  265 + * 进场班次
  266 + * @param gps
  267 + * @param sch
  268 + */
  269 + private static void inCarpark(GpsEntity gps, ScheduleRealInfo sch) {
  270 + String carpark = GeoUtils.gpsInCarpark(gps);
  271 + if (carpark != null && carpark.equals(sch.getZdzCode())) {
  272 + //进场班次取第一个实际进场时间
  273 + if(sch.getZdsjActual() != null)
  274 + return;
  275 +
  276 + //进场
  277 + arriveEnd(sch, gps);
  278 + return;
  279 + }
  280 +
  281 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  282 + if (queue == null)
  283 + return;
  284 + //上一个gps
  285 + GpsEntity prev = queue.getTail();
  286 +
  287 + if (carpark == null && prev.isInstation() && prev.getStopNo().equals(sch.getQdzCode())) {
  288 + gps.setStopNo(prev.getStopNo());
  289 + //进场班次发出
  290 + busWillDepart(sch, gps);
  291 + return;
  292 + }
  293 + }
  294 +
  295 + /**
  296 + * 完成班次 -返回下一个班次
  297 + *
  298 + * @param sch
  299 + */
  300 + private static ScheduleRealInfo finishPlan(ScheduleRealInfo sch) {
  301 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  302 + if (next != null) {
  303 + next.setQdzArrDatesj(sch.getZdsjActual());
  304 + dayOfSchedule.addExecPlan(next);
  305 + }
  306 + return next;
  307 + }
  308 +
  309 + @Override
  310 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  311 + dayOfSchedule = applicationContext.getBean(DayOfSchedule.class);
  312 + lineConfigData = applicationContext.getBean(LineConfigData.class);
  313 + }
  314 +}
src/main/java/com/bsth/data/gpsdata/analyse/components/GpsStateCorrective.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse.components;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.schedule.DayOfSchedule;
  5 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import com.vividsolutions.jts.geom.GeometryFactory;
  7 +import org.joda.time.format.DateTimeFormat;
  8 +import org.joda.time.format.DateTimeFormatter;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.BeansException;
  12 +import org.springframework.context.ApplicationContext;
  13 +import org.springframework.context.ApplicationContextAware;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +/**
  17 + * GPS状态纠正
  18 + * Created by panzhao on 2016/12/23.
  19 + */
  20 +@Component
  21 +public class GpsStateCorrective implements ApplicationContextAware {
  22 +
  23 + static Logger logger = LoggerFactory.getLogger(GpsStateCorrective.class);
  24 +
  25 + static DayOfSchedule dayOfSchedule;
  26 +
  27 + private static GeometryFactory geometryFactory = new GeometryFactory();
  28 +
  29 + public static void correct(GpsEntity gps, ScheduleRealInfo sch){
  30 +/* int upDown = Integer.parseInt(sch.getXlDir());
  31 + gps.setUpDown(upDown);
  32 + List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), upDown);
  33 +
  34 + Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
  35 +
  36 + //之前的点位
  37 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  38 + GpsEntity prev = null;
  39 + if(queue != null)
  40 + prev = queue.getTail();
  41 +
  42 + //线路上,站点间
  43 + StationRoute station = GeoUtils.pointInStation(point, srs);
  44 + //在站内
  45 + if(station != null){
  46 + gps.setStopNo(station.getCode());
  47 + gps.setInstation(true);
  48 + gps.setStation(station);
  49 +
  50 + if(prev != null && prev.getUpDown() == upDown){
  51 + StationRoute prevStation = GeoCacheData.getStation(prev.getLineId(), upDown, prev.getStopNo());
  52 +
  53 + //倒着开??
  54 + if(prevStation.getRouteSort() > station.getRouteSort()){
  55 + reversalHandle(gps, prev, sch);
  56 + }
  57 + }
  58 + }
  59 + else{
  60 + if(prev != null)
  61 + gps.setStopNo(prev.getStopNo());
  62 + }
  63 +
  64 + //是否在停车场内
  65 + Map<String, Polygon> carparkMap = GeoCacheData.tccMap;
  66 + Set<String> codes = carparkMap.keySet();
  67 + Polygon p;
  68 + for(String code : codes){
  69 + p = carparkMap.get(code);
  70 + //场内
  71 + if(p.contains(point)){
  72 + gps.setCarparkNo(code);
  73 + if(sch.getBcType().equals("out")){
  74 + gps.setInstation(true);
  75 + gps.setStopNo(code);
  76 + }
  77 + }
  78 + }*/
  79 + }
  80 +
  81 + private static DateTimeFormatter fmt = DateTimeFormat.forPattern("HH:mm");
  82 +
  83 + private static void reversalHandle(GpsEntity gps, GpsEntity prev, ScheduleRealInfo sch){
  84 + /*if(sch.getBcType().equals("out") && gps.getTimestamp() < sch.getZdsjT())
  85 + return;
  86 +
  87 + //先假设没到终点,直接开始了下一个班次
  88 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  89 + String log = "倒着开??? nbbm: " + gps.getNbbm() + " 当前:" + gps.getStopNo() + " 上一站:" + prev.getStopNo() + " 当前班次:" + sch.getDfsj();
  90 + if(next != null){
  91 + dayOfSchedule.addExecPlan(next);
  92 +
  93 + log += (" 下一个班次:" + next.getDfsj());
  94 + }
  95 +
  96 + log += (" GPS时间:" + fmt.print(gps.getTimestamp()));
  97 +
  98 + logger.info(log);*/
  99 + }
  100 +
  101 + @Override
  102 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  103 + dayOfSchedule = applicationContext.getBean(DayOfSchedule.class);
  104 + }
  105 +}
src/main/java/com/bsth/data/gpsdata/analyse/util/GeoUtils.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse.util;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.gpsdata.analyse.GeoCacheData;
  5 +import com.bsth.data.gpsdata.analyse.StationRoute;
  6 +import com.vividsolutions.jts.geom.Coordinate;
  7 +import com.vividsolutions.jts.geom.GeometryFactory;
  8 +import com.vividsolutions.jts.geom.Point;
  9 +import com.vividsolutions.jts.geom.Polygon;
  10 +
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +import java.util.Set;
  14 +
  15 +/**
  16 + * Created by panzhao on 2016/12/23.
  17 + */
  18 +public class GeoUtils {
  19 +
  20 + private final static double EARTHRADIUS = 6378137;
  21 +
  22 + private static GeometryFactory geometryFactory = new GeometryFactory();
  23 + /**
  24 + * gps是否在路由上的某个站内
  25 + *
  26 + * @param gps
  27 + * @param srs
  28 + * @return
  29 + */
  30 + public static StationRoute gpsInStation(GpsEntity gps, List<StationRoute> srs) {
  31 + Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
  32 + double min = -1, distance, distance2;
  33 + StationRoute stationRoute = null;
  34 +
  35 + for (StationRoute sr : srs) {
  36 + if (sr.getPolygon() == null) {
  37 + //圆形
  38 + distance = getDistance(sr.getPoint(), point);//sr.getPoint().distance(point);
  39 +
  40 + if (distance > sr.getRadius())
  41 + continue;
  42 +
  43 + if (min > distance || min == -1) {
  44 + min = distance;
  45 + stationRoute = sr;
  46 + }
  47 + } else {
  48 + //多边形
  49 + if (sr.getPolygon().contains(point)) {
  50 + stationRoute = sr;
  51 + break;
  52 + }
  53 + }
  54 + }
  55 + return stationRoute;
  56 + }
  57 +
  58 + public static double getDistance(Point p1, Point p2) {
  59 + double lng1 = getLoop(p1.getY(), -180, 180), lat1 = getRange(
  60 + p1.getX(), -74, 74);
  61 + double lng2 = getLoop(p2.getY(), -180, 180), lat2 = getRange(
  62 + p2.getX(), -74, 74);
  63 +
  64 + double x1, x2, y1, y2;
  65 + x1 = degreeToRad(lng1);
  66 + y1 = degreeToRad(lat1);
  67 + x2 = degreeToRad(lng2);
  68 + y2 = degreeToRad(lat2);
  69 + return EARTHRADIUS
  70 + * Math.acos((Math.sin(y1) * Math.sin(y2) + Math.cos(y1)
  71 + * Math.cos(y2) * Math.cos(x2 - x1)));
  72 + }
  73 +
  74 + private static double getLoop(double v, double a, double b) {
  75 + while (v > b) {
  76 + v -= b - a;
  77 + }
  78 + while (v < a) {
  79 + v += b - a;
  80 + }
  81 + return v;
  82 + }
  83 +
  84 + private static double getRange(double v, double a, double b) {
  85 + v = Math.min(Math.max(v, a), b);
  86 + return v;
  87 + }
  88 +
  89 + private static double degreeToRad(double degree) {
  90 + return Math.PI * degree / 180;
  91 + }
  92 +
  93 +
  94 + /**
  95 + * gps 是否在某个停车场内
  96 + * @param gps
  97 + * @return
  98 + */
  99 + public static String gpsInCarpark(GpsEntity gps){
  100 + Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
  101 +
  102 + Map<String, Polygon> carparkMap = GeoCacheData.tccMap;
  103 + Set<String> codes = carparkMap.keySet();
  104 + Polygon polygon;
  105 + for(String code : codes){
  106 + polygon = carparkMap.get(code);
  107 + if(point.within(polygon)){
  108 + return code;
  109 + }
  110 + }
  111 + return null;
  112 + }
  113 +
  114 + /**
  115 + * 是否是有效的连续点
  116 + * @param prevGps
  117 + * @param gps
  118 + * @return
  119 + */
  120 + public static boolean overdue(GpsEntity prevGps, GpsEntity gps) {
  121 + return gps.getTimestamp() - prevGps.getTimestamp() < 120000;
  122 + }
  123 +}
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java 0 → 100644
  1 +package com.bsth.data.gpsdata.recovery;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.data.gpsdata.GpsEntity;
  5 +import com.bsth.data.gpsdata.analyse.components.GpsArrival;
  6 +import com.bsth.util.db.DBUtils_MS;
  7 +import com.google.common.collect.ArrayListMultimap;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.jdbc.core.JdbcTemplate;
  11 +import org.springframework.jdbc.core.RowMapper;
  12 +
  13 +import java.sql.ResultSet;
  14 +import java.sql.SQLException;
  15 +import java.util.*;
  16 +import java.util.concurrent.CountDownLatch;
  17 +import java.util.concurrent.ExecutorService;
  18 +import java.util.concurrent.Executors;
  19 +
  20 +/**
  21 + * 数据恢复
  22 + * Created by panzhao on 2016/12/24.
  23 + */
  24 +public class GpsDataRecovery {
  25 +
  26 + static Logger logger = LoggerFactory.getLogger(GpsDataRecovery.class);
  27 +
  28 + public static boolean run;
  29 +
  30 + static ExecutorService threadPool = Executors.newFixedThreadPool(50);
  31 +
  32 + private static CountDownLatch count;
  33 +
  34 + public static void recovery() {
  35 + List<GpsEntity> list = loadData();
  36 +
  37 + //按车辆分组数据
  38 + ArrayListMultimap<String, GpsEntity> listMap = ArrayListMultimap.create();
  39 + for (GpsEntity gps : list) {
  40 + if(gps.getNbbm() != null)
  41 + listMap.put(gps.getNbbm(), gps);
  42 + }
  43 +
  44 + count = new CountDownLatch(listMap.keySet().size());
  45 +
  46 + Set<String> keys = listMap.keySet();
  47 + for (String nbbm : keys) {
  48 + threadPool.execute(new RecoveryDataThread(listMap.get(nbbm), count));
  49 + /*if(nbbm.equals("W9A-250"))
  50 + new RecoveryDataThread(listMap.get(nbbm), count).run();*/
  51 + }
  52 + try {
  53 + //等待子线程结束
  54 + count.await();
  55 + logger.info("GPS 数据恢复完成....");
  56 + } catch (InterruptedException e) {
  57 + logger.error("", e);
  58 + }
  59 + }
  60 +
  61 + /**
  62 + * 加载当天的gps数据
  63 + *
  64 + * @return
  65 + */
  66 + public static List<GpsEntity> loadData() {
  67 + Calendar calendar = Calendar.getInstance();
  68 + int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
  69 +
  70 + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from BSTH_C_GPS_INFO where days_year=" + dayOfYear;
  71 + JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource());
  72 +
  73 + List<GpsEntity> list =
  74 + jdbcTemplate.query(sql, new RowMapper<GpsEntity>() {
  75 + @Override
  76 + public GpsEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
  77 + GpsEntity gps = new GpsEntity();
  78 +
  79 + gps.setDeviceId(rs.getString("DEVICE_ID"));
  80 + gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId()));
  81 + gps.setSpeed(rs.getFloat("SPEED_GPS"));
  82 + gps.setLat(rs.getFloat("LAT"));
  83 + gps.setLon(rs.getFloat("LON"));
  84 + gps.setLineId(rs.getString("LINE_ID"));
  85 + gps.setTimestamp(rs.getLong("TS"));
  86 + gps.setUpDown(getUpOrDown(rs.getLong("SERVICE_STATE")));
  87 + return gps;
  88 + }
  89 + });
  90 + return list;
  91 + }
  92 +
  93 + /**
  94 + * 王通 2016/6/29 9:23:24 获取车辆线路上下行
  95 + *
  96 + * @return -1无效 0上行 1下行
  97 + */
  98 + public static int getUpOrDown(long serviceState) {
  99 + if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000
  100 + || (serviceState & 0x01000000) == 0x01000000 || (serviceState & 0x08000000) == 0x08000000)
  101 + return -1;
  102 + return (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0);
  103 + }
  104 +
  105 + public static class RecoveryDataThread implements Runnable {
  106 +
  107 + List<GpsEntity> list;
  108 + CountDownLatch count;
  109 +
  110 + public RecoveryDataThread(List<GpsEntity> list, CountDownLatch count) {
  111 + this.list = list;
  112 + this.count = count;
  113 + }
  114 +
  115 + @Override
  116 + public void run() {
  117 + try {
  118 + //排序
  119 + Collections.sort(list, new GpsComp());
  120 + //依次跑完gps
  121 + //int i = 0;
  122 + for(GpsEntity gps : list){
  123 + /* i++;
  124 + if(i == 383){
  125 + System.out.println("aaa");
  126 + }*/
  127 + GpsArrival.arrival(gps);
  128 + }
  129 + } catch (Exception e) {
  130 + logger.error("", e);
  131 + } finally {
  132 + count.countDown();
  133 + }
  134 + }
  135 + }
  136 +
  137 + public static class GpsComp implements Comparator<GpsEntity>{
  138 +
  139 + @Override
  140 + public int compare(GpsEntity g1, GpsEntity g2) {
  141 + return (int) (g1.getTimestamp() - g2.getTimestamp());
  142 + }
  143 + }
  144 +}
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -3,9 +3,11 @@ package com.bsth.data.schedule; @@ -3,9 +3,11 @@ package com.bsth.data.schedule;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
5 import com.bsth.Application; 5 import com.bsth.Application;
  6 +import com.bsth.data.BasicData;
6 import com.bsth.data.LineConfigData; 7 import com.bsth.data.LineConfigData;
7 import com.bsth.data.directive.FirstScheduleCheckThread; 8 import com.bsth.data.directive.FirstScheduleCheckThread;
8 import com.bsth.data.gpsdata.GpsRealData; 9 import com.bsth.data.gpsdata.GpsRealData;
  10 +import com.bsth.data.gpsdata.recovery.GpsDataRecovery;
9 import com.bsth.data.schedule.thread.ScheduleLateThread; 11 import com.bsth.data.schedule.thread.ScheduleLateThread;
10 import com.bsth.data.schedule.thread.SchedulePstThread; 12 import com.bsth.data.schedule.thread.SchedulePstThread;
11 import com.bsth.data.schedule.thread.ScheduleRefreshThread; 13 import com.bsth.data.schedule.thread.ScheduleRefreshThread;
@@ -111,17 +113,28 @@ public class DayOfSchedule implements CommandLineRunner { @@ -111,17 +113,28 @@ public class DayOfSchedule implements CommandLineRunner {
111 @Autowired 113 @Autowired
112 SubmitToTrafficManage submitToTrafficManage; 114 SubmitToTrafficManage submitToTrafficManage;
113 115
  116 + @Autowired
  117 + LineConfigData lineConfigs;
  118 +
  119 + @Autowired
  120 + BasicData.BasicDataLoader dataLoader;
  121 +
114 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd") 122 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd")
115 ,fmtHHmm = DateTimeFormat.forPattern("HH:mm"); 123 ,fmtHHmm = DateTimeFormat.forPattern("HH:mm");
116 124
117 @Override 125 @Override
118 public void run(String... arg0) throws Exception { 126 public void run(String... arg0) throws Exception {
  127 + //加载基础数据
  128 + dataLoader.loadAllData();
  129 + //从数据库恢复排班
  130 + //dataRecovery();
  131 +
119 //翻班线程 132 //翻班线程
120 Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); 133 Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
121 //入库 134 //入库
122 Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); 135 Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
123 //首班出场指令补发器 136 //首班出场指令补发器
124 - Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS); 137 +// Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS);
125 //班次误点扫描 138 //班次误点扫描
126 Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); 139 Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
127 140
@@ -134,6 +147,23 @@ public class DayOfSchedule implements CommandLineRunner { @@ -134,6 +147,23 @@ public class DayOfSchedule implements CommandLineRunner {
134 //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); 147 //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
135 } 148 }
136 149
  150 + //数据恢复
  151 + private void dataRecovery() {
  152 + GpsDataRecovery.run = true;
  153 +
  154 + Collection<LineConfig> confs = lineConfigs.getAll();
  155 + String lineCode, currSchDate;
  156 + for(LineConfig conf : confs){
  157 + lineCode = conf.getLine().getLineCode();
  158 + currSchDate = calcSchDate(lineCode);
  159 + //加载班次数据
  160 + reloadSch(lineCode, currSchDate, false);
  161 + }
  162 +
  163 + //恢复gps数据
  164 + GpsDataRecovery.recovery();
  165 + }
  166 +
137 public Map<String, String> getCurrSchDate() { 167 public Map<String, String> getCurrSchDate() {
138 return currSchDateMap; 168 return currSchDateMap;
139 } 169 }
@@ -189,17 +219,20 @@ public class DayOfSchedule implements CommandLineRunner { @@ -189,17 +219,20 @@ public class DayOfSchedule implements CommandLineRunner {
189 putAll(list); 219 putAll(list);
190 220
191 Set<String> cars = searchAllCars(list); 221 Set<String> cars = searchAllCars(list);
192 - //计算“起点站应到”时间  
193 - for(String nbbm : cars) 222 + for(String nbbm : cars){
  223 + //计算“起点站应到”时间
194 schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); 224 schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm));
195 - 225 + //车辆 ——> 要执行的班次对照
  226 + carExecutePlanMap.put(nbbm, schAttrCalculator.calcCurrentExecSch(nbbmScheduleMap.get(nbbm)));
  227 + }
  228 +
196 //是否是出站即出场 229 //是否是出站即出场
197 LineConfig conf = lineConfigData.get(lineCode); 230 LineConfig conf = lineConfigData.get(lineCode);
198 if(conf.getOutConfig() == 2){ 231 if(conf.getOutConfig() == 2){
199 for(String nbbm : cars) 232 for(String nbbm : cars)
200 schAttrCalculator.connectOutSchedule(nbbmScheduleMap.get(nbbm)); 233 schAttrCalculator.connectOutSchedule(nbbmScheduleMap.get(nbbm));
201 } 234 }
202 - 235 +
203 // 页面 翻班通知 236 // 页面 翻班通知
204 sendUtils.shiftSchedule(lineCode); 237 sendUtils.shiftSchedule(lineCode);
205 } catch (Exception e) { 238 } catch (Exception e) {
@@ -451,6 +484,10 @@ public class DayOfSchedule implements CommandLineRunner { @@ -451,6 +484,10 @@ public class DayOfSchedule implements CommandLineRunner {
451 public ScheduleRealInfo next(ScheduleRealInfo sch) { 484 public ScheduleRealInfo next(ScheduleRealInfo sch) {
452 485
453 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); 486 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
  487 + int outConfig = -1;
  488 + LineConfig config = lineConfigData.get(sch.getXlBm());
  489 + if(config != null)
  490 + outConfig = config.getOutConfig();
454 491
455 boolean flag = false; 492 boolean flag = false;
456 ScheduleRealInfo next = null; 493 ScheduleRealInfo next = null;
@@ -462,6 +499,10 @@ public class DayOfSchedule implements CommandLineRunner { @@ -462,6 +499,10 @@ public class DayOfSchedule implements CommandLineRunner {
462 //忽略烂班 499 //忽略烂班
463 if(temp.isDestroy()) 500 if(temp.isDestroy())
464 continue; 501 continue;
  502 +
  503 + //出站既出场,忽略出场班次
  504 + if(outConfig == 2 && temp.getBcType().equals("out"))
  505 + continue;
465 506
466 if(flag){ 507 if(flag){
467 next = temp; 508 next = temp;
@@ -471,6 +512,30 @@ public class DayOfSchedule implements CommandLineRunner { @@ -471,6 +512,30 @@ public class DayOfSchedule implements CommandLineRunner {
471 return next; 512 return next;
472 } 513 }
473 514
  515 + /**
  516 + * 上一个班次
  517 + * @param sch
  518 + * @return
  519 + */
  520 + public ScheduleRealInfo prev(ScheduleRealInfo sch){
  521 + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
  522 +
  523 + //boolean flag = false;
  524 + ScheduleRealInfo prev = null;
  525 + int size = list.size();
  526 +
  527 + for(int i = 0; i < size; i ++){
  528 + if(list.get(i).isDestroy())
  529 + continue;
  530 +
  531 + if(list.get(i).getId().equals(sch.getId())){
  532 + return prev;
  533 + }
  534 + prev = list.get(i);
  535 + }
  536 + return prev;
  537 + }
  538 +
474 public void put(ScheduleRealInfo sch) { 539 public void put(ScheduleRealInfo sch) {
475 schAttrCalculator 540 schAttrCalculator
476 .calcRealDate(sch) 541 .calcRealDate(sch)
@@ -666,9 +731,18 @@ public class DayOfSchedule implements CommandLineRunner { @@ -666,9 +731,18 @@ public class DayOfSchedule implements CommandLineRunner {
666 carExecutePlanMap.remove(clzbh); 731 carExecutePlanMap.remove(clzbh);
667 } 732 }
668 733
669 - public Map<String, ScheduleRealInfo> execPlamMap(){ 734 + public Map<String, ScheduleRealInfo> execPlanMap(){
670 return carExecutePlanMap; 735 return carExecutePlanMap;
671 } 736 }
  737 +
  738 + /**
  739 + * 车辆当前执行的班次
  740 + * @param nbbm
  741 + * @return
  742 + */
  743 + public static ScheduleRealInfo executeCurr(String nbbm){
  744 + return carExecutePlanMap.get(nbbm);
  745 + }
672 746
673 /** 747 /**
674 * @Title: changeCar 748 * @Title: changeCar
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
@@ -3,6 +3,7 @@ package com.bsth.data.schedule; @@ -3,6 +3,7 @@ package com.bsth.data.schedule;
3 import com.bsth.data.LineConfigData; 3 import com.bsth.data.LineConfigData;
4 import com.bsth.entity.realcontrol.LineConfig; 4 import com.bsth.entity.realcontrol.LineConfig;
5 import com.bsth.entity.realcontrol.ScheduleRealInfo; 5 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import org.apache.commons.lang3.StringUtils;
6 import org.joda.time.format.DateTimeFormat; 7 import org.joda.time.format.DateTimeFormat;
7 import org.joda.time.format.DateTimeFormatter; 8 import org.joda.time.format.DateTimeFormatter;
8 import org.slf4j.Logger; 9 import org.slf4j.Logger;
@@ -115,8 +116,11 @@ public class SchAttrCalculator { @@ -115,8 +116,11 @@ public class SchAttrCalculator {
115 ScheduleRealInfo prve = list.get(0), curr; 116 ScheduleRealInfo prve = list.get(0), curr;
116 for(int i = 1; i < len; i ++){ 117 for(int i = 1; i < len; i ++){
117 curr = list.get(i); 118 curr = list.get(i);
118 - if(prve.getZdzName().equals(curr.getQdzName())) 119 + if(prve.getZdzName().equals(curr.getQdzName())){
119 curr.setQdzArrDateJH(prve.getZdsj()); 120 curr.setQdzArrDateJH(prve.getZdsj());
  121 + if(StringUtils.isNotEmpty(prve.getZdsjActual()) && StringUtils.isEmpty(curr.getQdzArrDatesj()))
  122 + curr.setQdzArrDatesj(prve.getZdsjActual());
  123 + }
120 124
121 prve = curr; 125 prve = curr;
122 } 126 }
@@ -211,4 +215,30 @@ public class SchAttrCalculator { @@ -211,4 +215,30 @@ public class SchAttrCalculator {
211 if(sch.getZdsjActualTime() == null && sch.getZdsjActual() != null) 215 if(sch.getZdsjActualTime() == null && sch.getZdsjActual() != null)
212 sch.setZdsjActualAll(sch.getZdsjActual()); 216 sch.setZdsjActualAll(sch.getZdsjActual());
213 } 217 }
  218 +
  219 + /**
  220 + * 计算当前要执行的班次
  221 + * @param list
  222 + * @return
  223 + */
  224 + public ScheduleRealInfo calcCurrentExecSch(List<ScheduleRealInfo> list){
  225 + String lineCode = list.get(0).getXlBm();
  226 + LineConfig conf = lineConfigData.get(lineCode);
  227 + int outConfig = -1;
  228 + if(conf != null)
  229 + outConfig = conf.getOutConfig();
  230 +
  231 + for(ScheduleRealInfo sch : list){
  232 + //如果是出站既出场,忽略出场班次
  233 + if(outConfig == 2 && sch.getBcType().equals("out"))
  234 + continue;
  235 +
  236 + //已执行
  237 + if(StringUtils.isNotEmpty(sch.getZdsjActual()))
  238 + continue;
  239 +
  240 + return sch;
  241 + }
  242 + return null;
  243 + }
214 } 244 }
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
1 package com.bsth.data.schedule.thread; 1 package com.bsth.data.schedule.thread;
2 2
3 -import java.util.Collection;  
4 -import java.util.Set;  
5 -  
6 -import org.slf4j.Logger;  
7 -import org.slf4j.LoggerFactory;  
8 -import org.springframework.beans.factory.annotation.Autowired;  
9 -import org.springframework.stereotype.Component;  
10 -  
11 import com.bsth.data.BasicData; 3 import com.bsth.data.BasicData;
12 import com.bsth.data.LineConfigData; 4 import com.bsth.data.LineConfigData;
13 import com.bsth.data.arrival.ArrivalData_GPS; 5 import com.bsth.data.arrival.ArrivalData_GPS;
@@ -15,6 +7,13 @@ import com.bsth.data.directive.DayOfDirectives; @@ -15,6 +7,13 @@ import com.bsth.data.directive.DayOfDirectives;
15 import com.bsth.data.pilot80.PilotReport; 7 import com.bsth.data.pilot80.PilotReport;
16 import com.bsth.data.schedule.DayOfSchedule; 8 import com.bsth.data.schedule.DayOfSchedule;
17 import com.bsth.entity.realcontrol.LineConfig; 9 import com.bsth.entity.realcontrol.LineConfig;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import java.util.Collection;
  16 +import java.util.Set;
18 17
19 /** 18 /**
20 * 19 *
@@ -57,6 +56,7 @@ public class ScheduleRefreshThread extends Thread{ @@ -57,6 +56,7 @@ public class ScheduleRefreshThread extends Thread{
57 currSchDate = dayOfSchedule.calcSchDate(lineCode); 56 currSchDate = dayOfSchedule.calcSchDate(lineCode);
58 57
59 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){ 58 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){
  59 +
60 logger.info(lineCode + "开始翻班, " + currSchDate); 60 logger.info(lineCode + "开始翻班, " + currSchDate);
61 //清除进出站数据 61 //清除进出站数据
62 arrivalData.clearRAMData(lineCode); 62 arrivalData.clearRAMData(lineCode);
src/main/java/com/bsth/entity/CarDevice.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
3 -import com.bsth.entity.sys.SysUser; 3 +import com.bsth.entity.schedule.BEntity;
  4 +import org.joda.time.DateTime;
4 5
5 import javax.persistence.*; 6 import javax.persistence.*;
6 import java.util.Date; 7 import java.util.Date;
@@ -10,7 +11,7 @@ import java.util.Date; @@ -10,7 +11,7 @@ import java.util.Date;
10 */ 11 */
11 @Entity 12 @Entity
12 @Table(name = "bsth_c_car_device") 13 @Table(name = "bsth_c_car_device")
13 -public class CarDevice { 14 +public class CarDevice extends BEntity {
14 15
15 /** 主键 */ 16 /** 主键 */
16 @Id 17 @Id
@@ -62,18 +63,26 @@ public class CarDevice { @@ -62,18 +63,26 @@ public class CarDevice {
62 @Column(nullable = false) 63 @Column(nullable = false)
63 private Boolean isCancel = false; 64 private Boolean isCancel = false;
64 65
65 - /** 创建人 */  
66 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
67 - private SysUser createBy;  
68 - /** 修改人 */  
69 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
70 - private SysUser updateBy;  
71 - /** 创建日期 */  
72 - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
73 - private Date createDate;  
74 - /** 修改日期 */  
75 - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")  
76 - private Date updateDate; 66 + public CarDevice() {}
  67 + public CarDevice(Object id, Object xlid, Object clid, Object qyrq) {
  68 + if (id != null) {
  69 + this.id = Long.valueOf(id.toString());
  70 + }
  71 + if (xlid != null) {
  72 + this.xl = Integer.valueOf(xlid.toString());
  73 + }
  74 + if (clid != null) {
  75 + this.cl = Integer.valueOf(clid.toString());
  76 + }
  77 + if (qyrq != null) {
  78 + try {
  79 + this.qyrq = new Date();
  80 + this.qyrq.setTime(Long.parseLong(qyrq.toString()));
  81 + } catch (Exception exp) {
  82 + this.qyrq = new DateTime(qyrq.toString()).toDate();
  83 + }
  84 + }
  85 + }
77 86
78 public Long getId() { 87 public Long getId() {
79 return id; 88 return id;
@@ -179,38 +188,6 @@ public class CarDevice { @@ -179,38 +188,6 @@ public class CarDevice {
179 this.guaranteeDesc = guaranteeDesc; 188 this.guaranteeDesc = guaranteeDesc;
180 } 189 }
181 190
182 - public SysUser getCreateBy() {  
183 - return createBy;  
184 - }  
185 -  
186 - public void setCreateBy(SysUser createBy) {  
187 - this.createBy = createBy;  
188 - }  
189 -  
190 - public SysUser getUpdateBy() {  
191 - return updateBy;  
192 - }  
193 -  
194 - public void setUpdateBy(SysUser updateBy) {  
195 - this.updateBy = updateBy;  
196 - }  
197 -  
198 - public Date getCreateDate() {  
199 - return createDate;  
200 - }  
201 -  
202 - public void setCreateDate(Date createDate) {  
203 - this.createDate = createDate;  
204 - }  
205 -  
206 - public Date getUpdateDate() {  
207 - return updateDate;  
208 - }  
209 -  
210 - public void setUpdateDate(Date updateDate) {  
211 - this.updateDate = updateDate;  
212 - }  
213 -  
214 public Date getQyrq() { 191 public Date getQyrq() {
215 return qyrq; 192 return qyrq;
216 } 193 }
src/main/java/com/bsth/entity/Cars.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
3 -import com.bsth.entity.sys.SysUser; 3 +import com.bsth.entity.schedule.BEntity;
  4 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 5
5 import javax.persistence.*; 6 import javax.persistence.*;
6 import java.io.Serializable; 7 import java.io.Serializable;
@@ -22,7 +23,8 @@ import java.util.Date; @@ -22,7 +23,8 @@ import java.util.Date;
22 23
23 @Entity 24 @Entity
24 @Table(name = "bsth_c_cars") 25 @Table(name = "bsth_c_cars")
25 -public class Cars implements Serializable { 26 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
  27 +public class Cars extends BEntity implements Serializable {
26 28
27 /** 主键Id */ 29 /** 主键Id */
28 @Id 30 @Id
@@ -30,7 +32,7 @@ public class Cars implements Serializable { @@ -30,7 +32,7 @@ public class Cars implements Serializable {
30 private Integer id; 32 private Integer id;
31 33
32 /** 自编号/内部编号 */ 34 /** 自编号/内部编号 */
33 - @Column(nullable = false, length = 8, unique = true) 35 + @Column(nullable = false, length = 20, unique = true)
34 private String insideCode; 36 private String insideCode;
35 37
36 // 公司、分公司暂时不用关联实体 38 // 公司、分公司暂时不用关联实体
@@ -134,22 +136,25 @@ public class Cars implements Serializable { @@ -134,22 +136,25 @@ public class Cars implements Serializable {
134 /** 线路名称(TODO:在原系统里没有,这里暂时留着,并且不做线路关联,只保留个名字) */ 136 /** 线路名称(TODO:在原系统里没有,这里暂时留着,并且不做线路关联,只保留个名字) */
135 private String xlmc; 137 private String xlmc;
136 138
137 -  
138 - /** 创建人 */  
139 - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)  
140 - private SysUser createBy;  
141 -  
142 - /** 修改人 */  
143 - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)  
144 - private SysUser updateBy;  
145 -  
146 - /** 创建日期 */  
147 - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
148 - private Date createDate;  
149 -  
150 - /** 修改日期 */  
151 - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")  
152 - private Date updateDate; 139 + public Cars() {}
  140 +
  141 + public Cars(Object id, Object nbbh, Object clbh, Object cph, Object sbbh) {
  142 + if (id != null) {
  143 + this.id = Integer.valueOf(id.toString());
  144 + }
  145 + if (nbbh != null) {
  146 + this.insideCode = nbbh.toString();
  147 + }
  148 + if (clbh != null) {
  149 + this.carCode = clbh.toString();
  150 + }
  151 + if (cph != null) {
  152 + this.carPlate = cph.toString();
  153 + }
  154 + if (sbbh != null) {
  155 + this.equipmentCode = sbbh.toString();
  156 + }
  157 + }
153 158
154 public String getServiceNo() { 159 public String getServiceNo() {
155 return serviceNo; 160 return serviceNo;
@@ -494,36 +499,4 @@ public class Cars implements Serializable { @@ -494,36 +499,4 @@ public class Cars implements Serializable {
494 public void setXlmc(String xlmc) { 499 public void setXlmc(String xlmc) {
495 this.xlmc = xlmc; 500 this.xlmc = xlmc;
496 } 501 }
497 -  
498 - public SysUser getCreateBy() {  
499 - return createBy;  
500 - }  
501 -  
502 - public void setCreateBy(SysUser createBy) {  
503 - this.createBy = createBy;  
504 - }  
505 -  
506 - public SysUser getUpdateBy() {  
507 - return updateBy;  
508 - }  
509 -  
510 - public void setUpdateBy(SysUser updateBy) {  
511 - this.updateBy = updateBy;  
512 - }  
513 -  
514 - public Date getCreateDate() {  
515 - return createDate;  
516 - }  
517 -  
518 - public void setCreateDate(Date createDate) {  
519 - this.createDate = createDate;  
520 - }  
521 -  
522 - public Date getUpdateDate() {  
523 - return updateDate;  
524 - }  
525 -  
526 - public void setUpdateDate(Date updateDate) {  
527 - this.updateDate = updateDate;  
528 - }  
529 } 502 }
src/main/java/com/bsth/entity/Line.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
  3 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
3 import org.springframework.format.annotation.DateTimeFormat; 4 import org.springframework.format.annotation.DateTimeFormat;
4 5
5 import javax.persistence.*; 6 import javax.persistence.*;
@@ -23,6 +24,7 @@ import java.util.Date; @@ -23,6 +24,7 @@ import java.util.Date;
23 24
24 @Entity 25 @Entity
25 @Table(name = "bsth_c_line") 26 @Table(name = "bsth_c_line")
  27 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
26 public class Line implements Serializable { 28 public class Line implements Serializable {
27 29
28 @Id 30 @Id
src/main/java/com/bsth/entity/Personnel.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
3 -import com.bsth.entity.sys.SysUser; 3 +import com.bsth.entity.schedule.BEntity;
  4 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 5
5 import javax.persistence.*; 6 import javax.persistence.*;
6 -import java.util.Date;  
7 7
8 /** 8 /**
9 * 9 *
@@ -21,7 +21,8 @@ import java.util.Date; @@ -21,7 +21,8 @@ import java.util.Date;
21 21
22 @Entity 22 @Entity
23 @Table(name = "bsth_c_personnel") 23 @Table(name = "bsth_c_personnel")
24 -public class Personnel { 24 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
  25 +public class Personnel extends BEntity {
25 26
26 /** 主键Id */ 27 /** 主键Id */
27 @Id 28 @Id
@@ -57,6 +58,20 @@ public class Personnel { @@ -57,6 +58,20 @@ public class Personnel {
57 /** 身份证 */ 58 /** 身份证 */
58 private String card; 59 private String card;
59 60
  61 + public Personnel() {}
  62 +
  63 + public Personnel(Object id, Object companyCode, Object gh) {
  64 + if (id != null) {
  65 + this.id = Integer.valueOf(id.toString());
  66 + }
  67 + if (companyCode != null) {
  68 + this.companyCode = companyCode.toString();
  69 + }
  70 + if (gh != null) {
  71 + this.jobCode = gh.toString();
  72 + }
  73 + }
  74 +
60 public String getCard() { 75 public String getCard() {
61 return card; 76 return card;
62 } 77 }
@@ -76,23 +91,6 @@ public class Personnel { @@ -76,23 +91,6 @@ public class Personnel {
76 /** 描述(TODO:在原系统里没有,这里暂时留着) */ 91 /** 描述(TODO:在原系统里没有,这里暂时留着) */
77 private String descriptions; 92 private String descriptions;
78 93
79 -  
80 -  
81 - /** 创建人 */  
82 - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)  
83 - private SysUser createBy;  
84 - /** 修改人 */  
85 - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)  
86 - private SysUser updateBy;  
87 -  
88 - /** 创建日期 */  
89 - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
90 - private Date createDate;  
91 -  
92 - /** 修改日期 */  
93 - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")  
94 - private Date updateDate;  
95 -  
96 public Integer getId() { 94 public Integer getId() {
97 return id; 95 return id;
98 } 96 }
@@ -220,36 +218,4 @@ public class Personnel { @@ -220,36 +218,4 @@ public class Personnel {
220 public void setDescriptions(String descriptions) { 218 public void setDescriptions(String descriptions) {
221 this.descriptions = descriptions; 219 this.descriptions = descriptions;
222 } 220 }
223 -  
224 - public SysUser getCreateBy() {  
225 - return createBy;  
226 - }  
227 -  
228 - public void setCreateBy(SysUser createBy) {  
229 - this.createBy = createBy;  
230 - }  
231 -  
232 - public SysUser getUpdateBy() {  
233 - return updateBy;  
234 - }  
235 -  
236 - public void setUpdateBy(SysUser updateBy) {  
237 - this.updateBy = updateBy;  
238 - }  
239 -  
240 - public Date getCreateDate() {  
241 - return createDate;  
242 - }  
243 -  
244 - public void setCreateDate(Date createDate) {  
245 - this.createDate = createDate;  
246 - }  
247 -  
248 - public Date getUpdateDate() {  
249 - return updateDate;  
250 - }  
251 -  
252 - public void setUpdateDate(Date updateDate) {  
253 - this.updateDate = updateDate;  
254 - }  
255 } 221 }
src/main/java/com/bsth/entity/mcy_forms/Allline.java 0 → 100644
  1 +package com.bsth.entity.mcy_forms;
  2 +
  3 +public class Allline {
  4 +
  5 + private String rq;//日期
  6 +
  7 + private String gs;//公司
  8 +
  9 + private String zhgs;//直属公司
  10 +
  11 + private String fgs;//分公司
  12 +
  13 + private String xl;//线路条数
  14 +
  15 + private String xlmc;//线路名称
  16 +
  17 + private String gsgs;
  18 + private String fgsgs;
  19 +
  20 + private String size;
  21 +
  22 +
  23 + public String getGsgs() {
  24 + return gsgs;
  25 + }
  26 +
  27 + public void setGsgs(String gsgs) {
  28 + this.gsgs = gsgs;
  29 + }
  30 +
  31 + public String getFgsgs() {
  32 + return fgsgs;
  33 + }
  34 +
  35 + public void setFgsgs(String fgsgs) {
  36 + this.fgsgs = fgsgs;
  37 + }
  38 +
  39 +
  40 + public String getSize() {
  41 + return size;
  42 + }
  43 +
  44 + public void setSize(String size) {
  45 + this.size = size;
  46 + }
  47 +
  48 + public String getZhgs() {
  49 + return zhgs;
  50 + }
  51 +
  52 + public void setZhgs(String zhgs) {
  53 + this.zhgs = zhgs;
  54 + }
  55 +
  56 + public String getXlmc() {
  57 + return xlmc;
  58 + }
  59 +
  60 + public void setXlmc(String xlmc) {
  61 + this.xlmc = xlmc;
  62 + }
  63 +
  64 + private String cchjh;//出车数计划
  65 +
  66 + private String cchsj;//出车数计划
  67 +
  68 + private String cchqz;//出车数权证
  69 +
  70 + private String chl;//出车率
  71 +
  72 + private String bcjh;//班次计划
  73 +
  74 + private String bcsj;//班次实际
  75 +
  76 + private String bbzxl;//班次执行率
  77 +
  78 + private String sm;//说明
  79 +
  80 + public String getRq() {
  81 + return rq;
  82 + }
  83 +
  84 + public void setRq(String rq) {
  85 + this.rq = rq;
  86 + }
  87 +
  88 + public String getGs() {
  89 + return gs;
  90 + }
  91 +
  92 + public void setGs(String gs) {
  93 + this.gs = gs;
  94 + }
  95 +
  96 + public String getFgs() {
  97 + return fgs;
  98 + }
  99 +
  100 + public void setFgs(String fgs) {
  101 + this.fgs = fgs;
  102 + }
  103 +
  104 + public String getXl() {
  105 + return xl;
  106 + }
  107 +
  108 + public void setXl(String xl) {
  109 + this.xl = xl;
  110 + }
  111 +
  112 + public String getCchjh() {
  113 + return cchjh;
  114 + }
  115 +
  116 + public void setCchjh(String cchjh) {
  117 + this.cchjh = cchjh;
  118 + }
  119 +
  120 + public String getCchsj() {
  121 + return cchsj;
  122 + }
  123 +
  124 + public void setCchsj(String cchsj) {
  125 + this.cchsj = cchsj;
  126 + }
  127 +
  128 + public String getCchqz() {
  129 + return cchqz;
  130 + }
  131 +
  132 + public void setCchqz(String cchqz) {
  133 + this.cchqz = cchqz;
  134 + }
  135 +
  136 + public String getChl() {
  137 + return chl;
  138 + }
  139 +
  140 + public void setChl(String chl) {
  141 + this.chl = chl;
  142 + }
  143 +
  144 + public String getBcjh() {
  145 + return bcjh;
  146 + }
  147 +
  148 + public void setBcjh(String bcjh) {
  149 + this.bcjh = bcjh;
  150 + }
  151 +
  152 + public String getBcsj() {
  153 + return bcsj;
  154 + }
  155 +
  156 + public void setBcsj(String bcsj) {
  157 + this.bcsj = bcsj;
  158 + }
  159 +
  160 + public String getBbzxl() {
  161 + return bbzxl;
  162 + }
  163 +
  164 + public void setBbzxl(String bbzxl) {
  165 + this.bbzxl = bbzxl;
  166 + }
  167 +
  168 + public String getSm() {
  169 + return sm;
  170 + }
  171 +
  172 + public void setSm(String sm) {
  173 + this.sm = sm;
  174 + }
  175 +
  176 +
  177 +
  178 +
  179 +}
src/main/java/com/bsth/entity/mcy_forms/Changetochange.java
1 package com.bsth.entity.mcy_forms; 1 package com.bsth.entity.mcy_forms;
2 2
3 -import java.util.Date;  
4 -  
5 import javax.persistence.Entity; 3 import javax.persistence.Entity;
6 import javax.persistence.GeneratedValue; 4 import javax.persistence.GeneratedValue;
7 import javax.persistence.Id; 5 import javax.persistence.Id;
src/main/java/com/bsth/entity/mcy_forms/Executionrate.java 0 → 100644
  1 +package com.bsth.entity.mcy_forms;
  2 +
  3 +public class Executionrate {
  4 +
  5 + private String rq;//日期
  6 +
  7 + private String gs;//公司
  8 +
  9 + private String zhgs;//直属公司
  10 +
  11 + private String fgs;//分公司
  12 +
  13 + private String xl;//线路条数
  14 +
  15 + private String xlmc;//线路名称
  16 +
  17 + private String gsgs;
  18 + private String fgsgs;
  19 +
  20 + private String size;
  21 +
  22 +
  23 + public String getGsgs() {
  24 + return gsgs;
  25 + }
  26 +
  27 + public void setGsgs(String gsgs) {
  28 + this.gsgs = gsgs;
  29 + }
  30 +
  31 + public String getFgsgs() {
  32 + return fgsgs;
  33 + }
  34 +
  35 + public void setFgsgs(String fgsgs) {
  36 + this.fgsgs = fgsgs;
  37 + }
  38 +
  39 +
  40 + public String getSize() {
  41 + return size;
  42 + }
  43 +
  44 + public void setSize(String size) {
  45 + this.size = size;
  46 + }
  47 +
  48 + public String getZhgs() {
  49 + return zhgs;
  50 + }
  51 +
  52 + public void setZhgs(String zhgs) {
  53 + this.zhgs = zhgs;
  54 + }
  55 +
  56 + public String getXlmc() {
  57 + return xlmc;
  58 + }
  59 +
  60 + public void setXlmc(String xlmc) {
  61 + this.xlmc = xlmc;
  62 + }
  63 +
  64 + private String cchjh;//出车数计划
  65 +
  66 + private String cchsj;//出车数计划
  67 +
  68 + private String cchqz;//出车数权证
  69 +
  70 + private String chl;//出车率
  71 +
  72 + private String bcjh;//班次计划
  73 +
  74 + private String bcsj;//班次实际
  75 +
  76 + private String bbzxl;//班次执行率
  77 +
  78 + private String sm;//说明
  79 +
  80 + public String getRq() {
  81 + return rq;
  82 + }
  83 +
  84 + public void setRq(String rq) {
  85 + this.rq = rq;
  86 + }
  87 +
  88 + public String getGs() {
  89 + return gs;
  90 + }
  91 +
  92 + public void setGs(String gs) {
  93 + this.gs = gs;
  94 + }
  95 +
  96 + public String getFgs() {
  97 + return fgs;
  98 + }
  99 +
  100 + public void setFgs(String fgs) {
  101 + this.fgs = fgs;
  102 + }
  103 +
  104 + public String getXl() {
  105 + return xl;
  106 + }
  107 +
  108 + public void setXl(String xl) {
  109 + this.xl = xl;
  110 + }
  111 +
  112 + public String getCchjh() {
  113 + return cchjh;
  114 + }
  115 +
  116 + public void setCchjh(String cchjh) {
  117 + this.cchjh = cchjh;
  118 + }
  119 +
  120 + public String getCchsj() {
  121 + return cchsj;
  122 + }
  123 +
  124 + public void setCchsj(String cchsj) {
  125 + this.cchsj = cchsj;
  126 + }
  127 +
  128 + public String getCchqz() {
  129 + return cchqz;
  130 + }
  131 +
  132 + public void setCchqz(String cchqz) {
  133 + this.cchqz = cchqz;
  134 + }
  135 +
  136 + public String getChl() {
  137 + return chl;
  138 + }
  139 +
  140 + public void setChl(String chl) {
  141 + this.chl = chl;
  142 + }
  143 +
  144 + public String getBcjh() {
  145 + return bcjh;
  146 + }
  147 +
  148 + public void setBcjh(String bcjh) {
  149 + this.bcjh = bcjh;
  150 + }
  151 +
  152 + public String getBcsj() {
  153 + return bcsj;
  154 + }
  155 +
  156 + public void setBcsj(String bcsj) {
  157 + this.bcsj = bcsj;
  158 + }
  159 +
  160 + public String getBbzxl() {
  161 + return bbzxl;
  162 + }
  163 +
  164 + public void setBbzxl(String bbzxl) {
  165 + this.bbzxl = bbzxl;
  166 + }
  167 +
  168 + public String getSm() {
  169 + return sm;
  170 + }
  171 +
  172 + public void setSm(String sm) {
  173 + this.sm = sm;
  174 + }
  175 +
  176 +
  177 +
  178 +}
src/main/java/com/bsth/entity/mcy_forms/Operationservice.java
@@ -13,6 +13,26 @@ public class Operationservice { @@ -13,6 +13,26 @@ public class Operationservice {
13 private String emptMileage;//空驶里程 13 private String emptMileage;//空驶里程
14 14
15 private String sjbc;//实际班次 15 private String sjbc;//实际班次
  16 +
  17 + private String jname;
  18 +
  19 + private String clzbh;
  20 +
  21 + public String getJname() {
  22 + return jname;
  23 + }
  24 +
  25 + public void setJname(String jname) {
  26 + this.jname = jname;
  27 + }
  28 +
  29 + public String getClzbh() {
  30 + return clzbh;
  31 + }
  32 +
  33 + public void setClzbh(String clzbh) {
  34 + this.clzbh = clzbh;
  35 + }
16 36
17 public String getXlName() { 37 public String getXlName() {
18 return xlName; 38 return xlName;
src/main/java/com/bsth/entity/mcy_forms/Shifday.java
@@ -34,7 +34,36 @@ public class Shifday { @@ -34,7 +34,36 @@ public class Shifday {
34 34
35 private String sjbc;//实际班次 35 private String sjbc;//实际班次
36 36
  37 + private String jgh;
37 38
  39 + private String zbh;
  40 +
  41 + private String rq;
  42 +
  43 + public String getRq() {
  44 + return rq;
  45 + }
  46 +
  47 + public void setRq(String rq) {
  48 + this.rq = rq;
  49 + }
  50 +
  51 + public String getJgh() {
  52 + return jgh;
  53 + }
  54 +
  55 + public void setJgh(String jgh) {
  56 + this.jgh = jgh;
  57 + }
  58 +
  59 + public String getZbh() {
  60 + return zbh;
  61 + }
  62 +
  63 + public void setZbh(String zbh) {
  64 + this.zbh = zbh;
  65 + }
  66 +
38 public String getJhlc() { 67 public String getJhlc() {
39 return jhlc; 68 return jhlc;
40 } 69 }
src/main/java/com/bsth/entity/mcy_forms/Shiftuehiclemanth.java
@@ -20,7 +20,24 @@ public class Shiftuehiclemanth { @@ -20,7 +20,24 @@ public class Shiftuehiclemanth {
20 20
21 private String sjbc;//实际班次 21 private String sjbc;//实际班次
22 22
23 - 23 + private String jgh;
  24 + private String zbh;
  25 + public String getJgh() {
  26 + return jgh;
  27 + }
  28 +
  29 + public void setJgh(String jgh) {
  30 + this.jgh = jgh;
  31 + }
  32 +
  33 + public String getZbh() {
  34 + return zbh;
  35 + }
  36 +
  37 + public void setZbh(String zbh) {
  38 + this.zbh = zbh;
  39 + }
  40 +
24 public String getCjbc() { 41 public String getCjbc() {
25 return cjbc; 42 return cjbc;
26 } 43 }