Commit ca7ada0af21f3b71ac47713b1a8c93f1b0c5667b

Authored by 徐烜
1 parent ace4e67e

处理代码冲突

Too many changes to show.

To preserve performance only 9 of 24 files are displayed.

src/main/java/com/bsth/XDApplication.java
1   -<<<<<<< HEAD
2   -package com.bsth;
3   -
4   -import com.bsth.data.BasicData;
5   -import com.bsth.data.LineVersionsData;
6   -import com.bsth.data.ThreadMonotor;
7   -import com.bsth.data.car_out_info.UpdateDBThread;
8   -import com.bsth.data.directive.DirectivesPstThread;
9   -import com.bsth.data.forecast.SampleTimeDataLoader;
10   -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
11   -import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread;
12   -import com.bsth.data.msg_queue.DirectivePushQueue;
13   -import com.bsth.data.msg_queue.WebSocketPushQueue;
14   -import com.bsth.data.safe_driv.SafeDrivDataLoadThread;
15   -import com.bsth.data.schedule.DayOfSchedule;
16   -import com.bsth.data.schedule.auto_exec.AutoExecScanThread;
17   -import com.bsth.data.schedule.e_state_check.thread.FixedCheckStationCodeThread;
18   -import com.bsth.data.schedule.edit_logs.SeiPstThread;
19   -import com.bsth.data.schedule.late_adjust.ScheduleLateThread;
20   -import com.bsth.data.schedule.signal.SchSiginUpdateDBThread;
21   -import com.bsth.data.schedule.thread.CalcOilThread;
22   -import com.bsth.data.schedule.thread.SchedulePstThread;
23   -import com.bsth.data.schedule.thread.ScheduleRefreshThread;
24   -import com.bsth.data.schedule.thread.SubmitToTrafficManage;
25   -import com.bsth.util.DateUtils;
26   -import com.bsth.util.Tools;
27   -import org.slf4j.Logger;
28   -import org.slf4j.LoggerFactory;
29   -import org.springframework.beans.factory.annotation.Autowired;
30   -import org.springframework.boot.CommandLineRunner;
31   -import org.springframework.stereotype.Component;
32   -
33   -import java.util.concurrent.ScheduledExecutorService;
34   -import java.util.concurrent.TimeUnit;
35   -
36   -/**
37   - * 线调大部分服务都在这里启动
38   - * Created by panzhao on 2017/5/14.
39   - */
40   -@Component
41   -public class XDApplication implements CommandLineRunner {
42   -
43   - Logger log = LoggerFactory.getLogger(this.getClass());
44   -
45   - @Autowired
46   - BasicData.BasicDataLoader basicDataLoader;
47   - @Autowired
48   - UpdateDBThread fcxxUpdateThread;
49   - @Autowired
50   - ScheduleRefreshThread scheduleRefreshThread;
51   - @Autowired
52   - SchedulePstThread schedulePstThread;
53   - @Autowired
54   - ScheduleLateThread scheduleLateThread;
55   - @Autowired
56   - SubmitToTrafficManage submitToTrafficManage;
57   - @Autowired
58   - CalcOilThread calcOilThread;
59   - @Autowired
60   - DirectivesPstThread directivesPstThread;
61   - @Autowired
62   - ThreadMonotor threadMonotor;
63   - @Autowired
64   - SeiPstThread seiPstThread;
65   - @Autowired
66   - SampleTimeDataLoader sampleTimeDataLoader;
67   - @Autowired
68   - SchSiginUpdateDBThread schSiginUpdateDBThread;
69   - @Autowired
70   - AutoExecScanThread autoExecScanThread;
71   -
72   - @Autowired
73   - GpsDataLoaderThread gpsDataLoader;
74   -
75   - @Autowired
76   - OfflineMonitorThread offlineMonitorThread;
77   -
78   - @Autowired
79   - LineVersionsData lineVersionsData;
80   -
81   - /*@Autowired
82   - FixedEnableVerionsThread fixedEnableVerionsThread;*/
83   -
84   - @Autowired
85   - SafeDrivDataLoadThread safeDrivDataLoadThread;
86   -
87   - @Autowired
88   - FixedCheckStationCodeThread fixedCheckStationCodeThread;
89   -
90   - private static long timeDiff;
91   - private static long timeDiffTraffic;
92   -
93   - static {
94   - // 早上2:20
95   - timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis();
96   - if (timeDiff < 0)
97   - timeDiff += (1000 * 60 * 60 * 24);
98   - // 早上07:00
99   - timeDiffTraffic = (DateUtils.getTimestamp() + 1000 * 60 * 60 * 7) - System.currentTimeMillis();
100   - if (timeDiffTraffic < 0)
101   - timeDiffTraffic += (1000 * 60 * 60 * 24);
102   - }
103   -
104   - @Override
105   - public void run(String... strings) throws Exception {
106   - try {
107   - Tools tools = new Tools("application.properties");
108   - String environment = tools.getValue("spring.profiles.active");
109   - //预先加载基础的对照数据
110   - basicDataLoader.loadAllData();
111   - switch (environment){
112   - case "dev":
113   - devInit();
114   - break;
115   - case "prod":
116   - prodInit();
117   - break;
118   - }
119   - }catch (Exception e){
120   - log.error("线调后台启动出现异常!!", e);
121   - System.exit(1);
122   - }
123   - }
124   -
125   - @Autowired
126   - DayOfSchedule dayOfSchedule;
127   - public void devInit(){
128   - log.info("devInit...");
129   - ScheduledExecutorService sexec = Application.mainServices;
130   - //抓取GPS数据
131   - GpsDataLoaderThread.setFlag(-1);
132   - //dayOfSchedule.dataRecovery();
133   - //sexec.scheduleWithFixedDelay(gpsDataLoader, 60, 4, TimeUnit.SECONDS);
134   - //实际排班更新线程
135   - //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
136   - //sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点
137   - //sexec.scheduleWithFixedDelay(autoExecScanThread, 100, 50, TimeUnit.SECONDS);//班次自动执行
138   - //WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
139   -
140   - //sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 50, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码
141   - //实际排班延迟入库线程
142   - //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS);
143   - //班次修正日志延迟入库
144   - //sexec.scheduleWithFixedDelay(seiPstThread, 60, 30, TimeUnit.SECONDS);
145   - //调度指令延迟入库
146   - //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS);
147   - //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
148   - //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);
149   -
150   - //安全驾驶
151   - //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 40, 30, TimeUnit.SECONDS);
152   -
153   - //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 20, 60 * 2 , TimeUnit.SECONDS);
154   - }
155   -
156   - public void prodInit(){
157   - log.info("prodInit...");
158   - ScheduledExecutorService sexec = Application.mainServices;
159   - //安全驾驶
160   - //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS);
161   -
162   - /** 线调业务 */
163   - sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程
164   - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点
165   - GpsDataLoaderThread.setFlag(-1);
166   - sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据
167   - sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码
168   -
169   - sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线
170   - sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程
171   - sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库
172   - sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库
173   - //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
174   - sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据
175   - sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新
176   - sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行
177   - DirectivePushQueue.start();//消息队列 -指令,系统下发的
178   - WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
179   -
180   - /** 线调为其他程序提供的数据 --写入数据库 */
181   - sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布)
182   - //线路首末班数据(网关用,班次更新时写入)
183   - //com.bsth.data.schedule.f_a_l.FirstAndLastHandler
184   - sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号)
185   -
186   - //运管处静态数据提交
187   - //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处");
188   - //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
189   - //计算油、公里加注
190   - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
191   -
192   - //线路版本更新
193   - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS);
194   -
195   - //线路版本更新
196   - //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
197   - }
198   -}
199   -=======
200 1 package com.bsth;
201 2  
202 3 import com.bsth.data.BasicData;
... ... @@ -466,4 +267,3 @@ public class XDApplication implements CommandLineRunner {
466 267 //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
467 268 }
468 269 }
469   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -5,25 +5,6 @@ import java.io.IOException;
5 5 import java.io.InputStream;
6 6 import java.io.OutputStream;
7 7 import java.net.HttpURLConnection;
8   -<<<<<<< HEAD
9   -import java.net.URL;
10   -import java.util.ArrayList;
11   -import java.util.Collection;
12   -import java.util.HashMap;
13   -import java.util.List;
14   -import java.util.Map;
15   -
16   -import org.apache.commons.io.IOUtils;
17   -import org.apache.commons.lang3.StringEscapeUtils;
18   -import org.joda.time.format.DateTimeFormat;
19   -import org.joda.time.format.DateTimeFormatter;
20   -import org.springframework.beans.factory.annotation.Autowired;
21   -import org.springframework.web.bind.annotation.PathVariable;
22   -import org.springframework.web.bind.annotation.RequestMapping;
23   -import org.springframework.web.bind.annotation.RequestMethod;
24   -import org.springframework.web.bind.annotation.RequestParam;
25   -import org.springframework.web.bind.annotation.RestController;
26   -=======
27 8 import java.net.MalformedURLException;
28 9 import java.net.URL;
29 10 import java.net.URLEncoder;
... ... @@ -47,7 +28,6 @@ import org.joda.time.format.DateTimeFormat;
47 28 import org.joda.time.format.DateTimeFormatter;
48 29 import org.springframework.beans.factory.annotation.Autowired;
49 30 import org.springframework.web.bind.annotation.*;
50   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
51 31  
52 32 import com.alibaba.fastjson.JSONArray;
53 33 import com.bsth.common.ResponseCode;
... ... @@ -58,1156 +38,996 @@ import com.bsth.data.BasicData;
58 38 import com.bsth.data.schedule.DayOfSchedule;
59 39 import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
60 40 import com.bsth.entity.realcontrol.ScheduleRealInfo;
61   -<<<<<<< HEAD
62   -import com.bsth.entity.schedule.SchedulePlanInfo;
63   -import com.bsth.entity.sys.SysUser;
64   -import com.bsth.security.util.SecurityUtils;
65   -import com.bsth.service.realcontrol.ScheduleRealInfoService;
66   -import com.bsth.util.ConfigUtil;
67   -import com.fasterxml.jackson.databind.ObjectMapper;
68   -=======
69 41 import com.bsth.entity.report.RepairReport;
70 42 import com.bsth.entity.schedule.SchedulePlanInfo;
71 43 import com.bsth.service.realcontrol.ScheduleRealInfoService;
72   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
73 44  
74 45 @RestController
75 46 @RequestMapping("/realSchedule")
76 47 public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {
77 48  
78   - @Autowired
79   - ScheduleRealInfoService scheduleRealInfoService;
80   -
81   - @Autowired
82   - DayOfSchedule dayOfSchedule;
83   -<<<<<<< HEAD
84   - //待发时间调整时间
85   - public static Long dfsj= 0L;
86   - //待发时间调整
87   - public Long dfsj(Long sj){
88   - dfsj = sj;
89   - return dfsj;
90   - }
91   -=======
92   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
93   -
94   - @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
95   - public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
96   - return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
97   - }
98   -
99   - @RequestMapping(value = "/lines")
100   - public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
101   - return scheduleRealInfoService.findByLines(lines);
102   - }
103   -
104   - @RequestMapping(value = "/car")
105   - public List<ScheduleRealInfo> findByCar(String nbbm){
106   - return dayOfSchedule.findByNbbm(nbbm);
107   - }
108   -
109   - /**
110   - *
111   - * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
112   - * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
113   - */
114   - @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
115   - public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
116   - @RequestParam String dfsj,String bcType,
117   - @RequestParam(defaultValue = "") String opType) {
118   - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
119   - }
120   -
121   -<<<<<<< HEAD
122   -
123   - /**
124   - *
125   - * @Title: outgoAdjust @Description: TODO(待发调整锁定待发)
126   - *
127   - */
128   - @RequestMapping(value = "/outgoAdjusttwo", method = RequestMethod.POST)
129   - public Map<String, Object> outgoAdjusttow(@RequestParam String dfsj) {
130   - return scheduleRealInfoService.outgoAdjusttwo(dfsj);
131   - }
132   - /**
133   - *
134   - * @Title: outgoAdjust @Description: TODO(待发时间定义)
135   - *
136   - */
137   - @RequestMapping(value = "/outgoAdjusttwodfsj", method = RequestMethod.POST)
138   - public Long outgoAdjusttowdfsj(@RequestParam Long dfsj) {
139   - return dfsj(dfsj);
140   - }
141   -
142   - /**
143   - *
144   - * @Title: outgoAdjust @Description: TODO(待发时间查询)
145   - *
146   - */
147   - @RequestMapping(value = "/outgoAdjusttwoxc", method = RequestMethod.POST)
148   - public Long outgoAdjusttowdfsjxc() {
149   - return dfsj;
150   - }
151   -
152   -
153   -=======
154   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
155   - /**
156   - *
157   - * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
158   - */
159   - @RequestMapping(value = "/destroy", method = RequestMethod.POST)
160   - public Map<String, Object> destroy(@RequestParam String idsStr
161   - /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
162   - @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
163   - return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
164   - }
165   -
166   - /**
167   - *
168   - * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws
169   - */
170   - @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
171   - public Map<String, String> carDeviceMapp() {
172   - return BasicData.deviceId2NbbmMap.inverse();
173   - }
174   -
175   - /**
176   - *
177   - * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param
178   - * lineId @throws
179   - */
180   - @RequestMapping(value = "/driver", method = RequestMethod.GET)
181   - public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {
182   - return scheduleRealInfoService.findDriverByLine(lineCode);
183   - }
184   -
185   - /**
186   - *
187   - * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param
188   - * lineId @throws
189   - */
190   - @RequestMapping(value = "/conductor", method = RequestMethod.GET)
191   - public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {
192   - return scheduleRealInfoService.findConductorByLine(lineCode);
193   - }
194   -
195   - /**
196   - *
197   - * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param
198   - * lineId @throws
199   - */
200   - @RequestMapping(value = "/cars", method = RequestMethod.GET)
201   - public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {
202   - return scheduleRealInfoService.findCarByLine(lineCode);
203   - }
204   -
205   - /**
206   - *
207   - * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws
208   - */
209   - @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
210   - public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
211   - return scheduleRealInfoService.sreachVehic(nbbm);
212   - }
213   - /**
214   - *
215   - * @Title: realOutAdjust
216   - * @Description: TODO(实发调整)
217   - * @param @param id 班次ID
218   - * @param @param fcsjActual 实际发车时间 HH:mm
219   - * @param @param remarks 备注
220   - * @throws
221   - */
222   - @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
223   -<<<<<<< HEAD
224   - public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual,
225   - @RequestParam String remarks) {
226   - return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks);
227   -=======
228   - public Map<String, Object> realOutAdjust(@RequestParam Map<String, String> map) {
229   - return scheduleRealInfoService.realOutAdjust(map);
230   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
231   - }
232   -
233   - /**
234   - *
235   - * @Title: revokeDestroy
236   - * @Description: TODO(撤销烂班)
237   - * @param @param id
238   - * @throws
239   - */
240   - @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)
241   - public Map<String, Object> revokeDestroy(@RequestParam Long id){
242   - return scheduleRealInfoService.revokeDestroy(id);
243   - }
244   -
245   - /**
246   - *
247   - * @Title: revokeRealOutgo
248   - * @Description: TODO(撤销实发)
249   - * @param @param id
250   - * @throws
251   - */
252   - @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)
253   - public Map<String, Object> revokeRealOutgo(@RequestParam Long id){
254   - return scheduleRealInfoService.revokeRealOutgo(id);
255   - }
256   -
257   - /**
258   - * 撤销执行
259   - * @param id
260   - * @return
261   - */
262   - @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)
263   - public Map<String, Object> revokeRealArrive(@RequestParam Long id){
264   - return scheduleRealInfoService.revokeRealArrive(id);
265   - }
266   -
267   - /**
268   - *
269   - * @Title: spaceAdjust
270   - * @Description: TODO(间隔调整)
271   - * @param @param ids 要调整的班次数组ID
272   - * @param @param space 间隔
273   - * @throws
274   - */
275   - @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)
276   - public Map<String, Object> spaceAdjust(Long[] ids, Integer space){
277   - return scheduleRealInfoService.spaceAdjust(ids, space);
278   - }
279   -
280   - /**
281   - *
282   - * @Title: schInfoFineTune
283   - * @Description: TODO(发车信息微调)
284   - * @param @param map
285   - * @throws
286   - */
287   - @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)
288   - public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){
289   - return scheduleRealInfoService.schInfoFineTune(map);
290   - }
291   -
292   - /**
293   - *
294   - * @Title: outgoAdjustAll
295   - * @Description: TODO(批量待发调整)
296   - * @param @param list
297   - * @throws
298   - */
299   - @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
300   - public Map<String, Object> outgoAdjustAll(@RequestParam String params){
301   - //反转义
302   - params = StringEscapeUtils.unescapeHtml4(params);
303   - return scheduleRealInfoService.outgoAdjustAll(params);
304   - }
305   -
306   - /**
307   - *
308   - * @Title: findByLineAndUpDown
309   - * @Description: TODO(根据线路和走向获取班次)
310   - * @param @param line
311   - * @param @param upDown
312   - */
313   - @RequestMapping(value = "/findByLineAndUpDown")
314   - public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){
315   - return dayOfSchedule.findByLineAndUpDown(line, upDown);
316   - }
317   -
318   - /**
319   - *
320   - * @Title: findRouteByLine
321   - * @Description: TODO(获取线路的站点,路段路由)
322   - * @param @param lineCode
323   - * @throws
324   - */
325   - @RequestMapping(value = "/findRouteByLine")
326   - public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
327   - return scheduleRealInfoService.findRouteByLine(lineCode);
328   - }
329   -
330   - /**
331   - *
332   - * @Title: removeChildTask
333   - * @Description: TODO(删除子任务)
334   - * @param @param taskId 子任务ID
335   - * @throws
336   - */
337   - @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)
338   - public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){
339   - return scheduleRealInfoService.removeChildTask(taskId);
340   - }
341   -
342   - /**
343   - *
344   - * @Title: findByLineCode
345   - * @Description: TODO(根据线路获取班次信息)
346   - * @param @param lineCode
347   - */
348   - @RequestMapping(value = "/lineCode/{lineCode}")
349   - public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
350   - return dayOfSchedule.findByLineCode(lineCode);
351   - }
352   -
353   - @RequestMapping(value = "/queryUserInfo")
354   - public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
355   - @RequestParam String date,@RequestParam String state) {
356   - return scheduleRealInfoService.queryUserInfo(line, date,state);
357   - }
358   -
359   - @RequestMapping(value = "/queryUserInfoPx")
360   - public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
361   - @RequestParam String date,@RequestParam String state,@RequestParam String type) {
362   - return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
363   - }
364   -
365   - @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
366   -<<<<<<< HEAD
367   - public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
368   - @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
369   - return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line);
370   -=======
371   - public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String jGh, @RequestParam String clZbh,
372   - @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
373   - return scheduleRealInfoService.exportWaybill(jName,jGh, clZbh, lpName,date,line);
374   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
375   - }
376   -
377   - @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
378   - public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
379   - ,@RequestParam String date,@RequestParam String line) {
380   - return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
381   - }
382   -
383   -
384   - @RequestMapping(value = "/dailyInfo")
385   - public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
386   - return scheduleRealInfoService.dailyInfo(line, date, type);
387   - }
388   -
389   - @RequestMapping(value = "/historyMessage")
390   - public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
391   - @RequestParam String code, @RequestParam String type) {
392   - return scheduleRealInfoService.historyMessage(line, date, code, type);
393   - }
394   -
395   - @RequestMapping(value="/findLine")
396   - public List<Map<String,String>> findLine(@RequestParam String line){
397   - return scheduleRealInfoService.findLine(line);
398   - }
399   -
400   - @RequestMapping(value="/findKMBC",method = RequestMethod.GET)
401   - public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
402   - ,@RequestParam String date,@RequestParam String line){
403   - return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);
404   - }
405   -
406   - /**
407   - * 路单公里统计 (闵行审计专用)
408   - * @param jGh
409   - * @param clZbh
410   - * @param lpName
411   - * @param date
412   - * @param line
413   - * @return
414   - */
415   - @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)
416   - public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
417   - ,@RequestParam String date,@RequestParam String line){
418   - return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);
419   - }
420   -
421   - @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
422   - public Map<String,Object> findKMBCQp(@RequestParam String clZbh
423   - ,@RequestParam String date,@RequestParam String line){
424   - return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
425   - }
426   -
427   - @RequestMapping(value="/findLpName")
428   - public List<Map<String,String>> findLpName(@RequestParam String lpName){
429   - return scheduleRealInfoService.findLpName(lpName);
430   - }
431   -
432   - @RequestMapping(value = "/account")
433   - public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
434   - @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
435   - return scheduleRealInfoService.account(line, date, code, xlName, type);
436   - }
437   -
438   - @RequestMapping(value = "/accountPx")
439   - public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,
440   - @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {
441   - return scheduleRealInfoService.accountPx(line, date, code, xlName, px);
442   - }
443   -
444   - @RequestMapping(value = "/correctForm")
445   - public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,
446   - @RequestParam String endDate,
447   - @RequestParam String lpName, @RequestParam String code,
448   - @RequestParam String type,@RequestParam String changType) {
449   - return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);
450   - }
451   - /**
452   - * @Title queryListWaybill
453   - * @Description 查询行车路单列表
454   -<<<<<<< HEAD
455   - * @param jName 驾驶员名字
456   -=======
457   - * @param jGh 驾驶员名字
458   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
459   - * @param clZbh 车辆自编号(内部编号)
460   - * @param lpName 路牌
461   - * @return
462   - */
463   - @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
464   -<<<<<<< HEAD
465   - public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
466   - ,@RequestParam String date,@RequestParam String line){
467   - return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line);
468   -=======
469   - public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
470   - ,@RequestParam String date,@RequestParam String line){
471   - return scheduleRealInfoService.queryListWaybill(jGh, clZbh,lpName,date,line);
472   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
473   - }
474   -
475   - /**
476   - * @Title queryListWaybill
477   - * @Description 查询行车路单列表(闵行审计专用路单)
478   - * @param jName 驾驶员名字
479   - * @param clZbh 车辆自编号(内部编号)
480   - * @param lpName 路牌
481   - * @return
482   - */
483   - @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)
484   - public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
485   - ,@RequestParam String date,@RequestParam String line){
486   - return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);
487   - }
488   -
489   - @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
490   - public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
491   - @RequestParam String date,@RequestParam String line){
492   - return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
493   - }
494   -
495   - @RequestMapping(value="/statisticsDaily")
496   - public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,
497   - @RequestParam String xlName, @RequestParam String type){
498   - return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
499   - }
500   -
501   - @RequestMapping(value="/statisticsDaily_mh_2")
502   - public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,
503   - @RequestParam String xlName, @RequestParam String type){
504   - return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);
505   - }
506   -
507   - @RequestMapping(value="/statisticsDailyTj")
508   - public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){
509   - String gsdm="";
510   - if(map.get("gsdm")!=null){
511   - gsdm=map.get("gsdm").toString();
512   - }
513   - String fgsdm="";
514   - if(map.get("fgsdm")!=null){
515   - fgsdm=map.get("fgsdm").toString();
516   - }
517   - String line="";
518   - if(map.get("line")!=null){
519   - line=map.get("line").toString();
520   - }
521   - String date="";
522   - if(map.get("date")!=null){
523   - date=map.get("date").toString();
524   - }
525   - String date2="";
526   - if(map.get("date2")!=null){
527   - date2=map.get("date2").toString();
528   - }
529   - String xlName="";
530   - if(map.get("xlName")!=null){
531   - xlName=map.get("xlName").toString();
532   - }
533   - String type="";
534   - if(map.get("type")!=null){
535   - type=map.get("type").toString();
536   - }
537   - String nature="0";
538   - if(map.get("nature")!=null){
539   - nature=map.get("nature").toString();
540   - }
541   - return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
542   - }
543   -
544   - /*
545   - * 公里修正报表
546   - */
547   - @RequestMapping(value="/mileageReportTj")
548   - public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){
549   - String gsdm="";
550   - if(map.get("gsdm")!=null){
551   - gsdm=map.get("gsdm").toString();
552   - }
553   - String fgsdm="";
554   - if(map.get("fgsdm")!=null){
555   - fgsdm=map.get("fgsdm").toString();
556   - }
557   - String line="";
558   - if(map.get("line")!=null){
559   - line=map.get("line").toString();
560   - }
561   - String date="";
562   - if(map.get("date")!=null){
563   - date=map.get("date").toString();
564   - }
565   - String date2="";
566   - if(map.get("date2")!=null){
567   - date2=map.get("date2").toString();
568   - }
569   - String xlName="";
570   - if(map.get("xlName")!=null){
571   - xlName=map.get("xlName").toString();
572   - }
573   - return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);
574   - }
575   -
576   - /*
577   - * 班次修正报表
578   - */
579   - @RequestMapping(value="/scheduleCorrectionReport")
580   - public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){
581   - String gsdm="";
582   - if(map.get("gsdm")!=null){
583   - gsdm=map.get("gsdm").toString();
584   - }
585   - String fgsdm="";
586   - if(map.get("fgsdm")!=null){
587   - fgsdm=map.get("fgsdm").toString();
588   - }
589   - String line="";
590   - if(map.get("line")!=null){
591   - line=map.get("line").toString();
592   - }
593   - String date="";
594   - if(map.get("date")!=null){
595   - date=map.get("date").toString();
596   - }
597   - String date2="";
598   - if(map.get("date2")!=null){
599   - date2=map.get("date2").toString();
600   - }
601   - String xlName="";
602   - if(map.get("xlName")!=null){
603   - xlName=map.get("xlName").toString();
604   - }
605   - return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);
606   - }
607   -
608   - @RequestMapping(value="/MapById",method = RequestMethod.GET)
609   - public Map<String, Object> MapById(@RequestParam("id") Long id){
610   - return scheduleRealInfoService.MapById(id);
611   - }
612   -
613   - @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)
614   - public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){
615   - return scheduleRealInfoService.MapByIdQp(id);
616   - }
617   -
618   - /**
619   - * @Title: scheduleDaily
620   - * @Description: TODO(调度日报表)
621   - * @param line 线路
622   - * @param date 时间
623   - * @return
624   - */
625   - @RequestMapping(value="/scheduleDaily")
626   - public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){
627   - return scheduleRealInfoService.scheduleDaily(line,date);
628   - }
629   -
630   - @RequestMapping(value="/realScheduleList")
631   - public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
632   - return scheduleRealInfoService.realScheduleList(line,date);
633   - }
634   -
635   - @RequestMapping(value="/realScheduleList_zrw")
636   - public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
637   - return scheduleRealInfoService.realScheduleList_zrw(line,date);
638   - }
639   -
640   - @RequestMapping(value="/realScheduleList_mh_2")
641   - public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
642   - return scheduleRealInfoService.realScheduleList_mh_2(line,date);
643   - }
644   -
645   - @RequestMapping(value="/realScheduleListQp")
646   - public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
647   - return scheduleRealInfoService.realScheduleListQp(line,date);
648   - }
649   -
650   - @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
651   -<<<<<<< HEAD
652   - public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
653   -=======
654   - public synchronized Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
655   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
656   - cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
657   - List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
658   - return scheduleRealInfoService.multi_tzrc(cpcs, null);
659   - }
660   -
661   - @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
662   - public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
663   - dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
664   - List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
665   - return scheduleRealInfoService.multi_dftz(dfsjcs);
666   - }
667   -
668   - @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)
669   - public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){
670   - return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);
671   - }
672   -
673   - @RequestMapping(value="/history", method=RequestMethod.POST)
674   - public Map<String,Object> historySave(ScheduleRealInfo sch){
675   - return scheduleRealInfoService.historySave(sch);
676   - }
677   -
678   -
679   - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
680   - private final static long ONE_DAY = 1000 * 60 * 60 * 24;
681   - /**
682   - * 获取可编辑的历史班次日期
683   - * @return
684   - */
685   - @RequestMapping("dateArray")
686   - public List<String> dateArray(@RequestParam(defaultValue = "0") int c){
687   - List<String> rs = new ArrayList<>();
688   -
689   - long t = System.currentTimeMillis();
690   - if(c != 1)
691   - t -= (ONE_DAY + (1000 * 60 * 60 * 6));
692   -<<<<<<< HEAD
693   - for(int i = 0; i < 4; i ++){
694   -=======
695   - for(int i = 0; i < 3; i ++){
696   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
697   - rs.add(fmtyyyyMMdd.print(t));
698   - t -= ONE_DAY;
699   - }
700   - return rs;
701   - }
702   -
703   - @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
704   - public Map<String, Object> svgAttr(@RequestParam String jsonStr){
705   - return scheduleRealInfoService.svgAttr(jsonStr);
706   - }
707   -
708   - @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
709   - public Map<String, Object> findSvgAttr(@RequestParam String idx){
710   - return scheduleRealInfoService.findSvgAttr(idx);
711   - }
712   -
713   - @RequestMapping(value = "addRemarks", method = RequestMethod.POST)
714   - public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){
715   - return scheduleRealInfoService.addRemarks(id, remarks);
716   - }
717   -
718   - @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)
719   - public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){
720   - return scheduleRealInfoService.scheduleDailyQp(line,date);
721   - }
722   -
723   - @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)
724   - public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){
725   - return scheduleRealInfoService.scheduleDailyExport(map);
726   - }
727   -
728   - @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
729   - public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
730   - return scheduleRealInfoService.exportWaybillMore(map);
731   - }
732   -
733   - /**
734   - * 获取当日计划排班 , 从计划表抓取数据
735   - * @return
736   - */
737   - @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)
738   - public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
739   - return scheduleRealInfoService.currentSchedulePlan(lineCode);
740   - }
741   -
742   - @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
743   - public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
744   - return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
745   - }
746   -
747   - /**
748   - * 删除当日实际排班
749   - * @return
750   - */
751   - @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)
752   - public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){
753   - return dayOfSchedule.deleteRealSchedule(lineCode);
754   - }
755   -
756   - /**
757   - * 从计划表重新加载当日排班
758   - * @param lineCode
759   - * @return
760   - */
761   - @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)
762   - public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){
763   - Map<String, Object> rs = new HashMap<>();
764   - List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);
765   - if(list != null && list.size() > 0){
766   - rs.put("status", ResponseCode.ERROR);
767   - rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");
768   - return rs;
769   - }
770   -
771   - int code = dayOfSchedule.reloadSch(lineCode);
772   -
773   - //重新按公司编码索引数据
774   - dayOfSchedule.groupByGsbm();
775   - rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
776   - return rs;
777   - }
778   -
779   - /**
780   - * 误点调整
781   - * @param idx
782   - * @param minute
783   - * @return
784   - */
785   - @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
786   - public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
787   - return scheduleRealInfoService.lateAdjust(idx, minute);
788   - }
789   -
790   - /**
791   - * 获取所有应发未到的班次
792   - * @param idx
793   - * @return
794   - */
795   - @RequestMapping(value = "allLate2")
796   - public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
797   - return scheduleRealInfoService.allLate2(idx);
798   - }
799   -
800   - /**
801   - * 添加一个临加到历史库
802   - * @param sch
803   - * @return
804   - */
805   - @RequestMapping(value = "history/add", method = RequestMethod.POST)
806   - public Map<String, Object> addToHistory(ScheduleRealInfo sch){
807   - return scheduleRealInfoService.addToHistory(sch);
808   - }
809   -
810   - /**
811   - * 从历史库里删除临加班次
812   -<<<<<<< HEAD
813   - * @param sch
814   -=======
815   - * @param id
816   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
817   - * @return
818   - */
819   - @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)
820   - public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
821   - return scheduleRealInfoService.deleteToHistory(id);
822   - }
823   -<<<<<<< HEAD
824   -
825   - /**
826   - * 从历史库里删除临加班次
827   - * @param sch
828   - * @return
829   - */
830   - @RequestMapping(value = "wxsb", method = RequestMethod.POST)
831   - public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){
832   - SysUser user = SecurityUtils.getCurrentUser();
833   - String uname = user.getUserName();
834   - StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url"));
835   - url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType"));
836   - // 分公司保存格式 分公司编码_公司编码
837   - String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm"));
838   - String[] arr = val.split("_");
839   - if (!"22".equals(arr[1])) {
840   - Map<String, Object> res = new HashMap<String, Object>();
841   - res.put("status", ResponseCode.ERROR);
842   - res.put("msg", "除金高公司外暂未开通此功能");
843   -
844   - return res;
845   - }
846   - url.append("&fgs=").append(arr[0]);
847   -
848   - return request(url.toString());
849   - }
850   -
851   - @SuppressWarnings("unchecked")
852   - private static Map<String, Object> request(String url) {
853   - Map<String, Object> res = new HashMap<String, Object>();
854   - res.put("status", ResponseCode.SUCCESS);
855   - InputStream in = null;
856   - HttpURLConnection con = null;
857   - try {
858   - con = (HttpURLConnection)new URL(url).openConnection();
859   - con.setRequestMethod("POST");
860   - con.setRequestProperty("keep-alive", "true");
861   - con.setRequestProperty("accept", "application/json");
862   - con.setRequestProperty("content-type", "application/json");
863   - con.setDoInput(true);
864   - con.setReadTimeout(2500);
865   - con.setConnectTimeout(2500);
866   -
867   - con.connect();
868   - if (con.getResponseCode() == 200) {
869   - in = con.getInputStream();
870   - ByteArrayOutputStream bout = new ByteArrayOutputStream();
871   - IOUtils.copy(in, bout); bout.close();
872   - Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
873   - if (!"报修成功".equals(response.get("msg"))) {
874   - res.put("status", ResponseCode.ERROR);
875   - res.putAll(response);
876   - }
877   - }
878   - } catch (IOException e) {
879   - // TODO Auto-generated catch block
880   - res.put("status", ResponseCode.ERROR);
881   - res.put("msg", "调用上报接口异常");
882   - } finally {
883   - try {
884   - if (in != null) in.close();
885   - if (con != null) con.disconnect();
886   - } catch (IOException e) {
887   - // TODO Auto-generated catch block
888   - e.printStackTrace();
889   - }
890   - }
891   -
892   - return res;
893   - }
894   -=======
  49 + @Autowired
  50 + ScheduleRealInfoService scheduleRealInfoService;
  51 +
  52 + @Autowired
  53 + DayOfSchedule dayOfSchedule;
  54 +
  55 + @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
  56 + public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
  57 + return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
  58 + }
  59 +
  60 + @RequestMapping(value = "/lines")
  61 + public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
  62 + return scheduleRealInfoService.findByLines(lines);
  63 + }
  64 +
  65 + @RequestMapping(value = "/car")
  66 + public List<ScheduleRealInfo> findByCar(String nbbm){
  67 + return dayOfSchedule.findByNbbm(nbbm);
  68 + }
  69 +
  70 + /**
  71 + *
  72 + * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
  73 + * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
  74 + */
  75 + @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
  76 + public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
  77 + @RequestParam String dfsj,String bcType,
  78 + @RequestParam(defaultValue = "") String opType) {
  79 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
  80 + }
  81 +
  82 + /**
  83 + *
  84 + * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
  85 + */
  86 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  87 + public Map<String, Object> destroy(@RequestParam String idsStr
  88 + /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
  89 + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
  90 + return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
  91 + }
  92 +
  93 + /**
  94 + *
  95 + * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws
  96 + */
  97 + @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
  98 + public Map<String, String> carDeviceMapp() {
  99 + return BasicData.deviceId2NbbmMap.inverse();
  100 + }
  101 +
  102 + /**
  103 + *
  104 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param
  105 + * lineId @throws
  106 + */
  107 + @RequestMapping(value = "/driver", method = RequestMethod.GET)
  108 + public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {
  109 + return scheduleRealInfoService.findDriverByLine(lineCode);
  110 + }
  111 +
  112 + /**
  113 + *
  114 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param
  115 + * lineId @throws
  116 + */
  117 + @RequestMapping(value = "/conductor", method = RequestMethod.GET)
  118 + public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {
  119 + return scheduleRealInfoService.findConductorByLine(lineCode);
  120 + }
  121 +
  122 + /**
  123 + *
  124 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param
  125 + * lineId @throws
  126 + */
  127 + @RequestMapping(value = "/cars", method = RequestMethod.GET)
  128 + public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {
  129 + return scheduleRealInfoService.findCarByLine(lineCode);
  130 + }
  131 +
  132 + /**
  133 + *
  134 + * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws
  135 + */
  136 + @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
  137 + public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
  138 + return scheduleRealInfoService.sreachVehic(nbbm);
  139 + }
  140 + /**
  141 + *
  142 + * @Title: realOutAdjust
  143 + * @Description: TODO(实发调整)
  144 + * @param @param id 班次ID
  145 + * @param @param fcsjActual 实际发车时间 HH:mm
  146 + * @param @param remarks 备注
  147 + * @throws
  148 + */
  149 + @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
  150 + public Map<String, Object> realOutAdjust(@RequestParam Map<String, String> map) {
  151 + return scheduleRealInfoService.realOutAdjust(map);
  152 + }
  153 +
  154 + /**
  155 + *
  156 + * @Title: revokeDestroy
  157 + * @Description: TODO(撤销烂班)
  158 + * @param @param id
  159 + * @throws
  160 + */
  161 + @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)
  162 + public Map<String, Object> revokeDestroy(@RequestParam Long id){
  163 + return scheduleRealInfoService.revokeDestroy(id);
  164 + }
  165 +
  166 + /**
  167 + *
  168 + * @Title: revokeRealOutgo
  169 + * @Description: TODO(撤销实发)
  170 + * @param @param id
  171 + * @throws
  172 + */
  173 + @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)
  174 + public Map<String, Object> revokeRealOutgo(@RequestParam Long id){
  175 + return scheduleRealInfoService.revokeRealOutgo(id);
  176 + }
  177 +
  178 + /**
  179 + * 撤销执行
  180 + * @param id
  181 + * @return
  182 + */
  183 + @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)
  184 + public Map<String, Object> revokeRealArrive(@RequestParam Long id){
  185 + return scheduleRealInfoService.revokeRealArrive(id);
  186 + }
  187 +
  188 + /**
  189 + *
  190 + * @Title: spaceAdjust
  191 + * @Description: TODO(间隔调整)
  192 + * @param @param ids 要调整的班次数组ID
  193 + * @param @param space 间隔
  194 + * @throws
  195 + */
  196 + @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)
  197 + public Map<String, Object> spaceAdjust(Long[] ids, Integer space){
  198 + return scheduleRealInfoService.spaceAdjust(ids, space);
  199 + }
  200 +
  201 + /**
  202 + *
  203 + * @Title: schInfoFineTune
  204 + * @Description: TODO(发车信息微调)
  205 + * @param @param map
  206 + * @throws
  207 + */
  208 + @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)
  209 + public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){
  210 + return scheduleRealInfoService.schInfoFineTune(map);
  211 + }
  212 +
  213 + /**
  214 + *
  215 + * @Title: outgoAdjustAll
  216 + * @Description: TODO(批量待发调整)
  217 + * @param @param list
  218 + * @throws
  219 + */
  220 + @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
  221 + public Map<String, Object> outgoAdjustAll(@RequestParam String params){
  222 + //反转义
  223 + params = StringEscapeUtils.unescapeHtml4(params);
  224 + return scheduleRealInfoService.outgoAdjustAll(params);
  225 + }
  226 +
  227 + /**
  228 + *
  229 + * @Title: findByLineAndUpDown
  230 + * @Description: TODO(根据线路和走向获取班次)
  231 + * @param @param line
  232 + * @param @param upDown
  233 + */
  234 + @RequestMapping(value = "/findByLineAndUpDown")
  235 + public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){
  236 + return dayOfSchedule.findByLineAndUpDown(line, upDown);
  237 + }
  238 +
  239 + /**
  240 + *
  241 + * @Title: findRouteByLine
  242 + * @Description: TODO(获取线路的站点,路段路由)
  243 + * @param @param lineCode
  244 + * @throws
  245 + */
  246 + @RequestMapping(value = "/findRouteByLine")
  247 + public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
  248 + return scheduleRealInfoService.findRouteByLine(lineCode);
  249 + }
  250 +
  251 + /**
  252 + *
  253 + * @Title: removeChildTask
  254 + * @Description: TODO(删除子任务)
  255 + * @param @param taskId 子任务ID
  256 + * @throws
  257 + */
  258 + @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)
  259 + public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){
  260 + return scheduleRealInfoService.removeChildTask(taskId);
  261 + }
  262 +
  263 + /**
  264 + *
  265 + * @Title: findByLineCode
  266 + * @Description: TODO(根据线路获取班次信息)
  267 + * @param @param lineCode
  268 + */
  269 + @RequestMapping(value = "/lineCode/{lineCode}")
  270 + public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
  271 + return dayOfSchedule.findByLineCode(lineCode);
  272 + }
  273 +
  274 + @RequestMapping(value = "/queryUserInfo")
  275 + public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
  276 + @RequestParam String date,@RequestParam String state) {
  277 + return scheduleRealInfoService.queryUserInfo(line, date,state);
  278 + }
  279 +
  280 + @RequestMapping(value = "/queryUserInfoPx")
  281 + public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
  282 + @RequestParam String date,@RequestParam String state,@RequestParam String type) {
  283 + return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
  284 + }
  285 +
  286 + @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
  287 + public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String jGh, @RequestParam String clZbh,
  288 + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
  289 + return scheduleRealInfoService.exportWaybill(jName,jGh, clZbh, lpName,date,line);
  290 + }
  291 +
  292 + @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
  293 + public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
  294 + ,@RequestParam String date,@RequestParam String line) {
  295 + return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
  296 + }
  297 +
  298 +
  299 + @RequestMapping(value = "/dailyInfo")
  300 + public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
  301 + return scheduleRealInfoService.dailyInfo(line, date, type);
  302 + }
  303 +
  304 + @RequestMapping(value = "/historyMessage")
  305 + public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
  306 + @RequestParam String code, @RequestParam String type) {
  307 + return scheduleRealInfoService.historyMessage(line, date, code, type);
  308 + }
  309 +
  310 + @RequestMapping(value="/findLine")
  311 + public List<Map<String,String>> findLine(@RequestParam String line){
  312 + return scheduleRealInfoService.findLine(line);
  313 + }
  314 +
  315 + @RequestMapping(value="/findKMBC",method = RequestMethod.GET)
  316 + public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  317 + ,@RequestParam String date,@RequestParam String line){
  318 + return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);
  319 + }
  320 +
  321 + /**
  322 + * 路单公里统计 (闵行审计专用)
  323 + * @param jGh
  324 + * @param clZbh
  325 + * @param lpName
  326 + * @param date
  327 + * @param line
  328 + * @return
  329 + */
  330 + @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)
  331 + public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  332 + ,@RequestParam String date,@RequestParam String line){
  333 + return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);
  334 + }
  335 +
  336 + @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
  337 + public Map<String,Object> findKMBCQp(@RequestParam String clZbh
  338 + ,@RequestParam String date,@RequestParam String line){
  339 + return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
  340 + }
  341 +
  342 + @RequestMapping(value="/findLpName")
  343 + public List<Map<String,String>> findLpName(@RequestParam String lpName){
  344 + return scheduleRealInfoService.findLpName(lpName);
  345 + }
  346 +
  347 + @RequestMapping(value = "/account")
  348 + public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
  349 + @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
  350 + return scheduleRealInfoService.account(line, date, code, xlName, type);
  351 + }
  352 +
  353 + @RequestMapping(value = "/accountPx")
  354 + public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,
  355 + @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {
  356 + return scheduleRealInfoService.accountPx(line, date, code, xlName, px);
  357 + }
  358 +
  359 + @RequestMapping(value = "/correctForm")
  360 + public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,
  361 + @RequestParam String endDate,
  362 + @RequestParam String lpName, @RequestParam String code,
  363 + @RequestParam String type,@RequestParam String changType) {
  364 + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);
  365 + }
  366 + /**
  367 + * @Title queryListWaybill
  368 + * @Description 查询行车路单列表
  369 + * @param jGh 驾驶员名字
  370 + * @param clZbh 车辆自编号(内部编号)
  371 + * @param lpName 路牌
  372 + * @return
  373 + */
  374 + @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
  375 + public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  376 + ,@RequestParam String date,@RequestParam String line){
  377 + return scheduleRealInfoService.queryListWaybill(jGh, clZbh,lpName,date,line);
  378 + }
  379 +
  380 + /**
  381 + * @Title queryListWaybill
  382 + * @Description 查询行车路单列表(闵行审计专用路单)
  383 + * @param jName 驾驶员名字
  384 + * @param clZbh 车辆自编号(内部编号)
  385 + * @param lpName 路牌
  386 + * @return
  387 + */
  388 + @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)
  389 + public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  390 + ,@RequestParam String date,@RequestParam String line){
  391 + return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);
  392 + }
  393 +
  394 + @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
  395 + public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
  396 + @RequestParam String date,@RequestParam String line){
  397 + return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
  398 + }
  399 +
  400 + @RequestMapping(value="/statisticsDaily")
  401 + public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,
  402 + @RequestParam String xlName, @RequestParam String type){
  403 + return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
  404 + }
  405 +
  406 + @RequestMapping(value="/statisticsDaily_mh_2")
  407 + public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,
  408 + @RequestParam String xlName, @RequestParam String type){
  409 + return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);
  410 + }
  411 +
  412 + @RequestMapping(value="/statisticsDailyTj")
  413 + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){
  414 + String gsdm="";
  415 + if(map.get("gsdm")!=null){
  416 + gsdm=map.get("gsdm").toString();
  417 + }
  418 + String fgsdm="";
  419 + if(map.get("fgsdm")!=null){
  420 + fgsdm=map.get("fgsdm").toString();
  421 + }
  422 + String line="";
  423 + if(map.get("line")!=null){
  424 + line=map.get("line").toString();
  425 + }
  426 + String date="";
  427 + if(map.get("date")!=null){
  428 + date=map.get("date").toString();
  429 + }
  430 + String date2="";
  431 + if(map.get("date2")!=null){
  432 + date2=map.get("date2").toString();
  433 + }
  434 + String xlName="";
  435 + if(map.get("xlName")!=null){
  436 + xlName=map.get("xlName").toString();
  437 + }
  438 + String type="";
  439 + if(map.get("type")!=null){
  440 + type=map.get("type").toString();
  441 + }
  442 + String nature="0";
  443 + if(map.get("nature")!=null){
  444 + nature=map.get("nature").toString();
  445 + }
  446 + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
  447 + }
  448 +
  449 + /*
  450 + * 公里修正报表
  451 + */
  452 + @RequestMapping(value="/mileageReportTj")
  453 + public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){
  454 + String gsdm="";
  455 + if(map.get("gsdm")!=null){
  456 + gsdm=map.get("gsdm").toString();
  457 + }
  458 + String fgsdm="";
  459 + if(map.get("fgsdm")!=null){
  460 + fgsdm=map.get("fgsdm").toString();
  461 + }
  462 + String line="";
  463 + if(map.get("line")!=null){
  464 + line=map.get("line").toString();
  465 + }
  466 + String date="";
  467 + if(map.get("date")!=null){
  468 + date=map.get("date").toString();
  469 + }
  470 + String date2="";
  471 + if(map.get("date2")!=null){
  472 + date2=map.get("date2").toString();
  473 + }
  474 + String xlName="";
  475 + if(map.get("xlName")!=null){
  476 + xlName=map.get("xlName").toString();
  477 + }
  478 + return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);
  479 + }
  480 +
  481 + /*
  482 + * 班次修正报表
  483 + */
  484 + @RequestMapping(value="/scheduleCorrectionReport")
  485 + public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){
  486 + String gsdm="";
  487 + if(map.get("gsdm")!=null){
  488 + gsdm=map.get("gsdm").toString();
  489 + }
  490 + String fgsdm="";
  491 + if(map.get("fgsdm")!=null){
  492 + fgsdm=map.get("fgsdm").toString();
  493 + }
  494 + String line="";
  495 + if(map.get("line")!=null){
  496 + line=map.get("line").toString();
  497 + }
  498 + String date="";
  499 + if(map.get("date")!=null){
  500 + date=map.get("date").toString();
  501 + }
  502 + String date2="";
  503 + if(map.get("date2")!=null){
  504 + date2=map.get("date2").toString();
  505 + }
  506 + String xlName="";
  507 + if(map.get("xlName")!=null){
  508 + xlName=map.get("xlName").toString();
  509 + }
  510 + return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);
  511 + }
  512 +
  513 + @RequestMapping(value="/MapById",method = RequestMethod.GET)
  514 + public Map<String, Object> MapById(@RequestParam("id") Long id){
  515 + return scheduleRealInfoService.MapById(id);
  516 + }
  517 +
  518 + @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)
  519 + public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){
  520 + return scheduleRealInfoService.MapByIdQp(id);
  521 + }
  522 +
  523 + /**
  524 + * @Title: scheduleDaily
  525 + * @Description: TODO(调度日报表)
  526 + * @param line 线路
  527 + * @param date 时间
  528 + * @return
  529 + */
  530 + @RequestMapping(value="/scheduleDaily")
  531 + public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){
  532 + return scheduleRealInfoService.scheduleDaily(line,date);
  533 + }
  534 +
  535 + @RequestMapping(value="/realScheduleList")
  536 + public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
  537 + return scheduleRealInfoService.realScheduleList(line,date);
  538 + }
  539 +
  540 + @RequestMapping(value="/realScheduleList_zrw")
  541 + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
  542 + return scheduleRealInfoService.realScheduleList_zrw(line,date);
  543 + }
  544 +
  545 + @RequestMapping(value="/realScheduleList_mh_2")
  546 + public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
  547 + return scheduleRealInfoService.realScheduleList_mh_2(line,date);
  548 + }
  549 +
  550 + @RequestMapping(value="/realScheduleListQp")
  551 + public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
  552 + return scheduleRealInfoService.realScheduleListQp(line,date);
  553 + }
  554 +
  555 + @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
  556 + public synchronized Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
  557 + cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
  558 + List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
  559 + return scheduleRealInfoService.multi_tzrc(cpcs, null);
  560 + }
  561 +
  562 + @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
  563 + public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
  564 + dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
  565 + List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
  566 + return scheduleRealInfoService.multi_dftz(dfsjcs);
  567 + }
  568 +
  569 + @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)
  570 + public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){
  571 + return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);
  572 + }
  573 +
  574 + @RequestMapping(value="/history", method=RequestMethod.POST)
  575 + public Map<String,Object> historySave(ScheduleRealInfo sch){
  576 + return scheduleRealInfoService.historySave(sch);
  577 + }
  578 +
  579 +
  580 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  581 + private final static long ONE_DAY = 1000 * 60 * 60 * 24;
  582 + /**
  583 + * 获取可编辑的历史班次日期
  584 + * @return
  585 + */
  586 + @RequestMapping("dateArray")
  587 + public List<String> dateArray(@RequestParam(defaultValue = "0") int c){
  588 + List<String> rs = new ArrayList<>();
  589 +
  590 + long t = System.currentTimeMillis();
  591 + if(c != 1)
  592 + t -= (ONE_DAY + (1000 * 60 * 60 * 6));
  593 + for(int i = 0; i < 3; i ++){
  594 + rs.add(fmtyyyyMMdd.print(t));
  595 + t -= ONE_DAY;
  596 + }
  597 + return rs;
  598 + }
  599 +
  600 + @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
  601 + public Map<String, Object> svgAttr(@RequestParam String jsonStr){
  602 + return scheduleRealInfoService.svgAttr(jsonStr);
  603 + }
  604 +
  605 + @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
  606 + public Map<String, Object> findSvgAttr(@RequestParam String idx){
  607 + return scheduleRealInfoService.findSvgAttr(idx);
  608 + }
  609 +
  610 + @RequestMapping(value = "addRemarks", method = RequestMethod.POST)
  611 + public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){
  612 + return scheduleRealInfoService.addRemarks(id, remarks);
  613 + }
  614 +
  615 + @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)
  616 + public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){
  617 + return scheduleRealInfoService.scheduleDailyQp(line,date);
  618 + }
  619 +
  620 + @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)
  621 + public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){
  622 + return scheduleRealInfoService.scheduleDailyExport(map);
  623 + }
  624 +
  625 + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
  626 + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
  627 + return scheduleRealInfoService.exportWaybillMore(map);
  628 + }
  629 +
  630 + /**
  631 + * 获取当日计划排班 , 从计划表抓取数据
  632 + * @return
  633 + */
  634 + @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)
  635 + public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
  636 + return scheduleRealInfoService.currentSchedulePlan(lineCode);
  637 + }
  638 +
  639 + @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
  640 + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
  641 + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
  642 + }
  643 +
  644 + /**
  645 + * 删除当日实际排班
  646 + * @return
  647 + */
  648 + @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)
  649 + public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){
  650 + return dayOfSchedule.deleteRealSchedule(lineCode);
  651 + }
  652 +
  653 + /**
  654 + * 从计划表重新加载当日排班
  655 + * @param lineCode
  656 + * @return
  657 + */
  658 + @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)
  659 + public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){
  660 + Map<String, Object> rs = new HashMap<>();
  661 + List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);
  662 + if(list != null && list.size() > 0){
  663 + rs.put("status", ResponseCode.ERROR);
  664 + rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");
  665 + return rs;
  666 + }
  667 +
  668 + int code = dayOfSchedule.reloadSch(lineCode);
  669 +
  670 + //重新按公司编码索引数据
  671 + dayOfSchedule.groupByGsbm();
  672 + rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
  673 + return rs;
  674 + }
  675 +
  676 + /**
  677 + * 误点调整
  678 + * @param idx
  679 + * @param minute
  680 + * @return
  681 + */
  682 + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
  683 + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
  684 + return scheduleRealInfoService.lateAdjust(idx, minute);
  685 + }
  686 +
  687 + /**
  688 + * 获取所有应发未到的班次
  689 + * @param idx
  690 + * @return
  691 + */
  692 + @RequestMapping(value = "allLate2")
  693 + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
  694 + return scheduleRealInfoService.allLate2(idx);
  695 + }
  696 +
  697 + /**
  698 + * 添加一个临加到历史库
  699 + * @param sch
  700 + * @return
  701 + */
  702 + @RequestMapping(value = "history/add", method = RequestMethod.POST)
  703 + public Map<String, Object> addToHistory(ScheduleRealInfo sch){
  704 + return scheduleRealInfoService.addToHistory(sch);
  705 + }
  706 +
  707 + /**
  708 + * 从历史库里删除临加班次
  709 + * @param id
  710 + * @return
  711 + */
  712 + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)
  713 + public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
  714 + return scheduleRealInfoService.deleteToHistory(id);
  715 + }
895 716  
896 717 @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)
897 718 public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){
898 719 Map<String, Object> map =new HashMap<>();
899 720 map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));
900   - return map;
901   - }
902   -
903   - /**
904   - * 从历史库里删除临加班次
905   - * @param param
906   - * @return
907   - */
908   - @RequestMapping(value = "wxsb", method = RequestMethod.POST)
909   - public Map<String, Object> repairReport(@RequestParam Map<String, Object> param){
910   - return scheduleRealInfoService.repairReport(param, true);
911   - }
912   -
913   - @RequestMapping(value = "wxsb", method = RequestMethod.GET)
914   - public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){
915   - return scheduleRealInfoService.repairReportList(line, date, code, type);
916   - }
917   -
918   - @RequestMapping(value = "lineLevel", method = RequestMethod.GET)
919   - public Map<String, String> lineLevel(@RequestParam String idx){
920   - return scheduleRealInfoService.getLevelsByLines(Arrays.asList(idx.split(",")));
921   - }
922   -
923   - /**
924   - * 反馈安全驾驶系统
925   - * @param param
926   - * @return
927   - */
928   - @RequestMapping(value = "ackDsm", method = RequestMethod.POST)
929   - public Map<String, Object> ackDsm(@RequestParam Map<String, Object> param){
930   - Map<String, Object> res = new HashMap<>();
931   - InputStream in = null;
932   - SysUser user = SecurityUtils.getCurrentUser();
933   - DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
934   - StringBuilder url = new StringBuilder("http://211.95.61.66:9008/modules/dsmCheckTheRecord/addDsm?"), uri = new StringBuilder();
935   - HttpURLConnection con = null;
936   - try {
937   - uri.append("ddyName=").append(URLEncoder.encode(user == null ? "admin" : user.getUserName(), "UTF-8"));
938   - uri.append("&checkTime=").append(URLEncoder.encode(fmt.print(System.currentTimeMillis()), "UTF-8"));
939   - uri.append("&nbbm=").append(URLEncoder.encode(param.get("nbbm").toString(), "UTF-8"));
940   - uri.append("&starttime=").append(URLEncoder.encode(fmt.print(Long.parseLong(param.get("ts").toString())), "UTF-8"));
941   - url.append(uri);
942   - con = (HttpURLConnection)new URL(url.toString()).openConnection();
943   - con.setDoInput(true);
944   - con.setRequestMethod("POST");
945   - con.setConnectTimeout(5000);
946   - con.setReadTimeout(5000);
947   - con.setRequestProperty("keep-alive", "true");
948   - con.setRequestProperty("accept", "*/*");
949   - con.setRequestProperty("content-type", "application/x-www-form-urlencoded");
950   - con.connect();
951   -
952   - if (con.getResponseCode() == 200) {
953   - in = con.getInputStream();
954   - ByteArrayOutputStream bout = new ByteArrayOutputStream();
955   - IOUtils.copy(in, bout);
956   - Map<String, Object> map = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
957   - System.out.println(map);
958   - }
959   - } catch (MalformedURLException e) {
960   - // TODO Auto-generated catch block
961   - e.printStackTrace();
962   - } catch (IOException e) {
963   - // TODO Auto-generated catch block
964   - e.printStackTrace();
965   - } finally {
966   - if (con != null) {
967   - con.disconnect();
968   - }
969   - }
970   -
971   - return res;
972   - }
973   -
974   - @RequestMapping(value = "exportPlan", method = RequestMethod.GET)
975   - public Map<String, Object> exportPlan(@RequestParam String date){
976   - Map<String, Object> res = new HashMap<>();
977   - DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm");
978   - Connection conn = null;
979   - PreparedStatement ps = null;
980   - ResultSet rs = null;
981   -
982   - List<Map<String, Object>> list = new ArrayList<>();
983   - String sql = "select xl_name,xl_dir,schedule_date,fcsj,cl_zbh,j_name,bcsj from bsth_c_s_sp_info where schedule_date = ? and xl_bm in (22205, 202104, 202105, 202106, 202107, 210415) and bc_type = 'normal'";
984   - try{
985   - conn = DBUtils_control.getConnection();
986   - ps = conn.prepareStatement(sql);
987   - ps.setString(1, date);
988   - rs = ps.executeQuery();
989   - ObjectMapper mapper = new ObjectMapper();
990   -
991   - while (rs.next()) {
992   - SchedulePlan schedulePlan = new SchedulePlan();
993   - schedulePlan.setXlName(rs.getString("xl_name"));
994   - schedulePlan.setXlDir(rs.getInt("xl_dir"));
995   - Date scheduleDate = rs.getDate("schedule_date");
996   - schedulePlan.setScheduleDate(new DateTime(scheduleDate.getTime()).toString("yyyy-MM-dd"));
997   - String fcsj = rs.getString("fcsj");
998   - int bcsj = rs.getInt("bcsj");
999   - DateTime fcsjDt = dateTimeFormatter.parseDateTime(schedulePlan.getScheduleDate() + " " + fcsj);
1000   - schedulePlan.setFcsj(fcsjDt.toString("HH:mm:00"));
1001   - DateTime ddsjDt = fcsjDt.plusMinutes(bcsj);
1002   - schedulePlan.setDdsj(ddsjDt.toString("HH:mm:00"));
1003   - schedulePlan.setSjdStart(fcsjDt.toString("HH:00:00"));
1004   - DateTime endDt = fcsjDt.plusHours(1);
1005   - schedulePlan.setSjdEnd(endDt.toString("HH:00:00"));
1006   - schedulePlan.setClZbh(rs.getString("cl_zbh"));
1007   - schedulePlan.setJsy(rs.getString("j_name"));
1008   - schedulePlan.setBcsj(bcsj);
1009   -
1010   - list.add(mapper.readValue(mapper.writeValueAsString(schedulePlan), HashMap.class));
1011   - }
1012   - List<Iterator<?>> iterators = new ArrayList<Iterator<?>>();
1013   - iterators.add(list.iterator());
1014   - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
1015   - String sourcePath = path + "mould/schedulePlan.xls";
1016   -
1017   - new ReportUtils().excelReplace(iterators, new Object[]{}, sourcePath, path + "export/" + date + "-花博会专线班次.xls");
1018   -
1019   - res.put("status", ResponseCode.SUCCESS);
1020   - res.put("msg", "成功");
1021   - } catch (Exception e) {
1022   - res.put("status", ResponseCode.ERROR);
1023   - res.put("msg", e.getMessage());
1024   - } finally {
1025   - DBUtils_control.close(rs, ps, conn);
1026   - }
1027   -
1028   - return res;
1029   - }
1030   -
1031   - public final static class SchedulePlan {
1032   - private String company = "浦东公司[46]";
1033   -
1034   - private String xlName = "";
1035   -
1036   - private int xlDir;
1037   -
1038   - private String xlDirStr = "";
1039   -
1040   - private String scheduleDate = "";
1041   -
1042   - private String sjdStart = "";
1043   -
1044   - private String sjdEnd = "";
1045   -
1046   - private String fcsj = "";
1047   -
1048   - private int bcsj;
1049   -
1050   - private String ddsj = "";
1051   -
1052   - private int yys = 25;
1053   -
1054   - private String clZbh = "";
1055   -
1056   - private String cph = "";
1057   -
1058   - private String color = "绿牌";
1059   -
1060   - private String jsy = "";
1061   -
1062   - private String jsydh = "";
1063   -
1064   - private int pj = 10;
1065   -
1066   - public String getCompany() {
1067   - return company;
1068   - }
  721 + return map;
  722 + }
  723 +
  724 + /**
  725 + * 从历史库里删除临加班次
  726 + * @param param
  727 + * @return
  728 + */
  729 + @RequestMapping(value = "wxsb", method = RequestMethod.POST)
  730 + public Map<String, Object> repairReport(@RequestParam Map<String, Object> param){
  731 + return scheduleRealInfoService.repairReport(param, true);
  732 + }
  733 +
  734 + @RequestMapping(value = "wxsb", method = RequestMethod.GET)
  735 + public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){
  736 + return scheduleRealInfoService.repairReportList(line, date, code, type);
  737 + }
1069 738  
1070   - public void setCompany(String company) {
1071   - this.company = company;
1072   - }
1073   -
1074   - public String getXlName() {
1075   - return xlName;
1076   - }
1077   -
1078   - public void setXlName(String xlName) {
1079   - this.xlName = xlName;
1080   - }
  739 + @RequestMapping(value = "lineLevel", method = RequestMethod.GET)
  740 + public Map<String, String> lineLevel(@RequestParam String idx){
  741 + return scheduleRealInfoService.getLevelsByLines(Arrays.asList(idx.split(",")));
  742 + }
  743 +
  744 + /**
  745 + * 反馈安全驾驶系统
  746 + * @param param
  747 + * @return
  748 + */
  749 + @RequestMapping(value = "ackDsm", method = RequestMethod.POST)
  750 + public Map<String, Object> ackDsm(@RequestParam Map<String, Object> param){
  751 + Map<String, Object> res = new HashMap<>();
  752 + InputStream in = null;
  753 + SysUser user = SecurityUtils.getCurrentUser();
  754 + DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
  755 + StringBuilder url = new StringBuilder("http://211.95.61.66:9008/modules/dsmCheckTheRecord/addDsm?"), uri = new StringBuilder();
  756 + HttpURLConnection con = null;
  757 + try {
  758 + uri.append("ddyName=").append(URLEncoder.encode(user == null ? "admin" : user.getUserName(), "UTF-8"));
  759 + uri.append("&checkTime=").append(URLEncoder.encode(fmt.print(System.currentTimeMillis()), "UTF-8"));
  760 + uri.append("&nbbm=").append(URLEncoder.encode(param.get("nbbm").toString(), "UTF-8"));
  761 + uri.append("&starttime=").append(URLEncoder.encode(fmt.print(Long.parseLong(param.get("ts").toString())), "UTF-8"));
  762 + url.append(uri);
  763 + con = (HttpURLConnection)new URL(url.toString()).openConnection();
  764 + con.setDoInput(true);
  765 + con.setRequestMethod("POST");
  766 + con.setConnectTimeout(5000);
  767 + con.setReadTimeout(5000);
  768 + con.setRequestProperty("keep-alive", "true");
  769 + con.setRequestProperty("accept", "*/*");
  770 + con.setRequestProperty("content-type", "application/x-www-form-urlencoded");
  771 + con.connect();
  772 +
  773 + if (con.getResponseCode() == 200) {
  774 + in = con.getInputStream();
  775 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  776 + IOUtils.copy(in, bout);
  777 + Map<String, Object> map = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  778 + System.out.println(map);
  779 + }
  780 + } catch (MalformedURLException e) {
  781 + // TODO Auto-generated catch block
  782 + e.printStackTrace();
  783 + } catch (IOException e) {
  784 + // TODO Auto-generated catch block
  785 + e.printStackTrace();
  786 + } finally {
  787 + if (con != null) {
  788 + con.disconnect();
  789 + }
  790 + }
  791 +
  792 + return res;
  793 + }
  794 +
  795 + @RequestMapping(value = "exportPlan", method = RequestMethod.GET)
  796 + public Map<String, Object> exportPlan(@RequestParam String date){
  797 + Map<String, Object> res = new HashMap<>();
  798 + DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm");
  799 + Connection conn = null;
  800 + PreparedStatement ps = null;
  801 + ResultSet rs = null;
  802 +
  803 + List<Map<String, Object>> list = new ArrayList<>();
  804 + String sql = "select xl_name,xl_dir,schedule_date,fcsj,cl_zbh,j_name,bcsj from bsth_c_s_sp_info where schedule_date = ? and xl_bm in (22205, 202104, 202105, 202106, 202107, 210415) and bc_type = 'normal'";
  805 + try{
  806 + conn = DBUtils_control.getConnection();
  807 + ps = conn.prepareStatement(sql);
  808 + ps.setString(1, date);
  809 + rs = ps.executeQuery();
  810 + ObjectMapper mapper = new ObjectMapper();
  811 +
  812 + while (rs.next()) {
  813 + SchedulePlan schedulePlan = new SchedulePlan();
  814 + schedulePlan.setXlName(rs.getString("xl_name"));
  815 + schedulePlan.setXlDir(rs.getInt("xl_dir"));
  816 + Date scheduleDate = rs.getDate("schedule_date");
  817 + schedulePlan.setScheduleDate(new DateTime(scheduleDate.getTime()).toString("yyyy-MM-dd"));
  818 + String fcsj = rs.getString("fcsj");
  819 + int bcsj = rs.getInt("bcsj");
  820 + DateTime fcsjDt = dateTimeFormatter.parseDateTime(schedulePlan.getScheduleDate() + " " + fcsj);
  821 + schedulePlan.setFcsj(fcsjDt.toString("HH:mm:00"));
  822 + DateTime ddsjDt = fcsjDt.plusMinutes(bcsj);
  823 + schedulePlan.setDdsj(ddsjDt.toString("HH:mm:00"));
  824 + schedulePlan.setSjdStart(fcsjDt.toString("HH:00:00"));
  825 + DateTime endDt = fcsjDt.plusHours(1);
  826 + schedulePlan.setSjdEnd(endDt.toString("HH:00:00"));
  827 + schedulePlan.setClZbh(rs.getString("cl_zbh"));
  828 + schedulePlan.setJsy(rs.getString("j_name"));
  829 + schedulePlan.setBcsj(bcsj);
  830 +
  831 + list.add(mapper.readValue(mapper.writeValueAsString(schedulePlan), HashMap.class));
  832 + }
  833 + List<Iterator<?>> iterators = new ArrayList<Iterator<?>>();
  834 + iterators.add(list.iterator());
  835 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  836 + String sourcePath = path + "mould/schedulePlan.xls";
  837 +
  838 + new ReportUtils().excelReplace(iterators, new Object[]{}, sourcePath, path + "export/" + date + "-花博会专线班次.xls");
  839 +
  840 + res.put("status", ResponseCode.SUCCESS);
  841 + res.put("msg", "成功");
  842 + } catch (Exception e) {
  843 + res.put("status", ResponseCode.ERROR);
  844 + res.put("msg", e.getMessage());
  845 + } finally {
  846 + DBUtils_control.close(rs, ps, conn);
  847 + }
  848 +
  849 + return res;
  850 + }
1081 851  
1082   - public int getXlDir() {
1083   - return xlDir;
1084   - }
  852 + public final static class SchedulePlan {
  853 + private String company = "浦东公司[46]";
1085 854  
1086   - public void setXlDir(int xlDir) {
1087   - this.xlDir = xlDir;
1088   - }
  855 + private String xlName = "";
1089 856  
1090   - public String getXlDirStr() {
1091   - xlDirStr = "";
1092   - if (xlDir == 0) {
1093   - xlDirStr = "上行";
1094   - } else if (xlDir == 1) {
1095   - xlDirStr = "下行";
1096   - }
1097   - return xlDirStr;
1098   - }
  857 + private int xlDir;
1099 858  
1100   - public void setXlDirStr(String xlDirStr) {
1101   - this.xlDirStr = xlDirStr;
1102   - }
  859 + private String xlDirStr = "";
1103 860  
1104   - public String getScheduleDate() {
1105   - return scheduleDate;
1106   - }
  861 + private String scheduleDate = "";
1107 862  
1108   - public void setScheduleDate(String scheduleDate) {
1109   - this.scheduleDate = scheduleDate;
1110   - }
  863 + private String sjdStart = "";
1111 864  
1112   - public String getSjdStart() {
1113   - return sjdStart;
1114   - }
  865 + private String sjdEnd = "";
1115 866  
1116   - public void setSjdStart(String sjdStart) {
1117   - this.sjdStart = sjdStart;
1118   - }
  867 + private String fcsj = "";
1119 868  
1120   - public String getSjdEnd() {
1121   - return sjdEnd;
1122   - }
  869 + private int bcsj;
1123 870  
1124   - public void setSjdEnd(String sjdEnd) {
1125   - this.sjdEnd = sjdEnd;
1126   - }
  871 + private String ddsj = "";
1127 872  
1128   - public String getFcsj() {
1129   - return fcsj;
1130   - }
  873 + private int yys = 25;
1131 874  
1132   - public void setFcsj(String fcsj) {
1133   - this.fcsj = fcsj;
1134   - }
  875 + private String clZbh = "";
1135 876  
1136   - public int getBcsj() {
1137   - return bcsj;
1138   - }
  877 + private String cph = "";
1139 878  
1140   - public void setBcsj(int bcsj) {
1141   - this.bcsj = bcsj;
1142   - }
  879 + private String color = "绿牌";
1143 880  
1144   - public String getDdsj() {
1145   - return ddsj;
1146   - }
  881 + private String jsy = "";
1147 882  
1148   - public void setDdsj(String ddsj) {
1149   - this.ddsj = ddsj;
1150   - }
  883 + private String jsydh = "";
1151 884  
1152   - public int getYys() {
1153   - return yys;
1154   - }
  885 + private int pj = 10;
1155 886  
1156   - public void setYys(int yys) {
1157   - this.yys = yys;
1158   - }
1159   -
1160   - public String getClZbh() {
1161   - return clZbh;
1162   - }
1163   -
1164   - public void setClZbh(String clZbh) {
1165   - this.clZbh = clZbh;
1166   - }
1167   -
1168   - public String getCph() {
1169   - cph = BasicData.nbbmCompanyPlateMap.get(clZbh);
1170   - if (cph == null) {
1171   - cph = "";
1172   - }
1173   - return cph;
1174   - }
1175   -
1176   - public void setCph(String cph) {
1177   - this.cph = cph;
1178   - }
1179   -
1180   - public String getColor() {
1181   - return color;
1182   - }
1183   -
1184   - public void setColor(String color) {
1185   - this.color = color;
1186   - }
1187   -
1188   - public String getJsy() {
1189   - return jsy;
1190   - }
1191   -
1192   - public void setJsy(String jsy) {
1193   - this.jsy = jsy;
1194   - }
1195   -
1196   - public String getJsydh() {
1197   - return jsydh;
1198   - }
1199   -
1200   - public void setJsydh(String jsydh) {
1201   - this.jsydh = jsydh;
1202   - }
1203   -
1204   - public int getPj() {
1205   - return pj;
1206   - }
1207   -
1208   - public void setPj(int pj) {
1209   - this.pj = pj;
1210   - }
1211   - }
1212   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
  887 + public String getCompany() {
  888 + return company;
  889 + }
  890 +
  891 + public void setCompany(String company) {
  892 + this.company = company;
  893 + }
  894 +
  895 + public String getXlName() {
  896 + return xlName;
  897 + }
  898 +
  899 + public void setXlName(String xlName) {
  900 + this.xlName = xlName;
  901 + }
  902 +
  903 + public int getXlDir() {
  904 + return xlDir;
  905 + }
  906 +
  907 + public void setXlDir(int xlDir) {
  908 + this.xlDir = xlDir;
  909 + }
  910 +
  911 + public String getXlDirStr() {
  912 + xlDirStr = "";
  913 + if (xlDir == 0) {
  914 + xlDirStr = "上行";
  915 + } else if (xlDir == 1) {
  916 + xlDirStr = "下行";
  917 + }
  918 + return xlDirStr;
  919 + }
  920 +
  921 + public void setXlDirStr(String xlDirStr) {
  922 + this.xlDirStr = xlDirStr;
  923 + }
  924 +
  925 + public String getScheduleDate() {
  926 + return scheduleDate;
  927 + }
  928 +
  929 + public void setScheduleDate(String scheduleDate) {
  930 + this.scheduleDate = scheduleDate;
  931 + }
  932 +
  933 + public String getSjdStart() {
  934 + return sjdStart;
  935 + }
  936 +
  937 + public void setSjdStart(String sjdStart) {
  938 + this.sjdStart = sjdStart;
  939 + }
  940 +
  941 + public String getSjdEnd() {
  942 + return sjdEnd;
  943 + }
  944 +
  945 + public void setSjdEnd(String sjdEnd) {
  946 + this.sjdEnd = sjdEnd;
  947 + }
  948 +
  949 + public String getFcsj() {
  950 + return fcsj;
  951 + }
  952 +
  953 + public void setFcsj(String fcsj) {
  954 + this.fcsj = fcsj;
  955 + }
  956 +
  957 + public int getBcsj() {
  958 + return bcsj;
  959 + }
  960 +
  961 + public void setBcsj(int bcsj) {
  962 + this.bcsj = bcsj;
  963 + }
  964 +
  965 + public String getDdsj() {
  966 + return ddsj;
  967 + }
  968 +
  969 + public void setDdsj(String ddsj) {
  970 + this.ddsj = ddsj;
  971 + }
  972 +
  973 + public int getYys() {
  974 + return yys;
  975 + }
  976 +
  977 + public void setYys(int yys) {
  978 + this.yys = yys;
  979 + }
  980 +
  981 + public String getClZbh() {
  982 + return clZbh;
  983 + }
  984 +
  985 + public void setClZbh(String clZbh) {
  986 + this.clZbh = clZbh;
  987 + }
  988 +
  989 + public String getCph() {
  990 + cph = BasicData.nbbmCompanyPlateMap.get(clZbh);
  991 + if (cph == null) {
  992 + cph = "";
  993 + }
  994 + return cph;
  995 + }
  996 +
  997 + public void setCph(String cph) {
  998 + this.cph = cph;
  999 + }
  1000 +
  1001 + public String getColor() {
  1002 + return color;
  1003 + }
  1004 +
  1005 + public void setColor(String color) {
  1006 + this.color = color;
  1007 + }
  1008 +
  1009 + public String getJsy() {
  1010 + return jsy;
  1011 + }
  1012 +
  1013 + public void setJsy(String jsy) {
  1014 + this.jsy = jsy;
  1015 + }
  1016 +
  1017 + public String getJsydh() {
  1018 + return jsydh;
  1019 + }
  1020 +
  1021 + public void setJsydh(String jsydh) {
  1022 + this.jsydh = jsydh;
  1023 + }
  1024 +
  1025 + public int getPj() {
  1026 + return pj;
  1027 + }
  1028 +
  1029 + public void setPj(int pj) {
  1030 + this.pj = pj;
  1031 + }
  1032 + }
1213 1033 }
... ...
src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -27,324 +27,324 @@ import com.bsth.util.ReportUtils;
27 27 @RestController
28 28 @RequestMapping("report")
29 29 public class ReportController {
30   -
31   - @Autowired
32   - ReportService service;
33   -
34   - @RequestMapping(value="/queryListBczx" ,method = RequestMethod.GET)
35   - public List<ScheduleRealInfo> queryListBczx(@RequestParam String clzbh,@RequestParam String line,@RequestParam String date){
36   - return service.queryListBczx(line,date,clzbh);
37   - }
38   -
39   - @RequestMapping(value="/queryListZdxx" ,method = RequestMethod.GET)
40   - public List<ArrivalInfo> queryListZdxx(@RequestParam String clzbh,@RequestParam String line,
41   - @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){
42   - return service.queryListZdxx(line,date,clzbh,fcsj,ddsj);
43   - }
44   -
45   - @RequestMapping(value="/exportQueryListZdxx" ,method = RequestMethod.GET)
46   - public List<Map<String, Object>> exportQueryListZdxx(@RequestParam String clzbh,@RequestParam String line,
47   - @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){
48   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
49   - ReportUtils ee = new ReportUtils();
50   - List<ArrivalInfo> list=service.queryListZdxx(line,date,clzbh,fcsj,ddsj);
51   - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
52   - int i=1;
53   - for (ArrivalInfo a:list ) {
54   - Map<String, Object> m = new HashMap<String, Object>();
55   - m.put("i", i);
56   - m.put("nbbm", a.getNbbm());
57   - m.put("pzh", a.getPzh());
58   - m.put("stopName", a.getStopName());
59   - m.put("jzsj", a.getJzsj());
60   - m.put("czsj", a.getCzsj());
61   - m.put("kgm", "");
62   - m.put("upDown", a.getUpDown()==0?"上行":"下行");
63   - m.put("kmsd", "");
64   - m.put("bufa", "");
65   - m.put("skcs", "");
66   - m.put("skje", "");
67   - m.put("mfskcs", "");
68   - m.put("mfskje", "");
69   - resList.add(m);
70   - i++;
71   - }
72   - try {
73   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  30 +
  31 + @Autowired
  32 + ReportService service;
  33 +
  34 + @RequestMapping(value="/queryListBczx" ,method = RequestMethod.GET)
  35 + public List<ScheduleRealInfo> queryListBczx(@RequestParam String clzbh,@RequestParam String line,@RequestParam String date){
  36 + return service.queryListBczx(line,date,clzbh);
  37 + }
  38 +
  39 + @RequestMapping(value="/queryListZdxx" ,method = RequestMethod.GET)
  40 + public List<ArrivalInfo> queryListZdxx(@RequestParam String clzbh,@RequestParam String line,
  41 + @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){
  42 + return service.queryListZdxx(line,date,clzbh,fcsj,ddsj);
  43 + }
  44 +
  45 + @RequestMapping(value="/exportQueryListZdxx" ,method = RequestMethod.GET)
  46 + public List<Map<String, Object>> exportQueryListZdxx(@RequestParam String clzbh,@RequestParam String line,
  47 + @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){
  48 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  49 + ReportUtils ee = new ReportUtils();
  50 + List<ArrivalInfo> list=service.queryListZdxx(line,date,clzbh,fcsj,ddsj);
  51 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  52 + int i=1;
  53 + for (ArrivalInfo a:list ) {
  54 + Map<String, Object> m = new HashMap<String, Object>();
  55 + m.put("i", i);
  56 + m.put("nbbm", a.getNbbm());
  57 + m.put("pzh", a.getPzh());
  58 + m.put("stopName", a.getStopName());
  59 + m.put("jzsj", a.getJzsj());
  60 + m.put("czsj", a.getCzsj());
  61 + m.put("kgm", "");
  62 + m.put("upDown", a.getUpDown()==0?"上行":"下行");
  63 + m.put("kmsd", "");
  64 + m.put("bufa", "");
  65 + m.put("skcs", "");
  66 + m.put("skje", "");
  67 + m.put("mfskcs", "");
  68 + m.put("mfskje", "");
  69 + resList.add(m);
  70 + i++;
  71 + }
  72 + try {
  73 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
74 74 sdfSimple = new SimpleDateFormat("yyyyMMdd");
75   - Map<String, Object> map=new HashMap<String, Object>();
76   - listI.add(resList.iterator());
77   - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
78   - ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
79   - path + "export/"+sdfSimple.format(sdfMonth.parse(date))
80   - +"-"+clzbh+"-班次到离站.xls");
81   - } catch (Exception e) {
82   - e.printStackTrace();
83   - }
84   - return resList;
85   - }
86   -
87   -
88   - @RequestMapping(value="/queryStrinon" ,method = RequestMethod.GET)
89   - public List<StationRoute> queryStrinon(@RequestParam String line,
90   - @RequestParam int zd){
91   - List<StationRoute> list=service.queryStrinon(line,zd);
92   - return list;
93   - }
94   - //根据排班查到离站
95   - @RequestMapping(value="/queryInOutStrtion" ,method = RequestMethod.GET)
96   - public List<Map<String, Object>> queryInOutStrtion(@RequestParam String line,
97   - @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){
98   - return service.queryInOutStrtion(line,date,zd,lzsj);
99   - }
100   -
101   - //根据GPS数据查到离站
102   - @RequestMapping(value="/queryInOutStrtions" ,method = RequestMethod.GET)
103   - public List<Map<String, Object>> queryInOutStrtions(@RequestParam String line,
104   - @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){
105   - return service.queryInOutStrtions(line,date,zd,lzsj);
106   - }
107   - @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET)
108   - public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line,
109   - @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
110   - return service.queryListClzd(line,zd,zdlx,fcsj,ddsj);
111   - }
112   -
113   -
114   -
115   -
116   -
117   -
118   - @RequestMapping(value="/exportQueryListClzd" ,method = RequestMethod.GET)
119   - public List<Map<String, Object>> exportQueryListClzd(@RequestParam String zd,@RequestParam String line,
120   - @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
121   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
122   - ReportUtils ee = new ReportUtils();
123   - List<ArrivalInfo> list=service.queryListClzd(line,zd,zdlx,fcsj,ddsj);
124   - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
125   - int i=1;
126   - for (ArrivalInfo a:list ) {
127   - Map<String, Object> m = new HashMap<String, Object>();
128   - m.put("i", i);
129   - m.put("nbbm", a.getNbbm());
130   - m.put("pzh", a.getPzh());
131   - m.put("stopName", a.getStopName());
132   - m.put("jzsj", a.getJzsj());
133   - m.put("czsj", a.getCzsj());
134   - m.put("kgm", "");
135   - m.put("upDown", a.getUpDown()==0?"上行":"下行");
136   - m.put("kmsd", "");
137   - m.put("bufa", "");
138   - m.put("skcs", "");
139   - m.put("skje", "");
140   - m.put("mfskcs", "");
141   - m.put("mfskje", "");
142   - resList.add(m);
143   - i++;
144   - }
145   -
146   - try {
  75 + Map<String, Object> map=new HashMap<String, Object>();
  76 + listI.add(resList.iterator());
  77 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  78 + ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
  79 + path + "export/"+sdfSimple.format(sdfMonth.parse(date))
  80 + +"-"+clzbh+"-班次到离站.xls");
  81 + } catch (Exception e) {
  82 + e.printStackTrace();
  83 + }
  84 + return resList;
  85 + }
  86 +
  87 +
  88 + @RequestMapping(value="/queryStrinon" ,method = RequestMethod.GET)
  89 + public List<StationRoute> queryStrinon(@RequestParam String line,
  90 + @RequestParam int zd){
  91 + List<StationRoute> list=service.queryStrinon(line,zd);
  92 + return list;
  93 + }
  94 + //根据排班查到离站
  95 + @RequestMapping(value="/queryInOutStrtion" ,method = RequestMethod.GET)
  96 + public List<Map<String, Object>> queryInOutStrtion(@RequestParam String line,
  97 + @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){
  98 + return service.queryInOutStrtion(line,date,zd,lzsj);
  99 + }
  100 +
  101 + //根据GPS数据查到离站
  102 + @RequestMapping(value="/queryInOutStrtions" ,method = RequestMethod.GET)
  103 + public List<Map<String, Object>> queryInOutStrtions(@RequestParam String line,
  104 + @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){
  105 + return service.queryInOutStrtions(line,date,zd,lzsj);
  106 + }
  107 + @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET)
  108 + public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line,
  109 + @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
  110 + return service.queryListClzd(line,zd,zdlx,fcsj,ddsj);
  111 + }
  112 +
  113 +
  114 +
  115 +
  116 +
  117 +
  118 + @RequestMapping(value="/exportQueryListClzd" ,method = RequestMethod.GET)
  119 + public List<Map<String, Object>> exportQueryListClzd(@RequestParam String zd,@RequestParam String line,
  120 + @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
  121 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  122 + ReportUtils ee = new ReportUtils();
  123 + List<ArrivalInfo> list=service.queryListClzd(line,zd,zdlx,fcsj,ddsj);
  124 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  125 + int i=1;
  126 + for (ArrivalInfo a:list ) {
  127 + Map<String, Object> m = new HashMap<String, Object>();
  128 + m.put("i", i);
  129 + m.put("nbbm", a.getNbbm());
  130 + m.put("pzh", a.getPzh());
  131 + m.put("stopName", a.getStopName());
  132 + m.put("jzsj", a.getJzsj());
  133 + m.put("czsj", a.getCzsj());
  134 + m.put("kgm", "");
  135 + m.put("upDown", a.getUpDown()==0?"上行":"下行");
  136 + m.put("kmsd", "");
  137 + m.put("bufa", "");
  138 + m.put("skcs", "");
  139 + m.put("skje", "");
  140 + m.put("mfskcs", "");
  141 + m.put("mfskje", "");
  142 + resList.add(m);
  143 + i++;
  144 + }
  145 +
  146 + try {
147 147 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
148 148 sdfSimple = new SimpleDateFormat("yyyyMMdd");
149   - String lineName = BasicData.lineCode2NameMap.get(line);
150   - String dateTime = "", startDate = "", endDate = "";
151   - startDate = fcsj.substring(0, 10);
152   - endDate = ddsj.substring(0, 10);
153   - if(startDate.equals(endDate)){
154   - dateTime = sdfSimple.format(sdfMonth.parse(startDate));
155   - } else {
156   - dateTime = sdfSimple.format(sdfMonth.parse(startDate))
157   - +"-"+sdfSimple.format(sdfMonth.parse(endDate));
158   - }
159   - Map<String, Object> map=new HashMap<String, Object>();
160   - listI.add(resList.iterator());
161   - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
162   - ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
163   - path + "export/"+dateTime+"-"+lineName+"-班次到离站.xls");
164   - } catch (Exception e) {
165   - e.printStackTrace();
166   - }
167   - return resList;
168   - }
169   -
170   -
171   - @RequestMapping(value="/jobSummaryExport" ,method = RequestMethod.GET)
172   - public List<Map<String, Object>> jobSummaryExport(@RequestParam Map<String, Object> map){
173   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
174   - String lineName=map.get("lineName").toString();
175   - String date=map.get("date").toString();
176   - ReportUtils ee = new ReportUtils();
177   - List<Map<String,Object>> fwqlList= service.jobFwqk(map);
178   - List<Map<String, Object>> lgqlList=service.jobLjqk(map);
179   - map=service.jobHzxx(map);
180   - map.put("lineName", lineName);
181   - map.put("date",date);
182   - if(fwqlList.size()<=0){
183   - Map<String, Object> newMap=new HashMap<String,Object>();
184   - newMap.put("nr", " ");
185   - newMap.put("lp", " ");
186   - newMap.put("nbbm", " ");
187   - newMap.put("jgh", " ");
188   - newMap.put("dz", " ");
189   - newMap.put("sj", " ");
190   - newMap.put("lbbc", " ");
191   - newMap.put("lblc", " ");
192   - newMap.put("jyqp", " ");
193   - fwqlList.add(newMap);
194   - }
195   - if(lgqlList.size()<=0){
196   - Map<String, Object> newMap=new HashMap<String,Object>();
197   - newMap.put("lp", " ");
198   - newMap.put("nbbm", " ");
199   - newMap.put("jgh", " ");
200   - newMap.put("dz", " ");
201   - newMap.put("sj", " ");
202   - newMap.put("ljlc"," ");
203   - newMap.put("jyqp", " ");
204   - lgqlList.add(newMap);
205   - }
206   - try {
  149 + String lineName = BasicData.lineCode2NameMap.get(line);
  150 + String dateTime = "", startDate = "", endDate = "";
  151 + startDate = fcsj.substring(0, 10);
  152 + endDate = ddsj.substring(0, 10);
  153 + if(startDate.equals(endDate)){
  154 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  155 + } else {
  156 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  157 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  158 + }
  159 + Map<String, Object> map=new HashMap<String, Object>();
  160 + listI.add(resList.iterator());
  161 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  162 + ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
  163 + path + "export/"+dateTime+"-"+lineName+"-班次到离站.xls");
  164 + } catch (Exception e) {
  165 + e.printStackTrace();
  166 + }
  167 + return resList;
  168 + }
  169 +
  170 +
  171 + @RequestMapping(value="/jobSummaryExport" ,method = RequestMethod.GET)
  172 + public List<Map<String, Object>> jobSummaryExport(@RequestParam Map<String, Object> map){
  173 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  174 + String lineName=map.get("lineName").toString();
  175 + String date=map.get("date").toString();
  176 + ReportUtils ee = new ReportUtils();
  177 + List<Map<String,Object>> fwqlList= service.jobFwqk(map);
  178 + List<Map<String, Object>> lgqlList=service.jobLjqk(map);
  179 + map=service.jobHzxx(map);
  180 + map.put("lineName", lineName);
  181 + map.put("date",date);
  182 + if(fwqlList.size()<=0){
  183 + Map<String, Object> newMap=new HashMap<String,Object>();
  184 + newMap.put("nr", " ");
  185 + newMap.put("lp", " ");
  186 + newMap.put("nbbm", " ");
  187 + newMap.put("jgh", " ");
  188 + newMap.put("dz", " ");
  189 + newMap.put("sj", " ");
  190 + newMap.put("lbbc", " ");
  191 + newMap.put("lblc", " ");
  192 + newMap.put("jyqp", " ");
  193 + fwqlList.add(newMap);
  194 + }
  195 + if(lgqlList.size()<=0){
  196 + Map<String, Object> newMap=new HashMap<String,Object>();
  197 + newMap.put("lp", " ");
  198 + newMap.put("nbbm", " ");
  199 + newMap.put("jgh", " ");
  200 + newMap.put("dz", " ");
  201 + newMap.put("sj", " ");
  202 + newMap.put("ljlc"," ");
  203 + newMap.put("jyqp", " ");
  204 + lgqlList.add(newMap);
  205 + }
  206 + try {
207 207 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
208 208 sdfSimple = new SimpleDateFormat("yyyyMMdd");
209   - listI.add(fwqlList.iterator());
210   - listI.add(lgqlList.iterator());
211   - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
212   - ee.excelReplace(listI, new Object[] { map }, path + "mould/jobSummary.xls",
213   - path + "export/"+sdfSimple.format(sdfMonth.parse(date))
214   - +"-"+lineName+"-调度员工作汇总日报.xls");
215   - } catch (Exception e) {
216   - e.printStackTrace();
217   - }
218   - return new ArrayList<Map<String, Object>>();
219   - }
220   - @RequestMapping(value = "/sreachZd", method = RequestMethod.GET)
221   - public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx) {
222   - return service.sreachZd(line,zdlx);
223   - }
224   -
225   -
226   -
227   - @RequestMapping(value = "/historyMessageCount", method = RequestMethod.GET)
228   - public List<Object[]> historyMessageCount(@RequestParam String line, @RequestParam String date,
229   - @RequestParam String code) {
230   - return service.historyMessageCount(line, date, code);
231   - }
232   -
233   - @RequestMapping(value = "/historyMessageList", method = RequestMethod.GET)
234   - public List<Object[]> historyMessageList(@RequestParam String line, @RequestParam String date,
235   - @RequestParam String code,@RequestParam String type) {
236   - return service.historyMessageList(line, date, code, type);
237   - }
238   -
239   - @RequestMapping(value = "/tbodyTime1", method = RequestMethod.GET)
240   - public Map<String, Object> tbodyTime1(@RequestParam String line,@RequestParam String ttinfo) {
241   - return service.tbodyTime1(line, ttinfo);
242   - }
243   -
244   - @RequestMapping(value = "/tbodyTime2", method = RequestMethod.GET)
245   - public Map<String, Object> tbodyTime2(@RequestParam String line,@RequestParam String ttinfo) {
246   - return service.tbodyTime2(line, ttinfo);
247   - }
248   -
249   - @RequestMapping(value = "/tbodyTime3", method = RequestMethod.GET)
250   - public List<Map<String, Object>> tbodyTime3(@RequestParam String line,@RequestParam String ttinfo) {
251   - return service.tbodyTime3(line, ttinfo);
252   - }
253   -
254   - @RequestMapping(value = "/tbodyTime4", method = RequestMethod.GET)
255   - public List<Map<String, Object>> tbodyTime4(@RequestParam String line,@RequestParam String ttinfo) {
256   - return service.tbodyTime4(line, ttinfo);
257   - }
258   -
259   - @RequestMapping(value = "/tbodyTime5", method = RequestMethod.GET)
260   - public List<Map<String, Object>> tbodyTime5(@RequestParam String line,@RequestParam String ttinfo) {
261   - return service.tbodyTime5(line, ttinfo);
262   - }
263   -
264   - @RequestMapping(value="/getTtinfo", method = RequestMethod.GET)
265   - public List<Map<String,Object>> getTtinfo(@RequestParam Map<String, Object> map){
266   - return service.getTtinfo(map);
267   - }
268   -
269   -
270   - @RequestMapping(value="/jobFwqk", method = RequestMethod.GET)
271   - public List<Map<String,Object>> jobFwqk(@RequestParam Map<String, Object> map){
272   - return service.jobFwqk(map);
273   - }
274   -
275   - @RequestMapping(value="/jobHzxx", method = RequestMethod.GET)
276   - public Map<String,Object> jobHzxx(@RequestParam Map<String, Object> map){
277   - Map<String, Object> newMap=service.jobHzxx(map);
278   - return newMap;
279   - }
280   -
281   -
282   - @RequestMapping(value="/jobLjqk", method = RequestMethod.GET)
283   - public List<Map<String,Object>> jobLjqk(@RequestParam Map<String, Object> map){
284   - return service.jobLjqk(map);
285   - }
286   -
287   - @RequestMapping(value="/lineList",method = RequestMethod.GET)
288   - public List<Map<String,Object>> lineList(){
289   - return service.lineList();
290   - }
291   -
292   - @RequestMapping(value="/carList",method = RequestMethod.GET)
293   - public List<Map<String,String>> carList(@RequestParam Map<String, Object> map){
294   - return service.carList(map);
295   - }
296   -
297   - @RequestMapping(value="/userList",method = RequestMethod.GET)
298   - public List<Map<String,String>> userList(@RequestParam Map<String, Object> map){
299   - return service.userList(map);
300   - }
301   -
302   - @RequestMapping(value="/countLineMileage")
303   - public List<Map<String,Object>> countLineMileage(@RequestParam Map<String, Object> map){
304   -
305   - return service.countByList(map);
306   - }
307   -
308   - @RequestMapping(value="/countLineMileage2")
309   - public List<Map<String,Object>> countLineMileage2(@RequestParam Map<String, Object> map){
310   -
311   - return service.countByList2(map);
312   - }
313   -
314   - @RequestMapping(value="/countBusMileage")
315   - public List<Map<String,Object>> countBusMileage(@RequestParam Map<String, Object> map){
316   - return service.countByBusList(map);
317   - }
318   -
319   - @RequestMapping(value="/countDjg")
320   - public List<Map<String, Object>> countDjg(@RequestParam Map<String, Object> map){
321   - return service.countDjg(map);
322   - }
323   -
324   -
325   - @RequestMapping(value="/countDjgXx")
326   - public List<Map<String, Object>> countDjgXx(@RequestParam Map<String, Object> map){
327   - List<Map<String, Object>> lMap=new ArrayList<Map<String, Object>>();
328   - String json =StringEscapeUtils.unescapeHtml4(map.get("listXx").toString());
329   - JSONArray jsonArray=JSONArray.parseArray(json);
330   - JSONObject jsonObject;
331   - for (int x = 0; x < jsonArray.size(); x++) {
332   - jsonObject=jsonArray.getJSONObject(x);
333   - Map<String, Object> m_=new HashMap<String,Object>();
334   - m_.put("fgsname", jsonObject.getString("fgsname"));
335   - m_.put("xlName", jsonObject.getString("xlName"));
336   - m_.put("djgde", jsonObject.getString("djgde"));
337   - m_.put("qJh", jsonObject.getString("qJh"));
338   - m_.put("qSj", jsonObject.getString("qSj"));
339   - m_.put("hJh", jsonObject.getString("hJh"));
340   - m_.put("hSj", jsonObject.getString("hSj"));
341   - m_.put("djgsj", jsonObject.getString("djgsj"));
342   - m_.put("bcjgsj", jsonObject.getString("bcjgsj"));
343   - lMap.add(m_);
344   - }
345   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
346   - Map<String, Object> m = new HashMap<String, Object>();
347   - m.put("date", map.get("date").toString());
  209 + listI.add(fwqlList.iterator());
  210 + listI.add(lgqlList.iterator());
  211 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  212 + ee.excelReplace(listI, new Object[] { map }, path + "mould/jobSummary.xls",
  213 + path + "export/"+sdfSimple.format(sdfMonth.parse(date))
  214 + +"-"+lineName+"-调度员工作汇总日报.xls");
  215 + } catch (Exception e) {
  216 + e.printStackTrace();
  217 + }
  218 + return new ArrayList<Map<String, Object>>();
  219 + }
  220 + @RequestMapping(value = "/sreachZd", method = RequestMethod.GET)
  221 + public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx) {
  222 + return service.sreachZd(line,zdlx);
  223 + }
  224 +
  225 +
  226 +
  227 + @RequestMapping(value = "/historyMessageCount", method = RequestMethod.GET)
  228 + public List<Object[]> historyMessageCount(@RequestParam String line, @RequestParam String date,
  229 + @RequestParam String code) {
  230 + return service.historyMessageCount(line, date, code);
  231 + }
  232 +
  233 + @RequestMapping(value = "/historyMessageList", method = RequestMethod.GET)
  234 + public List<Object[]> historyMessageList(@RequestParam String line, @RequestParam String date,
  235 + @RequestParam String code,@RequestParam String type) {
  236 + return service.historyMessageList(line, date, code, type);
  237 + }
  238 +
  239 + @RequestMapping(value = "/tbodyTime1", method = RequestMethod.GET)
  240 + public Map<String, Object> tbodyTime1(@RequestParam String line,@RequestParam String ttinfo) {
  241 + return service.tbodyTime1(line, ttinfo);
  242 + }
  243 +
  244 + @RequestMapping(value = "/tbodyTime2", method = RequestMethod.GET)
  245 + public Map<String, Object> tbodyTime2(@RequestParam String line,@RequestParam String ttinfo) {
  246 + return service.tbodyTime2(line, ttinfo);
  247 + }
  248 +
  249 + @RequestMapping(value = "/tbodyTime3", method = RequestMethod.GET)
  250 + public List<Map<String, Object>> tbodyTime3(@RequestParam String line,@RequestParam String ttinfo) {
  251 + return service.tbodyTime3(line, ttinfo);
  252 + }
  253 +
  254 + @RequestMapping(value = "/tbodyTime4", method = RequestMethod.GET)
  255 + public List<Map<String, Object>> tbodyTime4(@RequestParam String line,@RequestParam String ttinfo) {
  256 + return service.tbodyTime4(line, ttinfo);
  257 + }
  258 +
  259 + @RequestMapping(value = "/tbodyTime5", method = RequestMethod.GET)
  260 + public List<Map<String, Object>> tbodyTime5(@RequestParam String line,@RequestParam String ttinfo) {
  261 + return service.tbodyTime5(line, ttinfo);
  262 + }
  263 +
  264 + @RequestMapping(value="/getTtinfo", method = RequestMethod.GET)
  265 + public List<Map<String,Object>> getTtinfo(@RequestParam Map<String, Object> map){
  266 + return service.getTtinfo(map);
  267 + }
  268 +
  269 +
  270 + @RequestMapping(value="/jobFwqk", method = RequestMethod.GET)
  271 + public List<Map<String,Object>> jobFwqk(@RequestParam Map<String, Object> map){
  272 + return service.jobFwqk(map);
  273 + }
  274 +
  275 + @RequestMapping(value="/jobHzxx", method = RequestMethod.GET)
  276 + public Map<String,Object> jobHzxx(@RequestParam Map<String, Object> map){
  277 + Map<String, Object> newMap=service.jobHzxx(map);
  278 + return newMap;
  279 + }
  280 +
  281 +
  282 + @RequestMapping(value="/jobLjqk", method = RequestMethod.GET)
  283 + public List<Map<String,Object>> jobLjqk(@RequestParam Map<String, Object> map){
  284 + return service.jobLjqk(map);
  285 + }
  286 +
  287 + @RequestMapping(value="/lineList",method = RequestMethod.GET)
  288 + public List<Map<String,Object>> lineList(){
  289 + return service.lineList();
  290 + }
  291 +
  292 + @RequestMapping(value="/carList",method = RequestMethod.GET)
  293 + public List<Map<String,String>> carList(@RequestParam Map<String, Object> map){
  294 + return service.carList(map);
  295 + }
  296 +
  297 + @RequestMapping(value="/userList",method = RequestMethod.GET)
  298 + public List<Map<String,String>> userList(@RequestParam Map<String, Object> map){
  299 + return service.userList(map);
  300 + }
  301 +
  302 + @RequestMapping(value="/countLineMileage")
  303 + public List<Map<String,Object>> countLineMileage(@RequestParam Map<String, Object> map){
  304 +
  305 + return service.countByList(map);
  306 + }
  307 +
  308 + @RequestMapping(value="/countLineMileage2")
  309 + public List<Map<String,Object>> countLineMileage2(@RequestParam Map<String, Object> map){
  310 +
  311 + return service.countByList2(map);
  312 + }
  313 +
  314 + @RequestMapping(value="/countBusMileage")
  315 + public List<Map<String,Object>> countBusMileage(@RequestParam Map<String, Object> map){
  316 + return service.countByBusList(map);
  317 + }
  318 +
  319 + @RequestMapping(value="/countDjg")
  320 + public List<Map<String, Object>> countDjg(@RequestParam Map<String, Object> map){
  321 + return service.countDjg(map);
  322 + }
  323 +
  324 +
  325 + @RequestMapping(value="/countDjgXx")
  326 + public List<Map<String, Object>> countDjgXx(@RequestParam Map<String, Object> map){
  327 + List<Map<String, Object>> lMap=new ArrayList<Map<String, Object>>();
  328 + String json =StringEscapeUtils.unescapeHtml4(map.get("listXx").toString());
  329 + JSONArray jsonArray=JSONArray.parseArray(json);
  330 + JSONObject jsonObject;
  331 + for (int x = 0; x < jsonArray.size(); x++) {
  332 + jsonObject=jsonArray.getJSONObject(x);
  333 + Map<String, Object> m_=new HashMap<String,Object>();
  334 + m_.put("fgsname", jsonObject.getString("fgsname"));
  335 + m_.put("xlName", jsonObject.getString("xlName"));
  336 + m_.put("djgde", jsonObject.getString("djgde"));
  337 + m_.put("qJh", jsonObject.getString("qJh"));
  338 + m_.put("qSj", jsonObject.getString("qSj"));
  339 + m_.put("hJh", jsonObject.getString("hJh"));
  340 + m_.put("hSj", jsonObject.getString("hSj"));
  341 + m_.put("djgsj", jsonObject.getString("djgsj"));
  342 + m_.put("bcjgsj", jsonObject.getString("bcjgsj"));
  343 + lMap.add(m_);
  344 + }
  345 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  346 + Map<String, Object> m = new HashMap<String, Object>();
  347 + m.put("date", map.get("date").toString());
348 348 ReportUtils ee = new ReportUtils();
349 349 try {
350 350 listI.add(lMap.iterator());
... ... @@ -355,62 +355,38 @@ public class ReportController {
355 355 // TODO: handle exception
356 356 e.printStackTrace();
357 357 }
358   -
359   - return lMap;
360   - }
361   - @RequestMapping(value="/online")
362   - public Map<String, Object> online(@RequestParam Map<String, Object> map){
363   - return service.online(map);
364   - }
365   -
366   -<<<<<<< HEAD
367   - @RequestMapping(value="/workingHours" ,method = RequestMethod.POST)
368   - public List<Map<String, Object>> workingHours(@RequestParam String gsdm, @RequestParam String fgsdm,
369   - @RequestParam String line, @RequestParam String date, @RequestParam String date2, @RequestParam String gh,
370   - @RequestParam String cl, @RequestParam String lineName, @RequestParam String type){
371   - List<Map<String, Object>> list = service.workingHours(gsdm, fgsdm, line, date, date2, gh, cl);
372   - if("export".equals(type)){
373   - try {
374   - ReportUtils ee = new ReportUtils();
375   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
376   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
377   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
378   - listI.add(list.iterator());
379   - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
380   - ee.excelReplace(listI, new Object[] { }, path + "mould/workingHours.xls",
381   - path + "export/"+sdfSimple.format(sdfMonth.parse(date))
382   - +"-"+lineName+"-工时统计表.xls");
383   - } catch (Exception e) {
384   - e.printStackTrace();
385   - }
386   - }
387   - return list;
388   -=======
389   -
390   -
391   - @RequestMapping(value = "/singledatatj", method = RequestMethod.GET)
392   - public List<Singledata> singledatatj(@RequestParam Map<String, Object> map) {
393   -
394   - return service.singledatatj(map);
395   - }
396   -
397   - //单日统计路单公里与油量,电量合并
398   - @RequestMapping(value = "/singleEnergy", method = RequestMethod.GET)
399   - public List<Map<String, Object>> singleEnergy(@RequestParam Map<String, Object> map) {
400   -
401   - return service.singleEnergy(map);
402   - }
403   -
404   - /**
405   - * @Description :TODO(路单线路明细月报表导出数据)
406   - *
407   - * @param map <tables>
408   - *
409   - * @return Map<String, Object>
410   - */
411   - @RequestMapping(value = "/calcDetailMonthlyE" , method = RequestMethod.POST)
412   - public Map<String, Object> calcDetailMonthlyE(@RequestParam Map<String,Object> map) {
413   - return service.calcDetailMonthlyE(map);
414   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
415   - }
  358 +
  359 + return lMap;
  360 + }
  361 + @RequestMapping(value="/online")
  362 + public Map<String, Object> online(@RequestParam Map<String, Object> map){
  363 + return service.online(map);
  364 + }
  365 +
  366 +
  367 +
  368 + @RequestMapping(value = "/singledatatj", method = RequestMethod.GET)
  369 + public List<Singledata> singledatatj(@RequestParam Map<String, Object> map) {
  370 +
  371 + return service.singledatatj(map);
  372 + }
  373 +
  374 + //单日统计路单公里与油量,电量合并
  375 + @RequestMapping(value = "/singleEnergy", method = RequestMethod.GET)
  376 + public List<Map<String, Object>> singleEnergy(@RequestParam Map<String, Object> map) {
  377 +
  378 + return service.singleEnergy(map);
  379 + }
  380 +
  381 + /**
  382 + * @Description :TODO(路单线路明细月报表导出数据)
  383 + *
  384 + * @param map <tables>
  385 + *
  386 + * @return Map<String, Object>
  387 + */
  388 + @RequestMapping(value = "/calcDetailMonthlyE" , method = RequestMethod.POST)
  389 + public Map<String, Object> calcDetailMonthlyE(@RequestParam Map<String,Object> map) {
  390 + return service.calcDetailMonthlyE(map);
  391 + }
416 392 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
... ... @@ -6,10 +6,7 @@ import com.bsth.data.gpsdata_v2.entity.GpsEntity;
6 6 import com.bsth.data.gpsdata_v2.handlers.*;
7 7 import com.bsth.email.SendEmailController;
8 8 import com.bsth.email.entity.EmailBean;
9   -<<<<<<< HEAD
10   -=======
11 9 import com.fasterxml.jackson.databind.ObjectMapper;
12   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
13 10 import com.google.common.collect.ArrayListMultimap;
14 11 import org.apache.commons.lang3.StringUtils;
15 12 import org.slf4j.Logger;
... ... @@ -45,35 +42,27 @@ public class DataHandleProcess {
45 42 ReverseRouteProcess reverseRouteProcess;
46 43 @Autowired
47 44 GpsRealData gpsRealData;
48   -<<<<<<< HEAD
49   -=======
50 45 // 发送邮件
51   - @Autowired
52   - private SendEmailController sendEmailController;
53   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
  46 + @Autowired
  47 + private SendEmailController sendEmailController;
54 48  
55 49  
56 50 static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class);
57 51  
58 52 final static int POOL_SIZE = 20;
59 53  
60   -<<<<<<< HEAD
61   - static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1);
62   - public static CountDownLatch count;
63   -=======
64 54 static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1, new ThreadFactory() {
65 55  
66   - @Override
67   - public Thread newThread(Runnable r) {
68   - // TODO Auto-generated method stub
69   - Thread t = new Thread(r);
70   - t.setName("GPSProcessor");
71   -
72   - return t;
73   - }
74   -
  56 + @Override
  57 + public Thread newThread(Runnable r) {
  58 + // TODO Auto-generated method stub
  59 + Thread t = new Thread(r);
  60 + t.setName("GPSProcessor");
  61 +
  62 + return t;
  63 + }
  64 +
75 65 });
76   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
77 66  
78 67 static long lastTime;
79 68  
... ... @@ -105,11 +94,7 @@ public class DataHandleProcess {
105 94 }
106 95 Set<Integer> ks = dataListMap.keySet();
107 96 logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());
108   -<<<<<<< HEAD
109   - count = new CountDownLatch(ks.size());
110   -=======
111 97 CountDownLatch count = new CountDownLatch(ks.size());
112   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
113 98  
114 99 logger.info(JSON.toJSONString(ks));
115 100 for (Integer index : ks) {
... ... @@ -118,24 +103,20 @@ public class DataHandleProcess {
118 103  
119 104  
120 105 //等待子线程结束
121   -<<<<<<< HEAD
122   - count.await();
123   -=======
124 106 boolean isNormal = count.await(5000, TimeUnit.MILLISECONDS);
125 107 if (!isNormal) {
126   - try {
127   - //发送邮件
128   - EmailBean mail = new EmailBean();
129   - mail.setSubject("线调GPS处理");
130   - mail.setContent("GPS处理超时,检查日志信息<br/>");
131   - sendEmailController.sendMail("113252620@qq.com", mail);
132   - logger.info(new ObjectMapper().writeValueAsString(list));
133   - logger.info("DataHandlerProcess:邮件发送成功!");
134   - } catch (Exception e){
135   - logger.error("DataHandlerProcess:邮件发送失败!",e);
136   - }
  108 + try {
  109 + //发送邮件
  110 + EmailBean mail = new EmailBean();
  111 + mail.setSubject("线调GPS处理");
  112 + mail.setContent("GPS处理超时,检查日志信息<br/>");
  113 + sendEmailController.sendMail("113252620@qq.com", mail);
  114 + logger.info(new ObjectMapper().writeValueAsString(list));
  115 + logger.info("DataHandlerProcess:邮件发送成功!");
  116 + } catch (Exception e){
  117 + logger.error("DataHandlerProcess:邮件发送失败!",e);
  118 + }
137 119 }
138   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
139 120  
140 121 //加入实时gps对照
141 122 for (GpsEntity gps : list)
... ... @@ -161,18 +142,12 @@ public class DataHandleProcess {
161 142  
162 143 @Override
163 144 public void run() {
164   -<<<<<<< HEAD
165   -=======
166 145 long start = System.currentTimeMillis();
167   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
168 146 try {
169 147 Collections.sort(list, comp);
170 148 GpsEntity gps;
171 149 for(int i = 0,len = list.size(); i< len ;i ++){
172   -<<<<<<< HEAD
173   -=======
174   - if (Thread.currentThread().isInterrupted()) break;
175   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
  150 + if (Thread.currentThread().isInterrupted()) break;
176 151 gps = list.get(i);
177 152  
178 153 try {
... ... @@ -192,14 +167,6 @@ public class DataHandleProcess {
192 167  
193 168 GpsCacheData.putGps(gps);//历史gps缓存
194 169 } catch (Throwable e) {
195   -<<<<<<< HEAD
196   - logger.error("", e);
197   - }
198   - }
199   - } finally {
200   - if (count != null)
201   - count.countDown();
202   -=======
203 170 logger.error("SignalHandleThread.run1", e);
204 171 }
205 172 }
... ... @@ -212,7 +179,6 @@ public class DataHandleProcess {
212 179 StringBuilder sb = new StringBuilder();
213 180 sb.append("list size:").append(list.size()).append(" cost:").append(System.currentTimeMillis() - start);
214 181 logger.info(sb.toString());
215   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
216 182 }
217 183 }
218 184 }
... ... @@ -224,4 +190,4 @@ public class DataHandleProcess {
224 190 return g1.getTimestamp().compareTo(g2.getTimestamp());
225 191 }
226 192 }
227   -}
228 193 \ No newline at end of file
  194 +}
... ...
src/main/java/com/bsth/data/gpsdata_v2/cache/GpsCacheData.java
... ... @@ -4,7 +4,6 @@ import com.bsth.data.gpsdata_v2.entity.GpsEntity;
4 4 import com.bsth.data.gpsdata_v2.entity.StationRoute;
5 5 import com.bsth.data.gpsdata_v2.entity.trail.GpsExecTrail;
6 6 import com.bsth.data.gpsdata_v2.utils.CircleQueue;
7   -import com.google.common.collect.ArrayListMultimap;
8 7 import org.slf4j.Logger;
9 8 import org.slf4j.LoggerFactory;
10 9  
... ... @@ -20,15 +19,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
20 19 public class GpsCacheData {
21 20  
22 21 /**
23   -<<<<<<< HEAD
24   - * 每辆车缓存最后200条gps
25   - */
26   - private static final int CACHE_SIZE = 200;
27   -=======
28 22 * 每辆车缓存最后20条gps
29 23 */
30 24 private static final int CACHE_SIZE = 20;
31   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
32 25 private static ConcurrentMap<String, CircleQueue<GpsEntity>> gpsCacheMap = new ConcurrentHashMap<>();
33 26  
34 27 /**
... ... @@ -62,10 +55,7 @@ public class GpsCacheData {
62 55 trailListMultimap.put(nbbm, list);
63 56 }
64 57 trail = new GpsExecTrail();
65   -<<<<<<< HEAD
66   -=======
67 58 list.clear();
68   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
69 59 list.add(trail);
70 60 } else{
71 61 trail = list.get(list.size() - 1);
... ... @@ -118,11 +108,7 @@ public class GpsCacheData {
118 108 return null;
119 109  
120 110 GpsEntity prev;
121   -<<<<<<< HEAD
122   - for(int i = trails.size() - 1; i > 0; i--){
123   -=======
124 111 for(int i = trails.size() - 1; i > -1; i--){
125   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
126 112 prev = trails.get(i).getSrs().peekLast();
127 113  
128 114 if(prev != null){
... ...
src/main/java/com/bsth/data/gpsdata_v2/load/SocketClientLoader.java
... ... @@ -23,10 +23,7 @@ import java.util.List;
23 23 * 从专用的socket client 加载数据
24 24 * Created by panzhao on 2017/11/15.
25 25 */
26   -<<<<<<< HEAD
27   -=======
28 26 //@Component
29   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
30 27 public class SocketClientLoader {
31 28  
32 29 static Logger logger = LoggerFactory.getLogger(SocketClientLoader.class);
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
1   -<<<<<<< HEAD
2   -package com.bsth.data.gpsdata_v2.utils;
3   -
4   -import com.bsth.data.BasicData;
5   -import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
6   -import com.bsth.data.gpsdata_v2.entity.GpsEntity;
7   -import com.bsth.data.gpsdata_v2.handlers.*;
8   -import com.bsth.util.db.DBUtils_MS;
9   -import com.google.common.collect.ArrayListMultimap;
10   -import org.slf4j.Logger;
11   -import org.slf4j.LoggerFactory;
12   -import org.springframework.beans.BeansException;
13   -import org.springframework.context.ApplicationContext;
14   -import org.springframework.context.ApplicationContextAware;
15   -import org.springframework.jdbc.core.JdbcTemplate;
16   -import org.springframework.jdbc.core.RowMapper;
17   -import org.springframework.stereotype.Component;
18   -
19   -import java.sql.ResultSet;
20   -import java.sql.SQLException;
21   -import java.util.*;
22   -import java.util.concurrent.CountDownLatch;
23   -import java.util.concurrent.ExecutorService;
24   -import java.util.concurrent.Executors;
25   -
26   -/**
27   - * gps数据恢复
28   - * Created by panzhao on 2016/12/24.
29   - */
30   -@Component
31   -public class GpsDataRecovery implements ApplicationContextAware {
32   -
33   - static Logger logger = LoggerFactory.getLogger(GpsDataRecovery.class);
34   -
35   - public static boolean run;
36   -
37   - static ExecutorService threadPool = Executors.newFixedThreadPool(10);
38   -
39   - static GpsStateProcess gpsStateProcess;
40   - static StationInsideProcess stationInsideProcess;
41   - static InStationProcess inStationProcess;
42   - static OutStationProcess outStationProcess;
43   - static AbnormalStateProcess abnormalStateProcess;
44   - static ReverseRouteProcess reverseRouteProcess;
45   -
46   - public void recovery() {
47   - List<GpsEntity> list = loadData();
48   -
49   - //按线路分组数据
50   - ArrayListMultimap<String, GpsEntity> listMap = ArrayListMultimap.create();
51   - for (GpsEntity gps : list) {
52   - if (gps.getNbbm() != null)
53   - listMap.put(gps.getNbbm(), gps);
54   - }
55   -
56   -
57   - Set<String> keys = listMap.keySet();
58   -
59   - CountDownLatch count = new CountDownLatch(keys.size());
60   - GpsComp comp = new GpsComp();
61   - for (String nbbm : keys) {
62   - Collections.sort(listMap.get(nbbm), comp);
63   - threadPool.submit(new RecoveryThread(listMap.get(nbbm), count));
64   - /*if(nbbm.equals("W1E-169"))
65   - new RecoveryThread(listMap.get(nbbm), count).run();*/
66   - /*if(lineId.equals("60028"))
67   - new RecoveryThread(listMap.get(lineId), count).run();*/
68   - }
69   -
70   - try {
71   - count.await();
72   - run = false;
73   - logger.info("数据恢复完成....");
74   - } catch (InterruptedException e) {
75   - logger.error("", e);
76   - }
77   - }
78   -
79   - /**
80   - * 加载当天的gps数据
81   - *
82   - * @return
83   - */
84   - public List<GpsEntity> loadData() {
85   - Calendar calendar = Calendar.getInstance();
86   - int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
87   -
88   - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info"; //+ dayOfYear;
89   - JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource());
90   -
91   - List<GpsEntity> list =
92   - jdbcTemplate.query(sql, new RowMapper<GpsEntity>() {
93   - @Override
94   - public GpsEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
95   - GpsEntity gps = new GpsEntity();
96   -
97   - gps.setDeviceId(rs.getString("DEVICE_ID"));
98   - gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId()));
99   - gps.setSpeed(rs.getFloat("SPEED_GPS"));
100   - gps.setLat(rs.getFloat("LAT"));
101   - gps.setLon(rs.getFloat("LON"));
102   - gps.setLineId(rs.getString("LINE_ID"));
103   - gps.setTimestamp(rs.getLong("TS"));
104   - gps.setUpDown((byte) getUpOrDown(rs.getLong("SERVICE_STATE")));
105   - gps.setServerTimestamp(rs.getLong("SERVER_TS"));
106   - gps.setState((int) getService(rs.getLong("SERVICE_STATE")));
107   - return gps;
108   - }
109   - });
110   - return list;
111   - }
112   -
113   - /**
114   - * 获取运营状态
115   - *
116   - * @return -1无效 0运营 1未运营
117   - */
118   - public static byte getService(long serviceState) {
119   - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000)
120   - return -1;
121   - return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0);
122   - }
123   -
124   - /**
125   - * 王通 2016/6/29 9:23:24 获取车辆线路上下行
126   - *
127   - * @return -1无效 0上行 1下行
128   - */
129   - public static int getUpOrDown(long serviceState) {
130   - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000
131   - || (serviceState & 0x01000000) == 0x01000000 || (serviceState & 0x08000000) == 0x08000000)
132   - return -1;
133   - return (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0);
134   - }
135   -
136   - @Override
137   - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
138   - gpsStateProcess = applicationContext.getBean(GpsStateProcess.class);
139   - stationInsideProcess = applicationContext.getBean(StationInsideProcess.class);
140   - inStationProcess = applicationContext.getBean(InStationProcess.class);
141   - outStationProcess = applicationContext.getBean(OutStationProcess.class);
142   - abnormalStateProcess = applicationContext.getBean(AbnormalStateProcess.class);
143   - reverseRouteProcess = applicationContext.getBean(ReverseRouteProcess.class);
144   - }
145   -
146   - public static class GpsComp implements Comparator<GpsEntity> {
147   -
148   - @Override
149   - public int compare(GpsEntity g1, GpsEntity g2) {
150   - return g1.getTimestamp().compareTo(g2.getTimestamp());
151   - }
152   - }
153   -
154   - public static class RecoveryThread implements Runnable {
155   - List<GpsEntity> list;
156   - CountDownLatch count;
157   -
158   - RecoveryThread(List<GpsEntity> list, CountDownLatch count) {
159   - this.list = list;
160   - this.count = count;
161   - }
162   -
163   - @Override
164   - public void run() {
165   - try {
166   - //循环gps恢复数据
167   - for (GpsEntity gps : list) {
168   - try {
169   -
170   - /*if(gps.getTimestamp() >= 1511569544000L)
171   - System.out.println("aaa");*/
172   -
173   - if(Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20)
174   - continue;
175   -
176   - gpsStateProcess.process(gps);//状态处理
177   - stationInsideProcess.process(gps);//场站内外判定
178   - reverseRouteProcess.process(gps);//反向路由处理
179   -
180   - abnormalStateProcess.process(gps);//超速越界
181   -
182   - inStationProcess.process(gps);//进站
183   - outStationProcess.process(gps);//出站
184   -
185   - GpsCacheData.putGps(gps);//历史gps缓存
186   - } catch (Exception e) {
187   - logger.error("", e);
188   - }
189   - }
190   - } finally {
191   - count.countDown();
192   - }
193   - }
194   - }
195   -=======
196 1 package com.bsth.data.gpsdata_v2.utils;
197 2  
198 3 import com.bsth.data.BasicData;
... ... @@ -386,5 +191,4 @@ public class GpsDataRecovery implements ApplicationContextAware {
386 191 }
387 192 }
388 193 }
389   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
390   -}
391 194 \ No newline at end of file
  195 +}
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
1   -<<<<<<< HEAD
2   -package com.bsth.data.schedule;
3   -
4   -import com.alibaba.fastjson.JSON;
5   -import com.alibaba.fastjson.JSONArray;
6   -import com.bsth.common.Constants;
7   -import com.bsth.common.ResponseCode;
8   -import com.bsth.data.LineConfigData;
9   -import com.bsth.data.gpsdata_v2.GpsRealData;
10   -import com.bsth.data.gpsdata_v2.utils.GpsDataRecovery;
11   -import com.bsth.data.schedule.f_a_l.FirstAndLastHandler;
12   -import com.bsth.entity.realcontrol.LineConfig;
13   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
14   -import com.bsth.entity.schedule.SchedulePlanInfo;
15   -import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
16   -import com.bsth.service.schedule.SchedulePlanInfoService;
17   -import com.bsth.util.ConfigUtil;
18   -import com.bsth.websocket.handler.SendUtils;
19   -import com.google.common.collect.ArrayListMultimap;
20   -import com.google.common.collect.HashMultimap;
21   -import com.google.common.collect.ListMultimap;
22   -import com.google.common.collect.Multimaps;
23   -import org.apache.commons.lang3.StringUtils;
24   -import org.joda.time.format.DateTimeFormat;
25   -import org.joda.time.format.DateTimeFormatter;
26   -import org.slf4j.Logger;
27   -import org.slf4j.LoggerFactory;
28   -import org.springframework.beans.factory.annotation.Autowired;
29   -import org.springframework.dao.DataIntegrityViolationException;
30   -import org.springframework.jdbc.core.BatchPreparedStatementSetter;
31   -import org.springframework.jdbc.core.JdbcTemplate;
32   -import org.springframework.jdbc.datasource.DataSourceTransactionManager;
33   -import org.springframework.stereotype.Component;
34   -import org.springframework.transaction.TransactionDefinition;
35   -import org.springframework.transaction.TransactionStatus;
36   -import org.springframework.transaction.support.DefaultTransactionDefinition;
37   -
38   -import java.sql.PreparedStatement;
39   -import java.sql.SQLException;
40   -import java.text.ParseException;
41   -import java.text.SimpleDateFormat;
42   -import java.util.*;
43   -import java.util.concurrent.ConcurrentHashMap;
44   -import java.util.concurrent.ConcurrentLinkedQueue;
45   -import java.util.concurrent.ConcurrentMap;
46   -
47   -/**
48   - * @author PanZhao
49   - * @ClassName: DayOfSchedule
50   - * @Description: TODO(当日实际排班)
51   - * @date 2016年8月15日 上午10:16:12
52   - */
53   -@Component
54   -public class DayOfSchedule {
55   -
56   - Logger logger = LoggerFactory.getLogger(this.getClass());
57   -
58   - //按线路分组的 “原始计划” 排班数据
59   - public static Map<String, List<SchedulePlanInfo>> schedulePlanMap;
60   -
61   - // 按车辆索引的班次数据
62   - private static ListMultimap<String, ScheduleRealInfo> nbbmScheduleMap;
63   -
64   - // 按营运公司索引的班次数据
65   - private static ListMultimap<String, ScheduleRealInfo> gsBmScheduleMap;
66   -
67   - //按线路索引计划用车
68   - private static HashMultimap<String, String> lineNbbmsMap;
69   -
70   - //按路牌索引班次数据 线路编码_路牌名称 ——> 班次list
71   - private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap;
72   -
73   - // 班次主键映射
74   - private static ConcurrentMap<Long, ScheduleRealInfo> id2SchedulMap;
75   -
76   - //车辆 ——> 当前执行班次
77   - private static ConcurrentMap<String, ScheduleRealInfo> carExecutePlanMap;
78   -
79   - // 持久化
80   - public static ConcurrentLinkedQueue<ScheduleRealInfo> pstBuffer;
81   -
82   - // 排序器
83   - private static ScheduleComparator.FCSJ schFCSJComparator;
84   -
85   - private static ScheduleComparator.DFSJ schDFSJComparator;
86   -
87   - private static Long sch_max_id=Long.parseLong(ConfigUtil.get("auto_increment_offset"));
88   -
89   - @Autowired
90   - LineConfigData lineConfigData;
91   -
92   - @Autowired
93   - ScheduleRealInfoRepository schRepository;
94   -
95   - @Autowired
96   - SchedulePlanInfoService schPlanService;
97   -
98   - @Autowired
99   - SchAttrCalculator schAttrCalculator;
100   -
101   - @Autowired
102   - SendUtils sendUtils;
103   -
104   - @Autowired
105   - GpsRealData gpsRealData;
106   -
107   - /**
108   - * 线路当前使用的排班的日期
109   - */
110   - public static Map<String, String> currSchDateMap;
111   -
112   - static {
113   - nbbmScheduleMap = ArrayListMultimap.create();
114   - nbbmScheduleMap = Multimaps.synchronizedListMultimap(nbbmScheduleMap);
115   -
116   - gsBmScheduleMap = ArrayListMultimap.create();
117   - lpScheduleMap = ArrayListMultimap.create();
118   - lineNbbmsMap = HashMultimap.create();
119   -
120   - id2SchedulMap = new ConcurrentHashMap<>();
121   - pstBuffer = new ConcurrentLinkedQueue<>();
122   - schFCSJComparator = new ScheduleComparator.FCSJ();
123   - schDFSJComparator = new ScheduleComparator.DFSJ();
124   - currSchDateMap = new HashMap<>();
125   - carExecutePlanMap = new ConcurrentHashMap<>();
126   -
127   - schedulePlanMap = new HashMap<>();
128   - }
129   -
130   - @Autowired
131   - LineConfigData lineConfigs;
132   -
133   - @Autowired
134   - GpsDataRecovery gpsDataRecovery;
135   -
136   - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), fmtHHmm = DateTimeFormat.forPattern("HH:mm");
137   -
138   - //数据恢复
139   - public void dataRecovery() {
140   - Collection<LineConfig> confs = lineConfigs.getAll();
141   - String lineCode, currSchDate;
142   - for (LineConfig conf : confs) {
143   - lineCode = conf.getLine().getLineCode();
144   - currSchDate = calcSchDate(lineCode);
145   - //加载班次数据
146   - reloadSch(lineCode, currSchDate, false);
147   - }
148   -
149   - //恢复gps数据
150   - gpsDataRecovery.recovery();
151   - }
152   -
153   - public Map<String, String> getCurrSchDate() {
154   - return currSchDateMap;
155   - }
156   -
157   - /**
158   - * @Title: calcSchDateB
159   - * @Description: TODO(计算线路当前应该使用的排班日期)
160   - */
161   - public String calcSchDate(String lineCode) {
162   - Long t = System.currentTimeMillis();
163   - LineConfig conf = lineConfigData.get(lineCode);
164   -
165   - // 小于当天起始运营时间,则取前一天的排班
166   - String ct = fmtHHmm.print(t);
167   - if(ct.compareTo(conf.getStartOpt()) < 0)
168   - t -= 1000 * 60 * 60 * 24;
169   -
170   - String schDate = fmtyyyyMMdd.print(t);
171   - return schDate;
172   - }
173   -
174   - /**
175   - * @param @param lineCode 线路编码
176   - * @param @param schDate 班次日期 yyyy-MM-dd
177   - * @param @param forcePlan 强制从计划调度重新抓取
178   - * @Title: reloadSch
179   - * @Title: reloadSch
180   - * @Description: TODO(重新载入排班)
181   - */
182   - public int reloadSch(String lineCode, String schDate, boolean forcePlan) {
183   - try {
184   - List<ScheduleRealInfo> list;
185   -
186   - if (forcePlan)
187   - removeRealSch(lineCode, schDate);
188   - else
189   - clearRAMData(lineCode);
190   -
191   - if (existRealSch(lineCode, schDate))
192   - list = loadRealSch(lineCode, schDate);// 从实际排班表加载
193   - else {
194   - list = loadPlanSch(lineCode, schDate);// 从计划排班表加载
195   - // 写入数据库
196   - batchSave(list);
197   - }
198   -
199   - //更新线路和班次日期对照
200   - currSchDateMap.put(lineCode, schDate);
201   - //添加到缓存
202   - putAll(list);
203   -
204   - //标记首末班
205   - FirstAndLastHandler.marks(list);
206   -
207   - Set<String> lps = searchAllLP(list);
208   - for (String lp : lps) {
209   - //计算“起点站应到”时间
210   - schAttrCalculator.calcQdzTimePlan(lpScheduleMap.get(lineCode + "_" + lp));
211   - }
212   - Set<String> cars = searchAllCars(list);
213   - for (String nbbm : cars) {
214   - //车辆 ——> 要执行的班次对照
215   - reCalcExecPlan(nbbm);
216   - }
217   -
218   - //分组计划用车
219   - reCalcLineNbbms();
220   - // 页面 翻班通知
221   - //sendUtils.shiftSchedule(lineCode);
222   - } catch (Exception e) {
223   - logger.error("", e);
224   - return -1;
225   - }
226   -
227   - return 0;
228   - }
229   -
230   - public int reloadSch(String lineCode) {
231   - return reloadSch(lineCode, calcSchDate(lineCode), true);
232   - }
233   -
234   - /**
235   - * @Title: searchAllCars
236   - * @Description: TODO(搜索班次集合中的车辆)
237   - */
238   - private Set<String> searchAllCars(List<ScheduleRealInfo> list) {
239   - Set<String> cars = new HashSet<>();
240   - for (ScheduleRealInfo sch : list)
241   - cars.add(sch.getClZbh());
242   -
243   - return cars;
244   - }
245   -
246   - /**
247   - * @Title: searchAllCars
248   - * @Description: TODO(搜索班次集合中的路牌)
249   - */
250   - private Set<String> searchAllLP(List<ScheduleRealInfo> list) {
251   - Set<String> lps = new HashSet<>();
252   - for (ScheduleRealInfo sch : list)
253   - lps.add(sch.getLpName());
254   -
255   - return lps;
256   - }
257   -
258   - private void putAll(List<ScheduleRealInfo> list) {
259   - for (ScheduleRealInfo sch : list)
260   - put(sch);
261   - }
262   -
263   - /**
264   - * @param @param lineCode 线路编码
265   - * @param @param schDate 班次日期 yyyy-MM-dd
266   - * @Title: removeRealSch
267   - * @Description: TODO(清除实际排班,包括数据库和内存数据)
268   - */
269   - public void removeRealSch(String lineCode, String schDate) throws Exception {
270   - try {
271   - // 清理数据库数据
272   - schRepository.deleteByLineCodeAndDate(lineCode + "", schDate);
273   -
274   - // 清理内存数据
275   - clearRAMData(lineCode + "");
276   - } catch (Exception e) {
277   - logger.error("removeRealSch error, " + lineCode + " -" + schDate, e);
278   - throw e;
279   - }
280   - }
281   -
282   - /**
283   - * @Title: clearRAMData
284   - * @Description: TODO(清理内存数据)
285   - */
286   - public void clearRAMData(String lineCode) {
287   - int count = 0;
288   - List<ScheduleRealInfo> remList = new ArrayList<>();
289   - Collection<ScheduleRealInfo> all = nbbmScheduleMap.values();
290   - for (ScheduleRealInfo sch : all) {
291   - if (sch.getXlBm().equals(lineCode))
292   - remList.add(sch);
293   - }
294   -
295   - for (ScheduleRealInfo sch : remList) {
296   - if (null != sch) {
297   - nbbmScheduleMap.remove(sch.getClZbh(), sch);
298   - id2SchedulMap.remove(sch.getId());
299   - count++;
300   -
301   - //清理路牌对照
302   - lpScheduleMap.removeAll(sch.getXlBm() + "_" + sch.getLpName());
303   -
304   - //清除车辆 ——> 执行班次对照
305   - carExecutePlanMap.remove(sch.getClZbh());
306   - }
307   - }
308   - //清理计划排班
309   - schedulePlanMap.remove(lineCode);
310   -
311   - remList.clear();
312   - remList = null;
313   - logger.info(lineCode + "排班清理 " + count);
314   - }
315   -
316   - /**
317   - * @Title: existRealSch
318   - * @Description: TODO(实际排班是否已存在)
319   - */
320   - public boolean existRealSch(String lineCode, String schDate) {
321   - int count = schRepository.countByLineCodeAndDate(lineCode, schDate);
322   - return count > 0;
323   - }
324   -
325   - /**
326   - * @Title: loadRealSch
327   - * @Description: TODO(从实际排班表加载数据)
328   - */
329   - public List<ScheduleRealInfo> loadRealSch(String lineCode, String schDate) {
330   - return schRepository.findByLineCodeAndDate(lineCode, schDate);
331   - }
332   -
333   - /**
334   - * @Title: loadPlanSch
335   - * @Description: TODO(从计划排班表加载数据)
336   - */
337   - public List<ScheduleRealInfo> loadPlanSch(String lineCode, String schDate) {
338   - logger.info("从计划排班表恢复排班,lineCode: " + lineCode + ", schDate: " + schDate);
339   - List<ScheduleRealInfo> realList = new ArrayList<>();
340   -
341   - try {
342   - Map<String, Object> data = new HashMap<>();
343   -
344   - data.put("scheduleDate_eq", fmtyyyyMMdd.parseDateTime(schDate).toDate());
345   - data.put("xlBm_eq", lineCode);
346   -
347   - // 查询计划排班
348   - List<SchedulePlanInfo> planItr = cleanSchPlanItr(schPlanService.list(data).iterator());
349   - //保存一份原始计划排班数据
350   - schedulePlanMap.put(lineCode, planItr);
351   -
352   - // 转换为实际排班
353   - realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class);
354   -
355   - Date d = new Date();
356   - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
357   - String fcsj;
358   - for (ScheduleRealInfo sch : realList) {
359   - sch.setScheduleDateStr(fmtyyyyMMdd.print(sch.getScheduleDate().getTime()));
360   - sch.setRealExecDate(sch.getScheduleDateStr());
361   - sch.setCreateDate(d);
362   -
363   - if (StringUtils.isEmpty(sch.getFcsj()))
364   - sch.setFcsj("00:00");
365   -
366   - if (sch.getFcsj().equals("24:00"))
367   - sch.setFcsj("23:59");
368   -
369   - if (sch.getFcsj().substring(0, 2).equals("24")) {
370   - sch.setFcsj("00" + sch.getFcsj().substring(2));
371   - }
372   -
373   - fcsj = sch.getFcsj().trim();
374   - //处理一下发车时间格式没有:号的问题
375   - if (fcsj.indexOf(":") == -1 && fcsj.length() >= 4) {
376   - sch.setFcsj(fcsj.substring(0, 2) + ":" + fcsj.substring(2, 4));
377   - }
378   -
379   - try {
380   - sdf.parse(sch.getFcsj());
381   - } catch (ParseException e) {
382   - //发车时间仍然校验不过的,直接写成00:00
383   - sch.setFcsj("00:00");
384   - }
385   - sch.setDfsj(sch.getFcsj());
386   -
387   - // 计划终点时间
388   - if (sch.getBcsj() != null) {
389   - sch.setZdsj(fmtHHmm.print(fmtHHmm.parseMillis(sch.getFcsj()) + (sch.getBcsj() * 60 * 1000)));
390   - sch.setLate(false);
391   - }
392   -
393   - //售票员为空设置为""字符串
394   - if (StringUtils.isEmpty(sch.getsGh())) {
395   - sch.setsGh("");
396   - sch.setsName("");
397   - }
398   - sch.setJhlcOrig(sch.getJhlc());
399   - //保留备注
400   - if (StringUtils.isNotEmpty(sch.getRemark()))
401   - sch.setRemarks(sch.getRemark());
402   - }
403   - } catch (Exception e) {
404   - logger.error("", e);
405   - }
406   -
407   - return realList;
408   - }
409   -
410   -
411   - public synchronized long getId(){
412   - long temp = sch_max_id;
413   - if (sch_max_id < 0) {
414   - sch_max_id = schRepository.getMaxId();
415   - if(null == sch_max_id)
416   - sch_max_id = 3000L;//留一点空间补数据用
417   - if (temp == -1) {
418   - sch_max_id += sch_max_id % 2 == 0 ? 1 : 0;
419   - } else if (temp == -2) {
420   - sch_max_id += sch_max_id % 2 == 0 ? 0 : 1;
421   - }
422   - } else {
423   - sch_max_id += 2;
424   - }
425   - /*if(sch_max_id==-1){
426   - sch_max_id = schRepository.getMaxId();
427   - if(null == sch_max_id)
428   - sch_max_id = 3000L;//留一点空间补数据用
429   - sch_max_id += 5;
430   - }
431   - else
432   - sch_max_id++;*/
433   - return sch_max_id;
434   - }
435   -
436   - /**
437   - * @Title: batchSave
438   - * @Description: TODO(批量入库)
439   - */
440   - private void batchSave(List<ScheduleRealInfo> list) {
441   - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
442   - for (ScheduleRealInfo item : list) {
443   - item.setSpId(item.getId());// 保留原始的计划ID
444   - item.setId(getId());// 设置ID
445   - item.setScheduleDateStr(sdfyyyyMMdd.format(item.getScheduleDate()));
446   - }
447   -
448   - //编程式事务
449   - DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
450   - DefaultTransactionDefinition def = new DefaultTransactionDefinition();
451   - def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
452   - TransactionStatus status = tran.getTransaction(def);
453   -
454   - try{
455   - final List<ScheduleRealInfo> pstList = list;
456   - //写入
457   - jdbcTemplate.batchUpdate("insert into bsth_c_s_sp_info_real(id,bc_type,bcs,bcsj,cl_zbh,create_date,dfsj,directive_state,fcno,fcsj,fcsj_actual,j_gh,j_name,jhlc,lp_name,qdz_code,qdz_name,real_exec_date,remarks,s_gh,s_name,schedule_date,schedule_date_str,sflj,sp_id,status,update_date,xl_bm,xl_dir,xl_name,zdsj,zdsj_actual,zdz_code,zdz_name,ccno,df_auto,fgs_bm,fgs_name,gs_bm,gs_name,online,adjust_exps,reissue,jhlc_orig,sigin_compate,drift_status,cc_service,major_station_name)" +
458   - " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
459   - @Override
460   - public void setValues(PreparedStatement ps, int i) throws SQLException {
461   - ScheduleRealInfo sch = pstList.get(i);
462   - ps.setLong(1, sch.getId());
463   - ps.setString(2, sch.getBcType());
464   - ps.setInt(3, sch.getBcs()==null?0:sch.getBcs());
465   - ps.setInt(4, sch.getBcsj()==null?0:sch.getBcsj());
466   - ps.setString(5, sch.getClZbh());
467   - ps.setTimestamp(6, new java.sql.Timestamp(sch.getCreateDate().getTime()));
468   - ps.setString(7, sch.getDfsj());
469   - ps.setInt(8, sch.getDirectiveState());
470   - ps.setInt(9, sch.getFcno()==null?0:sch.getFcno());
471   - ps.setString(10, sch.getFcsj());
472   - ps.setString(11, sch.getFcsjActual());
473   - ps.setString(12, sch.getjGh());
474   - ps.setString(13, sch.getjName());
475   - ps.setDouble(14, sch.getJhlc());
476   - ps.setString(15, sch.getLpName());
477   - ps.setString(16, sch.getQdzCode());
478   - ps.setString(17, sch.getQdzName());
479   - ps.setString(18, sch.getRealExecDate());
480   - ps.setString(19, sch.getRemarks());
481   - ps.setString(20, sch.getsGh());
482   - ps.setString(21, sch.getsName());
483   - ps.setTimestamp(22, new java.sql.Timestamp(sch.getScheduleDate().getTime()));
484   - ps.setString(23, sch.getScheduleDateStr());
485   - ps.setBoolean(24, sch.isSflj());
486   - ps.setLong(25, sch.getSpId());
487   - ps.setInt(26, sch.getStatus());
488   - ps.setTimestamp(27, new java.sql.Timestamp(sch.getUpdateDate().getTime()));
489   - ps.setString(28, sch.getXlBm());
490   - ps.setString(29, sch.getXlDir());
491   - ps.setString(30, sch.getXlName());
492   - ps.setString(31, sch.getZdsj());
493   - ps.setString(32, sch.getZdsjActual());
494   - ps.setString(33, sch.getZdzCode());
495   - ps.setString(34, sch.getZdzName());
496   - ps.setInt(35, sch.getCcno()==null?0:sch.getCcno());
497   - ps.setBoolean(36, sch.isDfAuto());
498   - ps.setString(37, sch.getFgsBm());
499   - ps.setString(38, sch.getFgsName());
500   - ps.setString(39, sch.getGsBm());
501   - ps.setString(40, sch.getGsName());
502   - ps.setBoolean(41, sch.isOnline());
503   - ps.setString(42, sch.getAdjustExps());
504   - ps.setBoolean(43, sch.isReissue());
505   - ps.setDouble(44, sch.getJhlcOrig());
506   - ps.setInt(45, sch.getSiginCompate());
507   - ps.setInt(46, sch.getDriftStatus());
508   - ps.setBoolean(47, sch.isCcService());
509   - ps.setString(48, sch.getMajorStationName());
510   - }
511   -
512   - @Override
513   - public int getBatchSize() {
514   - return pstList.size();
515   - }
516   - });
517   -
518   - tran.commit(status);
519   - }catch (Exception e){
520   - tran.rollback(status);
521   - logger.error("real schedule batchSave error...", e);
522   - }
523   - // 入库
524   - //new BatchSaveUtils<ScheduleRealInfo>().saveList(list, ScheduleRealInfo.class);
525   - }
526   -
527   - public List<SchedulePlanInfo> cleanSchPlanItr(Iterator<SchedulePlanInfo> itrab) {
528   - List<SchedulePlanInfo> list = new ArrayList<>();
529   -
530   - SchedulePlanInfo sp;
531   - while (itrab.hasNext()) {
532   - sp = itrab.next();
533   - sp.setSchedulePlan(null);
534   - sp.setCreateBy(null);
535   - sp.setUpdateBy(null);
536   - list.add(sp);
537   - }
538   - return list;
539   - }
540   -
541   - /**
542   - * @Title: findByLineCode
543   - * @Description: TODO(lineCode 获取班次)
544   - */
545   - public List<ScheduleRealInfo> findByLineCode(String lineCode) {
546   - List<ScheduleRealInfo> rs = new ArrayList<>();
547   -
548   - Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
549   - for (ScheduleRealInfo sch : schs) {
550   - if (sch.getXlBm().equals(lineCode))
551   - rs.add(sch);
552   - }
553   - return rs;
554   - }
555   -
556   - /**
557   - * @Title: findByLineCode
558   - * @Description: TODO(lineList 获取班次)
559   - */
560   - public Map<String, Collection<ScheduleRealInfo>> findByLineCodes(List<String> lineList) {
561   - ArrayListMultimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create();
562   -
563   - Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
564   - for (ScheduleRealInfo sch : schs) {
565   - if (lineList.contains(sch.getXlBm())) {
566   - mMap.put(sch.getXlBm(), sch);
567   - }
568   - }
569   - return mMap.asMap();
570   - }
571   -
572   - /**
573   - * @Title: findCarByLineCode
574   - * @Description: TODO(线路下运营的车辆)
575   - */
576   - public Set<String> findCarByLineCode(String lineCode) {
577   - /*Set<String> rs = new HashSet<>();
578   -
579   - Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
580   - for (ScheduleRealInfo sch : schs) {
581   - if (sch.getXlBm().equals(lineCode))
582   - rs.add(sch.getClZbh());
583   - }
584   -*/
585   - return lineNbbmsMap.get(lineCode);
586   - }
587   -
588   - public List<ScheduleRealInfo> findByNbbm(String nbbm) {
589   - return nbbmScheduleMap.get(nbbm);
590   - }
591   -
592   - /**
593   - * @Title: findByLineAndUpDown
594   - * @Description: TODO(lineCode 和走向获取班次)
595   - */
596   - public List<ScheduleRealInfo> findByLineAndUpDown(String lineCode, Integer upDown) {
597   - List<ScheduleRealInfo> list = findByLineCode(lineCode), rs = new ArrayList<>();
598   -
599   - for (ScheduleRealInfo sch : list) {
600   - if (sch.getXlDir().equals(upDown + ""))
601   - rs.add(sch);
602   - }
603   - return rs;
604   - }
605   -
606   - public ScheduleRealInfo get(long id) {
607   - return id2SchedulMap.get(id);
608   - }
609   -
610   -
611   - /**
612   - * @Title: next
613   - * @Description: TODO(下一个班次)
614   - */
615   - public ScheduleRealInfo next(ScheduleRealInfo sch) {
616   - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
617   - //排序
618   - Collections.sort(list, schDFSJComparator);
619   - return next(list, sch);
620   - }
621   -
622   -
623   - /**
624   - * 下一个班次
625   - *
626   - * @param list 班次集合
627   - * @param sch 当前班次
628   - * @return
629   - */
630   - private ScheduleRealInfo next(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) {
631   - int outConfig = -1;
632   - LineConfig config = lineConfigData.get(sch.getXlBm());
633   - if (config != null)
634   - outConfig = config.getOutConfig();
635   -
636   - //限定出站既出场的停车场
637   - List<String> parks = config.findTwinsParkList();
638   - boolean limitPark = null != parks && parks.size() > 0;
639   - boolean flag = false;
640   - ScheduleRealInfo next = null;
641   - for (ScheduleRealInfo temp : list) {
642   - if (temp.getId() == sch.getId()) {
643   - flag = true;
644   - continue;
645   - }
646   - //忽略烂班
647   - if (temp.isDestroy())
648   - continue;
649   -
650   - //出站既出场,忽略出场班次
651   - if (outConfig == 2 && temp.getBcType().equals("out") && isEmptyMileage(temp)
652   - && (!limitPark || parks.contains(temp.getQdzCode())))
653   - continue;
654   -
655   - if (flag) {
656   - next = temp;
657   - break;
658   - }
659   - }
660   - return next;
661   - }
662   -
663   - private boolean isEmptyMileage(ScheduleRealInfo sch) {
664   - return sch.getBcsj() == 0 || sch.getJhlcOrig().intValue() == 0;
665   - }
666   -
667   - /**
668   - * 下一个班次
669   - *
670   - * @param list 班次集合
671   - * @param sch 当前班次
672   - * @return
673   - */
674   - private ScheduleRealInfo next2_lp(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) {
675   - int outConfig = -1;
676   - LineConfig config = lineConfigData.get(sch.getXlBm());
677   - if (config != null)
678   - outConfig = config.getOutConfig();
679   -
680   - boolean flag = false;
681   - ScheduleRealInfo next = null;
682   - for (ScheduleRealInfo temp : list) {
683   - if (temp.getId() == sch.getId()) {
684   - flag = true;
685   - continue;
686   - }
687   -
688   - if (flag) {
689   - next = temp;
690   - break;
691   - }
692   - }
693   - return next;
694   - }
695   -
696   - private ScheduleRealInfo next3_lp(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) {
697   - int outConfig = -1;
698   - LineConfig config = lineConfigData.get(sch.getXlBm());
699   - if (config != null)
700   - outConfig = config.getOutConfig();
701   -
702   - //限定出站既出场的停车场
703   - List<String> parks = config.findTwinsParkList();
704   - boolean limitPark = null != parks && parks.size() > 0;
705   - boolean flag = false;
706   - ScheduleRealInfo next = null;
707   - for (ScheduleRealInfo temp : list) {
708   - if (temp.getId() == sch.getId()) {
709   - flag = true;
710   - continue;
711   - }
712   -
713   - //出站既出场,忽略出场班次
714   - if (outConfig == 2 && temp.getBcType().equals("out") && isEmptyMileage(temp)
715   - && (!limitPark || parks.contains(temp.getQdzCode())))
716   - continue;
717   -
718   - if (flag) {
719   - next = temp;
720   - break;
721   - }
722   - }
723   - return next;
724   - }
725   -
726   - /**
727   - * 上一个班次
728   - *
729   - * @param sch
730   - * @return
731   - */
732   - public ScheduleRealInfo prev(ScheduleRealInfo sch) {
733   - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
734   -
735   - //boolean flag = false;
736   - ScheduleRealInfo prev = null;
737   - int size = list.size();
738   -
739   - for (int i = 0; i < size; i++) {
740   - if (list.get(i).isDestroy())
741   - continue;
742   -
743   - if (list.get(i).getId().equals(sch.getId())) {
744   - return prev;
745   - }
746   - prev = list.get(i);
747   - }
748   - return prev;
749   - }
750   -
751   - /**
752   - * 是否是首班出场
753   - *
754   - * @param sch
755   - * @return
756   - */
757   - public boolean isFirstOut(ScheduleRealInfo sch) {
758   - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
759   - try {
760   - if (list.get(0) == sch && sch.getBcType().equals("out"))
761   - return true;
762   - } catch (IndexOutOfBoundsException e) {
763   - logger.error("小小的数组越界,无伤大雅!");
764   - }
765   - return false;
766   - }
767   -
768   - public void put(ScheduleRealInfo sch) {
769   - schAttrCalculator
770   - .calcRealDate(sch)
771   - .calcAllTimeByFcsj(sch);
772   -
773   - nbbmScheduleMap.put(sch.getClZbh(), sch);
774   -
775   - //主键索引
776   - id2SchedulMap.put(sch.getId(), sch);
777   - //路牌对照表
778   - addLPMapp(sch);
779   -
780   - //跨24点的,再save一次
781   - if (!sch.getRealExecDate().equals(sch.getScheduleDateStr()))
782   - save(sch);
783   - }
784   -
785   - public void addLPMapp(ScheduleRealInfo sch) {
786   - lpScheduleMap.put(sch.getXlBm() + "_" + sch.getLpName(), sch);
787   - }
788   -
789   - public void delete(ScheduleRealInfo sch) {
790   - if (!sch.isSflj())
791   - return;
792   -
793   - nbbmScheduleMap.remove(sch.getClZbh(), sch);
794   - id2SchedulMap.remove(sch.getId());
795   - lpScheduleMap.remove(sch.getXlBm() + "_" + sch.getLpName(), sch);
796   -
797   - //如果正在执行该班次
798   - if (carExecutePlanMap.get(sch.getClZbh()) == sch) {
799   - //重新计算车辆当前执行班次
800   - reCalcExecPlan(sch.getClZbh());
801   - }
802   - }
803   -
804   - public List<ScheduleRealInfo> updateQdzTimePlan(String lpName) {
805   - List<ScheduleRealInfo> list = lpScheduleMap.get(lpName);
806   - Collections.sort(list, schFCSJComparator);
807   - return schAttrCalculator.updateQdzTimePlan(list);
808   - }
809   -
810   - public List<ScheduleRealInfo> updateQdzTimePlan(ScheduleRealInfo sch) {
811   - return updateQdzTimePlan(sch.getXlBm() + "_" + sch.getLpName());
812   - }
813   -
814   - /**
815   - * @Title: doneSum
816   - * @Description: TODO(已完成班次总数)
817   - */
818   - public int doneSum(String clZbh) {
819   - List<ScheduleRealInfo> list = nbbmScheduleMap.get(clZbh);
820   - int rs = 0;
821   -
822   - for (ScheduleRealInfo sch : list) {
823   - if (sch.getStatus() == 2 && !sch.isDestroy())
824   - rs++;
825   - }
826   - return rs;
827   - }
828   -
829   - public void save(ScheduleRealInfo sch) {
830   - sch.setUpdateDate(new Date());
831   - pstBuffer.add(sch);
832   - }
833   -
834   -
835   - /**
836   - * @Title: nextByBcType
837   - * @Description: TODO(获取下一个指定班次类型的班次)
838   - */
839   - public ScheduleRealInfo nextByBcType(String nbbm, String bcType) {
840   - List<ScheduleRealInfo> list = findByBcType(nbbm, bcType);
841   -
842   - Collections.sort(list, schFCSJComparator);
843   - ScheduleRealInfo sch = null;
844   - for (ScheduleRealInfo temp : list) {
845   - if (temp.getFcsjActual() == null)
846   - sch = temp;
847   - }
848   -
849   - return sch;
850   - }
851   -
852   -
853   - /**
854   - * 搜索离当前时间最近的一个指定类型的班次
855   - *
856   - * @param nbbm
857   - * @param bcType
858   - * @return
859   - */
860   - public ScheduleRealInfo searchNearByBcType(String nbbm, String bcType) {
861   - List<ScheduleRealInfo> list = findByBcType(nbbm, bcType);
862   - Collections.sort(list, schFCSJComparator);
863   -
864   - long t = System.currentTimeMillis();
865   - int distance = -1, diff;
866   -
867   - ScheduleRealInfo sch = null;
868   - for (ScheduleRealInfo temp : list) {
869   - diff = (int) Math.abs(temp.getDfsjT() - t);
870   - if (diff < distance || distance == -1) {
871   - sch = temp;
872   - distance = diff;
873   - }
874   - }
875   - return sch;
876   - }
877   -
878   - public List<ScheduleRealInfo> findByBcType(String nbbm, String bcType) {
879   - List<ScheduleRealInfo> all = nbbmScheduleMap.get(nbbm), outList = new ArrayList<>();
880   -
881   - for (ScheduleRealInfo sch : all) {
882   - if (sch.getBcType().equals(bcType))
883   - outList.add(sch);
884   - }
885   - return outList;
886   - }
887   -
888   - public Collection<ScheduleRealInfo> findAll() {
889   - return nbbmScheduleMap.values();
890   - }
891   -
892   - public Collection<ScheduleRealInfo> findAllByLpContainer() {
893   - return lpScheduleMap.values();
894   - }
895   -
896   - public Collection<ScheduleRealInfo> findAllByIdContainer() {
897   - return id2SchedulMap.values();
898   - }
899   -
900   - public int getPstSize() {
901   - return pstBuffer.size();
902   - }
903   -
904   - public boolean addExecPlan(ScheduleRealInfo sch) {
905   - ScheduleRealInfo oldExec = executeCurr(sch.getClZbh());
906   - if (sch != null){
907   - if(sch.getStatus()==2)
908   - reCalcExecPlan(sch.getClZbh());
909   - else
910   - carExecutePlanMap.put(sch.getClZbh(), sch);
911   - }
912   - else
913   - carExecutePlanMap.remove(sch.getClZbh());
914   -
915   - return executeCurr(sch.getClZbh()) != oldExec;
916   - }
917   -
918   - public void removeExecPlan(String clzbh) {
919   - carExecutePlanMap.remove(clzbh);
920   - }
921   -
922   - public Map<String, ScheduleRealInfo> execPlanMap() {
923   - return carExecutePlanMap;
924   - }
925   -
926   - /**
927   - * 车辆当前执行的班次
928   - *
929   - * @param nbbm
930   - * @return
931   - */
932   - public ScheduleRealInfo executeCurr(String nbbm) {
933   - if(StringUtils.isEmpty(nbbm))
934   - return null;
935   - return carExecutePlanMap.get(nbbm);
936   - }
937   -
938   - /**
939   - * @param @param sch
940   - * @param @param newClZbh 新的车辆自编号
941   - * @Title: changeCar
942   - * @Description: TODO(班次换车) 返回有更新的班次
943   - */
944   - public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch, String newClZbh) {
945   - List<ScheduleRealInfo> ups = new ArrayList<>();
946   -
947   - String oldClZbh = sch.getClZbh();
948   - //变更相关映射信息
949   - nbbmScheduleMap.remove(sch.getClZbh(), sch);
950   -
951   - sch.setClZbh(newClZbh);
952   - if (!nbbmScheduleMap.containsEntry(newClZbh, sch)) {
953   - nbbmScheduleMap.put(newClZbh, sch);
954   - }
955   -
956   - //重新计算车辆当前执行班次
957   - reCalcExecPlan(newClZbh);
958   - reCalcExecPlan(oldClZbh);
959   - //重新分组计划用车
960   - reCalcLineNbbms();
961   - return ups;
962   - }
963   -
964   - public void removeNbbm2SchMapp(ScheduleRealInfo sch) {
965   - nbbmScheduleMap.remove(sch.getClZbh(), sch);
966   - }
967   -
968   - public void addNbbm2SchMapp(ScheduleRealInfo sch) {
969   - nbbmScheduleMap.put(sch.getClZbh(), sch);
970   - }
971   -
972   - public void reCalcExecPlan(String nbbm) {
973   - List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm);
974   - Collections.sort(list, schDFSJComparator);
975   -
976   - ScheduleRealInfo sch = schAttrCalculator.calcCurrentExecSch(list);
977   - if(null != sch)
978   - carExecutePlanMap.put(nbbm, sch);
979   - else
980   - carExecutePlanMap.remove(nbbm);
981   - }
982   -
983   - /**
984   - * 空驶任务?
985   - * 出场、进场、直放、两点间空驶
986   - * @param sch
987   - * @return
988   - */
989   - public static boolean emptyService(ScheduleRealInfo sch){
990   - String type = sch.getBcType();
991   - return type.equals("out") || type.equals("in") || type.equals("venting") || type.equals("ldks");
992   - }
993   -
994   - @Autowired
995   - JdbcTemplate jdbcTemplate;
996   -
997   - /**
998   - * 删除实际排班
999   - *
1000   - * @param lineCode
1001   - * @return
1002   - */
1003   - public Map<String, Object> deleteRealSchedule(String lineCode) {
1004   - Map<String, Object> rs = new HashMap<>();
1005   -
1006   - try {
1007   - String rq = currSchDateMap.get(lineCode);
1008   - if (StringUtils.isNotEmpty(rq)) {
1009   - List<ScheduleRealInfo> all = findByLineCode(lineCode);
1010   -
1011   - if(null != all && all.size() > 0){
1012   - //解除gps 和班次之间的关联
1013   - List<ScheduleRealInfo> unions = calcUnion(all, carExecutePlanMap.values());
1014   - for (ScheduleRealInfo sch : unions) {
1015   - removeExecPlan(sch.getClZbh());
1016   - }
1017   - //解除调度指令和班次的外键约束
1018   - StringBuilder inStr = new StringBuilder("(");
1019   - for (ScheduleRealInfo sch : all) {
1020   - inStr.append(sch.getId() + ",");
1021   - }
1022   - inStr.deleteCharAt(inStr.length() - 1).append(")");
1023   - jdbcTemplate.update(Constants.MULTI_REMOVE_DIRECTIVE_SCH_FK + " " + inStr.toString());
1024   - }
1025   -
1026   - //删除班次数据
1027   - removeRealSch(lineCode, rq);
1028   -
1029   - }
1030   - rs.put("status", ResponseCode.SUCCESS);
1031   - } catch (Exception e) {
1032   - logger.error("", e);
1033   - rs.put("status", ResponseCode.ERROR);
1034   - if (e instanceof DataIntegrityViolationException)
1035   - rs.put("msg", "失败,违反数据约束!!");
1036   - else
1037   - rs.put("msg", e.getMessage());
1038   - }
1039   -
1040   - return rs;
1041   - }
1042   -
1043   - /**
1044   - * 计算并集
1045   - *
1046   - * @param all
1047   - * @param sub
1048   - * @return
1049   - */
1050   - public List<ScheduleRealInfo> calcUnion(Collection<ScheduleRealInfo> c1, Collection<ScheduleRealInfo> c2) {
1051   - List<ScheduleRealInfo> rs = new ArrayList<>();
1052   -
1053   - for (ScheduleRealInfo sch : c1) {
1054   - if (c2.contains(sch)) {
1055   - rs.add(sch);
1056   - }
1057   - }
1058   - return rs;
1059   - }
1060   -
1061   - /**
1062   - * 覆盖一辆车的所有班次
1063   - *
1064   - * @param nbbm
1065   - * @param sets
1066   - */
1067   - public void replaceByNbbm(String nbbm, Collection<ScheduleRealInfo> sets) {
1068   - nbbmScheduleMap.removeAll(nbbm);
1069   - nbbmScheduleMap.putAll(nbbm, sets);
1070   - }
1071   -
1072   - /**
1073   - * 获取该班次所在路牌的下一个班次
1074   - *
1075   - * @param sch
1076   - * @return
1077   - */
1078   - public ScheduleRealInfo nextByLp(ScheduleRealInfo sch) {
1079   - List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName());
1080   - Collections.sort(list, schFCSJComparator);
1081   - return next3_lp(list, sch);
1082   - }
1083   -
1084   - /**
1085   - * 获取该班次所在路牌的下一个班次,不考虑场既是站
1086   - *
1087   - * @param sch
1088   - * @return
1089   - */
1090   - public ScheduleRealInfo nextByLp2(ScheduleRealInfo sch) {
1091   - List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName());
1092   - Collections.sort(list, schFCSJComparator);
1093   - return next2_lp(list, sch);
1094   - }
1095   -
1096   - public ArrayListMultimap<String, ScheduleRealInfo> getLpScheduleMap() {
1097   - return lpScheduleMap;
1098   - }
1099   -
1100   - /**
1101   - * 重新全量计算路牌下的班次关联性
1102   - * 临时性的函数
1103   - */
1104   - public void _test_reCalcLpSch() {
1105   - Map<String ,Collection<ScheduleRealInfo>> map = lpScheduleMap.asMap();
1106   - Set<String> ks = map.keySet();
1107   - for(String k : ks){
1108   - schAttrCalculator.calcQdzTimePlan(new ArrayList<ScheduleRealInfo>(map.get(k)));
1109   - }
1110   - }
1111   -
1112   - public int dbCount(String lineCode, String currSchDate) {
1113   - int count = -1;
1114   -
1115   - try{
1116   - count = jdbcTemplate.queryForObject("select count(*) from bsth_c_s_sp_info_real where schedule_date='"+currSchDate+"' and xl_bm='"+lineCode+"'", java.lang.Integer.class);
1117   -
1118   - }catch (Exception e){
1119   - logger.error("", e);
1120   - }
1121   - return count;
1122   - }
1123   -
1124   - /**
1125   - * 重新计算ID对照map
1126   - */
1127   - public int reCalcIdMaps(){
1128   - Collection<ScheduleRealInfo> all = findAll();
1129   - ConcurrentMap<Long, ScheduleRealInfo> id2SchedulMapCopy = new ConcurrentHashMap<>();
1130   -
1131   - for(ScheduleRealInfo sch : all){
1132   - id2SchedulMapCopy.put(sch.getId(), sch);
1133   - }
1134   -
1135   - id2SchedulMap = id2SchedulMapCopy;
1136   -
1137   - return id2SchedulMap.size();
1138   - }
1139   -
1140   - /**
1141   - * 重新计算线路计划用车
1142   - */
1143   - public void reCalcLineNbbms(){
1144   - HashMultimap<String, String> multimap = HashMultimap.create();
1145   -
1146   - Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
1147   - for (ScheduleRealInfo sch : schs) {
1148   - multimap.put(sch.getXlBm(), sch.getClZbh());
1149   - }
1150   -
1151   - lineNbbmsMap = multimap;
1152   - }
1153   -
1154   - public String sizeString(){
1155   - return id2SchedulMap.size() + "/" + nbbmScheduleMap.size();
1156   - }
1157   -
1158   -
1159   - /**
1160   - * 按公司编码分组数据
1161   - */
1162   - public void groupByGsbm(){
1163   - Collection<ScheduleRealInfo> all = findAll();
1164   - ListMultimap<String, ScheduleRealInfo> gsBmMaps = ArrayListMultimap.create();
1165   -
1166   - for(ScheduleRealInfo sch : all){
1167   - gsBmMaps.put(sch.getGsBm(), sch);
1168   - }
1169   -
1170   - if(gsBmMaps.size() > 0){
1171   - gsBmScheduleMap = null;
1172   - gsBmScheduleMap = gsBmMaps;
1173   - }
1174   - }
1175   -
1176   - public Collection<ScheduleRealInfo> findByGsbm(String gsbm){
1177   - return gsBmScheduleMap.get(gsbm);
1178   - }
1179   -=======
1180 1 package com.bsth.data.schedule;
1181 2  
1182 3 import com.alibaba.fastjson.JSON;
... ... @@ -1263,7 +84,7 @@ public class DayOfSchedule {
1263 84 private static ScheduleComparator.DFSJ schDFSJComparator;
1264 85  
1265 86 private static Long sch_max_id=-1L;
1266   -
  87 +
1267 88 private Map<String, RepairReport> incode2report = new ConcurrentHashMap<String, RepairReport>();
1268 89  
1269 90 @Autowired
... ... @@ -2013,8 +834,8 @@ public class DayOfSchedule {
2013 834 ScheduleRealInfo sch = null;
2014 835 for (ScheduleRealInfo temp : list) {
2015 836 if (temp.getFcsjActual() == null) {
2016   - sch = temp;
2017   - break;
  837 + sch = temp;
  838 + break;
2018 839 }
2019 840 }
2020 841  
... ... @@ -2364,20 +1185,19 @@ public class DayOfSchedule {
2364 1185 reCalcExecPlan(sch.getClZbh());
2365 1186 }
2366 1187 }
2367   -
  1188 +
2368 1189 /**
2369 1190 ** 用于重置维修上报计数,一般只应该在翻班的时候调用
2370 1191 */
2371 1192 public void resetRepairReport(String incode) {
2372   - incode2report.remove(incode);
  1193 + incode2report.remove(incode);
2373 1194 }
2374   -
  1195 +
2375 1196 public RepairReport getLastestRepairReport(String incode) {
2376   - return incode2report.get(incode);
  1197 + return incode2report.get(incode);
2377 1198 }
2378   -
  1199 +
2379 1200 public void setLastestRepairReport(RepairReport rr) {
2380   - incode2report.put(rr.getIncode(), rr);
  1201 + incode2report.put(rr.getIncode(), rr);
2381 1202 }
2382   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
2383   -}
2384 1203 \ No newline at end of file
  1204 +}
... ...
src/main/java/com/bsth/entity/Cars.java
... ... @@ -9,28 +9,28 @@ import java.io.Serializable;
9 9 import java.util.Date;
10 10  
11 11 /**
12   - *
  12 + *
13 13 * @ClassName : Cars(车实体类)
14   - *
  14 + *
15 15 * @Author : bsth@lq
16   - *
  16 + *
17 17 * @Description : TODO(车辆基本信息)
18   - *
  18 + *
19 19 * @Data : 2016-04-27
20 20 *
21 21 * @Version 公交调度系统BS版 0.1
22   - *
  22 + *
23 23 */
24 24  
25 25 @Entity
26 26 @Table(name = "bsth_c_cars")
27 27 @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
28 28 public class Cars extends BEntity implements Serializable {
29   -
30   - /** 主键Id */
31   - @Id
32   - @GeneratedValue(strategy = GenerationType.IDENTITY)
33   - private Integer id;
  29 +
  30 + /** 主键Id */
  31 + @Id
  32 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  33 + private Integer id;
34 34  
35 35 /** 自编号/内部编号 */
36 36 @Column(nullable = false, length = 20, unique = true)
... ... @@ -54,26 +54,26 @@ public class Cars extends BEntity implements Serializable {
54 54  
55 55 /** 车辆编码(TODO:在原系统里没有,这里暂时留着) */
56 56 @Column(nullable = false)
57   - private String carCode;
  57 + private String carCode;
58 58 /** 车牌号 */
59 59 @Column(nullable = false)
60   - private String carPlate;
  60 + private String carPlate;
61 61 /** 供应商名称 */
62 62 @Column(nullable = false)
63 63 private String supplierName;
64 64 /** 设备终端号 */
65 65 @Column(nullable = false)
66 66 private String equipmentCode;
67   -
  67 +
68 68 // 以下信息来自总公司的业务系统,可能需要调用相关接口
69   - /** 车型类别 */
70   - private String carClass ;
  69 + /** 车型类别 */
  70 + private String carClass ;
71 71 /** 技术速度 */
72 72 private Double speed;
73 73 /** 座位数 */
74   - private Integer carSeatnNumber;
75   - /** 载客标准 */
76   - private String carStandard;
  74 + private Integer carSeatnNumber;
  75 + /** 载客标准 */
  76 + private String carStandard;
77 77 /** 标准油耗(开空调) */
78 78 private Double kburnStandard;
79 79 /** 标准油耗(关空调) */
... ... @@ -103,21 +103,21 @@ public class Cars extends BEntity implements Serializable {
103 103 /** 取消日期 */
104 104 private Date closeDate;
105 105  
106   - /** 是否空调车 */
  106 + /** 是否空调车 */
107 107 @Column(nullable = true)
108 108 private Boolean hvacCar;
109   - /** 有无人售票 */
  109 + /** 有无人售票 */
110 110 @Column(nullable = true)
111   - private Boolean ticketType;
  111 + private Boolean ticketType;
112 112 /** 是否有LED服务屏 */
113 113 @Column(nullable = true)
114 114 private Boolean ledScreen;
115   - /** 是否有TV视频 */
  115 + /** 是否有TV视频 */
116 116 @Column(nullable = true)
117   - private Boolean tvVideoType;
  117 + private Boolean tvVideoType;
118 118  
119   - /** 车辆类型 */
120   - private String carType;
  119 + /** 车辆类型 */
  120 + private String carType;
121 121 /** 是否机动车(机动车类型选择)*/
122 122 private String vehicleStats;
123 123 /** 营运状态 */
... ... @@ -128,23 +128,20 @@ public class Cars extends BEntity implements Serializable {
128 128 private Boolean sfdc;
129 129 /** 是否混合动力(TODO:在原系统里没有,这里暂时留着) */
130 130 private Boolean sfmix;
131   -<<<<<<< HEAD
132   -=======
133 131 /** 是否氢能源车 */
134 132 private Boolean hydrogen;
135   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
136 133 /** 备注/描述 */
137 134 private String descriptions;
138 135  
139   - /** 车辆序号(TODO:在原系统里没有,这里暂时留着) */
140   - private String carOrdinal;
141   - /** 视频编号 */
142   - private String videoCode;
143   - /** 是否报废 */
  136 + /** 车辆序号(TODO:在原系统里没有,这里暂时留着) */
  137 + private String carOrdinal;
  138 + /** 视频编号 */
  139 + private String videoCode;
  140 + /** 是否报废 */
144 141 @Column(nullable = true)
145   - private Boolean scrapState;
146   - /** 是否切换(TODO:在原系统里没有,这里暂时留着)*/
147   - private Integer isSwitch;
  142 + private Boolean scrapState;
  143 + /** 是否切换(TODO:在原系统里没有,这里暂时留着)*/
  144 + private Integer isSwitch;
148 145 /** 线路名称(TODO:在原系统里没有,这里暂时留着,并且不做线路关联,只保留个名字) */
149 146 private String xlmc;
150 147  
... ... @@ -167,16 +164,16 @@ public class Cars extends BEntity implements Serializable {
167 164 this.equipmentCode = sbbh.toString();
168 165 }
169 166 }
170   -
  167 +
171 168 public String getServiceNo() {
172   - return serviceNo;
173   - }
  169 + return serviceNo;
  170 + }
174 171  
175   - public void setServiceNo(String serviceNo) {
176   - this.serviceNo = serviceNo;
177   - }
  172 + public void setServiceNo(String serviceNo) {
  173 + this.serviceNo = serviceNo;
  174 + }
178 175  
179   - public Integer getId() {
  176 + public Integer getId() {
180 177 return id;
181 178 }
182 179  
... ... @@ -527,15 +524,12 @@ public class Cars extends BEntity implements Serializable {
527 524 public void setSfmix(Boolean sfmix) {
528 525 this.sfmix = sfmix;
529 526 }
530   -<<<<<<< HEAD
531   -=======
532 527  
533   - public Boolean getHydrogen() {
534   - return hydrogen;
535   - }
  528 + public Boolean getHydrogen() {
  529 + return hydrogen;
  530 + }
536 531  
537   - public void setHydrogen(Boolean hydrogen) {
538   - this.hydrogen = hydrogen;
539   - }
540   ->>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
  532 + public void setHydrogen(Boolean hydrogen) {
  533 + this.hydrogen = hydrogen;
  534 + }
541 535 }
... ...