Commit 278c7ef62cf3f24a8adc96130c6187cea34223d5

Authored by 王通
2 parents e7c4fc40 8be72ebe

Merge branch 'pudong' into jiading

# Conflicts:
#	src/main/java/com/bsth/XDApplication.java
#	src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
#	src/main/java/com/bsth/entity/Cars.java
#	src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
#	src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
#	src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
#	src/main/resources/application-prod.properties
#	src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
#	src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
Showing 54 changed files with 3002 additions and 531 deletions

Too many changes to show.

To preserve performance only 54 of 545 files are displayed.

README.md
... ... @@ -447,9 +447,5 @@
447 447 | direction | float | 角度0-359 |
448 448 | inTemp | int | 车内温度 |
449 449 | serviceState | long | 设备状态字 |
450   -<<<<<<< HEAD
451   -| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
452   -=======
453 450 | daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
454 451  
455   ->>>>>>> af8ec3bedc8644f5813e9adab12a163e93cc7f50
... ...
... ... @@ -295,6 +295,13 @@
295 295 <artifactId>jpinyin</artifactId>
296 296 <version>1.1.8</version>
297 297 </dependency>
  298 +
  299 + <!-- plan common工程依赖 -->
  300 + <dependency>
  301 + <groupId>com.bsth.control_v2</groupId>
  302 + <artifactId>plan_module-common</artifactId>
  303 + <version>1.0-SNAPSHOT</version>
  304 + </dependency>
298 305 </dependencies>
299 306  
300 307 <dependencyManagement>
... ...
src/main/java/com/bsth/WebAppConfiguration.java
... ... @@ -76,17 +76,4 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS
76 76 registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol","/freeLogin/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor())
77 77 .withSockJS();
78 78 }
79   -
80   - /**
81   - * 增加websocket的输出缓冲区
82   - * @return
83   - */
84   - @Bean
85   - public ServletServerContainerFactoryBean createServletServerContainerFactoryBean() {
86   - ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
87   - container.setMaxTextMessageBufferSize(52768);
88   - container.setMaxBinaryMessageBufferSize(52768);
89   - logger.info("Websocket factory returned");
90   - return container;
91   - }
92 79 }
... ...
src/main/java/com/bsth/XDApplication.java
... ... @@ -14,6 +14,7 @@ import com.bsth.data.msg_queue.WebSocketPushQueue;
14 14 import com.bsth.data.safe_driv.SafeDrivDataLoadThread;
15 15 import com.bsth.data.schedule.DayOfSchedule;
16 16 import com.bsth.data.schedule.auto_exec.AutoExecScanThread;
  17 +import com.bsth.data.schedule.e_state_check.thread.FixedCheckStationCodeThread;
17 18 import com.bsth.data.schedule.edit_logs.SeiPstThread;
18 19 import com.bsth.data.schedule.late_adjust.ScheduleLateThread;
19 20 import com.bsth.data.schedule.signal.SchSiginUpdateDBThread;
... ... @@ -83,6 +84,9 @@ public class XDApplication implements CommandLineRunner {
83 84 @Autowired
84 85 SafeDrivDataLoadThread safeDrivDataLoadThread;
85 86  
  87 + @Autowired
  88 + FixedCheckStationCodeThread fixedCheckStationCodeThread;
  89 +
86 90 private static long timeDiff;
87 91 private static long timeDiffTraffic;
88 92  
... ... @@ -129,8 +133,11 @@ public class XDApplication implements CommandLineRunner {
129 133 //sexec.scheduleWithFixedDelay(gpsDataLoader, 60, 4, TimeUnit.SECONDS);
130 134 //实际排班更新线程
131 135 //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
  136 + //sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点
132 137 //sexec.scheduleWithFixedDelay(autoExecScanThread, 100, 50, TimeUnit.SECONDS);//班次自动执行
133 138 //WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
  139 +
  140 + //sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 50, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码
134 141 //实际排班延迟入库线程
135 142 //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS);
136 143 //班次修正日志延迟入库
... ... @@ -154,9 +161,10 @@ public class XDApplication implements CommandLineRunner {
154 161  
155 162 /** 线调业务 */
156 163 sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程
157   - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点
158   - gpsDataLoader.setFlag(-1);
159   - sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 3, TimeUnit.SECONDS);//抓取GPS数据
  164 + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点
  165 + gpsDataLoader.setFlag(-1);
  166 + sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据
  167 + sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码
160 168  
161 169 sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线
162 170 sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程
... ... @@ -164,7 +172,7 @@ public class XDApplication implements CommandLineRunner {
164 172 sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库
165 173 sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
166 174 sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据
167   - sexec.scheduleWithFixedDelay(basicDataLoader, 2, 2, TimeUnit.HOURS);//基础数据更新
  175 + sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新
168 176 sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行
169 177 DirectivePushQueue.start();//消息队列 -指令,系统下发的
170 178 WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
... ...
src/main/java/com/bsth/controller/LineVersionsController.java
1 1 package com.bsth.controller;
2 2  
3   -import java.util.List;
4   -import java.util.Map;
5   -
  3 +import com.bsth.entity.LineVersions;
  4 +import com.bsth.repository.LineRepository;
  5 +import com.bsth.service.LineVersionsService;
6 6 import org.springframework.beans.factory.annotation.Autowired;
7 7 import org.springframework.web.bind.annotation.RequestMapping;
8 8 import org.springframework.web.bind.annotation.RequestMethod;
9 9 import org.springframework.web.bind.annotation.RequestParam;
10 10 import org.springframework.web.bind.annotation.RestController;
11 11  
12   -import com.bsth.entity.LineVersions;
13   -import com.bsth.repository.LineRepository;
14   -import com.bsth.service.LineVersionsService;
  12 +import java.util.List;
  13 +import java.util.Map;
15 14  
16 15 /**
17 16 *
... ... @@ -75,7 +74,11 @@ public class LineVersionsController extends BaseController&lt;LineVersions, Integer
75 74 public Map<String, Object> add(@RequestParam Map<String, Object> map) {
76 75 return service.add(map);
77 76 }
78   -
  77 + @RequestMapping(value = "delete", method = RequestMethod.POST)
  78 + public Map<String, Object> delete(@RequestParam (defaultValue = "id") int id) {
  79 + return service.delete(id);
  80 + }
  81 +
79 82 /**
80 83 * 根据线路id获取当前版本号
81 84 *
... ...
src/main/java/com/bsth/controller/SectionController.java
... ... @@ -142,7 +142,7 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; {
142 142 *
143 143 * @return int <sectionCode路段编码>
144 144 */
145   - @RequestMapping(value="doubleName" , method = RequestMethod.GET)
  145 + @RequestMapping(value="doubleName" , method = RequestMethod.POST)
146 146 public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) {
147 147 return service.doubleName(map);
148 148 }
... ...
src/main/java/com/bsth/controller/StationController.java
1 1 package com.bsth.controller;
2 2  
3   -import java.util.Map;
4   -
  3 +import com.bsth.entity.Station;
  4 +import com.bsth.service.StationService;
  5 +import com.bsth.util.GetUIDAndCode;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
5 8 import org.springframework.beans.factory.annotation.Autowired;
6 9 import org.springframework.web.bind.annotation.RequestMapping;
7 10 import org.springframework.web.bind.annotation.RequestMethod;
8 11 import org.springframework.web.bind.annotation.RequestParam;
9 12 import org.springframework.web.bind.annotation.RestController;
10 13  
11   -import com.bsth.entity.Station;
12   -import com.bsth.service.StationService;
13   -import com.bsth.util.GetUIDAndCode;
  14 +import java.util.Map;
14 15  
15 16 /**
16 17 *
... ... @@ -34,6 +35,9 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
34 35  
35 36 @Autowired
36 37 private StationService service;
  38 +
  39 + /** 日志记录器 */
  40 + private static final Logger LOGGER = LoggerFactory.getLogger(StationController.class);
37 41  
38 42 /**
39 43 * @Description :TODO(根据坐标点匹配数据库中的站点)
... ... @@ -153,10 +157,13 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
153 157 */
154 158 @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET)
155 159 public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) {
  160 + System.out.println(stationCount+" _ "+ sectionCount );
156 161 for(int i = 0; i < stationCount; i++) {
  162 + System.out.println(i);
157 163 GetUIDAndCode.getStationId();
158 164 }
159   - for(int i = 0; i < sectionCount; i++) {
  165 + for(int j = 0; j < sectionCount; j++) {
  166 + System.out.println(j);
160 167 GetUIDAndCode.getSectionId();
161 168 }
162 169 return 1;
... ...
src/main/java/com/bsth/controller/StationRouteController.java
1 1 package com.bsth.controller;
2 2  
3   -import com.bsth.entity.Station;
4 3 import com.bsth.entity.StationRoute;
5 4 import com.bsth.entity.StationRouteCache;
6 5 import com.bsth.repository.StationRouteCacheRepository;
... ... @@ -12,11 +11,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
12 11 import org.springframework.web.bind.annotation.RequestParam;
13 12 import org.springframework.web.bind.annotation.RestController;
14 13  
  14 +import javax.servlet.http.HttpServletResponse;
15 15 import java.util.List;
16 16 import java.util.Map;
17 17  
18   -import javax.servlet.http.HttpServletResponse;
19   -
20 18 /**
21 19 *
22 20 * @ClassName: StationRouteController(站点路由控制器)
... ... @@ -72,11 +70,11 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
72 70 }
73 71  
74 72 /**
75   - * @param String
  73 + * @param map
76 74 * @throws
77 75 * @Description: TODO(批量撤销站点)
78 76 */
79   - @RequestMapping(value = "/batchDestroy", method = RequestMethod.GET)
  77 + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST)
80 78 public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) {
81 79 return service.updateStationRouteInfoFormId(map);
82 80 }
... ...
src/main/java/com/bsth/controller/calc/CalcExportController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.HashMap;
  6 +import java.util.Iterator;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +import com.bsth.common.ResponseCode;
  17 +import com.bsth.entity.calc.CalcWaybill;
  18 +import com.bsth.entity.mcy_forms.Waybillday;
  19 +import com.bsth.service.calc.CalcLbStatuAnalyService;
  20 +import com.bsth.service.calc.CalcMixService;
  21 +import com.bsth.service.calc.CalcWaybillService;
  22 +import com.bsth.util.ReportUtils;
  23 +
  24 +@RestController
  25 +@RequestMapping("calc_export")
  26 +public class CalcExportController {
  27 +
  28 + @Autowired
  29 + CalcWaybillService service;
  30 +
  31 + @Autowired
  32 + CalcLbStatuAnalyService lbService;
  33 +
  34 + @Autowired
  35 + CalcMixService clacMixService;
  36 +
  37 + @RequestMapping(value = "/waybilldayExport", method = RequestMethod.GET)
  38 + public Map<String, Object> calcjsyspyExport(@RequestParam Map<String, Object> map) {
  39 +
  40 + String line="";
  41 + if(map.get("line")!=null){
  42 + line=map.get("line").toString().trim();
  43 + }
  44 + String lineName="";
  45 + if(map.get("lineName")!=null){
  46 + lineName=map.get("lineName").toString().trim();
  47 + }
  48 + String startDate="";
  49 + if(map.get("startDate")!=null){
  50 + startDate=map.get("startDate").toString().trim();
  51 + }
  52 + String endDate="";
  53 + if(map.get("endDate")!=null){
  54 + endDate=map.get("endDate").toString().trim();
  55 + }
  56 + String cont="";
  57 + if(map.get("cont")!=null){
  58 + cont=map.get("cont").toString().trim();
  59 + }
  60 + String empnames="";
  61 + if(map.get("empnames")!=null){
  62 + empnames=map.get("empnames").toString().trim();
  63 + }
  64 + String gsdmManth="";
  65 + if(map.get("gsdmManth")!=null){
  66 + gsdmManth=map.get("gsdmManth").toString().trim();
  67 + }
  68 + String fgsdmManth="";
  69 + if(map.get("fgsdmManth")!=null){
  70 + fgsdmManth=map.get("fgsdmManth").toString().trim();
  71 + }
  72 +
  73 + Map<String, Object> resMap = new HashMap<String, Object>();
  74 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  75 + List<Map<String, Object>> list = clacMixService.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth);
  76 +
  77 + Map<String, Object> temp = new HashMap<String, Object>();
  78 + temp.put("i", "序号");
  79 + temp.put("jName", empnames);
  80 + temp.put("jhyybc", "计划营运班次");
  81 + temp.put("jhfyybc", "计划空驶班次");
  82 + temp.put("sjyybc", "实际营运班次");
  83 + temp.put("sjfyybc", "实际空驶班次");
  84 + temp.put("lbbc", "烂班班次");
  85 + temp.put("ljbc", "临加班次");
  86 + temp.put("jhzlc", "计划总里程");
  87 + temp.put("jhyylc", "计划营运里程");
  88 + temp.put("jhfyylc", "计划空驶里程");
  89 + temp.put("sjzlc", "实际总里程");
  90 + temp.put("sjyylc", "实际营运里程");
  91 + temp.put("sjfyylc", "实际空驶里程");
  92 + temp.put("lblc", "烂班里程");
  93 + temp.put("ljyylc", "临加营运里程");
  94 + temp.put("ljfyylc", "临加空驶里程");
  95 + resList.add(temp);
  96 + for(int i = 0; i < list.size(); i++){
  97 + temp = list.get(i);
  98 + temp.put("i", i+1);
  99 + resList.add(temp);
  100 + }
  101 +
  102 + String date = startDate.replaceAll("-", "");
  103 + if(!startDate.equals(endDate)){
  104 + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", "");
  105 + }
  106 +
  107 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  108 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  109 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  110 + Map<String,Object> mm = new HashMap<String, Object>();
  111 + ReportUtils ee = new ReportUtils();
  112 +
  113 + try {
  114 + listI.add(resList.iterator());
  115 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  116 + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcjsyspy.xls",
  117 + path+"export/"+date+"-"+lineName+"-人车班次公里统计.xls");
  118 + resMap.put("status", ResponseCode.SUCCESS);
  119 + } catch (Exception e) {
  120 + e.printStackTrace();
  121 + resMap.put("status", ResponseCode.ERROR);
  122 + }
  123 + return resMap;
  124 + }
  125 +
  126 + @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET)
  127 + public Map<String, Object> singledataExportTj(@RequestParam Map<String, Object> map) {
  128 +
  129 + String line="";
  130 + if(map.get("line")!=null){
  131 + line=map.get("line").toString().trim();
  132 + }
  133 + String lineName="";
  134 + if(map.get("lineName")!=null){
  135 + lineName=map.get("lineName").toString().trim();
  136 + }
  137 + String startDate="";
  138 + if(map.get("startDate")!=null){
  139 + startDate=map.get("startDate").toString().trim();
  140 + }
  141 + String endDate="";
  142 + if(map.get("endDate")!=null){
  143 + endDate=map.get("endDate").toString().trim();
  144 + }
  145 + String tjtype="";
  146 + if(map.get("tjtype")!=null){
  147 + tjtype=map.get("tjtype").toString().trim();
  148 + }
  149 + String cont="";
  150 + if(map.get("cont")!=null){
  151 + cont=map.get("cont").toString().trim();
  152 + }
  153 + String gsdmSing="";
  154 + if(map.get("gsdmSing")!=null){
  155 + gsdmSing=map.get("gsdmSing").toString().trim();
  156 + }
  157 + String fgsdmSing="";
  158 + if(map.get("fgsdmSing")!=null){
  159 + fgsdmSing=map.get("fgsdmSing").toString().trim();
  160 + }
  161 +
  162 + Map<String, Object> resMap = new HashMap<String, Object>();
  163 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  164 + List<Map<String, Object>> list = clacMixService.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing);
  165 +
  166 + Map<String, Object> temp = new HashMap<String, Object>();
  167 + temp.put("i", "序号");
  168 + temp.put("gS", "所属公司");
  169 + temp.put("xlName", "线路");
  170 + temp.put("jName", tjtype);
  171 + temp.put("jhzlc", "计划公里");
  172 + temp.put("sjzlc", "行驶里程(包括空放)");
  173 + temp.put("sjfyylc", "空驶里程");
  174 + temp.put("hyl", "耗油量");
  175 + temp.put("jzl", "加注量");
  176 + temp.put("sh", "非营业用油");
  177 +
  178 + resList.add(temp);
  179 + for(int i = 0; i < list.size(); i++){
  180 + temp = list.get(i);
  181 + temp.put("i", i+1);
  182 + if(temp.get("xlName") == null){
  183 + temp.put("xlName", "");
  184 + }
  185 + resList.add(temp);
  186 + }
  187 +
  188 + String date = startDate.replaceAll("-", "");
  189 + if(!startDate.equals(endDate)){
  190 + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", "");
  191 + }
  192 +
  193 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  194 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  195 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  196 + Map<String,Object> mm = new HashMap<String, Object>();
  197 + ReportUtils ee = new ReportUtils();
  198 +
  199 + try {
  200 + listI.add(resList.iterator());
  201 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  202 + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcsingledata.xls",
  203 + path+"export/"+date+"-"+lineName+"-路单数据(统计).xls");
  204 + resMap.put("status", ResponseCode.SUCCESS);
  205 + } catch (Exception e) {
  206 + e.printStackTrace();
  207 + resMap.put("status", ResponseCode.ERROR);
  208 + }
  209 + return resMap;
  210 + }
  211 +
  212 + @RequestMapping(value = "/lbStatuAnalyExport", method = RequestMethod.GET)
  213 + public Map<String, Object> lbStatuAnalyExport(@RequestParam Map<String, Object> map) {
  214 +
  215 + String gsdm="";
  216 + if(map.get("company")!=null){
  217 + gsdm=map.get("company").toString().trim();
  218 + }
  219 + String fgsdm="";
  220 + if(map.get("subCompany")!=null){
  221 + fgsdm=map.get("subCompany").toString().trim();
  222 + }
  223 + String line="";
  224 + if(map.get("line")!=null){
  225 + line=map.get("line").toString().trim();
  226 + }
  227 + String lineName="";
  228 + if(map.get("lineName")!=null){
  229 + lineName=map.get("lineName").toString().trim();
  230 + }
  231 + String date="";
  232 + if(map.get("startDate")!=null){
  233 + date=map.get("startDate").toString().trim();
  234 + }
  235 + String date2="";
  236 + if(map.get("endDate")!=null){
  237 + date2=map.get("endDate").toString().trim();
  238 + }
  239 + String sfyy="";
  240 + if(map.get("sfyy")!=null){
  241 + sfyy=map.get("sfyy").toString().trim();
  242 + }
  243 + String type="";
  244 + if(map.get("type")!=null){
  245 + type=map.get("type").toString().trim();
  246 + }
  247 +
  248 + Map<String, Object> resMap = new HashMap<String, Object>();
  249 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  250 + List<Map<String, Object>> list = lbService.lbStatuAnaly(gsdm, fgsdm, line, date, date2, sfyy, type);
  251 +
  252 + for(int i = 0; i < list.size(); i++){
  253 + Map<String, Object> temp = list.get(i);
  254 + temp.put("i", i+1);
  255 + if(!temp.containsKey("date") || temp.get("date") == null){
  256 + temp.put("date", "");
  257 + }
  258 + if(!temp.containsKey("company") || temp.get("company") == null){
  259 + temp.put("company", "");
  260 + }
  261 + if(!temp.containsKey("subCompany") || temp.get("subCompany") == null){
  262 + temp.put("subCompany", "");
  263 + }
  264 + resList.add(temp);
  265 + }
  266 +
  267 + String Data = date.replaceAll("-", "");
  268 + if(!date.equals(date2)){
  269 + Data = date.replaceAll("-", "") + "-" + date2.replaceAll("-", "");
  270 + }
  271 +
  272 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  273 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  274 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  275 + Map<String,Object> mm = new HashMap<String, Object>();
  276 + ReportUtils ee = new ReportUtils();
  277 +
  278 + try {
  279 + listI.add(resList.iterator());
  280 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  281 + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcLbStatuAnaly.xls",
  282 + path+"export/"+Data+"-"+lineName+"-烂班情况分析表(统计).xls");
  283 + resMap.put("status", ResponseCode.SUCCESS);
  284 + } catch (Exception e) {
  285 + e.printStackTrace();
  286 + resMap.put("status", ResponseCode.ERROR);
  287 + }
  288 + return resMap;
  289 + }
  290 +
  291 +}
... ...
src/main/java/com/bsth/controller/calc/CalcLbStatuAnalyController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.controller.BaseController;
  7 +import com.bsth.entity.calc.CalcLbStatuAnaly;
  8 +import com.bsth.service.calc.CalcLbStatuAnalyService;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +/**
  15 + * Created by 19/03/18.
  16 + */
  17 +@RestController
  18 +@RequestMapping("calcLbStatuAnaly")
  19 +public class CalcLbStatuAnalyController extends BaseController<CalcLbStatuAnaly, Integer> {
  20 +
  21 + @Autowired
  22 + private CalcLbStatuAnalyService service;
  23 +
  24 +
  25 + @RequestMapping(value="/lbStatuAnaly")
  26 + public List<Map<String,Object>> lbStatuAnaly(@RequestParam Map<String, Object> map){
  27 + String gsdm="";
  28 + if(map.get("company")!=null){
  29 + gsdm=map.get("company").toString().trim();
  30 + }
  31 + String fgsdm="";
  32 + if(map.get("subCompany")!=null){
  33 + fgsdm=map.get("subCompany").toString().trim();
  34 + }
  35 + String line="";
  36 + if(map.get("line")!=null){
  37 + line=map.get("line").toString().trim();
  38 + }
  39 + String date="";
  40 + if(map.get("startDate")!=null){
  41 + date=map.get("startDate").toString().trim();
  42 + }
  43 + String date2="";
  44 + if(map.get("endDate")!=null){
  45 + date2=map.get("endDate").toString().trim();
  46 + }
  47 + String sfyy="";
  48 + if(map.get("sfyy")!=null){
  49 + sfyy=map.get("sfyy").toString().trim();
  50 + }
  51 + String type="";
  52 + if(map.get("type")!=null){
  53 + type=map.get("type").toString().trim();
  54 + }
  55 + return service.lbStatuAnaly(gsdm,fgsdm,line,date,date2,sfyy,type);
  56 + }
  57 +
  58 +}
... ...
src/main/java/com/bsth/controller/calc/CalcMixController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.service.calc.CalcMixService;
  13 +
  14 +@RestController
  15 +@RequestMapping("calc_mix")
  16 +public class CalcMixController {
  17 +
  18 + @Autowired
  19 + CalcMixService service;
  20 +
  21 + @RequestMapping(value="/calcjsyspy")
  22 + public List<Map<String, Object>> calcjsyspy(@RequestParam Map<String, Object> map){
  23 + String line="";
  24 + if(map.get("line")!=null){
  25 + line=map.get("line").toString().trim();
  26 + }
  27 + String startDate="";
  28 + if(map.get("startDate")!=null){
  29 + startDate=map.get("startDate").toString().trim();
  30 + }
  31 + String endDate="";
  32 + if(map.get("endDate")!=null){
  33 + endDate=map.get("endDate").toString().trim();
  34 + }
  35 + String empnames="";
  36 + if(map.get("empnames")!=null){
  37 + empnames=map.get("empnames").toString().trim();
  38 + }
  39 + String cont="";
  40 + if(map.get("cont")!=null){
  41 + cont=map.get("cont").toString().trim();
  42 + }
  43 + String gsdmManth="";
  44 + if(map.get("gsdmManth")!=null){
  45 + gsdmManth=map.get("gsdmManth").toString().trim();
  46 + }
  47 + String fgsdmManth="";
  48 + if(map.get("fgsdmManth")!=null){
  49 + fgsdmManth=map.get("fgsdmManth").toString().trim();
  50 + }
  51 + return service.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth);
  52 + }
  53 +
  54 + @RequestMapping(value = "/singledatatj", method = RequestMethod.GET)
  55 + public List<Map<String, Object>> singledatatj(@RequestParam Map<String, Object> map) {
  56 + String line="";
  57 + if(map.get("line")!=null){
  58 + line=map.get("line").toString().trim();
  59 + }
  60 + String startDate="";
  61 + if(map.get("startDate")!=null){
  62 + startDate=map.get("startDate").toString().trim();
  63 + }
  64 + String endDate="";
  65 + if(map.get("endDate")!=null){
  66 + endDate=map.get("endDate").toString().trim();
  67 + }
  68 + String tjtype="";
  69 + if(map.get("tjtype")!=null){
  70 + tjtype=map.get("tjtype").toString().trim();
  71 + }
  72 + String cont="";
  73 + if(map.get("cont")!=null){
  74 + cont=map.get("cont").toString().trim();
  75 + }
  76 + String gsdmSing="";
  77 + if(map.get("gsdmSing")!=null){
  78 + gsdmSing=map.get("gsdmSing").toString().trim();
  79 + }
  80 + String fgsdmSing="";
  81 + if(map.get("fgsdmSing")!=null){
  82 + fgsdmSing=map.get("fgsdmSing").toString().trim();
  83 + }
  84 + return service.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing);
  85 + }
  86 +
  87 +}
... ...
src/main/java/com/bsth/controller/calc/CalcWaybillController.java
1 1 package com.bsth.controller.calc;
2 2  
3   -import java.util.HashMap;
4   -import java.util.List;
5   -import java.util.Map;
6   -
7 3 import com.bsth.common.ResponseCode;
8 4 import com.bsth.controller.BaseController;
  5 +import com.bsth.entity.calc.CalcStatistics;
9 6 import com.bsth.entity.calc.CalcWaybill;
10 7 import com.bsth.service.calc.CalcWaybillService;
11   -
12 8 import org.springframework.beans.factory.annotation.Autowired;
13 9 import org.springframework.web.bind.annotation.RequestMapping;
14 10 import org.springframework.web.bind.annotation.RequestParam;
15 11 import org.springframework.web.bind.annotation.RestController;
16 12  
  13 +import java.util.HashMap;
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
17 17 /**
18 18 * Created by 17/10/23.
19 19 */
... ... @@ -26,26 +26,35 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
26 26  
27 27 @RequestMapping(value="/generateNew")
28 28 public Map<String, Object> generateNews(@RequestParam Map<String, Object> map) throws Exception{
29   - String date = "", line = "";
  29 + String date = "", line = "", key="";
30 30 if(map.get("date")!=null){
31 31 date=map.get("date").toString().trim();
32 32 }
33 33 if(map.get("line")!=null){
34 34 line=map.get("line").toString().trim();
35 35 }
  36 + if(map.get("key")!=null){
  37 + key=map.get("key").toString().trim();
  38 + }
36 39  
37 40 Map<String, Object> m = new HashMap<String, Object>();
  41 + m.put("date", date);
  42 + m.put("line", line);
  43 + m.put("key", key);
38 44 try {
39 45  
40 46 m = calcWaybillService.generateNew(date, line);
41 47  
  48 + if(key.length() == 0){
  49 + m.put("status", calcWaybillService.calcDaily(date, line));
  50 + }
  51 +
42 52 } catch (Exception e) {
43 53 // TODO: handle exception
44 54 e.printStackTrace();
45 55 m.put("status", ResponseCode.ERROR);
46 56 return m;
47 57 }
48   -
49 58 return m;
50 59 }
51 60  
... ... @@ -82,4 +91,230 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
82 91 return calcWaybillService.statisticsDailyTj(gsdm,fgsdm,line,date,date2,xlName,type);
83 92 }
84 93  
  94 + @RequestMapping(value="/generateDaliy")
  95 + public Map<String, Object> generateDaliy(@RequestParam Map<String, Object> map) throws Exception{
  96 + String date = "", line = "";
  97 + if(map.containsKey("date") && map.get("date")!=null){
  98 + date=map.get("date").toString().trim();
  99 + }
  100 + if(map.containsKey("line") && map.get("line")!=null){
  101 + line=map.get("line").toString().trim();
  102 + }
  103 +
  104 + Map<String, Object> m = new HashMap<String, Object>();
  105 + m.put("date", date);
  106 + m.put("line", line);
  107 + try {
  108 +
  109 + m.put("status", calcWaybillService.calcDaily(date, line));
  110 +
  111 + } catch (Exception e) {
  112 + // TODO: handle exception
  113 + e.printStackTrace();
  114 + m.put("status", ResponseCode.ERROR);
  115 + return m;
  116 + }
  117 + return m;
  118 + }
  119 +
  120 + @RequestMapping(value="/calcStatisticsDaily")
  121 + public List<CalcStatistics> calcStatisticsDaily(@RequestParam Map<String, Object> map){
  122 + String gsdm="";
  123 + if(map.get("gsdm")!=null){
  124 + gsdm=map.get("gsdm").toString().trim();
  125 + }
  126 + String fgsdm="";
  127 + if(map.get("fgsdm")!=null){
  128 + fgsdm=map.get("fgsdm").toString().trim();
  129 + }
  130 + String line="";
  131 + if(map.get("line")!=null){
  132 + line=map.get("line").toString().trim();
  133 + }
  134 + String date="";
  135 + if(map.get("date")!=null){
  136 + date=map.get("date").toString().trim();
  137 + }
  138 + String date2="";
  139 + if(map.get("date2")!=null){
  140 + date2=map.get("date2").toString().trim();
  141 + }
  142 + String xlName="";
  143 + if(map.get("xlName")!=null){
  144 + xlName=map.get("xlName").toString().trim();
  145 + }
  146 + String type="";
  147 + if(map.get("type")!=null){
  148 + type=map.get("type").toString().trim();
  149 + }
  150 + String nature="0";
  151 + if(map.get("nature")!=null){
  152 + nature=map.get("nature").toString();
  153 + }
  154 + return calcWaybillService.calcStatisticsDaily(gsdm,fgsdm,line,date,date2,xlName,type,nature);
  155 + }
  156 +
  157 + @RequestMapping(value="/calcStatisticsDaily2")
  158 + public List<Map<String, Object>> calcStatisticsDaily2(@RequestParam Map<String, Object> map){
  159 + String gsdm="";
  160 + if(map.get("gsdm")!=null){
  161 + gsdm=map.get("gsdm").toString().trim();
  162 + }
  163 + String fgsdm="";
  164 + if(map.get("fgsdm")!=null){
  165 + fgsdm=map.get("fgsdm").toString().trim();
  166 + }
  167 + String line="";
  168 + if(map.get("line")!=null){
  169 + line=map.get("line").toString().trim();
  170 + }
  171 + String date="";
  172 + if(map.get("date")!=null){
  173 + date=map.get("date").toString().trim();
  174 + }
  175 + String date2="";
  176 + if(map.get("date2")!=null){
  177 + date2=map.get("date2").toString().trim();
  178 + }
  179 + String xlName="";
  180 + if(map.get("xlName")!=null){
  181 + xlName=map.get("xlName").toString().trim();
  182 + }
  183 + String type="";
  184 + if(map.get("type")!=null){
  185 + type=map.get("type").toString().trim();
  186 + }
  187 + String nature="0";
  188 + if(map.get("nature")!=null){
  189 + nature=map.get("nature").toString();
  190 + }
  191 + return calcWaybillService.calcStatisticsDaily2(gsdm,fgsdm,line,date,date2,xlName,type,nature);
  192 + }
  193 +
  194 + @RequestMapping(value="/generateLineMileage")
  195 + public Map<String, Object> generateLineMileage(@RequestParam Map<String, Object> map) throws Exception{
  196 + Map<String, Object> m = new HashMap<String, Object>();
  197 + String date = "", line = "";
  198 + try {
  199 +
  200 + if(map.containsKey("date") && map.get("date")!=null){
  201 + date=map.get("date").toString().trim();
  202 + }
  203 + if(map.containsKey("line") && map.get("line")!=null){
  204 + line=map.get("line").toString().trim();
  205 + }
  206 +
  207 +
  208 + return calcWaybillService.calcLineMileage(date, line);
  209 +
  210 + } catch (Exception e) {
  211 + // TODO: handle exception
  212 + e.printStackTrace();
  213 + m.put("status", ResponseCode.ERROR);
  214 + m.put("date", date);
  215 + m.put("line", line);
  216 + return m;
  217 + }
  218 + }
  219 +
  220 + @RequestMapping(value="/generateBusMileage")
  221 + public Map<String, Object> generateBusMileage(@RequestParam Map<String, Object> map) throws Exception{
  222 + Map<String, Object> m = new HashMap<String, Object>();
  223 + String date = "", line = "";
  224 + try {
  225 +
  226 + if(map.containsKey("date") && map.get("date")!=null){
  227 + date=map.get("date").toString().trim();
  228 + }
  229 + if(map.containsKey("line") && map.get("line")!=null){
  230 + line=map.get("line").toString().trim();
  231 + }
  232 +
  233 +
  234 + return calcWaybillService.calcBusMileage(date, line);
  235 +
  236 + } catch (Exception e) {
  237 + // TODO: handle exception
  238 + e.printStackTrace();
  239 + m.put("status", ResponseCode.ERROR);
  240 + m.put("date", date);
  241 + m.put("line", line);
  242 + return m;
  243 + }
  244 + }
  245 +
  246 + @RequestMapping(value="/getLineMileage")
  247 + public List<Map<String, Object>> getLineMileage(@RequestParam Map<String, Object> map){
  248 + String gsdm="";
  249 + if(map.get("gsdm")!=null){
  250 + gsdm=map.get("gsdm").toString().trim();
  251 + }
  252 + String fgsdm="";
  253 + if(map.get("fgsdm")!=null){
  254 + fgsdm=map.get("fgsdm").toString().trim();
  255 + }
  256 + String line="";
  257 + if(map.get("line")!=null){
  258 + line=map.get("line").toString().trim();
  259 + }
  260 + String date="";
  261 + if(map.get("date")!=null){
  262 + date=map.get("date").toString().trim();
  263 + }
  264 + String date2="";
  265 + if(map.get("date2")!=null){
  266 + date2=map.get("date2").toString().trim();
  267 + }
  268 + String xlName="";
  269 + if(map.get("xlName")!=null){
  270 + xlName=map.get("xlName").toString().trim();
  271 + }
  272 + String zt="";
  273 + if(map.get("zt")!=null){
  274 + zt=map.get("zt").toString();
  275 + }
  276 + String by="";
  277 + if(map.get("by")!=null){
  278 + by=map.get("by").toString();
  279 + }
  280 + String type="";
  281 + if(map.get("type")!=null){
  282 + type=map.get("type").toString().trim();
  283 + }
  284 + return calcWaybillService.getLineMileage(gsdm, fgsdm, line, date, date2, xlName, zt, by, type);
  285 + }
  286 +
  287 + @RequestMapping(value="/getBusMileage")
  288 + public List<Map<String, Object>> getBusMileage(@RequestParam Map<String, Object> map){
  289 + String line="";
  290 + if(map.get("line")!=null){
  291 + line=map.get("line").toString().trim();
  292 + }
  293 + String date="";
  294 + if(map.get("date")!=null){
  295 + date=map.get("date").toString().trim();
  296 + }
  297 + String date2="";
  298 + if(map.get("date2")!=null){
  299 + date2=map.get("date2").toString().trim();
  300 + }
  301 + String xlName="";
  302 + if(map.get("xlName")!=null){
  303 + xlName=map.get("xlName").toString().trim();
  304 + }
  305 + String zt="";
  306 + if(map.get("zt")!=null){
  307 + zt=map.get("zt").toString();
  308 + }
  309 + String by="";
  310 + if(map.get("by")!=null){
  311 + by=map.get("by").toString();
  312 + }
  313 + String type="";
  314 + if(map.get("type")!=null){
  315 + type=map.get("type").toString().trim();
  316 + }
  317 + return calcWaybillService.getBusMileage(line, date, date2, xlName, zt, by, type);
  318 + }
  319 +
85 320 }
... ...
src/main/java/com/bsth/controller/forms/ExportController.java
... ... @@ -46,7 +46,8 @@ public class ExportController {
46 46 @RequestMapping(value = "/waybilldayExport", method = RequestMethod.POST)
47 47 public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map) {
48 48 List<Waybillday> waybillday = formsService.waybillday(map);
49   - exportService.waybillday(map.get("date").toString(), waybillday);
  49 + exportService.waybillday(map.get("date").toString(),
  50 + map.get("lineName").toString(), waybillday);
50 51 return waybillday;
51 52 }
52 53  
... ... @@ -85,7 +86,8 @@ public class ExportController {
85 86 // 班次车辆人员日统计
86 87 @RequestMapping(value = "/shifdayExport", method = RequestMethod.GET)
87 88 public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) {
88   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  89 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  90 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
89 91 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
90 92 Map<String, Object> map2 = new HashMap<String, Object>();
91 93 ReportUtils ee = new ReportUtils();
... ... @@ -117,10 +119,14 @@ public class ExportController {
117 119 }
118 120  
119 121 try {
  122 + String lineName = "";
  123 + if(map.containsKey("lineName"))
  124 + lineName = map.get("lineName").toString();
120 125 listI.add(resList.iterator());
121 126 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
122 127 ee.excelReplace(listI, new Object[] { map2 }, path + "mould/shifday.xls",
123   - path + "export/班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  128 + path + "export/" + sdfSimple.format(sdfMonth.parse(map.get("date").toString()))
  129 + + "-" + lineName + "-班次车辆人员日报表.xls");
124 130 } catch (Exception e) {
125 131 e.printStackTrace();
126 132 }
... ... @@ -130,7 +136,8 @@ public class ExportController {
130 136 // 班次车辆人员月统计
131 137 @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.GET)
132 138 public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map) {
133   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  139 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  140 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
134 141 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
135 142 ReportUtils ee = new ReportUtils();
136 143 List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map);
... ... @@ -153,7 +160,20 @@ public class ExportController {
153 160 }
154 161  
155 162 try {
156   - String mouldurl = null;
  163 + String mouldurl = null, lineName = "", dateTime = ""
  164 + , startDate = "", endDate = "";
  165 + if(map.containsKey("lineName"))
  166 + lineName = map.get("lineName").toString();
  167 + if(map.containsKey("startDate"))
  168 + startDate = map.get("startDate").toString();
  169 + if(map.containsKey("endDate"))
  170 + endDate = map.get("endDate").toString();
  171 + if(startDate.equals(endDate)){
  172 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  173 + } else {
  174 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  175 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  176 + }
157 177 if(map.get("empnames").equals("驾驶员")){
158 178 mouldurl="mould/shiftuehiclemanth.xls";
159 179 }else if(map.get("empnames").equals("售票员")){
... ... @@ -164,7 +184,7 @@ public class ExportController {
164 184 listI.add(resList.iterator());
165 185 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
166 186 ee.excelReplace(listI, new Object[] { map }, path +mouldurl,
167   - path + "export/班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  187 + path + "export/" + dateTime + "-" + lineName + "-班次车辆人员月报表.xls");
168 188 } catch (Exception e) {
169 189 e.printStackTrace();
170 190 }
... ... @@ -304,7 +324,8 @@ public class ExportController {
304 324 }
305 325 @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET)
306 326 public List<Map<String, Object>> singledataExportTj(@RequestParam Map<String, Object> map) {
307   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  327 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  328 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
308 329 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
309 330 ReportUtils ee = new ReportUtils();
310 331 List<Singledata> singledata = formsService.singledatatj(map);
... ... @@ -333,10 +354,16 @@ public class ExportController {
333 354 }
334 355  
335 356 try {
  357 + String startDate = "", lineName = "";
  358 + if(map.containsKey("startDate"))
  359 + startDate = map.get("startDate").toString();
  360 + if(map.containsKey("lineName"))
  361 + lineName = map.get("lineName").toString();
336 362 listI.add(resList.iterator());
337 363 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
338 364 ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls",
339   - path + "export/路单数据" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  365 + path + "export/" + sdfSimple.format(sdfMonth.parse(startDate))
  366 + + "-" + lineName + "-路单数据.xls");
340 367 } catch (Exception e) {
341 368 e.printStackTrace();
342 369 }
... ... @@ -388,7 +415,8 @@ public class ExportController {
388 415 // 车辆加注
389 416 @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.GET)
390 417 public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) {
391   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  418 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  419 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
392 420 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
393 421 ReportUtils ee = new ReportUtils();
394 422 List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(),
... ... @@ -414,10 +442,15 @@ public class ExportController {
414 442 }
415 443  
416 444 try {
  445 + String date = "", lineName = "";
  446 + if(map.containsKey("data"))
  447 + date = map.get("data").toString();
  448 + if(map.containsKey("lineName"))
  449 + lineName = map.get("lineName").toString();
417 450 listI.add(resList.iterator());
418 451 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
419 452 ee.excelReplace(listI, new Object[] { map }, path + "mould/vehicleloading.xls",
420   - path + "export/车辆加注" + sdfSimple.format(sdfMonth.parse(map.get("data").toString())) + ".xls");
  453 + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) + "-" + lineName + "-车辆加注.xls");
421 454 } catch (Exception e) {
422 455 e.printStackTrace();
423 456 }
... ... @@ -436,21 +469,35 @@ public class ExportController {
436 469 for (Operationservice l : operationservice) {
437 470 Map<String, Object> m = new HashMap<String, Object>();
438 471 m.put("i", i);
439   - m.put("xlName", l.getXlName());
440   - m.put("jzl", l.getJzl());
441   - m.put("xhl", l.getXhl());
442   - m.put("xsgl", l.getXsgl());
443   - m.put("emptMileage", l.getEmptMileage());
444   - m.put("sjbc", l.getSjbc());
  472 + m.put("fgs", l.getFgs()!=null?l.getFgs():"");
  473 + m.put("xlName", l.getXlName()!=null?l.getXlName():"");
  474 + m.put("jzl", l.getJzl()!=null?l.getJzl():"");
  475 + m.put("xhl", l.getXhl()!=null?l.getXhl():"");
  476 + m.put("xsgl", l.getXsgl()!=null?l.getXsgl():"");
  477 + m.put("emptMileage", l.getEmptMileage()!=null?l.getEmptMileage():"");
  478 + m.put("sjbc", l.getSjbc()!=null?l.getSjbc():"");
445 479 resList.add(m);
446 480 i++;
447 481 }
448 482  
449 483 try {
  484 + String dateTime = "", startDate = "", endDate = "", lineName = "";
  485 + if(map.containsKey("startDate"))
  486 + startDate = map.get("startDate").toString();
  487 + if(map.containsKey("endDate"))
  488 + endDate = map.get("endDate").toString();
  489 + if(map.containsKey("lineName"))
  490 + lineName = map.get("lineName").toString();
  491 + if(startDate.equals(endDate)){
  492 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  493 + } else {
  494 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  495 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  496 + }
450 497 listI.add(resList.iterator());
451 498 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
452   - ee.excelReplace(listI, new Object[] { map }, path + "mould/operationservice.xls", path + "export/运营服务阶段报表"
453   - + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  499 + ee.excelReplace(listI, new Object[] { map }, path + "mould/operationservice.xls", path + "export/"
  500 + + dateTime + "-" + lineName + "-运营服务阶段报表.xls");
454 501 } catch (Exception e) {
455 502 e.printStackTrace();
456 503 }
... ... @@ -460,7 +507,8 @@ public class ExportController {
460 507 // 换人换车情况日统计
461 508 @RequestMapping(value = "/changetochangeExport", method = RequestMethod.POST)
462 509 public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map) {
463   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  510 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  511 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
464 512 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
465 513 ReportUtils ee = new ReportUtils();
466 514 List<Changetochange> changetochange = formsService.changetochange(map);
... ... @@ -484,10 +532,23 @@ public class ExportController {
484 532 }
485 533  
486 534 try {
  535 + String dateTime = "", startDate = "", endDate = "", lineName = "";
  536 + if(map.containsKey("startDate"))
  537 + startDate = map.get("startDate").toString();
  538 + if(map.containsKey("endDate"))
  539 + endDate = map.get("endDate").toString();
  540 + if(map.containsKey("lineName"))
  541 + lineName = map.get("lineName").toString();
  542 + if(startDate.equals(endDate)){
  543 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  544 + } else {
  545 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  546 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  547 + }
487 548 listI.add(resList.iterator());
488 549 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
489   - ee.excelReplace(listI, new Object[] { map }, path + "mould/changetochange.xls", path + "export/换人换车情况日统计"
490   - + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  550 + ee.excelReplace(listI, new Object[] { map }, path + "mould/changetochange.xls", path + "export/"
  551 + + dateTime + "-" + lineName + "-换人换车情况日统计.xls");
491 552 } catch (Exception e) {
492 553 e.printStackTrace();
493 554 }
... ... @@ -497,7 +558,8 @@ public class ExportController {
497 558 // 营运线路出车率统计表
498 559 @RequestMapping(value = "/turnoutrateExport", method = RequestMethod.POST)
499 560 public List<Map<String, Object>> turnoutrateExport(@RequestParam Map<String, Object> map) {
500   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  561 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  562 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
501 563 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
502 564 ReportUtils ee = new ReportUtils();
503 565 Map<String, Object> map1 = new HashMap<String, Object>();
... ... @@ -517,10 +579,23 @@ public class ExportController {
517 579 resList.remove(m);
518 580  
519 581 try {
  582 + String dateTime = "", startDate = "", endDate = "", lineName = "";
  583 + if(map.containsKey("startDate"))
  584 + startDate = map.get("startDate").toString();
  585 + if(map.containsKey("endDate"))
  586 + endDate = map.get("endDate").toString();
  587 + if(map.containsKey("lineName"))
  588 + lineName = map.get("lineName").toString();
  589 + if(startDate.equals(endDate)){
  590 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  591 + } else {
  592 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  593 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  594 + }
520 595 listI.add(resList.iterator());
521 596 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
522   - ee.excelReplace(listI, new Object[] { map1 }, path + "mould/turnoutrate.xls", path + "export/营运线路出车率统计表"
523   - + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  597 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould/turnoutrate.xls", path + "export/"
  598 + + dateTime + "-" + lineName + "-营运线路出车率统计表.xls");
524 599 } catch (Exception e) {
525 600 e.printStackTrace();
526 601 }
... ... @@ -713,10 +788,13 @@ public class ExportController {
713 788 m.put("line", BasicData.lineCode2NameMap.get(map.get("line").toString()));
714 789 m.put("date", map.get("date").toString());
715 790 try {
  791 + String lineName = map.get("lineName").toString();
  792 + String date = map.get("date").toString();
716 793 listI.add(resList.iterator());
717 794 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
718   - ee.excelReplace(listI, new Object[] { m }, path + "mould/daily.xls", path + "export/班次日报表"
719   - + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  795 + ee.excelReplace(listI, new Object[] { m }, path + "mould/daily.xls",
  796 + path + "export/" + sdfSimple.format(sdfMonth.parse(date))
  797 + + "-" + lineName + "-班次日报表.xls");
720 798 } catch (Exception e) {
721 799 e.printStackTrace();
722 800 }
... ...
src/main/java/com/bsth/controller/gps/GpsController.java
... ... @@ -5,6 +5,8 @@ import com.bsth.data.gpsdata_v2.GpsRealData;
5 5 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
6 6 import com.bsth.data.gpsdata_v2.handlers.overspeed.GpsOverspeed;
7 7 import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
  8 +import com.bsth.data.schedule.e_state_check.ScheduleStationCodeChecker;
  9 +import com.bsth.data.schedule.e_state_check.entity.SCodeInfo;
8 10 import com.bsth.service.gps.GpsService;
9 11 import com.bsth.service.gps.entity.GpsSpeed;
10 12 import com.google.common.base.Splitter;
... ... @@ -56,8 +58,13 @@ public class GpsController {
56 58  
57 59 //超速信息
58 60 List<GpsOverspeed> overspeedList = overspeedProcess.findByLines(lineArray);
  61 +
  62 + //班次站点检查信息
  63 + List<SCodeInfo> scis = ScheduleStationCodeChecker.findByLineIdx(lineArray);
  64 +
59 65 rs.put("gpsList", gpsList);
60 66 rs.put("overspeedList", overspeedList);
  67 + rs.put("scis", scis);
61 68 return rs;
62 69 }
63 70  
... ...
src/main/java/com/bsth/controller/oil/DlbController.java
... ... @@ -164,7 +164,11 @@ public class DlbController extends BaseController&lt;Dlb, Integer&gt;{
164 164 m.put("rq", y.getRq());
165 165 m.put("gsname",y.getGsname() );
166 166 m.put("fgsname", y.getFgsname());
167   - m.put("xlname", y.getXlname());
  167 + if(y.getLinename()==null){
  168 + m.put("xlname", y.getXlname()==null?"":y.getXlname());
  169 + }else{
  170 + m.put("xlname", y.getLinename());
  171 + }
168 172 m.put("nbbm", y.getNbbm());
169 173 m.put("jsy", y.getJsy());
170 174 m.put("name", y.getName());
... ...
src/main/java/com/bsth/controller/oil/LsylbController.java 0 → 100644
  1 +package com.bsth.controller.oil;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.HashMap;
  6 +import java.util.Iterator;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +import com.bsth.controller.BaseController;
  17 +import com.bsth.entity.oil.Lsylb;
  18 +import com.bsth.entity.oil.Ylb;
  19 +import com.bsth.service.oil.LsylbService;
  20 +import com.bsth.util.Arith;
  21 +import com.bsth.util.ReportUtils;
  22 +
  23 +@RestController
  24 +@RequestMapping("lsylb")
  25 +public class LsylbController extends BaseController<Ylb, Integer>{
  26 + @Autowired
  27 + LsylbService lsylbService;
  28 +
  29 + @RequestMapping(value = "/lsylbList",method = RequestMethod.GET)
  30 + public List<Lsylb> lsylbList(@RequestParam Map<String, Object> map){
  31 + List<Lsylb> ylbList=lsylbService.listYlb(map);
  32 + return ylbList;
  33 + }
  34 +
  35 + @RequestMapping(value = "/sumLsylb",method = RequestMethod.GET)
  36 + public Map<String, Object> sumLsylb(@RequestParam Map<String, Object> map){
  37 + Map<String, Object> list=lsylbService.sumYlb(map);
  38 + return list;
  39 + }
  40 +
  41 + @RequestMapping(value = "/listExport",method = RequestMethod.POST)
  42 + public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){
  43 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  44 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  45 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  46 + ReportUtils ee = new ReportUtils();
  47 + List<Lsylb> lsylb= lsylbService.listYlb(map);
  48 + String nylx=map.get("nylx").toString();
  49 +// (new CustomerSpecs<Ylb>(map)).iterator();
  50 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  51 + for (Lsylb y : lsylb) {
  52 + Map<String, Object> m = new HashMap<String, Object>();
  53 + m.put("rq", sdfMonth.format(y.getRq()));
  54 + m.put("gsname",y.getGsname() );
  55 + m.put("fgsname", y.getFgsname());
  56 + m.put("xlname", y.getXlname()==null?"":y.getXlname());
  57 + m.put("nbbm", y.getNbbm());
  58 + m.put("jsy", y.getJsy());
  59 + m.put("name", y.getName());
  60 + m.put("czlc", "0");
  61 + m.put("jzlc", "0");
  62 + m.put("sh", y.getSh()==null?"0":y.getSh());
  63 +
  64 + String shyy ="无";
  65 +
  66 + if(nylx.equals("0")){
  67 + m.put("jzl", y.getJzl()==null?"0":y.getJzl());
  68 + m.put("czyl", y.getCzyl()==null?"0":y.getCzyl());
  69 + m.put("jzyl", y.getJzyl()==null?"0":y.getJzyl());
  70 + m.put("yh", y.getYh()==null?"0":y.getYh());
  71 +
  72 + if(y.getShyy()!=null){
  73 + shyy=y.getShyy();
  74 + if(shyy.equals("1")){shyy="票务用油";}
  75 + else if(shyy.equals("2")){shyy="保养用油";}
  76 + else if(shyy.equals("3")){shyy="报废车用油";}
  77 + else if(shyy.equals("4")){shyy="其它用油";}
  78 + else if(shyy.equals("5")){shyy="人保部";}
  79 + else if(shyy.equals("6")){shyy="车队";}
  80 + else if(shyy.equals("7")){shyy="车间(高保)";}
  81 + else if(shyy.equals("8")){shyy="车间(小修)";}
  82 + else{shyy ="无";}
  83 + }
  84 + m.put("zyh", Arith.add(m.get("sh"), m.get("yh")));
  85 +
  86 + String rylx="";
  87 + if(y.getRylx()!=null){
  88 + if(y.getRylx().equals("0")){rylx="0号柴油";}
  89 + if(y.getRylx().equals("1")){rylx="负10号柴油";}
  90 + }
  91 + m.put("rylx", rylx);
  92 + }else{
  93 + m.put("cdl", y.getJzl()==null?"0":y.getJzl());
  94 + m.put("czcd", y.getCzyl()==null?"0":y.getCzyl());
  95 + m.put("jzcd", y.getJzyl()==null?"0":y.getJzyl());
  96 + m.put("hd", y.getYh()==null?"0":y.getYh());
  97 + if(y.getShyy()!=null){
  98 + shyy=y.getShyy();
  99 + if(shyy.equals("1")){shyy="票务用电";}
  100 + else if(shyy.equals("2")){shyy="保养用电";}
  101 + else if(shyy.equals("3")){shyy="报废车用电";}
  102 + else if(shyy.equals("4")){shyy="其它用电";}
  103 + else if(shyy.equals("5")){shyy="人保部";}
  104 + else if(shyy.equals("6")){shyy="车队";}
  105 + else if(shyy.equals("7")){shyy="车间(高保)";}
  106 + else if(shyy.equals("8")){shyy="车间(小修)";}
  107 + else{shyy ="无";}
  108 + }
  109 + m.put("zyh", Arith.add(m.get("sh"), m.get("hd")));
  110 + m.put("rdlx", "");
  111 +
  112 + }
  113 + m.put("shyy", shyy);
  114 + m.put("ns", y.getNs()==null?"0":y.getNs());
  115 + m.put("zlc", y.getZlc()==null?"0":y.getZlc());
  116 + m.put("bglyh", y.getBglyh());
  117 + resList.add(m);
  118 + }
  119 + try {
  120 + map.put("sheetName", map.get("rq"));
  121 + listI.add(resList.iterator());
  122 + String xls="";
  123 + String name="";
  124 +
  125 + if(nylx.equals("0")){
  126 + xls="list.xls";
  127 + name="进出场存油量.xls";
  128 + }else{
  129 + xls="listDl.xls";
  130 + name="进出场存电量.xls";
  131 + }
  132 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  133 + ee.excelReplace(listI, new Object[] { map }, path+"mould/"+xls,
  134 + path+"export/"+map.get("rq").toString()+ name);
  135 + } catch (Exception e) {
  136 + e.printStackTrace();
  137 + }
  138 +
  139 + return resList;
  140 +
  141 + }
  142 +}
... ...
src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -268,7 +268,11 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
268 268 m.put("rq", sdfMonth.format(y.getRq()));
269 269 m.put("gsname",y.getGsname() );
270 270 m.put("fgsname", y.getFgsname());
271   - m.put("xlname", y.getXlname()==null?"":y.getXlname());
  271 + if(y.getLinename()==null){
  272 + m.put("xlname", y.getXlname()==null?"":y.getXlname());
  273 + }else{
  274 + m.put("xlname", y.getLinename());
  275 + }
272 276 m.put("nbbm", y.getNbbm());
273 277 m.put("jsy", y.getJsy());
274 278 m.put("name", y.getName());
... ...
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
1   -package com.bsth.controller.realcontrol;
2   -
3   -import com.bsth.data.directive.DayOfDirectives;
4   -import com.bsth.data.directive.DirectivesPstThread;
5   -import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
6   -import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
7   -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
8   -import com.bsth.data.msg_queue.DirectivePushQueue;
9   -import com.bsth.data.msg_queue.WebSocketPushQueue;
10   -import com.bsth.data.pilot80.PilotReport;
11   -import com.bsth.data.schedule.DayOfSchedule;
12   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
13   -import com.bsth.websocket.handler.SendUtils;
14   -import org.slf4j.Logger;
15   -import org.slf4j.LoggerFactory;
16   -import org.springframework.beans.factory.annotation.Autowired;
17   -import org.springframework.web.bind.annotation.RequestMapping;
18   -import org.springframework.web.bind.annotation.RequestParam;
19   -import org.springframework.web.bind.annotation.RestController;
20   -
21   -import java.util.HashMap;
22   -import java.util.List;
23   -import java.util.Map;
24   -
25   -/**
26   - * Created by panzhao on 2017/4/14.
27   - */
28   -@RestController
29   -@RequestMapping("adminUtils")
30   -public class AdminUtilsController {
31   -
32   -
33   - Logger logger = LoggerFactory.getLogger(this.getClass());
34   -
35   - @Autowired
36   - DayOfSchedule dayOfSchedule;
37   -
38   - @Autowired
39   - GeoCacheData geoCacheData;
40   -
41   - @Autowired
42   - DayOfDirectives dayOfDirectives;
43   -
44   - @Autowired
45   - SendUtils sendUtils;
46   -
47   - @Autowired
48   - PilotReport pilotReport;
49   -
50   - /**
51   - * 出现重复班次的车辆
52   - * @param
53   -
54   - @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)
55   - public void schRepeat(@RequestParam String nbbm){
56   - logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");
57   - List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);
58   - logger.info("检测前,车辆班次数量:" + list.size());
59   -
60   - Map<Long, ScheduleRealInfo> map = new HashMap<>();
61   - for(ScheduleRealInfo sch : list){
62   - if(map.containsKey(sch.getId())){
63   - logger.info("检测到重复ID: " + sch.getId());
64   - }
65   - map.put(sch.getId(), sch);
66   - }
67   -
68   - logger.info("检测后,车辆班次数量:" + list.size());
69   - if(map.values().size() > 0){
70   - dayOfSchedule.replaceByNbbm(nbbm, map.values());
71   - }
72   - }*/
73   -
74   -/* @RequestMapping(value = "/directivePushQueue")
75   - public void directivePushQueue(){
76   - DirectivePushQueue.start();
77   - }*/
78   -
79   - @RequestMapping(value = "/directiveQueueSize")
80   - public void directiveQueueSize(){
81   - DirectivePushQueue.size();
82   - }
83   -
84   - /*@RequestMapping(value = "/webSocketPushQueue")
85   - public void webSocketPushQueue(){
86   - WebSocketPushQueue.start();
87   - }*/
88   -
89   - @RequestMapping(value = "/webSocketQueueSize")
90   - public void webSocketQueueSize(){
91   - WebSocketPushQueue.size();
92   - }
93   -
94   - @RequestMapping(value = "/setHttpFlag")
95   - public void setHttpFlag(@RequestParam int flag){
96   - if(flag != 0 && flag != -1)
97   - return;
98   - GpsDataLoaderThread.setFlag(flag);
99   - }
100   -
101   - @RequestMapping(value = "/updateCacheBuff")
102   - public void updateCacheBuff(){
103   - geoCacheData.loadData();
104   - }
105   -
106   - @RequestMapping(value = "/reCalcLpSch")
107   - public void reCalcLpSch(){
108   - dayOfSchedule._test_reCalcLpSch();
109   - }
110   -
111   - @RequestMapping(value = "/findSchByLpName")
112   - public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){
113   - return dayOfSchedule.getLpScheduleMap().get(lpName);
114   - }
115   -
116   - @RequestMapping(value = "/findSchByNbbm")
117   - public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm){
118   - return dayOfSchedule.findByNbbm(nbbm);
119   - }
120   -
121   - @RequestMapping(value = "/removeExecPlan")
122   - public int removeExecPlan(@RequestParam String nbbm){
123   - dayOfSchedule.removeExecPlan(nbbm);
124   - return 1;
125   - }
126   -
127   - @RequestMapping(value = "/sch_re_calc_id_maps")
128   - public int reCalcIdMaps(){
129   - return dayOfSchedule.reCalcIdMaps();
130   - }
131   -
132   - @RequestMapping(value = "/sch_size_string")
133   - public String schSizeString(){
134   - return dayOfSchedule.sizeString();
135   - }
136   -
137   - @RequestMapping(value = "/containerSize")
138   - public Map<String, Integer> containerSize(){
139   - Map<String, Integer> rs = new HashMap<>();
140   - rs.put("60_size", dayOfDirectives.all60().size());
141   - rs.put("80_size", pilotReport.findAll().size());
142   - rs.put("nbbm_sch_size", dayOfSchedule.findAll().size());
143   - rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size());
144   - rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size());
145   - rs.put("pst_sch_size", dayOfSchedule.getPstSize());
146   - rs.put("speeds_size", OverspeedProcess.size());
147   - return rs;
148   - }
149   -
150   - @RequestMapping(value = "/websocketRadioText")
151   - public int radioText(String t, String lineCode){
152   - sendUtils.sendRadioText(t, lineCode);
153   - return 0;
154   - }
155   -
156   - @Autowired
157   - DirectivesPstThread directivesPstThread;
158   -
159   - @RequestMapping(value = "/_sd_60_pst")
160   - public void sd_60_pst(){
161   - logger.info("手动入库指令....");
162   - directivesPstThread.run();
163   - }
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.Date;
  5 +import java.util.HashMap;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +import com.bsth.common.ResponseCode;
  17 +import com.bsth.data.directive.DayOfDirectives;
  18 +import com.bsth.data.directive.DirectivesPstThread;
  19 +import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  20 +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
  21 +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
  22 +import com.bsth.data.msg_queue.DirectivePushQueue;
  23 +import com.bsth.data.msg_queue.WebSocketPushQueue;
  24 +import com.bsth.data.pilot80.PilotReport;
  25 +import com.bsth.data.schedule.DayOfSchedule;
  26 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  27 +import com.bsth.websocket.handler.SendUtils;
  28 +
  29 +import ch.qos.logback.classic.Level;
  30 +import ch.qos.logback.classic.LoggerContext;
  31 +
  32 +/**
  33 + * Created by panzhao on 2017/4/14.
  34 + */
  35 +@RestController
  36 +@RequestMapping("adminUtils")
  37 +public class AdminUtilsController {
  38 +
  39 +
  40 + Logger logger = LoggerFactory.getLogger(this.getClass());
  41 +
  42 + @Autowired
  43 + DayOfSchedule dayOfSchedule;
  44 +
  45 + @Autowired
  46 + GeoCacheData geoCacheData;
  47 +
  48 + @Autowired
  49 + DayOfDirectives dayOfDirectives;
  50 +
  51 + @Autowired
  52 + SendUtils sendUtils;
  53 +
  54 + @Autowired
  55 + PilotReport pilotReport;
  56 +
  57 + /**
  58 + * 出现重复班次的车辆
  59 + *
  60 + * @param
  61 + * @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)
  62 + * public void schRepeat(@RequestParam String nbbm){
  63 + * logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");
  64 + * List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);
  65 + * logger.info("检测前,车辆班次数量:" + list.size());
  66 + * <p>
  67 + * Map<Long, ScheduleRealInfo> map = new HashMap<>();
  68 + * for(ScheduleRealInfo sch : list){
  69 + * if(map.containsKey(sch.getId())){
  70 + * logger.info("检测到重复ID: " + sch.getId());
  71 + * }
  72 + * map.put(sch.getId(), sch);
  73 + * }
  74 + * <p>
  75 + * logger.info("检测后,车辆班次数量:" + list.size());
  76 + * if(map.values().size() > 0){
  77 + * dayOfSchedule.replaceByNbbm(nbbm, map.values());
  78 + * }
  79 + * }
  80 + */
  81 +
  82 +/* @RequestMapping(value = "/directivePushQueue")
  83 + public void directivePushQueue(){
  84 + DirectivePushQueue.start();
  85 + }*/
  86 + @RequestMapping(value = "/directiveQueueSize")
  87 + public void directiveQueueSize() {
  88 + DirectivePushQueue.size();
  89 + }
  90 +
  91 + /*@RequestMapping(value = "/webSocketPushQueue")
  92 + public void webSocketPushQueue(){
  93 + WebSocketPushQueue.start();
  94 + }*/
  95 +
  96 + @RequestMapping(value = "/webSocketQueueSize")
  97 + public void webSocketQueueSize() {
  98 + WebSocketPushQueue.size();
  99 + }
  100 +
  101 + @RequestMapping(value = "/setHttpFlag")
  102 + public void setHttpFlag(@RequestParam int flag) {
  103 + if (flag != 0 && flag != -1)
  104 + return;
  105 + GpsDataLoaderThread.setFlag(flag);
  106 + }
  107 +
  108 + @RequestMapping(value = "/updateCacheBuff")
  109 + public void updateCacheBuff() {
  110 + geoCacheData.loadData();
  111 + }
  112 +
  113 + @RequestMapping(value = "/reCalcLpSch")
  114 + public void reCalcLpSch() {
  115 + dayOfSchedule._test_reCalcLpSch();
  116 + }
  117 +
  118 + @RequestMapping(value = "/findSchByLpName")
  119 + public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName) {
  120 + return dayOfSchedule.getLpScheduleMap().get(lpName);
  121 + }
  122 +
  123 + @RequestMapping(value = "/findSchByNbbm")
  124 + public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm) {
  125 + return dayOfSchedule.findByNbbm(nbbm);
  126 + }
  127 +
  128 + @RequestMapping(value = "/removeExecPlan")
  129 + public int removeExecPlan(@RequestParam String nbbm) {
  130 + dayOfSchedule.removeExecPlan(nbbm);
  131 + return 1;
  132 + }
  133 +
  134 + @RequestMapping(value = "/sch_re_calc_id_maps")
  135 + public int reCalcIdMaps() {
  136 + return dayOfSchedule.reCalcIdMaps();
  137 + }
  138 +
  139 + @RequestMapping(value = "/sch_size_string")
  140 + public String schSizeString() {
  141 + return dayOfSchedule.sizeString();
  142 + }
  143 +
  144 + @RequestMapping(value = "/containerSize")
  145 + public Map<String, Integer> containerSize() {
  146 + Map<String, Integer> rs = new HashMap<>();
  147 + rs.put("60_size", dayOfDirectives.all60().size());
  148 + rs.put("80_size", pilotReport.findAll().size());
  149 + rs.put("nbbm_sch_size", dayOfSchedule.findAll().size());
  150 + rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size());
  151 + rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size());
  152 + rs.put("pst_sch_size", dayOfSchedule.getPstSize());
  153 + rs.put("speeds_size", OverspeedProcess.size());
  154 + return rs;
  155 + }
  156 +
  157 + @RequestMapping(value = "/websocketRadioText")
  158 + public int radioText(String t, String lineCode) {
  159 + sendUtils.sendRadioText(t, lineCode);
  160 + return 0;
  161 + }
  162 +
  163 + @Autowired
  164 + DirectivesPstThread directivesPstThread;
  165 +
  166 + @RequestMapping(value = "/_sd_60_pst")
  167 + public void sd_60_pst() {
  168 + logger.info("手动入库指令....");
  169 + directivesPstThread.run();
  170 + }
  171 +
  172 + /**
  173 + * 删除班次,删除内存中未清理掉的非当天的班次
  174 + * @createDate 2019.05.13
  175 + * @author zhangxianzhou
  176 + * @param id 线路id
  177 + * @return 被删除的班次信息
  178 + */
  179 + @RequestMapping("/deleteSchduleBC")
  180 + public Map deleteSchduleBC(Long id) {
  181 + Map<String, Object> rs = new HashMap<>();
  182 + rs.put("status", ResponseCode.ERROR);
  183 + ScheduleRealInfo sch = null;
  184 + try {
  185 + sch = dayOfSchedule.get(id);
  186 + if (sch == null) {
  187 + rs.put("msg", "无效的id号");
  188 + return rs;
  189 + }
  190 + Date date=new Date();
  191 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  192 + String dateStr=sdf.format(date);
  193 + if (sch.getScheduleDateStr().equals(dateStr)){
  194 + rs.put("msg", "不能删除当日排班");
  195 + return rs;
  196 + }
  197 + //内存中删除
  198 + dayOfSchedule.deleteBC(sch);
  199 + rs.put("delete", sch);
  200 + rs.put("status", ResponseCode.SUCCESS);
  201 +
  202 + } catch (Exception e) {
  203 + logger.error("", e);
  204 + rs.put("msg", e.getMessage());
  205 + sch.setDeleted(false);
  206 + }
  207 +
  208 + return rs;
  209 + }
  210 +
  211 + @RequestMapping("/changeLogLevel")
  212 + public Map<String, Object> changeLogLevel(@RequestParam String level) {
  213 + Map<String, Object> rs = new HashMap<>();
  214 + rs.put("errCode", 1);
  215 + LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory();
  216 + context.getLogger("root").setLevel(Level.toLevel(level));
  217 + rs.put("errCode", 0);
  218 + rs.put("errMsg", "成功");
  219 +
  220 + return rs;
  221 + }
164 222 }
165 223 \ No newline at end of file
... ...
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
... ... @@ -49,6 +49,12 @@ public class RealMapController {
49 49 return realMapService.findRouteByLine(idx);
50 50 }
51 51  
  52 +
  53 + @RequestMapping(value = "/findRouteAndVersionByLine")
  54 + public Map<String, Object> findRouteByLineAndVersion(@RequestParam String idx) {
  55 + return realMapService.findRouteAndVersionByLine(idx);
  56 + }
  57 +
52 58 @RequestMapping(value = "/multiRouteByLine")
53 59 public Map<String, Object> multiRouteByLine(@RequestParam String codeStr) {
54 60 return realMapService.multiRouteByLine(codeStr);
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
1 1 package com.bsth.controller.realcontrol;
2 2  
  3 +import java.io.ByteArrayOutputStream;
  4 +import java.io.IOException;
  5 +import java.io.InputStream;
  6 +import java.io.OutputStream;
  7 +import java.net.HttpURLConnection;
  8 +import java.net.URL;
  9 +import java.util.ArrayList;
  10 +import java.util.Collection;
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import org.apache.commons.io.IOUtils;
  16 +import org.apache.commons.lang3.StringEscapeUtils;
  17 +import org.joda.time.format.DateTimeFormat;
  18 +import org.joda.time.format.DateTimeFormatter;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.web.bind.annotation.PathVariable;
  21 +import org.springframework.web.bind.annotation.RequestMapping;
  22 +import org.springframework.web.bind.annotation.RequestMethod;
  23 +import org.springframework.web.bind.annotation.RequestParam;
  24 +import org.springframework.web.bind.annotation.RestController;
  25 +
3 26 import com.alibaba.fastjson.JSONArray;
4 27 import com.bsth.common.ResponseCode;
5 28 import com.bsth.controller.BaseController;
... ... @@ -10,14 +33,11 @@ import com.bsth.data.schedule.DayOfSchedule;
10 33 import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
11 34 import com.bsth.entity.realcontrol.ScheduleRealInfo;
12 35 import com.bsth.entity.schedule.SchedulePlanInfo;
  36 +import com.bsth.entity.sys.SysUser;
  37 +import com.bsth.security.util.SecurityUtils;
13 38 import com.bsth.service.realcontrol.ScheduleRealInfoService;
14   -import org.apache.commons.lang3.StringEscapeUtils;
15   -import org.joda.time.format.DateTimeFormat;
16   -import org.joda.time.format.DateTimeFormatter;
17   -import org.springframework.beans.factory.annotation.Autowired;
18   -import org.springframework.web.bind.annotation.*;
19   -
20   -import java.util.*;
  39 +import com.bsth.util.ConfigUtil;
  40 +import com.fasterxml.jackson.databind.ObjectMapper;
21 41  
22 42 @RestController
23 43 @RequestMapping("/realSchedule")
... ... @@ -29,6 +49,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
29 49 @Autowired
30 50 DayOfSchedule dayOfSchedule;
31 51  
  52 + @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
  53 + public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
  54 + return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
  55 + }
  56 +
32 57 @RequestMapping(value = "/lines")
33 58 public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
34 59 return scheduleRealInfoService.findByLines(lines);
... ... @@ -48,7 +73,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
48 73 public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
49 74 @RequestParam String dfsj,String bcType,
50 75 @RequestParam(defaultValue = "") String opType) {
51   - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType);
  76 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
52 77 }
53 78  
54 79 /**
... ... @@ -59,7 +84,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
59 84 public Map<String, Object> destroy(@RequestParam String idsStr
60 85 /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
61 86 @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
62   - return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks, adjustExps/*, spaceNum*/);
  87 + return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
63 88 }
64 89  
65 90 /**
... ... @@ -412,7 +437,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
412 437 if(map.get("type")!=null){
413 438 type=map.get("type").toString();
414 439 }
415   - return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type);
  440 + String nature="0";
  441 + if(map.get("nature")!=null){
  442 + nature=map.get("nature").toString();
  443 + }
  444 + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
416 445 }
417 446  
418 447 /*
... ... @@ -506,6 +535,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
506 535 return scheduleRealInfoService.realScheduleList(line,date);
507 536 }
508 537  
  538 + @RequestMapping(value="/realScheduleList_zrw")
  539 + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
  540 + return scheduleRealInfoService.realScheduleList_zrw(line,date);
  541 + }
  542 +
509 543 @RequestMapping(value="/realScheduleList_mh_2")
510 544 public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
511 545 return scheduleRealInfoService.realScheduleList_mh_2(line,date);
... ... @@ -520,7 +554,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
520 554 public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
521 555 cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
522 556 List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
523   - return scheduleRealInfoService.multi_tzrc(cpcs);
  557 + return scheduleRealInfoService.multi_tzrc(cpcs, null);
524 558 }
525 559  
526 560 @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
... ... @@ -630,6 +664,9 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
630 664 }
631 665  
632 666 int code = dayOfSchedule.reloadSch(lineCode);
  667 +
  668 + //重新按公司编码索引数据
  669 + dayOfSchedule.groupByGsbm();
633 670 rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
634 671 return rs;
635 672 }
... ... @@ -674,4 +711,81 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
674 711 public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
675 712 return scheduleRealInfoService.deleteToHistory(id);
676 713 }
  714 +
  715 + @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)
  716 + public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){
  717 + Map<String, Object> map =new HashMap<>();
  718 + map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));
  719 + return map;
  720 + }
  721 +
  722 + /**
  723 + * 从历史库里删除临加班次
  724 + * @param sch
  725 + * @return
  726 + */
  727 + @RequestMapping(value = "wxsb", method = RequestMethod.POST)
  728 + public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){
  729 + SysUser user = SecurityUtils.getCurrentUser();
  730 + String uname = user.getUserName();
  731 + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url"));
  732 + url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType"));
  733 + // 分公司保存格式 分公司编码_公司编码
  734 + String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm"));
  735 + String[] arr = val.split("_");
  736 + if (!"22".equals(arr[1])) {
  737 + Map<String, Object> res = new HashMap<String, Object>();
  738 + res.put("status", ResponseCode.ERROR);
  739 + res.put("msg", "除金高公司外暂未开通此功能");
  740 +
  741 + return res;
  742 + }
  743 + url.append("&fgs=").append(arr[0]);
  744 +
  745 + return request(url.toString());
  746 + }
  747 +
  748 + @SuppressWarnings("unchecked")
  749 + private static Map<String, Object> request(String url) {
  750 + Map<String, Object> res = new HashMap<String, Object>();
  751 + res.put("status", ResponseCode.SUCCESS);
  752 + InputStream in = null;
  753 + HttpURLConnection con = null;
  754 + try {
  755 + con = (HttpURLConnection)new URL(url).openConnection();
  756 + con.setRequestMethod("POST");
  757 + con.setRequestProperty("keep-alive", "true");
  758 + con.setRequestProperty("accept", "application/json");
  759 + con.setRequestProperty("content-type", "application/json");
  760 + con.setDoInput(true);
  761 + con.setReadTimeout(2500);
  762 + con.setConnectTimeout(2500);
  763 +
  764 + con.connect();
  765 + if (con.getResponseCode() == 200) {
  766 + in = con.getInputStream();
  767 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  768 + IOUtils.copy(in, bout); bout.close();
  769 + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  770 + if (!"报修成功".equals(response.get("msg"))) {
  771 + res.put("status", ResponseCode.ERROR);
  772 + res.putAll(response);
  773 + }
  774 + }
  775 + } catch (IOException e) {
  776 + // TODO Auto-generated catch block
  777 + res.put("status", ResponseCode.ERROR);
  778 + res.put("msg", "调用上报接口异常");
  779 + } finally {
  780 + try {
  781 + if (in != null) in.close();
  782 + if (con != null) con.disconnect();
  783 + } catch (IOException e) {
  784 + // TODO Auto-generated catch block
  785 + e.printStackTrace();
  786 + }
  787 + }
  788 +
  789 + return res;
  790 + }
677 791 }
... ...
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
1 1 package com.bsth.controller.realcontrol;
2 2  
3 3 import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONArray;
  5 +import com.alibaba.fastjson.JSONObject;
  6 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  7 +import com.bsth.controller.realcontrol.dto.DftzAndDestroy;
4 8 import com.bsth.data.BasicData;
5 9 import com.bsth.data.directive.DayOfDirectives;
6 10 import com.bsth.data.directive.DirectiveCreator;
... ... @@ -8,10 +12,12 @@ import com.bsth.data.directive.GatewayHttpUtils;
8 12 import com.bsth.data.gpsdata_v2.GpsRealData;
9 13 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
10 14 import com.bsth.data.schedule.DayOfSchedule;
  15 +import com.bsth.data.schedule.external.TccExternalService;
11 16 import com.bsth.entity.directive.D60;
12 17 import com.bsth.entity.realcontrol.ScheduleRealInfo;
13 18 import com.bsth.repository.directive.D60Repository;
14 19 import com.google.common.base.Splitter;
  20 +import org.apache.commons.lang3.StringEscapeUtils;
15 21 import org.apache.commons.lang3.StringUtils;
16 22 import org.slf4j.Logger;
17 23 import org.slf4j.LoggerFactory;
... ... @@ -44,12 +50,16 @@ public class ServiceDataInterface {
44 50 @Autowired
45 51 GpsRealData gpsRealData;
46 52  
  53 + @Autowired
  54 + TccExternalService tccExternalService;
  55 +
47 56 /**
48 57 * 获取车辆 和 当前执行班次对照信息
  58 + *
49 59 * @return
50 60 */
51 61 @RequestMapping("/execSchList")
52   - public List<Map<String, Object>> execSchList(@RequestParam String secretKey){
  62 + public List<Map<String, Object>> execSchList(@RequestParam String secretKey) {
53 63 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
54 64 return null;
55 65  
... ... @@ -57,15 +67,15 @@ public class ServiceDataInterface {
57 67 Collection<ScheduleRealInfo> list = dayOfSchedule.execPlanMap().values();
58 68  
59 69 Map<String, Object> map;
60   - for(ScheduleRealInfo sch : list){
61   - if(null == sch)
  70 + for (ScheduleRealInfo sch : list) {
  71 + if (null == sch)
62 72 continue;
63 73 map = new HashMap<>();
64 74 map.put("clZbh", sch.getClZbh());
65 75 map.put("jGh", sch.getjGh());
66 76 map.put("jName", sch.getjName());
67 77 map.put("sGh", sch.getsGh());
68   - map.put("sName", sch.getsGh());
  78 + map.put("sName", sch.getsName());
69 79 map.put("lpName", sch.getLpName());
70 80 map.put("xlBm", sch.getXlBm());
71 81 map.put("xlName", sch.getXlName());
... ... @@ -79,6 +89,8 @@ public class ServiceDataInterface {
79 89 map.put("remarks", sch.getRemark());
80 90 map.put("status", sch.getStatus());
81 91  
  92 + //放站班次,放到的站点
  93 + map.put("majorStationName", sch.getMajorStationName());
82 94 rs.add(map);
83 95 }
84 96 return rs;
... ... @@ -93,7 +105,7 @@ public class ServiceDataInterface {
93 105 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
94 106 return null;
95 107  
96   - List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  108 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findByGsbm(companyId)), rs = new ArrayList<>();
97 109 for (ScheduleRealInfo sch : all) {
98 110 if (sch.getGsBm() != null
99 111 && sch.getGsBm().equals(companyId)
... ... @@ -105,7 +117,7 @@ public class ServiceDataInterface {
105 117 }
106 118  
107 119 @RequestMapping("/returnCCInfo")
108   - public List<ScheduleRealInfo> returnCCInfo(@RequestParam String companyId, @RequestParam String secretKey){
  120 + public List<ScheduleRealInfo> returnCCInfo(@RequestParam String companyId, @RequestParam String secretKey) {
109 121 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
110 122 return null;
111 123  
... ... @@ -123,7 +135,7 @@ public class ServiceDataInterface {
123 135 }
124 136  
125 137 @RequestMapping("/returnJCInfo")
126   - public List<ScheduleRealInfo> returnJCInfo(@RequestParam String companyId, @RequestParam String secretKey){
  138 + public List<ScheduleRealInfo> returnJCInfo(@RequestParam String companyId, @RequestParam String secretKey) {
127 139 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
128 140 return null;
129 141  
... ... @@ -141,10 +153,11 @@ public class ServiceDataInterface {
141 153  
142 154 /**
143 155 * 获取全量的进出场数据, 仅供接口项目调用。 由接口项目负责对外所有场站输出
  156 + *
144 157 * @return
145 158 */
146 159 @RequestMapping("/findCurrInAndOut")
147   - public List<ScheduleRealInfo> findCurrInAndOut(@RequestParam String secretKey){
  160 + public List<ScheduleRealInfo> findCurrInAndOut(@RequestParam String secretKey) {
148 161 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
149 162 return null;
150 163  
... ... @@ -161,30 +174,29 @@ public class ServiceDataInterface {
161 174  
162 175 /**
163 176 * 向指定的车辆下发消息短语
164   - * @param nbbm
165   - * @param txt
  177 + *
166 178 * @return
167 179 */
168 180 @RequestMapping(value = "/send60Phrase", method = RequestMethod.POST)
169   - public int send60Phrase(@RequestBody Map<String, String> map,@RequestParam String secretKey){
170   - try{
  181 + public int send60Phrase(@RequestBody Map<String, String> map, @RequestParam String secretKey) {
  182 + try {
171 183 String nbbm = map.get("nbbm");
172 184 String txt = map.get("txt");
173 185 String sender = map.get("sender");
174   - if(txt.length() > 50)
  186 + if (txt.length() > 50)
175 187 txt = txt.substring(0, 50);
176 188 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
177 189 return -500;
178 190  
179 191 //车辆和设备号对照
180 192 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
181   - if(StringUtils.isEmpty(deviceId))
  193 + if (StringUtils.isEmpty(deviceId))
182 194 return -404;
183 195  
184 196 //检查设备是否在线
185 197 long t = System.currentTimeMillis();
186 198 GpsEntity gps = gpsRealData.get(deviceId);
187   - if(null == gps || (t - gps.getServerTimestamp()) > 1000 * 60 * 5)
  199 + if (null == gps || (t - gps.getServerTimestamp()) > 1000 * 60 * 5)
188 200 return -405;
189 201  
190 202 Short dispatchInstruct = 0;//消息短语
... ... @@ -199,7 +211,7 @@ public class ServiceDataInterface {
199 211  
200 212 dayOfDirectives.put60(d60);
201 213 return d60.getMsgId();
202   - }catch (Exception e){
  214 + } catch (Exception e) {
203 215 logger.error("", e);
204 216 return -500;
205 217 }
... ... @@ -207,23 +219,24 @@ public class ServiceDataInterface {
207 219  
208 220 /**
209 221 * 根据msg id 查询指令响应情况
210   - * @param msgIDs
  222 + *
  223 + * @param msgIds
211 224 * @return
212 225 */
213 226 @RequestMapping("/findD60Reply")
214   - public List<Map<String, Object>> findD60Reply(@RequestParam String msgIds){
  227 + public List<Map<String, Object>> findD60Reply(@RequestParam String msgIds) {
215 228 List<Map<String, Object>> rs = new ArrayList<>();
216   - try{
  229 + try {
217 230 Map<String, Object> map = new HashMap();
218 231  
219 232 List<String> ids = Splitter.on(",").splitToList(msgIds);
220 233 D60 d60;
221   - for(String id : ids){
222   - if(StringUtils.isEmpty(id))
  234 + for (String id : ids) {
  235 + if (StringUtils.isEmpty(id))
223 236 continue;
224 237  
225 238 d60 = dayOfDirectives.get(Integer.parseInt(id));
226   - if(null == d60)
  239 + if (null == d60)
227 240 continue;
228 241  
229 242 map.put("msgId", d60.getMsgId());
... ... @@ -231,9 +244,60 @@ public class ServiceDataInterface {
231 244 map.put("jsyReplyTime", d60.getReply47Time());
232 245 rs.add(map);
233 246 }
234   - }catch (Exception e){
  247 + } catch (Exception e) {
235 248 logger.error("", e);
236 249 }
237 250 return rs;
238 251 }
  252 +
  253 + /**
  254 + * 获取路牌下所有班次
  255 + *
  256 + * @param lineCode
  257 + * @param lpName
  258 + * @return
  259 + */
  260 + @RequestMapping("/findByLpName")
  261 + public List<ScheduleRealInfo> findByLpName(@RequestParam String lineCode, @RequestParam String lpName, @RequestParam String secretKey) {
  262 + try {
  263 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  264 + return null;
  265 +
  266 + List<ScheduleRealInfo> list = dayOfSchedule.getLpScheduleMap().get(lineCode + "_" + lpName);
  267 + return list;
  268 + } catch (Exception e) {
  269 + logger.error("", e);
  270 + }
  271 + return null;
  272 + }
  273 +
  274 + /**
  275 + * 调整出场班次待发,并烂掉后续班次(调派用)
  276 + *
  277 + * @param dad
  278 + * @return
  279 + */
  280 + @RequestMapping(value = "/dftzAndDestroy", method = RequestMethod.POST)
  281 + public Map<String, Object> dftzAndDestroy(@RequestBody DftzAndDestroy dad, @RequestParam String secretKey) {
  282 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  283 + return null;
  284 + return tccExternalService.dftz(dad);
  285 + }
  286 +
  287 + /**
  288 + * 换人换车,(调派用)
  289 + * @return
  290 + */
  291 + @RequestMapping(value = "/tccHrhc", method = RequestMethod.POST)
  292 + public Map<String, Object> hrhc(@RequestBody String jsonStr, @RequestParam String secretKey){
  293 +
  294 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  295 + return null;
  296 +
  297 + jsonStr = StringEscapeUtils.unescapeHtml4(jsonStr);
  298 + JSONObject rootObj = JSON.parseObject(jsonStr);
  299 +
  300 + List<ChangePersonCar> cpcs = JSONArray.parseArray(rootObj.getString("cpcs"), ChangePersonCar.class);
  301 + return tccExternalService.hrhc(cpcs, rootObj.getString("tccCode"), rootObj.getString("userId"));
  302 + }
239 303 }
... ...
src/main/java/com/bsth/controller/realcontrol/dto/DftzAndDestroy.java 0 → 100644
  1 +package com.bsth.controller.realcontrol.dto;
  2 +
  3 +/**
  4 + * Created by panzhao on 2018/3/22.
  5 + */
  6 +public class DftzAndDestroy {
  7 +
  8 + /**
  9 + * 要调整待发的出场班次ID
  10 + */
  11 + private Long dftzId;
  12 +
  13 + /**
  14 + * 要设置的待发时间
  15 + */
  16 + private String newTimeStr;
  17 +
  18 + /**
  19 + * 要烂掉的班次的 班次id ,号分割多个
  20 + */
  21 + private String destroyIdx;
  22 +
  23 + /**
  24 + * 备注
  25 + */
  26 + private String remarks;
  27 +
  28 + private String reason;
  29 +
  30 + /**
  31 + * 调派工号
  32 + */
  33 + private String userId;
  34 +
  35 + public String getNewTimeStr() {
  36 + return newTimeStr;
  37 + }
  38 +
  39 + public void setNewTimeStr(String newTimeStr) {
  40 + this.newTimeStr = newTimeStr;
  41 + }
  42 +
  43 + public String getDestroyIdx() {
  44 + return destroyIdx;
  45 + }
  46 +
  47 + public void setDestroyIdx(String destroyIdx) {
  48 + this.destroyIdx = destroyIdx;
  49 + }
  50 +
  51 + public String getRemarks() {
  52 + return remarks;
  53 + }
  54 +
  55 + public void setRemarks(String remarks) {
  56 + this.remarks = remarks;
  57 + }
  58 +
  59 + public Long getDftzId() {
  60 + return dftzId;
  61 + }
  62 +
  63 + public void setDftzId(Long dftzId) {
  64 + this.dftzId = dftzId;
  65 + }
  66 +
  67 + public String getReason() {
  68 + return reason;
  69 + }
  70 +
  71 + public void setReason(String reason) {
  72 + this.reason = reason;
  73 + }
  74 +
  75 + public String getUserId() {
  76 + return userId;
  77 + }
  78 +
  79 + public void setUserId(String userId) {
  80 + this.userId = userId;
  81 + }
  82 +}
... ...
src/main/java/com/bsth/controller/report/CalcSheetController.java 0 → 100644
  1 +package com.bsth.controller.report;
  2 +import java.util.List;
  3 +import java.util.Map;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +import com.bsth.controller.BaseController;
  11 +import com.bsth.entity.sheet.CalcSheet;
  12 +import com.bsth.entity.sheet.Sheet;
  13 +import com.bsth.service.report.CalcSheetService;
  14 +
  15 +@RestController
  16 +@RequestMapping("calcSheet")
  17 +public class CalcSheetController extends BaseController<CalcSheet, Integer>{
  18 + @Autowired
  19 + CalcSheetService calcSheetService;
  20 + //发车到站准点率统计
  21 + @RequestMapping(value = "/countList",method = RequestMethod.GET)
  22 + public List<CalcSheet> countList(@RequestParam Map<String, Object> map){
  23 + List<CalcSheet> list=calcSheetService.countListCalcSheet(map);
  24 + return list;
  25 + }
  26 + //发车到站准点率列表
  27 + @RequestMapping(value = "/calcListSheet",method = RequestMethod.GET)
  28 + public List<CalcSheet> calcListSheet(@RequestParam Map<String, Object> map){
  29 + List<CalcSheet> list=calcSheetService.calcListSheet(map);
  30 + return list;
  31 + }
  32 + //发车站点准点率详细
  33 + @RequestMapping(value = "/calcSheet",method = RequestMethod.GET)
  34 + public List<Sheet> calcSheet(@RequestParam Map<String, Object> map){
  35 + List<Sheet> list=calcSheetService.calcSheet(map);
  36 + return list;
  37 + }
  38 +
  39 + //营运线路出车率统计
  40 + @RequestMapping(value = "/calcTurnoutrate",method = RequestMethod.GET)
  41 + public List<Map<String, Object>> calcTurnoutrate(@RequestParam Map<String, Object> map){
  42 + List<Map<String, Object>> list=calcSheetService.calcTurnoutrate(map);
  43 + return list;
  44 + }
  45 +
  46 +
  47 + @RequestMapping(value = "/calcTurnoutrateZgf",method = RequestMethod.GET)
  48 + public List<Map<String, Object>> calcTurnoutrateZgf(@RequestParam Map<String, Object> map){
  49 + List<Map<String, Object>> list=calcSheetService.calcTurnoutrateZgf(map);
  50 + return list;
  51 + }
  52 +}
... ...
src/main/java/com/bsth/controller/report/ReportController.java
1 1 package com.bsth.controller.report;
2 2  
  3 +import java.text.SimpleDateFormat;
3 4 import java.util.ArrayList;
4 5 import java.util.HashMap;
5 6 import java.util.Iterator;
... ... @@ -15,8 +16,10 @@ import org.springframework.web.bind.annotation.RestController;
15 16  
16 17 import com.alibaba.fastjson.JSONArray;
17 18 import com.alibaba.fastjson.JSONObject;
  19 +import com.bsth.data.BasicData;
18 20 import com.bsth.entity.StationRoute;
19 21 import com.bsth.entity.excep.ArrivalInfo;
  22 +import com.bsth.entity.mcy_forms.Singledata;
20 23 import com.bsth.entity.realcontrol.ScheduleRealInfo;
21 24 import com.bsth.service.report.ReportService;
22 25 import com.bsth.util.ReportUtils;
... ... @@ -51,6 +54,7 @@ public class ReportController {
51 54 Map<String, Object> m = new HashMap<String, Object>();
52 55 m.put("i", i);
53 56 m.put("nbbm", a.getNbbm());
  57 + m.put("pzh", a.getPzh());
54 58 m.put("stopName", a.getStopName());
55 59 m.put("jzsj", a.getJzsj());
56 60 m.put("czsj", a.getCzsj());
... ... @@ -65,13 +69,15 @@ public class ReportController {
65 69 resList.add(m);
66 70 i++;
67 71 }
68   -
69 72 try {
  73 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  74 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
70 75 Map<String, Object> map=new HashMap<String, Object>();
71 76 listI.add(resList.iterator());
72 77 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
73 78 ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
74   - path + "export/班次到离站.xls");
  79 + path + "export/"+sdfSimple.format(sdfMonth.parse(date))
  80 + +"-"+clzbh+"-班次到离站.xls");
75 81 } catch (Exception e) {
76 82 e.printStackTrace();
77 83 }
... ... @@ -138,11 +144,23 @@ public class ReportController {
138 144 }
139 145  
140 146 try {
  147 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  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 + }
141 159 Map<String, Object> map=new HashMap<String, Object>();
142 160 listI.add(resList.iterator());
143 161 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
144 162 ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
145   - path + "export/班次到离站.xls");
  163 + path + "export/"+dateTime+"-"+lineName+"-班次到离站.xls");
146 164 } catch (Exception e) {
147 165 e.printStackTrace();
148 166 }
... ... @@ -186,11 +204,14 @@ public class ReportController {
186 204 lgqlList.add(newMap);
187 205 }
188 206 try {
  207 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  208 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
189 209 listI.add(fwqlList.iterator());
190 210 listI.add(lgqlList.iterator());
191 211 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
192 212 ee.excelReplace(listI, new Object[] { map }, path + "mould/jobSummary.xls",
193   - path + "export/调度员工作汇总日报.xls");
  213 + path + "export/"+sdfSimple.format(sdfMonth.parse(date))
  214 + +"-"+lineName+"-调度员工作汇总日报.xls");
194 215 } catch (Exception e) {
195 216 e.printStackTrace();
196 217 }
... ... @@ -337,10 +358,17 @@ public class ReportController {
337 358  
338 359 return lMap;
339 360 }
340   -
341   -
342 361 @RequestMapping(value="/online")
343 362 public Map<String, Object> online(@RequestParam Map<String, Object> map){
344 363 return service.online(map);
345 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 +
346 374 }
... ...
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
1 1 package com.bsth.controller.schedule.core;
2 2  
  3 +import com.bsth.common.Constants;
3 4 import com.bsth.common.ResponseCode;
4 5 import com.bsth.controller.schedule.BController;
5 6 import com.bsth.entity.schedule.CarConfigInfo;
  7 +import com.bsth.entity.sys.CompanyAuthority;
6 8 import com.bsth.repository.schedule.CarConfigInfoRepository;
7 9 import com.bsth.service.schedule.CarConfigInfoService;
8 10 import com.bsth.service.schedule.exception.ScheduleException;
... ... @@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
12 14 import org.springframework.web.bind.annotation.RequestParam;
13 15 import org.springframework.web.bind.annotation.RestController;
14 16  
  17 +import javax.servlet.http.HttpServletRequest;
  18 +import javax.servlet.http.HttpSession;
15 19 import java.util.HashMap;
16 20 import java.util.List;
17 21 import java.util.Map;
... ... @@ -58,4 +62,84 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; {
58 62  
59 63 return rtn;
60 64 }
  65 +
  66 + @RequestMapping(value = "/validate_cars_2", method = RequestMethod.GET)
  67 + public Map<String, Object> validate_cars(@RequestParam Integer xlId, @RequestParam Integer clId) {
  68 + Map<String, Object> rtn = new HashMap<>();
  69 + try {
  70 + carConfigInfoService.validate_cars(xlId, clId);
  71 + rtn.put("status", ResponseCode.SUCCESS);
  72 + } catch (ScheduleException exp) {
  73 + rtn.put("status", ResponseCode.ERROR);
  74 + rtn.put("msg", exp.getMessage());
  75 + }
  76 +
  77 + return rtn;
  78 + }
  79 +
  80 + @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET)
  81 + public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  82 + HttpSession session = request.getSession();
  83 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  84 +
  85 + Map<String, Object> rtn = new HashMap<>();
  86 + try {
  87 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  88 + null,
  89 + param.get("xl.id_eq"),
  90 + param.get("xl.name_eq"),
  91 + param.get("cl.id_eq")
  92 + );
  93 + carConfigInfoService.validate_cars_gs(carConfigInfo, cmyAuths);
  94 + rtn.put("status", ResponseCode.SUCCESS);
  95 + } catch (ScheduleException exp) {
  96 + rtn.put("status", ResponseCode.ERROR);
  97 + rtn.put("msg", exp.getMessage());
  98 + }
  99 +
  100 + return rtn;
  101 + }
  102 +
  103 + @RequestMapping(value = "/validate_cars_fgs", method = RequestMethod.GET)
  104 + public Map<String, Object> validate_cars_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  105 + HttpSession session = request.getSession();
  106 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  107 +
  108 + Map<String, Object> rtn = new HashMap<>();
  109 + try {
  110 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  111 + null,
  112 + param.get("xl.id_eq"),
  113 + param.get("xl.name_eq"),
  114 + param.get("cl.id_eq")
  115 + );
  116 + carConfigInfoService.validate_cars_fgs(carConfigInfo, cmyAuths);
  117 + rtn.put("status", ResponseCode.SUCCESS);
  118 + } catch (ScheduleException exp) {
  119 + rtn.put("status", ResponseCode.ERROR);
  120 + rtn.put("msg", exp.getMessage());
  121 + }
  122 +
  123 + return rtn;
  124 + }
  125 +
  126 + @RequestMapping(value = "/validate_cars_config", method = RequestMethod.GET)
  127 + public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) {
  128 + Map<String, Object> rtn = new HashMap<>();
  129 + try {
  130 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  131 + null,
  132 + param.get("xl.id_eq"),
  133 + param.get("xl.name_eq"),
  134 + param.get("cl.id_eq")
  135 + );
  136 + carConfigInfoService.validate_cars_config(carConfigInfo);
  137 + rtn.put("status", ResponseCode.SUCCESS);
  138 + } catch (ScheduleException exp) {
  139 + rtn.put("status", ResponseCode.ERROR);
  140 + rtn.put("msg", exp.getMessage());
  141 + }
  142 +
  143 + return rtn;
  144 + }
61 145 }
... ...
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
1 1 package com.bsth.controller.schedule.core;
2 2  
  3 +import com.bsth.common.Constants;
3 4 import com.bsth.common.ResponseCode;
4 5 import com.bsth.controller.schedule.BController;
5 6 import com.bsth.entity.schedule.EmployeeConfigInfo;
  7 +import com.bsth.entity.sys.CompanyAuthority;
6 8 import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
7 9 import com.bsth.service.schedule.EmployeeConfigInfoService;
8 10 import com.bsth.service.schedule.exception.ScheduleException;
9 11 import org.springframework.beans.factory.annotation.Autowired;
10 12 import org.springframework.web.bind.annotation.*;
11 13  
  14 +import javax.servlet.http.HttpServletRequest;
  15 +import javax.servlet.http.HttpSession;
12 16 import java.util.HashMap;
13 17 import java.util.List;
14 18 import java.util.Map;
... ... @@ -70,6 +74,75 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo
70 74 return rtn;
71 75 }
72 76  
  77 + @RequestMapping(value = "/validate_jsy_config", method = RequestMethod.GET)
  78 + public Map<String, Object> validate_jsy_config(@RequestParam Map<String, Object> param) {
  79 + Map<String, Object> rtn = new HashMap<>();
  80 + try {
  81 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  82 + null,
  83 + param.get("xl.id_eq"),
  84 + param.get("xl.name_eq"),
  85 + param.get("jsy.id_eq"),
  86 + null
  87 + );
  88 + employeeConfigInfoService.validate_jsy_config(employeeConfigInfo);
  89 + rtn.put("status", ResponseCode.SUCCESS);
  90 + } catch (ScheduleException exp) {
  91 + rtn.put("status", ResponseCode.ERROR);
  92 + rtn.put("msg", exp.getMessage());
  93 + }
  94 +
  95 + return rtn;
  96 + }
  97 +
  98 + @RequestMapping(value = "/validate_jsy_gs", method = RequestMethod.GET)
  99 + public Map<String, Object> validate_jsy_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  100 + HttpSession session = request.getSession();
  101 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  102 +
  103 + Map<String, Object> rtn = new HashMap<>();
  104 + try {
  105 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  106 + null,
  107 + param.get("xl.id_eq"),
  108 + param.get("xl.name_eq"),
  109 + param.get("jsy.id_eq"),
  110 + null
  111 + );
  112 + employeeConfigInfoService.validate_jsy_gs(employeeConfigInfo, cmyAuths);
  113 + rtn.put("status", ResponseCode.SUCCESS);
  114 + } catch (ScheduleException exp) {
  115 + rtn.put("status", ResponseCode.ERROR);
  116 + rtn.put("msg", exp.getMessage());
  117 + }
  118 +
  119 + return rtn;
  120 + }
  121 +
  122 + @RequestMapping(value = "/validate_jsy_fgs", method = RequestMethod.GET)
  123 + public Map<String, Object> validate_jsy_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  124 + HttpSession session = request.getSession();
  125 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  126 +
  127 + Map<String, Object> rtn = new HashMap<>();
  128 + try {
  129 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  130 + null,
  131 + param.get("xl.id_eq"),
  132 + param.get("xl.name_eq"),
  133 + param.get("jsy.id_eq"),
  134 + null
  135 + );
  136 + employeeConfigInfoService.validate_jsy_fgs(employeeConfigInfo, cmyAuths);
  137 + rtn.put("status", ResponseCode.SUCCESS);
  138 + } catch (ScheduleException exp) {
  139 + rtn.put("status", ResponseCode.ERROR);
  140 + rtn.put("msg", exp.getMessage());
  141 + }
  142 +
  143 + return rtn;
  144 + }
  145 +
73 146 @RequestMapping(value = "/validate_spy", method = RequestMethod.GET)
74 147 public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) {
75 148 Map<String, Object> rtn = new HashMap<>();
... ... @@ -89,4 +162,70 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo
89 162 }
90 163 return rtn;
91 164 }
  165 +
  166 + @RequestMapping(value = "/validate_spy_config", method = RequestMethod.GET)
  167 + public Map<String, Object> validate_spy_config(@RequestParam Map<String, Object> param) {
  168 + Map<String, Object> rtn = new HashMap<>();
  169 + try {
  170 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  171 + null,
  172 + param.get("xl.id_eq"),
  173 + param.get("xl.name_eq"),
  174 + null,
  175 + param.get("spy.id_eq")
  176 + );
  177 + employeeConfigInfoService.validate_spy_config(employeeConfigInfo);
  178 + rtn.put("status", ResponseCode.SUCCESS);
  179 + } catch (ScheduleException exp) {
  180 + rtn.put("status", ResponseCode.ERROR);
  181 + rtn.put("msg", exp.getMessage());
  182 + }
  183 + return rtn;
  184 + }
  185 +
  186 + @RequestMapping(value = "/validate_spy_gs", method = RequestMethod.GET)
  187 + public Map<String, Object> validate_spy_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  188 + HttpSession session = request.getSession();
  189 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  190 +
  191 + Map<String, Object> rtn = new HashMap<>();
  192 + try {
  193 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  194 + null,
  195 + param.get("xl.id_eq"),
  196 + param.get("xl.name_eq"),
  197 + null,
  198 + param.get("spy.id_eq")
  199 + );
  200 + employeeConfigInfoService.validate_spy_gs(employeeConfigInfo, cmyAuths);
  201 + rtn.put("status", ResponseCode.SUCCESS);
  202 + } catch (ScheduleException exp) {
  203 + rtn.put("status", ResponseCode.ERROR);
  204 + rtn.put("msg", exp.getMessage());
  205 + }
  206 + return rtn;
  207 + }
  208 +
  209 + @RequestMapping(value = "/validate_spy_fgs", method = RequestMethod.GET)
  210 + public Map<String, Object> validate_spy_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  211 + HttpSession session = request.getSession();
  212 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  213 +
  214 + Map<String, Object> rtn = new HashMap<>();
  215 + try {
  216 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  217 + null,
  218 + param.get("xl.id_eq"),
  219 + param.get("xl.name_eq"),
  220 + null,
  221 + param.get("spy.id_eq")
  222 + );
  223 + employeeConfigInfoService.validate_spy_fgs(employeeConfigInfo, cmyAuths);
  224 + rtn.put("status", ResponseCode.SUCCESS);
  225 + } catch (ScheduleException exp) {
  226 + rtn.put("status", ResponseCode.ERROR);
  227 + rtn.put("msg", exp.getMessage());
  228 + }
  229 + return rtn;
  230 + }
92 231 }
... ...
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
... ... @@ -57,4 +57,21 @@ public class SchedulePlanController extends BController&lt;SchedulePlan, Long&gt; {
57 57 return rtn;
58 58 }
59 59  
  60 + /**
  61 + * 验证排班计划时间范围内规则的正确性。
  62 + * @return
  63 + * @throws Exception
  64 + */
  65 + @RequestMapping(value = "/valttrule/{xlid}/{from}/{to}", method = RequestMethod.GET)
  66 + public Map<String, Object> validateRule(
  67 + @PathVariable(value = "xlid") Integer xlid,
  68 + @PathVariable(value = "from") Date from,
  69 + @PathVariable(value = "to") Date to
  70 + ) throws Exception {
  71 + Map<String, Object> rtn = new HashMap<>();
  72 + rtn.put("status", ResponseCode.SUCCESS);
  73 + rtn.put("data", schedulePlanService.validateRule(xlid, from, to));
  74 + return rtn;
  75 + }
  76 +
60 77 }
... ...
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
... ... @@ -6,7 +6,9 @@ import com.bsth.entity.schedule.TTInfoDetail;
6 6 import com.bsth.service.schedule.TTInfoDetailService;
7 7 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
8 8 import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData;
  9 +import com.bsth.service.schedule.timetable.ExcelFormatType;
9 10 import com.bsth.service.schedule.utils.DataToolsFile;
  11 +import com.bsth.service.schedule.utils.DataToolsFileType;
10 12 import org.springframework.beans.factory.annotation.Autowired;
11 13 import org.springframework.web.bind.annotation.*;
12 14  
... ... @@ -41,13 +43,14 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
41 43 */
42 44 @RequestMapping(value = "/validate/sheet", method = RequestMethod.POST)
43 45 public Map<String, Object> validate_sheet(
44   - String filename, String sheetname, Integer lineid, String linename, Integer lineversion) {
  46 + String filename, String sheetname, Integer lineid, String linename, Integer lineversion, String excelFormatType) {
45 47 Map<String, Object> rtn = new HashMap<>();
46 48 try {
47 49 if (lineversion == null) {
48 50 throw new Exception("线路版本未知");
49 51 }
50   - ttInfoDetailService.validateExcelSheet(filename, sheetname, lineid, linename, lineversion);
  52 + ttInfoDetailService.validateExcelSheet(filename, sheetname, lineid, linename, lineversion,
  53 + ExcelFormatType.getEnum(excelFormatType));
51 54 rtn.put("status", ResponseCode.SUCCESS);
52 55 } catch (Exception exp) {
53 56 rtn.put("status", ResponseCode.ERROR);
... ... @@ -126,11 +129,19 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
126 129 }
127 130  
128 131  
129   - @RequestMapping(value = "/exportDTDFile", method = RequestMethod.POST)
  132 + @RequestMapping(value = "/exportDTDFile/{type}", method = RequestMethod.POST)
130 133 public void exportFile(
131   - @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos,
  134 + @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos, @PathVariable("type") String type,
132 135 HttpServletResponse response) throws Exception {
133   - DataToolsFile dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos);
  136 + DataToolsFile dataToolsFile = null;
  137 + if ("xls".equals(type)) {
  138 + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLS);
  139 + } else if ("xlsx".equals(type)) {
  140 + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLSX);
  141 + } else {
  142 + throw new Exception("未知的导出格式==>" + type);
  143 + }
  144 +
134 145 // 流输出导出文件
135 146 response.setHeader("content-type", "application/octet-stream");
136 147 response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
... ...
src/main/java/com/bsth/data/BasicData.java
... ... @@ -28,7 +28,7 @@ public class BasicData {
28 28 //公司代码和公司名对照(K: 公司编码,V:公司名)
29 29 public static Map<String, String> businessCodeNameMap;
30 30  
31   - //分公司公司代码和分公司公司名对照(K: 公司编码_分公司编码,V:分公司公司名)
  31 + //分公司公司代码和分公司公司名对照(K: 分公司编码_公司编码,V:分公司公司名)
32 32 public static Map<String, String> businessFgsCodeNameMap;
33 33  
34 34 //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号)
... ... @@ -36,6 +36,9 @@ public class BasicData {
36 36  
37 37 //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码)
38 38 public static Map<String, String> nbbm2CompanyCodeMap;
  39 +
  40 + //车辆自编号和分公司代码对照 (K: 车辆自编号 ,V:分公司编码_公司编码)
  41 + public static Map<String, String> nbbm2FgsCompanyCodeMap;
39 42  
40 43 //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号)
41 44 public static Map<String, String> nbbmCompanyPlateMap;
... ... @@ -52,6 +55,7 @@ public class BasicData {
52 55 //线路编码和名称对照
53 56 public static Map<String, String> lineCode2NameMap;
54 57  
  58 + public static Map<String, String> lineCodeAllNameMap;
55 59 //停车场
56 60 public static List<String> parkCodeList;
57 61  
... ... @@ -141,6 +145,7 @@ public class BasicData {
141 145 */
142 146 public int loadAllData() {
143 147 try {
  148 + logger.info("开始加载基础数据..,");
144 149 //设备信息
145 150 loadDeviceInfo();
146 151 //站点信息
... ... @@ -154,6 +159,7 @@ public class BasicData {
154 159 //公司信息
155 160 loadBusinessInfo();
156 161  
  162 + logger.info("load geo cache..,");
157 163 geoCacheData.loadData();
158 164 station2ParkBuffer.saveAll();
159 165 logger.info("加载基础数据成功!,");
... ... @@ -189,6 +195,8 @@ public class BasicData {
189 195 BiMap<String, String> deviceId2Nbbm = HashBiMap.create();
190 196 //车辆和公司代码对照
191 197 Map<String, String> nbbm2CompanyCode = new HashMap<>();
  198 + //车辆和分公司代码对照
  199 + Map<String, String> nbbm2FgsCompanyCode = new HashMap<>();
192 200  
193 201 //车辆自编号和拍照号对照
194 202 Map<String, String> nbbmCompanyPlate = new HashMap<>();
... ... @@ -199,11 +207,13 @@ public class BasicData {
199 207 car = carIterator.next();
200 208 deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode());
201 209 nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode());
  210 + nbbm2FgsCompanyCode.put(car.getInsideCode(), car.getBrancheCompanyCode() + "_" + car.getBusinessCode() );
202 211 nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate());
203 212 }
204 213  
205 214 deviceId2NbbmMap = deviceId2Nbbm;
206 215 nbbm2CompanyCodeMap = nbbm2CompanyCode;
  216 + nbbm2FgsCompanyCodeMap = nbbm2FgsCompanyCode;
207 217 nbbmCompanyPlateMap =nbbmCompanyPlate;
208 218 }
209 219  
... ... @@ -247,6 +257,8 @@ public class BasicData {
247 257 CarConfigInfo cci;
248 258 while (allIterator.hasNext()) {
249 259 cci = allIterator.next();
  260 + if(cci.getIsCancel())
  261 + continue;//排除已经报废的
250 262 ccMap.put(cci.getCl().getInsideCode(), cci.getXl());
251 263 }
252 264 nbbm2LineMap = ccMap;
... ... @@ -304,6 +316,14 @@ public class BasicData {
304 316 lineId2ShangHaiCodeMap = id2SHcode;
305 317 lineCode2ShangHaiCodeMap = code2SHcode;
306 318 stationName2YgcNumber = tempStationName2YgcNumber;
  319 +
  320 + Map<String, String> code2nameAll = new HashMap<>();
  321 + Iterator<Line> iteratorAll = lineRepository.findAll().iterator();
  322 + while (iteratorAll.hasNext()) {
  323 + line = iteratorAll.next();
  324 + code2nameAll.put(line.getLineCode(), line.getName());
  325 + }
  326 + lineCodeAllNameMap=code2nameAll;
307 327 }
308 328  
309 329 /**
... ...
src/main/java/com/bsth/data/Station2ParkBuffer.java
... ... @@ -50,6 +50,8 @@ public class Station2ParkBuffer implements CommandLineRunner {
50 50  
51 51 public static StationToPark get(String lineCode, String sName, String eName) {
52 52 List<StationToPark> list = get(lineCode);
  53 + if(null == list)
  54 + return null;
53 55 StationToPark stp = null;
54 56 for (StationToPark s : list) {
55 57 if (s.getStationName().equals(sName) && s.getParkName().equals(eName)) {
... ...
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
... ... @@ -74,7 +74,6 @@ public class CarOutInfoHandler {
74 74 save(pstList);
75 75 pstList.clear();
76 76 xlMaps.clear();
77   - //logger.info("更新发车信息表!!");
78 77 }catch (Exception e){
79 78 logger.error("", e);
80 79 }
... ...
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
... ... @@ -142,7 +142,7 @@ public class DirectivesPstThread extends Thread {
142 142  
143 143 tran.commit(status);
144 144  
145   - logger.info("64 入库成功: " + d64s.size());
  145 + //logger.info("64 入库成功: " + d64s.size());
146 146 }catch (Exception e){
147 147 tran.rollback(status);
148 148 logger.error("", e);
... ...
src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
... ... @@ -129,8 +129,11 @@ public class GpsRealData {
129 129 Set<String> nbbmSet = dayOfSchedule.findCarByLineCode(lineCode);//计划用车
130 130  
131 131 Map<String, String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
  132 + String deviceId;
132 133 for(String nbbm : nbbmSet){
133   - set.add(nbbm2deviceMap.get(nbbm));
  134 + deviceId = nbbm2deviceMap.get(nbbm);
  135 + if(StringUtils.isNotEmpty(deviceId))
  136 + set.add(deviceId);
134 137 }
135 138  
136 139 List<GpsEntity> rs = new ArrayList<>();
... ...
src/main/java/com/bsth/data/gpsdata_v2/cache/GeoCacheData.java
... ... @@ -21,6 +21,8 @@ import org.springframework.stereotype.Component;
21 21 import java.sql.ResultSet;
22 22 import java.sql.SQLException;
23 23 import java.util.*;
  24 +import java.util.concurrent.ConcurrentHashMap;
  25 +import java.util.concurrent.ConcurrentMap;
24 26  
25 27 /**
26 28 * 空间数据缓存
... ... @@ -38,7 +40,7 @@ public class GeoCacheData {
38 40 /**
39 41 * 路段编码和名称对照
40 42 */
41   - private static Map<String, String> sectionCode2Name;
  43 + private static ConcurrentMap<String, String> sectionCode2Name;
42 44 /**
43 45 * 线路站点路由
44 46 */
... ... @@ -50,15 +52,15 @@ public class GeoCacheData {
50 52 /**
51 53 * 线路_上下行_站点编码 ——> 站点
52 54 */
53   - private static Map<String, StationRoute> routeCodeMap;
  55 + private static ConcurrentMap<String, StationRoute> routeCodeMap;
54 56 /**
55 57 * 停车场
56 58 */
57   - public static Map<String, Polygon> tccMap;
  59 + public static ConcurrentMap<String, Polygon> tccMap;
58 60 /**
59 61 * 线路限速信息
60 62 */
61   - private static Map<String, Double> speedLimitMap;
  63 + private static ConcurrentMap<String, Double> speedLimitMap;
62 64  
63 65 @Autowired
64 66 JdbcTemplate jdbcTemplate;
... ... @@ -118,7 +120,7 @@ public class GeoCacheData {
118 120 //按线路和走向分组
119 121 if (routeList.size() > 0) {
120 122 ArrayListMultimap<String, StationRoute> tempMap = ArrayListMultimap.create();
121   - Map<String, StationRoute> codeMap = new HashMap<>(routeList.size());
  123 + ConcurrentMap<String, StationRoute> codeMap = new ConcurrentHashMap<>(routeList.size());
122 124 for (StationRoute sr : routeList) {
123 125 tempMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr);
124 126 //站点编码 ——> 和路由顺序对照
... ... @@ -141,7 +143,7 @@ public class GeoCacheData {
141 143 //加载停车场数据
142 144 String sql = "select PARK_CODE, ST_AsText(G_PARK_POINT) as G_PARK_POINT from bsth_c_car_park where park_code is not null and b_park_point is not null and destroy=0";
143 145 List<Map<String, Object>> tccList = jdbcTemplate.queryForList(sql);
144   - Map<String, Polygon> tccTempMap = new HashMap<>();
  146 + ConcurrentMap<String, Polygon> tccTempMap = new ConcurrentHashMap<>();
145 147  
146 148 Polygon polygon;
147 149 for (Map<String, Object> tMap : tccList) {
... ... @@ -163,7 +165,7 @@ public class GeoCacheData {
163 165 //加载线路限速信息
164 166 String sql = "select l.LINE_CODE,i.SPEEDING from bsth_c_line_information i left join bsth_c_line l on i.line=l.id where i.speed_limit is not null";
165 167 List<Map<String, Object>> speedMap = jdbcTemplate.queryForList(sql);
166   - Map<String, Double> speedTempMap = new HashMap<>();
  168 + ConcurrentMap<String, Double> speedTempMap = new ConcurrentHashMap();
167 169 for (Map<String, Object> tMap : speedMap) {
168 170 try {
169 171 speedTempMap.put(tMap.get("LINE_CODE").toString(), Double.parseDouble(tMap.get("SPEEDING").toString()));
... ... @@ -208,7 +210,7 @@ public class GeoCacheData {
208 210 if(sectionCacheTempMap.size() > 0)
209 211 sectionCacheMap = sectionCacheTempMap;
210 212  
211   - Map<String, String> sectionCode2NameTemp = new HashMap<>();
  213 + ConcurrentMap<String, String> sectionCode2NameTemp = new ConcurrentHashMap<>();
212 214  
213 215 //加载全量路段编码和名称对照
214 216 sql = "select SECTION_CODE,SECTION_NAME,CROSES_ROAD from bsth_c_section";
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
... ... @@ -81,10 +81,15 @@ public class InStationProcess {
81 81 * @param prev
82 82 */
83 83 private void inStation(GpsEntity gps, GpsEntity prev) {
  84 + logger.info("进站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")");
84 85 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
85 86 boolean flow = true;
86 87 //要经过2个中途站才能进
87 88 int count = GpsCacheData.lastInTrailsSize(gps);
  89 + if (null != sch)
  90 + logger.info("班次id: -" + sch.getId() + " count:" + count+" sch.getZdzCode(): "+sch.getZdzCode()+" sch.getZdzCode(): "+sch.getZdzCode()+" gps.getCarparkNo() :"+gps.getCarparkNo());
  91 + else
  92 + logger.info("sch is null....");
88 93 List<StationRoute> routes = GeoCacheData.getStationRoute(gps.getLineId(), gps.getUpDown());
89 94 if (null != sch && isNormalSch(sch) && gps.getInstation() == 1 && routes.size() > 4
90 95 && count < 2) {
... ... @@ -120,7 +125,7 @@ public class InStationProcess {
120 125 private void inEndStation(ScheduleRealInfo sch, GpsEntity gps) {
121 126 String nbbm = sch.getClZbh();
122 127 //校验进站前置约束
123   - if (!validInPremise(gps))
  128 + if (!validInPremise(gps) && isNormalSch(sch))
124 129 return;
125 130  
126 131 //实达时间不覆盖
... ... @@ -132,8 +137,6 @@ public class InStationProcess {
132 137  
133 138 sch.setZdsjActualAll(rsT);
134 139 sch.setSiginCompate(2);
135   - //通知误点停靠程序,有车辆到站
136   - LateAdjustHandle.carArrive(gps);
137 140  
138 141 //持久化
139 142 dayOfSchedule.save(sch);
... ... @@ -147,6 +150,10 @@ public class InStationProcess {
147 150 else
148 151 dayOfSchedule.removeExecPlan(nbbm);
149 152  
  153 + //通知误点停靠程序,有车辆到站
  154 + LateAdjustHandle.carArrive(gps, next);
  155 + //LateAdjustHandle.carArrive(gps);
  156 +
150 157 //路牌的下一个班次,页面显示起点实际到达时间
151 158 ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch);
152 159 if (lpNext != null) {
... ... @@ -158,7 +165,7 @@ public class InStationProcess {
158 165 //webSocket
159 166 sendUtils.sendZdsj(sch, lpNext, doneSum);
160 167  
161   - logger.info("车辆:" + nbbm + " 班次:" + sch.getDfsj() + "到终点, 时间:" + sch.getZdsjActual());
  168 + logger.info("车辆:" + nbbm + " 班次:" + sch.getDfsj() + "到终点, 时间:" + sch.getZdsjActual() + " -stopNo: " + gps.getStopNo());
162 169  
163 170 //清除车辆误点调整监听
164 171 LateAdjustHandle.remove(sch);
... ... @@ -220,12 +227,12 @@ public class InStationProcess {
220 227 private void inStationAndInPark(ScheduleRealInfo sch, ScheduleRealInfo next) {
221 228 LineConfig config = lineConfigData.get(sch.getXlBm());
222 229 //限定出站既出场的停车场
223   - String park = config.getTwinsPark();
224   - boolean limitPark = StringUtils.isNotEmpty(park);
  230 + List<String> parks = config.findTwinsParkList();
  231 + boolean limitPark = null != parks && parks.size() > 0;
225 232  
226 233  
227 234 if (next.getBcType().equals("in") && config.getOutConfig() == 2 && isEmptyMileage(next)
228   - && (!limitPark || park.equals(next.getZdzCode()))) {
  235 + && (!limitPark || parks.contains(next.getZdzCode()))) {
229 236  
230 237 endSch(next, sch.getZdsjActualTime());
231 238  
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
... ... @@ -16,6 +16,8 @@ import org.slf4j.LoggerFactory;
16 16 import org.springframework.beans.factory.annotation.Autowired;
17 17 import org.springframework.stereotype.Component;
18 18  
  19 +import java.util.List;
  20 +
19 21 /**
20 22 * 车辆出站处理程序
21 23 * Created by panzhao on 2017/11/16.
... ... @@ -72,8 +74,13 @@ public class OutStationProcess {
72 74 * @param gps
73 75 */
74 76 private void outStation(GpsEntity gps, GpsEntity prev) {
  77 + logger.info("出站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")");
75 78 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
76 79  
  80 + if (null != sch)
  81 + logger.info("班次id: " + sch.getId() + " sch.getQdzCode():" + sch.getQdzCode() + " prev.getStopNo():" + prev.getStopNo() + " prev.getStopNo():" + prev.getStopNo() + " sch.getQdzCode():" + sch.getQdzCode() +" prev.getCarparkNo() :"+prev.getCarparkNo()+" diff :"+((int) (sch.getDfsjT() - gps.getTimestamp()))+" dayOfSchedule.isFirstOut(sch) && diff"+(dayOfSchedule.isFirstOut(sch))+" sch.getFcsjActual():"+sch.getFcsjActual()+" StringUtils.isNotEmpty(sch.getFcsjActual())&& !outManyFit(gps, sch) :"+(StringUtils.isNotEmpty(sch.getFcsjActual())&& !outManyFit(gps, sch))+ ")");
  82 + else
  83 + logger.info("sch is null....");
77 84 //起点发车
78 85 if (null != sch &&
79 86 ((sch.getQdzCode().equals(prev.getStopNo())
... ... @@ -159,14 +166,14 @@ public class OutStationProcess {
159 166 try {
160 167 LineConfig config = lineConfigData.get(sch.getXlBm());
161 168 //限定出站既出场的停车场
162   - String park = config.getTwinsPark();
163   - boolean limitPark = StringUtils.isNotEmpty(park);
  169 + List<String> parks = config.findTwinsParkList();
  170 + boolean limitPark = null != parks && parks.size() > 0;
164 171  
165 172 if (config != null && config.getOutConfig() == 2) {
166 173 //出站既出场
167 174 ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
168 175 if (isOut(schPrev) && isEmptyMileage(schPrev)
169   - && (!limitPark || park.equals(schPrev.getQdzCode()))) {
  176 + && (!limitPark || parks.contains(schPrev.getQdzCode()))) {
170 177  
171 178 endSch(schPrev, sch.getFcsjActualTime());
172 179  
... ...
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
... ... @@ -20,12 +20,12 @@ import java.util.List;
20 20 * Created by panzhao on 2017/4/6.
21 21 */
22 22 @Component
23   -public class SafeDrivDataLoadThread extends Thread{
  23 +public class SafeDrivDataLoadThread extends Thread {
24 24  
25 25 Logger logger = LoggerFactory.getLogger(this.getClass());
26 26  
27 27 static String url;
28   - static CloseableHttpClient httpClient = null;
  28 + static CloseableHttpClient httpClient;
29 29 static HttpGet get;
30 30 static RequestConfig requestConfig;
31 31 static CloseableHttpResponse response;
... ... @@ -33,12 +33,12 @@ public class SafeDrivDataLoadThread extends Thread{
33 33 static BufferedReader br;
34 34  
35 35 static {
36   - url = "http://180.166.5.82:9007/bsth-safedriving/Crlcxb/realtimeInterface.do";
  36 + url = "http://211.95.61.66:9007/bsth-safedriving/Crlcxb/realtimeInterface.do";
37 37 httpClient = HttpClients.createDefault();
38 38 get = new HttpGet(url);
39 39 requestConfig = RequestConfig.custom()
40   - .setConnectTimeout(2500).setConnectionRequestTimeout(2000)
41   - .setSocketTimeout(2500).build();
  40 + .setConnectTimeout(5500).setConnectionRequestTimeout(5000)
  41 + .setSocketTimeout(5500).build();
42 42 get.setConfig(requestConfig);
43 43 }
44 44  
... ... @@ -51,9 +51,7 @@ public class SafeDrivDataLoadThread extends Thread{
51 51  
52 52 int statusCode = response.getStatusLine().getStatusCode();
53 53 if(statusCode != 200){
54   - get.abort();
55 54 logger.error("http client status code: " + statusCode);
56   - return;
57 55 }
58 56  
59 57 entity = response.getEntity();
... ... @@ -67,7 +65,7 @@ public class SafeDrivDataLoadThread extends Thread{
67 65  
68 66 list = JSON.parseArray(stringBuffer.toString(), SafeDriv.class);
69 67  
70   - for(SafeDriv sd : list){
  68 + for (SafeDriv sd : list) {
71 69 SafeDrivCenter.put(sd);
72 70 }
73 71 }
... ... @@ -75,7 +73,7 @@ public class SafeDrivDataLoadThread extends Thread{
75 73 if (null != response)
76 74 response.close();
77 75 } catch (Exception e) {
78   - logger.error("安全驾驶接口报错了" , e.getMessage());
  76 + logger.error("安全驾驶接口报错了", e);
79 77 }
80 78 }
81 79 }
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -16,6 +16,8 @@ import com.bsth.service.schedule.SchedulePlanInfoService;
16 16 import com.bsth.websocket.handler.SendUtils;
17 17 import com.google.common.collect.ArrayListMultimap;
18 18 import com.google.common.collect.HashMultimap;
  19 +import com.google.common.collect.ListMultimap;
  20 +import com.google.common.collect.Multimaps;
19 21 import org.apache.commons.lang3.StringUtils;
20 22 import org.joda.time.format.DateTimeFormat;
21 23 import org.joda.time.format.DateTimeFormatter;
... ... @@ -38,6 +40,7 @@ import java.text.SimpleDateFormat;
38 40 import java.util.*;
39 41 import java.util.concurrent.ConcurrentHashMap;
40 42 import java.util.concurrent.ConcurrentLinkedQueue;
  43 +import java.util.concurrent.ConcurrentMap;
41 44  
42 45 /**
43 46 * @author PanZhao
... ... @@ -53,20 +56,23 @@ public class DayOfSchedule {
53 56 //按线路分组的 “原始计划” 排班数据
54 57 public static Map<String, List<SchedulePlanInfo>> schedulePlanMap;
55 58  
56   - // 按车辆分组的班次数据
57   - private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap;
  59 + // 按车辆索引的班次数据
  60 + private static ListMultimap<String, ScheduleRealInfo> nbbmScheduleMap;
58 61  
59   - //按线路分组计划用车
  62 + // 按营运公司索引的班次数据
  63 + private static ListMultimap<String, ScheduleRealInfo> gsBmScheduleMap;
  64 +
  65 + //按线路索引计划用车
60 66 private static HashMultimap<String, String> lineNbbmsMap;
61 67  
62   - //按路牌分组的班次数据 线路编码_路牌名称 ——> 班次list
  68 + //按路牌索引班次数据 线路编码_路牌名称 ——> 班次list
63 69 private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap;
64 70  
65 71 // 班次主键映射
66   - private static Map<Long, ScheduleRealInfo> id2SchedulMap;
  72 + private static ConcurrentMap<Long, ScheduleRealInfo> id2SchedulMap;
67 73  
68 74 //车辆 ——> 当前执行班次
69   - private static Map<String, ScheduleRealInfo> carExecutePlanMap;
  75 + private static ConcurrentMap<String, ScheduleRealInfo> carExecutePlanMap;
70 76  
71 77 // 持久化
72 78 public static ConcurrentLinkedQueue<ScheduleRealInfo> pstBuffer;
... ... @@ -103,6 +109,9 @@ public class DayOfSchedule {
103 109  
104 110 static {
105 111 nbbmScheduleMap = ArrayListMultimap.create();
  112 + nbbmScheduleMap = Multimaps.synchronizedListMultimap(nbbmScheduleMap);
  113 +
  114 + gsBmScheduleMap = ArrayListMultimap.create();
106 115 lpScheduleMap = ArrayListMultimap.create();
107 116 lineNbbmsMap = HashMultimap.create();
108 117  
... ... @@ -324,7 +333,7 @@ public class DayOfSchedule {
324 333 * @Description: TODO(从计划排班表加载数据)
325 334 */
326 335 public List<ScheduleRealInfo> loadPlanSch(String lineCode, String schDate) {
327   - logger.info("从计划排班表恢复排班,lineCode: " + lineCode + ", schDate: " + schDate);
  336 + //logger.info("从计划排班表恢复排班,lineCode: " + lineCode + ", schDate: " + schDate);
328 337 List<ScheduleRealInfo> realList = new ArrayList<>();
329 338  
330 339 try {
... ... @@ -340,6 +349,7 @@ public class DayOfSchedule {
340 349  
341 350 // 转换为实际排班
342 351 realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class);
  352 + logger.info("从计划排班表恢复排班,lineCode: " + lineCode + ", schDate: " + schDate + ", size:" + realList.size());
343 353  
344 354 Date d = new Date();
345 355 SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
... ... @@ -610,8 +620,8 @@ public class DayOfSchedule {
610 620 outConfig = config.getOutConfig();
611 621  
612 622 //限定出站既出场的停车场
613   - String park = config.getTwinsPark();
614   - boolean limitPark = StringUtils.isNotEmpty(park);
  623 + List<String> parks = config.findTwinsParkList();
  624 + boolean limitPark = null != parks && parks.size() > 0;
615 625 boolean flag = false;
616 626 ScheduleRealInfo next = null;
617 627 for (ScheduleRealInfo temp : list) {
... ... @@ -624,8 +634,8 @@ public class DayOfSchedule {
624 634 continue;
625 635  
626 636 //出站既出场,忽略出场班次
627   - if (outConfig == 2 && temp.getBcType().equals("out") && (temp.getBcsj()==0 || temp.getJhlcOrig().equals(0))
628   - && (!limitPark || park.equals(temp.getQdzCode())))
  637 + if (outConfig == 2 && temp.getBcType().equals("out") && isEmptyMileage(temp)
  638 + && (!limitPark || parks.contains(temp.getQdzCode())))
629 639 continue;
630 640  
631 641 if (flag) {
... ... @@ -636,6 +646,10 @@ public class DayOfSchedule {
636 646 return next;
637 647 }
638 648  
  649 + private boolean isEmptyMileage(ScheduleRealInfo sch) {
  650 + return sch.getBcsj() == 0 || sch.getJhlcOrig().intValue() == 0;
  651 + }
  652 +
639 653 /**
640 654 * 下一个班次
641 655 *
... ... @@ -672,8 +686,8 @@ public class DayOfSchedule {
672 686 outConfig = config.getOutConfig();
673 687  
674 688 //限定出站既出场的停车场
675   - String park = config.getTwinsPark();
676   - boolean limitPark = StringUtils.isNotEmpty(park);
  689 + List<String> parks = config.findTwinsParkList();
  690 + boolean limitPark = null != parks && parks.size() > 0;
677 691 boolean flag = false;
678 692 ScheduleRealInfo next = null;
679 693 for (ScheduleRealInfo temp : list) {
... ... @@ -683,8 +697,8 @@ public class DayOfSchedule {
683 697 }
684 698  
685 699 //出站既出场,忽略出场班次
686   - if (outConfig == 2 && temp.getBcType().equals("out") && (temp.getBcsj()==0 || temp.getJhlcOrig().equals(0))
687   - && (!limitPark || park.equals(temp.getQdzCode())))
  700 + if (outConfig == 2 && temp.getBcType().equals("out") && isEmptyMileage(temp)
  701 + && (!limitPark || parks.contains(temp.getQdzCode())))
688 702 continue;
689 703  
690 704 if (flag) {
... ... @@ -979,18 +993,21 @@ public class DayOfSchedule {
979 993 String rq = currSchDateMap.get(lineCode);
980 994 if (StringUtils.isNotEmpty(rq)) {
981 995 List<ScheduleRealInfo> all = findByLineCode(lineCode);
982   - //解除gps 和班次之间的关联
983   - List<ScheduleRealInfo> unions = calcUnion(all, carExecutePlanMap.values());
984   - for (ScheduleRealInfo sch : unions) {
985   - removeExecPlan(sch.getClZbh());
986   - }
987   - //解除调度指令和班次的外键约束
988   - StringBuilder inStr = new StringBuilder("(");
989   - for (ScheduleRealInfo sch : all) {
990   - inStr.append(sch.getId() + ",");
  996 +
  997 + if(null != all && all.size() > 0){
  998 + //解除gps 和班次之间的关联
  999 + List<ScheduleRealInfo> unions = calcUnion(all, carExecutePlanMap.values());
  1000 + for (ScheduleRealInfo sch : unions) {
  1001 + removeExecPlan(sch.getClZbh());
  1002 + }
  1003 + //解除调度指令和班次的外键约束
  1004 + StringBuilder inStr = new StringBuilder("(");
  1005 + for (ScheduleRealInfo sch : all) {
  1006 + inStr.append(sch.getId() + ",");
  1007 + }
  1008 + inStr.deleteCharAt(inStr.length() - 1).append(")");
  1009 + jdbcTemplate.update(Constants.MULTI_REMOVE_DIRECTIVE_SCH_FK + " " + inStr.toString());
991 1010 }
992   - inStr.deleteCharAt(inStr.length() - 1).append(")");
993   - jdbcTemplate.update(Constants.MULTI_REMOVE_DIRECTIVE_SCH_FK + " " + inStr.toString());
994 1011  
995 1012 //删除班次数据
996 1013 removeRealSch(lineCode, rq);
... ... @@ -1095,7 +1112,7 @@ public class DayOfSchedule {
1095 1112 */
1096 1113 public int reCalcIdMaps(){
1097 1114 Collection<ScheduleRealInfo> all = findAll();
1098   - Map<Long, ScheduleRealInfo> id2SchedulMapCopy = new ConcurrentHashMap<>();
  1115 + ConcurrentMap<Long, ScheduleRealInfo> id2SchedulMapCopy = new ConcurrentHashMap<>();
1099 1116  
1100 1117 for(ScheduleRealInfo sch : all){
1101 1118 id2SchedulMapCopy.put(sch.getId(), sch);
... ... @@ -1123,4 +1140,42 @@ public class DayOfSchedule {
1123 1140 public String sizeString(){
1124 1141 return id2SchedulMap.size() + "/" + nbbmScheduleMap.size();
1125 1142 }
  1143 +
  1144 +
  1145 + /**
  1146 + * 按公司编码分组数据
  1147 + */
  1148 + public void groupByGsbm(){
  1149 + Collection<ScheduleRealInfo> all = findAll();
  1150 + ListMultimap<String, ScheduleRealInfo> gsBmMaps = ArrayListMultimap.create();
  1151 +
  1152 + for(ScheduleRealInfo sch : all){
  1153 + gsBmMaps.put(sch.getGsBm(), sch);
  1154 + }
  1155 +
  1156 + if(gsBmMaps.size() > 0){
  1157 + gsBmScheduleMap = null;
  1158 + gsBmScheduleMap = gsBmMaps;
  1159 + }
  1160 + }
  1161 +
  1162 + public Collection<ScheduleRealInfo> findByGsbm(String gsbm){
  1163 + return gsBmScheduleMap.get(gsbm);
  1164 + }
  1165 + /**
  1166 + * 删除班次,删除内存中未清理掉的非当天的班次
  1167 + * @createDate 2019.05.13
  1168 + * @author zhangxianzhou
  1169 + * @param sch
  1170 + */
  1171 + public void deleteBC(ScheduleRealInfo sch) {
  1172 + nbbmScheduleMap.remove(sch.getClZbh(), sch);
  1173 + id2SchedulMap.remove(sch.getId());
  1174 + lpScheduleMap.remove(sch.getXlBm() + "_" + sch.getLpName(), sch);
  1175 + //如果正在执行该班次
  1176 + if (carExecutePlanMap.get(sch.getClZbh()) == sch) {
  1177 + //重新计算车辆当前执行班次
  1178 + reCalcExecPlan(sch.getClZbh());
  1179 + }
  1180 + }
1126 1181 }
1127 1182 \ No newline at end of file
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -213,12 +213,12 @@ public class SchAttrCalculator {
213 213  
214 214 int outConfig = -1;
215 215 //限定出站既出场的停车场
216   - String park = null;
  216 + List<String> parks = null;
217 217 if (conf != null) {
218 218 outConfig = conf.getOutConfig();
219   - park = conf.getTwinsPark();
  219 + parks = conf.findTwinsParkList();
220 220 }
221   - boolean limitPark = StringUtils.isNotEmpty(park);
  221 + boolean limitPark = null != parks && parks.size() > 0;
222 222  
223 223 ScheduleRealInfo sch, prev = null;
224 224 for(int i = list.size() - 1; i >= 0; i --){
... ... @@ -226,7 +226,7 @@ public class SchAttrCalculator {
226 226  
227 227 //如果是出站既出场,忽略出场班次
228 228 if (outConfig == 2 && sch.getBcType().equals("out")
229   - && (!limitPark || park.equals(sch.getQdzCode()))
  229 + && (!limitPark || parks.contains(sch.getQdzCode()))
230 230 && (sch.getBcsj()==0 || sch.getJhlcOrig().intValue()==0))
231 231 continue;
232 232  
... ...
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
... ... @@ -9,12 +9,10 @@ import java.util.HashMap;
9 9 import java.util.Map;
10 10  
11 11 /**
12   - *
13   - * @ClassName: ScheduleComparator
14   - * @Description: TODO(实际班次排序器)
15 12 * @author PanZhao
16   - * @date 2016年8月15日 下午1:53:28
17   - *
  13 + * @ClassName: ScheduleComparator
  14 + * @Description: TODO(实际班次排序器)
  15 + * @date 2016年8月15日 下午1:53:28
18 16 */
19 17 public class ScheduleComparator {
20 18  
... ... @@ -26,71 +24,62 @@ public class ScheduleComparator {
26 24 }*/
27 25  
28 26  
29   - static Map<String, Integer> bcTypeOrderMap = new HashMap<>();
  27 + static Map<String, Integer> bcTypeOrderMap = new HashMap<>();
30 28  
31   - static{
32   - bcTypeOrderMap.put("out", 0);
33   - bcTypeOrderMap.put("normal", 1);
34   - bcTypeOrderMap.put("region", 2);
35   - bcTypeOrderMap.put("major", 3);
36   - bcTypeOrderMap.put("venting", 4);
37   - bcTypeOrderMap.put("ldks", 5);
38   - bcTypeOrderMap.put("in", 6);
39   - }
40   -
41   - public static class FCSJ implements Comparator<ScheduleRealInfo>{
  29 + static {
  30 + bcTypeOrderMap.put("out", 0);
  31 + bcTypeOrderMap.put("normal", 1);
  32 + bcTypeOrderMap.put("region", 2);
  33 + bcTypeOrderMap.put("major", 3);
  34 + bcTypeOrderMap.put("venting", 4);
  35 + bcTypeOrderMap.put("ldks", 5);
  36 + bcTypeOrderMap.put("in", 6);
  37 + }
42 38  
43   - @Override
44   - public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
45   - int diff = (int) (s1.getFcsjT() - s2.getFcsjT());
46   - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
47   - }
48   - }
  39 + public static class FCSJ implements Comparator<ScheduleRealInfo> {
49 40  
50   - private static int typeOrder(String bcType){
51   - return bcTypeOrderMap.get(bcType)!=null?bcTypeOrderMap.get(bcType):0;
52   - }
  41 + @Override
  42 + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
  43 + int diff = (int) (s1.getFcsjT() - s2.getFcsjT());
  44 + return diff != 0 ? diff : typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  45 + }
  46 + }
  47 +
  48 + private static int typeOrder(String bcType) {
  49 + return bcTypeOrderMap.get(bcType) != null ? bcTypeOrderMap.get(bcType) : 0;
  50 + }
53 51  
54   - public static class DFSJ implements Comparator<ScheduleRealInfo>{
  52 + public static class DFSJ implements Comparator<ScheduleRealInfo> {
55 53  
56 54 static Logger logger = LoggerFactory.getLogger(DFSJ.class);
57 55  
58   - @Override
59   - public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
60   - try{
  56 + @Override
  57 + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
  58 + try {
  59 + int diff;
  60 + if (!s2.isSflj() && !s1.isSflj()) {
  61 + diff = (int) (s1.getFcsjT() - s2.getFcsjT());
61 62  
62   - if(!s1.getXlBm().equals(s2.getXlBm()) || !s1.getLpName().equals(s2.getLpName())){
63   - int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
64   - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
65   - }
66   - else{
67   - /**
68   - * 按时刻表发车顺序号
69   - */
70   - Integer fc1 = s1.getFcno();
71   - Integer fc2 = s2.getFcno();
72   - if(null != fc1 && null != fc2){
73   - return fc1.intValue()==fc2.intValue()?0:fc1.intValue()-fc2.intValue();
74   - }
75   - else{
76   - int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
77   - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
78   - }
  63 + } else {
  64 + diff = (int) (s1.getDfsjT() - s2.getDfsjT());
79 65 }
80   - }catch (Exception e){
  66 +
  67 + return diff != 0 ? diff : typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  68 +
  69 + } catch (Exception e) {
81 70 logger.error("排序异常", e);
82   - return s1.getDfsjT() - s2.getDfsjT() > 0?1:-1;
  71 + return s1.getDfsjT() - s2.getDfsjT() > 0 ? 1 : -1;
83 72 }
84   - }
85   - }
  73 + }
  74 + }
86 75  
87   - public static class DFSJ2 implements Comparator<ScheduleRealInfo>{
  76 + public static class DFSJ2 implements Comparator<ScheduleRealInfo> {
88 77  
89 78  
90 79 @Override
91 80 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
92 81 int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
93   - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  82 + return diff != 0 ? diff : typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
94 83 }
95 84 }
96 85 }
... ...
src/main/java/com/bsth/data/schedule/e_state_check/ScheduleStationCodeChecker.java 0 → 100644
  1 +package com.bsth.data.schedule.e_state_check;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.bsth.data.schedule.DayOfSchedule;
  5 +import com.bsth.data.schedule.e_state_check.entity.SCodeInfo;
  6 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  7 +import com.google.common.collect.ArrayListMultimap;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  12 +import org.springframework.jdbc.core.JdbcTemplate;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import java.util.*;
  16 +
  17 +/**
  18 + * 检查班次站点编码和路由编码是否相符合
  19 + * Created by panzhao on 2018/4/2.
  20 + */
  21 +@Component
  22 +public class ScheduleStationCodeChecker {
  23 +
  24 + @Autowired
  25 + DayOfSchedule dayOfSchedule;
  26 +
  27 + private static ArrayListMultimap<String, SCodeInfo> multimap;
  28 +
  29 + static {
  30 + multimap = ArrayListMultimap.create();
  31 + }
  32 +
  33 + @Autowired
  34 + JdbcTemplate jdbcTemplate;
  35 +
  36 + static Logger logger = LoggerFactory.getLogger(ScheduleStationCodeChecker.class);
  37 +
  38 + public static List<SCodeInfo> findByLineIdx(List<String> lineArray){
  39 + List<SCodeInfo> rs = new ArrayList<>();
  40 +
  41 + try{
  42 + for(String coed : lineArray){
  43 + rs.addAll(multimap.get(coed));
  44 + }
  45 + }catch (Exception e){
  46 + logger.error("", e);
  47 + }
  48 + return rs;
  49 + }
  50 +
  51 + public void checkAll() {
  52 + try {
  53 + logger.info("start....");
  54 + List<ScheduleRealInfo> all = new ArrayList(dayOfSchedule.findAll());
  55 +
  56 + //按线路站点分组数据(上行)
  57 + Map<String, ScheduleRealInfo> ups = new HashMap<>();
  58 + //按线路站点分组数据(下行)
  59 + Map<String, ScheduleRealInfo> downs = new HashMap();
  60 +
  61 + String key;
  62 + for (ScheduleRealInfo sch : all) {
  63 + if (sch.getBcType().equals("out")
  64 + || sch.getBcType().equals("in"))
  65 + continue;
  66 +
  67 + key = sch.getXlBm() + "_" + sch.getXlDir() + "_";
  68 +
  69 + ups.put(key + sch.getQdzCode(), sch);
  70 + downs.put(key + sch.getZdzCode(), sch);
  71 + }
  72 +
  73 + //获取全部实际的站点编码
  74 + Map<String, SCodeInfo> realMap = allRealCodeInfo();
  75 +
  76 + List<SCodeInfo> rs = new ArrayList<>();
  77 + rs.addAll(checkCode(ups.values(), realMap, "qd"));
  78 + rs.addAll(checkCode(downs.values(), realMap, "zd"));
  79 +
  80 + //按线路分组
  81 + ArrayListMultimap<String, SCodeInfo> mList = ArrayListMultimap.create();
  82 + for (SCodeInfo sci : rs) {
  83 + mList.put(sci.getLineCode(), sci);
  84 + }
  85 +
  86 + multimap = mList;
  87 + logger.info("站点检查 end.... idx: " + (multimap.keySet().size() > 0 ? JSON.toJSONString(multimap.keySet()):"无"));
  88 + } catch (Exception e) {
  89 + logger.error("", e);
  90 + }
  91 + }
  92 +
  93 + private List<SCodeInfo> checkCode(Collection<ScheduleRealInfo> list, Map<String, SCodeInfo> realMap, String qdOrZd) {
  94 + List<SCodeInfo> rs = new ArrayList<>();
  95 + String k;
  96 + SCodeInfo sci;
  97 + for(ScheduleRealInfo sch : list){
  98 + k = sch.getXlBm() + "_" + sch.getXlDir() + "_";
  99 +
  100 + sci = realMap.get(k + getName(sch, qdOrZd));//名称和编码都不存在
  101 + if(null == sci && !realMap.containsKey(k + getCode(sch, qdOrZd))){
  102 + sci = SCodeInfo.getInstance(sch, qdOrZd);
  103 + rs.add(sci);
  104 + continue;
  105 + }
  106 + else if(null != sci && !codeEq(sci, getCode(sch, qdOrZd))){//名称一致的站点,编码不一致
  107 + sci.setStationCode(getCode(sch, qdOrZd));
  108 + rs.add(sci);
  109 + continue;
  110 + }
  111 + }
  112 + return rs;
  113 + }
  114 +
  115 + private boolean codeEq(SCodeInfo sci, String code){
  116 + return sci.getRealStationCode().equals(code) || sci.getRealStationCode().indexOf(code + "^") != -1;
  117 + }
  118 +
  119 + private String getName(ScheduleRealInfo sch, String qdOrZd) {
  120 + return qdOrZd.equals("qd")?sch.getQdzName():sch.getZdzName();
  121 + }
  122 +
  123 + private String getCode(ScheduleRealInfo sch, String qdOrZd) {
  124 + return qdOrZd.equals("qd")?sch.getQdzCode():sch.getZdzCode();
  125 + }
  126 +
  127 +
  128 + private Map<String, SCodeInfo> allRealCodeInfo() {
  129 + String sql = "select line_code,directions as up_down,station_code as real_station_code,station_name from bsth_c_stationroute where line in (select id from bsth_c_line where destroy=0) and destroy=0";
  130 + List<SCodeInfo> realList = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SCodeInfo.class));
  131 + Map<String, SCodeInfo> realMap = new HashMap<>();
  132 +
  133 + String kName;
  134 + SCodeInfo old;
  135 + for (SCodeInfo sci : realList) {
  136 + kName = sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getStationName();
  137 +
  138 + if(realMap.containsKey(kName)){
  139 + //环线可能存在同名的站点
  140 + old = realMap.get(kName);
  141 + old.setRealStationCode(old.getRealStationCode() + "^" + sci.getRealStationCode() + "^");
  142 + continue;
  143 + }
  144 +
  145 + realMap.put(kName, sci);
  146 + realMap.put(sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getRealStationCode(), sci);
  147 + }
  148 +
  149 + return realMap;
  150 + }
  151 +}
0 152 \ No newline at end of file
... ...
src/main/java/com/bsth/data/schedule/e_state_check/entity/SCodeInfo.java 0 → 100644
  1 +package com.bsth.data.schedule.e_state_check.entity;
  2 +
  3 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +
  5 +/**
  6 + * Created by panzhao on 2018/4/2.
  7 + */
  8 +public class SCodeInfo {
  9 +
  10 + /**
  11 + * 线路编码
  12 + */
  13 + private String lineCode;
  14 +
  15 + /**
  16 + * 上下行
  17 + */
  18 + private int upDown;
  19 +
  20 + /**
  21 + * 站点编码
  22 + */
  23 + private String stationCode;
  24 +
  25 + /**
  26 + * 站点名称
  27 + */
  28 + private String stationName;
  29 +
  30 + /**
  31 + * 实际站点编码
  32 + */
  33 + private String realStationCode;
  34 +
  35 + public String getLineCode() {
  36 + return lineCode;
  37 + }
  38 +
  39 + public void setLineCode(String lineCode) {
  40 + this.lineCode = lineCode;
  41 + }
  42 +
  43 + public int getUpDown() {
  44 + return upDown;
  45 + }
  46 +
  47 + public void setUpDown(int upDown) {
  48 + this.upDown = upDown;
  49 + }
  50 +
  51 + public String getStationCode() {
  52 + return stationCode;
  53 + }
  54 +
  55 + public void setStationCode(String stationCode) {
  56 + this.stationCode = stationCode;
  57 + }
  58 +
  59 + public String getStationName() {
  60 + return stationName;
  61 + }
  62 +
  63 + public void setStationName(String stationName) {
  64 + this.stationName = stationName;
  65 + }
  66 +
  67 + public String getRealStationCode() {
  68 + return realStationCode;
  69 + }
  70 +
  71 + public void setRealStationCode(String realStationCode) {
  72 + this.realStationCode = realStationCode;
  73 + }
  74 +
  75 + public static SCodeInfo getUpInstance(ScheduleRealInfo sch) {
  76 + SCodeInfo sci = new SCodeInfo();
  77 + sci.setLineCode(sch.getXlBm());
  78 + sci.setUpDown(Integer.parseInt(sch.getXlDir()));
  79 + sci.setStationName(sch.getQdzName());
  80 + sci.setStationCode(sch.getQdzCode());
  81 + return sci;
  82 + }
  83 +
  84 + public static SCodeInfo geDownInstance(ScheduleRealInfo sch) {
  85 + SCodeInfo sci = new SCodeInfo();
  86 + sci.setLineCode(sch.getXlBm());
  87 + sci.setUpDown(Integer.parseInt(sch.getXlDir()));
  88 + sci.setStationName(sch.getZdzName());
  89 + sci.setStationCode(sch.getZdzCode());
  90 + return sci;
  91 + }
  92 +
  93 + public static SCodeInfo getInstance(ScheduleRealInfo sch, String qdOrZd) {
  94 + return qdOrZd.equals("qd")?getUpInstance(sch):geDownInstance(sch);
  95 + }
  96 +}
... ...
src/main/java/com/bsth/data/schedule/e_state_check/thread/FixedCheckStationCodeThread.java 0 → 100644
  1 +package com.bsth.data.schedule.e_state_check.thread;
  2 +
  3 +import com.bsth.data.schedule.e_state_check.ScheduleStationCodeChecker;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +/**
  10 + * 定时检查班次站点编码线程
  11 + * Created by panzhao on 2018/4/2.
  12 + */
  13 +@Component
  14 +public class FixedCheckStationCodeThread extends Thread {
  15 +
  16 + @Autowired
  17 + ScheduleStationCodeChecker scheduleStationCodeChecker;
  18 +
  19 + Logger logger = LoggerFactory.getLogger(this.getClass());
  20 +
  21 + @Override
  22 + public void run() {
  23 + try {
  24 + scheduleStationCodeChecker.checkAll();
  25 + } catch (Exception e) {
  26 + logger.error("", e);
  27 + }
  28 + }
  29 +}
... ...
src/main/java/com/bsth/data/schedule/edit_logs/FormLogger.java
... ... @@ -37,7 +37,7 @@ public class FormLogger {
37 37 /**
38 38 * 换人换车情况表
39 39 */
40   - public void saveChangetochange(ScheduleRealInfo sch, ChangePersonCar cpc){
  40 + public void saveChangetochange(ScheduleRealInfo sch, ChangePersonCar cpc, String userId){
41 41 try {
42 42 String newNbbm = cpc.getClZbh();
43 43 String newJsy = cpc.getJsy();
... ... @@ -51,7 +51,6 @@ public class FormLogger {
51 51 return;
52 52  
53 53 Date d = new Date();
54   - SysUser user = SecurityUtils.getCurrentUser();
55 54 Changetochange cc = new Changetochange();
56 55 cc.setRq(sch.getScheduleDateStr());
57 56 cc.setGs(sch.getGsBm());
... ... @@ -61,8 +60,13 @@ public class FormLogger {
61 60 cc.setFssj(sch.getFcsj());
62 61 cc.setXgsj(fmtHHmm.print(d.getTime()));
63 62 cc.setsId(sch.getId());
64   - if(user != null)
  63 +
  64 + if(StringUtils.isEmpty(userId)){
  65 + SysUser user = SecurityUtils.getCurrentUser();
65 66 cc.setXgr(user.getUserName());
  67 + }
  68 + else
  69 + cc.setXgr(userId);
66 70  
67 71 cc.setPcch(sch.getClZbh());
68 72 cc.setPcry(oldJsy);
... ... @@ -86,7 +90,7 @@ public class FormLogger {
86 90 ChangePersonCar cpc = new ChangePersonCar();
87 91 cpc.setClZbh(nbbm);
88 92 cpc.setJsy(jsy);
89   - saveChangetochange(sch, cpc);
  93 + saveChangetochange(sch, cpc, null);
90 94 }
91 95  
92 96 public void saveDb(){
... ...
src/main/java/com/bsth/data/schedule/edit_logs/ScheduleModifyLogger.java
... ... @@ -28,14 +28,14 @@ public class ScheduleModifyLogger {
28 28  
29 29 /**
30 30 * 待发调整
31   - * opType 0: 双击调整、 1:待发调整、2:批量待发调整、3:间隔调整
  31 + * opType 0: 双击调整、 1:待发调整、2:批量待发调整、3:间隔调整、4:调派系统调整
32 32 */
33   - public static void dftz(ScheduleRealInfo sch, String opType, String oldDfsj, String nowDfsj, String remarks) {
  33 + public static void dftz(ScheduleRealInfo sch, String opType, String oldDfsj, String nowDfsj, String remarks, String userId) {
34 34 try {
35 35 if (oldDfsj.equals(nowDfsj))
36 36 return;
37 37  
38   - SchEditInfo sei = SchEditInfo.getInstance(sch);
  38 + SchEditInfo sei = SchEditInfo.getInstance(sch, userId);
39 39 sei.setType(EditType.DFTZ);
40 40 sei.setType2(opType);
41 41 sei.setRemarks(remarks == null ? "" : remarks);
... ... @@ -78,9 +78,9 @@ public class ScheduleModifyLogger {
78 78 *
79 79 * @param remarks
80 80 */
81   - public static void jhlb(ScheduleRealInfo sch, String remarks) {
  81 + public static void jhlb(ScheduleRealInfo sch, String remarks, String userId) {
82 82 try {
83   - SchEditInfo sei = SchEditInfo.getInstance(sch);
  83 + SchEditInfo sei = SchEditInfo.getInstance(sch, userId);
84 84 sei.setRemarks(remarks);
85 85 sei.setType(EditType.JHLB);
86 86  
... ... @@ -182,7 +182,7 @@ public class ScheduleModifyLogger {
182 182 * @param sch
183 183 * @param cpc
184 184 */
185   - public static void tzrc(ScheduleRealInfo sch, ChangePersonCar cpc) {
  185 + public static void tzrc(ScheduleRealInfo sch, ChangePersonCar cpc, String userId) {
186 186 try {
187 187 String newNbbm = cpc.getClZbh();
188 188 String newJsy = cpc.getJsy();
... ... @@ -218,7 +218,7 @@ public class ScheduleModifyLogger {
218 218 if(jobj.size() == 0)
219 219 return;
220 220  
221   - SchEditInfo sei = SchEditInfo.getInstance(sch);
  221 + SchEditInfo sei = SchEditInfo.getInstance(sch, userId);
222 222 sei.setType(EditType.TZRC);
223 223  
224 224 sei.setJsonArray(jobj.toJSONString());
... ...
src/main/java/com/bsth/data/schedule/edit_logs/entity/SchEditInfo.java
... ... @@ -160,6 +160,26 @@ public class SchEditInfo {
160 160 return sei;
161 161 }
162 162  
  163 + public static SchEditInfo getInstance(ScheduleRealInfo sch, String userId){
  164 + SchEditInfo sei = new SchEditInfo();
  165 + long t = System.currentTimeMillis();
  166 + sei.setTs(t);
  167 + sei.setTimeStr(fmtHHmm.print(t));
  168 + if(null != userId)
  169 + sei.setUser(userId);
  170 + else{
  171 + SysUser user = SecurityUtils.getCurrentUser();
  172 + if(user != null)
  173 + sei.setUser(user.getUserName());
  174 + }
  175 + sei.setRq(sch.getScheduleDateStr());
  176 + sei.setSchId(sch.getId());
  177 + sei.setLineCode(sch.getXlBm());
  178 + sei.setGsbm(sch.getGsBm());
  179 + sei.setFgsbm(sch.getFgsBm());
  180 + return sei;
  181 + }
  182 +
163 183 public String getLineCode() {
164 184 return lineCode;
165 185 }
... ...
src/main/java/com/bsth/data/schedule/external/TccExternalService.java 0 → 100644
  1 +package com.bsth.data.schedule.external;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  5 +import com.bsth.controller.realcontrol.dto.DftzAndDestroy;
  6 +import com.bsth.data.schedule.DayOfSchedule;
  7 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  8 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
  9 +import com.bsth.websocket.handler.SendUtils;
  10 +import org.apache.commons.lang3.StringUtils;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +import java.util.*;
  17 +
  18 +/**
  19 + * 对停车场开放的班次调度服务
  20 + * Created by panzhao on 2018/3/22.
  21 + */
  22 +@Component
  23 +public class TccExternalService {
  24 +
  25 + Logger logger = LoggerFactory.getLogger(TccExternalService.class);
  26 +
  27 + @Autowired
  28 + DayOfSchedule dayOfSchedule;
  29 +
  30 + @Autowired
  31 + ScheduleRealInfoService scheduleRealInfoService;
  32 +
  33 + @Autowired
  34 + SendUtils sendUtils;
  35 +
  36 + /**
  37 + * 待发调整
  38 + *
  39 + * @param dad
  40 + * @return
  41 + */
  42 + public Map<String, Object> dftz(DftzAndDestroy dad) {
  43 + Map<String, Object> rs = new HashMap();
  44 + rs.put("status", ResponseCode.ERROR);
  45 + try {
  46 + List<ScheduleRealInfo> updateList = new ArrayList<>();//要刷新的班次
  47 + ScheduleRealInfo sch = dayOfSchedule.get(dad.getDftzId());
  48 + if (null == sch) {
  49 + rs.put("msg", "班次已经不存在了!");
  50 + return rs;
  51 + }
  52 +
  53 + if (!sch.getBcType().equals("out")) {
  54 + rs.put("msg", "只能操作出场班次!");
  55 + return rs;
  56 + }
  57 +
  58 + //调整待发时间
  59 + scheduleRealInfoService.outgoAdjust(sch.getId(), dad.getRemarks(), dad.getNewTimeStr(), sch.getBcType(), "4", dad.getUserId());
  60 + updateList.add(sch);
  61 +
  62 + //需要烂班的班次
  63 + if (StringUtils.isNotEmpty(dad.getDestroyIdx())) {
  64 + Map<String, Object> dMap =
  65 + scheduleRealInfoService.destroy(dad.getDestroyIdx(), dad.getRemarks(), dad.getReason(), dad.getUserId());
  66 +
  67 +
  68 + updateList.addAll((Collection<? extends ScheduleRealInfo>) dMap.get("ts"));
  69 + }
  70 +
  71 + //通知调度客户端更新班次信息
  72 + sendUpdate2Page(updateList);
  73 +
  74 + rs.put("status", ResponseCode.SUCCESS);
  75 + rs.put("t", sch);
  76 + } catch (Exception e) {
  77 + rs.put("msg", "内部调度服务接口出现异常!");
  78 + logger.error("", e);
  79 + }
  80 + return rs;
  81 + }
  82 +
  83 + /**
  84 + * 换人换车
  85 + *
  86 + * @param cpcs
  87 + * @return
  88 + */
  89 + public Map<String, Object> hrhc(List<ChangePersonCar> cpcs,String tccCode, String userId) {
  90 + Map<String, Object> rs = new HashMap();
  91 + rs.put("status", ResponseCode.ERROR);
  92 + try {
  93 + rs = scheduleRealInfoService.multi_tzrc(cpcs, userId);
  94 +
  95 + //通知调度客户端更新班次信息
  96 + sendUpdate2Page(new ArrayList<ScheduleRealInfo>((Set)rs.get("ts")));
  97 +
  98 + //返回更新结果集中指定停车场的进出场班次
  99 + Set<ScheduleRealInfo> ts = (Set<ScheduleRealInfo>) rs.get("ts");
  100 + List<ScheduleRealInfo> list = new ArrayList<>();
  101 + for(ScheduleRealInfo sch : ts){
  102 + if((sch.getBcType().equals("out") && sch.getQdzCode().equals(tccCode))
  103 + || (sch.getBcType().equals("in") && sch.getZdzCode().equals(tccCode)))
  104 + list.add(sch);
  105 + }
  106 + rs.put("list", list);
  107 + rs.remove("ts");
  108 + } catch (Exception e) {
  109 + rs.put("msg", "服务器出现异常!");
  110 + logger.error("", e);
  111 + }
  112 + return rs;
  113 + }
  114 +
  115 +
  116 + public void sendUpdate2Page(List<ScheduleRealInfo> list) {
  117 + sendUtils.refreshSch(list);
  118 + }
  119 +}
... ...
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
1 1  
2 2 package com.bsth.data.schedule.late_adjust;
3 3  
4   -import com.bsth.data.BasicData;
5 4 import com.bsth.data.LineConfigData;
6 5 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
7 6 import com.bsth.entity.realcontrol.LineConfig;
... ... @@ -16,17 +15,17 @@ import org.springframework.context.ApplicationContextAware;
16 15 import org.springframework.stereotype.Component;
17 16  
18 17 import java.util.Collection;
19   -import java.util.HashMap;
20   -import java.util.Map;
  18 +import java.util.concurrent.ConcurrentHashMap;
  19 +import java.util.concurrent.ConcurrentMap;
21 20  
22 21 /**
23 22 * 误点自动调整待发 处理程序
24   - *
  23 + * <p>
25 24 * 注意 :这里的误点是指应发未到
26 25 * Created by panzhao on 2017/4/16.
27 26 */
28 27 @Component
29   -public class LateAdjustHandle implements ApplicationContextAware{
  28 +public class LateAdjustHandle implements ApplicationContextAware {
30 29  
31 30 static LineConfigData lineConfigData;
32 31 static SendUtils sendUtils;
... ... @@ -34,61 +33,42 @@ public class LateAdjustHandle implements ApplicationContextAware{
34 33 static Logger logger = LoggerFactory.getLogger(LateAdjustHandle.class);
35 34  
36 35 /**
37   - * 应发未到车辆 和 班次
  36 + * 应发未到的班次 key : id
38 37 */
39   - private static Map<String, ScheduleRealInfo> lateSchMap;
  38 + private static ConcurrentMap<Long, ScheduleRealInfo> lateSchMap = new ConcurrentHashMap<>();
40 39  
41 40  
42   - static {
43   - lateSchMap = new HashMap<>();
44   - }
45   -
46 41 /**
47 42 * 新增一个误点班次
  43 + *
48 44 * @param sch
49 45 */
50   - public static void putLate(ScheduleRealInfo sch){
  46 + public static void putLate(ScheduleRealInfo sch) {
51 47 try {
52   - //出场班次不需要
53   - if(sch.getBcType().equals("out"))
54   - return;
55 48 //线路配置
56 49 LineConfig config = lineConfigData.get(sch.getXlBm());
57   - if(sch.getLateMinute() == 0){
58   - if(config.isEnableYjtk()){
59   - sch.setLateMinute(sch.getXlDir().equals("0")?config.getUpStopMinute():config.getDownStopMinute());
60   - }
61   - else
  50 + if (sch.getLateMinute() == 0) {
  51 + if (!config.isEnableYjtk())
62 52 return;
63   - }
64 53  
65   - if(sch.getDfsj().compareTo(config.getYjtkStart()) > 0
66   - && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){
  54 + sch.setLateMinute(sch.getXlDir().equals("0") ? config.getUpStopMinute() : config.getDownStopMinute());
  55 + }
67 56  
68   - ScheduleRealInfo cancel = null;
69   - //之前存在误点班次没有发出
70   - ScheduleRealInfo old = lateSchMap.get(sch.getClZbh());
  57 + if (sch.getDfsj().compareTo(config.getYjtkStart()) > 0
  58 + && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0) {
71 59  
72   - if(old != null && old.getDfsjT() < sch.getDfsjT()){
73   - //如果之前班次的 待发应到时间已经过了 3 分钟
74   - long t = System.currentTimeMillis();
75   - long dfEndTime = old.getDfsjT() + (old.getBcsj() * 60 * 1000);
76   - if((t - dfEndTime) > 1000 * 60 * 3){
  60 + //班次压入
  61 + if (!lateSchMap.containsKey(sch.getId())) {
  62 + logger.info("29【应发未到 班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");
77 63  
78   - remove(old);
79   - cancel = old;
80   - logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!");
81   - }
  64 + sch.setLate2(true);
  65 + lateSchMap.put(sch.getId(), sch);
  66 + //通知客户端
  67 + sendUtils.sendAutoWdtz(sch, null);
82 68 }
83   -
84   - lateSchMap.put(sch.getClZbh(), sch);
85   - //通知客户端
86   - sch.setLate2(true);
87   - sendUtils.sendAutoWdtz(sch, cancel);
88   -
89   - logger.info("【应发未到】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");
90 69 }
91   - }catch (Exception e){
  70 +
  71 + } catch (Exception e) {
92 72 logger.error("", e);
93 73 }
94 74 }
... ... @@ -96,85 +76,78 @@ public class LateAdjustHandle implements ApplicationContextAware{
96 76  
97 77 /**
98 78 * 获取所有应发未到的班次
  79 + *
99 80 * @return
100 81 */
101   - public static Collection<ScheduleRealInfo> allLateSch(){
  82 + public static Collection<ScheduleRealInfo> allLateSch() {
102 83 return lateSchMap.values();
103 84 }
104 85  
105   - public static void remove(ScheduleRealInfo sch){
  86 + public static void remove(ScheduleRealInfo sch) {
106 87 try {
107   - if(lateSchMap.get(sch.getClZbh()) == sch){
108   - lateSchMap.remove(sch.getClZbh());
  88 + if (lateSchMap.containsKey(sch.getId())) {
  89 + lateSchMap.remove(sch.getId());
  90 +
109 91 sch.setLate2(false);
110 92 sch.setLateMinute(0);
111 93 sch.setDfAuto(false);
112 94  
113   - logger.info("移除误点调整 -" + sch.getClZbh());
  95 + logger.info("移除误点调整 -" + sch.getClZbh() + " -time: " + sch.getDfsj() + " -id: " + sch.getId());
114 96 }
115   - }catch (Exception e){
  97 + } catch (Exception e) {
116 98 logger.error("", e);
117 99 }
118 100 }
119 101  
120   -/* public static void remove(String nbbm){
121   - if(lateSchMap.containsKey(nbbm)){
122   - ScheduleRealInfo sch = lateSchMap.get(nbbm);
123   - sch.setLate2(false);
124   - sch.setLateMinute(0);
125   - sch.setDfAuto(false);
126   -
127   - lateSchMap.remove(nbbm);
128   - logger.info("移除误点调整 nbbm -" + nbbm);
129   - }
130   - }*/
131   -
132 102 /**
133   - * 车辆到站
  103 + * 车辆到站 进站 进 的哪个班次,就调该车辆的下一个班次
  104 + *
134 105 * @param gps
135 106 */
136   - public static void carArrive(GpsEntity gps){
137   - try{
138   - if(gps.getInstation() != 1)
  107 + public static void carArrive(GpsEntity gps, ScheduleRealInfo sch) {
  108 + try {
  109 + if (gps.getInstation() <= 0 || null == sch)
139 110 return;
140 111  
141   - ScheduleRealInfo sch = lateSchMap.get(gps.getNbbm());
142   - if(sch == null)
143   - return;
  112 + if (!lateSchMap.containsKey(sch.getId())) {
  113 + //班次是否误点(可能处于误点线程扫描的空隙,所以再判定一次)
  114 + if (sch.getDfsjT() <= gps.getTimestamp()) {
  115 + putLate(sch);
  116 +
  117 + if (!lateSchMap.containsKey(sch.getId()))
  118 + return;
  119 +
  120 + logger.info("线程空隙漏掉的误点,id: " + sch.getId());
  121 + } else
  122 + return;
  123 + }
  124 +
144 125  
145 126 //可能是延迟信号,gps时间没有误点
146   - if(gps.getTimestamp() <= sch.getDfsjT()){
  127 + if (gps.getTimestamp() <= sch.getDfsjT()) {
147 128 sch.setLate2(false);
148   - lateSchMap.remove(sch.getClZbh());
  129 + lateSchMap.remove(sch.getId());
149 130 return;
150 131 }
151   - //进的是班次起点(名称一样即可)
152   - gps.setStationName(BasicData.stationCode2NameMap.get(gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo()));
153   - if(gps.getStationName().equals(sch.getQdzName())
154   - /*&& sch.getLateMinute() > 0*/){
155   - //自动调整待发 到达时间 + 停靠时间
156   - long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000));
157   -
158   - //超过2小时最大阈值,放弃 -临时代码,待删除
159   - if(Math.abs(dt - sch.getDfsjT()) > 1000 * 60 * 60 * 2){
160   - logger.info(sch.getClZbh() + " 超过误点调整阈值,放弃");
161   - }
162   - else{
163   - sch.setDfsjAll(dt);
164   - sch.setDfAuto(true);
165   - //取消应发未到标记
166   - sch.setLate2(false);
167   - }
168 132  
169   - lateSchMap.remove(sch.getClZbh());
170   - logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt);
171   - }
172   - }catch (Exception e){
  133 +
  134 + //自动调整待发 到达时间 + 停靠时间
  135 + long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000));
  136 +
  137 + sch.setDfsjAll(dt);
  138 + sch.setDfAuto(true);
  139 + //取消应发未到标记
  140 + sch.setLate2(false);
  141 +
  142 + lateSchMap.remove(sch.getId());
  143 + logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt + " -id:" + sch.getId());
  144 + } catch (Exception e) {
173 145 e.printStackTrace();
174 146 logger.error("late2 car arrive", e);
175 147 }
176 148 }
177 149  
  150 +
178 151 @Override
179 152 public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
180 153 lineConfigData = applicationContext.getBean(LineConfigData.class);
... ...
src/main/java/com/bsth/data/schedule/taopao/TaoPaoDataBuffer.java 0 → 100644
  1 +package com.bsth.data.schedule.taopao;
  2 +
  3 +import com.bsth.data.schedule.DayOfSchedule;
  4 +import com.bsth.data.schedule.taopao.entity.CLTaoPaoInfo;
  5 +import com.google.common.collect.ArrayListMultimap;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +/**
  10 + * 实际班次套跑信息
  11 + */
  12 +@Component
  13 +public class TaoPaoDataBuffer {
  14 +
  15 + /**
  16 + * 线路编码 ——> 套跑信息
  17 + */
  18 + private static ArrayListMultimap<String, CLTaoPaoInfo> multimap;
  19 +
  20 + static {
  21 + multimap = ArrayListMultimap.create();
  22 + }
  23 +
  24 + @Autowired
  25 + DayOfSchedule dayOfSchedule;
  26 +}
... ...
src/main/java/com/bsth/data/schedule/taopao/entity/CLTaoPaoInfo.java 0 → 100644
  1 +package com.bsth.data.schedule.taopao.entity;
  2 +
  3 +/**
  4 + * 车辆套跑 信息
  5 + */
  6 +public class CLTaoPaoInfo {
  7 +
  8 + private String lineCode;
  9 +
  10 + private String nbbm;
  11 +
  12 + /**
  13 + * 班次ID , 号分割多个
  14 + */
  15 + private String schIdx;
  16 +
  17 + public String getLineCode() {
  18 + return lineCode;
  19 + }
  20 +
  21 + public void setLineCode(String lineCode) {
  22 + this.lineCode = lineCode;
  23 + }
  24 +
  25 + public String getNbbm() {
  26 + return nbbm;
  27 + }
  28 +
  29 + public void setNbbm(String nbbm) {
  30 + this.nbbm = nbbm;
  31 + }
  32 +
  33 + public String getSchIdx() {
  34 + return schIdx;
  35 + }
  36 +
  37 + public void setSchIdx(String schIdx) {
  38 + this.schIdx = schIdx;
  39 + }
  40 +}
... ...
src/main/java/com/bsth/data/schedule/taopao/entity/TPCutRealSchedule.java 0 → 100644
  1 +package com.bsth.data.schedule.taopao.entity;
  2 +
  3 +import javax.persistence.Transient;
  4 +
  5 +/**
  6 + * 精简的班次信息(展示套跑信息用)
  7 + */
  8 +public class TPCutRealSchedule {
  9 +
  10 + /** 主键Id */
  11 + private Long id;
  12 +
  13 + /** 排班日期字符串 YYYY-MM-DD */
  14 + private String scheduleDateStr;
  15 +
  16 + /** 路牌名称 */
  17 + private String lpName;
  18 +
  19 + /** 车辆自编号 */
  20 + private String clZbh;
  21 +
  22 + /** 驾驶员工号 */
  23 + private String jGh;
  24 + /** 驾驶员名字 */
  25 + private String jName;
  26 + /** 售票员工号 */
  27 + private String sGh;
  28 + /** 售票员名字 */
  29 + private String sName;
  30 +
  31 + /** 线路方向 */
  32 + private String xlDir;
  33 + /** 起点站名字 */
  34 + private String qdzName;
  35 +
  36 + /** 终点站名字 */
  37 + private String zdzName;
  38 +
  39 + /** 计划发车时间(格式 HH:mm) */
  40 + private String fcsj;
  41 + /** 计划发车时间戳*/
  42 + @Transient
  43 + private Long fcsjT;
  44 +
  45 + /** 计划终点时间(格式 HH:mm) */
  46 + private String zdsj;
  47 + /** 计划终点时间戳*/
  48 + @Transient
  49 + private Long zdsjT;
  50 +
  51 + /** 计划里程 */
  52 + private Double jhlc;
  53 +
  54 + /** 班次历时 */
  55 + private Integer bcsj;
  56 +
  57 + /**
  58 + * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
  59 + */
  60 + private String bcType;
  61 +
  62 + //放站班次 站点名称
  63 + private String majorStationName;
  64 +
  65 + /** 实际发车时间*/
  66 + private String fcsjActual;
  67 + /**实际终点时间 */
  68 + private String zdsjActual;
  69 +
  70 + /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */
  71 + private int status;
  72 +
  73 + private String adjustExps;
  74 +
  75 + /** 是否是临加班次 */
  76 + private boolean sflj;
  77 +
  78 + /** 备注*/
  79 + private String remarks;
  80 +
  81 + /**待发时间(格式 HH:mm) */
  82 + private String dfsj;
  83 +
  84 + /**待发时间戳 */
  85 + @Transient
  86 + private Long dfsjT;
  87 +
  88 + /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */
  89 + private Integer directiveState = -1;
  90 +
  91 + /** 起点站计划到达时间 */
  92 + @Transient
  93 + private String qdzArrDatejh;
  94 +
  95 + /** 起点站实际到达时间 */
  96 + @Transient
  97 + private String qdzArrDatesj;
  98 +
  99 + public Long getId() {
  100 + return id;
  101 + }
  102 +
  103 + public void setId(Long id) {
  104 + this.id = id;
  105 + }
  106 +
  107 + public String getScheduleDateStr() {
  108 + return scheduleDateStr;
  109 + }
  110 +
  111 + public void setScheduleDateStr(String scheduleDateStr) {
  112 + this.scheduleDateStr = scheduleDateStr;
  113 + }
  114 +
  115 + public String getLpName() {
  116 + return lpName;
  117 + }
  118 +
  119 + public void setLpName(String lpName) {
  120 + this.lpName = lpName;
  121 + }
  122 +
  123 + public String getClZbh() {
  124 + return clZbh;
  125 + }
  126 +
  127 + public void setClZbh(String clZbh) {
  128 + this.clZbh = clZbh;
  129 + }
  130 +
  131 + public String getjGh() {
  132 + return jGh;
  133 + }
  134 +
  135 + public void setjGh(String jGh) {
  136 + this.jGh = jGh;
  137 + }
  138 +
  139 + public String getjName() {
  140 + return jName;
  141 + }
  142 +
  143 + public void setjName(String jName) {
  144 + this.jName = jName;
  145 + }
  146 +
  147 + public String getsGh() {
  148 + return sGh;
  149 + }
  150 +
  151 + public void setsGh(String sGh) {
  152 + this.sGh = sGh;
  153 + }
  154 +
  155 + public String getsName() {
  156 + return sName;
  157 + }
  158 +
  159 + public void setsName(String sName) {
  160 + this.sName = sName;
  161 + }
  162 +
  163 + public String getXlDir() {
  164 + return xlDir;
  165 + }
  166 +
  167 + public void setXlDir(String xlDir) {
  168 + this.xlDir = xlDir;
  169 + }
  170 +
  171 + public String getQdzName() {
  172 + return qdzName;
  173 + }
  174 +
  175 + public void setQdzName(String qdzName) {
  176 + this.qdzName = qdzName;
  177 + }
  178 +
  179 + public String getZdzName() {
  180 + return zdzName;
  181 + }
  182 +
  183 + public void setZdzName(String zdzName) {
  184 + this.zdzName = zdzName;
  185 + }
  186 +
  187 + public String getFcsj() {
  188 + return fcsj;
  189 + }
  190 +
  191 + public void setFcsj(String fcsj) {
  192 + this.fcsj = fcsj;
  193 + }
  194 +
  195 + public Long getFcsjT() {
  196 + return fcsjT;
  197 + }
  198 +
  199 + public void setFcsjT(Long fcsjT) {
  200 + this.fcsjT = fcsjT;
  201 + }
  202 +
  203 + public String getZdsj() {
  204 + return zdsj;
  205 + }
  206 +
  207 + public void setZdsj(String zdsj) {
  208 + this.zdsj = zdsj;
  209 + }
  210 +
  211 + public Long getZdsjT() {
  212 + return zdsjT;
  213 + }
  214 +
  215 + public void setZdsjT(Long zdsjT) {
  216 + this.zdsjT = zdsjT;
  217 + }
  218 +
  219 + public Double getJhlc() {
  220 + return jhlc;
  221 + }
  222 +
  223 + public void setJhlc(Double jhlc) {
  224 + this.jhlc = jhlc;
  225 + }
  226 +
  227 + public Integer getBcsj() {
  228 + return bcsj;
  229 + }
  230 +
  231 + public void setBcsj(Integer bcsj) {
  232 + this.bcsj = bcsj;
  233 + }
  234 +
  235 + public String getBcType() {
  236 + return bcType;
  237 + }
  238 +
  239 + public void setBcType(String bcType) {
  240 + this.bcType = bcType;
  241 + }
  242 +
  243 + public String getMajorStationName() {
  244 + return majorStationName;
  245 + }
  246 +
  247 + public void setMajorStationName(String majorStationName) {
  248 + this.majorStationName = majorStationName;
  249 + }
  250 +
  251 + public String getFcsjActual() {
  252 + return fcsjActual;
  253 + }
  254 +
  255 + public void setFcsjActual(String fcsjActual) {
  256 + this.fcsjActual = fcsjActual;
  257 + }
  258 +
  259 + public String getZdsjActual() {
  260 + return zdsjActual;
  261 + }
  262 +
  263 + public void setZdsjActual(String zdsjActual) {
  264 + this.zdsjActual = zdsjActual;
  265 + }
  266 +
  267 + public int getStatus() {
  268 + return status;
  269 + }
  270 +
  271 + public void setStatus(int status) {
  272 + this.status = status;
  273 + }
  274 +
  275 + public String getAdjustExps() {
  276 + return adjustExps;
  277 + }
  278 +
  279 + public void setAdjustExps(String adjustExps) {
  280 + this.adjustExps = adjustExps;
  281 + }
  282 +
  283 + public boolean isSflj() {
  284 + return sflj;
  285 + }
  286 +
  287 + public void setSflj(boolean sflj) {
  288 + this.sflj = sflj;
  289 + }
  290 +
  291 + public String getRemarks() {
  292 + return remarks;
  293 + }
  294 +
  295 + public void setRemarks(String remarks) {
  296 + this.remarks = remarks;
  297 + }
  298 +
  299 + public String getDfsj() {
  300 + return dfsj;
  301 + }
  302 +
  303 + public void setDfsj(String dfsj) {
  304 + this.dfsj = dfsj;
  305 + }
  306 +
  307 + public Long getDfsjT() {
  308 + return dfsjT;
  309 + }
  310 +
  311 + public void setDfsjT(Long dfsjT) {
  312 + this.dfsjT = dfsjT;
  313 + }
  314 +
  315 + public Integer getDirectiveState() {
  316 + return directiveState;
  317 + }
  318 +
  319 + public void setDirectiveState(Integer directiveState) {
  320 + this.directiveState = directiveState;
  321 + }
  322 +
  323 + public String getQdzArrDatejh() {
  324 + return qdzArrDatejh;
  325 + }
  326 +
  327 + public void setQdzArrDatejh(String qdzArrDatejh) {
  328 + this.qdzArrDatejh = qdzArrDatejh;
  329 + }
  330 +
  331 + public String getQdzArrDatesj() {
  332 + return qdzArrDatesj;
  333 + }
  334 +
  335 + public void setQdzArrDatesj(String qdzArrDatesj) {
  336 + this.qdzArrDatesj = qdzArrDatesj;
  337 + }
  338 +}
... ...
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
... ... @@ -2,8 +2,9 @@ package com.bsth.data.schedule.thread;
2 2  
3 3 import com.bsth.data.directive.DayOfDirectives;
4 4 import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
5   -import com.bsth.data.safe_driv.SafeDrivCenter;
  5 +import com.bsth.service.calc.CalcWaybillService;
6 6 import com.bsth.service.oil.DlbService;
  7 +import com.bsth.data.safe_driv.SafeDrivCenter;
7 8 import com.bsth.service.oil.YlbService;
8 9 import com.bsth.service.report.SheetService;
9 10 import org.slf4j.Logger;
... ... @@ -29,6 +30,9 @@ public class CalcOilThread extends Thread{
29 30  
30 31 @Autowired
31 32 DayOfDirectives dayOfDirectives;
  33 +
  34 + @Autowired
  35 + CalcWaybillService calcWaybillService;
32 36  
33 37 @Override
34 38 public void run() {
... ... @@ -38,8 +42,15 @@ public class CalcOilThread extends Thread{
38 42 dlbService.obtainDsq();
39 43 logger.info("计算路单里程加注量结束!");
40 44 logger.info("开始计算班次准点率....");
41   - sheetService.saveSheetList("");
  45 + //sheetService.saveSheetList("");
42 46 logger.info("计算班次准点率结束!");
  47 +
  48 + logger.info("开始保存重新统计数据....");
  49 + calcWaybillService.autoGenerate("", "");
  50 + logger.info("重新统计保存结束!");
  51 + logger.info("开始保存统计日报....");
  52 + calcWaybillService.calcDaily("", "");
  53 + logger.info("统计日报保存结束!");
43 54 } catch(Exception e){
44 55 logger.error("计算路单里程加注量失败",e);
45 56 }
... ...
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
... ... @@ -77,6 +77,9 @@ public class ScheduleRefreshThread extends Thread{
77 77 }
78 78 }
79 79  
  80 + //按公司编码索引数据
  81 + dayOfSchedule.groupByGsbm();
  82 +
80 83 //首末班入库(给网关用的数据)
81 84 FirstAndLastHandler.saveAll();
82 85 } catch (Exception e) {
... ...
src/main/java/com/bsth/data/schedule/thread/SubmitToTrafficManage.java
... ... @@ -25,36 +25,48 @@ public class SubmitToTrafficManage extends Thread{
25 25 @Override
26 26 public void run() {
27 27 logger.info("开始提交数据到运管处...");
28   -
29   - try {
30   - //路单
31   - trafficManageService.setLD();
32   - } catch (Exception e) {
33   - logger.error("提交路单到运管处失败", e);
  28 + boolean isContinue = true;
  29 + // 上传路单,如果接口异常,会自动重传
  30 + while (isContinue){
  31 + try {
  32 + //路单
  33 + trafficManageService.setLD();
  34 + isContinue = false;
  35 + } catch (Exception e) {
  36 + logger.error("提交路单到运管处失败", e);
  37 + try {
  38 + // 如果出现异常,程序暂停60分钟后再重新执行
  39 + Thread.sleep(60 * 60 * 1000);
  40 + } catch (Exception ex) { }
  41 + }
34 42 }
35   - try {
36   - //车辆里程、油耗
37   - trafficManageService.setLCYH();
38   - } catch (Exception e) {
39   - logger.error("提交车辆里程、油耗到运管处失败", e);
40   - }
41   - try {
42   - //线路调度日报
43   - trafficManageService.setDDRB();
44   - } catch (Exception e) {
45   - logger.error("提交线路调度日报到运管处失败", e);
46   - }
47   - try {
48   - //线路计划班次表
49   - trafficManageService.setJHBC();
50   - } catch (Exception e) {
51   - logger.error("提交线路计划班次表到运管处失败", e);
52   - }
53   - try {
54   - // 运管处基础数据更新
55   - ygcBasicDataService.updateYgcBasicData();
56   - } catch (Exception e) {
57   - logger.error("运管处基础数据更新失败", e);
  43 +
  44 + // 路单上传成功后,再上传其他数据
  45 + if(!isContinue){
  46 + try {
  47 + //车辆里程、油耗
  48 + trafficManageService.setLCYH();
  49 + } catch (Exception e) {
  50 + logger.error("提交车辆里程、油耗到运管处失败", e);
  51 + }
  52 + try {
  53 + //线路调度日报
  54 + trafficManageService.setDDRB();
  55 + } catch (Exception e) {
  56 + logger.error("提交线路调度日报到运管处失败", e);
  57 + }
  58 + try {
  59 + //线路计划班次表
  60 + trafficManageService.setJHBC();
  61 + } catch (Exception e) {
  62 + logger.error("提交线路计划班次表到运管处失败", e);
  63 + }
  64 + try {
  65 + // 运管处基础数据更新
  66 + ygcBasicDataService.updateYgcBasicData();
  67 + } catch (Exception e) {
  68 + logger.error("运管处基础数据更新失败", e);
  69 + }
58 70 }
59 71 logger.info("提交数据到运管处结束!");
60 72 }
... ...