Commit 4fcdfd42621a63c0c1357e7a38cdcddcf847697d

Authored by 潘钊
2 parents 9f87b4d0 a91199a8

Merge branch 'minhang' into qingpu

# Conflicts:
#	src/main/resources/ms-jdbc.properties
Showing 85 changed files with 2804 additions and 562 deletions

Too many changes to show.

To preserve performance only 85 of 93 files are displayed.

src/main/java/com/bsth/controller/BaseController.java
@@ -3,6 +3,7 @@ package com.bsth.controller; @@ -3,6 +3,7 @@ package com.bsth.controller;
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.service.BaseService; 4 import com.bsth.service.BaseService;
5 import com.bsth.service.schedule.utils.DataImportExportService; 5 import com.bsth.service.schedule.utils.DataImportExportService;
  6 +import com.google.common.base.Splitter;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.data.domain.Page; 8 import org.springframework.data.domain.Page;
8 import org.springframework.data.domain.PageRequest; 9 import org.springframework.data.domain.PageRequest;
@@ -17,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile; @@ -17,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
17 import javax.servlet.http.HttpServletResponse; 18 import javax.servlet.http.HttpServletResponse;
18 import java.io.*; 19 import java.io.*;
19 import java.util.HashMap; 20 import java.util.HashMap;
  21 +import java.util.List;
20 import java.util.Map; 22 import java.util.Map;
21 23
22 /** 24 /**
@@ -58,8 +60,12 @@ public class BaseController<T, ID extends Serializable> { @@ -58,8 +60,12 @@ public class BaseController<T, ID extends Serializable> {
58 d = Direction.ASC; 60 d = Direction.ASC;
59 else 61 else
60 d = Direction.DESC; 62 d = Direction.DESC;
61 -  
62 - return baseService.list(map, new PageRequest(page, size, new Sort(d, order))); 63 +
  64 + // 允许多个字段排序,order可以写单个字段,也可以写多个字段
  65 + // 多个字段格式:{col1},{col2},{col3},....,{coln}
  66 + // 每个字段的排序方向都是一致,这个以后再看要不要改
  67 + List<String> list = Splitter.on(",").trimResults().splitToList(order);
  68 + return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
63 } 69 }
64 70
65 /** 71 /**
src/main/java/com/bsth/controller/forecast/SampleController.java 0 → 100644
  1 +package com.bsth.controller.forecast;
  2 +
  3 +import org.springframework.web.bind.annotation.RequestMapping;
  4 +import org.springframework.web.bind.annotation.RestController;
  5 +
  6 +import com.bsth.controller.BaseController;
  7 +import com.bsth.entity.forecast.Sample;
  8 +
  9 +@RestController
  10 +@RequestMapping("sample")
  11 +public class SampleController extends BaseController<Sample, Long>{
  12 +
  13 +}
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
@@ -34,4 +34,9 @@ public class LineConfigController extends BaseController&lt;LineConfig, Integer&gt;{ @@ -34,4 +34,9 @@ public class LineConfigController extends BaseController&lt;LineConfig, Integer&gt;{
34 public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){ 34 public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){
35 return lineConfigService.editStartOptTime(time, lineCode); 35 return lineConfigService.editStartOptTime(time, lineCode);
36 } 36 }
  37 +
  38 + @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST)
  39 + public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type){
  40 + return lineConfigService.editOutTimeType(lineCode, type);
  41 + }
37 } 42 }
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -298,8 +298,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -298,8 +298,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
298 298
299 @RequestMapping(value = "/exportWaybill") 299 @RequestMapping(value = "/exportWaybill")
300 public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh, 300 public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
301 - @RequestParam String lpName) {  
302 - return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName); 301 + @RequestParam String lpName,@RequestParam String date) {
  302 + return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date);
303 } 303 }
304 304
305 @RequestMapping(value = "/dailyInfo") 305 @RequestMapping(value = "/dailyInfo")
@@ -319,8 +319,9 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -319,8 +319,9 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
319 } 319 }
320 320
321 @RequestMapping(value="/findKMBC") 321 @RequestMapping(value="/findKMBC")
322 - public Map<String,Object> findKMBC(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName){  
323 - return scheduleRealInfoService.findKMBC(jName, clZbh,lpName); 322 + public Map<String,Object> findKMBC(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  323 + ,@RequestParam String date){
  324 + return scheduleRealInfoService.findKMBC(jName, clZbh,lpName,date);
324 } 325 }
325 326
326 @RequestMapping(value="/findLpName") 327 @RequestMapping(value="/findLpName")
@@ -348,8 +349,9 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -348,8 +349,9 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
348 * @return 349 * @return
349 */ 350 */
350 @RequestMapping(value="/queryListWaybill") 351 @RequestMapping(value="/queryListWaybill")
351 - public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName){  
352 - return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName); 352 + public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  353 + ,@RequestParam String date){
  354 + return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date);
353 } 355 }
354 356
355 @RequestMapping(value="/statisticsDaily") 357 @RequestMapping(value="/statisticsDaily")
src/main/java/com/bsth/controller/schedule/SchedulePlanInfoController.java
@@ -2,18 +2,9 @@ package com.bsth.controller.schedule; @@ -2,18 +2,9 @@ package com.bsth.controller.schedule;
2 2
3 import com.bsth.controller.BaseController; 3 import com.bsth.controller.BaseController;
4 import com.bsth.entity.schedule.SchedulePlanInfo; 4 import com.bsth.entity.schedule.SchedulePlanInfo;
5 -import com.google.common.base.Splitter;  
6 -import org.springframework.data.domain.Page;  
7 -import org.springframework.data.domain.PageRequest;  
8 -import org.springframework.data.domain.Sort;  
9 import org.springframework.web.bind.annotation.RequestMapping; 5 import org.springframework.web.bind.annotation.RequestMapping;
10 -import org.springframework.web.bind.annotation.RequestMethod;  
11 -import org.springframework.web.bind.annotation.RequestParam;  
12 import org.springframework.web.bind.annotation.RestController; 6 import org.springframework.web.bind.annotation.RestController;
13 7
14 -import java.util.List;  
15 -import java.util.Map;  
16 -  
17 /** 8 /**
18 * Created by xu on 16/6/16. 9 * Created by xu on 16/6/16.
19 */ 10 */
@@ -21,32 +12,4 @@ import java.util.Map; @@ -21,32 +12,4 @@ import java.util.Map;
21 @RequestMapping("spic") 12 @RequestMapping("spic")
22 public class SchedulePlanInfoController extends BaseController<SchedulePlanInfo, Long> { 13 public class SchedulePlanInfoController extends BaseController<SchedulePlanInfo, Long> {
23 14
24 - /**  
25 - *  
26 - * @Title: list  
27 - * @Description: TODO(多条件分页查询)  
28 - * @param @param map 查询条件  
29 - * @param @param page 页码  
30 - * @param @param size 每页显示数量  
31 - * @throws  
32 - */  
33 - @RequestMapping(method = RequestMethod.GET)  
34 - public Page<SchedulePlanInfo> list(@RequestParam Map<String, Object> map,  
35 - @RequestParam(defaultValue = "0") int page,  
36 - @RequestParam(defaultValue = "10") int size,  
37 - @RequestParam(defaultValue = "id") String order,  
38 - @RequestParam(defaultValue = "DESC") String direction){  
39 -  
40 - Sort.Direction d;  
41 -  
42 - if(null != direction && direction.equals("ASC"))  
43 - d = Sort.Direction.ASC;  
44 - else  
45 - d = Sort.Direction.DESC;  
46 -  
47 - // order由 col1,col2,col3 这样传入  
48 - List<String> list = Splitter.on(",").trimResults().splitToList(order);  
49 - return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));  
50 - }  
51 -  
52 } 15 }
src/main/java/com/bsth/controller/schedule/ScheduleRule1FlatController.java
@@ -55,11 +55,14 @@ public class ScheduleRule1FlatController extends BaseController&lt;ScheduleRule1Fla @@ -55,11 +55,14 @@ public class ScheduleRule1FlatController extends BaseController&lt;ScheduleRule1Fla
55 for (int i = 0; i < lpNames.length; i++) { 55 for (int i = 0; i < lpNames.length; i++) {
56 param1.put("lpName_eq", lpNames[i]); 56 param1.put("lpName_eq", lpNames[i]);
57 Iterable<GuideboardInfo> guideboardInfos = guideboardInfoService.list(param1); 57 Iterable<GuideboardInfo> guideboardInfos = guideboardInfoService.list(param1);
  58 + if (!guideboardInfos.iterator().hasNext()) {
  59 + throw new RuntimeException("路牌:" + lpNames[i] + "没有找到!");
  60 + }
58 lpIds[i] = guideboardInfos.iterator().next().getId().toString(); 61 lpIds[i] = guideboardInfos.iterator().next().getId().toString();
59 } 62 }
60 t.setLpIds(StringUtils.join(lpIds, ",")); 63 t.setLpIds(StringUtils.join(lpIds, ","));
61 64
62 - // 2、查找人员配置id 65 + // 2、查找人员配置id(这里要考虑分班的情况,先用-隔开,在用,隔开)
63 Map<String, Object> param2 = new HashMap<>(); 66 Map<String, Object> param2 = new HashMap<>();
64 param2.put("xl.id_eq", t.getXl().getId()); 67 param2.put("xl.id_eq", t.getXl().getId());
65 param2.put("dbbm_eq", null); 68 param2.put("dbbm_eq", null);
@@ -67,9 +70,34 @@ public class ScheduleRule1FlatController extends BaseController&lt;ScheduleRule1Fla @@ -67,9 +70,34 @@ public class ScheduleRule1FlatController extends BaseController&lt;ScheduleRule1Fla
67 String[] ryDbbms = t.getRyDbbms().split(","); 70 String[] ryDbbms = t.getRyDbbms().split(",");
68 String[] ryIds = new String[ryDbbms.length]; 71 String[] ryIds = new String[ryDbbms.length];
69 for (int j = 0; j < ryDbbms.length; j++) { 72 for (int j = 0; j < ryDbbms.length; j++) {
70 - param2.put("dbbm_eq", ryDbbms[j]);  
71 - Iterable<EmployeeConfigInfo> employeeConfigInfos = employeeConfigInfoService.list(param2);  
72 - ryIds[j] = employeeConfigInfos.iterator().next().getId().toString(); 73 + if (ryDbbms[j].indexOf("-") == -1) {
  74 + param2.put("dbbm_eq", ryDbbms[j]);
  75 + Iterable<EmployeeConfigInfo> employeeConfigInfos = employeeConfigInfoService.list(param2);
  76 + if (!employeeConfigInfos.iterator().hasNext()) {
  77 + throw new RuntimeException("搭班编码::" + ryDbbms[j] + "没有找到!");
  78 + }
  79 + ryIds[j] = employeeConfigInfos.iterator().next().getId().toString();
  80 + } else {
  81 + String[] fbRyDbbms = ryDbbms[j].split("-");
  82 + if (fbRyDbbms.length != 2) {
  83 + throw new RuntimeException("搭班编码:" + ryDbbms[j] + "错误!");
  84 + }
  85 + String[] fbRyIds = new String[2];
  86 + param2.put("dbbm_eq", fbRyDbbms[0]);
  87 + Iterable<EmployeeConfigInfo> employeeConfigInfos = employeeConfigInfoService.list(param2);
  88 + if (!employeeConfigInfos.iterator().hasNext()) {
  89 + throw new RuntimeException("搭班编码::" + fbRyDbbms[0] + "没有找到!");
  90 + }
  91 + fbRyIds[0] = employeeConfigInfos.iterator().next().getId().toString();
  92 + param2.put("dbbm_eq", fbRyDbbms[1]);
  93 + employeeConfigInfos = employeeConfigInfoService.list(param2);
  94 + if (!employeeConfigInfos.iterator().hasNext()) {
  95 + throw new RuntimeException("搭班编码::" + fbRyDbbms[1] + "没有找到!");
  96 + }
  97 + fbRyIds[1] = employeeConfigInfos.iterator().next().getId().toString();
  98 + ryIds[j] = StringUtils.join(fbRyIds, "-");
  99 + }
  100 +
73 } 101 }
74 t.setRyConfigIds(StringUtils.join(ryIds, ",")); 102 t.setRyConfigIds(StringUtils.join(ryIds, ","));
75 103
src/main/java/com/bsth/controller/sys/UserLineController.java 0 → 100644
  1 +package com.bsth.controller.sys;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.controller.BaseController;
  13 +import com.bsth.entity.sys.UserLine;
  14 +import com.bsth.service.sys.UserLineService;
  15 +
  16 +@RestController
  17 +@RequestMapping("userline")
  18 +public class UserLineController extends BaseController<UserLine, Integer> {
  19 +
  20 +
  21 + @Autowired
  22 + private UserLineService service;
  23 +
  24 + @RequestMapping(value = "/userRoleTree", method = RequestMethod.GET)
  25 + public List<Map<String, Object>> userRoleTree(@RequestParam Map<String, Object> map){
  26 +
  27 + return service.userRoleTree(map);
  28 +
  29 + }
  30 +
  31 + /**
  32 + *
  33 + * @Title: setLineCasts
  34 + *
  35 + * @Description: TODO(为角色设置模块,全量覆盖)
  36 + *
  37 + * @param @param userId 用户ID
  38 + *
  39 + * @param @param mIds 线路ID字符串(1,2,3,4)
  40 + *
  41 + * @throws
  42 + */
  43 + @RequestMapping(value = "/setLineCasts", method = RequestMethod.POST)
  44 + public Map<String, Object> setLineCasts(@RequestParam Integer userId,@RequestParam String mIds){
  45 + return service.setLineCasts(userId, mIds);
  46 + }
  47 +}
src/main/java/com/bsth/data/match/Arrival2Schedule.java
@@ -158,7 +158,6 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -158,7 +158,6 @@ public class Arrival2Schedule implements ApplicationContextAware {
158 158
159 //漂移判定 159 //漂移判定
160 if(driftCheck(mr, arr)){ 160 if(driftCheck(mr, arr)){
161 -  
162 mr.sch.setFcsjActualAll(mr.ts); 161 mr.sch.setFcsjActualAll(mr.ts);
163 //通知客户端 162 //通知客户端
164 sendUtils.sendFcsj(mr.sch); 163 sendUtils.sendFcsj(mr.sch);
@@ -211,7 +210,7 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -211,7 +210,7 @@ public class Arrival2Schedule implements ApplicationContextAware {
211 if(null != next){ 210 if(null != next){
212 next.setQdzArrDateSJ(mr.sch.getZdsjActual()); 211 next.setQdzArrDateSJ(mr.sch.getZdsjActual());
213 //下发调度指令 212 //下发调度指令
214 - directiveService.send60Dispatch(next, doneSum, "到站@系统"); 213 + //directiveService.send60Dispatch(next, doneSum, "到站@系统");
215 214
216 //起点既停车场的进场班次 215 //起点既停车场的进场班次
217 if(next.getBcType().equals("in") && next.getJhlc() == null) 216 if(next.getBcType().equals("in") && next.getJhlc() == null)
src/main/java/com/bsth/data/pilot80/PilotReport.java
@@ -283,7 +283,7 @@ public class PilotReport { @@ -283,7 +283,7 @@ public class PilotReport {
283 283
284 public void clear(String lineCode){ 284 public void clear(String lineCode){
285 logger.info("清除 80数据 before: " + d80MultiMap.size()); 285 logger.info("清除 80数据 before: " + d80MultiMap.size());
286 - d80MultiMap.removeAll(lineCode); 286 + d80MultiMap.removeAll(Integer.parseInt(lineCode));
287 logger.info("清除 80数据 after: " + d80MultiMap.size()); 287 logger.info("清除 80数据 after: " + d80MultiMap.size());
288 } 288 }
289 289
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -25,6 +25,9 @@ import com.alibaba.fastjson.JSONArray; @@ -25,6 +25,9 @@ import com.alibaba.fastjson.JSONArray;
25 import com.bsth.Application; 25 import com.bsth.Application;
26 import com.bsth.data.LineConfigData; 26 import com.bsth.data.LineConfigData;
27 import com.bsth.data.directive.FirstScheduleCheckThread; 27 import com.bsth.data.directive.FirstScheduleCheckThread;
  28 +import com.bsth.data.schedule.thread.ScheduleLateThread;
  29 +import com.bsth.data.schedule.thread.SchedulePstThread;
  30 +import com.bsth.data.schedule.thread.ScheduleRefreshThread;
28 import com.bsth.entity.realcontrol.LineConfig; 31 import com.bsth.entity.realcontrol.LineConfig;
29 import com.bsth.entity.realcontrol.ScheduleRealInfo; 32 import com.bsth.entity.realcontrol.ScheduleRealInfo;
30 import com.bsth.entity.schedule.SchedulePlanInfo; 33 import com.bsth.entity.schedule.SchedulePlanInfo;
@@ -62,15 +65,11 @@ public class DayOfSchedule implements CommandLineRunner { @@ -62,15 +65,11 @@ public class DayOfSchedule implements CommandLineRunner {
62 public static LinkedList<ScheduleRealInfo> pstBuffer; 65 public static LinkedList<ScheduleRealInfo> pstBuffer;
63 66
64 // 排序器 67 // 排序器
65 - private static ScheduleComparator.FCNO schNoComparator;  
66 - //private static ScheduleComparator.FCSJ schFcsjComparator; 68 + private static ScheduleComparator.FCSJ schFCSJComparator;
67 69
68 @Autowired 70 @Autowired
69 LineConfigData lineConfigData; 71 LineConfigData lineConfigData;
70 72
71 - /*@Autowired  
72 - ScheduleRealInfoService scheduleRealService;*/  
73 -  
74 @Autowired 73 @Autowired
75 ScheduleRealInfoRepository schRepository; 74 ScheduleRealInfoRepository schRepository;
76 75
@@ -90,7 +89,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -90,7 +89,7 @@ public class DayOfSchedule implements CommandLineRunner {
90 nbbmScheduleMap = ArrayListMultimap.create(); 89 nbbmScheduleMap = ArrayListMultimap.create();
91 id2SchedulMap = new HashMap<>(); 90 id2SchedulMap = new HashMap<>();
92 pstBuffer = new LinkedList<>(); 91 pstBuffer = new LinkedList<>();
93 - schNoComparator = new ScheduleComparator.FCNO(); 92 + schFCSJComparator = new ScheduleComparator.FCSJ();
94 currSchDateMap = new HashMap<>(); 93 currSchDateMap = new HashMap<>();
95 nbbm2SEStationMap = TreeMultimap.create(); 94 nbbm2SEStationMap = TreeMultimap.create();
96 } 95 }
@@ -103,6 +102,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -103,6 +102,9 @@ public class DayOfSchedule implements CommandLineRunner {
103 102
104 @Autowired 103 @Autowired
105 FirstScheduleCheckThread firstScheduleCheckThread; 104 FirstScheduleCheckThread firstScheduleCheckThread;
  105 +
  106 + @Autowired
  107 + ScheduleLateThread scheduleLateThread;
106 108
107 @Override 109 @Override
108 public void run(String... arg0) throws Exception { 110 public void run(String... arg0) throws Exception {
@@ -112,6 +114,8 @@ public class DayOfSchedule implements CommandLineRunner { @@ -112,6 +114,8 @@ public class DayOfSchedule implements CommandLineRunner {
112 Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); 114 Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
113 //首班出场指令补发器 115 //首班出场指令补发器
114 Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 60, 60, TimeUnit.SECONDS); 116 Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 60, 60, TimeUnit.SECONDS);
  117 + //班次误点扫描
  118 + Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
115 } 119 }
116 120
117 public Map<String, String> getCurrSchDate() { 121 public Map<String, String> getCurrSchDate() {
@@ -167,11 +171,18 @@ public class DayOfSchedule implements CommandLineRunner { @@ -167,11 +171,18 @@ public class DayOfSchedule implements CommandLineRunner {
167 //添加到缓存 171 //添加到缓存
168 putAll(list); 172 putAll(list);
169 173
170 - //计算“起点站应到”时间  
171 Set<String> cars = searchAllCars(list); 174 Set<String> cars = searchAllCars(list);
  175 + //计算“起点站应到”时间
172 for(String nbbm : cars) 176 for(String nbbm : cars)
173 schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); 177 schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm));
174 178
  179 + //是否是出站即出场
  180 + LineConfig conf = lineConfigData.get(lineCode);
  181 + if(conf.getOutConfig() == 2){
  182 + for(String nbbm : cars)
  183 + schAttrCalculator.connectOutSchedule(nbbmScheduleMap.get(nbbm));
  184 + }
  185 +
175 // 页面 翻班通知 186 // 页面 翻班通知
176 sendUtils.shiftSchedule(lineCode); 187 sendUtils.shiftSchedule(lineCode);
177 } catch (Exception e) { 188 } catch (Exception e) {
@@ -265,6 +276,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -265,6 +276,7 @@ public class DayOfSchedule implements CommandLineRunner {
265 * @Description: TODO(从计划排班表加载数据) 276 * @Description: TODO(从计划排班表加载数据)
266 */ 277 */
267 public List<ScheduleRealInfo> loadPlanSch(String lineCode, String schDate) { 278 public List<ScheduleRealInfo> loadPlanSch(String lineCode, String schDate) {
  279 + logger.info("从计划排班表恢复排班,lineCode: " + lineCode + ", schDate: " + schDate);
268 List<ScheduleRealInfo> realList = new ArrayList<>(); 280 List<ScheduleRealInfo> realList = new ArrayList<>();
269 281
270 try { 282 try {
@@ -290,6 +302,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -290,6 +302,9 @@ public class DayOfSchedule implements CommandLineRunner {
290 logger.error("loadPlanSch... 计算终点时间失败..."); 302 logger.error("loadPlanSch... 计算终点时间失败...");
291 } 303 }
292 } 304 }
  305 + //计划里程为0,直接清空
  306 + if(sch.getJhlc() != null && sch.getJhlc() == 0)
  307 + sch.setJhlc(null);
293 } 308 }
294 } catch (Exception e) { 309 } catch (Exception e) {
295 logger.error("", e); 310 logger.error("", e);
@@ -418,28 +433,6 @@ public class DayOfSchedule implements CommandLineRunner { @@ -418,28 +433,6 @@ public class DayOfSchedule implements CommandLineRunner {
418 return next; 433 return next;
419 } 434 }
420 435
421 - /**  
422 - *  
423 - * @Title: prveRealSch  
424 - * @Description: TODO(获取上一个已实际发出的班次)  
425 - */  
426 -/* public ScheduleRealInfo prveSjfc(ScheduleRealInfo sch) {  
427 - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());  
428 - // 排序  
429 - Collections.sort(list, schNoComparator);  
430 -  
431 - ScheduleRealInfo prve = null;  
432 -  
433 - int i = list.indexOf(sch);  
434 - for (; i >= 0; i--){  
435 - if (list.get(i).getFcsjActual() != null){  
436 - prve = list.get(i);  
437 - break;  
438 - }  
439 - }  
440 - return prve;  
441 - }*/  
442 -  
443 public void put(ScheduleRealInfo sch) { 436 public void put(ScheduleRealInfo sch) {
444 schAttrCalculator 437 schAttrCalculator
445 .calcRealDate(sch) 438 .calcRealDate(sch)
@@ -466,7 +459,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -466,7 +459,7 @@ public class DayOfSchedule implements CommandLineRunner {
466 public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) { 459 public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) {
467 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); 460 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
468 // 排序 461 // 排序
469 - Collections.sort(list, schNoComparator); 462 + Collections.sort(list, schFCSJComparator);
470 463
471 List<ScheduleRealInfo> rs = new ArrayList<>(); 464 List<ScheduleRealInfo> rs = new ArrayList<>();
472 ScheduleRealInfo temp; 465 ScheduleRealInfo temp;
@@ -554,33 +547,6 @@ public class DayOfSchedule implements CommandLineRunner { @@ -554,33 +547,6 @@ public class DayOfSchedule implements CommandLineRunner {
554 pstBuffer.add(sch); 547 pstBuffer.add(sch);
555 } 548 }
556 549
557 - /**  
558 - *  
559 - * @Title: outSch  
560 - * @Description: TODO(出场班次)  
561 - */  
562 -/* public List<ScheduleRealInfo> outSch(String nbbm){  
563 - List<ScheduleRealInfo> all = nbbmScheduleMap.get(nbbm)  
564 - ,outList = new ArrayList<>();  
565 -  
566 - for(ScheduleRealInfo sch : all){  
567 - if(sch.getBcType().equals("out"))  
568 - outList.add(sch);  
569 - }  
570 - return outList;  
571 - }  
572 -  
573 - public ScheduleRealInfo nextOut(String nbbm){  
574 - List<ScheduleRealInfo> list = outSch(nbbm);  
575 - Collections.sort(list, schNoComparator);  
576 - ScheduleRealInfo sch = null;  
577 - for(ScheduleRealInfo temp : list){  
578 - if(temp.getFcsjActual() == null)  
579 - sch = temp;  
580 - }  
581 -  
582 - return sch;  
583 - }*/  
584 550
585 /** 551 /**
586 * 552 *
@@ -590,7 +556,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -590,7 +556,7 @@ public class DayOfSchedule implements CommandLineRunner {
590 public ScheduleRealInfo nextByBcType(String nbbm, String bcType){ 556 public ScheduleRealInfo nextByBcType(String nbbm, String bcType){
591 List<ScheduleRealInfo> list = findByBcType(nbbm, bcType); 557 List<ScheduleRealInfo> list = findByBcType(nbbm, bcType);
592 558
593 - Collections.sort(list, schNoComparator); 559 + Collections.sort(list, schFCSJComparator);
594 ScheduleRealInfo sch = null; 560 ScheduleRealInfo sch = null;
595 for(ScheduleRealInfo temp : list){ 561 for(ScheduleRealInfo temp : list){
596 if(temp.getFcsjActual() == null) 562 if(temp.getFcsjActual() == null)
@@ -623,4 +589,8 @@ public class DayOfSchedule implements CommandLineRunner { @@ -623,4 +589,8 @@ public class DayOfSchedule implements CommandLineRunner {
623 public Set<String> allCar(){ 589 public Set<String> allCar(){
624 return nbbmScheduleMap.keySet(); 590 return nbbmScheduleMap.keySet();
625 } 591 }
  592 +
  593 + public Collection<ScheduleRealInfo> findAll(){
  594 + return nbbmScheduleMap.values();
  595 + }
626 } 596 }
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
@@ -87,7 +87,7 @@ public class SchAttrCalculator { @@ -87,7 +87,7 @@ public class SchAttrCalculator {
87 * @Description: TODO(计算班次的起点应到时间,list 必须是同一辆车的班次) 87 * @Description: TODO(计算班次的起点应到时间,list 必须是同一辆车的班次)
88 */ 88 */
89 public void calcQdzTimePlan(List<ScheduleRealInfo> list){ 89 public void calcQdzTimePlan(List<ScheduleRealInfo> list){
90 - Collections.sort(list, new ScheduleComparator.FCNO()); 90 + Collections.sort(list, new ScheduleComparator.FCSJ());
91 91
92 int len = list.size(); 92 int len = list.size();
93 if(len == 0) 93 if(len == 0)
@@ -102,6 +102,34 @@ public class SchAttrCalculator { @@ -102,6 +102,34 @@ public class SchAttrCalculator {
102 prve = curr; 102 prve = curr;
103 } 103 }
104 } 104 }
  105 +
  106 + /**
  107 + *
  108 + * @Title: connectOutSchedule
  109 + * @Description: TODO(关联出场班次)
  110 + */
  111 + public void connectOutSchedule(List<ScheduleRealInfo> list){
  112 + Collections.sort(list, new ScheduleComparator.FCSJ());
  113 +
  114 + int len = list.size();
  115 + if(len == 0)
  116 + return;
  117 +
  118 + ScheduleRealInfo prve = list.get(0), curr;
  119 + for(int i = 1; i < len; i ++){
  120 + curr = list.get(i);
  121 +
  122 + //出站即出场关联
  123 + if(prve.getBcType().equals("out") && prve.getJhlc() == null)
  124 + curr.setTwinsSch(prve);
  125 +
  126 + //进站即进场关联
  127 + if(curr.getBcType().equals("in") && curr.getJhlc() == null)
  128 + prve.setTwinsSch(curr);
  129 +
  130 + prve = curr;
  131 + }
  132 + }
105 133
106 public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { 134 public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException {
107 sch.setFcsjT(DateUtils.sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime()); 135 sch.setFcsjT(DateUtils.sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime());
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
@@ -14,18 +14,18 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; @@ -14,18 +14,18 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
14 */ 14 */
15 public class ScheduleComparator { 15 public class ScheduleComparator {
16 16
17 - public static class FCNO implements Comparator<ScheduleRealInfo>{ 17 +/* public static class FCNO implements Comparator<ScheduleRealInfo>{
18 @Override 18 @Override
19 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { 19 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
20 return s1.getFcno() - s2.getFcno(); 20 return s1.getFcno() - s2.getFcno();
21 } 21 }
22 - } 22 + }*/
23 23
24 public static class FCSJ implements Comparator<ScheduleRealInfo>{ 24 public static class FCSJ implements Comparator<ScheduleRealInfo>{
25 25
26 @Override 26 @Override
27 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { 27 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
28 - return (int) (s1.getFcsjT() - s2.getFcsjT()); 28 + return (int) (s1.getDfsjT() - s2.getDfsjT());
29 } 29 }
30 } 30 }
31 } 31 }
src/main/java/com/bsth/data/schedule/thread/ScheduleLateThread.java 0 → 100644
  1 +package com.bsth.data.schedule.thread;
  2 +
  3 +
  4 +import java.util.ArrayList;
  5 +import java.util.Collections;
  6 +import java.util.Comparator;
  7 +import java.util.List;
  8 +
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import com.bsth.data.schedule.DayOfSchedule;
  13 +import com.bsth.data.schedule.ScheduleComparator;
  14 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  15 +import com.bsth.websocket.handler.SendUtils;
  16 +
  17 +/**
  18 + *
  19 + * @ClassName: ScheduleLateThread
  20 + * @Description: TODO(班次误点扫描线程)
  21 + * @author PanZhao
  22 + * @date 2016年8月31日 下午3:09:02
  23 + *
  24 + */
  25 +@Component
  26 +public class ScheduleLateThread extends Thread{
  27 +
  28 + @Autowired
  29 + DayOfSchedule dayOfSchedule;
  30 +
  31 + @Autowired
  32 + SendUtils sendUtils;
  33 +
  34 + private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.FCSJ();
  35 +
  36 + @Override
  37 + public void run() {
  38 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll());
  39 + Collections.sort(all, cpm);
  40 +
  41 + long t = System.currentTimeMillis();
  42 + int size = all.size();
  43 +
  44 + ScheduleRealInfo sch;
  45 + for(int i = 0; i < size; i ++){
  46 + sch = all.get(i);
  47 + if(sch.getDfsjT() > t)
  48 + break;
  49 +
  50 + if(sch.getStatus() == 0 && sch.getFcsjActual() == null){
  51 + //应发未发
  52 + sch.setLate(true);
  53 + //通知客户端
  54 + sendUtils.refreshSch(sch);
  55 + }
  56 + }
  57 + }
  58 +}
src/main/java/com/bsth/data/schedule/SchedulePstThread.java renamed to src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
1 -package com.bsth.data.schedule; 1 +package com.bsth.data.schedule.thread;
2 2
3 import java.util.LinkedList; 3 import java.util.LinkedList;
4 4
5 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.stereotype.Component; 6 import org.springframework.stereotype.Component;
7 7
  8 +import com.bsth.data.schedule.DayOfSchedule;
8 import com.bsth.entity.realcontrol.ScheduleRealInfo; 9 import com.bsth.entity.realcontrol.ScheduleRealInfo;
9 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 10 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
10 11
src/main/java/com/bsth/data/schedule/ScheduleRefreshThread.java renamed to src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
1 -package com.bsth.data.schedule; 1 +package com.bsth.data.schedule.thread;
2 2
3 import java.util.Collection; 3 import java.util.Collection;
4 import java.util.Set; 4 import java.util.Set;
@@ -13,6 +13,7 @@ import com.bsth.data.LineConfigData; @@ -13,6 +13,7 @@ import com.bsth.data.LineConfigData;
13 import com.bsth.data.arrival.ArrivalData_GPS; 13 import com.bsth.data.arrival.ArrivalData_GPS;
14 import com.bsth.data.directive.DayOfDirectives; 14 import com.bsth.data.directive.DayOfDirectives;
15 import com.bsth.data.pilot80.PilotReport; 15 import com.bsth.data.pilot80.PilotReport;
  16 +import com.bsth.data.schedule.DayOfSchedule;
16 import com.bsth.entity.realcontrol.LineConfig; 17 import com.bsth.entity.realcontrol.LineConfig;
17 18
18 /** 19 /**
src/main/java/com/bsth/entity/LineInformation.java
@@ -100,6 +100,94 @@ public class LineInformation { @@ -100,6 +100,94 @@ public class LineInformation {
100 // 进场里程 100 // 进场里程
101 private Double paradeMileage; 101 private Double paradeMileage;
102 102
  103 + // 上行进场时间
  104 + private Double upInTimer;
  105 +
  106 + // 上行出场时间
  107 + private Double upOutTimer;
  108 +
  109 + // 下行进场时间
  110 + private Double downInTimer;
  111 +
  112 + // 下行出场时间
  113 + private Double downOutTimer;
  114 +
  115 + // 上行进场里程
  116 + private Double upInMileage;
  117 +
  118 + // 上行出场里程
  119 + private Double upOutMileage;
  120 +
  121 + // 下行进场里程
  122 + private Double downInMileage;
  123 +
  124 + // 下行出场里程
  125 + private Double downOutMileage;
  126 +
  127 + public Double getUpInTimer() {
  128 + return upInTimer;
  129 + }
  130 +
  131 + public void setUpInTimer(Double upInTimer) {
  132 + this.upInTimer = upInTimer;
  133 + }
  134 +
  135 + public Double getUpOutTimer() {
  136 + return upOutTimer;
  137 + }
  138 +
  139 + public void setUpOutTimer(Double upOutTimer) {
  140 + this.upOutTimer = upOutTimer;
  141 + }
  142 +
  143 + public Double getDownInTimer() {
  144 + return downInTimer;
  145 + }
  146 +
  147 + public void setDownInTimer(Double downInTimer) {
  148 + this.downInTimer = downInTimer;
  149 + }
  150 +
  151 + public Double getDownOutTimer() {
  152 + return downOutTimer;
  153 + }
  154 +
  155 + public void setDownOutTimer(Double downOutTimer) {
  156 + this.downOutTimer = downOutTimer;
  157 + }
  158 +
  159 + public Double getUpInMileage() {
  160 + return upInMileage;
  161 + }
  162 +
  163 + public void setUpInMileage(Double upInMileage) {
  164 + this.upInMileage = upInMileage;
  165 + }
  166 +
  167 + public Double getUpOutMileage() {
  168 + return upOutMileage;
  169 + }
  170 +
  171 + public void setUpOutMileage(Double upOutMileage) {
  172 + this.upOutMileage = upOutMileage;
  173 + }
  174 +
  175 + public Double getDownInMileage() {
  176 + return downInMileage;
  177 + }
  178 +
  179 + public void setDownInMileage(Double downInMileage) {
  180 + this.downInMileage = downInMileage;
  181 + }
  182 +
  183 + public Double getDownOutMileage() {
  184 + return downOutMileage;
  185 + }
  186 +
  187 + public void setDownOutMileage(Double downOutMileage) {
  188 + this.downOutMileage = downOutMileage;
  189 + }
  190 +
103 // 出场里程 191 // 出场里程
104 private Double outMileage; 192 private Double outMileage;
105 193
src/main/java/com/bsth/entity/forecast/Sample.java 0 → 100644
  1 +package com.bsth.entity.forecast;
  2 +
  3 +
  4 +import javax.persistence.Entity;
  5 +import javax.persistence.GeneratedValue;
  6 +import javax.persistence.Id;
  7 +import javax.persistence.Table;
  8 +import javax.persistence.Transient;
  9 +
  10 +/**
  11 + *
  12 + * @ClassName: Sample
  13 + * @Description: TODO(站点耗时预测样本)
  14 + * @author PanZhao
  15 + * @date 2016年8月31日 上午9:50:49
  16 + *
  17 + */
  18 +@Entity
  19 +@Table(name = "bsth_forecast_sample")
  20 +public class Sample {
  21 +
  22 + @Id
  23 + @GeneratedValue
  24 + private Long id;
  25 +
  26 + private Integer lineCode;
  27 +
  28 + // 开始时间
  29 + private String sDate;
  30 + @Transient
  31 + private Long sTime;
  32 +
  33 + // 结束时间
  34 + private String eDate;
  35 + @Transient
  36 + private Long eTime;
  37 +
  38 + // 开始站点
  39 + private String sStation;
  40 +
  41 + // 结束站点
  42 + private String eStation;
  43 +
  44 + // 0:gps分析生成, 1:人工录入
  45 + private int type;
  46 +
  47 + private String tag;
  48 +
  49 + //行驶时间
  50 + private Float runTime;
  51 +
  52 + private int updown;
  53 +
  54 + public Long getId() {
  55 + return id;
  56 + }
  57 +
  58 + public void setId(Long id) {
  59 + this.id = id;
  60 + }
  61 +
  62 + public String getsDate() {
  63 + return sDate;
  64 + }
  65 +
  66 + public void setsDate(String sDate) {
  67 + this.sDate = sDate;
  68 + }
  69 +
  70 + public Long getsTime() {
  71 + return sTime;
  72 + }
  73 +
  74 + public void setsTime(Long sTime) {
  75 + this.sTime = sTime;
  76 + }
  77 +
  78 + public String geteDate() {
  79 + return eDate;
  80 + }
  81 +
  82 + public void seteDate(String eDate) {
  83 + this.eDate = eDate;
  84 + }
  85 +
  86 + public Long geteTime() {
  87 + return eTime;
  88 + }
  89 +
  90 + public void seteTime(Long eTime) {
  91 + this.eTime = eTime;
  92 + }
  93 +
  94 + public String getsStation() {
  95 + return sStation;
  96 + }
  97 +
  98 + public void setsStation(String sStation) {
  99 + this.sStation = sStation;
  100 + }
  101 +
  102 + public String geteStation() {
  103 + return eStation;
  104 + }
  105 +
  106 + public void seteStation(String eStation) {
  107 + this.eStation = eStation;
  108 + }
  109 +
  110 + public int getType() {
  111 + return type;
  112 + }
  113 +
  114 + public void setType(int type) {
  115 + this.type = type;
  116 + }
  117 +
  118 + public String getTag() {
  119 + return tag;
  120 + }
  121 +
  122 + public void setTag(String tag) {
  123 + this.tag = tag;
  124 + }
  125 +
  126 + public Float getRunTime() {
  127 + return runTime;
  128 + }
  129 +
  130 + public void setRunTime(Float runTime) {
  131 + this.runTime = runTime;
  132 + }
  133 +
  134 + public Integer getLineCode() {
  135 + return lineCode;
  136 + }
  137 +
  138 + public void setLineCode(Integer lineCode) {
  139 + this.lineCode = lineCode;
  140 + }
  141 +
  142 + public int getUpdown() {
  143 + return updown;
  144 + }
  145 +
  146 + public void setUpdown(int updown) {
  147 + this.updown = updown;
  148 + }
  149 +}
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
@@ -55,10 +55,10 @@ public class LineConfig { @@ -55,10 +55,10 @@ public class LineConfig {
55 /** 托管状态 */ 55 /** 托管状态 */
56 private boolean trust; 56 private boolean trust;
57 57
58 - /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 */ 58 + /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */
59 private int outConfig; 59 private int outConfig;
60 60
61 - /** 进场时间设置 0:真实进场(设备进入缓冲区时间) 1:请求进场时间 */ 61 + /** 进场时间设置 0:真实进场(设备进入缓冲区时间) 1:请求进场时间 2:出站即出场*/
62 private int inConfig; 62 private int inConfig;
63 63
64 /** 短语模板 , 号分隔多个 */ 64 /** 短语模板 , 号分隔多个 */
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -102,19 +102,10 @@ public class ScheduleRealInfo { @@ -102,19 +102,10 @@ public class ScheduleRealInfo {
102 */ 102 */
103 private String bcType; 103 private String bcType;
104 104
105 - /** 设备请求出场或进场时间(班次为 出场或进场 时,该字段可能有值)  
106 - private Long devRequestTime;*/  
107 -  
108 - /** 停车场既首发站 */  
109 - @Transient  
110 - private boolean parkIsFirstStation;  
111 - /** 首发站既停车场 */  
112 - @Transient  
113 - private boolean firstStationIsPark;  
114 - /** 与其共享发车时间的进出场班次 */ 105 + /** 出站即出场 , 关联的进出场班次 */
115 @JsonIgnore 106 @JsonIgnore
116 @Transient 107 @Transient
117 - private ScheduleRealInfo twins; 108 + private ScheduleRealInfo twinsSch;
118 109
119 /** 创建人 */ 110 /** 创建人 */
120 @JsonIgnore 111 @JsonIgnore
@@ -149,7 +140,7 @@ public class ScheduleRealInfo { @@ -149,7 +140,7 @@ public class ScheduleRealInfo {
149 private boolean sflj; 140 private boolean sflj;
150 141
151 /** 是否误点*/ 142 /** 是否误点*/
152 - private boolean isLate; 143 + private boolean late;
153 144
154 /**实际里程*/ 145 /**实际里程*/
155 private Float realMileage; 146 private Float realMileage;
@@ -468,14 +459,6 @@ public class ScheduleRealInfo { @@ -468,14 +459,6 @@ public class ScheduleRealInfo {
468 this.status = status; 459 this.status = status;
469 } 460 }
470 461
471 - public boolean isLate() {  
472 - return isLate;  
473 - }  
474 -  
475 - public void setLate(boolean isLate) {  
476 - this.isLate = isLate;  
477 - }  
478 -  
479 public Float getRealMileage() { 462 public Float getRealMileage() {
480 return realMileage; 463 return realMileage;
481 } 464 }
@@ -539,35 +522,6 @@ public class ScheduleRealInfo { @@ -539,35 +522,6 @@ public class ScheduleRealInfo {
539 } 522 }
540 } 523 }
541 524
542 - /**  
543 - * @throws ParseException  
544 - *  
545 - * @Title: syncTime  
546 - * @Description: TODO(根据计发时间,计算待发时间和终点时间)  
547 - * @param 设定文件  
548 - * @return void 返回类型  
549 - * @throws  
550 -  
551 - public void syncTime(){  
552 - try{  
553 - this.setDfsj(this.getFcsj());  
554 - //发车时间戳  
555 - this.setFcsjT(sdfyyyyMMddHHmm.parse(this.realExecDate + " " + this.getFcsj()).getTime());  
556 - //待发时间戳  
557 - this.setDfsjT(this.getFcsjT());  
558 - //计算终点时间  
559 - calcEndTime();  
560 -  
561 - if(this.fcsjActual != null)  
562 - this.setFcsjActualAll(this.fcsjActual);  
563 -  
564 - if(this.zdsjActual != null)  
565 - this.setZdsjActualAll(this.zdsjActual);  
566 - }catch(Exception e){  
567 - e.printStackTrace();  
568 - }  
569 - } */  
570 -  
571 public void calcEndTime(){ 525 public void calcEndTime(){
572 //计划终点时间 526 //计划终点时间
573 if(this.getBcsj() != null){ 527 if(this.getBcsj() != null){
@@ -671,21 +625,6 @@ public class ScheduleRealInfo { @@ -671,21 +625,6 @@ public class ScheduleRealInfo {
671 calcStatus(); 625 calcStatus();
672 } 626 }
673 627
674 - //和依赖班次同步发车时间  
675 -/* public void synchroFcsj(){  
676 - if(this.isFirstStationIsPark() || this.isParkIsFirstStation()){  
677 - ScheduleRealInfo twinsSch = this.twins;  
678 - if(null != twinsSch){  
679 - //有关联的出场班次  
680 - twinsSch.setFcsjActual(this.fcsjActual);  
681 - twinsSch.setFcsjActualTime(this.fcsjActualTime);  
682 - if(null != twinsSch.getSjfcModel())  
683 - twinsSch.getSjfcModel().setPersonTime(this.fcsjActualTime);  
684 - twinsSch.calcStatus();  
685 - }  
686 - }  
687 - }*/  
688 -  
689 /** 628 /**
690 * 629 *
691 * @Title: setFcsjActualAll 630 * @Title: setFcsjActualAll
@@ -718,19 +657,6 @@ public class ScheduleRealInfo { @@ -718,19 +657,6 @@ public class ScheduleRealInfo {
718 } 657 }
719 } 658 }
720 659
721 - //和依赖的进场班次同步终点时间  
722 -/* public void synchroZdsj(){  
723 - if(this.isFirstStationIsPark()){  
724 - ScheduleRealInfo twinsSch = this.twins;  
725 - if(null != twinsSch && twinsSch.getBcType().equals("in")){  
726 - //有关联的进场班次  
727 - twinsSch.setFcsjActual(this.zdsjActual);  
728 - twinsSch.setFcsjActualTime(this.zdsjActualTime);  
729 - twinsSch.calcStatus();  
730 - }  
731 - }  
732 - }*/  
733 -  
734 public Long getSpId() { 660 public Long getSpId() {
735 return spId; 661 return spId;
736 } 662 }
@@ -755,9 +681,9 @@ public class ScheduleRealInfo { @@ -755,9 +681,9 @@ public class ScheduleRealInfo {
755 if(StringUtils.isNotBlank(this.fcsjActual)){ 681 if(StringUtils.isNotBlank(this.fcsjActual)){
756 this.status = 1; 682 this.status = 1;
757 683
758 - //进出场班次并且没有终点时间 684 + //进出场班次并且没有计划里程
759 if((this.bcType.equals("out") || this.bcType.equals("in")) 685 if((this.bcType.equals("out") || this.bcType.equals("in"))
760 - && this.zdsj == null){ 686 + && this.jhlc == null){
761 this.status = 2; 687 this.status = 2;
762 } 688 }
763 } 689 }
@@ -792,60 +718,12 @@ public class ScheduleRealInfo { @@ -792,60 +718,12 @@ public class ScheduleRealInfo {
792 public void setScheduleDateStr(String scheduleDateStr) { 718 public void setScheduleDateStr(String scheduleDateStr) {
793 this.scheduleDateStr = scheduleDateStr; 719 this.scheduleDateStr = scheduleDateStr;
794 } 720 }
795 -  
796 - public boolean isParkIsFirstStation() {  
797 - return parkIsFirstStation;  
798 - }  
799 -  
800 - public void setParkIsFirstStation(boolean parkIsFirstStation) {  
801 - this.parkIsFirstStation = parkIsFirstStation;  
802 - }  
803 -  
804 -/* public ScheduleRealInfo getTwins() {  
805 - return twins;  
806 - }  
807 -  
808 - public void setTwins(ScheduleRealInfo twins) {  
809 - this.twins = twins;  
810 - }  
811 -  
812 - public boolean isFirstStationIsPark() {  
813 - return firstStationIsPark;  
814 - }  
815 -  
816 - public void setFirstStationIsPark(boolean firstStationIsPark) {  
817 - this.firstStationIsPark = firstStationIsPark;  
818 - }*/  
819 -  
820 -  
821 - /*public boolean statusTostart(){  
822 - return this.getFcsjActual() == null  
823 - && this.getSjfcModel().getTime() != null;  
824 - }  
825 -  
826 - public boolean statusToEnd(){  
827 - return this.getZdsjActual() == null  
828 - && this.getSjddModel().getTime() != null;  
829 - }  
830 -  
831 - public void revokeRealOutgo() {  
832 - //this.setStatus(0);  
833 - this.setFcsjActual(null);  
834 - this.setFcsjActualTime(null);  
835 - if(null != this.getSjfcModel())  
836 - this.getSjfcModel().resetNull();  
837 - this.calcStatus();  
838 - }*/  
839 721
840 public void clearFcsjActual(){ 722 public void clearFcsjActual(){
841 this.setFcsjActual(null); 723 this.setFcsjActual(null);
842 this.setFcsjActualTime(null); 724 this.setFcsjActualTime(null);
843 this.calcStatus(); 725 this.calcStatus();
844 } 726 }
845 -  
846 -/* public boolean existDependent() {  
847 - return this.isFirstStationIsPark() || this.parkIsFirstStation;  
848 - }*/  
849 727
850 //清除实际终点时间 728 //清除实际终点时间
851 public void clearZdsjActual(){ 729 public void clearZdsjActual(){
@@ -862,4 +740,20 @@ public class ScheduleRealInfo { @@ -862,4 +740,20 @@ public class ScheduleRealInfo {
862 public void setOpDirectiveState(Integer opDirectiveState) { 740 public void setOpDirectiveState(Integer opDirectiveState) {
863 this.opDirectiveState = opDirectiveState; 741 this.opDirectiveState = opDirectiveState;
864 } 742 }
  743 +
  744 + public ScheduleRealInfo getTwinsSch() {
  745 + return twinsSch;
  746 + }
  747 +
  748 + public void setTwinsSch(ScheduleRealInfo twinsSch) {
  749 + this.twinsSch = twinsSch;
  750 + }
  751 +
  752 + public boolean isLate() {
  753 + return late;
  754 + }
  755 +
  756 + public void setLate(boolean late) {
  757 + this.late = late;
  758 + }
865 } 759 }
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
@@ -3,10 +3,10 @@ package com.bsth.entity.schedule; @@ -3,10 +3,10 @@ package com.bsth.entity.schedule;
3 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
4 import com.bsth.entity.sys.SysUser; 4 import com.bsth.entity.sys.SysUser;
5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; 5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
6 -import com.fasterxml.jackson.annotation.JsonIgnore;  
7 6
8 import javax.persistence.*; 7 import javax.persistence.*;
9 import java.util.Date; 8 import java.util.Date;
  9 +import java.util.List;
10 10
11 /** 11 /**
12 * 排班计划明细。 12 * 排班计划明细。
@@ -150,7 +150,7 @@ public class SchedulePlanInfo { @@ -150,7 +150,7 @@ public class SchedulePlanInfo {
150 ScheduleResult_output scheduleResult_output, 150 ScheduleResult_output scheduleResult_output,
151 TTInfoDetail ttInfoDetail, 151 TTInfoDetail ttInfoDetail,
152 CarConfigInfo carConfigInfo, 152 CarConfigInfo carConfigInfo,
153 - EmployeeConfigInfo employeeConfigInfo, 153 + List<EmployeeConfigInfo> employeeConfigInfoList,
154 SchedulePlan schedulePlan) { 154 SchedulePlan schedulePlan) {
155 155
156 // TODO:关联的公司名称 156 // TODO:关联的公司名称
@@ -180,6 +180,17 @@ public class SchedulePlanInfo { @@ -180,6 +180,17 @@ public class SchedulePlanInfo {
180 180
181 // TODO:报道时间,出场时间没有 181 // TODO:报道时间,出场时间没有
182 // 关联的驾驶员 182 // 关联的驾驶员
  183 + EmployeeConfigInfo employeeConfigInfo = null;
  184 + if (ttInfoDetail.getIsFB()) {
  185 + if (employeeConfigInfoList.size() > 1) {
  186 + employeeConfigInfo = employeeConfigInfoList.get(1);
  187 + } else {
  188 + employeeConfigInfo = employeeConfigInfoList.get(0);
  189 + }
  190 + } else {
  191 + employeeConfigInfo = employeeConfigInfoList.get(0);
  192 + }
  193 +
183 this.j = employeeConfigInfo.getJsy().getId(); 194 this.j = employeeConfigInfo.getJsy().getId();
184 this.jGh = employeeConfigInfo.getJsy().getJobCode(); 195 this.jGh = employeeConfigInfo.getJsy().getJobCode();
185 this.jName = employeeConfigInfo.getJsy().getPersonnelName(); 196 this.jName = employeeConfigInfo.getJsy().getPersonnelName();
@@ -207,15 +218,13 @@ public class SchedulePlanInfo { @@ -207,15 +218,13 @@ public class SchedulePlanInfo {
207 this.zdz = ttInfoDetail.getTcc().getId(); // 终点站-停车场id 218 this.zdz = ttInfoDetail.getTcc().getId(); // 终点站-停车场id
208 this.zdzCode = ttInfoDetail.getTcc().getParkCode(); // 终点站-停车场code 219 this.zdzCode = ttInfoDetail.getTcc().getParkCode(); // 终点站-停车场code
209 this.zdzName = ttInfoDetail.getTcc().getParkName(); // 终点站-停车场name 220 this.zdzName = ttInfoDetail.getTcc().getParkName(); // 终点站-停车场name
210 - } else if ("normal".equals(this.bcType)) { // 正常班次 221 + } else { // 其他班次
211 this.qdz = ttInfoDetail.getQdz().getId(); // 起点站id 222 this.qdz = ttInfoDetail.getQdz().getId(); // 起点站id
212 this.qdzCode = ttInfoDetail.getQdz().getStationCod(); // 起点站code 223 this.qdzCode = ttInfoDetail.getQdz().getStationCod(); // 起点站code
213 this.qdzName = ttInfoDetail.getQdz().getStationName(); // 起点站name 224 this.qdzName = ttInfoDetail.getQdz().getStationName(); // 起点站name
214 this.zdz = ttInfoDetail.getZdz().getId(); // 终点站id 225 this.zdz = ttInfoDetail.getZdz().getId(); // 终点站id
215 this.zdzCode = ttInfoDetail.getZdz().getStationCod(); // 终点站code 226 this.zdzCode = ttInfoDetail.getZdz().getStationCod(); // 终点站code
216 this.zdzName = ttInfoDetail.getZdz().getStationName(); // 终点站name 227 this.zdzName = ttInfoDetail.getZdz().getStationName(); // 终点站name
217 - } else {  
218 - throw new RuntimeException("排班计划数据,未知班次类型:" + this.bcType);  
219 } 228 }
220 229
221 this.fcsj = ttInfoDetail.getFcsj(); // 发车时间 230 this.fcsj = ttInfoDetail.getFcsj(); // 发车时间
src/main/java/com/bsth/entity/schedule/rule/ScheduleRule1Flat.java
@@ -61,10 +61,10 @@ public class ScheduleRule1Flat { @@ -61,10 +61,10 @@ public class ScheduleRule1Flat {
61 /** 起始路牌(从0开始) */ 61 /** 起始路牌(从0开始) */
62 @NotNull 62 @NotNull
63 private Integer lpStart; 63 private Integer lpStart;
64 - /** 人员搭班编码s(用逗号隔开) */ 64 + /** 人员搭班编码s(用逗号隔开,如果分班,就先-隔开再逗号隔开) */
65 @NotNull 65 @NotNull
66 private String ryDbbms; 66 private String ryDbbms;
67 - /** 对应的人员配置ids(用逗号隔开) */ 67 + /** 对应的人员配置ids(用逗号隔开,如果分班,就先-隔开再逗号隔开) */
68 @NotNull 68 @NotNull
69 private String ryConfigIds; 69 private String ryConfigIds;
70 /** 起始人员(从0开始) */ 70 /** 起始人员(从0开始) */
src/main/java/com/bsth/entity/sys/UserLine.java 0 → 100644
  1 +package com.bsth.entity.sys;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.GeneratedValue;
  5 +import javax.persistence.GenerationType;
  6 +import javax.persistence.Id;
  7 +import javax.persistence.ManyToOne;
  8 +import javax.persistence.Table;
  9 +
  10 +import com.bsth.entity.Line;
  11 +
  12 +/**
  13 + *
  14 + * @ClassName: Line(用户线路分配实体类)
  15 + *
  16 + * @Description: TODO(用户线路分配实体类)
  17 + *
  18 + * @Author bsth@lq
  19 + *
  20 + * @Date 2016年8月26日 09:03:33
  21 + *
  22 + * @Version 公交调度系统BS版 0.1
  23 + *
  24 + */
  25 +
  26 +@Entity
  27 +@Table(name = "bsth_c_user_line")
  28 +public class UserLine {
  29 +
  30 + @Id
  31 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  32 + private Integer id;
  33 +
  34 + @ManyToOne
  35 + private Line line;
  36 +
  37 + @ManyToOne
  38 + private SysUser user;
  39 +
  40 + public Line getLine() {
  41 + return line;
  42 + }
  43 +
  44 + public Integer getId() {
  45 + return id;
  46 + }
  47 +
  48 + public void setId(Integer id) {
  49 + this.id = id;
  50 + }
  51 +
  52 + public void setLine(Line line) {
  53 + this.line = line;
  54 + }
  55 +
  56 + public SysUser getUser() {
  57 + return user;
  58 + }
  59 +
  60 + public void setUser(SysUser user) {
  61 + this.user = user;
  62 + }
  63 +}
src/main/java/com/bsth/repository/CarParkRepository.java
@@ -66,9 +66,9 @@ public interface CarParkRepository extends BaseRepository&lt;CarPark, Integer&gt;{ @@ -66,9 +66,9 @@ public interface CarParkRepository extends BaseRepository&lt;CarPark, Integer&gt;{
66 "k.update_date AS carParkUpdateDate," + 66 "k.update_date AS carParkUpdateDate," +
67 "k.versions AS carParkVersions," + 67 "k.versions AS carParkVersions," +
68 "k.b_center_point AS carParkBcenterPoint," + 68 "k.b_center_point AS carParkBcenterPoint," +
69 - "AsText(k.b_park_point) AS carParkBparkPoint," + 69 + "ST_AsText(k.b_park_point) AS carParkBparkPoint," +
70 "k.g_center_point AS carParkGcenterPoint," + 70 "k.g_center_point AS carParkGcenterPoint," +
71 - "AsText(k.g_park_point) AS carParkGparkPoint, " + 71 + "ST_AsText(k.g_park_point) AS carParkGparkPoint, " +
72 "k.db_type AS carParkDBtype," + 72 "k.db_type AS carParkDBtype," +
73 "k.radius AS carParkRadius," + 73 "k.radius AS carParkRadius," +
74 "k.shapes_type AS carParkShapesType FROM bsth_c_car_park k where k.id = ?1", nativeQuery=true) 74 "k.shapes_type AS carParkShapesType FROM bsth_c_car_park k where k.id = ?1", nativeQuery=true)
src/main/java/com/bsth/repository/LineRepository.java
@@ -36,6 +36,6 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; { @@ -36,6 +36,6 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; {
36 36
37 @Query(value = " SELECT l FROM Line l where l.name like ?1") 37 @Query(value = " SELECT l FROM Line l where l.name like ?1")
38 List<Line> findLine(String line); 38 List<Line> findLine(String line);
39 - 39 +
40 public Line findByLineCode(String string); 40 public Line findByLineCode(String string);
41 } 41 }
src/main/java/com/bsth/repository/SectionRouteRepository.java
@@ -51,8 +51,8 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -51,8 +51,8 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
51 " b.middle_node AS sectionMiddleNode," + 51 " b.middle_node AS sectionMiddleNode," +
52 " b.section_type AS sectionType," + 52 " b.section_type AS sectionType," +
53 " b.csection_vector AS sectionCsectionVector," + 53 " b.csection_vector AS sectionCsectionVector," +
54 - " AsText(b.bsection_vector) AS sectionBsectionVector," +  
55 - " AsText(b.gsection_vector) AS sectionGsectionVector," + 54 + " ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
  55 + " ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
56 " b.road_coding AS sectionRoadCoding," + 56 " b.road_coding AS sectionRoadCoding," +
57 " b.section_distance AS sectionDistance," + 57 " b.section_distance AS sectionDistance," +
58 " b.section_time AS sectionTime," + 58 " b.section_time AS sectionTime," +
@@ -101,9 +101,9 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -101,9 +101,9 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
101 "b.start_node AS sectionStartNode," + 101 "b.start_node AS sectionStartNode," +
102 "b.middle_node AS sectionMiddleNode," + 102 "b.middle_node AS sectionMiddleNode," +
103 "b.section_type AS sectionType," + 103 "b.section_type AS sectionType," +
104 - "AsText(b.csection_vector) AS sectionCsectionVector," +  
105 - "AsText(b.bsection_vector) AS sectionBsectionVector," +  
106 - "AsText(b.gsection_vector) AS sectionGsectionVector," + 104 + "ST_AsText(b.csection_vector) AS sectionCsectionVector," +
  105 + "ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
  106 + "ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
107 "b.section_distance AS sectionDistance," + 107 "b.section_distance AS sectionDistance," +
108 "b.section_time AS sectionTime," + 108 "b.section_time AS sectionTime," +
109 "b.db_type AS sectionDbtype," + 109 "b.db_type AS sectionDbtype," +
@@ -151,7 +151,7 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -151,7 +151,7 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
151 */ 151 */
152 @Query(value = "SELECT " + 152 @Query(value = "SELECT " +
153 "c.directions," + 153 "c.directions," +
154 - "AsText(s.bsection_vector) as bsection_vector," + 154 + "ST_AsText(s.bsection_vector) as bsection_vector," +
155 "s.speed_limit," + 155 "s.speed_limit," +
156 "s.section_name " + 156 "s.section_name " +
157 " FROM bsth_c_sectionroute c " + 157 " FROM bsth_c_sectionroute c " +
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -3,7 +3,7 @@ package com.bsth.repository; @@ -3,7 +3,7 @@ package com.bsth.repository;
3 import java.util.List; 3 import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
6 - 6 +import com.bsth.entity.schedule.CarConfigInfo;
7 import org.springframework.data.domain.Page; 7 import org.springframework.data.domain.Page;
8 import org.springframework.data.domain.Pageable; 8 import org.springframework.data.domain.Pageable;
9 import org.springframework.data.jpa.domain.Specification; 9 import org.springframework.data.jpa.domain.Specification;
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Repository; @@ -14,6 +14,7 @@ import org.springframework.stereotype.Repository;
14 import org.springframework.transaction.annotation.Transactional; 14 import org.springframework.transaction.annotation.Transactional;
15 15
16 import com.bsth.entity.Line; 16 import com.bsth.entity.Line;
  17 +import com.bsth.entity.LineInformation;
17 import com.bsth.entity.StationRoute; 18 import com.bsth.entity.StationRoute;
18 19
19 /** 20 /**
@@ -62,8 +63,8 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -62,8 +63,8 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
62 "b.y AS 'station.y'," + 63 "b.y AS 'station.y'," +
63 "b.shapes_type AS 'station.shapesType'," + 64 "b.shapes_type AS 'station.shapesType'," +
64 "b.radius AS 'station.radius'," + 65 "b.radius AS 'station.radius'," +
65 - "AsText(b.g_polygon_grid) AS 'station.gPolygonGrid'," +  
66 - "AsText(b.b_polygon_grid) AS 'station.bPolygonGrid'," + 66 + "ST_AsText(b.g_polygon_grid) AS 'station.gPolygonGrid'," +
  67 + "ST_AsText(b.b_polygon_grid) AS 'station.bPolygonGrid'," +
67 "b.destroy AS 'station.destroy'," + 68 "b.destroy AS 'station.destroy'," +
68 "b.versions AS 'station.versions'," + 69 "b.versions AS 'station.versions'," +
69 "b.descriptions AS 'station.descriptions' FROM (" + 70 "b.descriptions AS 'station.descriptions' FROM (" +
@@ -108,7 +109,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -108,7 +109,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
108 * 109 *
109 * @return List<Object[]> 110 * @return List<Object[]>
110 */ 111 */
111 - @Query(value = "SELECT s.b_jwpoints FROM (" + 112 + @Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" +
112 "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + 113 "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " +
113 "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true) 114 "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true)
114 List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction); 115 List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction);
@@ -190,8 +191,8 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -190,8 +191,8 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
190 " b.g_laty AS stationGlaty," + 191 " b.g_laty AS stationGlaty," +
191 " b.x AS stationX," + 192 " b.x AS stationX," +
192 " b.y AS stationY," + 193 " b.y AS stationY," +
193 - " AsText(b.b_polygon_grid) as stationBPolyonGrid," +  
194 - " AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + 194 + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," +
  195 + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " +
195 " b.destroy AS stationDestroy," + 196 " b.destroy AS stationDestroy," +
196 " b.radius AS stationRadius," + 197 " b.radius AS stationRadius," +
197 " b.shapes_type AS stationShapesType," + 198 " b.shapes_type AS stationShapesType," +
@@ -226,17 +227,10 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -226,17 +227,10 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
226 227
227 List<StationRoute> findByLine(Line line); 228 List<StationRoute> findByLine(Line line);
228 229
229 - @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)  
230 - @Override  
231 - Page<StationRoute> findAll(Specification<StationRoute> spec, Pageable pageable);  
232 -  
233 - @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)  
234 - @Override  
235 - List<StationRoute> findAll(Specification<StationRoute> spec);  
236 - 230 + @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
  231 + @Query("select s from StationRoute s where s.destroy=0")
  232 + List<StationRoute> findAll2();
237 233
238 @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2") 234 @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2")
239 List<Map<String, Object>> findStations(Integer xlid, Integer xldir); 235 List<Map<String, Object>> findStations(Integer xlid, Integer xldir);
240 -  
241 -  
242 } 236 }
src/main/java/com/bsth/repository/forecast/SampleRepository.java 0 → 100644
  1 +package com.bsth.repository.forecast;
  2 +
  3 +import org.springframework.stereotype.Repository;
  4 +
  5 +import com.bsth.entity.forecast.Sample;
  6 +import com.bsth.repository.BaseRepository;
  7 +
  8 +@Repository
  9 +public interface SampleRepository extends BaseRepository<Sample, Long>{
  10 +
  11 +}
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -20,10 +20,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -20,10 +20,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
20 List<ScheduleRealInfo> findByLines(List<String> lines); 20 List<ScheduleRealInfo> findByLines(List<String> lines);
21 21
22 22
23 - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by jName,clZbh,lpName") 23 + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType = 'out' order by (lpName+1)")
24 List<ScheduleRealInfo> queryUserInfo(String line,String date); 24 List<ScheduleRealInfo> queryUserInfo(String line,String date);
25 25
26 - @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by fcsj") 26 + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs")
27 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); 27 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName);
28 28
29 @Query(value="select new map(clZbh as clZbh,jGh as jGh,jName as jName,sum(jhlc) as zgl,sum(addMileage) as ksgl,count(jName) as bcs) from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by clZbh,jGh") 29 @Query(value="select new map(clZbh as clZbh,jGh as jGh,jName as jName,sum(jhlc) as zgl,sum(addMileage) as ksgl,count(jName) as bcs) from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by clZbh,jGh")
@@ -54,8 +54,8 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -54,8 +54,8 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
54 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDate >= str_to_date(?2,'%Y-%m-%d') and s.scheduleDate <= str_to_date(?3,'%Y-%m-%d') and s.lpName = ?4 order by s.fcsj") 54 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDate >= str_to_date(?2,'%Y-%m-%d') and s.scheduleDate <= str_to_date(?3,'%Y-%m-%d') and s.lpName = ?4 order by s.fcsj")
55 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName); 55 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName);
56 56
57 - @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by fcsj")  
58 - List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName); 57 + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate <= str_to_date(?4,'%Y-%m-%d') order by bcs")
  58 + List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date);
59 59
60 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") 60 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
61 List<ScheduleRealInfo> scheduleDaily(String line,String date); 61 List<ScheduleRealInfo> scheduleDaily(String line,String date);
src/main/java/com/bsth/repository/sys/UserLineRepository.java 0 → 100644
  1 +package com.bsth.repository.sys;
  2 +
  3 +import org.springframework.data.jpa.repository.Modifying;
  4 +import org.springframework.data.jpa.repository.Query;
  5 +import org.springframework.stereotype.Repository;
  6 +import org.springframework.transaction.annotation.Transactional;
  7 +
  8 +import com.bsth.entity.sys.UserLine;
  9 +import com.bsth.repository.BaseRepository;
  10 +
  11 +
  12 +@Repository
  13 +public interface UserLineRepository extends BaseRepository<UserLine, Integer>{
  14 +
  15 + @Modifying
  16 + @Query(value="DELETE FROM bsth_c_user_line WHERE user = ?1", nativeQuery=true)
  17 + public void del(int userId);
  18 +
  19 +}
src/main/java/com/bsth/service/BaseService.java
@@ -4,6 +4,7 @@ import org.springframework.data.domain.Page; @@ -4,6 +4,7 @@ import org.springframework.data.domain.Page;
4 import org.springframework.data.domain.Pageable; 4 import org.springframework.data.domain.Pageable;
5 5
6 import java.io.Serializable; 6 import java.io.Serializable;
  7 +import java.util.Collection;
7 import java.util.Map; 8 import java.util.Map;
8 9
9 /** 10 /**
@@ -70,4 +71,11 @@ public interface BaseService&lt;T, ID extends Serializable&gt; { @@ -70,4 +71,11 @@ public interface BaseService&lt;T, ID extends Serializable&gt; {
70 * @return {status:状态编码,msg:错误描述},状态编码 @see com.bsth.common.ResponseCode 71 * @return {status:状态编码,msg:错误描述},状态编码 @see com.bsth.common.ResponseCode
71 */ 72 */
72 Map<String, Object> validateEquale(Map<String, Object> params); 73 Map<String, Object> validateEquale(Map<String, Object> params);
  74 +
  75 + /**
  76 + * 批量保存。
  77 + * @param entities 实体列表
  78 + * @return 保存后的entities
  79 + */
  80 + <S extends T> Collection<S> bulkSave(Collection<S> entities);
73 } 81 }
src/main/java/com/bsth/service/directive/DirectiveService.java
@@ -4,9 +4,6 @@ package com.bsth.service.directive; @@ -4,9 +4,6 @@ package com.bsth.service.directive;
4 import java.util.List; 4 import java.util.List;
5 import java.util.Map; 5 import java.util.Map;
6 6
7 -import org.springframework.data.domain.Page;  
8 -import org.springframework.data.domain.PageRequest;  
9 -  
10 import com.bsth.entity.directive.D60; 7 import com.bsth.entity.directive.D60;
11 import com.bsth.entity.directive.D64; 8 import com.bsth.entity.directive.D64;
12 import com.bsth.entity.directive.D80; 9 import com.bsth.entity.directive.D80;
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
@@ -40,6 +40,8 @@ import com.bsth.security.util.SecurityUtils; @@ -40,6 +40,8 @@ import com.bsth.security.util.SecurityUtils;
40 import com.bsth.service.impl.BaseServiceImpl; 40 import com.bsth.service.impl.BaseServiceImpl;
41 import com.bsth.util.DateUtils; 41 import com.bsth.util.DateUtils;
42 import com.bsth.websocket.handler.RealControlSocketHandler; 42 import com.bsth.websocket.handler.RealControlSocketHandler;
  43 +import com.fasterxml.jackson.core.JsonProcessingException;
  44 +import com.fasterxml.jackson.databind.ObjectMapper;
43 import com.google.common.base.Splitter; 45 import com.google.common.base.Splitter;
44 46
45 @Service 47 @Service
@@ -165,10 +167,17 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -165,10 +167,17 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
165 */ 167 */
166 @Override 168 @Override
167 public void sendD60ToPage(ScheduleRealInfo sch) { 169 public void sendD60ToPage(ScheduleRealInfo sch) {
168 - JSONObject json = new JSONObject();  
169 - json.put("fn", "directive");  
170 - json.put("t", sch);  
171 - socketHandler.sendMessageToLine(sch.getXlBm(), json.toJSONString()); 170 + Map<String, Object> map = new HashMap<>();
  171 + map.put("fn", sch);
  172 + map.put("t", sch);
  173 +
  174 + ObjectMapper mapper = new ObjectMapper();
  175 +
  176 + try {
  177 + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
  178 + } catch (JsonProcessingException e) {
  179 + logger.error("", e);
  180 + }
172 } 181 }
173 182
174 @Override 183 @Override
@@ -244,7 +253,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -244,7 +253,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
244 logger.error("没有设备号对照的车辆:" + nbbm); 253 logger.error("没有设备号对照的车辆:" + nbbm);
245 return null; 254 return null;
246 } 255 }
247 - // 根据当前确定 上下行和营运状态 256 + // 根据当前GPS确定 上下行和营运状态
248 Integer upDown = null, state = null; 257 Integer upDown = null, state = null;
249 if (null == sch) { 258 if (null == sch) {
250 GpsEntity gpsData = gpsRealDataBuffer.findByDeviceId(deviceId); 259 GpsEntity gpsData = gpsRealDataBuffer.findByDeviceId(deviceId);
src/main/java/com/bsth/service/forecast/SampleService.java 0 → 100644
  1 +package com.bsth.service.forecast;
  2 +
  3 +import com.bsth.entity.forecast.Sample;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +public interface SampleService extends BaseService<Sample, Long>{
  7 +
  8 +}
src/main/java/com/bsth/service/forecast/SampleServiceImpl.java 0 → 100644
  1 +package com.bsth.service.forecast;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +
  5 +import com.bsth.entity.forecast.Sample;
  6 +import com.bsth.service.impl.BaseServiceImpl;
  7 +
  8 +@Service
  9 +public class SampleServiceImpl extends BaseServiceImpl<Sample, Long>{
  10 +
  11 +}
src/main/java/com/bsth/service/impl/BaseServiceImpl.java
@@ -7,18 +7,23 @@ import com.bsth.service.BaseService; @@ -7,18 +7,23 @@ import com.bsth.service.BaseService;
7 import org.slf4j.Logger; 7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
9 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.beans.factory.annotation.Value;
10 import org.springframework.dao.DataIntegrityViolationException; 11 import org.springframework.dao.DataIntegrityViolationException;
11 import org.springframework.data.domain.Page; 12 import org.springframework.data.domain.Page;
12 import org.springframework.data.domain.Pageable; 13 import org.springframework.data.domain.Pageable;
13 14
  15 +import javax.persistence.EntityManager;
14 import java.io.Serializable; 16 import java.io.Serializable;
15 -import java.util.HashMap;  
16 -import java.util.Map; 17 +import java.util.*;
17 18
18 public class BaseServiceImpl<T, ID extends Serializable> implements BaseService<T, ID>{ 19 public class BaseServiceImpl<T, ID extends Serializable> implements BaseService<T, ID>{
19 20
20 @Autowired 21 @Autowired
21 private BaseRepository<T, ID> baseRepository; 22 private BaseRepository<T, ID> baseRepository;
  23 + @Autowired
  24 + private EntityManager entityManager;
  25 + @Value("${hibernate.jdbc.batch_size}")
  26 + private int batchSize;
22 27
23 Logger logger = LoggerFactory.getLogger(this.getClass()); 28 Logger logger = LoggerFactory.getLogger(this.getClass());
24 29
@@ -50,9 +55,25 @@ public class BaseServiceImpl&lt;T, ID extends Serializable&gt; implements BaseService&lt; @@ -50,9 +55,25 @@ public class BaseServiceImpl&lt;T, ID extends Serializable&gt; implements BaseService&lt;
50 } 55 }
51 return map; 56 return map;
52 } 57 }
53 -  
54 58
55 - @Override 59 + @Override
  60 + public <S extends T> Collection<S> bulkSave(Collection<S> entities) {
  61 + final List<S> savedEntities = new ArrayList<>(entities.size());
  62 + int i = 0;
  63 + for (S t : entities) {
  64 + entityManager.persist(t);
  65 + savedEntities.add(t);
  66 + i++;
  67 + if (i % batchSize == 0) {
  68 + entityManager.flush();
  69 + entityManager.clear();
  70 + }
  71 + }
  72 +
  73 + return savedEntities;
  74 + }
  75 +
  76 + @Override
56 public Iterable<T> findAll() { 77 public Iterable<T> findAll() {
57 return baseRepository.findAll(); 78 return baseRepository.findAll();
58 } 79 }
src/main/java/com/bsth/service/impl/LineServiceImpl.java
@@ -38,9 +38,10 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L @@ -38,9 +38,10 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L
38 // TODO Auto-generated method stub 38 // TODO Auto-generated method stub
39 return repository.selectMaxIdToLineCode(); 39 return repository.selectMaxIdToLineCode();
40 } 40 }
41 - 41 +
42 @Override 42 @Override
43 public Line findByLineCode(Integer lineCode) { 43 public Line findByLineCode(Integer lineCode) {
44 return repository.findByLineCode(lineCode + ""); 44 return repository.findByLineCode(lineCode + "");
45 } 45 }
  46 +
46 } 47 }
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -457,7 +457,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -457,7 +457,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
457 457
458 Map<String, Object> tempM = new HashMap<String,Object>(); 458 Map<String, Object> tempM = new HashMap<String,Object>();
459 459
460 - tempM.put("bJwpoints", list.get(i)); 460 + tempM.put("bJwpoints", list.get(i)[0]);
  461 +
  462 + tempM.put("stationName", list.get(i)[1]);
461 463
462 resultList.add(tempM); 464 resultList.add(tempM);
463 465
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
@@ -13,4 +13,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{ @@ -13,4 +13,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{
13 13
14 Map<String, Object> editStartOptTime(String time, String lineCode); 14 Map<String, Object> editStartOptTime(String time, String lineCode);
15 15
  16 + Map<String, Object> editOutTimeType(String lineCode, int type);
  17 +
16 } 18 }
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -60,7 +60,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -60,7 +60,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
60 60
61 List<ScheduleRealInfo> queryUserInfo(String line,String date); 61 List<ScheduleRealInfo> queryUserInfo(String line,String date);
62 62
63 - List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); 63 + List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName,String date);
64 64
65 List<Map<String,Object>> dailyInfo(String line,String date,String type); 65 List<Map<String,Object>> dailyInfo(String line,String date,String type);
66 66
@@ -84,7 +84,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -84,7 +84,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
84 84
85 List<Map<String,String>> findLine(String line); 85 List<Map<String,String>> findLine(String line);
86 86
87 - Map<String,Object> findKMBC(String jName,String clZbh,String lpName); 87 + Map<String,Object> findKMBC(String jName,String clZbh,String lpName,String date);
88 88
89 List<Map<String,String>> findLpName(String lpName); 89 List<Map<String,String>> findLpName(String lpName);
90 90
@@ -92,7 +92,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -92,7 +92,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
92 92
93 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code); 93 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
94 94
95 - List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName); 95 + List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date);
96 96
97 Map<String, Object> removeChildTask(Long taskId); 97 Map<String, Object> removeChildTask(Long taskId);
98 98
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
@@ -64,4 +64,18 @@ public class LineConfigServiceImpl extends BaseServiceImpl&lt;LineConfig, Integer&gt; @@ -64,4 +64,18 @@ public class LineConfigServiceImpl extends BaseServiceImpl&lt;LineConfig, Integer&gt;
64 rs.put("time", time); 64 rs.put("time", time);
65 return rs; 65 return rs;
66 } 66 }
  67 +
  68 + @Override
  69 + public Map<String, Object> editOutTimeType(String lineCode, int type) {
  70 + Map<String, Object> rs = new HashMap<>();
  71 + LineConfig conf = lineConfigData.get(lineCode);
  72 +
  73 + conf.setOutConfig(type);
  74 + conf.setInConfig(type);
  75 + lineConfigData.set(conf);
  76 +
  77 + rs.put("status", ResponseCode.SUCCESS);
  78 + rs.put("type", type);
  79 + return rs;
  80 + }
67 } 81 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -455,11 +455,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -455,11 +455,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
455 * 455 *
456 */ 456 */
457 @Override 457 @Override
458 - public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName) { 458 + public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName,String date) {
459 ReportUtils ee = new ReportUtils(); 459 ReportUtils ee = new ReportUtils();
460 ReportRelatedUtils rru = new ReportRelatedUtils(); 460 ReportRelatedUtils rru = new ReportRelatedUtils();
461 List<Iterator<?>> list = new ArrayList<Iterator<?>>(); 461 List<Iterator<?>> list = new ArrayList<Iterator<?>>();
462 - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.exportWaybill(jName, clZbh, lpName); 462 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName,date);
463 List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>(); 463 List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
464 464
465 DecimalFormat format = new DecimalFormat("0.00"); 465 DecimalFormat format = new DecimalFormat("0.00");
@@ -712,7 +712,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -712,7 +712,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
712 } 712 }
713 else{ 713 else{
714 // 按发车时间排序 714 // 按发车时间排序
715 - Collections.sort(list, new ScheduleComparator.FCNO()); 715 + Collections.sort(list, new ScheduleComparator.FCSJ());
716 716
717 // 以第一个实际发车/待发时间为起点,调整间隔 717 // 以第一个实际发车/待发时间为起点,调整间隔
718 sch = list.get(0); 718 sch = list.get(0);
@@ -979,8 +979,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -979,8 +979,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
979 979
980 @Override 980 @Override
981 public Map<String, Object> findKMBC(String jName, String clZbh, 981 public Map<String, Object> findKMBC(String jName, String clZbh,
982 - String lpName) {  
983 - List<ScheduleRealInfo> list = scheduleRealInfoRepository.exportWaybill(jName, clZbh, lpName); 982 + String lpName,String date) {
  983 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date);
984 DecimalFormat format = new DecimalFormat("0.00"); 984 DecimalFormat format = new DecimalFormat("0.00");
985 int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); 985 int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
986 int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); 986 int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
@@ -1039,8 +1039,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1039,8 +1039,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1039 1039
1040 @Override 1040 @Override
1041 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh, 1041 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1042 - String lpName) {  
1043 - return scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName); 1042 + String lpName,String date) {
  1043 + return scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName,date);
1044 } 1044 }
1045 1045
1046 @Override 1046 @Override
src/main/java/com/bsth/service/schedule/SchedulePlanServiceImpl.java
@@ -47,8 +47,8 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl&lt;SchedulePlan, Long&gt; @@ -47,8 +47,8 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl&lt;SchedulePlan, Long&gt;
47 // 1-1、查找线路具体信息 47 // 1-1、查找线路具体信息
48 Line xl = strategy.getLine(schedulePlan.getXl().getId()); 48 Line xl = strategy.getLine(schedulePlan.getXl().getId());
49 // 1-2、查出指定线路的所有规则 49 // 1-2、查出指定线路的所有规则
50 - TTInfo ttInfo = strategy.getTTInfo(xl.getId()); // 时刻表id  
51 - schedulePlan.setTtInfo(ttInfo); // 关联的时刻表 50 + TTInfo ttInfo = strategy.getTTInfo(xl.getId()).get(0); // 时刻表id
  51 + schedulePlan.setTtInfo(ttInfo); // TODO:关联的时刻表,之后改掉
52 52
53 // 2-1、构造drools规则输入数据,输出数据 53 // 2-1、构造drools规则输入数据,输出数据
54 // 全局计算参数 54 // 全局计算参数
@@ -89,7 +89,9 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl&lt;SchedulePlan, Long&gt; @@ -89,7 +89,9 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl&lt;SchedulePlan, Long&gt;
89 89
90 // 3、根据规则返回,组合最后的输出数据 90 // 3、根据规则返回,组合最后的输出数据
91 // 3-1、根据注入的策略服务,获取原始数据 91 // 3-1、根据注入的策略服务,获取原始数据
92 - Multimap<Long, TTInfoDetail> gbdTTinfoMaps = strategy.getGuideboardXlTTInfoDetailMaps(xl.getId()); // 路牌对应时刻明细 92 + Map<Date, Multimap<Long, TTInfoDetail>> gbdTTinfoMaps = strategy.getGuideboardXlTTInfoDetailMaps(
  93 + xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime());
  94 +
93 Map<Long, CarConfigInfo> carConfigMaps = strategy.getCarConfigMaps(xl.getId()); // 车辆配置对应车辆信息 95 Map<Long, CarConfigInfo> carConfigMaps = strategy.getCarConfigMaps(xl.getId()); // 车辆配置对应车辆信息
94 Map<Long, EmployeeConfigInfo> employeeConfigMaps = strategy.getEmployeeConfigMaps(xl.getId()); // 人员配置对应的人员信息 96 Map<Long, EmployeeConfigInfo> employeeConfigMaps = strategy.getEmployeeConfigMaps(xl.getId()); // 人员配置对应的人员信息
95 97
@@ -97,18 +99,23 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl&lt;SchedulePlan, Long&gt; @@ -97,18 +99,23 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl&lt;SchedulePlan, Long&gt;
97 List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>(); 99 List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>();
98 for (ScheduleResult_output scheduleResult_output : scheduleResults_output.getResults()) { 100 for (ScheduleResult_output scheduleResult_output : scheduleResults_output.getResults()) {
99 // 车辆配置对应的车辆 101 // 车辆配置对应的车辆
100 - CarConfigInfo configInfo = carConfigMaps.get(scheduleResult_output.getCarConfigId());  
101 - // 人员配置对应的人员  
102 - EmployeeConfigInfo employeeConfigInfo = employeeConfigMaps.get(scheduleResult_output.getEmployeeConfigId()); 102 + CarConfigInfo configInfo = carConfigMaps.get(Long.valueOf(scheduleResult_output.getCarConfigId()));
  103 + // 人员配置对应的人员,这里需要分班处理的
  104 + List<EmployeeConfigInfo> employeeConfigInfoList = new ArrayList<>();
  105 + String[] eids = scheduleResult_output.getEmployeeConfigId().split("-");
  106 + for (String eid : eids) {
  107 + employeeConfigInfoList.add(employeeConfigMaps.get(Long.valueOf(eid)));
  108 + }
103 // 排班明细(这个要迭代的) 109 // 排班明细(这个要迭代的)
104 - Collection<TTInfoDetail> ttInfoDetails = gbdTTinfoMaps.get(scheduleResult_output.getGuideboardId()); 110 + Collection<TTInfoDetail> ttInfoDetails = gbdTTinfoMaps.get(scheduleResult_output.getSd().toDate()).get(
  111 + Long.parseLong(scheduleResult_output.getGuideboardId()));
105 for (TTInfoDetail ttInfoDetail : ttInfoDetails) { 112 for (TTInfoDetail ttInfoDetail : ttInfoDetails) {
106 SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo( 113 SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo(
107 xl, 114 xl,
108 scheduleResult_output, 115 scheduleResult_output,
109 ttInfoDetail, 116 ttInfoDetail,
110 configInfo, 117 configInfo,
111 - employeeConfigInfo, 118 + employeeConfigInfoList,
112 schedulePlan); 119 schedulePlan);
113 schedulePlanInfos.add(schedulePlanInfo); 120 schedulePlanInfos.add(schedulePlanInfo);
114 } 121 }
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
@@ -58,6 +58,9 @@ public class MyDroolsConfiguration { @@ -58,6 +58,9 @@ public class MyDroolsConfiguration {
58 kfs.write("src/main/resources/shiftloop.drl", kieServices.getResources() 58 kfs.write("src/main/resources/shiftloop.drl", kieServices.getResources()
59 .newInputStreamResource(this.getClass().getResourceAsStream( 59 .newInputStreamResource(this.getClass().getResourceAsStream(
60 "/rules/shiftloop.drl"), "UTF-8")); 60 "/rules/shiftloop.drl"), "UTF-8"));
  61 + kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources()
  62 + .newInputStreamResource(this.getClass().getResourceAsStream(
  63 + "/rules/ttinfo.drl"), "UTF-8"));
61 // TODO:还有其他drl.... 64 // TODO:还有其他drl....
62 65
63 // 4、创建KieBuilder,使用KieFileSystem构建 66 // 4、创建KieBuilder,使用KieFileSystem构建
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleCalcuParam_input.java
@@ -11,15 +11,12 @@ public class ScheduleCalcuParam_input { @@ -11,15 +11,12 @@ public class ScheduleCalcuParam_input {
11 private DateTime fromDate; 11 private DateTime fromDate;
12 /** 结束计算日期 */ 12 /** 结束计算日期 */
13 private DateTime toDate; 13 private DateTime toDate;
14 - /** 时刻表id */  
15 - private Long ttinfoId;  
16 14
17 public ScheduleCalcuParam_input() {} 15 public ScheduleCalcuParam_input() {}
18 16
19 public ScheduleCalcuParam_input(SchedulePlan schedulePlan) { 17 public ScheduleCalcuParam_input(SchedulePlan schedulePlan) {
20 this.fromDate = new DateTime((schedulePlan.getScheduleFromTime())); 18 this.fromDate = new DateTime((schedulePlan.getScheduleFromTime()));
21 this.toDate = new DateTime((schedulePlan.getScheduleToTime())); 19 this.toDate = new DateTime((schedulePlan.getScheduleToTime()));
22 - this.ttinfoId = schedulePlan.getTtInfo().getId();  
23 } 20 }
24 21
25 public DateTime getFromDate() { 22 public DateTime getFromDate() {
@@ -38,11 +35,4 @@ public class ScheduleCalcuParam_input { @@ -38,11 +35,4 @@ public class ScheduleCalcuParam_input {
38 this.toDate = toDate; 35 this.toDate = toDate;
39 } 36 }
40 37
41 - public Long getTtinfoId() {  
42 - return ttinfoId;  
43 - }  
44 -  
45 - public void setTtinfoId(Long ttinfoId) {  
46 - this.ttinfoId = ttinfoId;  
47 - }  
48 } 38 }
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResult_output.java
@@ -9,13 +9,13 @@ public class ScheduleResult_output { @@ -9,13 +9,13 @@ public class ScheduleResult_output {
9 /** 具体日期 */ 9 /** 具体日期 */
10 private DateTime sd; 10 private DateTime sd;
11 /** 用的是哪一组rule */ 11 /** 用的是哪一组rule */
12 - private Long ruleId; 12 + private String ruleId;
13 /** 路牌id */ 13 /** 路牌id */
14 - private Long guideboardId; 14 + private String guideboardId;
15 /** 人员配置id */ 15 /** 人员配置id */
16 - private Long employeeConfigId; 16 + private String employeeConfigId;
17 /** 车辆配置id */ 17 /** 车辆配置id */
18 - private Long carConfigId; 18 + private String carConfigId;
19 19
20 public DateTime getSd() { 20 public DateTime getSd() {
21 return sd; 21 return sd;
@@ -25,36 +25,35 @@ public class ScheduleResult_output { @@ -25,36 +25,35 @@ public class ScheduleResult_output {
25 this.sd = sd; 25 this.sd = sd;
26 } 26 }
27 27
28 - public Long getGuideboardId() { 28 + public String getRuleId() {
  29 + return ruleId;
  30 + }
  31 +
  32 + public void setRuleId(String ruleId) {
  33 + this.ruleId = ruleId;
  34 + }
  35 +
  36 + public String getGuideboardId() {
29 return guideboardId; 37 return guideboardId;
30 } 38 }
31 39
32 - public void setGuideboardId(Long guideboardId) { 40 + public void setGuideboardId(String guideboardId) {
33 this.guideboardId = guideboardId; 41 this.guideboardId = guideboardId;
34 } 42 }
35 43
36 - public Long getEmployeeConfigId() { 44 + public String getEmployeeConfigId() {
37 return employeeConfigId; 45 return employeeConfigId;
38 } 46 }
39 47
40 - public void setEmployeeConfigId(Long employeeConfigId) { 48 + public void setEmployeeConfigId(String employeeConfigId) {
41 this.employeeConfigId = employeeConfigId; 49 this.employeeConfigId = employeeConfigId;
42 } 50 }
43 51
44 - public Long getCarConfigId() { 52 + public String getCarConfigId() {
45 return carConfigId; 53 return carConfigId;
46 } 54 }
47 55
48 - public void setCarConfigId(Long carConfigId) { 56 + public void setCarConfigId(String carConfigId) {
49 this.carConfigId = carConfigId; 57 this.carConfigId = carConfigId;
50 } 58 }
51 -  
52 - public Long getRuleId() {  
53 - return ruleId;  
54 - }  
55 -  
56 - public void setRuleId(Long ruleId) {  
57 - this.ruleId = ruleId;  
58 - }  
59 -  
60 } 59 }
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResults_output.java
@@ -25,7 +25,7 @@ public class ScheduleResults_output { @@ -25,7 +25,7 @@ public class ScheduleResults_output {
25 */ 25 */
26 public String showGuideboardDesc1() { 26 public String showGuideboardDesc1() {
27 StringBuilder stringBuilder = new StringBuilder(); 27 StringBuilder stringBuilder = new StringBuilder();
28 - Map<Long, List<ScheduleResult_output>> groupRuleIdGuideBoardMap = new HashMap<>(); 28 + Map<String, List<ScheduleResult_output>> groupRuleIdGuideBoardMap = new HashMap<>();
29 for (ScheduleResult_output s : results) { 29 for (ScheduleResult_output s : results) {
30 if (groupRuleIdGuideBoardMap.get(s.getRuleId()) == null) { 30 if (groupRuleIdGuideBoardMap.get(s.getRuleId()) == null) {
31 groupRuleIdGuideBoardMap.put(s.getRuleId(), new ArrayList<ScheduleResult_output>()); 31 groupRuleIdGuideBoardMap.put(s.getRuleId(), new ArrayList<ScheduleResult_output>());
@@ -33,7 +33,7 @@ public class ScheduleResults_output { @@ -33,7 +33,7 @@ public class ScheduleResults_output {
33 groupRuleIdGuideBoardMap.get(s.getRuleId()).add(s); 33 groupRuleIdGuideBoardMap.get(s.getRuleId()).add(s);
34 } 34 }
35 35
36 - for (Long ruleId : groupRuleIdGuideBoardMap.keySet()) { 36 + for (String ruleId : groupRuleIdGuideBoardMap.keySet()) {
37 Collections.sort(groupRuleIdGuideBoardMap.get(ruleId), new Comparator<ScheduleResult_output>() { 37 Collections.sort(groupRuleIdGuideBoardMap.get(ruleId), new Comparator<ScheduleResult_output>() {
38 @Override 38 @Override
39 public int compare(ScheduleResult_output o1, ScheduleResult_output o2) { 39 public int compare(ScheduleResult_output o1, ScheduleResult_output o2) {
@@ -41,8 +41,8 @@ public class ScheduleResults_output { @@ -41,8 +41,8 @@ public class ScheduleResults_output {
41 } 41 }
42 }); 42 });
43 43
44 - List<Long> gbids = new ArrayList<>();  
45 - List<Long> ecids = new ArrayList<>(); 44 + List<String> gbids = new ArrayList<>();
  45 + List<String> ecids = new ArrayList<>();
46 for (ScheduleResult_output so : groupRuleIdGuideBoardMap.get(ruleId)) { 46 for (ScheduleResult_output so : groupRuleIdGuideBoardMap.get(ruleId)) {
47 gbids.add(so.getGuideboardId()); 47 gbids.add(so.getGuideboardId());
48 ecids.add(so.getEmployeeConfigId()); 48 ecids.add(so.getEmployeeConfigId());
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
@@ -12,51 +12,52 @@ import java.util.List; @@ -12,51 +12,52 @@ import java.util.List;
12 */ 12 */
13 public class ScheduleRule_input { 13 public class ScheduleRule_input {
14 /** 规则Id */ 14 /** 规则Id */
15 - private Long ruleId; 15 + private String ruleId;
16 /** 规则启用日期 */ 16 /** 规则启用日期 */
17 private DateTime qyrq; 17 private DateTime qyrq;
18 18
19 /** 路牌范围 */ 19 /** 路牌范围 */
20 - private List<Long> guideboardIds = new ArrayList<>(); 20 + private List<String> guideboardIds = new ArrayList<>();
21 /** 起始路牌下标 */ 21 /** 起始路牌下标 */
22 private int startGbdIndex; 22 private int startGbdIndex;
23 23
24 /** 人员范围 */ 24 /** 人员范围 */
25 - private List<Long> employeeConfigIds = new ArrayList<>(); 25 + private List<String> employeeConfigIds = new ArrayList<>();
26 /** 起始人员下标 */ 26 /** 起始人员下标 */
27 private int startEIndex; 27 private int startEIndex;
28 28
29 /** 车辆配置id */ 29 /** 车辆配置id */
30 - private Long carConfigId; 30 + private String carConfigId;
31 31
32 // TODO:车辆翻班暂时不考虑进去 32 // TODO:车辆翻班暂时不考虑进去
33 33
34 public ScheduleRule_input() {} 34 public ScheduleRule_input() {}
35 35
36 public ScheduleRule_input(ScheduleRule1Flat scheduleRule1Flat) { 36 public ScheduleRule_input(ScheduleRule1Flat scheduleRule1Flat) {
37 - this.ruleId = scheduleRule1Flat.getId(); 37 + this.ruleId = String.valueOf(scheduleRule1Flat.getId());
38 this.qyrq = new DateTime(scheduleRule1Flat.getQyrq()); 38 this.qyrq = new DateTime(scheduleRule1Flat.getQyrq());
39 List<String> lpIds = Splitter.on(",").splitToList(scheduleRule1Flat.getLpIds()); 39 List<String> lpIds = Splitter.on(",").splitToList(scheduleRule1Flat.getLpIds());
40 - for (String lpId : lpIds) {  
41 - this.guideboardIds.add(Long.parseLong(lpId));  
42 - } 40 +// for (String lpId : lpIds) {
  41 +// this.guideboardIds.add(Long.parseLong(lpId));
  42 +// }
  43 + guideboardIds.addAll(lpIds);
43 // 路牌初始下标减1 44 // 路牌初始下标减1
44 this.startGbdIndex = scheduleRule1Flat.getLpStart() - 1; 45 this.startGbdIndex = scheduleRule1Flat.getLpStart() - 1;
45 List<String> ryCids = Splitter.on(",").splitToList(scheduleRule1Flat.getRyConfigIds()); 46 List<String> ryCids = Splitter.on(",").splitToList(scheduleRule1Flat.getRyConfigIds());
46 - for (String ryCid : ryCids) {  
47 - this.employeeConfigIds.add(Long.parseLong(ryCid));  
48 - } 47 +// for (String ryCid : ryCids) {
  48 +// this.employeeConfigIds.add(Long.parseLong(ryCid));
  49 +// }
  50 + employeeConfigIds.addAll(ryCids);
49 // 人员初始索引减1 51 // 人员初始索引减1
50 this.startEIndex = scheduleRule1Flat.getRyStart() - 1; 52 this.startEIndex = scheduleRule1Flat.getRyStart() - 1;
51 - this.carConfigId = scheduleRule1Flat.getCarConfigInfo().getId(); 53 + this.carConfigId = String.valueOf(scheduleRule1Flat.getCarConfigInfo().getId());
52 } 54 }
53 55
54 -  
55 - public Long getRuleId() { 56 + public String getRuleId() {
56 return ruleId; 57 return ruleId;
57 } 58 }
58 59
59 - public void setRuleId(Long ruleId) { 60 + public void setRuleId(String ruleId) {
60 this.ruleId = ruleId; 61 this.ruleId = ruleId;
61 } 62 }
62 63
@@ -68,11 +69,11 @@ public class ScheduleRule_input { @@ -68,11 +69,11 @@ public class ScheduleRule_input {
68 this.qyrq = qyrq; 69 this.qyrq = qyrq;
69 } 70 }
70 71
71 - public List<Long> getGuideboardIds() { 72 + public List<String> getGuideboardIds() {
72 return guideboardIds; 73 return guideboardIds;
73 } 74 }
74 75
75 - public void setGuideboardIds(List<Long> guideboardIds) { 76 + public void setGuideboardIds(List<String> guideboardIds) {
76 this.guideboardIds = guideboardIds; 77 this.guideboardIds = guideboardIds;
77 } 78 }
78 79
@@ -84,11 +85,11 @@ public class ScheduleRule_input { @@ -84,11 +85,11 @@ public class ScheduleRule_input {
84 this.startGbdIndex = startGbdIndex; 85 this.startGbdIndex = startGbdIndex;
85 } 86 }
86 87
87 - public List<Long> getEmployeeConfigIds() { 88 + public List<String> getEmployeeConfigIds() {
88 return employeeConfigIds; 89 return employeeConfigIds;
89 } 90 }
90 91
91 - public void setEmployeeConfigIds(List<Long> employeeConfigIds) { 92 + public void setEmployeeConfigIds(List<String> employeeConfigIds) {
92 this.employeeConfigIds = employeeConfigIds; 93 this.employeeConfigIds = employeeConfigIds;
93 } 94 }
94 95
@@ -100,11 +101,11 @@ public class ScheduleRule_input { @@ -100,11 +101,11 @@ public class ScheduleRule_input {
100 this.startEIndex = startEIndex; 101 this.startEIndex = startEIndex;
101 } 102 }
102 103
103 - public Long getCarConfigId() { 104 + public String getCarConfigId() {
104 return carConfigId; 105 return carConfigId;
105 } 106 }
106 107
107 - public void setCarConfigId(Long carConfigId) { 108 + public void setCarConfigId(String carConfigId) {
108 this.carConfigId = carConfigId; 109 this.carConfigId = carConfigId;
109 } 110 }
110 } 111 }
src/main/java/com/bsth/service/schedule/rules/strategy/IStrategy.java
@@ -8,6 +8,8 @@ import com.bsth.entity.schedule.TTInfoDetail; @@ -8,6 +8,8 @@ import com.bsth.entity.schedule.TTInfoDetail;
8 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 8 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
9 import com.google.common.collect.Multimap; 9 import com.google.common.collect.Multimap;
10 10
  11 +import java.util.Date;
  12 +import java.util.List;
11 import java.util.Map; 13 import java.util.Map;
12 14
13 /** 15 /**
@@ -27,7 +29,14 @@ public interface IStrategy { @@ -27,7 +29,14 @@ public interface IStrategy {
27 * @param xlId 线路id 29 * @param xlId 线路id
28 * @return 时刻表 30 * @return 时刻表
29 */ 31 */
30 - TTInfo getTTInfo(Integer xlId); 32 + List<TTInfo> getTTInfo(Integer xlId);
  33 +
  34 + /**
  35 + * 获取指定线路的时刻表的明细。
  36 + * @param xlId 线路id
  37 + * @return
  38 + */
  39 + List<TTInfoDetail> getTTInfoDetail(Integer xlId);
31 40
32 /** 41 /**
33 * 获取指定线路下,可用的排班规则。 42 * 获取指定线路下,可用的排班规则。
@@ -37,11 +46,13 @@ public interface IStrategy { @@ -37,11 +46,13 @@ public interface IStrategy {
37 Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId); 46 Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId);
38 47
39 /** 48 /**
40 - * 获取指定线路下,路牌与时刻明细对应的Map。 49 + * 获取指定线路下,日期与路牌与时刻明细对应的Map。
41 * @param xlId 线路id 50 * @param xlId 线路id
  51 + * @param fromDate 开始日期
  52 + * @param toDate 结束日期
42 * @return 路牌id为key,时刻明细 Collection<TTInfoDetail> 为value 53 * @return 路牌id为key,时刻明细 Collection<TTInfoDetail> 为value
43 */ 54 */
44 - Multimap<Long, TTInfoDetail> getGuideboardXlTTInfoDetailMaps(Integer xlId); 55 + Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(Integer xlId, Date fromDate, Date toDate);
45 56
46 /** 57 /**
47 * 获取指定线路下,车辆配置与车辆信息对应的Map。 58 * 获取指定线路下,车辆配置与车辆信息对应的Map。
src/main/java/com/bsth/service/schedule/rules/strategy/IStrategyImpl.java
@@ -8,14 +8,21 @@ import com.bsth.entity.schedule.TTInfoDetail; @@ -8,14 +8,21 @@ import com.bsth.entity.schedule.TTInfoDetail;
8 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 8 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
9 import com.bsth.service.LineService; 9 import com.bsth.service.LineService;
10 import com.bsth.service.schedule.*; 10 import com.bsth.service.schedule.*;
  11 +import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input;
  12 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output;
  13 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
  14 +import com.bsth.service.schedule.rules.ttinfo.TTInfo_input;
11 import com.google.common.collect.ArrayListMultimap; 15 import com.google.common.collect.ArrayListMultimap;
12 import com.google.common.collect.Multimap; 16 import com.google.common.collect.Multimap;
  17 +import org.joda.time.DateTime;
  18 +import org.kie.api.KieBase;
  19 +import org.kie.api.runtime.KieSession;
  20 +import org.slf4j.Logger;
  21 +import org.slf4j.LoggerFactory;
13 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
15 24
16 -import java.util.HashMap;  
17 -import java.util.Iterator;  
18 -import java.util.Map; 25 +import java.util.*;
19 26
20 /** 27 /**
21 * Created by xu on 16/7/10. 28 * Created by xu on 16/7/10.
@@ -35,6 +42,12 @@ public class IStrategyImpl implements IStrategy { @@ -35,6 +42,12 @@ public class IStrategyImpl implements IStrategy {
35 @Autowired 42 @Autowired
36 private ScheduleRule1FlatService scheduleRule1FlatService; 43 private ScheduleRule1FlatService scheduleRule1FlatService;
37 44
  45 + /** 日志记录器 */
  46 + private Logger logger = LoggerFactory.getLogger(IStrategyImpl.class);
  47 +
  48 + @Autowired
  49 + private KieBase kieBase;
  50 +
38 @Override 51 @Override
39 public Line getLine(Integer xlId) { 52 public Line getLine(Integer xlId) {
40 Line xl = lineService.findById(xlId); // 查找线路具体信息 53 Line xl = lineService.findById(xlId); // 查找线路具体信息
@@ -42,18 +55,39 @@ public class IStrategyImpl implements IStrategy { @@ -42,18 +55,39 @@ public class IStrategyImpl implements IStrategy {
42 } 55 }
43 56
44 @Override 57 @Override
45 - public TTInfo getTTInfo(Integer xlId) {  
46 - // TODO:本来要使用规则判定到底使用哪张时刻表,这里选用第一张  
47 - Map<String, Object> param = new HashMap<>(); // 查询参数  
48 - param.clear();  
49 - param.put("xl.id_eq", xlId); // 线路id  
50 - param.put("isCancel_eq", false); // 没有作废  
51 - param.put("isEnableDisTemplate_eq", true); // 是否启用  
52 - Iterable<TTInfo> ttInfoIterable = ttInfoService.list(param);  
53 - Iterator<TTInfo> ttInfoIterator = ttInfoIterable.iterator();  
54 - if (!ttInfoIterator.hasNext())  
55 - throw new RuntimeException("线路id=" + xlId + ",下没有任何时刻表数据!");  
56 - return ttInfoIterator.next(); 58 + public List<TTInfo> getTTInfo(Integer xlId) {
  59 + // 查询参数
  60 + Map<String, Object> param = new HashMap<>();
  61 + param.put("xl.id_eq", xlId); // 线路Id
  62 + param.put("isCancel_eq", false); // 作废的过滤掉
  63 + Iterator<TTInfo> ttInfoIterator = ttInfoService.list(param).iterator();
  64 + if (!ttInfoIterator.hasNext()) {
  65 + throw new RuntimeException("线路id=" + xlId + " 没有时刻表!");
  66 + }
  67 + List<TTInfo> ttInfos = new ArrayList<>();
  68 + while (ttInfoIterator.hasNext()) {
  69 + TTInfo ttInfo = ttInfoIterator.next();
  70 + ttInfos.add(ttInfo);
  71 + }
  72 + return ttInfos;
  73 + }
  74 +
  75 + @Override
  76 + public List<TTInfoDetail> getTTInfoDetail(Integer xlId) {
  77 + List<TTInfoDetail> ttInfoDetails = new ArrayList<>();
  78 +
  79 + List<TTInfo> ttInfos = getTTInfo(xlId);
  80 + Map<String, Object> param = new HashMap<>();
  81 + for (TTInfo ttInfo : ttInfos) {
  82 + param.clear();
  83 + param.put("ttinfo.id_eq", ttInfo.getId());
  84 + Iterator<TTInfoDetail> ttInfoDetailIterator = ttInfoDetailService.list(param).iterator();
  85 + while (ttInfoDetailIterator.hasNext()) {
  86 + ttInfoDetails.add(ttInfoDetailIterator.next());
  87 + }
  88 + }
  89 +
  90 + return ttInfoDetails;
57 } 91 }
58 92
59 @Override 93 @Override
@@ -70,23 +104,59 @@ public class IStrategyImpl implements IStrategy { @@ -70,23 +104,59 @@ public class IStrategyImpl implements IStrategy {
70 } 104 }
71 105
72 @Override 106 @Override
73 - public Multimap<Long, TTInfoDetail> getGuideboardXlTTInfoDetailMaps(Integer xlId) {  
74 - TTInfo ttInfo = getTTInfo(xlId);  
75 - // 查询参数 107 + public Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(
  108 + Integer xlId, Date fromDate, Date toDate) {
  109 + // 获取线路的所有时刻表
  110 + List<TTInfo> ttInfos = getTTInfo(xlId);
  111 +
  112 + // 执行规则,判定每天使用的时刻表
  113 + KieSession session = kieBase.newKieSession();
  114 +
  115 + session.setGlobal("log", logger);
  116 + TTInfoResults_output ttInfoResults_output = new TTInfoResults_output();
  117 + session.setGlobal("results", ttInfoResults_output);
  118 +
  119 + TTInfoCalcuParam_input ttInfoCalcuParam_input = new TTInfoCalcuParam_input(
  120 + new DateTime(fromDate), new DateTime(toDate), String.valueOf(xlId));
  121 + session.insert(ttInfoCalcuParam_input);
  122 + for (TTInfo ttInfo : ttInfos) {
  123 + TTInfo_input ttInfo_input = new TTInfo_input(ttInfo);
  124 + session.insert(ttInfo_input);
  125 + }
  126 +
  127 + session.fireAllRules();
  128 + session.dispose();
  129 +
  130 + // 获取ttinfoDetail
  131 + List<TTInfoDetail> ttInfoDetails = getTTInfoDetail(xlId);
  132 +
  133 + // 规则输出结果
  134 + Multimap<DateTime, TTInfoResult_output> outputMultimap =
  135 + ttInfoResults_output.getResults().get(String.valueOf(xlId));
  136 + // return结果输出
  137 + Map<Date, Multimap<Long, TTInfoDetail>> ttInfoDetailMultimap = new HashMap<>();
  138 +
76 Map<String, Object> param = new HashMap<>(); 139 Map<String, Object> param = new HashMap<>();
77 - param.put("ttinfo.id_eq", ttInfo.getId());  
78 - Iterable<TTInfoDetail> ttInfoDetailIterable = ttInfoDetailService.list(param);  
79 - Iterator<TTInfoDetail> ttInfoDetailIterator = ttInfoDetailIterable.iterator();  
80 - if (!ttInfoDetailIterator.hasNext())  
81 - throw new RuntimeException("时刻表id=" + ttInfo.getId() + ",下没有明细数据!");  
82 -  
83 - Multimap<Long, TTInfoDetail> gtmaps = ArrayListMultimap.create();  
84 - while (ttInfoDetailIterator.hasNext()) {  
85 - TTInfoDetail ttInfoDetail = ttInfoDetailIterator.next();  
86 - gtmaps.put(ttInfoDetail.getLp().getId(), ttInfoDetail); 140 + for (DateTime dateTime : outputMultimap.keySet()) {
  141 + Collection<TTInfoResult_output> ttInfoResult_outputs = outputMultimap.get(dateTime);
  142 + // 如果有多个,使用第一个
  143 + Iterator<TTInfoResult_output> ttInfoResult_outputIterator = ttInfoResult_outputs.iterator();
  144 + if (ttInfoResult_outputIterator.hasNext()) {
  145 + // 同一天,多张时刻表只取第一张
  146 + TTInfoResult_output ttInfoResult_output = ttInfoResult_outputIterator.next();
  147 + // 查找时刻表明细
  148 + Multimap<Long, TTInfoDetail> ttinfodetailMap2 = ArrayListMultimap.create();
  149 + for (TTInfoDetail ttInfoDetail : ttInfoDetails) {
  150 + if (ttInfoDetail.getTtinfo().getId() == Long.valueOf(ttInfoResult_output.getTtInfoId())) {
  151 + ttinfodetailMap2.put(ttInfoDetail.getLp().getId(), ttInfoDetail);
  152 + }
  153 + }
  154 +
  155 + ttInfoDetailMultimap.put(dateTime.toDate(), ttinfodetailMap2);
  156 + }
87 } 157 }
88 158
89 - return gtmaps; 159 + return ttInfoDetailMultimap;
90 } 160 }
91 161
92 @Override 162 @Override
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoCalcuParam_input.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 时刻表计算参数_输入。
  7 + */
  8 +public class TTInfoCalcuParam_input {
  9 + /** 开始计算日期 */
  10 + private DateTime fromDate;
  11 + /** 结束计算日期 */
  12 + private DateTime toDate;
  13 + /** 线路Id */
  14 + private String xlId;
  15 +
  16 + public TTInfoCalcuParam_input() {}
  17 +
  18 + public TTInfoCalcuParam_input(DateTime fromDate, DateTime toDate, String xlId) {
  19 + this.fromDate = fromDate;
  20 + this.toDate = toDate;
  21 + this.xlId = xlId;
  22 + }
  23 +
  24 + public DateTime getFromDate() {
  25 + return fromDate;
  26 + }
  27 +
  28 + public void setFromDate(DateTime fromDate) {
  29 + this.fromDate = fromDate;
  30 + }
  31 +
  32 + public DateTime getToDate() {
  33 + return toDate;
  34 + }
  35 +
  36 + public void setToDate(DateTime toDate) {
  37 + this.toDate = toDate;
  38 + }
  39 +
  40 + public String getXlId() {
  41 + return xlId;
  42 + }
  43 +
  44 + public void setXlId(String xlId) {
  45 + this.xlId = xlId;
  46 + }
  47 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoResult_output.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 时刻表选择规则出的结果_输出。
  7 + */
  8 +public class TTInfoResult_output {
  9 + /** 具体日期 */
  10 + private DateTime dateTime;
  11 + /** 时刻表Id */
  12 + private String ttInfoId;
  13 + /** 线路Id */
  14 + private String xlId;
  15 +
  16 + public DateTime getDateTime() {
  17 + return dateTime;
  18 + }
  19 +
  20 + public void setDateTime(DateTime dateTime) {
  21 + this.dateTime = dateTime;
  22 + }
  23 +
  24 + public String getTtInfoId() {
  25 + return ttInfoId;
  26 + }
  27 +
  28 + public void setTtInfoId(String ttInfoId) {
  29 + this.ttInfoId = ttInfoId;
  30 + }
  31 +
  32 + public String getXlId() {
  33 + return xlId;
  34 + }
  35 +
  36 + public void setXlId(String xlId) {
  37 + this.xlId = xlId;
  38 + }
  39 +
  40 + @Override
  41 + public String toString() {
  42 + return String.format(
  43 + "<日期=%s 线路id=%s 时刻表id=%s>\n",
  44 + dateTime.toString("yyyy-MM-dd"),
  45 + xlId,
  46 + ttInfoId);
  47 + }
  48 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoResults_output.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import com.google.common.collect.ArrayListMultimap;
  4 +import com.google.common.collect.Multimap;
  5 +import org.joda.time.DateTime;
  6 +
  7 +import java.util.HashMap;
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +/**
  12 + * 输出结果集合。
  13 + */
  14 +public class TTInfoResults_output {
  15 +
  16 + /** 输出列表,key为线路id,value是key为日期,value为排序的时刻表output列表 */
  17 + private Map<String, Multimap<DateTime, TTInfoResult_output>> results = new HashMap<>();
  18 +
  19 + public Map<String, Multimap<DateTime, TTInfoResult_output>> getResults() {
  20 + return results;
  21 + }
  22 +
  23 + public void setResults(Map<String, Multimap<DateTime, TTInfoResult_output>> results) {
  24 + this.results = results;
  25 + }
  26 +
  27 + public void addXlTTInfos(String xlid, DateTime dt, List<TTInfo_input> ttInfo_inputList) {
  28 + Multimap<DateTime, TTInfoResult_output> map;
  29 + if (results.get(xlid) == null) {
  30 + map = ArrayListMultimap.create();
  31 + results.put(xlid, map);
  32 + } else {
  33 + map = results.get(xlid);
  34 + }
  35 +
  36 + for (TTInfo_input ttInfo_input : ttInfo_inputList) {
  37 + TTInfoResult_output ttInfoResult_output = new TTInfoResult_output();
  38 + ttInfoResult_output.setDateTime(dt);
  39 + ttInfoResult_output.setTtInfoId(ttInfo_input.getTtInfoId());
  40 + ttInfoResult_output.setXlId(xlid);
  41 + map.put(dt, ttInfoResult_output);
  42 + }
  43 + }
  44 +
  45 + /**
  46 + * 输出计算后的时刻表
  47 + * @return
  48 + */
  49 + public String showTTInfoDesc1() {
  50 + StringBuilder str = new StringBuilder();
  51 + for (String key : results.keySet()) {
  52 + str.append("线路id=" + key);
  53 + str.append("\n");
  54 + str.append("时刻表=" + results.get(key));
  55 + str.append("\n");
  56 + }
  57 +
  58 + return str.toString();
  59 + }
  60 +
  61 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfo_input.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import com.bsth.entity.schedule.TTInfo;
  4 +import org.joda.time.DateTime;
  5 +import org.joda.time.format.DateTimeFormat;
  6 +
  7 +import java.util.ArrayList;
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 时刻表_输入
  12 + */
  13 +public class TTInfo_input implements Comparable<TTInfo_input> {
  14 + /** 时刻表id */
  15 + private String ttInfoId;
  16 + /** 线路Id */
  17 + private String xlId;
  18 + /** 周一到周日是否启用 */
  19 + private List<Boolean> weekdays = new ArrayList<>();
  20 + /** 特殊节假日 */
  21 + private List<DateTime> specialDays = new ArrayList<>();
  22 + /** 最新修改时间 */
  23 + private DateTime updateDate;
  24 + /** 是否启用 */
  25 + private Boolean isEnable;
  26 + /** 启用日期 */
  27 + private DateTime qyDate;
  28 +
  29 + public TTInfo_input() {
  30 +
  31 + }
  32 +
  33 + @Override
  34 + public int compareTo(TTInfo_input ttInfo_input) {
  35 + if (ttInfo_input != null) {
  36 + if (ttInfo_input.updateDate != null && this.updateDate != null)
  37 + return - this.updateDate.compareTo(ttInfo_input.updateDate);
  38 + }
  39 + return -1;
  40 + }
  41 +
  42 + public TTInfo_input(TTInfo ttInfo) {
  43 + this.ttInfoId = String.valueOf(ttInfo.getId());
  44 + this.xlId = String.valueOf(ttInfo.getXl().getId());
  45 + String[] days = ttInfo.getRule_days().split(",");
  46 + System.out.println(days.length);
  47 + for (int i = 0; i < 7; i++) {
  48 + if ("1".equals(days[i])) {
  49 + weekdays.add(true);
  50 + } else {
  51 + weekdays.add(false);
  52 + }
  53 + }
  54 + String[] sdays = ttInfo.getSpecial_days().split(",");
  55 + for (int i = 0; i < sdays.length; i++) {
  56 + specialDays.add(DateTimeFormat.forPattern("yyyy-MM-dd").
  57 + parseDateTime(sdays[i]));
  58 + }
  59 + this.updateDate = new DateTime(ttInfo.getUpdateDate());
  60 + this.isEnable = ttInfo.getIsEnableDisTemplate();
  61 + this.qyDate = new DateTime(ttInfo.getQyrq());
  62 +
  63 + }
  64 +
  65 + public String getTtInfoId() {
  66 + return ttInfoId;
  67 + }
  68 +
  69 + public void setTtInfoId(String ttInfoId) {
  70 + this.ttInfoId = ttInfoId;
  71 + }
  72 +
  73 + public String getXlId() {
  74 + return xlId;
  75 + }
  76 +
  77 + public void setXlId(String xlId) {
  78 + this.xlId = xlId;
  79 + }
  80 +
  81 + public List<Boolean> getWeekdays() {
  82 + return weekdays;
  83 + }
  84 +
  85 + public void setWeekdays(List<Boolean> weekdays) {
  86 + this.weekdays = weekdays;
  87 + }
  88 +
  89 + public List<DateTime> getSpecialDays() {
  90 + return specialDays;
  91 + }
  92 +
  93 + public void setSpecialDays(List<DateTime> specialDays) {
  94 + this.specialDays = specialDays;
  95 + }
  96 +
  97 + public DateTime getUpdateDate() {
  98 + return updateDate;
  99 + }
  100 +
  101 + public void setUpdateDate(DateTime updateDate) {
  102 + this.updateDate = updateDate;
  103 + }
  104 +
  105 + public Boolean getIsEnable() {
  106 + return isEnable;
  107 + }
  108 +
  109 + public void setIsEnable(Boolean isEnable) {
  110 + this.isEnable = isEnable;
  111 + }
  112 +
  113 + public DateTime getQyDate() {
  114 + return qyDate;
  115 + }
  116 +
  117 + public void setQyDate(DateTime qyDate) {
  118 + this.qyDate = qyDate;
  119 + }
  120 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/readme.txt 0 → 100644
  1 +时刻表选择规则,每天的时刻表都不一样
0 \ No newline at end of file 2 \ No newline at end of file
src/main/java/com/bsth/service/sys/UserLineService.java 0 → 100644
  1 +package com.bsth.service.sys;
  2 +import java.util.List;
  3 +import java.util.Map;
  4 +
  5 +import com.bsth.entity.sys.UserLine;
  6 +import com.bsth.service.BaseService;
  7 +
  8 +
  9 +
  10 +/**
  11 + *
  12 + * @Interface: LineService(线路service业务层实现接口)
  13 + *
  14 + * @extends : BaseService
  15 + *
  16 + * @Description: TODO(线路service业务层实现接口)
  17 + *
  18 + * @Author bsth@lq
  19 + *
  20 + * @Date 2016年4月28日 上午9:21:17
  21 + *
  22 + * @Version 公交调度系统BS版 0.1
  23 + *
  24 + */
  25 +public interface UserLineService extends BaseService<UserLine, Integer> {
  26 +
  27 + List<Map<String, Object>> userRoleTree(Map<String, Object> map);
  28 +
  29 + Map<String, Object> setLineCasts(Integer userId, String mIds);
  30 +
  31 +}
src/main/java/com/bsth/service/sys/impl/ModuleServiceImpl.java
1 package com.bsth.service.sys.impl; 1 package com.bsth.service.sys.impl;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
  4 +import java.util.Collections;
  5 +import java.util.Comparator;
4 import java.util.HashMap; 6 import java.util.HashMap;
5 import java.util.HashSet; 7 import java.util.HashSet;
6 import java.util.List; 8 import java.util.List;
@@ -8,6 +10,8 @@ import java.util.Map; @@ -8,6 +10,8 @@ import java.util.Map;
8 import java.util.Set; 10 import java.util.Set;
9 11
10 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.data.domain.Sort;
  14 +import org.springframework.data.domain.Sort.Direction;
11 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
12 16
13 import com.bsth.common.ResponseCode; 17 import com.bsth.common.ResponseCode;
@@ -60,7 +64,7 @@ public class ModuleServiceImpl extends BaseServiceImpl&lt;Module, Integer&gt; implemen @@ -60,7 +64,7 @@ public class ModuleServiceImpl extends BaseServiceImpl&lt;Module, Integer&gt; implemen
60 SysUser user = SecurityUtils.getCurrentUser(); 64 SysUser user = SecurityUtils.getCurrentUser();
61 Set<Role> roles = user.getRoles(); 65 Set<Role> roles = user.getRoles();
62 66
63 - List<Module> all = (List<Module>) moduleRepository.findAll() 67 + List<Module> all = (List<Module>) moduleRepository.findAll(new Sort(Direction.ASC, "id"))
64 ,results = new ArrayList<>(); 68 ,results = new ArrayList<>();
65 69
66 Map<Integer, Module> map = new HashMap<>(); 70 Map<Integer, Module> map = new HashMap<>();
src/main/java/com/bsth/service/sys/impl/UserLineServiceImpl.java 0 → 100644
  1 +package com.bsth.service.sys.impl;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.HashMap;
  5 +import java.util.HashSet;
  6 +import java.util.Iterator;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +import java.util.Set;
  10 +
  11 +import org.apache.catalina.User;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Service;
  16 +import org.springframework.transaction.annotation.Transactional;
  17 +
  18 +import com.bsth.common.ResponseCode;
  19 +import com.bsth.entity.Line;
  20 +import com.bsth.entity.search.CustomerSpecs;
  21 +import com.bsth.entity.sys.Role;
  22 +import com.bsth.entity.sys.SysUser;
  23 +import com.bsth.entity.sys.UserLine;
  24 +import com.bsth.repository.LineRepository;
  25 +import com.bsth.repository.sys.RoleRepository;
  26 +import com.bsth.repository.sys.SysUserRepository;
  27 +import com.bsth.repository.sys.UserLineRepository;
  28 +import com.bsth.service.impl.BaseServiceImpl;
  29 +import com.bsth.service.sys.UserLineService;
  30 +
  31 +
  32 +/**
  33 + * Created by xu on 16/5/31.
  34 + */
  35 +@Service
  36 +public class UserLineServiceImpl extends BaseServiceImpl<UserLine, Integer> implements UserLineService {
  37 +
  38 + @Autowired
  39 + private UserLineRepository repository;
  40 +
  41 + @Autowired
  42 + private SysUserRepository userRepository;
  43 +
  44 + @Autowired
  45 + private RoleRepository roleRepository;
  46 +
  47 + @Autowired
  48 + private LineRepository lineRepository;
  49 +
  50 + Logger logger = LoggerFactory.getLogger(this.getClass());
  51 +
  52 + @Override
  53 + public List<Map<String, Object>> userRoleTree(Map<String, Object> map) {
  54 +
  55 + CustomerSpecs spec = new CustomerSpecs<Role>(map);
  56 +
  57 + List<Role> roleLine = roleRepository.findAll(spec);
  58 +
  59 + int size = roleLine.size();
  60 +
  61 + List<Map<String, Object>> list = new ArrayList<>();
  62 +
  63 + if(size>0){
  64 +
  65 + for(int i = 0; i <size;i++) {
  66 +
  67 + Map<String, Object> tempM = new HashMap<String, Object>();
  68 + int roleId = roleLine.get(i).getId();
  69 + String roleName = roleLine.get(i).getRoleName();
  70 + tempM.put("name", roleName);
  71 + tempM.put("text", roleName);
  72 + tempM.put("icon", "fa fa-database");
  73 + tempM.put("pId",null);
  74 + tempM.put("id", 100+roleId);
  75 + tempM.put("groupType", "1");
  76 + tempM.put("enable", true);
  77 + Set<SysUser> user = roleLine.get(i).getUsers();
  78 + Iterator<SysUser> it = user.iterator();
  79 + List<Map<String, Object>> roleChildren = new ArrayList<>();
  80 + while(it.hasNext()) {
  81 + Map<String, Object> userMap = new HashMap<String, Object>();
  82 + SysUser tempU = it.next();
  83 + String userName = tempU.getUserName();
  84 + int userId = tempU.getId();
  85 + userMap.put("name", userName);
  86 + userMap.put("text", userName);
  87 + userMap.put("icon", "fa fa-user");
  88 + userMap.put("pId",100+roleId);
  89 + userMap.put("id", 1000+userId);
  90 + userMap.put("userId", userId);
  91 + userMap.put("groupType", "2");
  92 + userMap.put("enable", true);
  93 + roleChildren.add(userMap);
  94 +
  95 + }
  96 + tempM.put("children", roleChildren);
  97 + list.add(tempM);
  98 + }
  99 +
  100 + }
  101 +
  102 + return list;
  103 + }
  104 +
  105 + @Override
  106 + @Transactional
  107 + public Map<String, Object> setLineCasts(Integer userId, String mIds) {
  108 + Map<String, Object> map = new HashMap<>();
  109 +
  110 + try {
  111 +
  112 + repository.del(userId);
  113 +
  114 + SysUser user = userRepository.findOne(userId);
  115 +
  116 + List<Integer> idList = new ArrayList<>();
  117 + String[] array = mIds.split(",");
  118 + for (String id : array) {
  119 + if (null == id || id.trim().equals(""))
  120 + continue;
  121 + idList.add(Integer.parseInt(id));
  122 + }
  123 +
  124 + int size = idList.size();
  125 +
  126 + if(size>0) {
  127 +
  128 + for(int i = 0 ; i<size;i++) {
  129 +
  130 + UserLine entity = new UserLine();
  131 +
  132 + int lineId = idList.get(i);
  133 +
  134 + Line line = lineRepository.findOne(lineId);
  135 +
  136 + entity.setUser(user);
  137 +
  138 + entity.setLine(line);
  139 +
  140 + repository.save(entity);
  141 + }
  142 +
  143 + }
  144 +
  145 + map.put("status", ResponseCode.SUCCESS);
  146 +
  147 + } catch (Exception e) {
  148 +
  149 + logger.error("", e);
  150 + map.put("status", ResponseCode.ERROR);
  151 + }
  152 +
  153 + return map;
  154 + }
  155 +}
src/main/java/com/bsth/websocket/handler/SendUtils.java
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Component; @@ -14,6 +14,7 @@ import org.springframework.stereotype.Component;
14 14
15 import com.alibaba.fastjson.JSONObject; 15 import com.alibaba.fastjson.JSONObject;
16 import com.bsth.data.BasicData; 16 import com.bsth.data.BasicData;
  17 +import com.bsth.data.LineConfigData;
17 import com.bsth.data.schedule.DayOfSchedule; 18 import com.bsth.data.schedule.DayOfSchedule;
18 import com.bsth.entity.directive.D80; 19 import com.bsth.entity.directive.D80;
19 import com.bsth.entity.realcontrol.ScheduleRealInfo; 20 import com.bsth.entity.realcontrol.ScheduleRealInfo;
@@ -24,6 +25,9 @@ public class SendUtils{ @@ -24,6 +25,9 @@ public class SendUtils{
24 25
25 @Autowired 26 @Autowired
26 private RealControlSocketHandler socketHandler; 27 private RealControlSocketHandler socketHandler;
  28 +
  29 + @Autowired
  30 + LineConfigData lineConfigData;
27 31
28 private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); 32 private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
29 33
@@ -33,17 +37,19 @@ public class SendUtils{ @@ -33,17 +37,19 @@ public class SendUtils{
33 * @throws JsonProcessingException 37 * @throws JsonProcessingException
34 * TODO(推送发车信息) 38 * TODO(推送发车信息)
35 */ 39 */
36 - public void sendFcsj(ScheduleRealInfo schedule) {  
37 - 40 + public void sendFcsj(ScheduleRealInfo sch) {
  41 + //处理出站即出场的班次
  42 + connectOutSchTime(sch);
  43 +
38 Map<String, Object> map = new HashMap<>(); 44 Map<String, Object> map = new HashMap<>();
39 map.put("fn", "faChe"); 45 map.put("fn", "faChe");
40 - map.put("t", schedule); 46 + map.put("t", sch);
41 map.put("dataStr", sdf.format(new Date())); 47 map.put("dataStr", sdf.format(new Date()));
42 48
43 ObjectMapper mapper = new ObjectMapper(); 49 ObjectMapper mapper = new ObjectMapper();
44 50
45 try { 51 try {
46 - socketHandler.sendMessageToLine(schedule.getXlBm(), mapper.writeValueAsString(map)); 52 + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
47 } catch (Exception e) { 53 } catch (Exception e) {
48 logger.error("", e); 54 logger.error("", e);
49 } 55 }
@@ -77,11 +83,13 @@ public class SendUtils{ @@ -77,11 +83,13 @@ public class SendUtils{
77 * @throws NumberFormatException @Title: sendFcsj @Description: 83 * @throws NumberFormatException @Title: sendFcsj @Description:
78 * TODO(推送到达终点时间) @param @param schedule 班次 @throws 84 * TODO(推送到达终点时间) @param @param schedule 班次 @throws
79 */ 85 */
80 - public void sendZdsj(ScheduleRealInfo schedule, ScheduleRealInfo nextSch, int finish) { 86 + public void sendZdsj(ScheduleRealInfo sch, ScheduleRealInfo nextSch, int finish) {
  87 + //处理进站即进场的班次
  88 + connectInSchTime(sch);
81 89
82 Map<String, Object> map = new HashMap<>(); 90 Map<String, Object> map = new HashMap<>();
83 map.put("fn", "zhongDian"); 91 map.put("fn", "zhongDian");
84 - map.put("t", schedule); 92 + map.put("t", sch);
85 map.put("nt", nextSch); 93 map.put("nt", nextSch);
86 map.put("finish", finish); 94 map.put("finish", finish);
87 map.put("dataStr", sdf.format(new Date())); 95 map.put("dataStr", sdf.format(new Date()));
@@ -89,7 +97,7 @@ public class SendUtils{ @@ -89,7 +97,7 @@ public class SendUtils{
89 ObjectMapper mapper = new ObjectMapper(); 97 ObjectMapper mapper = new ObjectMapper();
90 98
91 try { 99 try {
92 - socketHandler.sendMessageToLine(schedule.getXlBm(), mapper.writeValueAsString(map)); 100 + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
93 } catch (Exception e) { 101 } catch (Exception e) {
94 logger.error("", e); 102 logger.error("", e);
95 } 103 }
@@ -141,5 +149,38 @@ public class SendUtils{ @@ -141,5 +149,38 @@ public class SendUtils{
141 refreshSch(list); 149 refreshSch(list);
142 } 150 }
143 151
144 - //public void sendReportOutTime(ScheduleRealInfo sch) 152 +
  153 + //出站即出场
  154 + public void connectOutSchTime(ScheduleRealInfo sch){
  155 + try{
  156 + ScheduleRealInfo twins = sch.getTwinsSch();
  157 + if(twins != null
  158 + && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2
  159 + && twins.getBcType().equals("out")){
  160 +
  161 + twins.setFcsjActualAll(sch.getFcsjActualTime());
  162 + //刷新关联的出场班次
  163 + refreshSch(twins);
  164 + }
  165 + }catch(Exception e){
  166 + logger.error("", e);
  167 + }
  168 + }
  169 +
  170 + //进站即出场
  171 + public void connectInSchTime(ScheduleRealInfo sch){
  172 + try{
  173 + ScheduleRealInfo twins = sch.getTwinsSch();
  174 + if(twins != null
  175 + && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2
  176 + && twins.getBcType().equals("in")){
  177 +
  178 + twins.setZdsjActualAll(sch.getZdsjActualTime());
  179 + //刷新关联的出场班次
  180 + refreshSch(twins);
  181 + }
  182 + }catch(Exception e){
  183 + logger.error("", e);
  184 + }
  185 + }
145 } 186 }
src/main/resources/application-dev.properties
@@ -8,7 +8,7 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy @@ -8,7 +8,7 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
8 spring.jpa.database= MYSQL 8 spring.jpa.database= MYSQL
9 spring.jpa.show-sql= true 9 spring.jpa.show-sql= true
10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver 10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11 -spring.datasource.url= jdbc:mysql://127.0.0.1:3306/control 11 +spring.datasource.url= jdbc:mysql://127.0.0.1:3306/qp_control
12 spring.datasource.username= root 12 spring.datasource.username= root
13 spring.datasource.password= panzhao 13 spring.datasource.password= panzhao
14 #DATASOURCE 14 #DATASOURCE
src/main/resources/application.properties
@@ -13,3 +13,6 @@ multipart.maxRequestSize = -1 @@ -13,3 +13,6 @@ multipart.maxRequestSize = -1
13 13
14 server.compression.enabled=true 14 server.compression.enabled=true
15 server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript 15 server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript
  16 +
  17 +# batch insert
  18 +hibernate.jdbc.batch_size = 50
src/main/resources/datatools/config-dev.properties
@@ -4,13 +4,13 @@ @@ -4,13 +4,13 @@
4 datatools.kettle_properties=/datatools/kettle.properties 4 datatools.kettle_properties=/datatools/kettle.properties
5 # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正) 5 # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正)
6 #数据库ip地址 6 #数据库ip地址
7 -datatools.kvars_dbip=127.0.0.1 7 +datatools.kvars_dbip=192.168.168.201
8 #数据库用户名 8 #数据库用户名
9 datatools.kvars_dbuname=root 9 datatools.kvars_dbuname=root
10 #数据库密码 10 #数据库密码
11 -datatools.kvars_dbpwd= 11 +datatools.kvars_dbpwd=123456
12 #数据库库名 12 #数据库库名
13 -datatools.kvars_dbdname=control 13 +datatools.kvars_dbdname=mh_control
14 14
15 # 3、上传数据配置信息 15 # 3、上传数据配置信息
16 # 上传文件目录配置(根据不同的环境需要修正) 16 # 上传文件目录配置(根据不同的环境需要修正)
src/main/resources/ms-jdbc.properties
@@ -6,4 +6,4 @@ @@ -6,4 +6,4 @@
6 ms.mysql.driver= com.mysql.jdbc.Driver 6 ms.mysql.driver= com.mysql.jdbc.Driver
7 ms.mysql.url= jdbc:mysql://192.168.40.82:3306/ms?useUnicode=true&characterEncoding=utf-8 7 ms.mysql.url= jdbc:mysql://192.168.40.82:3306/ms?useUnicode=true&characterEncoding=utf-8
8 ms.mysql.username= root 8 ms.mysql.username= root
9 -ms.mysql.password= 123456  
10 \ No newline at end of file 9 \ No newline at end of file
  10 +ms.mysql.password= 123456
src/main/resources/rules/shiftloop.drl
1 -package com.bsth.service.schedule; 1 +package com.bsth.service.schedule.shiftloop;
2 2
3 import org.joda.time.*; 3 import org.joda.time.*;
4 import java.util.*; 4 import java.util.*;
@@ -15,7 +15,7 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; @@ -15,7 +15,7 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
15 //------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------// 15 //------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//
16 16
17 declare Calcu_days_result 17 declare Calcu_days_result
18 - ruleId : Long // 规则Id 18 + ruleId : String // 规则Id
19 qyrq_days : Integer // 开始日期离启用日期的天数 19 qyrq_days : Integer // 开始日期离启用日期的天数
20 sdays : Integer // 总共需要排班的天数 20 sdays : Integer // 总共需要排班的天数
21 calcu_start_date : DateTime // 开始计算日期 21 calcu_start_date : DateTime // 开始计算日期
@@ -104,18 +104,18 @@ end @@ -104,18 +104,18 @@ end
104 104
105 //----------------------- 路牌范围循环计算 ------------------------// 105 //----------------------- 路牌范围循环计算 ------------------------//
106 declare Calcu_guideboard_index_result 106 declare Calcu_guideboard_index_result
107 - ruleId : Long // 规则Id 107 + ruleId : String // 规则Id
108 calcu_index : Integer // 计算之后的起始索引 108 calcu_index : Integer // 计算之后的起始索引
109 end 109 end
110 declare Calcu_guideboard_index_param_1 110 declare Calcu_guideboard_index_param_1
111 - ruleId : Long // 规则Id 111 + ruleId : String // 规则Id
112 oindex : Integer // 原始起始索引 112 oindex : Integer // 原始起始索引
113 range_size : Integer // 范围大小 113 range_size : Integer // 范围大小
114 temp : Integer // 原始起始索引距离最后一个索引的大小 114 temp : Integer // 原始起始索引距离最后一个索引的大小
115 days_temp : Integer // 开始日期离启用日期的天数 - temp 115 days_temp : Integer // 开始日期离启用日期的天数 - temp
116 end 116 end
117 declare Calcu_guideboard_index_param_2 117 declare Calcu_guideboard_index_param_2
118 - ruleId : Long // 规则Id 118 + ruleId : String // 规则Id
119 s_value : Integer // 商 119 s_value : Integer // 商
120 y_value : Integer // 余 120 y_value : Integer // 余
121 end 121 end
@@ -217,18 +217,18 @@ end @@ -217,18 +217,18 @@ end
217 217
218 //----------------------- 人员范围循环计算 ------------------------// 218 //----------------------- 人员范围循环计算 ------------------------//
219 declare Calcu_employee_index_result 219 declare Calcu_employee_index_result
220 - ruleId : Long // 规则Id 220 + ruleId : String // 规则Id
221 calcu_index : Integer // 计算之后的起始索引 221 calcu_index : Integer // 计算之后的起始索引
222 end 222 end
223 declare Calcu_employee_index_param_1 223 declare Calcu_employee_index_param_1
224 - ruleId : Long // 规则Id 224 + ruleId : String // 规则Id
225 oindex : Integer // 原始起始索引 225 oindex : Integer // 原始起始索引
226 range_size : Integer // 范围大小 226 range_size : Integer // 范围大小
227 temp : Integer // 原始起始索引距离最后一个索引的大小 227 temp : Integer // 原始起始索引距离最后一个索引的大小
228 days_temp : Integer // 开始日期离启用日期的天数 - temp 228 days_temp : Integer // 开始日期离启用日期的天数 - temp
229 end 229 end
230 declare Calcu_employee_index_param_2 230 declare Calcu_employee_index_param_2
231 - ruleId : Long // 规则Id 231 + ruleId : String // 规则Id
232 s_value : Integer // 商 232 s_value : Integer // 商
233 y_value : Integer // 余 233 y_value : Integer // 余
234 end 234 end
@@ -332,7 +332,7 @@ end @@ -332,7 +332,7 @@ end
332 332
333 //----------------------- 路牌范围循环计算 ------------------------// 333 //----------------------- 路牌范围循环计算 ------------------------//
334 declare Calcu_guideboard_range_loop_result 334 declare Calcu_guideboard_range_loop_result
335 - ruleId : Long // 规则Id 335 + ruleId : String // 规则Id
336 firstLoopSize : Integer // 初始的范围循环个数 336 firstLoopSize : Integer // 初始的范围循环个数
337 middelLoopCount : Integer // 中间的范围循环次数 337 middelLoopCount : Integer // 中间的范围循环次数
338 rangeSize : Integer // 范围大小 338 rangeSize : Integer // 范围大小
@@ -340,7 +340,7 @@ declare Calcu_guideboard_range_loop_result @@ -340,7 +340,7 @@ declare Calcu_guideboard_range_loop_result
340 end 340 end
341 341
342 declare Calcu_guideboard_range_loop_param 342 declare Calcu_guideboard_range_loop_param
343 - ruleId : Long // 规则Id 343 + ruleId : String // 规则Id
344 temp : Integer // 起始索引距离最后一个索引的大小 344 temp : Integer // 起始索引距离最后一个索引的大小
345 sdays : Integer // 总共需要排班的天数 345 sdays : Integer // 总共需要排班的天数
346 end 346 end
@@ -409,7 +409,7 @@ end @@ -409,7 +409,7 @@ end
409 409
410 //----------------------- 人员范围循环计算 ------------------------// 410 //----------------------- 人员范围循环计算 ------------------------//
411 declare Calcu_employee_range_loop_result 411 declare Calcu_employee_range_loop_result
412 - ruleId : Long // 规则Id 412 + ruleId : String // 规则Id
413 firstLoopSize : Integer // 初始的范围循环个数 413 firstLoopSize : Integer // 初始的范围循环个数
414 middelLoopCount : Integer // 中间的范围循环次数 414 middelLoopCount : Integer // 中间的范围循环次数
415 rangeSize : Integer // 范围大小 415 rangeSize : Integer // 范围大小
@@ -417,7 +417,7 @@ declare Calcu_employee_range_loop_result @@ -417,7 +417,7 @@ declare Calcu_employee_range_loop_result
417 end 417 end
418 418
419 declare Calcu_employee_range_loop_param 419 declare Calcu_employee_range_loop_param
420 - ruleId : Long // 规则Id 420 + ruleId : String // 规则Id
421 temp : Integer // 起始索引距离最后一个索引的大小 421 temp : Integer // 起始索引距离最后一个索引的大小
422 sdays : Integer // 总共需要排班的天数 422 sdays : Integer // 总共需要排班的天数
423 end 423 end
@@ -489,7 +489,7 @@ end @@ -489,7 +489,7 @@ end
489 489
490 //----------------------- 路牌范围循环计算 ------------------------// 490 //----------------------- 路牌范围循环计算 ------------------------//
491 declare Calcu_loop_guideboard_result 491 declare Calcu_loop_guideboard_result
492 - ruleId : Long // 规则id 492 + ruleId : String // 规则id
493 go_list : List // 路牌循环的列表 493 go_list : List // 路牌循环的列表
494 end 494 end
495 495
@@ -553,7 +553,7 @@ end @@ -553,7 +553,7 @@ end
553 553
554 //----------------------- 人员范围循环计算 ------------------------// 554 //----------------------- 人员范围循环计算 ------------------------//
555 declare Calcu_loop_employee_result 555 declare Calcu_loop_employee_result
556 - ruleId : Long // 规则id 556 + ruleId : String // 规则id
557 eo_list : List // 人员循环的列表 557 eo_list : List // 人员循环的列表
558 end 558 end
559 559
src/main/resources/rules/ttinfo.drl 0 → 100644
  1 +package com.bsth.service.schedule.ttinfo;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input;
  7 +import com.bsth.service.schedule.rules.ttinfo.TTInfo_input;
  8 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output;
  9 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
  10 +
  11 +import org.slf4j.Logger;
  12 +
  13 +// 全局日志
  14 +global Logger log;
  15 +// return输出
  16 +global TTInfoResults_output results
  17 +
  18 +
  19 +/*
  20 + TODO:规则说明,以后待说明
  21 +*/
  22 +
  23 +//----------------- 第一阶段、计算规则准备数据(天数)----------------//
  24 +
  25 +declare Calcu_days_result
  26 + calcu_day : Integer // 该计算第几天
  27 + calcu_weekday : Integer // 星期几(1到7)
  28 + calcu_date : DateTime // 该计算的具体日期
  29 + calcu_days : Integer // 总共需要计算的天数
  30 + calcu_start_date : DateTime // 开始计算日期
  31 + calcu_end_date : DateTime // 结束计算日期
  32 + xlId : String // 线路Id
  33 +end
  34 +
  35 +rule "calcu_days"
  36 + when
  37 + TTInfoCalcuParam_input($fromDate : fromDate, $toDate : toDate, $fromDate.isBefore($toDate), $xlId : xlId)
  38 + then
  39 + // 构造Calcu_days_result对象,进行下一阶段计算
  40 + Calcu_days_result cdr = new Calcu_days_result();
  41 + Period p = new Period($fromDate, $toDate, PeriodType.days());
  42 +
  43 + cdr.setCalcu_day(1);
  44 + cdr.setCalcu_date($fromDate);
  45 + cdr.setCalcu_days(p.getDays() + 1);
  46 + cdr.setCalcu_weekday($fromDate.getDayOfWeek());
  47 + cdr.setCalcu_start_date($fromDate);
  48 + cdr.setCalcu_end_date(($toDate));
  49 + cdr.setXlId($xlId);
  50 +
  51 + log.info("总共需要计算的天数 calcu_days={} 之后的计算从第1天开始 ", p.getDays() + 1);
  52 +
  53 + insert(cdr); // 插入fact数据,进入下一个阶段
  54 +end
  55 +
  56 +//----------------- 第二阶段、判定时刻表是否启用 ----------------//
  57 +
  58 +declare Calcu_ttinfo_enable_result
  59 + xlId : String // 线路id
  60 + ttInfo_input_list : ArrayList // 可用时刻表列表
  61 + calcu_date : DateTime // 计算日期
  62 +end
  63 +
  64 +rule "calcu_ttinfo_enable"
  65 + salience 900
  66 + when
  67 + $calcu_days_result : Calcu_days_result($calcu_date : calcu_date, calcu_day <= calcu_days, $xlId : xlId)
  68 + $ttInfo_input_list : ArrayList(size >= 1) from collect (TTInfo_input(xlId == $xlId, isEnable == true))
  69 + then
  70 + // 构造Calcu_ttinfo_enable_result对象,进行下一步计算
  71 + Calcu_ttinfo_enable_result cter = new Calcu_ttinfo_enable_result();
  72 + cter.setXlId($xlId);
  73 + cter.setTtInfo_input_list($ttInfo_input_list);
  74 + cter.setCalcu_date($calcu_date);
  75 +
  76 + log.info("启用的时刻表:xlId={} 时刻表个数={}", $xlId, $ttInfo_input_list.size());
  77 +
  78 + insert (cter);
  79 +
  80 +end
  81 +
  82 +//----------------- 第三阶段、时刻表的日期匹配 -------------------//
  83 +
  84 +rule "calcu_ttinfo_special_day" // 特殊日期匹配
  85 + salience 800
  86 + when
  87 + $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
  88 + $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day)
  89 + $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays contains $calcu_date) from $ttInfo_input_list)
  90 + then
  91 + // 更新Calcu_days_result对象
  92 + int new_calcu_day = $calcu_day + 1;
  93 + $calcu_days_result.setCalcu_day(new_calcu_day);
  94 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  95 + $calcu_days_result.setCalcu_date(new_calcu_date);
  96 + $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
  97 +
  98 + log.info("启用特殊日期时刻表:xlId={} 时刻表个数={} 特殊日期={}", $xlId, $ttinfolist.size(), $calcu_date);
  99 +
  100 + // $ttinfolist按时间倒排序,result输出
  101 + Collections.sort($ttinfolist);
  102 + results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
  103 +
  104 + update($calcu_days_result);
  105 +end
  106 +
  107 +rule "calcu_ttinfo_normal_day" // 平日匹配
  108 + salience 700
  109 + when
  110 + $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
  111 + $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
  112 + $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == true) from $ttInfo_input_list)
  113 + then
  114 + // 更新Calcu_days_result对象
  115 + int new_calcu_day = $calcu_day + 1;
  116 + $calcu_days_result.setCalcu_day(new_calcu_day);
  117 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  118 + $calcu_days_result.setCalcu_date(new_calcu_date);
  119 + $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
  120 +
  121 + log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday);
  122 +
  123 + // $ttinfolist按时间倒排序,result输出
  124 + Collections.sort($ttinfolist);
  125 + results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
  126 +
  127 + update($calcu_days_result);
  128 +end
  129 +
  130 +rule "calcu_ttinfo_other_day" // 都没有的情况下,匹配
  131 + salience 500
  132 + when
  133 + $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
  134 + $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
  135 + $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == false) from $ttInfo_input_list)
  136 + then
  137 + // 更新Calcu_days_result对象
  138 + int new_calcu_day = $calcu_day + 1;
  139 + $calcu_days_result.setCalcu_day(new_calcu_day);
  140 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  141 + $calcu_days_result.setCalcu_date(new_calcu_date);
  142 + $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
  143 +
  144 + log.info("启用默认日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday);
  145 +
  146 + // $ttinfolist按时间倒排序,result输出
  147 + Collections.sort($ttinfolist);
  148 + results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
  149 +
  150 + update($calcu_days_result);
  151 +
  152 +end
0 \ No newline at end of file 153 \ No newline at end of file
src/main/resources/static/pages/base/line/add.html
@@ -189,6 +189,24 @@ @@ -189,6 +189,24 @@
189 </div> 189 </div>
190 </div> 190 </div>
191 191
  192 + <!-- 起始站名称 -->
  193 + <div class="form-group">
  194 + <label class="control-label col-md-3"> 起始站名称: </label>
  195 + <div class="col-md-4">
  196 + <input type="text" class="form-control" name="startStationName" id="startStationNameInput" placeholder="起始站名称">
  197 + <span class="help-block"> 说明 :上行起始站名称 </span>
  198 + </div>
  199 + </div>
  200 +
  201 + <!-- 终点站名称 -->
  202 + <div class="form-group">
  203 + <label class="control-label col-md-3"> 终点站名称: </label>
  204 + <div class="col-md-4">
  205 + <input type="text" class="form-control" name="endStationName" id="endStationNameInput" placeholder="终点站名称">
  206 + <span class="help-block"> 说明 :上行终点站名称 </span>
  207 + </div>
  208 + </div>
  209 +
192 <!-- 设备线路编码 --> 210 <!-- 设备线路编码 -->
193 <div class="form-group"> 211 <div class="form-group">
194 <label class="control-label col-md-3"> 设备线路编码: </label> 212 <label class="control-label col-md-3"> 设备线路编码: </label>
@@ -221,27 +239,12 @@ @@ -221,27 +239,12 @@
221 </div> 239 </div>
222 </div> 240 </div>
223 241
224 - <!-- 起始站名称 -->  
225 - <div class="form-group">  
226 - <label class="control-label col-md-3"> 起始站名称: </label>  
227 - <div class="col-md-4">  
228 - <input type="text" class="form-control" name="startStationName" id="startStationNameInput" placeholder="起始站名称">  
229 - </div>  
230 - </div>  
231 -  
232 - <!-- 终点站名称 -->  
233 - <div class="form-group">  
234 - <label class="control-label col-md-3"> 终点站名称: </label>  
235 - <div class="col-md-4">  
236 - <input type="text" class="form-control" name="endStationName" id="endStationNameInput" placeholder="终点站名称">  
237 - </div>  
238 - </div>  
239 -  
240 <!-- 起始站首班车时间 --> 242 <!-- 起始站首班车时间 -->
241 <div class="form-group"> 243 <div class="form-group">
242 <label class="control-label col-md-3"> 起始站首班车时间: </label> 244 <label class="control-label col-md-3"> 起始站首班车时间: </label>
243 <div class="col-md-4"> 245 <div class="col-md-4">
244 <input type="text" class="form-control" name="startStationFirstTime" id="startStationFirstTimeInput" placeholder="起始站首班车时间"> 246 <input type="text" class="form-control" name="startStationFirstTime" id="startStationFirstTimeInput" placeholder="起始站首班车时间">
  247 + <span class="help-block"> 例如 :06:00 </span>
245 </div> 248 </div>
246 </div> 249 </div>
247 250
@@ -250,6 +253,7 @@ @@ -250,6 +253,7 @@
250 <label class="control-label col-md-3"> 起始站末班车时间: </label> 253 <label class="control-label col-md-3"> 起始站末班车时间: </label>
251 <div class="col-md-4"> 254 <div class="col-md-4">
252 <input type="text" class="form-control" name="StartStationEndTime" id="StartStationEndTimeInput" placeholder="起始站末班车时间 "> 255 <input type="text" class="form-control" name="StartStationEndTime" id="StartStationEndTimeInput" placeholder="起始站末班车时间 ">
  256 + <span class="help-block"> 例如 :17:00 </span>
253 </div> 257 </div>
254 </div> 258 </div>
255 259
@@ -259,6 +263,7 @@ @@ -259,6 +263,7 @@
259 <label class="control-label col-md-3"> 终点站首班车时间: </label> 263 <label class="control-label col-md-3"> 终点站首班车时间: </label>
260 <div class="col-md-4"> 264 <div class="col-md-4">
261 <input type="text" class="form-control" name="endStationFirstTime" id="endStationFirstTimeInput" placeholder="终点站首班车时间"> 265 <input type="text" class="form-control" name="endStationFirstTime" id="endStationFirstTimeInput" placeholder="终点站首班车时间">
  266 + <span class="help-block"> 例如 :05:00 </span>
262 </div> 267 </div>
263 </div> 268 </div>
264 269
@@ -267,6 +272,7 @@ @@ -267,6 +272,7 @@
267 <label class="control-label col-md-3"> 终点站末班车时间: </label> 272 <label class="control-label col-md-3"> 终点站末班车时间: </label>
268 <div class="col-md-4"> 273 <div class="col-md-4">
269 <input type="text" class="form-control" name="endStationEndTime" id="endStationEndTimeInput" placeholder="终点站末班车时间 "> 274 <input type="text" class="form-control" name="endStationEndTime" id="endStationEndTimeInput" placeholder="终点站末班车时间 ">
  275 + <span class="help-block"> 例如 :18:00 </span>
270 </div> 276 </div>
271 </div> 277 </div>
272 278
src/main/resources/static/pages/base/line/js/line-add-form.js
@@ -162,7 +162,23 @@ $(function(){ @@ -162,7 +162,23 @@ $(function(){
162 required : true, 162 required : true,
163 163
164 // 最大长度 164 // 最大长度
165 - maxlength: 20 165 + maxlength: 30
  166 + },
  167 +
  168 + // 英文名称
  169 + 'es' : {
  170 +
  171 + // 最大长度
  172 + maxlength: 30
  173 +
  174 + },
  175 +
  176 + // 线路简称
  177 + 'shortName' : {
  178 +
  179 + // 最大长度
  180 + maxlength: 30
  181 +
166 }, 182 },
167 183
168 // 线路编码 184 // 线路编码
@@ -172,9 +188,49 @@ $(function(){ @@ -172,9 +188,49 @@ $(function(){
172 required : true, 188 required : true,
173 189
174 // 最大长度 190 // 最大长度
175 - maxlength: 20 191 + maxlength: 30
  192 + },
  193 +
  194 + // 所属公司
  195 + 'company' : {
  196 +
  197 + // 最大长度
  198 + maxlength: 30
176 }, 199 },
177 200
  201 + // 线路性质
  202 + 'nature' : {
  203 +
  204 + // 最大长度
  205 + maxlength: 30
  206 +
  207 + },
  208 +
  209 + // 线路等级
  210 + 'level' : {
  211 +
  212 + // 最大长度
  213 + maxlength: 30
  214 +
  215 + },
  216 +
  217 + // 起始站名称
  218 + 'startStationName' : {
  219 +
  220 + // 最大长度
  221 + maxlength: 30
  222 +
  223 + },
  224 +
  225 + // 终点站名称
  226 + 'endStationName' : {
  227 +
  228 + // 最大长度
  229 + maxlength: 30
  230 +
  231 + },
  232 +
  233 +
178 // 起始站调度电话 234 // 起始站调度电话
179 'startPhone' : { 235 'startPhone' : {
180 236
@@ -185,7 +241,10 @@ $(function(){ @@ -185,7 +241,10 @@ $(function(){
185 digits : true, 241 digits : true,
186 242
187 // 电话号码格式 243 // 电话号码格式
188 - isPhone : true 244 + isPhone : true,
  245 +
  246 + // 最大长度
  247 + maxlength: 30
189 }, 248 },
190 249
191 // 终点站调度电话 250 // 终点站调度电话
@@ -198,7 +257,10 @@ $(function(){ @@ -198,7 +257,10 @@ $(function(){
198 digits : true, 257 digits : true,
199 258
200 // 电话号码格式 259 // 电话号码格式
201 - isPhone : true 260 + isPhone : true,
  261 +
  262 + // 最大长度
  263 + maxlength: 30
202 }, 264 },
203 265
204 // 开辟日期 266 // 开辟日期
@@ -221,21 +283,27 @@ $(function(){ @@ -221,21 +283,27 @@ $(function(){
221 // 上海市线路编码 283 // 上海市线路编码
222 'shanghaiLinecode' : { 284 'shanghaiLinecode' : {
223 285
224 - // 必须输入合法的数字(负数,小数)。 286 + /*// 必须输入合法的数字(负数,小数)。
225 number : true, 287 number : true,
226 288
227 // 必须输入整数。 289 // 必须输入整数。
228 - digits : true 290 + digits : true,*/
  291 +
  292 + // 最大长度
  293 + maxlength: 30
229 }, 294 },
230 295
231 // 设备线路编码 296 // 设备线路编码
232 'eqLinecode' : { 297 'eqLinecode' : {
233 298
234 - // 必须输入合法的数字(负数,小数)。 299 + /*// 必须输入合法的数字(负数,小数)。
235 number : true, 300 number : true,
236 301
237 // 必须输入整数。 302 // 必须输入整数。
238 - digits : true 303 + digits : true,*/
  304 +
  305 + // 最大长度
  306 + maxlength: 30
239 }, 307 },
240 308
241 // 车辆总数 309 // 车辆总数
@@ -245,7 +313,10 @@ $(function(){ @@ -245,7 +313,10 @@ $(function(){
245 number : true, 313 number : true,
246 314
247 // 必须输入整数。 315 // 必须输入整数。
248 - digits : true 316 + digits : true,
  317 +
  318 + // 最大长度
  319 + maxlength: 8
249 }, 320 },
250 321
251 // 空调车辆数 322 // 空调车辆数
@@ -255,7 +326,10 @@ $(function(){ @@ -255,7 +326,10 @@ $(function(){
255 number : true, 326 number : true,
256 327
257 // 必须输入整数。 328 // 必须输入整数。
258 - digits : true 329 + digits : true,
  330 +
  331 + // 最大长度
  332 + maxlength: 8
259 }, 333 },
260 334
261 // 普通车辆数 335 // 普通车辆数
@@ -265,7 +339,10 @@ $(function(){ @@ -265,7 +339,10 @@ $(function(){
265 number : true, 339 number : true,
266 340
267 // 必须输入整数。 341 // 必须输入整数。
268 - digits : true 342 + digits : true,
  343 +
  344 + // 最大长度
  345 + maxlength: 8
269 }, 346 },
270 347
271 // 描述/说明 348 // 描述/说明
src/main/resources/static/pages/base/line/js/line-list-table.js
@@ -14,71 +14,16 @@ @@ -14,71 +14,16 @@
14 14
15 (function(){ 15 (function(){
16 16
17 - /** 填充公司下拉框选择值 */  
18 - $get('/business/all', {upCode_eq: '77'}, function(array){  
19 -  
20 - // 公司下拉options属性值  
21 - var options = '<option value="">请选择...</option>';  
22 -  
23 - // 遍历array  
24 - $.each(array, function(i,d){  
25 -  
26 - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';  
27 -  
28 - });  
29 -  
30 - // 填充公司下拉框options  
31 - $('#companySelect').html(options)  
32 -  
33 - /** 闵行没下属公司,这里暂时注释公司值改变事件 */  
34 - //$('#companySelect').html(options).on('change', setbrancheCompanySelectOptions);  
35 -  
36 - });  
37 -  
38 - /** 填充分公司下拉框。--- 闵行没下属公司,这里暂时注释*/  
39 - /* setbrancheCompanySelectOptions();*/  
40 -  
41 - /** 填充分公司下拉框选择值 */  
42 - function setbrancheCompanySelectOptions(){  
43 -  
44 - // 获取公司下拉框选择值  
45 - var businessCode = $('#companySelect').val();  
46 -  
47 - // 分公司下拉框options属性值  
48 - var options = '<option value="">请选择...</option>';  
49 -  
50 - // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码  
51 - if(businessCode == null || businessCode ==''){  
52 -  
53 - // 填充分公司下拉框options  
54 - $('#brancheCompanySelect').html(options);  
55 -  
56 - } else {  
57 -  
58 - /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */  
59 - $get('/business/all', {upCode_eq: businessCode}, function(array){  
60 -  
61 - // 遍历array  
62 - $.each(array, function(i,d){  
63 -  
64 - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';  
65 -  
66 - // 填充分公司下拉框options  
67 - $('#brancheCompanySelect').html(options);  
68 -  
69 - });  
70 - });  
71 - }  
72 - }  
73 -  
74 /** page : 当前页;initPag : */ 17 /** page : 当前页;initPag : */
75 var page = 0,initPag; 18 var page = 0,initPag;
76 19
77 // 选择框 20 // 选择框
78 var icheckOptions = {checkboxClass: 'icheckbox_flat-blue',increaseArea: '20%'}; 21 var icheckOptions = {checkboxClass: 'icheckbox_flat-blue',increaseArea: '20%'};
79 22
  23 + $('#destroy').val(0);
  24 +
80 /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */ 25 /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */
81 - loadTableDate(null,true); 26 + loadTableDate({'destroy_eq':0},true);
82 27
83 /** 重置按钮事件 */ 28 /** 重置按钮事件 */
84 $('tr.filter .filter-cancel').on('click',function() { 29 $('tr.filter .filter-cancel').on('click',function() {
@@ -161,8 +106,6 @@ @@ -161,8 +106,6 @@
161 // 异步请求获取表格数据 106 // 异步请求获取表格数据
162 $.get('/line',params,function(result){ 107 $.get('/line',params,function(result){
163 108
164 - debugger;  
165 -  
166 // 添加序号 109 // 添加序号
167 result.content.page = page; 110 result.content.page = page;
168 111
@@ -258,6 +201,64 @@ @@ -258,6 +201,64 @@
258 }); 201 });
259 } 202 }
260 203
  204 + /** 填充公司下拉框选择值 */
  205 + $get('/business/all', {upCode_eq: '77'}, function(array){
  206 +
  207 + // 公司下拉options属性值
  208 + var options = '<option value="">请选择...</option>';
  209 +
  210 + // 遍历array
  211 + $.each(array, function(i,d){
  212 +
  213 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  214 +
  215 + });
  216 +
  217 + // 填充公司下拉框options
  218 + $('#companySelect').html(options)
  219 +
  220 + /** 闵行没下属公司,这里暂时注释公司值改变事件 */
  221 + //$('#companySelect').html(options).on('change', setbrancheCompanySelectOptions);
  222 +
  223 + });
  224 +
  225 + /** 填充分公司下拉框。--- 闵行没下属公司,这里暂时注释*/
  226 + /* setbrancheCompanySelectOptions();*/
  227 +
  228 + /** 填充分公司下拉框选择值 */
  229 + function setbrancheCompanySelectOptions(){
  230 +
  231 + // 获取公司下拉框选择值
  232 + var businessCode = $('#companySelect').val();
  233 +
  234 + // 分公司下拉框options属性值
  235 + var options = '<option value="">请选择...</option>';
  236 +
  237 + // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码
  238 + if(businessCode == null || businessCode ==''){
  239 +
  240 + // 填充分公司下拉框options
  241 + $('#brancheCompanySelect').html(options);
  242 +
  243 + } else {
  244 +
  245 + /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */
  246 + $get('/business/all', {upCode_eq: businessCode}, function(array){
  247 +
  248 + // 遍历array
  249 + $.each(array, function(i,d){
  250 +
  251 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  252 +
  253 + // 填充分公司下拉框options
  254 + $('#brancheCompanySelect').html(options);
  255 +
  256 + });
  257 + });
  258 + }
  259 + }
  260 +
  261 +
261 /** 生成行单,这里暂时只做了单选生成。 */ 262 /** 生成行单,这里暂时只做了单选生成。 */
262 $('#datatable_ajax_tools #createUsingSingle').on('click', function() { 263 $('#datatable_ajax_tools #createUsingSingle').on('click', function() {
263 264
src/main/resources/static/pages/base/line/list.html
@@ -110,7 +110,7 @@ @@ -110,7 +110,7 @@
110 </td> 110 </td>
111 <td> 111 <td>
112 <!-- 这里没使用字典表,暂时写在页面上 --> 112 <!-- 这里没使用字典表,暂时写在页面上 -->
113 - <select class="form-control form-filter " name="destroy_eq"> 113 + <select class="form-control form-filter " id='destroy' name="destroy_eq">
114 <option value="">请选择...</option> 114 <option value="">请选择...</option>
115 <option value="0">运营</option> 115 <option value="0">运营</option>
116 <option value="1">撤销</option> 116 <option value="1">撤销</option>
@@ -291,4 +291,5 @@ @@ -291,4 +291,5 @@
291 </tr> 291 </tr>
292 {{/if}} 292 {{/if}}
293 </script> 293 </script>
294 -<script src="/pages/base/line/js/line-list-table.js"></script>  
295 \ No newline at end of file 294 \ No newline at end of file
  295 +<script src="/pages/base/line/js/line-list-table.js"></script>
  296 +<!-- <a href="/pages/base/stationroute/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> -->
296 \ No newline at end of file 297 \ No newline at end of file
src/main/resources/static/pages/base/linecast/cast.html 0 → 100644
  1 +<link href="/pages/base/linecast/css/cast.css" rel="stylesheet" type="text/css" />
  2 +
  3 +<script type="text/javascript" src="/pages/base/linecast/js/jquery.quicksearch.js"></script>
  4 +
  5 +<div class="page-head">
  6 + <div class="page-title">
  7 + <h1>线路分配</h1>
  8 + </div>
  9 +</div>
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li>
  13 + <li><span class="active">线路分配</span></li>
  14 +</ul>
  15 +
  16 +<div class="row">
  17 + <div class="col-md-4" style="padding-right: 0px;">
  18 + <div class="portlet light bordered" style="min-height: 520px;">
  19 + <div class="portlet-title">
  20 + <div class="caption">
  21 + <i class="fa fa-users font-dark"></i>
  22 + <span class="caption-subject font-dark sbold uppercase">用户菜单</span>
  23 + </div>
  24 + </div>
  25 + <div class="portlet-body">
  26 + <div id="modules_tree" ></div>
  27 + </div>
  28 + </div>
  29 + </div>
  30 + <div class="col-md-6" style="padding-left: 0px;">
  31 + <div class="portlet light bordered" style="height: 520px;">
  32 + <div class="portlet-body" style="min-height: 200px;" id="init-text">
  33 + <div class="text-info" style="text-align: center;line-height: 200px;">
  34 + <i class="fa fa-info"></i> 单击节点查看详细
  35 + </div>
  36 + </div>
  37 +
  38 + <div style="display:none" id="line-cast">
  39 + <!-- BEGIN PORTLET-->
  40 + <div class="portlet light bordered">
  41 + <div class="portlet-title">
  42 + <div class="caption">
  43 + <i class="icon-bar-chart font-green"></i>
  44 + <span class="caption-subject font-green bold uppercase">线路配置</span>
  45 + </div>
  46 + <div class="actions">
  47 + <button class="btn green btn-circle btn-sm" disabled="disabled" id="saveModuleSett"><i class="fa fa-check"></i> 保存修改</button>
  48 + </div>
  49 + </div>
  50 + <div class="portlet-body">
  51 + <div class="form-group last" >
  52 + <div>
  53 + <select multiple="multiple" class="multi-select" id="moduleSettSelect" ></select>
  54 + </div>
  55 + </div>
  56 + </div>
  57 + </div>
  58 + </div>
  59 + </div>
  60 + </div>
  61 +</div>
  62 +
  63 +<script type="text/html" id="left_line_cast">
  64 +
  65 +</script>
  66 +
  67 +<script>
  68 +
  69 +$(function(){
  70 +
  71 + getTreeData(function(treeData){
  72 +
  73 + //初始化树
  74 + $('#modules_tree').on('loaded.jstree', function(e, data){close_all();}).jstree({
  75 + 'core' : {
  76 + 'themes' : {
  77 + 'responsive': false
  78 + },
  79 + 'data': treeData,
  80 + 'multiple':false
  81 + },
  82 + 'types' : {
  83 + "default" : {
  84 + "icon" : false
  85 + },
  86 + 'enable_true' : {
  87 + "icon" : 'fa fa-check icon-lg'
  88 + },
  89 + 'enable_false' : {
  90 + 'icon' : 'fa fa-close icon-lg'
  91 + },
  92 + 'group':{
  93 + 'icon' : 'fa fa-object-group icon-lg'
  94 + }
  95 + },
  96 + 'plugins': ['types']
  97 + }).on('select_node.jstree', jstreeClick);
  98 + });
  99 +
  100 + $('.tooltips').tooltip();
  101 +
  102 +});
  103 +
  104 +function jstreeClick(){
  105 +
  106 + var selected = getCurrSelNode();
  107 +
  108 + var obj = selected[0].original;
  109 +
  110 + $('#saveModuleSett').attr('disabled', 'disabled');
  111 +
  112 + if(obj.pId==null) {
  113 +
  114 + $('#line-cast').hide();
  115 +
  116 + $('#init-text').show();
  117 + }else {
  118 +
  119 + $('#line-cast').show();
  120 +
  121 + $('#init-text').hide();
  122 +
  123 + var userId = obj.userId;
  124 +
  125 + getModuleTreeData(userId);
  126 +
  127 + }
  128 +
  129 +}
  130 +
  131 +function getCurrSelNode(){
  132 +
  133 + var array = [];
  134 +
  135 + try {
  136 +
  137 + array = $.jstree.reference("#modules_tree").get_selected(true);
  138 +
  139 + } catch (e) {
  140 +
  141 + console.log(e);
  142 +
  143 + }
  144 +
  145 + return array;
  146 +}
  147 +
  148 +function close_all(){
  149 +
  150 + $.jstree.reference("#modules_tree").close_all();
  151 +
  152 +}
  153 +
  154 +
  155 +
  156 +function getTreeData(cb){
  157 +
  158 + var treeData = [];
  159 +
  160 + $get('/userline/userRoleTree',null, function(arr){
  161 +
  162 + //转换为jsTree想要的数据格式
  163 + treeData = createTreeData(arr);
  164 +
  165 + cb && cb(treeData)
  166 + });
  167 +}
  168 +
  169 +function getModuleTreeData(userId){
  170 +
  171 +
  172 + $get('/line/all',null, function(linedata){
  173 +
  174 + $get('/userline/all',{'user.id_eq':userId}, function(userlinedata){
  175 +
  176 + var options = '';
  177 +
  178 + var len = userlinedata.length;
  179 +
  180 + $.each(linedata, function(i, g){
  181 +
  182 + //是否被当前用户持有
  183 + var selected = '';
  184 +
  185 + if(len>0) {
  186 +
  187 + for(var j = 0;j<userlinedata.length;j++ ) {
  188 +
  189 + if(userlinedata[j].line.id==g.id){
  190 +
  191 + selected = 'selected';
  192 +
  193 + break;
  194 +
  195 + }
  196 +
  197 + }
  198 +
  199 + }
  200 +
  201 + options += '<option value="'+g.id+'" ' + selected +'>'+g.name+'</option>'
  202 +
  203 + });
  204 +
  205 + //初始化multiSelect
  206 + $('#moduleSettSelect').html(options).multiSelect({
  207 + selectableOptgroup: true,
  208 +
  209 + selectableFooter: "<div class='multi-custom-header-left'>未分配</div>",
  210 + selectionFooter: "<div class='multi-custom-header-right'>已分配</div>",
  211 +
  212 + selectableHeader: "<input type='text' class='search-input' style='width: 221px;' autocomplete='off' placeholder='搜索线路'>",
  213 + selectionHeader: "<input type='text' class='search-input' style='width: 221px;' autocomplete='off' placeholder='搜索线路'>",
  214 + afterInit: function(ms){
  215 + var that = this,
  216 + $selectableSearch = that.$selectableUl.prev(),
  217 + $selectionSearch = that.$selectionUl.prev(),
  218 + selectableSearchString = '#'+that.$container.attr('id')+' .ms-elem-selectable:not(.ms-selected)',
  219 + selectionSearchString = '#'+that.$container.attr('id')+' .ms-elem-selection.ms-selected';
  220 +
  221 + that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
  222 + .on('keydown', function(e){
  223 + if (e.which === 40){
  224 + that.$selectableUl.focus();
  225 + return false;
  226 + }
  227 + });
  228 +
  229 + that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
  230 + .on('keydown', function(e){
  231 + if (e.which == 40){
  232 + that.$selectionUl.focus();
  233 + return false;
  234 + }
  235 + });
  236 + },
  237 + afterSelect: function(){
  238 + this.qs1.cache();
  239 + this.qs2.cache();
  240 + },
  241 + afterDeselect: function(){
  242 + this.qs1.cache();
  243 + this.qs2.cache();
  244 + }
  245 + }).on('change',function(){
  246 +
  247 + if( $(this).val() ==null || $(this).val().length > 0)
  248 + $('#saveModuleSett').removeAttr('disabled');
  249 + else
  250 + $('#saveModuleSett').attr('disabled', 'disabled');
  251 + });
  252 +
  253 + $('#moduleSettSelect').multiSelect('refresh');
  254 +
  255 + });
  256 +
  257 + });
  258 +}
  259 +
  260 +
  261 +$('#saveModuleSett').on('click', function(){
  262 + if($(this).attr('disabled'))
  263 + return;
  264 +
  265 + var ids = '';
  266 +
  267 + if($('#moduleSettSelect').val() !=null) {
  268 +
  269 + $.each($('#moduleSettSelect').val(), function(i, mId){
  270 + ids += mId + ',';
  271 + });
  272 +
  273 + }
  274 +
  275 + var selected = getCurrSelNode();
  276 +
  277 + var obj = selected[0].original;
  278 +
  279 + if(obj) {
  280 +
  281 + $post('/userline/setLineCasts', {'userId': obj.userId,mIds: ids}, function(){
  282 + $('#saveModuleSett').attr('disabled', 'disabled');
  283 + layer.msg('修改成功!');
  284 + });
  285 +
  286 + }
  287 +
  288 +});
  289 +</script>
0 \ No newline at end of file 290 \ No newline at end of file
src/main/resources/static/pages/base/linecast/css/cast.css 0 → 100644
  1 +.jstree-default .jstree-hovered{
  2 + background-color: rgba(101, 155, 224, 0.19);
  3 +}
  4 +
  5 +.jstree-default .jstree-clicked {
  6 + background-color: #659BE0;
  7 + color: white;
  8 +}
  9 +.layui-layer-cfm-delete .layui-layer-btn0{
  10 + background-color: #e73d4a;
  11 + border-color: #CE3643;
  12 +}
0 \ No newline at end of file 13 \ No newline at end of file
src/main/resources/static/pages/base/linecast/js/jquery.quicksearch.js 0 → 100644
  1 +(function($, window, document, undefined) {
  2 + $.fn.quicksearch = function (target, opt) {
  3 +
  4 + var timeout, cache, rowcache, jq_results, val = '', e = this, options = $.extend({
  5 + delay: 100,
  6 + selector: null,
  7 + stripeRows: null,
  8 + loader: null,
  9 + noResults: '',
  10 + matchedResultsCount: 0,
  11 + bind: 'keyup',
  12 + onBefore: function () {
  13 + return;
  14 + },
  15 + onAfter: function () {
  16 + return;
  17 + },
  18 + show: function () {
  19 + this.style.display = "";
  20 + },
  21 + hide: function () {
  22 + this.style.display = "none";
  23 + },
  24 + prepareQuery: function (val) {
  25 + return val.toLowerCase().split(' ');
  26 + },
  27 + testQuery: function (query, txt, _row) {
  28 + for (var i = 0; i < query.length; i += 1) {
  29 + if (txt.indexOf(query[i]) === -1) {
  30 + return false;
  31 + }
  32 + }
  33 + return true;
  34 + }
  35 + }, opt);
  36 +
  37 + this.go = function () {
  38 +
  39 + var i = 0,
  40 + numMatchedRows = 0,
  41 + noresults = true,
  42 + query = options.prepareQuery(val),
  43 + val_empty = (val.replace(' ', '').length === 0);
  44 +
  45 + for (var i = 0, len = rowcache.length; i < len; i++) {
  46 + if (val_empty || options.testQuery(query, cache[i], rowcache[i])) {
  47 + options.show.apply(rowcache[i]);
  48 + noresults = false;
  49 + numMatchedRows++;
  50 + } else {
  51 + options.hide.apply(rowcache[i]);
  52 + }
  53 + }
  54 +
  55 + if (noresults) {
  56 + this.results(false);
  57 + } else {
  58 + this.results(true);
  59 + this.stripe();
  60 + }
  61 +
  62 + this.matchedResultsCount = numMatchedRows;
  63 + this.loader(false);
  64 + options.onAfter();
  65 +
  66 + return this;
  67 + };
  68 +
  69 + /*
  70 + * External API so that users can perform search programatically.
  71 + * */
  72 + this.search = function (submittedVal) {
  73 + val = submittedVal;
  74 + e.trigger();
  75 + };
  76 +
  77 + /*
  78 + * External API to get the number of matched results as seen in
  79 + * https://github.com/ruiz107/quicksearch/commit/f78dc440b42d95ce9caed1d087174dd4359982d6
  80 + * */
  81 + this.currentMatchedResults = function() {
  82 + return this.matchedResultsCount;
  83 + };
  84 +
  85 + this.stripe = function () {
  86 +
  87 + if (typeof options.stripeRows === "object" && options.stripeRows !== null)
  88 + {
  89 + var joined = options.stripeRows.join(' ');
  90 + var stripeRows_length = options.stripeRows.length;
  91 +
  92 + jq_results.not(':hidden').each(function (i) {
  93 + $(this).removeClass(joined).addClass(options.stripeRows[i % stripeRows_length]);
  94 + });
  95 + }
  96 +
  97 + return this;
  98 + };
  99 +
  100 + this.strip_html = function (input) {
  101 + var output = input.replace(new RegExp('<[^<]+\>', 'g'), "");
  102 + output = $.trim(output.toLowerCase());
  103 + return output;
  104 + };
  105 +
  106 + this.results = function (bool) {
  107 + if (typeof options.noResults === "string" && options.noResults !== "") {
  108 + if (bool) {
  109 + $(options.noResults).hide();
  110 + } else {
  111 + $(options.noResults).show();
  112 + }
  113 + }
  114 + return this;
  115 + };
  116 +
  117 + this.loader = function (bool) {
  118 + if (typeof options.loader === "string" && options.loader !== "") {
  119 + (bool) ? $(options.loader).show() : $(options.loader).hide();
  120 + }
  121 + return this;
  122 + };
  123 +
  124 + this.cache = function () {
  125 +
  126 + jq_results = $(target);
  127 +
  128 + if (typeof options.noResults === "string" && options.noResults !== "") {
  129 + jq_results = jq_results.not(options.noResults);
  130 + }
  131 +
  132 + var t = (typeof options.selector === "string") ? jq_results.find(options.selector) : $(target).not(options.noResults);
  133 + cache = t.map(function () {
  134 + return e.strip_html(this.innerHTML);
  135 + });
  136 +
  137 + rowcache = jq_results.map(function () {
  138 + return this;
  139 + });
  140 +
  141 + /*
  142 + * Modified fix for sync-ing "val".
  143 + * Original fix https://github.com/michaellwest/quicksearch/commit/4ace4008d079298a01f97f885ba8fa956a9703d1
  144 + * */
  145 + val = val || this.val() || "";
  146 +
  147 + return this.go();
  148 + };
  149 +
  150 + this.trigger = function () {
  151 + this.loader(true);
  152 + options.onBefore();
  153 +
  154 + window.clearTimeout(timeout);
  155 + timeout = window.setTimeout(function () {
  156 + e.go();
  157 + }, options.delay);
  158 +
  159 + return this;
  160 + };
  161 +
  162 + this.cache();
  163 + this.results(true);
  164 + this.stripe();
  165 + this.loader(false);
  166 +
  167 + return this.each(function () {
  168 +
  169 + /*
  170 + * Changed from .bind to .on.
  171 + * */
  172 + $(this).on(options.bind, function () {
  173 +
  174 + val = $(this).val();
  175 + e.trigger();
  176 + });
  177 + });
  178 +
  179 + };
  180 +
  181 +}(jQuery, this, document));
0 \ No newline at end of file 182 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
@@ -12,6 +12,12 @@ html,body{ @@ -12,6 +12,12 @@ html,body{
12 overflow:hidden; 12 overflow:hidden;
13 } 13 }
14 14
  15 +.rm3_image {
  16 + width: 120px;
  17 + height: 26px;
  18 +
  19 +}
  20 +
15 /* 隐藏百度地图logo */ 21 /* 隐藏百度地图logo */
16 .anchorBL, 22 .anchorBL,
17 .anchorBL, 23 .anchorBL,
src/main/resources/static/pages/base/stationroute/css/img/back160.png 0 → 100644

3.28 KB

src/main/resources/static/pages/base/stationroute/edit.html
@@ -443,6 +443,8 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati @@ -443,6 +443,8 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
443 // 弹出添加成功提示消息 443 // 弹出添加成功提示消息
444 layer.msg('修改成功...'); 444 layer.msg('修改成功...');
445 445
  446 + /** 通知更新缓存区 */
  447 + $.post('http://192.168.168.171:8800/transport_server/basic/refresh',function(rs){console.log(rs)})
446 448
447 }else { 449 }else {
448 450
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
@@ -650,6 +650,8 @@ var PublicFunctions = function () { @@ -650,6 +650,8 @@ var PublicFunctions = function () {
650 // 中心点坐标字符串 650 // 中心点坐标字符串
651 var bJwpointsStr = resultdata[s].bJwpoints; 651 var bJwpointsStr = resultdata[s].bJwpoints;
652 652
  653 + var stationName = resultdata[s].stationName;
  654 +
653 // 起个中心点坐标字符串 655 // 起个中心点坐标字符串
654 var bJwpointsArray = bJwpointsStr.split(' '); 656 var bJwpointsArray = bJwpointsStr.split(' ');
655 657
@@ -657,7 +659,7 @@ var PublicFunctions = function () { @@ -657,7 +659,7 @@ var PublicFunctions = function () {
657 var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]); 659 var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]);
658 660
659 /** 在地图上画点 @param:<point_center:中心坐标点> */ 661 /** 在地图上画点 @param:<point_center:中心坐标点> */
660 - WorldsBMap.drawingUpStationPoint(point_center); 662 + WorldsBMap.drawingUpStationPoint(point_center,stationName,s+1);
661 663
662 } 664 }
663 665
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
@@ -684,11 +684,26 @@ var WorldsBMap = function () { @@ -684,11 +684,26 @@ var WorldsBMap = function () {
684 }, 684 },
685 685
686 /** 在地图上画点 @param:<point_center:中心坐标点> */ 686 /** 在地图上画点 @param:<point_center:中心坐标点> */
687 - drawingUpStationPoint : function(point_center) { 687 + drawingUpStationPoint : function(point_center,stationName,s) {
688 688
689 // 自定义标注物图片 689 // 自定义标注物图片
690 - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));  
691 - 690 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10));
  691 +
  692 + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">'
  693 + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'
  694 + + '</div>'
  695 + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>';
  696 +
  697 +
  698 + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{
  699 + "anchor" : new BMap.Size(-10,8),
  700 + "enableDragging" : true});
  701 +
  702 +
  703 + myRichMarker1.disableDragging();
  704 + mapBValue.addOverlay(myRichMarker1);
  705 +
  706 +
692 // 创建标注物 707 // 创建标注物
693 marker = new BMap.Marker(point_center,{icon : icon_target}); 708 marker = new BMap.Marker(point_center,{icon : icon_target});
694 709
src/main/resources/static/pages/control/line/css/lineControl.css
@@ -2554,6 +2554,8 @@ span.nt-coord:before{ @@ -2554,6 +2554,8 @@ span.nt-coord:before{
2554 margin: 8px 0; 2554 margin: 8px 0;
2555 } 2555 }
2556 2556
  2557 +
  2558 +
2557 tr.linjia td:nth-child(1):AFTER { 2559 tr.linjia td:nth-child(1):AFTER {
2558 content: "\f173"; 2560 content: "\f173";
2559 font: normal normal normal 14px/1 FontAwesome; 2561 font: normal normal normal 14px/1 FontAwesome;
@@ -2565,6 +2567,21 @@ tr.linjia td:nth-child(1):AFTER { @@ -2565,6 +2567,21 @@ tr.linjia td:nth-child(1):AFTER {
2565 padding: 1px 3px 1px 3px; 2567 padding: 1px 3px 1px 3px;
2566 background: #e7505a; 2568 background: #e7505a;
2567 border-radius: 15px; 2569 border-radius: 15px;
  2570 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
  2571 +}
  2572 +
  2573 +tr.child_task td:nth-child(1):AFTER{
  2574 + content: "Z";
  2575 + font: normal normal normal 14px/1 FontAwesome;
  2576 + position: absolute;
  2577 + right: 1px;
  2578 + bottom: 2px;
  2579 + color: #ffffff;
  2580 + padding: 1px 3px 1px 3px;
  2581 + background: #3598dc;
  2582 + border-radius: 15px;
  2583 + font-weight: bold;
  2584 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
2568 } 2585 }
2569 2586
2570 .device_event_str{ 2587 .device_event_str{
src/main/resources/static/pages/control/line/js/data.js
@@ -197,10 +197,6 @@ var _data = (function(){ @@ -197,10 +197,6 @@ var _data = (function(){
197 if(!lineLpMap[lineCode][this.lpName]) 197 if(!lineLpMap[lineCode][this.lpName])
198 lineLpMap[lineCode][this.lpName] = []; 198 lineLpMap[lineCode][this.lpName] = [];
199 lineLpMap[lineCode][this.lpName].push(this); 199 lineLpMap[lineCode][this.lpName].push(this);
200 - //车辆 ——> 班次数组  
201 - /*if(!clSchMap[this.clZbh])  
202 - clSchMap[this.clZbh] = [];  
203 - clSchMap[this.clZbh].push(this);*/  
204 }); 200 });
205 201
206 //按发车时间排序 202 //按发车时间排序
src/main/resources/static/pages/control/line/js/rightMenu.js
@@ -571,14 +571,15 @@ var _menu = (function() { @@ -571,14 +571,15 @@ var _menu = (function() {
571 var params = $('form#schinfoFineTune').serializeJSON(); 571 var params = $('form#schinfoFineTune').serializeJSON();
572 572
573 if(!customFormValidate('form#schinfoFineTune'))return; 573 if(!customFormValidate('form#schinfoFineTune'))return;
574 - 574 +
  575 + var loadIndex = layer.msg('操作中...', {icon: 16});
575 $post('/realSchedule/schInfoFineTune', params, function(rs){ 576 $post('/realSchedule/schInfoFineTune', params, function(rs){
576 layer.close(index); 577 layer.close(index);
  578 + layer.close(loadIndex);
  579 +
577 if(rs.ts) 580 if(rs.ts)
578 _alone.refreshScheduleArray(rs.ts); 581 _alone.refreshScheduleArray(rs.ts);
579 582
580 - /*if(rs.nextSch)  
581 - _alone.refreshSchedule(rs.nextSch);*/  
582 }); 583 });
583 }); 584 });
584 } 585 }
src/main/resources/static/pages/control/line/temps/alone_tp.html
@@ -104,7 +104,7 @@ @@ -104,7 +104,7 @@
104 <!-- 班次table --> 104 <!-- 班次table -->
105 <script id="alone_plan_table_temp" type="text/html"> 105 <script id="alone_plan_table_temp" type="text/html">
106 {{each list as item i}} 106 {{each list as item i}}
107 -<tr data-id={{item.id}} class="{{if item.sflj}}linjia{{/if}}"> 107 +<tr data-id={{item.id}} class="{{if item.sflj}}linjia{{/if}} {{if item.cTasks.length > 0}} child_task {{/if}}">
108 <td name="lineNo"></td> 108 <td name="lineNo"></td>
109 <td data-name="lpName"><a href="javascript:;">{{item.lpName}}</a></td> 109 <td data-name="lpName"><a href="javascript:;">{{item.lpName}}</a></td>
110 110
@@ -138,7 +138,8 @@ @@ -138,7 +138,8 @@
138 138
139 {{else if item.status == 1}} 139 {{else if item.status == 1}}
140 <td data-name="sjfcsj" class="tl-zzzx sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td> 140 <td data-name="sjfcsj" class="tl-zzzx sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td>
141 - 141 +{{else if item.status == 0 && item.late}}
  142 + <td data-name="sjfcsj" class="tl-wd sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td>
142 {{else }} 143 {{else }}
143 <td data-name="sjfcsj" class="sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td> 144 <td data-name="sjfcsj" class="sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td>
144 {{/if}} 145 {{/if}}
src/main/resources/static/pages/control/lineConfig/config.html
@@ -211,23 +211,14 @@ butto.line-config-btn:active{ @@ -211,23 +211,14 @@ butto.line-config-btn:active{
211 </div> 211 </div>
212 </section> 212 </section>
213 213
214 - <!--<section>  
215 - <h3>出场时间</h3>  
216 -  
217 - <div class="settings-row" >  
218 - <p > 使用 <a href="javascript:;" data-type="select" id="outTimeType"></a> 作为出场班次的实际时间。</p>  
219 - </div>  
220 - </section>  
221 --->  
222 -<!--  
223 <section> 214 <section>
224 - <h3>场时间</h3> 215 + <h3>班次进出场时间</h3>
225 216
226 <div class="settings-row" > 217 <div class="settings-row" >
227 - <p > 使用 <a href="javascript:;" data-type="select" id="inTimeType"></a> 作为进场班次的实际时间。</p> 218 + <p > 使用 <a href="javascript:;" data-type="select" id="outTimeType"></a> 时间作为出场班次的实际时间。</p>
228 </div> 219 </div>
229 </section> 220 </section>
230 ---> 221 +
231 </form> 222 </form>
232 </script> 223 </script>
233 224
@@ -305,7 +296,6 @@ butto.line-config-btn:active{ @@ -305,7 +296,6 @@ butto.line-config-btn:active{
305 //运营开始时间 296 //运营开始时间
306 $('#startOptTimeLink').editable({ 297 $('#startOptTimeLink').editable({
307 type: 'time', 298 type: 'time',
308 - title:'修改线路运营开始时间',  
309 placement: 'right', 299 placement: 'right',
310 display: false, 300 display: false,
311 validate: function(value){ 301 validate: function(value){
@@ -316,42 +306,41 @@ butto.line-config-btn:active{ @@ -316,42 +306,41 @@ butto.line-config-btn:active{
316 }) 306 })
317 .on('save', function(e, params) { 307 .on('save', function(e, params) {
318 var index = showLoad('提交数据...'); 308 var index = showLoad('提交数据...');
319 - var lineCode = $('.line_config_tree li.selected').data('code');  
320 - $post('/lineConfig/editTime', {lineCode: lineCode, time: params.newValue} 309 + $post('/lineConfig/editTime', {lineCode: getLineCode(), time: params.newValue}
321 ,function(rs){ 310 ,function(rs){
322 layer.close(index); 311 layer.close(index);
323 $('#startOptTimeLink').text(rs.time); 312 $('#startOptTimeLink').text(rs.time);
324 }); 313 });
325 }); 314 });
326 315
327 -/* //出场时间类型 316 + //进出场时间类型
328 $('#outTimeType').editable({ 317 $('#outTimeType').editable({
329 value: conf.outConfig, 318 value: conf.outConfig,
330 inputclass: 'form-control', 319 inputclass: 'form-control',
331 placement: 'right', 320 placement: 'right',
332 source: [{ 321 source: [{
333 value: 0, 322 value: 0,
334 - text: '离开缓冲区时间' 323 + text: 'gps出场'
335 }, { 324 }, {
336 value: 1, 325 value: 1,
337 - text: '请求出场时间'  
338 - }]  
339 - });  
340 -  
341 - //进场时间类型  
342 - $('#inTimeType').editable({  
343 - value: conf.inConfig,  
344 - inputclass: 'form-control',  
345 - placement: 'right',  
346 - source: [{  
347 - value: 0,  
348 - text: '离开缓冲区时间' 326 + text: '请求出场'
349 }, { 327 }, {
350 - value: 1,  
351 - text: '请求进场时间' 328 + value: 2,
  329 + text: '出站即出场'
352 }] 330 }]
353 - }); */  
354 - 331 + })
  332 + .on('save', function(e, params) {
  333 + var index = showLoad('提交数据...');
  334 + $post('/lineConfig/editOutTimeType', {lineCode: lineCode, type: params.newValue}
  335 + ,function(rs){
  336 + layer.close(index);
  337 + $('#outTimeType').val(rs.type);
  338 + });
  339 + });
  340 + }
  341 +
  342 + function getLineCode(){
  343 + return $('.line_config_tree li.selected').data('code');
355 } 344 }
356 }(); 345 }();
357 </script> 346 </script>
358 \ No newline at end of file 347 \ No newline at end of file
src/main/resources/static/pages/forecast/gps/gpsMain.html 0 → 100644
  1 +暂未开放
0 \ No newline at end of file 2 \ No newline at end of file
src/main/resources/static/pages/forecast/real/realForecast.html 0 → 100644
  1 +暂未开放
0 \ No newline at end of file 2 \ No newline at end of file
src/main/resources/static/pages/forecast/sample/css/main.css 0 → 100644
  1 +#lineConfigPanel{
  2 + background: #fff;
  3 + overflow: hidden;
  4 + font-family: 'Segoe UI',Arial,'Microsoft Yahei',sans-serif !important;
  5 + min-width: 1392px;
  6 +}
  7 +
  8 +#lineConfigPanel h1{
  9 + -webkit-margin-start: 23px;
  10 + color: rgb(92, 97, 102);
  11 + margin-bottom: 1em;
  12 + margin-top: 21px;
  13 + font-size: 1.5em;
  14 +}
  15 +
  16 +#lineConfigPanel .line_config_tree ul {
  17 + list-style-type: none;
  18 + padding: 0;
  19 + height: 100% !important;
  20 +}
  21 +
  22 +#lineConfigPanel .line_config_tree ul li{
  23 + -webkit-border-start: 6px solid transparent;
  24 + -webkit-padding-start: 18px;
  25 + -webkit-user-select: none;
  26 + cursor: pointer;
  27 +}
  28 +
  29 +#lineConfigPanel .line_config_tree ul li.selected{
  30 + -webkit-border-start-color: #1bbc9b;
  31 + cursor: default;
  32 + pointer-events: none;
  33 +}
  34 +
  35 +#lineConfigPanel .line_config_tree ul li button{
  36 + background-color: white;
  37 + border: 0;
  38 + color: #999;
  39 + cursor: pointer;
  40 + font: inherit;
  41 + line-height: 1.417em;
  42 + margin: 6px 0;
  43 + padding: 0;
  44 +}
  45 +
  46 +#lineConfigPanel .line_config_tree ul li.selected button{
  47 + color: #1bbc9b;
  48 +}
  49 +
  50 +#lineConfigPanel #trafficChart{
  51 + display: inline-block;
  52 + width: calc(100% - 152px);
  53 + vertical-align: top;
  54 + height: 100%;
  55 +}
  56 +
  57 +#lineConfigPanel #trafficChart .sample_tags{
  58 + width: 100%;
  59 + height: 65px;
  60 + text-align: right;
  61 + padding: 20px 40px 0;
  62 +}
  63 +
  64 +#lineConfigPanel #trafficChart .sample_tags a.tag{
  65 + display: inline-block;
  66 + line-height: 1;
  67 + vertical-align: baseline;
  68 + background-color: #E8E8E8;
  69 + padding: .5833em .833em;
  70 + color: rgba(0,0,0,.6);
  71 + text-transform: none;
  72 + font-weight: 700;
  73 + border: 0 solid transparent;
  74 + border-radius: .28571429rem !important;
  75 + -webkit-transition: background .1s ease;
  76 + transition: background .1s ease;
  77 + font-size: .85714286rem;
  78 + margin: .8em .5em .5em 0;
  79 + font-weight: 400;
  80 +}
  81 +
  82 +#lineConfigPanel #trafficChart svg{
  83 + width: 100%;
  84 + height: calc(100% - 65px);
  85 +}
  86 +
  87 +#lineConfigPanel #trafficChart svg circle{
  88 + fill: #b9b7b7;
  89 + r: 6;
  90 + stroke: rgb(253, 253, 253);
  91 + stroke-width: 3;
  92 +}
  93 +
  94 +#lineConfigPanel #trafficChart svg path{
  95 + stroke-width: 6.4px;
  96 + opacity: 0.9;
  97 + stroke: #b2afaf;
  98 + cursor: pointer;
  99 +}
  100 +
  101 +#lineConfigPanel #trafficChart svg path.active{
  102 + stroke: #1bbc9b;
  103 +}
  104 +
  105 +#lineConfigPanel #trafficChart svg text{
  106 + font-size: 85%;
  107 + fill: #6b6666;
  108 + font-weight: bold;
  109 +}
  110 +
  111 +#lineConfigPanel #trafficChart .sample_tags a.tag.active{
  112 + background-color: #1bbc9b;
  113 + color: white;
  114 +}
  115 +
  116 +.line_config_tree{
  117 + width: 155px;
  118 + float: left;
  119 + height: 100%;
  120 +}
  121 +
  122 +#lineConfigPanel .slimScrollBar{
  123 + border-radius: 7px !important;
  124 + background: rgb(176, 173, 173) !important;
  125 + width: 4px !important;
  126 +}
  127 +
  128 +.line_config_content{
  129 + width: calc(100% - 155px);
  130 + float: left;
  131 + height: 100%;
  132 +}
  133 +
  134 +.line_config_content .body{
  135 + height: 100% !important;
  136 + overflow: auto;
  137 + color: rgb(48, 57, 66);
  138 + overflow: hidden;
  139 +}
  140 +
  141 +.left_station_route{
  142 + height: 100%;
  143 + width: 147px;
  144 + display: inline-block;
  145 + padding-top: 7px;
  146 +}
  147 +
  148 + .left_station_route ul{
  149 + list-style-type: none;
  150 + padding-left: 0;
  151 +}
  152 +
  153 +.left_station_route ul li{
  154 + -webkit-user-select: none;
  155 + margin: 8px 0;
  156 +}
  157 +
  158 +.left_station_route ul.list li:FIRST-CHILD {
  159 + margin-top: 0px;
  160 +}
  161 +
  162 +.left_station_route .tabbable-line ul li div{
  163 + padding-left: 10px;
  164 + display: block;
  165 + white-space: nowrap;
  166 + overflow: hidden;
  167 + text-overflow: ellipsis;
  168 +}
  169 +
  170 +.left_station_route .tabbable-line ul li div a{
  171 + color: #605f5f;
  172 + text-decoration: none;
  173 +}
  174 +
  175 +.left_station_route ul.list li:FIRST-CHILD div a{
  176 + cursor: default;
  177 + color: #bbbaba;
  178 +}
  179 +
  180 +.left_station_route .tabbable-line .tab-content{
  181 + height: 100% !important;
  182 + padding: 20px 0 0;
  183 +}
  184 +
  185 +rect.station_rect{
  186 + fill: #949595;
  187 + height: 24px;
  188 + rx: 3px;
  189 +}
  190 +
  191 +rect.f_rect{
  192 + height: 20px;
  193 + fill: #32c2a5;
  194 + rx: 3px;
  195 +}
  196 +
  197 +#lineConfigPanel #trafficChart svg text.f_text{
  198 + fill: #ffffff;
  199 +}
  200 +
  201 +.select2-container--open{
  202 + z-index: 100000000;
  203 +}
0 \ No newline at end of file 204 \ No newline at end of file
src/main/resources/static/pages/forecast/sample/js/svg.js 0 → 100644
  1 +var sampleSvg = (function(){
  2 +
  3 + var rowNum = 5
  4 + ,itemWidth = 240
  5 + , rowHeight = 130
  6 + , _count
  7 + , margin
  8 + , _opt
  9 + , svg
  10 + , _data;
  11 +
  12 + var stationMapp = {};
  13 + //路由
  14 + var routes;
  15 + //X比例尺
  16 + var scaleX = function(d, i){
  17 + var r = parseInt(i / rowNum)
  18 + ,x = (i % rowNum) * itemWidth;
  19 +
  20 + if(r % 2 != 0)
  21 + x = itemWidth * (rowNum - 1) - x ;
  22 + return x + margin;
  23 + }
  24 + //Y 比例尺
  25 + var scaleY = function(d, i){
  26 + return (parseInt(i / rowNum)) * rowHeight + 60;
  27 + };
  28 +
  29 + var dx = function(d){return d.cx;};
  30 + var dy = function(d){return d.cy;};
  31 + var text = function(d){return d.stationName;}
  32 + var transform = function(d, i){
  33 + var size = d.stationName.length
  34 + ,dx = size / 2 * 12
  35 + ,dy = -15;
  36 +
  37 + if((i + 1) % rowNum == 1 && i != 0)
  38 + dy += 40;
  39 + return 'translate(-'+dx+', '+dy+')';
  40 + }
  41 +
  42 + var line = d3.svg.line().x(function(d) {
  43 + return d.cx;
  44 + }).y(function(d) {
  45 + return d.cy;
  46 + });
  47 +
  48 + var dataId = function(d, i){
  49 + if(i >= _count - 1)
  50 + return null;
  51 + else
  52 + return _opt.rts[i + 1].stationCode;
  53 + }
  54 +
  55 + function draw(opt){
  56 + $('#trafficChart svg').remove();
  57 + svg = d3.select('#trafficChart').append('svg');
  58 + //容器宽度
  59 + var width = $('#trafficChart svg').width();
  60 + margin = (width - (rowNum - 1) * itemWidth) / 2;
  61 + var rts = opt.rts
  62 + _count = rts.length;
  63 + _opt = opt;
  64 + routes = rts;
  65 + //附加坐标
  66 + $.each(rts , function(i, obj){
  67 + obj.cx = scaleX(obj, i);
  68 + obj.cy = scaleY(obj, i);
  69 + stationMapp[obj.stationCode] = obj.stationName;
  70 + });
  71 +
  72 + //画线
  73 + svg.selectAll('path').data(rts)
  74 + .enter().append('path')
  75 + .attr('d', function(d, i){
  76 + if(i == _count - 1)
  77 + return;
  78 + return line([d, rts[i + 1]]);
  79 + })
  80 + .attr('data-id', dataId)
  81 + .attr('data-group', function(d, i){return dataId(d, i - 1) + '_' + dataId(null, i)})
  82 + .on('click', function(){popAddModal($(this).data('id'))});
  83 +
  84 + //画点
  85 + svg.selectAll('circle').data(rts)
  86 + .enter().append('circle')
  87 + .attr('cx', dx)
  88 + .attr('cy', dy)
  89 +
  90 + //站点名
  91 + drawText(rts);
  92 + //显示tags
  93 + showTags();
  94 + }
  95 +
  96 + $('#trafficChart').on('click', '.sample_tags a.tag', function(){
  97 + $('.sample_tags a.tag.active').removeClass('active');
  98 + $(this).addClass('active');
  99 + var tag = $(this).text();
  100 + clearRunTimeE();
  101 + //show
  102 + showRunTimeE(_data[tag])
  103 +
  104 + });
  105 +
  106 + function showRunTimeE(rs){
  107 + //改变path颜色
  108 + $.each(rs, function(){
  109 + var group = this.sStation + '_' + this.eStation
  110 + ,path = $('#trafficChart path[data-group='+group+']')
  111 + ,d = path.attr('d');
  112 + this.cp = analysePath(d);
  113 + path.attr('class', 'active')
  114 + .attr('data-sid', this.id);
  115 + });
  116 +
  117 + //背景
  118 + svg.selectAll('.f_rect')
  119 + .data(rs).enter().append('rect')
  120 + .attr('x', function(d){return d.cp[0]})
  121 + .attr('y', function(d){return d.cp[1]})
  122 + .attr('transform', 'translate(-4, -14)')
  123 + .attr('width', function(d){
  124 + return (d.runTime + '').length * 7 + 20;
  125 + })
  126 + .classed('f_rect', true);
  127 +
  128 + //时间text
  129 + svg.selectAll('.f_text')
  130 + .data(rs).enter().append('text')
  131 + .attr('x', function(d){return d.cp[0]})
  132 + .attr('y', function(d){return d.cp[1]})
  133 + .attr('class', 'f_text')
  134 + .text(function(d){return d.runTime + 'm'});
  135 + }
  136 +
  137 +
  138 + function clearRunTimeE(){
  139 + $('#trafficChart path.active').removeAttr('class');
  140 + $('.f_rect,.f_text').remove();
  141 + }
  142 +
  143 + function showTags(){
  144 + //查询 耗时信息
  145 + $.get('/sample/all', {'lineCode_eq': _opt.lineCode, 'updown_eq': _opt.updown}, function(rs){
  146 + //按tag分组数据
  147 + _data = {};
  148 + var tags = '';//
  149 + $.each(rs, function(i, d){
  150 + if(!_data[d.tag]){
  151 + _data[d.tag] = [];
  152 + tags += '<a class="tag">'+d.tag+'</a>';
  153 + }
  154 + _data[d.tag].push(d);
  155 + });
  156 + $('#trafficChart .sample_tags').html(tags);
  157 + //选中第一个tag
  158 + $('#trafficChart .sample_tags a.tag:eq(0)').click();
  159 + });
  160 + }
  161 +
  162 + function drawText(rts){
  163 + svg.selectAll('text').data(rts)
  164 + .enter().append('text')
  165 + .attr('x', dx)
  166 + .attr('y', dy)
  167 + .attr('transform', transform)
  168 + .text(text)
  169 + }
  170 +
  171 + var tagRange = {'早高峰': {s: '06:31', e: '08:30'}, '平峰': {s: '08:31', e: '16:00'}, '晚高峰': {s: '16:01', e: '18:00'}};
  172 + function popAddModal(id){
  173 + //var eid = id ,sid = prve(id);
  174 + //if(!sid)return;
  175 +
  176 + //var opts = {sid: sid, eid: eid, sName: stationMapp[sid], eName: stationMapp[eid]};
  177 + $.get('/pages/forecast/sample/modal.html', function(rs){
  178 + var index = layer.open({
  179 + type: 1,
  180 + area: '550px',
  181 + content: rs,
  182 + shift: 5,
  183 + // title: '...',
  184 + success: function(){
  185 + $('#forecast_sample_modal').trigger('init', {_opt: _opt, _data: _data, id: id});
  186 + /*$("#addSampleForm select[name=tag]").select2({
  187 + maximumSelectionLength: 1,
  188 + tags: true
  189 + })
  190 + .on('change', function(){
  191 + var t = $(this).val();
  192 + if(tagRange[t]){
  193 + $("#addSampleForm input[name=sDate]").val(tagRange[t].s);
  194 + $("#addSampleForm input[name=eDate]").val(tagRange[t].e);
  195 + }
  196 + });
  197 +
  198 + //提交
  199 + $('#addSampleForm .confirm').on('click', function(){
  200 + if(customFormValidate('#addSampleForm')){
  201 + console.log(_opt);
  202 + var param = $('#addSampleForm').serializeJSON();
  203 + param.lineCode = _opt.lineCode;
  204 + param.updown = _opt.updown;
  205 + $post('/sample', param, function(){layer.close(index);});
  206 + }
  207 + });*/
  208 + }
  209 + });
  210 + });
  211 + }
  212 +
  213 +
  214 + var drawObject = {
  215 + draw: draw ,
  216 + popAddModal: popAddModal
  217 + }
  218 +
  219 + //分析path d 路径中间点
  220 + function analysePath(d){
  221 + d = d.replace('M', '');
  222 + var sp = d.split('L')[0].split(',')
  223 + ,ep = d.split('L')[1].split(',')
  224 + ,cp = [];
  225 + sp[0] = parseInt(sp[0]);
  226 + sp[1] = parseInt(sp[1]);
  227 + ep[0] = parseInt(ep[0]);
  228 + ep[1] = parseInt(ep[1]);
  229 +
  230 + cp = sp;
  231 + var diff;
  232 + if(sp[0] != ep[0]){
  233 + diff = Math.abs(sp[0] - ep[0]) / 2 - 16;
  234 + cp[0] = sp[0] > ep[0]?ep[0]+diff:sp[0]+diff;
  235 + cp[1] -= 10;
  236 + }
  237 + else if(sp[1] != ep[1]){
  238 + diff = Math.abs(sp[1] - ep[1]) / 2;
  239 + cp[1] = sp[1] > ep[1]?ep[1]+diff:sp[1]+diff;
  240 +
  241 + cp[0] += 10;
  242 + }
  243 + return cp;
  244 + }
  245 +
  246 + /**
  247 + * 自定义表单校验
  248 + */
  249 + function customFormValidate(f){
  250 + var rs = true;
  251 + //所有可见的项
  252 + var es = $('input,select', f);
  253 +
  254 + for(var i = 0, e; e = es[i++];){
  255 + if($(e).attr('required') && ( $(e).val() == null || $(e).val() == '')){
  256 + if($(e).hasClass('select2-hidden-accessible'))
  257 + $(e).next().find('.select2-selection').addClass('custom-val-error');
  258 + else
  259 + $(e).addClass('custom-val-error');
  260 + rs = false;
  261 + }
  262 + else{
  263 + if($(e).hasClass('select2-hidden-accessible'))
  264 + $(e).next().find('.select2-selection').removeClass('custom-val-error');
  265 + else
  266 + $(e).removeClass('custom-val-error');
  267 + }
  268 + }
  269 +
  270 + if(!rs){
  271 + layer.alert('数据完整性校验失败,请检查输入项', {icon: 2, title: '操作失败', shift: 5});
  272 + }
  273 + return rs;
  274 + }
  275 + return drawObject;
  276 +})();
0 \ No newline at end of file 277 \ No newline at end of file