Commit 641a78224824e928a9f8004875399c85a71e5095

Authored by sgz
2 parents cac7e0c0 2dc63700

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

Showing 58 changed files with 1552 additions and 1334 deletions

Too many changes to show.

To preserve performance only 58 of 295 files are displayed.

1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3 3
4 <modelVersion>4.0.0</modelVersion> 4 <modelVersion>4.0.0</modelVersion>
5 <groupId>com.bsth</groupId> 5 <groupId>com.bsth</groupId>
@@ -237,27 +237,33 @@ @@ -237,27 +237,33 @@
237 <version>1.13</version> 237 <version>1.13</version>
238 </dependency> 238 </dependency>
239 239
240 - <dependency>  
241 - <groupId>org.dbunit</groupId>  
242 - <artifactId>dbunit</artifactId>  
243 - <version>2.4.9</version>  
244 - <scope>test</scope> 240 + <dependency>
  241 + <groupId>org.dbunit</groupId>
  242 + <artifactId>dbunit</artifactId>
  243 + <version>2.4.9</version>
  244 + <scope>test</scope>
245 245
246 - <exclusions>  
247 - <exclusion>  
248 - <groupId>org.slf4j</groupId>  
249 - <artifactId>slf4j-api</artifactId>  
250 - </exclusion>  
251 - </exclusions>  
252 - </dependency> 246 + <exclusions>
  247 + <exclusion>
  248 + <groupId>org.slf4j</groupId>
  249 + <artifactId>slf4j-api</artifactId>
  250 + </exclusion>
  251 + </exclusions>
  252 + </dependency>
  253 +
  254 + <dependency>
  255 + <groupId>com.h2database</groupId>
  256 + <artifactId>h2</artifactId>
  257 + <version>1.2.132</version>
  258 + <scope>test</scope>
  259 + </dependency>
253 260
254 - <dependency>  
255 - <groupId>com.h2database</groupId>  
256 - <artifactId>h2</artifactId>  
257 - <version>1.2.132</version>  
258 - <scope>test</scope>  
259 - </dependency>  
260 261
  262 + <dependency>
  263 + <groupId>ojdbc</groupId>
  264 + <artifactId>ojdbc</artifactId>
  265 + <version>14</version>
  266 + </dependency>
261 </dependencies> 267 </dependencies>
262 268
263 <dependencyManagement> 269 <dependencyManagement>
src/main/java/com/bsth/controller/BusinessController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
  3 +import org.springframework.beans.factory.annotation.Autowired;
3 import org.springframework.web.bind.annotation.RequestMapping; 4 import org.springframework.web.bind.annotation.RequestMapping;
  5 +import org.springframework.web.bind.annotation.RequestMethod;
4 import org.springframework.web.bind.annotation.RestController; 6 import org.springframework.web.bind.annotation.RestController;
5 7
6 import com.bsth.entity.Business; 8 import com.bsth.entity.Business;
  9 +import com.bsth.service.BusinessService;
  10 +import com.bsth.util.GetUIDAndCode;
7 11
8 /** 12 /**
9 * 13 *
@@ -23,5 +27,11 @@ import com.bsth.entity.Business; @@ -23,5 +27,11 @@ import com.bsth.entity.Business;
23 @RestController 27 @RestController
24 @RequestMapping("business") 28 @RequestMapping("business")
25 public class BusinessController extends BaseController<Business, Integer> { 29 public class BusinessController extends BaseController<Business, Integer> {
26 - 30 + @Autowired
  31 + private BusinessService businessService;
  32 +
  33 + @RequestMapping(value = "getCompCode", method = RequestMethod.GET)
  34 + public long getLineCode() {
  35 + return businessService.getCompCode();
  36 + }
27 } 37 }
src/main/java/com/bsth/controller/SectionController.java
@@ -48,13 +48,9 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; { @@ -48,13 +48,9 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; {
48 */ 48 */
49 @RequestMapping(value="sectionSave" , method = RequestMethod.POST) 49 @RequestMapping(value="sectionSave" , method = RequestMethod.POST)
50 public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) { 50 public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) {
51 -  
52 map.put("createBy", ""); 51 map.put("createBy", "");
53 -  
54 map.put("updateBy", ""); 52 map.put("updateBy", "");
55 -  
56 return service.sectionSave(map); 53 return service.sectionSave(map);
57 -  
58 } 54 }
59 55
60 /** 56 /**
src/main/java/com/bsth/controller/SectionRouteController.java
@@ -57,7 +57,6 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer @@ -57,7 +57,6 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer
57 */ 57 */
58 @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET) 58 @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET)
59 public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) { 59 public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) {
60 -  
61 return routeService.findSectionRouteInfoFormId(map); 60 return routeService.findSectionRouteInfoFormId(map);
62 } 61 }
63 62
src/main/java/com/bsth/controller/StationController.java
@@ -60,16 +60,12 @@ public class StationController extends BaseController&lt;Station, Integer&gt; { @@ -60,16 +60,12 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
60 */ 60 */
61 @RequestMapping(value="collectionSave" , method = RequestMethod.POST) 61 @RequestMapping(value="collectionSave" , method = RequestMethod.POST)
62 public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) { 62 public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) {
63 -  
64 return service.systemSaveStations(map); 63 return service.systemSaveStations(map);
65 -  
66 } 64 }
67 65
68 @RequestMapping(value="manualSave" , method = RequestMethod.POST) 66 @RequestMapping(value="manualSave" , method = RequestMethod.POST)
69 public Map<String, Object> manualSave(@RequestParam Map<String, Object> map) { 67 public Map<String, Object> manualSave(@RequestParam Map<String, Object> map) {
70 -  
71 return service.manualSave(map); 68 return service.manualSave(map);
72 -  
73 } 69 }
74 70
75 /** 71 /**
@@ -89,13 +85,9 @@ public class StationController extends BaseController&lt;Station, Integer&gt; { @@ -89,13 +85,9 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
89 */ 85 */
90 @RequestMapping(value="stationSave" , method = RequestMethod.POST) 86 @RequestMapping(value="stationSave" , method = RequestMethod.POST)
91 public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { 87 public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) {
92 -  
93 map.put("createBy", ""); 88 map.put("createBy", "");
94 -  
95 map.put("updateBy", ""); 89 map.put("updateBy", "");
96 -  
97 return service.stationSaveMap(map); 90 return service.stationSaveMap(map);
98 -  
99 } 91 }
100 92
101 /** 93 /**
src/main/java/com/bsth/controller/StationRouteController.java
@@ -36,6 +36,17 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer @@ -36,6 +36,17 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
36 @Autowired 36 @Autowired
37 StationRouteRepository stationRouteRepository; 37 StationRouteRepository stationRouteRepository;
38 38
  39 + /**
  40 + * @param @param map
  41 + * @throws
  42 + * @Title: list
  43 + * @Description: TODO(多条件查询)
  44 + */
  45 + @RequestMapping(value = "/all", method = RequestMethod.GET)
  46 + public Iterable<StationRoute> list(@RequestParam Map<String, Object> map) {
  47 + return service.list(map);
  48 + }
  49 +
39 /** 50 /**
40 * @Description :TODO(查询树站点与路段数据) 51 * @Description :TODO(查询树站点与路段数据)
41 * 52 *
src/main/java/com/bsth/controller/forms/ExportController.java
@@ -28,6 +28,7 @@ import com.bsth.entity.mcy_forms.Vehicleloading; @@ -28,6 +28,7 @@ import com.bsth.entity.mcy_forms.Vehicleloading;
28 import com.bsth.entity.mcy_forms.Waybillday; 28 import com.bsth.entity.mcy_forms.Waybillday;
29 import com.bsth.service.forms.ExportService; 29 import com.bsth.service.forms.ExportService;
30 import com.bsth.service.forms.FormsService; 30 import com.bsth.service.forms.FormsService;
  31 +import com.bsth.util.Arith;
31 import com.bsth.util.ReportUtils; 32 import com.bsth.util.ReportUtils;
32 33
33 @RestController 34 @RestController
@@ -167,7 +168,7 @@ public class ExportController { @@ -167,7 +168,7 @@ public class ExportController {
167 } 168 }
168 169
169 // 路单数据报表 170 // 路单数据报表
170 - @RequestMapping(value = "/singledataExport", method = RequestMethod.POST) 171 + @RequestMapping(value = "/singledataExport", method = RequestMethod.GET)
171 public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map) { 172 public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map) {
172 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 173 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
173 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 174 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
@@ -213,12 +214,12 @@ public class ExportController { @@ -213,12 +214,12 @@ public class ExportController {
213 } 214 }
214 215
215 // 车辆加注 216 // 车辆加注
216 - @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.POST) 217 + @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.GET)
217 public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) { 218 public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) {
218 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 219 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
219 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 220 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
220 ReportUtils ee = new ReportUtils(); 221 ReportUtils ee = new ReportUtils();
221 - List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("gsdmVehic").toString(),map.get("fgsdmVehic").toString(),map.get("line").toString(), 222 + List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(),
222 map.get("data").toString()); 223 map.get("data").toString());
223 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 224 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
224 int i = 1; 225 int i = 1;
@@ -252,7 +253,7 @@ public class ExportController { @@ -252,7 +253,7 @@ public class ExportController {
252 } 253 }
253 254
254 // 运营服务阶段报表 255 // 运营服务阶段报表
255 - @RequestMapping(value = "/operationserviceExport", method = RequestMethod.POST) 256 + @RequestMapping(value = "/operationserviceExport", method = RequestMethod.GET)
256 public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map) { 257 public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map) {
257 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 258 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
258 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 259 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
@@ -558,17 +559,13 @@ public class ExportController { @@ -558,17 +559,13 @@ public class ExportController {
558 List<Daily> allline = formsService.daily(map); 559 List<Daily> allline = formsService.daily(map);
559 560
560 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 561 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
561 - Float zgl=0f;  
562 - Float ks=0f;  
563 - Float yh=0f;  
564 - Float bc=0f; 562 + double zgl=0.0;
  563 + double ks=0.0;
  564 + double yh=0.0;
  565 + int bc=0;
565 Map<String, Object> m ; 566 Map<String, Object> m ;
566 for (Daily d : allline) { 567 for (Daily d : allline) {
567 m = new HashMap<String, Object>(); 568 m = new HashMap<String, Object>();
568 - zgl +=d.getZlc()==""?0f:Float.valueOf(d.getZlc());  
569 - ks +=d.getJzl1()==""?0f:Float.valueOf(d.getJzl1());  
570 - yh +=d.getYh()==""?0f:Float.valueOf(d.getYh());  
571 - bc +=d.getBc()==""?0f:Float.valueOf(d.getBc());  
572 m.put("zbh", d.getZbh()); 569 m.put("zbh", d.getZbh());
573 m.put("jgh",d.getJgh()); 570 m.put("jgh",d.getJgh());
574 m.put("jName", d.getjName()); 571 m.put("jName", d.getjName());
@@ -576,9 +573,13 @@ public class ExportController { @@ -576,9 +573,13 @@ public class ExportController {
576 m.put("jzl1", d.getJzl1()); 573 m.put("jzl1", d.getJzl1());
577 m.put("yh", d.getYh()); 574 m.put("yh", d.getYh());
578 m.put("bc", d.getBc()); 575 m.put("bc", d.getBc());
  576 + zgl =Arith.add(zgl, d.getZlc());
  577 + ks =Arith.add(ks, d.getJzl1());
  578 + yh =Arith.add(yh, d.getYh());
  579 + bc +=Integer.parseInt(d.getBc());
579 580
580 resList.add(m); 581 resList.add(m);
581 - } 582 + }
582 583
583 m=new HashMap<String,Object>(); 584 m=new HashMap<String,Object>();
584 m.put("total_zgl", zgl); 585 m.put("total_zgl", zgl);
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
@@ -73,21 +73,20 @@ public class MCY_FormsController { @@ -73,21 +73,20 @@ public class MCY_FormsController {
73 } 73 }
74 74
75 // 路单数据 75 // 路单数据
76 - @RequestMapping(value = "/singledata", method = RequestMethod.POST) 76 + @RequestMapping(value = "/singledata", method = RequestMethod.GET)
77 public List<Singledata> singledata(@RequestParam Map<String, Object> map) { 77 public List<Singledata> singledata(@RequestParam Map<String, Object> map) {
78 78
79 return formsService.singledata(map); 79 return formsService.singledata(map);
80 } 80 }
81 81
82 // 车辆加注 82 // 车辆加注
83 - @RequestMapping(value = "/vehicleloading", method = RequestMethod.POST)  
84 - public List<Vehicleloading> vehicleloading(@RequestParam String gsdmVehic, @RequestParam String fgsdmVehic,  
85 - @RequestParam String line, @RequestParam String data) {  
86 - return formsService.vehicleloading(gsdmVehic, fgsdmVehic, line, data); 83 + @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET)
  84 + public List<Vehicleloading> vehicleloading(@RequestParam String line, @RequestParam String data) {
  85 + return formsService.vehicleloading(line, data);
87 } 86 }
88 87
89 // 运营服务阶段报表 88 // 运营服务阶段报表
90 - @RequestMapping(value = "/operationservice", method = RequestMethod.POST) 89 + @RequestMapping(value = "/operationservice", method = RequestMethod.GET)
91 public List<Operationservice> operationservice(@RequestParam Map<String, Object> map) { 90 public List<Operationservice> operationservice(@RequestParam Map<String, Object> map) {
92 91
93 return formsService.operationservice(map); 92 return formsService.operationservice(map);
src/main/java/com/bsth/controller/oil/YlbController.java
@@ -238,9 +238,11 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -238,9 +238,11 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
238 Map<String, Object> m = new HashMap<String, Object>(); 238 Map<String, Object> m = new HashMap<String, Object>();
239 m.put("rq", y.getRq()); 239 m.put("rq", y.getRq());
240 m.put("gsname",y.getGsname() ); 240 m.put("gsname",y.getGsname() );
  241 + m.put("fgsname", y.getFgsname());
241 m.put("xlname", y.getXlname()); 242 m.put("xlname", y.getXlname());
242 m.put("nbbm", y.getNbbm()); 243 m.put("nbbm", y.getNbbm());
243 m.put("jsy", y.getJsy()); 244 m.put("jsy", y.getJsy());
  245 + m.put("name", y.getName());
244 m.put("jzl", y.getJzl()); 246 m.put("jzl", y.getJzl());
245 m.put("czlc", y.getCzlc()); 247 m.put("czlc", y.getCzlc());
246 m.put("jzlc", y.getJzlc()); 248 m.put("jzlc", y.getJzlc());
src/main/java/com/bsth/controller/realcontrol/DataManagerController.java
1 -package com.bsth.controller.realcontrol;  
2 -  
3 -import com.bsth.service.realcontrol.DataManagerService;  
4 -import org.apache.commons.lang3.StringEscapeUtils;  
5 -import org.springframework.beans.factory.annotation.Autowired;  
6 -import org.springframework.web.bind.annotation.RequestMapping;  
7 -import org.springframework.web.bind.annotation.RequestParam;  
8 -import org.springframework.web.bind.annotation.RestController;  
9 -  
10 -import java.util.Map;  
11 -  
12 -/**  
13 - * 数据管理,包括从老系统的数据迁移。新系统的数据校验等  
14 - * Created by panzhao on 2017/4/17.  
15 - */  
16 -@RestController  
17 -@RequestMapping("dataManager")  
18 -public class DataManagerController {  
19 -  
20 - @Autowired  
21 - DataManagerService dataManagerService;  
22 -  
23 - @RequestMapping("cars/old_now")  
24 - public Map<String, Object> carInfos(@RequestParam Integer lineId){  
25 - return dataManagerService.carInfos(lineId);  
26 - }  
27 -  
28 - @RequestMapping("car/updateDevices")  
29 - public Map<String, Object> updateDevices(@RequestParam String jsonStr){  
30 - jsonStr = StringEscapeUtils.unescapeHtml4(jsonStr);  
31 - return dataManagerService.updateDevices(jsonStr);  
32 - }  
33 -} 1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.service.realcontrol.DataManagerService;
  4 +import org.apache.commons.lang3.StringEscapeUtils;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestParam;
  8 +import org.springframework.web.bind.annotation.RestController;
  9 +
  10 +import java.util.Map;
  11 +
  12 +/**
  13 + * 数据管理,包括从老系统的数据迁移。新系统的数据校验等
  14 + * Created by panzhao on 2017/4/17.
  15 + */
  16 +@RestController
  17 +@RequestMapping("dataManager")
  18 +public class DataManagerController {
  19 +
  20 + @Autowired
  21 + DataManagerService dataManagerService;
  22 +
  23 + @RequestMapping("cars/old_now")
  24 + public Map<String, Object> carInfos(@RequestParam Integer lineId){
  25 + return dataManagerService.carInfos(lineId);
  26 + }
  27 +
  28 + @RequestMapping("car/updateDevices")
  29 + public Map<String, Object> updateDevices(@RequestParam String jsonStr){
  30 + jsonStr = StringEscapeUtils.unescapeHtml4(jsonStr);
  31 + return dataManagerService.updateDevices(jsonStr);
  32 + }
  33 +}
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -186,16 +186,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -186,16 +186,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
186 186
187 /** 187 /**
188 * 188 *
189 - * @Title: trustStatus @Description: TODO(线路托管状态) @param @param lineCodes  
190 - * 线路编码 @throws  
191 - */  
192 - @RequestMapping(value = "/trustStatus")  
193 - public Map<Integer, Integer> trustStatus(@RequestParam String lineCodes) {  
194 - return scheduleRealInfoService.trustStatus(lineCodes);  
195 - }  
196 -  
197 - /**  
198 - *  
199 * @Title: outgoAdjustAll 189 * @Title: outgoAdjustAll
200 * @Description: TODO(批量待发调整) 190 * @Description: TODO(批量待发调整)
201 * @param @param list 191 * @param @param list
@@ -207,17 +197,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -207,17 +197,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
207 params = StringEscapeUtils.unescapeHtml4(params); 197 params = StringEscapeUtils.unescapeHtml4(params);
208 return scheduleRealInfoService.outgoAdjustAll(params); 198 return scheduleRealInfoService.outgoAdjustAll(params);
209 } 199 }
210 -  
211 - /**  
212 - *  
213 - * @Title: changeTrustStatus @Description: TODO(切换线路托管状态) @param @param  
214 - * lineCode 线路编码 @param @param status 托管状态 @throws  
215 - */  
216 - @RequestMapping(value = "/trustStatus/change", method = RequestMethod.POST)  
217 - public int changeTrustStatus(@RequestParam Integer lineCode, @RequestParam Integer status) {  
218 - //ScheduleBuffer.trustMap.put(lineCode, status);  
219 - return 200;  
220 - }  
221 200
222 /** 201 /**
223 * 202 *
@@ -243,12 +222,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -243,12 +222,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
243 return scheduleRealInfoService.findRouteByLine(lineCode); 222 return scheduleRealInfoService.findRouteByLine(lineCode);
244 } 223 }
245 224
246 - @RequestMapping(value = "/test/getSch")  
247 - public int getSch(){  
248 - //getSchedulePlanThread.start();  
249 - return 1;  
250 - }  
251 -  
252 /** 225 /**
253 * 226 *
254 * @Title: removeChildTask 227 * @Title: removeChildTask
@@ -269,7 +242,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -269,7 +242,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
269 */ 242 */
270 @RequestMapping(value = "/lineCode/{lineCode}") 243 @RequestMapping(value = "/lineCode/{lineCode}")
271 public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){ 244 public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
272 - //return ScheduleBuffer.realSchedulListMap.get(lineCode);  
273 return dayOfSchedule.findByLineCode(lineCode); 245 return dayOfSchedule.findByLineCode(lineCode);
274 } 246 }
275 247
@@ -447,10 +419,10 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -447,10 +419,10 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
447 return scheduleRealInfoService.changeBcType(id, bcType, remarks); 419 return scheduleRealInfoService.changeBcType(id, bcType, remarks);
448 } 420 }
449 421
450 - @RequestMapping(value="/history", method=RequestMethod.POST) 422 +/* @RequestMapping(value="/history", method=RequestMethod.POST)
451 public Map<String,Object> historySave(ScheduleRealInfo sch){ 423 public Map<String,Object> historySave(ScheduleRealInfo sch){
452 return scheduleRealInfoService.historySave(sch); 424 return scheduleRealInfoService.historySave(sch);
453 - } 425 + }*/
454 426
455 427
456 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); 428 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
@@ -543,4 +515,25 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -543,4 +515,25 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
543 rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); 515 rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
544 return rs; 516 return rs;
545 } 517 }
  518 +
  519 + /**
  520 + * 误点调整
  521 + * @param idx
  522 + * @param minute
  523 + * @return
  524 + */
  525 + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
  526 + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
  527 + return scheduleRealInfoService.lateAdjust(idx, minute);
  528 + }
  529 +
  530 + /**
  531 + * 获取所有应发未到的班次
  532 + * @param idx
  533 + * @return
  534 + */
  535 + @RequestMapping(value = "allLate2")
  536 + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
  537 + return scheduleRealInfoService.allLate2(idx);
  538 + }
546 } 539 }
src/main/java/com/bsth/controller/report/ReportController.java
1 package com.bsth.controller.report; 1 package com.bsth.controller.report;
2 2
  3 +import java.util.ArrayList;
3 import java.util.HashMap; 4 import java.util.HashMap;
  5 +import java.util.Iterator;
4 import java.util.List; 6 import java.util.List;
5 import java.util.Map; 7 import java.util.Map;
6 8
@@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
13 import com.bsth.entity.excep.ArrivalInfo; 15 import com.bsth.entity.excep.ArrivalInfo;
14 import com.bsth.entity.realcontrol.ScheduleRealInfo; 16 import com.bsth.entity.realcontrol.ScheduleRealInfo;
15 import com.bsth.service.report.ReportService; 17 import com.bsth.service.report.ReportService;
  18 +import com.bsth.util.ReportUtils;
16 19
17 @RestController 20 @RestController
18 @RequestMapping("report") 21 @RequestMapping("report")
@@ -31,12 +34,142 @@ public class ReportController { @@ -31,12 +34,142 @@ public class ReportController {
31 @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){ 34 @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){
32 return service.queryListZdxx(line,date,clzbh,fcsj,ddsj); 35 return service.queryListZdxx(line,date,clzbh,fcsj,ddsj);
33 } 36 }
  37 +
  38 + @RequestMapping(value="/exportQueryListZdxx" ,method = RequestMethod.GET)
  39 + public List<Map<String, Object>> exportQueryListZdxx(@RequestParam String clzbh,@RequestParam String line,
  40 + @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){
  41 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  42 + ReportUtils ee = new ReportUtils();
  43 + List<ArrivalInfo> list=service.queryListZdxx(line,date,clzbh,fcsj,ddsj);
  44 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  45 + int i=1;
  46 + for (ArrivalInfo a:list ) {
  47 + Map<String, Object> m = new HashMap<String, Object>();
  48 + m.put("i", i);
  49 + m.put("nbbm", a.getNbbm());
  50 + m.put("stopName", a.getStopName());
  51 + m.put("jzsj", a.getJzsj());
  52 + m.put("czsj", a.getCzsj());
  53 + m.put("kgm", "");
  54 + m.put("upDown", a.getUpDown()==0?"上行":"下行");
  55 + m.put("kmsd", "");
  56 + m.put("bufa", "");
  57 + m.put("skcs", "");
  58 + m.put("skje", "");
  59 + m.put("mfskcs", "");
  60 + m.put("mfskje", "");
  61 + resList.add(m);
  62 + i++;
  63 + }
  64 +
  65 + try {
  66 + Map<String, Object> map=new HashMap<String, Object>();
  67 + listI.add(resList.iterator());
  68 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  69 + ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
  70 + path + "export/班次到离站.xls");
  71 + } catch (Exception e) {
  72 + e.printStackTrace();
  73 + }
  74 + return resList;
  75 + }
  76 +
  77 +
34 @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET) 78 @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET)
35 public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line, 79 public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line,
36 @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ 80 @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
37 return service.queryListClzd(line,zd,zdlx,fcsj,ddsj); 81 return service.queryListClzd(line,zd,zdlx,fcsj,ddsj);
38 } 82 }
39 83
  84 +
  85 +
  86 +
  87 + @RequestMapping(value="/exportQueryListClzd" ,method = RequestMethod.GET)
  88 + public List<Map<String, Object>> exportQueryListClzd(@RequestParam String zd,@RequestParam String line,
  89 + @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
  90 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  91 + ReportUtils ee = new ReportUtils();
  92 + List<ArrivalInfo> list=service.queryListClzd(line,zd,zdlx,fcsj,ddsj);
  93 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  94 + int i=1;
  95 + for (ArrivalInfo a:list ) {
  96 + Map<String, Object> m = new HashMap<String, Object>();
  97 + m.put("i", i);
  98 + m.put("nbbm", a.getNbbm());
  99 + m.put("stopName", a.getStopName());
  100 + m.put("jzsj", a.getJzsj());
  101 + m.put("czsj", a.getCzsj());
  102 + m.put("kgm", "");
  103 + m.put("upDown", a.getUpDown()==0?"上行":"下行");
  104 + m.put("kmsd", "");
  105 + m.put("bufa", "");
  106 + m.put("skcs", "");
  107 + m.put("skje", "");
  108 + m.put("mfskcs", "");
  109 + m.put("mfskje", "");
  110 + resList.add(m);
  111 + i++;
  112 + }
  113 +
  114 + try {
  115 + Map<String, Object> map=new HashMap<String, Object>();
  116 + listI.add(resList.iterator());
  117 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  118 + ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
  119 + path + "export/班次到离站.xls");
  120 + } catch (Exception e) {
  121 + e.printStackTrace();
  122 + }
  123 + return resList;
  124 + }
  125 +
  126 +
  127 + @RequestMapping(value="/jobSummaryExport" ,method = RequestMethod.GET)
  128 + public List<Map<String, Object>> jobSummaryExport(@RequestParam Map<String, Object> map){
  129 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  130 + String lineName=map.get("lineName").toString();
  131 + String date=map.get("date").toString();
  132 + ReportUtils ee = new ReportUtils();
  133 + List<Map<String,Object>> fwqlList= service.jobFwqk(map);
  134 + List<Map<String, Object>> lgqlList=service.jobLjqk(map);
  135 + map=service.jobHzxx(map);
  136 + map.put("lineName", lineName);
  137 + map.put("date",date);
  138 + if(fwqlList.size()<=0){
  139 + Map<String, Object> newMap=new HashMap<String,Object>();
  140 + newMap.put("nr", " ");
  141 + newMap.put("lp", " ");
  142 + newMap.put("nbbm", " ");
  143 + newMap.put("jgh", " ");
  144 + newMap.put("dz", " ");
  145 + newMap.put("sj", " ");
  146 + newMap.put("lbbc", " ");
  147 + newMap.put("lblc", " ");
  148 + newMap.put("jyqp", " ");
  149 + fwqlList.add(newMap);
  150 + }
  151 + if(lgqlList.size()<=0){
  152 + Map<String, Object> newMap=new HashMap<String,Object>();
  153 + newMap.put("lp", " ");
  154 + newMap.put("nbbm", " ");
  155 + newMap.put("jgh", " ");
  156 + newMap.put("dz", " ");
  157 + newMap.put("sj", " ");
  158 + newMap.put("ljlc"," ");
  159 + newMap.put("jyqp", " ");
  160 + lgqlList.add(newMap);
  161 + }
  162 + try {
  163 + listI.add(fwqlList.iterator());
  164 + listI.add(lgqlList.iterator());
  165 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  166 + ee.excelReplace(listI, new Object[] { map }, path + "mould/jobSummary.xls",
  167 + path + "export/调度员工作汇总日报.xls");
  168 + } catch (Exception e) {
  169 + e.printStackTrace();
  170 + }
  171 + return new ArrayList<Map<String, Object>>();
  172 + }
40 @RequestMapping(value = "/sreachZd", method = RequestMethod.GET) 173 @RequestMapping(value = "/sreachZd", method = RequestMethod.GET)
41 public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx,@RequestParam String zd) { 174 public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx,@RequestParam String zd) {
42 return service.sreachZd(line,zdlx, zd); 175 return service.sreachZd(line,zdlx, zd);
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
@@ -5,11 +5,7 @@ import com.bsth.controller.schedule.BController; @@ -5,11 +5,7 @@ import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.schedule.TTInfoDetail; 5 import com.bsth.entity.schedule.TTInfoDetail;
6 import com.bsth.service.schedule.TTInfoDetailService; 6 import com.bsth.service.schedule.TTInfoDetailService;
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;  
10 -import org.springframework.web.bind.annotation.RequestMethod;  
11 -import org.springframework.web.bind.annotation.RequestParam;  
12 -import org.springframework.web.bind.annotation.RestController; 8 +import org.springframework.web.bind.annotation.*;
13 9
14 import java.util.HashMap; 10 import java.util.HashMap;
15 import java.util.List; 11 import java.util.List;
@@ -88,6 +84,20 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; { @@ -88,6 +84,20 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
88 } 84 }
89 return rtn; 85 return rtn;
90 } 86 }
  87 +
  88 + @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET)
  89 + public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir) {
  90 + Map<String, Object> rtn = new HashMap<>();
  91 + try {
  92 + List<Map<String, Object>> list = ttInfoDetailService.findZdAndTcc(lineid, xldir);
  93 + rtn.put("status", ResponseCode.SUCCESS);
  94 + rtn.put("data", list);
  95 + } catch (Exception exp) {
  96 + rtn.put("status", ResponseCode.ERROR);
  97 + rtn.put("msg", exp.getMessage());
  98 + }
  99 + return rtn;
  100 + }
91 101
92 /** 102 /**
93 * 时刻表明细批量插入 103 * 时刻表明细批量插入
src/main/java/com/bsth/data/BasicData.java
@@ -332,7 +332,8 @@ public class BasicData implements CommandLineRunner { @@ -332,7 +332,8 @@ public class BasicData implements CommandLineRunner {
332 } 332 }
333 333
334 perTempMap.put(jobCode, p); 334 perTempMap.put(jobCode, p);
335 - allPersonMap.put(jobCode, p.getPersonnelName()); 335 +
  336 + allPersonMap.put(jobCode.substring(jobCode.indexOf("-")+1), p.getPersonnelName());
336 } 337 }
337 338
338 jsyMap = jsyTempMap; 339 jsyMap = jsyTempMap;
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
@@ -85,7 +85,7 @@ public abstract class SignalHandle { @@ -85,7 +85,7 @@ public abstract class SignalHandle {
85 gps.setStopNo(station.getCode()); 85 gps.setStopNo(station.getCode());
86 } 86 }
87 87
88 - logger.info(fmtHHmm.print(gps.getTimestamp()) + " 车辆 :" + gps.getNbbm() + " 切换到走向 : " + updown); 88 + logger.info(gps.getTimestamp() + " -" + fmtHHmm.print(gps.getTimestamp()) + " 车辆 :" + gps.getNbbm() + " 切换到走向 : " + updown);
89 } 89 }
90 90
91 /** 91 /**
src/main/java/com/bsth/data/gpsdata/arrival/handlers/CorrectSignalHandle.java
@@ -48,12 +48,6 @@ public class CorrectSignalHandle extends SignalHandle { @@ -48,12 +48,6 @@ public class CorrectSignalHandle extends SignalHandle {
48 gps.setState(0); 48 gps.setState(0);
49 } 49 }
50 50
51 - /*if(gps.getState() != 0){  
52 - logger.info(gps.getNbbm() + " 纠正状态到营运");  
53 - //切换到营运状态  
54 - directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "纠正@系统");  
55 - }*/  
56 -  
57 return true; 51 return true;
58 } 52 }
59 } 53 }
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
@@ -8,6 +8,7 @@ import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; @@ -8,6 +8,7 @@ import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState;
8 import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher; 8 import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher;
9 import com.bsth.data.schedule.DayOfSchedule; 9 import com.bsth.data.schedule.DayOfSchedule;
10 import com.bsth.data.schedule.ScheduleComparator; 10 import com.bsth.data.schedule.ScheduleComparator;
  11 +import com.bsth.data.schedule.late_adjust.LateAdjustHandle;
11 import com.bsth.entity.realcontrol.LineConfig; 12 import com.bsth.entity.realcontrol.LineConfig;
12 import com.bsth.entity.realcontrol.ScheduleRealInfo; 13 import com.bsth.entity.realcontrol.ScheduleRealInfo;
13 import com.bsth.service.directive.DirectiveService; 14 import com.bsth.service.directive.DirectiveService;
@@ -145,6 +146,9 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -145,6 +146,9 @@ public class InOutStationSignalHandle extends SignalHandle{
145 //持久化 146 //持久化
146 dayOfSchedule.save(sch); 147 dayOfSchedule.save(sch);
147 148
  149 + //清理应发未发标记
  150 + LateAdjustHandle.remove(sch);
  151 +
148 if(sch.getBcType().equals("out")){ 152 if(sch.getBcType().equals("out")){
149 //出场时,切换成营运状态 153 //出场时,切换成营运状态
150 directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统"); 154 directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统");
@@ -242,23 +246,35 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -242,23 +246,35 @@ public class InOutStationSignalHandle extends SignalHandle{
242 long rsT = lineConfigData.applyIn(sch, gps.getTimestamp()); 246 long rsT = lineConfigData.applyIn(sch, gps.getTimestamp());
243 247
244 sch.setZdsjActualAll(rsT); 248 sch.setZdsjActualAll(rsT);
  249 +
  250 + //通知误点停靠程序,有车辆到站
  251 + LateAdjustHandle.carArrive(gps);
  252 +
245 //已完成班次数 253 //已完成班次数
246 int doneSum = dayOfSchedule.doneSum(sch.getClZbh()); 254 int doneSum = dayOfSchedule.doneSum(sch.getClZbh());
247 ScheduleRealInfo next = dayOfSchedule.next(sch); 255 ScheduleRealInfo next = dayOfSchedule.next(sch);
248 - //通知客户端  
249 - sendUtils.sendZdsj(sch, next, doneSum);  
250 //持久化 256 //持久化
251 dayOfSchedule.save(sch); 257 dayOfSchedule.save(sch);
252 258
253 - //准备执行下一个班次  
254 - if (next != null) {  
255 - next.setQdzArrDatesj(sch.getZdsjActual()); 259 + if(next != null){
256 dayOfSchedule.addExecPlan(next); 260 dayOfSchedule.addExecPlan(next);
257 //进站既进场 261 //进站既进场
258 inStationAndInPark(sch, next); 262 inStationAndInPark(sch, next);
  263 + }
  264 +
  265 + //该路牌的下一个班次,起点实际到达时间
  266 + ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch);
  267 + if(lpNext != null){
  268 + lpNext.setQdzArrDatesj(sch.getZdsjActual());
  269 + }
  270 +
  271 + //通知客户端
  272 + sendUtils.sendZdsj(sch, lpNext, doneSum);
  273 +
  274 + //准备执行下一个班次
  275 + if (next != null) {
259 //将gps转换为下一个班次走向的站内信号 276 //将gps转换为下一个班次走向的站内信号
260 transformUpdown(gps, next); 277 transformUpdown(gps, next);
261 -  
262 //下发调度指令 278 //下发调度指令
263 directiveService.send60Dispatch(next, doneSum, "到站@系统"); 279 directiveService.send60Dispatch(next, doneSum, "到站@系统");
264 280
src/main/java/com/bsth/data/gpsdata/arrival/handlers/OfflineSignalHandle.java
@@ -30,7 +30,8 @@ public class OfflineSignalHandle extends SignalHandle{ @@ -30,7 +30,8 @@ public class OfflineSignalHandle extends SignalHandle{
30 30
31 if(isNotEmpty(prevs)){ 31 if(isNotEmpty(prevs)){
32 GpsEntity prev = prevs.getTail(); 32 GpsEntity prev = prevs.getTail();
33 - int space = (int) (gps.getTimestamp() - prev.getTimestamp()); 33 + //间隔太大就丢弃,不管之前还是之后
  34 + int space = Math.abs((int) (gps.getTimestamp() - prev.getTimestamp()));
34 if(space > OFFLINE_TIME) 35 if(space > OFFLINE_TIME)
35 gps.setSignalState("reconnection"); 36 gps.setSignalState("reconnection");
36 37
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
@@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware { @@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
60 for (String nbbm : keys) { 60 for (String nbbm : keys) {
61 Collections.sort(listMap.get(nbbm), comp); 61 Collections.sort(listMap.get(nbbm), comp);
62 threadPool.execute(new RecoveryThread(listMap.get(nbbm), count)); 62 threadPool.execute(new RecoveryThread(listMap.get(nbbm), count));
63 - /*if(nbbm.equals("W9G-013")) 63 + /*if(nbbm.equals("W7C-001"))
64 new RecoveryThread(listMap.get(nbbm), count).run();*/ 64 new RecoveryThread(listMap.get(nbbm), count).run();*/
65 } 65 }
66 66
@@ -150,8 +150,6 @@ public class GpsDataRecovery implements ApplicationContextAware { @@ -150,8 +150,6 @@ public class GpsDataRecovery implements ApplicationContextAware {
150 CircleQueue<GpsEntity> prevs; 150 CircleQueue<GpsEntity> prevs;
151 boolean task; 151 boolean task;
152 for (GpsEntity gps : list) { 152 for (GpsEntity gps : list) {
153 - /*if(gps.getTimestamp() > 1491951840000L)  
154 - System.out.print("");*/  
155 153
156 //是否有任务 154 //是否有任务
157 155
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
@@ -88,7 +88,7 @@ public class SafeDrivDataLoadThread extends Thread{ @@ -88,7 +88,7 @@ public class SafeDrivDataLoadThread extends Thread{
88 httpClient.close(); 88 httpClient.close();
89 response.close(); 89 response.close();
90 } catch (Exception e) { 90 } catch (Exception e) {
91 - logger.error("", e); 91 + logger.error(e.getMessage());
92 } 92 }
93 } 93 }
94 } 94 }
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -11,7 +11,10 @@ import com.bsth.data.directive.DirectivesPstThread; @@ -11,7 +11,10 @@ import com.bsth.data.directive.DirectivesPstThread;
11 import com.bsth.data.gpsdata.GpsRealData; 11 import com.bsth.data.gpsdata.GpsRealData;
12 import com.bsth.data.gpsdata.recovery.GpsDataRecovery; 12 import com.bsth.data.gpsdata.recovery.GpsDataRecovery;
13 import com.bsth.data.schedule.late_adjust.ScheduleLateThread; 13 import com.bsth.data.schedule.late_adjust.ScheduleLateThread;
14 -import com.bsth.data.schedule.thread.*; 14 +import com.bsth.data.schedule.thread.CalcOilThread;
  15 +import com.bsth.data.schedule.thread.SchedulePstThread;
  16 +import com.bsth.data.schedule.thread.ScheduleRefreshThread;
  17 +import com.bsth.data.schedule.thread.SubmitToTrafficManage;
15 import com.bsth.entity.realcontrol.LineConfig; 18 import com.bsth.entity.realcontrol.LineConfig;
16 import com.bsth.entity.realcontrol.ScheduleRealInfo; 19 import com.bsth.entity.realcontrol.ScheduleRealInfo;
17 import com.bsth.entity.schedule.SchedulePlanInfo; 20 import com.bsth.entity.schedule.SchedulePlanInfo;
@@ -20,7 +23,9 @@ import com.bsth.service.schedule.SchedulePlanInfoService; @@ -20,7 +23,9 @@ import com.bsth.service.schedule.SchedulePlanInfoService;
20 import com.bsth.util.BatchSaveUtils; 23 import com.bsth.util.BatchSaveUtils;
21 import com.bsth.util.DateUtils; 24 import com.bsth.util.DateUtils;
22 import com.bsth.websocket.handler.SendUtils; 25 import com.bsth.websocket.handler.SendUtils;
  26 +import com.google.common.base.Predicate;
23 import com.google.common.collect.ArrayListMultimap; 27 import com.google.common.collect.ArrayListMultimap;
  28 +import com.google.common.collect.Collections2;
24 import org.apache.commons.lang3.StringUtils; 29 import org.apache.commons.lang3.StringUtils;
25 import org.joda.time.format.DateTimeFormat; 30 import org.joda.time.format.DateTimeFormat;
26 import org.joda.time.format.DateTimeFormatter; 31 import org.joda.time.format.DateTimeFormatter;
@@ -56,16 +61,16 @@ public class DayOfSchedule implements CommandLineRunner { @@ -56,16 +61,16 @@ public class DayOfSchedule implements CommandLineRunner {
56 // 按车辆分组的班次数据 61 // 按车辆分组的班次数据
57 private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap; 62 private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap;
58 63
  64 + //按路牌分组的班次数据 线路编码_路牌名称 ——> 班次list
  65 + private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap;
  66 +
59 // 班次主键映射 67 // 班次主键映射
60 private static Map<Long, ScheduleRealInfo> id2SchedulMap; 68 private static Map<Long, ScheduleRealInfo> id2SchedulMap;
61 69
62 - // 车辆和排班起终点站对照(包括进出的停车场,区间起终点)  
63 - //private static TreeMultimap<String, String> nbbm2SEStationMap;  
64 -  
65 //车辆 ——> 当前执行班次 70 //车辆 ——> 当前执行班次
66 private static Map<String, ScheduleRealInfo> carExecutePlanMap; 71 private static Map<String, ScheduleRealInfo> carExecutePlanMap;
67 72
68 - // 持久化缓冲区 73 + // 持久化
69 public static LinkedList<ScheduleRealInfo> pstBuffer; 74 public static LinkedList<ScheduleRealInfo> pstBuffer;
70 75
71 // 排序器 76 // 排序器
@@ -99,11 +104,12 @@ public class DayOfSchedule implements CommandLineRunner { @@ -99,11 +104,12 @@ public class DayOfSchedule implements CommandLineRunner {
99 104
100 static { 105 static {
101 nbbmScheduleMap = ArrayListMultimap.create(); 106 nbbmScheduleMap = ArrayListMultimap.create();
  107 + lpScheduleMap = ArrayListMultimap.create();
  108 +
102 id2SchedulMap = new HashMap<>(); 109 id2SchedulMap = new HashMap<>();
103 pstBuffer = new LinkedList<>(); 110 pstBuffer = new LinkedList<>();
104 schFCSJComparator = new ScheduleComparator.FCSJ(); 111 schFCSJComparator = new ScheduleComparator.FCSJ();
105 currSchDateMap = new HashMap<>(); 112 currSchDateMap = new HashMap<>();
106 - //nbbm2SEStationMap = TreeMultimap.create();  
107 carExecutePlanMap = new HashMap<>(); 113 carExecutePlanMap = new HashMap<>();
108 114
109 schedulePlanMap = new HashMap<>(); 115 schedulePlanMap = new HashMap<>();
@@ -146,7 +152,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -146,7 +152,7 @@ public class DayOfSchedule implements CommandLineRunner {
146 //入库 152 //入库
147 // Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 30, TimeUnit.SECONDS); 153 // Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 30, TimeUnit.SECONDS);
148 //班次误点扫描 154 //班次误点扫描
149 -// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); 155 +// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS);
150 156
151 //每天凌晨2点20提交数据到运管处 157 //每天凌晨2点20提交数据到运管处
152 long diff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); 158 long diff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis();
@@ -154,10 +160,10 @@ public class DayOfSchedule implements CommandLineRunner { @@ -154,10 +160,10 @@ public class DayOfSchedule implements CommandLineRunner {
154 diff += (1000 * 60 * 60 * 24); 160 diff += (1000 * 60 * 60 * 24);
155 161
156 logger.info(diff / 1000 / 60 + "分钟之后提交到运管处"); 162 logger.info(diff / 1000 / 60 + "分钟之后提交到运管处");
157 - //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); 163 + //Application.mainServices.scheduleAtFixedRate(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
158 164
159 //计算油、公里加注 165 //计算油、公里加注
160 - Application.mainServices.scheduleWithFixedDelay(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); 166 + Application.mainServices.scheduleAtFixedRate(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
161 167
162 //指令持久化线程 168 //指令持久化线程
163 Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); 169 Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS);
@@ -230,10 +236,14 @@ public class DayOfSchedule implements CommandLineRunner { @@ -230,10 +236,14 @@ public class DayOfSchedule implements CommandLineRunner {
230 //添加到缓存 236 //添加到缓存
231 putAll(list); 237 putAll(list);
232 238
  239 +
  240 + Set<String> lps = searchAllLP(list);
  241 + for(String lp : lps){
  242 + //计算“起点站应到”时间
  243 + schAttrCalculator.calcQdzTimePlan(lpScheduleMap.get(lineCode + "_" + lp));
  244 + }
233 Set<String> cars = searchAllCars(list); 245 Set<String> cars = searchAllCars(list);
234 for (String nbbm : cars) { 246 for (String nbbm : cars) {
235 - //计算“起点站应到”时间  
236 - schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm));  
237 //车辆 ——> 要执行的班次对照 247 //车辆 ——> 要执行的班次对照
238 reCalcExecPlan(nbbm); 248 reCalcExecPlan(nbbm);
239 } 249 }
@@ -255,7 +265,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -255,7 +265,7 @@ public class DayOfSchedule implements CommandLineRunner {
255 /** 265 /**
256 * @Title: searchAllCars 266 * @Title: searchAllCars
257 * @Description: TODO(搜索班次集合中的车辆) 267 * @Description: TODO(搜索班次集合中的车辆)
258 - */ 268 + */
259 private Set<String> searchAllCars(List<ScheduleRealInfo> list) { 269 private Set<String> searchAllCars(List<ScheduleRealInfo> list) {
260 Set<String> cars = new HashSet<>(); 270 Set<String> cars = new HashSet<>();
261 for (ScheduleRealInfo sch : list) 271 for (ScheduleRealInfo sch : list)
@@ -264,6 +274,18 @@ public class DayOfSchedule implements CommandLineRunner { @@ -264,6 +274,18 @@ public class DayOfSchedule implements CommandLineRunner {
264 return cars; 274 return cars;
265 } 275 }
266 276
  277 + /**
  278 + * @Title: searchAllCars
  279 + * @Description: TODO(搜索班次集合中的路牌)
  280 + */
  281 + private Set<String> searchAllLP(List<ScheduleRealInfo> list) {
  282 + Set<String> lps = new HashSet<>();
  283 + for (ScheduleRealInfo sch : list)
  284 + lps.add(sch.getLpName());
  285 +
  286 + return lps;
  287 + }
  288 +
267 private void putAll(List<ScheduleRealInfo> list) { 289 private void putAll(List<ScheduleRealInfo> list) {
268 for (ScheduleRealInfo sch : list) 290 for (ScheduleRealInfo sch : list)
269 put(sch); 291 put(sch);
@@ -309,6 +331,17 @@ public class DayOfSchedule implements CommandLineRunner { @@ -309,6 +331,17 @@ public class DayOfSchedule implements CommandLineRunner {
309 } 331 }
310 } 332 }
311 333
  334 + //清理路牌对照
  335 + List<String> lprms = new ArrayList<>();
  336 + Set<String> lps = lpScheduleMap.keySet();
  337 + for(String lp : lps){
  338 + if(lp.indexOf(lineCode + "_") != -1)
  339 + lprms.add(lp);
  340 + }
  341 +
  342 + for(String lp : lprms)
  343 + lpScheduleMap.removeAll(lp);
  344 +
312 logger.info(lineCode + "排班清理 " + count); 345 logger.info(lineCode + "排班清理 " + count);
313 } 346 }
314 347
@@ -493,18 +526,31 @@ public class DayOfSchedule implements CommandLineRunner { @@ -493,18 +526,31 @@ public class DayOfSchedule implements CommandLineRunner {
493 return id2SchedulMap.get(id); 526 return id2SchedulMap.get(id);
494 } 527 }
495 528
496 - /* public Set<String> getSEStationList(String nbbm) {  
497 - return nbbm2SEStationMap.get(nbbm);  
498 - }*/  
499 529
500 /** 530 /**
501 * @Title: next 531 * @Title: next
502 * @Description: TODO(下一个班次) 532 * @Description: TODO(下一个班次)
503 */ 533 */
504 public ScheduleRealInfo next(ScheduleRealInfo sch) { 534 public ScheduleRealInfo next(ScheduleRealInfo sch) {
  535 + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
  536 + return next(list, sch);
  537 + }
505 538
  539 + /**
  540 + * 下一个相同走向的班次
  541 + * @param sch
  542 + * @return
  543 + */
  544 + public ScheduleRealInfo nextSame(final ScheduleRealInfo sch){
506 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); 545 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
507 - int outConfig = -1; 546 + Collection<ScheduleRealInfo> subList = Collections2.filter(list, new Predicate<ScheduleRealInfo>(){
  547 +
  548 + @Override
  549 + public boolean apply(ScheduleRealInfo item) {
  550 + return item.getXlDir().equals(sch.getXlDir());
  551 + }
  552 + });
  553 + /*int outConfig = -1;
508 LineConfig config = lineConfigData.get(sch.getXlBm()); 554 LineConfig config = lineConfigData.get(sch.getXlBm());
509 if (config != null) 555 if (config != null)
510 outConfig = config.getOutConfig(); 556 outConfig = config.getOutConfig();
@@ -528,21 +574,22 @@ public class DayOfSchedule implements CommandLineRunner { @@ -528,21 +574,22 @@ public class DayOfSchedule implements CommandLineRunner {
528 && (!limitPark || park.equals(temp.getQdzCode()))) 574 && (!limitPark || park.equals(temp.getQdzCode())))
529 continue; 575 continue;
530 576
531 - if (flag) { 577 + if (flag && temp.getXlDir().equals(sch.getXlDir())) {
532 next = temp; 578 next = temp;
533 break; 579 break;
534 } 580 }
535 - }  
536 - return next; 581 + }*/
  582 + return next(subList, sch);
537 } 583 }
538 584
  585 +
539 /** 586 /**
540 - * 下一个相同走向的班次  
541 - * @param sch 587 + * 下一个班次
  588 + * @param list 班次集合
  589 + * @param sch 当前班次
542 * @return 590 * @return
543 */ 591 */
544 - public ScheduleRealInfo nextSame(ScheduleRealInfo sch){  
545 - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); 592 + private ScheduleRealInfo next(Collection<ScheduleRealInfo> list , ScheduleRealInfo sch){
546 int outConfig = -1; 593 int outConfig = -1;
547 LineConfig config = lineConfigData.get(sch.getXlBm()); 594 LineConfig config = lineConfigData.get(sch.getXlBm());
548 if (config != null) 595 if (config != null)
@@ -567,7 +614,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -567,7 +614,7 @@ public class DayOfSchedule implements CommandLineRunner {
567 && (!limitPark || park.equals(temp.getQdzCode()))) 614 && (!limitPark || park.equals(temp.getQdzCode())))
568 continue; 615 continue;
569 616
570 - if (flag && temp.getXlDir().equals(sch.getXlDir())) { 617 + if (flag) {
571 next = temp; 618 next = temp;
572 break; 619 break;
573 } 620 }
@@ -623,16 +670,21 @@ public class DayOfSchedule implements CommandLineRunner { @@ -623,16 +670,21 @@ public class DayOfSchedule implements CommandLineRunner {
623 670
624 String nbbm = sch.getClZbh(); 671 String nbbm = sch.getClZbh();
625 nbbmScheduleMap.put(nbbm, sch); 672 nbbmScheduleMap.put(nbbm, sch);
626 - //nbbm2SEStationMap.put(nbbm, sch.getQdzCode());  
627 - //nbbm2SEStationMap.put(nbbm, sch.getZdzCode());  
628 673
629 //主键索引 674 //主键索引
630 id2SchedulMap.put(sch.getId(), sch); 675 id2SchedulMap.put(sch.getId(), sch);
  676 + //路牌对照表
  677 + addLPMapp(sch);
  678 +
631 //跨24点的,再save一次 679 //跨24点的,再save一次
632 if (!sch.getRealExecDate().equals(sch.getScheduleDateStr())) 680 if (!sch.getRealExecDate().equals(sch.getScheduleDateStr()))
633 save(sch); 681 save(sch);
634 } 682 }
635 683
  684 + public void addLPMapp(ScheduleRealInfo sch){
  685 + lpScheduleMap.put(sch.getXlBm() + "_" + sch.getLpName(), sch);
  686 + }
  687 +
636 public void delete(ScheduleRealInfo sch) { 688 public void delete(ScheduleRealInfo sch) {
637 //ScheduleRealInfo sch = id2SchedulMap.get(id); 689 //ScheduleRealInfo sch = id2SchedulMap.get(id);
638 if (!sch.isSflj()) 690 if (!sch.isSflj())
@@ -640,13 +692,24 @@ public class DayOfSchedule implements CommandLineRunner { @@ -640,13 +692,24 @@ public class DayOfSchedule implements CommandLineRunner {
640 692
641 nbbmScheduleMap.remove(sch.getClZbh(), sch); 693 nbbmScheduleMap.remove(sch.getClZbh(), sch);
642 id2SchedulMap.remove(sch.getId()); 694 id2SchedulMap.remove(sch.getId());
  695 + lpScheduleMap.remove(sch.getXlBm() + "_" + sch.getLpName(), sch);
643 //return sch; 696 //return sch;
644 } 697 }
645 698
646 699
647 - public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) { 700 +/* public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) {
648 Collections.sort(nbbmScheduleMap.get(nbbm), schFCSJComparator); 701 Collections.sort(nbbmScheduleMap.get(nbbm), schFCSJComparator);
649 return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm)); 702 return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm));
  703 + }*/
  704 +
  705 + public List<ScheduleRealInfo> updateQdzTimePlan(String lpName) {
  706 + List<ScheduleRealInfo> list = lpScheduleMap.get(lpName);
  707 + Collections.sort(list, schFCSJComparator);
  708 + return schAttrCalculator.updateQdzTimePlan(list);
  709 + }
  710 +
  711 + public List<ScheduleRealInfo> updateQdzTimePlan(ScheduleRealInfo sch) {
  712 + return updateQdzTimePlan(sch.getXlBm() + "_" + sch.getLpName());
650 } 713 }
651 714
652 /** 715 /**
@@ -807,9 +870,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -807,9 +870,9 @@ public class DayOfSchedule implements CommandLineRunner {
807 */ 870 */
808 public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch, String newClZbh) { 871 public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch, String newClZbh) {
809 List<ScheduleRealInfo> ups = new ArrayList<>(); 872 List<ScheduleRealInfo> ups = new ArrayList<>();
810 - String oldClzbh = sch.getClZbh(); 873 + /*String oldClzbh = sch.getClZbh();
811 if (oldClzbh.equals(newClZbh)) 874 if (oldClzbh.equals(newClZbh))
812 - return ups; 875 + return ups;*/
813 876
814 877
815 //变更相关映射信息 878 //变更相关映射信息
@@ -817,12 +880,10 @@ public class DayOfSchedule implements CommandLineRunner { @@ -817,12 +880,10 @@ public class DayOfSchedule implements CommandLineRunner {
817 880
818 sch.setClZbh(newClZbh); 881 sch.setClZbh(newClZbh);
819 nbbmScheduleMap.put(newClZbh, sch); 882 nbbmScheduleMap.put(newClZbh, sch);
820 - //nbbm2SEStationMap.put(newClZbh, sch.getQdzCode());  
821 - //nbbm2SEStationMap.put(newClZbh, sch.getZdzCode());  
822 883
823 //重新计算班次应到时间 884 //重新计算班次应到时间
824 - ups.addAll(updateQdzTimePlan(oldClzbh));  
825 - ups.addAll(updateQdzTimePlan(newClZbh)); 885 + //ups.addAll(updateQdzTimePlan(oldClzbh));
  886 + //ups.addAll(updateQdzTimePlan(newClZbh));
826 887
827 //重新计算车辆当前执行班次 888 //重新计算车辆当前执行班次
828 reCalcExecPlan(newClZbh); 889 reCalcExecPlan(newClZbh);
@@ -839,7 +900,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -839,7 +900,9 @@ public class DayOfSchedule implements CommandLineRunner {
839 } 900 }
840 901
841 public void reCalcExecPlan(String nbbm){ 902 public void reCalcExecPlan(String nbbm){
842 - carExecutePlanMap.put(nbbm, schAttrCalculator.calcCurrentExecSch(nbbmScheduleMap.get(nbbm))); 903 + List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm);
  904 + Collections.sort(list, schFCSJComparator);
  905 + carExecutePlanMap.put(nbbm, schAttrCalculator.calcCurrentExecSch(list));
843 } 906 }
844 907
845 /** 908 /**
@@ -939,4 +1002,15 @@ public class DayOfSchedule implements CommandLineRunner { @@ -939,4 +1002,15 @@ public class DayOfSchedule implements CommandLineRunner {
939 //重新计算班次应到时间 1002 //重新计算班次应到时间
940 updateQdzTimePlan(nbbm); 1003 updateQdzTimePlan(nbbm);
941 } 1004 }
  1005 +
  1006 + /**
  1007 + * 获取该班次所在路牌的下一个班次
  1008 + * @param sch
  1009 + * @return
  1010 + */
  1011 + public ScheduleRealInfo nextByLp(ScheduleRealInfo sch) {
  1012 + List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName());
  1013 + Collections.sort(list, schFCSJComparator);
  1014 + return next(list, sch);
  1015 + }
942 } 1016 }
943 \ No newline at end of file 1017 \ No newline at end of file
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
@@ -104,7 +104,7 @@ public class SchAttrCalculator { @@ -104,7 +104,7 @@ public class SchAttrCalculator {
104 /** 104 /**
105 * 105 *
106 * @Title: calcQdzTimePlan 106 * @Title: calcQdzTimePlan
107 - * @Description: TODO(计算班次的起点应到时间,list 必须是同一辆车的班次) 107 + * @Description: TODO(计算班次的起点应到时间)
108 */ 108 */
109 public void calcQdzTimePlan(List<ScheduleRealInfo> list){ 109 public void calcQdzTimePlan(List<ScheduleRealInfo> list){
110 Collections.sort(list, new ScheduleComparator.FCSJ()); 110 Collections.sort(list, new ScheduleComparator.FCSJ());
@@ -116,12 +116,13 @@ public class SchAttrCalculator { @@ -116,12 +116,13 @@ public class SchAttrCalculator {
116 ScheduleRealInfo prve = list.get(0), curr; 116 ScheduleRealInfo prve = list.get(0), curr;
117 for(int i = 1; i < len; i ++){ 117 for(int i = 1; i < len; i ++){
118 curr = list.get(i); 118 curr = list.get(i);
119 - if(prve.getZdzName().equals(curr.getQdzName())){ 119 +
  120 + if(prve.getZdzName().equals(curr.getQdzName())
  121 + || prve.getZdzCode().equals(curr.getQdzCode())){
120 curr.setQdzArrDateJH(prve.getZdsj()); 122 curr.setQdzArrDateJH(prve.getZdsj());
121 - if(StringUtils.isNotEmpty(prve.getZdsjActual()) && StringUtils.isEmpty(curr.getQdzArrDatesj())) 123 + if(StringUtils.isNotEmpty(prve.getZdsjActual()))
122 curr.setQdzArrDatesj(prve.getZdsjActual()); 124 curr.setQdzArrDatesj(prve.getZdsjActual());
123 } 125 }
124 -  
125 prve = curr; 126 prve = curr;
126 } 127 }
127 } 128 }
@@ -129,7 +130,7 @@ public class SchAttrCalculator { @@ -129,7 +130,7 @@ public class SchAttrCalculator {
129 /** 130 /**
130 * 131 *
131 * @Title: updateQdzTimePlan 132 * @Title: updateQdzTimePlan
132 - * @Description: TODO(更新班次的起点应到时间,list 必须是同一辆车的班次) 并返回被更新的班次 133 + * @Description: TODO(更新班次的起点应到时间) 并返回被更新的班次
133 */ 134 */
134 public List<ScheduleRealInfo> updateQdzTimePlan(List<ScheduleRealInfo> list){ 135 public List<ScheduleRealInfo> updateQdzTimePlan(List<ScheduleRealInfo> list){
135 Collections.sort(list, new ScheduleComparator.FCSJ()); 136 Collections.sort(list, new ScheduleComparator.FCSJ());
@@ -143,7 +144,8 @@ public class SchAttrCalculator { @@ -143,7 +144,8 @@ public class SchAttrCalculator {
143 for(int i = 1; i < len; i ++){ 144 for(int i = 1; i < len; i ++){
144 curr = list.get(i); 145 curr = list.get(i);
145 146
146 - if(prve.getZdzName().equals(curr.getQdzName())){ 147 + if(prve.getZdzName().equals(curr.getQdzName())
  148 + || prve.getZdzCode().equals(curr.getQdzCode())){
147 149
148 if(curr.getQdzArrDateJH() != null && prve.getZdsj().equals(curr.getQdzArrDateJH())){ 150 if(curr.getQdzArrDateJH() != null && prve.getZdsj().equals(curr.getQdzArrDateJH())){
149 prve = curr; 151 prve = curr;
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
1 -  
2 -package com.bsth.data.schedule.late_adjust;  
3 -  
4 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
5 -  
6 -import java.util.Map;  
7 -  
8 -/**  
9 - * 误点调整处理程序  
10 - * Created by panzhao on 2017/4/16.  
11 - */  
12 -public class LateAdjustHandle {  
13 -  
14 - /**  
15 - * 误点的车辆 和 班次  
16 - */  
17 - private static Map<String, ScheduleRealInfo> lateSchMap;  
18 -  
19 -  
20 - /**  
21 - * 误点的班次ID 和 停靠时间(秒)  
22 - */  
23 - private static Map<Long, Integer> stopTimeMap;  
24 -  
25 -  
26 - /**  
27 - * 班次误点(考虑停靠时间)  
28 - * @param sch  
29 - */  
30 - public static void schLate(ScheduleRealInfo sch){  
31 -  
32 - }  
33 -} 1 +
  2 +package com.bsth.data.schedule.late_adjust;
  3 +
  4 +import com.bsth.data.BasicData;
  5 +import com.bsth.data.LineConfigData;
  6 +import com.bsth.data.gpsdata.GpsEntity;
  7 +import com.bsth.entity.realcontrol.LineConfig;
  8 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  9 +import com.bsth.util.Arith;
  10 +import com.bsth.websocket.handler.SendUtils;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.BeansException;
  14 +import org.springframework.context.ApplicationContext;
  15 +import org.springframework.context.ApplicationContextAware;
  16 +import org.springframework.stereotype.Component;
  17 +
  18 +import java.util.Collection;
  19 +import java.util.HashMap;
  20 +import java.util.Map;
  21 +
  22 +/**
  23 + * 误点自动调整待发 处理程序
  24 + *
  25 + * 注意 :这里的误点是指应发未到
  26 + * Created by panzhao on 2017/4/16.
  27 + */
  28 +@Component
  29 +public class LateAdjustHandle implements ApplicationContextAware{
  30 +
  31 + static LineConfigData lineConfigData;
  32 + static SendUtils sendUtils;
  33 +
  34 + static Logger logger = LoggerFactory.getLogger(LateAdjustHandle.class);
  35 +
  36 + /**
  37 + * 应发未到车辆 和 班次
  38 + */
  39 + private static Map<String, ScheduleRealInfo> lateSchMap;
  40 +
  41 +
  42 + static {
  43 + lateSchMap = new HashMap<>();
  44 + }
  45 +
  46 + /**
  47 + * 新增一个误点班次
  48 + * @param sch
  49 + */
  50 + public static void putLate(ScheduleRealInfo sch){
  51 + try {
  52 + //进出场班次不需要
  53 + if(sch.getBcType().equals("in") || sch.getBcType().equals("out"))
  54 + return;
  55 + //线路配置
  56 + LineConfig config = lineConfigData.get(sch.getXlBm());
  57 + if(sch.getLateMinute() == 0){
  58 + if(config.isEnableYjtk()){
  59 + sch.setLateMinute(sch.getXlDir().equals("0")?config.getUpStopMinute():config.getDownStopMinute());
  60 + }
  61 + else
  62 + return;
  63 + }
  64 +
  65 + if(sch.getDfsj().compareTo(config.getYjtkStart()) > 0
  66 + && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){
  67 +
  68 + ScheduleRealInfo cancel = null;
  69 + //之前存在误点班次没有发出
  70 + ScheduleRealInfo old = lateSchMap.get(sch.getClZbh());
  71 + if(old != null && old.getDfsjT() < sch.getDfsjT()){
  72 + remove(old);
  73 + cancel = old;
  74 + logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!");
  75 + }
  76 +
  77 + lateSchMap.put(sch.getClZbh(), sch);
  78 + //通知客户端
  79 + sch.setLate2(true);
  80 + sendUtils.sendAutoWdtz(sch, cancel);
  81 +
  82 + logger.info("【应发未到】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");
  83 + }
  84 + }catch (Exception e){
  85 + logger.error("", e);
  86 + }
  87 + }
  88 +
  89 +
  90 + /**
  91 + * 获取所有应发未到的班次
  92 + * @return
  93 + */
  94 + public static Collection<ScheduleRealInfo> allLateSch(){
  95 + return lateSchMap.values();
  96 + }
  97 +
  98 + public static void remove(ScheduleRealInfo sch){
  99 + try {
  100 + if(lateSchMap.get(sch.getClZbh()) == sch){
  101 + lateSchMap.remove(sch.getClZbh());
  102 + sch.setLate2(false);
  103 + sch.setLateMinute(0);
  104 + }
  105 + }catch (Exception e){
  106 + logger.error("", e);
  107 + }
  108 + }
  109 +
  110 + /**
  111 + * 车辆到站
  112 + * @param gps
  113 + */
  114 + public static void carArrive(GpsEntity gps){
  115 + try{
  116 + if(gps.getInstation() != 1)
  117 + return;
  118 +
  119 + ScheduleRealInfo sch = lateSchMap.get(gps.getNbbm());
  120 + if(sch == null)
  121 + return;
  122 +
  123 + //进的是班次起点(名称一样即可)
  124 + gps.setStationName(BasicData.stationCode2NameMap.get(gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo()));
  125 + if(gps.getStationName().equals(sch.getQdzName())
  126 + && sch.getLateMinute() > 0){
  127 + //自动调整待发 到达时间 + 停靠时间
  128 + long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000));
  129 + sch.setDfsjAll(dt);
  130 + sch.setDfAuto(true);
  131 + //取消应发未到标记
  132 + sch.setLate2(false);
  133 +
  134 + lateSchMap.remove(sch.getClZbh());
  135 + logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt);
  136 + }
  137 + }catch (Exception e){
  138 + e.printStackTrace();
  139 + logger.error("", e);
  140 + }
  141 + }
  142 +
  143 + @Override
  144 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  145 + lineConfigData = applicationContext.getBean(LineConfigData.class);
  146 + sendUtils = applicationContext.getBean(SendUtils.class);
  147 + }
  148 +}
34 \ No newline at end of file 149 \ No newline at end of file
src/main/java/com/bsth/data/schedule/late_adjust/ScheduleLateThread.java
1 -package com.bsth.data.schedule.late_adjust;  
2 -  
3 -  
4 -import com.bsth.data.schedule.DayOfSchedule;  
5 -import com.bsth.data.schedule.ScheduleComparator;  
6 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
7 -import com.bsth.websocket.handler.SendUtils;  
8 -import org.springframework.beans.factory.annotation.Autowired;  
9 -import org.springframework.stereotype.Component;  
10 -  
11 -import java.util.ArrayList;  
12 -import java.util.Collections;  
13 -import java.util.Comparator;  
14 -import java.util.List;  
15 -  
16 -/**  
17 - *  
18 - * @ClassName: ScheduleLateThread  
19 - * @Description: TODO(班次误点扫描线程)  
20 - * @author PanZhao  
21 - * @date 2016年8月31日 下午3:09:02  
22 - *  
23 - */  
24 -@Component  
25 -public class ScheduleLateThread extends Thread{  
26 -  
27 - @Autowired  
28 - DayOfSchedule dayOfSchedule;  
29 -  
30 - @Autowired  
31 - SendUtils sendUtils;  
32 -  
33 - private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.FCSJ();  
34 -  
35 - @Override  
36 - public void run() {  
37 - List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll());  
38 - Collections.sort(all, cpm);  
39 -  
40 - long t = System.currentTimeMillis();  
41 - int size = all.size();  
42 -  
43 - ScheduleRealInfo sch;  
44 - for(int i = 0; i < size; i ++){  
45 - sch = all.get(i);  
46 - if(sch.getDfsjT() > t)  
47 - break;  
48 -  
49 - if(sch.isLate() == false  
50 - && sch.getStatus() == 0  
51 - && sch.getFcsjActual() == null){  
52 - //应发未发  
53 - sch.setLate(true);  
54 - //通知客户端  
55 - sendUtils.refreshSch(sch);  
56 - }  
57 - }  
58 - }  
59 -} 1 +package com.bsth.data.schedule.late_adjust;
  2 +
  3 +
  4 +import com.bsth.data.schedule.DayOfSchedule;
  5 +import com.bsth.data.schedule.ScheduleComparator;
  6 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  7 +import com.bsth.websocket.handler.SendUtils;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import java.util.ArrayList;
  13 +import java.util.Collections;
  14 +import java.util.Comparator;
  15 +import java.util.List;
  16 +
  17 +/**
  18 + *
  19 + * @ClassName: ScheduleLateThread
  20 + * @Description: TODO(班次误点扫描线程)
  21 + * @author PanZhao
  22 + * @date 2016年8月31日 下午3:09:02
  23 + *
  24 + */
  25 +@Component
  26 +public class ScheduleLateThread extends Thread{
  27 +
  28 + @Autowired
  29 + DayOfSchedule dayOfSchedule;
  30 +
  31 + @Autowired
  32 + SendUtils sendUtils;
  33 +
  34 + private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.FCSJ();
  35 +
  36 + @Override
  37 + public void run() {
  38 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll());
  39 + Collections.sort(all, cpm);
  40 +
  41 + long t = System.currentTimeMillis();
  42 + int size = all.size();
  43 +
  44 + ScheduleRealInfo sch;
  45 + for(int i = 0; i < size; i ++){
  46 + sch = all.get(i);
  47 + if(sch.getDfsjT() > t)
  48 + break;
  49 +
  50 + if(sch.isLate())
  51 + continue;
  52 +
  53 + if(sch.getStatus() == 0
  54 + && StringUtils.isEmpty(sch.getFcsjActual())){
  55 +
  56 + //检查应发未到 当前班次无起点到达时间
  57 + if(StringUtils.isEmpty(sch.getQdzArrDateSJ())){
  58 + ScheduleRealInfo prev = dayOfSchedule.prev(sch);
  59 + //上一个班次也没有实际终点到达时间
  60 + if(prev != null && StringUtils.isEmpty(prev.getZdsjActual())){
  61 + //进入误点调整程序
  62 + LateAdjustHandle.putLate(sch);
  63 + }
  64 + }
  65 +
  66 + //应发未发
  67 + sch.setLate(true);
  68 + //通知客户端
  69 + sendUtils.refreshSch(sch);
  70 + }
  71 + }
  72 + }
  73 +}
60 \ No newline at end of file 74 \ No newline at end of file
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
@@ -57,8 +57,6 @@ public class ScheduleRefreshThread extends Thread{ @@ -57,8 +57,6 @@ public class ScheduleRefreshThread extends Thread{
57 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){ 57 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){
58 58
59 logger.info(lineCode + "开始翻班, " + currSchDate); 59 logger.info(lineCode + "开始翻班, " + currSchDate);
60 - //清除进出站数据  
61 - //arrivalData.clearRAMData(lineCode);  
62 //清除指令数据 60 //清除指令数据
63 Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode); 61 Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode);
64 for(String car : cars) 62 for(String car : cars)
src/main/java/com/bsth/entity/Business.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Column;
3 import javax.persistence.Entity; 6 import javax.persistence.Entity;
4 import javax.persistence.GeneratedValue; 7 import javax.persistence.GeneratedValue;
5 import javax.persistence.GenerationType; 8 import javax.persistence.GenerationType;
@@ -40,6 +43,29 @@ public class Business { @@ -40,6 +43,29 @@ public class Business {
40 43
41 // 描述 44 // 描述
42 private String descriptions; 45 private String descriptions;
  46 +
  47 + // 创建日期
  48 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  49 + private Date createDate;
  50 +
  51 + // 修改日期
  52 + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  53 + private Date updateDate;
  54 + public Date getCreateDate() {
  55 + return createDate;
  56 + }
  57 +
  58 + public void setCreateDate(Date createDate) {
  59 + this.createDate = createDate;
  60 + }
  61 +
  62 + public Date getUpdateDate() {
  63 + return updateDate;
  64 + }
  65 +
  66 + public void setUpdateDate(Date updateDate) {
  67 + this.updateDate = updateDate;
  68 + }
43 69
44 public Integer getId() { 70 public Integer getId() {
45 return id; 71 return id;
src/main/java/com/bsth/entity/LineInformation.java
@@ -64,6 +64,12 @@ public class LineInformation { @@ -64,6 +64,12 @@ public class LineInformation {
64 // 晚高峰结束时间 00:00 64 // 晚高峰结束时间 00:00
65 private String lateEndTime; 65 private String lateEndTime;
66 66
  67 + // 小夜高峰开始时间 00:00
  68 + private String xygfkssj;
  69 +
  70 + // 小夜高峰结束时间 00:00
  71 + private String xygfjssj;
  72 +
67 // 早高峰上行行驶时间 73 // 早高峰上行行驶时间
68 private Double earlyUpTime; 74 private Double earlyUpTime;
69 75
@@ -91,15 +97,6 @@ public class LineInformation { @@ -91,15 +97,6 @@ public class LineInformation {
91 // 停车场 97 // 停车场
92 private String carPark; 98 private String carPark;
93 99
94 - // 进场时间  
95 - private Double paradeTime;  
96 -  
97 - // 出场时间  
98 - private Double outTime;  
99 -  
100 - // 进场里程  
101 - private Double paradeMileage;  
102 -  
103 // 上行进场时间 100 // 上行进场时间
104 private Double upInTimer; 101 private Double upInTimer;
105 102
@@ -123,7 +120,82 @@ public class LineInformation { @@ -123,7 +120,82 @@ public class LineInformation {
123 120
124 // 下行出场里程 121 // 下行出场里程
125 private Double downOutMileage; 122 private Double downOutMileage;
  123 +
  124 + // 早高峰大间隔(分钟)老调度系统字段,暂时保留
  125 + private Double earlyIntervalLg;
  126 +
  127 + // 晚高峰大间隔(分钟)老调度系统字段,暂时保留
  128 + private Double lateIntervalLg;
  129 +
  130 + // 平时大间隔(分钟)老调度系统字段,暂时保留
  131 + private Double intervalLg;
  132 +
  133 + // 限速(平时)老调度系统字段,暂时保留
  134 + private Double speedLimit;
  135 +
  136 + // 限速(雨天)老调度系统字段,暂时保留
  137 + private Double rainLimit;
  138 +
  139 + // 限速(大雾)老调度系统字段,暂时保留
  140 + private Double fogLimit;
126 141
  142 + // 限速(冰雪)老调度系统字段,暂时保留
  143 + private Double snowLimit;
  144 +
  145 + // 限速(节庆)老调度系统字段,暂时保留
  146 + private Double festivalSpeedLimit;
  147 +
  148 + // 滞站
  149 + private Integer lagStation;
  150 +
  151 + // 越站
  152 + private Integer skip;
  153 +
  154 + // 超速
  155 + private Integer speeding;
  156 +
  157 + // 串线
  158 + private Integer crossedLine;
  159 +
  160 + // 越界
  161 + private Integer overflights;
  162 +
  163 + // 描述
  164 + private String descriptions;
  165 +
  166 + // 创建人
  167 + private Integer createBy;
  168 +
  169 + // 修改人
  170 + private Integer updateBy;
  171 +
  172 + // 创建日期
  173 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  174 + private Date createDate;
  175 +
  176 + // 修改日期
  177 + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  178 + private Date updateDate;
  179 +
  180 + @ManyToOne
  181 + private Line line;
  182 +
  183 + public String getXygfkssj() {
  184 + return xygfkssj;
  185 + }
  186 +
  187 + public void setXygfkssj(String xygfkssj) {
  188 + this.xygfkssj = xygfkssj;
  189 + }
  190 +
  191 + public String getXygfjssj() {
  192 + return xygfjssj;
  193 + }
  194 +
  195 + public void setXygfjssj(String xygfjssj) {
  196 + this.xygfjssj = xygfjssj;
  197 + }
  198 +
127 public Double getUpInTimer() { 199 public Double getUpInTimer() {
128 return upInTimer; 200 return upInTimer;
129 } 201 }
@@ -188,68 +260,6 @@ public class LineInformation { @@ -188,68 +260,6 @@ public class LineInformation {
188 this.downOutMileage = downOutMileage; 260 this.downOutMileage = downOutMileage;
189 } 261 }
190 262
191 - // 出场里程  
192 - private Double outMileage;  
193 -  
194 - // 早高峰大间隔(分钟)  
195 - private Double earlyIntervalLg;  
196 -  
197 - // 晚高峰大间隔(分钟)  
198 - private Double lateIntervalLg;  
199 -  
200 - // 平时大间隔(分钟)  
201 - private Double intervalLg;  
202 -  
203 - // 限速(平时)  
204 - private Double speedLimit;  
205 -  
206 - // 限速(雨天)  
207 - private Double rainLimit;  
208 -  
209 - // 限速(大雾)  
210 - private Double fogLimit;  
211 -  
212 - // 限速(冰雪)  
213 - private Double snowLimit;  
214 -  
215 - // 限速(节庆)  
216 - private Double festivalSpeedLimit;  
217 -  
218 - // 滞站  
219 - private Integer lagStation;  
220 -  
221 - // 越站  
222 - private Integer skip;  
223 -  
224 - // 超速  
225 - private Integer speeding;  
226 -  
227 - // 串线  
228 - private Integer crossedLine;  
229 -  
230 - // 越界  
231 - private Integer overflights;  
232 -  
233 - // 描述  
234 - private String descriptions;  
235 -  
236 - // 创建人  
237 - private Integer createBy;  
238 -  
239 - // 修改人  
240 - private Integer updateBy;  
241 -  
242 - // 创建日期  
243 - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
244 - private Date createDate;  
245 -  
246 - // 修改日期  
247 - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")  
248 - private Date updateDate;  
249 -  
250 - @ManyToOne  
251 - private Line line;  
252 -  
253 public Integer getId() { 263 public Integer getId() {
254 return id; 264 return id;
255 } 265 }
@@ -416,39 +426,6 @@ public class LineInformation { @@ -416,39 +426,6 @@ public class LineInformation {
416 public void setCarPark(String carPark) { 426 public void setCarPark(String carPark) {
417 this.carPark = carPark; 427 this.carPark = carPark;
418 } 428 }
419 -  
420 - public Double getParadeTime() {  
421 - return paradeTime;  
422 - }  
423 -  
424 - public void setParadeTime(Double paradeTime) {  
425 - this.paradeTime = paradeTime;  
426 - }  
427 -  
428 - public Double getOutTime() {  
429 - return outTime;  
430 - }  
431 -  
432 - public void setOutTime(Double outTime) {  
433 - this.outTime = outTime;  
434 - }  
435 -  
436 - public Double getParadeMileage() {  
437 - return paradeMileage;  
438 - }  
439 -  
440 - public void setParadeMileage(Double paradeMileage) {  
441 - this.paradeMileage = paradeMileage;  
442 - }  
443 -  
444 - public Double getOutMileage() {  
445 - return outMileage;  
446 - }  
447 -  
448 - public void setOutMileage(Double outMileage) {  
449 - this.outMileage = outMileage;  
450 - }  
451 -  
452 public Double getEarlyIntervalLg() { 429 public Double getEarlyIntervalLg() {
453 return earlyIntervalLg; 430 return earlyIntervalLg;
454 } 431 }
src/main/java/com/bsth/entity/SectionRoute.java
@@ -52,7 +52,7 @@ public class SectionRoute { @@ -52,7 +52,7 @@ public class SectionRoute {
52 // 是否撤销 52 // 是否撤销
53 private Integer destroy; 53 private Integer destroy;
54 54
55 - /** 是否有路段限速数据 <0:未分段;1:分段>*/ 55 + /** 是否有路段限速数据 <0:分段;1:未分段>*/
56 private Integer isRoadeSpeed; 56 private Integer isRoadeSpeed;
57 57
58 // 描述 58 // 描述
src/main/java/com/bsth/entity/mcy_forms/Operationservice.java
@@ -3,7 +3,7 @@ package com.bsth.entity.mcy_forms; @@ -3,7 +3,7 @@ package com.bsth.entity.mcy_forms;
3 public class Operationservice { 3 public class Operationservice {
4 4
5 private String xlName;//线路 5 private String xlName;//线路
6 - 6 + private String xlBm;//线路编码
7 private String jzl;//加注量 7 private String jzl;//加注量
8 8
9 private String xhl;//消耗量 9 private String xhl;//消耗量
@@ -81,6 +81,14 @@ public class Operationservice { @@ -81,6 +81,14 @@ public class Operationservice {
81 public void setSjbc(String sjbc) { 81 public void setSjbc(String sjbc) {
82 this.sjbc = sjbc; 82 this.sjbc = sjbc;
83 } 83 }
  84 +
  85 + public String getXlBm() {
  86 + return xlBm;
  87 + }
  88 +
  89 + public void setXlBm(String xlBm) {
  90 + this.xlBm = xlBm;
  91 + }
84 92
85 93
86 } 94 }
src/main/java/com/bsth/entity/mcy_forms/Waybillday.java
@@ -20,6 +20,8 @@ public class Waybillday { @@ -20,6 +20,8 @@ public class Waybillday {
20 20
21 private String zlc;//里程 21 private String zlc;//里程
22 22
  23 + private String sh;//损耗
  24 +
23 public String getJgh() { 25 public String getJgh() {
24 return jgh; 26 return jgh;
25 } 27 }
@@ -110,6 +112,15 @@ public class Waybillday { @@ -110,6 +112,15 @@ public class Waybillday {
110 public void setYl(String yl) { 112 public void setYl(String yl) {
111 this.yl = yl; 113 this.yl = yl;
112 } 114 }
  115 +
  116 + public String getSh() {
  117 + return sh;
  118 + }
  119 +
  120 + public void setSh(String sh) {
  121 + this.sh = sh;
  122 + }
  123 +
113 124
114 125
115 } 126 }
src/main/java/com/bsth/entity/oil/Ylb.java
@@ -63,6 +63,11 @@ public class Ylb { @@ -63,6 +63,11 @@ public class Ylb {
63 @Transient 63 @Transient
64 private String gsname; 64 private String gsname;
65 65
  66 + @Transient
  67 + private String fgsname;
  68 +
  69 + @Transient
  70 + private String name;
66 71
67 public Integer getId() { 72 public Integer getId() {
68 return id; 73 return id;
@@ -299,6 +304,22 @@ public class Ylb { @@ -299,6 +304,22 @@ public class Ylb {
299 } 304 }
300 305
301 306
  307 + public String getFgsname() {
  308 + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.ssgsdm);
  309 + }
  310 +
  311 + public void setFgsname(String fgsname) {
  312 + this.fgsname = fgsname;
  313 + }
  314 +
  315 + public String getName() {
  316 + return BasicData.allPerson.get(this.jsy);
  317 + }
  318 +
  319 + public void setName(String name) {
  320 + this.name = name;
  321 + }
  322 +
302 323
303 324
304 325
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
@@ -82,7 +82,9 @@ public class LineConfig { @@ -82,7 +82,9 @@ public class LineConfig {
82 * 应急停靠 82 * 应急停靠
83 */ 83 */
84 private boolean enableYjtk; 84 private boolean enableYjtk;
  85 + /** HH:mm */
85 private String yjtkStart; 86 private String yjtkStart;
  87 + /** HH:mm */
86 private String yjtkEnd; 88 private String yjtkEnd;
87 private int upStopMinute; 89 private int upStopMinute;
88 private int downStopMinute; 90 private int downStopMinute;
src/main/java/com/bsth/entity/realcontrol/OilStationSociety.java
@@ -21,6 +21,11 @@ public class OilStationSociety { @@ -21,6 +21,11 @@ public class OilStationSociety {
21 private String stationName; 21 private String stationName;
22 22
23 /** 23 /**
  24 + * 加油站编码(为空则默认社会加油站)
  25 + */
  26 + private String stationCode;
  27 +
  28 + /**
24 * 上行进场距离 29 * 上行进场距离
25 */ 30 */
26 private Double upInMile; 31 private Double upInMile;
@@ -137,4 +142,12 @@ public class OilStationSociety { @@ -137,4 +142,12 @@ public class OilStationSociety {
137 public void setDownOutTime(int downOutTime) { 142 public void setDownOutTime(int downOutTime) {
138 this.downOutTime = downOutTime; 143 this.downOutTime = downOutTime;
139 } 144 }
  145 +
  146 + public String getStationCode() {
  147 + return stationCode;
  148 + }
  149 +
  150 + public void setStationCode(String stationCode) {
  151 + this.stationCode = stationCode;
  152 + }
140 } 153 }
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -139,10 +139,17 @@ public class ScheduleRealInfo { @@ -139,10 +139,17 @@ public class ScheduleRealInfo {
139 /** 是否是临加班次 */ 139 /** 是否是临加班次 */
140 private boolean sflj; 140 private boolean sflj;
141 141
142 - /** 是否误点*/ 142 + /** 是否误点 (应发未发)*/
143 @Transient 143 @Transient
144 private boolean late; 144 private boolean late;
145 145
  146 + /** 是否误点 (应发未到) */
  147 + @Transient
  148 + private boolean late2;
  149 + /** 误点停靠时间 */
  150 + @Transient
  151 + private float lateMinute;
  152 +
146 /** 备注*/ 153 /** 备注*/
147 private String remarks; 154 private String remarks;
148 155
@@ -772,6 +779,8 @@ public class ScheduleRealInfo { @@ -772,6 +779,8 @@ public class ScheduleRealInfo {
772 779
773 public void destroy(){ 780 public void destroy(){
774 this.jhlc = 0.0; 781 this.jhlc = 0.0;
  782 + if(this.isSflj())
  783 + this.jhlcOrig = 0.0;
775 this.status = -1; 784 this.status = -1;
776 this.clearFcsjActual(); 785 this.clearFcsjActual();
777 } 786 }
@@ -887,4 +896,20 @@ public class ScheduleRealInfo { @@ -887,4 +896,20 @@ public class ScheduleRealInfo {
887 public void setRemark(String remark) { 896 public void setRemark(String remark) {
888 this.remark = remark; 897 this.remark = remark;
889 } 898 }
  899 +
  900 + public float getLateMinute() {
  901 + return lateMinute;
  902 + }
  903 +
  904 + public void setLateMinute(float lateMinute) {
  905 + this.lateMinute = lateMinute;
  906 + }
  907 +
  908 + public boolean isLate2() {
  909 + return late2;
  910 + }
  911 +
  912 + public void setLate2(boolean late2) {
  913 + this.late2 = late2;
  914 + }
890 } 915 }
src/main/java/com/bsth/entity/schedule/SchedulePlan.java
@@ -2,8 +2,11 @@ package com.bsth.entity.schedule; @@ -2,8 +2,11 @@ package com.bsth.entity.schedule;
2 2
3 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
4 import com.fasterxml.jackson.annotation.JsonIgnore; 4 import com.fasterxml.jackson.annotation.JsonIgnore;
  5 +import org.apache.commons.lang3.BooleanUtils;
5 6
6 import javax.persistence.*; 7 import javax.persistence.*;
  8 +import java.sql.PreparedStatement;
  9 +import java.sql.SQLException;
7 import java.util.ArrayList; 10 import java.util.ArrayList;
8 import java.util.Date; 11 import java.util.Date;
9 import java.util.List; 12 import java.util.List;
@@ -53,6 +56,30 @@ public class SchedulePlan extends BEntity { @@ -53,6 +56,30 @@ public class SchedulePlan extends BEntity {
53 @OneToMany(mappedBy = "schedulePlan", cascade = CascadeType.ALL, fetch = FetchType.LAZY) 56 @OneToMany(mappedBy = "schedulePlan", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
54 private List<SchedulePlanInfo> schedulePlanInfoList = new ArrayList<>(); 57 private List<SchedulePlanInfo> schedulePlanInfoList = new ArrayList<>();
55 58
  59 +
  60 + public static String generateInsertSql() {
  61 + String sql = "insert into bsth_c_s_sp " +
  62 + " (xl, schedule_from_time, schedule_to_time, " +
  63 + "tt_info_names, tt_info_ids, is_history_plan_first, plan_result, " +
  64 + "create_by, update_by, create_date, update_date) " +
  65 + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
  66 + return sql;
  67 + }
  68 +
  69 + public void preparedStatementSet(PreparedStatement ps) throws SQLException {
  70 + ps.setInt(1, this.xl.getId());
  71 + ps.setDate(2, new java.sql.Date(this.scheduleFromTime.getTime()));
  72 + ps.setDate(3, new java.sql.Date(this.scheduleToTime.getTime()));
  73 + ps.setString(4, this.ttInfoNames);
  74 + ps.setString(5, this.ttInfoIds);
  75 + ps.setInt(6, BooleanUtils.isTrue(this.isHistoryPlanFirst) ? 1 : 0);
  76 + ps.setString(7, this.planResult);
  77 + ps.setInt(8, this.getCreateBy().getId());
  78 + ps.setInt(9, this.getUpdateBy().getId());
  79 + ps.setTimestamp(10, new java.sql.Timestamp(this.getCreateDate().getTime()));
  80 + ps.setTimestamp(11, new java.sql.Timestamp(this.getUpdateDate().getTime()));
  81 + }
  82 +
56 public Long getId() { 83 public Long getId() {
57 return id; 84 return id;
58 } 85 }
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
@@ -6,6 +6,9 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; @@ -6,6 +6,9 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
6 import org.apache.commons.lang3.StringUtils; 6 import org.apache.commons.lang3.StringUtils;
7 7
8 import javax.persistence.*; 8 import javax.persistence.*;
  9 +import java.sql.PreparedStatement;
  10 +import java.sql.SQLException;
  11 +import java.sql.Types;
9 import java.util.Date; 12 import java.util.Date;
10 import java.util.List; 13 import java.util.List;
11 14
@@ -88,16 +91,18 @@ public class SchedulePlanInfo { @@ -88,16 +91,18 @@ public class SchedulePlanInfo {
88 @Column(nullable = false) 91 @Column(nullable = false)
89 private String xlDir; 92 private String xlDir;
90 /** 起点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */ 93 /** 起点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */
91 - @Column(nullable = false)  
92 - private Integer qdz; 94 + // 这个字段以后不用了
  95 +// @Column(nullable = false)
  96 +// private Integer qdz;
93 /** 起点站code */ 97 /** 起点站code */
94 private String qdzCode; 98 private String qdzCode;
95 /** 起点站名字 */ 99 /** 起点站名字 */
96 @Column(nullable = false) 100 @Column(nullable = false)
97 private String qdzName; 101 private String qdzName;
98 /** 终点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */ 102 /** 终点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */
99 - @Column(nullable = false)  
100 - private Integer zdz; 103 + // 这个字段以后不用了
  104 +// @Column(nullable = false)
  105 +// private Integer zdz;
101 /** 终点站code */ 106 /** 终点站code */
102 private String zdzCode; 107 private String zdzCode;
103 /** 终点站名字 */ 108 /** 终点站名字 */
@@ -146,12 +151,15 @@ public class SchedulePlanInfo { @@ -146,12 +151,15 @@ public class SchedulePlanInfo {
146 private Date updateDate; 151 private Date updateDate;
147 152
148 153
  154 +// @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  155 +// @JoinTable(
  156 +// name = "bsth_c_s_sp_r_info",
  157 +// joinColumns = @JoinColumn(name = "sp_info_id"),
  158 +// inverseJoinColumns = @JoinColumn(name = "sp_id")
  159 +// )
  160 +// private SchedulePlan schedulePlan;
  161 +
149 @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) 162 @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
150 - @JoinTable(  
151 - name = "bsth_c_s_sp_r_info",  
152 - joinColumns = @JoinColumn(name = "sp_info_id"),  
153 - inverseJoinColumns = @JoinColumn(name = "sp_id")  
154 - )  
155 private SchedulePlan schedulePlan; 163 private SchedulePlan schedulePlan;
156 164
157 public SchedulePlanInfo() {} 165 public SchedulePlanInfo() {}
@@ -238,28 +246,10 @@ public class SchedulePlanInfo { @@ -238,28 +246,10 @@ public class SchedulePlanInfo {
238 // 时刻明细数据 246 // 时刻明细数据
239 this.xlDir = ttInfoDetail.getXlDir(); // 线路上下行 247 this.xlDir = ttInfoDetail.getXlDir(); // 线路上下行
240 this.bcType = ttInfoDetail.getBcType(); // 班次类型 248 this.bcType = ttInfoDetail.getBcType(); // 班次类型
241 - if ("out".equals(this.bcType)) { // 出场班次  
242 - this.qdz = ttInfoDetail.getTcc().getId(); // 起点站-停车场id  
243 - this.qdzCode = ttInfoDetail.getTcc().getParkCode(); // 起点站-停车场code  
244 - this.qdzName = ttInfoDetail.getTcc().getParkName(); // 起点站-停车场name  
245 - this.zdz = ttInfoDetail.getZdz().getId(); // 终点站id  
246 - this.zdzCode = ttInfoDetail.getZdz().getStationCod(); // 终点站code  
247 - this.zdzName = ttInfoDetail.getZdz().getStationName(); // 终点站name  
248 - } else if ("in".equals(this.bcType)) { // 进场班次  
249 - this.qdz = ttInfoDetail.getQdz().getId(); // 起点站id  
250 - this.qdzCode = ttInfoDetail.getQdz().getStationCod(); // 起点站code  
251 - this.qdzName = ttInfoDetail.getQdz().getStationName(); // 起点站name  
252 - this.zdz = ttInfoDetail.getTcc().getId(); // 终点站-停车场id  
253 - this.zdzCode = ttInfoDetail.getTcc().getParkCode(); // 终点站-停车场code  
254 - this.zdzName = ttInfoDetail.getTcc().getParkName(); // 终点站-停车场name  
255 - } else { // 其他班次  
256 - this.qdz = ttInfoDetail.getQdz().getId(); // 起点站id  
257 - this.qdzCode = ttInfoDetail.getQdz().getStationCod(); // 起点站code  
258 - this.qdzName = ttInfoDetail.getQdz().getStationName(); // 起点站name  
259 - this.zdz = ttInfoDetail.getZdz().getId(); // 终点站id  
260 - this.zdzCode = ttInfoDetail.getZdz().getStationCod(); // 终点站code  
261 - this.zdzName = ttInfoDetail.getZdz().getStationName(); // 终点站name  
262 - } 249 + this.qdzCode = ttInfoDetail.getQdzCode(); // 起点站code
  250 + this.qdzName = ttInfoDetail.getQdzName(); // 起点站name
  251 + this.zdzCode = ttInfoDetail.getZdzCode(); // 终点站code
  252 + this.zdzName = ttInfoDetail.getZdzName(); // 终点站name
263 253
264 this.fcsj = ttInfoDetail.getFcsj(); // 发车时间 254 this.fcsj = ttInfoDetail.getFcsj(); // 发车时间
265 this.fcno = ttInfoDetail.getFcno(); // 发车顺序号 255 this.fcno = ttInfoDetail.getFcno(); // 发车顺序号
@@ -280,7 +270,7 @@ public class SchedulePlanInfo { @@ -280,7 +270,7 @@ public class SchedulePlanInfo {
280 if (pzType != null && !pzType.equals("BSY")) { 270 if (pzType != null && !pzType.equals("BSY")) {
281 if ("ZW".equals(pzType)) { // 只看早晚进出场 271 if ("ZW".equals(pzType)) { // 只看早晚进出场
282 if (isFirstBc) { // 第一个班次是出场 272 if (isFirstBc) { // 第一个班次是出场
283 - this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id 273 +// this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id
284 this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code 274 this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code
285 this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name 275 this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name
286 276
@@ -288,7 +278,7 @@ public class SchedulePlanInfo { @@ -288,7 +278,7 @@ public class SchedulePlanInfo {
288 this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); 278 this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue();
289 279
290 } else if (isLastBc) { // 最后一个班次是进场 280 } else if (isLastBc) { // 最后一个班次是进场
291 - this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id 281 +// this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id
292 this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code 282 this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code
293 this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name 283 this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name
294 284
@@ -298,7 +288,7 @@ public class SchedulePlanInfo { @@ -298,7 +288,7 @@ public class SchedulePlanInfo {
298 288
299 } else if ("FS".equals(pzType)) { // 所有进出场 289 } else if ("FS".equals(pzType)) { // 所有进出场
300 if ("out".equals(this.bcType)) { // 出场班次 290 if ("out".equals(this.bcType)) { // 出场班次
301 - this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id 291 +// this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id
302 this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code 292 this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code
303 this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name 293 this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name
304 294
@@ -306,7 +296,7 @@ public class SchedulePlanInfo { @@ -306,7 +296,7 @@ public class SchedulePlanInfo {
306 this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); 296 this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue();
307 297
308 } else if ("in".equals(this.bcType)) { 298 } else if ("in".equals(this.bcType)) {
309 - this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id 299 +// this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id
310 this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code 300 this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code
311 this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name 301 this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name
312 302
@@ -318,13 +308,61 @@ public class SchedulePlanInfo { @@ -318,13 +308,61 @@ public class SchedulePlanInfo {
318 308
319 } 309 }
320 310
321 -  
322 - public Integer getS() {  
323 - return s;  
324 - }  
325 -  
326 - public void setS(Integer s) {  
327 - this.s = s; 311 + public static String generateInsertSql() {
  312 + String sql = "insert into bsth_c_s_sp_info " +
  313 + " (schedule_date, gs_name, gs_bm, fgs_name, fgs_bm, ccno, " +
  314 + "xl, xl_name, xl_bm, lp, lp_name, cl, cl_zbh, bd_time, cc_time, " +
  315 + "j, j_gh, j_name, s, s_gh, s_name, " +
  316 + "xl_dir, qdz_code, qdz_name, zdz_code, zdz_name, " +
  317 + "fcsj, fcno, bcs, jhlc, bcsj, bc_type, " +
  318 + "tt_info, tt_info_name, remark, schedule_plan, " +
  319 + "create_by, update_by, create_date, update_date) " +
  320 + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
  321 + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  322 + return sql;
  323 + }
  324 +
  325 + public void preparedStatementSet(PreparedStatement ps) throws SQLException {
  326 + if (this.scheduleDate != null) ps.setDate(1, new java.sql.Date(this.scheduleDate.getTime())); else ps.setNull(1, Types.DATE);
  327 + if (this.gsName != null) ps.setString(2, this.gsName); else ps.setNull(2, Types.VARCHAR);
  328 + if (this.gsBm != null) ps.setString(3, this.gsBm); else ps.setNull(3, Types.VARCHAR);
  329 + if (this.fgsName != null) ps.setString(4, this.fgsName); else ps.setNull(4, Types.VARCHAR);
  330 + if (this.fgsBm != null) ps.setString(5, this.fgsBm); else ps.setNull(5, Types.VARCHAR);
  331 + if (this.ccno != null) ps.setInt(6, this.ccno); else ps.setNull(6, Types.INTEGER);
  332 + if (this.xl != null) ps.setInt(7, this.xl); else ps.setNull(7, Types.INTEGER);
  333 + if (this.xlName != null) ps.setString(8, this.xlName); else ps.setNull(8, Types.VARCHAR);
  334 + if (this.xlBm != null) ps.setString(9, this.xlBm); else ps.setNull(9, Types.VARCHAR);
  335 + if (this.lp != null) ps.setLong(10, this.lp); else ps.setNull(10, Types.BIGINT);
  336 + if (this.lpName != null) ps.setString(11, this.lpName); else ps.setNull(11, Types.VARCHAR);
  337 + if (this.cl != null) ps.setInt(12, this.cl); else ps.setNull(12, Types.INTEGER);
  338 + if (this.clZbh != null) ps.setString(13, this.clZbh); else ps.setNull(13, Types.VARCHAR);
  339 + if (this.bdTime != null) ps.setString(14, this.bdTime); else ps.setNull(14, Types.VARCHAR);
  340 + if (this.ccTime != null) ps.setString(15, this.ccTime); else ps.setNull(15, Types.VARCHAR);
  341 + if (this.j != null) ps.setInt(16, this.j); else ps.setNull(16, Types.INTEGER);
  342 + if (this.jGh != null) ps.setString(17, this.jGh); else ps.setNull(17, Types.VARCHAR);
  343 + if (this.jName != null) ps.setString(18, this.jName); else ps.setNull(18, Types.VARCHAR);
  344 + if (this.s != null) ps.setInt(19, this.s); else ps.setNull(19, Types.INTEGER);
  345 + if (this.sGh != null) ps.setString(20, this.sGh); else ps.setNull(20, Types.VARCHAR);
  346 + if (this.sName != null) ps.setString(21, this.sName); else ps.setNull(21, Types.VARCHAR);
  347 + if (this.xlDir != null) ps.setString(22, this.xlDir); else ps.setNull(22, Types.VARCHAR);
  348 + if (this.qdzCode != null) ps.setString(23, this.qdzCode); else ps.setNull(23, Types.VARCHAR);
  349 + if (this.qdzName != null) ps.setString(24, this.qdzName); else ps.setNull(24, Types.VARCHAR);
  350 + if (this.zdzCode != null) ps.setString(25, this.zdzCode); else ps.setNull(25, Types.VARCHAR);
  351 + if (this.zdzName != null) ps.setString(26, this.zdzName); else ps.setNull(26, Types.VARCHAR);
  352 + if (this.fcsj != null) ps.setString(27, this.fcsj); else ps.setNull(27, Types.VARCHAR);
  353 + if (this.fcno != null) ps.setInt(28, this.fcno); else ps.setNull(28, Types.INTEGER);
  354 + if (this.bcs != null) ps.setInt(29, this.bcs); else ps.setNull(29, Types.INTEGER);
  355 + if (this.jhlc != null) ps.setDouble(30, this.jhlc); else ps.setNull(30, Types.DOUBLE);
  356 + if (this.bcsj != null) ps.setInt(31, this.bcsj); else ps.setNull(31, Types.INTEGER);
  357 + if (this.bcType != null) ps.setString(32, this.bcType); else ps.setNull(32, Types.VARCHAR);
  358 + if (this.ttInfo != null) ps.setLong(33, this.ttInfo); else ps.setNull(33, Types.BIGINT);
  359 + if (this.ttInfoName != null) ps.setString(34, this.ttInfoName); else ps.setNull(34, Types.VARCHAR);
  360 + if (this.remark != null) ps.setString(35, this.remark); else ps.setNull(35, Types.VARCHAR);
  361 + if (this.schedulePlan != null) ps.setLong(36, this.schedulePlan.getId()); else ps.setNull(36, Types.BIGINT);
  362 + if (this.createBy != null) ps.setInt(37, this.createBy.getId()); else ps.setNull(37, Types.INTEGER);
  363 + if (this.updateBy != null) ps.setInt(38, this.updateBy.getId()); else ps.setNull(38, Types.INTEGER);
  364 + if (this.createDate != null) ps.setTimestamp(39, new java.sql.Timestamp(this.createDate.getTime())); else ps.setNull(39, Types.TIMESTAMP);
  365 + if (this.updateDate != null) ps.setTimestamp(40, new java.sql.Timestamp(this.updateDate.getTime())); else ps.setNull(40, Types.TIMESTAMP);
328 } 366 }
329 367
330 public Long getId() { 368 public Long getId() {
@@ -343,6 +381,46 @@ public class SchedulePlanInfo { @@ -343,6 +381,46 @@ public class SchedulePlanInfo {
343 this.scheduleDate = scheduleDate; 381 this.scheduleDate = scheduleDate;
344 } 382 }
345 383
  384 + public String getGsName() {
  385 + return gsName;
  386 + }
  387 +
  388 + public void setGsName(String gsName) {
  389 + this.gsName = gsName;
  390 + }
  391 +
  392 + public String getGsBm() {
  393 + return gsBm;
  394 + }
  395 +
  396 + public void setGsBm(String gsBm) {
  397 + this.gsBm = gsBm;
  398 + }
  399 +
  400 + public String getFgsName() {
  401 + return fgsName;
  402 + }
  403 +
  404 + public void setFgsName(String fgsName) {
  405 + this.fgsName = fgsName;
  406 + }
  407 +
  408 + public String getFgsBm() {
  409 + return fgsBm;
  410 + }
  411 +
  412 + public void setFgsBm(String fgsBm) {
  413 + this.fgsBm = fgsBm;
  414 + }
  415 +
  416 + public Integer getCcno() {
  417 + return ccno;
  418 + }
  419 +
  420 + public void setCcno(Integer ccno) {
  421 + this.ccno = ccno;
  422 + }
  423 +
346 public Integer getXl() { 424 public Integer getXl() {
347 return xl; 425 return xl;
348 } 426 }
@@ -439,6 +517,14 @@ public class SchedulePlanInfo { @@ -439,6 +517,14 @@ public class SchedulePlanInfo {
439 this.jName = jName; 517 this.jName = jName;
440 } 518 }
441 519
  520 + public Integer getS() {
  521 + return s;
  522 + }
  523 +
  524 + public void setS(Integer s) {
  525 + this.s = s;
  526 + }
  527 +
442 public String getsGh() { 528 public String getsGh() {
443 return sGh; 529 return sGh;
444 } 530 }
@@ -463,12 +549,12 @@ public class SchedulePlanInfo { @@ -463,12 +549,12 @@ public class SchedulePlanInfo {
463 this.xlDir = xlDir; 549 this.xlDir = xlDir;
464 } 550 }
465 551
466 - public Integer getQdz() {  
467 - return qdz; 552 + public String getQdzCode() {
  553 + return qdzCode;
468 } 554 }
469 555
470 - public void setQdz(Integer qdz) {  
471 - this.qdz = qdz; 556 + public void setQdzCode(String qdzCode) {
  557 + this.qdzCode = qdzCode;
472 } 558 }
473 559
474 public String getQdzName() { 560 public String getQdzName() {
@@ -479,12 +565,12 @@ public class SchedulePlanInfo { @@ -479,12 +565,12 @@ public class SchedulePlanInfo {
479 this.qdzName = qdzName; 565 this.qdzName = qdzName;
480 } 566 }
481 567
482 - public Integer getZdz() {  
483 - return zdz; 568 + public String getZdzCode() {
  569 + return zdzCode;
484 } 570 }
485 571
486 - public void setZdz(Integer zdz) {  
487 - this.zdz = zdz; 572 + public void setZdzCode(String zdzCode) {
  573 + this.zdzCode = zdzCode;
488 } 574 }
489 575
490 public String getZdzName() { 576 public String getZdzName() {
@@ -543,6 +629,30 @@ public class SchedulePlanInfo { @@ -543,6 +629,30 @@ public class SchedulePlanInfo {
543 this.bcType = bcType; 629 this.bcType = bcType;
544 } 630 }
545 631
  632 + public Long getTtInfo() {
  633 + return ttInfo;
  634 + }
  635 +
  636 + public void setTtInfo(Long ttInfo) {
  637 + this.ttInfo = ttInfo;
  638 + }
  639 +
  640 + public String getTtInfoName() {
  641 + return ttInfoName;
  642 + }
  643 +
  644 + public void setTtInfoName(String ttInfoName) {
  645 + this.ttInfoName = ttInfoName;
  646 + }
  647 +
  648 + public String getRemark() {
  649 + return remark;
  650 + }
  651 +
  652 + public void setRemark(String remark) {
  653 + this.remark = remark;
  654 + }
  655 +
546 public SysUser getCreateBy() { 656 public SysUser getCreateBy() {
547 return createBy; 657 return createBy;
548 } 658 }
@@ -575,62 +685,6 @@ public class SchedulePlanInfo { @@ -575,62 +685,6 @@ public class SchedulePlanInfo {
575 this.updateDate = updateDate; 685 this.updateDate = updateDate;
576 } 686 }
577 687
578 - public String getQdzCode() {  
579 - return qdzCode;  
580 - }  
581 -  
582 - public void setQdzCode(String qdzCode) {  
583 - this.qdzCode = qdzCode;  
584 - }  
585 -  
586 - public String getZdzCode() {  
587 - return zdzCode;  
588 - }  
589 -  
590 - public void setZdzCode(String zdzCode) {  
591 - this.zdzCode = zdzCode;  
592 - }  
593 -  
594 - public String getGsName() {  
595 - return gsName;  
596 - }  
597 -  
598 - public void setGsName(String gsName) {  
599 - this.gsName = gsName;  
600 - }  
601 -  
602 - public String getGsBm() {  
603 - return gsBm;  
604 - }  
605 -  
606 - public void setGsBm(String gsBm) {  
607 - this.gsBm = gsBm;  
608 - }  
609 -  
610 - public String getFgsName() {  
611 - return fgsName;  
612 - }  
613 -  
614 - public void setFgsName(String fgsName) {  
615 - this.fgsName = fgsName;  
616 - }  
617 -  
618 - public String getFgsBm() {  
619 - return fgsBm;  
620 - }  
621 -  
622 - public void setFgsBm(String fgsBm) {  
623 - this.fgsBm = fgsBm;  
624 - }  
625 -  
626 - public Integer getCcno() {  
627 - return ccno;  
628 - }  
629 -  
630 - public void setCcno(Integer ccno) {  
631 - this.ccno = ccno;  
632 - }  
633 -  
634 public SchedulePlan getSchedulePlan() { 688 public SchedulePlan getSchedulePlan() {
635 return schedulePlan; 689 return schedulePlan;
636 } 690 }
@@ -638,28 +692,4 @@ public class SchedulePlanInfo { @@ -638,28 +692,4 @@ public class SchedulePlanInfo {
638 public void setSchedulePlan(SchedulePlan schedulePlan) { 692 public void setSchedulePlan(SchedulePlan schedulePlan) {
639 this.schedulePlan = schedulePlan; 693 this.schedulePlan = schedulePlan;
640 } 694 }
641 -  
642 - public Long getTtInfo() {  
643 - return ttInfo;  
644 - }  
645 -  
646 - public void setTtInfo(Long ttInfo) {  
647 - this.ttInfo = ttInfo;  
648 - }  
649 -  
650 - public String getTtInfoName() {  
651 - return ttInfoName;  
652 - }  
653 -  
654 - public void setTtInfoName(String ttInfoName) {  
655 - this.ttInfoName = ttInfoName;  
656 - }  
657 -  
658 - public String getRemark() {  
659 - return remark;  
660 - }  
661 -  
662 - public void setRemark(String remark) {  
663 - this.remark = remark;  
664 - }  
665 } 695 }
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
@@ -47,16 +47,28 @@ public class TTInfoDetail extends BEntity { @@ -47,16 +47,28 @@ public class TTInfoDetail extends BEntity {
47 /** 线路方向(TODO:上下行,上行,下行,这个以后用枚举还是字典再议,现在先用文字) */ 47 /** 线路方向(TODO:上下行,上行,下行,这个以后用枚举还是字典再议,现在先用文字) */
48 @Column(nullable = false) 48 @Column(nullable = false)
49 private String xlDir; 49 private String xlDir;
50 - /** 起点站关联 */ 50 +
  51 + /** 起点站关联(以后不用了,暂时留着) */
51 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) 52 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
52 private Station qdz; 53 private Station qdz;
53 - /** 终点站关联 */ 54 + /** 终点站关联(以后不用了,暂时留着) */
54 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) 55 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
55 private Station zdz; 56 private Station zdz;
56 - /** 停车场关联(出场,进场班次会关联停车场) */ 57 + /** 停车场关联(出场,进场班次会关联停车场)(以后不用了,暂时留着) */
57 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) 58 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
58 private CarPark tcc; 59 private CarPark tcc;
59 60
  61 + // 站点包括普通站点和停车场(站点编码不同,使用站点编码区分)
  62 + // 以后不需要再区分是站点还是停车场了
  63 + /** 起站点代码(bsth_c_station,bsth_c_car_park 里的编码) */
  64 + private String qdzCode;
  65 + /** 起站点名字(bsth_c_stationroute,bsth_c_car_park里的名字) */
  66 + private String qdzName;
  67 + /** 终点站代码(bsth_c_station,bsth_c_car_park 里的编码) */
  68 + private String zdzCode;
  69 + /** 终点站名字(bsth_c_stationroute,bsth_c_car_park里的名字) */
  70 + private String zdzName;
  71 +
60 /** 发车时间(格式 HH:mm) */ 72 /** 发车时间(格式 HH:mm) */
61 @Column(nullable = false, length = 5) 73 @Column(nullable = false, length = 5)
62 private String fcsj; 74 private String fcsj;
@@ -236,4 +248,36 @@ public class TTInfoDetail extends BEntity { @@ -236,4 +248,36 @@ public class TTInfoDetail extends BEntity {
236 public void setIsFB(Boolean isFB) { 248 public void setIsFB(Boolean isFB) {
237 this.isFB = isFB; 249 this.isFB = isFB;
238 } 250 }
  251 +
  252 + public String getQdzCode() {
  253 + return qdzCode;
  254 + }
  255 +
  256 + public void setQdzCode(String qdzCode) {
  257 + this.qdzCode = qdzCode;
  258 + }
  259 +
  260 + public String getQdzName() {
  261 + return qdzName;
  262 + }
  263 +
  264 + public void setQdzName(String qdzName) {
  265 + this.qdzName = qdzName;
  266 + }
  267 +
  268 + public String getZdzCode() {
  269 + return zdzCode;
  270 + }
  271 +
  272 + public void setZdzCode(String zdzCode) {
  273 + this.zdzCode = zdzCode;
  274 + }
  275 +
  276 + public String getZdzName() {
  277 + return zdzName;
  278 + }
  279 +
  280 + public void setZdzName(String zdzName) {
  281 + this.zdzName = zdzName;
  282 + }
239 } 283 }
src/main/java/com/bsth/entity/schedule/rule/RerunRule.java
@@ -53,6 +53,8 @@ public class RerunRule extends BEntity { @@ -53,6 +53,8 @@ public class RerunRule extends BEntity {
53 private GuideboardInfo rerunLp; 53 private GuideboardInfo rerunLp;
54 /** 套跑班次(时刻表明细ids,使用逗号连接) */ 54 /** 套跑班次(时刻表明细ids,使用逗号连接) */
55 private String rerunTtinfodetailIds; 55 private String rerunTtinfodetailIds;
  56 + /** 套跑班次(对应具体班次的发车时间,使用逗号连接,重复的时间会去除) */
  57 + private String rerunTtinfodetailFcsjs;
56 58
57 59
58 /** 套跑类型(dylp;对应路牌,dybc:对应班车) */ 60 /** 套跑类型(dylp;对应路牌,dybc:对应班车) */
@@ -167,4 +169,11 @@ public class RerunRule extends BEntity { @@ -167,4 +169,11 @@ public class RerunRule extends BEntity {
167 this.isCancel = isCancel; 169 this.isCancel = isCancel;
168 } 170 }
169 171
  172 + public String getRerunTtinfodetailFcsjs() {
  173 + return rerunTtinfodetailFcsjs;
  174 + }
  175 +
  176 + public void setRerunTtinfodetailFcsjs(String rerunTtinfodetailFcsjs) {
  177 + this.rerunTtinfodetailFcsjs = rerunTtinfodetailFcsjs;
  178 + }
170 } 179 }
src/main/java/com/bsth/entity/schedule/temp/SchedulePlanRuleResult.java
@@ -10,6 +10,7 @@ import java.util.Date; @@ -10,6 +10,7 @@ import java.util.Date;
10 */ 10 */
11 @Entity 11 @Entity
12 @Table(name = "bsth_c_s_sp_rule_rst") 12 @Table(name = "bsth_c_s_sp_rule_rst")
  13 +// TODO:此表以后考虑表分区
13 public class SchedulePlanRuleResult { 14 public class SchedulePlanRuleResult {
14 /** 主键Id */ 15 /** 主键Id */
15 @Id 16 @Id
@@ -17,7 +18,8 @@ public class SchedulePlanRuleResult { @@ -17,7 +18,8 @@ public class SchedulePlanRuleResult {
17 private Long id; 18 private Long id;
18 19
19 /** 线路id */ 20 /** 线路id */
20 - private String xlId; 21 + // 这里要建一个索引 tt1 normal btree
  22 + private Integer xlId;
21 /** 线路名字 */ 23 /** 线路名字 */
22 private String xlName; 24 private String xlName;
23 25
@@ -49,6 +51,7 @@ public class SchedulePlanRuleResult { @@ -49,6 +51,7 @@ public class SchedulePlanRuleResult {
49 private String ttinfoName; 51 private String ttinfoName;
50 52
51 /** 排班日期 */ 53 /** 排班日期 */
  54 + // 这里要建一个索引 tt2 normal btree
52 private Date scheduleDate; 55 private Date scheduleDate;
53 56
54 /** 操作人员id */ 57 /** 操作人员id */
@@ -56,6 +59,7 @@ public class SchedulePlanRuleResult { @@ -56,6 +59,7 @@ public class SchedulePlanRuleResult {
56 /** 操作人员姓名 */ 59 /** 操作人员姓名 */
57 private String sysuserName; 60 private String sysuserName;
58 /** 操作时间 */ 61 /** 操作时间 */
  62 + // 这里要建一个索引 tt3 normal btree
59 private Date createDate; 63 private Date createDate;
60 64
61 public SchedulePlanRuleResult() { 65 public SchedulePlanRuleResult() {
@@ -76,6 +80,22 @@ public class SchedulePlanRuleResult { @@ -76,6 +80,22 @@ public class SchedulePlanRuleResult {
76 this.id = id; 80 this.id = id;
77 } 81 }
78 82
  83 + public Integer getXlId() {
  84 + return xlId;
  85 + }
  86 +
  87 + public void setXlId(Integer xlId) {
  88 + this.xlId = xlId;
  89 + }
  90 +
  91 + public String getXlName() {
  92 + return xlName;
  93 + }
  94 +
  95 + public void setXlName(String xlName) {
  96 + this.xlName = xlName;
  97 + }
  98 +
79 public String getRuleId() { 99 public String getRuleId() {
80 return ruleId; 100 return ruleId;
81 } 101 }
@@ -148,6 +168,22 @@ public class SchedulePlanRuleResult { @@ -148,6 +168,22 @@ public class SchedulePlanRuleResult {
148 this.ecindex = ecindex; 168 this.ecindex = ecindex;
149 } 169 }
150 170
  171 + public String getTtinfoId() {
  172 + return ttinfoId;
  173 + }
  174 +
  175 + public void setTtinfoId(String ttinfoId) {
  176 + this.ttinfoId = ttinfoId;
  177 + }
  178 +
  179 + public String getTtinfoName() {
  180 + return ttinfoName;
  181 + }
  182 +
  183 + public void setTtinfoName(String ttinfoName) {
  184 + this.ttinfoName = ttinfoName;
  185 + }
  186 +
151 public Date getScheduleDate() { 187 public Date getScheduleDate() {
152 return scheduleDate; 188 return scheduleDate;
153 } 189 }
@@ -179,36 +215,4 @@ public class SchedulePlanRuleResult { @@ -179,36 +215,4 @@ public class SchedulePlanRuleResult {
179 public void setCreateDate(Date createDate) { 215 public void setCreateDate(Date createDate) {
180 this.createDate = createDate; 216 this.createDate = createDate;
181 } 217 }
182 -  
183 - public String getXlId() {  
184 - return xlId;  
185 - }  
186 -  
187 - public void setXlId(String xlId) {  
188 - this.xlId = xlId;  
189 - }  
190 -  
191 - public String getXlName() {  
192 - return xlName;  
193 - }  
194 -  
195 - public void setXlName(String xlName) {  
196 - this.xlName = xlName;  
197 - }  
198 -  
199 - public String getTtinfoId() {  
200 - return ttinfoId;  
201 - }  
202 -  
203 - public void setTtinfoId(String ttinfoId) {  
204 - this.ttinfoId = ttinfoId;  
205 - }  
206 -  
207 - public String getTtinfoName() {  
208 - return ttinfoName;  
209 - }  
210 -  
211 - public void setTtinfoName(String ttinfoName) {  
212 - this.ttinfoName = ttinfoName;  
213 - }  
214 } 218 }
src/main/java/com/bsth/repository/BusinessRepository.java
1 package com.bsth.repository; 1 package com.bsth.repository;
2 2
  3 +import org.springframework.data.jpa.repository.Query;
3 import org.springframework.stereotype.Repository; 4 import org.springframework.stereotype.Repository;
4 5
5 import com.bsth.entity.Business; 6 import com.bsth.entity.Business;
@@ -28,5 +29,7 @@ public interface BusinessRepository extends BaseRepository&lt;Business, Integer&gt; { @@ -28,5 +29,7 @@ public interface BusinessRepository extends BaseRepository&lt;Business, Integer&gt; {
28 List<Business> findByBusinessCode(String code); 29 List<Business> findByBusinessCode(String code);
29 30
30 List<Business> findByUpCodeAndBusinessCode(String c1, String c2); 31 List<Business> findByUpCodeAndBusinessCode(String c1, String c2);
31 - 32 +
  33 + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_business) k" , nativeQuery=true)
  34 + long getMaxId();
32 } 35 }
src/main/java/com/bsth/repository/SectionRepository.java
@@ -72,7 +72,6 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; { @@ -72,7 +72,6 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
72 72
73 String descriptions, int versions,int id); 73 String descriptions, int versions,int id);
74 74
75 -  
76 /** 75 /**
77 * @Description :TODO(编辑线路走向) 76 * @Description :TODO(编辑线路走向)
78 * 77 *
src/main/java/com/bsth/repository/SectionRouteRepository.java
@@ -121,7 +121,7 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -121,7 +121,7 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
121 "b.create_date AS sectionCreateDate," + 121 "b.create_date AS sectionCreateDate," +
122 "b.update_by AS sectionUpdateBy," + 122 "b.update_by AS sectionUpdateBy," +
123 "b.update_date AS sectionUpdateDate," + 123 "b.update_date AS sectionUpdateDate," +
124 - "b.versions AS sectionVersion FROM (" + 124 + "b.versions AS sectionVersion , a.isRoadeSpeed FROM (" +
125 " SELECT s.id AS sectionRouteId," + 125 " SELECT s.id AS sectionRouteId," +
126 "s.line_code AS sectionRouteLineCode," + 126 "s.line_code AS sectionRouteLineCode," +
127 "s.sectionroute_code AS sectionRouteCode," + 127 "s.sectionroute_code AS sectionRouteCode," +
@@ -134,7 +134,7 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -134,7 +134,7 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
134 "s.update_by AS sectionRouteUpdateBy," + 134 "s.update_by AS sectionRouteUpdateBy," +
135 "s.update_date AS sectionRouteUpdateDate," + 135 "s.update_date AS sectionRouteUpdateDate," +
136 "s.versions AS sectionRouteVersions," + 136 "s.versions AS sectionRouteVersions," +
137 - "s.destroy AS sectionRouteDestroy" + 137 + "s.destroy AS sectionRouteDestroy, s.is_roade_speed AS isRoadeSpeed " +
138 " FROM bsth_c_sectionroute s where s.id =?1) a " + 138 " FROM bsth_c_sectionroute s where s.id =?1) a " +
139 " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true) 139 " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true)
140 List<Object[]> findSectionRouteInfoFormId(int id); 140 List<Object[]> findSectionRouteInfoFormId(int id);
@@ -171,6 +171,10 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -171,6 +171,10 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
171 @Query(value="UPDATE bsth_c_sectionroute set is_roade_speed = ?1 where line= ?2 and directions=?3 ",nativeQuery = true) 171 @Query(value="UPDATE bsth_c_sectionroute set is_roade_speed = ?1 where line= ?2 and directions=?3 ",nativeQuery = true)
172 void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); 172 void isRoadSpeedUpd(Integer isR,Integer line,Integer directions);
173 173
  174 + @Modifying
  175 + @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+10) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true)
  176 + public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod);
  177 +
174 @Modifying 178 @Modifying
175 @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) 179 @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true)
176 public void sectionRouteDir(Integer line); 180 public void sectionRouteDir(Integer line);
src/main/java/com/bsth/repository/StationRepository.java
@@ -37,7 +37,7 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; { @@ -37,7 +37,7 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
37 , nativeQuery=true) 37 , nativeQuery=true)
38 long stationMaxId(); 38 long stationMaxId();
39 39
40 - @Query(value = "SELECT * FROM bsth_c_station s where s.station_name = ?1" 40 + @Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?1"
41 , nativeQuery=true) 41 , nativeQuery=true)
42 List<Object[]> findStationName(String stationName); 42 List<Object[]> findStationName(String stationName);
43 43
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -22,7 +22,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -22,7 +22,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
22 List<ScheduleRealInfo> findByLines(List<String> lines); 22 List<ScheduleRealInfo> findByLines(List<String> lines);
23 23
24 24
25 - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and bc_type not in ('in','out') order by (lpName+1),clZbh,realExecDate,fcsj") 25 + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and bc_type not in ('in','out') order by (lpName+1),clZbh,realExecDate,dfsj")
26 List<ScheduleRealInfo> scheduleDailyQp(String line,String date); 26 List<ScheduleRealInfo> scheduleDailyQp(String line,String date);
27 27
28 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)") 28 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)")
@@ -87,11 +87,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -87,11 +87,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
87 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code); 87 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
88 88
89 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 89 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
90 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj") 90 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,dfsj")
91 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); 91 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
92 92
93 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 93 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
94 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj") 94 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,dfsj")
95 List<ScheduleRealInfo> queryListWaybillXcld(String jGh,String clZbh,String lpName,String date,String line); 95 List<ScheduleRealInfo> queryListWaybillXcld(String jGh,String clZbh,String lpName,String date,String line);
96 96
97 // @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 97 // @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
@@ -104,11 +104,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -104,11 +104,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
104 104
105 105
106 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 106 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
107 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsj") 107 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,dfsj")
108 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line); 108 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);
109 109
110 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 110 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
111 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') and s.gsBm like %?4% and s.fgsBm like %?5% order by realExecDate,fcsj") 111 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') and s.gsBm like %?4% and s.fgsBm like %?5% order by realExecDate,dfsj")
112 List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm); 112 List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm);
113 113
114 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 114 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
@@ -133,11 +133,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -133,11 +133,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
133 133
134 //去掉了 xlBm is not null 134 //去掉了 xlBm is not null
135 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 135 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
136 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.realExecDate,s.fcsj, (s.lpName+1)") 136 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.realExecDate,s.dfsj, (s.lpName+1)")
137 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); 137 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
138 138
139 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 139 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
140 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.fcsj") 140 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.dfsj")
141 List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); 141 List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);
142 142
143 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 143 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
@@ -151,18 +151,19 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -151,18 +151,19 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
151 151
152 //按照时间段统计 152 //按照时间段统计
153 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 153 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
154 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and s.bcType not in ('in','out') and gsBm like %?4% and fgsBm like %?5% order by s.xlBm") 154 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and gsBm like %?4% and fgsBm like %?5% order by s.xlBm")
155 List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm); 155 List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm);
156 156
157 //按照时间段统计 157 //按照时间段统计
158 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 158 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
159 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and s.bcType not in ('in','out') order by s.xlBm") 159 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 order by s.xlBm")
160 List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2); 160 List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2);
161 //月报表 161 //月报表
162 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 162 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
163 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 order by s.xlBm") 163 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 order by s.xlBm")
164 List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2); 164 List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2);
165 165
  166 +
166 @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY clZbh,fcsj") 167 @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY clZbh,fcsj")
167 List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm); 168 List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm);
168 169
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
@@ -24,8 +24,6 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI @@ -24,8 +24,6 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
24 @Query(value = "select s from SchedulePlanInfo s where scheduleDate=?1") 24 @Query(value = "select s from SchedulePlanInfo s where scheduleDate=?1")
25 List<SchedulePlanInfo> findByDate(Date date); 25 List<SchedulePlanInfo> findByDate(Date date);
26 26
27 - Long deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(Integer xlid, Date startDate, Date endDate);  
28 -  
29 @Query(value = " select " + 27 @Query(value = " select " +
30 "info.xl as xlId, " + 28 "info.xl as xlId, " +
31 "info.xl_name as xlName, " + 29 "info.xl_name as xlName, " +
src/main/java/com/bsth/repository/schedule/SchedulePlanRuleResultRepository.java
@@ -2,24 +2,18 @@ package com.bsth.repository.schedule; @@ -2,24 +2,18 @@ package com.bsth.repository.schedule;
2 2
3 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; 3 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
4 import com.bsth.repository.BaseRepository; 4 import com.bsth.repository.BaseRepository;
5 -import org.springframework.data.jpa.repository.Modifying;  
6 -import org.springframework.data.jpa.repository.Query;  
7 import org.springframework.stereotype.Repository; 5 import org.springframework.stereotype.Repository;
8 6
9 -import java.util.Date;  
10 -import java.util.List;  
11 -  
12 /** 7 /**
13 * Created by xu on 17/3/29. 8 * Created by xu on 17/3/29.
14 */ 9 */
15 @Repository 10 @Repository
16 public interface SchedulePlanRuleResultRepository extends BaseRepository<SchedulePlanRuleResult, Long> { 11 public interface SchedulePlanRuleResultRepository extends BaseRepository<SchedulePlanRuleResult, Long> {
17 12
18 - @Query("select t from SchedulePlanRuleResult t " +  
19 - "where not exists (select 1 from SchedulePlanRuleResult " +  
20 - "where createDate > t.createDate and scheduleDate < ?2 ) " +  
21 - "and t.xlId = ?1 and t.scheduleDate < ?2")  
22 - List<SchedulePlanRuleResult> findLastByXl(String xlid, Date from); 13 +// @Query("select t from SchedulePlanRuleResult t " +
  14 +// "where not exists (select 1 from SchedulePlanRuleResult " +
  15 +// "where createDate > t.createDate and scheduleDate < ?2 ) " +
  16 +// "and t.xlId = ?1 and t.scheduleDate < ?2")
23 17
24 // @Modifying 18 // @Modifying
25 // @Query("delete from SchedulePlanRuleResult t " + 19 // @Query("delete from SchedulePlanRuleResult t " +
src/main/java/com/bsth/service/BusinessService.java
@@ -18,5 +18,5 @@ import com.bsth.entity.Business; @@ -18,5 +18,5 @@ import com.bsth.entity.Business;
18 * 18 *
19 */ 19 */
20 public interface BusinessService extends BaseService<Business, Integer> { 20 public interface BusinessService extends BaseService<Business, Integer> {
21 - 21 + long getCompCode();
22 } 22 }
src/main/java/com/bsth/service/StationRouteService.java
@@ -23,6 +23,14 @@ import com.bsth.entity.StationRoute; @@ -23,6 +23,14 @@ import com.bsth.entity.StationRoute;
23 public interface StationRouteService extends BaseService<StationRoute, Integer> { 23 public interface StationRouteService extends BaseService<StationRoute, Integer> {
24 24
25 /** 25 /**
  26 + *
  27 + * @Title: list
  28 + * @Description: TODO(多条件查询)
  29 + * @throws
  30 + */
  31 + Iterable<StationRoute> list(Map<String, Object> map);
  32 +
  33 + /**
26 * @Description :TODO(查询树站点与路段数据) 34 * @Description :TODO(查询树站点与路段数据)
27 * 35 *
28 * @param map <line.id_eq:线路ID; directions_eq:方向> 36 * @param map <line.id_eq:线路ID; directions_eq:方向>
src/main/java/com/bsth/service/forms/FormsService.java
@@ -31,7 +31,7 @@ public interface FormsService { @@ -31,7 +31,7 @@ public interface FormsService {
31 31
32 public List<Singledata> singledata(Map<String, Object> map); 32 public List<Singledata> singledata(Map<String, Object> map);
33 33
34 - public List<Vehicleloading> vehicleloading(String gsdmVehic,String fgsdmVehic,String line,String data); 34 + public List<Vehicleloading> vehicleloading(String line,String data);
35 35
36 public List<Operationservice> operationservice(Map<String, Object> map); 36 public List<Operationservice> operationservice(Map<String, Object> map);
37 37
src/main/java/com/bsth/service/forms/impl/ExportServiceImpl.java
@@ -35,12 +35,14 @@ public class ExportServiceImpl implements ExportService{ @@ -35,12 +35,14 @@ public class ExportServiceImpl implements ExportService{
35 35
36 for(Waybillday w : list){ 36 for(Waybillday w : list){
37 Map<String, Object> m = new HashMap<String, Object>(); 37 Map<String, Object> m = new HashMap<String, Object>();
38 - m.put("carPlate", w.getCarPlate()); 38 + m.put("carPlate", w.getNbbm());
39 m.put("jzl1", w.getJzl1()); 39 m.put("jzl1", w.getJzl1());
40 m.put("jzl", w.getJzl()); 40 m.put("jzl", w.getJzl());
41 m.put("yh", w.getYh()); 41 m.put("yh", w.getYh());
  42 + m.put("sh", w.getSh());
42 m.put("jName", w.getjName()); 43 m.put("jName", w.getjName());
43 m.put("zlc", w.getZlc()); 44 m.put("zlc", w.getZlc());
  45 + m.put("jy", "");
44 resList.add(m); 46 resList.add(m);
45 } 47 }
46 48
@@ -48,7 +50,7 @@ public class ExportServiceImpl implements ExportService{ @@ -48,7 +50,7 @@ public class ExportServiceImpl implements ExportService{
48 listI.add(resList.iterator()); 50 listI.add(resList.iterator());
49 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 51 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
50 ee.excelReplace(listI, new Object[] { map }, path+"mould/waybillday.xls", 52 ee.excelReplace(listI, new Object[] { map }, path+"mould/waybillday.xls",
51 - path+"export/行车路单日报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); 53 + path+"export/行车路单日报表.xls");
52 } catch (Exception e) { 54 } catch (Exception e) {
53 e.printStackTrace(); 55 e.printStackTrace();
54 } 56 }
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
@@ -25,7 +25,9 @@ import com.bsth.entity.mcy_forms.Singledata; @@ -25,7 +25,9 @@ import com.bsth.entity.mcy_forms.Singledata;
25 import com.bsth.entity.mcy_forms.Turnoutrate; 25 import com.bsth.entity.mcy_forms.Turnoutrate;
26 import com.bsth.entity.mcy_forms.Vehicleloading; 26 import com.bsth.entity.mcy_forms.Vehicleloading;
27 import com.bsth.entity.mcy_forms.Waybillday; 27 import com.bsth.entity.mcy_forms.Waybillday;
  28 +import com.bsth.entity.oil.Ylb;
28 import com.bsth.entity.realcontrol.ScheduleRealInfo; 29 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  30 +import com.bsth.repository.oil.YlbRepository;
29 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 31 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
30 import com.bsth.data.BasicData; 32 import com.bsth.data.BasicData;
31 import com.bsth.entity.mcy_forms.Allline; 33 import com.bsth.entity.mcy_forms.Allline;
@@ -55,52 +57,76 @@ public class FormsServiceImpl implements FormsService { @@ -55,52 +57,76 @@ public class FormsServiceImpl implements FormsService {
55 57
56 @Autowired 58 @Autowired
57 CulateMileageService culateMileageService; 59 CulateMileageService culateMileageService;
  60 +
  61 + @Autowired
  62 + YlbRepository ylbRepository;
58 63
59 // 行车路单日报表 64 // 行车路单日报表
60 @Override 65 @Override
61 public List<Waybillday> waybillday(Map<String, Object> map) { 66 public List<Waybillday> waybillday(Map<String, Object> map) {
62 -  
63 -  
64 -  
65 - String sql=" select t.*,z.jzl,z.yh from ("  
66 - + " select x.j_gh,x.cl_zbh,x.j_name,x.schedule_date,"  
67 - + " x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name from bsth_c_s_sp_info_real x "  
68 - + " where to_days( x.schedule_date)=to_days('"+map.get("date").toString() + "') "  
69 - + " and x.gs_bm='"+map.get("gsdmWaybillday").toString()+"' "  
70 - + " and x.fgs_bm='"+map.get("fgsdmWaybillday").toString()+"' "  
71 - + " and xl_bm like '%"+ map.get("line").toString().trim()+"%'"  
72 - + " GROUP BY x.j_gh,x.cl_zbh,x.j_name,"  
73 - + " x.schedule_date,x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name ) t"  
74 - + " LEFT join (select y.rq,y.xlbm,y.nbbm,y.jsy,y.jzl,y.yh from"  
75 - + " bsth_c_ylb y where 1=1 "  
76 - + " and to_days(y.RQ)=to_days('"+map.get("date").toString() + "') "  
77 - + " and y.XLBM like '%"+ map.get("line").toString().trim()+"%'"  
78 - + " and y.ssgsdm='"+map.get("gsdmWaybillday").toString()+"'"  
79 - + " and y.fgsdm='"+map.get("gsdmWaybillday").toString()+"') z "  
80 - + " on t.cl_zbh=z.nbbm "; 67 + String line=map.get("line").toString();
  68 + String date=map.get("date").toString();
  69 +
  70 + String sql="select "
  71 + + " r.cl_zbh,r.j_gh,r.j_name"
  72 + + " from bsth_c_s_sp_info_real r where "
  73 + + " r.schedule_date_str = '"+date+"'"
  74 + + " and r.xl_bm = '"+line+"' "
  75 + + " group by "
  76 + + " r.cl_zbh,r.j_gh,r.j_name";
81 77
82 List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() { 78 List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() {
  79 +
83 @Override 80 @Override
84 public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException { 81 public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException {
85 - Waybillday wbd = new Waybillday();  
86 - wbd.setCarPlate(arg0.getString("cl_zbh"));  
87 - wbd.setJzl(arg0.getString("jzl"));  
88 - wbd.setYh(arg0.getString("yh"));  
89 - wbd.setjName(arg0.getString("j_name"));  
90 - wbd.setRq(arg0.getString("schedule_date"));  
91 - wbd.setJgh(arg0.getString("j_gh"));  
92 - return wbd;  
93 - } 82 + Waybillday w=new Waybillday();
  83 + w.setJgh(arg0.getString("j_gh"));
  84 + w.setjName(arg0.getString("j_name"));
  85 + w.setNbbm(arg0.getString("cl_zbh"));
  86 + return w;
  87 +
  88 + };
94 }); 89 });
95 -  
96 - for(int i=0;i<list.size();i++){ 90 + List<ScheduleRealInfo> realList= scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
  91 + List<Ylb> listYlb= ylbRepository.obtainYl(date, "", "", line, "", "xlbm");
  92 + double jzl=0.0,sh=0.0,yh=0.0;
  93 + for (int i = 0; i < list.size(); i++) {
97 Waybillday w=list.get(i); 94 Waybillday w=list.get(i);
98 - Map<String, Object> maps = new HashMap<>();  
99 - maps = commonService.findKMBC2(w.getJgh(), w.getCarPlate(),  
100 - w.getRq());  
101 - w.setJzl1(maps.get("ksgl").toString());  
102 - w.setZlc(maps.get("realMileage").toString());  
103 - 95 + List<ScheduleRealInfo> listInfo=new ArrayList<ScheduleRealInfo>();
  96 + for (int j = 0; j < realList.size(); j++) {
  97 + ScheduleRealInfo s=realList.get(j);
  98 + if(w.getNbbm().equals(s.getClZbh()) && w.getJgh().equals(w.getJgh())){
  99 + listInfo.add(s);
  100 + }
  101 + }
  102 +
  103 + double sjgl=culateMileageService.culateSjgl(listInfo);
  104 + double ljgl=culateMileageService.culateLjgl(listInfo);
  105 + double zyygl=Arith.add(sjgl, ljgl);
  106 + double jccg=culateMileageService.culateJccgl(listInfo);
  107 + double ksgl=culateMileageService.culateKsgl(listInfo);
  108 + double zksgl=Arith.add(jccg, ksgl);
  109 +
  110 + w.setJzl1(String.valueOf(zksgl));
  111 + w.setZlc(String.valueOf(Arith.add(zyygl, zksgl)));
  112 +
  113 +
  114 + jzl=0.0;
  115 + sh=0.0;
  116 + yh=0.0;
  117 + for (int j = 0; j < listYlb.size(); j++) {
  118 + Ylb y=listYlb.get(j);
  119 + if(w.getNbbm().equals(y.getNbbm()) && w.getJgh().equals(y.getJsy())){
  120 + jzl=Arith.add(jzl, y.getJzl());
  121 + sh=Arith.add(sh, y.getSh());
  122 + yh=Arith.add(yh, y.getYh());
  123 + }
  124 + }
  125 +
  126 + w.setJzl(String.valueOf(jzl));
  127 + w.setYh(String.valueOf(yh));
  128 + w.setSh(String.valueOf(sh));
  129 +
104 } 130 }
105 return list; 131 return list;
106 } 132 }
@@ -417,7 +443,19 @@ public class FormsServiceImpl implements FormsService { @@ -417,7 +443,19 @@ public class FormsServiceImpl implements FormsService {
417 // 路单数据 443 // 路单数据
418 @Override 444 @Override
419 public List<Singledata> singledata(Map<String, Object> map) { 445 public List<Singledata> singledata(Map<String, Object> map) {
420 - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 446 +
  447 + String gsdm="";
  448 + if(map.get("gsdmSing")!=null){
  449 + gsdm=map.get("gsdmSing").toString();
  450 + }
  451 + String fgsdm="";
  452 + if(map.get("fgsdmSing")!=null){
  453 + fgsdm=map.get("fgsdmSing").toString();
  454 + }
  455 +
  456 + String xlbm=map.get("line").toString().trim();
  457 +
  458 + /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
421 SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日"); 459 SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
422 Date d = null; 460 Date d = null;
423 Date d1 = null; 461 Date d1 = null;
@@ -429,60 +467,92 @@ public class FormsServiceImpl implements FormsService { @@ -429,60 +467,92 @@ public class FormsServiceImpl implements FormsService {
429 e.printStackTrace(); 467 e.printStackTrace();
430 } 468 }
431 String rq2 = sdf1.format(d); 469 String rq2 = sdf1.format(d);
432 - String rq3 = sdf1.format(d1); 470 + String rq3 = sdf1.format(d1);*/
433 471
434 - rq = rq2 + "-" + rq3; 472 +// rq = rq2 + "-" + rq3;
435 startDate = map.get("startDate").toString(); 473 startDate = map.get("startDate").toString();
436 - endDate = map.get("endDate").toString();  
437 - String sql = "select t.*,y.yh,y.jzl from ("  
438 - + " select r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"  
439 - + " from bsth_c_s_sp_info_real r where r.schedule_date_str "  
440 - + " BETWEEN '"+startDate+"' and '"+endDate+"' and r.xl_bm='"+map.get("line").toString()+"' "  
441 - + " AND r.gs_bm is not null and r.gs_bm='"+map.get("gsdmSing").toString()+"' "  
442 - + " and r.fgs_bm='"+map.get("fgsdmSing").toString()+"' "  
443 - + " group by r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm) t "  
444 - + " LEFT JOIN (select a.nbbm,a.jsy,SUM(a.yh) as yh,SUM(a.jzl) as jzl "  
445 - + " from bsth_c_ylb a where a.rq BETWEEN '"+startDate+"' and '"+endDate+"'and "  
446 - + " a.ssgsdm='"+map.get("gsdmSing").toString()+"' and a.fgsdm='"+map.get("fgsdmSing").toString()+"' "  
447 - + "group by a.nbbm,a.jsy) y"  
448 - + " on y.nbbm=t.cl_zbh and y.jsy= t.j_gh"; 474 +// endDate = map.get("endDate").toString();
  475 +// String sql = "select t.*,y.yh,y.jzl from ("
  476 +// + " select r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"
  477 +// + " from bsth_c_s_sp_info_real r where r.schedule_date_str "
  478 +// + " BETWEEN '"+startDate+"' and '"+endDate+"' and r.xl_bm='"+map.get("line").toString()+"' "
  479 +// + " AND r.gs_bm is not null and r.gs_bm='"+map.get("gsdmSing").toString()+"' "
  480 +// + " and r.fgs_bm='"+map.get("fgsdmSing").toString()+"' "
  481 +// + " group by r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm) t "
  482 +// + " LEFT JOIN (select a.nbbm,a.jsy,SUM(a.yh) as yh,SUM(a.jzl) as jzl "
  483 +// + " from bsth_c_ylb a where a.rq BETWEEN '"+startDate+"' and '"+endDate+"'and "
  484 +// + " a.ssgsdm='"+map.get("gsdmSing").toString()+"' and a.fgsdm='"+map.get("fgsdmSing").toString()+"' "
  485 +// + "group by a.nbbm,a.jsy) y"
  486 +// + " on y.nbbm=t.cl_zbh and y.jsy= t.j_gh";
449 487
  488 + String sql="select r.s_gh,r.s_name, "
  489 + + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"
  490 + + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'";
  491 + if(xlbm.equals("")){
  492 + sql +="and r.gs_bm='"+gsdm+"' "
  493 + + " and r.fgs_bm='"+fgsdm+"'";
  494 + }else{
  495 + sql += " and r.xl_bm = '"+xlbm+"'";
  496 + }
  497 + sql += " group by r.s_gh,r.s_name,"
  498 + + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm";
  499 +
450 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 500 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
451 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 501 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
452 @Override 502 @Override
453 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 503 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
454 Singledata sin = new Singledata(); 504 Singledata sin = new Singledata();
455 - sin.setrQ(rq);  
456 - sin.setgS(arg0.getString("gs_bm")); 505 + sin.setrQ(startDate);
457 sin.setxL(arg0.getString("xl_name")); 506 sin.setxL(arg0.getString("xl_name"));
458 sin.setClzbh(arg0.getString("cl_zbh")); 507 sin.setClzbh(arg0.getString("cl_zbh"));
459 sin.setJsy(arg0.getString("j_gh")); 508 sin.setJsy(arg0.getString("j_gh"));
460 sin.setjName(arg0.getString("j_name")); 509 sin.setjName(arg0.getString("j_name"));
461 - sin.setHyl(arg0.getString("YH"));  
462 - sin.setJzl(arg0.getString("JZL"));  
463 - // sin.setJzl(arg0.getString(""));//非营业性用油  
464 - sin.setJhjl(arg0.getString("JZL")); 510 + sin.setSgh(arg0.getString("s_gh"));
  511 + sin.setsName(arg0.getString("s_name"));
  512 + sin.setgS(BasicData.businessFgsCodeNameMap.get(arg0.getString("fgs_bm")+"_"+arg0.getString("gs_bm")));
465 513
466 return sin; 514 return sin;
467 } 515 }
468 }); 516 });
469 - DecimalFormat df = new DecimalFormat("0.00");  
470 - for(int i=0;i<list.size();i++){  
471 -  
472 - Singledata si=list.get(i);  
473 - si.setgS(BasicData.businessCodeNameMap.get(si.getgS()));  
474 - si.setJzl(df.format(Double.parseDouble(si.getJzl())));  
475 - si.setHyl(df.format(Double.parseDouble(si.getHyl())));  
476 - Map<String, Object> maps = new HashMap<>();  
477 - maps = commonService.findKMBC1(si.getjName(),si.getClzbh(), startDate,  
478 - endDate);  
479 - //sin.setjName(maps.get("j_name") == null ? "" : maps.get("j_name").toString());  
480 - si.setSgh(maps.get("s_gh") == null ? "" : maps.get("s_gh").toString());  
481 - si.setsName(maps.get("s_name") == null ? "" : maps.get("s_name").toString());  
482 - si.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString());  
483 - si.setEmptMileage(maps.get("ksgl") == null ? "" : maps.get("ksgl").toString());  
484 - si.setJhjl(maps.get("jhlc") == null ? "" : maps.get("jhlc").toString());  
485 517
  518 + List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
  519 + List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(xlbm, startDate);
  520 + for (int i = 0; i < list.size(); i++) {
  521 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  522 + Singledata sin=list.get(i);
  523 + String jsy=sin.getJsy();
  524 + String clzbh=sin.getClzbh();
  525 + for (int j = 0; j < listReal.size(); j++) {
  526 + ScheduleRealInfo s=listReal.get(j);
  527 + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)){
  528 + newList.add(s);
  529 + }
  530 + }
  531 +
  532 + double jhgl=culateMileageService.culateJhgl(newList);
  533 + double yygl=culateMileageService.culateSjgl(newList);
  534 + double ljgl=culateMileageService.culateLjgl(newList);
  535 + double ksgl=culateMileageService.culateKsgl(newList);
  536 + double jcgl=culateMileageService.culateJccgl(newList);
  537 + double zyygl=Arith.add(yygl, ljgl);
  538 + double zksgl=Arith.add(ksgl, jcgl);
  539 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  540 + sin.setEmptMileage(String.valueOf(zksgl));
  541 + sin.setJhjl(String.valueOf(jhgl));
  542 + double yhl=0.0;
  543 + double jzl=0.0;
  544 + double fyy=0.0;
  545 + for (int j = 0; j < listYlb.size(); j++) {
  546 + Ylb y=listYlb.get(j);
  547 + if(y.getJsy().equals(jsy) && y.getNbbm().equals(clzbh)){
  548 + yhl=Arith.add(yhl, y.getYh()==null?0:y.getYh());
  549 + jzl=Arith.add(jzl, y.getJzl()==null?0:y.getJzl());
  550 + fyy=Arith.add(fyy, y.getSh()==null?0:y.getSh());
  551 + }
  552 + }
  553 + sin.setHyl(String.valueOf(yhl));
  554 + sin.setJzl(String.valueOf(jzl));
  555 + sin.setUnyyyl(String.valueOf(fyy));
486 } 556 }
487 return list; 557 return list;
488 } 558 }
@@ -490,105 +560,174 @@ public class FormsServiceImpl implements FormsService { @@ -490,105 +560,174 @@ public class FormsServiceImpl implements FormsService {
490 // 运营服务阶段报表 560 // 运营服务阶段报表
491 @Override 561 @Override
492 public List<Operationservice> operationservice(Map<String, Object> map) { 562 public List<Operationservice> operationservice(Map<String, Object> map) {
493 -  
494 - String sql = " SELECT r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "  
495 - + " FROM bsth_c_s_sp_info_real r "  
496 - // + "LEFT JOIN bsth_c_s_sp_info_real r on r.cl_zbh=y.NBBM"  
497 - + " left join bsth_c_ylb y ON r.cl_zbh = y.nbbm "  
498 - + " where 1=1 ";  
499 - if(map.get("startDate").toString()!=""){  
500 - sql+=" and to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') ";  
501 - }  
502 563
503 - if(map.get("endDate").toString()!=""){  
504 - sql+=" and to_days('" + map.get("endDate").toString() + "') ";  
505 - }  
506 - sql+=" and r.xl_bm='" + map.get("line").toString() + "'" ;  
507 - sql+=" and r.bc_type not in('in','out')";  
508 - if(map.get("gsdmOperat").toString()!=""){  
509 - sql+=" and r.gs_bm='"+map.get("gsdmOperat").toString()+"'";  
510 - }  
511 - if(map.get("fgsdmOperat").toString()!=""){  
512 - sql+=" and r.fgs_bm='"+map.get("fgsdmOperat").toString()+"'";  
513 - }  
514 - sql += " AND r.gs_bm is not null";  
515 - sql += " GROUP BY r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name";  
516 - startDate = map.get("startDate").toString();  
517 - endDate = map.get("endDate").toString();  
518 - List<Operationservice> list = jdbcTemplate.query(sql, new RowMapper<Operationservice>() {  
519 -  
520 - @Override  
521 - public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException {  
522 - Operationservice op = new Operationservice();  
523 - op.setXlName(arg0.getString("xl_name"));  
524 - op.setJzl(arg0.getString("JZL"));  
525 - op.setXhl(arg0.getString("YH"));  
526 - op.setClzbh(arg0.getString("cl_zbh"));  
527 - op.setJname(arg0.getString("j_name")); 564 + String xlbm=map.get("line").toString().trim();
  565 + String gsdm="";
  566 + if(map.get("gsdmOperat")!=null){
  567 + gsdm=map.get("gsdmOperat").toString();
  568 + }
  569 + String fgsdm="";
  570 + if(map.get("fgsdmOperat")!=null){
  571 + fgsdm=map.get("fgsdmOperat").toString();
  572 + }
  573 + startDate=map.get("startDate").toString();
  574 + endDate =map.get("endDate").toString();
  575 + String sql="select r.xl_bm"
  576 + + " from bsth_c_s_sp_info_real r where"
  577 + + " r.schedule_date_str BETWEEN '"+startDate+"' and '"+endDate+"'";
  578 + if(xlbm.equals("")){
  579 + sql +="and r.gs_bm='"+gsdm+"' "
  580 + + " and r.fgs_bm='"+fgsdm+"'";
  581 + }else{
  582 + sql += " and r.xl_bm = '"+xlbm+"'";
  583 + }
  584 + sql += " group by r.xl_bm";
  585 +
  586 +
  587 + List<Operationservice> list= jdbcTemplate.query(sql, new RowMapper<Operationservice>() {
  588 + @Override
  589 + public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException {
  590 + Operationservice ve = new Operationservice();
  591 + ve.setXlBm(arg0.getString("xl_bm"));
  592 + return ve;
  593 + }
  594 + });
  595 +
  596 + String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+startDate+"' and '"+endDate+"'";
  597 + if(xlbm.equals("")){
  598 + ylbSql +="and ssgsdm='"+gsdm+"' "
  599 + + " and fgsdm='"+fgsdm+"'";
  600 + }else{
  601 + ylbSql += " and xlbm = '"+xlbm+"'";
  602 + }
  603 + List<Ylb> ylbList= jdbcTemplate.query(ylbSql, new RowMapper<Ylb>() {
  604 + @Override
  605 + public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException {
  606 + Ylb y = new Ylb();
  607 + y.setXlbm(arg0.getString("xlbm"));
  608 + y.setJzl(arg0.getDouble("jzl"));
  609 + y.setYh(arg0.getDouble("yh"));
  610 + return y;
  611 + }
  612 + });
  613 + List<ScheduleRealInfo> listReal;
  614 + if(xlbm.equals("")){
  615 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj(xlbm, startDate, endDate, gsdm, fgsdm);
  616 + }else{
  617 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj2(xlbm, startDate, endDate);
  618 + }
  619 +
  620 + for (int i = 0; i < list.size(); i++) {
  621 + Operationservice o=list.get(i);
  622 + String line=o.getXlBm();
  623 + String xlname=BasicData.lineCode2NameMap.get(line);
  624 + o.setXlName(xlname);
  625 +
  626 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  627 + for (int j = 0; j < listReal.size(); j++) {
  628 + ScheduleRealInfo s=listReal.get(j);
  629 + if(s.getXlBm().equals(line)){
  630 + newList.add(s);
  631 + }
  632 + }
  633 +
  634 + int sjbc=culateMileageService.culateSjbc(newList,"");
  635 + int ljbc=culateMileageService.culateLjbc(newList,"");
  636 + double ksgl=culateMileageService.culateKsgl(newList);
  637 + double jccgl=culateMileageService.culateJccgl(newList);
  638 +
  639 + double sjgl=culateMileageService.culateSjgl(newList);
  640 + double ljgl=culateMileageService.culateLjgl(newList);
  641 +
  642 + o.setEmptMileage(String.valueOf(Arith.add(ksgl, jccgl)));
  643 + o.setXsgl(String.valueOf(Arith.add(sjgl, ljgl)));
  644 + o.setSjbc(String.valueOf(sjbc+ljbc));
528 645
529 - return op; 646 + double jzl=0.0;
  647 + double xhl=0.0;
  648 + for (int j = 0; j < ylbList.size(); j++) {
  649 + Ylb t=ylbList.get(j);
  650 + if(t.getXlbm().equals(line)){
  651 + jzl=Arith.add(jzl, t.getJzl());
  652 + xhl=Arith.add(xhl, t.getYh());
  653 + }
  654 + }
  655 +
  656 + o.setJzl(String.valueOf(jzl));
  657 + o.setXhl(String.valueOf(xhl));
530 } 658 }
531 - });  
532 -  
533 - for(int i=0;i<list.size();i++){  
534 - Operationservice o=list.get(i);  
535 - Map<String, Object> maps = new HashMap<>();  
536 - maps = commonService.findKMBC1(o.getJname(), o.getClzbh(), startDate,  
537 - endDate);  
538 - o.setXsgl(maps.get("jhlc").toString() == null ? "" : maps.get("jhlc").toString());  
539 - o.setEmptMileage(maps.get("ksgl").toString() == null ? "" : maps.get("ksgl").toString());  
540 - o.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());  
541 - }  
542 return list; 659 return list;
543 } 660 }
544 661
545 662
546 // 车辆加注 663 // 车辆加注
547 @Override 664 @Override
548 - public List<Vehicleloading> vehicleloading(String gsdmVehic,String fgsdmVehic,String line, String date) {  
549 -  
550 - String sql = " SELECT r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "  
551 - + " FROM bsth_c_s_sp_info_real r "  
552 - + " INNER join ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH from bsth_c_ylb y "  
553 - + " where to_days(y.RQ)=to_days('" + date + "') and y.XLBM= '" + line + "' GROUP BY y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH) y "  
554 - + " on r.cl_zbh=y.nbbm "  
555 - + " where to_days(r.schedule_date_str)=to_days('" + date + "')"  
556 - + " and r.xl_bm='" + line + "' "  
557 - + " AND r.gs_bm is not null"  
558 - + " and r.bc_type not in('in','out')";  
559 - if(gsdmVehic.toString()!=""){  
560 - sql+=" and r.gs_bm='"+gsdmVehic+"'";  
561 - }  
562 - if(fgsdmVehic.toString()!=""){  
563 - sql+=" and r.fgs_bm='"+fgsdmVehic +"'";  
564 - }  
565 - sql += " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; 665 + public List<Vehicleloading> vehicleloading(String line, String date) {
  666 +
  667 + String sql="select r.s_gh,r.s_name, "
  668 + + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"
  669 + + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+date+"' "
  670 + + " and r.xl_bm = '"+line+"' group by r.s_gh,r.s_name,"
  671 + + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm";
  672 +
566 List<Vehicleloading> list = jdbcTemplate.query(sql, new RowMapper<Vehicleloading>() { 673 List<Vehicleloading> list = jdbcTemplate.query(sql, new RowMapper<Vehicleloading>() {
567 @Override 674 @Override
568 public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException { 675 public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException {
569 Vehicleloading ve = new Vehicleloading(); 676 Vehicleloading ve = new Vehicleloading();
570 - ve.setrQ(arg0.getString("schedule_date_str"));  
571 - ve.setgS(arg0.getString("gs_name")); 677 + ve.setgS(BasicData.businessFgsCodeNameMap.get(arg0.getString("fgs_bm")+"_"+arg0.getString("gs_bm")));
572 ve.setxL(arg0.getString("xl_name")); 678 ve.setxL(arg0.getString("xl_name"));
573 ve.setClzbh(arg0.getString("cl_zbh")); 679 ve.setClzbh(arg0.getString("cl_zbh"));
574 - ve.setJzl(arg0.getString("JZL"));  
575 - ve.setHyl(arg0.getString("YH"));  
576 - // ve.setLs(arg0.getString("").toString());//尿素  
577 ve.setJgh(arg0.getString("j_gh").toString()); 680 ve.setJgh(arg0.getString("j_gh").toString());
578 return ve; 681 return ve;
579 } 682 }
580 }); 683 });
581 684
582 - for(int i=0;i<list.size();i++){  
583 - Vehicleloading v=list.get(i);  
584 - Map<String, Object> maps = new HashMap<>();  
585 - maps = commonService.findKMBC2(v.getJgh(), v.getClzbh(),  
586 - v.getrQ());  
587 - v.setJhlc(maps.get("jhlc") == null ? "" : maps.get("jhlc").toString());  
588 - v.setJhbc(maps.get("jhbc").toString() == null ? "" : maps.get("jhbc").toString());// 计划班次  
589 - v.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());// 实际班次  
590 - }  
591 685
  686 + List<Ylb> listYlb= ylbRepository.obtainYl(startDate, "", "", line, "", "xlbm");
  687 + List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
  688 + for (int i = 0; i < list.size(); i++) {
  689 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  690 + Vehicleloading sin=list.get(i);
  691 + sin.setrQ(date);
  692 + String jsy=sin.getJgh();
  693 + String clzbh=sin.getClzbh();
  694 + for (int j = 0; j < listReal.size(); j++) {
  695 + ScheduleRealInfo s=listReal.get(j);
  696 + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)){
  697 + newList.add(s);
  698 + }
  699 + }
  700 +
  701 + int jhbc=culateMileageService.culateJhbc(newList, "");
  702 + int sjbc=culateMileageService.culateSjbc(newList, "");
  703 + int ljbc=culateMileageService.culateLjbc(newList, "");
  704 + double yygl=culateMileageService.culateSjgl(newList);
  705 + double ljgl=culateMileageService.culateLjgl(newList);
  706 + double ksgl=culateMileageService.culateKsgl(newList);
  707 + double jcgl=culateMileageService.culateJccgl(newList);
  708 + double zyygl=Arith.add(yygl, ljgl);
  709 + double zksgl=Arith.add(ksgl, jcgl);
  710 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  711 + sin.setJhbc(String.valueOf(jhbc));
  712 + sin.setSjbc(String.valueOf(sjbc+ljbc));
  713 + double yhl=0.0;
  714 + double jzl=0.0;
  715 + double fyy=0.0;
  716 + double ns=0.0;
  717 + for (int j = 0; j < listYlb.size(); j++) {
  718 + Ylb y=listYlb.get(j);
  719 + if(y.getJsy().equals(jsy) && y.getNbbm().equals(clzbh)){
  720 + yhl=Arith.add(yhl, y.getYh()==null?0:y.getYh());
  721 + jzl=Arith.add(jzl, y.getJzl()==null?0:y.getJzl());
  722 + fyy=Arith.add(fyy, y.getSh()==null?0:y.getSh());
  723 + ns =Arith.add(ns, y.getNs()==null?0:y.getNs());
  724 + }
  725 + }
  726 + sin.setHyl(String.valueOf(yhl));
  727 + sin.setJzl(String.valueOf(jzl));
  728 + sin.setUnyyyl(String.valueOf(fyy));
  729 + sin.setLs(String.valueOf(ns));
  730 + }
592 return list; 731 return list;
593 } 732 }
594 733
@@ -816,7 +955,7 @@ public class FormsServiceImpl implements FormsService { @@ -816,7 +955,7 @@ public class FormsServiceImpl implements FormsService {
816 } 955 }
817 956
818 String fgsbm=""; 957 String fgsbm="";
819 - if(map.get("fgsdmDaily").toString()!=null){ 958 + if(map.get("fgsdmDaily")!=null){
820 fgsbm=map.get("fgsdmDaily").toString(); 959 fgsbm=map.get("fgsdmDaily").toString();
821 } 960 }
822 961
@@ -853,6 +992,12 @@ public class FormsServiceImpl implements FormsService { @@ -853,6 +992,12 @@ public class FormsServiceImpl implements FormsService {
853 for(int i=0;i<list.size();i++){ 992 for(int i=0;i<list.size();i++){
854 sList =new ArrayList<ScheduleRealInfo>(); 993 sList =new ArrayList<ScheduleRealInfo>();
855 Daily d=list.get(i); 994 Daily d=list.get(i);
  995 + if(d.getYh()==null){
  996 + d.setYh("0");
  997 + }else{
  998 + if(d.getYh().equals(""))
  999 + d.setYh("0");
  1000 + }
856 for (int j = 0; j < lists.size(); j++) { 1001 for (int j = 0; j < lists.size(); j++) {
857 ScheduleRealInfo s=lists.get(j); 1002 ScheduleRealInfo s=lists.get(j);
858 if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){ 1003 if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){
src/main/java/com/bsth/service/impl/BusinessServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
  3 +import org.springframework.beans.factory.annotation.Autowired;
3 import org.springframework.stereotype.Service; 4 import org.springframework.stereotype.Service;
4 5
5 import com.bsth.entity.Business; 6 import com.bsth.entity.Business;
  7 +import com.bsth.repository.BusinessRepository;
6 import com.bsth.service.BusinessService; 8 import com.bsth.service.BusinessService;
7 9
8 /** 10 /**
@@ -23,5 +25,12 @@ import com.bsth.service.BusinessService; @@ -23,5 +25,12 @@ import com.bsth.service.BusinessService;
23 25
24 @Service 26 @Service
25 public class BusinessServiceImpl extends BaseServiceImpl<Business, Integer> implements BusinessService{ 27 public class BusinessServiceImpl extends BaseServiceImpl<Business, Integer> implements BusinessService{
  28 + @Autowired
  29 + private BusinessRepository businessRepository;
  30 + @Override
  31 + public long getCompCode() {
  32 + // TODO Auto-generated method stub
  33 + return businessRepository.getMaxId();
  34 + }
26 35
27 } 36 }
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
@@ -16,6 +16,7 @@ import com.bsth.repository.LineRepository; @@ -16,6 +16,7 @@ import com.bsth.repository.LineRepository;
16 import com.bsth.repository.SectionRepository; 16 import com.bsth.repository.SectionRepository;
17 import com.bsth.repository.SectionRouteRepository; 17 import com.bsth.repository.SectionRouteRepository;
18 import com.bsth.service.SectionRouteService; 18 import com.bsth.service.SectionRouteService;
  19 +import com.bsth.util.GetUIDAndCode;
19 20
20 /** 21 /**
21 * 22 *
@@ -185,6 +186,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ @@ -185,6 +186,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
185 186
186 tempM.put("sectionVersion", objects.get(i)[33]); 187 tempM.put("sectionVersion", objects.get(i)[33]);
187 188
  189 + tempM.put("isRoadeSpeed", objects.get(i)[34]);
188 resultList.add(tempM); 190 resultList.add(tempM);
189 } 191 }
190 192
@@ -203,32 +205,19 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ @@ -203,32 +205,19 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
203 */ 205 */
204 @Override 206 @Override
205 public List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map) { 207 public List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map) {
206 -  
207 Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); 208 Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString());
208 -  
209 Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); 209 Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString());
210 -  
211 Integer stationRouteCode = map.get("sectionRouteCode").equals("") ? null : Integer.parseInt(map.get("sectionRouteCode").toString()); 210 Integer stationRouteCode = map.get("sectionRouteCode").equals("") ? null : Integer.parseInt(map.get("sectionRouteCode").toString());
212 -  
213 List<Object[]> reslutList = repository.findUpSectionRouteCode(lineId, direction, stationRouteCode); 211 List<Object[]> reslutList = repository.findUpSectionRouteCode(lineId, direction, stationRouteCode);
214 -  
215 List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); 212 List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
216 -  
217 if(reslutList.get(0)!=null) { 213 if(reslutList.get(0)!=null) {
218 -  
219 for(int i = 0 ; i <reslutList.size() ;i++){ 214 for(int i = 0 ; i <reslutList.size() ;i++){
220 -  
221 Map<String, Object> tempM = new HashMap<String, Object>(); 215 Map<String, Object> tempM = new HashMap<String, Object>();
222 -  
223 System.out.println(reslutList.get(i)); 216 System.out.println(reslutList.get(i));
224 -  
225 tempM.put("sectionrouteCode", reslutList.get(i)); 217 tempM.put("sectionrouteCode", reslutList.get(i));
226 -  
227 list.add(tempM); 218 list.add(tempM);
228 -  
229 } 219 }
230 } 220 }
231 -  
232 return list; 221 return list;
233 } 222 }
234 223
@@ -243,8 +232,10 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ @@ -243,8 +232,10 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
243 List<Object[]> list = repository.getSectionRoute(line, dir); 232 List<Object[]> list = repository.getSectionRoute(line, dir);
244 int src = repository.sectionRouteCodeMaxId(); 233 int src = repository.sectionRouteCodeMaxId();
245 for(int i = 0 ; i<list.size() ; i++) { 234 for(int i = 0 ; i<list.size() ; i++) {
246 - int sectionId = Integer.parseInt(String.valueOf(repository2.sectionMaxId())) + 1 ;  
247 - String sectionCode = String.valueOf(sectionId); 235 + /*int sectionId = Integer.parseInt(String.valueOf(repository2.sectionMaxId())) + 1 ;*/
  236 + long sectionMaxId = GetUIDAndCode.getSectionId();
  237 + String sectionCode = String.valueOf(sectionMaxId);
  238 + int sectionId = (int)sectionMaxId;
248 String sectionName = list.get(i)[9] == null ? null : list.get(i)[9].toString(); 239 String sectionName = list.get(i)[9] == null ? null : list.get(i)[9].toString();
249 String crosesRoad = list.get(i)[10] == null ? null : list.get(i)[10].toString(); 240 String crosesRoad = list.get(i)[10] == null ? null : list.get(i)[10].toString();
250 String endNode = list.get(i)[11] == null ? null : list.get(i)[11].toString(); 241 String endNode = list.get(i)[11] == null ? null : list.get(i)[11].toString();
@@ -267,12 +258,12 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ @@ -267,12 +258,12 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
267 gsectionVector, bsectionVector, 258 gsectionVector, bsectionVector,
268 sectionType, csectionVector, roadCoding, 259 sectionType, csectionVector, roadCoding,
269 sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, sectionId); 260 sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, sectionId);
270 - int sectionRouteId = Integer.parseInt(String.valueOf(repository.sectionRouteMaxId())) + 1 ; 261 + // int sectionRouteId = Integer.parseInt(String.valueOf(repository.sectionRouteMaxId())) + 1 ;
271 SectionRoute sr = new SectionRoute(); 262 SectionRoute sr = new SectionRoute();
272 Line lineObject = lineRepository.findOne(line); 263 Line lineObject = lineRepository.findOne(line);
273 Section section = repository2.findOne(sectionId); 264 Section section = repository2.findOne(sectionId);
274 Integer xh = (src == 0 ? (toDir ==1? (list.size()-i)*10 : (list.size()+i)*10) : toDir==1? (src + (list.size()-i)*10) : (src + (list.size()+i)*10)) ; 265 Integer xh = (src == 0 ? (toDir ==1? (list.size()-i)*10 : (list.size()+i)*10) : toDir==1? (src + (list.size()-i)*10) : (src + (list.size()+i)*10)) ;
275 - sr.setId(sectionRouteId); 266 + // sr.setId(sectionRouteId);
276 sr.setSectionrouteCode(xh); 267 sr.setSectionrouteCode(xh);
277 sr.setLineCode(lineObject.getLineCode()); 268 sr.setLineCode(lineObject.getLineCode());
278 sr.setSectionCode(sectionCode); 269 sr.setSectionCode(sectionCode);
@@ -294,5 +285,4 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ @@ -294,5 +285,4 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
294 } 285 }
295 return resultMap; 286 return resultMap;
296 } 287 }
297 -  
298 -} 288 +}
299 \ No newline at end of file 289 \ No newline at end of file
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
@@ -7,6 +7,7 @@ import java.util.Map; @@ -7,6 +7,7 @@ import java.util.Map;
7 7
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
  10 +import org.springframework.transaction.annotation.Transactional;
10 11
11 import com.alibaba.fastjson.JSONArray; 12 import com.alibaba.fastjson.JSONArray;
12 import com.bsth.common.ResponseCode; 13 import com.bsth.common.ResponseCode;
@@ -57,210 +58,122 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -57,210 +58,122 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
57 */ 58 */
58 @Override 59 @Override
59 public Map<String, Object> sectionUpdate(Map<String, Object> map) { 60 public Map<String, Object> sectionUpdate(Map<String, Object> map) {
60 -  
61 Map<String, Object> resultMap = new HashMap<String, Object>(); 61 Map<String, Object> resultMap = new HashMap<String, Object>();
62 -  
63 try { 62 try {
64 -  
65 String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString(); 63 String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString();
66 -  
67 // 原始线状图形坐标集合 64 // 原始线状图形坐标集合
68 String sectionsBpoints = ""; 65 String sectionsBpoints = "";
69 -  
70 // WGS线状图形坐标集合 66 // WGS线状图形坐标集合
71 String sectionsWJPpoints = ""; 67 String sectionsWJPpoints = "";
72 -  
73 if(!bsectionVector.equals("")) { 68 if(!bsectionVector.equals("")) {
74 -  
75 // 转换成JSON数组 69 // 转换成JSON数组
76 JSONArray sectionsArray = JSONArray.parseArray(bsectionVector); 70 JSONArray sectionsArray = JSONArray.parseArray(bsectionVector);
77 -  
78 // 遍历 71 // 遍历
79 for(int s = 0 ;s<sectionsArray.size();s++) { 72 for(int s = 0 ;s<sectionsArray.size();s++) {
80 -  
81 String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); 73 String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
82 -  
83 String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); 74 String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
84 -  
85 /** to WGS坐标 */ 75 /** to WGS坐标 */
86 Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); 76 Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
87 -  
88 String WGSLngStr = String.valueOf(resultPoint.getLng()); 77 String WGSLngStr = String.valueOf(resultPoint.getLng());
89 -  
90 String WGSLatStr = String.valueOf(resultPoint.getLat()); 78 String WGSLatStr = String.valueOf(resultPoint.getLat());
91 -  
92 if(s==0) { 79 if(s==0) {
93 -  
94 sectionsBpoints = pointsLngStr + " " + pointsLatStr; 80 sectionsBpoints = pointsLngStr + " " + pointsLatStr;
95 -  
96 sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; 81 sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
97 -  
98 }else { 82 }else {
99 -  
100 sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; 83 sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
101 -  
102 sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; 84 sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
103 -  
104 } 85 }
105 -  
106 -  
107 } 86 }
108 -  
109 } 87 }
110 -  
111 // 原坐标类型 88 // 原坐标类型
112 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); 89 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
113 -  
114 // 说明 90 // 说明
115 String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); 91 String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
116 -  
117 // 是否撤销 92 // 是否撤销
118 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); 93 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
119 -  
120 // 方向 94 // 方向
121 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); 95 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
122 -  
123 // 线路ID 96 // 线路ID
124 Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); 97 Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString());
125 -  
126 // 道路编码 98 // 道路编码
127 String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); 99 String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
128 -  
129 // 路段编码 100 // 路段编码
130 String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); 101 String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString();
131 -  
132 // 路段长度 102 // 路段长度
133 Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); 103 Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString());
134 -  
135 // 路段ID 104 // 路段ID
136 Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString()); 105 Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString());
137 -  
138 // 路段名称 106 // 路段名称
139 String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); 107 String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString();
140 -  
141 // 路段路由Id 108 // 路段路由Id
142 Integer sectionRouteId = map.get("sectionRouteId").equals("") ? null : Integer.valueOf(map.get("sectionRouteId").toString()); 109 Integer sectionRouteId = map.get("sectionRouteId").equals("") ? null : Integer.valueOf(map.get("sectionRouteId").toString());
143 -  
144 // 线路编码 110 // 线路编码
145 String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); 111 String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString();
146 -  
147 // 路段时长 112 // 路段时长
148 Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); 113 Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString());
149 -  
150 // 路段路由 114 // 路段路由
151 Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); 115 Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
152 -  
153 SectionRoute resultS = routeRepository.findOne(sectionRouteId); 116 SectionRoute resultS = routeRepository.findOne(sectionRouteId);
154 -  
155 int old_code = resultS.getSectionrouteCode(); 117 int old_code = resultS.getSectionrouteCode();
156 -  
157 if(sectionrouteCode!=null) { 118 if(sectionrouteCode!=null) {
158 -  
159 int new_code = sectionrouteCode+100; 119 int new_code = sectionrouteCode+100;
160 -  
161 if(new_code==old_code){ 120 if(new_code==old_code){
162 -  
163 sectionrouteCode = new_code; 121 sectionrouteCode = new_code;
164 -  
165 }else { 122 }else {
166 -  
167 sectionrouteCode = new_code-100+1; 123 sectionrouteCode = new_code-100+1;
168 -  
169 } 124 }
170 -  
171 }else { 125 }else {
172 -  
173 sectionrouteCode = old_code; 126 sectionrouteCode = old_code;
174 -  
175 } 127 }
176 -  
177 // 限速 128 // 限速
178 Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); 129 Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString());
179 -  
180 // 版本 130 // 版本
181 Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); 131 Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
182 -  
183 // WGS坐标点集合 132 // WGS坐标点集合
184 String gsectionVector = null; 133 String gsectionVector = null;
185 if(!sectionsWJPpoints.equals("")) 134 if(!sectionsWJPpoints.equals(""))
186 gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; 135 gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
187 -  
188 // 原坐标点集合 136 // 原坐标点集合
189 String bsectionVectorS = null; 137 String bsectionVectorS = null;
190 if(!sectionsBpoints.equals("")) 138 if(!sectionsBpoints.equals(""))
191 bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; 139 bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
192 -  
193 Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); 140 Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
194 -  
195 String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); 141 String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString();
196 -  
197 Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); 142 Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString());
198 - 143 + Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString());
199 SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); 144 SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
200 -  
201 Date date = new Date(); 145 Date date = new Date();
202 -  
203 // 修改日期 146 // 修改日期
204 String updateDate = formatter.format(date); 147 String updateDate = formatter.format(date);
205 -  
206 String crosesRoad=""; 148 String crosesRoad="";
207 -  
208 String endNode=""; 149 String endNode="";
209 -  
210 String startNode=""; 150 String startNode="";
211 -  
212 String middleNode=""; 151 String middleNode="";
213 -  
214 String sectionType=""; 152 String sectionType="";
215 -  
216 - // String csectionVector="";  
217 -  
218 // 更新 153 // 更新
219 - /*repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate);*/  
220 repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); 154 repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate);
221 -  
222 SectionRoute route = new SectionRoute(); 155 SectionRoute route = new SectionRoute();
223 -  
224 Line line = lineRepository.findOne(sectionRouteLine); 156 Line line = lineRepository.findOne(sectionRouteLine);
225 -  
226 Section section = repository.findOne(sectionId); 157 Section section = repository.findOne(sectionId);
227 -  
228 route.setId(sectionRouteId); 158 route.setId(sectionRouteId);
229 -  
230 route.setSectionrouteCode(sectionrouteCode); 159 route.setSectionrouteCode(sectionrouteCode);
231 -  
232 route.setLineCode(lineCode); 160 route.setLineCode(lineCode);
233 -  
234 route.setSectionCode(sectionCode); 161 route.setSectionCode(sectionCode);
235 -  
236 route.setDirections(directions); 162 route.setDirections(directions);
237 -  
238 route.setVersions(version); 163 route.setVersions(version);
239 -  
240 route.setDestroy(destroy); 164 route.setDestroy(destroy);
241 -  
242 route.setDescriptions(descriptions); 165 route.setDescriptions(descriptions);
243 -  
244 route.setCreateBy(createBy); 166 route.setCreateBy(createBy);
245 -  
246 route.setUpdateBy(updateBy); 167 route.setUpdateBy(updateBy);
247 -  
248 route.setLine(line); 168 route.setLine(line);
249 -  
250 route.setSection(section); 169 route.setSection(section);
251 - 170 + route.setIsRoadeSpeed(isRoadeSpeed);
252 routeRepository.save(route); 171 routeRepository.save(route);
253 -  
254 resultMap.put("status", ResponseCode.SUCCESS); 172 resultMap.put("status", ResponseCode.SUCCESS);
255 -  
256 } catch (Exception e) { 173 } catch (Exception e) {
257 -  
258 resultMap.put("status", ResponseCode.ERROR); 174 resultMap.put("status", ResponseCode.ERROR);
259 -  
260 logger.error("save erro.", e); 175 logger.error("save erro.", e);
261 -  
262 } 176 }
263 -  
264 return resultMap; 177 return resultMap;
265 } 178 }
266 179
@@ -294,164 +207,105 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -294,164 +207,105 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
294 * @return map<SUCCESS:成功;ERROR:异常> 207 * @return map<SUCCESS:成功;ERROR:异常>
295 */ 208 */
296 @Override 209 @Override
  210 + @Transactional
297 public Map<String, Object> sectionSave(Map<String, Object> map) { 211 public Map<String, Object> sectionSave(Map<String, Object> map) {
298 -  
299 Map<String, Object> resultMap = new HashMap<String, Object>(); 212 Map<String, Object> resultMap = new HashMap<String, Object>();
300 -  
301 try { 213 try {
302 -  
303 - /** 线路ID */ 214 + // 线路ID.
304 Integer lineId = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString()); 215 Integer lineId = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString());
305 -  
306 - /** 线路编码 */ 216 + // 线路编码.
307 String lineCode = map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); 217 String lineCode = map.get("lineCode").equals("") ? "" : map.get("lineCode").toString();
308 - 218 + // 路段名称.
309 String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); 219 String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString();
310 - 220 + // 路段编码.
311 String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); 221 String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString();
312 - 222 + // 道路编码.
313 String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); 223 String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
314 - 224 + // 原始坐标类型.
315 String dbType = map.get("dbType").equals("") ? "" :map.get("dbType").toString(); 225 String dbType = map.get("dbType").equals("") ? "" :map.get("dbType").toString();
316 - 226 + // 路段几何图形坐标.
317 String sectionJSON = map.get("bsectionVector").equals("") ? "" : map.get("bsectionVector").toString(); 227 String sectionJSON = map.get("bsectionVector").equals("") ? "" : map.get("bsectionVector").toString();
318 - 228 + // 路段序号
319 String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" : map.get("sectionrouteCode").toString(); 229 String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" : map.get("sectionrouteCode").toString();
320 -  
321 - Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString());  
322 -  
323 - Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString());  
324 -  
325 - Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString());  
326 -  
327 - Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());  
328 -  
329 - Integer destroy = map.get("destroy").equals("") ? null : Integer.valueOf(map.get("destroy").toString());  
330 -  
331 - Integer directions = map.get("directions").equals("") ? null : Integer.valueOf(map.get("directions").toString());  
332 - 230 + // 路段时长.
  231 + Double sectionTime = map.get("sectionTime").equals("") ? 0.0d : Double.valueOf(map.get("sectionTime").toString());
  232 + // 路段距离.
  233 + Double sectionDistance = map.get("sectionDistance").equals("") ? 0.0d : Double.valueOf(map.get("sectionDistance").toString());
  234 + // 路段限速.
  235 + Double speedLimit = map.get("speedLimit").equals("") ? 0.0d : Double.valueOf(map.get("speedLimit").toString());
  236 + // 版本.
  237 + Integer versions = map.get("versions").equals("") ? 1 : Integer.valueOf(map.get("versions").toString());
  238 + // 是否撤销.
  239 + Integer destroy = map.get("destroy").equals("") ? 0 : Integer.valueOf(map.get("destroy").toString());
  240 + // 路段方向.
  241 + Integer directions = map.get("directions").equals("") ? 0 : Integer.valueOf(map.get("directions").toString());
  242 + // 描述与说明.
333 String descriptions = map.get("descriptions").equals("")? "" : map.get("descriptions").toString(); 243 String descriptions = map.get("descriptions").equals("")? "" : map.get("descriptions").toString();
334 -  
335 // 原始线状图形坐标集合 244 // 原始线状图形坐标集合
336 String sectionsBpoints = ""; 245 String sectionsBpoints = "";
337 -  
338 // WGS线状图形坐标集合 246 // WGS线状图形坐标集合
339 String sectionsWJPpoints = ""; 247 String sectionsWJPpoints = "";
340 -  
341 if(!sectionJSON.equals("")) { 248 if(!sectionJSON.equals("")) {
342 -  
343 // 转换成JSON数组 249 // 转换成JSON数组
344 JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); 250 JSONArray sectionsArray = JSONArray.parseArray(sectionJSON);
345 -  
346 // 遍历 251 // 遍历
347 for(int s = 0 ;s<sectionsArray.size();s++) { 252 for(int s = 0 ;s<sectionsArray.size();s++) {
348 -  
349 String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); 253 String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
350 -  
351 String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); 254 String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
352 -  
353 String WGSLngStr = ""; 255 String WGSLngStr = "";
354 -  
355 String WGSLatStr = ""; 256 String WGSLatStr = "";
356 -  
357 Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); 257 Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
358 -  
359 WGSLngStr = String.valueOf(resultPoint.getLng()); 258 WGSLngStr = String.valueOf(resultPoint.getLng());
360 -  
361 WGSLatStr = String.valueOf(resultPoint.getLat()); 259 WGSLatStr = String.valueOf(resultPoint.getLat());
362 -  
363 if(s==0) { 260 if(s==0) {
364 -  
365 sectionsBpoints = pointsLngStr + " " + pointsLatStr; 261 sectionsBpoints = pointsLngStr + " " + pointsLatStr;
366 -  
367 sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; 262 sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
368 -  
369 }else { 263 }else {
370 -  
371 sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; 264 sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
372 -  
373 sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; 265 sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
374 -  
375 } 266 }
376 -  
377 } 267 }
378 -  
379 } 268 }
380 -  
381 // WGS坐标点集合 269 // WGS坐标点集合
382 String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; 270 String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
383 -  
384 // 原坐标点集合 271 // 原坐标点集合
385 String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; 272 String bsectionVector = "LINESTRING(" + sectionsBpoints + ")";
386 -  
387 String crosesRoad=""; 273 String crosesRoad="";
388 -  
389 String endNode =""; 274 String endNode ="";
390 -  
391 String startNode=""; 275 String startNode="";
392 -  
393 String middleNode=""; 276 String middleNode="";
394 -  
395 String sectionType=""; 277 String sectionType="";
396 -  
397 String csectionVector=null; 278 String csectionVector=null;
398 -  
399 Integer id = Integer.valueOf(sectionCode); 279 Integer id = Integer.valueOf(sectionCode);
400 -  
401 repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, id); 280 repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, id);
402 -  
403 Section section = repository.findOne(id); 281 Section section = repository.findOne(id);
404 -  
405 Line line = lineRepository.findOne(lineId); 282 Line line = lineRepository.findOne(lineId);
406 -  
407 // 路段路由 283 // 路段路由
408 SectionRoute sectionRoute = new SectionRoute(); 284 SectionRoute sectionRoute = new SectionRoute();
409 -  
410 Integer routeCode = null; 285 Integer routeCode = null;
411 -  
412 if(!sectionrouteCode.equals("")){ 286 if(!sectionrouteCode.equals("")){
413 -  
414 String sectionrouteCodeArray[] = sectionrouteCode.split("_"); 287 String sectionrouteCodeArray[] = sectionrouteCode.split("_");
415 -  
416 routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1; 288 routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1;
417 -  
418 }else { 289 }else {
419 -  
420 routeCode = 100; 290 routeCode = 100;
421 -  
422 } 291 }
423 - 292 + routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode);
424 sectionRoute.setSectionrouteCode(routeCode); 293 sectionRoute.setSectionrouteCode(routeCode);
425 -  
426 sectionRoute.setLineCode(lineCode); 294 sectionRoute.setLineCode(lineCode);
427 -  
428 sectionRoute.setSection(section); 295 sectionRoute.setSection(section);
429 -  
430 sectionRoute.setSectionCode(sectionCode); 296 sectionRoute.setSectionCode(sectionCode);
431 -  
432 sectionRoute.setDirections(directions); 297 sectionRoute.setDirections(directions);
433 -  
434 sectionRoute.setDescriptions(descriptions); 298 sectionRoute.setDescriptions(descriptions);
435 -  
436 sectionRoute.setDestroy(destroy); 299 sectionRoute.setDestroy(destroy);
437 -  
438 sectionRoute.setVersions(versions); 300 sectionRoute.setVersions(versions);
439 -  
440 sectionRoute.setLine(line); 301 sectionRoute.setLine(line);
441 - 302 + sectionRoute.setIsRoadeSpeed(0);
442 routeRepository.save(sectionRoute); 303 routeRepository.save(sectionRoute);
443 -  
444 resultMap.put("status", ResponseCode.SUCCESS); 304 resultMap.put("status", ResponseCode.SUCCESS);
445 -  
446 } catch (Exception e) { 305 } catch (Exception e) {
447 -  
448 resultMap.put("status", ResponseCode.ERROR); 306 resultMap.put("status", ResponseCode.ERROR);
449 -  
450 logger.error("save erro.", e); 307 logger.error("save erro.", e);
451 -  
452 } 308 }
453 -  
454 return resultMap; 309 return resultMap;
455 } 310 }
456 -  
457 -} 311 +}
458 \ No newline at end of file 312 \ No newline at end of file
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -4,6 +4,7 @@ import com.bsth.common.ResponseCode; @@ -4,6 +4,7 @@ import com.bsth.common.ResponseCode;
4 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
5 import com.bsth.entity.Station; 5 import com.bsth.entity.Station;
6 import com.bsth.entity.StationRoute; 6 import com.bsth.entity.StationRoute;
  7 +import com.bsth.entity.search.CustomerSpecs;
7 import com.bsth.repository.LineRepository; 8 import com.bsth.repository.LineRepository;
8 import com.bsth.repository.SectionRouteRepository; 9 import com.bsth.repository.SectionRouteRepository;
9 import com.bsth.repository.StationRepository; 10 import com.bsth.repository.StationRepository;
@@ -16,6 +17,8 @@ import com.bsth.util.Geo.Point; @@ -16,6 +17,8 @@ import com.bsth.util.Geo.Point;
16 import com.bsth.util.db.DBUtils_MS; 17 import com.bsth.util.db.DBUtils_MS;
17 import com.google.common.base.Splitter; 18 import com.google.common.base.Splitter;
18 import org.springframework.beans.factory.annotation.Autowired; 19 import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.data.domain.Sort;
  21 +import org.springframework.data.domain.Sort.Direction;
19 import org.springframework.stereotype.Service; 22 import org.springframework.stereotype.Service;
20 import org.springframework.transaction.annotation.Transactional; 23 import org.springframework.transaction.annotation.Transactional;
21 24
@@ -56,6 +59,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -56,6 +59,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
56 @Autowired 59 @Autowired
57 private StationRepository stationRepository; 60 private StationRepository stationRepository;
58 61
  62 + @Override
  63 + public Iterable<StationRoute> list(Map<String, Object> map) {
  64 + List<Sort.Order> orderList = new ArrayList<>();
  65 + orderList.add(new Sort.Order(Direction.ASC, "directions"));
  66 + orderList.add(new Sort.Order(Direction.ASC, "stationRouteCode"));
  67 + return repository.findAll(new CustomerSpecs<StationRoute>(map), new Sort(orderList));
  68 + }
  69 +
59 /** 70 /**
60 * @Description :TODO(查询树站点与路段数据) 71 * @Description :TODO(查询树站点与路段数据)
61 * 72 *
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -31,6 +31,8 @@ import com.bsth.service.StationService; @@ -31,6 +31,8 @@ import com.bsth.service.StationService;
31 import com.bsth.util.GetUIDAndCode; 31 import com.bsth.util.GetUIDAndCode;
32 import com.bsth.util.TransGPS; 32 import com.bsth.util.TransGPS;
33 import com.bsth.util.TransGPS.Location; 33 import com.bsth.util.TransGPS.Location;
  34 +import com.bsth.util.Geo.GeoUtils;
  35 +import com.bsth.util.Geo.Point;
34 36
35 /** 37 /**
36 * 38 *
@@ -82,62 +84,41 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -82,62 +84,41 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
82 */ 84 */
83 @Override 85 @Override
84 public Map<String, Object> systemSaveStations(Map<String, Object> map) { 86 public Map<String, Object> systemSaveStations(Map<String, Object> map) {
85 -  
86 Map<String, Object> resultMap = new HashMap<String,Object>(); 87 Map<String, Object> resultMap = new HashMap<String,Object>();
87 -  
88 try { 88 try {
89 -  
90 // 站点信息字符传 89 // 站点信息字符传
91 String stationJSON = map.get("stationJSON").toString().equals("") ? "" : map.get("stationJSON").toString(); 90 String stationJSON = map.get("stationJSON").toString().equals("") ? "" : map.get("stationJSON").toString();
92 -  
93 // 路段信息字符串 91 // 路段信息字符串
94 String sectionJSON = map.get("sectionJSON").toString().equals("") ? "" : map.get("sectionJSON").toString(); 92 String sectionJSON = map.get("sectionJSON").toString().equals("") ? "" : map.get("sectionJSON").toString();
95 -  
96 // 方向 93 // 方向
97 int directions = Integer.parseInt(map.get("directions").toString()); 94 int directions = Integer.parseInt(map.get("directions").toString());
98 -  
99 // 是否撤销 95 // 是否撤销
100 int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); 96 int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString());
101 -  
102 // 版本 97 // 版本
103 int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString()); 98 int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString());
104 -  
105 // 坐标类型 99 // 坐标类型
106 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); 100 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
107 -  
108 // 限速 101 // 限速
109 String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString(); 102 String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString();
110 -  
111 // 线路ID 103 // 线路ID
112 int lineId = map.get("lineId").toString().equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); 104 int lineId = map.get("lineId").toString().equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
113 -  
114 // 半径 105 // 半径
115 int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString()); 106 int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());
116 -  
117 // 图形类型 107 // 图形类型
118 String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); 108 String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
119 -  
120 // 路段距离 109 // 路段距离
121 Double sectionDistance = 0.0d; 110 Double sectionDistance = 0.0d;
122 -  
123 // 路段时长 111 // 路段时长
124 Double sectionDuration = 0.0d; 112 Double sectionDuration = 0.0d;
125 -  
126 // 里程(上或者下) 113 // 里程(上或者下)
127 double sumUpOrDownMileage = 0.0d; 114 double sumUpOrDownMileage = 0.0d;
128 -  
129 // 线路信息 115 // 线路信息
130 Line resultLine = lineRepository.findOne(lineId); 116 Line resultLine = lineRepository.findOne(lineId);
131 -  
132 Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); 117 Map<String, Object> resultSaveMapm = new HashMap<String,Object>();
133 -  
134 String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); 118 String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString();
135 -  
136 if(!stationJSON.equals("")) { 119 if(!stationJSON.equals("")) {
137 -  
138 // 保存站点与站点路由信息 120 // 保存站点与站点路由信息
139 resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); 121 resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes);
140 -  
141 } 122 }
142 123
143 // 路段长度 124 // 路段长度
@@ -259,275 +240,148 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -259,275 +240,148 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
259 * @throws Exception 240 * @throws Exception
260 */ 241 */
261 public Map<String, Object> savaStationAndStationRouteInfo(String stationJSON,double sectionDistance,double sectionDuration,String dbType, 242 public Map<String, Object> savaStationAndStationRouteInfo(String stationJSON,double sectionDistance,double sectionDuration,String dbType,
262 -  
263 int radius,String shapesType,int destroy,int versions,double sumUpOrDownMileage,int directions,Line resultLine,String baseRes) throws Exception{ 243 int radius,String shapesType,int destroy,int versions,double sumUpOrDownMileage,int directions,Line resultLine,String baseRes) throws Exception{
264 -  
265 Map<String, Object> paramsMeleageAndDistncDura = new HashMap<String,Object>(); 244 Map<String, Object> paramsMeleageAndDistncDura = new HashMap<String,Object>();
266 -  
267 JSONArray stationsArray = JSONArray.parseArray(stationJSON); 245 JSONArray stationsArray = JSONArray.parseArray(stationJSON);
268 -  
269 if(stationsArray.size()>0) { 246 if(stationsArray.size()>0) {
270 -  
271 for(int i = 0;i <stationsArray.size();i++) { 247 for(int i = 0;i <stationsArray.size();i++) {
272 -  
273 // 站点名称 248 // 站点名称
274 String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); 249 String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString();
275 -  
276 Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString()); 250 Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString());
277 -  
278 // 转成公里 251 // 转成公里
279 distance = distance/1000; 252 distance = distance/1000;
280 -  
281 BigDecimal d = new BigDecimal(distance); 253 BigDecimal d = new BigDecimal(distance);
282 -  
283 distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 254 distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
284 -  
285 sectionDistance= distance + sectionDistance; 255 sectionDistance= distance + sectionDistance;
286 -  
287 Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString()); 256 Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString());
288 -  
289 // 转成分钟 257 // 转成分钟
290 duration = duration/60; 258 duration = duration/60;
291 -  
292 BigDecimal t = new BigDecimal(duration); 259 BigDecimal t = new BigDecimal(duration);
293 -  
294 duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 260 duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
295 -  
296 sectionDuration = duration + sectionDuration; 261 sectionDuration = duration + sectionDuration;
297 -  
298 // 百度经纬度坐标 262 // 百度经纬度坐标
299 String bJwpoints = ""; 263 String bJwpoints = "";
300 -  
301 // 百度坐标经度 264 // 百度坐标经度
302 String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString(); 265 String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString();
303 - 266 + bLonx = bLonx==null || bLonx.equals("") ? "0" : bLonx;
304 // 百度坐标纬度 267 // 百度坐标纬度
305 String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString(); 268 String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString();
306 - 269 + bLatx = bLatx==null || bLatx.equals("") ? "0" : bLatx;
307 List<Object[]> stationNameList = repository.findStationName(stationName); 270 List<Object[]> stationNameList = repository.findStationName(stationName);
308 -  
309 - boolean isHave = isHaveStationname(bJwpoints,stationNameList);  
310 - 271 + Map<String, Object> isHaveMap = isHaveStationname(bLonx,bLatx,stationNameList);
311 // 初始化站点对象 272 // 初始化站点对象
312 Station arg0 = new Station(); 273 Station arg0 = new Station();
313 -  
314 - // 站点编码  
315 - long stationCode = 0L;  
316 -  
317 - if(isHave) {  
318 -  
319 - Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());  
320 - 274 + if(Boolean.parseBoolean(isHaveMap.get("isHave").toString())) {
  275 + /*Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());*/
  276 + Integer stationId = Integer.parseInt(isHaveMap.get("id").toString());
321 arg0 = repository.findOne(stationId); 277 arg0 = repository.findOne(stationId);
322 -  
323 }else { 278 }else {
324 -  
325 - stationCode = GetUIDAndCode.getStationId();  
326 - 279 + // 站点编码
  280 + long stationCode = GetUIDAndCode.getStationId();
327 arg0.setStationCod(String.valueOf(stationCode)); 281 arg0.setStationCod(String.valueOf(stationCode));
328 -  
329 arg0.setId((int)stationCode); 282 arg0.setId((int)stationCode);
330 -  
331 arg0.setStationName(stationName); 283 arg0.setStationName(stationName);
332 -  
333 // 原坐标类型 284 // 原坐标类型
334 arg0.setDbType(dbType); 285 arg0.setDbType(dbType);
335 -  
336 -  
337 String gLonxStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").toString(); 286 String gLonxStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").toString();
338 -  
339 String gLatyStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").toString(); 287 String gLatyStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").toString();
340 -  
341 float gLonx = 0.0f; 288 float gLonx = 0.0f;
342 -  
343 float gLaty = 0.0f; 289 float gLaty = 0.0f;
344 -  
345 Location resultPoint = null; 290 Location resultPoint = null;
346 -  
347 if(baseRes.equals("No")){ 291 if(baseRes.equals("No")){
348 -  
349 /** BD to WGS坐标 */ 292 /** BD to WGS坐标 */
350 resultPoint = FromBDPointToWGSPoint(bLonx,bLatx); 293 resultPoint = FromBDPointToWGSPoint(bLonx,bLatx);
351 -  
352 if(gLonxStr==null) 294 if(gLonxStr==null)
353 gLonx = (float)resultPoint.getLng(); 295 gLonx = (float)resultPoint.getLng();
354 else 296 else
355 gLonx = Float.valueOf(gLonxStr); 297 gLonx = Float.valueOf(gLonxStr);
356 -  
357 if(gLatyStr==null) 298 if(gLatyStr==null)
358 gLaty = (float)resultPoint.getLat(); 299 gLaty = (float)resultPoint.getLat();
359 else 300 else
360 gLaty = Float.valueOf(gLatyStr); 301 gLaty = Float.valueOf(gLatyStr);
361 -  
362 arg0.setgLonx(gLonx); 302 arg0.setgLonx(gLonx);
363 -  
364 arg0.setgLaty(gLaty); 303 arg0.setgLaty(gLaty);
365 -  
366 // 百度经纬度 304 // 百度经纬度
367 bJwpoints = bLonx + " " + bLatx; 305 bJwpoints = bLonx + " " + bLatx;
368 -  
369 arg0.setbJwpoints(bJwpoints); 306 arg0.setbJwpoints(bJwpoints);
370 -  
371 }else if(baseRes.equals("GCJ02")){ 307 }else if(baseRes.equals("GCJ02")){
372 -  
373 Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); 308 Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr));
374 -  
375 Location location = TransGPS.bd_encrypt(bdLoc); 309 Location location = TransGPS.bd_encrypt(bdLoc);
376 -  
377 String GCJLng = String.valueOf(location.getLng()); 310 String GCJLng = String.valueOf(location.getLng());
378 -  
379 String GCJLat = String.valueOf(location.getLat()); 311 String GCJLat = String.valueOf(location.getLat());
380 -  
381 resultPoint = FromBDPointToWGSPoint(GCJLng,GCJLat); 312 resultPoint = FromBDPointToWGSPoint(GCJLng,GCJLat);
382 -  
383 bJwpoints = GCJLng + " " +GCJLat; 313 bJwpoints = GCJLng + " " +GCJLat;
384 -  
385 arg0.setgLonx((float)location.getLng()); 314 arg0.setgLonx((float)location.getLng());
386 -  
387 arg0.setgLaty((float)location.getLat()); 315 arg0.setgLaty((float)location.getLat());
388 -  
389 arg0.setbJwpoints(bJwpoints); 316 arg0.setbJwpoints(bJwpoints);
390 -  
391 -  
392 }else if(baseRes.equals("BD09")){ 317 }else if(baseRes.equals("BD09")){
393 -  
394 resultPoint = FromBDPointToWGSPoint(gLonxStr, gLatyStr); 318 resultPoint = FromBDPointToWGSPoint(gLonxStr, gLatyStr);
395 -  
396 bJwpoints = gLonxStr+ " " + gLatyStr; 319 bJwpoints = gLonxStr+ " " + gLatyStr;
397 -  
398 arg0.setgLonx((float)resultPoint.getLng()); 320 arg0.setgLonx((float)resultPoint.getLng());
399 -  
400 arg0.setgLaty((float)resultPoint.getLat()); 321 arg0.setgLaty((float)resultPoint.getLat());
401 -  
402 }else if(baseRes.equals("WGS84")){ 322 }else if(baseRes.equals("WGS84")){
403 -  
404 Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); 323 Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr));
405 -  
406 Location gcjLoc = TransGPS.transformFromWGSToGCJ(bdLoc); 324 Location gcjLoc = TransGPS.transformFromWGSToGCJ(bdLoc);
407 -  
408 Location bdEn = TransGPS.bd_encrypt(gcjLoc); 325 Location bdEn = TransGPS.bd_encrypt(gcjLoc);
409 -  
410 bJwpoints = String.valueOf(bdEn.getLng()) + " " + String.valueOf(bdEn.getLat()); 326 bJwpoints = String.valueOf(bdEn.getLng()) + " " + String.valueOf(bdEn.getLat());
411 -  
412 arg0.setbJwpoints(bJwpoints); 327 arg0.setbJwpoints(bJwpoints);
413 -  
414 arg0.setgLonx(Float.valueOf(gLonxStr)); 328 arg0.setgLonx(Float.valueOf(gLonxStr));
415 -  
416 arg0.setgLaty(Float.valueOf(gLatyStr)); 329 arg0.setgLaty(Float.valueOf(gLatyStr));
417 -  
418 } 330 }
419 -  
420 -  
421 -  
422 - /* if(gLonxStr==null)  
423 - gLonx = (float)resultPoint.getLng();  
424 - else  
425 - gLonx = Float.valueOf(gLonxStr);  
426 -  
427 - if(gLatyStr==null)  
428 - gLaty = (float)resultPoint.getLat();  
429 - else  
430 - gLaty = Float.valueOf(gLatyStr);  
431 -  
432 - arg0.setgLonx(gLonx);  
433 -  
434 - arg0.setgLaty(gLaty);*/  
435 -  
436 - // 站点地理位置WGS坐标经度  
437 - // String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();  
438 - // arg0.setgLonx(Float.parseFloat(gLonx));  
439 -  
440 - // 站点地理位置WGS坐标纬度  
441 - // String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();  
442 - // arg0.setgLaty(Float.parseFloat(gLaty));  
443 -  
444 arg0.setRadius(radius); 331 arg0.setRadius(radius);
445 -  
446 -  
447 arg0.setShapesType(shapesType); 332 arg0.setShapesType(shapesType);
448 -  
449 // 是否想撤销 333 // 是否想撤销
450 arg0.setDestroy(destroy); 334 arg0.setDestroy(destroy);
451 -  
452 // 版本号 335 // 版本号
453 arg0.setVersions(versions); 336 arg0.setVersions(versions);
454 -  
455 /*arg0.setbJwpoints(bJwpoints);*/ 337 /*arg0.setbJwpoints(bJwpoints);*/
456 -  
457 // 插入站点信息 338 // 插入站点信息
458 repository.save(arg0); 339 repository.save(arg0);
459 340
460 } 341 }
461 -  
462 // 站点路由对象 342 // 站点路由对象
463 StationRoute route = new StationRoute(); 343 StationRoute route = new StationRoute();
464 -  
465 // 站点名称 344 // 站点名称
466 route.setStationName(stationName); 345 route.setStationName(stationName);
467 -  
468 route.setDistances(distance); 346 route.setDistances(distance);
469 -  
470 sumUpOrDownMileage = sumUpOrDownMileage + distance; 347 sumUpOrDownMileage = sumUpOrDownMileage + distance;
471 -  
472 route.setToTime(duration); 348 route.setToTime(duration);
473 -  
474 -  
475 // 站点编码 349 // 站点编码
476 route.setStationCode(arg0.getStationCod()); 350 route.setStationCode(arg0.getStationCod());
477 -  
478 // 站点序号 351 // 站点序号
479 route.setStationRouteCode((i+1)*100); 352 route.setStationRouteCode((i+1)*100);
480 -  
481 // 站点类型 353 // 站点类型
482 if(i==0) { 354 if(i==0) {
483 -  
484 // 起始站 355 // 起始站
485 route.setStationMark("B"); 356 route.setStationMark("B");
486 -  
487 }else if(i==stationsArray.size()-1) { 357 }else if(i==stationsArray.size()-1) {
488 -  
489 // 终点站 358 // 终点站
490 route.setStationMark("E"); 359 route.setStationMark("E");
491 -  
492 }else { 360 }else {
493 -  
494 // 中途站 361 // 中途站
495 route.setStationMark("Z"); 362 route.setStationMark("Z");
496 -  
497 } 363 }
498 -  
499 // 版本号 364 // 版本号
500 route.setVersions(versions); 365 route.setVersions(versions);
501 -  
502 // 站点ID 366 // 站点ID
503 route.setStation(arg0); 367 route.setStation(arg0);
504 -  
505 // 方向 368 // 方向
506 route.setDirections(directions); 369 route.setDirections(directions);
507 -  
508 // 线路ID 370 // 线路ID
509 route.setLine(resultLine); 371 route.setLine(resultLine);
510 -  
511 // 线路编码 372 // 线路编码
512 route.setLineCode(resultLine.getLineCode()); 373 route.setLineCode(resultLine.getLineCode());
513 -  
514 route.setDestroy(destroy); 374 route.setDestroy(destroy);
515 -  
516 // 插入站点路由信息 375 // 插入站点路由信息
517 routeRepository.save(route); 376 routeRepository.save(route);
518 377
519 } 378 }
520 -  
521 paramsMeleageAndDistncDura.put("sumUpOrDownMileage", sumUpOrDownMileage); 379 paramsMeleageAndDistncDura.put("sumUpOrDownMileage", sumUpOrDownMileage);
522 -  
523 paramsMeleageAndDistncDura.put("sectionDistance", sectionDistance); 380 paramsMeleageAndDistncDura.put("sectionDistance", sectionDistance);
524 -  
525 paramsMeleageAndDistncDura.put("sectionDuration", sectionDuration); 381 paramsMeleageAndDistncDura.put("sectionDuration", sectionDuration);
526 - 382 + paramsMeleageAndDistncDura.put("stationdata",stationsArray);
527 } 383 }
528 -  
529 return paramsMeleageAndDistncDura; 384 return paramsMeleageAndDistncDura;
530 -  
531 } 385 }
532 386
533 /** 387 /**
@@ -784,68 +638,52 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -784,68 +638,52 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
784 638
785 639
786 Section section = sectionRepository.findOne(sectionid); 640 Section section = sectionRepository.findOne(sectionid);
787 -  
788 // 路段路由 641 // 路段路由
789 SectionRoute sectionRoute = new SectionRoute(); 642 SectionRoute sectionRoute = new SectionRoute();
790 -  
791 // 路段序号 643 // 路段序号
792 sectionRoute.setSectionrouteCode(100); 644 sectionRoute.setSectionrouteCode(100);
793 -  
794 // 线路编码 645 // 线路编码
795 sectionRoute.setLineCode(resultLine.getLineCode()); 646 sectionRoute.setLineCode(resultLine.getLineCode());
796 -  
797 // 路段ID 647 // 路段ID
798 sectionRoute.setSection(section); 648 sectionRoute.setSection(section);
799 -  
800 sectionRoute.setDestroy(destroy); 649 sectionRoute.setDestroy(destroy);
801 -  
802 // 线路ID 650 // 线路ID
803 sectionRoute.setLine(resultLine); 651 sectionRoute.setLine(resultLine);
804 -  
805 // 路段编码 652 // 路段编码
806 sectionRoute.setSectionCode(sectionCode); 653 sectionRoute.setSectionCode(sectionCode);
807 -  
808 // 版本 654 // 版本
809 sectionRoute.setVersions(versions); 655 sectionRoute.setVersions(versions);
810 -  
811 // 方向 656 // 方向
812 sectionRoute.setDirections(directions); 657 sectionRoute.setDirections(directions);
813 -  
814 // 路段路由保存 658 // 路段路由保存
815 sectionRouteRepository.save(sectionRoute); 659 sectionRouteRepository.save(sectionRoute);
816 660
817 } 661 }
818 -  
819 - public boolean isHaveStationname(String bJwpoints,List<Object[]> stationNameList) {  
820 -  
821 - boolean temp = true;  
822 - 662 + public Map<String, Object> isHaveStationname(String jd,String wd,List<Object[]> stationNameList) {
  663 + Map<String, Object> rsM = new HashMap<String ,Object>();
  664 + boolean temp = false;
823 if(stationNameList.size()>0) { 665 if(stationNameList.size()>0) {
824 -  
825 - for(int k = 0 ; k <stationNameList.size();k++) {  
826 -  
827 - if(bJwpoints.equals(stationNameList.get(k)[0])){  
828 -  
829 - return temp;  
830 -  
831 - }else {  
832 -  
833 - temp = false;  
834 - 666 + if(jd.equals("0") || wd.equals("0")) {
  667 + rsM.put("id", stationNameList.get(0)[1]);
  668 + temp = true;
  669 + }else{
  670 + Point p1 = new Point(Double.parseDouble(jd),Double.parseDouble(wd));
  671 + for(int k = 0 ; k <stationNameList.size();k++) {
  672 + String bJwpoints[] = stationNameList.get(k)[0].toString().split(" ");
  673 + Point p2 = new Point(Double.parseDouble(bJwpoints[0]),Double.parseDouble(bJwpoints[1]));
  674 + double jl = GeoUtils.getDistance(p1, p2);
  675 + if(jl<=120d) {
  676 + rsM.put("id", stationNameList.get(k)[1]);
  677 + temp = true;
  678 + break;
  679 + }
835 } 680 }
836 -  
837 } 681 }
838 -  
839 - }else {  
840 -  
841 - temp = false;  
842 - }  
843 -  
844 - return temp; 682 + }
  683 + rsM.put("isHave", temp);
  684 + return rsM;
845 } 685 }
846 686
847 -  
848 -  
849 /** 687 /**
850 * @Description :TODO(新增站点保存) 688 * @Description :TODO(新增站点保存)
851 * 689 *
@@ -863,246 +701,134 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -863,246 +701,134 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
863 */ 701 */
864 @Override 702 @Override
865 public Map<String, Object> stationSaveMap(Map<String, Object> map) { 703 public Map<String, Object> stationSaveMap(Map<String, Object> map) {
866 -  
867 Map<String, Object> resultMap = new HashMap<String, Object>(); 704 Map<String, Object> resultMap = new HashMap<String, Object>();
868 -  
869 try { 705 try {
870 -  
871 // 站点编码 706 // 站点编码
872 String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); 707 String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString();
873 -  
874 // 站点ID 708 // 站点ID
875 int stationId = Integer.valueOf(stationCod); 709 int stationId = Integer.valueOf(stationCod);
876 -  
877 // 站点名称 710 // 站点名称
878 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); 711 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
879 -  
880 // 道路编码 712 // 道路编码
881 String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); 713 String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
882 -  
883 // 原坐标类型 714 // 原坐标类型
884 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); 715 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
885 -  
886 // 原坐标点 716 // 原坐标点
887 String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString(); 717 String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString();
888 -  
889 String bJwpointsArray[] = null; 718 String bJwpointsArray[] = null;
890 -  
891 if(bJwpoints!=null) { 719 if(bJwpoints!=null) {
892 -  
893 bJwpointsArray = bJwpoints.split(" "); 720 bJwpointsArray = bJwpoints.split(" ");
894 -  
895 } 721 }
896 -  
897 // WGS经纬度 722 // WGS经纬度
898 Float gLonx = null; 723 Float gLonx = null;
899 -  
900 // WGS纬度 724 // WGS纬度
901 Float gLaty = null; 725 Float gLaty = null;
902 -  
903 if(bJwpointsArray.length>0) { 726 if(bJwpointsArray.length>0) {
904 -  
905 Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); 727 Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]);
906 -  
907 gLonx = (float)resultPoint.getLng(); 728 gLonx = (float)resultPoint.getLng();
908 -  
909 gLaty = (float)resultPoint.getLat(); 729 gLaty = (float)resultPoint.getLat();
910 -  
911 } 730 }
912 -  
913 - /*// WGS经纬度  
914 - String gJwpoints = map.get("gJwpoints").equals("") ? null : map.get("gJwpoints").toString();  
915 -  
916 - String gJwpointsArray []= null;  
917 -  
918 - if(gJwpoints!=null) {  
919 -  
920 - gJwpointsArray = gJwpoints.split(" ");  
921 -  
922 - }*/  
923 -  
924 // 方向 731 // 方向
925 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); 732 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
926 -  
927 // 距离 733 // 距离
928 Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); 734 Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString());
929 -  
930 // 时间 735 // 时间
931 Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); 736 Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString());
932 -  
933 - /*// WGS经纬度  
934 - Float gLonx = Float.parseFloat(gJwpointsArray[0]);  
935 -  
936 - // WGS纬度  
937 - Float gLaty = Float.parseFloat(gJwpointsArray[1]);*/  
938 -  
939 // 城建坐标经度 737 // 城建坐标经度
940 Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); 738 Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString());
941 -  
942 // 城建坐标纬度 739 // 城建坐标纬度
943 Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); 740 Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString());
944 -  
945 - // 多边形WGS坐标点集合  
946 - // String gPloygonGrid = map.get("gPolygonGrid").equals("") ? "" : map.get("gPolygonGrid").toString();  
947 -  
948 // 多边形原坐标点集合 741 // 多边形原坐标点集合
949 String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); 742 String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString();
950 -  
951 // 多边形WGS坐标点集合 743 // 多边形WGS坐标点集合
952 String gPloygonGrid =""; 744 String gPloygonGrid ="";
953 -  
954 if(!bPloygonGrid.equals("")) { 745 if(!bPloygonGrid.equals("")) {
955 -  
956 String bPloygonGridArray[] = bPloygonGrid.split(","); 746 String bPloygonGridArray[] = bPloygonGrid.split(",");
957 -  
958 int bLen_ = bPloygonGridArray.length; 747 int bLen_ = bPloygonGridArray.length;
959 -  
960 for(int b = 0 ;b<bLen_;b++) { 748 for(int b = 0 ;b<bLen_;b++) {
961 -  
962 String tempArray[]= bPloygonGridArray[b].split(" "); 749 String tempArray[]= bPloygonGridArray[b].split(" ");
963 -  
964 Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); 750 Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]);
965 -  
966 if(b==0) { 751 if(b==0) {
967 -  
968 gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); 752 gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat());
969 -  
970 }else { 753 }else {
971 -  
972 gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); 754 gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat());
973 -  
974 } 755 }
975 -  
976 } 756 }
977 -  
978 } 757 }
979 -  
980 - /* bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";  
981 -  
982 - gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";*/  
983 -  
984 // 是否撤销 758 // 是否撤销
985 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); 759 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
986 -  
987 // 圆半径 760 // 圆半径
988 Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); 761 Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString());
989 -  
990 // 图形类型 762 // 图形类型
991 String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); 763 String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
992 -  
993 // 版本 764 // 版本
994 Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); 765 Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString());
995 -  
996 // 说明 766 // 说明
997 String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); 767 String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
998 -  
999 // 创建人 768 // 创建人
1000 Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); 769 Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString());
1001 -  
1002 // 修改人 770 // 修改人
1003 Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); 771 Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString());
1004 -  
1005 // 线路ID 772 // 线路ID
1006 int line = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); 773 int line = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
1007 -  
1008 // 线路信息 774 // 线路信息
1009 Line resultLine = lineRepository.findOne(line); 775 Line resultLine = lineRepository.findOne(line);
1010 -  
1011 // 站点路由序号 776 // 站点路由序号
1012 String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString(); 777 String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString();
1013 -  
1014 // 站点类型 778 // 站点类型
1015 String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString(); 779 String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString();
1016 -  
1017 Integer stationRouteCode = null; 780 Integer stationRouteCode = null;
1018 -  
1019 if(stationRouteCodeStr!="") { 781 if(stationRouteCodeStr!="") {
1020 -  
1021 String stationRouteCodeArray [] = stationRouteCodeStr.split("_"); 782 String stationRouteCodeArray [] = stationRouteCodeStr.split("_");
1022 -  
1023 stationRouteCode = Integer.parseInt(stationRouteCodeArray[0].toString())+1; 783 stationRouteCode = Integer.parseInt(stationRouteCodeArray[0].toString())+1;
1024 -  
1025 -  
1026 }else { 784 }else {
1027 -  
1028 stationRouteCode = 100; 785 stationRouteCode = 100;
1029 -  
1030 } 786 }
1031 -  
1032 if(bPloygonGrid.equals("")) 787 if(bPloygonGrid.equals(""))
1033 bPloygonGrid = null; 788 bPloygonGrid = null;
1034 else 789 else
1035 bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; 790 bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
1036 -  
1037 if(gPloygonGrid.equals("")) 791 if(gPloygonGrid.equals(""))
1038 gPloygonGrid = null; 792 gPloygonGrid = null;
1039 else 793 else
1040 gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; 794 gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
1041 -  
1042 // 保存站点 795 // 保存站点
1043 repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints, 796 repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints,
1044 -  
1045 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, 797 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius,
1046 -  
1047 shapesType, versions, descriptions, createBy, updateBy,stationId); 798 shapesType, versions, descriptions, createBy, updateBy,stationId);
1048 -  
1049 -  
1050 -  
1051 -  
1052 Station station = repository.findOne(stationId); 799 Station station = repository.findOne(stationId);
1053 -  
1054 StationRoute arg0 = new StationRoute(); 800 StationRoute arg0 = new StationRoute();
1055 -  
1056 // 线路 801 // 线路
1057 arg0.setLine(resultLine); 802 arg0.setLine(resultLine);
1058 -  
1059 arg0.setLineCode(resultLine.getLineCode()); 803 arg0.setLineCode(resultLine.getLineCode());
1060 -  
1061 // 站点 804 // 站点
1062 arg0.setStation(station); 805 arg0.setStation(station);
1063 -  
1064 // 站点路由名称 806 // 站点路由名称
1065 arg0.setStationName(stationName); 807 arg0.setStationName(stationName);
1066 -  
1067 // 站点路由编码 808 // 站点路由编码
1068 arg0.setStationCode(stationCod); 809 arg0.setStationCode(stationCod);
1069 -  
1070 // 站点路由序号 810 // 站点路由序号
1071 arg0.setStationRouteCode(stationRouteCode); 811 arg0.setStationRouteCode(stationRouteCode);
1072 -  
1073 // 站点路由类型 812 // 站点路由类型
1074 arg0.setStationMark(stationMark); 813 arg0.setStationMark(stationMark);
1075 -  
1076 // 站点路由站点方向 814 // 站点路由站点方向
1077 arg0.setDirections(directions); 815 arg0.setDirections(directions);
1078 -  
1079 // 站点路由到站距离 816 // 站点路由到站距离
1080 arg0.setDistances(distances); 817 arg0.setDistances(distances);
1081 -  
1082 // 站点路由到站时间 818 // 站点路由到站时间
1083 arg0.setToTime(toTime); 819 arg0.setToTime(toTime);
1084 -  
1085 // 站点版本号 820 // 站点版本号
1086 arg0.setVersions(versions); 821 arg0.setVersions(versions);
1087 -  
1088 // 是否撤销 822 // 是否撤销
1089 arg0.setDestroy(destroy); 823 arg0.setDestroy(destroy);
1090 -  
1091 // 站点路由说明 824 // 站点路由说明
1092 arg0.setDescriptions(descriptions); 825 arg0.setDescriptions(descriptions);
1093 -  
1094 routeRepository.save(arg0); 826 routeRepository.save(arg0);
1095 -  
1096 resultMap.put("status", ResponseCode.SUCCESS); 827 resultMap.put("status", ResponseCode.SUCCESS);
1097 -  
1098 } catch (Exception e) { 828 } catch (Exception e) {
1099 -  
1100 resultMap.put("status", ResponseCode.ERROR); 829 resultMap.put("status", ResponseCode.ERROR);
1101 -  
1102 logger.error("save erro.", e); 830 logger.error("save erro.", e);
1103 -  
1104 } 831 }
1105 -  
1106 return resultMap; 832 return resultMap;
1107 } 833 }
1108 834
@@ -1373,101 +1099,64 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1373,101 +1099,64 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1373 1099
1374 @Override 1100 @Override
1375 public Map<String, Object> manualSave(Map<String, Object> map) { 1101 public Map<String, Object> manualSave(Map<String, Object> map) {
1376 -  
1377 Map<String, Object> resultMap = new HashMap<String,Object>(); 1102 Map<String, Object> resultMap = new HashMap<String,Object>();
1378 -  
1379 try { 1103 try {
1380 -  
1381 // 站点信息字符传 1104 // 站点信息字符传
1382 String stationJSON = map.get("stationJSON").equals("") ? "" : map.get("stationJSON").toString(); 1105 String stationJSON = map.get("stationJSON").equals("") ? "" : map.get("stationJSON").toString();
1383 -  
1384 // 路段信息字符串 1106 // 路段信息字符串
1385 String sectionJSON = map.get("sectionJSON").equals("") ? "" : map.get("sectionJSON").toString(); 1107 String sectionJSON = map.get("sectionJSON").equals("") ? "" : map.get("sectionJSON").toString();
1386 -  
1387 // 方向 1108 // 方向
1388 int directions = Integer.parseInt(map.get("directions").toString()); 1109 int directions = Integer.parseInt(map.get("directions").toString());
1389 -  
1390 // 是否撤销 1110 // 是否撤销
1391 int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); 1111 int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString());
1392 -  
1393 // 版本 1112 // 版本
1394 int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString()); 1113 int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString());
1395 -  
1396 // 坐标类型 1114 // 坐标类型
1397 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); 1115 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
1398 -  
1399 // 限速 1116 // 限速
1400 String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString(); 1117 String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString();
1401 -  
1402 // 线路ID 1118 // 线路ID
1403 int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); 1119 int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
1404 -  
1405 // 半径 1120 // 半径
1406 int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString()); 1121 int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());
1407 -  
1408 // 图形类型 1122 // 图形类型
1409 String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); 1123 String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
1410 -  
1411 // 线路信息 1124 // 线路信息
1412 Line resultLine = lineRepository.findOne(lineId); 1125 Line resultLine = lineRepository.findOne(lineId);
1413 -  
1414 // 路段距离 1126 // 路段距离
1415 Double sectionDistance = 0.0d; 1127 Double sectionDistance = 0.0d;
1416 -  
1417 // 路段时长 1128 // 路段时长
1418 Double sectionDuration = 0.0d; 1129 Double sectionDuration = 0.0d;
1419 -  
1420 // 里程(上或者下) 1130 // 里程(上或者下)
1421 double sumUpOrDownMileage = 0.0d; 1131 double sumUpOrDownMileage = 0.0d;
1422 -  
1423 Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); 1132 Map<String, Object> resultSaveMapm = new HashMap<String,Object>();
1424 -  
1425 String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); 1133 String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString();
1426 -  
1427 if(!stationJSON.equals("")) { 1134 if(!stationJSON.equals("")) {
1428 -  
1429 // 保存站点与站点路由信息 1135 // 保存站点与站点路由信息
1430 resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); 1136 resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes);
1431 -  
1432 } 1137 }
1433 -  
1434 // 路段长度 1138 // 路段长度
1435 sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString()); 1139 sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString());
1436 -  
1437 // 路段时长 1140 // 路段时长
1438 sectionDuration = Double.valueOf(resultSaveMapm.get("sectionDuration").toString()); 1141 sectionDuration = Double.valueOf(resultSaveMapm.get("sectionDuration").toString());
1439 -  
1440 // 如果路段信息JSON字符串不为空 1142 // 如果路段信息JSON字符串不为空
1441 if(!sectionJSON.equals("")) { 1143 if(!sectionJSON.equals("")) {
1442 -  
1443 manualSaveSectionAndSectionRoute(sectionJSON, speedLimitStr, sectionDistance, sectionDuration, dbType, versions, resultLine, destroy, directions); 1144 manualSaveSectionAndSectionRoute(sectionJSON, speedLimitStr, sectionDistance, sectionDuration, dbType, versions, resultLine, destroy, directions);
1444 -  
1445 } 1145 }
1446 -  
1447 // 里程 1146 // 里程
1448 sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString()); 1147 sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString());
1449 -  
1450 BigDecimal s = new BigDecimal(sumUpOrDownMileage); 1148 BigDecimal s = new BigDecimal(sumUpOrDownMileage);
1451 -  
1452 sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 1149 sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
1453 -  
1454 // 更新里程 1150 // 更新里程
1455 // updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage); 1151 // updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage);
1456 -  
1457 if(directions==0) { 1152 if(directions==0) {
1458 -  
1459 // lineUpdateStationName(resultLine); 1153 // lineUpdateStationName(resultLine);
1460 -  
1461 } 1154 }
1462 -  
1463 resultMap.put("status", ResponseCode.SUCCESS); 1155 resultMap.put("status", ResponseCode.SUCCESS);
1464 - 1156 + resultMap.put("stationData", resultSaveMapm.get("stationdata"));
1465 } catch (Exception e) { 1157 } catch (Exception e) {
1466 -  
1467 resultMap.put("status", ResponseCode.ERROR); 1158 resultMap.put("status", ResponseCode.ERROR);
1468 -  
1469 logger.error("save erro.", e); 1159 logger.error("save erro.", e);
1470 -  
1471 } 1160 }
1472 1161
1473 return resultMap; 1162 return resultMap;
@@ -1478,103 +1167,61 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1478,103 +1167,61 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1478 double sectionTime,String dbType,Integer versions,Line resultLine, 1167 double sectionTime,String dbType,Integer versions,Line resultLine,
1479 1168
1480 Integer destroy,Integer directions) { 1169 Integer destroy,Integer directions) {
1481 -  
1482 // 转换成JSON数组 1170 // 转换成JSON数组
1483 JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); 1171 JSONArray sectionsArray = JSONArray.parseArray(sectionJSON);
1484 -  
1485 // 遍历 1172 // 遍历
1486 for(int s = 0 ;s<sectionsArray.size();s++) { 1173 for(int s = 0 ;s<sectionsArray.size();s++) {
1487 -  
1488 // 站点名称 1174 // 站点名称
1489 String sectionName = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("sectionName").toString(); 1175 String sectionName = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("sectionName").toString();
1490 -  
1491 String pointsStr = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("points").toString(); 1176 String pointsStr = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("points").toString();
1492 -  
1493 // 原始线状图形坐标集合 1177 // 原始线状图形坐标集合
1494 String sectionsBpoints = ""; 1178 String sectionsBpoints = "";
1495 -  
1496 // WGS线状图形坐标集合 1179 // WGS线状图形坐标集合
1497 String sectionsWJPpoints = ""; 1180 String sectionsWJPpoints = "";
1498 -  
1499 if(!pointsStr.equals("")){ 1181 if(!pointsStr.equals("")){
1500 -  
1501 JSONArray pointsArray = JSONArray.parseArray(pointsStr); 1182 JSONArray pointsArray = JSONArray.parseArray(pointsStr);
1502 -  
1503 for(int p =0;p<pointsArray.size();p++){ 1183 for(int p =0;p<pointsArray.size();p++){
1504 -  
1505 String pointsLngStr = pointsArray.getJSONObject(p).get("lng").toString(); 1184 String pointsLngStr = pointsArray.getJSONObject(p).get("lng").toString();
1506 -  
1507 String pointsLatStr = pointsArray.getJSONObject(p).get("lat").toString(); 1185 String pointsLatStr = pointsArray.getJSONObject(p).get("lat").toString();
1508 -  
1509 Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); 1186 Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
1510 -  
1511 String WGSLngStr = String.valueOf(resultPoint.getLng()); 1187 String WGSLngStr = String.valueOf(resultPoint.getLng());
1512 -  
1513 String WGSLatStr = String.valueOf(resultPoint.getLat()); 1188 String WGSLatStr = String.valueOf(resultPoint.getLat());
1514 -  
1515 if(p==pointsArray.size()-1){ 1189 if(p==pointsArray.size()-1){
1516 -  
1517 sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; 1190 sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr;
1518 -  
1519 sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; 1191 sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr;
1520 -  
1521 // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat"); 1192 // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat");
1522 -  
1523 }else { 1193 }else {
1524 -  
1525 sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; 1194 sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+",";
1526 -  
1527 sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ","; 1195 sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ",";
1528 -  
1529 // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat") +","; 1196 // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat") +",";
1530 -  
1531 -  
1532 } 1197 }
1533 -  
1534 } 1198 }
1535 -  
1536 } 1199 }
1537 -  
1538 long sectionMaxId = GetUIDAndCode.getSectionId(); 1200 long sectionMaxId = GetUIDAndCode.getSectionId();
1539 -  
1540 String sectionCode = String.valueOf(sectionMaxId); 1201 String sectionCode = String.valueOf(sectionMaxId);
1541 -  
1542 int sectionId = (int) (sectionMaxId); 1202 int sectionId = (int) (sectionMaxId);
1543 -  
1544 // 交出路 1203 // 交出路
1545 String crosesRoad = ""; 1204 String crosesRoad = "";
1546 -  
1547 // 终止节点 1205 // 终止节点
1548 String endNode = ""; 1206 String endNode = "";
1549 -  
1550 // 开始节点 1207 // 开始节点
1551 String startNode = ""; 1208 String startNode = "";
1552 -  
1553 // 中间节点 1209 // 中间节点
1554 String middleNode = ""; 1210 String middleNode = "";
1555 -  
1556 // WGS坐标点集合 1211 // WGS坐标点集合
1557 String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; 1212 String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
1558 -  
1559 // 原坐标点集合 1213 // 原坐标点集合
1560 String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; 1214 String bsectionVector = "LINESTRING(" + sectionsBpoints + ")";
1561 -  
1562 // 城建坐标点集合 1215 // 城建坐标点集合
1563 String csectionVector = ""; 1216 String csectionVector = "";
1564 -  
1565 // 路段类型 1217 // 路段类型
1566 String sectionType = ""; 1218 String sectionType = "";
1567 -  
1568 // 道路编码 1219 // 道路编码
1569 String roadCoding = ""; 1220 String roadCoding = "";
1570 -  
1571 // 限速 1221 // 限速
1572 double speedLimit = Double.parseDouble(speedLimitStr); 1222 double speedLimit = Double.parseDouble(speedLimitStr);
1573 -  
1574 // 说明 1223 // 说明
1575 String descriptions = ""; 1224 String descriptions = "";
1576 -  
1577 -  
1578 sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, 1225 sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,
1579 1226
1580 middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, 1227 middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,
@@ -1582,37 +1229,24 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1582,37 +1229,24 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1582 roadCoding, sectionDistance, sectionTime, dbType, speedLimit, 1229 roadCoding, sectionDistance, sectionTime, dbType, speedLimit,
1583 1230
1584 descriptions, versions,sectionId); 1231 descriptions, versions,sectionId);
1585 -  
1586 -  
1587 -  
1588 Section section = sectionRepository.findOne(Integer.parseInt(sectionCode)); 1232 Section section = sectionRepository.findOne(Integer.parseInt(sectionCode));
1589 -  
1590 // 路段路由 1233 // 路段路由
1591 SectionRoute sectionRoute = new SectionRoute(); 1234 SectionRoute sectionRoute = new SectionRoute();
1592 -  
1593 // 路段序号 1235 // 路段序号
1594 sectionRoute.setSectionrouteCode((s+1)*100); 1236 sectionRoute.setSectionrouteCode((s+1)*100);
1595 -  
1596 // 线路编码 1237 // 线路编码
1597 sectionRoute.setLineCode(resultLine.getLineCode()); 1238 sectionRoute.setLineCode(resultLine.getLineCode());
1598 -  
1599 // 路段ID 1239 // 路段ID
1600 sectionRoute.setSection(section); 1240 sectionRoute.setSection(section);
1601 -  
1602 // 线路ID 1241 // 线路ID
1603 sectionRoute.setLine(resultLine); 1242 sectionRoute.setLine(resultLine);
1604 -  
1605 // 路段编码 1243 // 路段编码
1606 sectionRoute.setSectionCode(sectionCode); 1244 sectionRoute.setSectionCode(sectionCode);
1607 -  
1608 // 版本 1245 // 版本
1609 sectionRoute.setVersions(versions); 1246 sectionRoute.setVersions(versions);
1610 -  
1611 sectionRoute.setDestroy(destroy); 1247 sectionRoute.setDestroy(destroy);
1612 -  
1613 // 方向 1248 // 方向
1614 sectionRoute.setDirections(directions); 1249 sectionRoute.setDirections(directions);
1615 -  
1616 sectionRouteRepository.save(sectionRoute); 1250 sectionRouteRepository.save(sectionRoute);
1617 } 1251 }
1618 1252
src/main/java/com/bsth/service/realcontrol/DataManagerService.java
1 -package com.bsth.service.realcontrol;  
2 -  
3 -import java.util.Map;  
4 -  
5 -/**  
6 - * Created by panzhao on 2017/4/18.  
7 - */  
8 -public interface DataManagerService {  
9 -  
10 - Map<String, Object> carInfos(Integer lineId);  
11 -  
12 - Map<String,Object> updateDevices(String jsonStr);  
13 -} 1 +package com.bsth.service.realcontrol;
  2 +
  3 +import java.util.Map;
  4 +
  5 +/**
  6 + * Created by panzhao on 2017/4/18.
  7 + */
  8 +public interface DataManagerService {
  9 +
  10 + Map<String, Object> carInfos(Integer lineId);
  11 +
  12 + Map<String,Object> updateDevices(String jsonStr);
  13 +}
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -138,7 +138,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -138,7 +138,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
138 138
139 Map<String,Object> changeBcType(Long id, String bcType, String remarks); 139 Map<String,Object> changeBcType(Long id, String bcType, String remarks);
140 140
141 - Map<String,Object> historySave(ScheduleRealInfo sch); 141 + //Map<String,Object> historySave(ScheduleRealInfo sch);
142 142
143 Map<String, Object> MapById(Long id) ; 143 Map<String, Object> MapById(Long id) ;
144 144
@@ -161,4 +161,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -161,4 +161,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
161 void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type); 161 void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type);
162 162
163 Map<String,Object> revokeRealArrive(Long id); 163 Map<String,Object> revokeRealArrive(Long id);
  164 +
  165 + Map<String,Object> lateAdjust(String idx, float minute);
  166 +
  167 + List<ScheduleRealInfo> allLate2(String idx);
164 } 168 }