Commit 502f6f7ff3ff76f0f6b6dbdac8a353604a7d5626

Authored by 潘钊
2 parents 37848c9a 4b9cb4e6

Merge branch 'master' of 192.168.168.201:panzhaov5/bsth_control

# Conflicts:
#	src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
Showing 54 changed files with 2838 additions and 1426 deletions

Too many changes to show.

To preserve performance only 54 of 189 files are displayed.

@@ -102,7 +102,12 @@ @@ -102,7 +102,12 @@
102 <artifactId>guava</artifactId> 102 <artifactId>guava</artifactId>
103 <version>19.0</version> 103 <version>19.0</version>
104 </dependency> 104 </dependency>
105 - 105 + <!-- ftp文件上传包 -->
  106 + <dependency>
  107 + <groupId>commons-net</groupId>
  108 + <artifactId>commons-net</artifactId>
  109 + <version>3.5</version>
  110 + </dependency>
106 <!-- drools 6依赖 --> 111 <!-- drools 6依赖 -->
107 <dependency> 112 <dependency>
108 <groupId>org.kie</groupId> 113 <groupId>org.kie</groupId>
src/main/java/com/bsth/StartCommand.java
@@ -67,7 +67,7 @@ public class StartCommand implements CommandLineRunner{ @@ -67,7 +67,7 @@ public class StartCommand implements CommandLineRunner{
67 //一分钟持久化一次实际排班 67 //一分钟持久化一次实际排班
68 scheduler.scheduleWithFixedDelay(SchedulePersistenceThread, 60 * 1, 60 * 1, TimeUnit.SECONDS); 68 scheduler.scheduleWithFixedDelay(SchedulePersistenceThread, 60 * 1, 60 * 1, TimeUnit.SECONDS);
69 //将实际到离站和排班计划进行匹配 12秒一次 69 //将实际到离站和排班计划进行匹配 12秒一次
70 - //scheduler.scheduleWithFixedDelay(gpsArrivalStationThread, 20, 1200, TimeUnit.SECONDS); 70 + //scheduler.scheduleWithFixedDelay(gpsArrivalStationThread, 5, 1200, TimeUnit.SECONDS);
71 } catch (Exception e) { 71 } catch (Exception e) {
72 e.printStackTrace(); 72 e.printStackTrace();
73 } 73 }
src/main/java/com/bsth/controller/BaseController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
3 -import java.io.Serializable;  
4 -import java.util.Map;  
5 - 3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.service.BaseService;
  5 +import com.bsth.service.schedule.utils.DataImportExportService;
6 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.data.domain.Page; 7 import org.springframework.data.domain.Page;
8 import org.springframework.data.domain.PageRequest; 8 import org.springframework.data.domain.PageRequest;
@@ -12,8 +12,12 @@ import org.springframework.web.bind.annotation.PathVariable; @@ -12,8 +12,12 @@ import org.springframework.web.bind.annotation.PathVariable;
12 import org.springframework.web.bind.annotation.RequestMapping; 12 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.bind.annotation.RequestMethod; 13 import org.springframework.web.bind.annotation.RequestMethod;
14 import org.springframework.web.bind.annotation.RequestParam; 14 import org.springframework.web.bind.annotation.RequestParam;
  15 +import org.springframework.web.multipart.MultipartFile;
15 16
16 -import com.bsth.service.BaseService; 17 +import java.io.File;
  18 +import java.io.Serializable;
  19 +import java.util.HashMap;
  20 +import java.util.Map;
17 21
18 /** 22 /**
19 * 23 *
@@ -29,6 +33,8 @@ public class BaseController&lt;T, ID extends Serializable&gt; { @@ -29,6 +33,8 @@ public class BaseController&lt;T, ID extends Serializable&gt; {
29 33
30 @Autowired 34 @Autowired
31 BaseService<T, ID> baseService; 35 BaseService<T, ID> baseService;
  36 + @Autowired
  37 + DataImportExportService dataImportExportService;
32 38
33 /** 39 /**
34 * 40 *
@@ -105,5 +111,41 @@ public class BaseController&lt;T, ID extends Serializable&gt; { @@ -105,5 +111,41 @@ public class BaseController&lt;T, ID extends Serializable&gt; {
105 public Map<String, Object> delete(@PathVariable("id") ID id){ 111 public Map<String, Object> delete(@PathVariable("id") ID id){
106 return baseService.delete(id); 112 return baseService.delete(id);
107 } 113 }
  114 +
  115 + /**
  116 + * 上传数据文件,并使用ktr转换文件导入数据。
  117 + * @param file
  118 + * @return
  119 + * @throws Exception
  120 + */
  121 + @RequestMapping(value = "/dataImport", method = RequestMethod.POST)
  122 + public Map<String, Object> uploadDataAndImport(MultipartFile file) throws Exception {
  123 + Map<String, Object> resultMap = new HashMap<>();
  124 +
  125 + try {
  126 + // 获取ktr转换文件绝对路径
  127 + File ktrfile = new File(this.getClass().getResource(getDataImportKtrClasspath()).toURI());
  128 + System.out.println(ktrfile.getAbsolutePath());
  129 + // 导入数据
  130 + dataImportExportService.fileDataImport(file, ktrfile);
  131 +
  132 + resultMap.put("status", ResponseCode.SUCCESS);
  133 + resultMap.put("msg", "导入成功");
  134 + } catch (Exception exp) {
  135 + exp.printStackTrace();
  136 + resultMap.put("status", ResponseCode.ERROR);
  137 + resultMap.put("msg", exp.getLocalizedMessage());
  138 + }
  139 +
  140 + return resultMap;
  141 + }
  142 +
  143 + /**
  144 + * @return 数据导入的ktr转换文件类路径。
  145 + */
  146 + protected String getDataImportKtrClasspath() {
  147 + // 默认返回异常,子类如果要使用导入功能,必须覆写此方法,指定ktr文件类路径
  148 + throw new RuntimeException("必须override,并指定ktr classpath");
  149 + }
108 150
109 } 151 }
src/main/java/com/bsth/controller/CarDeviceController.java
1 -package com.bsth.controller;  
2 -  
3 -import com.bsth.entity.CarDevice;  
4 -import org.springframework.web.bind.annotation.RequestBody;  
5 -import org.springframework.web.bind.annotation.RequestMapping;  
6 -import org.springframework.web.bind.annotation.RequestMethod;  
7 -import org.springframework.web.bind.annotation.RestController;  
8 -  
9 -import java.util.Map;  
10 -  
11 -/**  
12 - * Created by xu on 16/6/15.  
13 - */  
14 -@RestController  
15 -@RequestMapping("carDevice")  
16 -public class CarDeviceController extends BaseController<CarDevice, Long> {  
17 -  
18 - /**  
19 - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody  
20 - * @Title: save  
21 - * @Description: TODO(持久化对象)  
22 - * @param @param t  
23 - * @param @return 设定文件  
24 - * @return Map<String,Object> {status: 1(成功),-1(失败)}  
25 - * @throws  
26 - */  
27 - @RequestMapping(method = RequestMethod.POST)  
28 - public Map<String, Object> save(@RequestBody CarDevice t){  
29 - return baseService.save(t);  
30 - }  
31 -} 1 +package com.bsth.controller;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +import org.springframework.web.bind.annotation.RequestBody;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RequestMethod;
  7 +import org.springframework.web.bind.annotation.RestController;
  8 +
  9 +import java.util.Map;
  10 +
  11 +/**
  12 + * Created by xu on 16/6/15.
  13 + */
  14 +@RestController
  15 +@RequestMapping("carDevice")
  16 +public class CarDeviceController extends BaseController<CarDevice, Long> {
  17 +
  18 + /**
  19 + * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
  20 + * @Title: save
  21 + * @Description: TODO(持久化对象)
  22 + * @param @param t
  23 + * @param @return 设定文件
  24 + * @return Map<String,Object> {status: 1(成功),-1(失败)}
  25 + * @throws
  26 + */
  27 + @RequestMapping(method = RequestMethod.POST)
  28 + public Map<String, Object> save(@RequestBody CarDevice t){
  29 + return baseService.save(t);
  30 + }
  31 +}
src/main/java/com/bsth/controller/CarParkController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.CarPark;
  7 +import com.bsth.service.CarParkService;
  8 +import com.bsth.util.GetUIDAndCode;
  9 +
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.web.bind.annotation.*;
  12 +
  13 +
  14 +@RestController
  15 +@RequestMapping("carpark")
  16 +public class CarParkController extends BaseController<CarPark, Integer> {
  17 +
  18 + @Autowired
  19 + CarParkService service;
  20 +
  21 + /**
  22 + * @Description :TODO(查询停车场编码)
  23 + *
  24 + * @return int <carParkCode 停车场编码>
  25 + */
  26 + @RequestMapping(value="getCarParkCode" , method = RequestMethod.GET)
  27 + public long getStationCode() {
  28 + return GetUIDAndCode.getCarParkId();
  29 +
  30 + }
  31 +
  32 + @RequestMapping(value="carParkSave" , method = RequestMethod.POST)
  33 + public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) {
  34 +
  35 + map.put("createBy", "");
  36 +
  37 + map.put("updateBy", "");
  38 +
  39 + return service.carParkSave(map);
  40 +
  41 + }
  42 +
  43 + @RequestMapping(value = "findCarParkInfoFormId",method = RequestMethod.GET)
  44 + public List<Map<String, Object>> findCarParkInfoFormId(@RequestParam Map<String, Object> map) {
  45 +
  46 + return service.findCarParkInfoFormId(map);
  47 + }
  48 +
  49 + @RequestMapping(value="carParkUpdate" , method = RequestMethod.POST)
  50 + public Map<String, Object> carParkUpdate(@RequestParam Map<String, Object> map) {
  51 +
  52 + map.put("updateBy", "");
  53 +
  54 + return service.carParkUpdate(map);
  55 +
  56 + }
  57 +
  58 +}
src/main/java/com/bsth/controller/CarsController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
3 -import com.bsth.common.ResponseCode;  
4 import com.bsth.entity.Cars; 3 import com.bsth.entity.Cars;
5 import com.bsth.service.schedule.utils.DataImportExportService; 4 import com.bsth.service.schedule.utils.DataImportExportService;
6 import com.bsth.service.schedule.utils.DataToolsProperties; 5 import com.bsth.service.schedule.utils.DataToolsProperties;
7 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 import org.springframework.boot.context.properties.EnableConfigurationProperties;
9 import org.springframework.web.bind.annotation.*; 8 import org.springframework.web.bind.annotation.*;
10 -import org.springframework.web.multipart.MultipartFile;  
11 9
12 -import java.io.File;  
13 -import java.util.HashMap;  
14 import java.util.Map; 10 import java.util.Map;
15 11
16 /** 12 /**
@@ -51,28 +47,8 @@ public class CarsController extends BaseController&lt;Cars, Integer&gt; { @@ -51,28 +47,8 @@ public class CarsController extends BaseController&lt;Cars, Integer&gt; {
51 return baseService.validateEquale(map); 47 return baseService.validateEquale(map);
52 } 48 }
53 49
54 - // 上传图片  
55 - @RequestMapping(value = "/dataImport", method = RequestMethod.POST)  
56 - public Map<String, Object> uploadPic(MultipartFile file) throws Exception {  
57 - Map<String, Object> resultMap = new HashMap<>();  
58 -  
59 - try {  
60 - // 获取ktr转换文件绝对路径  
61 - File ktrfile = new File(this.getClass().getResource(  
62 - dataToolsProperties.getCarsDatainputktr()).toURI());  
63 - System.out.println(ktrfile.getAbsolutePath());  
64 - // 导入数据  
65 - dataImportExportService.fileDataImport(file, ktrfile);  
66 -  
67 - resultMap.put("status", ResponseCode.SUCCESS);  
68 - resultMap.put("msg", "导入成功");  
69 - } catch (Exception exp) {  
70 - exp.printStackTrace();  
71 - resultMap.put("status", ResponseCode.ERROR);  
72 - resultMap.put("msg", exp.getLocalizedMessage());  
73 - }  
74 -  
75 - return resultMap; 50 + @Override
  51 + protected String getDataImportKtrClasspath() {
  52 + return dataToolsProperties.getCarsDatainputktr();
76 } 53 }
77 -  
78 } 54 }
src/main/java/com/bsth/controller/LineController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
  3 +import java.util.Map;
  4 +
3 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.web.bind.annotation.RequestMapping; 6 import org.springframework.web.bind.annotation.RequestMapping;
5 import org.springframework.web.bind.annotation.RequestMethod; 7 import org.springframework.web.bind.annotation.RequestMethod;
@@ -7,6 +9,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -7,6 +9,7 @@ import org.springframework.web.bind.annotation.RestController;
7 9
8 import com.bsth.entity.Line; 10 import com.bsth.entity.Line;
9 import com.bsth.service.LineService; 11 import com.bsth.service.LineService;
  12 +import com.bsth.util.GetUIDAndCode;
10 13
11 /** 14 /**
12 * 15 *
@@ -31,12 +34,25 @@ public class LineController extends BaseController&lt;Line, Integer&gt; { @@ -31,12 +34,25 @@ public class LineController extends BaseController&lt;Line, Integer&gt; {
31 private LineService service; 34 private LineService service;
32 35
33 /** 36 /**
34 - * 获取线路编码 37 + * 获取线路编码与ID
35 * 38 *
36 * @return int <lineCode:线路编码> 39 * @return int <lineCode:线路编码>
37 */ 40 */
38 @RequestMapping(value = "getLineCode", method = RequestMethod.GET) 41 @RequestMapping(value = "getLineCode", method = RequestMethod.GET)
39 - public int getLineCode() {  
40 - return service.selectMaxIdToLineCode(); 42 + public long getLineCode() {
  43 + return GetUIDAndCode.getLineId();
41 } 44 }
  45 +
  46 + /**
  47 + *
  48 + * 保存
  49 + *
  50 + */
  51 + @RequestMapping(method = RequestMethod.POST)
  52 + public Map<String, Object> save(Line t){
  53 +
  54 + t.setId(Integer.valueOf(t.getLineCode()));
  55 +
  56 + return service.save(t);
  57 + }
42 } 58 }
src/main/java/com/bsth/controller/PersonnelController.java
1 -package com.bsth.controller;  
2 -  
3 -import com.bsth.entity.Personnel;  
4 -import org.springframework.web.bind.annotation.*;  
5 -  
6 -import java.util.Map;  
7 -  
8 -/**  
9 - * Created by xu on 16/6/15.  
10 - */  
11 -@RestController  
12 -@RequestMapping("personnel")  
13 -public class PersonnelController extends BaseController<Personnel, Integer> {  
14 - /**  
15 - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody  
16 - * @Title: save  
17 - * @Description: TODO(持久化对象)  
18 - * @param @param t  
19 - * @param @return 设定文件  
20 - * @return Map<String,Object> {status: 1(成功),-1(失败)}  
21 - * @throws  
22 - */  
23 - @RequestMapping(method = RequestMethod.POST)  
24 - public Map<String, Object> save(@RequestBody Personnel t){  
25 - return baseService.save(t);  
26 - }  
27 -  
28 - /**  
29 - * 验证。  
30 - * @param map  
31 - * @return  
32 - */  
33 - @RequestMapping(value = "/validate/equale", method = RequestMethod.GET)  
34 - public Map<String, Object> validateData(@RequestParam Map<String, Object> map) {  
35 - // 一般比较相同公司下工号是否相同  
36 - return baseService.validateEquale(map);  
37 - }  
38 -} 1 +package com.bsth.controller;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +import com.bsth.service.schedule.utils.DataImportExportService;
  5 +import com.bsth.service.schedule.utils.DataToolsProperties;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.boot.context.properties.EnableConfigurationProperties;
  8 +import org.springframework.web.bind.annotation.*;
  9 +
  10 +import java.util.Map;
  11 +
  12 +/**
  13 + * Created by xu on 16/6/15.
  14 + */
  15 +@RestController
  16 +@RequestMapping("personnel")
  17 +@EnableConfigurationProperties(DataToolsProperties.class)
  18 +public class PersonnelController extends BaseController<Personnel, Integer> {
  19 +
  20 + @Autowired
  21 + private DataImportExportService dataImportExportService;
  22 + @Autowired
  23 + private DataToolsProperties dataToolsProperties;
  24 +
  25 + /**
  26 + * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
  27 + * @Title: save
  28 + * @Description: TODO(持久化对象)
  29 + * @param @param t
  30 + * @param @return 设定文件
  31 + * @return Map<String,Object> {status: 1(成功),-1(失败)}
  32 + * @throws
  33 + */
  34 + @RequestMapping(method = RequestMethod.POST)
  35 + public Map<String, Object> save(@RequestBody Personnel t){
  36 + return baseService.save(t);
  37 + }
  38 +
  39 + /**
  40 + * 验证。
  41 + * @param map
  42 + * @return
  43 + */
  44 + @RequestMapping(value = "/validate/equale", method = RequestMethod.GET)
  45 + public Map<String, Object> validateData(@RequestParam Map<String, Object> map) {
  46 + // 一般比较相同公司下工号是否相同
  47 + return baseService.validateEquale(map);
  48 + }
  49 +
  50 + @Override
  51 + protected String getDataImportKtrClasspath() {
  52 + return dataToolsProperties.getEmployeesDatainputktr();
  53 + }
  54 +}
src/main/java/com/bsth/controller/SectionRouteController.java
@@ -47,4 +47,17 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer @@ -47,4 +47,17 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer
47 return routeService.getSectionRoute(map); 47 return routeService.getSectionRoute(map);
48 } 48 }
49 49
  50 +
  51 + /**
  52 + * @Description : TODO(根据路段路由Id查询详情)
  53 + *
  54 + * @param map <id:路段路由ID>
  55 + *
  56 + * @return List<Map<String, Object>>
  57 + */
  58 + @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET)
  59 + public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) {
  60 +
  61 + return routeService.findSectionRouteInfoFormId(map);
  62 + }
50 } 63 }
src/main/java/com/bsth/controller/StationController.java
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
10 10
11 import com.bsth.entity.Station; 11 import com.bsth.entity.Station;
12 import com.bsth.service.StationService; 12 import com.bsth.service.StationService;
  13 +import com.bsth.util.GetUIDAndCode;
13 14
14 /** 15 /**
15 * 16 *
@@ -127,8 +128,8 @@ public class StationController extends BaseController&lt;Station, Integer&gt; { @@ -127,8 +128,8 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
127 * @return int <stationCode站点编码> 128 * @return int <stationCode站点编码>
128 */ 129 */
129 @RequestMapping(value="getStationCode" , method = RequestMethod.GET) 130 @RequestMapping(value="getStationCode" , method = RequestMethod.GET)
130 - public int getStationCode() {  
131 - return service.getStationCode(); 131 + public long getStationCode() {
  132 + return GetUIDAndCode.getStationId();
132 133
133 } 134 }
134 } 135 }
src/main/java/com/bsth/controller/StationRouteController.java
@@ -87,4 +87,31 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer @@ -87,4 +87,31 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
87 return service.stationRouteIsDestroy(map); 87 return service.stationRouteIsDestroy(map);
88 } 88 }
89 89
  90 + /**
  91 + * @Description : TODO(根据线路ID生成行单)
  92 + *
  93 + * @param map <id:线路ID>
  94 + *
  95 + * @return Map<String, Object> <SUCCESS ; ERROR>
  96 + */
  97 + @RequestMapping(value = "/usingSingle",method = RequestMethod.POST)
  98 + public Map<String, Object> usingSingle(@RequestParam Map<String, Object> map) {
  99 +
  100 + return service.usingSingle(map);
  101 + }
  102 +
  103 +
  104 + /**
  105 + * @Description : TODO(根据站点路由Id查询详情)
  106 + *
  107 + * @param map <id:站点路由ID>
  108 + *
  109 + * @return List<Map<String, Object>>
  110 + */
  111 + @RequestMapping(value = "/findStationRouteInfo",method = RequestMethod.GET)
  112 + public List<Map<String, Object>> findStationRouteInfo(@RequestParam Map<String, Object> map) {
  113 +
  114 + return service.findStationRouteInfo(map);
  115 + }
  116 +
90 } 117 }
src/main/java/com/bsth/controller/schedule/SchedulePlanController.java
1 -package com.bsth.controller.schedule;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.entity.schedule.SchedulePlan;  
5 -import org.springframework.web.bind.annotation.RequestMapping;  
6 -import org.springframework.web.bind.annotation.RestController;  
7 -  
8 -/**  
9 - * Created by xu on 16/6/16.  
10 - */  
11 -@RestController  
12 -@RequestMapping("spc")  
13 -public class SchedulePlanController extends BaseController<SchedulePlan, Long> {  
14 -} 1 +package com.bsth.controller.schedule;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.schedule.SchedulePlan;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * Created by xu on 16/6/16.
  10 + */
  11 +@RestController
  12 +@RequestMapping("spc")
  13 +public class SchedulePlanController extends BaseController<SchedulePlan, Long> {
  14 +}
src/main/java/com/bsth/controller/schedule/SchedulePlanInfoController.java
1 -package com.bsth.controller.schedule;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.entity.schedule.SchedulePlanInfo;  
5 -import org.springframework.web.bind.annotation.RequestMapping;  
6 -import org.springframework.web.bind.annotation.RestController;  
7 -  
8 -/**  
9 - * Created by xu on 16/6/16.  
10 - */  
11 -@RestController  
12 -@RequestMapping("spic")  
13 -public class SchedulePlanInfoController extends BaseController<SchedulePlanInfo, Long> {  
14 -} 1 +package com.bsth.controller.schedule;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.schedule.SchedulePlanInfo;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * Created by xu on 16/6/16.
  10 + */
  11 +@RestController
  12 +@RequestMapping("spic")
  13 +public class SchedulePlanInfoController extends BaseController<SchedulePlanInfo, Long> {
  14 +}
src/main/java/com/bsth/entity/CarPark.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
  3 +import java.util.Date;
  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.Id; 8 import javax.persistence.Id;
@@ -8,7 +11,7 @@ import javax.persistence.Table; @@ -8,7 +11,7 @@ import javax.persistence.Table;
8 11
9 /** 12 /**
10 * 13 *
11 - * @ClassName: Line(停车场类) 14 + * @ClassName: CarPark(停车场类)
12 * 15 *
13 * @Description: TODO(停车场) 16 * @Description: TODO(停车场)
14 * 17 *
@@ -34,14 +37,70 @@ public class CarPark { @@ -34,14 +37,70 @@ public class CarPark {
34 // 停车场名称 37 // 停车场名称
35 private String parkName; 38 private String parkName;
36 39
37 - // 地理位置  
38 - private String parkPoint; 40 + // 地理位置(百度坐标)
  41 + private String bParkPoint;
  42 +
  43 + // 地理位置中心点(百度坐标)
  44 + private String bCenterPoint;
  45 +
  46 + // 地理位置(WGS坐标)
  47 + private String gParkPoint;
  48 +
  49 + // 地理位置中心点(WGS坐标)
  50 + private String gCenterPoint;
  51 +
  52 + /**
  53 + * 经纬坐标类型
  54 + *
  55 + * --------- b:百度坐标系
  56 + *
  57 + * --------- d:高德坐标系
  58 + */
  59 + private String dbType;
  60 +
  61 + /**
  62 + * 图形类型
  63 + *
  64 + * ------ r:圆形
  65 + *
  66 + * ------ p:多边形
  67 + */
  68 + private String shapesType;
  69 +
  70 + // 圆形半径
  71 + private Integer radius;
39 72
40 // 面积 73 // 面积
41 private double area; 74 private double area;
42 75
43 // 所属公司 76 // 所属公司
44 private String company; 77 private String company;
  78 +
  79 + // 分公司
  80 + private String brancheCompany;
  81 +
  82 + // 是否撤销
  83 + private Integer destroy;
  84 +
  85 + // 版本号
  86 + private Integer versions;
  87 +
  88 + // 描述
  89 + private String descriptions;
  90 +
  91 + // 创建人
  92 + private Integer createBy;
  93 +
  94 + // 修改人
  95 + private Integer updateBy;
  96 +
  97 + // 创建日期
  98 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  99 + private Date createDate;
  100 +
  101 + // 修改日期
  102 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  103 + private Date updateDate;
45 104
46 public Integer getId() { 105 public Integer getId() {
47 return id; 106 return id;
@@ -66,13 +125,61 @@ public class CarPark { @@ -66,13 +125,61 @@ public class CarPark {
66 public void setParkName(String parkName) { 125 public void setParkName(String parkName) {
67 this.parkName = parkName; 126 this.parkName = parkName;
68 } 127 }
  128 +
  129 + public String getbParkPoint() {
  130 + return bParkPoint;
  131 + }
  132 +
  133 + public void setbParkPoint(String bParkPoint) {
  134 + this.bParkPoint = bParkPoint;
  135 + }
  136 +
  137 + public String getbCenterPoint() {
  138 + return bCenterPoint;
  139 + }
  140 +
  141 + public void setbCenterPoint(String bCenterPoint) {
  142 + this.bCenterPoint = bCenterPoint;
  143 + }
  144 +
  145 + public String getgParkPoint() {
  146 + return gParkPoint;
  147 + }
  148 +
  149 + public void setgParkPoint(String gParkPoint) {
  150 + this.gParkPoint = gParkPoint;
  151 + }
  152 +
  153 + public String getDbType() {
  154 + return dbType;
  155 + }
  156 +
  157 + public void setDbType(String dbType) {
  158 + this.dbType = dbType;
  159 + }
  160 +
  161 + public String getShapesType() {
  162 + return shapesType;
  163 + }
  164 +
  165 + public void setShapesType(String shapesType) {
  166 + this.shapesType = shapesType;
  167 + }
  168 +
  169 + public Integer getRadius() {
  170 + return radius;
  171 + }
69 172
70 - public String getParkPoint() {  
71 - return parkPoint; 173 + public void setRadius(Integer radius) {
  174 + this.radius = radius;
72 } 175 }
73 176
74 - public void setParkPoint(String parkPoint) {  
75 - this.parkPoint = parkPoint; 177 + public String getgCenterPoint() {
  178 + return gCenterPoint;
  179 + }
  180 +
  181 + public void setgCenterPoint(String gCenterPoint) {
  182 + this.gCenterPoint = gCenterPoint;
76 } 183 }
77 184
78 public double getArea() { 185 public double getArea() {
@@ -82,6 +189,14 @@ public class CarPark { @@ -82,6 +189,14 @@ public class CarPark {
82 public void setArea(double area) { 189 public void setArea(double area) {
83 this.area = area; 190 this.area = area;
84 } 191 }
  192 +
  193 + public String getBrancheCompany() {
  194 + return brancheCompany;
  195 + }
  196 +
  197 + public void setBrancheCompany(String brancheCompany) {
  198 + this.brancheCompany = brancheCompany;
  199 + }
85 200
86 public String getCompany() { 201 public String getCompany() {
87 return company; 202 return company;
@@ -90,4 +205,61 @@ public class CarPark { @@ -90,4 +205,61 @@ public class CarPark {
90 public void setCompany(String company) { 205 public void setCompany(String company) {
91 this.company = company; 206 this.company = company;
92 } 207 }
  208 +
  209 + public Integer getDestroy() {
  210 + return destroy;
  211 + }
  212 +
  213 + public void setDestroy(Integer destroy) {
  214 + this.destroy = destroy;
  215 + }
  216 +
  217 + public Integer getVersions() {
  218 + return versions;
  219 + }
  220 +
  221 + public void setVersions(Integer versions) {
  222 + this.versions = versions;
  223 + }
  224 +
  225 + public String getDescriptions() {
  226 + return descriptions;
  227 + }
  228 +
  229 + public void setDescriptions(String descriptions) {
  230 + this.descriptions = descriptions;
  231 + }
  232 +
  233 + public Integer getCreateBy() {
  234 + return createBy;
  235 + }
  236 +
  237 + public void setCreateBy(Integer createBy) {
  238 + this.createBy = createBy;
  239 + }
  240 +
  241 + public Integer getUpdateBy() {
  242 + return updateBy;
  243 + }
  244 +
  245 + public void setUpdateBy(Integer updateBy) {
  246 + this.updateBy = updateBy;
  247 + }
  248 +
  249 + public Date getCreateDate() {
  250 + return createDate;
  251 + }
  252 +
  253 + public void setCreateDate(Date createDate) {
  254 + this.createDate = createDate;
  255 + }
  256 +
  257 + public Date getUpdateDate() {
  258 + return updateDate;
  259 + }
  260 +
  261 + public void setUpdateDate(Date updateDate) {
  262 + this.updateDate = updateDate;
  263 + }
  264 +
93 } 265 }
src/main/java/com/bsth/entity/Line.java
@@ -27,7 +27,7 @@ public class Line implements Serializable { @@ -27,7 +27,7 @@ public class Line implements Serializable {
27 27
28 // 线路ID 28 // 线路ID
29 @Id 29 @Id
30 - @GeneratedValue(strategy = GenerationType.IDENTITY) 30 + /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
31 private Integer id; 31 private Integer id;
32 32
33 // 线路名称 33 // 线路名称
src/main/java/com/bsth/entity/Section.java
@@ -28,7 +28,7 @@ import javax.persistence.Table; @@ -28,7 +28,7 @@ import javax.persistence.Table;
28 public class Section { 28 public class Section {
29 29
30 @Id 30 @Id
31 - @GeneratedValue(strategy = GenerationType.IDENTITY) 31 + /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
32 private Integer id; 32 private Integer id;
33 33
34 // 路段编码 34 // 路段编码
src/main/java/com/bsth/entity/Station.java
@@ -29,7 +29,7 @@ import javax.persistence.Table; @@ -29,7 +29,7 @@ import javax.persistence.Table;
29 public class Station { 29 public class Station {
30 30
31 @Id 31 @Id
32 - @GeneratedValue(strategy = GenerationType.IDENTITY) 32 + /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
33 private Integer id; 33 private Integer id;
34 34
35 // 站点编码 35 // 站点编码
src/main/java/com/bsth/entity/schedule/GuideboardInfo.java
1 -package com.bsth.entity.schedule;  
2 -  
3 -import com.bsth.entity.Line;  
4 -import com.bsth.entity.sys.SysUser;  
5 -  
6 -import javax.persistence.*;  
7 -import javax.persistence.Table;  
8 -import java.util.Date;  
9 -  
10 -/**  
11 - * 路牌信息。  
12 - */  
13 -@Entity  
14 -@Table(name = "bsth_c_s_gbi")  
15 -public class GuideboardInfo {  
16 -  
17 - /** 主键Id */  
18 - @Id  
19 - @GeneratedValue  
20 - private Long id;  
21 -  
22 - /** 线路关联 */  
23 - @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
24 - private Line xl;  
25 -  
26 - /** 路牌顺序号 */  
27 - @Column(nullable = false)  
28 - private Integer lpNo;  
29 - /** 路牌名称 */  
30 - @Column(nullable = false)  
31 - private String lpName;  
32 - /** 路牌类型(普通路牌/临加路牌) */  
33 - @Column(nullable = false)  
34 - private String lpType;  
35 -  
36 - /** 创建人 */  
37 - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)  
38 - private SysUser createBy;  
39 - /** 修改人 */  
40 - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)  
41 - private SysUser updateBy;  
42 -  
43 - /** 创建日期 */  
44 - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
45 - private Date createDate;  
46 - /** 修改日期 */  
47 - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")  
48 - private Date updateDate;  
49 -  
50 -  
51 - public Long getId() {  
52 - return id;  
53 - }  
54 -  
55 - public void setId(Long id) {  
56 - this.id = id;  
57 - }  
58 -  
59 - public Line getXl() {  
60 - return xl;  
61 - }  
62 -  
63 - public void setXl(Line xl) {  
64 - this.xl = xl;  
65 - }  
66 -  
67 - public Integer getLpNo() {  
68 - return lpNo;  
69 - }  
70 -  
71 - public void setLpNo(Integer lpNo) {  
72 - this.lpNo = lpNo;  
73 - }  
74 -  
75 - public String getLpName() {  
76 - return lpName;  
77 - }  
78 -  
79 - public void setLpName(String lpName) {  
80 - this.lpName = lpName;  
81 - }  
82 -  
83 - public String getLpType() {  
84 - return lpType;  
85 - }  
86 -  
87 - public void setLpType(String lpType) {  
88 - this.lpType = lpType;  
89 - }  
90 -  
91 - public SysUser getCreateBy() {  
92 - return createBy;  
93 - }  
94 -  
95 - public void setCreateBy(SysUser createBy) {  
96 - this.createBy = createBy;  
97 - }  
98 -  
99 - public SysUser getUpdateBy() {  
100 - return updateBy;  
101 - }  
102 -  
103 - public void setUpdateBy(SysUser updateBy) {  
104 - this.updateBy = updateBy;  
105 - }  
106 -  
107 - public Date getCreateDate() {  
108 - return createDate;  
109 - }  
110 -  
111 - public void setCreateDate(Date createDate) {  
112 - this.createDate = createDate;  
113 - }  
114 -  
115 - public Date getUpdateDate() {  
116 - return updateDate;  
117 - }  
118 -  
119 - public void setUpdateDate(Date updateDate) {  
120 - this.updateDate = updateDate;  
121 - }  
122 -} 1 +package com.bsth.entity.schedule;
  2 +
  3 +import com.bsth.entity.Line;
  4 +import com.bsth.entity.sys.SysUser;
  5 +
  6 +import javax.persistence.*;
  7 +import javax.persistence.Table;
  8 +import java.util.Date;
  9 +
  10 +/**
  11 + * 路牌信息。
  12 + */
  13 +@Entity
  14 +@Table(name = "bsth_c_s_gbi")
  15 +public class GuideboardInfo {
  16 +
  17 + /** 主键Id */
  18 + @Id
  19 + @GeneratedValue
  20 + private Long id;
  21 +
  22 + /** 线路关联 */
  23 + @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  24 + private Line xl;
  25 +
  26 + /** 路牌顺序号 */
  27 + @Column(nullable = false)
  28 + private Integer lpNo;
  29 + /** 路牌名称 */
  30 + @Column(nullable = false)
  31 + private String lpName;
  32 + /** 路牌类型(普通路牌/临加路牌) */
  33 + @Column(nullable = false)
  34 + private String lpType;
  35 +
  36 + /** 创建人 */
  37 + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
  38 + private SysUser createBy;
  39 + /** 修改人 */
  40 + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
  41 + private SysUser updateBy;
  42 +
  43 + /** 创建日期 */
  44 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  45 + private Date createDate;
  46 + /** 修改日期 */
  47 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  48 + private Date updateDate;
  49 +
  50 +
  51 + public Long getId() {
  52 + return id;
  53 + }
  54 +
  55 + public void setId(Long id) {
  56 + this.id = id;
  57 + }
  58 +
  59 + public Line getXl() {
  60 + return xl;
  61 + }
  62 +
  63 + public void setXl(Line xl) {
  64 + this.xl = xl;
  65 + }
  66 +
  67 + public Integer getLpNo() {
  68 + return lpNo;
  69 + }
  70 +
  71 + public void setLpNo(Integer lpNo) {
  72 + this.lpNo = lpNo;
  73 + }
  74 +
  75 + public String getLpName() {
  76 + return lpName;
  77 + }
  78 +
  79 + public void setLpName(String lpName) {
  80 + this.lpName = lpName;
  81 + }
  82 +
  83 + public String getLpType() {
  84 + return lpType;
  85 + }
  86 +
  87 + public void setLpType(String lpType) {
  88 + this.lpType = lpType;
  89 + }
  90 +
  91 + public SysUser getCreateBy() {
  92 + return createBy;
  93 + }
  94 +
  95 + public void setCreateBy(SysUser createBy) {
  96 + this.createBy = createBy;
  97 + }
  98 +
  99 + public SysUser getUpdateBy() {
  100 + return updateBy;
  101 + }
  102 +
  103 + public void setUpdateBy(SysUser updateBy) {
  104 + this.updateBy = updateBy;
  105 + }
  106 +
  107 + public Date getCreateDate() {
  108 + return createDate;
  109 + }
  110 +
  111 + public void setCreateDate(Date createDate) {
  112 + this.createDate = createDate;
  113 + }
  114 +
  115 + public Date getUpdateDate() {
  116 + return updateDate;
  117 + }
  118 +
  119 + public void setUpdateDate(Date updateDate) {
  120 + this.updateDate = updateDate;
  121 + }
  122 +}
src/main/java/com/bsth/entity/schedule/TTInfo.java
1 -package com.bsth.entity.schedule;  
2 -  
3 -import com.bsth.entity.Line;  
4 -import com.bsth.entity.sys.SysUser;  
5 -  
6 -import javax.persistence.*;  
7 -import java.util.Date;  
8 -  
9 -/**  
10 - * 时刻表信息  
11 - */  
12 -@Entity  
13 -@Table(name="bsth_c_s_ttinfo")  
14 -public class TTInfo {  
15 -  
16 - /** 主键Id */  
17 - @Id  
18 - @GeneratedValue  
19 - private Long id;  
20 -  
21 - /** 线路关联 */  
22 - @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
23 - private Line xl;  
24 -  
25 - /** 时刻表名称 */  
26 - @Column(nullable = false, unique = true)  
27 - private String name;  
28 - /** 线路方向(TODO:上下行,上行,下行,这个以后用枚举还是字典再议,现在先用文字) */  
29 - @Column(nullable = false)  
30 - private String xlDir;  
31 - /** 启用日期 */  
32 - @Column(nullable = false)  
33 - private Date qyrq;  
34 - /** 模版类型(TODO:时刻表,间隔式,这个以后用枚举还是字典再议,现在先用文字) */  
35 - private String templateType;  
36 - /** 是否启用调度模版 */  
37 - private Boolean isEnableDisTemplate;  
38 - /** 路牌数 */  
39 - private int lpCount;  
40 - /** 圈数 */  
41 - private int loopCount;  
42 -  
43 - // TODO:原系统里的分别在,圈后圈进场,意思不知道,再议  
44 -  
45 - /** 常规有效日(1-7表示星期一到星期日,多个用逗号隔开) */  
46 - private String rule_days;  
47 - /** 特殊有效日期(格式:2001-01-01,多个用逗号隔开) */  
48 - private String special_days;  
49 -  
50 -  
51 -  
52 - /** 是否启用(这个是算出来的,不持久化) */  
53 - @Transient  
54 - private boolean isEnable;  
55 -  
56 - /** 操作人员关联 */  
57 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
58 - private SysUser createBy;  
59 - /** 更新人员关联 */  
60 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
61 - private SysUser updateBy;  
62 - // 创建日期  
63 - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
64 - private Date createDate;  
65 - // 修改日期  
66 - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")  
67 - private Date updateDate;  
68 -  
69 -  
70 - public Long getId() {  
71 - return id;  
72 - }  
73 -  
74 - public void setId(Long id) {  
75 - this.id = id;  
76 - }  
77 -  
78 - public Line getXl() {  
79 - return xl;  
80 - }  
81 -  
82 - public void setXl(Line xl) {  
83 - this.xl = xl;  
84 - }  
85 -  
86 - public String getName() {  
87 - return name;  
88 - }  
89 -  
90 - public void setName(String name) {  
91 - this.name = name;  
92 - }  
93 -  
94 - public String getXlDir() {  
95 - return xlDir;  
96 - }  
97 -  
98 - public void setXlDir(String xlDir) {  
99 - this.xlDir = xlDir;  
100 - }  
101 -  
102 - public Date getQyrq() {  
103 - return qyrq;  
104 - }  
105 -  
106 - public void setQyrq(Date qyrq) {  
107 - this.qyrq = qyrq;  
108 - }  
109 -  
110 - public String getTemplateType() {  
111 - return templateType;  
112 - }  
113 -  
114 - public void setTemplateType(String templateType) {  
115 - this.templateType = templateType;  
116 - }  
117 -  
118 - public Boolean getIsEnableDisTemplate() {  
119 - return isEnableDisTemplate;  
120 - }  
121 -  
122 - public void setIsEnableDisTemplate(Boolean isEnableDisTemplate) {  
123 - this.isEnableDisTemplate = isEnableDisTemplate;  
124 - }  
125 -  
126 - public int getLpCount() {  
127 - return lpCount;  
128 - }  
129 -  
130 - public void setLpCount(int lpCount) {  
131 - this.lpCount = lpCount;  
132 - }  
133 -  
134 - public int getLoopCount() {  
135 - return loopCount;  
136 - }  
137 -  
138 - public void setLoopCount(int loopCount) {  
139 - this.loopCount = loopCount;  
140 - }  
141 -  
142 - public String getRule_days() {  
143 - return rule_days;  
144 - }  
145 -  
146 - public void setRule_days(String rule_days) {  
147 - this.rule_days = rule_days;  
148 - }  
149 -  
150 - public String getSpecial_days() {  
151 - return special_days;  
152 - }  
153 -  
154 - public void setSpecial_days(String special_days) {  
155 - this.special_days = special_days;  
156 - }  
157 -  
158 - public boolean isEnable() {  
159 - return isEnable;  
160 - }  
161 -  
162 - public void setIsEnable(boolean isEnable) {  
163 - this.isEnable = isEnable;  
164 - }  
165 -  
166 - public SysUser getCreateBy() {  
167 - return createBy;  
168 - }  
169 -  
170 - public void setCreateBy(SysUser createBy) {  
171 - this.createBy = createBy;  
172 - }  
173 -  
174 - public SysUser getUpdateBy() {  
175 - return updateBy;  
176 - }  
177 -  
178 - public void setUpdateBy(SysUser updateBy) {  
179 - this.updateBy = updateBy;  
180 - }  
181 -  
182 - public Date getCreateDate() {  
183 - return createDate;  
184 - }  
185 -  
186 - public void setCreateDate(Date createDate) {  
187 - this.createDate = createDate;  
188 - }  
189 -  
190 - public Date getUpdateDate() {  
191 - return updateDate;  
192 - }  
193 -  
194 - public void setUpdateDate(Date updateDate) {  
195 - this.updateDate = updateDate;  
196 - }  
197 -} 1 +package com.bsth.entity.schedule;
  2 +
  3 +import com.bsth.entity.Line;
  4 +import com.bsth.entity.sys.SysUser;
  5 +
  6 +import javax.persistence.*;
  7 +import java.util.Date;
  8 +
  9 +/**
  10 + * 时刻表信息
  11 + */
  12 +@Entity
  13 +@Table(name="bsth_c_s_ttinfo")
  14 +public class TTInfo {
  15 +
  16 + /** 主键Id */
  17 + @Id
  18 + @GeneratedValue
  19 + private Long id;
  20 +
  21 + /** 线路关联 */
  22 + @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  23 + private Line xl;
  24 +
  25 + /** 时刻表名称 */
  26 + @Column(nullable = false, unique = true)
  27 + private String name;
  28 + /** 线路方向(TODO:上下行,上行,下行,这个以后用枚举还是字典再议,现在先用文字) */
  29 + @Column(nullable = false)
  30 + private String xlDir;
  31 + /** 启用日期 */
  32 + @Column(nullable = false)
  33 + private Date qyrq;
  34 + /** 模版类型(TODO:时刻表,间隔式,这个以后用枚举还是字典再议,现在先用文字) */
  35 + private String templateType;
  36 + /** 是否启用调度模版 */
  37 + private Boolean isEnableDisTemplate;
  38 + /** 路牌数 */
  39 + private int lpCount;
  40 + /** 圈数 */
  41 + private int loopCount;
  42 +
  43 + // TODO:原系统里的分别在,圈后圈进场,意思不知道,再议
  44 +
  45 + /** 常规有效日(1-7表示星期一到星期日,多个用逗号隔开) */
  46 + private String rule_days;
  47 + /** 特殊有效日期(格式:2001-01-01,多个用逗号隔开) */
  48 + private String special_days;
  49 +
  50 +
  51 +
  52 + /** 是否启用(这个是算出来的,不持久化) */
  53 + @Transient
  54 + private boolean isEnable;
  55 +
  56 + /** 操作人员关联 */
  57 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  58 + private SysUser createBy;
  59 + /** 更新人员关联 */
  60 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  61 + private SysUser updateBy;
  62 + // 创建日期
  63 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  64 + private Date createDate;
  65 + // 修改日期
  66 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  67 + private Date updateDate;
  68 +
  69 +
  70 + public Long getId() {
  71 + return id;
  72 + }
  73 +
  74 + public void setId(Long id) {
  75 + this.id = id;
  76 + }
  77 +
  78 + public Line getXl() {
  79 + return xl;
  80 + }
  81 +
  82 + public void setXl(Line xl) {
  83 + this.xl = xl;
  84 + }
  85 +
  86 + public String getName() {
  87 + return name;
  88 + }
  89 +
  90 + public void setName(String name) {
  91 + this.name = name;
  92 + }
  93 +
  94 + public String getXlDir() {
  95 + return xlDir;
  96 + }
  97 +
  98 + public void setXlDir(String xlDir) {
  99 + this.xlDir = xlDir;
  100 + }
  101 +
  102 + public Date getQyrq() {
  103 + return qyrq;
  104 + }
  105 +
  106 + public void setQyrq(Date qyrq) {
  107 + this.qyrq = qyrq;
  108 + }
  109 +
  110 + public String getTemplateType() {
  111 + return templateType;
  112 + }
  113 +
  114 + public void setTemplateType(String templateType) {
  115 + this.templateType = templateType;
  116 + }
  117 +
  118 + public Boolean getIsEnableDisTemplate() {
  119 + return isEnableDisTemplate;
  120 + }
  121 +
  122 + public void setIsEnableDisTemplate(Boolean isEnableDisTemplate) {
  123 + this.isEnableDisTemplate = isEnableDisTemplate;
  124 + }
  125 +
  126 + public int getLpCount() {
  127 + return lpCount;
  128 + }
  129 +
  130 + public void setLpCount(int lpCount) {
  131 + this.lpCount = lpCount;
  132 + }
  133 +
  134 + public int getLoopCount() {
  135 + return loopCount;
  136 + }
  137 +
  138 + public void setLoopCount(int loopCount) {
  139 + this.loopCount = loopCount;
  140 + }
  141 +
  142 + public String getRule_days() {
  143 + return rule_days;
  144 + }
  145 +
  146 + public void setRule_days(String rule_days) {
  147 + this.rule_days = rule_days;
  148 + }
  149 +
  150 + public String getSpecial_days() {
  151 + return special_days;
  152 + }
  153 +
  154 + public void setSpecial_days(String special_days) {
  155 + this.special_days = special_days;
  156 + }
  157 +
  158 + public boolean isEnable() {
  159 + return isEnable;
  160 + }
  161 +
  162 + public void setIsEnable(boolean isEnable) {
  163 + this.isEnable = isEnable;
  164 + }
  165 +
  166 + public SysUser getCreateBy() {
  167 + return createBy;
  168 + }
  169 +
  170 + public void setCreateBy(SysUser createBy) {
  171 + this.createBy = createBy;
  172 + }
  173 +
  174 + public SysUser getUpdateBy() {
  175 + return updateBy;
  176 + }
  177 +
  178 + public void setUpdateBy(SysUser updateBy) {
  179 + this.updateBy = updateBy;
  180 + }
  181 +
  182 + public Date getCreateDate() {
  183 + return createDate;
  184 + }
  185 +
  186 + public void setCreateDate(Date createDate) {
  187 + this.createDate = createDate;
  188 + }
  189 +
  190 + public Date getUpdateDate() {
  191 + return updateDate;
  192 + }
  193 +
  194 + public void setUpdateDate(Date updateDate) {
  195 + this.updateDate = updateDate;
  196 + }
  197 +}
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
1 -package com.bsth.entity.schedule;  
2 -  
3 -import com.bsth.entity.CarPark;  
4 -import com.bsth.entity.Line;  
5 -import com.bsth.entity.Station;  
6 -import com.bsth.entity.sys.SysUser;  
7 -  
8 -import javax.persistence.*;  
9 -import java.util.Date;  
10 -  
11 -/**  
12 - * 时刻表明细  
13 - */  
14 -@Entity  
15 -@Table(name = "bsth_c_s_ttinfo_detail")  
16 -public class TTInfoDetail {  
17 -  
18 - /** 主健Id */  
19 - @Id  
20 - @GeneratedValue  
21 - private Long id;  
22 -  
23 -  
24 - /** 关联线路 */  
25 - @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
26 - private Line xl;  
27 - /** 时刻表主对象关联 */  
28 - @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
29 - private TTInfo ttinfo;  
30 - /** 关联的路牌 */  
31 - @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
32 - private GuideboardInfo lp;  
33 -  
34 - /** 发车顺序号 */  
35 - @Column(nullable = false)  
36 - private Integer fcno;  
37 - /** 线路方向(TODO:上下行,上行,下行,这个以后用枚举还是字典再议,现在先用文字) */  
38 - @Column(nullable = false)  
39 - private String xlDir;  
40 - /** 起点站关联 */  
41 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
42 - private Station qdz;  
43 - /** 终点站关联 */  
44 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
45 - private Station zdz;  
46 - /** 停车场关联(出场,进场班次会关联停车场) */  
47 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
48 - private CarPark tcc;  
49 -  
50 - /** 发车时间(格式 HH:mm) */  
51 - @Column(nullable = false, length = 5)  
52 - private String fcsj;  
53 - /** 对应班次数 */  
54 - private Integer bcs;  
55 - @Column(nullable = false)  
56 - /** 计划里程 */  
57 - private Double jhlc;  
58 - /** 班次历时 */  
59 - private Integer bcsj;  
60 -  
61 - /**  
62 - * 班次类型  
63 - * TODO:正常班次、出场、进场、加油、临加班次、区间班次、放空班次、放大站班次、两点间空驶  
64 - * TODO:这个以后用枚举还是字典再议,现在先用文字  
65 - */  
66 - @Column(nullable = false)  
67 - private String bcType;  
68 -  
69 - /** 是否分班(表示这个班次是否是晚班班次,就是换另外一个驾驶员开)*/  
70 - private Boolean isFB;  
71 -  
72 - /** 是否切换线路 */  
73 - private Boolean isSwitchXl;  
74 - /** 切换的线路(isSwitchXl == true) */  
75 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
76 - private Line switchXl;  
77 - /** 切换线路信息(isSwitchXl == true) */  
78 - private String switchXlDesc;  
79 - /** 备注 */  
80 - private String remark;  
81 -  
82 - /** 创建人 */  
83 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
84 - private SysUser createBy;  
85 - /** 修改人 */  
86 - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)  
87 - private SysUser updateBy;  
88 -  
89 - /** 创建日期 */  
90 - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
91 - private Date createDate;  
92 - /** 修改日期 */  
93 - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")  
94 - private Date updateDate;  
95 -  
96 - public Long getId() {  
97 - return id;  
98 - }  
99 -  
100 - public void setId(Long id) {  
101 - this.id = id;  
102 - }  
103 -  
104 - public Line getXl() {  
105 - return xl;  
106 - }  
107 -  
108 - public void setXl(Line xl) {  
109 - this.xl = xl;  
110 - }  
111 -  
112 - public TTInfo getTtinfo() {  
113 - return ttinfo;  
114 - }  
115 -  
116 - public void setTtinfo(TTInfo ttinfo) {  
117 - this.ttinfo = ttinfo;  
118 - }  
119 -  
120 - public GuideboardInfo getLp() {  
121 - return lp;  
122 - }  
123 -  
124 - public void setLp(GuideboardInfo lp) {  
125 - this.lp = lp;  
126 - }  
127 -  
128 - public Integer getFcno() {  
129 - return fcno;  
130 - }  
131 -  
132 - public void setFcno(Integer fcno) {  
133 - this.fcno = fcno;  
134 - }  
135 -  
136 - public String getXlDir() {  
137 - return xlDir;  
138 - }  
139 -  
140 - public void setXlDir(String xlDir) {  
141 - this.xlDir = xlDir;  
142 - }  
143 -  
144 - public Station getQdz() {  
145 - return qdz;  
146 - }  
147 -  
148 - public void setQdz(Station qdz) {  
149 - this.qdz = qdz;  
150 - }  
151 -  
152 - public Station getZdz() {  
153 - return zdz;  
154 - }  
155 -  
156 - public void setZdz(Station zdz) {  
157 - this.zdz = zdz;  
158 - }  
159 -  
160 - public String getFcsj() {  
161 - return fcsj;  
162 - }  
163 -  
164 - public void setFcsj(String fcsj) {  
165 - this.fcsj = fcsj;  
166 - }  
167 -  
168 - public Integer getBcs() {  
169 - return bcs;  
170 - }  
171 -  
172 - public void setBcs(Integer bcs) {  
173 - this.bcs = bcs;  
174 - }  
175 -  
176 - public Double getJhlc() {  
177 - return jhlc;  
178 - }  
179 -  
180 - public void setJhlc(Double jhlc) {  
181 - this.jhlc = jhlc;  
182 - }  
183 -  
184 - public Integer getBcsj() {  
185 - return bcsj;  
186 - }  
187 -  
188 - public void setBcsj(Integer bcsj) {  
189 - this.bcsj = bcsj;  
190 - }  
191 -  
192 - public String getBcType() {  
193 - return bcType;  
194 - }  
195 -  
196 - public void setBcType(String bcType) {  
197 - this.bcType = bcType;  
198 - }  
199 -  
200 - public Boolean getIsSwitchXl() {  
201 - return isSwitchXl;  
202 - }  
203 -  
204 - public void setIsSwitchXl(Boolean isSwitchXl) {  
205 - this.isSwitchXl = isSwitchXl;  
206 - }  
207 -  
208 - public Line getSwitchXl() {  
209 - return switchXl;  
210 - }  
211 -  
212 - public void setSwitchXl(Line switchXl) {  
213 - this.switchXl = switchXl;  
214 - }  
215 -  
216 - public String getSwitchXlDesc() {  
217 - return switchXlDesc;  
218 - }  
219 -  
220 - public void setSwitchXlDesc(String switchXlDesc) {  
221 - this.switchXlDesc = switchXlDesc;  
222 - }  
223 -  
224 - public String getRemark() {  
225 - return remark;  
226 - }  
227 -  
228 - public void setRemark(String remark) {  
229 - this.remark = remark;  
230 - }  
231 -  
232 - public SysUser getCreateBy() {  
233 - return createBy;  
234 - }  
235 -  
236 - public void setCreateBy(SysUser createBy) {  
237 - this.createBy = createBy;  
238 - }  
239 -  
240 - public SysUser getUpdateBy() {  
241 - return updateBy;  
242 - }  
243 -  
244 - public void setUpdateBy(SysUser updateBy) {  
245 - this.updateBy = updateBy;  
246 - }  
247 -  
248 - public Date getCreateDate() {  
249 - return createDate;  
250 - }  
251 -  
252 - public void setCreateDate(Date createDate) {  
253 - this.createDate = createDate;  
254 - }  
255 -  
256 - public Date getUpdateDate() {  
257 - return updateDate;  
258 - }  
259 -  
260 - public void setUpdateDate(Date updateDate) {  
261 - this.updateDate = updateDate;  
262 - }  
263 -  
264 - public CarPark getTcc() {  
265 - return tcc;  
266 - }  
267 -  
268 - public void setTcc(CarPark tcc) {  
269 - this.tcc = tcc;  
270 - }  
271 -  
272 - public Boolean getIsFB() {  
273 - return isFB;  
274 - }  
275 -  
276 - public void setIsFB(Boolean isFB) {  
277 - this.isFB = isFB;  
278 - }  
279 -} 1 +package com.bsth.entity.schedule;
  2 +
  3 +import com.bsth.entity.CarPark;
  4 +import com.bsth.entity.Line;
  5 +import com.bsth.entity.Station;
  6 +import com.bsth.entity.sys.SysUser;
  7 +
  8 +import javax.persistence.*;
  9 +import java.util.Date;
  10 +
  11 +/**
  12 + * 时刻表明细
  13 + */
  14 +@Entity
  15 +@Table(name = "bsth_c_s_ttinfo_detail")
  16 +public class TTInfoDetail {
  17 +
  18 + /** 主健Id */
  19 + @Id
  20 + @GeneratedValue
  21 + private Long id;
  22 +
  23 +
  24 + /** 关联线路 */
  25 + @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  26 + private Line xl;
  27 + /** 时刻表主对象关联 */
  28 + @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  29 + private TTInfo ttinfo;
  30 + /** 关联的路牌 */
  31 + @ManyToOne(optional = false, cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  32 + private GuideboardInfo lp;
  33 +
  34 + /** 发车顺序号 */
  35 + @Column(nullable = false)
  36 + private Integer fcno;
  37 + /** 线路方向(TODO:上下行,上行,下行,这个以后用枚举还是字典再议,现在先用文字) */
  38 + @Column(nullable = false)
  39 + private String xlDir;
  40 + /** 起点站关联 */
  41 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  42 + private Station qdz;
  43 + /** 终点站关联 */
  44 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  45 + private Station zdz;
  46 + /** 停车场关联(出场,进场班次会关联停车场) */
  47 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  48 + private CarPark tcc;
  49 +
  50 + /** 发车时间(格式 HH:mm) */
  51 + @Column(nullable = false, length = 5)
  52 + private String fcsj;
  53 + /** 对应班次数 */
  54 + private Integer bcs;
  55 + @Column(nullable = false)
  56 + /** 计划里程 */
  57 + private Double jhlc;
  58 + /** 班次历时 */
  59 + private Integer bcsj;
  60 +
  61 + /**
  62 + * 班次类型
  63 + * TODO:正常班次、出场、进场、加油、临加班次、区间班次、放空班次、放大站班次、两点间空驶
  64 + * TODO:这个以后用枚举还是字典再议,现在先用文字
  65 + */
  66 + @Column(nullable = false)
  67 + private String bcType;
  68 +
  69 + /** 是否分班(表示这个班次是否是晚班班次,就是换另外一个驾驶员开)*/
  70 + private Boolean isFB;
  71 +
  72 + /** 是否切换线路 */
  73 + private Boolean isSwitchXl;
  74 + /** 切换的线路(isSwitchXl == true) */
  75 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  76 + private Line switchXl;
  77 + /** 切换线路信息(isSwitchXl == true) */
  78 + private String switchXlDesc;
  79 + /** 备注 */
  80 + private String remark;
  81 +
  82 + /** 创建人 */
  83 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  84 + private SysUser createBy;
  85 + /** 修改人 */
  86 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  87 + private SysUser updateBy;
  88 +
  89 + /** 创建日期 */
  90 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  91 + private Date createDate;
  92 + /** 修改日期 */
  93 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  94 + private Date updateDate;
  95 +
  96 + public Long getId() {
  97 + return id;
  98 + }
  99 +
  100 + public void setId(Long id) {
  101 + this.id = id;
  102 + }
  103 +
  104 + public Line getXl() {
  105 + return xl;
  106 + }
  107 +
  108 + public void setXl(Line xl) {
  109 + this.xl = xl;
  110 + }
  111 +
  112 + public TTInfo getTtinfo() {
  113 + return ttinfo;
  114 + }
  115 +
  116 + public void setTtinfo(TTInfo ttinfo) {
  117 + this.ttinfo = ttinfo;
  118 + }
  119 +
  120 + public GuideboardInfo getLp() {
  121 + return lp;
  122 + }
  123 +
  124 + public void setLp(GuideboardInfo lp) {
  125 + this.lp = lp;
  126 + }
  127 +
  128 + public Integer getFcno() {
  129 + return fcno;
  130 + }
  131 +
  132 + public void setFcno(Integer fcno) {
  133 + this.fcno = fcno;
  134 + }
  135 +
  136 + public String getXlDir() {
  137 + return xlDir;
  138 + }
  139 +
  140 + public void setXlDir(String xlDir) {
  141 + this.xlDir = xlDir;
  142 + }
  143 +
  144 + public Station getQdz() {
  145 + return qdz;
  146 + }
  147 +
  148 + public void setQdz(Station qdz) {
  149 + this.qdz = qdz;
  150 + }
  151 +
  152 + public Station getZdz() {
  153 + return zdz;
  154 + }
  155 +
  156 + public void setZdz(Station zdz) {
  157 + this.zdz = zdz;
  158 + }
  159 +
  160 + public String getFcsj() {
  161 + return fcsj;
  162 + }
  163 +
  164 + public void setFcsj(String fcsj) {
  165 + this.fcsj = fcsj;
  166 + }
  167 +
  168 + public Integer getBcs() {
  169 + return bcs;
  170 + }
  171 +
  172 + public void setBcs(Integer bcs) {
  173 + this.bcs = bcs;
  174 + }
  175 +
  176 + public Double getJhlc() {
  177 + return jhlc;
  178 + }
  179 +
  180 + public void setJhlc(Double jhlc) {
  181 + this.jhlc = jhlc;
  182 + }
  183 +
  184 + public Integer getBcsj() {
  185 + return bcsj;
  186 + }
  187 +
  188 + public void setBcsj(Integer bcsj) {
  189 + this.bcsj = bcsj;
  190 + }
  191 +
  192 + public String getBcType() {
  193 + return bcType;
  194 + }
  195 +
  196 + public void setBcType(String bcType) {
  197 + this.bcType = bcType;
  198 + }
  199 +
  200 + public Boolean getIsSwitchXl() {
  201 + return isSwitchXl;
  202 + }
  203 +
  204 + public void setIsSwitchXl(Boolean isSwitchXl) {
  205 + this.isSwitchXl = isSwitchXl;
  206 + }
  207 +
  208 + public Line getSwitchXl() {
  209 + return switchXl;
  210 + }
  211 +
  212 + public void setSwitchXl(Line switchXl) {
  213 + this.switchXl = switchXl;
  214 + }
  215 +
  216 + public String getSwitchXlDesc() {
  217 + return switchXlDesc;
  218 + }
  219 +
  220 + public void setSwitchXlDesc(String switchXlDesc) {
  221 + this.switchXlDesc = switchXlDesc;
  222 + }
  223 +
  224 + public String getRemark() {
  225 + return remark;
  226 + }
  227 +
  228 + public void setRemark(String remark) {
  229 + this.remark = remark;
  230 + }
  231 +
  232 + public SysUser getCreateBy() {
  233 + return createBy;
  234 + }
  235 +
  236 + public void setCreateBy(SysUser createBy) {
  237 + this.createBy = createBy;
  238 + }
  239 +
  240 + public SysUser getUpdateBy() {
  241 + return updateBy;
  242 + }
  243 +
  244 + public void setUpdateBy(SysUser updateBy) {
  245 + this.updateBy = updateBy;
  246 + }
  247 +
  248 + public Date getCreateDate() {
  249 + return createDate;
  250 + }
  251 +
  252 + public void setCreateDate(Date createDate) {
  253 + this.createDate = createDate;
  254 + }
  255 +
  256 + public Date getUpdateDate() {
  257 + return updateDate;
  258 + }
  259 +
  260 + public void setUpdateDate(Date updateDate) {
  261 + this.updateDate = updateDate;
  262 + }
  263 +
  264 + public CarPark getTcc() {
  265 + return tcc;
  266 + }
  267 +
  268 + public void setTcc(CarPark tcc) {
  269 + this.tcc = tcc;
  270 + }
  271 +
  272 + public Boolean getIsFB() {
  273 + return isFB;
  274 + }
  275 +
  276 + public void setIsFB(Boolean isFB) {
  277 + this.isFB = isFB;
  278 + }
  279 +}
src/main/java/com/bsth/repository/CarDeviceRepository.java
1 -package com.bsth.repository;  
2 -  
3 -import com.bsth.entity.CarDevice;  
4 -import org.springframework.stereotype.Repository;  
5 -  
6 -/**  
7 - * Created by xu on 16/6/15.  
8 - */  
9 -@Repository  
10 -public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> {  
11 -} 1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +import org.springframework.stereotype.Repository;
  5 +
  6 +/**
  7 + * Created by xu on 16/6/15.
  8 + */
  9 +@Repository
  10 +public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> {
  11 +}
src/main/java/com/bsth/repository/CarParkRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import com.bsth.entity.CarPark;
  11 +
  12 +@Repository
  13 +public interface CarParkRepository extends BaseRepository<CarPark, Integer>{
  14 +
  15 + // 查询最大ID
  16 + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_car_park) k"
  17 + , nativeQuery=true)
  18 + public long carParkMaxId();
  19 +
  20 + @Transactional
  21 + @Modifying
  22 + @Query(value="INSERT INTO bsth_c_car_park (" +
  23 + "id , area , company , park_code , park_name , " +
  24 + "branche_company , create_by , create_date , descriptions , destroy," +
  25 + "update_by, update_date , versions , b_center_point , b_park_point , " +
  26 + "db_type, g_center_point, g_park_point, radius, shapes_type) " +
  27 + " VALUES(" +
  28 + "?1 , ?2 , ?3 , ?4 , ?5," +
  29 + "?6 , ?7 , str_to_date(?8,'%Y-%m-%d %H:%i:%s') , ?9 , ?10," +
  30 + "?11,str_to_date(?12,'%Y-%m-%d %H:%i:%s') ,?13, ?14, GeomFromText(?15), " +
  31 + "?16, ?17,GeomFromText(?18),?19,?20)", nativeQuery=true)
  32 + public void carParkSave(Integer id,Double area,String company,String parkCode,String parkName,
  33 +
  34 + String brancheCompany,Integer createBy,String createDate,String descriptions,Integer destroy,
  35 +
  36 + Integer updateBy,String updateDate,Integer versions,String bCenterPoint,String bParkPoint,
  37 +
  38 + String dbType,String gCenterPoint,String gParkPoint,Integer radius,String shapesType);
  39 +
  40 +
  41 + /**
  42 + * @Description :TODO(查询路段信息)
  43 + *
  44 + * @param map <id:路段路由ID>
  45 + *
  46 + * @return List<Object[]>
  47 + */
  48 + @Query(value ="SELECT k.id AS carParkId," +
  49 + "k.area AS carParkArea," +
  50 + "k.company AS carParkCompany," +
  51 + "k.park_code AS carParkCode," +
  52 + "k.park_name AS carParkName," +
  53 + "k.branche_company AS carParkBrancheCompany," +
  54 + "k.create_by AS carParkCreateBy," +
  55 + "k.create_date AS carParkCreateDate," +
  56 + "k.descriptions AS carParkDescriptions," +
  57 + "k.destroy AS carParkDestroy," +
  58 + "k.update_by AS carParkUpdate," +
  59 + "k.update_date AS carParkUpdateDate," +
  60 + "k.versions AS carParkVersions," +
  61 + "k.b_center_point AS carParkBcenterPoint," +
  62 + "AsText(k.b_park_point) AS carParkBparkPoint," +
  63 + "k.g_center_point AS carParkGcenterPoint," +
  64 + "AsText(k.g_park_point) AS carParkGparkPoint, " +
  65 + "k.db_type AS carParkDBtype," +
  66 + "k.radius AS carParkRadius," +
  67 + "k.shapes_type AS carParkShapesType FROM bsth_c_car_park k where k.id = ?1", nativeQuery=true)
  68 + List<Object[]> findCarParkInfoFormId(int id);
  69 +
  70 + @Transactional
  71 + @Modifying
  72 + @Query(value="UPDATE bsth_c_car_park SET " +
  73 + "area = ?1 , " +
  74 + "company = ?2 , " +
  75 + "park_code = ?3 , " +
  76 + "park_name = ?4 , " +
  77 + "branche_company = ?5 , " +
  78 + "create_by = ?6 , " +
  79 + "create_date = ?7 , " +
  80 + "descriptions = ?8 , " +
  81 + "destroy = ?9 , " +
  82 + "update_by = ?10 , " +
  83 + "update_date = ?11 , " +
  84 + "versions = ?12 , " +
  85 + "b_center_point = ?13 , " +
  86 + "g_center_point = ?14 , " +
  87 + "b_park_point = GeomFromText(?15) , " +
  88 + "g_park_point = GeomFromText(?16) , " +
  89 + "db_type = ?17 , " +
  90 + "radius = ?18 , " +
  91 + "shapes_type = ?19 " +
  92 + " WHERE id = ?20 ", nativeQuery=true)
  93 + public void carParkUpdate(double area,String company,String parkCode,String parkName,String brancheCompany,
  94 +
  95 + Integer createBy ,String createDate,String descriptions,Integer destroy,Integer updateBy,
  96 +
  97 + String updateDate,Integer versions,String bCenterPoint,String gCenterPoint,String bParkPoint,
  98 +
  99 + String gParkPoint,String dbType,Integer radius,String shapesType,Integer id );
  100 +
  101 +}
src/main/java/com/bsth/repository/LineInformationRepository.java
@@ -5,6 +5,7 @@ import java.util.List; @@ -5,6 +5,7 @@ import java.util.List;
5 import org.springframework.data.jpa.repository.Query; 5 import org.springframework.data.jpa.repository.Query;
6 import org.springframework.stereotype.Repository; 6 import org.springframework.stereotype.Repository;
7 7
  8 +import com.bsth.entity.Line;
8 import com.bsth.entity.LineInformation; 9 import com.bsth.entity.LineInformation;
9 10
10 /** 11 /**
@@ -28,4 +29,6 @@ public interface LineInformationRepository extends BaseRepository&lt;LineInformatio @@ -28,4 +29,6 @@ public interface LineInformationRepository extends BaseRepository&lt;LineInformatio
28 29
29 @Query("select i from LineInformation i where i.line.lineCode in ?1") 30 @Query("select i from LineInformation i where i.line.lineCode in ?1")
30 List<LineInformation> findByLine(List<String> lineCodes); 31 List<LineInformation> findByLine(List<String> lineCodes);
  32 +
  33 + List<LineInformation> findByLine(Line line);
31 } 34 }
src/main/java/com/bsth/repository/LineRepository.java
@@ -23,11 +23,12 @@ import com.bsth.entity.Line; @@ -23,11 +23,12 @@ import com.bsth.entity.Line;
23 @Repository 23 @Repository
24 public interface LineRepository extends BaseRepository<Line, Integer> { 24 public interface LineRepository extends BaseRepository<Line, Integer> {
25 25
  26 +
26 /** 27 /**
27 * 获取线路编码 28 * 获取线路编码
28 * 29 *
29 * @return int <lineCode:线路编码> 30 * @return int <lineCode:线路编码>
30 */ 31 */
31 - @Query(value = " SELECT MAX(id)+1 from bsth_c_line ", nativeQuery = true)  
32 - public int selectMaxIdToLineCode(); 32 + @Query(value = " SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_line) k ", nativeQuery = true)
  33 + public long selectMaxIdToLineCode();
33 } 34 }
src/main/java/com/bsth/repository/PersonnelRepository.java
1 -package com.bsth.repository;  
2 -  
3 -import com.bsth.entity.Personnel;  
4 -import org.springframework.stereotype.Repository;  
5 -  
6 -/**  
7 - * Created by xu on 16/6/15.  
8 - */  
9 -@Repository  
10 -public interface PersonnelRepository extends BaseRepository<Personnel, Integer> {  
11 -} 1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +import org.springframework.stereotype.Repository;
  5 +
  6 +/**
  7 + * Created by xu on 16/6/15.
  8 + */
  9 +@Repository
  10 +public interface PersonnelRepository extends BaseRepository<Personnel, Integer> {
  11 +}
src/main/java/com/bsth/repository/SectionRepository.java
@@ -30,7 +30,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; { @@ -30,7 +30,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
30 // 查询最大ID 30 // 查询最大ID
31 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_section) k" 31 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_section) k"
32 , nativeQuery=true) 32 , nativeQuery=true)
33 - public int sectionMaxId(); 33 + public long sectionMaxId();
34 34
35 35
36 /** 36 /**
@@ -54,7 +54,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; { @@ -54,7 +54,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
54 54
55 "road_coding , section_distance , section_time , db_type, speed_limit ,"+ 55 "road_coding , section_distance , section_time , db_type, speed_limit ,"+
56 56
57 - "descriptions , versions) "+ 57 + "descriptions , versions,id) "+
58 58
59 "VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+ 59 "VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+
60 60
@@ -62,7 +62,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; { @@ -62,7 +62,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
62 62
63 "?11 , ?12 , ?13 , ?14 , ?15 ,"+ 63 "?11 , ?12 , ?13 , ?14 , ?15 ,"+
64 64
65 - "?16 , ?17 "+ 65 + "?16 , ?17, ?18"+
66 ")", nativeQuery=true) 66 ")", nativeQuery=true)
67 public void systemSave(String sectionCode , String sectionName , String crosesRoad , String endNode , String startNode, 67 public void systemSave(String sectionCode , String sectionName , String crosesRoad , String endNode , String startNode,
68 68
@@ -70,7 +70,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; { @@ -70,7 +70,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
70 70
71 String roadCoding,double sectionDistance,double sectionTime,String dbType,double speedLimit, 71 String roadCoding,double sectionDistance,double sectionTime,String dbType,double speedLimit,
72 72
73 - String descriptions, int versions); 73 + String descriptions, int versions,int id);
74 74
75 75
76 /** 76 /**
src/main/java/com/bsth/repository/SectionRouteRepository.java
@@ -69,4 +69,63 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -69,4 +69,63 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
69 " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id", nativeQuery=true) 69 " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id", nativeQuery=true)
70 List<Object[]> getSectionRoute(int lineId, int directions); 70 List<Object[]> getSectionRoute(int lineId, int directions);
71 71
  72 +
  73 + /**
  74 + * @Description :TODO(查询路段信息)
  75 + *
  76 + * @param map <id:路段路由ID>
  77 + *
  78 + * @return List<Object[]>
  79 + */
  80 + @Query(value ="SELECT a.sectionRouteId," +
  81 + "a.sectionRouteLineCode," +
  82 + "a.sectionRouteCode," +
  83 + "a.sectionRouteDirections," +
  84 + "a.sectionRouteLine," +
  85 + "a.sectionRouteSection," +
  86 + "a.sectionRouteDescriptions," +
  87 + "a.sectionRouteCreateBy," +
  88 + "a.sectionRouteCreateDate," +
  89 + "a.sectionRouteUpdateBy," +
  90 + "a.sectionRouteUpdateDate," +
  91 + "a.sectionRouteVersions," +
  92 + "a.sectionRouteDestroy," +
  93 + "b.id AS sectionId," +
  94 + "b.section_code AS sectionCode," +
  95 + "b.section_name AS sectionName," +
  96 + "b.road_coding AS sectionRoadCoding," +
  97 + "b.end_node AS sectionEndCode," +
  98 + "b.start_node AS sectionStartNode," +
  99 + "b.middle_node AS sectionMiddleNode," +
  100 + "b.section_type AS sectionType," +
  101 + "AsText(b.csection_vector) AS sectionCsectionVector," +
  102 + "AsText(b.bsection_vector) AS sectionBsectionVector," +
  103 + "AsText(b.gsection_vector) AS sectionGsectionVector," +
  104 + "b.section_distance AS sectionDistance," +
  105 + "b.section_time AS sectionTime," +
  106 + "b.db_type AS sectionDbtype," +
  107 + "b.speed_limit AS sectionSpeedLimit," +
  108 + "b.descriptions AS sectionDescriptions," +
  109 + "b.create_by AS sectionCreateBy," +
  110 + "b.create_date AS sectionCreateDate," +
  111 + "b.update_by AS sectionUpdateBy," +
  112 + "b.update_date AS sectionUpdateDate," +
  113 + "b.versions AS sectionVersion FROM (" +
  114 + " SELECT s.id AS sectionRouteId," +
  115 + "s.line_code AS sectionRouteLineCode," +
  116 + "s.sectionroute_code AS sectionRouteCode," +
  117 + "s.directions AS sectionRouteDirections," +
  118 + "s.line AS sectionRouteLine," +
  119 + "s.section AS sectionRouteSection," +
  120 + "s.descriptions AS sectionRouteDescriptions," +
  121 + "s.create_by AS sectionRouteCreateBy," +
  122 + "s.create_date AS sectionRouteCreateDate," +
  123 + "s.update_by AS sectionRouteUpdateBy," +
  124 + "s.update_date AS sectionRouteUpdateDate," +
  125 + "s.versions AS sectionRouteVersions," +
  126 + "s.destroy AS sectionRouteDestroy" +
  127 + " FROM bsth_c_sectionroute s where s.id =?1) a " +
  128 + " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true)
  129 + List<Object[]> findSectionRouteInfoFormId(int id);
  130 +
72 } 131 }
src/main/java/com/bsth/repository/StationRepository.java
@@ -35,7 +35,7 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; { @@ -35,7 +35,7 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
35 */ 35 */
36 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_station) k" 36 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_station) k"
37 , nativeQuery=true) 37 , nativeQuery=true)
38 - int stationMaxId(); 38 + long stationMaxId();
39 39
40 @Query(value = "SELECT * FROM bsth_c_station s where s.station_name = ?1" 40 @Query(value = "SELECT * FROM bsth_c_station s where s.station_name = ?1"
41 , nativeQuery=true) 41 , nativeQuery=true)
@@ -63,12 +63,12 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; { @@ -63,12 +63,12 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
63 "?1 , ?2 , ?3 , ?4 , ?5," + 63 "?1 , ?2 , ?3 , ?4 , ?5," +
64 "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," + 64 "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," +
65 "?12 ,?13, ?14, ?15, ?16," + 65 "?12 ,?13, ?14, ?15, ?16," +
66 - "?17,?18)", nativeQuery=true) 66 + "?17,?18,?19)", nativeQuery=true)
67 public void stationSave(String stationCode,String stationName,String roadCoding,String dbType,String bJwpoints, 67 public void stationSave(String stationCode,String stationName,String roadCoding,String dbType,String bJwpoints,
68 68
69 Float gLonx, Float gLaty, Float x,Float y, String gPloygonGrid, String bPloygonGrid, 69 Float gLonx, Float gLaty, Float x,Float y, String gPloygonGrid, String bPloygonGrid,
70 70
71 - Integer destroy,Integer radius,String shapesType,Integer versions,String descriptions,Integer createBy,Integer updateBy); 71 + Integer destroy,Integer radius,String shapesType,Integer versions,String descriptions,Integer createBy,Integer updateBy,int id);
72 72
73 /** 73 /**
74 * @Description :TODO(站点更新) 74 * @Description :TODO(站点更新)
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -118,4 +118,98 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -118,4 +118,98 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
118 "destroy = ?2 WHERE id = ?1", nativeQuery=true) 118 "destroy = ?2 WHERE id = ?1", nativeQuery=true)
119 public void stationRouteIsDestroyUpd(Integer stationRouteId, Integer destroy); 119 public void stationRouteIsDestroyUpd(Integer stationRouteId, Integer destroy);
120 120
  121 +
  122 + /**
  123 + * @Description : TODO(根据线路ID生成行单)
  124 + *
  125 + * @param lineId:线路ID
  126 + *
  127 + * @return List<Object[]>
  128 + */
  129 + @Query(value = "SELECT * FROM ("+
  130 + "SELECT b.g_lonx," +
  131 + "b.g_laty,b.b_jwpoints," +
  132 + "a.station_mark," +
  133 + "a.station_route_code," +
  134 + "b.station_cod," +
  135 + "a.distances,"+
  136 + "b.station_name," +
  137 + "a.directions FROM (SELECT " +
  138 + "s.station_mark," +
  139 + "s.station_route_code," +
  140 + "s.directions," +
  141 + "s.distances,"+
  142 + "s.station FROM bsth_c_stationroute s where s.line = ?1) a " +
  143 + "LEFT JOIN bsth_c_station b " +
  144 + " on a.station = b.id ORDER BY a.directions ASC ) k ORDER BY k.directions,k.station_route_code ASC", nativeQuery=true)
  145 + List<Object[]> usingSingle(Integer lineId);
  146 +
  147 + /**
  148 + * @Description : TODO(根据站点路由Id查询详情)
  149 + *
  150 + * @param id:站点路由ID
  151 + *
  152 + * @return List<Object[]>
  153 + */
  154 + @Query(value = "SELECT a.stationRouteLine," +
  155 + " a.stationRouteStation," +
  156 + " a.stationRouteCode," +
  157 + " a.stationRouteLIneCode," +
  158 + " a.stationRouteStationMark," +
  159 + " a.stationOutStationNmber," +
  160 + " a.stationRoutedirections," +
  161 + " a.stationRouteDistances," +
  162 + " a.stationRouteToTime," +
  163 + " a.staitonRouteFirstTime," +
  164 + " a.stationRouteEndTime," +
  165 + " a.stationRouteDescriptions," +
  166 + " a.stationRouteDestroy," +
  167 + " a.stationRouteVersions," +
  168 + " a.stationRouteCreateBy," +
  169 + " a.stationRouteCreateDate," +
  170 + " a.stationRouteUpdateBy," +
  171 + " a.stationRouteUpdateDate," +
  172 + " b.id AS stationId," +
  173 + " b.station_cod AS stationCode," +
  174 + " b.station_name AS stationName," +
  175 + " b.road_coding AS stationRoadCoding," +
  176 + " b.db_type AS stationDbType," +
  177 + " b.b_jwpoints AS stationJwpoints," +
  178 + " b.g_lonx AS stationGlonx," +
  179 + " b.g_laty AS stationGlaty," +
  180 + " b.x AS stationX," +
  181 + " b.y AS stationY," +
  182 + " AsText(b.b_polygon_grid) as stationBPolyonGrid," +
  183 + " AsText(b.g_polygon_grid) AS stationGPloyonGrid, " +
  184 + " b.destroy AS stationDestroy," +
  185 + " b.radius AS stationRadius," +
  186 + " b.shapes_type AS stationShapesType," +
  187 + " b.versions AS stationVersions," +
  188 + " b.descriptions AS sttationDescriptions," +
  189 + " b.create_by AS stationCreateBy," +
  190 + " b.create_date AS stationCreateDate," +
  191 + " b.update_by AS stationUpdateBy," +
  192 + " b.update_date AS stationUpdateDate," +
  193 + " a.stationRouteId"+
  194 + " FROM ( SELECT s.id AS stationRouteId," +
  195 + " s.line AS stationRouteLine," +
  196 + " s.station as stationRouteStation," +
  197 + " s.station_route_code as stationRouteCode," +
  198 + " s.line_code AS stationRouteLIneCode," +
  199 + " s.station_mark AS stationRouteStationMark," +
  200 + " s.out_station_nmber AS stationOutStationNmber," +
  201 + " s.directions AS stationRoutedirections," +
  202 + " s.distances AS stationRouteDistances," +
  203 + " s.to_time AS stationRouteToTime," +
  204 + " s.first_time AS staitonRouteFirstTime," +
  205 + " s.end_time AS stationRouteEndTime," +
  206 + " s.descriptions AS stationRouteDescriptions," +
  207 + " s.destroy AS stationRouteDestroy," +
  208 + " s.versions AS stationRouteVersions," +
  209 + " s.create_by AS stationRouteCreateBy," +
  210 + " s.create_date AS stationRouteCreateDate," +
  211 + " s.update_by AS stationRouteUpdateBy," +
  212 + " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.id = ?1 ) a " +
  213 + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true)
  214 + List<Object[]> findStationRouteInfo(Integer id);
121 } 215 }
src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
@@ -7,6 +7,7 @@ import java.util.List; @@ -7,6 +7,7 @@ import java.util.List;
7 7
8 import org.springframework.data.domain.Page; 8 import org.springframework.data.domain.Page;
9 import org.springframework.data.domain.Pageable; 9 import org.springframework.data.domain.Pageable;
  10 +import org.springframework.data.jpa.domain.Specification;
10 import org.springframework.data.jpa.repository.EntityGraph; 11 import org.springframework.data.jpa.repository.EntityGraph;
11 import org.springframework.data.jpa.repository.Query; 12 import org.springframework.data.jpa.repository.Query;
12 import org.springframework.stereotype.Repository; 13 import org.springframework.stereotype.Repository;
@@ -19,10 +20,9 @@ public interface CarConfigInfoRepository extends BaseRepository&lt;CarConfigInfo, L @@ -19,10 +20,9 @@ public interface CarConfigInfoRepository extends BaseRepository&lt;CarConfigInfo, L
19 20
20 @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH) 21 @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
21 @Override 22 @Override
22 - Page<CarConfigInfo> findAll(Pageable pageable);  
23 - 23 + Page<CarConfigInfo> findAll(Specification<CarConfigInfo> spec, Pageable pageable);
24 24
25 @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH) 25 @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
26 @Query("select cc from CarConfigInfo cc where cc.xl.lineCode=?1") 26 @Query("select cc from CarConfigInfo cc where cc.xl.lineCode=?1")
27 List<CarConfigInfo> findBylineCode(String lineCode); 27 List<CarConfigInfo> findBylineCode(String lineCode);
28 -} 28 +}
29 \ No newline at end of file 29 \ No newline at end of file
src/main/java/com/bsth/repository/schedule/SchedulePlanRepository.java
1 -package com.bsth.repository.schedule;  
2 -  
3 -import com.bsth.entity.schedule.SchedulePlan;  
4 -import com.bsth.repository.BaseRepository;  
5 -import org.springframework.stereotype.Repository;  
6 -  
7 -/**  
8 - * Created by xu on 16/6/16.  
9 - */  
10 -@Repository  
11 -public interface SchedulePlanRepository extends BaseRepository<SchedulePlan, Long> {  
12 -} 1 +package com.bsth.repository.schedule;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlan;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + * Created by xu on 16/6/16.
  9 + */
  10 +@Repository
  11 +public interface SchedulePlanRepository extends BaseRepository<SchedulePlan, Long> {
  12 +}
src/main/java/com/bsth/service/CarDeviceService.java
1 -package com.bsth.service;  
2 -  
3 -import com.bsth.entity.CarDevice;  
4 -  
5 -/**  
6 - * Created by xu on 16/6/15.  
7 - */  
8 -public interface CarDeviceService extends BaseService<CarDevice, Long> {  
9 -} 1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +
  5 +/**
  6 + * Created by xu on 16/6/15.
  7 + */
  8 +public interface CarDeviceService extends BaseService<CarDevice, Long> {
  9 +}
src/main/java/com/bsth/service/CarParkService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.CarPark;
  7 +
  8 +public interface CarParkService extends BaseService<CarPark, Integer> {
  9 +
  10 + Map<String, Object> carParkSave(Map<String, Object> map);
  11 +
  12 + List<Map<String, Object>> findCarParkInfoFormId(Map<String, Object> map);
  13 +
  14 + Map<String, Object> carParkUpdate(Map<String, Object> map);
  15 +
  16 +}
src/main/java/com/bsth/service/LineService.java
@@ -22,7 +22,7 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; { @@ -22,7 +22,7 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; {
22 /** 22 /**
23 * 获取线路编码 23 * 获取线路编码
24 * 24 *
25 - * @return int <lineCode:线路编码> 25 + * @return long <lineCode:线路编码>
26 */ 26 */
27 - int selectMaxIdToLineCode(); 27 + long selectMaxIdToLineCode();
28 } 28 }
src/main/java/com/bsth/service/PersonnelService.java
1 -package com.bsth.service;  
2 -  
3 -import com.bsth.entity.Personnel;  
4 -  
5 -/**  
6 - * Created by xu on 16/6/15.  
7 - */  
8 -public interface PersonnelService extends BaseService<Personnel, Integer> {  
9 -} 1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +
  5 +/**
  6 + * Created by xu on 16/6/15.
  7 + */
  8 +public interface PersonnelService extends BaseService<Personnel, Integer> {
  9 +}
src/main/java/com/bsth/service/SectionRouteService.java
@@ -23,4 +23,13 @@ import com.bsth.entity.SectionRoute; @@ -23,4 +23,13 @@ import com.bsth.entity.SectionRoute;
23 public interface SectionRouteService extends BaseService<SectionRoute, Integer> { 23 public interface SectionRouteService extends BaseService<SectionRoute, Integer> {
24 24
25 List<Map<String, Object>> getSectionRoute(Map<String, Object> map); 25 List<Map<String, Object>> getSectionRoute(Map<String, Object> map);
  26 +
  27 + /**
  28 + * @Description : TODO(根据路段路由Id查询详情)
  29 + *
  30 + * @param map <id:路段路由ID>
  31 + *
  32 + * @return List<Map<String, Object>>
  33 + */
  34 + List<Map<String, Object>> findSectionRouteInfoFormId(Map<String, Object> map);
26 } 35 }
src/main/java/com/bsth/service/StationRouteService.java
@@ -59,4 +59,23 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt; @@ -59,4 +59,23 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
59 * @return Map<String, Object> <SUCCESS ; ERROR> 59 * @return Map<String, Object> <SUCCESS ; ERROR>
60 */ 60 */
61 Map<String, Object> stationRouteIsDestroy(Map<String, Object> map); 61 Map<String, Object> stationRouteIsDestroy(Map<String, Object> map);
  62 +
  63 + /**
  64 + * @Description : TODO(根据线路ID生成行单)
  65 + *
  66 + * @param map <id:线路ID>
  67 + *
  68 + * @return Map<String, Object> <SUCCESS ; ERROR>
  69 + */
  70 + Map<String, Object> usingSingle(Map<String, Object> map);
  71 +
  72 +
  73 + /**
  74 + * @Description : TODO(根据站点路由Id查询详情)
  75 + *
  76 + * @param map <id:站点路由ID>
  77 + *
  78 + * @return List<Map<String, Object>>
  79 + */
  80 + List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map);
62 } 81 }
src/main/java/com/bsth/service/StationService.java
@@ -34,7 +34,6 @@ public interface StationService extends BaseService&lt;Station, Integer&gt; { @@ -34,7 +34,6 @@ public interface StationService extends BaseService&lt;Station, Integer&gt; {
34 34
35 Map<String, Object> manualSave(Map<String, Object> map); 35 Map<String, Object> manualSave(Map<String, Object> map);
36 36
37 - int getStationCode();  
38 37
39 /** 38 /**
40 * @Description :TODO(新增站点保存) 39 * @Description :TODO(新增站点保存)
src/main/java/com/bsth/service/impl/CarDeviceServiceImpl.java
1 -package com.bsth.service.impl;  
2 -  
3 -import com.bsth.entity.CarDevice;  
4 -import com.bsth.service.CarDeviceService;  
5 -import org.springframework.stereotype.Service;  
6 -  
7 -/**  
8 - * Created by xu on 16/6/15.  
9 - */  
10 -@Service  
11 -public class CarDeviceServiceImpl extends BaseServiceImpl<CarDevice, Long> implements CarDeviceService {  
12 -} 1 +package com.bsth.service.impl;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +import com.bsth.service.CarDeviceService;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +/**
  8 + * Created by xu on 16/6/15.
  9 + */
  10 +@Service
  11 +public class CarDeviceServiceImpl extends BaseServiceImpl<CarDevice, Long> implements CarDeviceService {
  12 +}
src/main/java/com/bsth/service/impl/CarParkServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.Date;
  6 +import java.util.HashMap;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import com.bsth.common.ResponseCode;
  11 +import com.bsth.entity.CarPark;
  12 +import com.bsth.repository.CarParkRepository;
  13 +import com.bsth.service.CarParkService;
  14 +
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.stereotype.Service;
  17 +
  18 +
  19 +@Service
  20 +public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implements CarParkService {
  21 +
  22 + @Autowired
  23 + CarParkRepository carParkRepository;
  24 +
  25 + @Override
  26 + public Map<String, Object> carParkSave(Map<String, Object> map) {
  27 +
  28 + Map<String, Object> resultMap = new HashMap<String, Object>();
  29 +
  30 + try {
  31 +
  32 + // 停车场编码
  33 + String parkCode = map.get("parkCode").equals("") ? null : map.get("parkCode").toString();
  34 +
  35 + // 停车场id
  36 + Integer id = Integer.parseInt(parkCode);
  37 +
  38 + // 停车场名称
  39 + String parkName = map.get("parkName").equals("") ? "" : map.get("parkName").toString();
  40 +
  41 + // 地理位置(百度坐标集合)
  42 + String bParkPoint = map.get("bParkPoint").equals("") ? "" : map.get("bParkPoint").toString();
  43 +
  44 + // 地理位置(WGS坐标集合)
  45 + String gParkPoint = map.get("gParkPoint").equals("") ? "" :map.get("gParkPoint").toString();
  46 +
  47 + // 地理位置中心点(百度坐标)
  48 + String bCenterPoint = map.get("bCenterPoint").equals("") ? "" : map.get("bCenterPoint").toString();
  49 +
  50 + // 地理位置中心点(WGS坐标)
  51 + String gCenterPoint = map.get("gCenterPoint").equals("") ? "" : map.get("gCenterPoint").toString();
  52 +
  53 + // 坐标类型
  54 + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
  55 +
  56 + // 图形类型
  57 + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
  58 +
  59 + // 半径
  60 + Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString());
  61 +
  62 + // 面积
  63 + double area = map.get("area").equals("") ? null : Double.parseDouble(map.get("area").toString());
  64 +
  65 + // 公司
  66 + String company = map.get("company").equals("") ? "" : map.get("company").toString();
  67 +
  68 + // 分公司
  69 + String brancheCompany = map.get("brancheCompany").equals("") ? "" : map.get("brancheCompany").toString();
  70 +
  71 + // 是否撤销
  72 + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
  73 +
  74 + // 版本号
  75 + Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString());
  76 +
  77 + // 描述与说明
  78 + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
  79 +
  80 + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
  81 +
  82 + Date date = new Date();
  83 +
  84 + // 创建日期
  85 + String createDate = formatter.format(date);
  86 +
  87 + // 修改日期
  88 + String updateDate = formatter.format(date);
  89 +
  90 + // 创建人
  91 + Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString());
  92 +
  93 + // 修改人
  94 + Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString());
  95 +
  96 + carParkRepository.carParkSave(id, area, company, parkCode, parkName,
  97 +
  98 + brancheCompany, createBy, createDate, descriptions, destroy,
  99 +
  100 + updateBy, updateDate, versions, bCenterPoint, bParkPoint,
  101 +
  102 + dbType, gCenterPoint, gParkPoint, radius, shapesType);
  103 +
  104 + resultMap.put("status", ResponseCode.SUCCESS);
  105 +
  106 + } catch (Exception e) {
  107 +
  108 + resultMap.put("status", ResponseCode.ERROR);
  109 +
  110 + logger.error("save erro.", e);
  111 +
  112 + }
  113 +
  114 + return resultMap;
  115 + }
  116 +
  117 + @Override
  118 + public List<Map<String, Object>> findCarParkInfoFormId(Map<String, Object> map) {
  119 +
  120 + // 获取线路ID
  121 + Integer id = map.get("id").equals("") ? 0 : Integer.parseInt(map.get("id").toString());
  122 +
  123 + List<Object[]> objects = carParkRepository.findCarParkInfoFormId(id);
  124 +
  125 + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  126 +
  127 + int len = objects.size();
  128 +
  129 + if(objects.size()>0) {
  130 +
  131 + for(int i = 0 ; i < len; i++) {
  132 +
  133 + Map<String, Object> tempM = new HashMap<String,Object>();
  134 +
  135 + tempM.put("carParkId", objects.get(i)[0]);
  136 +
  137 + tempM.put("carParkArea", objects.get(i)[1]);
  138 +
  139 + tempM.put("carParkCompany", objects.get(i)[2]);
  140 +
  141 + tempM.put("carParkCode", objects.get(i)[3]);
  142 +
  143 + tempM.put("carParkName", objects.get(i)[4]);
  144 +
  145 + tempM.put("carParkBrancheCompany", objects.get(i)[5]);
  146 +
  147 + tempM.put("carParkCreateBy", objects.get(i)[6]);
  148 +
  149 + tempM.put("carParkCreateDate", objects.get(i)[7]);
  150 +
  151 + tempM.put("carParkDescriptions", objects.get(i)[8]);
  152 +
  153 + tempM.put("carParkDestroy", objects.get(i)[9]);
  154 +
  155 + tempM.put("carParkUpdate", objects.get(i)[10]);
  156 +
  157 + tempM.put("carParkUpdateDate", objects.get(i)[11]);
  158 +
  159 + tempM.put("carParkVersions", objects.get(i)[12]);
  160 +
  161 + tempM.put("carParkBcenterPoint", objects.get(i)[13]);
  162 +
  163 + tempM.put("carParkBparkPoint", objects.get(i)[14]);
  164 +
  165 + tempM.put("carParkGcenterPoint", objects.get(i)[15]);
  166 +
  167 + tempM.put("carParkGparkPoint", objects.get(i)[16]);
  168 +
  169 + tempM.put("carParkDBtype", objects.get(i)[17]);
  170 +
  171 + tempM.put("carParkRadius", objects.get(i)[18]);
  172 +
  173 + tempM.put("carParkShapesType", objects.get(i)[19]);
  174 +
  175 + resultList.add(tempM);
  176 + }
  177 +
  178 + }
  179 +
  180 + return resultList;
  181 + }
  182 +
  183 + @Override
  184 + public Map<String, Object> carParkUpdate(Map<String, Object> map) {
  185 + Map<String, Object> resultMap = new HashMap<String, Object>();
  186 +
  187 + try {
  188 +
  189 + // id
  190 + Integer id = map.get("id").equals("") ? null : Integer.parseInt(map.get("id").toString());
  191 +
  192 + if(id!=null) {
  193 +
  194 + // 面积
  195 + double area = map.get("area").equals("") ? null : Double.parseDouble(map.get("area").toString());
  196 +
  197 + // 中心点(百度坐标)
  198 + String bCenterPoint = map.get("bCenterPoint").equals("") ? "" : map.get("bCenterPoint").toString();
  199 +
  200 + // 图形坐标点集合(百度坐标)
  201 + String bParkPoint = map.get("bParkPoint").equals("") ? "" : map.get("bParkPoint").toString();
  202 +
  203 + // 分公司
  204 + String brancheCompany = map.get("brancheCompany").equals("")? "" :map.get("brancheCompany").toString();
  205 +
  206 + // 公司
  207 + String company = map.get("company").equals("") ? "" : map.get("company").toString();
  208 +
  209 + // 坐标类型
  210 + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
  211 +
  212 + // 描述与说明
  213 + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
  214 +
  215 + // 是否撤销
  216 + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
  217 +
  218 + // 中心点(WGS坐标)
  219 + String gCenterPoint = map.get("gCenterPoint").equals("") ? "" : map.get("gCenterPoint").toString();
  220 +
  221 + // 图形坐标点集合(WGS坐标)
  222 + String gParkPoint = map.get("gParkPoint").equals("") ? "" : map.get("gParkPoint").toString();
  223 +
  224 + // 编码
  225 + String parkCode = map.get("parkCode").equals("") ? "" : map.get("parkCode").toString();
  226 +
  227 + // 名称
  228 + String parkName = map.get("parkName").equals("") ? "" : map.get("parkName").toString();
  229 +
  230 + // 半径
  231 + Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString());
  232 +
  233 + // 图形类型
  234 + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
  235 +
  236 + // 版本
  237 + Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString());
  238 +
  239 + // 创建人
  240 + Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString());
  241 +
  242 + // 创建日期
  243 + String createDate = map.get("createDate").equals("") ? "" : map.get("createDate").toString();
  244 +
  245 + Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString());
  246 +
  247 + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
  248 +
  249 + Date date = new Date();
  250 +
  251 + // 修改日期
  252 + String updateDate = formatter.format(date);
  253 +
  254 + carParkRepository.carParkUpdate(area, company, parkCode, parkName, brancheCompany, createBy, createDate, descriptions, destroy, updateBy, updateDate, versions, bCenterPoint, gCenterPoint, bParkPoint, gParkPoint, dbType, radius, shapesType, id);
  255 +
  256 + }
  257 +
  258 + resultMap.put("status", ResponseCode.SUCCESS);
  259 +
  260 + } catch (Exception e) {
  261 +
  262 + resultMap.put("status", ResponseCode.ERROR);
  263 +
  264 + logger.error("save erro.", e);
  265 +
  266 + }
  267 +
  268 + return resultMap;
  269 + }
  270 +
  271 +}
src/main/java/com/bsth/service/impl/LineServiceImpl.java
@@ -34,7 +34,7 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L @@ -34,7 +34,7 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L
34 * 34 *
35 * @return int <lineCode:线路编码> 35 * @return int <lineCode:线路编码>
36 */ 36 */
37 - public int selectMaxIdToLineCode() { 37 + public long selectMaxIdToLineCode() {
38 // TODO Auto-generated method stub 38 // TODO Auto-generated method stub
39 return repository.selectMaxIdToLineCode(); 39 return repository.selectMaxIdToLineCode();
40 } 40 }
src/main/java/com/bsth/service/impl/PersonnelServiceImpl.java
1 -package com.bsth.service.impl;  
2 -  
3 -import com.bsth.entity.Personnel;  
4 -import com.bsth.service.PersonnelService;  
5 -import org.springframework.stereotype.Service;  
6 -  
7 -/**  
8 - * Created by xu on 16/6/15.  
9 - */  
10 -@Service  
11 -public class PersonnelServiceImpl extends BaseServiceImpl<Personnel, Integer> implements PersonnelService {  
12 -} 1 +package com.bsth.service.impl;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +import com.bsth.service.PersonnelService;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +/**
  8 + * Created by xu on 16/6/15.
  9 + */
  10 +@Service
  11 +public class PersonnelServiceImpl extends BaseServiceImpl<Personnel, Integer> implements PersonnelService {
  12 +}
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
@@ -91,4 +91,104 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ @@ -91,4 +91,104 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
91 return resultList; 91 return resultList;
92 } 92 }
93 93
  94 + /**
  95 + * @Description : TODO(根据路段路由Id查询详情)
  96 + *
  97 + * @param map <id:路段路由ID>
  98 + *
  99 + * @return List<Map<String, Object>>
  100 + */
  101 + @Override
  102 + public List<Map<String, Object>> findSectionRouteInfoFormId(Map<String, Object> map) {
  103 +
  104 + // 获取线路ID
  105 + Integer id = map.get("id").equals("") ? 0 : Integer.parseInt(map.get("id").toString());
  106 +
  107 + List<Object[]> objects = repository.findSectionRouteInfoFormId(id);
  108 +
  109 + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  110 +
  111 + int len = objects.size();
  112 +
  113 + if(objects.size()>0) {
  114 +
  115 + for(int i = 0 ; i < len; i++) {
  116 + Map<String, Object> tempM = new HashMap<String,Object>();
  117 +
  118 + tempM.put("sectionRouteId", objects.get(i)[0]);
  119 +
  120 + tempM.put("sectionRouteLineCode", objects.get(i)[1]);
  121 +
  122 + tempM.put("sectionRouteCode", objects.get(i)[2]);
  123 +
  124 + tempM.put("sectionRouteDirections", objects.get(i)[3]);
  125 +
  126 + tempM.put("sectionRouteLine", objects.get(i)[4]);
  127 +
  128 + tempM.put("sectionRouteSection", objects.get(i)[5]);
  129 +
  130 + tempM.put("sectionRouteDescriptions", objects.get(i)[6]);
  131 +
  132 + tempM.put("sectionRouteCreateBy", objects.get(i)[7]);
  133 +
  134 + tempM.put("sectionRouteCreateDate", objects.get(i)[8]);
  135 +
  136 + tempM.put("sectionRouteUpdateBy", objects.get(i)[9]);
  137 +
  138 + tempM.put("sectionRouteUpdateDate", objects.get(i)[10]);
  139 +
  140 + tempM.put("sectionRouteVersions", objects.get(i)[11]);
  141 +
  142 + tempM.put("sectionRouteDestroy", objects.get(i)[12]);
  143 +
  144 + tempM.put("sectionId", objects.get(i)[13]);
  145 +
  146 + tempM.put("sectionCode", objects.get(i)[14]);
  147 +
  148 + tempM.put("sectionName", objects.get(i)[15]);
  149 +
  150 + tempM.put("sectionRoadCoding", objects.get(i)[16]);
  151 +
  152 + tempM.put("sectionEndCode", objects.get(i)[17]);
  153 +
  154 + tempM.put("sectionStartNode", objects.get(i)[18]);
  155 +
  156 + tempM.put("sectionMiddleNode", objects.get(i)[19]);
  157 +
  158 + tempM.put("sectionType", objects.get(i)[20]);
  159 +
  160 + tempM.put("sectionCsectionVector", objects.get(i)[21]);
  161 +
  162 + tempM.put("sectionBsectionVector", objects.get(i)[22]);
  163 +
  164 + tempM.put("sectionGsectionVector", objects.get(i)[23]);
  165 +
  166 + tempM.put("sectionDistance", objects.get(i)[24]);
  167 +
  168 + tempM.put("sectionTime", objects.get(i)[25]);
  169 +
  170 + tempM.put("sectionDbtype", objects.get(i)[26]);
  171 +
  172 + tempM.put("sectionSpeedLimit", objects.get(i)[27]);
  173 +
  174 + tempM.put("sectionDescriptions", objects.get(i)[28]);
  175 +
  176 + tempM.put("sectionCreateBy", objects.get(i)[29]);
  177 +
  178 + tempM.put("sectionCreateDate", objects.get(i)[30]);
  179 +
  180 + tempM.put("sectionUpdateBy", objects.get(i)[31]);
  181 +
  182 + tempM.put("sectionUpdateDate", objects.get(i)[32]);
  183 +
  184 + tempM.put("sectionVersion", objects.get(i)[33]);
  185 +
  186 + resultList.add(tempM);
  187 + }
  188 +
  189 + }
  190 +
  191 + return resultList;
  192 + }
  193 +
94 } 194 }
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
  3 +import java.io.ByteArrayInputStream;
  4 +import java.io.InputStream;
3 import java.util.ArrayList; 5 import java.util.ArrayList;
4 import java.util.HashMap; 6 import java.util.HashMap;
5 import java.util.List; 7 import java.util.List;
@@ -17,6 +19,7 @@ import com.bsth.repository.SectionRouteRepository; @@ -17,6 +19,7 @@ import com.bsth.repository.SectionRouteRepository;
17 import com.bsth.repository.StationRepository; 19 import com.bsth.repository.StationRepository;
18 import com.bsth.repository.StationRouteRepository; 20 import com.bsth.repository.StationRouteRepository;
19 import com.bsth.service.StationRouteService; 21 import com.bsth.service.StationRouteService;
  22 +import com.bsth.util.FTPClientUtils;
20 23
21 /** 24 /**
22 * 25 *
@@ -482,4 +485,220 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -482,4 +485,220 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
482 485
483 return resultMap; 486 return resultMap;
484 } 487 }
  488 +
  489 + /**
  490 + * @Description : TODO(根据线路ID生成行单)
  491 + *
  492 + * @param map <lineId:线路ID>
  493 + *
  494 + * @return Map<String, Object> <SUCCESS ; ERROR>
  495 + */
  496 + @Override
  497 + public Map<String, Object> usingSingle(Map<String, Object> map) {
  498 +
  499 + Map<String, Object> resultMap = new HashMap<String,Object>();
  500 +
  501 + try {
  502 +
  503 + // 获取线路ID
  504 + Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
  505 +
  506 + Line line = lineRepository.findOne(lineId);
  507 +
  508 + List<Object[]> objects = repository.usingSingle(lineId);
  509 +
  510 + String stationRStr = "";
  511 +
  512 + // windows下的文本文件换行符
  513 + String enterStr = "\r\n";
  514 +
  515 + // linux/unix下的文本文件换行符
  516 + // String enterStr = "\r";
  517 +
  518 + if(objects.size()>0) {
  519 +
  520 + for(int i = 0; i<objects.size();i++) {
  521 +
  522 + // 经度
  523 + String lng = objects.get(i)[0].toString();
  524 +
  525 + // 纬度
  526 + String lat = " " + objects.get(i)[1].toString();
  527 +
  528 + // 站点类型
  529 + String stationMake = objects.get(i)[3].toString();
  530 +
  531 + if(stationMake.equals("E")) {
  532 +
  533 + stationMake = " " + "2";
  534 +
  535 + }else {
  536 +
  537 + stationMake =" " + "1";
  538 +
  539 + }
  540 +
  541 + // 站点序号
  542 + String stationNo = " " + objects.get(i)[4].toString();
  543 +
  544 + // 站点编码
  545 + String stationCode = " " + objects.get(i)[5].toString();
  546 +
  547 + double tempd = Double.parseDouble(objects.get(i)[6].toString())*1000;
  548 +
  549 + // 站点距离
  550 + String staitondistance = " " + String.valueOf((int) tempd);
  551 +
  552 + // 限速
  553 + String sleepStr = " " + "60";
  554 +
  555 + // 站点名称
  556 + String staitonName = " " + objects.get(i)[7].toString();
  557 +
  558 + stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + staitonName + enterStr;
  559 +
  560 + }
  561 +
  562 + }
  563 +
  564 + System.out.println(stationRStr);
  565 +
  566 + FTPClientUtils ftpClientUtils = new FTPClientUtils();
  567 +
  568 + String url = "192.168.168.101";
  569 +
  570 + int port = 21;
  571 +
  572 + String username = "testftpservice";
  573 +
  574 + String password = "123";
  575 +
  576 + String path = "C:/ftptest";
  577 +
  578 + String filename = line.getLineCode() + ".txt";
  579 +
  580 + stationRStr = line.getName() + enterStr + stationRStr;
  581 +
  582 + InputStream input = new ByteArrayInputStream(stationRStr.getBytes("utf-8"));
  583 +
  584 + boolean b = ftpClientUtils.uploadFile(url, port, username, password, path, filename, input);
  585 +
  586 + System.out.println(b);
  587 +
  588 + resultMap.put("status", ResponseCode.SUCCESS);
  589 +
  590 + } catch (Exception e) {
  591 +
  592 + resultMap.put("status", ResponseCode.ERROR);
  593 +
  594 + logger.error("save erro.", e);
  595 +
  596 + }
  597 + return resultMap;
  598 + }
  599 +
  600 + @Override
  601 + public List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map) {
  602 +
  603 + // 获取线路ID
  604 + Integer id = map.get("id").equals("") ? 0 : Integer.parseInt(map.get("id").toString());
  605 +
  606 + List<Object[]> objects = repository.findStationRouteInfo(id);
  607 +
  608 + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  609 +
  610 + int len = objects.size();
  611 +
  612 + if(objects.size()>0) {
  613 +
  614 + for(int i = 0 ; i < len; i++) {
  615 + Map<String, Object> tempM = new HashMap<String,Object>();
  616 +
  617 + tempM.put("stationRouteLine", objects.get(i)[0]);
  618 +
  619 + tempM.put("stationRouteStation", objects.get(i)[1]);
  620 +
  621 + tempM.put("stationRouteCode", objects.get(i)[2]);
  622 +
  623 + tempM.put("stationRouteLIneCode", objects.get(i)[3]);
  624 +
  625 + tempM.put("stationRouteStationMark", objects.get(i)[4]);
  626 +
  627 + tempM.put("stationOutStationNmber", objects.get(i)[5]);
  628 +
  629 + tempM.put("stationRoutedirections", objects.get(i)[6]);
  630 +
  631 + tempM.put("stationRouteDistances", objects.get(i)[7]);
  632 +
  633 + tempM.put("stationRouteToTime", objects.get(i)[8]);
  634 +
  635 + tempM.put("staitonRouteFirstTime", objects.get(i)[9]);
  636 +
  637 + tempM.put("stationRouteEndTime", objects.get(i)[10]);
  638 +
  639 + tempM.put("stationRouteDescriptions", objects.get(i)[11]);
  640 +
  641 + tempM.put("stationRouteDestroy", objects.get(i)[12]);
  642 +
  643 + tempM.put("stationRouteVersions", objects.get(i)[13]);
  644 +
  645 + tempM.put("stationRouteCreateBy", objects.get(i)[14]);
  646 +
  647 + tempM.put("stationRouteCreateDate", objects.get(i)[15]);
  648 +
  649 + tempM.put("stationRouteUpdateBy", objects.get(i)[16]);
  650 +
  651 + tempM.put("stationRouteUpdateDate", objects.get(i)[17]);
  652 +
  653 + tempM.put("stationId", objects.get(i)[18]);
  654 +
  655 + tempM.put("stationCode", objects.get(i)[19]);
  656 +
  657 + tempM.put("stationName", objects.get(i)[20]);
  658 +
  659 + tempM.put("stationRoadCoding", objects.get(i)[21]);
  660 +
  661 + tempM.put("stationDbType", objects.get(i)[22]);
  662 +
  663 + tempM.put("stationJwpoints", objects.get(i)[23]);
  664 +
  665 + tempM.put("stationGlonx", objects.get(i)[24]);
  666 +
  667 + tempM.put("stationGlaty", objects.get(i)[25]);
  668 +
  669 + tempM.put("stationX", objects.get(i)[26]);
  670 +
  671 + tempM.put("stationY", objects.get(i)[27]);
  672 +
  673 + tempM.put("stationBPolyonGrid", objects.get(i)[28]);
  674 +
  675 + tempM.put("stationGPloyonGrid", objects.get(i)[29]);
  676 +
  677 + tempM.put("stationDestroy", objects.get(i)[30]);
  678 +
  679 + tempM.put("stationRadius", objects.get(i)[31]);
  680 +
  681 + tempM.put("stationShapesType", objects.get(i)[32]);
  682 +
  683 + tempM.put("stationVersions", objects.get(i)[33]);
  684 +
  685 + tempM.put("sttationDescriptions", objects.get(i)[34]);
  686 +
  687 + tempM.put("stationCreateBy", objects.get(i)[35]);
  688 +
  689 + tempM.put("stationCreateDate", objects.get(i)[36]);
  690 +
  691 + tempM.put("stationUpdateBy", objects.get(i)[37]);
  692 +
  693 + tempM.put("stationUpdateDate", objects.get(i)[38]);
  694 +
  695 + tempM.put("stationRouteId", objects.get(i)[39]);
  696 +
  697 + resultList.add(tempM);
  698 + }
  699 +
  700 + }
  701 +
  702 + return resultList;
  703 + }
485 } 704 }
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -16,16 +16,19 @@ import com.alibaba.fastjson.JSONArray; @@ -16,16 +16,19 @@ import com.alibaba.fastjson.JSONArray;
16 import com.alibaba.fastjson.JSONObject; 16 import com.alibaba.fastjson.JSONObject;
17 import com.bsth.common.ResponseCode; 17 import com.bsth.common.ResponseCode;
18 import com.bsth.entity.Line; 18 import com.bsth.entity.Line;
  19 +import com.bsth.entity.LineInformation;
19 import com.bsth.entity.Section; 20 import com.bsth.entity.Section;
20 import com.bsth.entity.SectionRoute; 21 import com.bsth.entity.SectionRoute;
21 import com.bsth.entity.Station; 22 import com.bsth.entity.Station;
22 import com.bsth.entity.StationRoute; 23 import com.bsth.entity.StationRoute;
  24 +import com.bsth.repository.LineInformationRepository;
23 import com.bsth.repository.LineRepository; 25 import com.bsth.repository.LineRepository;
24 import com.bsth.repository.SectionRepository; 26 import com.bsth.repository.SectionRepository;
25 import com.bsth.repository.SectionRouteRepository; 27 import com.bsth.repository.SectionRouteRepository;
26 import com.bsth.repository.StationRepository; 28 import com.bsth.repository.StationRepository;
27 import com.bsth.repository.StationRouteRepository; 29 import com.bsth.repository.StationRouteRepository;
28 import com.bsth.service.StationService; 30 import com.bsth.service.StationService;
  31 +import com.bsth.util.GetUIDAndCode;
29 32
30 /** 33 /**
31 * 34 *
@@ -52,6 +55,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -52,6 +55,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
52 @Autowired 55 @Autowired
53 private StationRouteRepository routeRepository; 56 private StationRouteRepository routeRepository;
54 57
  58 + @Autowired
  59 + private LineInformationRepository informationRepository;
  60 +
55 @Autowired 61 @Autowired
56 private LineRepository lineRepository; 62 private LineRepository lineRepository;
57 63
@@ -103,327 +109,521 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -103,327 +109,521 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
103 // 线路ID 109 // 线路ID
104 int lineId = map.get("lineId").toString().equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); 110 int lineId = map.get("lineId").toString().equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
105 111
106 - Double sectionDistance = 0.0; 112 + // 半径
  113 + int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());
  114 +
  115 + // 图形类型
  116 + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
  117 +
  118 + // 路段距离
  119 + Double sectionDistance = 0.0d;
107 120
108 - Double sectionDuration = 0.0; 121 + // 路段时长
  122 + Double sectionDuration = 0.0d;
  123 +
  124 + // 里程(上或者下)
  125 + double sumUpOrDownMileage = 0.0d;
109 126
110 // 线路信息 127 // 线路信息
111 Line resultLine = lineRepository.findOne(lineId); 128 Line resultLine = lineRepository.findOne(lineId);
112 129
  130 + Map<String, Object> resultSaveMapm = new HashMap<String,Object>();
  131 +
113 if(!stationJSON.equals("")) { 132 if(!stationJSON.equals("")) {
114 133
115 - JSONArray stationsArray = JSONArray.parseArray(stationJSON);  
116 -  
117 - if(stationsArray.size()>0) {  
118 -  
119 - for(int i = 0;i <stationsArray.size();i++) {  
120 -  
121 - // 站点名称  
122 - String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString();  
123 -  
124 - Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString());  
125 -  
126 - // 转成公里  
127 - distance = distance/1000;  
128 -  
129 - BigDecimal d = new BigDecimal(distance);  
130 -  
131 - distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();  
132 -  
133 - sectionDistance= distance + sectionDistance;  
134 -  
135 - Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString());  
136 -  
137 - // 转成分钟  
138 - duration = duration/60;  
139 -  
140 - BigDecimal t = new BigDecimal(duration);  
141 -  
142 - duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();  
143 -  
144 - sectionDuration = duration + sectionDuration;  
145 -  
146 - // 百度经纬度坐标  
147 - String bJwpoints = "";  
148 -  
149 - // 百度坐标经度  
150 - String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString();  
151 -  
152 - // 百度坐标纬度  
153 - String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString();  
154 -  
155 - // 百度经纬度  
156 - bJwpoints = bLonx + " " + bLatx;  
157 -  
158 - List<Object[]> stationNameList = repository.findStationName(stationName);  
159 -  
160 - boolean isHave = isHaveStationname(bJwpoints,stationNameList);  
161 -  
162 - // 初始化站点对象  
163 - Station arg0 = new Station();  
164 -  
165 - // 站点编码  
166 - int stationCode = 0;  
167 -  
168 - if(isHave) {  
169 -  
170 - Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());  
171 -  
172 - arg0 = repository.findOne(stationId);  
173 -  
174 - stationCode = Integer.parseInt(arg0.getStationCod());  
175 -  
176 - }else {  
177 -  
178 - stationCode = repository.stationMaxId();  
179 -  
180 - arg0.setStationName(stationName);  
181 -  
182 - // 原坐标类型  
183 - arg0.setDbType(dbType);  
184 -  
185 - // 站点地理位置WGS坐标经度  
186 - String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();  
187 - arg0.setgLonx(Float.parseFloat(gLonx));  
188 -  
189 - // 站点地理位置WGS坐标纬度  
190 - String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();  
191 - arg0.setgLaty(Float.parseFloat(gLaty));  
192 -  
193 - // 半径  
194 - int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());  
195 - arg0.setRadius(radius);  
196 -  
197 - // 图形类型  
198 - String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();  
199 - arg0.setShapesType(shapesType);  
200 -  
201 - // 站点编码  
202 - arg0.setStationCod(String.valueOf(stationCode+1));  
203 -  
204 - // 是否想撤销  
205 - arg0.setDestroy(destroy);  
206 -  
207 - // 版本号  
208 - arg0.setVersions(versions);  
209 -  
210 - arg0.setbJwpoints(bJwpoints);  
211 -  
212 - // 插入站点信息  
213 - repository.save(arg0);  
214 -  
215 - }  
216 -  
217 - // 站点路由对象  
218 - StationRoute route = new StationRoute();  
219 -  
220 - // 站点名称  
221 - route.setStationName(stationName);  
222 -  
223 - route.setDistances(distance);  
224 -  
225 - route.setToTime(duration);  
226 -  
227 -  
228 - // 站点编码  
229 - route.setStationCode(arg0.getStationCod());  
230 -  
231 - // 站点序号  
232 - route.setStationRouteCode((i+1)*100);  
233 -  
234 - // 站点类型  
235 - if(i==0) {  
236 -  
237 - // 起始站  
238 - route.setStationMark("B");  
239 -  
240 - }else if(i==stationsArray.size()-1) {  
241 -  
242 - // 终点站  
243 - route.setStationMark("E");  
244 -  
245 - }else {  
246 -  
247 - // 中途站  
248 - route.setStationMark("Z");  
249 -  
250 - }  
251 -  
252 - // 版本号  
253 - route.setVersions(versions);  
254 -  
255 - // 站点ID  
256 - route.setStation(arg0);  
257 -  
258 - // 方向  
259 - route.setDirections(directions);  
260 -  
261 - // 线路ID  
262 - route.setLine(resultLine);  
263 -  
264 - // 线路编码  
265 - route.setLineCode(resultLine.getLineCode());  
266 -  
267 - route.setDestroy(destroy);  
268 -  
269 - // 插入站点路由信息  
270 - routeRepository.save(route);  
271 -  
272 - }  
273 -  
274 - } 134 + resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine);
275 135
276 } 136 }
277 137
  138 + sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString());
  139 +
  140 + sectionDuration= Double.valueOf(resultSaveMapm.get("sectionDuration").toString());
  141 +
278 // 如果路段信息JSON字符串不为空 142 // 如果路段信息JSON字符串不为空
279 if(!sectionJSON.equals("")) { 143 if(!sectionJSON.equals("")) {
280 144
281 - // 转换成JSON数组  
282 - JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); 145 + saveSectionAndSectionRouteInfo( sectionJSON, directions, resultLine, speedLimitStr,sectionDistance, sectionDuration, dbType, versions, destroy);
  146 + }
  147 +
  148 + sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString());
  149 +
  150 + updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage);
  151 +
  152 + resultMap.put("status", ResponseCode.SUCCESS);
  153 +
  154 + } catch (Exception e) {
  155 +
  156 + resultMap.put("status", ResponseCode.ERROR);
  157 +
  158 + logger.error("save erro.", e);
  159 +
  160 + }
  161 +
  162 + return resultMap;
  163 + }
  164 +
  165 +
  166 + /**
  167 + * @Description :保存站点和站点路由信息(系统规划)
  168 + *
  169 + * @param stationJSON:站点和站点路由json数据
  170 + *
  171 + * @param sectionDistance: 总距离
  172 + *
  173 + * @param sectionDuration: 总时长
  174 + *
  175 + * @param dbType:原坐标类型
  176 + *
  177 + * @param radius:半径
  178 + *
  179 + * @param shapesType:图形类型
  180 + *
  181 + * @param destroy:是否撤销
  182 + *
  183 + * @param versions:版本
  184 + *
  185 + * @param sumUpOrDownMileage:里程(上或者下)
  186 + *
  187 + * @param directions:方向
  188 + *
  189 + * @param resultLine:线路实体类
  190 + *
  191 + * @return
  192 + *
  193 + * @throws Exception
  194 + */
  195 + public Map<String, Object> savaStationAndStationRouteInfo(String stationJSON,double sectionDistance,double sectionDuration,String dbType,
  196 +
  197 + int radius,String shapesType,int destroy,int versions,double sumUpOrDownMileage,int directions,Line resultLine) throws Exception{
  198 +
  199 + Map<String, Object> paramsMeleageAndDistncDura = new HashMap<String,Object>();
  200 +
  201 + JSONArray stationsArray = JSONArray.parseArray(stationJSON);
  202 +
  203 + if(stationsArray.size()>0) {
  204 +
  205 + for(int i = 0;i <stationsArray.size();i++) {
283 206
284 - // 原始线状图形坐标集合  
285 - String sectionsBpoints = ""; 207 + // 站点名称
  208 + String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString();
286 209
287 - // WGS线状图形坐标集合  
288 - String sectionsWJPpoints = ""; 210 + Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString());
289 211
290 - // 遍历  
291 - for(int s = 0 ;s<sectionsArray.size();s++) { 212 + // 转成公里
  213 + distance = distance/1000;
  214 +
  215 + BigDecimal d = new BigDecimal(distance);
  216 +
  217 + distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
  218 +
  219 + sectionDistance= distance + sectionDistance;
  220 +
  221 + Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString());
  222 +
  223 + // 转成分钟
  224 + duration = duration/60;
  225 +
  226 + BigDecimal t = new BigDecimal(duration);
  227 +
  228 + duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
  229 +
  230 + sectionDuration = duration + sectionDuration;
  231 +
  232 + // 百度经纬度坐标
  233 + String bJwpoints = "";
  234 +
  235 + // 百度坐标经度
  236 + String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString();
  237 +
  238 + // 百度坐标纬度
  239 + String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString();
  240 +
  241 + // 百度经纬度
  242 + bJwpoints = bLonx + " " + bLatx;
  243 +
  244 + List<Object[]> stationNameList = repository.findStationName(stationName);
  245 +
  246 + boolean isHave = isHaveStationname(bJwpoints,stationNameList);
  247 +
  248 + // 初始化站点对象
  249 + Station arg0 = new Station();
  250 +
  251 + // 站点编码
  252 + long stationCode = 0L;
  253 +
  254 + if(isHave) {
292 255
293 - String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); 256 + Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());
294 257
295 - String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); 258 + arg0 = repository.findOne(stationId);
296 259
297 - String WGSLngStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lng").toString(); 260 + }else {
298 261
299 - String WGSLatStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lat").toString(); 262 + stationCode = GetUIDAndCode.getStationId();
300 263
301 - if(s==0) {  
302 -  
303 - sectionsBpoints = pointsLngStr + " " + pointsLatStr;  
304 -  
305 - sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;  
306 -  
307 - }else {  
308 -  
309 - sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;  
310 -  
311 - sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;  
312 -  
313 - } 264 + arg0.setStationCod(String.valueOf(stationCode));
  265 +
  266 + arg0.setId((int)stationCode);
  267 +
  268 + arg0.setStationName(stationName);
  269 +
  270 + // 原坐标类型
  271 + arg0.setDbType(dbType);
  272 +
  273 + // 站点地理位置WGS坐标经度
  274 + String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();
  275 + arg0.setgLonx(Float.parseFloat(gLonx));
  276 +
  277 + // 站点地理位置WGS坐标纬度
  278 + String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();
  279 + arg0.setgLaty(Float.parseFloat(gLaty));
  280 +
  281 + arg0.setRadius(radius);
  282 +
  283 +
  284 + arg0.setShapesType(shapesType);
314 285
  286 + // 是否想撤销
  287 + arg0.setDestroy(destroy);
  288 +
  289 + // 版本号
  290 + arg0.setVersions(versions);
  291 +
  292 + arg0.setbJwpoints(bJwpoints);
  293 +
  294 + // 插入站点信息
  295 + repository.save(arg0);
315 296
316 } 297 }
317 298
318 - int sectionMaxId = sectionRepository.sectionMaxId(); 299 + // 站点路由对象
  300 + StationRoute route = new StationRoute();
  301 +
  302 + // 站点名称
  303 + route.setStationName(stationName);
  304 +
  305 + route.setDistances(distance);
  306 +
  307 + sumUpOrDownMileage = sumUpOrDownMileage + distance;
319 308
320 - String sectionCode = String.valueOf(sectionMaxId+1); 309 + route.setToTime(duration);
321 310
322 - String upOrDownStr = "";  
323 311
324 - if(directions==0){ 312 + // 站点编码
  313 + route.setStationCode(arg0.getStationCod());
  314 +
  315 + // 站点序号
  316 + route.setStationRouteCode((i+1)*100);
  317 +
  318 + // 站点类型
  319 + if(i==0) {
  320 +
  321 + // 起始站
  322 + route.setStationMark("B");
325 323
326 - upOrDownStr = "上行路段"; 324 + }else if(i==stationsArray.size()-1) {
327 325
328 - }else if(directions==1){ 326 + // 终点站
  327 + route.setStationMark("E");
  328 +
  329 + }else {
329 330
330 - upOrDownStr = "下行路段"; 331 + // 中途站
  332 + route.setStationMark("Z");
331 333
332 } 334 }
333 335
334 - // 路段名称  
335 - String sectionName = resultLine.getName()+upOrDownStr; 336 + // 版本号
  337 + route.setVersions(versions);
336 338
337 - // 交出路  
338 - String crosesRoad = ""; 339 + // 站点ID
  340 + route.setStation(arg0);
339 341
340 - // 终止节点  
341 - String endNode = ""; 342 + // 方向
  343 + route.setDirections(directions);
342 344
343 - // 开始节点  
344 - String startNode = ""; 345 + // 线路ID
  346 + route.setLine(resultLine);
345 347
346 - // 中间节点  
347 - String middleNode = ""; 348 + // 线路编码
  349 + route.setLineCode(resultLine.getLineCode());
348 350
349 - // WGS坐标点集合  
350 - String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; 351 + route.setDestroy(destroy);
351 352
352 - // 原坐标点集合  
353 - String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; 353 + // 插入站点路由信息
  354 + routeRepository.save(route);
  355 +
  356 + }
  357 +
  358 + paramsMeleageAndDistncDura.put("sumUpOrDownMileage", sumUpOrDownMileage);
  359 +
  360 + paramsMeleageAndDistncDura.put("sectionDistance", sectionDistance);
  361 +
  362 + paramsMeleageAndDistncDura.put("sectionDuration", sectionDuration);
  363 +
  364 + }
  365 +
  366 + return paramsMeleageAndDistncDura;
  367 +
  368 + }
  369 +
  370 + /**
  371 + *
  372 + *
  373 + * @param resultLine:线路实体类
  374 + *
  375 + * @param directions:方向
  376 + *
  377 + * @param sumUpOrDownMileage:里程(上或者下)
  378 + */
  379 + public void updateLineInfoUpOrDownMileage(Line resultLine ,int directions,double sumUpOrDownMileage) {
  380 +
  381 + List<LineInformation> listLineInfo = informationRepository.findByLine(resultLine);
  382 +
  383 + int listLineSize = listLineInfo.size();
  384 +
  385 + // 不存在线路标准信息则插入
  386 + if(listLineSize==0) {
  387 +
  388 + LineInformation paramInfo = new LineInformation();
  389 +
  390 + // 上行
  391 + if(directions==0) {
354 392
355 - // 城建坐标点集合  
356 - String csectionVector = ""; 393 + paramInfo.setUpMileage(sumUpOrDownMileage);
357 394
358 - // 路段类型  
359 - String sectionType = ""; 395 + paramInfo.setDownMileage(0.0d);
360 396
361 - // 道路编码  
362 - String roadCoding = ""; 397 + paramInfo.setTotalMileage(sumUpOrDownMileage+0.0d);
363 398
364 - // 限速  
365 - double speedLimit = Double.parseDouble(speedLimitStr); 399 + paramInfo.setType("zc");
366 400
367 - // 说明  
368 - String descriptions = ""; 401 + paramInfo.setLine(resultLine);
369 402
370 - // 路段保存  
371 - sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,  
372 -  
373 - middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,  
374 -  
375 - roadCoding, sectionDistance, sectionDuration, dbType, speedLimit,  
376 -  
377 - descriptions, versions);  
378 - 403 + // 下行
  404 + }else if(directions==1) {
379 405
  406 + paramInfo.setUpMileage(0.0d);
380 407
381 - Section section = sectionRepository.findOne(Integer.parseInt(sectionCode)); 408 + paramInfo.setDownMileage(sumUpOrDownMileage);
382 409
383 - // 路段路由  
384 - SectionRoute sectionRoute = new SectionRoute(); 410 + paramInfo.setTotalMileage(sumUpOrDownMileage+0.0d);
385 411
386 - // 路段序号  
387 - sectionRoute.setSectionrouteCode(100); 412 + paramInfo.setType("zc");
388 413
389 - // 线路编码  
390 - sectionRoute.setLineCode(resultLine.getLineCode()); 414 + paramInfo.setLine(resultLine);
391 415
392 - // 路段ID  
393 - sectionRoute.setSection(section); 416 + }
  417 +
  418 + informationRepository.save(paramInfo);
  419 +
  420 + // 存在则更新
  421 + }else if(listLineSize>0) {
  422 +
  423 + for(int s =0;s<listLineSize;s++) {
394 424
395 - sectionRoute.setDestroy(destroy); 425 + LineInformation lineInformation = listLineInfo.get(s);
396 426
397 - // 线路ID  
398 - sectionRoute.setLine(resultLine); 427 + double tempUp = lineInformation.getUpMileage();
399 428
400 - // 路段编码  
401 - sectionRoute.setSectionCode(sectionCode); 429 + double tempDown = lineInformation.getDownMileage();
402 430
403 - // 版本  
404 - sectionRoute.setVersions(versions); 431 + // 上行
  432 + if(directions==0) {
  433 +
  434 + if(tempUp>0.0d){
  435 +
  436 + continue;
  437 + }
  438 +
  439 +
  440 + lineInformation.setUpMileage(sumUpOrDownMileage);
  441 +
  442 + lineInformation.setTotalMileage(sumUpOrDownMileage+tempDown);
  443 +
  444 +
  445 + }else if(directions==1) {
  446 +
  447 + if(tempDown>0.0d){
  448 +
  449 + continue;
  450 + }
  451 +
  452 + lineInformation.setDownMileage(sumUpOrDownMileage);
  453 +
  454 + lineInformation.setTotalMileage(sumUpOrDownMileage+tempUp);
  455 +
  456 + }
405 457
406 - // 方向  
407 - sectionRoute.setDirections(directions); 458 + informationRepository.save(lineInformation);
408 459
409 - // 路段路由保存  
410 - sectionRouteRepository.save(sectionRoute);  
411 } 460 }
412 461
413 - resultMap.put("status", ResponseCode.SUCCESS); 462 + }
  463 +
  464 + }
  465 +
  466 + /**
  467 + * @Description 保存路段与路段路由信息
  468 + *
  469 + * @param sectionJSON:路段与路段路由json字符串数据
  470 + *
  471 + * @param directions:方向
  472 + *
  473 + * @param resultLine:线路实体类
  474 + *
  475 + * @param speedLimitStr:限速
  476 + *
  477 + * @param sectionDistance:总距离
  478 + *
  479 + * @param sectionDuration:总时长
  480 + *
  481 + * @param dbType:原中坐标类型
  482 + *
  483 + * @param versions:版本号
  484 + *
  485 + * @param destroy:是否撤销
  486 + *
  487 + */
  488 + public void saveSectionAndSectionRouteInfo(String sectionJSON,int directions,Line resultLine,String speedLimitStr,
414 489
415 - } catch (Exception e) { 490 + double sectionDistance,double sectionDuration,String dbType,int versions,int destroy) throws Exception{
  491 +
  492 + // 转换成JSON数组
  493 + JSONArray sectionsArray = JSONArray.parseArray(sectionJSON);
  494 +
  495 + // 原始线状图形坐标集合
  496 + String sectionsBpoints = "";
  497 +
  498 + // WGS线状图形坐标集合
  499 + String sectionsWJPpoints = "";
  500 +
  501 + // 遍历
  502 + for(int s = 0 ;s<sectionsArray.size();s++) {
416 503
417 - resultMap.put("status", ResponseCode.ERROR); 504 + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
  505 +
  506 + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
  507 +
  508 + String WGSLngStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lng").toString();
  509 +
  510 + String WGSLatStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lat").toString();
  511 +
  512 + if(s==0) {
  513 +
  514 + sectionsBpoints = pointsLngStr + " " + pointsLatStr;
  515 +
  516 + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
  517 +
  518 + }else {
  519 +
  520 + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
  521 +
  522 + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
  523 +
  524 + }
418 525
419 - logger.error("save erro.", e);  
420 526
421 } 527 }
422 528
423 - return resultMap; 529 + long sectionMaxId = GetUIDAndCode.getSectionId();
  530 +
  531 + String sectionCode = String.valueOf(sectionMaxId);
  532 +
  533 + int sectionid = (int)sectionMaxId;
  534 +
  535 + String upOrDownStr = "";
  536 +
  537 + if(directions==0){
  538 +
  539 + upOrDownStr = "上行路段";
  540 +
  541 + }else if(directions==1){
  542 +
  543 + upOrDownStr = "下行路段";
  544 +
  545 + }
  546 +
  547 + // 路段名称
  548 + String sectionName = resultLine.getName()+upOrDownStr;
  549 +
  550 + // 交出路
  551 + String crosesRoad = "";
  552 +
  553 + // 终止节点
  554 + String endNode = "";
  555 +
  556 + // 开始节点
  557 + String startNode = "";
  558 +
  559 + // 中间节点
  560 + String middleNode = "";
  561 +
  562 + // WGS坐标点集合
  563 + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
  564 +
  565 + // 原坐标点集合
  566 + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")";
  567 +
  568 + // 城建坐标点集合
  569 + String csectionVector = "";
  570 +
  571 + // 路段类型
  572 + String sectionType = "";
  573 +
  574 + // 道路编码
  575 + String roadCoding = "";
  576 +
  577 + // 限速
  578 + double speedLimit = Double.parseDouble(speedLimitStr);
  579 +
  580 + // 说明
  581 + String descriptions = "";
  582 +
  583 + // 路段保存
  584 + sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,
  585 +
  586 + middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,
  587 +
  588 + roadCoding, sectionDistance, sectionDuration, dbType, speedLimit,
  589 +
  590 + descriptions, versions,sectionid);
  591 +
  592 +
  593 +
  594 + Section section = sectionRepository.findOne(sectionid);
  595 +
  596 + // 路段路由
  597 + SectionRoute sectionRoute = new SectionRoute();
  598 +
  599 + // 路段序号
  600 + sectionRoute.setSectionrouteCode(100);
  601 +
  602 + // 线路编码
  603 + sectionRoute.setLineCode(resultLine.getLineCode());
  604 +
  605 + // 路段ID
  606 + sectionRoute.setSection(section);
  607 +
  608 + sectionRoute.setDestroy(destroy);
  609 +
  610 + // 线路ID
  611 + sectionRoute.setLine(resultLine);
  612 +
  613 + // 路段编码
  614 + sectionRoute.setSectionCode(sectionCode);
  615 +
  616 + // 版本
  617 + sectionRoute.setVersions(versions);
  618 +
  619 + // 方向
  620 + sectionRoute.setDirections(directions);
  621 +
  622 + // 路段路由保存
  623 + sectionRouteRepository.save(sectionRoute);
  624 +
424 } 625 }
425 626
426 -  
427 public boolean isHaveStationname(String bJwpoints,List<Object[]> stationNameList) { 627 public boolean isHaveStationname(String bJwpoints,List<Object[]> stationNameList) {
428 628
429 boolean temp = true; 629 boolean temp = true;
@@ -452,17 +652,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -452,17 +652,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
452 return temp; 652 return temp;
453 } 653 }
454 654
455 - /**  
456 - * @Description :TODO(查询站点编码)  
457 - *  
458 - * @return int <stationCode站点编码>  
459 - */  
460 - @Override  
461 - public int getStationCode() {  
462 -  
463 - return repository.stationMaxId();  
464 -  
465 - } 655 +
466 656
467 /** 657 /**
468 * @Description :TODO(新增站点保存) 658 * @Description :TODO(新增站点保存)
@@ -489,6 +679,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -489,6 +679,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
489 // 站点编码 679 // 站点编码
490 String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); 680 String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString();
491 681
  682 + // 站点ID
  683 + int stationId = Integer.valueOf(stationCod);
  684 +
492 // 站点名称 685 // 站点名称
493 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); 686 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
494 687
@@ -585,13 +778,12 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -585,13 +778,12 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
585 778
586 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, 779 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius,
587 780
588 - shapesType, versions, descriptions, createBy, updateBy); 781 + shapesType, versions, descriptions, createBy, updateBy,stationId);
589 782
590 783
591 784
592 - int staitonId = repository.stationMaxId();  
593 785
594 - Station station = repository.findOne(staitonId); 786 + Station station = repository.findOne(stationId);
595 787
596 StationRoute arg0 = new StationRoute(); 788 StationRoute arg0 = new StationRoute();
597 789
@@ -605,9 +797,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -605,9 +797,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
605 arg0.setStationName(stationName); 797 arg0.setStationName(stationName);
606 798
607 // 站点路由编码 799 // 站点路由编码
608 - arg0.setStationCode(station.getStationCod()); 800 + arg0.setStationCode(stationCod);
609 801
610 - // 站点路由Id 802 + // 站点路由序号
611 arg0.setStationRouteCode(Integer.parseInt(stationRouteCodeArray[0])+1); 803 arg0.setStationRouteCode(Integer.parseInt(stationRouteCodeArray[0])+1);
612 804
613 // 站点路由类型 805 // 站点路由类型
@@ -878,7 +1070,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -878,7 +1070,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
878 1070
879 if(distanceStr.indexOf("米")!=-1){ 1071 if(distanceStr.indexOf("米")!=-1){
880 1072
881 - distance = Double.parseDouble(distanceStr.replaceAll("米", "")); 1073 + distance = Double.parseDouble(distanceStr.replaceAll("米", "")) / 1000;
882 1074
883 }else if(distanceStr.indexOf("公里")!=-1){ 1075 }else if(distanceStr.indexOf("公里")!=-1){
884 1076
@@ -930,7 +1122,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -930,7 +1122,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
930 Station arg0 = new Station(); 1122 Station arg0 = new Station();
931 1123
932 // 站点编码 1124 // 站点编码
933 - int stationCode = 0; 1125 + long stationCode = 0L;
934 1126
935 if(isHave) { 1127 if(isHave) {
936 1128
@@ -942,7 +1134,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -942,7 +1134,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
942 1134
943 }else { 1135 }else {
944 1136
945 - stationCode = repository.stationMaxId(); 1137 + stationCode = GetUIDAndCode.getStationId();
  1138 +
  1139 + int stationId = (int) (stationCode);
  1140 +
  1141 + arg0.setId(stationId);
946 1142
947 arg0.setStationName(stationName); 1143 arg0.setStationName(stationName);
948 1144
@@ -966,7 +1162,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -966,7 +1162,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
966 arg0.setShapesType(shapesType); 1162 arg0.setShapesType(shapesType);
967 1163
968 // 站点编码 1164 // 站点编码
969 - arg0.setStationCod(String.valueOf(stationCode+1)); 1165 + arg0.setStationCod(String.valueOf(stationCode));
970 1166
971 // 是否想撤销 1167 // 是否想撤销
972 arg0.setDestroy(destroy); 1168 arg0.setDestroy(destroy);
@@ -978,6 +1174,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -978,6 +1174,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
978 1174
979 // 插入站点信息 1175 // 插入站点信息
980 repository.save(arg0); 1176 repository.save(arg0);
  1177 +
  1178 +
981 // 站点路由对象 1179 // 站点路由对象
982 StationRoute route = new StationRoute(); 1180 StationRoute route = new StationRoute();
983 1181
@@ -1081,16 +1279,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1081,16 +1279,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1081 } 1279 }
1082 1280
1083 } 1281 }
1084 - System.out.println(sectionName);  
1085 -  
1086 - System.out.println(sectionsBpoints); 1282 +
1087 1283
1088 - System.out.println(sectionsWJPpoints);  
1089 - 1284 + long sectionMaxId = GetUIDAndCode.getSectionId();
1090 1285
1091 - int sectionMaxId = sectionRepository.sectionMaxId(); 1286 + String sectionCode = String.valueOf(sectionMaxId);
1092 1287
1093 - String sectionCode = String.valueOf(sectionMaxId+1); 1288 + int sectionId = (int) (sectionMaxId);
1094 1289
1095 // 交出路 1290 // 交出路
1096 String crosesRoad = ""; 1291 String crosesRoad = "";
@@ -1138,7 +1333,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1138,7 +1333,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1138 1333
1139 roadCoding, sectionDistance, sectionTime, dbType, speedLimit, 1334 roadCoding, sectionDistance, sectionTime, dbType, speedLimit,
1140 1335
1141 - descriptions, versions); 1336 + descriptions, versions,sectionId);
1142 1337
1143 1338
1144 1339
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
1 -package com.bsth.service.schedule;  
2 -  
3 -import com.bsth.entity.schedule.SchedulePlanInfo;  
4 -import com.bsth.service.BaseService;  
5 -  
6 -/**  
7 - * Created by xu on 16/6/16.  
8 - */  
9 -public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, Long> {  
10 -} 1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlanInfo;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +/**
  7 + * Created by xu on 16/6/16.
  8 + */
  9 +public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, Long> {
  10 +}
src/main/java/com/bsth/service/schedule/SchedulePlanInfoServiceImpl.java
1 -package com.bsth.service.schedule;  
2 -  
3 -import com.bsth.entity.schedule.SchedulePlanInfo;  
4 -import com.bsth.service.impl.BaseServiceImpl;  
5 -import org.springframework.stereotype.Service;  
6 -  
7 -/**  
8 - * Created by xu on 16/6/16.  
9 - */  
10 -@Service  
11 -public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInfo, Long> implements SchedulePlanInfoService {  
12 -} 1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlanInfo;
  4 +import com.bsth.service.impl.BaseServiceImpl;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +/**
  8 + * Created by xu on 16/6/16.
  9 + */
  10 +@Service
  11 +public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInfo, Long> implements SchedulePlanInfoService {
  12 +}
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
1 -package com.bsth.service.schedule;  
2 -  
3 -import com.bsth.entity.schedule.SchedulePlan;  
4 -import com.bsth.service.BaseService;  
5 -  
6 -/**  
7 - * Created by xu on 16/6/16.  
8 - */  
9 -public interface SchedulePlanService extends BaseService<SchedulePlan, Long> {  
10 -} 1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlan;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +/**
  7 + * Created by xu on 16/6/16.
  8 + */
  9 +public interface SchedulePlanService extends BaseService<SchedulePlan, Long> {
  10 +}
src/main/java/com/bsth/service/schedule/SchedulePlanServiceImpl.java
1 -package com.bsth.service.schedule;  
2 -  
3 -import com.bsth.entity.schedule.SchedulePlan;  
4 -import com.bsth.service.impl.BaseServiceImpl;  
5 -import org.springframework.stereotype.Service;  
6 -  
7 -/**  
8 - * Created by xu on 16/6/16.  
9 - */  
10 -@Service  
11 -public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> implements SchedulePlanService {  
12 -} 1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlan;
  4 +import com.bsth.service.impl.BaseServiceImpl;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +/**
  8 + * Created by xu on 16/6/16.
  9 + */
  10 +@Service
  11 +public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> implements SchedulePlanService {
  12 +}
src/main/java/com/bsth/service/schedule/rules/Message.java
1 -package com.bsth.service.schedule.rules;  
2 -  
3 -/**  
4 - * Created by xu on 16/6/15.  
5 - */  
6 -public class Message {  
7 - public static final int HELLO = 0;  
8 - public static final int GOODBYE = 1;  
9 -  
10 - private String message;  
11 - private int status;  
12 - public String getMessage() {  
13 - return message;  
14 - }  
15 - public void setMessage(String message) {  
16 - this.message = message;  
17 - }  
18 - public int getStatus() {  
19 - return status;  
20 - }  
21 - public void setStatus(int status) {  
22 - this.status = status;  
23 - }  
24 -} 1 +package com.bsth.service.schedule.rules;
  2 +
  3 +/**
  4 + * Created by xu on 16/6/15.
  5 + */
  6 +public class Message {
  7 + public static final int HELLO = 0;
  8 + public static final int GOODBYE = 1;
  9 +
  10 + private String message;
  11 + private int status;
  12 + public String getMessage() {
  13 + return message;
  14 + }
  15 + public void setMessage(String message) {
  16 + this.message = message;
  17 + }
  18 + public int getStatus() {
  19 + return status;
  20 + }
  21 + public void setStatus(int status) {
  22 + this.status = status;
  23 + }
  24 +}
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
1 -package com.bsth.service.schedule.rules;  
2 -  
3 -import org.kie.api.KieBase;  
4 -import org.kie.api.KieBaseConfiguration;  
5 -import org.kie.api.KieServices;  
6 -import org.kie.api.builder.*;  
7 -import org.kie.api.builder.Message;  
8 -import org.kie.api.builder.model.KieBaseModel;  
9 -import org.kie.api.builder.model.KieModuleModel;  
10 -import org.kie.api.builder.model.KieSessionModel;  
11 -import org.kie.api.conf.EqualityBehaviorOption;  
12 -import org.kie.api.conf.EventProcessingOption;  
13 -import org.kie.api.runtime.KieContainer;  
14 -import org.kie.api.runtime.conf.ClockTypeOption;  
15 -import org.springframework.context.annotation.Bean;  
16 -import org.springframework.context.annotation.Configuration;  
17 -  
18 -/**  
19 - * Drools 6配置类。  
20 - */  
21 -@Configuration  
22 -public class MyDroolsConfiguration {  
23 - /**  
24 - * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件,  
25 - * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。  
26 - */  
27 - @Bean  
28 - public KieBase myKieBase() {  
29 - // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大  
30 - // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性  
31 -  
32 - // 1、创建kieservices  
33 - KieServices kieServices = KieServices.Factory.get();  
34 - // 2、创建KieModuleModel,默认是由kmodule.xml的方式创建,这里使用api方式闯将  
35 - KieModuleModel kieModuleModel = kieServices.newKieModuleModel();  
36 - // 2.1、创建KieBaseModel,类似kmodule.xml中的kbase标签  
37 - KieBaseModel kieBaseModel1 = kieModuleModel.newKieBaseModel("KBase1")  
38 - .setDefault(true)  
39 - .setEqualsBehavior(EqualityBehaviorOption.EQUALITY)  
40 - .setEventProcessingMode(EventProcessingOption.STREAM);  
41 - // 2.2、创建与kbase关联的KieSessionModel,类似kmodule.xml中的kbase内的ksession标签  
42 - kieBaseModel1.newKieSessionModel("KSession1")  
43 - .setDefault(true)  
44 - .setType(KieSessionModel.KieSessionType.STATEFUL)  
45 - .setClockType(ClockTypeOption.get("realtime"));  
46 -  
47 - // 3、创建KieFileSystem,将模型xml,drl等写入,TODO:以后考虑从数据库中获取  
48 - KieFileSystem kfs = kieServices.newKieFileSystem();  
49 - // 3.1、写入KieBaseModel(内部包含了KieSessionModel的内容了,注意之前的KieSessionModel的创建方式)  
50 - kfs.writeKModuleXML(kieModuleModel.toXML());  
51 -  
52 - // 3.2、写入drl(写法超多,有点混乱)  
53 - // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入  
54 - // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的  
55 - kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources()  
56 - .newInputStreamResource(this.getClass().getResourceAsStream(  
57 - "/rules/HelloWorld.drl"), "UTF-8"));  
58 - kfs.write("src/main/resources/shiftloop.drl", kieServices.getResources()  
59 - .newInputStreamResource(this.getClass().getResourceAsStream(  
60 - "/rules/shiftloop.drl"), "UTF-8"));  
61 - // TODO:还有其他drl....  
62 -  
63 - // 4、创建KieBuilder,使用KieFileSystem构建  
64 - KieBuilder kieBuilder = kieServices.newKieBuilder(kfs).buildAll();  
65 - Results results = kieBuilder.getResults();  
66 - if (results.hasMessages(Message.Level.ERROR))  
67 - throw new IllegalStateException("构建drools6错误:" + results.getMessages());  
68 -  
69 - // 5、获取KieContainer  
70 - // TODO:ReleaseId用处很大,以后再议  
71 - ReleaseId releaseId = kieServices.getRepository().getDefaultReleaseId();  
72 - KieContainer kieContainer = kieServices.newKieContainer(releaseId);  
73 -  
74 - // 6、创建kbase  
75 - KieBaseConfiguration kieBaseConfiguration = kieServices.newKieBaseConfiguration();  
76 - KieBase kieBase = kieContainer.newKieBase("KBase1", kieBaseConfiguration);  
77 -  
78 - return kieBase;  
79 - }  
80 -} 1 +package com.bsth.service.schedule.rules;
  2 +
  3 +import org.kie.api.KieBase;
  4 +import org.kie.api.KieBaseConfiguration;
  5 +import org.kie.api.KieServices;
  6 +import org.kie.api.builder.*;
  7 +import org.kie.api.builder.Message;
  8 +import org.kie.api.builder.model.KieBaseModel;
  9 +import org.kie.api.builder.model.KieModuleModel;
  10 +import org.kie.api.builder.model.KieSessionModel;
  11 +import org.kie.api.conf.EqualityBehaviorOption;
  12 +import org.kie.api.conf.EventProcessingOption;
  13 +import org.kie.api.runtime.KieContainer;
  14 +import org.kie.api.runtime.conf.ClockTypeOption;
  15 +import org.springframework.context.annotation.Bean;
  16 +import org.springframework.context.annotation.Configuration;
  17 +
  18 +/**
  19 + * Drools 6配置类。
  20 + */
  21 +@Configuration
  22 +public class MyDroolsConfiguration {
  23 + /**
  24 + * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件,
  25 + * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。
  26 + */
  27 + @Bean
  28 + public KieBase myKieBase() {
  29 + // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大
  30 + // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性
  31 +
  32 + // 1、创建kieservices
  33 + KieServices kieServices = KieServices.Factory.get();
  34 + // 2、创建KieModuleModel,默认是由kmodule.xml的方式创建,这里使用api方式闯将
  35 + KieModuleModel kieModuleModel = kieServices.newKieModuleModel();
  36 + // 2.1、创建KieBaseModel,类似kmodule.xml中的kbase标签
  37 + KieBaseModel kieBaseModel1 = kieModuleModel.newKieBaseModel("KBase1")
  38 + .setDefault(true)
  39 + .setEqualsBehavior(EqualityBehaviorOption.EQUALITY)
  40 + .setEventProcessingMode(EventProcessingOption.STREAM);
  41 + // 2.2、创建与kbase关联的KieSessionModel,类似kmodule.xml中的kbase内的ksession标签
  42 + kieBaseModel1.newKieSessionModel("KSession1")
  43 + .setDefault(true)
  44 + .setType(KieSessionModel.KieSessionType.STATEFUL)
  45 + .setClockType(ClockTypeOption.get("realtime"));
  46 +
  47 + // 3、创建KieFileSystem,将模型xml,drl等写入,TODO:以后考虑从数据库中获取
  48 + KieFileSystem kfs = kieServices.newKieFileSystem();
  49 + // 3.1、写入KieBaseModel(内部包含了KieSessionModel的内容了,注意之前的KieSessionModel的创建方式)
  50 + kfs.writeKModuleXML(kieModuleModel.toXML());
  51 +
  52 + // 3.2、写入drl(写法超多,有点混乱)
  53 + // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入
  54 + // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的
  55 + kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources()
  56 + .newInputStreamResource(this.getClass().getResourceAsStream(
  57 + "/rules/HelloWorld.drl"), "UTF-8"));
  58 + kfs.write("src/main/resources/shiftloop.drl", kieServices.getResources()
  59 + .newInputStreamResource(this.getClass().getResourceAsStream(
  60 + "/rules/shiftloop.drl"), "UTF-8"));
  61 + // TODO:还有其他drl....
  62 +
  63 + // 4、创建KieBuilder,使用KieFileSystem构建
  64 + KieBuilder kieBuilder = kieServices.newKieBuilder(kfs).buildAll();
  65 + Results results = kieBuilder.getResults();
  66 + if (results.hasMessages(Message.Level.ERROR))
  67 + throw new IllegalStateException("构建drools6错误:" + results.getMessages());
  68 +
  69 + // 5、获取KieContainer
  70 + // TODO:ReleaseId用处很大,以后再议
  71 + ReleaseId releaseId = kieServices.getRepository().getDefaultReleaseId();
  72 + KieContainer kieContainer = kieServices.newKieContainer(releaseId);
  73 +
  74 + // 6、创建kbase
  75 + KieBaseConfiguration kieBaseConfiguration = kieServices.newKieBaseConfiguration();
  76 + KieBase kieBase = kieContainer.newKieBase("KBase1", kieBaseConfiguration);
  77 +
  78 + return kieBase;
  79 + }
  80 +}
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleCalcuParam_input.java
1 -package com.bsth.service.schedule.rules.shiftloop;  
2 -  
3 -import org.joda.time.DateTime;  
4 -  
5 -/**  
6 - * 排班计算参数_输入。  
7 - */  
8 -public class ScheduleCalcuParam_input {  
9 - /** 开始计算日期 */  
10 - private DateTime fromDate;  
11 - /** 结束计算日期 */  
12 - private DateTime toDate;  
13 - /** 时刻表id */  
14 - private Long ttinfoId;  
15 -  
16 - public DateTime getFromDate() {  
17 - return fromDate;  
18 - }  
19 -  
20 - public void setFromDate(DateTime fromDate) {  
21 - this.fromDate = fromDate;  
22 - }  
23 -  
24 - public DateTime getToDate() {  
25 - return toDate;  
26 - }  
27 -  
28 - public void setToDate(DateTime toDate) {  
29 - this.toDate = toDate;  
30 - }  
31 -  
32 - public Long getTtinfoId() {  
33 - return ttinfoId;  
34 - }  
35 -  
36 - public void setTtinfoId(Long ttinfoId) {  
37 - this.ttinfoId = ttinfoId;  
38 - }  
39 -} 1 +package com.bsth.service.schedule.rules.shiftloop;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 排班计算参数_输入。
  7 + */
  8 +public class ScheduleCalcuParam_input {
  9 + /** 开始计算日期 */
  10 + private DateTime fromDate;
  11 + /** 结束计算日期 */
  12 + private DateTime toDate;
  13 + /** 时刻表id */
  14 + private Long ttinfoId;
  15 +
  16 + public DateTime getFromDate() {
  17 + return fromDate;
  18 + }
  19 +
  20 + public void setFromDate(DateTime fromDate) {
  21 + this.fromDate = fromDate;
  22 + }
  23 +
  24 + public DateTime getToDate() {
  25 + return toDate;
  26 + }
  27 +
  28 + public void setToDate(DateTime toDate) {
  29 + this.toDate = toDate;
  30 + }
  31 +
  32 + public Long getTtinfoId() {
  33 + return ttinfoId;
  34 + }
  35 +
  36 + public void setTtinfoId(Long ttinfoId) {
  37 + this.ttinfoId = ttinfoId;
  38 + }
  39 +}
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResult_output.java
1 -package com.bsth.service.schedule.rules.shiftloop;  
2 -  
3 -import org.joda.time.DateTime;  
4 -  
5 -/**  
6 - * 规则计算出的结果_输出。  
7 - */  
8 -public class ScheduleResult_output {  
9 - /** 具体日期 */  
10 - private DateTime sd;  
11 - /** 用的是哪一组rule */  
12 - private Long ruleId;  
13 - /** 路牌id */  
14 - private Long guideboardId;  
15 - /** 人员配置id */  
16 - private Long employeeConfigId;  
17 - /** 车辆配置id */  
18 - private Long carConfigId;  
19 -  
20 - public DateTime getSd() {  
21 - return sd;  
22 - }  
23 -  
24 - public void setSd(DateTime sd) {  
25 - this.sd = sd;  
26 - }  
27 -  
28 - public Long getGuideboardId() {  
29 - return guideboardId;  
30 - }  
31 -  
32 - public void setGuideboardId(Long guideboardId) {  
33 - this.guideboardId = guideboardId;  
34 - }  
35 -  
36 - public Long getEmployeeConfigId() {  
37 - return employeeConfigId;  
38 - }  
39 -  
40 - public void setEmployeeConfigId(Long employeeConfigId) {  
41 - this.employeeConfigId = employeeConfigId;  
42 - }  
43 -  
44 - public Long getCarConfigId() {  
45 - return carConfigId;  
46 - }  
47 -  
48 - public void setCarConfigId(Long carConfigId) {  
49 - this.carConfigId = carConfigId;  
50 - }  
51 -  
52 - public Long getRuleId() {  
53 - return ruleId;  
54 - }  
55 -  
56 - public void setRuleId(Long ruleId) {  
57 - this.ruleId = ruleId;  
58 - }  
59 -  
60 -} 1 +package com.bsth.service.schedule.rules.shiftloop;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 规则计算出的结果_输出。
  7 + */
  8 +public class ScheduleResult_output {
  9 + /** 具体日期 */
  10 + private DateTime sd;
  11 + /** 用的是哪一组rule */
  12 + private Long ruleId;
  13 + /** 路牌id */
  14 + private Long guideboardId;
  15 + /** 人员配置id */
  16 + private Long employeeConfigId;
  17 + /** 车辆配置id */
  18 + private Long carConfigId;
  19 +
  20 + public DateTime getSd() {
  21 + return sd;
  22 + }
  23 +
  24 + public void setSd(DateTime sd) {
  25 + this.sd = sd;
  26 + }
  27 +
  28 + public Long getGuideboardId() {
  29 + return guideboardId;
  30 + }
  31 +
  32 + public void setGuideboardId(Long guideboardId) {
  33 + this.guideboardId = guideboardId;
  34 + }
  35 +
  36 + public Long getEmployeeConfigId() {
  37 + return employeeConfigId;
  38 + }
  39 +
  40 + public void setEmployeeConfigId(Long employeeConfigId) {
  41 + this.employeeConfigId = employeeConfigId;
  42 + }
  43 +
  44 + public Long getCarConfigId() {
  45 + return carConfigId;
  46 + }
  47 +
  48 + public void setCarConfigId(Long carConfigId) {
  49 + this.carConfigId = carConfigId;
  50 + }
  51 +
  52 + public Long getRuleId() {
  53 + return ruleId;
  54 + }
  55 +
  56 + public void setRuleId(Long ruleId) {
  57 + this.ruleId = ruleId;
  58 + }
  59 +
  60 +}
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResults_output.java
1 -package com.bsth.service.schedule.rules.shiftloop;  
2 -  
3 -import org.apache.commons.lang3.StringUtils;  
4 -  
5 -import java.util.*;  
6 -  
7 -/**  
8 - * 输出结果集合。  
9 - */  
10 -public class ScheduleResults_output {  
11 - /** 输出列表 */  
12 - private List<ScheduleResult_output> results = new ArrayList<>();  
13 -  
14 - public List<ScheduleResult_output> getResults() {  
15 - return results;  
16 - }  
17 -  
18 - public void setResults(List<ScheduleResult_output> results) {  
19 - this.results = results;  
20 - }  
21 -  
22 - /**  
23 - * 输出每个规则排出来的路牌id列表  
24 - * @return  
25 - */  
26 - public String showGuideboardDesc1() {  
27 - StringBuilder stringBuilder = new StringBuilder();  
28 - Map<Long, List<ScheduleResult_output>> groupRuleIdGuideBoardMap = new HashMap<>();  
29 - for (ScheduleResult_output s : results) {  
30 - if (groupRuleIdGuideBoardMap.get(s.getRuleId()) == null) {  
31 - groupRuleIdGuideBoardMap.put(s.getRuleId(), new ArrayList<ScheduleResult_output>());  
32 - }  
33 - groupRuleIdGuideBoardMap.get(s.getRuleId()).add(s);  
34 - }  
35 -  
36 - for (Long ruleId : groupRuleIdGuideBoardMap.keySet()) {  
37 - Collections.sort(groupRuleIdGuideBoardMap.get(ruleId), new Comparator<ScheduleResult_output>() {  
38 - @Override  
39 - public int compare(ScheduleResult_output o1, ScheduleResult_output o2) {  
40 - return o1.getSd().compareTo(o2.getSd());  
41 - }  
42 - });  
43 -  
44 - List<Long> gbids = new ArrayList<>();  
45 - List<Long> ecids = new ArrayList<>();  
46 - for (ScheduleResult_output so : groupRuleIdGuideBoardMap.get(ruleId)) {  
47 - gbids.add(so.getGuideboardId());  
48 - ecids.add(so.getEmployeeConfigId());  
49 - }  
50 -  
51 - stringBuilder.append(  
52 - "规则id=" + ruleId + ", " +  
53 - "路牌列表=" + StringUtils.join(gbids, ",") + "\n");  
54 - stringBuilder.append(  
55 - "规则id=" + ruleId + ", " +  
56 - "人员配置列表=" + StringUtils.join(ecids, ",") + "\n");  
57 - }  
58 -  
59 - return stringBuilder.toString();  
60 - }  
61 -  
62 - // TODO:人员输出  
63 -} 1 +package com.bsth.service.schedule.rules.shiftloop;
  2 +
  3 +import org.apache.commons.lang3.StringUtils;
  4 +
  5 +import java.util.*;
  6 +
  7 +/**
  8 + * 输出结果集合。
  9 + */
  10 +public class ScheduleResults_output {
  11 + /** 输出列表 */
  12 + private List<ScheduleResult_output> results = new ArrayList<>();
  13 +
  14 + public List<ScheduleResult_output> getResults() {
  15 + return results;
  16 + }
  17 +
  18 + public void setResults(List<ScheduleResult_output> results) {
  19 + this.results = results;
  20 + }
  21 +
  22 + /**
  23 + * 输出每个规则排出来的路牌id列表
  24 + * @return
  25 + */
  26 + public String showGuideboardDesc1() {
  27 + StringBuilder stringBuilder = new StringBuilder();
  28 + Map<Long, List<ScheduleResult_output>> groupRuleIdGuideBoardMap = new HashMap<>();
  29 + for (ScheduleResult_output s : results) {
  30 + if (groupRuleIdGuideBoardMap.get(s.getRuleId()) == null) {
  31 + groupRuleIdGuideBoardMap.put(s.getRuleId(), new ArrayList<ScheduleResult_output>());
  32 + }
  33 + groupRuleIdGuideBoardMap.get(s.getRuleId()).add(s);
  34 + }
  35 +
  36 + for (Long ruleId : groupRuleIdGuideBoardMap.keySet()) {
  37 + Collections.sort(groupRuleIdGuideBoardMap.get(ruleId), new Comparator<ScheduleResult_output>() {
  38 + @Override
  39 + public int compare(ScheduleResult_output o1, ScheduleResult_output o2) {
  40 + return o1.getSd().compareTo(o2.getSd());
  41 + }
  42 + });
  43 +
  44 + List<Long> gbids = new ArrayList<>();
  45 + List<Long> ecids = new ArrayList<>();
  46 + for (ScheduleResult_output so : groupRuleIdGuideBoardMap.get(ruleId)) {
  47 + gbids.add(so.getGuideboardId());
  48 + ecids.add(so.getEmployeeConfigId());
  49 + }
  50 +
  51 + stringBuilder.append(
  52 + "规则id=" + ruleId + ", " +
  53 + "路牌列表=" + StringUtils.join(gbids, ",") + "\n");
  54 + stringBuilder.append(
  55 + "规则id=" + ruleId + ", " +
  56 + "人员配置列表=" + StringUtils.join(ecids, ",") + "\n");
  57 + }
  58 +
  59 + return stringBuilder.toString();
  60 + }
  61 +
  62 + // TODO:人员输出
  63 +}