Commit bff0718aa2a8d5c48416b62a10eb4e886ecd97e4

Authored by 潘钊
2 parents c6de4555 52cf1396

Merge branch 'pudong' into jiading 0307

Showing 59 changed files with 1915 additions and 1308 deletions

Too many changes to show.

To preserve performance only 59 of 116 files are displayed.

src/main/java/com/bsth/XDApplication.java
... ... @@ -161,7 +161,7 @@ public class XDApplication implements CommandLineRunner {
161 161 sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线
162 162 sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程
163 163 sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库
164   - sexec.scheduleWithFixedDelay(directivesPstThread, 180, 120, TimeUnit.SECONDS);//调度指令延迟入库
  164 + sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库
165 165 sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
166 166 sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据
167 167 sexec.scheduleWithFixedDelay(basicDataLoader, 2, 2, TimeUnit.HOURS);//基础数据更新
... ...
src/main/java/com/bsth/controller/SectionRouteController.java
... ... @@ -37,14 +37,22 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer
37 37 SectionRouteService routeService;
38 38  
39 39 /**
40   - * @param String
  40 + * @param map
41 41 * @throws
42 42 * @Description: TODO(批量撤销路段)
43 43 */
44   - @RequestMapping(value = "/batchDestroy", method = RequestMethod.GET)
  44 + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST)
45 45 public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) {
46 46 return routeService.updateSectionRouteInfoFormId(map);
47 47 }
  48 + /**
  49 + * @param id //路段路由id
  50 + * @Description: TODO(撤销路段)
  51 + */
  52 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  53 + public Map<String, Object> destroy(@RequestParam Integer id) {
  54 + return routeService.destroy(id);
  55 + }
48 56  
49 57 /**
50 58 * @param @param map
... ...
src/main/java/com/bsth/controller/StationRouteController.java
... ... @@ -137,6 +137,18 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
137 137 public List<Map<String, Object>> getStationRouteCenterPoints(@RequestParam Map<String, Object> map) {
138 138 return service.getStationRouteCenterPoints(map);
139 139 }
  140 +
  141 + /**
  142 + * @Description :TODO(查询线路某方向下所有站点)
  143 + *
  144 + * @param map <lineId:线路ID; direction:方向>
  145 + *
  146 + * @return List<Map<String, Object>>
  147 + */
  148 + @RequestMapping(value = "/getStationRouteList" , method = RequestMethod.GET)
  149 + public List<Map<String, Object>> getStationRouteList(@RequestParam Map<String, Object> map) {
  150 + return service.getStationRouteList(map);
  151 + }
140 152  
141 153 /**
142 154 * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
... ...
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java renamed to src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
1   -package com.bsth.controller.realcontrol;
2   -
3   -import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
4   -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
5   -import com.bsth.data.msg_queue.DirectivePushQueue;
6   -import com.bsth.data.msg_queue.WebSocketPushQueue;
7   -import com.bsth.data.schedule.DayOfSchedule;
8   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
9   -import org.slf4j.Logger;
10   -import org.slf4j.LoggerFactory;
11   -import org.springframework.beans.factory.annotation.Autowired;
12   -import org.springframework.web.bind.annotation.RequestMapping;
13   -import org.springframework.web.bind.annotation.RequestMethod;
14   -import org.springframework.web.bind.annotation.RequestParam;
15   -import org.springframework.web.bind.annotation.RestController;
16   -
17   -import java.util.HashMap;
18   -import java.util.List;
19   -import java.util.Map;
20   -
21   -/**
22   - * Created by panzhao on 2017/4/14.
23   - */
24   -@RestController
25   -@RequestMapping("anomalyCheck")
26   -public class anomalyCheckController {
27   -
28   -
29   - Logger logger = LoggerFactory.getLogger(this.getClass());
30   -
31   - @Autowired
32   - DayOfSchedule dayOfSchedule;
33   -
34   - @Autowired
35   - GeoCacheData geoCacheData;
36   -
37   - /**
38   - * 出现重复班次的车辆
39   - * @param nbbm
40   - */
41   - @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)
42   - public void schRepeat(@RequestParam String nbbm){
43   - logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");
44   - List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);
45   - logger.info("检测前,车辆班次数量:" + list.size());
46   -
47   - Map<Long, ScheduleRealInfo> map = new HashMap<>();
48   - for(ScheduleRealInfo sch : list){
49   - if(map.containsKey(sch.getId())){
50   - logger.info("检测到重复ID: " + sch.getId());
51   - }
52   - map.put(sch.getId(), sch);
53   - }
54   -
55   - logger.info("检测后,车辆班次数量:" + list.size());
56   - if(map.values().size() > 0){
57   - dayOfSchedule.replaceByNbbm(nbbm, map.values());
58   - }
59   - }
60   -
61   - @RequestMapping(value = "/directivePushQueue")
62   - public void directivePushQueue(){
63   - DirectivePushQueue.start();
64   - }
65   -
66   - @RequestMapping(value = "/directiveQueueSize")
67   - public void directiveQueueSize(){
68   - DirectivePushQueue.size();
69   - }
70   -
71   - @RequestMapping(value = "/webSocketPushQueue")
72   - public void webSocketPushQueue(){
73   - WebSocketPushQueue.start();
74   - }
75   -
76   - @RequestMapping(value = "/webSocketQueueSize")
77   - public void webSocketQueueSize(){
78   - WebSocketPushQueue.size();
79   - }
80   -
81   - @RequestMapping(value = "/setHttpFlag")
82   - public void setHttpFlag(@RequestParam int flag){
83   - if(flag != 0 && flag != -1)
84   - return;
85   - GpsDataLoaderThread.setFlag(flag);
86   - }
87   -
88   - @RequestMapping(value = "/updateCacheBuff")
89   - public void updateCacheBuff(){
90   - geoCacheData.loadData();
91   - }
92   -
93   - @RequestMapping(value = "/reCalcLpSch")
94   - public void reCalcLpSch(){
95   - dayOfSchedule._test_reCalcLpSch();
96   - }
97   -
98   - @RequestMapping(value = "/findSchByLpName")
99   - public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){
100   - return dayOfSchedule.getLpScheduleMap().get(lpName);
101   - }
102   -
103   - @RequestMapping(value = "/findSchByNbbm")
104   - public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm){
105   - return dayOfSchedule.findByNbbm(nbbm);
106   - }
107   -
108   - @RequestMapping(value = "/removeExecPlan")
109   - public int removeExecPlan(@RequestParam String nbbm){
110   - dayOfSchedule.removeExecPlan(nbbm);
111   - return 1;
112   - }
113   -
114   - @RequestMapping(value = "/sch_re_calc_id_maps")
115   - public int reCalcIdMaps(){
116   - return dayOfSchedule.reCalcIdMaps();
117   - }
118   -
119   - @RequestMapping(value = "/sch_size_string")
120   - public String schSizeString(){
121   - return dayOfSchedule.sizeString();
122   - }
123   -}
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.data.directive.DayOfDirectives;
  4 +import com.bsth.data.directive.DirectivesPstThread;
  5 +import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  6 +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
  7 +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
  8 +import com.bsth.data.msg_queue.DirectivePushQueue;
  9 +import com.bsth.data.msg_queue.WebSocketPushQueue;
  10 +import com.bsth.data.pilot80.PilotReport;
  11 +import com.bsth.data.schedule.DayOfSchedule;
  12 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  13 +import com.bsth.websocket.handler.SendUtils;
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.web.bind.annotation.RequestMapping;
  18 +import org.springframework.web.bind.annotation.RequestParam;
  19 +import org.springframework.web.bind.annotation.RestController;
  20 +
  21 +import java.util.HashMap;
  22 +import java.util.List;
  23 +import java.util.Map;
  24 +
  25 +/**
  26 + * Created by panzhao on 2017/4/14.
  27 + */
  28 +@RestController
  29 +@RequestMapping("adminUtils")
  30 +public class AdminUtilsController {
  31 +
  32 +
  33 + Logger logger = LoggerFactory.getLogger(this.getClass());
  34 +
  35 + @Autowired
  36 + DayOfSchedule dayOfSchedule;
  37 +
  38 + @Autowired
  39 + GeoCacheData geoCacheData;
  40 +
  41 + @Autowired
  42 + DayOfDirectives dayOfDirectives;
  43 +
  44 + @Autowired
  45 + SendUtils sendUtils;
  46 +
  47 + @Autowired
  48 + PilotReport pilotReport;
  49 +
  50 + /**
  51 + * 出现重复班次的车辆
  52 + * @param
  53 +
  54 + @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)
  55 + public void schRepeat(@RequestParam String nbbm){
  56 + logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");
  57 + List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);
  58 + logger.info("检测前,车辆班次数量:" + list.size());
  59 +
  60 + Map<Long, ScheduleRealInfo> map = new HashMap<>();
  61 + for(ScheduleRealInfo sch : list){
  62 + if(map.containsKey(sch.getId())){
  63 + logger.info("检测到重复ID: " + sch.getId());
  64 + }
  65 + map.put(sch.getId(), sch);
  66 + }
  67 +
  68 + logger.info("检测后,车辆班次数量:" + list.size());
  69 + if(map.values().size() > 0){
  70 + dayOfSchedule.replaceByNbbm(nbbm, map.values());
  71 + }
  72 + }*/
  73 +
  74 +/* @RequestMapping(value = "/directivePushQueue")
  75 + public void directivePushQueue(){
  76 + DirectivePushQueue.start();
  77 + }*/
  78 +
  79 + @RequestMapping(value = "/directiveQueueSize")
  80 + public void directiveQueueSize(){
  81 + DirectivePushQueue.size();
  82 + }
  83 +
  84 + /*@RequestMapping(value = "/webSocketPushQueue")
  85 + public void webSocketPushQueue(){
  86 + WebSocketPushQueue.start();
  87 + }*/
  88 +
  89 + @RequestMapping(value = "/webSocketQueueSize")
  90 + public void webSocketQueueSize(){
  91 + WebSocketPushQueue.size();
  92 + }
  93 +
  94 + @RequestMapping(value = "/setHttpFlag")
  95 + public void setHttpFlag(@RequestParam int flag){
  96 + if(flag != 0 && flag != -1)
  97 + return;
  98 + GpsDataLoaderThread.setFlag(flag);
  99 + }
  100 +
  101 + @RequestMapping(value = "/updateCacheBuff")
  102 + public void updateCacheBuff(){
  103 + geoCacheData.loadData();
  104 + }
  105 +
  106 + @RequestMapping(value = "/reCalcLpSch")
  107 + public void reCalcLpSch(){
  108 + dayOfSchedule._test_reCalcLpSch();
  109 + }
  110 +
  111 + @RequestMapping(value = "/findSchByLpName")
  112 + public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){
  113 + return dayOfSchedule.getLpScheduleMap().get(lpName);
  114 + }
  115 +
  116 + @RequestMapping(value = "/findSchByNbbm")
  117 + public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm){
  118 + return dayOfSchedule.findByNbbm(nbbm);
  119 + }
  120 +
  121 + @RequestMapping(value = "/removeExecPlan")
  122 + public int removeExecPlan(@RequestParam String nbbm){
  123 + dayOfSchedule.removeExecPlan(nbbm);
  124 + return 1;
  125 + }
  126 +
  127 + @RequestMapping(value = "/sch_re_calc_id_maps")
  128 + public int reCalcIdMaps(){
  129 + return dayOfSchedule.reCalcIdMaps();
  130 + }
  131 +
  132 + @RequestMapping(value = "/sch_size_string")
  133 + public String schSizeString(){
  134 + return dayOfSchedule.sizeString();
  135 + }
  136 +
  137 + @RequestMapping(value = "/containerSize")
  138 + public Map<String, Integer> containerSize(){
  139 + Map<String, Integer> rs = new HashMap<>();
  140 + rs.put("60_size", dayOfDirectives.all60().size());
  141 + rs.put("80_size", pilotReport.findAll().size());
  142 + rs.put("nbbm_sch_size", dayOfSchedule.findAll().size());
  143 + rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size());
  144 + rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size());
  145 + rs.put("pst_sch_size", dayOfSchedule.getPstSize());
  146 + rs.put("speeds_size", OverspeedProcess.size());
  147 + return rs;
  148 + }
  149 +
  150 + @RequestMapping(value = "/websocketRadioText")
  151 + public int radioText(String t, String lineCode){
  152 + sendUtils.sendRadioText(t, lineCode);
  153 + return 0;
  154 + }
  155 +
  156 + @Autowired
  157 + DirectivesPstThread directivesPstThread;
  158 +
  159 + @RequestMapping(value = "/_sd_60_pst")
  160 + public void sd_60_pst(){
  161 + logger.info("手动入库指令....");
  162 + directivesPstThread.run();
  163 + }
  164 +}
124 165 \ No newline at end of file
... ...
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
... ... @@ -194,15 +194,10 @@ public class ServiceDataInterface {
194 194 int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60));
195 195 d60.setHttpCode(code);
196 196  
197   - if (code == 0) {
198   - // 添加到缓存
199   - dayOfDirectives.put60(d60, true);
200   - } else {
  197 + if (code != 0)
201 198 d60.setErrorText("网关通讯失败, code: " + code);
202   - d60Repository.save(d60);
203   - dayOfDirectives.put60(d60, false);
204   - }
205 199  
  200 + dayOfDirectives.put60(d60);
206 201 return d60.getMsgId();
207 202 }catch (Exception e){
208 203 logger.error("", e);
... ...
src/main/java/com/bsth/data/directive/DayOfDirectives.java
... ... @@ -16,6 +16,8 @@ import org.springframework.stereotype.Component;
16 16  
17 17 import java.util.*;
18 18 import java.util.concurrent.ConcurrentHashMap;
  19 +import java.util.concurrent.ConcurrentLinkedQueue;
  20 +import java.util.concurrent.ConcurrentMap;
19 21  
20 22 /**
21 23 *
... ... @@ -29,16 +31,15 @@ import java.util.concurrent.ConcurrentHashMap;
29 31 public class DayOfDirectives {
30 32  
31 33 // 当日60指令缓存
32   - private static Map<Integer, D60> d60Map;
  34 + private static ConcurrentMap<Integer, D60> d60Map;
33 35  
34 36 // 线路切换指令 64
35   - public static Map<String, D64> d64Map;
36   -
37   - //等待C0_A4回复的用户
38   - //public static Map<K, V>
  37 + public static ConcurrentMap<String, D64> d64Map;
39 38  
40   - //等待入库的指令
41   - public static LinkedList<Directive> pstDirectives;
  39 + //等待插入的指令
  40 + public static ConcurrentLinkedQueue<Directive> pstDirectives;
  41 + //等待更新的指令
  42 + public static ConcurrentLinkedQueue<D60> pstD60s;
42 43  
43 44 @Autowired
44 45 DirectiveService directiveService;
... ... @@ -55,14 +56,14 @@ public class DayOfDirectives {
55 56 static{
56 57 d60Map = new ConcurrentHashMap<>();
57 58 d64Map = new ConcurrentHashMap<>();
58   - pstDirectives = new LinkedList<>();
  59 + pstDirectives = new ConcurrentLinkedQueue<>();
  60 + pstD60s = new ConcurrentLinkedQueue<>();
59 61 }
60 62  
61   - public void put60(D60 d60, boolean pst) {
  63 + public void put60(D60 d60) {
62 64 d60Map.put(d60.getMsgId(), d60);
63 65 //等待持久化
64   - if(pst)
65   - pstDirectives.add(d60);
  66 + pstDirectives.add(d60);
66 67 }
67 68  
68 69 public void put64(D64 d64) {
... ... @@ -102,9 +103,9 @@ public class DayOfDirectives {
102 103 d60.setReply47Time(System.currentTimeMillis());
103 104 break;
104 105 }
105   - // 等待持久化
106   - if(!pstDirectives.contains(d60))
107   - pstDirectives.add(d60);
  106 +
  107 + //更新60数据
  108 + pstD60s.add(d60);
108 109  
109 110 ScheduleRealInfo sch = d60.getSch();
110 111 if (null == sch)
... ... @@ -135,64 +136,20 @@ public class DayOfDirectives {
135 136 if (null == data)
136 137 logger.warn("64响应 data is null ,json: " + json);
137 138 else {
138   - d64.setRespAck(data.getShort("requestAck"));
139   - // 持久化
140   - if(!pstDirectives.contains(d64))
141   - pstDirectives.add(d64);
  139 + logger.info(d64.getDeviceId() + "_" + d64.getData().getLineId() + "响应:" + data.getShort("requestAck"));
  140 + /*d64.setRespAck(data.getShort("requestAck"));
  141 + // 持久化*/
  142 + //64 响应不入库了...
142 143 }
143 144 }
144 145 }
145 146  
146   -/* private void saveD60(D60 d60) {
147   - // 等47再入库
148   - if (d60.getReply47() == null)
149   - return;
150   -
151   - directiveService.save(d60);
152   - }*/
153   -
154   - public void clear(String device){
155   - int c60 = 0, c64 = 0;
156   -
157   - Collection<D60> d60s = d60Map.values();
158   - List<D60> rem60List = new ArrayList<>();
159   - for(D60 d60 : d60s){
160   - if(device.equals(d60.getDeviceId()))
161   - rem60List.add(d60);
162   - }
163   -
164   - //清除60数据
165   - for(D60 d60 : rem60List){
166   - if(d60.getReply47() == null)
167   - directiveService.save(d60);
168   - if(null != d60Map.remove(d60.getMsgId()))
169   - c60 ++;
170   - }
171   -
172   - rem60List.clear();
173   - if(c60 > 0)
174   - logger.info("清除60数据 ," + c60);
175   -
176   - //找到该设备的64数据
177   - Collection<D64> d64s = d64Map.values();
178   - List<D64> rem64List = new ArrayList<>();
179   - for(D64 d64 : d64s){
180   - if(device.equals(d64.getDeviceId()))
181   - rem64List.add(d64);
182   - }
183   -
184   - //清除64数据
185   - for(D64 d64 : rem64List){
186   - if(d64.getRespAck() == null)
187   - directiveService.save64(d64);
188   -
189   - if(null != d64Map.remove(d64.getKey()))
190   - c64 ++;
191   - }
192   -
193   - rem64List.clear();
194   - if(c64 > 0)
195   - logger.info("清除64数据 ," + c64);
  147 + @Autowired
  148 + DirectivesPstThread directivesPstThread;
  149 + public void clearAll(){
  150 + d60Map = new ConcurrentHashMap<>();
  151 + d64Map = new ConcurrentHashMap<>();
  152 + logger.info("清除指令数据 ,,,");
196 153 }
197 154  
198 155 public Collection<D60> all60(){
... ...
src/main/java/com/bsth/data/directive/DirectiveCreator.java
... ... @@ -81,7 +81,7 @@ public class DirectiveCreator {
81 81 }
82 82  
83 83  
84   - public D60 createD60_01(String nbbm, String text, int upDown, int state, Date alarmTime){
  84 + public D60 createD60_02(String nbbm, String text, int upDown, int state, Date alarmTime){
85 85 SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm");
86 86  
87 87 Long timestamp = System.currentTimeMillis();
... ... @@ -102,7 +102,7 @@ public class DirectiveCreator {
102 102 directive.setMsgId(msgId);
103 103 // 构造数据
104 104 data.setDeviceId(deviceId);
105   - data.setDispatchInstruct((short) 0x01);
  105 + data.setDispatchInstruct((short) 0x02);
106 106 data.setTimestamp(timestamp);
107 107 data.setCompanyCode(company);
108 108 data.setMsgId(msgId);
... ...
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
1 1 package com.bsth.data.directive;
2 2  
  3 +import com.alibaba.fastjson.JSON;
3 4 import com.bsth.data.schedule.DayOfSchedule;
4 5 import com.bsth.entity.directive.D60;
5 6 import com.bsth.entity.directive.D64;
6 7 import com.bsth.entity.directive.Directive;
7   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
8 8 import com.bsth.repository.directive.D60Repository;
9 9 import com.bsth.repository.directive.D64Repository;
10 10 import org.joda.time.format.DateTimeFormat;
... ... @@ -12,9 +12,20 @@ import org.joda.time.format.DateTimeFormatter;
12 12 import org.slf4j.Logger;
13 13 import org.slf4j.LoggerFactory;
14 14 import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  16 +import org.springframework.jdbc.core.JdbcTemplate;
  17 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
15 18 import org.springframework.stereotype.Component;
  19 +import org.springframework.transaction.TransactionDefinition;
  20 +import org.springframework.transaction.TransactionStatus;
  21 +import org.springframework.transaction.support.DefaultTransactionDefinition;
16 22  
17   -import java.util.LinkedList;
  23 +import java.sql.PreparedStatement;
  24 +import java.sql.SQLException;
  25 +import java.sql.Types;
  26 +import java.util.ArrayList;
  27 +import java.util.List;
  28 +import java.util.concurrent.ConcurrentLinkedQueue;
18 29  
19 30 /**
20 31 * 指令持久化线程
... ... @@ -34,40 +45,258 @@ public class DirectivesPstThread extends Thread {
34 45 @Autowired
35 46 DayOfSchedule dayOfSchedule;
36 47  
  48 + @Autowired
  49 + JdbcTemplate jdbcTemplate;
  50 +
37 51 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
38 52  
39 53 @Override
40 54 public void run() {
  55 + try{
  56 + ConcurrentLinkedQueue<Directive> list = DayOfDirectives.pstDirectives;
41 57  
42   - LinkedList<Directive> list = DayOfDirectives.pstDirectives;
43   -
44   - Directive directive;
45   - for (int i = 0; i < 1000; i++) {
46   - try {
  58 + List<D60> d60s = new ArrayList<>();
  59 + List<D64> d64s = new ArrayList<>();
  60 + //按 60 和 64 分组
  61 + Directive directive;
  62 + D60 d60;
  63 + for (int i = 0; i < 2000; i++) {
47 64 directive = list.poll();
48 65 if(null == directive)
49 66 break;
  67 +
50 68 //日期
51 69 directive.setRq(fmtyyyyMMdd.print(directive.getTimestamp()));
  70 +
52 71 if (directive instanceof D60) {
53   - D60 d60 = (D60) directive;
54   - if(d60.isDispatch()){
55   - ScheduleRealInfo sch = d60.getSch();
56   - //如果关联的班次已经不存在了,放弃入库
57   - if(sch.isDeleted()){
58   - logger.warn("save 指令,发现 deleted=true 的班次,id=" + sch.getId());
59   - continue;
60   - }
61   - }
62   - d60Repository.save(d60);
  72 + d60 = (D60) directive;
  73 + if(isDelete(d60))
  74 + continue;
  75 + d60s.add(d60);
  76 + }
  77 + else if(directive instanceof D64)
  78 + d64s.add((D64) directive);
  79 + }
  80 +
  81 + //入库60
  82 + save60(d60s);
  83 + //入库64
  84 + save64(d64s);
  85 +
  86 +
  87 + // 60 指令更新(车载响应)
  88 + ConcurrentLinkedQueue<D60> updateD60s = DayOfDirectives.pstD60s;
  89 + d60s = new ArrayList<>();
  90 + for (int i = 0; i < 2000; i++) {
  91 + d60 = updateD60s.poll();
  92 + if(null == d60)
  93 + break;
  94 + d60s.add(d60);
  95 + }
  96 +
  97 + if(d60s.size() > 0)
  98 + update60(d60s);
  99 + }catch (Exception e){
  100 + logger.error("指令入库出现异常", e);
  101 + }
  102 + }
  103 +
  104 + private void save64(final List<D64> d64s) {
  105 + if(null == d64s || d64s.size() == 0)
  106 + return;
  107 +
  108 + String sql = "insert into bsth_v_directive_64(device_id,error_text,http_code,oper_code,rq,sender,timestamp,city_code,line_id,txt_content,resp_ack) " +
  109 + " values(?,?,?,?,?,?,?,?,?,?,?)";
  110 +
  111 + //编程式事务
  112 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  113 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  114 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  115 + TransactionStatus status = tran.getTransaction(def);
  116 +
  117 + try{
  118 + jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
  119 + @Override
  120 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  121 + D64 d64 = d64s.get(i);
  122 + ps.setString(1 , d64.getDeviceId());
  123 + ps.setString(2, isNvl(d64.getErrorText()));
  124 + ps.setInt(3, d64.getHttpCode());
  125 + ps.setShort(4, isNvl(d64.getOperCode()));
  126 + ps.setString(5, d64.getRq());
  127 +
  128 + ps.setString(6, isNvl(d64.getSender()));
  129 + ps.setLong(7, d64.getTimestamp());
  130 +
  131 + ps.setShort(8, isNvl(d64.getData().getCityCode()));
  132 + ps.setString(9, isNvl(d64.getData().getLineId()));
  133 + ps.setString(10, isNvl(d64.getData().getTxtContent()));
  134 + ps.setShort(11, isNvl(d64.getRespAck()));
  135 + }
  136 +
  137 + @Override
  138 + public int getBatchSize() {
  139 + return d64s.size();
63 140 }
  141 + });
  142 +
  143 + tran.commit(status);
  144 +
  145 + logger.info("64 入库成功: " + d64s.size());
  146 + }catch (Exception e){
  147 + tran.rollback(status);
  148 + logger.error("", e);
  149 + logger.warn("失败的数据:" + JSON.toJSONString(d64s));
  150 + }
  151 + }
  152 +
  153 + private void update60(final List<D60> d60s) {
  154 + if(null == d60s || d60s.size() == 0)
  155 + return;
  156 +
  157 + String sql = "update bsth_v_directive_60 set reply46=?,reply46time=?,reply47=?,reply47time=? where device_id=? and timestamp=? and msg_id=?";
  158 +
  159 + //编程式事务
  160 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  161 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  162 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  163 + TransactionStatus status = tran.getTransaction(def);
  164 +
  165 + try{
  166 + jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
  167 + @Override
  168 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  169 + D60 d60 = d60s.get(i);
  170 + ps.setShort(1, isNvl(d60.getReply46()));
  171 + if(null == d60.getReply46Time())
  172 + ps.setNull(2, Types.BIGINT);
  173 + else
  174 + ps.setLong(2, d60.getReply46Time());
  175 +
  176 + ps.setShort(3, isNvl(d60.getReply47()));
64 177  
65   - if (directive instanceof D64) {
66   - d64Repository.save((D64) directive);
  178 + if(null == d60.getReply47Time())
  179 + ps.setNull(4, Types.BIGINT);
  180 + else
  181 + ps.setLong(4, d60.getReply47Time());
  182 + ps.setString(5, d60.getDeviceId());
  183 + ps.setLong(6, d60.getTimestamp());
  184 + ps.setInt(7, d60.getMsgId());
67 185 }
68   - } catch (Exception e) {
69   - logger.error("", e);
  186 +
  187 + @Override
  188 + public int getBatchSize() {
  189 + return d60s.size();
  190 + }
  191 + });
  192 +
  193 + tran.commit(status);
  194 +
  195 + logger.info("60 更新成功: " + d60s.size());
  196 + }catch (Exception e){
  197 + tran.rollback(status);
  198 + logger.error("", e);
  199 + logger.warn("失败的数据:" + JSON.toJSONString(d60s));
  200 + }
  201 + }
  202 +
  203 + private void save60(final List<D60> d60s) {
  204 + if(null == d60s || d60s.size() == 0)
  205 + return;
  206 +
  207 + String sql = "insert into bsth_v_directive_60(device_id,error_text,http_code,oper_code,rq,sender,timestamp" +
  208 + ",alarm_time,company_code,dispatch_instruct,instruct_type,msg_id,service_state,txt_content,is_dispatch" +
  209 + ",line_code,reply46,reply46time,reply47,reply47time,sch) " +
  210 + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  211 +
  212 + //编程式事务
  213 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  214 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  215 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  216 + TransactionStatus status = tran.getTransaction(def);
  217 +
  218 + try{
  219 + jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
  220 + @Override
  221 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  222 + D60 d60 = d60s.get(i);
  223 + ps.setString(1, d60.getDeviceId());
  224 + ps.setString(2, isNvl(d60.getErrorText()));
  225 + ps.setInt(3, d60.getHttpCode());
  226 + ps.setShort(4, d60.getOperCode());
  227 + ps.setString(5, d60.getRq());
  228 + ps.setString(6, d60.getSender());
  229 + ps.setLong(7, d60.getTimestamp());
  230 +
  231 + ps.setLong(8, isNvl(d60.getData().getAlarmTime()));
  232 + ps.setShort(9, isNvl(d60.getData().getCompanyCode()));
  233 + ps.setShort(10, isNvl(d60.getData().getDispatchInstruct()));
  234 + ps.setInt(11, d60.getData().getInstructType());
  235 + ps.setInt(12, d60.getData().getMsgId());
  236 + ps.setLong(13, d60.getData().getServiceState());
  237 + ps.setString(14, d60.getData().getTxtContent());
  238 + ps.setBoolean(15, d60.isDispatch());
  239 +
  240 + ps.setString(16, isNvl(d60.getLineCode()));
  241 + ps.setShort(17, isNvl(d60.getReply46()));
  242 +
  243 + if(null == d60.getReply46Time())
  244 + ps.setNull(18, Types.BIGINT);
  245 + else
  246 + ps.setLong(18, d60.getReply46Time());
  247 +
  248 + ps.setShort(19, isNvl(d60.getReply47()));
  249 +
  250 + if(null == d60.getReply47Time())
  251 + ps.setNull(20, Types.BIGINT);
  252 + else
  253 + ps.setLong(20, d60.getReply47Time());
  254 +
  255 + if(d60.getSch()==null)
  256 + ps.setNull(21, Types.BIGINT);
  257 + else
  258 + ps.setLong(21, d60.getSch().getId());
  259 + }
  260 +
  261 + @Override
  262 + public int getBatchSize() {
  263 + return d60s.size();
  264 + }
  265 + });
  266 +
  267 + tran.commit(status);
  268 +
  269 + logger.info("60 入库成功: " + d60s.size());
  270 + }catch (Exception e){
  271 + tran.rollback(status);
  272 + logger.error("", e);
  273 + logger.warn("失败的数据:" + JSON.toJSONString(d60s));
  274 + }
  275 + }
  276 +
  277 + private String isNvl(String v) {
  278 + return v==null?"":v;
  279 + }
  280 +
  281 + private short isNvl(Short v) {
  282 + return v==null?0:v;
  283 + }
  284 +
  285 + private long isNvl(Long v) {
  286 + return v==null?0:v;
  287 + }
  288 +
  289 + private boolean isDelete(D60 d60){
  290 + try{
  291 + //如果关联的班次已经不存在了,放弃入库,很低概率出现
  292 + if(d60.isDispatch() && d60.getSch().isDeleted()){
  293 + logger.warn("save 指令,发现 deleted=true 的班次,id=" + d60.getSch().getId());
  294 + return true;
70 295 }
  296 + }catch (Exception e){
  297 + logger.error("", e);
71 298 }
  299 +
  300 + return false;
72 301 }
73 302 }
... ...
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
... ... @@ -32,8 +32,8 @@ public class GatewayHttpUtils {
32 32 httpClient = HttpClients.createDefault();
33 33 post = new HttpPost(url);
34 34 requestConfig = RequestConfig.custom()
35   - .setConnectTimeout(2000).setConnectionRequestTimeout(1000)
36   - .setSocketTimeout(2000).build();
  35 + .setConnectTimeout(3000).setConnectionRequestTimeout(2000)
  36 + .setSocketTimeout(3000).build();
37 37 post.setConfig(requestConfig);
38 38 }
39 39  
... ... @@ -48,9 +48,7 @@ public class GatewayHttpUtils {
48 48  
49 49 int statusCode = response.getStatusLine().getStatusCode();
50 50 if(statusCode != 200){
51   - //post.abort();
52 51 logger.error("http client status code: " + statusCode);
53   - //return code;
54 52 }
55 53  
56 54 JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
... ...
src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
... ... @@ -124,6 +124,8 @@ public class GpsRealData {
124 124 */
125 125 public List<GpsEntity> getByLine(String lineCode) {
126 126 NavigableSet<String> set = lineCode2Devices.get(lineCode);//实际车载
  127 + if(null == set)
  128 + set = new TreeSet();
127 129 Set<String> nbbmSet = dayOfSchedule.findCarByLineCode(lineCode);//计划用车
128 130  
129 131 Map<String, String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
... ...
src/main/java/com/bsth/data/gpsdata_v2/entity/GpsEntity.java
... ... @@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
13 13 public class GpsEntity implements Cloneable{
14 14  
15 15 /** 公司代码 */
  16 + @JsonIgnore
16 17 private Short companyCode;
17 18  
18 19 /** 线路编码 */
... ... @@ -31,6 +32,7 @@ public class GpsEntity implements Cloneable{
31 32 private String stationName;
32 33  
33 34 /** 到站时间 */
  35 + @JsonIgnore
34 36 private long arrTime;
35 37  
36 38 /** 经度 */
... ... @@ -56,6 +58,12 @@ public class GpsEntity implements Cloneable{
56 58  
57 59 /** 上下行(0 上行 , 1 下行 , -1 无效) */
58 60 private Byte upDown;
  61 +
  62 + /**
  63 + * 设备原始走向_营运状态
  64 + * 当设备状态和系统不一致时,该字段有值
  65 + */
  66 + private String origStateStr;
59 67  
60 68 /** 车辆内部编码 */
61 69 private String nbbm;
... ... @@ -379,4 +387,12 @@ public class GpsEntity implements Cloneable{
379 387 public void setPlanCode(String planCode) {
380 388 this.planCode = planCode;
381 389 }
  390 +
  391 + public String getOrigStateStr() {
  392 + return origStateStr;
  393 + }
  394 +
  395 + public void setOrigStateStr(String origStateStr) {
  396 + this.origStateStr = origStateStr;
  397 + }
382 398 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/GpsStateProcess.java
... ... @@ -7,6 +7,9 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
7 7 import org.springframework.beans.factory.annotation.Autowired;
8 8 import org.springframework.stereotype.Component;
9 9  
  10 +import java.util.concurrent.ConcurrentHashMap;
  11 +import java.util.concurrent.ConcurrentMap;
  12 +
10 13 /**
11 14 * GPS 状态处理
12 15 * Created by panzhao on 2017/11/15.
... ... @@ -20,6 +23,13 @@ public class GpsStateProcess {
20 23 @Autowired
21 24 GpsStatusManager gpsStatusManager;
22 25  
  26 + /**
  27 + * 设置状态差异连续次数
  28 + */
  29 + private static ConcurrentMap<String, Integer> stateDiffMap = new ConcurrentHashMap<>();
  30 +
  31 + private final static int CHANGE_THRESHOLD = 2;
  32 +
23 33 public void process(GpsEntity gps) {
24 34 //在执行的任务
25 35 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
... ... @@ -27,16 +37,40 @@ public class GpsStateProcess {
27 37 if (null == sch)
28 38 return;
29 39  
30   - byte upDown = Byte.parseByte(sch.getXlDir());
  40 + int upDown = Integer.parseInt(sch.getXlDir());
31 41 int schState = dayOfSchedule.emptyService(sch)?1:0;
32   -
  42 + String device = gps.getDeviceId();
  43 + /**
  44 + * 网关在进终点的时候,会直接将当前点位状态改变
  45 + * 为避免出现单个点的状态跳动,设置一下切换阈值
  46 + */
33 47 if(gps.getState() != schState || gps.getUpDown() != upDown){
34   - //下发指令纠正车载的 营运状态 和 走向
35   - gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, schState, "同步@系统");
  48 + Integer count = 0;
  49 + if(stateDiffMap.containsKey(device))
  50 + count = stateDiffMap.get(device);
  51 +
  52 + count ++;
  53 +
  54 + if(count >= CHANGE_THRESHOLD){
  55 + //下发指令纠正车载的 营运状态 和 走向
  56 + gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, schState, "同步@系统");
  57 + count = 0;
  58 + }
  59 +
  60 + stateDiffMap.put(device, count);
  61 +
  62 + //记录原始设备状态
  63 + gps.setOrigStateStr(gps.getUpDown() + "_" + gps.getState());
36 64 }
  65 + else
  66 + stateDiffMap.put(device, 0);
37 67  
38 68 if (gps.getUpDown() != upDown) {
39   - gps.setUpDown(upDown);//修正走向
  69 + gps.setUpDown((byte) upDown);//修正走向
  70 + }
  71 +
  72 + if(gps.getState() != schState){
  73 + gps.setState(schState);//修正营运状态
40 74 }
41 75  
42 76 if (!sch.getXlBm().equals(gps.getLineId())) {
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
... ... @@ -144,6 +144,8 @@ public class InStationProcess {
144 144 dayOfSchedule.addExecPlan(next);
145 145 inStationAndInPark(sch, next);//进站既进场
146 146 }
  147 + else
  148 + dayOfSchedule.removeExecPlan(nbbm);
147 149  
148 150 //路牌的下一个班次,页面显示起点实际到达时间
149 151 ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch);
... ... @@ -176,9 +178,14 @@ public class InStationProcess {
176 178 if(null == next && gps.isService()){
177 179 nonService(sch, "结束@系统");//营运结束
178 180 }
179   - //下发运营指令
180   - DirectivePushQueue.put6003(next, "到站@系统");
181 181  
  182 + /**
  183 + * 下一班不是全程班次的时候,下发运营指令
  184 + * 全程班次时,由网关根据进出起终点,自动切换走向
  185 +
  186 + if(null != next && !next.getBcType().equals("normal"))
  187 + DirectivePushQueue.put6003(next, "到站@系统");
  188 + */
182 189 //下发调度指令
183 190 DirectivePushQueue.put6002(next, doneSum, "到站@系统", "");
184 191 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
... ... @@ -39,7 +39,7 @@ public class OutStationProcess {
39 39  
40 40 @Autowired
41 41 GpsStatusManager gpsStatusManager;
42   - private final static int MAX_BEFORE_TIME = 1000 * 60 * 120;
  42 + private final static int MAX_BEFORE_TIME = 1000 * 60 * 60 * 3;
43 43  
44 44 public void process(GpsEntity gps) {
45 45 //自动执行的线路,滚蛋
... ... @@ -86,8 +86,8 @@ public class OutStationProcess {
86 86 }
87 87  
88 88 int diff = (int) (sch.getDfsjT() - gps.getTimestamp());
89   - //首班出场最多提前2小时
90   - if ((dayOfSchedule.isFirstOut(sch) && diff > MAX_BEFORE_TIME) || diff > MAX_BEFORE_TIME / 2)
  89 + //首班出场最多提前3小时
  90 + if (dayOfSchedule.isFirstOut(sch) && diff > MAX_BEFORE_TIME)
91 91 return;
92 92  
93 93 gps.setPremiseCode(null);//清除前置围栏标记
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/overspeed/OverspeedProcess.java
... ... @@ -43,7 +43,7 @@ public class OverspeedProcess {
43 43 */
44 44 private static Map<String, Integer> contSpeedMap;
45 45  
46   - Logger logger = LoggerFactory.getLogger(this.getClass());
  46 + static Logger logger = LoggerFactory.getLogger(OverspeedProcess.class);
47 47  
48 48 static{
49 49 multimap = ArrayListMultimap.create();
... ... @@ -51,6 +51,10 @@ public class OverspeedProcess {
51 51 realOverspeedMap = new HashMap();
52 52 }
53 53  
  54 + public static int size(){
  55 + return multimap.size();
  56 + }
  57 +
54 58 public static void clear(){
55 59 multimap = null;
56 60 multimap = ArrayListMultimap.create();
... ... @@ -60,6 +64,8 @@ public class OverspeedProcess {
60 64  
61 65 realOverspeedMap = null;
62 66 realOverspeedMap = new HashMap();
  67 +
  68 + logger.info("清理超速缓存数据,,,");
63 69 }
64 70  
65 71 public boolean process(GpsEntity gps){
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
... ... @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
84 84 Calendar calendar = Calendar.getInstance();
85 85 int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
86 86  
87   - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=346"; //+ dayOfYear;
  87 + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=39"; //+ dayOfYear;
88 88 JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource());
89 89  
90 90 List<GpsEntity> list =
... ... @@ -102,6 +102,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
102 102 gps.setTimestamp(rs.getLong("TS"));
103 103 gps.setUpDown((byte) getUpOrDown(rs.getLong("SERVICE_STATE")));
104 104 gps.setServerTimestamp(rs.getLong("SERVER_TS"));
  105 + gps.setState((int) getService(rs.getLong("SERVICE_STATE")));
105 106 return gps;
106 107 }
107 108 });
... ... @@ -109,6 +110,17 @@ public class GpsDataRecovery implements ApplicationContextAware {
109 110 }
110 111  
111 112 /**
  113 + * 获取运营状态
  114 + *
  115 + * @return -1无效 0运营 1未运营
  116 + */
  117 + public static byte getService(long serviceState) {
  118 + if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000)
  119 + return -1;
  120 + return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0);
  121 + }
  122 +
  123 + /**
112 124 * 王通 2016/6/29 9:23:24 获取车辆线路上下行
113 125 *
114 126 * @return -1无效 0上行 1下行
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataUtils.java
... ... @@ -15,6 +15,8 @@ public class GpsDataUtils {
15 15  
16 16 static Logger logger = LoggerFactory.getLogger(GpsDataUtils.class);
17 17  
  18 + private final static long MAX_DIFF = 1000 * 60 * 60 * 24;
  19 +
18 20 /**
19 21 * 过滤无效的gps点位
20 22 *
... ... @@ -24,9 +26,16 @@ public class GpsDataUtils {
24 26 public static List<GpsEntity> clearInvalid(List<GpsEntity> list) {
25 27 List<GpsEntity> rs = new ArrayList<>();
26 28  
  29 + long t = System.currentTimeMillis();
27 30 try {
28 31 GpsEntity prev;
29 32 for (GpsEntity gps : list) {
  33 + if(Math.abs(gps.getTimestamp() - t) > MAX_DIFF){
  34 + //尝试校准GPS时间
  35 + gps.setTimestamp(t + 1);
  36 + gps.setAbnormalStatus("timeError");
  37 + }
  38 +
30 39 prev = GpsRealData.get(gps.getDeviceId());
31 40  
32 41 //不接收过期数据
... ... @@ -48,7 +57,7 @@ public class GpsDataUtils {
48 57 if (rs.size() < list.size())
49 58 logger.info("过滤无效的点位 : " + (list.size() - rs.size()));
50 59 } catch (Exception e) {
51   - logger.error("", e);
  60 + logger.error("过滤GPS出现异常", e);
52 61 rs = list;
53 62 }
54 63 return rs;
... ...
src/main/java/com/bsth/data/msg_queue/DirectivePushQueue.java
... ... @@ -24,7 +24,7 @@ public class DirectivePushQueue implements ApplicationContextAware {
24 24 static ConcurrentLinkedQueue<QueueData_Directive> linkedList;
25 25 static DataPushThread thread;
26 26 static DirectiveService directiveService;
27   - static long t;
  27 + static long threadT;
28 28  
29 29 /**
30 30 * 下发运营指令6003的最小间隔时间
... ... @@ -34,11 +34,11 @@ public class DirectivePushQueue implements ApplicationContextAware {
34 34 /**
35 35 * 车辆 ——> 上次下发6003的时间
36 36 */
37   - static ConcurrentMap<String, Long> lastSend6003Map;
  37 + static ConcurrentMap<String, Long> lastSend60TimeMap;
38 38  
39 39 static {
40 40 linkedList = new ConcurrentLinkedQueue<>();
41   - lastSend6003Map = new ConcurrentHashMap<>();
  41 + lastSend60TimeMap = new ConcurrentHashMap<>();
42 42 }
43 43  
44 44 public static void put6002(ScheduleRealInfo sch, int finish, String sender, String txtPrefix){
... ... @@ -52,12 +52,13 @@ public class DirectivePushQueue implements ApplicationContextAware {
52 52 qd6002.setTxtPrefix(txtPrefix);
53 53  
54 54 linkedList.add(qd6002);
  55 + lastSend60TimeMap.put(sch.getClZbh(), System.currentTimeMillis());
55 56 }
56 57  
57 58 public static void put6003(String nbbm, int state, int upDown, String sender){
58 59 long t = System.currentTimeMillis();
59   - if(lastSend6003Map.containsKey(nbbm)
60   - && t - lastSend6003Map.get(nbbm) < MIN_SEND6003_SPACE)
  60 + if(lastSend60TimeMap.containsKey(nbbm)
  61 + && t - lastSend60TimeMap.get(nbbm) < MIN_SEND6003_SPACE)
61 62 return; //最短下发间隔
62 63  
63 64 QueueData_Directive qd6003 = new QueueData_Directive();
... ... @@ -68,7 +69,7 @@ public class DirectivePushQueue implements ApplicationContextAware {
68 69 qd6003.setCode("60_03");
69 70  
70 71 linkedList.add(qd6003);
71   - lastSend6003Map.put(nbbm, t);
  72 + lastSend60TimeMap.put(nbbm, t);
72 73 }
73 74  
74 75 public static void put6003(ScheduleRealInfo sch, String sender){
... ... @@ -146,7 +147,7 @@ public class DirectivePushQueue implements ApplicationContextAware {
146 147 sleepFlag = true;
147 148 }
148 149 }
149   - t = System.currentTimeMillis();
  150 + threadT = System.currentTimeMillis();
150 151 }
151 152 catch(InterruptedException e){
152 153 log.error("", e);
... ...
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
... ... @@ -3,6 +3,8 @@ package com.bsth.data.safe_driv;
3 3 import com.bsth.websocket.handler.SendUtils;
4 4 import org.joda.time.format.DateTimeFormat;
5 5 import org.joda.time.format.DateTimeFormatter;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
6 8 import org.springframework.beans.BeansException;
7 9 import org.springframework.beans.factory.annotation.Autowired;
8 10 import org.springframework.context.ApplicationContext;
... ... @@ -33,6 +35,8 @@ public class SafeDrivCenter implements ApplicationContextAware {
33 35 */
34 36 private static Map<String, SafeDriv> safeMap;
35 37  
  38 + static Logger logger = LoggerFactory.getLogger(SafeDrivCenter.class);
  39 +
36 40 static {
37 41 data = new HashSet<>();
38 42 safeMap = new HashMap<>();
... ... @@ -61,6 +65,7 @@ public class SafeDrivCenter implements ApplicationContextAware {
61 65 public static void clear(){
62 66 data = new HashSet<>();
63 67 safeMap = new HashMap<>();
  68 + logger.info("清除安全驾驶数据,,,");
64 69 }
65 70  
66 71 @Override
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -861,6 +861,18 @@ public class DayOfSchedule {
861 861 return nbbmScheduleMap.values();
862 862 }
863 863  
  864 + public Collection<ScheduleRealInfo> findAllByLpContainer() {
  865 + return lpScheduleMap.values();
  866 + }
  867 +
  868 + public Collection<ScheduleRealInfo> findAllByIdContainer() {
  869 + return id2SchedulMap.values();
  870 + }
  871 +
  872 + public int getPstSize() {
  873 + return pstBuffer.size();
  874 + }
  875 +
864 876 public boolean addExecPlan(ScheduleRealInfo sch) {
865 877 ScheduleRealInfo oldExec = executeCurr(sch.getClZbh());
866 878 if (sch != null){
... ...
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
1 1 package com.bsth.data.schedule.thread;
2 2  
  3 +import com.bsth.data.directive.DayOfDirectives;
3 4 import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
  5 +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
4 6 import com.bsth.service.oil.DlbService;
5 7 import com.bsth.data.safe_driv.SafeDrivCenter;
6 8 import com.bsth.service.oil.YlbService;
... ... @@ -27,6 +29,9 @@ public class CalcOilThread extends Thread{
27 29 SheetService sheetService;
28 30 Logger logger = LoggerFactory.getLogger(this.getClass());
29 31  
  32 + @Autowired
  33 + DayOfDirectives dayOfDirectives;
  34 +
30 35 @Override
31 36 public void run() {
32 37 try{
... ... @@ -37,12 +42,18 @@ public class CalcOilThread extends Thread{
37 42 logger.info("开始计算班次准点率....");
38 43 sheetService.saveSheetList("");
39 44 logger.info("计算班次准点率结束!");
40   - //清除安全驾驶数据 先临时蹭这个线程
41   - SafeDrivCenter.clear();
42   - //清除超速缓存数据
43   - OverspeedProcess.clear();
44 45 } catch(Exception e){
45 46 logger.error("计算路单里程加注量失败",e);
46 47 }
  48 +
  49 + //清除指令数据
  50 + dayOfDirectives.clearAll();
  51 + //清除安全驾驶数据
  52 + SafeDrivCenter.clear();
  53 + //清除超速缓存数据
  54 + OverspeedProcess.clear();
  55 +
  56 + GpsDataLoaderThread.setFlag(0);
  57 +
47 58 }
48 59 }
... ...
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
1 1 package com.bsth.data.schedule.thread;
2 2  
3   -import com.bsth.data.BasicData;
4 3 import com.bsth.data.LineConfigData;
5 4 import com.bsth.data.directive.DayOfDirectives;
6 5 import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
... ... @@ -56,17 +55,15 @@ public class ScheduleRefreshThread extends Thread{
56 55  
57 56 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){
58 57  
59   - //logger.info(lineCode + "开始翻班, " + currSchDate);
60   -
61 58 try{
62   - //清除指令数据
63 59 Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode);
64 60 for(String car : cars){
65   - dayOfDirectives.clear(BasicData.deviceId2NbbmMap.inverse().get(car));
66 61 GpsCacheData.remove(car);
67 62 }
68 63 //清除驾驶员上报数据
69 64 pilotReport.clear(lineCode);
  65 + //清除指令数据 指令数据,直接定时全部清空
  66 + //dayOfDirectives.clear(lineCode);
70 67 }catch (Exception e){
71 68 logger.error("清理 60 和 80出现问题", e);
72 69 }
... ...
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
... ... @@ -136,6 +136,14 @@ public class SchedulePlanInfo extends BEntity {
136 136 /** 时刻表的明细备注 */
137 137 private String remark;
138 138  
  139 + //---------------- 修改时使用的字段 -----------------//
  140 + /** 调整原因(在调度执勤日报页面中修改,选择营运状态) */
  141 + private Integer modifyReason;
  142 + /** 调整的备注(在调度执勤日报页面中修改,与时刻表的班次备注区分开) */
  143 + private String modifyRemark;
  144 + /** 调整的次数(在调度执勤日报页面,排班计划明细里,改的话都会增加) */
  145 + private Integer modifyCount;
  146 +
139 147  
140 148 // @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
141 149 // @JoinTable(
... ... @@ -761,4 +769,28 @@ public class SchedulePlanInfo extends BEntity {
761 769 public void setSchedulePlan(SchedulePlan schedulePlan) {
762 770 this.schedulePlan = schedulePlan;
763 771 }
  772 +
  773 + public Integer getModifyReason() {
  774 + return modifyReason;
  775 + }
  776 +
  777 + public void setModifyReason(Integer modifyReason) {
  778 + this.modifyReason = modifyReason;
  779 + }
  780 +
  781 + public String getModifyRemark() {
  782 + return modifyRemark;
  783 + }
  784 +
  785 + public void setModifyRemark(String modifyRemark) {
  786 + this.modifyRemark = modifyRemark;
  787 + }
  788 +
  789 + public Integer getModifyCount() {
  790 + return modifyCount;
  791 + }
  792 +
  793 + public void setModifyCount(Integer modifyCount) {
  794 + this.modifyCount = modifyCount;
  795 + }
764 796 }
... ...
src/main/java/com/bsth/filter/AccessLogFilter.java
... ... @@ -46,6 +46,7 @@ public class AccessLogFilter extends BaseFilter {
46 46 String url = request.getRequestURI();
47 47 String params = getParams(request);
48 48 String headers = getHeaders(request);
  49 + String method = request.getMethod();
49 50  
50 51 StringBuilder s = new StringBuilder();
51 52 s.append(getBlock(username + " -" + name));
... ... @@ -53,6 +54,7 @@ public class AccessLogFilter extends BaseFilter {
53 54 s.append(getBlock(ip));
54 55 s.append(getBlock(userAgent));
55 56 s.append(getBlock(url));
  57 + s.append(getBlock(method));
56 58 s.append(getBlock(params));
57 59 s.append(getBlock(headers));
58 60 s.append(getBlock(request.getHeader("Referer")));
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -301,7 +301,77 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
301 301 " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.id = ?1 ) a " +
302 302 " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true)
303 303 List<Object[]> findStationRouteInfo(Integer id);
304   -
  304 +
  305 + /**
  306 + * @Description : TODO(根据站点路由Id查询详情)
  307 + *
  308 + * @param id:站点路由ID
  309 + *
  310 + * @return List<Object[]>
  311 + */
  312 + @Query(value = "SELECT a.stationRouteLine," +
  313 + " a.stationRouteStation," +
  314 + " a.stationRouteCode," +
  315 + " a.stationRouteLIneCode," +
  316 + " a.stationRouteStationMark," +
  317 + " a.stationOutStationNmber," +
  318 + " a.stationRoutedirections," +
  319 + " a.stationRouteDistances," +
  320 + " a.stationRouteToTime," +
  321 + " a.staitonRouteFirstTime," +
  322 + " a.stationRouteEndTime," +
  323 + " a.stationRouteDescriptions," +
  324 + " a.stationRouteDestroy," +
  325 + " a.stationRouteVersions," +
  326 + " a.stationRouteCreateBy," +
  327 + " a.stationRouteCreateDate," +
  328 + " a.stationRouteUpdateBy," +
  329 + " a.stationRouteUpdateDate," +
  330 + " b.id AS stationId," +
  331 + " b.station_cod AS stationCode," +
  332 + " a.stationRouteName," +
  333 + " b.road_coding AS stationRoadCoding," +
  334 + " b.db_type AS stationDbType," +
  335 + " b.b_jwpoints AS stationJwpoints," +
  336 + " b.g_lonx AS stationGlonx," +
  337 + " b.g_laty AS stationGlaty," +
  338 + " b.x AS stationX," +
  339 + " b.y AS stationY," +
  340 + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," +
  341 + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " +
  342 + " b.destroy AS stationDestroy," +
  343 + " b.radius AS stationRadius," +
  344 + " b.shapes_type AS stationShapesType," +
  345 + " b.versions AS stationVersions," +
  346 + " b.descriptions AS sttationDescriptions," +
  347 + " b.create_by AS stationCreateBy," +
  348 + " b.create_date AS stationCreateDate," +
  349 + " b.update_by AS stationUpdateBy," +
  350 + " b.update_date AS stationUpdateDate," +
  351 + " a.stationRouteId,b.station_name as zdmc "+
  352 + " FROM ( SELECT s.id AS stationRouteId," +
  353 + " s.line AS stationRouteLine," +
  354 + " s.station as stationRouteStation," +
  355 + " s.station_name AS stationRouteName," +
  356 + " s.station_route_code as stationRouteCode," +
  357 + " s.line_code AS stationRouteLIneCode," +
  358 + " s.station_mark AS stationRouteStationMark," +
  359 + " s.out_station_nmber AS stationOutStationNmber," +
  360 + " s.directions AS stationRoutedirections," +
  361 + " s.distances AS stationRouteDistances," +
  362 + " s.to_time AS stationRouteToTime," +
  363 + " s.first_time AS staitonRouteFirstTime," +
  364 + " s.end_time AS stationRouteEndTime," +
  365 + " s.descriptions AS stationRouteDescriptions," +
  366 + " s.destroy AS stationRouteDestroy," +
  367 + " s.versions AS stationRouteVersions," +
  368 + " s.create_by AS stationRouteCreateBy," +
  369 + " s.create_date AS stationRouteCreateDate," +
  370 + " s.update_by AS stationRouteUpdateBy," +
  371 + " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.line = ?1 and s.directions = ?2 and s.destroy = 0) a " +
  372 + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true)
  373 + List<Object[]> getStationRouteList(Integer lineId, Integer dir);
  374 +
305 375 List<StationRoute> findByLine(Line line);
306 376  
307 377 @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
... ...
src/main/java/com/bsth/service/SectionRouteService.java
... ... @@ -67,5 +67,5 @@ public interface SectionRouteService extends BaseService&lt;SectionRoute, Integer&gt;
67 67  
68 68 void batchUpdate(Integer lineId, String lineCode);
69 69  
70   -
  70 + Map<String,Object> destroy(Integer id);
71 71 }
... ...
src/main/java/com/bsth/service/StationRouteService.java
... ... @@ -92,6 +92,15 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
92 92 * @return List<Map<String, Object>>
93 93 */
94 94 List<Map<String, Object>> getStationRouteCenterPoints(Map<String, Object> map);
  95 +
  96 + /**
  97 + * @Description :TODO(查询线路某方向下所有站点)
  98 + *
  99 + * @param map <lineId:线路ID; direction:方向>
  100 + *
  101 + * @return List<Map<String, Object>>
  102 + */
  103 + List<Map<String, Object>> getStationRouteList(Map<String, Object> map);
95 104  
96 105 /**
97 106 * @Description :TODO(撤销站点)
... ...
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
... ... @@ -96,14 +96,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
96 96 d60.setSender(sender);
97 97 d60.setHttpCode(code);
98 98  
99   - if (code == 0) {
100   - // 添加到缓存
101   - dayOfDirectives.put60(d60, true);
102   - } else {
  99 + if (code != 0)
103 100 d60.setErrorText("网关通讯失败, code: " + code);
104   - d60Repository.save(d60);
105   - dayOfDirectives.put60(d60, false);
106   - }
  101 +
  102 + dayOfDirectives.put60(d60);
107 103 return code;
108 104 }
109 105  
... ... @@ -128,7 +124,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
128 124 text += " (放站到"+sch.getMajorStationName()+"带客)";
129 125 }
130 126  
131   - //下发0x01指令 调度指令(闹钟有效)
  127 + //下发0x02指令 调度指令(闹钟有效)
132 128 long t = System.currentTimeMillis() + 1000 * 30,
133 129 alarmTime = sch.getDfsjT() < t?t:sch.getDfsjT();
134 130  
... ... @@ -139,7 +135,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
139 135 int state = 0;//营运状态
140 136 if(dayOfSchedule.emptyService(sch))
141 137 state = 1;
142   - d60 = new DirectiveCreator().createD60_01(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir())
  138 + d60 = new DirectiveCreator().createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir())
143 139 , state, new Date(alarmTime));
144 140  
145 141 d60.setLineCode(sch.getXlBm());
... ... @@ -171,16 +167,13 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
171 167  
172 168 if (code == 0) {
173 169 sch.setDirectiveState(60);
174   - // 添加到缓存,延迟入库
175   - dayOfDirectives.put60(d60, true);
176 170 // 通知页面
177 171 sendD60ToPage(sch);
178 172 } else {
179 173 d60.setErrorText("网关通讯失败, code: " + code);
180   - dayOfDirectives.put60(d60, false);
181   - d60Repository.save(d60);
182 174 }
183 175  
  176 + dayOfDirectives.put60(d60);
184 177 return code;
185 178 }
186 179  
... ... @@ -227,18 +220,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
227 220 int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60));
228 221 // 添加到缓存,等待入库
229 222 d60.setHttpCode(code);
230   - /*if (null != sch){
231   - d60.setSch(sch);
232   - d60.setLineCode(sch.getXlBm());
233   - }*/
234 223  
235   - if (code == 0) {
236   - dayOfDirectives.put60(d60, true);
237   - } else {
  224 + GpsEntity gps = gpsRealDataBuffer.getByNbbm(nbbm);
  225 + if(null != gps)
  226 + d60.setLineCode(gps.getLineId());
  227 +
  228 + if (code != 0)
238 229 d60.setErrorText("网关通讯失败, code: " + code);
239   - d60Repository.save(d60);
240   - dayOfDirectives.put60(d60, false);
241   - }
  230 +
  231 + dayOfDirectives.put60(d60);
242 232 return code;
243 233 }
244 234  
... ... @@ -268,15 +258,13 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
268 258 // 入库
269 259 d64.setHttpCode(code);
270 260 d64.getData().setTxtContent("切换线路[" + BasicData.lineCode2NameMap.get(lineCode) + "]");
271   - dayOfDirectives.put64(d64);
272   -
273 261 // 通知设备刷新线路文件,忽略结果
274 262 if (code == 0)
275 263 GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode));
276 264 else
277 265 d64.setErrorText(" 网关通讯失败, code: " + code);
278 266  
279   - d64Repository.save(d64);
  267 + dayOfDirectives.put64(d64);
280 268 return code;
281 269 }
282 270  
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -5,6 +5,7 @@ import com.bsth.data.BasicData;
5 5 import com.bsth.data.forecast.entity.ArrivalEntity;
6 6 import com.bsth.data.gpsdata_v2.GpsRealData;
7 7 import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  8 +import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
8 9 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
9 10 import com.bsth.data.gpsdata_v2.utils.GeoUtils;
10 11 import com.bsth.data.pilot80.PilotReport;
... ... @@ -232,16 +233,10 @@ public class GpsServiceImpl implements GpsService {
232 233 Map<String, Object> map = null;
233 234 for(Map<String, Object> rs : dataList){
234 235 serviceState = map_get_long(rs, "SERVICE_STATE");
235   -
236   - if(getGpsValid(serviceState) == 1)
237   - continue;
238   -
239   - map = new HashMap<>();
240 236 if(getGpsValid(serviceState) == 1)
241 237 continue;
242 238  
243 239 map = new HashMap<>();
244   -
245 240 lon = map_get_float(rs, "LON");
246 241 lat = map_get_float(rs, "LAT");
247 242 // 高德坐标
... ... @@ -274,7 +269,7 @@ public class GpsServiceImpl implements GpsService {
274 269 map.put("inout_stop", arrival.getInOut());
275 270 }
276 271  
277   - map.put("nbbm", BasicData.deviceId2NbbmMap.get(map_get_str(rs,"DEVICE_ID")));
  272 + //map.put("nbbm", nbbm);
278 273 map.put("state", getService(serviceState));
279 274 // 上下行
280 275 map.put("upDown", getUpOrDown(serviceState));
... ... @@ -500,6 +495,7 @@ public class GpsServiceImpl implements GpsService {
500 495 try {
501 496  
502 497 gpsRealData.remove(device);
  498 + GpsCacheData.remove(BasicData.deviceId2NbbmMap.get(device));
503 499 rs.put("status", ResponseCode.SUCCESS);
504 500 } catch (Exception e) {
505 501 rs.put("status", ResponseCode.ERROR);
... ...
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
... ... @@ -122,7 +122,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
122 122 }
123 123  
124 124 /**
125   - * @Description :TODO(查询路段信息)
  125 + * @Description :TODO(查询缓存路段信息)
126 126 *
127 127 * @param map <line.id_eq:线路ID; directions_eq:方向>
128 128 *
... ... @@ -408,4 +408,25 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
408 408 public void batchUpdate(Integer lineId, String lineCode) {
409 409 repository.batchUpdate(lineId,lineCode);
410 410 }
  411 +
  412 +
  413 +
  414 + /**
  415 + * @Description : TODO(根据路段路由Id批量撤销路段)
  416 + *
  417 + * @param id <id:路段路由ID>
  418 + */
  419 + @Override
  420 + @Transactional
  421 + public Map<String, Object> destroy(Integer id) {
  422 + Map<String, Object> resultMap = new HashMap<String, Object>();
  423 + try {
  424 + repository.sectionRouteIsDestroyUpdBatch(id);
  425 + resultMap.put("status", ResponseCode.SUCCESS);
  426 + } catch (Exception e) {
  427 + resultMap.put("status", ResponseCode.ERROR);
  428 + logger.error("save erro.", e);
  429 + }
  430 + return resultMap;
  431 + }
411 432 }
412 433 \ No newline at end of file
... ...
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
... ... @@ -453,7 +453,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
453 453 if(!sectionsBpoints.equals("")) {
454 454 bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
455 455 }
456   - repository.systemSave(sectionCode, sectionName, "", "", "", "", gsectionVector, bsectionVectorS, "", "", "", 0, 0, "", 0, "", 1, sectionId);
  456 + repository.systemSave(sectionCode, sectionName, null, "", "", "", gsectionVector, bsectionVectorS, "", "", "", 0, 0, "", 0, "", 1, sectionId);
457 457  
458 458 routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode+i);
459 459 SectionRoute route = new SectionRoute();
... ... @@ -636,7 +636,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
636 636 // 原坐标类型
637 637 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
638 638 // 说明
639   - String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
  639 + String descriptions = "";
640 640 // 是否撤销
641 641 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
642 642 // 方向
... ... @@ -662,14 +662,19 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
662 662 // 路段路由
663 663 Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
664 664 SectionRoute resultS = routeRepository.findOne(sectionRouteId);
665   -// int old_code = resultS.getSectionrouteCode();
666   - // 如果为空,默认在第一个路段
667   - if(sectionrouteCode!=null) {
668   - sectionrouteCode += 1;
669   - }else {
670   - sectionrouteCode = 1;
671   - }
672   - routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
  665 + int old_code = resultS.getSectionrouteCode();
  666 + // 是否修改路段序号标记
  667 + boolean type = false;
  668 + if(sectionrouteCode!=null) {
  669 + if(++sectionrouteCode == old_code) {
  670 + type = true;
  671 + }
  672 + // 默认是最前面路段
  673 + }else {
  674 + sectionrouteCode = 1;
  675 + }
  676 + if(!type)
  677 + routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
673 678 // 限速
674 679 Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString());
675 680 // 版本
... ... @@ -709,7 +714,6 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
709 714 route.setDirections(directions);
710 715 route.setVersions(version);
711 716 route.setDestroy(destroy);
712   - route.setDescriptions(descriptions);
713 717 route.setCreateBy(createBy);
714 718 route.setUpdateBy(updateBy);
715 719 route.setLine(line);
... ... @@ -784,17 +788,24 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
784 788 // 路段时长
785 789 Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString());
786 790 // 路段路由
787   -// Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
788   - Integer sectionrouteCode = 1;
  791 + Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
  792 +// Integer sectionrouteCode = 1;
789 793 SectionRouteCache resultS = routeCacheRepository.findOne(sectionRouteId);
790 794 int old_code = resultS.getSectionrouteCode();
  795 + // 是否修改路段序号标记
  796 + boolean type = false;
791 797 if(sectionrouteCode!=null) {
792   - sectionrouteCode += 1;
  798 + if(sectionrouteCode == old_code) {
  799 + type = true;
  800 + } else {
  801 + sectionrouteCode += 1;
  802 + }
793 803 // 默认是最前面路段
794 804 }else {
795 805 sectionrouteCode = 1;
796 806 }
797   - routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
  807 + if(!type)
  808 + routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
798 809 // 限速
799 810 Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString());
800 811 // 版本
... ...
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
... ... @@ -196,123 +196,80 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
196 196 List<Map<String, Object>> staitonChildren= new ArrayList<Map<String, Object>>();
197 197  
198 198 if(stationList.size()>0) {
199   -
200 199 for(int i = 0 ; i < stationList.size(); i++) {
201   -
202 200 Map<String, Object> tempM = new HashMap<String, Object>();
203   -
204 201 // 站点路由ID
205 202 tempM.put("stationRouteId", stationList.get(i)[0]);
206   -
207 203 // 站点路由线路ID
208 204 tempM.put("stationRouteLine", stationList.get(i)[1]);
209   -
210 205 // 站点路由站点ID
211 206 tempM.put("stationRouteStation", stationList.get(i)[2]);
212   -
213 207 // 站点路由名称
214   - tempM.put("stationRouteStationName", stationList.get(i)[3]);
215   -
  208 + tempM.put("stationRouteName", stationList.get(i)[3]);
216 209 // 站点路由站点序号
217   - tempM.put("stationRouteStationRouteCode", stationList.get(i)[4]);
218   -
  210 + tempM.put("stationRouteCode", stationList.get(i)[4]);
219 211 // 站点路由线路编码
220 212 tempM.put("stationRouteLineCode", stationList.get(i)[5]);
221   -
222 213 // 站点路由站点类型
223 214 tempM.put("stationRouteStationMark", stationList.get(i)[6]);
224   -
225 215 // 站点路由出站的序号
226 216 tempM.put("stationRouteOutStationNmber", stationList.get(i)[7]);
227   -
228 217 // 站点路由站点方向
229   - tempM.put("stationRouteDirections", stationList.get(i)[8]);
230   -
  218 + tempM.put("stationRoutedirections", stationList.get(i)[8]);
231 219 // 站点路由站点到站距离
232 220 tempM.put("stationRouteDistances", stationList.get(i)[9]);
233   -
234 221 // 站点路由到站时间
235 222 tempM.put("stationRouteToTime", stationList.get(i)[10]);
236   -
237 223 // 站点路由站点首班时间
238 224 tempM.put("stationRouteFirstTime", stationList.get(i)[11]);
239   -
240 225 // 站点路由站点末班时间
241 226 tempM.put("stationRouteEndTime", stationList.get(i)[12]);
242   -
243 227 // 站点路由站点说明
244 228 tempM.put("stationRouteDescriptions", stationList.get(i)[13]);
245   -
246 229 // 站点路由版本
247 230 tempM.put("stationRouteVersions", stationList.get(i)[14]);
248   -
249 231 // 站点ID
250 232 tempM.put("stationId", stationList.get(i)[15]);
251   -
252 233 // 站点编码
253   - tempM.put("stationStationCod", stationList.get(i)[16]);
254   -
  234 + tempM.put("stationCode", stationList.get(i)[16]);
255 235 // 站点名称
256 236 tempM.put("stationStationName", stationList.get(i)[17]);
257   -
258 237 // 路段编码
259 238 tempM.put("stationRoadCoding", stationList.get(i)[18]);
260   -
261 239 // 原坐标类型
262 240 tempM.put("stationDbType", stationList.get(i)[19]);
263   -
264 241 // 中心点(百度坐标)
265   - tempM.put("stationBJwpoints", stationList.get(i)[20]);
266   -
  242 + tempM.put("stationJwpoints", stationList.get(i)[20]);
267 243 // 中心点(WGS经度)
268 244 tempM.put("stationGLonx", stationList.get(i)[21]);
269   -
270 245 // 中心点(WGS纬度)
271 246 tempM.put("stationGLaty", stationList.get(i)[22]);
272   -
273 247 // 城建坐标x
274 248 tempM.put("stationx", stationList.get(i)[23]);
275   -
276 249 // 城建坐标y
277 250 tempM.put("stationy", stationList.get(i)[24]);
278   -
279 251 // 站点图形类型
280 252 tempM.put("stationShapesType", stationList.get(i)[25]);
281   -
282 253 // 站点圆半径
283 254 tempM.put("stationRadius", stationList.get(i)[26]);
284   -
285 255 // 站点图形WGS坐标
286 256 tempM.put("stationGPolygonGrid", stationList.get(i)[27]);
287   -
288 257 // 站点图形百度坐标
289 258 tempM.put("stationBPolygonGrid", stationList.get(i)[28]);
290   -
291 259 // 是否撤销
292 260 tempM.put("stationDestroy", stationList.get(i)[29]);
293   -
294 261 // 站点版本
295 262 tempM.put("stationVersions", stationList.get(i)[30]);
296   -
297 263 // 站点说明
298 264 tempM.put("stationDescriptions", stationList.get(i)[31]);
299   -
300   - tempM.put("name", stationList.get(i)[3]);
301   -
  265 + tempM.put("zdmc", stationList.get(i)[3]);
302 266 tempM.put("text", stationList.get(i)[3]);
303   -
304 267 tempM.put("icon", "fa fa-bus");
305   -
306 268 tempM.put("pId", 200);
307   -
308 269 tempM.put("id", i+1);
309   -
310 270 tempM.put("groupType", "3");
311   -
312 271 tempM.put("chaildredType", "station");
313   -
314 272 tempM.put("enable", true);
315   -
316 273 staitonChildren.add(tempM);
317 274 }
318 275 }
... ... @@ -321,107 +278,87 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
321 278 List<Map<String, Object>> sectionChildren = new ArrayList<Map<String, Object>>();
322 279  
323 280 if(sectionList.size()>0) {
324   -
325 281 for(int i = 0 ; i<sectionList.size() ; i++){
326   -
327 282 Map<String, Object> tempM = new HashMap<String, Object>();
328   -
329 283 // 路段路由ID
330 284 tempM.put("sectionrouteId",sectionList.get(i)[0]);
331   -
332 285 // 路段路由线路ID
333 286 tempM.put("sectionrouteLine",sectionList.get(i)[1]);
334   -
335 287 // 路段路由线路编码
336 288 tempM.put("sectionrouteLineCode",sectionList.get(i)[2]);
337   -
338 289 // 路段路由路段ID
339 290 tempM.put("sectionrouteSection",sectionList.get(i)[3]);
340   -
341 291 // 路段路由路段编码
342 292 tempM.put("sectionrouteSectionCode",sectionList.get(i)[4]);
343   -
344 293 tempM.put("sectionrouteCode",sectionList.get(i)[5]);
345   -
346 294 tempM.put("sectionrouteDirections",sectionList.get(i)[6]);
347   -
348 295 // 路段ID
349 296 tempM.put("sectionId",sectionList.get(i)[7]);
350   -
351 297 // 路段编码
352 298 tempM.put("sectionCode",sectionList.get(i)[8]);
353   -
354 299 // 路段名称
355 300 tempM.put("sectionName",sectionList.get(i)[9]);
356   -
357 301 // 道路编码
358 302 tempM.put("sectionCrosesRoad",sectionList.get(i)[10]);
359   -
360 303 // 终点站
361 304 tempM.put("sectionEndNode",sectionList.get(i)[11]);
362   -
363 305 // 起始节点
364 306 tempM.put("sectionStartNode",sectionList.get(i)[12]);
365   -
366 307 // 中间节点
367 308 tempM.put("sectionMiddleNode",sectionList.get(i)[13]);
368   -
369 309 // 路段类型
370 310 tempM.put("sectionType",sectionList.get(i)[14]);
371   -
372 311 // 路段折线图形城建坐标
373 312 tempM.put("sectionCsectionVector",sectionList.get(i)[15]);
374   -
375 313 // 路段折线图形百度坐标
376 314 tempM.put("sectionBsectionVector",sectionList.get(i)[16]);
377   -
378 315 // 路段折线图形WGS坐标
379 316 tempM.put("sectionGsectionVector",sectionList.get(i)[17]);
380   -
381 317 // 道路编码
382 318 tempM.put("sectionRoadCoding",sectionList.get(i)[18]);
383   -
384 319 // 路段距离
385 320 tempM.put("sectionDistance",sectionList.get(i)[19]);
386   -
387 321 // 路段时间
388 322 tempM.put("sectionTime",sectionList.get(i)[20]);
389   -
390 323 // 路段原坐标类型
391 324 tempM.put("sectiondbType",sectionList.get(i)[21]);
392   -
393 325 // 限速
394 326 tempM.put("sectionSpeedLimet",sectionList.get(i)[22]);
395   -
396 327 // 是否撤销
397 328 tempM.put("destroy",sectionList.get(i)[23]);
398   -
399 329 // 版本号
400 330 tempM.put("versions",sectionList.get(i)[24]);
401   -
402 331 // 说明
403 332 tempM.put("descriptions",sectionList.get(i)[25]);
404 333 // 说明
405 334 tempM.put("isRoadeSpeed",sectionList.get(i)[26]);
406   -
407 335 tempM.put("name", sectionList.get(i)[9]);
408   -
409 336 tempM.put("text", sectionList.get(i)[9]);
410   -
411 337 tempM.put("icon", null);
412   -
413 338 tempM.put("pId", 300);
414   -
415 339 tempM.put("id", (i+1)*1000);
416   -
417 340 tempM.put("groupType", "3");
418   -
419 341 tempM.put("chaildredType", "section");
420   -
421 342 tempM.put("enable", true);
422   -
423 343 sectionChildren.add(tempM);
424   -
  344 + }
  345 + } else {
  346 + if(stationList.size()>0) {
  347 + Map<String, Object> tempM = new HashMap<String, Object>();
  348 + tempM.put("name", "添加路段");
  349 + tempM.put("text", "添加路段");
  350 + tempM.put("lineId", stationList.get(0)[1]);
  351 + tempM.put("lineCode", stationList.get(0)[5]);
  352 + tempM.put("dir", stationList.get(0)[8]);
  353 + tempM.put("versions", stationList.get(0)[14]);
  354 + tempM.put("icon", null);
  355 + tempM.put("pId", 300);
  356 + tempM.put("id", 1000);
  357 + tempM.put("groupType", "3");
  358 + tempM.put("chaildredType", "addSection");
  359 + tempM.put("sectionBsectionVector", "LINESTRING("+stationList.get(0)[20]+")");
  360 + tempM.put("enable", true);
  361 + sectionChildren.add(tempM);
425 362 }
426 363 }
427 364  
... ... @@ -563,98 +500,102 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
563 500 int len = objects.size();
564 501  
565 502 if(objects.size()>0) {
  503 + // 遍历站点
  504 + traversalStation(objects, resultList, len);
  505 + }
  506 + return resultList;
  507 + }
566 508  
567   - for(int i = 0 ; i < len; i++) {
568   - Map<String, Object> tempM = new HashMap<String,Object>();
  509 + private void traversalStation(List<Object[]> objects, List<Map<String, Object>> resultList, int len) {
  510 + for(int i = 0 ; i < len; i++) {
  511 + Map<String, Object> tempM = new HashMap<String,Object>();
569 512  
570   - tempM.put("stationRouteLine", objects.get(i)[0]);
  513 + tempM.put("stationRouteLine", objects.get(i)[0]);
571 514  
572   - tempM.put("stationRouteStation", objects.get(i)[1]);
  515 + tempM.put("stationRouteStation", objects.get(i)[1]);
573 516  
574   - tempM.put("stationRouteCode", objects.get(i)[2]);
  517 + tempM.put("stationRouteCode", objects.get(i)[2]);
575 518  
576   - tempM.put("stationRouteLIneCode", objects.get(i)[3]);
  519 + tempM.put("stationRouteLIneCode", objects.get(i)[3]);
577 520  
578   - tempM.put("stationRouteStationMark", objects.get(i)[4]);
  521 + tempM.put("stationRouteStationMark", objects.get(i)[4]);
579 522  
580   - tempM.put("stationOutStationNmber", objects.get(i)[5]);
  523 + tempM.put("stationOutStationNmber", objects.get(i)[5]);
581 524  
582   - tempM.put("stationRoutedirections", objects.get(i)[6]);
  525 + tempM.put("stationRoutedirections", objects.get(i)[6]);
583 526  
584   - tempM.put("stationRouteDistances", objects.get(i)[7]);
  527 + tempM.put("stationRouteDistances", objects.get(i)[7]);
585 528  
586   - tempM.put("stationRouteToTime", objects.get(i)[8]);
  529 + tempM.put("stationRouteToTime", objects.get(i)[8]);
587 530  
588   - tempM.put("staitonRouteFirstTime", objects.get(i)[9]);
  531 + tempM.put("staitonRouteFirstTime", objects.get(i)[9]);
589 532  
590   - tempM.put("stationRouteEndTime", objects.get(i)[10]);
  533 + tempM.put("stationRouteEndTime", objects.get(i)[10]);
591 534  
592   - tempM.put("stationRouteDescriptions", objects.get(i)[11]);
  535 + tempM.put("stationRouteDescriptions", objects.get(i)[11]);
593 536  
594   - tempM.put("stationRouteDestroy", objects.get(i)[12]);
  537 + tempM.put("stationRouteDestroy", objects.get(i)[12]);
595 538  
596   - tempM.put("stationRouteVersions", objects.get(i)[13]);
  539 + tempM.put("stationRouteVersions", objects.get(i)[13]);
597 540  
598   - tempM.put("stationRouteCreateBy", objects.get(i)[14]);
  541 + tempM.put("stationRouteCreateBy", objects.get(i)[14]);
599 542  
600   - tempM.put("stationRouteCreateDate", objects.get(i)[15]);
  543 + tempM.put("stationRouteCreateDate", objects.get(i)[15]);
601 544  
602   - tempM.put("stationRouteUpdateBy", objects.get(i)[16]);
  545 + tempM.put("stationRouteUpdateBy", objects.get(i)[16]);
603 546  
604   - tempM.put("stationRouteUpdateDate", objects.get(i)[17]);
  547 + tempM.put("stationRouteUpdateDate", objects.get(i)[17]);
605 548  
606   - tempM.put("stationId", objects.get(i)[18]);
  549 + tempM.put("stationId", objects.get(i)[18]);
607 550  
608   - tempM.put("stationCode", objects.get(i)[19]);
  551 + tempM.put("stationCode", objects.get(i)[19]);
609 552  
610   - tempM.put("stationRouteName", objects.get(i)[20]);
  553 + tempM.put("stationRouteName", objects.get(i)[20]);
611 554  
612   - tempM.put("stationRoadCoding", objects.get(i)[21]);
  555 + tempM.put("stationRoadCoding", objects.get(i)[21]);
613 556  
614   - tempM.put("stationDbType", objects.get(i)[22]);
  557 + tempM.put("stationDbType", objects.get(i)[22]);
615 558  
616   - tempM.put("stationJwpoints", objects.get(i)[23]);
  559 + tempM.put("stationJwpoints", objects.get(i)[23]);
617 560  
618   - tempM.put("stationGlonx", objects.get(i)[24]);
  561 + tempM.put("stationGlonx", objects.get(i)[24]);
619 562  
620   - tempM.put("stationGlaty", objects.get(i)[25]);
  563 + tempM.put("stationGlaty", objects.get(i)[25]);
621 564  
622   - tempM.put("stationX", objects.get(i)[26]);
  565 + tempM.put("stationX", objects.get(i)[26]);
623 566  
624   - tempM.put("stationY", objects.get(i)[27]);
  567 + tempM.put("stationY", objects.get(i)[27]);
625 568  
626   - tempM.put("stationBPolyonGrid", objects.get(i)[28]);
  569 + tempM.put("stationBPolyonGrid", objects.get(i)[28]);
627 570  
628   - tempM.put("stationGPloyonGrid", objects.get(i)[29]);
  571 + tempM.put("stationGPloyonGrid", objects.get(i)[29]);
629 572  
630   - tempM.put("stationDestroy", objects.get(i)[30]);
  573 + tempM.put("stationDestroy", objects.get(i)[30]);
631 574  
632   - tempM.put("stationRadius", objects.get(i)[31]);
  575 + tempM.put("stationRadius", objects.get(i)[31]);
633 576  
634   - tempM.put("stationShapesType", objects.get(i)[32]);
  577 + tempM.put("stationShapesType", objects.get(i)[32]);
635 578  
636   - tempM.put("stationVersions", objects.get(i)[33]);
  579 + tempM.put("stationVersions", objects.get(i)[33]);
637 580  
638   - tempM.put("sttationDescriptions", objects.get(i)[34]);
  581 + tempM.put("sttationDescriptions", objects.get(i)[34]);
639 582  
640   - tempM.put("stationCreateBy", objects.get(i)[35]);
  583 + tempM.put("stationCreateBy", objects.get(i)[35]);
641 584  
642   - tempM.put("stationCreateDate", objects.get(i)[36]);
  585 + tempM.put("stationCreateDate", objects.get(i)[36]);
643 586  
644   - tempM.put("stationUpdateBy", objects.get(i)[37]);
  587 + tempM.put("stationUpdateBy", objects.get(i)[37]);
645 588  
646   - tempM.put("stationUpdateDate", objects.get(i)[38]);
  589 + tempM.put("stationUpdateDate", objects.get(i)[38]);
647 590  
648   - tempM.put("stationRouteId", objects.get(i)[39]);
649   - tempM.put("zdmc", objects.get(i)[40]);
  591 + tempM.put("stationRouteId", objects.get(i)[39]);
  592 + tempM.put("zdmc", objects.get(i)[40]);
650 593  
651   - resultList.add(tempM);
652   - }
653   - }
654   - return resultList;
  594 + resultList.add(tempM);
  595 + }
655 596 }
656 597  
657   - /**
  598 + /**
658 599 * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
659 600 *
660 601 * @param map <lineId:线路ID; direction:方向>
... ... @@ -692,6 +633,29 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
692 633  
693 634 return resultList;
694 635 }
  636 +
  637 + /**
  638 + * @Description :TODO(查询线路某方向下所有站点)
  639 + *
  640 + * @param map <lineId:线路ID; direction:方向>
  641 + *
  642 + * @return List<Map<String, Object>>
  643 + */
  644 + @Override
  645 + public List<Map<String, Object>> getStationRouteList(Map<String, Object> map) {
  646 + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString());
  647 + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString());
  648 + List<Object[]> objects = repository.getStationRouteList(lineId, direction);
  649 + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  650 +
  651 + int len = objects.size();
  652 +
  653 + if(objects.size()>0) {
  654 + // 遍历站点
  655 + traversalStation(objects, resultList, len);
  656 + }
  657 + return resultList;
  658 + }
695 659  
696 660  
697 661 /**
... ... @@ -774,109 +738,72 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
774 738 */
775 739 @Override
776 740 public Map<String, Object> usingSingle(Map<String, Object> map) {
777   -
778 741 // 返回值map
779 742 Map<String, Object> resultMap = new HashMap<String,Object>();
780   -
781 743 try {
782   -
783 744 // 获取线路ID
784 745 Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
785   -
786 746 /** 查询线路信息 @param:<lineId:线路ID> */
787 747 Line line = lineRepository.findOne(lineId);
788   -
789 748 /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */
790 749 List<Object[]> objects = repository.usingSingle(lineId);
791   -
792 750 if (objects.size()>0) {
793   -
794 751 /** 获取配置文件里的ftp登录参数 */
795 752 Map<String, Object> FTPParamMap = readPropertiesGetFTPParam();
796   -
797 753 // 压缩文件名
798 754 String odlGzFileName = line.getLineCode() + ".txt.gz";
799   -
800 755 // txt文件名
801 756 String textFileName = line.getLineCode() + ".txt";
802   -
803 757 // 创建一个ftp上传实例
804 758 FTPClientUtils clientUtils = new FTPClientUtils();
805   -
806 759 // IP
807 760 String url = FTPParamMap.get("url").toString();
808   -
809 761 // 端口
810 762 int port = Integer.valueOf(FTPParamMap.get("port").toString());
811   -
812 763 // 用户名
813 764 String username = FTPParamMap.get("username").toString();
814   -
815 765 // 密码
816 766 String password = FTPParamMap.get("password").toString();
817   -
818 767 // 相对路径
819 768 String remotePath = FTPParamMap.get("remotePath").toString();
820   -
821 769 /** 如果已存在相同行单文件名则先删除 */
822 770 clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName);
823   -
824 771 clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName);
825   -
826 772 String textStr = "";
827   -
828   - boolean tempTag = ishxType(objects);
829   -
830   - if(tempTag)
  773 +// boolean tempTag = ishxType(objects);
  774 + Integer linePlayType = line.getLinePlayType() == null ? -1:line.getLinePlayType();
  775 + if(linePlayType == 1)
831 776 textStr = hxTextFileToFtp(objects,lineId);// 环线行单文件内容
832   - else
  777 + else if (linePlayType == 0)
833 778 textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/
834   -
835   - /*textStr = line.getName() + "\t" + "2" + "\r" + textStr;*/
836   -
  779 + else
  780 + resultMap.put("status","NOLinePlayType");// 线路无线路规划类型
837 781 textStr = line.getName() + " " + "2" + "\r" + textStr;
838   -
839 782 InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk"));
840   -
841 783 /** 生成txt文件,上传ftp */
842 784 clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input);
843   -
844 785 // 创建打包实例
845 786 PackTarGZUtils packTarGZUtils= new PackTarGZUtils();
846   -
847 787 /** 获取txt文件 */
848 788 File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName);
849   -
850 789 File target = new File(odlGzFileName);
851   -
852 790 // 将txt文件打包
853 791 File targetFile = PackTarGZUtils.compress(textFile, target);
854   -
855   - /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/
856   -
857 792 clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath);
858   -
859 793 // 删除文件
860 794 textFile.delete();
861 795 targetFile.delete();
862   -
863 796 resultMap.put("status", ResponseCode.SUCCESS);
864   -
865 797 }else {
866   -
867 798 resultMap.put("status","NOTDATA");
868 799 }
869   -
870   -
871 800 } catch (Exception e) {
872   -
873 801 resultMap.put("status", ResponseCode.ERROR);
874   -
875 802 logger.error("save erro.", e);
876   -
877   - }
  803 + }
878 804 return resultMap;
879 805 }
  806 + // 判断线路走向是环线还是双向
880 807 public boolean ishxType(List<Object[]> listObj) {
881 808 boolean tag = true;
882 809 String pointBStr[] = null,pointEStr[] = null;
... ... @@ -889,9 +816,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
889 816 if(Integer.valueOf(listObj.get(i)[8].toString())==1)
890 817 numzd++;
891 818 }
892   - Point p1 = new Point(Double.valueOf(pointBStr[0]),Double.valueOf(pointBStr[1]));
  819 + Point p1 = new Point(Double.valueOf(pointBStr[0]),Double.valueOf(pointBStr[1]));
893 820 Point p2 = new Point(Double.valueOf(pointEStr[0]),Double.valueOf(pointEStr[1]));
894   - if(GeoUtils.getDistance(p1, p2)>100 && numzd>2)
  821 + if(GeoUtils.getDistance(p1, p2)>100 && numzd>2)
895 822 tag = false;
896 823 return tag;
897 824 }
... ... @@ -1241,95 +1168,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1241 1168 int len = objects.size();
1242 1169  
1243 1170 if(objects.size()>0) {
1244   -
1245   - for(int i = 0 ; i < len; i++) {
1246   - Map<String, Object> tempM = new HashMap<String,Object>();
1247   -
1248   - tempM.put("stationRouteLine", objects.get(i)[0]);
1249   -
1250   - tempM.put("stationRouteStation", objects.get(i)[1]);
1251   -
1252   - tempM.put("stationRouteCode", objects.get(i)[2]);
1253   -
1254   - tempM.put("stationRouteLIneCode", objects.get(i)[3]);
1255   -
1256   - tempM.put("stationRouteStationMark", objects.get(i)[4]);
1257   -
1258   - tempM.put("stationOutStationNmber", objects.get(i)[5]);
1259   -
1260   - tempM.put("stationRoutedirections", objects.get(i)[6]);
1261   -
1262   - tempM.put("stationRouteDistances", objects.get(i)[7]);
1263   -
1264   - tempM.put("stationRouteToTime", objects.get(i)[8]);
1265   -
1266   - tempM.put("staitonRouteFirstTime", objects.get(i)[9]);
1267   -
1268   - tempM.put("stationRouteEndTime", objects.get(i)[10]);
1269   -
1270   - tempM.put("stationRouteDescriptions", objects.get(i)[11]);
1271   -
1272   - tempM.put("stationRouteDestroy", objects.get(i)[12]);
1273   -
1274   - tempM.put("stationRouteVersions", objects.get(i)[13]);
1275   -
1276   - tempM.put("stationRouteCreateBy", objects.get(i)[14]);
1277   -
1278   - tempM.put("stationRouteCreateDate", objects.get(i)[15]);
1279   -
1280   - tempM.put("stationRouteUpdateBy", objects.get(i)[16]);
1281   -
1282   - tempM.put("stationRouteUpdateDate", objects.get(i)[17]);
1283   -
1284   - tempM.put("stationId", objects.get(i)[18]);
1285   -
1286   - tempM.put("stationCode", objects.get(i)[19]);
1287   -
1288   - tempM.put("stationRouteName", objects.get(i)[20]);
1289   -
1290   - tempM.put("stationRoadCoding", objects.get(i)[21]);
1291   -
1292   - tempM.put("stationDbType", objects.get(i)[22]);
1293   -
1294   - tempM.put("stationJwpoints", objects.get(i)[23]);
1295   -
1296   - tempM.put("stationGlonx", objects.get(i)[24]);
1297   -
1298   - tempM.put("stationGlaty", objects.get(i)[25]);
1299   -
1300   - tempM.put("stationX", objects.get(i)[26]);
1301   -
1302   - tempM.put("stationY", objects.get(i)[27]);
1303   -
1304   - tempM.put("stationBPolyonGrid", objects.get(i)[28]);
1305   -
1306   - tempM.put("stationGPloyonGrid", objects.get(i)[29]);
1307   -
1308   - tempM.put("stationDestroy", objects.get(i)[30]);
1309   -
1310   - tempM.put("stationRadius", objects.get(i)[31]);
1311   -
1312   - tempM.put("stationShapesType", objects.get(i)[32]);
1313   -
1314   - tempM.put("stationVersions", objects.get(i)[33]);
1315   -
1316   - tempM.put("sttationDescriptions", objects.get(i)[34]);
1317   -
1318   - tempM.put("stationCreateBy", objects.get(i)[35]);
1319   -
1320   - tempM.put("stationCreateDate", objects.get(i)[36]);
1321   -
1322   - tempM.put("stationUpdateBy", objects.get(i)[37]);
1323   -
1324   - tempM.put("stationUpdateDate", objects.get(i)[38]);
1325   -
1326   - tempM.put("stationRouteId", objects.get(i)[39]);
1327   - tempM.put("zdmc", objects.get(i)[40]);
1328   -
1329   - resultList.add(tempM);
1330   - }
1331   -
1332   - }
  1171 +
  1172 + traversalStation(objects, resultList, len);
  1173 +
  1174 + }
1333 1175  
1334 1176 return resultList;
1335 1177 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
1 1 package com.bsth.service.realcontrol.impl;
2 2  
  3 +import com.alibaba.fastjson.JSON;
3 4 import com.bsth.common.ResponseCode;
4 5 import com.bsth.data.BasicData;
5 6 import com.bsth.data.Station2ParkBuffer;
... ... @@ -137,6 +138,8 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
137 138 Map<String, Object> rs = new HashMap();
138 139 try {
139 140 ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
  141 + logger.info("cts: " + JSON.toJSONString(t));
  142 + logger.info("sch: " + JSON.toJSONString(sch));
140 143 //保存起终点名称
141 144 if(StringUtils.isEmpty(t.getStartStationName()))
142 145 t.setStartStationName(getStationName(sch.getXlBm(), t.getStartStation()));
... ... @@ -151,7 +154,7 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
151 154 ChildTaskPlan task = null;
152 155 Set<ChildTaskPlan> set = sch.getcTasks();
153 156 for(ChildTaskPlan obj : set){
154   - if(obj.getId() == t.getId()){
  157 + if(obj.getId().intValue() == t.getId().intValue()){
155 158 task = obj;
156 159 break;
157 160 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -698,13 +698,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
698 698 //数据库删除
699 699 rs = super.delete(id);
700 700 if(rs.get("status").equals(ResponseCode.SUCCESS)){
701   - /*ScheduleRealInfo temp = super.findById(id);
702   - if(temp != null){
703   - rs.put("status", ResponseCode.ERROR);
704   - rs.put("msg", "删除失败,请重试!");
705   - return rs;
706   - }*/
707   -
708 701 dayOfSchedule.delete(sch);
709 702 //更新起点应到时间
710 703 List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch);
... ... @@ -1027,12 +1020,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1027 1020 !zdsj.equals(zdsjActual) &&
1028 1021 !zdsj.equals("")&&
1029 1022 !zdsjActual.equals("")) {
  1023 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  1024 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
1030 1025 if (zdsj.compareTo(zdsjActual) > 0) {
1031   - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
1032   - maps.put("slow", "");
  1026 + if(zdsjT - zdsjAT > 1000){
  1027 + maps.put("fast", "");
  1028 + maps.put("slow", zdsjAT - zdsjT + 1440);
  1029 + } else {
  1030 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  1031 + maps.put("slow", "");
  1032 + }
1033 1033 } else {
1034   - maps.put("fast", "");
1035   - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  1034 + if(zdsjAT - zdsjT > 1000){
  1035 + maps.put("fast", zdsjT - zdsjAT + 1440);
  1036 + maps.put("slow", "");
  1037 + } else {
  1038 + maps.put("fast", "");
  1039 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  1040 + }
1036 1041 }
1037 1042 } else {
1038 1043 maps.put("fast", "");
... ... @@ -3707,12 +3712,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3707 3712 String zdsjActual = scheduleRealInfo.getZdsjActual();
3708 3713 if (zdsj != null && zdsjActual != null &&
3709 3714 !zdsj.equals(zdsjActual)) {
  3715 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  3716 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
3710 3717 if (zdsj.compareTo(zdsjActual) > 0) {
3711   - map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
3712   - map.put("slow", "");
  3718 + if(zdsjT - zdsjAT > 1000){
  3719 + map.put("fast", "");
  3720 + map.put("slow", zdsjAT - zdsjT + 1440);
  3721 + } else {
  3722 + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3723 + map.put("slow", "");
  3724 + }
3713 3725 } else {
3714   - map.put("fast", "");
3715   - map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3726 + if(zdsjAT - zdsjT > 1000){
  3727 + map.put("fast", zdsjT - zdsjAT + 1440);
  3728 + map.put("slow", "");
  3729 + } else {
  3730 + map.put("fast", "");
  3731 + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3732 + }
3716 3733 }
3717 3734 } else {
3718 3735 map.put("fast", "");
... ... @@ -4703,12 +4720,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4703 4720 !zdsj.equals(zdsjActual) &&
4704 4721 !zdsj.equals("")&&
4705 4722 !zdsjActual.equals("")) {
  4723 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  4724 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
4706 4725 if (zdsj.compareTo(zdsjActual) > 0) {
4707   - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
4708   - maps.put("slow", "");
  4726 + if(zdsjT - zdsjAT > 1000){
  4727 + maps.put("fast", "");
  4728 + maps.put("slow", zdsjAT - zdsjT + 1440);
  4729 + } else {
  4730 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4731 + maps.put("slow", "");
  4732 + }
4709 4733 } else {
4710   - maps.put("fast", "");
4711   - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4734 + if(zdsjAT - zdsjT > 1000){
  4735 + maps.put("fast", zdsjT - zdsjAT + 1440);
  4736 + maps.put("slow", "");
  4737 + } else {
  4738 + maps.put("fast", "");
  4739 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4740 + }
4712 4741 }
4713 4742 } else {
4714 4743 maps.put("fast", "");
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -93,8 +93,10 @@ public class ReportServiceImpl implements ReportService{
93 93 String sbbb=BasicData.deviceId2NbbmMap.inverse().get(clzbh);
94 94 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
95 95 SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
96   - Long date1=simpleDateFormat.parse(date+" "+sjfc+":00").getTime();
97   - Long date2=simpleDateFormat.parse(date+" "+sjdd+":00").getTime();
  96 +// Long date1=simpleDateFormat.parse(date+" "+sjfc+":00").getTime();
  97 +// Long date2=simpleDateFormat.parse(date+" "+sjdd+":00").getTime();
  98 + Long date1=simpleDateFormat.parse(sjfc+":00").getTime();
  99 + Long date2=simpleDateFormat.parse(sjdd+":00").getTime();
98 100 Date dates=simpleDateFormat.parse(date+" 00:00:00");
99 101 List<ArrivalInfo> lists=load(line,sbbb,date1,date2,dates,date);
100 102  
... ... @@ -129,20 +131,22 @@ public class ReportServiceImpl implements ReportService{
129 131 cal.setTime(dates);
130 132 //周数,表分区字段
131 133 int weeks_year = cal.get(Calendar.WEEK_OF_YEAR);
132   -
  134 + int weeks_year_next=weeks_year +1;
133 135 Connection conn = null;
134 136 PreparedStatement ps = null;
135 137 ResultSet rs = null;
136 138 String year=date.substring(0,4);
137   - String sql = "select * from bsth_c_arrival_info_"+year+" where device_id=? AND line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
  139 + String sql = "select * from bsth_c_arrival_info_"+year+" where device_id=? AND line_id=? "
  140 + + " AND weeks_year>=? AND weeks_year<=? AND ts >= ? AND ts <=? order by ts";
138 141 try{
139 142 conn = DBUtils_MS.getConnection();
140 143 ps = conn.prepareStatement(sql);
141 144 ps.setString(1, sbbb);
142 145 ps.setString(2,line);
143 146 ps.setInt(3, weeks_year);
144   - ps.setLong(4, date1);
145   - ps.setLong(5, date2);
  147 + ps.setInt(4, weeks_year_next);
  148 + ps.setLong(5, date1);
  149 + ps.setLong(6, date2);
146 150 rs = ps.executeQuery();
147 151  
148 152 list = resultSet2Set(rs);
... ...
src/main/java/com/bsth/service/report/impl/SheetServiceImpl.java
... ... @@ -44,6 +44,7 @@ import com.bsth.util.BatchSaveUtils;
44 44 import com.bsth.util.ComparableChild;
45 45 import com.bsth.util.ComparableReal;
46 46 import com.bsth.util.ReportRelatedUtils;
  47 +import com.bsth.util.ReportUtils;
47 48 import com.google.common.util.concurrent.AbstractScheduledService.Scheduler;
48 49  
49 50 @Service
... ... @@ -611,6 +612,24 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
611 612 }
612 613  
613 614 }
  615 +
  616 + if(map.containsKey("type") && map.get("type").toString().equals("export")){
  617 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  618 + Map<String, Object> m = new HashMap<String, Object>();
  619 + m.put("date", date);
  620 + m.put("endDate", endDate);
  621 + ReportUtils ee = new ReportUtils();
  622 + try {
  623 + listI.add(listmap.iterator());
  624 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  625 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "sheetList.xls",
  626 + path + "export/发车准点率"+date.replaceAll("-", "")+"-"+endDate.replaceAll("-", "")+".xls");
  627 + } catch (Exception e) {
  628 + // TODO: handle exception
  629 + e.printStackTrace();
  630 + }
  631 + }
  632 +
614 633 return listmap;
615 634 }
616 635  
... ... @@ -738,7 +757,33 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
738 757 // TODO Auto-generated catch block
739 758 e.printStackTrace();
740 759 }
741   -
  760 + }
  761 +
  762 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  763 + Map<String, Object> m = new HashMap<String, Object>();
  764 + ReportUtils ee = new ReportUtils();
  765 + try {
  766 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  767 + for(int i = 0; i < list.size(); i++){
  768 + Map<String, Object> temp = new HashMap<String, Object>();
  769 + Sheet s = list.get(i);
  770 + temp.put("id", i+1);
  771 + temp.put("date", s.getDate());
  772 + temp.put("line", s.getLine());
  773 + temp.put("zdname", s.getZdname());
  774 + temp.put("jhsj", s.getJhsj());
  775 + temp.put("sjsj", s.getSjsj());
  776 + temp.put("sfzd", s.getSfzd());
  777 + tempList.add(temp);
  778 + }
  779 + listI.add(tempList.iterator());
  780 + m.put("date", sheet.getDate());
  781 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  782 + ee.excelReplace(listI, new Object[]{m}, path + "mould/sheetList2.xls",
  783 + path + "export/发车准点率"+sheet.getDate().replaceAll("-", "")+".xls");
  784 + } catch (Exception e) {
  785 + // TODO: handle exception
  786 + e.printStackTrace();
742 787 }
743 788  
744 789 return list;
... ... @@ -800,6 +845,24 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
800 845 listmap.add(newmap);
801 846 }
802 847 }
  848 +
  849 + if(map.containsKey("type") && map.get("type").toString().equals("export")){
  850 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  851 + Map<String, Object> m = new HashMap<String, Object>();
  852 + m.put("date", date);
  853 + m.put("endDate", endDate);
  854 + ReportUtils ee = new ReportUtils();
  855 + try {
  856 + listI.add(listmap.iterator());
  857 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  858 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "sheetList1.xls",
  859 + path + "export/发车准点率"+date.replaceAll("-", "")+"-"+endDate.replaceAll("-", "")+".xls");
  860 + } catch (Exception e) {
  861 + // TODO: handle exception
  862 + e.printStackTrace();
  863 + }
  864 + }
  865 +
803 866 return listmap;
804 867 }
805 868  
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
... ... @@ -63,6 +63,8 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
63 63 /** 售票员工号s */
64 64 private List<String> spyGhs;
65 65  
  66 + /** 创建时间 */
  67 + private Date createDate;
66 68 /** 修改时间 */
67 69 private Date updateDate;
68 70 /** 修改人名 */
... ... @@ -70,6 +72,14 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
70 72 /** 时刻表名字 */
71 73 private String ttInfoName;
72 74  
  75 + //------------------- 修改yuan原因,描述,次数 ------------------------//
  76 + // 修改次数
  77 + private Integer m_count;
  78 + // 修改原因
  79 + private Integer m_reason;
  80 + // 修改描述
  81 + private String m_desc;
  82 +
73 83 @Override
74 84 public int compareTo(SchedulePlanGroupInfo o) {
75 85 // 路牌名字排序,数字路牌名在前,非数字在后
... ... @@ -104,9 +114,13 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
104 114 ", GROUP_CONCAT(distinct info.j_gh order by info.fcno) as jsyGhs " +
105 115 ", GROUP_CONCAT(distinct info.s_name order by info.fcno) as spyNames " +
106 116 ", GROUP_CONCAT(distinct info.s_gh order by info.fcno) as spyGhs " +
  117 + ", max(info.create_date) as createDate " +
107 118 ", max(info.update_date) as updateDate " +
108 119 ", max(user.user_name) as updateUserName " +
109 120 ", max(info.tt_info_name) as ttInfoName " +
  121 + ", max(info.modify_count) as m_count " +
  122 + ", max(info.modify_reason) as m_reason " +
  123 + ", max(info.modify_remark) as m_desc " +
110 124 "from bsth_c_s_sp_info info left join bsth_c_sys_user user on info.update_by = user.id " +
111 125 "left join bsth_c_s_gbi gbi on info.lp = gbi.id " +
112 126 "where info.xl = ? and info.schedule_date = ? " +
... ... @@ -171,10 +185,15 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
171 185 this.spyGhs.addAll(Arrays.asList(spyGhs_temp.split(",")));
172 186 }
173 187  
  188 + this.createDate = new Date(rs.getTimestamp("createDate").getTime());
174 189 this.updateDate = new Date(rs.getTimestamp("updateDate").getTime());
175 190 this.updateByName = rs.getString("updateUserName");
176 191 this.ttInfoName = rs.getString("ttInfoName");
177 192  
  193 + this.m_count = rs.getInt("m_count");
  194 + this.m_reason = rs.getInt("m_reason");
  195 + this.m_desc = rs.getString("m_desc");
  196 +
178 197 }
179 198  
180 199 public Integer getXlId() {
... ... @@ -296,6 +315,38 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
296 315 public void setTtInfoName(String ttInfoName) {
297 316 this.ttInfoName = ttInfoName;
298 317 }
  318 +
  319 + public Integer getM_count() {
  320 + return m_count;
  321 + }
  322 +
  323 + public void setM_count(Integer m_count) {
  324 + this.m_count = m_count;
  325 + }
  326 +
  327 + public Integer getM_reason() {
  328 + return m_reason;
  329 + }
  330 +
  331 + public void setM_reason(Integer m_reason) {
  332 + this.m_reason = m_reason;
  333 + }
  334 +
  335 + public String getM_desc() {
  336 + return m_desc;
  337 + }
  338 +
  339 + public void setM_desc(String m_desc) {
  340 + this.m_desc = m_desc;
  341 + }
  342 +
  343 + public Date getCreateDate() {
  344 + return createDate;
  345 + }
  346 +
  347 + public void setCreateDate(Date createDate) {
  348 + this.createDate = createDate;
  349 + }
299 350 }
300 351  
301 352 //---------------------------- 以下是过去版本 -------------------------------//
... ...
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
... ... @@ -556,15 +556,33 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
556 556 Station station1 = stationService.findById(lpObjList.get(0).getStationRouteId1());
557 557 Station station2 = stationService.findById(lpObjList.get(1).getStationRouteId2());
558 558 PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (1),
  559 + "报到", new Color(0x96b9d7));
  560 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (2),
559 561 "出场", new Color(0x96b9d7));
560 562 for (int i = 1; i <= groupCount; i++) {
561   - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2),
562   - station1.getStationName(), new Color(0x96b9d7));
563 563 PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1),
  564 + station1.getStationName(), new Color(0x96b9d7));
  565 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 2),
564 566 station2.getStationName(), new Color(0x96b9d7));
565 567 }
566   - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 2),
  568 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 3),
567 569 "进场", new Color(0x96b9d7));
  570 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 4),
  571 + "离场", new Color(0x96b9d7));
  572 +
  573 + // 路牌统计字段
  574 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 5),
  575 + "总公里", new Color(0x96b9d7));
  576 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 6),
  577 + "营业公里", new Color(0x96b9d7));
  578 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 7),
  579 + "空驶公里", new Color(0x96b9d7));
  580 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 8),
  581 + "总工时", new Color(0x96b9d7));
  582 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 9),
  583 + "营业工时", new Color(0x96b9d7));
  584 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 10),
  585 + "营运班次", new Color(0x96b9d7));
568 586  
569 587 // 构建每个路牌的班次数据
570 588 for (int i = 0; i < lpObjList.size(); i++) {
... ... @@ -572,34 +590,86 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
572 590 XSSFRow lpRow = sheet.createRow((short) (i + 1));
573 591 PoiUtils.createStringXSSFCell(wb, lpRow, (short) 0, lpObj.getLpname());
574 592 PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (1));
  593 + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (2));
575 594 for (int j = 1; j <= groupCount; j++) {
576   - PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2));
577 595 PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 1));
  596 + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 2));
578 597 }
579   - PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 2));
  598 +
  599 + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 3));
  600 + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 4));
580 601  
581 602 for (BcObj bcObj : lpObj.getBcObjList()) {
582 603 if (bcObj.getBcType() == BcType.NORMAL) {
583   - Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 2));
  604 + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3));
584 605 cell.setCellValue(bcObj.getFcsj());
  606 +
  607 + } else if (bcObj.getBcType() == BcType.BD) {
  608 + if (bcObj.getGroupNo() == -1) {
  609 + Cell cell = lpRow.getCell((short) 1);
  610 + cell.setCellValue(bcObj.getFcsj());
  611 + } else if (bcObj.getGroupNo() > 0) { // 分班报到
  612 + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3));
  613 + cell.setCellValue("报" + bcObj.getFcsj());
  614 +
  615 + }
  616 +
585 617 } else if (bcObj.getBcType() == BcType.OUT) {
586   - Cell cell = lpRow.getCell((short) (1));
587   - cell.setCellValue(bcObj.getFcsj());
  618 + if (bcObj.getGroupNo() == -1) {
  619 + Cell cell = lpRow.getCell((short) (2));
  620 + cell.setCellValue(bcObj.getFcsj());
  621 + } else if (bcObj.getGroupNo() > 0) { // 分班出场
  622 + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3));
  623 + cell.setCellValue("出" + bcObj.getFcsj());
  624 + }
  625 +
588 626 } else if (bcObj.getBcType() == BcType.IN) {
589   - Cell cell = lpRow.getCell((short) (groupCount * 2 + 2));
590   - cell.setCellValue(bcObj.getFcsj());
  627 + if (bcObj.getGroupNo() == -2) {
  628 + Cell cell = lpRow.getCell((short) (groupCount * 2 + 3));
  629 + cell.setCellValue(bcObj.getFcsj());
  630 + } else if (bcObj.getGroupNo() > 0) { //分班进场
  631 + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3));
  632 + // 停驶用 ※
  633 + cell.setCellValue(bcObj.getFcsj() + "X");
  634 + }
  635 +
  636 + } else if (bcObj.getBcType() == BcType.LC) {
  637 + if (bcObj.getGroupNo() == -2) {
  638 + Cell cell = lpRow.getCell((short) (groupCount * 2 + 4));
  639 + cell.setCellValue(bcObj.getFcsj());
  640 + }
  641 +
591 642 }
592 643 }
  644 +
  645 + // 路牌统计字段
  646 + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 5), lpObj.getZlc());
  647 + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 6), lpObj.getYylc());
  648 + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 7), lpObj.getKslc());
  649 + PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 8),
  650 + String.format("%d小时%d分钟", (int) (lpObj.getZgs() / 60), (int) (lpObj.getZgs() % 60)));
  651 + PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 9),
  652 + String.format("%d小时%d分钟", (int) (lpObj.getYygs() / 60), (int) (lpObj.getYygs() % 60)));
  653 + PoiUtils.createIntegerXSSFCell(wb, lpRow, (short) (groupCount * 2 + 10), lpObj.getYybc());
  654 +
593 655 }
594 656  
595 657 // 自适应单元格长宽
596 658 sheet.autoSizeColumn(0);
597 659 sheet.autoSizeColumn(1);
  660 + sheet.autoSizeColumn(2);
598 661 for (int i = 1; i <= groupCount; i++) {
599   - sheet.autoSizeColumn(i * 2);
600 662 sheet.autoSizeColumn(i * 2 + 1);
  663 + sheet.autoSizeColumn(i * 2 + 2);
601 664 }
602   -
  665 + sheet.autoSizeColumn(groupCount * 2 + 3);
  666 + sheet.autoSizeColumn(groupCount * 2 + 4);
  667 + sheet.autoSizeColumn(groupCount * 2 + 5);
  668 + sheet.autoSizeColumn(groupCount * 2 + 6);
  669 + sheet.autoSizeColumn(groupCount * 2 + 7);
  670 + sheet.autoSizeColumn(groupCount * 2 + 8);
  671 + sheet.autoSizeColumn(groupCount * 2 + 9);
  672 + sheet.autoSizeColumn(groupCount * 2 + 10);
603 673 }
604 674  
605 675 @Override
... ...
src/main/java/com/bsth/service/schedule/datatools/TTinfoDetailDynamicData.java
1   -package com.bsth.service.schedule.datatools;
2   -
3   -import com.bsth.service.schedule.exception.ScheduleException;
4   -import com.bsth.service.schedule.utils.DataToolsFile;
5   -import com.fasterxml.jackson.annotation.JsonCreator;
6   -import com.fasterxml.jackson.annotation.JsonValue;
7   -
8   -import java.util.List;
9   -
10   -/**
11   - * 动态时刻表数据。
12   - */
13   -public interface TTinfoDetailDynamicData {
14   -
15   - //---------------------- 生成时刻表用对象(以下) ---------------------//
16   - public static enum BcType { // 班次类型枚举
17   - IN("in"), // 进场
18   - OUT("out"), // 出场
19   - BD("bd"), // 早例保
20   - LC("lc"), // 晚例保
21   - NORMAL("normal"); // 正常
22   - private String flag;
23   -
24   - @JsonCreator
25   - private BcType(String flag) {
26   - this.flag = flag;
27   - }
28   -
29   - @JsonValue
30   - public String getFlag() {
31   - return flag;
32   - }
33   -
34   - public void setFlag(String flag) {
35   - this.flag = flag;
36   - }
37   - }
38   -
39   - public static class BcObj { // 班次对象
40   - /** 班次时间 */
41   - private Integer bcsj;
42   - /** 停站时间 */
43   - private Integer ssj;
44   - /** 吃饭时间 */
45   - private Integer eatsj;
46   -
47   - /** 停车场id */
48   - private Integer tccid;
49   - /** 起点站id */
50   - private Integer qdzid;
51   - /** 终点站id */
52   - private Integer zdzid;
53   -
54   - /** 是否上行 */
55   - private Boolean isUp;
56   -
57   - /** 班次类型 */
58   - private BcType bcType;
59   - /** 发车时刻 */
60   - private String fcsj;
61   - /** 用于统计的发车时间描述(把进出场,保养,吃饭时间写在一起) */
62   - private String fcsjDesc;
63   -
64   - /** 第几圈(从1开始) */
65   - private Integer groupNo;
66   - /** 圈里第几个班次(1或者2) */
67   - private Integer groupBcNo;
68   -
69   - public Integer getBcsj() {
70   - return bcsj;
71   - }
72   -
73   - public void setBcsj(Integer bcsj) {
74   - this.bcsj = bcsj;
75   - }
76   -
77   - public Integer getSsj() {
78   - return ssj;
79   - }
80   -
81   - public void setSsj(Integer ssj) {
82   - this.ssj = ssj;
83   - }
84   -
85   - public Integer getEatsj() {
86   - return eatsj;
87   - }
88   -
89   - public void setEatsj(Integer eatsj) {
90   - this.eatsj = eatsj;
91   - }
92   -
93   - public Integer getTccid() {
94   - return tccid;
95   - }
96   -
97   - public void setTccid(Integer tccid) {
98   - this.tccid = tccid;
99   - }
100   -
101   - public Integer getQdzid() {
102   - return qdzid;
103   - }
104   -
105   - public void setQdzid(Integer qdzid) {
106   - this.qdzid = qdzid;
107   - }
108   -
109   - public Integer getZdzid() {
110   - return zdzid;
111   - }
112   -
113   - public void setZdzid(Integer zdzid) {
114   - this.zdzid = zdzid;
115   - }
116   -
117   - public BcType getBcType() {
118   - return bcType;
119   - }
120   -
121   - public void setBcType(BcType bcType) {
122   - this.bcType = bcType;
123   - }
124   -
125   - public String getFcsj() {
126   - return fcsj;
127   - }
128   -
129   - public void setFcsj(String fcsj) {
130   - this.fcsj = fcsj;
131   - }
132   -
133   - public Boolean getIsUp() {
134   - return isUp;
135   - }
136   -
137   - public void setIsUp(Boolean isUp) {
138   - this.isUp = isUp;
139   - }
140   -
141   - public Integer getGroupNo() {
142   - return groupNo;
143   - }
144   -
145   - public void setGroupNo(Integer groupNo) {
146   - this.groupNo = groupNo;
147   - }
148   -
149   - public Integer getGroupBcNo() {
150   - return groupBcNo;
151   - }
152   -
153   - public void setGroupBcNo(Integer groupBcNo) {
154   - this.groupBcNo = groupBcNo;
155   - }
156   -
157   - public Boolean getUp() {
158   - return isUp;
159   - }
160   -
161   - public void setUp(Boolean up) {
162   - isUp = up;
163   - }
164   -
165   - public String getFcsjDesc() {
166   - return fcsjDesc;
167   - }
168   -
169   - public void setFcsjDesc(String fcsjDesc) {
170   - this.fcsjDesc = fcsjDesc;
171   - }
172   - }
173   -
174   - public static class LpObj { // 路牌对象
175   - /** 路牌名字 */
176   - private String lpname;
177   - /** 每圈的第一个班次是否上行 */
178   - private Boolean isUp;
179   -
180   - /** 第一个班次起点站路由id */
181   - private Integer stationRouteId1;
182   - /** 第二个班次起点站路由id */
183   - private Integer stationRouteId2;
184   -
185   - /** 班次列表 */
186   - private List<BcObj> bcObjList;
187   - /** 总圈数 */
188   - private Integer groupCount;
189   -
190   - /** 总工时 */
191   - private Double zgs;
192   - /** 总班次 */
193   - private Integer zbc;
194   -
195   -
196   - public String getLpname() {
197   - return lpname;
198   - }
199   -
200   - public void setLpname(String lpname) {
201   - this.lpname = lpname;
202   - }
203   -
204   - public Boolean getIsUp() {
205   - return isUp;
206   - }
207   -
208   - public void setIsUp(Boolean isUp) {
209   - this.isUp = isUp;
210   - }
211   -
212   - public List<BcObj> getBcObjList() {
213   - return bcObjList;
214   - }
215   -
216   - public void setBcObjList(List<BcObj> bcObjList) {
217   - this.bcObjList = bcObjList;
218   - }
219   -
220   - public Integer getGroupCount() {
221   - return groupCount;
222   - }
223   -
224   - public void setGroupCount(Integer groupCount) {
225   - this.groupCount = groupCount;
226   - }
227   -
228   - public Double getZgs() {
229   - return zgs;
230   - }
231   -
232   - public void setZgs(Double zgs) {
233   - this.zgs = zgs;
234   - }
235   -
236   - public Integer getZbc() {
237   - return zbc;
238   - }
239   -
240   - public void setZbc(Integer zbc) {
241   - this.zbc = zbc;
242   - }
243   -
244   - public Integer getStationRouteId1() {
245   - return stationRouteId1;
246   - }
247   -
248   - public void setStationRouteId1(Integer stationRouteId1) {
249   - this.stationRouteId1 = stationRouteId1;
250   - }
251   -
252   - public Integer getStationRouteId2() {
253   - return stationRouteId2;
254   - }
255   -
256   - public void setStationRouteId2(Integer stationRouteId2) {
257   - this.stationRouteId2 = stationRouteId2;
258   - }
259   - }
260   -
261   - public static class StatInfo { // 统计数据对象
262   - /** 统计项目 */
263   - private String statItem;
264   - /** 统计值 */
265   - private Double statValue;
266   -
267   - public String getStatItem() {
268   - return statItem;
269   - }
270   -
271   - public void setStatItem(String statItem) {
272   - this.statItem = statItem;
273   - }
274   -
275   - public Double getStatValue() {
276   - return statValue;
277   - }
278   -
279   - public void setStatValue(Double statValue) {
280   - this.statValue = statValue;
281   - }
282   - }
283   -
284   - public static class DTInfos { // 所有数据信息
285   - /** 路牌班次数据列表 */
286   - private List<LpObj> lpObjList;
287   - /** 统计数据列表 */
288   - private List<StatInfo> statInfoList;
289   -
290   - public List<LpObj> getLpObjList() {
291   - return lpObjList;
292   - }
293   -
294   - public void setLpObjList(List<LpObj> lpObjList) {
295   - this.lpObjList = lpObjList;
296   - }
297   -
298   - public List<StatInfo> getStatInfoList() {
299   - return statInfoList;
300   - }
301   -
302   - public void setStatInfoList(List<StatInfo> statInfoList) {
303   - this.statInfoList = statInfoList;
304   - }
305   - }
306   -
307   - //---------------------- 生成时刻表用对象(以上) ---------------------//
308   -
309   - /**
310   - * 导出动态时刻表数据。
311   - * @param dtInfos
312   - * @return
313   - * @throws ScheduleException
314   - */
315   - public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException;
316   -}
  1 +package com.bsth.service.schedule.datatools;
  2 +
  3 +import com.bsth.service.schedule.exception.ScheduleException;
  4 +import com.bsth.service.schedule.utils.DataToolsFile;
  5 +import com.fasterxml.jackson.annotation.JsonCreator;
  6 +import com.fasterxml.jackson.annotation.JsonValue;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 动态时刻表数据。
  12 + */
  13 +public interface TTinfoDetailDynamicData {
  14 +
  15 + //---------------------- 生成时刻表用对象(以下) ---------------------//
  16 + public static enum BcType { // 班次类型枚举
  17 + IN("in"), // 进场
  18 + OUT("out"), // 出场
  19 + BD("bd"), // 早例保
  20 + LC("lc"), // 晚例保
  21 + NORMAL("normal"); // 正常
  22 + private String flag;
  23 +
  24 + @JsonCreator
  25 + private BcType(String flag) {
  26 + this.flag = flag;
  27 + }
  28 +
  29 + @JsonValue
  30 + public String getFlag() {
  31 + return flag;
  32 + }
  33 +
  34 + public void setFlag(String flag) {
  35 + this.flag = flag;
  36 + }
  37 + }
  38 +
  39 + public static class BcObj { // 班次对象
  40 + /** 班次时间 */
  41 + private Integer bcsj;
  42 + /** 停站时间 */
  43 + private Integer ssj;
  44 + /** 吃饭时间 */
  45 + private Integer eatsj;
  46 +
  47 + /** 停车场id */
  48 + private Integer tccid;
  49 + /** 起点站id */
  50 + private Integer qdzid;
  51 + /** 终点站id */
  52 + private Integer zdzid;
  53 +
  54 + /** 是否上行 */
  55 + private Boolean isUp;
  56 +
  57 + /** 班次类型 */
  58 + private BcType bcType;
  59 + /** 发车时刻 */
  60 + private String fcsj;
  61 + /** 用于统计的发车时间描述(把进出场,保养,吃饭时间写在一起) */
  62 + private String fcsjDesc;
  63 +
  64 + /** 第几圈(从1开始) */
  65 + private Integer groupNo;
  66 + /** 圈里第几个班次(1或者2) */
  67 + private Integer groupBcNo;
  68 +
  69 + public Integer getBcsj() {
  70 + return bcsj;
  71 + }
  72 +
  73 + public void setBcsj(Integer bcsj) {
  74 + this.bcsj = bcsj;
  75 + }
  76 +
  77 + public Integer getSsj() {
  78 + return ssj;
  79 + }
  80 +
  81 + public void setSsj(Integer ssj) {
  82 + this.ssj = ssj;
  83 + }
  84 +
  85 + public Integer getEatsj() {
  86 + return eatsj;
  87 + }
  88 +
  89 + public void setEatsj(Integer eatsj) {
  90 + this.eatsj = eatsj;
  91 + }
  92 +
  93 + public Integer getTccid() {
  94 + return tccid;
  95 + }
  96 +
  97 + public void setTccid(Integer tccid) {
  98 + this.tccid = tccid;
  99 + }
  100 +
  101 + public Integer getQdzid() {
  102 + return qdzid;
  103 + }
  104 +
  105 + public void setQdzid(Integer qdzid) {
  106 + this.qdzid = qdzid;
  107 + }
  108 +
  109 + public Integer getZdzid() {
  110 + return zdzid;
  111 + }
  112 +
  113 + public void setZdzid(Integer zdzid) {
  114 + this.zdzid = zdzid;
  115 + }
  116 +
  117 + public BcType getBcType() {
  118 + return bcType;
  119 + }
  120 +
  121 + public void setBcType(BcType bcType) {
  122 + this.bcType = bcType;
  123 + }
  124 +
  125 + public String getFcsj() {
  126 + return fcsj;
  127 + }
  128 +
  129 + public void setFcsj(String fcsj) {
  130 + this.fcsj = fcsj;
  131 + }
  132 +
  133 + public Boolean getIsUp() {
  134 + return isUp;
  135 + }
  136 +
  137 + public void setIsUp(Boolean isUp) {
  138 + this.isUp = isUp;
  139 + }
  140 +
  141 + public Integer getGroupNo() {
  142 + return groupNo;
  143 + }
  144 +
  145 + public void setGroupNo(Integer groupNo) {
  146 + this.groupNo = groupNo;
  147 + }
  148 +
  149 + public Integer getGroupBcNo() {
  150 + return groupBcNo;
  151 + }
  152 +
  153 + public void setGroupBcNo(Integer groupBcNo) {
  154 + this.groupBcNo = groupBcNo;
  155 + }
  156 +
  157 + public Boolean getUp() {
  158 + return isUp;
  159 + }
  160 +
  161 + public void setUp(Boolean up) {
  162 + isUp = up;
  163 + }
  164 +
  165 + public String getFcsjDesc() {
  166 + return fcsjDesc;
  167 + }
  168 +
  169 + public void setFcsjDesc(String fcsjDesc) {
  170 + this.fcsjDesc = fcsjDesc;
  171 + }
  172 + }
  173 +
  174 + public static class LpObj { // 路牌对象
  175 + /** 路牌名字 */
  176 + private String lpname;
  177 + /** 每圈的第一个班次是否上行 */
  178 + private Boolean isUp;
  179 +
  180 + /** 第一个班次起点站路由id */
  181 + private Integer stationRouteId1;
  182 + /** 第二个班次起点站路由id */
  183 + private Integer stationRouteId2;
  184 +
  185 + /** 班次列表 */
  186 + private List<BcObj> bcObjList;
  187 + /** 总圈数 */
  188 + private Integer groupCount;
  189 +
  190 + //---------------- 路牌统计 ---------------//
  191 + /** 总里程 */
  192 + private Double zlc;
  193 + /** 营运里程 */
  194 + private Double yylc;
  195 + /** 空驶里程 */
  196 + private Double kslc;
  197 + /** 总工时 */
  198 + private Double zgs;
  199 + /** 总班次 */
  200 + private Integer zbc;
  201 + /** 营运工时 */
  202 + private Double yygs;
  203 + /** 营运班次 */
  204 + private Integer yybc;
  205 +
  206 + public String getLpname() {
  207 + return lpname;
  208 + }
  209 +
  210 + public void setLpname(String lpname) {
  211 + this.lpname = lpname;
  212 + }
  213 +
  214 + public Boolean getIsUp() {
  215 + return isUp;
  216 + }
  217 +
  218 + public void setIsUp(Boolean isUp) {
  219 + this.isUp = isUp;
  220 + }
  221 +
  222 + public List<BcObj> getBcObjList() {
  223 + return bcObjList;
  224 + }
  225 +
  226 + public void setBcObjList(List<BcObj> bcObjList) {
  227 + this.bcObjList = bcObjList;
  228 + }
  229 +
  230 + public Integer getGroupCount() {
  231 + return groupCount;
  232 + }
  233 +
  234 + public void setGroupCount(Integer groupCount) {
  235 + this.groupCount = groupCount;
  236 + }
  237 +
  238 + public Integer getStationRouteId1() {
  239 + return stationRouteId1;
  240 + }
  241 +
  242 + public void setStationRouteId1(Integer stationRouteId1) {
  243 + this.stationRouteId1 = stationRouteId1;
  244 + }
  245 +
  246 + public Integer getStationRouteId2() {
  247 + return stationRouteId2;
  248 + }
  249 +
  250 + public void setStationRouteId2(Integer stationRouteId2) {
  251 + this.stationRouteId2 = stationRouteId2;
  252 + }
  253 +
  254 + public Boolean getUp() {
  255 + return isUp;
  256 + }
  257 +
  258 + public void setUp(Boolean up) {
  259 + isUp = up;
  260 + }
  261 +
  262 + public Double getZlc() {
  263 + return zlc;
  264 + }
  265 +
  266 + public void setZlc(Double zlc) {
  267 + this.zlc = zlc;
  268 + }
  269 +
  270 + public Double getYylc() {
  271 + return yylc;
  272 + }
  273 +
  274 + public void setYylc(Double yylc) {
  275 + this.yylc = yylc;
  276 + }
  277 +
  278 + public Double getKslc() {
  279 + return kslc;
  280 + }
  281 +
  282 + public void setKslc(Double kslc) {
  283 + this.kslc = kslc;
  284 + }
  285 +
  286 + public Double getZgs() {
  287 + return zgs;
  288 + }
  289 +
  290 + public void setZgs(Double zgs) {
  291 + this.zgs = zgs;
  292 + }
  293 +
  294 + public Integer getZbc() {
  295 + return zbc;
  296 + }
  297 +
  298 + public void setZbc(Integer zbc) {
  299 + this.zbc = zbc;
  300 + }
  301 +
  302 + public Double getYygs() {
  303 + return yygs;
  304 + }
  305 +
  306 + public void setYygs(Double yygs) {
  307 + this.yygs = yygs;
  308 + }
  309 +
  310 + public Integer getYybc() {
  311 + return yybc;
  312 + }
  313 +
  314 + public void setYybc(Integer yybc) {
  315 + this.yybc = yybc;
  316 + }
  317 + }
  318 +
  319 + public static class StatInfo { // 统计数据对象
  320 + /** 统计项目 */
  321 + private String statItem;
  322 + /** 统计值 */
  323 + private Double statValue;
  324 +
  325 + public String getStatItem() {
  326 + return statItem;
  327 + }
  328 +
  329 + public void setStatItem(String statItem) {
  330 + this.statItem = statItem;
  331 + }
  332 +
  333 + public Double getStatValue() {
  334 + return statValue;
  335 + }
  336 +
  337 + public void setStatValue(Double statValue) {
  338 + this.statValue = statValue;
  339 + }
  340 + }
  341 +
  342 + public static class DTInfos { // 所有数据信息
  343 + /** 路牌班次数据列表 */
  344 + private List<LpObj> lpObjList;
  345 + /** 统计数据列表 */
  346 + private List<StatInfo> statInfoList;
  347 +
  348 + public List<LpObj> getLpObjList() {
  349 + return lpObjList;
  350 + }
  351 +
  352 + public void setLpObjList(List<LpObj> lpObjList) {
  353 + this.lpObjList = lpObjList;
  354 + }
  355 +
  356 + public List<StatInfo> getStatInfoList() {
  357 + return statInfoList;
  358 + }
  359 +
  360 + public void setStatInfoList(List<StatInfo> statInfoList) {
  361 + this.statInfoList = statInfoList;
  362 + }
  363 + }
  364 +
  365 + //---------------------- 生成时刻表用对象(以上) ---------------------//
  366 +
  367 + /**
  368 + * 导出动态时刻表数据。
  369 + * @param dtInfos
  370 + * @return
  371 + * @throws ScheduleException
  372 + */
  373 + public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException;
  374 +}
317 375 \ No newline at end of file
... ...
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
... ... @@ -636,8 +636,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
636 636  
637 637 if(model.length() != 0){
638 638 // sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type != 'in' and bc_type != 'out'";
639   - sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
640   -
  639 + sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out'" +
  640 + " and bc_type != 'ldks' and schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'";
  641 + if(line.length() != 0){
  642 + sql += " and xl_bm = '"+line+"'";
  643 + }
  644 +
641 645 ttList = jdbcTemplate.query(sql,
642 646 new RowMapper<Long>(){
643 647 @Override
... ... @@ -645,7 +649,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
645 649 return rs.getLong("id");
646 650 }
647 651 });
648   -
649 652 }
650 653  
651 654 } catch (Exception e) {
... ... @@ -1126,38 +1129,39 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1126 1129 @Override
1127 1130 public List<Map<String, Object>> getModel(Map<String, Object> map) {
1128 1131 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1129   - List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
1130   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1131   - SimpleDateFormat sdfEE = new SimpleDateFormat("EEEE");
  1132 +// List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  1133 +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  1134 +// SimpleDateFormat sdfEE = new SimpleDateFormat("EEEE");
1132 1135  
1133 1136 String line = map.get("line").toString();
1134 1137 String startDate = map.get("startDate").toString();
1135 1138 String endDate = map.get("endDate").toString();
  1139 + String isCancel = "";
1136 1140  
1137   - if(startDate.length() == 0){
1138   - startDate = sdf.format(new Date());
1139   - }
1140   - if(endDate.length() == 0){
1141   - endDate = sdf.format(new Date());
  1141 + if(map.containsKey("isCancel") && map.get("isCancel").toString().trim().length() > 0){
  1142 + isCancel = map.get("isCancel").toString().trim();
1142 1143 }
1143 1144 try {
1144   -
1145   - String sql = "select tt.id, tt.name, qyrq, tt.rule_days, tt.special_days from bsth_c_s_ttinfo tt left join bsth_c_line cl on cl.id = tt.xl where tt.is_cancel = 0 and tt.is_enable_dis_template = 1";
1146   - if(line.length() != 0){
1147   - sql += " and cl.line_code = '"+line+"'";
  1145 + String sql = "select tt.id, tt.name from bsth_c_s_ttinfo tt left join" +
  1146 + " (select tt_info from bsth_c_s_sp_info where 1=1";
  1147 + if(startDate.trim().length() > 0)
  1148 + sql += " and schedule_date >= '"+startDate+"'";
  1149 + if(endDate.trim().length() > 0)
  1150 + sql += " and schedule_date <= '"+endDate+"'";
  1151 + if(line.trim().length() != 0){
  1152 + sql += " and xl_bm = '"+line+"'";
  1153 + } else {
  1154 + return resList;
1148 1155 }
1149   - sql += " order by tt.create_date desc";
  1156 + sql += " ) sp on sp.tt_info = tt.id where sp.tt_info is not null group by tt.id, tt.name";
1150 1157  
1151   - list = jdbcTemplate.query(sql,
  1158 + resList = jdbcTemplate.query(sql,
1152 1159 new RowMapper<Map<String, Object>>(){
1153 1160 @Override
1154 1161 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1155 1162 Map<String, Object> map = new HashMap<String, Object>();
1156 1163 map.put("id", rs.getString("id"));
1157 1164 map.put("name", rs.getString("name"));
1158   - map.put("qyrq", rs.getString("qyrq"));
1159   - map.put("ruleDays", rs.getString("rule_days"));
1160   - map.put("specialDays", rs.getString("special_days"));
1161 1165 return map;
1162 1166 }
1163 1167 });
... ... @@ -1167,73 +1171,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1167 1171 e.printStackTrace();
1168 1172 }
1169 1173  
1170   - Date date1 = null;
1171   - Date date2 = null;
1172   - try {
1173   - date1 = sdf.parse(startDate);
1174   - date2 = sdf.parse(endDate);
1175   - } catch (ParseException e) {
1176   - // TODO Auto-generated catch block
1177   - e.printStackTrace();
1178   - }
1179   -
1180   - Set<Integer> ruleDays1 = new HashSet<Integer>();
1181   - List<String> specialDays1 = new ArrayList<String>();
1182   - for(long i = 0; ; i++){
1183   - Date tempDate = new Date(date1.getTime() + i*1000*60*60*24);
1184   - if(tempDate.getTime() > date2.getTime())
1185   - break;
1186   - String week = sdfEE.format(tempDate);
1187   - if(week.equals("星期一"))
1188   - ruleDays1.add(0);
1189   - else if(week.equals("星期二"))
1190   - ruleDays1.add(1);
1191   - else if(week.equals("星期三"))
1192   - ruleDays1.add(2);
1193   - else if(week.equals("星期四"))
1194   - ruleDays1.add(3);
1195   - else if(week.equals("星期五"))
1196   - ruleDays1.add(4);
1197   - else if(week.equals("星期六"))
1198   - ruleDays1.add(5);
1199   - else if(week.equals("星期日"))
1200   - ruleDays1.add(6);
1201   - specialDays1.add(sdf.format(tempDate));
1202   - }
1203   - for(Map<String, Object> m : list){
1204   - String[] ruleDays = m.get("ruleDays").toString().split(",");
1205   - String[] specialDays = m.get("specialDays").toString().split(",");
1206   - boolean flag = false;
1207   - DO:{
1208   - try {
1209   - long qyrq = sdf.parse(m.get("qyrq").toString()).getTime();
1210   - if(qyrq > date2.getTime())
1211   - break;
1212   - } catch (ParseException e) {
1213   - // TODO Auto-generated catch block
1214   - e.printStackTrace();
1215   - }
1216   - for(int i = 0; i < ruleDays.length; i++){
1217   - if(ruleDays[i].equals("1")){
1218   - if(ruleDays1.contains(i)){
1219   - flag = true;
1220   - break DO;
1221   - }
1222   - }
1223   - }
1224   - for(int i = 0; i < specialDays.length; i++){
1225   - for(int j = 0; j < specialDays1.size(); j++){
1226   - if(specialDays[i].equals(specialDays1.get(j))){
1227   - flag = true;
1228   - break DO;
1229   - }
1230   - }
1231   - }
1232   - }
1233   - if(flag)
1234   - resList.add(m);
1235   - }
1236   -
1237 1174 return resList;
1238 1175 }
1239 1176  
... ... @@ -1344,7 +1281,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1344 1281 tempMap.put("date", date.substring(5));
1345 1282 tempMap.put("line", xlName);
1346 1283 List<Long> up1 = new ArrayList<Long>();
1347   - List<Long> up2 = new ArrayList<Long>();;
  1284 + List<Long> up2 = new ArrayList<Long>();
1348 1285 List<Long> dn1 = new ArrayList<Long>();
1349 1286 List<Long> dn2 = new ArrayList<Long>();
1350 1287 Map<Long, ScheduleRealInfo> up1Map = new HashMap<Long, ScheduleRealInfo>();
... ... @@ -1484,7 +1421,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1484 1421 }
1485 1422  
1486 1423 try {
1487   - String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name,"
  1424 + String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name,"
1488 1425 + " a.cc_service, a.remarks, a.adjust_exps, b.start_opt from bsth_c_s_sp_info_real a left join (select line, start_opt from bsth_c_line_config order by id desc) b on a.xl_bm = b.line"
1489 1426 + " where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'"
1490 1427 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'";
... ... @@ -1501,6 +1438,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1501 1438 schedule.setScheduleDateStr(rs.getString("schedule_date_str"));
1502 1439 schedule.setRealExecDate(rs.getString("real_exec_date"));
1503 1440 schedule.setXlName(rs.getString("xl_name"));
  1441 + schedule.setXlBm(rs.getString("xl_bm"));
1504 1442 schedule.setFcsj(rs.getString("fcsj"));
1505 1443 schedule.setFcsjActual(rs.getString("fcsj_actual"));
1506 1444 schedule.setZdsj(rs.getString("zdsj"));
... ... @@ -1552,6 +1490,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1552 1490 }
1553 1491  
1554 1492 Map<String, Map<String, List<ScheduleRealInfo>>> keyMap = new HashMap<String, Map<String,List<ScheduleRealInfo>>>();
  1493 + Map<String, String> xlMap = new HashMap<String, String>();
1555 1494 String companyName = "", subCompanyName = "";
1556 1495  
1557 1496 for(ScheduleRealInfo s : list){
... ... @@ -1569,6 +1508,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1569 1508 companyName = s.getGsName();
1570 1509 if(subCompanyName.length()==0&&s.getFgsName()!=null&&s.getFgsName().trim().length()!=0)
1571 1510 subCompanyName = s.getFgsName();
  1511 + xlMap.put(xlName, s.getXlBm());
1572 1512 }
1573 1513  
1574 1514 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
... ... @@ -1589,9 +1529,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1589 1529 String date = dateMap.get(l);
1590 1530 Map<String, Object> temp = new HashMap<String, Object>();
1591 1531 temp.put("date", date.substring(5));
  1532 + temp.put("dates", date);
1592 1533 temp.put("line", xlName);
  1534 + temp.put("xlbm", xlMap.get(xlName));
1593 1535 List<Long> up1 = new ArrayList<Long>();
1594   - List<Long> up2 = new ArrayList<Long>();;
  1536 + List<Long> up2 = new ArrayList<Long>();
1595 1537 List<Long> dn1 = new ArrayList<Long>();
1596 1538 List<Long> dn2 = new ArrayList<Long>();
1597 1539 Map<Long, ScheduleRealInfo> up1Map = new HashMap<Long, ScheduleRealInfo>();
... ... @@ -1633,11 +1575,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1633 1575 temp.put("sjfcLast0", s4.getFcsjActual());
1634 1576 temp.put("delayLast0", delayLast0>0?"+"+delayLast0:delayLast0);
1635 1577 jhbc += 2;
1636   - if(delayFirst0 <= 1l && delayFirst0 >= -3l){
  1578 + if(delayFirst0 <= 1l && delayFirst0 >= -2l){
1637 1579 sjbc++;
1638 1580 } else {
1639 1581 Map<String, Object> m = new HashMap<String, Object>();
1640 1582 m.put("date", date.substring(5));
  1583 + m.put("dates", date);
1641 1584 m.put("line", xlName);
1642 1585 m.put("firstOrLast", "上行首发");
1643 1586 m.put("qdz", s1.getQdzName());
... ... @@ -1649,11 +1592,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1649 1592 m.put("remarks", s1.getRemarks() + s2.getRemarks());
1650 1593 mapList.add(m);
1651 1594 }
1652   - if(delayLast0 <= 1l && delayLast0 >= -3l){
  1595 + if(delayLast0 <= 1l && delayLast0 >= -2l){
1653 1596 sjbc++;
1654 1597 } else {
1655 1598 Map<String, Object> m = new HashMap<String, Object>();
1656 1599 m.put("date", date.substring(5));
  1600 + m.put("dates", date);
1657 1601 m.put("line", xlName);
1658 1602 m.put("firstOrLast", "上行末发");
1659 1603 m.put("qdz", s3.getQdzName());
... ... @@ -1698,6 +1642,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1698 1642 } else {
1699 1643 Map<String, Object> m = new HashMap<String, Object>();
1700 1644 m.put("date", date.substring(5));
  1645 + m.put("dates", date);
1701 1646 m.put("line", xlName);
1702 1647 m.put("firstOrLast", "下行首发");
1703 1648 m.put("qdz", s1.getQdzName());
... ... @@ -1715,6 +1660,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1715 1660 } else {
1716 1661 Map<String, Object> m = new HashMap<String, Object>();
1717 1662 m.put("date", date.substring(5));
  1663 + m.put("dates", date);
1718 1664 m.put("line", xlName);
1719 1665 m.put("firstOrLast", "下行末发");
1720 1666 m.put("qdz", s3.getQdzName());
... ... @@ -1737,13 +1683,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1737 1683 temp.put("sjfcLast1", "/");
1738 1684 temp.put("delayLast1", "/");
1739 1685 }
  1686 + if((up1.size() == 0 || up2.size() == 0) && (dn1.size() == 0 || dn2.size() == 0))
  1687 + continue;
1740 1688 tempList.add(temp);
1741 1689 }
1742 1690 tempMap.put("map", tempList);
1743 1691 tempMap.put("company", companyName);
1744 1692 tempMap.put("subCompany", subCompanyName);
1745   - tempMap.put("date", dates);
  1693 + tempMap.put("xlbm", xlMap.get(xlName));
1746 1694 tempMap.put("line", xlName);
  1695 + tempMap.put("date", dates);
1747 1696 tempMap.put("jhbc", jhbc);
1748 1697 tempMap.put("sjbc", sjbc);
1749 1698 tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc *100)) + "%");
... ... @@ -1788,6 +1737,36 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1788 1737 // TODO: handle exception
1789 1738 e.printStackTrace();
1790 1739 }
  1740 + } else if(type.equals("exportMap")){
  1741 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1742 + Map<String,Object> m = new HashMap<String, Object>();
  1743 + ReportUtils ee = new ReportUtils();
  1744 + try {
  1745 + if(resList.size() > 0)
  1746 + listI.add(((List<Map<String, Object>>)resList.get(0).get("map")).iterator());
  1747 + listI.add(resList.iterator());
  1748 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  1749 + ee.excelReplace(listI, new Object[] { tempMap }, path+"mould/firstAndLastBus_map.xls",
  1750 + path+"export/线路首末班明细.xls");
  1751 + } catch (Exception e) {
  1752 + // TODO: handle exception
  1753 + e.printStackTrace();
  1754 + }
  1755 + } else if(type.equals("delay_export")){
  1756 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1757 + Map<String,Object> m = new HashMap<String, Object>();
  1758 + ReportUtils ee = new ReportUtils();
  1759 + try {
  1760 + if(resList.size() > 0)
  1761 + listI.add(((List<Map<String, Object>>)resList.get(resList.size() - 1).get("map")).iterator());
  1762 + listI.add(resList.iterator());
  1763 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  1764 + ee.excelReplace(listI, new Object[] { tempMap }, path+"mould/firstAndLastBus_delay.xls",
  1765 + path+"export/首末班误点班次.xls");
  1766 + } catch (Exception e) {
  1767 + // TODO: handle exception
  1768 + e.printStackTrace();
  1769 + }
1791 1770 }
1792 1771  
1793 1772 return resList;
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanInfoServiceImpl.java
... ... @@ -26,6 +26,17 @@ public class SchedulePlanInfoServiceImpl extends BServiceImpl&lt;SchedulePlanInfo,
26 26 private JdbcTemplate jdbcTemplate;
27 27  
28 28 @Override
  29 + public SchedulePlanInfo save(SchedulePlanInfo schedulePlanInfo) {
  30 + // 生成计划不是save,使用的是spring batch插入的
  31 + // 这里是单独修改的时候,需要记录修改次数,用于标识被修改过
  32 +
  33 + Integer currentModifyCount = schedulePlanInfo.getModifyCount();
  34 + schedulePlanInfo.setModifyCount(currentModifyCount == null ? 1 : ++ currentModifyCount);
  35 +
  36 + return super.save(schedulePlanInfo);
  37 + }
  38 +
  39 + @Override
29 40 public List<Date> findLastestPlanDate(Integer xlId) {
30 41 String sql = "select max(schedule_date) as sd from bsth_c_s_sp_info " +
31 42 "where xl = ?";
... ...
src/main/java/com/bsth/service/schedule/utils/PoiUtils.java
... ... @@ -82,7 +82,7 @@ public class PoiUtils {
82 82  
83 83 public static XSSFCell createDoubleXSSFCell(
84 84 XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, Double value) {
85   - return createXSSFCell(
  85 + XSSFCell xssfCell = createXSSFCell(
86 86 xssfWorkbook, xssfRow, column,
87 87 value, XSSFCell.CELL_TYPE_NUMERIC,
88 88 HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
... ... @@ -90,6 +90,10 @@ public class PoiUtils {
90 90 (short) 13, new Color(0x2765A7), "宋体",
91 91 new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
92 92 );
  93 +
  94 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  95 + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0.00"));
  96 + return xssfCell;
93 97 }
94 98  
95 99 public static XSSFCell createIntegerXSSFCell(
... ...
src/main/java/com/bsth/websocket/handler/SendUtils.java
... ... @@ -10,6 +10,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
10 10 import com.bsth.websocket.dto.WsScheduleRealInfo;
11 11 import com.fasterxml.jackson.core.JsonProcessingException;
12 12 import com.fasterxml.jackson.databind.ObjectMapper;
  13 +import org.apache.commons.lang3.StringUtils;
13 14 import org.slf4j.Logger;
14 15 import org.slf4j.LoggerFactory;
15 16 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -195,4 +196,24 @@ public class SendUtils{
195 196 logger.error("", e);
196 197 }
197 198 }
  199 +
  200 + /**
  201 + * 对所有线调用户进行广播
  202 + * @param t
  203 + */
  204 + public void sendRadioText(String t, String lineCode){
  205 + Map<String, Object> map = new HashMap<>();
  206 + map.put("fn", "admin_radio_text");
  207 + map.put("t", t);
  208 + ObjectMapper mapper = new ObjectMapper();
  209 +
  210 + try {
  211 + if(StringUtils.isNotEmpty(lineCode))
  212 + socketHandler.sendMessageToLine(lineCode, mapper.writeValueAsString(map));
  213 + else
  214 + socketHandler.sendMessage(mapper.writeValueAsString(map));
  215 + } catch (JsonProcessingException e) {
  216 + logger.error("", e);
  217 + }
  218 + }
198 219 }
... ...
src/main/resources/fatso/start.js
... ... @@ -16,7 +16,7 @@ var platform = process.platform;
16 16 var iswin = platform=='win32';
17 17 var sp = platform=='win32'?'\\':'/';
18 18 //不参与的目录
19   -var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission'+sp+'authorize_all', 'summary', 'history_sch' ,'report'+sp+'oil','base'+sp+'geo_data_edit', 'forms','mforms', 'report', 'punctual']
  19 +var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission'+sp+'authorize_all', 'summary', 'history_sch' ,'report'+sp+'oil','base'+sp+'geo_data_edit','base'+sp+'carpark','forms','mforms', 'report', 'punctual']
20 20 ,ep = new EventProxy()
21 21 ,pName = 'bsth_control'
22 22 ,path = process.cwd()
... ...
src/main/resources/static/pages/base/carpark/js/carpark-list-table.js
... ... @@ -30,7 +30,7 @@
30 30 var branchMap = new Map();
31 31 initCompanySelect2(function(array) {
32 32 $.each(array, function() {
33   - companyMap[this.businessCode] = this.businessName;
  33 + companyMap[this.businessCode] = this.busi nessName;
34 34 // companyMap.put(this.businessCode.toString(), this.businessName);
35 35 if(this.businessCode != null || this.businessCode !=''){
36 36 /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */
... ...
src/main/resources/static/pages/base/line/js/line-details-info.js
... ... @@ -8,6 +8,18 @@
8 8 */
9 9  
10 10 $(function(){
  11 + // 关闭左侧栏
  12 + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
  13 + /** 开辟日期 日期控件 <format:日期控件时间格式;locale:语言> */
  14 + $('#openDateInput').datetimepicker({format : 'YYYY-MM-DD', locale: 'zh-cn'});
  15 + /** 起始站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  16 + $('#startStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  17 + /** 起始站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  18 + $('#endTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  19 + /** 终点站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  20 + $('#endStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  21 + /** 终点站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  22 + $('#endStationEndTimeInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
11 23  
12 24 // 填充分公司下拉框选择值
13 25 function getbrancheCompanyValues(businessCode,cb){
... ...
src/main/resources/static/pages/base/line/js/line-list-table.js
... ... @@ -357,6 +357,9 @@
357 357 }else if(data.status=='NOTDATA') {
358 358 // 弹出添加成功提示消息
359 359 layer.msg('系统无线路【'+ lineName +'】的站点与路段信息!');
  360 + }else if(data.status=='NOLinePlayType') {
  361 + // 弹出添加成功提示消息
  362 + layer.msg('无法识别【'+ lineName +'】的线路规划类型,请设置为双向/环线!');
360 363 }
361 364 });
362 365 }
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-list-table.js
... ... @@ -6,8 +6,8 @@
6 6 // 关闭左侧栏
7 7 if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
8 8 // 定义 page : 当前页;initPag ; icheckOptions:选择框
9   - var page = 0,
10   - initPag,
  9 + window.page = 0;
  10 + var initPag,
11 11 icheckOptions = {checkboxClass: 'icheckbox_flat-blue',increaseArea: '20%'},
12 12 storage = window.localStorage;
13 13 if(storage.xlName_AgursData!=null && storage.xlName_AgursData !='') {
... ... @@ -301,7 +301,6 @@
301 301 });
302 302 // 线路版本编辑
303 303 $(document).on('click', 'a.update_versions_route_btn', function () {
304   - debugger
305 304 var lineId = $(this).data('lineid');
306 305 swal({
307 306 title: "操作须知",
... ...
src/main/resources/static/pages/base/stationroute/add.html
... ... @@ -360,6 +360,7 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao
360 360 ajaxd.getSectionRouteInfo(Line.id,add_direction_v,function(data) {
361 361 fun.linePanlThree(Line.id,data,add_direction_v);
362 362 });
  363 + fun.editMapStatusRemove();
363 364 }
364 365 function hideMoble() {
365 366 // 隐藏mobal
... ...
src/main/resources/static/pages/base/stationroute/add_manual_select.html
... ... @@ -31,8 +31,8 @@
31 31 </form>
32 32 </div>
33 33 <div class="modal-footer">
34   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
35 34 <button type="button" class="btn btn-primary" id="addManualSelectnextButton">下一步</button>
  35 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
36 36 </div>
37 37 </div>
38 38 </div>
... ...
src/main/resources/static/pages/base/stationroute/add_select.html
... ... @@ -38,8 +38,8 @@
38 38 </form>
39 39 </div>
40 40 <div class="modal-footer">
41   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
42 41 <button type="button" class="btn btn-primary" id="addSelectnextButton">下一步</button>
  42 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
43 43 </div>
44 44 </div>
45 45 </div>
... ... @@ -141,7 +141,7 @@ $(&#39;#add_select_mobal&#39;).on(&#39;AddSelectMobal.show&#39;, function(e,map_,drw,ajaxd_,stat
141 141 map_.localSearchFromAdreesToPoint(stationName,function(Points) {
142 142 if(Points) {
143 143 /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
144   - stationObj.setAddStationBJwpoints(Points);
  144 + stationObj.setAddStationJwpoints(Points);
145 145 /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
146 146 stationObj.setAddStationShapesType('r');
147 147 /** 设置新增站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
... ... @@ -164,12 +164,13 @@ $(&#39;#add_select_mobal&#39;).on(&#39;AddSelectMobal.show&#39;, function(e,map_,drw,ajaxd_,stat
164 164 }
165 165 });
166 166 }else if(baseRes==1) {
167   - map_.clearMarkAndOverlays();
  167 + // map_.clearMarkAndOverlays();
168 168 // 以藏站点新增方式mobal
169 169 $('#add_select_mobal').modal('hide');
170 170 // 打开绘制工具
171 171 drw.openDrawingManager();
172   - map_.localtionPoint(stationName);
  172 + // map_.localtionPoint(stationName);
  173 + fun.editMapStatus();
173 174 }
174 175 // 查询是否存在输入的站点名称
175 176 /* ajaxd_.getLikeStationName(stationName,function(data) {
... ...
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
1 1 #bmap_basic{
2 2 min-width: 100%;
3   - /*width: calc(100% + 26px); */
4 3 margin-top: -10px;
5   - border: 2px solid #fdfdfd;
6   - min-height: 1200px;
7 4 height:100%;
8   - overflow: hidden;
  5 +}
  6 +
  7 +.mian-portlet-body{
  8 + height: 100%;
9 9 }
10 10  
11 11 html,body{
12 12 overflow:hidden;
13   - height: 99%;
  13 + height: calc(100% - 10px);
  14 +}
  15 +
  16 +.protlet-box-layer{
  17 + position: absolute;
  18 + z-index: 900;
  19 + height: 100%;
  20 + width: 100%;
  21 + background: #ffffff85;
  22 + display: none;
14 23 }
15 24  
16 25 .rm3_image {
... ... @@ -19,6 +28,52 @@ html,body{
19 28  
20 29 }
21 30  
  31 +.search_panel{
  32 + position: absolute;
  33 + z-index: 99;
  34 + height: 41px;
  35 + top: 30px;
  36 + left: 500px;
  37 + background: #fff1f0;
  38 + padding: 0px;
  39 + box-shadow: 5px 1px 5px rgba(90, 90, 90, 0.48);
  40 +}
  41 +
  42 +.search_input_panel {
  43 + display: inline;
  44 + height: 41px;
  45 +}
  46 +
  47 +.search_input_panel .search_input {
  48 + width: 200px;
  49 + height: 41px;
  50 + padding:0 20px 0 10px;
  51 + float:left;
  52 + border:none;
  53 + outline: 0px;
  54 +}
  55 +
  56 +.search_input_panel .clear {
  57 + right: 40px;
  58 + position: absolute;
  59 + top: 15px;
  60 + width: 20px;
  61 +}
  62 +
  63 +.search_button_panel{
  64 + height: 41px;
  65 + display: inline;
  66 +}
  67 +
  68 +.search_button {
  69 + width: 38px;
  70 + height: 41px;
  71 + background: #fff1f0;
  72 + border:none;
  73 + top: 0;
  74 + outline: 0px;
  75 +}
  76 +
22 77 /* 隐藏百度地图logo */
23 78 .anchorBL,
24 79 .anchorBL,
... ... @@ -36,8 +91,16 @@ html,body{
36 91 height: auto;
37 92 background:transparent;
38 93 border:0px solid;
39   - box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33);
40   - border-radius: 6px !important;box-shadow: 10px 10px 5px #888888;
  94 + /*border-radius: 6px !important;*/
  95 + box-shadow: 5px 5px 5px rgba(90, 90, 90, 0.48);
  96 +
  97 +}
  98 +
  99 +.protlet-box .portlet-title {
  100 + background-color:#fff1f0;
  101 + font-weight: 600;
  102 + color: #000 !important;
  103 + padding: 0 0 0 15px;
41 104 }
42 105  
43 106 .help-block{
... ... @@ -45,47 +108,13 @@ html,body{
45 108 font-size: 15px;
46 109 }
47 110  
48   -/*.BMap_pop div:nth-child(1) ,*/
49   -/*.BMap_pop div:nth-child(2) ,*/
50   -/*.BMap_pop div:nth-child(3) ,*/
51   -/*.BMap_pop div:nth-child(4) ,*/
52   -/*.BMap_pop div:nth-child(5) ,*/
53   -/*.BMap_pop div:nth-child(6) ,*/
54   -/*.BMap_pop div:nth-child(7) {*/
55   - /**/
56   - /*border:0px solid rgb(255, 255, 255) !important;*/
57   - /*background-color:#3B3F51 !important;*/
58   - /**/
59   -/*}*/
60   -
61   -/*.BMap_pop div:nth-child(3){*/
62   - /**/
63   - /*width:23px !important;*/
64   - /**/
65   -/*}*/
66   -
67   -/*.BMap_pop div:nth-child(7) {*/
68   - /**/
69   - /*width:23px !important;*/
70   - /**/
71   - /*height:24px !important;*/
72   - /**/
73   -/*}*/
74   -
75   -/*.BMap_pop div:nth-child(5) {*/
76   - /**/
77   - /*height:24px !important;*/
78   - /**/
79   -/*}*/
80   -
81   -/* 图片以后在弄,先隐藏div */
82   -/*.BMap_pop div:nth-child(8) {*/
83   - /**/
84   - /*height:0px !important;*/
85   - /*!* background:url('/pages/base/stationroute/css/img/iw3-1.png') no-repeat !important; *!*/
86   - /*!* background-image:url('/pages/base/stationroute/css/img/windowinfo_b.jpg') !important; *!*/
87   - /**/
88   -/*}*/
  111 +.info_win_btn {
  112 + background: #ff8355;
  113 + color: #fff;
  114 + font-size: 12px;
  115 + margin: 0 5px 0 0;
  116 + border: 1px solid transparent;
  117 +}
89 118  
90 119 .BMap_pop {
91 120  
... ... @@ -94,36 +123,111 @@ html,body{
94 123 }
95 124  
96 125 .defeat-scroll {
97   -width: 98%;
98   -height:380px;
99   -/* overflow:auto; */
100   -overflow:hidden;
  126 + width: 98%;
  127 + height:380px;
  128 + overflow:hidden;
101 129 }
102 130 .defeat-scroll::-webkit-scrollbar {
103   -width:6px;
104   -height:6px;
  131 + width:6px;
  132 + height:6px;
105 133 }
106 134 .defeat-scroll::-webkit-scrollbar-button {
107   -/* background-color:#FF7677; */
108   -background:rgba(255, 255, 255, 0);
  135 + background:rgba(255, 255, 255, 0);
109 136 }
110 137 .defeat-scroll::-webkit-scrollbar-track {
111   -/* background:#FF66D5; */
112   -background:rgba(255, 255, 255, 0);
  138 + background:rgba(255, 255, 255, 0);
113 139 }
114 140 .defeat-scroll::-webkit-scrollbar-track-piece {
115   -/* background:#ff0000; */
116   -background:rgba(255, 255, 255, 0);
  141 + background:rgba(255, 255, 255, 0);
117 142 }
118 143 .defeat-scroll::-webkit-scrollbar-thumb{
119   -background:rgba(197, 196, 196, 0.81);
120   -border-radius:10px !important;
  144 + background:rgba(197, 196, 196, 0.81);
  145 + border-radius:10px !important;
121 146 }
122 147 .defeat-scroll::-webkit-scrollbar-corner {
123   -/* background:#82AFFF; */
124   -background:rgba(255, 255, 255, 0);
  148 + background:rgba(255, 255, 255, 0);
  149 +}
  150 +/*.defeat-scroll::-webkit-scrollbar-resizer {
  151 + background:rgba(255, 255, 255, 0);
  152 +}*/
  153 +
  154 +.add_road_search_point_wrap{
  155 + width: 280px;
  156 + height: 120px;
  157 + position: absolute;
  158 + top: 40px;
  159 + left: calc(50% - 100px);
  160 + z-index: 999;
  161 + background: #fdfdfd;
  162 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  163 +}
  164 +
  165 +.buffer_edit_body{
  166 + padding: 5px 0 0 15px;
  167 +}
  168 +
  169 +.buffer_edit_body .form-group{
  170 + margin-top: 10px;
  171 + margin-bottom: 0px;
  172 + white: 240px
  173 +}
  174 +
  175 +.add_road_search_point_wrap ._title {
  176 + padding-right: 18px;
  177 + text-align: center;
  178 + font-size: 17px;
  179 + color: #2b2b2b;
  180 + /*padding: 2px 0 0 0;*/
  181 + font-weight: 600;
  182 +}
  183 +
  184 +.buffer_edit_body .btns{
  185 + text-align: right;
125 186 }
126   -.defeat-scroll::-webkit-scrollbar-resizer {
127   -/* background:#FF0BEE; */
128   -background:rgba(255, 255, 255, 0);
129   -}
130 187 \ No newline at end of file
  188 +
  189 +.buffer_edit_body .form-group .inline{
  190 + width: 100px !important;
  191 + height: 30px;
  192 + margin-right: 7px;
  193 + display: inline-block;
  194 + position: relative;
  195 + max-width: 100%;
  196 + vertical-align: middle;
  197 +}
  198 +
  199 +.sbmint-btn {
  200 + padding: 0 15px;
  201 + height: 28px;
  202 + line-height: 28px;
  203 + vertical-align: top;
  204 + margin-top: 2px;
  205 + background-color: #1e87f0;
  206 + color: #fff;
  207 + border: 1px solid transparent;
  208 +}
  209 +.cancel-btn {
  210 + padding: 0 15px;
  211 + height: 28px;
  212 + line-height: 28px;
  213 + vertical-align: top;
  214 + margin-top: 2px;
  215 + background-color: transparent;
  216 + color: #333;
  217 + border: 1px solid #e5e5e5;
  218 +}
  219 +
  220 +.draw_polyline_switch{
  221 + display: inline-block;
  222 + font-size: 12px;
  223 + vertical-align: bottom;
  224 + margin-left: 5px;
  225 +}
  226 +
  227 +.draw_polyline_switch>a{
  228 + color: red;
  229 +}
  230 +
  231 +.buffer_edit_body .form-group input{
  232 + height: 30px;
  233 +}
  234 +
... ...
src/main/resources/static/pages/base/stationroute/delete_select.html
... ... @@ -29,9 +29,9 @@
29 29 </form>
30 30 </div>
31 31 <div class="modal-footer">
32   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
33 32 <button type="button" class="btn btn-primary"
34   - id="deleteSelectnextButton">下一步</button>
  33 + id="deleteSelectnextButton">下一步</button>
  34 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
35 35 </div>
36 36 </div>
37 37 </div>
... ...
src/main/resources/static/pages/base/stationroute/deletesection.html
... ... @@ -139,25 +139,25 @@ $(&#39;#delete_section_mobal&#39;).on(&#39;deleteSectionMobal.show&#39;,function(e, ajaxd, line,
139 139 ids = ids.substr(1, ids.length - 1);
140 140 var params = {};
141 141 params.ids = ids;
142   - $.get('/sectionroute/batchDestroy',params,function(resuntDate) {
143   - if (resuntDate.status == 'SUCCESS') {
144   - // 弹出添加成功提示消息
145   - layer.msg('修改成功...');
146   - /** 通知更新缓存区 */
147   - //$.post('http://192.168.168.171:8800/transport_server/basic/refresh',function(rs) {console.log(rs)})
148   - } else {
149   - // 弹出添加失败提示消息
150   - layer.msg('修改失败...');
151   - }
152   - initSearch();
153   - // 刷新左边树
154   - fun.resjtreeDate(line.id,delBatch.dir);
155   - /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */
156   - ajaxd.getSectionRouteInfo(line.id,delBatch.dir,function(data) {
157   - /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */
158   - fun.linePanlThree(line.id,data,delBatch.dir);
159   - });
160   - });
  142 + $.post('/sectionroute/batchDestroy',params,function(resuntDate) {
  143 + if (resuntDate.status == 'SUCCESS') {
  144 + // 弹出添加成功提示消息
  145 + layer.msg('修改成功...');
  146 + /** 通知更新缓存区 */
  147 + //$.post('http://192.168.168.171:8800/transport_server/basic/refresh',function(rs) {console.log(rs)})
  148 + } else {
  149 + // 弹出添加失败提示消息
  150 + layer.msg('修改失败...');
  151 + }
  152 + initSearch();
  153 + // 刷新左边树
  154 + fun.resjtreeDate(line.id,delBatch.dir);
  155 + /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */
  156 + ajaxd.getSectionRouteInfo(line.id,delBatch.dir,function(data) {
  157 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */
  158 + fun.linePanlThree(line.id,data,delBatch.dir);
  159 + });
  160 + });
161 161 } else {
162 162 layer.msg('请选择要删除的路段!!!');
163 163 }
... ...
src/main/resources/static/pages/base/stationroute/deletestation.html
... ... @@ -141,7 +141,7 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line,
141 141 ids = ids.substr(1, ids.length - 1);
142 142 var params = {};
143 143 params.ids = ids;
144   - $.get('/stationroute/batchDestroy',params,function(resuntDate) {
  144 + $.post('/stationroute/batchDestroy',params,function(resuntDate) {
145 145 if (resuntDate.status == 'SUCCESS') {
146 146 // 弹出添加成功提示消息
147 147 layer.msg('修改成功...');
... ...
src/main/resources/static/pages/base/stationroute/doublename_road.html
... ... @@ -32,8 +32,8 @@
32 32 </form>
33 33 </div>
34 34 <div class="modal-footer">
35   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
36 35 <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button>
  36 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
37 37 </div>
38 38 </div>
39 39 </div>
... ... @@ -79,7 +79,7 @@
79 79 });
80 80 function closeMobleSetClean() {
81 81 // 清除地图覆盖物
82   - map_.clearMarkAndOverlays();
  82 + // map_.clearMarkAndOverlays();
83 83 fun.resjtreeDate(lineId,dir);
84 84 fun.editAChangeCssRemoveDisabled();
85 85 ajaxd.getSectionRouteInfo(lineId,dir,function(data) {
... ... @@ -128,12 +128,11 @@
128 128 params.versions = versions;
129 129 // 生成路段
130 130 $.get('/section/doubleName',params,function (resuntDate) {
131   - debugger
132 131 if(resuntDate.status=='SUCCESS') {
133 132 // 弹出添加成功提示消息
134 133 layer.msg('生成成功...');
135 134 } else if (resuntDate.status=='Failure') {
136   - layer.msg('抱歉,选取的路段太短,无法生成双路段!');
  135 + layer.msg('抱歉,您选取的路段基于高德地图的数据无法生成双路段!');
137 136 } else {
138 137 // 弹出添加失败提示消息
139 138 layer.msg('生成失败...');
... ... @@ -141,7 +140,7 @@
141 140 $('#doublename_road_mobal').modal('hide');
142 141 var dir = params.directions;
143 142 // 刷行左边树
144   - fun.resjtreeDate(lineId,dir);
  143 + // fun.resjtreeDate(lineId,dir);
145 144 closeMobleSetClean();
146 145 });
147 146 });
... ...
src/main/resources/static/pages/base/stationroute/edit.html
... ... @@ -21,25 +21,19 @@
21 21 <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
22 22 <input type="hidden" name="x" id="xInput" value=""/>
23 23 <input type="hidden" name="y" id="yInput" value=""/>
  24 + <input type="hidden" name="zdmc" id="zdmcInput"/>
  25 + <input type="hidden" name="descriptions" id="descriptionsTextarea" />
  26 + <input type="hidden" name="directions" id="stationdirSelect" />
  27 +
  28 + <!-- 站点名称 -->
24 29 <!-- 站点名称 -->
25 30 <div class="form-body">
26 31 <div class="form-group">
27 32 <label class="control-label col-md-3">
28   - <span class="required"> * </span> 站点名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
29   - </label>
30   - <div class="col-md-6">
31   - <input type="text" class="form-control" name="zdmc" id="zdmcInput" placeholder="站点名称" readonly="readonly">
32   - </div>
33   - </div>
34   - </div>
35   - <!-- 站点路由名称 -->
36   - <div class="form-body">
37   - <div class="form-group">
38   - <label class="control-label col-md-3">
39   - <span class="required"> * </span> 站点路由名称:
  33 + <span class="required"> * </span> 站点名称:
40 34 </label>
41 35 <div class="col-md-6">
42   - <input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点路由名称">
  36 + <input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点名称" readonly="readonly">
43 37 </div>
44 38 </div>
45 39 </div>
... ... @@ -54,21 +48,6 @@
54 48 </div>
55 49 </div>
56 50 </div>
57   - <!-- 站点方向 -->
58   - <div class="form-body">
59   - <div class="form-group">
60   - <label class="control-label col-md-3">
61   - <span class="required"> * </span>站点方向&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
62   - </label>
63   - <div class="col-md-6">
64   - <select name="directions" class="form-control" id="stationdirSelect">
65   - <option value="">-- 请选择站点类型 --</option>
66   - <option value="0">上行</option>
67   - <option value="1">下行</option>
68   - </select>
69   - </div>
70   - </div>
71   - </div>
72 51 <!-- 站点序号 -->
73 52 <div class="form-body">
74 53 <div class="form-group">
... ... @@ -175,13 +154,6 @@
175 154 </div>
176 155 </div>
177 156 </div>
178   - <!-- 描述/说明 -->
179   - <div class="form-group">
180   - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;: </label>
181   - <div class="col-md-6">
182   - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
183   - </div>
184   - </div>
185 157 </form>
186 158 </div>
187 159 <div class="modal-footer">
... ... @@ -198,7 +170,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
198 170 var editStationParmasObj = station_.getEitdStation();
199 171 var addLine = Line_.getLineObj();
200 172 fun.setFormValue(editStationParmasObj);
201   - var initzdlyP = {'lineCode_eq':editStationParmasObj.stationRouteLineCode,'destroy_eq':0,'directions_eq':editStationParmasObj.stationRouteDirections};
  173 + var initzdlyP = {'lineCode_eq':editStationParmasObj.stationRouteLIneCode,'destroy_eq':0,'directions_eq':editStationParmasObj.stationRoutedirections};
202 174 initSelect(initzdlyP);
203 175 // 显示mobal
204 176 $('#edit_station_mobal').modal({show : true,backdrop: 'static',keyboard: false});
... ... @@ -217,6 +189,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
217 189 ajaxd.getSectionRouteInfo(addLine.id,add_direction_v,function(data) {
218 190 fun.linePanlThree(addLine.id,data,add_direction_v);
219 191 });
  192 + fun.editMapStatusRemove();
220 193 }
221 194 // 编辑表单元素
222 195 var form = $('#edit_station_form');
... ... @@ -283,7 +256,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
283 256 var id = addLine.id;
284 257 var dir = params.directions
285 258 // 刷行左边树
286   - fun.resjtreeDate(id,dir);
  259 + // fun.resjtreeDate(id,dir);
287 260 closeMobleSetClean();
288 261 });
289 262 }
... ... @@ -312,7 +285,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
312 285 $.each(array, function(i, g){
313 286 // 判断.
314 287 if(g.name!='' || g.name != null) {
315   - if(g.stationRouteCode != editStationParmasObj.stationRouteStationRouteCode) {
  288 + if(g.stationRouteCode != editStationParmasObj.stationRouteCode) {
316 289 // 添加拼音检索下拉框格式数据数组.
317 290 if(editStationParmasObj.stationRouteStationMark=='E' && i == (len_-2)){
318 291 paramsD.push({'id':g.stationRouteCode + '_' + 'E' + '_' + g.directions,
... ... @@ -333,13 +306,13 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
333 306 });
334 307 }
335 308 function setZdlyValue() {
336   - ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRouteDirections,editStationParmasObj.stationRouteStationRouteCode,function(str) {
  309 + ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRoutedirections,editStationParmasObj.stationRouteCode,function(str) {
337 310 if(str.length>0){
338 311 var upStationRouteCode;
339 312 if (editStationParmasObj.stationRouteStationMark == 'E') {
340   - upStationRouteCode = str[0].stationRouteCode + '_' + 'E' + '_' + editStationParmasObj.stationRouteDirections;
  313 + upStationRouteCode = str[0].stationRouteCode + '_' + 'E' + '_' + editStationParmasObj.stationRoutedirections;
341 314 } else{
342   - upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRouteDirections;
  315 + upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRoutedirections;
343 316 }
344 317 $('#stationrouteSelect').select2('val',upStationRouteCode);
345 318 }else {
... ... @@ -374,5 +347,5 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
374 347 }
375 348 return tel;
376 349 }, '方向必须一致!');
377   -});
  350 +});
378 351 </script>
379 352 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/edit_select.html
... ... @@ -19,7 +19,7 @@
19 19 系统无法生成,请选择其他方式新增
20 20 </div>
21 21 <div class="form-group" id="formRequ">
22   - <label class="col-md-3 control-label"><span class="required"> * </span>原始站点名称:</label>
  22 + <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label>
23 23 <div class="col-md-9" id="errorInfo">
24 24 <input type="text" class="form-control input-medium" id="stationNamebootbox" name="stationNamebootbox">
25 25 </div>
... ... @@ -40,17 +40,14 @@
40 40 </form>
41 41 </div>
42 42 <div class="modal-footer">
43   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
44 43 <button type="button" class="btn btn-primary" id="editselectStationNextButton">下一步</button>
  44 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
45 45 </div>
46 46 </div>
47 47 </div>
48 48 </div>
49 49 <script type="text/javascript">
50   -$('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,editStationObj,lineObj,fun,dir_){
51   - var sel = fun.getCurrSelNode(dir_);
52   - debugger
53   - var Station = sel[0].original;
  50 +$('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,editStationObj,lineObj,fun,Station){
54 51 // 显示选择修改方式弹出层
55 52 $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false});
56 53 setTimeout(function(){
... ... @@ -75,7 +72,7 @@ $(&#39;#edit_select_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,drw,ajaxd,ed
75 72 setTimeout(function(){$('.tipso-animation').tipso('hide');},4000);
76 73 },500);
77 74 // 获取站点名称元素并赋值
78   - $('#stationNamebootbox').val(Station.stationStationName);
  75 + $('#stationNamebootbox').val(Station.stationRouteName);
79 76 // 定义站点图形
80 77 var stationShapesTypeV = Station.stationShapesType;
81 78 // 获取表单元素
... ... @@ -118,28 +115,25 @@ $(&#39;#edit_select_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,drw,ajaxd,ed
118 115 var editStationName = params.stationNamebootbox;
119 116  
120 117 if(params.editselect==0){
121   - $('#downLine').addClass('btn disabled');
122   - $('.btn-circle').addClass('disabled');
123   - $('#upLine').addClass('btn disabled');
124 118 editStationObj.setEitdStation(Station);
125 119 editStationObj.setEitdStationName(editStationName);
126 120  
127   - map_.clearMarkAndOverlays();
  121 + // map_.clearMarkAndOverlays();
128 122 // 打开绘制工具
129 123 drw.openDrawingManager();
130   - map_.localtionPoint(editStationName);
  124 + map_.localtionPoint(editStationName+"公交站点");
  125 + fun.editMapStatus();
131 126 }else if(params.editselect==1){
132   - $('#downLine').addClass('btn disabled');
133   - $('.btn-circle').addClass('disabled');
134   - $('#upLine').addClass('btn disabled');
135 127 editStationObj.setEitdStation(Station);
136 128 editStationObj.setEitdStationName(editStationName);
137   -
  129 + map_.clearMark();
138 130 // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
139 131 var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px',
140 132 shift: 0,time: 3000});
141 133 // 编辑图形
142   - map_.editShapes(editStationName,stationShapesTypeV,mindex);
  134 + // map_.editShapes(editStationName,stationShapesTypeV,mindex);
  135 + map_.editShapes(editStationObj);
  136 + fun.editMapStatus();
143 137 }
144 138 }
145 139 });
... ...
src/main/resources/static/pages/base/stationroute/editsection.html
... ... @@ -14,12 +14,17 @@
14 14 <!-- 线路ID -->
15 15 <input type="hidden" name="sectionId" id="sectionIdInput">
16 16 <input type="hidden" name="sectionRouteId" id="sectionRouteIdInput">
  17 + <input type="hidden" name="sectionCode" id="sectionCodeInput">
17 18 <input type="hidden" name="sectionRouteLine" id="sectionRouteLineInput">
18 19 <input type="hidden" name="lineCode" id="lineCodeInput">
19 20 <input type="hidden" name="bsectionVector" id="bsectionVectorInput" />
20 21 <input type="hidden" name="csectionVector" id="csectionVectorInput" value=""/>
21 22 <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
22 23 <input type="hidden" name="isRoadeSpeed" id="isRoadeSpeedInput"/>
  24 + <input type="hidden" name="directions" id="directionsSection">
  25 + <input type="hidden" name="speedLimit" id="speedLimitInput" >
  26 + <input type="hidden" name="roadCoding" id="roadCodingCodInput"/>
  27 + <input type="hidden" name="versions" id="versionsInput"/>
23 28 <!-- 路段名称 -->
24 29 <div class="form-body">
25 30 <div class="form-group">
... ... @@ -31,17 +36,6 @@
31 36 </div>
32 37 </div>
33 38 </div>
34   - <!-- 路段编码 -->
35   - <div class="form-body">
36   - <div class="form-group">
37   - <label class="control-label col-md-3">
38   - <span class="required"> * </span> 路段编码:
39   - </label>
40   - <div class="col-md-6">
41   - <input type="text" class="form-control" name="sectionCode" id="sectionCodeInput" placeholder="路段编码" readonly="readonly">
42   - </div>
43   - </div>
44   - </div>
45 39 <!-- 路段序号 -->
46 40 <div class="form-body">
47 41 <div class="form-group">
... ... @@ -54,103 +48,20 @@
54 48 </div>
55 49 </div>
56 50 </div>
57   - <!-- 路段方向 -->
58   - <div class="form-body">
59   - <div class="form-group">
60   - <label class="control-label col-md-3">
61   - <span class="required"> * </span>路段方向:
62   - </label>
63   - <div class="col-md-6">
64   - <select name="directions" class="form-control" id="directionsSection">
65   - <option value="">-- 请选择路段类型 --</option>
66   - <option value="0">上行</option>
67   - <option value="1">下行</option>
68   - </select>
69   - </div>
70   - </div>
71   - </div>
72   - <!-- 路段限速 -->
73   - <div class="form-body">
74   - <div class="form-group">
75   - <label class="control-label col-md-3">
76   - <span class="required"> * </span> 路段限速:
77   - </label>
78   - <div class="col-md-6">
79   - <input type="text" class="form-control" name="speedLimit" id="speedLimitInput" placeholder="路段限速">
80   - </div>
81   - </div>
82   - </div>
83   - <!-- 是否撤销 -->
84   - <div class="form-body">
85   - <div class="form-group">
86   - <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销:</label>
87   - <div class="col-md-6">
88   - <select name="destroy" class="form-control" id="destroySelect">
89   - <option value="">-- 请选择撤销类型 --</option>
90   - <option value="0">否</option>
91   - <option value="1">是</option>
92   - </select>
93   - </div>
94   - </div>
95   - </div>
96   - <!-- 道路编码-->
97   - <div class="form-body">
98   - <div class="form-group">
99   - <label class="control-label col-md-3">道路编码:</label>
100   - <div class="col-md-6">
101   - <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput" placeholder="道路编码">
102   - </div>
103   - </div>
104   - </div>
105   - <!-- 路段长度 -->
106   - <div class="form-body">
107   - <div class="form-group">
108   - <label class="col-md-3 control-label">路段长度:</label>
109   - <div class="col-md-6">
110   - <input type="text" class="form-control" name="sectionDistance" id="sectionDistanceInput" placeholder="路段长度">
111   - <span class="help-block">单位:公里(km)</span>
112   - </div>
113   - </div>
114   - </div>
115   - <!-- 路段历时 -->
116   - <div class="form-body">
117   - <div class="form-group">
118   - <label class="col-md-3 control-label">路段历时:</label>
119   - <div class="col-md-6">
120   - <input type="text" class="form-control" name="sectionTime" id="sectionTimeInput" placeholder="路段历时">
121   - <span class="help-block">单位:分钟(min)</span>
122   - </div>
123   - </div>
124   - </div>
125   - <!-- 版本号 -->
126   - <div class="form-body">
127   - <div class="form-group">
128   - <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;:</label>
129   - <div class="col-md-6">
130   - <input type="text" class="form-control" name="versions" id="versionsInput" Readonly>
131   - </div>
132   - </div>
133   - </div>
134   - <!-- 描述/说明 -->
135   - <div class="form-group">
136   - <label class="control-label col-md-3"> 描述/说明: </label>
137   - <div class="col-md-6">
138   - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
139   - </div>
140   - </div>
  51 +
141 52 </form>
142 53 </div>
143 54 <div class="modal-footer">
144   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
145 55 <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button>
  56 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
146 57 </div>
147 58 </div>
148 59 </div>
149 60 </div>
150 61 <script type="text/javascript">
151 62  
152   -$('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,section,fun){
153   - var Section = section.getEitdSection();
  63 +$('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fun){
  64 + var Section = p.data;
154 65 fun.setSectionFormValue(Section);
155 66 // 方向
156 67 var dir = Section.sectionrouteDirections;
... ... @@ -159,15 +70,6 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
159 70 ajaxd.getStation(lineId,dir,function(treeData) {
160 71 var array = treeData[0].children[1].children,paramsD =new Array();
161 72 var eq_scetionRouteCode = Section.sectionrouteCode;
162   - /* for(var i = 0 ; i<dArray.length; i++){
163   - var ptions_v = dArray[i].sectionrouteCode;
164   - if(eq_scetionRouteCode == ptions_v){
165   - continue;
166   - }
167   - options += '<option value="'+ ptions_v +'">'+dArray[i].sectionName + ' (' + ptions_v +')'
168   - + ' --' + fun.dirdmToName(dArray[i].sectionrouteDirections) + '</option>' ;
169   - }
170   - $('#sectionrouteCodeSelect').html(options); */
171 73 paramsD.push({'id':'请选择...','text':'将此路段设置位第一个路段'});
172 74 // 遍历.
173 75 $.each(array, function(i, g){
... ... @@ -195,16 +97,14 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
195 97 });
196 98 });
197 99 // 显示mobal
198   - $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false});
  100 + $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false});//
199 101 // 当调用 hide 实例方法时触发
200 102 $('#edit_section_mobal').on('hide.bs.modal', function () {
201 103 closeMobleSetClean();
202 104 });
203 105 function closeMobleSetClean() {
204   - // 清除地图覆盖物
205   - map_.clearMarkAndOverlays();
206   - /** 设置修改路段集合对象为空 */
207   - section.setEitdSection({});
  106 + // 清除地图覆盖物
  107 + map_.clearMarkAndOverlays();
208 108 fun.resjtreeDate(lineId,dir);
209 109 fun.editAChangeCssRemoveDisabled();
210 110 ajaxd.getSectionRouteInfo(lineId,dir,function(data) {
... ... @@ -227,14 +127,14 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
227 127 focusInvalid : false,
228 128 rules : {
229 129 'sectionName' : {required : true,maxlength:50},// 路段名称 必填项
230   - 'sectionCode': {required : true,},// 路段编码 必填项
  130 + /*'sectionCode': {required : true,},// 路段编码 必填项
231 131 'directions' : {required : true,},// 路段方向 必填项
232 132 'speedLimit' : {required : true,number : true},// 路段限速 必须输入合法的数字(负数,小数)。
233 133 'destroy' : {required : true,},// 是否撤销 必填项.
234 134 'roadCoding' : {number : true},// 道路编码 必须输入合法的数字(负数,小数)。
235 135 'sectionTime' : {number : true},// 路段时长 必须输入合法的数字(负数,小数)。
236 136 'sectionDistance' : {number : true},// 路段长度 必须输入合法的数字(负数,小数)。
237   - 'descriptions' : {maxlength: 150}// 描述与说明 最大长度.
  137 + 'descriptions' : {maxlength: 150}// 描述与说明 最大长度.*/
238 138 },
239 139 invalidHandler : function(event, validator) {
240 140 error.show();
... ... @@ -250,7 +150,14 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
250 150 label.closest('.form-group').removeClass('has-error');
251 151 },
252 152 submitHandler : function(f) {
  153 + // 获取折线坐标集合
  154 + var editPloyLineArray = p.getPath();
  155 + // 折线坐标集合
  156 + $('#bsectionVectorInput').val(JSON.stringify(editPloyLineArray));
253 157 var params = form.serializeJSON();
  158 + params.destroy=0;
  159 + params.sectionDistance=0;
  160 + params.sectionTime=0;
254 161 error.hide();
255 162 if(params.sectionrouteCode=='请选择...')
256 163 params.sectionrouteCode='';
... ... @@ -264,8 +171,6 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
264 171 }
265 172 $('#edit_section_mobal').modal('hide');
266 173 var dir = params.directions
267   - // 刷行左边树
268   - fun.resjtreeDate(lineId,dir);
269 174 closeMobleSetClean();
270 175 });
271 176 }
... ...