Commit 70ae995a5ae8639d14da5f026c0d3116a1c3122b
Merge branch 'minhang' into qingpu
# Conflicts: # src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
Showing
69 changed files
with
2775 additions
and
734 deletions
Too many changes to show.
To preserve performance only 69 of 310 files are displayed.
src/main/java/com/bsth/Application.java
| @@ -17,7 +17,7 @@ import java.util.concurrent.ScheduledExecutorService; | @@ -17,7 +17,7 @@ import java.util.concurrent.ScheduledExecutorService; | ||
| 17 | @SpringBootApplication | 17 | @SpringBootApplication |
| 18 | public class Application extends SpringBootServletInitializer { | 18 | public class Application extends SpringBootServletInitializer { |
| 19 | 19 | ||
| 20 | - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(15); | 20 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(16); |
| 21 | 21 | ||
| 22 | @Override | 22 | @Override |
| 23 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | 23 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
src/main/java/com/bsth/XDApplication.java
| @@ -4,10 +4,14 @@ import com.bsth.data.BasicData; | @@ -4,10 +4,14 @@ import com.bsth.data.BasicData; | ||
| 4 | import com.bsth.data.ThreadMonotor; | 4 | import com.bsth.data.ThreadMonotor; |
| 5 | import com.bsth.data.car_out_info.UpdateDBThread; | 5 | import com.bsth.data.car_out_info.UpdateDBThread; |
| 6 | import com.bsth.data.directive.DirectivesPstThread; | 6 | import com.bsth.data.directive.DirectivesPstThread; |
| 7 | +import com.bsth.data.forecast.SampleTimeDataLoader; | ||
| 7 | import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | 8 | import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; |
| 8 | import com.bsth.data.gpsdata.thread.OfflineMonitorThread; | 9 | import com.bsth.data.gpsdata.thread.OfflineMonitorThread; |
| 10 | +import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 11 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 9 | import com.bsth.data.schedule.edit_logs.SeiPstThread; | 12 | import com.bsth.data.schedule.edit_logs.SeiPstThread; |
| 10 | import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | 13 | import com.bsth.data.schedule.late_adjust.ScheduleLateThread; |
| 14 | +import com.bsth.data.schedule.signal.SchSiginUpdateDBThread; | ||
| 11 | import com.bsth.data.schedule.thread.CalcOilThread; | 15 | import com.bsth.data.schedule.thread.CalcOilThread; |
| 12 | import com.bsth.data.schedule.thread.SchedulePstThread; | 16 | import com.bsth.data.schedule.thread.SchedulePstThread; |
| 13 | import com.bsth.data.schedule.thread.ScheduleRefreshThread; | 17 | import com.bsth.data.schedule.thread.ScheduleRefreshThread; |
| @@ -56,6 +60,10 @@ public class XDApplication implements CommandLineRunner { | @@ -56,6 +60,10 @@ public class XDApplication implements CommandLineRunner { | ||
| 56 | ThreadMonotor threadMonotor; | 60 | ThreadMonotor threadMonotor; |
| 57 | @Autowired | 61 | @Autowired |
| 58 | SeiPstThread seiPstThread; | 62 | SeiPstThread seiPstThread; |
| 63 | + @Autowired | ||
| 64 | + SampleTimeDataLoader sampleTimeDataLoader; | ||
| 65 | + @Autowired | ||
| 66 | + SchSiginUpdateDBThread schSiginUpdateDBThread; | ||
| 59 | 67 | ||
| 60 | private static long timeDiff; | 68 | private static long timeDiff; |
| 61 | private static long timeDiffTraffic; | 69 | private static long timeDiffTraffic; |
| @@ -116,30 +124,31 @@ public class XDApplication implements CommandLineRunner { | @@ -116,30 +124,31 @@ public class XDApplication implements CommandLineRunner { | ||
| 116 | public void prodInit(){ | 124 | public void prodInit(){ |
| 117 | log.info("prodInit..."); | 125 | log.info("prodInit..."); |
| 118 | ScheduledExecutorService sexec = Application.mainServices; | 126 | ScheduledExecutorService sexec = Application.mainServices; |
| 119 | - //发车信息 | ||
| 120 | - sexec.scheduleWithFixedDelay(fcxxUpdateThread, 60, 40, TimeUnit.SECONDS); | ||
| 121 | - //抓取GPS数据 | ||
| 122 | - sexec.scheduleWithFixedDelay(gpsDataLoader, 30, 2, TimeUnit.SECONDS); | ||
| 123 | - //GPS设备掉离线 | ||
| 124 | - sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | ||
| 125 | - //班次更新线程 | ||
| 126 | - sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | ||
| 127 | - //班次延迟入库线程 | ||
| 128 | - sexec.scheduleWithFixedDelay(schedulePstThread, 60, 10, TimeUnit.SECONDS); | ||
| 129 | - //班次修正日志入库 | ||
| 130 | - sexec.scheduleWithFixedDelay(seiPstThread, 60, 60, TimeUnit.SECONDS); | ||
| 131 | - //检查班次误点 | ||
| 132 | - sexec.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); | ||
| 133 | - //调度指令延迟入库 | ||
| 134 | - sexec.scheduleWithFixedDelay(directivesPstThread, 180, 100, TimeUnit.SECONDS); | 127 | + |
| 128 | + /** 线调业务 */ | ||
| 129 | + sexec.scheduleWithFixedDelay(gpsDataLoader, 30, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 130 | + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 131 | + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);//班次更新线程 | ||
| 132 | + sexec.scheduleWithFixedDelay(schedulePstThread, 60, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 133 | + sexec.scheduleWithFixedDelay(seiPstThread, 60, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 134 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS);//检查班次误点 | ||
| 135 | + sexec.scheduleWithFixedDelay(directivesPstThread, 180, 100, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 136 | + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 137 | + sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 12, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 138 | + sexec.scheduleWithFixedDelay(basicDataLoader, 2, 2, TimeUnit.HOURS);//基础数据更新 | ||
| 139 | + DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 140 | + WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 141 | + | ||
| 142 | + /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 143 | + sexec.scheduleWithFixedDelay(fcxxUpdateThread, 60, 40, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 144 | + //线路首末班数据(网关用,班次更新时写入) | ||
| 145 | + //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 146 | + sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 60, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 135 | 147 | ||
| 136 | //运管处静态数据提交 | 148 | //运管处静态数据提交 |
| 137 | log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | 149 | log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); |
| 138 | sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 150 | sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 139 | //计算油、公里加注 | 151 | //计算油、公里加注 |
| 140 | sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 152 | sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 141 | - | ||
| 142 | - //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 143 | - sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); | ||
| 144 | } | 153 | } |
| 145 | } | 154 | } |
src/main/java/com/bsth/controller/LineController.java
| 1 | package com.bsth.controller; | 1 | package com.bsth.controller; |
| 2 | 2 | ||
| 3 | +import java.util.HashMap; | ||
| 3 | import java.util.Map; | 4 | import java.util.Map; |
| 4 | 5 | ||
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | import org.springframework.web.bind.annotation.RequestMapping; | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | import org.springframework.web.bind.annotation.RequestMethod; | 8 | import org.springframework.web.bind.annotation.RequestMethod; |
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 8 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
| 9 | 11 | ||
| 12 | +import com.bsth.common.ResponseCode; | ||
| 10 | import com.bsth.entity.Line; | 13 | import com.bsth.entity.Line; |
| 11 | import com.bsth.service.LineService; | 14 | import com.bsth.service.LineService; |
| 12 | import com.bsth.util.GetUIDAndCode; | 15 | import com.bsth.util.GetUIDAndCode; |
| @@ -50,12 +53,22 @@ public class LineController extends BaseController<Line, Integer> { | @@ -50,12 +53,22 @@ public class LineController extends BaseController<Line, Integer> { | ||
| 50 | */ | 53 | */ |
| 51 | @RequestMapping(method = RequestMethod.POST) | 54 | @RequestMapping(method = RequestMethod.POST) |
| 52 | public Map<String, Object> save(Line t){ | 55 | public Map<String, Object> save(Line t){ |
| 53 | - | 56 | + Map<String, Object> map = new HashMap<>(); |
| 54 | if(t.getId()==null) { | 57 | if(t.getId()==null) { |
| 55 | 58 | ||
| 56 | t.setId(Integer.valueOf(t.getLineCode())); | 59 | t.setId(Integer.valueOf(t.getLineCode())); |
| 57 | 60 | ||
| 58 | } | 61 | } |
| 62 | + if( (t.getId().toString().length()) > 6) { | ||
| 63 | + | ||
| 64 | + map.put("status", ResponseCode.ERROR); | ||
| 65 | + return map; | ||
| 66 | + } | ||
| 59 | return service.save(t); | 67 | return service.save(t); |
| 60 | } | 68 | } |
| 69 | + | ||
| 70 | + @RequestMapping(value ="/findById" , method = RequestMethod.GET) | ||
| 71 | + Line findByID(@RequestParam(defaultValue = "id") Integer id){ | ||
| 72 | + return service.findById(id); | ||
| 73 | + } | ||
| 61 | } | 74 | } |
src/main/java/com/bsth/controller/StationRouteController.java
| @@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RestController; | @@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RestController; | ||
| 12 | import java.util.List; | 12 | import java.util.List; |
| 13 | import java.util.Map; | 13 | import java.util.Map; |
| 14 | 14 | ||
| 15 | +import javax.servlet.http.HttpServletResponse; | ||
| 16 | + | ||
| 15 | /** | 17 | /** |
| 16 | * | 18 | * |
| 17 | * @ClassName: StationRouteController(站点路由控制器) | 19 | * @ClassName: StationRouteController(站点路由控制器) |
| @@ -48,6 +50,18 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -48,6 +50,18 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 48 | } | 50 | } |
| 49 | 51 | ||
| 50 | /** | 52 | /** |
| 53 | + * @Description :TODO(查询路段信息) | ||
| 54 | + * | ||
| 55 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 56 | + * | ||
| 57 | + * @return Map<String, Object> | ||
| 58 | + */ | ||
| 59 | + @RequestMapping(value = "/export" , method = RequestMethod.GET) | ||
| 60 | + public Map<String, Object> export(@RequestParam Integer id, HttpServletResponse resp) { | ||
| 61 | + return service.getSectionRouteExport(id, resp); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + /** | ||
| 51 | * @param String | 65 | * @param String |
| 52 | * @throws | 66 | * @throws |
| 53 | * @Description: TODO(批量撤销站点) | 67 | * @Description: TODO(批量撤销站点) |
src/main/java/com/bsth/controller/excep/NowOutboundController.java
| 1 | package com.bsth.controller.excep; | 1 | package com.bsth.controller.excep; |
| 2 | 2 | ||
| 3 | +import java.text.ParseException; | ||
| 3 | import java.util.HashMap; | 4 | import java.util.HashMap; |
| 5 | +import java.util.List; | ||
| 4 | import java.util.Map; | 6 | import java.util.Map; |
| 5 | 7 | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -10,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestParam; | @@ -10,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | import org.springframework.web.bind.annotation.RestController; | 12 | import org.springframework.web.bind.annotation.RestController; |
| 11 | 13 | ||
| 12 | import com.bsth.controller.BaseController; | 14 | import com.bsth.controller.BaseController; |
| 15 | +import com.bsth.data.BasicData; | ||
| 13 | import com.bsth.entity.excep.Outbound; | 16 | import com.bsth.entity.excep.Outbound; |
| 17 | +import com.bsth.entity.excep.Speeding; | ||
| 14 | import com.bsth.entity.sys.SysUser; | 18 | import com.bsth.entity.sys.SysUser; |
| 15 | import com.bsth.service.excep.NowOutboundService; | 19 | import com.bsth.service.excep.NowOutboundService; |
| 16 | import com.bsth.util.PageObject; | 20 | import com.bsth.util.PageObject; |
| @@ -44,5 +48,11 @@ public class NowOutboundController extends BaseController<SysUser, Integer>{ | @@ -44,5 +48,11 @@ public class NowOutboundController extends BaseController<SysUser, Integer>{ | ||
| 44 | return modelMap; | 48 | return modelMap; |
| 45 | } | 49 | } |
| 46 | 50 | ||
| 51 | + @RequestMapping(value = "/findPosition", method = RequestMethod.GET) | ||
| 52 | + public List<Outbound> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException { | ||
| 53 | + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle); | ||
| 54 | + List<Outbound> listOutbound = nowOutboundService.findPosition(deviceid,startdate,enddate); | ||
| 55 | + return listOutbound; | ||
| 56 | + } | ||
| 47 | 57 | ||
| 48 | } | 58 | } |
src/main/java/com/bsth/controller/forms/ExportController.java
| @@ -190,9 +190,6 @@ public class ExportController { | @@ -190,9 +190,6 @@ public class ExportController { | ||
| 190 | m.put("clzbh", l.getClzbh()); | 190 | m.put("clzbh", l.getClzbh()); |
| 191 | m.put("jsy", l.getJsy()); | 191 | m.put("jsy", l.getJsy()); |
| 192 | m.put("jName", l.getjName()); | 192 | m.put("jName", l.getjName()); |
| 193 | - | ||
| 194 | - | ||
| 195 | - | ||
| 196 | m.put("sgh", l.getSgh()); | 193 | m.put("sgh", l.getSgh()); |
| 197 | m.put("sName", l.getsName()); | 194 | m.put("sName", l.getsName()); |
| 198 | m.put("jhlc", l.getJhlc()); | 195 | m.put("jhlc", l.getJhlc()); |
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
| @@ -78,6 +78,13 @@ public class MCY_FormsController { | @@ -78,6 +78,13 @@ public class MCY_FormsController { | ||
| 78 | 78 | ||
| 79 | return formsService.singledata(map); | 79 | return formsService.singledata(map); |
| 80 | } | 80 | } |
| 81 | + | ||
| 82 | + // 路单数据 | ||
| 83 | + @RequestMapping(value = "/singledatanew", method = RequestMethod.GET) | ||
| 84 | + public List<Singledata> singledatanew(@RequestParam Map<String, Object> map) { | ||
| 85 | + | ||
| 86 | + return formsService.singledata(map); | ||
| 87 | + } | ||
| 81 | 88 | ||
| 82 | // 车辆加注 | 89 | // 车辆加注 |
| 83 | @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET) | 90 | @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET) |
src/main/java/com/bsth/controller/oil/CwjyController.java
| @@ -12,7 +12,10 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -12,7 +12,10 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 12 | import org.springframework.web.bind.annotation.RequestParam; | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | import org.springframework.web.bind.annotation.RestController; | 13 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 14 | ||
| 15 | +import com.bsth.common.ResponseCode; | ||
| 15 | import com.bsth.controller.BaseController; | 16 | import com.bsth.controller.BaseController; |
| 17 | +import com.bsth.data.BasicData; | ||
| 18 | +import com.bsth.entity.Line; | ||
| 16 | import com.bsth.entity.oil.Cwjy; | 19 | import com.bsth.entity.oil.Cwjy; |
| 17 | import com.bsth.entity.oil.Ylxxb; | 20 | import com.bsth.entity.oil.Ylxxb; |
| 18 | import com.bsth.entity.sys.SysUser; | 21 | import com.bsth.entity.sys.SysUser; |
| @@ -30,12 +33,24 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | @@ -30,12 +33,24 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | ||
| 30 | SysUser sysUser = SecurityUtils.getCurrentUser(); | 33 | SysUser sysUser = SecurityUtils.getCurrentUser(); |
| 31 | t.setCreateDate(new Date()); | 34 | t.setCreateDate(new Date()); |
| 32 | t.setXgr(sysUser.getUserName()); | 35 | t.setXgr(sysUser.getUserName()); |
| 33 | - return service.save(t); | 36 | + t.setNbbm(t.getNbbm().trim().toUpperCase()); |
| 37 | + Line line=BasicData.nbbm2LineMap.get(t.getNbbm()); | ||
| 38 | + t.setLine(line == null?"" : line.getLineCode()); | ||
| 39 | + Map<String, Object> map = new HashMap<>(); | ||
| 40 | + try { | ||
| 41 | + map=service.save(t); | ||
| 42 | + }catch (Exception e) { | ||
| 43 | + // TODO: handle exception | ||
| 44 | + if(e.getMessage().indexOf("PK_CWJYUK")>0){ | ||
| 45 | + map.put("fage", "存在相同数据,数据已经过滤"); | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + return map; | ||
| 34 | } | 49 | } |
| 35 | 50 | ||
| 36 | @RequestMapping(value = "/checkNbbm",method = RequestMethod.GET) | 51 | @RequestMapping(value = "/checkNbbm",method = RequestMethod.GET) |
| 37 | public int checkNbbm(Cwjy t){ | 52 | public int checkNbbm(Cwjy t){ |
| 38 | - return service.checkNbbm(t.getNbbm().trim()); | 53 | + return service.checkNbbm(t); |
| 39 | } | 54 | } |
| 40 | 55 | ||
| 41 | @RequestMapping(value = "/queryList",method = RequestMethod.GET) | 56 | @RequestMapping(value = "/queryList",method = RequestMethod.GET) |
src/main/java/com/bsth/controller/oil/DlbController.java
| @@ -2,6 +2,7 @@ package com.bsth.controller.oil; | @@ -2,6 +2,7 @@ package com.bsth.controller.oil; | ||
| 2 | 2 | ||
| 3 | import java.text.SimpleDateFormat; | 3 | import java.text.SimpleDateFormat; |
| 4 | import java.util.ArrayList; | 4 | import java.util.ArrayList; |
| 5 | +import java.util.Date; | ||
| 5 | import java.util.HashMap; | 6 | import java.util.HashMap; |
| 6 | import java.util.Iterator; | 7 | import java.util.Iterator; |
| 7 | import java.util.List; | 8 | import java.util.List; |
| @@ -84,8 +85,14 @@ public class DlbController extends BaseController<Dlb, Integer>{ | @@ -84,8 +85,14 @@ public class DlbController extends BaseController<Dlb, Integer>{ | ||
| 84 | 85 | ||
| 85 | 86 | ||
| 86 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) | 87 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) |
| 87 | - public Map<String, Object> obtain(@RequestParam Map<String, Object> map){ | ||
| 88 | - Map<String, Object> list=service.obtain(map); | 88 | + public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{ |
| 89 | + Map<String, Object> list=new HashMap<String, Object>(); | ||
| 90 | + try { | ||
| 91 | + list = service.obtain(map); | ||
| 92 | + } catch (Exception e) { | ||
| 93 | + // TODO Auto-generated catch block | ||
| 94 | + throw e; | ||
| 95 | + } | ||
| 89 | return list; | 96 | return list; |
| 90 | } | 97 | } |
| 91 | 98 | ||
| @@ -188,4 +195,30 @@ public class DlbController extends BaseController<Dlb, Integer>{ | @@ -188,4 +195,30 @@ public class DlbController extends BaseController<Dlb, Integer>{ | ||
| 188 | 195 | ||
| 189 | } | 196 | } |
| 190 | 197 | ||
| 198 | + | ||
| 199 | + @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) | ||
| 200 | + public String checkJsy(@RequestParam Map<String, Object> map){ | ||
| 201 | + String list=service.checkJsy(map); | ||
| 202 | + return list; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + @RequestMapping(value = "/deleteIds", method = RequestMethod.POST) | ||
| 206 | + public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) { | ||
| 207 | + Map<String, Object> maps=new HashMap<String, Object>(); | ||
| 208 | + try { | ||
| 209 | + maps= service.deleteIds(map); | ||
| 210 | + } catch (Exception e) { | ||
| 211 | + // TODO Auto-generated catch block | ||
| 212 | + e.printStackTrace(); | ||
| 213 | + } | ||
| 214 | + return maps; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + @RequestMapping(value = "/saveDlb",method = RequestMethod.POST) | ||
| 218 | + public Map<String, Object> saveDlb(Dlb t){ | ||
| 219 | +// SysUser user = SecurityUtils.getCurrentUser(); | ||
| 220 | + t.setCreatetime(new Date()); | ||
| 221 | +// Ylb t=new Ylb(); | ||
| 222 | + return service.saveDlb(t); | ||
| 223 | + } | ||
| 191 | } | 224 | } |
src/main/java/com/bsth/controller/oil/YlbController.java
| @@ -209,8 +209,8 @@ public class YlbController extends BaseController<Ylb, Integer>{ | @@ -209,8 +209,8 @@ public class YlbController extends BaseController<Ylb, Integer>{ | ||
| 209 | return maps; | 209 | return maps; |
| 210 | } | 210 | } |
| 211 | @RequestMapping(value="/oilListMonth") | 211 | @RequestMapping(value="/oilListMonth") |
| 212 | - public List<Ylb> oilListMonth(@RequestParam String line,@RequestParam String date,@RequestParam String type){ | ||
| 213 | - return yblService.oilListMonth(line, date, type); | 212 | + public List<Ylb> oilListMonth(@RequestParam Map<String, Object> map){ |
| 213 | + return yblService.oilListMonth(map); | ||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) | 216 | @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) |
src/main/java/com/bsth/controller/oil/YlxxbController.java
| 1 | package com.bsth.controller.oil; | 1 | package com.bsth.controller.oil; |
| 2 | 2 | ||
| 3 | import java.util.HashMap; | 3 | import java.util.HashMap; |
| 4 | +import java.util.List; | ||
| 4 | import java.util.Map; | 5 | import java.util.Map; |
| 5 | 6 | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -28,6 +29,12 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | @@ -28,6 +29,12 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | ||
| 28 | return pagequery; | 29 | return pagequery; |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 32 | + @RequestMapping(value = "/listNbbm",method = RequestMethod.GET) | ||
| 33 | + public List<Ylxxb> listNbbm(@RequestParam Map<String, Object> map){ | ||
| 34 | + List<Ylxxb> list=service.Pagequery_nbbm(map); | ||
| 35 | + return list; | ||
| 36 | + } | ||
| 37 | + | ||
| 31 | 38 | ||
| 32 | /** | 39 | /** |
| 33 | * 核对油量(有加油没里程) | 40 | * 核对油量(有加油没里程) |
| @@ -45,4 +52,17 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | @@ -45,4 +52,17 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | ||
| 45 | } | 52 | } |
| 46 | return list; | 53 | return list; |
| 47 | } | 54 | } |
| 55 | + | ||
| 56 | + @RequestMapping(value = "/checkNbbm",method = RequestMethod.POST) | ||
| 57 | + public Map<String, Object> checkNbbm(@RequestParam Map<String, Object> map){ | ||
| 58 | + Map<String, Object> list=new HashMap<>(); | ||
| 59 | + try { | ||
| 60 | + list = service.checkNbbm(map); | ||
| 61 | + } catch (Exception e) { | ||
| 62 | + // TODO Auto-generated catch block | ||
| 63 | + e.printStackTrace(); | ||
| 64 | + } | ||
| 65 | + return list; | ||
| 66 | + } | ||
| 67 | + | ||
| 48 | } | 68 | } |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| @@ -131,7 +131,7 @@ public class BasicDataController { | @@ -131,7 +131,7 @@ public class BasicDataController { | ||
| 131 | */ | 131 | */ |
| 132 | @RequestMapping("/nbbm2PlateNo") | 132 | @RequestMapping("/nbbm2PlateNo") |
| 133 | public Map<String, String> nbbm2PlateNo(){ | 133 | public Map<String, String> nbbm2PlateNo(){ |
| 134 | - return basicData.getNbbm2PlateNo(); | 134 | + return basicData.nbbmCompanyPlateMap; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | 137 |
src/main/java/com/bsth/controller/realcontrol/FrequentPhrasesController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | ||
| 2 | + | ||
| 3 | +import com.bsth.controller.BaseController; | ||
| 4 | +import com.bsth.entity.realcontrol.FrequentPhrases; | ||
| 5 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 6 | +import org.springframework.web.bind.annotation.RestController; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Created by panzhao on 2017/9/17. | ||
| 10 | + */ | ||
| 11 | +@RestController | ||
| 12 | +@RequestMapping("frequent_phrases") | ||
| 13 | +public class FrequentPhrasesController extends BaseController<FrequentPhrases, Integer>{ | ||
| 14 | + | ||
| 15 | +} |
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
| @@ -79,6 +79,11 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | @@ -79,6 +79,11 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | ||
| 79 | return lineConfigService.getByLineCode(lineCode); | 79 | return lineConfigService.getByLineCode(lineCode); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | + @RequestMapping(value = "/findByIdx") | ||
| 83 | + public Map<String, Object> findByIdx(@RequestParam String idx){ | ||
| 84 | + return lineConfigService.findByIdx(idx); | ||
| 85 | + } | ||
| 86 | + | ||
| 82 | /** | 87 | /** |
| 83 | * 到站缓冲区设置 | 88 | * 到站缓冲区设置 |
| 84 | * @param lineCode | 89 | * @param lineCode |
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | +import com.bsth.data.gpsdata.arrival.GeoCacheData; | ||
| 4 | +import com.bsth.data.gpsdata.arrival.entity.TimedEnableStationRoute; | ||
| 3 | import com.bsth.service.realcontrol.RealMapService; | 5 | import com.bsth.service.realcontrol.RealMapService; |
| 4 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 5 | import org.springframework.web.bind.annotation.RequestMapping; | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 6 | import org.springframework.web.bind.annotation.RequestParam; | 9 | import org.springframework.web.bind.annotation.RequestParam; |
| 7 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
| 8 | 11 | ||
| @@ -74,4 +77,9 @@ public class RealMapController { | @@ -74,4 +77,9 @@ public class RealMapController { | ||
| 74 | public Map<String, Object> multiSectionRoute(@RequestParam String codeIdx){ | 77 | public Map<String, Object> multiSectionRoute(@RequestParam String codeIdx){ |
| 75 | return realMapService.multiSectionRoute(codeIdx); | 78 | return realMapService.multiSectionRoute(codeIdx); |
| 76 | } | 79 | } |
| 80 | + | ||
| 81 | + @RequestMapping(value = "/lockAndFlxedTimeEnabled", method = RequestMethod.POST) | ||
| 82 | + public void lockAndFlxedTimeEnabled(TimedEnableStationRoute tes){ | ||
| 83 | + GeoCacheData.tesMap.put(tes.getLineCode(), tes); | ||
| 84 | + } | ||
| 77 | } | 85 | } |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -417,6 +417,70 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -417,6 +417,70 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 417 | } | 417 | } |
| 418 | return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type); | 418 | return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type); |
| 419 | } | 419 | } |
| 420 | + | ||
| 421 | + /* | ||
| 422 | + * 公里修正报表 | ||
| 423 | + */ | ||
| 424 | + @RequestMapping(value="/mileageReportTj") | ||
| 425 | + public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){ | ||
| 426 | + String gsdm=""; | ||
| 427 | + if(map.get("gsdm")!=null){ | ||
| 428 | + gsdm=map.get("gsdm").toString(); | ||
| 429 | + } | ||
| 430 | + String fgsdm=""; | ||
| 431 | + if(map.get("fgsdm")!=null){ | ||
| 432 | + fgsdm=map.get("fgsdm").toString(); | ||
| 433 | + } | ||
| 434 | + String line=""; | ||
| 435 | + if(map.get("line")!=null){ | ||
| 436 | + line=map.get("line").toString(); | ||
| 437 | + } | ||
| 438 | + String date=""; | ||
| 439 | + if(map.get("date")!=null){ | ||
| 440 | + date=map.get("date").toString(); | ||
| 441 | + } | ||
| 442 | + String date2=""; | ||
| 443 | + if(map.get("date2")!=null){ | ||
| 444 | + date2=map.get("date2").toString(); | ||
| 445 | + } | ||
| 446 | + String xlName=""; | ||
| 447 | + if(map.get("xlName")!=null){ | ||
| 448 | + xlName=map.get("xlName").toString(); | ||
| 449 | + } | ||
| 450 | + return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2); | ||
| 451 | + } | ||
| 452 | + | ||
| 453 | + /* | ||
| 454 | + * 班次修正报表 | ||
| 455 | + */ | ||
| 456 | + @RequestMapping(value="/scheduleCorrectionReport") | ||
| 457 | + public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){ | ||
| 458 | + String gsdm=""; | ||
| 459 | + if(map.get("gsdm")!=null){ | ||
| 460 | + gsdm=map.get("gsdm").toString(); | ||
| 461 | + } | ||
| 462 | + String fgsdm=""; | ||
| 463 | + if(map.get("fgsdm")!=null){ | ||
| 464 | + fgsdm=map.get("fgsdm").toString(); | ||
| 465 | + } | ||
| 466 | + String line=""; | ||
| 467 | + if(map.get("line")!=null){ | ||
| 468 | + line=map.get("line").toString(); | ||
| 469 | + } | ||
| 470 | + String date=""; | ||
| 471 | + if(map.get("date")!=null){ | ||
| 472 | + date=map.get("date").toString(); | ||
| 473 | + } | ||
| 474 | + String date2=""; | ||
| 475 | + if(map.get("date2")!=null){ | ||
| 476 | + date2=map.get("date2").toString(); | ||
| 477 | + } | ||
| 478 | + String xlName=""; | ||
| 479 | + if(map.get("xlName")!=null){ | ||
| 480 | + xlName=map.get("xlName").toString(); | ||
| 481 | + } | ||
| 482 | + return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2); | ||
| 483 | + } | ||
| 420 | 484 | ||
| 421 | @RequestMapping(value="/MapById",method = RequestMethod.GET) | 485 | @RequestMapping(value="/MapById",method = RequestMethod.GET) |
| 422 | public Map<String, Object> MapById(@RequestParam("id") Long id){ | 486 | public Map<String, Object> MapById(@RequestParam("id") Long id){ |
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
| @@ -95,4 +95,25 @@ public class anomalyCheckController { | @@ -95,4 +95,25 @@ public class anomalyCheckController { | ||
| 95 | public void updateCacheBuff(){ | 95 | public void updateCacheBuff(){ |
| 96 | geoCacheData.loadData(); | 96 | geoCacheData.loadData(); |
| 97 | } | 97 | } |
| 98 | + | ||
| 99 | + @RequestMapping(value = "/reCalcLpSch") | ||
| 100 | + public void reCalcLpSch(){ | ||
| 101 | + dayOfSchedule._test_reCalcLpSch(); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + @RequestMapping(value = "/findSchByLpName") | ||
| 105 | + public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){ | ||
| 106 | + return dayOfSchedule.getLpScheduleMap().get(lpName); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + @RequestMapping(value = "/findSchByNbbm") | ||
| 110 | + public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm){ | ||
| 111 | + return dayOfSchedule.findByNbbm(nbbm); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + @RequestMapping(value = "/removeExecPlan") | ||
| 115 | + public int removeExecPlan(@RequestParam String nbbm){ | ||
| 116 | + dayOfSchedule.removeExecPlan(nbbm); | ||
| 117 | + return 1; | ||
| 118 | + } | ||
| 98 | } | 119 | } |
src/main/java/com/bsth/controller/report/ReportController.java
| @@ -84,12 +84,19 @@ public class ReportController { | @@ -84,12 +84,19 @@ public class ReportController { | ||
| 84 | @RequestParam int zd){ | 84 | @RequestParam int zd){ |
| 85 | return service.queryStrinon(line,zd); | 85 | return service.queryStrinon(line,zd); |
| 86 | } | 86 | } |
| 87 | + //根据排班查到离站 | ||
| 87 | @RequestMapping(value="/queryInOutStrtion" ,method = RequestMethod.GET) | 88 | @RequestMapping(value="/queryInOutStrtion" ,method = RequestMethod.GET) |
| 88 | public List<Map<String, Object>> queryInOutStrtion(@RequestParam String line, | 89 | public List<Map<String, Object>> queryInOutStrtion(@RequestParam String line, |
| 89 | @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){ | 90 | @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){ |
| 90 | return service.queryInOutStrtion(line,date,zd,lzsj); | 91 | return service.queryInOutStrtion(line,date,zd,lzsj); |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 94 | + //根据GPS数据查到离站 | ||
| 95 | + @RequestMapping(value="/queryInOutStrtions" ,method = RequestMethod.GET) | ||
| 96 | + public List<Map<String, Object>> queryInOutStrtions(@RequestParam String line, | ||
| 97 | + @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){ | ||
| 98 | + return service.queryInOutStrtions(line,date,zd,lzsj); | ||
| 99 | + } | ||
| 93 | @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET) | 100 | @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET) |
| 94 | public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line, | 101 | public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line, |
| 95 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ | 102 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ |
src/main/java/com/bsth/controller/sys/IntervalController.java
| @@ -9,12 +9,13 @@ import org.springframework.web.bind.annotation.RequestParam; | @@ -9,12 +9,13 @@ import org.springframework.web.bind.annotation.RequestParam; | ||
| 9 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 10 | ||
| 11 | import com.alibaba.fastjson.JSON; | 11 | import com.alibaba.fastjson.JSON; |
| 12 | +import com.bsth.controller.BaseController; | ||
| 12 | import com.bsth.entity.sys.Interval; | 13 | import com.bsth.entity.sys.Interval; |
| 13 | import com.bsth.service.sys.IntervalService; | 14 | import com.bsth.service.sys.IntervalService; |
| 14 | 15 | ||
| 15 | @RestController | 16 | @RestController |
| 16 | @RequestMapping("interval") | 17 | @RequestMapping("interval") |
| 17 | -public class IntervalController { | 18 | +public class IntervalController extends BaseController<Interval, Integer> { |
| 18 | 19 | ||
| 19 | @Autowired | 20 | @Autowired |
| 20 | IntervalService intervalService; | 21 | IntervalService intervalService; |
src/main/java/com/bsth/controller/sys/UserController.java
| @@ -31,220 +31,252 @@ import java.util.*; | @@ -31,220 +31,252 @@ import java.util.*; | ||
| 31 | @RequestMapping("user") | 31 | @RequestMapping("user") |
| 32 | public class UserController extends BaseController<SysUser, Integer> { | 32 | public class UserController extends BaseController<SysUser, Integer> { |
| 33 | 33 | ||
| 34 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 35 | - | ||
| 36 | - @Autowired | ||
| 37 | - SysUserService sysUserService; | ||
| 38 | - | ||
| 39 | - @Autowired | ||
| 40 | - CompanyAuthorityService companyAuthorityService; | ||
| 41 | - | ||
| 42 | - @RequestMapping(value = "/login/jCryptionKey") | ||
| 43 | - public Map<String, Object> jCryptionKey(HttpServletRequest request){ | ||
| 44 | - //公匙返回页面 | ||
| 45 | - Map<String, Object> rs = new HashMap<>(); | ||
| 46 | - rs.put("publickey", RSAUtils.generateBase64PublicKey()); | ||
| 47 | - return rs; | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - //需要验证码的账号 | ||
| 51 | - public static Map<String, Integer> captchaMap = new HashMap<>(); | ||
| 52 | - | ||
| 53 | - @RequestMapping(value = "/login", method = RequestMethod.POST) | ||
| 54 | - public Map<String, Object> login(HttpServletRequest request, @RequestParam String userName, | ||
| 55 | - @RequestParam String password, String captcha) { | ||
| 56 | - | ||
| 57 | - Map<String, Object> rs = new HashMap<>(); | ||
| 58 | - rs.put("status", ResponseCode.ERROR); | ||
| 59 | - try { | ||
| 60 | - HttpSession session = request.getSession(); | ||
| 61 | - rs.put("captcha", session.getAttribute("captcha")); | ||
| 62 | - | ||
| 63 | - if(captchaMap.get(userName) != null && captchaMap.get(userName) >= 3){ | ||
| 64 | - //校验验证码 | ||
| 65 | - String verCode = (String) session | ||
| 66 | - .getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); | ||
| 67 | - | ||
| 68 | - if(StringUtils.isBlank(captcha)) | ||
| 69 | - return put(rs, "msg", "请输入验证码"); | ||
| 70 | - | ||
| 71 | - if(!verCode.equals(captcha)) | ||
| 72 | - return put(rs, "msg", "验证码有误,请刷新后重新输入"); | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - //解密RSA | ||
| 76 | - try { | ||
| 77 | - userName = RSAUtils.decryptBase64(userName); | ||
| 78 | - password = RSAUtils.decryptBase64(password); | ||
| 79 | - } catch (RuntimeException e) { | ||
| 80 | - return put(rs, "msg", "decrypt RSA fail!可能页面已过期,尝试刷新页面。"); | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - SysUser user = sysUserService.findByUserName(userName); | ||
| 84 | - if (null == user) | ||
| 85 | - return put(rs, "msg", "不存在的用户"); | ||
| 86 | - | ||
| 87 | - if (!user.isEnabled()) | ||
| 88 | - return put(rs, "msg", "该用户已被锁定,请联系管理员"); | ||
| 89 | - | ||
| 90 | - // 校验密码 | ||
| 91 | - boolean matchStatus = new BCryptPasswordEncoder(4).matches(password, user.getPassword()); | ||
| 92 | - if (!matchStatus) { | ||
| 93 | - rs.put("msg", "密码有误"); | ||
| 94 | - | ||
| 95 | - Integer captchSize = captchaMap.get(userName); | ||
| 96 | - if(null == captchSize) | ||
| 97 | - captchSize = 0; | ||
| 98 | - | ||
| 99 | - captchSize ++; | ||
| 100 | - captchaMap.put(userName, captchSize); | ||
| 101 | - return rs; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - // 登录 | ||
| 105 | - SecurityUtils.login(user, request); | ||
| 106 | - //session里写入用户名,webSocket连接时标识身份用 | ||
| 107 | - session.setAttribute(Constants.SESSION_USERNAME, user.getUserName()); | ||
| 108 | - | ||
| 109 | - //获取公司权限数据 | ||
| 110 | - List<CompanyAuthority> cmyAuths=companyAuthorityService.findByUser(user); | ||
| 111 | - session.setAttribute(Constants.COMPANY_AUTHORITYS, cmyAuths); | ||
| 112 | - | ||
| 113 | - captchaMap.remove(userName); | ||
| 114 | - rs.put("status", ResponseCode.SUCCESS); | ||
| 115 | - } catch (Exception e) { | ||
| 116 | - logger.error("", e); | ||
| 117 | - rs.put("msg", "服务器出现异常,请联系管理员"); | ||
| 118 | - } | ||
| 119 | - return rs; | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - /** | ||
| 123 | - * 返回当前用户的公司权限数据,用于构建页面级联下拉框 | ||
| 124 | - * @return | ||
| 125 | - */ | ||
| 126 | - @RequestMapping("companyData") | ||
| 127 | - public List<CompanyData> companyData(HttpServletRequest request){ | ||
| 128 | - List<CompanyData> rs = new ArrayList<>(); | ||
| 129 | - CompanyData companyData; | ||
| 130 | - | ||
| 131 | - ArrayListMultimap<String, CompanyAuthority> map = ArrayListMultimap.create(); | ||
| 132 | - List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) request.getSession().getAttribute(Constants.COMPANY_AUTHORITYS); | ||
| 133 | - | ||
| 134 | - for(CompanyAuthority cAuth : cmyAuths){ | ||
| 135 | - map.put(cAuth.getCompanyCode()+"_"+cAuth.getCompanyName(), cAuth); | ||
| 136 | - } | ||
| 137 | - | ||
| 138 | - Set<String> keys = map.keySet(); | ||
| 139 | - String[] temps; | ||
| 140 | - for(String k : keys){ | ||
| 141 | - temps = k.split("_"); | ||
| 142 | - | ||
| 143 | - companyData = new CompanyData(); | ||
| 144 | - companyData.setCompanyCode(temps[0]); | ||
| 145 | - companyData.setCompanyName(temps[1]); | ||
| 146 | - companyData.setChildren(new ArrayList<CompanyData.ChildrenCompany>()); | ||
| 147 | - | ||
| 148 | - cmyAuths = map.get(k); | ||
| 149 | - for(CompanyAuthority c : cmyAuths){ | ||
| 150 | - companyData.getChildren().add(new CompanyData.ChildrenCompany(c.getSubCompanyCode(), c.getSubCompanyName())); | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - rs.add(companyData); | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - return rs; | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | - @RequestMapping(value = "/login/captchaStatus") | ||
| 160 | - public int captchaStatus(String userName){ | ||
| 161 | - Integer size = captchaMap.get(userName); | ||
| 162 | - return size == null?0:size; | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - public Map<String, Object> put(Map<String, Object> rs, String key, Object val){ | ||
| 166 | - rs.put(key, val); | ||
| 167 | - return rs; | ||
| 168 | - } | ||
| 169 | - | ||
| 170 | - /** | ||
| 171 | - * | ||
| 172 | - * @Title: loginFailure @Description: TODO(查询登录失败的详细信息) @param @param | ||
| 173 | - * request @return String 返回类型 @throws | ||
| 174 | - */ | ||
| 175 | - @RequestMapping("/loginFailure") | ||
| 176 | - public String loginFailure(HttpServletRequest request) { | ||
| 177 | - String msg = ""; | ||
| 178 | - HttpSession session = request.getSession(); | ||
| 179 | - | ||
| 180 | - Object obj = session.getAttribute("SPRING_SECURITY_LAST_EXCEPTION"); | ||
| 181 | - | ||
| 182 | - if (obj instanceof BadCredentialsException) | ||
| 183 | - msg = "登录失败,用户名或密码错误."; | ||
| 184 | - else if (obj instanceof SessionAuthenticationException) | ||
| 185 | - msg = "登录失败,当前策略不允许重复登录."; | ||
| 186 | - session.removeAttribute("SPRING_SECURITY_LAST_EXCEPTION"); | ||
| 187 | - return msg; | ||
| 188 | - } | ||
| 189 | - | ||
| 190 | - @RequestMapping("/currentUser") | ||
| 191 | - public SysUser currentUser() { | ||
| 192 | - return SecurityUtils.getCurrentUser(); | ||
| 193 | - } | ||
| 194 | - | ||
| 195 | - /** | ||
| 196 | - * @Title changeEnabled | ||
| 197 | - * @Description: TODO(改变用户状态) | ||
| 198 | - * @param id | ||
| 199 | - * 用户ID | ||
| 200 | - * @param enabled | ||
| 201 | - * 状态 | ||
| 202 | - * @return | ||
| 203 | - */ | ||
| 204 | - @RequestMapping("/changeEnabled") | ||
| 205 | - public int changeEnabled(@RequestParam int id, @RequestParam int enabled) { | ||
| 206 | - return sysUserService.changeEnabled(id, enabled); | ||
| 207 | - } | ||
| 208 | - | ||
| 209 | - /** | ||
| 210 | - * @Title changePWD | ||
| 211 | - * @Description: TODO(修改密码) | ||
| 212 | - * @param oldPWD | ||
| 213 | - * 原始密码 | ||
| 214 | - * @param newPWD | ||
| 215 | - * 新密码 | ||
| 216 | - * @param cnewPWD | ||
| 217 | - * 确认新密码 | ||
| 218 | - * @return | ||
| 219 | - */ | ||
| 220 | - @RequestMapping(value = "/changePWD", method = RequestMethod.POST) | ||
| 221 | - public String changePWD(@RequestParam String oldPWD, @RequestParam String newPWD, @RequestParam String cnewPWD) { | ||
| 222 | - SysUser sysUser = SecurityUtils.getCurrentUser(); | ||
| 223 | - String msg = ""; | ||
| 224 | - if (new BCryptPasswordEncoder(4).matches(oldPWD, sysUser.getPassword())) { | ||
| 225 | - if (oldPWD.equals(newPWD)) { | ||
| 226 | - msg = "新密码不能跟原始密码一样!"; | ||
| 227 | - } else { | ||
| 228 | - if (newPWD.equals(cnewPWD)) { | ||
| 229 | - sysUserService.changePWD(sysUser.getId(), newPWD); | ||
| 230 | - msg = "修改成功!"; | ||
| 231 | - } else { | ||
| 232 | - msg = "新密码两次输入不一致!"; | ||
| 233 | - } | ||
| 234 | - } | ||
| 235 | - } else { | ||
| 236 | - msg = "原始密码错误!"; | ||
| 237 | - } | ||
| 238 | - return msg; | ||
| 239 | - } | ||
| 240 | - | ||
| 241 | - @RequestMapping(value = "/register" ,method = RequestMethod.POST) | ||
| 242 | - public Map<String, Object> register(SysUser u){ | ||
| 243 | - return sysUserService.register(u); | ||
| 244 | - } | ||
| 245 | - | ||
| 246 | - @RequestMapping(value = "/all_distinct") | ||
| 247 | - public List<SysUser> findAll_distinct(){ | ||
| 248 | - return sysUserService.findAll_distinct(); | ||
| 249 | - } | 34 | + Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + SysUserService sysUserService; | ||
| 38 | + | ||
| 39 | + @Autowired | ||
| 40 | + CompanyAuthorityService companyAuthorityService; | ||
| 41 | + | ||
| 42 | + @RequestMapping(value = "/login/jCryptionKey") | ||
| 43 | + public Map<String, Object> jCryptionKey(HttpServletRequest request) { | ||
| 44 | + //公匙返回页面 | ||
| 45 | + Map<String, Object> rs = new HashMap<>(); | ||
| 46 | + rs.put("publickey", RSAUtils.generateBase64PublicKey()); | ||
| 47 | + return rs; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + //需要验证码的账号 | ||
| 51 | + public static Map<String, Integer> captchaMap = new HashMap<>(); | ||
| 52 | + | ||
| 53 | + @RequestMapping(value = "/login", method = RequestMethod.POST) | ||
| 54 | + public Map<String, Object> login(HttpServletRequest request, @RequestParam String userName, | ||
| 55 | + @RequestParam String password, String captcha) { | ||
| 56 | + | ||
| 57 | + Map<String, Object> rs = new HashMap<>(); | ||
| 58 | + rs.put("status", ResponseCode.ERROR); | ||
| 59 | + try { | ||
| 60 | + HttpSession session = request.getSession(); | ||
| 61 | + rs.put("captcha", session.getAttribute("captcha")); | ||
| 62 | + | ||
| 63 | + if (captchaMap.get(userName) != null && captchaMap.get(userName) >= 3) { | ||
| 64 | + //校验验证码 | ||
| 65 | + String verCode = (String) session | ||
| 66 | + .getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); | ||
| 67 | + | ||
| 68 | + if (StringUtils.isBlank(captcha)) | ||
| 69 | + return put(rs, "msg", "请输入验证码"); | ||
| 70 | + | ||
| 71 | + if (!verCode.equals(captcha)) | ||
| 72 | + return put(rs, "msg", "验证码有误,请刷新后重新输入"); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + //解密RSA | ||
| 76 | + try { | ||
| 77 | + userName = RSAUtils.decryptBase64(userName); | ||
| 78 | + password = RSAUtils.decryptBase64(password); | ||
| 79 | + } catch (RuntimeException e) { | ||
| 80 | + return put(rs, "msg", "decrypt RSA fail!可能页面已过期,尝试刷新页面。"); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + SysUser user = sysUserService.findByUserName(userName); | ||
| 84 | + if (null == user) | ||
| 85 | + return put(rs, "msg", "不存在的用户"); | ||
| 86 | + | ||
| 87 | + if (!user.isEnabled()) | ||
| 88 | + return put(rs, "msg", "该用户已被锁定,请联系管理员"); | ||
| 89 | + | ||
| 90 | + // 校验密码 | ||
| 91 | + boolean matchStatus = new BCryptPasswordEncoder(4).matches(password, user.getPassword()); | ||
| 92 | + if (!matchStatus) { | ||
| 93 | + rs.put("msg", "密码有误"); | ||
| 94 | + | ||
| 95 | + Integer captchSize = captchaMap.get(userName); | ||
| 96 | + if (null == captchSize) | ||
| 97 | + captchSize = 0; | ||
| 98 | + | ||
| 99 | + captchSize++; | ||
| 100 | + captchaMap.put(userName, captchSize); | ||
| 101 | + return rs; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + // 登录 | ||
| 105 | + SecurityUtils.login(user, request); | ||
| 106 | + //session里写入用户名,webSocket连接时标识身份用 | ||
| 107 | + session.setAttribute(Constants.SESSION_USERNAME, user.getUserName()); | ||
| 108 | + | ||
| 109 | + //获取公司权限数据 | ||
| 110 | + List<CompanyAuthority> cmyAuths = companyAuthorityService.findByUser(user); | ||
| 111 | + session.setAttribute(Constants.COMPANY_AUTHORITYS, cmyAuths); | ||
| 112 | + | ||
| 113 | + captchaMap.remove(userName); | ||
| 114 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 115 | + } catch (Exception e) { | ||
| 116 | + logger.error("", e); | ||
| 117 | + rs.put("msg", "服务器出现异常,请联系管理员"); | ||
| 118 | + } | ||
| 119 | + return rs; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + @RequestMapping(value = "/change_user", method = RequestMethod.POST) | ||
| 123 | + public Map<String, Object> changeUser(HttpServletRequest request, @RequestParam String userName, | ||
| 124 | + @RequestParam String password) { | ||
| 125 | + | ||
| 126 | + Map<String, Object> rs = new HashMap<>(); | ||
| 127 | + rs.put("status", ResponseCode.ERROR); | ||
| 128 | + try { | ||
| 129 | + HttpSession session = request.getSession(); | ||
| 130 | + | ||
| 131 | + SysUser user = sysUserService.findByUserName(userName); | ||
| 132 | + if (null == user) | ||
| 133 | + return put(rs, "msg", "不存在的用户"); | ||
| 134 | + | ||
| 135 | + if (!user.isEnabled()) | ||
| 136 | + return put(rs, "msg", "该用户已被锁定,请联系管理员"); | ||
| 137 | + | ||
| 138 | + // 校验密码 | ||
| 139 | + boolean matchStatus = new BCryptPasswordEncoder(4).matches(password, user.getPassword()); | ||
| 140 | + if (!matchStatus) | ||
| 141 | + return put(rs, "msg", "密码有误"); | ||
| 142 | + | ||
| 143 | + // 登录 | ||
| 144 | + SecurityUtils.login(user, request); | ||
| 145 | + //session里写入用户名,webSocket连接时标识身份用 | ||
| 146 | + session.setAttribute(Constants.SESSION_USERNAME, user.getUserName()); | ||
| 147 | + | ||
| 148 | + //获取公司权限数据 | ||
| 149 | + List<CompanyAuthority> cmyAuths = companyAuthorityService.findByUser(user); | ||
| 150 | + session.setAttribute(Constants.COMPANY_AUTHORITYS, cmyAuths); | ||
| 151 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 152 | + } catch (Exception e) { | ||
| 153 | + logger.error("", e); | ||
| 154 | + rs.put("msg", "服务器出现异常,请联系管理员"); | ||
| 155 | + } | ||
| 156 | + return rs; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + /** | ||
| 160 | + * 返回当前用户的公司权限数据,用于构建页面级联下拉框 | ||
| 161 | + * | ||
| 162 | + * @return | ||
| 163 | + */ | ||
| 164 | + @RequestMapping("companyData") | ||
| 165 | + public List<CompanyData> companyData(HttpServletRequest request) { | ||
| 166 | + List<CompanyData> rs = new ArrayList<>(); | ||
| 167 | + CompanyData companyData; | ||
| 168 | + | ||
| 169 | + ArrayListMultimap<String, CompanyAuthority> map = ArrayListMultimap.create(); | ||
| 170 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) request.getSession().getAttribute(Constants.COMPANY_AUTHORITYS); | ||
| 171 | + | ||
| 172 | + for (CompanyAuthority cAuth : cmyAuths) { | ||
| 173 | + map.put(cAuth.getCompanyCode() + "_" + cAuth.getCompanyName(), cAuth); | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + Set<String> keys = map.keySet(); | ||
| 177 | + String[] temps; | ||
| 178 | + for (String k : keys) { | ||
| 179 | + temps = k.split("_"); | ||
| 180 | + | ||
| 181 | + companyData = new CompanyData(); | ||
| 182 | + companyData.setCompanyCode(temps[0]); | ||
| 183 | + companyData.setCompanyName(temps[1]); | ||
| 184 | + companyData.setChildren(new ArrayList<CompanyData.ChildrenCompany>()); | ||
| 185 | + | ||
| 186 | + cmyAuths = map.get(k); | ||
| 187 | + for (CompanyAuthority c : cmyAuths) { | ||
| 188 | + companyData.getChildren().add(new CompanyData.ChildrenCompany(c.getSubCompanyCode(), c.getSubCompanyName())); | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + rs.add(companyData); | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + return rs; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + @RequestMapping(value = "/login/captchaStatus") | ||
| 198 | + public int captchaStatus(String userName) { | ||
| 199 | + Integer size = captchaMap.get(userName); | ||
| 200 | + return size == null ? 0 : size; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + public Map<String, Object> put(Map<String, Object> rs, String key, Object val) { | ||
| 204 | + rs.put(key, val); | ||
| 205 | + return rs; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + /** | ||
| 209 | + * @Title: loginFailure @Description: TODO(查询登录失败的详细信息) @param @param | ||
| 210 | + * request @return String 返回类型 @throws | ||
| 211 | + */ | ||
| 212 | + @RequestMapping("/loginFailure") | ||
| 213 | + public String loginFailure(HttpServletRequest request) { | ||
| 214 | + String msg = ""; | ||
| 215 | + HttpSession session = request.getSession(); | ||
| 216 | + | ||
| 217 | + Object obj = session.getAttribute("SPRING_SECURITY_LAST_EXCEPTION"); | ||
| 218 | + | ||
| 219 | + if (obj instanceof BadCredentialsException) | ||
| 220 | + msg = "登录失败,用户名或密码错误."; | ||
| 221 | + else if (obj instanceof SessionAuthenticationException) | ||
| 222 | + msg = "登录失败,当前策略不允许重复登录."; | ||
| 223 | + session.removeAttribute("SPRING_SECURITY_LAST_EXCEPTION"); | ||
| 224 | + return msg; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + @RequestMapping("/currentUser") | ||
| 228 | + public SysUser currentUser() { | ||
| 229 | + return SecurityUtils.getCurrentUser(); | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + /** | ||
| 233 | + * @param id 用户ID | ||
| 234 | + * @param enabled 状态 | ||
| 235 | + * @return | ||
| 236 | + * @Title changeEnabled | ||
| 237 | + * @Description: TODO(改变用户状态) | ||
| 238 | + */ | ||
| 239 | + @RequestMapping("/changeEnabled") | ||
| 240 | + public int changeEnabled(@RequestParam int id, @RequestParam int enabled) { | ||
| 241 | + return sysUserService.changeEnabled(id, enabled); | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + /** | ||
| 245 | + * @param oldPWD 原始密码 | ||
| 246 | + * @param newPWD 新密码 | ||
| 247 | + * @param cnewPWD 确认新密码 | ||
| 248 | + * @return | ||
| 249 | + * @Title changePWD | ||
| 250 | + * @Description: TODO(修改密码) | ||
| 251 | + */ | ||
| 252 | + @RequestMapping(value = "/changePWD", method = RequestMethod.POST) | ||
| 253 | + public String changePWD(@RequestParam String oldPWD, @RequestParam String newPWD, @RequestParam String cnewPWD) { | ||
| 254 | + SysUser sysUser = SecurityUtils.getCurrentUser(); | ||
| 255 | + String msg = ""; | ||
| 256 | + if (new BCryptPasswordEncoder(4).matches(oldPWD, sysUser.getPassword())) { | ||
| 257 | + if (oldPWD.equals(newPWD)) { | ||
| 258 | + msg = "新密码不能跟原始密码一样!"; | ||
| 259 | + } else { | ||
| 260 | + if (newPWD.equals(cnewPWD)) { | ||
| 261 | + sysUserService.changePWD(sysUser.getId(), newPWD); | ||
| 262 | + msg = "修改成功!"; | ||
| 263 | + } else { | ||
| 264 | + msg = "新密码两次输入不一致!"; | ||
| 265 | + } | ||
| 266 | + } | ||
| 267 | + } else { | ||
| 268 | + msg = "原始密码错误!"; | ||
| 269 | + } | ||
| 270 | + return msg; | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + @RequestMapping(value = "/register", method = RequestMethod.POST) | ||
| 274 | + public Map<String, Object> register(SysUser u) { | ||
| 275 | + return sysUserService.register(u); | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + @RequestMapping(value = "/all_distinct") | ||
| 279 | + public List<SysUser> findAll_distinct() { | ||
| 280 | + return sysUserService.findAll_distinct(); | ||
| 281 | + } | ||
| 250 | } | 282 | } |
src/main/java/com/bsth/controller/traffic/VehicleInoutStopController.java
0 → 100644
| 1 | +package com.bsth.controller.traffic; | ||
| 2 | + | ||
| 3 | +import com.bsth.controller.BaseController; | ||
| 4 | +import com.bsth.entity.traffic.VehicleInoutStop; | ||
| 5 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 6 | +import org.springframework.web.bind.annotation.RestController; | ||
| 7 | +/** | ||
| 8 | + * | ||
| 9 | + * @author BSTH | ||
| 10 | + * | ||
| 11 | + */ | ||
| 12 | +@RestController | ||
| 13 | +@RequestMapping("vehicle_stop") | ||
| 14 | +public class VehicleInoutStopController extends BaseController<VehicleInoutStop,Integer> { | ||
| 15 | +} |
src/main/java/com/bsth/data/BasicData.java
| 1 | package com.bsth.data; | 1 | package com.bsth.data; |
| 2 | 2 | ||
| 3 | -import com.bsth.Application; | ||
| 4 | import com.bsth.data.gpsdata.arrival.GeoCacheData; | 3 | import com.bsth.data.gpsdata.arrival.GeoCacheData; |
| 5 | import com.bsth.data.pinyin.PersionPinYinBuffer; | 4 | import com.bsth.data.pinyin.PersionPinYinBuffer; |
| 6 | import com.bsth.entity.*; | 5 | import com.bsth.entity.*; |
| @@ -13,12 +12,9 @@ import org.apache.commons.lang3.StringUtils; | @@ -13,12 +12,9 @@ import org.apache.commons.lang3.StringUtils; | ||
| 13 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 13 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | -import org.springframework.boot.CommandLineRunner; | ||
| 17 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 18 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 19 | 16 | ||
| 20 | import java.util.*; | 17 | import java.util.*; |
| 21 | -import java.util.concurrent.TimeUnit; | ||
| 22 | 18 | ||
| 23 | /** | 19 | /** |
| 24 | * @author PanZhao | 20 | * @author PanZhao |
| @@ -27,7 +23,7 @@ import java.util.concurrent.TimeUnit; | @@ -27,7 +23,7 @@ import java.util.concurrent.TimeUnit; | ||
| 27 | * @date 2016年8月10日 下午3:27:45 | 23 | * @date 2016年8月10日 下午3:27:45 |
| 28 | */ | 24 | */ |
| 29 | @Component | 25 | @Component |
| 30 | -public class BasicData implements CommandLineRunner { | 26 | +public class BasicData { |
| 31 | 27 | ||
| 32 | //公司代码和公司名对照(K: 公司编码,V:公司名) | 28 | //公司代码和公司名对照(K: 公司编码,V:公司名) |
| 33 | public static Map<String, String> businessCodeNameMap; | 29 | public static Map<String, String> businessCodeNameMap; |
| @@ -80,20 +76,12 @@ public class BasicData implements CommandLineRunner { | @@ -80,20 +76,12 @@ public class BasicData implements CommandLineRunner { | ||
| 80 | 76 | ||
| 81 | static Logger logger = LoggerFactory.getLogger(BasicData.class); | 77 | static Logger logger = LoggerFactory.getLogger(BasicData.class); |
| 82 | 78 | ||
| 83 | - @Autowired | ||
| 84 | - BasicDataLoader dataLoader; | ||
| 85 | - | ||
| 86 | - @Override | ||
| 87 | - public void run(String... arg0) throws Exception { | ||
| 88 | - Application.mainServices.scheduleWithFixedDelay(dataLoader, 2, 2, TimeUnit.HOURS); | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | public static String getStationNameByCode(String code, String prefix){ | 79 | public static String getStationNameByCode(String code, String prefix){ |
| 92 | String name = stationCode2NameMap.get(code); | 80 | String name = stationCode2NameMap.get(code); |
| 93 | return name != null? name: stationCode2NameMap.get(prefix + code); | 81 | return name != null? name: stationCode2NameMap.get(prefix + code); |
| 94 | } | 82 | } |
| 95 | 83 | ||
| 96 | - @Autowired | 84 | +/* @Autowired |
| 97 | JdbcTemplate jdbcTemplate; | 85 | JdbcTemplate jdbcTemplate; |
| 98 | public Map<String, String> getNbbm2PlateNo(){ | 86 | public Map<String, String> getNbbm2PlateNo(){ |
| 99 | List<Map<String, Object>> list = jdbcTemplate.queryForList("select CAR_CODE,CAR_PLATE from bsth_c_cars where CAR_CODE is not null and CAR_PLATE is not null"); | 87 | List<Map<String, Object>> list = jdbcTemplate.queryForList("select CAR_CODE,CAR_PLATE from bsth_c_cars where CAR_CODE is not null and CAR_PLATE is not null"); |
| @@ -103,7 +91,7 @@ public class BasicData implements CommandLineRunner { | @@ -103,7 +91,7 @@ public class BasicData implements CommandLineRunner { | ||
| 103 | rs.put(map.get("CAR_CODE").toString(), map.get("CAR_PLATE").toString()); | 91 | rs.put(map.get("CAR_CODE").toString(), map.get("CAR_PLATE").toString()); |
| 104 | } | 92 | } |
| 105 | return rs; | 93 | return rs; |
| 106 | - } | 94 | + }*/ |
| 107 | 95 | ||
| 108 | @Component | 96 | @Component |
| 109 | public static class BasicDataLoader extends Thread { | 97 | public static class BasicDataLoader extends Thread { |
| @@ -269,7 +257,7 @@ public class BasicData implements CommandLineRunner { | @@ -269,7 +257,7 @@ public class BasicData implements CommandLineRunner { | ||
| 269 | * @Description: TODO(加载线路相关信息) | 257 | * @Description: TODO(加载线路相关信息) |
| 270 | */ | 258 | */ |
| 271 | public void loadLineInfo() { | 259 | public void loadLineInfo() { |
| 272 | - Iterator<Line> iterator = lineRepository.findAll().iterator(); | 260 | + Iterator<Line> iterator = lineRepository.findAllService().iterator(); |
| 273 | 261 | ||
| 274 | Line line; | 262 | Line line; |
| 275 | BiMap<Integer, String> biMap = HashBiMap.create(); | 263 | BiMap<Integer, String> biMap = HashBiMap.create(); |
src/main/java/com/bsth/data/LineConfigData.java
| @@ -77,7 +77,7 @@ public class LineConfigData implements CommandLineRunner { | @@ -77,7 +77,7 @@ public class LineConfigData implements CommandLineRunner { | ||
| 77 | public long applyIn(ScheduleRealInfo sch, Long timestamp){ | 77 | public long applyIn(ScheduleRealInfo sch, Long timestamp){ |
| 78 | LineConfig config = lineConfMap.get(sch.getXlBm()); | 78 | LineConfig config = lineConfMap.get(sch.getXlBm()); |
| 79 | int diff = sch.getXlDir().equals("0")?config.getUpInDiff():config.getDownInDiff(); | 79 | int diff = sch.getXlDir().equals("0")?config.getUpInDiff():config.getDownInDiff(); |
| 80 | - return timestamp - (diff * 1000); | 80 | + return timestamp + (diff * 1000); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | @Component | 83 | @Component |
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
| @@ -54,27 +54,19 @@ public class CarOutInfoHandler { | @@ -54,27 +54,19 @@ public class CarOutInfoHandler { | ||
| 54 | * 全量更新发车信息表 | 54 | * 全量更新发车信息表 |
| 55 | */ | 55 | */ |
| 56 | public void updateAll() { | 56 | public void updateAll() { |
| 57 | - Set<String> ks = BasicData.lineCode2NameMap.keySet(); | ||
| 58 | - for (String lineCode : ks) { | ||
| 59 | - update(lineCode); | ||
| 60 | - } | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - public void update(String lineCode) { | ||
| 64 | - try { | ||
| 65 | - ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap = dayOfSchedule.getLpScheduleMap(); | ||
| 66 | - List<ScheduleRealInfo> list = new ArrayList<>(); | 57 | + try{ |
| 58 | + //将班次按线路分组 | ||
| 59 | + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()); | ||
| 60 | + ArrayListMultimap<String, ScheduleRealInfo> xlMaps = ArrayListMultimap.create(); | ||
| 61 | + for(ScheduleRealInfo sch : all){ | ||
| 62 | + xlMaps.put(sch.getXlBm(), sch); | ||
| 63 | + } | ||
| 67 | 64 | ||
| 68 | - Set<String> ks = lpScheduleMap.keySet(); | ||
| 69 | - String prefix = lineCode + "_"; | 65 | + Set<String> ks = xlMaps.keySet(); |
| 70 | for (String k : ks) { | 66 | for (String k : ks) { |
| 71 | - if (k.startsWith(prefix)) { | ||
| 72 | - list.addAll(lpScheduleMap.get(k)); | ||
| 73 | - } | 67 | + update(xlMaps.get(k)); |
| 74 | } | 68 | } |
| 75 | - | ||
| 76 | - update(list); | ||
| 77 | - } catch (Exception e) { | 69 | + }catch (Exception e){ |
| 78 | logger.error("", e); | 70 | logger.error("", e); |
| 79 | } | 71 | } |
| 80 | } | 72 | } |
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
| 1 | package com.bsth.data.forecast; | 1 | package com.bsth.data.forecast; |
| 2 | 2 | ||
| 3 | -import com.bsth.Application; | ||
| 4 | import com.bsth.data.forecast.entity.ForecastResult; | 3 | import com.bsth.data.forecast.entity.ForecastResult; |
| 5 | import com.bsth.data.forecast.entity.ForecastResult.ForecastResultItem; | 4 | import com.bsth.data.forecast.entity.ForecastResult.ForecastResultItem; |
| 6 | import com.bsth.data.forecast.entity.SimpleRoute; | 5 | import com.bsth.data.forecast.entity.SimpleRoute; |
| @@ -13,7 +12,6 @@ import com.google.common.collect.ArrayListMultimap; | @@ -13,7 +12,6 @@ import com.google.common.collect.ArrayListMultimap; | ||
| 13 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 13 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | -import org.springframework.boot.CommandLineRunner; | ||
| 17 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 18 | 16 | ||
| 19 | import java.text.DecimalFormat; | 17 | import java.text.DecimalFormat; |
| @@ -21,7 +19,6 @@ import java.util.ArrayList; | @@ -21,7 +19,6 @@ import java.util.ArrayList; | ||
| 21 | import java.util.HashMap; | 19 | import java.util.HashMap; |
| 22 | import java.util.List; | 20 | import java.util.List; |
| 23 | import java.util.Map; | 21 | import java.util.Map; |
| 24 | -import java.util.concurrent.TimeUnit; | ||
| 25 | 22 | ||
| 26 | /** | 23 | /** |
| 27 | * | 24 | * |
| @@ -32,10 +29,7 @@ import java.util.concurrent.TimeUnit; | @@ -32,10 +29,7 @@ import java.util.concurrent.TimeUnit; | ||
| 32 | * | 29 | * |
| 33 | */ | 30 | */ |
| 34 | @Component | 31 | @Component |
| 35 | -public class ForecastRealServer implements CommandLineRunner { | ||
| 36 | - | ||
| 37 | - @Autowired | ||
| 38 | - SampleTimeDataLoader dataLoader; | 32 | +public class ForecastRealServer { |
| 39 | 33 | ||
| 40 | @Autowired | 34 | @Autowired |
| 41 | DayOfSchedule dayOfSchedule; | 35 | DayOfSchedule dayOfSchedule; |
| @@ -57,12 +51,6 @@ public class ForecastRealServer implements CommandLineRunner { | @@ -57,12 +51,6 @@ public class ForecastRealServer implements CommandLineRunner { | ||
| 57 | forecastMap = new HashMap<>(); | 51 | forecastMap = new HashMap<>(); |
| 58 | } | 52 | } |
| 59 | 53 | ||
| 60 | - @Override | ||
| 61 | - public void run(String... arg0) throws Exception { | ||
| 62 | - //2小时更新一次站点间耗时数据 | ||
| 63 | - Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | /** | 54 | /** |
| 67 | * | 55 | * |
| 68 | * @Title: forecast | 56 | * @Title: forecast |
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| @@ -79,6 +79,12 @@ public class GpsEntity implements Cloneable{ | @@ -79,6 +79,12 @@ public class GpsEntity implements Cloneable{ | ||
| 79 | @JsonIgnore | 79 | @JsonIgnore |
| 80 | private StationRoute station; | 80 | private StationRoute station; |
| 81 | 81 | ||
| 82 | + /** | ||
| 83 | + * 前置约束 -站点编码 | ||
| 84 | + */ | ||
| 85 | + @JsonIgnore | ||
| 86 | + private String premiseCode; | ||
| 87 | + | ||
| 82 | /** 状态 */ | 88 | /** 状态 */ |
| 83 | private String signalState = "normal"; | 89 | private String signalState = "normal"; |
| 84 | 90 | ||
| @@ -358,4 +364,12 @@ public class GpsEntity implements Cloneable{ | @@ -358,4 +364,12 @@ public class GpsEntity implements Cloneable{ | ||
| 358 | public void setServerTimestamp(Long serverTimestamp) { | 364 | public void setServerTimestamp(Long serverTimestamp) { |
| 359 | this.serverTimestamp = serverTimestamp; | 365 | this.serverTimestamp = serverTimestamp; |
| 360 | } | 366 | } |
| 367 | + | ||
| 368 | + public String getPremiseCode() { | ||
| 369 | + return premiseCode; | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + public void setPremiseCode(String premiseCode) { | ||
| 373 | + this.premiseCode = premiseCode; | ||
| 374 | + } | ||
| 361 | } | 375 | } |
src/main/java/com/bsth/data/gpsdata/arrival/GeoCacheData.java
| @@ -2,8 +2,11 @@ package com.bsth.data.gpsdata.arrival; | @@ -2,8 +2,11 @@ package com.bsth.data.gpsdata.arrival; | ||
| 2 | 2 | ||
| 3 | import com.bsth.data.gpsdata.GpsEntity; | 3 | import com.bsth.data.gpsdata.GpsEntity; |
| 4 | import com.bsth.data.gpsdata.arrival.entity.StationRoute; | 4 | import com.bsth.data.gpsdata.arrival.entity.StationRoute; |
| 5 | +import com.bsth.data.gpsdata.arrival.entity.TimedEnableStationRoute; | ||
| 6 | +import com.bsth.data.gpsdata.arrival.precondition.entity.PreconditionGeo; | ||
| 5 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; | 7 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; |
| 6 | import com.bsth.data.gpsdata.arrival.utils.StationRouteComp; | 8 | import com.bsth.data.gpsdata.arrival.utils.StationRouteComp; |
| 9 | +import com.google.common.base.Splitter; | ||
| 7 | import com.google.common.collect.ArrayListMultimap; | 10 | import com.google.common.collect.ArrayListMultimap; |
| 8 | import com.vividsolutions.jts.geom.Coordinate; | 11 | import com.vividsolutions.jts.geom.Coordinate; |
| 9 | import com.vividsolutions.jts.geom.GeometryFactory; | 12 | import com.vividsolutions.jts.geom.GeometryFactory; |
| @@ -13,6 +16,7 @@ import org.apache.commons.lang3.StringUtils; | @@ -13,6 +16,7 @@ import org.apache.commons.lang3.StringUtils; | ||
| 13 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 16 | import org.springframework.jdbc.core.JdbcTemplate; | 20 | import org.springframework.jdbc.core.JdbcTemplate; |
| 17 | import org.springframework.jdbc.core.RowMapper; | 21 | import org.springframework.jdbc.core.RowMapper; |
| 18 | import org.springframework.stereotype.Component; | 22 | import org.springframework.stereotype.Component; |
| @@ -41,6 +45,8 @@ public class GeoCacheData { | @@ -41,6 +45,8 @@ public class GeoCacheData { | ||
| 41 | 45 | ||
| 42 | //线路站点路由 | 46 | //线路站点路由 |
| 43 | private static ArrayListMultimap<String, StationRoute> stationCacheMap; | 47 | private static ArrayListMultimap<String, StationRoute> stationCacheMap; |
| 48 | + //线路前置进站围栏 | ||
| 49 | + public static ArrayListMultimap<String, PreconditionGeo> premiseGeoMap; | ||
| 44 | 50 | ||
| 45 | //线路_上下行_站点编码 ——> 站点 | 51 | //线路_上下行_站点编码 ——> 站点 |
| 46 | private static Map<String, StationRoute> routeCodeMap; | 52 | private static Map<String, StationRoute> routeCodeMap; |
| @@ -53,6 +59,9 @@ public class GeoCacheData { | @@ -53,6 +59,9 @@ public class GeoCacheData { | ||
| 53 | //线路限速信息 | 59 | //线路限速信息 |
| 54 | private static Map<String, Double> speedLimitMap; | 60 | private static Map<String, Double> speedLimitMap; |
| 55 | 61 | ||
| 62 | + //需要定时刷新的站点路由 | ||
| 63 | + public static Map<String, TimedEnableStationRoute> tesMap = new HashMap<>(); | ||
| 64 | + | ||
| 56 | @Autowired | 65 | @Autowired |
| 57 | JdbcTemplate jdbcTemplate; | 66 | JdbcTemplate jdbcTemplate; |
| 58 | 67 | ||
| @@ -63,10 +72,6 @@ public class GeoCacheData { | @@ -63,10 +72,6 @@ public class GeoCacheData { | ||
| 63 | public static void putGps(GpsEntity gps) { | 72 | public static void putGps(GpsEntity gps) { |
| 64 | CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getNbbm()); | 73 | CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getNbbm()); |
| 65 | if (queue == null) { | 74 | if (queue == null) { |
| 66 | - /*//第一个点从站内开始 | ||
| 67 | - if (gps.getInstation() == 0) | ||
| 68 | - return;*/ | ||
| 69 | - | ||
| 70 | queue = new CircleQueue<>(CACHE_SIZE); | 75 | queue = new CircleQueue<>(CACHE_SIZE); |
| 71 | gpsCacheMap.put(gps.getNbbm(), queue); | 76 | gpsCacheMap.put(gps.getNbbm(), queue); |
| 72 | } | 77 | } |
| @@ -141,6 +146,61 @@ public class GeoCacheData { | @@ -141,6 +146,61 @@ public class GeoCacheData { | ||
| 141 | 146 | ||
| 142 | //加载路段信息 | 147 | //加载路段信息 |
| 143 | loadRoadsData(); | 148 | loadRoadsData(); |
| 149 | + | ||
| 150 | + //加载前置进站围栏 | ||
| 151 | + loadPremiseGeoData(); | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + private void loadPremiseGeoData() { | ||
| 155 | + ArrayListMultimap<String, PreconditionGeo> premiseGeoMapCopy = ArrayListMultimap.create(); | ||
| 156 | + | ||
| 157 | + String sql = "select * from bsth_f_geo_premise"; | ||
| 158 | + List<PreconditionGeo> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(PreconditionGeo.class)); | ||
| 159 | + | ||
| 160 | + List<String> coordList; | ||
| 161 | + String[] cs; | ||
| 162 | + com.bsth.util.Geo.Point point; | ||
| 163 | + List<com.bsth.util.Geo.Point> ps; | ||
| 164 | + StationRoute sr; | ||
| 165 | + for(PreconditionGeo p : list){ | ||
| 166 | + try{ | ||
| 167 | + sr = routeCodeMap.get(p.getLineCode()+"_"+p.getUpDown()+"_"+p.getStationCode()); | ||
| 168 | + p.setOrder(sr.getRouteSort()); | ||
| 169 | + //polygon | ||
| 170 | + ps = new ArrayList<>(); | ||
| 171 | + coordList = Splitter.on(",").trimResults().splitToList(p.getCoords()); | ||
| 172 | + for(String c : coordList){ | ||
| 173 | + cs = c.split(" "); | ||
| 174 | + point = new com.bsth.util.Geo.Point(Double.parseDouble(cs[0]), Double.parseDouble(cs[1])); | ||
| 175 | + ps.add(point); | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + p.setPolygon(new com.bsth.util.Geo.Polygon(ps)); | ||
| 179 | + | ||
| 180 | + sr.setPremise(true); | ||
| 181 | + //按线路,走向分组 | ||
| 182 | + premiseGeoMapCopy.put(p.getLineCode()+"_"+p.getUpDown(), p); | ||
| 183 | + }catch (Exception e){ | ||
| 184 | + logger.error("", e); | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + //排序 | ||
| 189 | + Set<String> ks = premiseGeoMapCopy.keySet(); | ||
| 190 | + PreconditionGeoComp comp = new PreconditionGeoComp(); | ||
| 191 | + for(String k : ks){ | ||
| 192 | + Collections.sort(premiseGeoMapCopy.get(k), comp); | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + premiseGeoMap = premiseGeoMapCopy; | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + private static class PreconditionGeoComp implements Comparator<PreconditionGeo>{ | ||
| 199 | + | ||
| 200 | + @Override | ||
| 201 | + public int compare(PreconditionGeo p1, PreconditionGeo p2) { | ||
| 202 | + return p1.getOrder() - p2.getOrder(); | ||
| 203 | + } | ||
| 144 | } | 204 | } |
| 145 | 205 | ||
| 146 | private void loadRoadsData() { | 206 | private void loadRoadsData() { |
| @@ -282,6 +342,28 @@ public class GeoCacheData { | @@ -282,6 +342,28 @@ public class GeoCacheData { | ||
| 282 | connectStationRoute(tempMap.get(key)); | 342 | connectStationRoute(tempMap.get(key)); |
| 283 | } | 343 | } |
| 284 | 344 | ||
| 345 | + //定时启用的站点走向 | ||
| 346 | + if(tesMap.size() > 0){ | ||
| 347 | + List<String> rems = new ArrayList<>(); | ||
| 348 | + long t = System.currentTimeMillis(); | ||
| 349 | + for(TimedEnableStationRoute tes : tesMap.values()){ | ||
| 350 | + if(tes.getEnableTime() > t){ | ||
| 351 | + logger.info("锁住站点路由," + tes.getLineCode()); | ||
| 352 | + tempMap.replaceValues(tes.getLineCode() + "_0", stationCacheMap.get(tes.getLineCode() + "_0")); | ||
| 353 | + tempMap.replaceValues(tes.getLineCode() + "_1", stationCacheMap.get(tes.getLineCode() + "_1")); | ||
| 354 | + } | ||
| 355 | + else | ||
| 356 | + rems.add(tes.getLineCode()); | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | + //remove | ||
| 360 | + if(rems.size() > 0){ | ||
| 361 | + for(String lineCode : rems){ | ||
| 362 | + logger.info("启用路由," + lineCode); | ||
| 363 | + tesMap.remove(lineCode); | ||
| 364 | + } | ||
| 365 | + } | ||
| 366 | + } | ||
| 285 | stationCacheMap = tempMap; | 367 | stationCacheMap = tempMap; |
| 286 | routeCodeMap = codeMap; | 368 | routeCodeMap = codeMap; |
| 287 | } | 369 | } |
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
| @@ -78,6 +78,7 @@ public abstract class SignalHandle { | @@ -78,6 +78,7 @@ public abstract class SignalHandle { | ||
| 78 | byte updown = Byte.parseByte(sch.getXlDir()); | 78 | byte updown = Byte.parseByte(sch.getXlDir()); |
| 79 | //gps 切换走向 | 79 | //gps 切换走向 |
| 80 | gps.setUpDown(updown); | 80 | gps.setUpDown(updown); |
| 81 | + gps.setPremiseCode(null); | ||
| 81 | 82 | ||
| 82 | List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), updown); | 83 | List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), updown); |
| 83 | StationRoute station = GeoUtils.gpsInStation(gps, srs); | 84 | StationRoute station = GeoUtils.gpsInStation(gps, srs); |
src/main/java/com/bsth/data/gpsdata/arrival/entity/StationRoute.java
| @@ -60,6 +60,11 @@ public class StationRoute { | @@ -60,6 +60,11 @@ public class StationRoute { | ||
| 60 | 60 | ||
| 61 | private String name; | 61 | private String name; |
| 62 | 62 | ||
| 63 | + /** | ||
| 64 | + * 是否有前置进站约束 | ||
| 65 | + */ | ||
| 66 | + private boolean premise; | ||
| 67 | + | ||
| 63 | public String getCode() { | 68 | public String getCode() { |
| 64 | return code; | 69 | return code; |
| 65 | } | 70 | } |
| @@ -147,5 +152,13 @@ public class StationRoute { | @@ -147,5 +152,13 @@ public class StationRoute { | ||
| 147 | public void setName(String name) { | 152 | public void setName(String name) { |
| 148 | this.name = name; | 153 | this.name = name; |
| 149 | } | 154 | } |
| 155 | + | ||
| 156 | + public boolean isPremise() { | ||
| 157 | + return premise; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public void setPremise(boolean premise) { | ||
| 161 | + this.premise = premise; | ||
| 162 | + } | ||
| 150 | } | 163 | } |
| 151 | 164 |
src/main/java/com/bsth/data/gpsdata/arrival/entity/TimedEnableStationRoute.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.arrival.entity; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 定时启用站点路由 | ||
| 5 | + * Created by panzhao on 2017/8/28. | ||
| 6 | + */ | ||
| 7 | +public class TimedEnableStationRoute { | ||
| 8 | + | ||
| 9 | + private String lineCode; | ||
| 10 | + | ||
| 11 | + private Long enableTime; | ||
| 12 | + | ||
| 13 | + public String getLineCode() { | ||
| 14 | + return lineCode; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public void setLineCode(String lineCode) { | ||
| 18 | + this.lineCode = lineCode; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public Long getEnableTime() { | ||
| 22 | + return enableTime; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public void setEnableTime(Long enableTime) { | ||
| 26 | + this.enableTime = enableTime; | ||
| 27 | + } | ||
| 28 | +} |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/AbnormalStateHandle.java
| @@ -65,8 +65,8 @@ public class AbnormalStateHandle extends SignalHandle{ | @@ -65,8 +65,8 @@ public class AbnormalStateHandle extends SignalHandle{ | ||
| 65 | * @return | 65 | * @return |
| 66 | */ | 66 | */ |
| 67 | public boolean outOfBounds(GpsEntity gps){ | 67 | public boolean outOfBounds(GpsEntity gps){ |
| 68 | - //场内的车不处理 | ||
| 69 | - if(gps.getInstation() == 2){ | 68 | + //只处理电子围栏外的车 |
| 69 | + if(gps.getInstation() != 0){ | ||
| 70 | return false; | 70 | return false; |
| 71 | } | 71 | } |
| 72 | 72 |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| @@ -4,6 +4,7 @@ import com.bsth.data.LineConfigData; | @@ -4,6 +4,7 @@ import com.bsth.data.LineConfigData; | ||
| 4 | import com.bsth.data.gpsdata.GpsEntity; | 4 | import com.bsth.data.gpsdata.GpsEntity; |
| 5 | import com.bsth.data.gpsdata.arrival.GeoCacheData; | 5 | import com.bsth.data.gpsdata.arrival.GeoCacheData; |
| 6 | import com.bsth.data.gpsdata.arrival.SignalHandle; | 6 | import com.bsth.data.gpsdata.arrival.SignalHandle; |
| 7 | +import com.bsth.data.gpsdata.arrival.entity.StationRoute; | ||
| 7 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; | 8 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; |
| 8 | import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; | 9 | import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; |
| 9 | import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher; | 10 | import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher; |
| @@ -148,6 +149,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -148,6 +149,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 148 | && (gps.getInstation()==0 || !gps.getStopNo().equals(prev.getStopNo())) | 149 | && (gps.getInstation()==0 || !gps.getStopNo().equals(prev.getStopNo())) |
| 149 | && !willDepart(gps, prev, sch)){ | 150 | && !willDepart(gps, prev, sch)){ |
| 150 | 151 | ||
| 152 | + gps.setPremiseCode(null); | ||
| 151 | //发车班次匹配 | 153 | //发车班次匹配 |
| 152 | signalSchPlanMatcher.outMatch(gps, sch); | 154 | signalSchPlanMatcher.outMatch(gps, sch); |
| 153 | sch = dayOfSchedule.executeCurr(gps.getNbbm()); | 155 | sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| @@ -163,6 +165,10 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -163,6 +165,10 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 163 | 165 | ||
| 164 | //实发时间 | 166 | //实发时间 |
| 165 | sch.setFcsjActualAll(rsT); | 167 | sch.setFcsjActualAll(rsT); |
| 168 | + sch.setSiginCompate(1); | ||
| 169 | + | ||
| 170 | + //出站既出场 | ||
| 171 | + outStationAndOutPark(sch); | ||
| 166 | //通知客户端 | 172 | //通知客户端 |
| 167 | sendUtils.sendFcsj(sch); | 173 | sendUtils.sendFcsj(sch); |
| 168 | //持久化 | 174 | //持久化 |
| @@ -171,12 +177,11 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -171,12 +177,11 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 171 | //清理应发未发标记 | 177 | //清理应发未发标记 |
| 172 | LateAdjustHandle.remove(sch); | 178 | LateAdjustHandle.remove(sch); |
| 173 | 179 | ||
| 174 | - if(!gps.isService()){ | 180 | + if(!gps.isService() && !dayOfSchedule.emptyService(sch)){ |
| 175 | //切换成营运状态 | 181 | //切换成营运状态 |
| 176 | gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 0, "发车@系统"); | 182 | gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 0, "发车@系统"); |
| 177 | } | 183 | } |
| 178 | - //出站既出场 | ||
| 179 | - outStationAndOutPark(sch); | 184 | + |
| 180 | logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual()); | 185 | logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual()); |
| 181 | } | 186 | } |
| 182 | else if(isOutSch(sch)){ | 187 | else if(isOutSch(sch)){ |
| @@ -205,8 +210,8 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -205,8 +210,8 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 205 | } | 210 | } |
| 206 | if(next != null && prev.getStopNo().equals(next.getQdzCode())){ | 211 | if(next != null && prev.getStopNo().equals(next.getQdzCode())){ |
| 207 | //发下一个班次 | 212 | //发下一个班次 |
| 208 | - dayOfSchedule.addExecPlan(next); | ||
| 209 | - outStation(gps, prev); | 213 | + if(dayOfSchedule.addExecPlan(next)) |
| 214 | + outStation(gps, prev); | ||
| 210 | } | 215 | } |
| 211 | } | 216 | } |
| 212 | //当前班次是区间 | 217 | //当前班次是区间 |
| @@ -218,8 +223,8 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -218,8 +223,8 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 218 | //是环线 | 223 | //是环线 |
| 219 | if(prev.getStopNo().equals(next.getQdzCode())){ | 224 | if(prev.getStopNo().equals(next.getQdzCode())){ |
| 220 | //发下一个班次 | 225 | //发下一个班次 |
| 221 | - dayOfSchedule.addExecPlan(next); | ||
| 222 | - outStation(gps, prev); | 226 | + if(dayOfSchedule.addExecPlan(next)) |
| 227 | + outStation(gps, prev); | ||
| 223 | } | 228 | } |
| 224 | } | 229 | } |
| 225 | } | 230 | } |
| @@ -231,6 +236,10 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -231,6 +236,10 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 231 | * @return | 236 | * @return |
| 232 | */ | 237 | */ |
| 233 | private boolean outManyFit(GpsEntity gps, ScheduleRealInfo sch) { | 238 | private boolean outManyFit(GpsEntity gps, ScheduleRealInfo sch) { |
| 239 | + LineConfig conf = lineConfigData.get(sch.getXlBm()); | ||
| 240 | + if(null != conf && conf.isLockFirstOutTime()) | ||
| 241 | + return false;//锁定第一个发车信号,不匹配最佳 | ||
| 242 | + | ||
| 234 | if(StringUtils.isNotEmpty(sch.getZdsjActual())) | 243 | if(StringUtils.isNotEmpty(sch.getZdsjActual())) |
| 235 | return false; | 244 | return false; |
| 236 | 245 | ||
| @@ -238,39 +247,42 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -238,39 +247,42 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 238 | long t2 = gps.getTimestamp(); | 247 | long t2 = gps.getTimestamp(); |
| 239 | long c = sch.getDfsjT(); | 248 | long c = sch.getDfsjT(); |
| 240 | 249 | ||
| 241 | - if(c - t1 > 1000 * 60 * 15 && Math.abs(t2 - c) < 1000 * 60 * 5){ | 250 | + /*if(c - t1 > 1000 * 60 * 15 && Math.abs(t2 - c) < 1000 * 60 * 5){ |
| 251 | + return true; | ||
| 252 | + }*/ | ||
| 253 | + int threshold = 1000 * 60 * 5; | ||
| 254 | + if(Math.abs(t2 - c) < threshold && c - t1 > threshold){ | ||
| 242 | return true; | 255 | return true; |
| 243 | } | 256 | } |
| 257 | + //if(Math.abs(t2 - c) < 1000 * 60 * 5 && c - t1 > 1000 * 60 * 5) | ||
| 244 | return false; | 258 | return false; |
| 245 | } | 259 | } |
| 246 | 260 | ||
| 247 | 261 | ||
| 248 | private void outStationAndOutPark(ScheduleRealInfo sch){ | 262 | private void outStationAndOutPark(ScheduleRealInfo sch){ |
| 249 | - LineConfig config = lineConfigData.get(sch.getXlBm()); | ||
| 250 | - //限定出站既出场的停车场 | ||
| 251 | - String park = config.getTwinsPark(); | ||
| 252 | - boolean limitPark = StringUtils.isNotEmpty(park); | ||
| 253 | - | ||
| 254 | - if (config != null && config.getOutConfig() == 2) { | ||
| 255 | - //出站既出场 | ||
| 256 | - ScheduleRealInfo schPrev = dayOfSchedule.prev(sch); | ||
| 257 | - if (schPrev != null && schPrev.getBcType().equals("out") | ||
| 258 | - && (!limitPark || park.equals(schPrev.getQdzCode()))) { | ||
| 259 | - | ||
| 260 | - schPrev.setFcsjActualAll(sch.getFcsjActualTime()); | ||
| 261 | - schPrev.setZdsjActualAll(sch.getFcsjActualTime()); | ||
| 262 | - | ||
| 263 | - sendUtils.refreshSch(schPrev); | ||
| 264 | - dayOfSchedule.save(schPrev); | ||
| 265 | - | ||
| 266 | - /*if(schPrev.getBcType().equals("out")){ | ||
| 267 | - //出场时,切换成营运状态 | ||
| 268 | - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh()); | ||
| 269 | - gpsStatusManager.changeServiceState(deviceId, schPrev.getXlDir(), 0, "出场@系统"); | ||
| 270 | - //DirectivePushQueue.put6003(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), "出场@系统"); | ||
| 271 | - //directiveService.send60Operation(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), null, "出场@系统"); | ||
| 272 | - }*/ | 263 | + try{ |
| 264 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | ||
| 265 | + //限定出站既出场的停车场 | ||
| 266 | + String park = config.getTwinsPark(); | ||
| 267 | + boolean limitPark = StringUtils.isNotEmpty(park); | ||
| 268 | + | ||
| 269 | + if (config != null && config.getOutConfig() == 2) { | ||
| 270 | + //出站既出场 | ||
| 271 | + ScheduleRealInfo schPrev = dayOfSchedule.prev(sch); | ||
| 272 | + if (schPrev != null && schPrev.getBcType().equals("out") && (schPrev.getBcsj()==0 || schPrev.getJhlcOrig().intValue()==0) | ||
| 273 | + && (!limitPark || park.equals(schPrev.getQdzCode()))) { | ||
| 274 | + | ||
| 275 | + schPrev.setFcsjActualAll(sch.getFcsjActualTime()); | ||
| 276 | + schPrev.setZdsjActualAll(sch.getFcsjActualTime()); | ||
| 277 | + //起点实到 | ||
| 278 | + sch.setQdzArrDatesj(schPrev.getZdsjActual()); | ||
| 279 | + | ||
| 280 | + sendUtils.refreshSch(schPrev); | ||
| 281 | + dayOfSchedule.save(schPrev); | ||
| 282 | + } | ||
| 273 | } | 283 | } |
| 284 | + }catch (Exception e){ | ||
| 285 | + logger.error("", e); | ||
| 274 | } | 286 | } |
| 275 | } | 287 | } |
| 276 | 288 | ||
| @@ -283,7 +295,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -283,7 +295,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 283 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); | 295 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 284 | 296 | ||
| 285 | if(gps.getStopNo().equals(sch.getZdzCode()) | 297 | if(gps.getStopNo().equals(sch.getZdzCode()) |
| 286 | - && !gps.getStopNo().equals(prev.getStopNo())){ | 298 | + && (!gps.getStopNo().equals(prev.getStopNo()) || gps.getStopNo().equals(prev.getPremiseCode()))){ |
| 287 | 299 | ||
| 288 | int diff = 0; | 300 | int diff = 0; |
| 289 | try{ | 301 | try{ |
| @@ -299,6 +311,11 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -299,6 +311,11 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 299 | if(Math.abs(diff) > MAX_NORMAL_DIFF) | 311 | if(Math.abs(diff) > MAX_NORMAL_DIFF) |
| 300 | return; | 312 | return; |
| 301 | 313 | ||
| 314 | + //校验进站前置约束 | ||
| 315 | + if(!validInPremise(gps)){ | ||
| 316 | + return; | ||
| 317 | + } | ||
| 318 | + | ||
| 302 | //环线或内外圈 ,飘出去再回来 | 319 | //环线或内外圈 ,飘出去再回来 |
| 303 | if(sch.getQdzCode().equals(sch.getZdzCode()) | 320 | if(sch.getQdzCode().equals(sch.getZdzCode()) |
| 304 | && StringUtils.isNotEmpty(sch.getFcsjActual()) | 321 | && StringUtils.isNotEmpty(sch.getFcsjActual()) |
| @@ -316,7 +333,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -316,7 +333,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 316 | long rsT = lineConfigData.applyIn(sch, gps.getTimestamp()); | 333 | long rsT = lineConfigData.applyIn(sch, gps.getTimestamp()); |
| 317 | 334 | ||
| 318 | sch.setZdsjActualAll(rsT); | 335 | sch.setZdsjActualAll(rsT); |
| 319 | - | 336 | + sch.setSiginCompate(2); |
| 320 | //通知误点停靠程序,有车辆到站 | 337 | //通知误点停靠程序,有车辆到站 |
| 321 | LateAdjustHandle.carArrive(gps); | 338 | LateAdjustHandle.carArrive(gps); |
| 322 | 339 | ||
| @@ -352,11 +369,12 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -352,11 +369,12 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 352 | if(!next.getXlBm().equals(sch.getXlBm())){ | 369 | if(!next.getXlBm().equals(sch.getXlBm())){ |
| 353 | gpsStatusManager.changeLine(next.getClZbh(), next.getXlBm(), "套跑@系统"); | 370 | gpsStatusManager.changeLine(next.getClZbh(), next.getXlBm(), "套跑@系统"); |
| 354 | } | 371 | } |
| 355 | - } | ||
| 356 | - else if(sch.getBcType().equals("in")){ | ||
| 357 | - //进场,切换成非营运状态 | ||
| 358 | - gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 1, "进场@系统"); | ||
| 359 | - } | 372 | + |
| 373 | + //下一个班次是空驶班次 | ||
| 374 | + if(dayOfSchedule.emptyService(next)) | ||
| 375 | + nonService(sch, "空驶@系统"); | ||
| 376 | + } else | ||
| 377 | + nonService(sch, "结束@系统"); | ||
| 360 | } | 378 | } |
| 361 | else { | 379 | else { |
| 362 | /*if(sch.getFcsjActual() == null){ | 380 | /*if(sch.getFcsjActual() == null){ |
| @@ -393,9 +411,8 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -393,9 +411,8 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 393 | 411 | ||
| 394 | if(nearSch != null){ | 412 | if(nearSch != null){ |
| 395 | //直接跳到这个班次 | 413 | //直接跳到这个班次 |
| 396 | - dayOfSchedule.addExecPlan(nearSch); | ||
| 397 | - //重新进站 | ||
| 398 | - inStation(gps, prev); | 414 | + if(dayOfSchedule.addExecPlan(nearSch)) |
| 415 | + inStation(gps, prev);//重新进站 | ||
| 399 | } | 416 | } |
| 400 | } | 417 | } |
| 401 | } | 418 | } |
| @@ -403,6 +420,28 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -403,6 +420,28 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 403 | } | 420 | } |
| 404 | 421 | ||
| 405 | /** | 422 | /** |
| 423 | + * 校验进站前置约束 | ||
| 424 | + * @param gps | ||
| 425 | + * @return | ||
| 426 | + */ | ||
| 427 | + private boolean validInPremise(GpsEntity gps) { | ||
| 428 | + StationRoute sr = gps.getStation(); | ||
| 429 | + if(null == sr || !sr.isPremise()) | ||
| 430 | + return true; | ||
| 431 | + | ||
| 432 | + String premiseCode = gps.getPremiseCode(); | ||
| 433 | + | ||
| 434 | + if(StringUtils.isNotEmpty(premiseCode) && premiseCode.equals(gps.getStopNo())){ | ||
| 435 | + logger.info("满足前置进站约束 " + premiseCode); | ||
| 436 | + return true; | ||
| 437 | + } | ||
| 438 | + else{ | ||
| 439 | + logger.info(gps.getNbbm() + " not premiseCode 不满足前置进站约束 " + premiseCode); | ||
| 440 | + } | ||
| 441 | + return false; | ||
| 442 | + } | ||
| 443 | + | ||
| 444 | + /** | ||
| 406 | * 和当前进站信号最匹配的一个班次 | 445 | * 和当前进站信号最匹配的一个班次 |
| 407 | * @param gps | 446 | * @param gps |
| 408 | * @param halfList | 447 | * @param halfList |
| @@ -420,7 +459,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -420,7 +459,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 420 | String stopId = gps.getStopNo(); | 459 | String stopId = gps.getStopNo(); |
| 421 | for(int i = 0; i < halfList.size(); i ++){ | 460 | for(int i = 0; i < halfList.size(); i ++){ |
| 422 | sch = halfList.get(i); | 461 | sch = halfList.get(i); |
| 423 | - if(!sch.getZdzCode().equals(stopId)) | 462 | + if(!sch.getZdzCode().equals(stopId) || sch.getStatus()==2) |
| 424 | continue; | 463 | continue; |
| 425 | 464 | ||
| 426 | if(sch.getZdsjT() < gps.getTimestamp()) | 465 | if(sch.getZdsjT() < gps.getTimestamp()) |
| @@ -443,7 +482,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -443,7 +482,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 443 | boolean limitPark = StringUtils.isNotEmpty(park); | 482 | boolean limitPark = StringUtils.isNotEmpty(park); |
| 444 | 483 | ||
| 445 | 484 | ||
| 446 | - if (next.getBcType().equals("in") && config.getOutConfig() == 2 | 485 | + if (next.getBcType().equals("in") && config.getOutConfig() == 2 && (next.getBcsj()==0 || next.getJhlcOrig().equals(0)) |
| 447 | && (!limitPark || park.equals(next.getZdzCode()))) { | 486 | && (!limitPark || park.equals(next.getZdzCode()))) { |
| 448 | 487 | ||
| 449 | next.setFcsjActualAll(sch.getZdsjActualTime()); | 488 | next.setFcsjActualAll(sch.getZdsjActualTime()); |
| @@ -458,7 +497,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -458,7 +497,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 458 | dayOfSchedule.addExecPlan(next); | 497 | dayOfSchedule.addExecPlan(next); |
| 459 | 498 | ||
| 460 | //进场,切换成非营运状态 | 499 | //进场,切换成非营运状态 |
| 461 | - gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 1, "进场@系统"); | 500 | + nonService(sch, "进场@系统"); |
| 462 | } | 501 | } |
| 463 | } | 502 | } |
| 464 | 503 | ||
| @@ -514,4 +553,13 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -514,4 +553,13 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 514 | private boolean isInSch(ScheduleRealInfo sch){ | 553 | private boolean isInSch(ScheduleRealInfo sch){ |
| 515 | return sch.getBcType().equals("in") || GeoCacheData.tccMap.keySet().contains(sch.getZdzCode()); | 554 | return sch.getBcType().equals("in") || GeoCacheData.tccMap.keySet().contains(sch.getZdzCode()); |
| 516 | } | 555 | } |
| 556 | + | ||
| 557 | + /** | ||
| 558 | + * 切换为非营运状态 | ||
| 559 | + * @param sch | ||
| 560 | + * @param sender | ||
| 561 | + */ | ||
| 562 | + private void nonService(ScheduleRealInfo sch, String sender){ | ||
| 563 | + gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 1, sender); | ||
| 564 | + } | ||
| 517 | } | 565 | } |
| 518 | \ No newline at end of file | 566 | \ No newline at end of file |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/StationInsideHandle.java
| @@ -6,6 +6,8 @@ import com.bsth.data.gpsdata.arrival.SignalHandle; | @@ -6,6 +6,8 @@ import com.bsth.data.gpsdata.arrival.SignalHandle; | ||
| 6 | import com.bsth.data.gpsdata.arrival.entity.StationRoute; | 6 | import com.bsth.data.gpsdata.arrival.entity.StationRoute; |
| 7 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; | 7 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; |
| 8 | import com.bsth.data.gpsdata.arrival.utils.GeoUtils; | 8 | import com.bsth.data.gpsdata.arrival.utils.GeoUtils; |
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 9 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
| 10 | 12 | ||
| 11 | import java.util.List; | 13 | import java.util.List; |
| @@ -17,6 +19,7 @@ import java.util.List; | @@ -17,6 +19,7 @@ import java.util.List; | ||
| 17 | @Component | 19 | @Component |
| 18 | public class StationInsideHandle extends SignalHandle { | 20 | public class StationInsideHandle extends SignalHandle { |
| 19 | 21 | ||
| 22 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 20 | 23 | ||
| 21 | @Override | 24 | @Override |
| 22 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { | 25 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| @@ -37,13 +40,41 @@ public class StationInsideHandle extends SignalHandle { | @@ -37,13 +40,41 @@ public class StationInsideHandle extends SignalHandle { | ||
| 37 | gps.setStation(station); | 40 | gps.setStation(station); |
| 38 | } | 41 | } |
| 39 | 42 | ||
| 43 | + //是否在进站前置围栏内 | ||
| 44 | + String premiseCode = GeoUtils.gpsInPremiseGeo(gps); | ||
| 45 | + gps.setPremiseCode(premiseCode); | ||
| 46 | + | ||
| 47 | + if(isNotEmpty(prevs)){ | ||
| 48 | + try { | ||
| 49 | + GpsEntity prev = prevs.getTail(); | ||
| 50 | + //继承前置围栏 | ||
| 51 | + if(null == premiseCode && null != prev.getPremiseCode()) | ||
| 52 | + gps.setPremiseCode(prev.getPremiseCode()); | ||
| 53 | + | ||
| 54 | + //在场,站外 | ||
| 55 | + if(gps.getInstation() == 0){ | ||
| 56 | + //继承上一个点的站点编码 | ||
| 57 | + gps.setStopNo(prev.getStopNo()); | ||
| 58 | + | ||
| 59 | + /*if(null == premiseCode && null != prev.getPremiseCode()) | ||
| 60 | + gps.setPremiseCode(prev.getPremiseCode());*/ | ||
| 61 | + } | ||
| 62 | + /*else if(null != gps.getPremiseCode() && !gps.getStopNo().equals(gps.getPremiseCode())){ | ||
| 63 | + gps.setPremiseCode(null); | ||
| 64 | + }*/ | ||
| 65 | + }catch (Exception e){ | ||
| 66 | + logger.error("", e); | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | +/* | ||
| 40 | //在场,站外 | 71 | //在场,站外 |
| 41 | if(gps.getInstation() == 0 && isNotEmpty(prevs)){ | 72 | if(gps.getInstation() == 0 && isNotEmpty(prevs)){ |
| 42 | //继承上一个点的站点编码 | 73 | //继承上一个点的站点编码 |
| 43 | GpsEntity prev = prevs.getTail(); | 74 | GpsEntity prev = prevs.getTail(); |
| 44 | gps.setStopNo(prev.getStopNo()); | 75 | gps.setStopNo(prev.getStopNo()); |
| 45 | } | 76 | } |
| 46 | - | 77 | +*/ |
| 47 | return true; | 78 | return true; |
| 48 | } | 79 | } |
| 49 | } | 80 | } |
src/main/java/com/bsth/data/gpsdata/arrival/precondition/InPreconditionHandler.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.arrival.precondition; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.gpsdata.GpsEntity; | ||
| 4 | +import org.springframework.stereotype.Component; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 进站(前置电子围栏) | ||
| 8 | + * Created by panzhao on 2017/9/23. | ||
| 9 | + */ | ||
| 10 | +@Component | ||
| 11 | +public class InPreconditionHandler { | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 进站动作是否有通过前置围栏 | ||
| 15 | + * @param gps | ||
| 16 | + * @param prev | ||
| 17 | + * @return | ||
| 18 | + */ | ||
| 19 | + public boolean isPass(GpsEntity gps, GpsEntity prev){ | ||
| 20 | + return false; | ||
| 21 | + } | ||
| 22 | +} |
src/main/java/com/bsth/data/gpsdata/arrival/precondition/entity/PreconditionGeo.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.arrival.precondition.entity; | ||
| 2 | + | ||
| 3 | +import com.bsth.util.Geo.Polygon; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 前置围栏 -地理坐标 | ||
| 7 | + * Created by panzhao on 2017/9/23. | ||
| 8 | + */ | ||
| 9 | +public class PreconditionGeo { | ||
| 10 | + | ||
| 11 | + private String name; | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 前置约束的站点编码 | ||
| 15 | + */ | ||
| 16 | + private String stationCode; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 线路编码 | ||
| 20 | + */ | ||
| 21 | + private String lineCode; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 上下行 | ||
| 25 | + */ | ||
| 26 | + private int upDown; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 多边形坐标 | ||
| 30 | + */ | ||
| 31 | + private String coords; | ||
| 32 | + | ||
| 33 | + private com.bsth.util.Geo.Polygon polygon; | ||
| 34 | + | ||
| 35 | + private Integer order; | ||
| 36 | + | ||
| 37 | + public String getName() { | ||
| 38 | + return name; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public void setName(String name) { | ||
| 42 | + this.name = name; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public String getStationCode() { | ||
| 46 | + return stationCode; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public void setStationCode(String stationCode) { | ||
| 50 | + this.stationCode = stationCode; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public String getLineCode() { | ||
| 54 | + return lineCode; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public void setLineCode(String lineCode) { | ||
| 58 | + this.lineCode = lineCode; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public int getUpDown() { | ||
| 62 | + return upDown; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public void setUpDown(int upDown) { | ||
| 66 | + this.upDown = upDown; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public String getCoords() { | ||
| 70 | + return coords; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public void setCoords(String coords) { | ||
| 74 | + this.coords = coords; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public Integer getOrder() { | ||
| 78 | + return order; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public void setOrder(Integer order) { | ||
| 82 | + this.order = order; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public Polygon getPolygon() { | ||
| 86 | + return polygon; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public void setPolygon(Polygon polygon) { | ||
| 90 | + this.polygon = polygon; | ||
| 91 | + } | ||
| 92 | +} |
src/main/java/com/bsth/data/gpsdata/arrival/utils/GeoUtils.java
| @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata.arrival.utils; | @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata.arrival.utils; | ||
| 3 | import com.bsth.data.gpsdata.GpsEntity; | 3 | import com.bsth.data.gpsdata.GpsEntity; |
| 4 | import com.bsth.data.gpsdata.arrival.GeoCacheData; | 4 | import com.bsth.data.gpsdata.arrival.GeoCacheData; |
| 5 | import com.bsth.data.gpsdata.arrival.entity.StationRoute; | 5 | import com.bsth.data.gpsdata.arrival.entity.StationRoute; |
| 6 | +import com.bsth.data.gpsdata.arrival.precondition.entity.PreconditionGeo; | ||
| 6 | import com.vividsolutions.jts.geom.Coordinate; | 7 | import com.vividsolutions.jts.geom.Coordinate; |
| 7 | import com.vividsolutions.jts.geom.GeometryFactory; | 8 | import com.vividsolutions.jts.geom.GeometryFactory; |
| 8 | import com.vividsolutions.jts.geom.LineString; | 9 | import com.vividsolutions.jts.geom.LineString; |
| @@ -169,6 +170,28 @@ public class GeoUtils { | @@ -169,6 +170,28 @@ public class GeoUtils { | ||
| 169 | } | 170 | } |
| 170 | 171 | ||
| 171 | /** | 172 | /** |
| 173 | + * 是否在进站前置围栏内 | ||
| 174 | + * @param gps | ||
| 175 | + * @return | ||
| 176 | + */ | ||
| 177 | + public static String gpsInPremiseGeo(GpsEntity gps) { | ||
| 178 | + List<PreconditionGeo> list = GeoCacheData.premiseGeoMap.get(gps.getLineId()+"_"+gps.getUpDown()); | ||
| 179 | + | ||
| 180 | + if(null == list || list.size()==0) | ||
| 181 | + return null; | ||
| 182 | + | ||
| 183 | + com.bsth.util.Geo.Point point = new com.bsth.util.Geo.Point(gps.getLon(), gps.getLat()); | ||
| 184 | + com.bsth.util.Geo.Polygon polygon; | ||
| 185 | + for(PreconditionGeo p : list){ | ||
| 186 | + polygon = p.getPolygon(); | ||
| 187 | + if(com.bsth.util.Geo.GeoUtils.isPointInPolygon(point, polygon)){ | ||
| 188 | + return p.getStationCode(); | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | + return null; | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + /** | ||
| 172 | * 是否是有效的连续点 | 195 | * 是否是有效的连续点 |
| 173 | * @param prevGps | 196 | * @param prevGps |
| 174 | * @param gps | 197 | * @param gps |
src/main/java/com/bsth/data/gpsdata/arrival/utils/SignalSchPlanMatcher.java
| @@ -69,8 +69,8 @@ public class SignalSchPlanMatcher { | @@ -69,8 +69,8 @@ public class SignalSchPlanMatcher { | ||
| 69 | double s = (int) (next.getDfsjT() - sch.getDfsjT()); | 69 | double s = (int) (next.getDfsjT() - sch.getDfsjT()); |
| 70 | double r = (int) (t - sch.getDfsjT()); | 70 | double r = (int) (t - sch.getDfsjT()); |
| 71 | if(r / s > 0.7){ | 71 | if(r / s > 0.7){ |
| 72 | - dayOfSchedule.addExecPlan(next); | ||
| 73 | - outMatch(outSigal, next); | 72 | + if(dayOfSchedule.addExecPlan(next)) |
| 73 | + outMatch(outSigal, next); | ||
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | 76 |
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
| @@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 60 | for (String nbbm : keys) { | 60 | for (String nbbm : keys) { |
| 61 | Collections.sort(listMap.get(nbbm), comp); | 61 | Collections.sort(listMap.get(nbbm), comp); |
| 62 | threadPool.execute(new RecoveryThread(listMap.get(nbbm), count)); | 62 | threadPool.execute(new RecoveryThread(listMap.get(nbbm), count)); |
| 63 | - /*if(nbbm.equals("W9H-088")) | 63 | + /*if(nbbm.equals("W2H-015")) |
| 64 | new RecoveryThread(listMap.get(nbbm), count).run();*/ | 64 | new RecoveryThread(listMap.get(nbbm), count).run();*/ |
| 65 | /*if(lineId.equals("60028")) | 65 | /*if(lineId.equals("60028")) |
| 66 | new RecoveryThread(listMap.get(lineId), count).run();*/ | 66 | new RecoveryThread(listMap.get(lineId), count).run();*/ |
| @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 84 | Calendar calendar = Calendar.getInstance(); | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | ||
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=207";// + dayOfYear; | 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=267";// + dayOfYear; |
| 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | ||
| 90 | List<GpsEntity> list = | 90 | List<GpsEntity> list = |
| @@ -153,7 +153,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -153,7 +153,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 153 | boolean task; | 153 | boolean task; |
| 154 | for (GpsEntity gps : list) { | 154 | for (GpsEntity gps : list) { |
| 155 | try { | 155 | try { |
| 156 | - /*if(gps.getTimestamp() >= 1500942270000L){ | 156 | + /*if(gps.getTimestamp() >= 1506216540000L){ |
| 157 | System.out.println("debugger..."); | 157 | System.out.println("debugger..."); |
| 158 | }*/ | 158 | }*/ |
| 159 | //是否有任务 | 159 | //是否有任务 |
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
| @@ -48,11 +48,11 @@ public class GpsDataLoaderThread extends Thread { | @@ -48,11 +48,11 @@ public class GpsDataLoaderThread extends Thread { | ||
| 48 | //0:从GPS客户端内存获取 -1:从网关获取 | 48 | //0:从GPS客户端内存获取 -1:从网关获取 |
| 49 | private static int flag = 0; | 49 | private static int flag = 0; |
| 50 | 50 | ||
| 51 | - public static void setFlag(int v){ | 51 | + public static void setFlag(int v) { |
| 52 | flag = v; | 52 | flag = v; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | - public static int getFlag(int v){ | 55 | + public static int getFlag(int v) { |
| 56 | return flag; | 56 | return flag; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| @@ -65,7 +65,7 @@ public class GpsDataLoaderThread extends Thread { | @@ -65,7 +65,7 @@ public class GpsDataLoaderThread extends Thread { | ||
| 65 | @Override | 65 | @Override |
| 66 | public void run() { | 66 | public void run() { |
| 67 | try { | 67 | try { |
| 68 | - if(flag == 0) | 68 | + if (flag == 0) |
| 69 | load(); | 69 | load(); |
| 70 | else | 70 | else |
| 71 | loadByGateway(); | 71 | loadByGateway(); |
| @@ -76,6 +76,7 @@ public class GpsDataLoaderThread extends Thread { | @@ -76,6 +76,7 @@ public class GpsDataLoaderThread extends Thread { | ||
| 76 | 76 | ||
| 77 | /** | 77 | /** |
| 78 | * 从网关获取实时GPS数据 | 78 | * 从网关获取实时GPS数据 |
| 79 | + * | ||
| 79 | * @throws Exception | 80 | * @throws Exception |
| 80 | */ | 81 | */ |
| 81 | public void loadByGateway() throws Exception { | 82 | public void loadByGateway() throws Exception { |
| @@ -107,6 +108,9 @@ public class GpsDataLoaderThread extends Thread { | @@ -107,6 +108,9 @@ public class GpsDataLoaderThread extends Thread { | ||
| 107 | if (jsonObj != null) | 108 | if (jsonObj != null) |
| 108 | list = JSON.parseArray(jsonObj.getString("data"), GpsEntity.class); | 109 | list = JSON.parseArray(jsonObj.getString("data"), GpsEntity.class); |
| 109 | 110 | ||
| 111 | + //过滤掉无效的点位 | ||
| 112 | + list = filterInvalid(list); | ||
| 113 | + | ||
| 110 | String nbbm; | 114 | String nbbm; |
| 111 | GpsEntity old; | 115 | GpsEntity old; |
| 112 | for (GpsEntity gps : list) { | 116 | for (GpsEntity gps : list) { |
| @@ -130,7 +134,7 @@ public class GpsDataLoaderThread extends Thread { | @@ -130,7 +134,7 @@ public class GpsDataLoaderThread extends Thread { | ||
| 130 | //有更新的点位 | 134 | //有更新的点位 |
| 131 | updateList.add(gps); | 135 | updateList.add(gps); |
| 132 | } | 136 | } |
| 133 | - logger.info("全量点:"+ list.size() +",更新点" + updateList.size()); | 137 | + logger.info("全量点:" + list.size() + ",更新点" + updateList.size()); |
| 134 | //分析数据 | 138 | //分析数据 |
| 135 | gpsRealAnalyse.analyse(updateList); | 139 | gpsRealAnalyse.analyse(updateList); |
| 136 | } else | 140 | } else |
| @@ -146,9 +150,33 @@ public class GpsDataLoaderThread extends Thread { | @@ -146,9 +150,33 @@ public class GpsDataLoaderThread extends Thread { | ||
| 146 | } | 150 | } |
| 147 | 151 | ||
| 148 | /** | 152 | /** |
| 153 | + * 过滤无效的gps点位 | ||
| 154 | + * | ||
| 155 | + * @param list | ||
| 156 | + * @return | ||
| 157 | + */ | ||
| 158 | + private List<GpsEntity> filterInvalid(List<GpsEntity> list) { | ||
| 159 | + List<GpsEntity> rsList = new ArrayList<>(); | ||
| 160 | + | ||
| 161 | + try { | ||
| 162 | + for (GpsEntity gps : list) { | ||
| 163 | + if (gps.getValid() == 0) | ||
| 164 | + rsList.add(gps); | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + if (rsList.size() < list.size()) | ||
| 168 | + logger.info("过滤无效的点位 : " + (list.size() - rsList.size())); | ||
| 169 | + } catch (Exception e) { | ||
| 170 | + logger.error("", e); | ||
| 171 | + rsList = list; | ||
| 172 | + } | ||
| 173 | + return rsList; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + /** | ||
| 149 | * 从客户端内存获取GPS数据 | 177 | * 从客户端内存获取GPS数据 |
| 150 | */ | 178 | */ |
| 151 | - public void load() throws Exception{ | 179 | + public void load() throws Exception { |
| 152 | List<GpsEntity> list = null; | 180 | List<GpsEntity> list = null; |
| 153 | CloseableHttpClient httpClient = null; | 181 | CloseableHttpClient httpClient = null; |
| 154 | CloseableHttpResponse response = null; | 182 | CloseableHttpResponse response = null; |
| @@ -174,6 +202,10 @@ public class GpsDataLoaderThread extends Thread { | @@ -174,6 +202,10 @@ public class GpsDataLoaderThread extends Thread { | ||
| 174 | stringBuffer.append(str); | 202 | stringBuffer.append(str); |
| 175 | 203 | ||
| 176 | list = JSON.parseArray(stringBuffer.toString(), GpsEntity.class); | 204 | list = JSON.parseArray(stringBuffer.toString(), GpsEntity.class); |
| 205 | + | ||
| 206 | + //过滤掉无效的点位 | ||
| 207 | + list = filterInvalid(list); | ||
| 208 | + | ||
| 177 | String nbbm; | 209 | String nbbm; |
| 178 | logger.info("load end!"); | 210 | logger.info("load end!"); |
| 179 | for (GpsEntity gps : list) { | 211 | for (GpsEntity gps : list) { |
src/main/java/com/bsth/data/msg_queue/DirectivePushQueue.java
| @@ -5,7 +5,6 @@ import com.bsth.service.directive.DirectiveService; | @@ -5,7 +5,6 @@ import com.bsth.service.directive.DirectiveService; | ||
| 5 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
| 7 | import org.springframework.beans.BeansException; | 7 | import org.springframework.beans.BeansException; |
| 8 | -import org.springframework.boot.CommandLineRunner; | ||
| 9 | import org.springframework.context.ApplicationContext; | 8 | import org.springframework.context.ApplicationContext; |
| 10 | import org.springframework.context.ApplicationContextAware; | 9 | import org.springframework.context.ApplicationContextAware; |
| 11 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| @@ -17,7 +16,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; | @@ -17,7 +16,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; | ||
| 17 | * Created by panzhao on 2017/5/11. | 16 | * Created by panzhao on 2017/5/11. |
| 18 | */ | 17 | */ |
| 19 | @Component | 18 | @Component |
| 20 | -public class DirectivePushQueue implements CommandLineRunner, ApplicationContextAware { | 19 | +public class DirectivePushQueue implements ApplicationContextAware { |
| 21 | 20 | ||
| 22 | static ConcurrentLinkedQueue<QueueData_Directive> linkedList; | 21 | static ConcurrentLinkedQueue<QueueData_Directive> linkedList; |
| 23 | static DataPushThread thread; | 22 | static DataPushThread thread; |
| @@ -80,10 +79,10 @@ public class DirectivePushQueue implements CommandLineRunner, ApplicationContext | @@ -80,10 +79,10 @@ public class DirectivePushQueue implements CommandLineRunner, ApplicationContext | ||
| 80 | return linkedList.size(); | 79 | return linkedList.size(); |
| 81 | } | 80 | } |
| 82 | 81 | ||
| 83 | - @Override | 82 | +/* @Override |
| 84 | public void run(String... strings) throws Exception { | 83 | public void run(String... strings) throws Exception { |
| 85 | start(); | 84 | start(); |
| 86 | - } | 85 | + }*/ |
| 87 | 86 | ||
| 88 | @Override | 87 | @Override |
| 89 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | 88 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
src/main/java/com/bsth/data/msg_queue/WebSocketPushQueue.java
| @@ -3,7 +3,6 @@ package com.bsth.data.msg_queue; | @@ -3,7 +3,6 @@ package com.bsth.data.msg_queue; | ||
| 3 | import com.bsth.common.Constants; | 3 | import com.bsth.common.Constants; |
| 4 | import org.slf4j.Logger; | 4 | import org.slf4j.Logger; |
| 5 | import org.slf4j.LoggerFactory; | 5 | import org.slf4j.LoggerFactory; |
| 6 | -import org.springframework.boot.CommandLineRunner; | ||
| 7 | import org.springframework.stereotype.Component; | 6 | import org.springframework.stereotype.Component; |
| 8 | import org.springframework.web.socket.TextMessage; | 7 | import org.springframework.web.socket.TextMessage; |
| 9 | import org.springframework.web.socket.WebSocketSession; | 8 | import org.springframework.web.socket.WebSocketSession; |
| @@ -15,7 +14,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; | @@ -15,7 +14,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; | ||
| 15 | * Created by panzhao on 2017/5/11. | 14 | * Created by panzhao on 2017/5/11. |
| 16 | */ | 15 | */ |
| 17 | @Component | 16 | @Component |
| 18 | -public class WebSocketPushQueue implements CommandLineRunner { | 17 | +public class WebSocketPushQueue { |
| 19 | 18 | ||
| 20 | static ConcurrentLinkedQueue<QueueData> linkedList; | 19 | static ConcurrentLinkedQueue<QueueData> linkedList; |
| 21 | static DataPushThread thread; | 20 | static DataPushThread thread; |
| @@ -54,10 +53,6 @@ public class WebSocketPushQueue implements CommandLineRunner { | @@ -54,10 +53,6 @@ public class WebSocketPushQueue implements CommandLineRunner { | ||
| 54 | return linkedList.size(); | 53 | return linkedList.size(); |
| 55 | } | 54 | } |
| 56 | 55 | ||
| 57 | - @Override | ||
| 58 | - public void run(String... strings) throws Exception { | ||
| 59 | - start(); | ||
| 60 | - } | ||
| 61 | 56 | ||
| 62 | public static class DataPushThread extends Thread { | 57 | public static class DataPushThread extends Thread { |
| 63 | 58 |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -278,12 +278,14 @@ public class DayOfSchedule { | @@ -278,12 +278,14 @@ public class DayOfSchedule { | ||
| 278 | List<String> lprms = new ArrayList<>(); | 278 | List<String> lprms = new ArrayList<>(); |
| 279 | Set<String> lps = lpScheduleMap.keySet(); | 279 | Set<String> lps = lpScheduleMap.keySet(); |
| 280 | for (String lp : lps) { | 280 | for (String lp : lps) { |
| 281 | - if (lp.indexOf(lineCode + "_") != -1) | 281 | + if (lp.startsWith(lineCode + "_")) |
| 282 | lprms.add(lp); | 282 | lprms.add(lp); |
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | - for (String lp : lprms) | 285 | + for (String lp : lprms){ |
| 286 | + logger.info("清理路牌映射 " + lp); | ||
| 286 | lpScheduleMap.removeAll(lp); | 287 | lpScheduleMap.removeAll(lp); |
| 288 | + } | ||
| 287 | 289 | ||
| 288 | logger.info(lineCode + "排班清理 " + count); | 290 | logger.info(lineCode + "排班清理 " + count); |
| 289 | } | 291 | } |
| @@ -571,7 +573,7 @@ public class DayOfSchedule { | @@ -571,7 +573,7 @@ public class DayOfSchedule { | ||
| 571 | continue; | 573 | continue; |
| 572 | 574 | ||
| 573 | //出站既出场,忽略出场班次 | 575 | //出站既出场,忽略出场班次 |
| 574 | - if (outConfig == 2 && temp.getBcType().equals("out") | 576 | + if (outConfig == 2 && temp.getBcType().equals("out") && (temp.getBcsj()==0 || temp.getJhlcOrig().equals(0)) |
| 575 | && (!limitPark || park.equals(temp.getQdzCode()))) | 577 | && (!limitPark || park.equals(temp.getQdzCode()))) |
| 576 | continue; | 578 | continue; |
| 577 | 579 | ||
| @@ -590,7 +592,7 @@ public class DayOfSchedule { | @@ -590,7 +592,7 @@ public class DayOfSchedule { | ||
| 590 | * @param sch 当前班次 | 592 | * @param sch 当前班次 |
| 591 | * @return | 593 | * @return |
| 592 | */ | 594 | */ |
| 593 | - private ScheduleRealInfo next2(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) { | 595 | + private ScheduleRealInfo next2_lp(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) { |
| 594 | int outConfig = -1; | 596 | int outConfig = -1; |
| 595 | LineConfig config = lineConfigData.get(sch.getXlBm()); | 597 | LineConfig config = lineConfigData.get(sch.getXlBm()); |
| 596 | if (config != null) | 598 | if (config != null) |
| @@ -603,8 +605,35 @@ public class DayOfSchedule { | @@ -603,8 +605,35 @@ public class DayOfSchedule { | ||
| 603 | flag = true; | 605 | flag = true; |
| 604 | continue; | 606 | continue; |
| 605 | } | 607 | } |
| 606 | - //忽略烂班 | ||
| 607 | - if (temp.isDestroy()) | 608 | + |
| 609 | + if (flag) { | ||
| 610 | + next = temp; | ||
| 611 | + break; | ||
| 612 | + } | ||
| 613 | + } | ||
| 614 | + return next; | ||
| 615 | + } | ||
| 616 | + | ||
| 617 | + private ScheduleRealInfo next3_lp(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) { | ||
| 618 | + int outConfig = -1; | ||
| 619 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | ||
| 620 | + if (config != null) | ||
| 621 | + outConfig = config.getOutConfig(); | ||
| 622 | + | ||
| 623 | + //限定出站既出场的停车场 | ||
| 624 | + String park = config.getTwinsPark(); | ||
| 625 | + boolean limitPark = StringUtils.isNotEmpty(park); | ||
| 626 | + boolean flag = false; | ||
| 627 | + ScheduleRealInfo next = null; | ||
| 628 | + for (ScheduleRealInfo temp : list) { | ||
| 629 | + if (temp.getId() == sch.getId()) { | ||
| 630 | + flag = true; | ||
| 631 | + continue; | ||
| 632 | + } | ||
| 633 | + | ||
| 634 | + //出站既出场,忽略出场班次 | ||
| 635 | + if (outConfig == 2 && temp.getBcType().equals("out") && (temp.getBcsj()==0 || temp.getJhlcOrig().equals(0)) | ||
| 636 | + && (!limitPark || park.equals(temp.getQdzCode()))) | ||
| 608 | continue; | 637 | continue; |
| 609 | 638 | ||
| 610 | if (flag) { | 639 | if (flag) { |
| @@ -729,7 +758,7 @@ public class DayOfSchedule { | @@ -729,7 +758,7 @@ public class DayOfSchedule { | ||
| 729 | /** | 758 | /** |
| 730 | * @Title: prveNotExecNum | 759 | * @Title: prveNotExecNum |
| 731 | * @Description: TODO(班次之前未执行班次数量) | 760 | * @Description: TODO(班次之前未执行班次数量) |
| 732 | - */ | 761 | + |
| 733 | public int prveNotExecNum(ScheduleRealInfo sch) { | 762 | public int prveNotExecNum(ScheduleRealInfo sch) { |
| 734 | int n = 0; | 763 | int n = 0; |
| 735 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | 764 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); |
| @@ -741,29 +770,29 @@ public class DayOfSchedule { | @@ -741,29 +770,29 @@ public class DayOfSchedule { | ||
| 741 | break; | 770 | break; |
| 742 | } | 771 | } |
| 743 | return n; | 772 | return n; |
| 744 | - } | 773 | + }*/ |
| 745 | 774 | ||
| 746 | /** | 775 | /** |
| 747 | * @Title: validEndTime | 776 | * @Title: validEndTime |
| 748 | * @Description: TODO(是否是有效的到达时间) | 777 | * @Description: TODO(是否是有效的到达时间) |
| 749 | - */ | 778 | + |
| 750 | public boolean validEndTime(ScheduleRealInfo sch, Long ts) { | 779 | public boolean validEndTime(ScheduleRealInfo sch, Long ts) { |
| 751 | if (sch.getFcsjActualTime() != null && sch.getFcsjActualTime() > ts) | 780 | if (sch.getFcsjActualTime() != null && sch.getFcsjActualTime() > ts) |
| 752 | return false; | 781 | return false; |
| 753 | 782 | ||
| 754 | return validTime(sch, ts); | 783 | return validTime(sch, ts); |
| 755 | - } | 784 | + }*/ |
| 756 | 785 | ||
| 757 | /** | 786 | /** |
| 758 | * @Title: validStartTime | 787 | * @Title: validStartTime |
| 759 | * @Description: TODO(是否是合适的发车时间) | 788 | * @Description: TODO(是否是合适的发车时间) |
| 760 | - */ | 789 | + |
| 761 | public boolean validStartTime(ScheduleRealInfo sch, Long ts) { | 790 | public boolean validStartTime(ScheduleRealInfo sch, Long ts) { |
| 762 | if (sch.getZdsjActualTime() != null && sch.getZdsjActualTime() < ts) | 791 | if (sch.getZdsjActualTime() != null && sch.getZdsjActualTime() < ts) |
| 763 | return false; | 792 | return false; |
| 764 | 793 | ||
| 765 | return validTime(sch, ts); | 794 | return validTime(sch, ts); |
| 766 | - } | 795 | + }*/ |
| 767 | 796 | ||
| 768 | public boolean validTime(ScheduleRealInfo sch, Long ts) { | 797 | public boolean validTime(ScheduleRealInfo sch, Long ts) { |
| 769 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | 798 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); |
| @@ -875,15 +904,16 @@ public class DayOfSchedule { | @@ -875,15 +904,16 @@ public class DayOfSchedule { | ||
| 875 | return outList; | 904 | return outList; |
| 876 | } | 905 | } |
| 877 | 906 | ||
| 878 | - public Set<String> allCar() { | 907 | +/* public Set<String> allCar() { |
| 879 | return nbbmScheduleMap.keySet(); | 908 | return nbbmScheduleMap.keySet(); |
| 880 | - } | 909 | + }*/ |
| 881 | 910 | ||
| 882 | public Collection<ScheduleRealInfo> findAll() { | 911 | public Collection<ScheduleRealInfo> findAll() { |
| 883 | return nbbmScheduleMap.values(); | 912 | return nbbmScheduleMap.values(); |
| 884 | } | 913 | } |
| 885 | 914 | ||
| 886 | - public void addExecPlan(ScheduleRealInfo sch) { | 915 | + public boolean addExecPlan(ScheduleRealInfo sch) { |
| 916 | + ScheduleRealInfo oldExec = executeCurr(sch.getClZbh()); | ||
| 887 | if (sch != null){ | 917 | if (sch != null){ |
| 888 | if(sch.getStatus()==2) | 918 | if(sch.getStatus()==2) |
| 889 | reCalcExecPlan(sch.getClZbh()); | 919 | reCalcExecPlan(sch.getClZbh()); |
| @@ -892,6 +922,8 @@ public class DayOfSchedule { | @@ -892,6 +922,8 @@ public class DayOfSchedule { | ||
| 892 | } | 922 | } |
| 893 | else | 923 | else |
| 894 | carExecutePlanMap.remove(sch.getClZbh()); | 924 | carExecutePlanMap.remove(sch.getClZbh()); |
| 925 | + | ||
| 926 | + return executeCurr(sch.getClZbh()) != oldExec; | ||
| 895 | } | 927 | } |
| 896 | 928 | ||
| 897 | public void removeExecPlan(String clzbh) { | 929 | public void removeExecPlan(String clzbh) { |
| @@ -939,15 +971,16 @@ public class DayOfSchedule { | @@ -939,15 +971,16 @@ public class DayOfSchedule { | ||
| 939 | return ups; | 971 | return ups; |
| 940 | } | 972 | } |
| 941 | 973 | ||
| 942 | - public void removeNbbm2SchMapp(ScheduleRealInfo sch, String nbbm) { | ||
| 943 | - nbbmScheduleMap.remove(nbbm, sch); | 974 | + public void removeNbbm2SchMapp(ScheduleRealInfo sch) { |
| 975 | + nbbmScheduleMap.remove(sch.getClZbh(), sch); | ||
| 944 | } | 976 | } |
| 945 | 977 | ||
| 946 | - public void addNbbm2SchMapp(ScheduleRealInfo sch, String nbbm) { | ||
| 947 | - nbbmScheduleMap.put(nbbm, sch); | 978 | + public void addNbbm2SchMapp(ScheduleRealInfo sch) { |
| 979 | + nbbmScheduleMap.put(sch.getClZbh(), sch); | ||
| 948 | } | 980 | } |
| 949 | 981 | ||
| 950 | public void reCalcExecPlan(String nbbm) { | 982 | public void reCalcExecPlan(String nbbm) { |
| 983 | + logger.info("reCalcExecPlan...: " + nbbm); | ||
| 951 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm); | 984 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm); |
| 952 | Collections.sort(list, schFCSJComparator); | 985 | Collections.sort(list, schFCSJComparator); |
| 953 | 986 | ||
| @@ -1119,7 +1152,7 @@ public class DayOfSchedule { | @@ -1119,7 +1152,7 @@ public class DayOfSchedule { | ||
| 1119 | public ScheduleRealInfo nextByLp(ScheduleRealInfo sch) { | 1152 | public ScheduleRealInfo nextByLp(ScheduleRealInfo sch) { |
| 1120 | List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName()); | 1153 | List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName()); |
| 1121 | Collections.sort(list, schFCSJComparator); | 1154 | Collections.sort(list, schFCSJComparator); |
| 1122 | - return next(list, sch); | 1155 | + return next3_lp(list, sch); |
| 1123 | } | 1156 | } |
| 1124 | 1157 | ||
| 1125 | /** | 1158 | /** |
| @@ -1131,10 +1164,22 @@ public class DayOfSchedule { | @@ -1131,10 +1164,22 @@ public class DayOfSchedule { | ||
| 1131 | public ScheduleRealInfo nextByLp2(ScheduleRealInfo sch) { | 1164 | public ScheduleRealInfo nextByLp2(ScheduleRealInfo sch) { |
| 1132 | List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName()); | 1165 | List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName()); |
| 1133 | Collections.sort(list, schFCSJComparator); | 1166 | Collections.sort(list, schFCSJComparator); |
| 1134 | - return next2(list, sch); | 1167 | + return next2_lp(list, sch); |
| 1135 | } | 1168 | } |
| 1136 | 1169 | ||
| 1137 | public ArrayListMultimap<String, ScheduleRealInfo> getLpScheduleMap() { | 1170 | public ArrayListMultimap<String, ScheduleRealInfo> getLpScheduleMap() { |
| 1138 | return lpScheduleMap; | 1171 | return lpScheduleMap; |
| 1139 | } | 1172 | } |
| 1173 | + | ||
| 1174 | + /** | ||
| 1175 | + * 重新全量计算路牌下的班次关联性 | ||
| 1176 | + * 临时性的函数 | ||
| 1177 | + */ | ||
| 1178 | + public void _test_reCalcLpSch() { | ||
| 1179 | + Map<String ,Collection<ScheduleRealInfo>> map = lpScheduleMap.asMap(); | ||
| 1180 | + Set<String> ks = map.keySet(); | ||
| 1181 | + for(String k : ks){ | ||
| 1182 | + schAttrCalculator.calcQdzTimePlan(new ArrayList<ScheduleRealInfo>(map.get(k))); | ||
| 1183 | + } | ||
| 1184 | + } | ||
| 1140 | } | 1185 | } |
| 1141 | \ No newline at end of file | 1186 | \ No newline at end of file |
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
| @@ -17,212 +17,291 @@ import java.util.Collections; | @@ -17,212 +17,291 @@ import java.util.Collections; | ||
| 17 | import java.util.List; | 17 | import java.util.List; |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | - * | 20 | + * @author PanZhao |
| 21 | * @ClassName: SchAttrCalculator | 21 | * @ClassName: SchAttrCalculator |
| 22 | * @Description: TODO(班次相关属性计算器) | 22 | * @Description: TODO(班次相关属性计算器) |
| 23 | - * @author PanZhao | ||
| 24 | * @date 2016年8月15日 下午4:40:26 | 23 | * @date 2016年8月15日 下午4:40:26 |
| 25 | - * | ||
| 26 | */ | 24 | */ |
| 27 | @Component | 25 | @Component |
| 28 | public class SchAttrCalculator { | 26 | public class SchAttrCalculator { |
| 29 | 27 | ||
| 30 | - @Autowired | ||
| 31 | - LineConfigData lineConfigData; | ||
| 32 | - | ||
| 33 | - private final static long DAY_TIME = 1000 * 60 * 60 * 24L; | ||
| 34 | - | ||
| 35 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 36 | - | ||
| 37 | - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd") | ||
| 38 | - ,fmtHHmm = DateTimeFormat.forPattern("HH:mm") | ||
| 39 | - ,fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | ||
| 40 | - | ||
| 41 | - /** | ||
| 42 | - * @Title: calcRealDate | ||
| 43 | - * @Description: TODO(计算班次的真实执行日期) | ||
| 44 | - */ | ||
| 45 | - public SchAttrCalculator calcRealDate(ScheduleRealInfo sch) { | ||
| 46 | - LineConfig conf = lineConfigData.get(sch.getXlBm()); | ||
| 47 | - | ||
| 48 | - try { | ||
| 49 | - if (null == sch.getFcsjT()) | ||
| 50 | - calcFcsjTime(sch); | ||
| 51 | - | ||
| 52 | - //计发時間 | ||
| 53 | - if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){ | ||
| 54 | - sch.setFcsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getFcsj()) + DAY_TIME); | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - //待发時間 | ||
| 58 | - if(sch.getDfsj().compareTo(conf.getStartOpt()) < 0){ | ||
| 59 | - sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getDfsj()) + DAY_TIME); | ||
| 60 | - } | ||
| 61 | - else | ||
| 62 | - sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getDfsj())); | ||
| 63 | - | ||
| 64 | - //实发時間 | ||
| 65 | - if(StringUtils.isNotEmpty(sch.getFcsjActual()) && | ||
| 66 | - sch.getFcsjActual().compareTo(conf.getStartOpt()) < 0){ | ||
| 67 | - sch.setFcsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getFcsjActual()) + DAY_TIME); | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - //实际终点時間 | ||
| 71 | - if(StringUtils.isNotEmpty(sch.getZdsjActual()) && | ||
| 72 | - sch.getZdsjActual().compareTo(conf.getStartOpt()) < 0){ | ||
| 73 | - sch.setZdsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getZdsjActual()) + DAY_TIME); | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT())); | ||
| 77 | - } catch (Exception e) { | ||
| 78 | - logger.error("", e); | ||
| 79 | - } | ||
| 80 | - return this; | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - /** | ||
| 84 | - * | ||
| 85 | - * @Title: calcAllTimeByFcsj | ||
| 86 | - * @Description: TODO(根据发车时间字符串计算 (计发时间,终点时间,待发时间)) | ||
| 87 | - */ | ||
| 88 | - public SchAttrCalculator calcAllTimeByFcsj(ScheduleRealInfo sch) { | ||
| 89 | - try { | ||
| 90 | - // 生成时间戳 | ||
| 91 | - calcTimestamp(sch); | ||
| 92 | - | ||
| 93 | - // 计划终点时间 | ||
| 94 | - if (sch.getBcsj() != null) { | ||
| 95 | - sch.setZdsjT(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000)); | ||
| 96 | - sch.setZdsj(fmtHHmm.print(sch.getZdsjT())); | ||
| 97 | - } | ||
| 98 | - } catch (ParseException e) { | ||
| 99 | - logger.error("", e); | ||
| 100 | - } | ||
| 101 | - return this; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - /** | ||
| 105 | - * | ||
| 106 | - * @Title: calcQdzTimePlan | ||
| 107 | - * @Description: TODO(计算班次的起点应到时间) | ||
| 108 | - */ | ||
| 109 | - public void calcQdzTimePlan(List<ScheduleRealInfo> list){ | ||
| 110 | - Collections.sort(list, new ScheduleComparator.FCSJ()); | ||
| 111 | - | ||
| 112 | - int len = list.size(); | ||
| 113 | - if(len == 0) | ||
| 114 | - return; | ||
| 115 | - | ||
| 116 | - ScheduleRealInfo prve = list.get(0), curr; | ||
| 117 | - for(int i = 1; i < len; i ++){ | ||
| 118 | - curr = list.get(i); | ||
| 119 | - | ||
| 120 | - if(prve.getZdzName().equals(curr.getQdzName()) | ||
| 121 | - || prve.getZdzCode().equals(curr.getQdzCode())){ | ||
| 122 | - curr.setQdzArrDatejh(prve.getZdsj()); | ||
| 123 | - if(StringUtils.isNotEmpty(prve.getZdsjActual())) | ||
| 124 | - curr.setQdzArrDatesj(prve.getZdsjActual()); | ||
| 125 | - } | ||
| 126 | - prve = curr; | ||
| 127 | - } | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - /** | ||
| 131 | - * | ||
| 132 | - * @Title: updateQdzTimePlan | ||
| 133 | - * @Description: TODO(更新班次的起点应到时间) 并返回被更新的班次 | ||
| 134 | - */ | ||
| 135 | - public List<ScheduleRealInfo> updateQdzTimePlan(List<ScheduleRealInfo> list){ | ||
| 136 | - Collections.sort(list, new ScheduleComparator.FCSJ()); | ||
| 137 | - | ||
| 138 | - List<ScheduleRealInfo> updateList = new ArrayList<>(); | ||
| 139 | - int len = list.size(); | ||
| 140 | - if(len == 0) | ||
| 141 | - return updateList; | ||
| 142 | - | ||
| 143 | - ScheduleRealInfo prve = list.get(0), curr; | ||
| 144 | - for(int i = 1; i < len; i ++){ | ||
| 145 | - curr = list.get(i); | ||
| 146 | - | ||
| 147 | - if(prve.getZdzName().equals(curr.getQdzName()) | ||
| 148 | - || prve.getZdzCode().equals(curr.getQdzCode())){ | ||
| 149 | - | ||
| 150 | - if(curr.getQdzArrDatejh() != null && prve.getZdsj().equals(curr.getQdzArrDatejh())){ | ||
| 151 | - prve = curr; | ||
| 152 | - continue; | ||
| 153 | - } | ||
| 154 | - | ||
| 155 | - curr.setQdzArrDatejh(prve.getZdsj()); | ||
| 156 | - updateList.add(curr); | ||
| 157 | - } | ||
| 158 | - else{ | ||
| 159 | - curr.setQdzArrDatejh(null); | ||
| 160 | - updateList.add(curr); | ||
| 161 | - } | ||
| 162 | - prve = curr; | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - return updateList; | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { | ||
| 169 | - sch.setFcsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsj())); | ||
| 170 | - return this; | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - public void calcTimestamp(ScheduleRealInfo sch) throws ParseException{ | ||
| 174 | - //计发时间 | ||
| 175 | - if(sch.getFcsjT() == null) | ||
| 176 | - calcFcsjTime(sch); | ||
| 177 | - | ||
| 178 | - //待发时间 | ||
| 179 | - if(sch.getDfsj() == null) | ||
| 180 | - sch.setDfsjAll(sch.getFcsjT()); | ||
| 181 | - if(sch.getDfsjT() == null) | ||
| 182 | - sch.setDfsjAll(sch.getDfsj()); | ||
| 183 | - | ||
| 184 | - //实发时间戳 | ||
| 185 | - if(sch.getFcsjActualTime() == null && sch.getFcsjActual() != null) | ||
| 186 | - sch.setFcsjActualAll(sch.getFcsjActual()); | ||
| 187 | - | ||
| 188 | - //实达时间戳 | ||
| 189 | - if(sch.getZdsjActualTime() == null && sch.getZdsjActual() != null) | ||
| 190 | - sch.setZdsjActualAll(sch.getZdsjActual()); | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - /** | ||
| 194 | - * 计算当前要执行的班次 | ||
| 195 | - * @param list | ||
| 196 | - * @return | ||
| 197 | - */ | ||
| 198 | - public ScheduleRealInfo calcCurrentExecSch(List<ScheduleRealInfo> list){ | ||
| 199 | - String lineCode = list.get(0).getXlBm(); | ||
| 200 | - LineConfig conf = lineConfigData.get(lineCode); | ||
| 201 | - int outConfig = -1; | ||
| 202 | - //限定出站既出场的停车场 | ||
| 203 | - String park = null; | ||
| 204 | - if(conf != null){ | ||
| 205 | - outConfig = conf.getOutConfig(); | ||
| 206 | - park = conf.getTwinsPark(); | ||
| 207 | - } | ||
| 208 | - boolean limitPark = StringUtils.isNotEmpty(park); | ||
| 209 | - | ||
| 210 | - for(ScheduleRealInfo sch : list){ | ||
| 211 | - //如果是出站既出场,忽略出场班次 | ||
| 212 | - if(outConfig == 2 && sch.getBcType().equals("out") | ||
| 213 | - && (!limitPark || park.equals(sch.getQdzCode()))) | ||
| 214 | - continue; | ||
| 215 | - | ||
| 216 | - //忽略烂班 | ||
| 217 | - if(sch.isDestroy()) | ||
| 218 | - continue; | ||
| 219 | - | ||
| 220 | - //已执行 | ||
| 221 | - if(StringUtils.isNotEmpty(sch.getZdsjActual())) | ||
| 222 | - continue; | ||
| 223 | - | ||
| 224 | - return sch; | ||
| 225 | - } | ||
| 226 | - return null; | ||
| 227 | - } | 28 | + @Autowired |
| 29 | + LineConfigData lineConfigData; | ||
| 30 | + | ||
| 31 | + private final static long DAY_TIME = 1000 * 60 * 60 * 24L; | ||
| 32 | + | ||
| 33 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 34 | + | ||
| 35 | + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), fmtHHmm = DateTimeFormat.forPattern("HH:mm"), fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * @Title: calcRealDate | ||
| 39 | + * @Description: TODO(计算班次的真实执行日期) | ||
| 40 | + */ | ||
| 41 | + public SchAttrCalculator calcRealDate(ScheduleRealInfo sch) { | ||
| 42 | + LineConfig conf = lineConfigData.get(sch.getXlBm()); | ||
| 43 | + | ||
| 44 | + try { | ||
| 45 | + if (null == sch.getFcsjT()) | ||
| 46 | + calcFcsjTime(sch); | ||
| 47 | + | ||
| 48 | + String rq = sch.getScheduleDateStr(); | ||
| 49 | + //计发時間 | ||
| 50 | + sch.setFcsjAll(getTime(rq, sch.getFcsj(), conf)); | ||
| 51 | + | ||
| 52 | + //待发時間 | ||
| 53 | + sch.setDfsjAll(getTime(rq, sch.getDfsj(), conf)); | ||
| 54 | + /*if (sch.getDfsj().compareTo(conf.getStartOpt()) < 0) { | ||
| 55 | + sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + sch.getDfsj()) + DAY_TIME); | ||
| 56 | + } else | ||
| 57 | + sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + sch.getDfsj()));*/ | ||
| 58 | + | ||
| 59 | + //实发時間 | ||
| 60 | + sch.setFcsjActualAll(getTime(rq, sch.getFcsjActual(), conf)); | ||
| 61 | + /*if (StringUtils.isNotEmpty(sch.getFcsjActual()) && | ||
| 62 | + sch.getFcsjActual().compareTo(conf.getStartOpt()) < 0) { | ||
| 63 | + sch.setFcsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + sch.getFcsjActual()) + DAY_TIME); | ||
| 64 | + }*/ | ||
| 65 | + | ||
| 66 | + //实际终点時間 | ||
| 67 | + sch.setZdsjActualAll(getTime(rq, sch.getZdsjActual(), conf)); | ||
| 68 | + /*if (StringUtils.isNotEmpty(sch.getZdsjActual()) && | ||
| 69 | + sch.getZdsjActual().compareTo(conf.getStartOpt()) < 0) { | ||
| 70 | + sch.setZdsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + sch.getZdsjActual()) + DAY_TIME); | ||
| 71 | + }*/ | ||
| 72 | + | ||
| 73 | + sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT())); | ||
| 74 | + } catch (Exception e) { | ||
| 75 | + logger.error("", e); | ||
| 76 | + } | ||
| 77 | + return this; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public Long getTime(String rq, String timeStr, LineConfig conf) { | ||
| 81 | + Long t = null; | ||
| 82 | + if (StringUtils.isNotEmpty(timeStr)) { | ||
| 83 | + t = fmtyyyyMMddHHmm.parseMillis(rq + timeStr); | ||
| 84 | + if(timeStr.compareTo(conf.getStartOpt()) < 0) | ||
| 85 | + return t + DAY_TIME; | ||
| 86 | + } | ||
| 87 | + return t; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * @Title: calcAllTimeByFcsj | ||
| 92 | + * @Description: TODO(根据发车时间字符串计算 (计发时间,终点时间,待发时间)) | ||
| 93 | + */ | ||
| 94 | + public SchAttrCalculator calcAllTimeByFcsj(ScheduleRealInfo sch) { | ||
| 95 | + try { | ||
| 96 | + // 生成时间戳 | ||
| 97 | + calcTimestamp(sch); | ||
| 98 | + | ||
| 99 | + // 计划终点时间 | ||
| 100 | + if (sch.getBcsj() != null) { | ||
| 101 | + sch.setZdsjT(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000)); | ||
| 102 | + sch.setZdsj(fmtHHmm.print(sch.getZdsjT())); | ||
| 103 | + } | ||
| 104 | + } catch (ParseException e) { | ||
| 105 | + logger.error("", e); | ||
| 106 | + } | ||
| 107 | + return this; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * @Title: calcQdzTimePlan | ||
| 112 | + * @Description: TODO(计算班次的起点应到时间) | ||
| 113 | + */ | ||
| 114 | + public void calcQdzTimePlan(List<ScheduleRealInfo> list) { | ||
| 115 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | ||
| 116 | + | ||
| 117 | + int len = list.size(); | ||
| 118 | + if (len == 0) | ||
| 119 | + return; | ||
| 120 | + | ||
| 121 | + ScheduleRealInfo prve = list.get(0), curr; | ||
| 122 | + for (int i = 1; i < len; i++) { | ||
| 123 | + curr = list.get(i); | ||
| 124 | + | ||
| 125 | + if (isJoin(prve, curr)) { | ||
| 126 | + curr.setQdzArrDatejh(prve.getZdsj()); | ||
| 127 | + if (StringUtils.isNotEmpty(prve.getZdsjActual())) | ||
| 128 | + curr.setQdzArrDatesj(prve.getZdsjActual()); | ||
| 129 | + } | ||
| 130 | + prve = curr; | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + private boolean isJoin(ScheduleRealInfo prve, ScheduleRealInfo curr) { | ||
| 135 | + return prve.getZdzName().equals(curr.getQdzName())//名称相等 | ||
| 136 | + || prve.getZdzCode().equals(curr.getQdzCode())//编码相等 | ||
| 137 | + || prve.getZdzName().startsWith(curr.getQdzName())//起始包括 | ||
| 138 | + || curr.getQdzName().startsWith(prve.getZdzName());//起始包括 | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + /** | ||
| 142 | + * @Title: updateQdzTimePlan | ||
| 143 | + * @Description: TODO(更新班次的起点应到时间) 并返回被更新的班次 | ||
| 144 | + */ | ||
| 145 | + public List<ScheduleRealInfo> updateQdzTimePlan(List<ScheduleRealInfo> list) { | ||
| 146 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | ||
| 147 | + | ||
| 148 | + List<ScheduleRealInfo> updateList = new ArrayList<>(); | ||
| 149 | + int len = list.size(); | ||
| 150 | + if (len == 0) | ||
| 151 | + return updateList; | ||
| 152 | + | ||
| 153 | + ScheduleRealInfo prve = list.get(0), curr; | ||
| 154 | + for (int i = 1; i < len; i++) { | ||
| 155 | + curr = list.get(i); | ||
| 156 | + | ||
| 157 | + if (prve.getZdzName().equals(curr.getQdzName()) | ||
| 158 | + || prve.getZdzCode().equals(curr.getQdzCode())) { | ||
| 159 | + | ||
| 160 | + if (curr.getQdzArrDatejh() != null && prve.getZdsj().equals(curr.getQdzArrDatejh())) { | ||
| 161 | + prve = curr; | ||
| 162 | + continue; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + curr.setQdzArrDatejh(prve.getZdsj()); | ||
| 166 | + updateList.add(curr); | ||
| 167 | + } else { | ||
| 168 | + curr.setQdzArrDatejh(null); | ||
| 169 | + updateList.add(curr); | ||
| 170 | + } | ||
| 171 | + prve = curr; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + return updateList; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { | ||
| 178 | + sch.setFcsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsj())); | ||
| 179 | + return this; | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + public void calcTimestamp(ScheduleRealInfo sch) throws ParseException { | ||
| 183 | + //计发时间 | ||
| 184 | + if (sch.getFcsjT() == null) | ||
| 185 | + calcFcsjTime(sch); | ||
| 186 | + | ||
| 187 | + //待发时间 | ||
| 188 | + if (sch.getDfsj() == null) | ||
| 189 | + sch.setDfsjAll(sch.getFcsjT()); | ||
| 190 | + if (sch.getDfsjT() == null) | ||
| 191 | + sch.setDfsjAll(sch.getDfsj()); | ||
| 192 | + | ||
| 193 | + //实发时间戳 | ||
| 194 | + if (sch.getFcsjActualTime() == null && sch.getFcsjActual() != null) | ||
| 195 | + sch.setFcsjActualAll(sch.getFcsjActual()); | ||
| 196 | + | ||
| 197 | + //实达时间戳 | ||
| 198 | + if (sch.getZdsjActualTime() == null && sch.getZdsjActual() != null) | ||
| 199 | + sch.setZdsjActualAll(sch.getZdsjActual()); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + /** | ||
| 203 | + * 计算当前要执行的班次 | ||
| 204 | + * | ||
| 205 | + * @param list | ||
| 206 | + * @return | ||
| 207 | + */ | ||
| 208 | + public ScheduleRealInfo calcCurrentExecSch(List<ScheduleRealInfo> list) { | ||
| 209 | + String lineCode = list.get(0).getXlBm(); | ||
| 210 | + LineConfig conf = lineConfigData.get(lineCode); | ||
| 211 | + long t = System.currentTimeMillis(); | ||
| 212 | + int outConfig = -1; | ||
| 213 | + //限定出站既出场的停车场 | ||
| 214 | + String park = null; | ||
| 215 | + if (conf != null) { | ||
| 216 | + outConfig = conf.getOutConfig(); | ||
| 217 | + park = conf.getTwinsPark(); | ||
| 218 | + } | ||
| 219 | + boolean limitPark = StringUtils.isNotEmpty(park); | ||
| 220 | + | ||
| 221 | + for (ScheduleRealInfo sch : list) { | ||
| 222 | + //如果是出站既出场,忽略出场班次 | ||
| 223 | + if (outConfig == 2 && sch.getBcType().equals("out") | ||
| 224 | + && (!limitPark || park.equals(sch.getQdzCode()))) | ||
| 225 | + continue; | ||
| 226 | + | ||
| 227 | + //忽略烂班 | ||
| 228 | + if (sch.isDestroy()) | ||
| 229 | + continue; | ||
| 230 | + | ||
| 231 | + //已执行 | ||
| 232 | + if (StringUtils.isNotEmpty(sch.getZdsjActual())) | ||
| 233 | + continue; | ||
| 234 | + | ||
| 235 | + if (Math.abs((t - sch.getDfsjT())) > 1000 * 60 * 60) { | ||
| 236 | + //差值较大,倒着找看有没有更合适的 | ||
| 237 | + ScheduleRealInfo schReverse = calcCurrentExecSchReverse(list, outConfig, limitPark, park); | ||
| 238 | + if (null != schReverse && !schReverse.getId().equals(sch.getId())) { | ||
| 239 | + logger.info("calc_current_exec_sch_reverse... -" + schReverse.getId()); | ||
| 240 | + return suitableExecSch(schReverse, sch, t); | ||
| 241 | + } | ||
| 242 | + } | ||
| 243 | + return sch; | ||
| 244 | + } | ||
| 245 | + return null; | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + /** | ||
| 249 | + * 反转匹配一个班次 | ||
| 250 | + * | ||
| 251 | + * @param list | ||
| 252 | + * @param outConfig | ||
| 253 | + * @param limitPark | ||
| 254 | + * @param park | ||
| 255 | + * @return | ||
| 256 | + */ | ||
| 257 | + private ScheduleRealInfo calcCurrentExecSchReverse(List<ScheduleRealInfo> list, int outConfig, boolean limitPark, String park) { | ||
| 258 | + ScheduleRealInfo near = null; | ||
| 259 | + for (ScheduleRealInfo sch : list) { | ||
| 260 | + //如果是出站既出场,忽略出场班次 | ||
| 261 | + if (outConfig == 2 && isInout(sch) | ||
| 262 | + && (!limitPark || park.equals(sch.getQdzCode()) || park.equals(sch.getZdzCode()))) | ||
| 263 | + continue; | ||
| 264 | + | ||
| 265 | + //忽略烂班 | ||
| 266 | + if (sch.isDestroy()) | ||
| 267 | + continue; | ||
| 268 | + | ||
| 269 | + if (StringUtils.isNotEmpty(sch.getZdsjActual())) { | ||
| 270 | + near = null; | ||
| 271 | + continue; | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + if (null == near) | ||
| 275 | + near = sch; | ||
| 276 | + } | ||
| 277 | + return near; | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + /** | ||
| 281 | + * 比较2个班次,谁是指定时间更合适执行的 | ||
| 282 | + * | ||
| 283 | + * @param schReverse | ||
| 284 | + * @param sch | ||
| 285 | + * @param t | ||
| 286 | + * @return | ||
| 287 | + */ | ||
| 288 | + private ScheduleRealInfo suitableExecSch(ScheduleRealInfo schReverse, ScheduleRealInfo sch, long t) { | ||
| 289 | + return Math.abs(t - schReverse.getDfsjT()) > Math.abs(t - sch.getDfsjT()) ? sch : schReverse; | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + private boolean isInout(ScheduleRealInfo sch) { | ||
| 293 | + return sch.getBcType().equals("out") || sch.getBcType().equals("in"); | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + /** | ||
| 297 | + * | ||
| 298 | + * @param fcsjT | ||
| 299 | + * @param zdsjT | ||
| 300 | + */ | ||
| 301 | + public boolean isValid(Long fcsjT, Long zdsjT) { | ||
| 302 | + if(null != fcsjT && null != zdsjT) | ||
| 303 | + return fcsjT < zdsjT; | ||
| 304 | + | ||
| 305 | + return true; | ||
| 306 | + } | ||
| 228 | } | 307 | } |
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
| @@ -3,6 +3,8 @@ package com.bsth.data.schedule; | @@ -3,6 +3,8 @@ package com.bsth.data.schedule; | ||
| 3 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 3 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 4 | 4 | ||
| 5 | import java.util.Comparator; | 5 | import java.util.Comparator; |
| 6 | +import java.util.HashMap; | ||
| 7 | +import java.util.Map; | ||
| 6 | 8 | ||
| 7 | /** | 9 | /** |
| 8 | * | 10 | * |
| @@ -20,20 +22,38 @@ public class ScheduleComparator { | @@ -20,20 +22,38 @@ public class ScheduleComparator { | ||
| 20 | return s1.getFcno() - s2.getFcno(); | 22 | return s1.getFcno() - s2.getFcno(); |
| 21 | } | 23 | } |
| 22 | }*/ | 24 | }*/ |
| 25 | + | ||
| 26 | + static Map<String, Integer> bcTypeOrderMap = new HashMap<>(); | ||
| 27 | + | ||
| 28 | + static{ | ||
| 29 | + bcTypeOrderMap.put("out", 0); | ||
| 30 | + bcTypeOrderMap.put("normal", 1); | ||
| 31 | + bcTypeOrderMap.put("region", 2); | ||
| 32 | + bcTypeOrderMap.put("major", 3); | ||
| 33 | + bcTypeOrderMap.put("venting", 4); | ||
| 34 | + bcTypeOrderMap.put("ldks", 5); | ||
| 35 | + bcTypeOrderMap.put("in", 6); | ||
| 36 | + } | ||
| 23 | 37 | ||
| 24 | public static class FCSJ implements Comparator<ScheduleRealInfo>{ | 38 | public static class FCSJ implements Comparator<ScheduleRealInfo>{ |
| 25 | 39 | ||
| 26 | @Override | 40 | @Override |
| 27 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | 41 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { |
| 28 | - return (int) (s1.getFcsjT() - s2.getFcsjT()); | 42 | + int diff = (int) (s1.getFcsjT() - s2.getFcsjT()); |
| 43 | + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); | ||
| 29 | } | 44 | } |
| 30 | } | 45 | } |
| 31 | 46 | ||
| 47 | + private static int typeOrder(String bcType){ | ||
| 48 | + return bcTypeOrderMap.get(bcType)!=null?bcTypeOrderMap.get(bcType):0; | ||
| 49 | + } | ||
| 50 | + | ||
| 32 | public static class DFSJ implements Comparator<ScheduleRealInfo>{ | 51 | public static class DFSJ implements Comparator<ScheduleRealInfo>{ |
| 33 | 52 | ||
| 34 | @Override | 53 | @Override |
| 35 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | 54 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { |
| 36 | - return (int) (s1.getDfsjT() - s2.getDfsjT()); | 55 | + int diff = (int) (s1.getDfsjT() - s2.getDfsjT()); |
| 56 | + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); | ||
| 37 | } | 57 | } |
| 38 | } | 58 | } |
| 39 | } | 59 | } |
src/main/java/com/bsth/data/schedule/edit_logs/FormLogger.java
| @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
| 16 | 16 | ||
| 17 | import java.util.Date; | 17 | import java.util.Date; |
| 18 | +import java.util.LinkedList; | ||
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| 20 | * 为报表写入相关的班次修改记录 | 21 | * 为报表写入相关的班次修改记录 |
| @@ -27,9 +28,12 @@ public class FormLogger { | @@ -27,9 +28,12 @@ public class FormLogger { | ||
| 27 | 28 | ||
| 28 | Logger log = LoggerFactory.getLogger(this.getClass()); | 29 | Logger log = LoggerFactory.getLogger(this.getClass()); |
| 29 | 30 | ||
| 31 | + static LinkedList<Changetochange> ccPsts = new LinkedList<>(); | ||
| 32 | + | ||
| 30 | @Autowired | 33 | @Autowired |
| 31 | ChangetochangeRepository changetochangeRepository; | 34 | ChangetochangeRepository changetochangeRepository; |
| 32 | 35 | ||
| 36 | + | ||
| 33 | /** | 37 | /** |
| 34 | * 换人换车情况表 | 38 | * 换人换车情况表 |
| 35 | */ | 39 | */ |
| @@ -70,7 +74,9 @@ public class FormLogger { | @@ -70,7 +74,9 @@ public class FormLogger { | ||
| 70 | if(StringUtils.isNotEmpty(newJsy)) | 74 | if(StringUtils.isNotEmpty(newJsy)) |
| 71 | cc.setSjgh(newJsy); | 75 | cc.setSjgh(newJsy); |
| 72 | 76 | ||
| 73 | - changetochangeRepository.save(cc); | 77 | + //改异步入库 |
| 78 | + ccPsts.add(cc); | ||
| 79 | + //changetochangeRepository.save(cc); | ||
| 74 | }catch (Exception e){ | 80 | }catch (Exception e){ |
| 75 | log.error("纪录换人换车情况表", e); | 81 | log.error("纪录换人换车情况表", e); |
| 76 | } | 82 | } |
| @@ -82,4 +88,13 @@ public class FormLogger { | @@ -82,4 +88,13 @@ public class FormLogger { | ||
| 82 | cpc.setJsy(jsy); | 88 | cpc.setJsy(jsy); |
| 83 | saveChangetochange(sch, cpc); | 89 | saveChangetochange(sch, cpc); |
| 84 | } | 90 | } |
| 91 | + | ||
| 92 | + public void saveDb(){ | ||
| 93 | + Changetochange cc; | ||
| 94 | + for(int i = 0; i < 1000; i ++){ | ||
| 95 | + cc = ccPsts.poll(); | ||
| 96 | + if(null != cc) | ||
| 97 | + changetochangeRepository.save(cc); | ||
| 98 | + } | ||
| 99 | + } | ||
| 85 | } | 100 | } |
src/main/java/com/bsth/data/schedule/edit_logs/SeiPstThread.java
| @@ -23,6 +23,9 @@ public class SeiPstThread extends Thread{ | @@ -23,6 +23,9 @@ public class SeiPstThread extends Thread{ | ||
| 23 | 23 | ||
| 24 | Logger log = LoggerFactory.getLogger(this.getClass()); | 24 | Logger log = LoggerFactory.getLogger(this.getClass()); |
| 25 | 25 | ||
| 26 | + @Autowired | ||
| 27 | + FormLogger formLogger; | ||
| 28 | + | ||
| 26 | @Override | 29 | @Override |
| 27 | public void run() { | 30 | public void run() { |
| 28 | try{ | 31 | try{ |
| @@ -40,6 +43,9 @@ public class SeiPstThread extends Thread{ | @@ -40,6 +43,9 @@ public class SeiPstThread extends Thread{ | ||
| 40 | } | 43 | } |
| 41 | 44 | ||
| 42 | repository.save(pstList); | 45 | repository.save(pstList); |
| 46 | + | ||
| 47 | + //报表结构化日志入库 | ||
| 48 | + formLogger.saveDb(); | ||
| 43 | }catch (Exception e){ | 49 | }catch (Exception e){ |
| 44 | log.error("", e); | 50 | log.error("", e); |
| 45 | } | 51 | } |
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
| @@ -101,6 +101,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ | @@ -101,6 +101,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ | ||
| 101 | lateSchMap.remove(sch.getClZbh()); | 101 | lateSchMap.remove(sch.getClZbh()); |
| 102 | sch.setLate2(false); | 102 | sch.setLate2(false); |
| 103 | sch.setLateMinute(0); | 103 | sch.setLateMinute(0); |
| 104 | + sch.setDfAuto(false); | ||
| 104 | } | 105 | } |
| 105 | }catch (Exception e){ | 106 | }catch (Exception e){ |
| 106 | logger.error("", e); | 107 | logger.error("", e); |
src/main/java/com/bsth/data/schedule/signal/SchSiginUpdateDBThread.java
0 → 100644
| 1 | +package com.bsth.data.schedule.signal; | ||
| 2 | + | ||
| 3 | +import org.slf4j.Logger; | ||
| 4 | +import org.slf4j.LoggerFactory; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.stereotype.Component; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Created by panzhao on 2017/8/14. | ||
| 10 | + */ | ||
| 11 | +@Component | ||
| 12 | +public class SchSiginUpdateDBThread extends Thread{ | ||
| 13 | + | ||
| 14 | + @Autowired | ||
| 15 | + SignalComplateHandler signalComplateHandler; | ||
| 16 | + | ||
| 17 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 18 | + | ||
| 19 | + @Override | ||
| 20 | + public void run() { | ||
| 21 | + try{ | ||
| 22 | + signalComplateHandler.handler(); | ||
| 23 | + }catch (Exception e){ | ||
| 24 | + logger.error("", e); | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | +} |
src/main/java/com/bsth/data/schedule/signal/SignalComplateHandler.java
0 → 100644
| 1 | +package com.bsth.data.schedule.signal; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 4 | +import com.bsth.data.schedule.signal.entity.SchSiginCompate; | ||
| 5 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 6 | +import com.bsth.util.db.DBUtils_MS; | ||
| 7 | +import org.apache.commons.lang3.StringUtils; | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.jdbc.core.BatchPreparedStatementSetter; | ||
| 12 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 13 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | ||
| 14 | +import org.springframework.stereotype.Component; | ||
| 15 | +import org.springframework.transaction.TransactionDefinition; | ||
| 16 | +import org.springframework.transaction.TransactionStatus; | ||
| 17 | +import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
| 18 | + | ||
| 19 | +import java.sql.PreparedStatement; | ||
| 20 | +import java.sql.SQLException; | ||
| 21 | +import java.util.ArrayList; | ||
| 22 | +import java.util.Collection; | ||
| 23 | +import java.util.Date; | ||
| 24 | +import java.util.List; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * 班次信号补全(写入数据库,网关以补发的形式提交运管处) | ||
| 28 | + * Created by panzhao on 2017/8/13. | ||
| 29 | + */ | ||
| 30 | +@Component | ||
| 31 | +public class SignalComplateHandler { | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + DayOfSchedule dayOfSchedule; | ||
| 35 | + | ||
| 36 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 37 | + | ||
| 38 | + public void handler(){ | ||
| 39 | + Collection<ScheduleRealInfo> all = dayOfSchedule.findAll(); | ||
| 40 | + List<SchSiginCompate> list = new ArrayList<>(); | ||
| 41 | + | ||
| 42 | + SchSiginCompate siginCompate; | ||
| 43 | + Date d = new Date(); | ||
| 44 | + long et = System.currentTimeMillis() - (1000 * 60 * 60 * 2), | ||
| 45 | + st = et - (1000 * 60 * 60 * 2); | ||
| 46 | + for(ScheduleRealInfo sch : all){ | ||
| 47 | + if(sch.getDfsjT() > et || sch.getDfsjT() < st) | ||
| 48 | + continue; | ||
| 49 | + | ||
| 50 | + //能自动完成的 | ||
| 51 | + if(sch.getSiginCompate() >= 2) | ||
| 52 | + continue; | ||
| 53 | + | ||
| 54 | + //烂班 | ||
| 55 | + if(sch.isDestroy()) | ||
| 56 | + continue; | ||
| 57 | + | ||
| 58 | + //空驶任务 | ||
| 59 | + if(dayOfSchedule.emptyService(sch)) | ||
| 60 | + continue; | ||
| 61 | + | ||
| 62 | + siginCompate = new SchSiginCompate(sch); | ||
| 63 | + if(siginCompate == null || StringUtils.isEmpty(siginCompate.getDeciveId())) | ||
| 64 | + continue; | ||
| 65 | + | ||
| 66 | + //标记已经补发 | ||
| 67 | + sch.setSiginCompate(3); | ||
| 68 | + //标记入库 | ||
| 69 | + dayOfSchedule.save(sch); | ||
| 70 | + siginCompate.setCreateDate(d); | ||
| 71 | + list.add(siginCompate); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + put(list); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public void put(final List<SchSiginCompate> list){ | ||
| 78 | + if(null == list || list.size() == 0) | ||
| 79 | + return; | ||
| 80 | + | ||
| 81 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_MS.getDataSource()); | ||
| 82 | + //编程式事务 | ||
| 83 | + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemp.getDataSource()); | ||
| 84 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
| 85 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
| 86 | + TransactionStatus status = tran.getTransaction(def); | ||
| 87 | + | ||
| 88 | + try{ | ||
| 89 | + jdbcTemp.batchUpdate("insert into bsth_t_sigin_complate(id, rq, line_code, device_id, up_down, s_code, e_code, st, et, create_date, status) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() { | ||
| 90 | + @Override | ||
| 91 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | ||
| 92 | + SchSiginCompate sc = list.get(i); | ||
| 93 | + ps.setLong(1, sc.getId()); | ||
| 94 | + ps.setString(2, sc.getRq()); | ||
| 95 | + ps.setString(3, sc.getLineCode()); | ||
| 96 | + ps.setString(4, sc.getDeciveId()); | ||
| 97 | + ps.setInt(5, sc.getUpDown()); | ||
| 98 | + ps.setString(6, sc.getsCode()); | ||
| 99 | + ps.setString(7, sc.geteCode()); | ||
| 100 | + ps.setLong(8, sc.getSt()); | ||
| 101 | + ps.setLong(9, sc.getEt()); | ||
| 102 | + ps.setDate(10, new java.sql.Date(sc.getCreateDate().getTime())); | ||
| 103 | + ps.setInt(11, sc.getStatus()); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + @Override | ||
| 107 | + public int getBatchSize() { | ||
| 108 | + return list.size(); | ||
| 109 | + } | ||
| 110 | + }); | ||
| 111 | + | ||
| 112 | + tran.commit(status); | ||
| 113 | + log.info("补信号班次入库," + list.size()); | ||
| 114 | + }catch (Exception e){ | ||
| 115 | + log.error("", e); | ||
| 116 | + tran.rollback(status); | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + | ||
| 121 | +} |
src/main/java/com/bsth/data/schedule/signal/entity/SchSiginCompate.java
0 → 100644
| 1 | +package com.bsth.data.schedule.signal.entity; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 5 | + | ||
| 6 | +import java.util.Date; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 班次信号补偿 | ||
| 10 | + * Created by panzhao on 2017/8/13. | ||
| 11 | + */ | ||
| 12 | +public class SchSiginCompate { | ||
| 13 | + | ||
| 14 | + /** 实际班次ID */ | ||
| 15 | + private long id; | ||
| 16 | + | ||
| 17 | + /** 班次日期 */ | ||
| 18 | + private String rq; | ||
| 19 | + | ||
| 20 | + /** 线路编码 */ | ||
| 21 | + private String lineCode; | ||
| 22 | + | ||
| 23 | + /** 设备号 */ | ||
| 24 | + private String deciveId; | ||
| 25 | + | ||
| 26 | + /** 上下行 */ | ||
| 27 | + private int upDown; | ||
| 28 | + | ||
| 29 | + /** 起始站编码 */ | ||
| 30 | + private String sCode; | ||
| 31 | + | ||
| 32 | + /** 终点站编码 */ | ||
| 33 | + private String eCode; | ||
| 34 | + | ||
| 35 | + /** 开始时间戳 */ | ||
| 36 | + private long st; | ||
| 37 | + | ||
| 38 | + /** 结束时间戳 */ | ||
| 39 | + private long et; | ||
| 40 | + | ||
| 41 | + /** 入库时间 */ | ||
| 42 | + private Date createDate; | ||
| 43 | + | ||
| 44 | + private int status = 0; | ||
| 45 | + | ||
| 46 | + public SchSiginCompate(ScheduleRealInfo sch) { | ||
| 47 | + this.id = sch.getId(); | ||
| 48 | + this.rq = sch.getScheduleDateStr(); | ||
| 49 | + this.lineCode = sch.getXlBm(); | ||
| 50 | + this.upDown = Integer.parseInt(sch.getXlDir()); | ||
| 51 | + this.deciveId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh()); | ||
| 52 | + this.sCode = sch.getQdzCode(); | ||
| 53 | + this.eCode = sch.getZdzCode(); | ||
| 54 | + this.st = sch.getDfsjT(); | ||
| 55 | + this.et = sch.getZdsjT(); | ||
| 56 | + | ||
| 57 | + if(sch.getFcsjActualTime() != null) | ||
| 58 | + this.st = sch.getFcsjActualTime(); | ||
| 59 | + if(sch.getZdsjActualTime() != null) | ||
| 60 | + this.et = sch.getZdsjActualTime(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public long getId() { | ||
| 64 | + return id; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public void setId(long id) { | ||
| 68 | + this.id = id; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public String getRq() { | ||
| 72 | + return rq; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public void setRq(String rq) { | ||
| 76 | + this.rq = rq; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public String getLineCode() { | ||
| 80 | + return lineCode; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public void setLineCode(String lineCode) { | ||
| 84 | + this.lineCode = lineCode; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public String getDeciveId() { | ||
| 88 | + return deciveId; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public void setDeciveId(String deciveId) { | ||
| 92 | + this.deciveId = deciveId; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public int getUpDown() { | ||
| 96 | + return upDown; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public void setUpDown(int upDown) { | ||
| 100 | + this.upDown = upDown; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public String getsCode() { | ||
| 104 | + return sCode; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public void setsCode(String sCode) { | ||
| 108 | + this.sCode = sCode; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public String geteCode() { | ||
| 112 | + return eCode; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public void seteCode(String eCode) { | ||
| 116 | + this.eCode = eCode; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public long getSt() { | ||
| 120 | + return st; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public void setSt(long st) { | ||
| 124 | + this.st = st; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public long getEt() { | ||
| 128 | + return et; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public void setEt(long et) { | ||
| 132 | + this.et = et; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public Date getCreateDate() { | ||
| 136 | + return createDate; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public void setCreateDate(Date createDate) { | ||
| 140 | + this.createDate = createDate; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public int getStatus() { | ||
| 144 | + return status; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public void setStatus(int status) { | ||
| 148 | + this.status = status; | ||
| 149 | + } | ||
| 150 | +} |
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| @@ -49,25 +49,34 @@ public class ScheduleRefreshThread extends Thread{ | @@ -49,25 +49,34 @@ public class ScheduleRefreshThread extends Thread{ | ||
| 49 | Collection<LineConfig> confs = lineConfs.getAll(); | 49 | Collection<LineConfig> confs = lineConfs.getAll(); |
| 50 | 50 | ||
| 51 | String currSchDate, oldSchDate; | 51 | String currSchDate, oldSchDate; |
| 52 | - String lineCode; | 52 | + String lineCode = null; |
| 53 | for(LineConfig conf : confs){ | 53 | for(LineConfig conf : confs){ |
| 54 | - lineCode = conf.getLine().getLineCode(); | ||
| 55 | - oldSchDate = dayOfSchedule.getCurrSchDate().get(lineCode); | ||
| 56 | - currSchDate = dayOfSchedule.calcSchDate(lineCode); | ||
| 57 | - | ||
| 58 | - if(oldSchDate == null || !oldSchDate.equals(currSchDate)){ | 54 | + try{ |
| 55 | + lineCode = conf.getLine().getLineCode(); | ||
| 56 | + oldSchDate = dayOfSchedule.getCurrSchDate().get(lineCode); | ||
| 57 | + currSchDate = dayOfSchedule.calcSchDate(lineCode); | ||
| 59 | 58 | ||
| 60 | - logger.info(lineCode + "开始翻班, " + currSchDate); | ||
| 61 | - //清除指令数据 | ||
| 62 | - Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode); | ||
| 63 | - for(String car : cars) | ||
| 64 | - dayOfDirectives.clear(BasicData.deviceId2NbbmMap.inverse().get(car)); | ||
| 65 | - //清除驾驶员上报数据 | ||
| 66 | - pilotReport.clear(lineCode); | ||
| 67 | - | ||
| 68 | - //重载排班数据 | ||
| 69 | - dayOfSchedule.reloadSch(lineCode, currSchDate, false); | ||
| 70 | - logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size()); | 59 | + if(oldSchDate == null || !oldSchDate.equals(currSchDate)){ |
| 60 | + | ||
| 61 | + logger.info(lineCode + "开始翻班, " + currSchDate); | ||
| 62 | + | ||
| 63 | + try{ | ||
| 64 | + //清除指令数据 | ||
| 65 | + Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode); | ||
| 66 | + for(String car : cars) | ||
| 67 | + dayOfDirectives.clear(BasicData.deviceId2NbbmMap.inverse().get(car)); | ||
| 68 | + //清除驾驶员上报数据 | ||
| 69 | + pilotReport.clear(lineCode); | ||
| 70 | + }catch (Exception e){ | ||
| 71 | + logger.error("清理 60 和 80出现问题", e); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + //重载排班数据 | ||
| 75 | + dayOfSchedule.reloadSch(lineCode, currSchDate, false); | ||
| 76 | + logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size()); | ||
| 77 | + } | ||
| 78 | + }catch (Exception e){ | ||
| 79 | + logger.error("班次更新失败!! -" + lineCode, e); | ||
| 71 | } | 80 | } |
| 72 | } | 81 | } |
| 73 | 82 |
src/main/java/com/bsth/entity/Personnel.java
| @@ -44,7 +44,7 @@ public class Personnel extends BEntity { | @@ -44,7 +44,7 @@ public class Personnel extends BEntity { | ||
| 44 | @Formula(" concat(company_code, '_', branche_company_code) ") | 44 | @Formula(" concat(company_code, '_', branche_company_code) ") |
| 45 | private String cgsbm; | 45 | private String cgsbm; |
| 46 | 46 | ||
| 47 | - /** 工号 */ | 47 | + /** 工号(员工编号带公司编码前缀) */ |
| 48 | @Column(nullable = false) | 48 | @Column(nullable = false) |
| 49 | private String jobCode; | 49 | private String jobCode; |
| 50 | /** 姓名 */ | 50 | /** 姓名 */ |
| @@ -59,10 +59,17 @@ public class Personnel extends BEntity { | @@ -59,10 +59,17 @@ public class Personnel extends BEntity { | ||
| 59 | private String personnelType; | 59 | private String personnelType; |
| 60 | /** 所属岗位/工种(字典类型gzType) */ | 60 | /** 所属岗位/工种(字典类型gzType) */ |
| 61 | private String posts; | 61 | private String posts; |
| 62 | - | 62 | + |
| 63 | + /** 工号 */ | ||
| 64 | + @Column(nullable = false) | ||
| 65 | + private String jobCodeori; | ||
| 63 | /** 身份证 */ | 66 | /** 身份证 */ |
| 64 | private String card; | 67 | private String card; |
| 65 | 68 | ||
| 69 | + | ||
| 70 | + /** 备注 */ | ||
| 71 | + private String remark; | ||
| 72 | + | ||
| 66 | public Personnel() {} | 73 | public Personnel() {} |
| 67 | 74 | ||
| 68 | public Personnel(Object id, Object companyCode, Object gh) { | 75 | public Personnel(Object id, Object companyCode, Object gh) { |
| @@ -231,4 +238,20 @@ public class Personnel extends BEntity { | @@ -231,4 +238,20 @@ public class Personnel extends BEntity { | ||
| 231 | public void setCgsbm(String cgsbm) { | 238 | public void setCgsbm(String cgsbm) { |
| 232 | this.cgsbm = cgsbm; | 239 | this.cgsbm = cgsbm; |
| 233 | } | 240 | } |
| 241 | + | ||
| 242 | + public String getJobCodeori() { | ||
| 243 | + return jobCodeori; | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + public void setJobCodeori(String jobCodeori) { | ||
| 247 | + this.jobCodeori = jobCodeori; | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + public String getRemark() { | ||
| 251 | + return remark; | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + public void setRemark(String remark) { | ||
| 255 | + this.remark = remark; | ||
| 256 | + } | ||
| 234 | } | 257 | } |
src/main/java/com/bsth/entity/excep/ArrivalInfo.java
| @@ -61,11 +61,12 @@ public class ArrivalInfo { | @@ -61,11 +61,12 @@ public class ArrivalInfo { | ||
| 61 | private String jzsj; | 61 | private String jzsj; |
| 62 | /** -1 则信号有效,但程序标记为不使用 */ | 62 | /** -1 则信号有效,但程序标记为不使用 */ |
| 63 | private int flag = 0; | 63 | private int flag = 0; |
| 64 | - | 64 | + private Date dates; |
| 65 | + private int route; | ||
| 65 | public ArrivalInfo(){} | 66 | public ArrivalInfo(){} |
| 66 | 67 | ||
| 67 | public ArrivalInfo(String deviceId, long ts, String lineCode, int upDown, String stopNo, int inOut, long createDate, | 68 | public ArrivalInfo(String deviceId, long ts, String lineCode, int upDown, String stopNo, int inOut, long createDate, |
| 68 | - int weeksYear, String stopName) { | 69 | + int weeksYear, String stopName,Date dates,int route) { |
| 69 | 70 | ||
| 70 | this.deviceId = deviceId; | 71 | this.deviceId = deviceId; |
| 71 | this.ts = ts; | 72 | this.ts = ts; |
| @@ -75,6 +76,8 @@ public class ArrivalInfo { | @@ -75,6 +76,8 @@ public class ArrivalInfo { | ||
| 75 | this.stopName = stopName; | 76 | this.stopName = stopName; |
| 76 | this.inOut = inOut; | 77 | this.inOut = inOut; |
| 77 | this.createDate = createDate; | 78 | this.createDate = createDate; |
| 79 | + this.dates=dates; | ||
| 80 | + this.route=route; | ||
| 78 | } | 81 | } |
| 79 | 82 | ||
| 80 | /* @Override | 83 | /* @Override |
| @@ -253,6 +256,22 @@ public class ArrivalInfo { | @@ -253,6 +256,22 @@ public class ArrivalInfo { | ||
| 253 | public void setPzh(String pzh) { | 256 | public void setPzh(String pzh) { |
| 254 | this.pzh = pzh; | 257 | this.pzh = pzh; |
| 255 | } | 258 | } |
| 259 | + | ||
| 260 | + public Date getDates() { | ||
| 261 | + return dates; | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + public void setDates(Date dates) { | ||
| 265 | + this.dates = dates; | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + public int getRoute() { | ||
| 269 | + return route; | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + public void setRoute(int route) { | ||
| 273 | + this.route = route; | ||
| 274 | + } | ||
| 256 | 275 | ||
| 257 | 276 | ||
| 258 | 277 |
src/main/java/com/bsth/entity/excep/Outbound.java
| @@ -34,9 +34,6 @@ public class Outbound { | @@ -34,9 +34,6 @@ public class Outbound { | ||
| 34 | */ | 34 | */ |
| 35 | private String lineName; | 35 | private String lineName; |
| 36 | 36 | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - | ||
| 40 | /** | 37 | /** |
| 41 | * 上下行(0 上行 , 1 下行 , -1 无效) | 38 | * 上下行(0 上行 , 1 下行 , -1 无效) |
| 42 | */ | 39 | */ |
| @@ -57,18 +54,66 @@ public class Outbound { | @@ -57,18 +54,66 @@ public class Outbound { | ||
| 57 | */ | 54 | */ |
| 58 | private String location; | 55 | private String location; |
| 59 | 56 | ||
| 57 | + /** | ||
| 58 | + * 超速结束时经度 | ||
| 59 | + */ | ||
| 60 | + private Float endlon; | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 超速结束时纬度 | ||
| 64 | + */ | ||
| 65 | + private Float endlat; | ||
| 60 | 66 | ||
| 61 | /** | 67 | /** |
| 62 | * 时间戳 | 68 | * 时间戳 |
| 63 | */ | 69 | */ |
| 64 | private Long timestamp; | 70 | private Long timestamp; |
| 65 | 71 | ||
| 72 | + public Float getEndlon() { | ||
| 73 | + return endlon; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setEndlon(Float endlon) { | ||
| 77 | + this.endlon = endlon; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public Float getEndlat() { | ||
| 81 | + return endlat; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setEndlat(Float endlat) { | ||
| 85 | + this.endlat = endlat; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public Long getEndtimestamp() { | ||
| 89 | + return endtimestamp; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setEndtimestamp(Long endtimestamp) { | ||
| 93 | + this.endtimestamp = endtimestamp; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public String getEndtimestampDate() { | ||
| 97 | + return endtimestampDate; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setEndtimestampDate(String endtimestampDate) { | ||
| 101 | + this.endtimestampDate = endtimestampDate; | ||
| 102 | + } | ||
| 103 | + | ||
| 66 | /** | 104 | /** |
| 67 | * 时间戳转换的时间 | 105 | * 时间戳转换的时间 |
| 68 | */ | 106 | */ |
| 69 | private String timestampDate; | 107 | private String timestampDate; |
| 70 | 108 | ||
| 71 | 109 | ||
| 110 | + //结束时间,单位:秒/s | ||
| 111 | + @Transient | ||
| 112 | + private Long endtimestamp; | ||
| 113 | + | ||
| 114 | + @Transient | ||
| 115 | + private String endtimestampDate; | ||
| 116 | + | ||
| 72 | /** | 117 | /** |
| 73 | * 时间 | 118 | * 时间 |
| 74 | */ | 119 | */ |
src/main/java/com/bsth/entity/oil/Cwjy.java
| @@ -26,6 +26,11 @@ public class Cwjy { | @@ -26,6 +26,11 @@ public class Cwjy { | ||
| 26 | private String xgr; | 26 | private String xgr; |
| 27 | 27 | ||
| 28 | private Date createDate; | 28 | private Date createDate; |
| 29 | + | ||
| 30 | + private String line; | ||
| 31 | + | ||
| 32 | + @Transient | ||
| 33 | + private String linename; | ||
| 29 | 34 | ||
| 30 | @Transient | 35 | @Transient |
| 31 | private String gsname; | 36 | private String gsname; |
| @@ -95,6 +100,24 @@ public class Cwjy { | @@ -95,6 +100,24 @@ public class Cwjy { | ||
| 95 | public void setFgsname(String fgsname) { | 100 | public void setFgsname(String fgsname) { |
| 96 | this.fgsname = fgsname; | 101 | this.fgsname = fgsname; |
| 97 | } | 102 | } |
| 103 | + | ||
| 104 | + public String getLine() { | ||
| 105 | + return line; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setLine(String line) { | ||
| 109 | + this.line = line; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public String getLinename() { | ||
| 113 | + return BasicData.lineCode2NameMap.get(this.line); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setLinename(String linename) { | ||
| 117 | + this.linename = linename; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + | ||
| 98 | 121 | ||
| 99 | 122 | ||
| 100 | } | 123 | } |
src/main/java/com/bsth/entity/oil/Dlb.java
| @@ -54,6 +54,7 @@ public class Dlb { | @@ -54,6 +54,7 @@ public class Dlb { | ||
| 54 | private String edituser; | 54 | private String edituser; |
| 55 | private Date edittime; | 55 | private Date edittime; |
| 56 | private Date createtime; | 56 | private Date createtime; |
| 57 | + private Date updatetime; | ||
| 57 | private int nylx; | 58 | private int nylx; |
| 58 | //进场顺序(根据最先出场和最后进场来关联车辆的存电量) | 59 | //进场顺序(根据最先出场和最后进场来关联车辆的存电量) |
| 59 | private int jcsx; | 60 | private int jcsx; |
| @@ -374,4 +375,14 @@ public class Dlb { | @@ -374,4 +375,14 @@ public class Dlb { | ||
| 374 | public void setFgsname(String fgsname) { | 375 | public void setFgsname(String fgsname) { |
| 375 | this.fgsname = fgsname; | 376 | this.fgsname = fgsname; |
| 376 | } | 377 | } |
| 378 | + | ||
| 379 | + public Date getUpdatetime() { | ||
| 380 | + return updatetime; | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + public void setUpdatetime(Date updatetime) { | ||
| 384 | + this.updatetime = updatetime; | ||
| 385 | + } | ||
| 386 | + | ||
| 387 | + | ||
| 377 | } | 388 | } |
src/main/java/com/bsth/entity/oil/Ylxxb.java
| @@ -38,13 +38,14 @@ public class Ylxxb { | @@ -38,13 +38,14 @@ public class Ylxxb { | ||
| 38 | private Integer nylx; | 38 | private Integer nylx; |
| 39 | @Transient | 39 | @Transient |
| 40 | private String ldgh; | 40 | private String ldgh; |
| 41 | - //0为接口数据,1为手工输入 | 41 | + //0为接口数据,1为手工输入,2为改变车号,3为改变驾驶员 |
| 42 | private Integer jylx=0; | 42 | private Integer jylx=0; |
| 43 | @Transient | 43 | @Transient |
| 44 | private String gsname; | 44 | private String gsname; |
| 45 | @Transient | 45 | @Transient |
| 46 | private String fgsname; | 46 | private String fgsname; |
| 47 | - | 47 | + @Transient |
| 48 | + private String linename; | ||
| 48 | @Transient | 49 | @Transient |
| 49 | private Double zjzl; | 50 | private Double zjzl; |
| 50 | 51 | ||
| @@ -193,6 +194,12 @@ public class Ylxxb { | @@ -193,6 +194,12 @@ public class Ylxxb { | ||
| 193 | public void setZjzl(Double zjzl) { | 194 | public void setZjzl(Double zjzl) { |
| 194 | this.zjzl = zjzl; | 195 | this.zjzl = zjzl; |
| 195 | } | 196 | } |
| 197 | + public String getLinename() { | ||
| 198 | + return linename; | ||
| 199 | + } | ||
| 200 | + public void setLinename(String linename) { | ||
| 201 | + this.linename = linename; | ||
| 202 | + } | ||
| 196 | 203 | ||
| 197 | 204 | ||
| 198 | 205 |
src/main/java/com/bsth/entity/oil/YlxxbUpdate.java
0 → 100644
| 1 | +package com.bsth.entity.oil; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Entity; | ||
| 6 | +import javax.persistence.GeneratedValue; | ||
| 7 | +import javax.persistence.Id; | ||
| 8 | +import javax.persistence.Table; | ||
| 9 | +import javax.persistence.Transient; | ||
| 10 | + | ||
| 11 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 12 | + | ||
| 13 | +import com.bsth.data.BasicData; | ||
| 14 | + | ||
| 15 | +@Entity | ||
| 16 | +@Table(name = "bsth_c_ylxxb_update") | ||
| 17 | +public class YlxxbUpdate { | ||
| 18 | + @Id | ||
| 19 | + @GeneratedValue | ||
| 20 | + private Integer id; | ||
| 21 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 22 | + private Date yyrq; | ||
| 23 | + private Date jlrq; | ||
| 24 | + private String nbbm; | ||
| 25 | + private String jsy; | ||
| 26 | + private Double jzl; | ||
| 27 | + private String stationid; | ||
| 28 | + private Date createtime; | ||
| 29 | + private String gsdm; | ||
| 30 | + | ||
| 31 | + private Date xgrq; | ||
| 32 | + private String xgr; | ||
| 33 | + private String tj; | ||
| 34 | + public Integer getId() { | ||
| 35 | + return id; | ||
| 36 | + } | ||
| 37 | + public void setId(Integer id) { | ||
| 38 | + this.id = id; | ||
| 39 | + } | ||
| 40 | + public Date getYyrq() { | ||
| 41 | + return yyrq; | ||
| 42 | + } | ||
| 43 | + public void setYyrq(Date yyrq) { | ||
| 44 | + this.yyrq = yyrq; | ||
| 45 | + } | ||
| 46 | + public Date getJlrq() { | ||
| 47 | + return jlrq; | ||
| 48 | + } | ||
| 49 | + public void setJlrq(Date jlrq) { | ||
| 50 | + this.jlrq = jlrq; | ||
| 51 | + } | ||
| 52 | + public String getNbbm() { | ||
| 53 | + return nbbm; | ||
| 54 | + } | ||
| 55 | + public void setNbbm(String nbbm) { | ||
| 56 | + this.nbbm = nbbm; | ||
| 57 | + } | ||
| 58 | + public String getJsy() { | ||
| 59 | + return jsy; | ||
| 60 | + } | ||
| 61 | + public void setJsy(String jsy) { | ||
| 62 | + this.jsy = jsy; | ||
| 63 | + } | ||
| 64 | + public Double getJzl() { | ||
| 65 | + return jzl; | ||
| 66 | + } | ||
| 67 | + public void setJzl(Double jzl) { | ||
| 68 | + this.jzl = jzl; | ||
| 69 | + } | ||
| 70 | + public String getStationid() { | ||
| 71 | + return stationid; | ||
| 72 | + } | ||
| 73 | + public void setStationid(String stationid) { | ||
| 74 | + this.stationid = stationid; | ||
| 75 | + } | ||
| 76 | + public Date getCreatetime() { | ||
| 77 | + return createtime; | ||
| 78 | + } | ||
| 79 | + public void setCreatetime(Date createtime) { | ||
| 80 | + this.createtime = createtime; | ||
| 81 | + } | ||
| 82 | + public String getGsdm() { | ||
| 83 | + return gsdm; | ||
| 84 | + } | ||
| 85 | + public void setGsdm(String gsdm) { | ||
| 86 | + this.gsdm = gsdm; | ||
| 87 | + } | ||
| 88 | + public Date getXgrq() { | ||
| 89 | + return xgrq; | ||
| 90 | + } | ||
| 91 | + public void setXgrq(Date xgrq) { | ||
| 92 | + this.xgrq = xgrq; | ||
| 93 | + } | ||
| 94 | + public String getXgr() { | ||
| 95 | + return xgr; | ||
| 96 | + } | ||
| 97 | + public void setXgr(String xgr) { | ||
| 98 | + this.xgr = xgr; | ||
| 99 | + } | ||
| 100 | + public String getTj() { | ||
| 101 | + return tj; | ||
| 102 | + } | ||
| 103 | + public void setTj(String tj) { | ||
| 104 | + this.tj = tj; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + | ||
| 108 | + | ||
| 109 | + | ||
| 110 | +} |
src/main/java/com/bsth/entity/realcontrol/FrequentPhrases.java
0 → 100644
| 1 | +package com.bsth.entity.realcontrol; | ||
| 2 | + | ||
| 3 | +import javax.persistence.Entity; | ||
| 4 | +import javax.persistence.GeneratedValue; | ||
| 5 | +import javax.persistence.Id; | ||
| 6 | +import javax.persistence.Table; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 常用短语 | ||
| 10 | + * Created by panzhao on 2017/9/17. | ||
| 11 | + */ | ||
| 12 | +@Entity | ||
| 13 | +@Table(name = "bsth_c_s_frequent_phrases") | ||
| 14 | +public class FrequentPhrases { | ||
| 15 | + | ||
| 16 | + @Id | ||
| 17 | + @GeneratedValue | ||
| 18 | + private Integer id; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 用户名 | ||
| 22 | + */ | ||
| 23 | + private String userName; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 短语 | ||
| 27 | + */ | ||
| 28 | + private String text; | ||
| 29 | + | ||
| 30 | + public Integer getId() { | ||
| 31 | + return id; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public void setId(Integer id) { | ||
| 35 | + this.id = id; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public String getUserName() { | ||
| 39 | + return userName; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public void setUserName(String userName) { | ||
| 43 | + this.userName = userName; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public String getText() { | ||
| 47 | + return text; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public void setText(String text) { | ||
| 51 | + this.text = text; | ||
| 52 | + } | ||
| 53 | +} |
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
| @@ -89,6 +89,11 @@ public class LineConfig { | @@ -89,6 +89,11 @@ public class LineConfig { | ||
| 89 | private int upStopMinute; | 89 | private int upStopMinute; |
| 90 | private int downStopMinute; | 90 | private int downStopMinute; |
| 91 | 91 | ||
| 92 | + /** | ||
| 93 | + * 使用第一个发车时间,不匹配最佳时间 | ||
| 94 | + */ | ||
| 95 | + private boolean lockFirstOutTime; | ||
| 96 | + | ||
| 92 | 97 | ||
| 93 | @OneToMany(cascade = CascadeType.ALL) | 98 | @OneToMany(cascade = CascadeType.ALL) |
| 94 | private Set<D80ReplyTemp> d80Temps = new HashSet<>(); | 99 | private Set<D80ReplyTemp> d80Temps = new HashSet<>(); |
| @@ -281,4 +286,12 @@ public class LineConfig { | @@ -281,4 +286,12 @@ public class LineConfig { | ||
| 281 | public void setTwinsStation(String twinsStation) { | 286 | public void setTwinsStation(String twinsStation) { |
| 282 | this.twinsStation = twinsStation; | 287 | this.twinsStation = twinsStation; |
| 283 | } | 288 | } |
| 289 | + | ||
| 290 | + public boolean isLockFirstOutTime() { | ||
| 291 | + return lockFirstOutTime; | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + public void setLockFirstOutTime(boolean lockFirstOutTime) { | ||
| 295 | + this.lockFirstOutTime = lockFirstOutTime; | ||
| 296 | + } | ||
| 284 | } | 297 | } |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| @@ -214,6 +214,17 @@ public class ScheduleRealInfo { | @@ -214,6 +214,17 @@ public class ScheduleRealInfo { | ||
| 214 | @JsonIgnore | 214 | @JsonIgnore |
| 215 | private int saveFailCount=0; | 215 | private int saveFailCount=0; |
| 216 | 216 | ||
| 217 | + /** 是否需要补充GPS信号 (网关提交至运管处动态数据用) 1: 能发车, 2:能到达 3: 补发过*/ | ||
| 218 | + private int siginCompate; | ||
| 219 | + | ||
| 220 | + /** | ||
| 221 | + * 漂移状态 | ||
| 222 | + * 1: 发车漂移 | ||
| 223 | + * 2:到站漂移 | ||
| 224 | + * 3:中途漂移 | ||
| 225 | + */ | ||
| 226 | + private Integer driftStatus = 0; | ||
| 227 | + | ||
| 217 | public boolean isDfAuto() { | 228 | public boolean isDfAuto() { |
| 218 | return dfAuto; | 229 | return dfAuto; |
| 219 | } | 230 | } |
| @@ -303,10 +314,10 @@ public class ScheduleRealInfo { | @@ -303,10 +314,10 @@ public class ScheduleRealInfo { | ||
| 303 | String old = this.getRemarks(); | 314 | String old = this.getRemarks(); |
| 304 | if(StringUtils.isBlank(old)) | 315 | if(StringUtils.isBlank(old)) |
| 305 | old = ""; | 316 | old = ""; |
| 306 | - | 317 | + |
| 307 | old += remark + ";"; | 318 | old += remark + ";"; |
| 308 | this.setRemarks(old); | 319 | this.setRemarks(old); |
| 309 | - | 320 | + |
| 310 | } | 321 | } |
| 311 | 322 | ||
| 312 | public Long getId() { | 323 | public Long getId() { |
| @@ -622,16 +633,17 @@ public class ScheduleRealInfo { | @@ -622,16 +633,17 @@ public class ScheduleRealInfo { | ||
| 622 | this.dfsjT = dfsjT; | 633 | this.dfsjT = dfsjT; |
| 623 | this.dfsj = fmtHHmm.print(this.dfsjT); | 634 | this.dfsj = fmtHHmm.print(this.dfsjT); |
| 624 | } | 635 | } |
| 625 | - | 636 | + |
| 626 | public void setDfsjAll(String dfsj) { | 637 | public void setDfsjAll(String dfsj) { |
| 627 | this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj); | 638 | this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj); |
| 628 | this.dfsj = dfsj; | 639 | this.dfsj = dfsj; |
| 629 | } | 640 | } |
| 630 | - | 641 | + |
| 631 | public void calcEndTime(){ | 642 | public void calcEndTime(){ |
| 632 | //计划终点时间 | 643 | //计划终点时间 |
| 633 | if(this.getBcsj() != null){ | 644 | if(this.getBcsj() != null){ |
| 634 | - this.setZdsjT(this.getDfsjT() + (this.getBcsj() * 60 * 1000)); | 645 | + //this.setZdsjT(this.getDfsjT() + (this.getBcsj() * 60 * 1000)); |
| 646 | + this.setZdsjT(this.getFcsjT() + (this.getBcsj() * 60 * 1000));//计划终点时间不变 | ||
| 635 | this.setZdsj(fmtHHmm.print(this.zdsjT)); | 647 | this.setZdsj(fmtHHmm.print(this.zdsjT)); |
| 636 | } | 648 | } |
| 637 | } | 649 | } |
| @@ -665,33 +677,33 @@ public class ScheduleRealInfo { | @@ -665,33 +677,33 @@ public class ScheduleRealInfo { | ||
| 665 | public void setSflj(boolean sflj) { | 677 | public void setSflj(boolean sflj) { |
| 666 | this.sflj = sflj; | 678 | this.sflj = sflj; |
| 667 | } | 679 | } |
| 668 | - | 680 | + |
| 669 | /** | 681 | /** |
| 670 | - * | ||
| 671 | - * @Title: setFcsjAll | ||
| 672 | - * @Description: TODO(设置计划发车时间) | 682 | + * |
| 683 | + * @Title: setFcsjAll | ||
| 684 | + * @Description: TODO(设置计划发车时间) | ||
| 673 | * @throws | 685 | * @throws |
| 674 | */ | 686 | */ |
| 675 | public void setFcsjAll(String fcsj){ | 687 | public void setFcsjAll(String fcsj){ |
| 676 | this.fcsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsj); | 688 | this.fcsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsj); |
| 677 | this.fcsj = fcsj; | 689 | this.fcsj = fcsj; |
| 678 | } | 690 | } |
| 679 | - | 691 | + |
| 680 | /** | 692 | /** |
| 681 | - * | ||
| 682 | - * @Title: setFcsjAll | ||
| 683 | - * @Description: TODO(设置计划发车时间) | 693 | + * |
| 694 | + * @Title: setFcsjAll | ||
| 695 | + * @Description: TODO(设置计划发车时间) | ||
| 684 | * @throws | 696 | * @throws |
| 685 | */ | 697 | */ |
| 686 | public void setFcsjAll(Long fcsjT){ | 698 | public void setFcsjAll(Long fcsjT){ |
| 687 | this.fcsjT = fcsjT; | 699 | this.fcsjT = fcsjT; |
| 688 | this.fcsj = fmtHHmm.print(fcsjT); | 700 | this.fcsj = fmtHHmm.print(fcsjT); |
| 689 | } | 701 | } |
| 690 | - | 702 | + |
| 691 | /** | 703 | /** |
| 692 | - * | ||
| 693 | - * @Title: setFcsjActualAll | ||
| 694 | - * @Description: TODO(设置实际发车时间 字符串) | 704 | + * |
| 705 | + * @Title: setFcsjActualAll | ||
| 706 | + * @Description: TODO(设置实际发车时间 字符串) | ||
| 695 | * @throws | 707 | * @throws |
| 696 | */ | 708 | */ |
| 697 | public void setFcsjActualAll(String fcsjActual){ | 709 | public void setFcsjActualAll(String fcsjActual){ |
| @@ -699,39 +711,47 @@ public class ScheduleRealInfo { | @@ -699,39 +711,47 @@ public class ScheduleRealInfo { | ||
| 699 | this.fcsjActual = fcsjActual; | 711 | this.fcsjActual = fcsjActual; |
| 700 | calcStatus(); | 712 | calcStatus(); |
| 701 | } | 713 | } |
| 702 | - | 714 | + |
| 703 | /** | 715 | /** |
| 704 | - * | ||
| 705 | - * @Title: setFcsjActualAll | ||
| 706 | - * @Description: TODO(设置实际发车时间 时间戳) | 716 | + * |
| 717 | + * @Title: setFcsjActualAll | ||
| 718 | + * @Description: TODO(设置实际发车时间 时间戳) | ||
| 707 | * @throws | 719 | * @throws |
| 708 | */ | 720 | */ |
| 709 | public void setFcsjActualAll(Long t){ | 721 | public void setFcsjActualAll(Long t){ |
| 722 | + | ||
| 710 | this.fcsjActualTime = t; | 723 | this.fcsjActualTime = t; |
| 711 | - this.fcsjActual = fmtHHmm.print(t); | 724 | + if(null == t) |
| 725 | + this.fcsjActual = null; | ||
| 726 | + else | ||
| 727 | + this.fcsjActual = fmtHHmm.print(t); | ||
| 712 | 728 | ||
| 713 | //更新班次状态 | 729 | //更新班次状态 |
| 714 | calcStatus(); | 730 | calcStatus(); |
| 715 | } | 731 | } |
| 716 | - | 732 | + |
| 717 | /** | 733 | /** |
| 718 | - * | ||
| 719 | - * @Title: setFcsjActualAll | ||
| 720 | - * @Description: TODO(设置实际终点时间) | 734 | + * |
| 735 | + * @Title: setFcsjActualAll | ||
| 736 | + * @Description: TODO(设置实际终点时间) | ||
| 721 | * @throws | 737 | * @throws |
| 722 | */ | 738 | */ |
| 723 | public void setZdsjActualAll(Long t){ | 739 | public void setZdsjActualAll(Long t){ |
| 724 | this.zdsjActualTime = t; | 740 | this.zdsjActualTime = t; |
| 725 | - this.zdsjActual = fmtHHmm.print(t); | ||
| 726 | - | 741 | + |
| 742 | + if(null == t) | ||
| 743 | + this.zdsjActual = null; | ||
| 744 | + else | ||
| 745 | + this.zdsjActual = fmtHHmm.print(t); | ||
| 746 | + | ||
| 727 | //更新班次状态 | 747 | //更新班次状态 |
| 728 | calcStatus(); | 748 | calcStatus(); |
| 729 | } | 749 | } |
| 730 | - | 750 | + |
| 731 | /** | 751 | /** |
| 732 | - * | ||
| 733 | - * @Title: setFcsjActualAll | ||
| 734 | - * @Description: TODO(设置实际终点时间) | 752 | + * |
| 753 | + * @Title: setFcsjActualAll | ||
| 754 | + * @Description: TODO(设置实际终点时间) | ||
| 735 | * @throws | 755 | * @throws |
| 736 | */ | 756 | */ |
| 737 | public void setZdsjActualAll(String zdsjActual){ | 757 | public void setZdsjActualAll(String zdsjActual){ |
| @@ -740,7 +760,7 @@ public class ScheduleRealInfo { | @@ -740,7 +760,7 @@ public class ScheduleRealInfo { | ||
| 740 | 760 | ||
| 741 | calcStatus(); | 761 | calcStatus(); |
| 742 | } | 762 | } |
| 743 | - | 763 | + |
| 744 | public Long getSpId() { | 764 | public Long getSpId() { |
| 745 | return spId; | 765 | return spId; |
| 746 | } | 766 | } |
| @@ -760,11 +780,11 @@ public class ScheduleRealInfo { | @@ -760,11 +780,11 @@ public class ScheduleRealInfo { | ||
| 760 | public void calcStatus() { | 780 | public void calcStatus() { |
| 761 | if(this.status == -1) | 781 | if(this.status == -1) |
| 762 | return; | 782 | return; |
| 763 | - | 783 | + |
| 764 | this.status = 0; | 784 | this.status = 0; |
| 765 | if(StringUtils.isNotBlank(this.fcsjActual)){ | 785 | if(StringUtils.isNotBlank(this.fcsjActual)){ |
| 766 | this.status = 1; | 786 | this.status = 1; |
| 767 | - | 787 | + |
| 768 | //进出场班次并且没有计划里程的 | 788 | //进出场班次并且没有计划里程的 |
| 769 | if((this.bcType.equals("out") || this.bcType.equals("in")) | 789 | if((this.bcType.equals("out") || this.bcType.equals("in")) |
| 770 | && this.jhlc == null){ | 790 | && this.jhlc == null){ |
| @@ -774,7 +794,7 @@ public class ScheduleRealInfo { | @@ -774,7 +794,7 @@ public class ScheduleRealInfo { | ||
| 774 | if(StringUtils.isNotBlank(this.zdsjActual)) | 794 | if(StringUtils.isNotBlank(this.zdsjActual)) |
| 775 | this.status = 2; | 795 | this.status = 2; |
| 776 | } | 796 | } |
| 777 | - | 797 | + |
| 778 | public void destroy(){ | 798 | public void destroy(){ |
| 779 | this.jhlc = 0.0; | 799 | this.jhlc = 0.0; |
| 780 | if(this.isSflj()) | 800 | if(this.isSflj()) |
| @@ -782,11 +802,11 @@ public class ScheduleRealInfo { | @@ -782,11 +802,11 @@ public class ScheduleRealInfo { | ||
| 782 | this.status = -1; | 802 | this.status = -1; |
| 783 | this.clearFcsjActual(); | 803 | this.clearFcsjActual(); |
| 784 | } | 804 | } |
| 785 | - | 805 | + |
| 786 | public boolean isDestroy(){ | 806 | public boolean isDestroy(){ |
| 787 | return this.status == -1; | 807 | return this.status == -1; |
| 788 | } | 808 | } |
| 789 | - | 809 | + |
| 790 | /* public boolean isNotDestroy(){ | 810 | /* public boolean isNotDestroy(){ |
| 791 | return this.status != -1; | 811 | return this.status != -1; |
| 792 | }*/ | 812 | }*/ |
| @@ -806,18 +826,18 @@ public class ScheduleRealInfo { | @@ -806,18 +826,18 @@ public class ScheduleRealInfo { | ||
| 806 | public void setScheduleDateStr(String scheduleDateStr) { | 826 | public void setScheduleDateStr(String scheduleDateStr) { |
| 807 | this.scheduleDateStr = scheduleDateStr; | 827 | this.scheduleDateStr = scheduleDateStr; |
| 808 | } | 828 | } |
| 809 | - | 829 | + |
| 810 | public void clearFcsjActual(){ | 830 | public void clearFcsjActual(){ |
| 811 | this.setFcsjActual(null); | 831 | this.setFcsjActual(null); |
| 812 | this.setFcsjActualTime(null); | 832 | this.setFcsjActualTime(null); |
| 813 | this.calcStatus(); | 833 | this.calcStatus(); |
| 814 | } | 834 | } |
| 815 | - | 835 | + |
| 816 | //清除实际终点时间 | 836 | //清除实际终点时间 |
| 817 | public void clearZdsjActual(){ | 837 | public void clearZdsjActual(){ |
| 818 | this.setZdsjActual(null); | 838 | this.setZdsjActual(null); |
| 819 | this.setZdsjActualTime(null); | 839 | this.setZdsjActualTime(null); |
| 820 | - | 840 | + |
| 821 | calcStatus(); | 841 | calcStatus(); |
| 822 | } | 842 | } |
| 823 | 843 | ||
| @@ -922,4 +942,20 @@ public class ScheduleRealInfo { | @@ -922,4 +942,20 @@ public class ScheduleRealInfo { | ||
| 922 | public void setSaveFailCount(int saveFailCount) { | 942 | public void setSaveFailCount(int saveFailCount) { |
| 923 | this.saveFailCount = saveFailCount; | 943 | this.saveFailCount = saveFailCount; |
| 924 | } | 944 | } |
| 945 | + | ||
| 946 | + public int getSiginCompate() { | ||
| 947 | + return siginCompate; | ||
| 948 | + } | ||
| 949 | + | ||
| 950 | + public void setSiginCompate(int siginCompate) { | ||
| 951 | + this.siginCompate = siginCompate; | ||
| 952 | + } | ||
| 953 | + | ||
| 954 | + public Integer getDriftStatus() { | ||
| 955 | + return driftStatus; | ||
| 956 | + } | ||
| 957 | + | ||
| 958 | + public void setDriftStatus(Integer driftStatus) { | ||
| 959 | + this.driftStatus = driftStatus; | ||
| 960 | + } | ||
| 925 | } | 961 | } |
src/main/java/com/bsth/entity/report/MileageReport.java
0 → 100644
| 1 | +package com.bsth.entity.report; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @ClassName: MileageReport.java | ||
| 7 | + * @Description: TODO(营运里程修正报表) | ||
| 8 | + * @author: YouRuiFeng | ||
| 9 | + * @date: 2017-8-14 上午11:09:19 | ||
| 10 | + * | ||
| 11 | + */ | ||
| 12 | +public class MileageReport { | ||
| 13 | + /** 公司编码 */ | ||
| 14 | + private String companyId; | ||
| 15 | + | ||
| 16 | + /** 分公司编码 */ | ||
| 17 | + private String subCompanyId; | ||
| 18 | + | ||
| 19 | + /** 公司名称 */ | ||
| 20 | + private String companyName; | ||
| 21 | + | ||
| 22 | + /** 分公司名称 */ | ||
| 23 | + private String subCompanyName; | ||
| 24 | + | ||
| 25 | + /** 线路编码 */ | ||
| 26 | + private String lineCode; | ||
| 27 | + | ||
| 28 | + /** 线路名称 */ | ||
| 29 | + private String lineName; | ||
| 30 | + | ||
| 31 | + /** 总营运公里 */ | ||
| 32 | + private double zgl; | ||
| 33 | + | ||
| 34 | + /** 实际运营公里 */ | ||
| 35 | + private double sjyygl; | ||
| 36 | + | ||
| 37 | + /** 实际空驶公里 */ | ||
| 38 | + private double sjksgl; | ||
| 39 | + | ||
| 40 | + /** 手动待发公里 */ | ||
| 41 | + private double sddfgl; | ||
| 42 | + | ||
| 43 | + /** 自动代发公里 */ | ||
| 44 | + private double zddfgl; | ||
| 45 | + | ||
| 46 | + /** 完全无Gps信号公里 */ | ||
| 47 | + private double wqwxhgl; | ||
| 48 | + | ||
| 49 | + /** 部分无Gps公里 */ | ||
| 50 | + private double bfwxhgl; | ||
| 51 | + | ||
| 52 | + /** 漂移公里 */ | ||
| 53 | + private double pygl; | ||
| 54 | + | ||
| 55 | + /** 临加公里 */ | ||
| 56 | + private double ljgl; | ||
| 57 | + | ||
| 58 | + /** 子任务 */ | ||
| 59 | + private double zrwgl; | ||
| 60 | + | ||
| 61 | + /** 其他*/ | ||
| 62 | + private String other; | ||
| 63 | + | ||
| 64 | + /** 备注 */ | ||
| 65 | + private String remarks; | ||
| 66 | + | ||
| 67 | + /** 日期 (班次日期) */ | ||
| 68 | + private String rq; | ||
| 69 | + | ||
| 70 | + private Date createDate; | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + public String getCompanyId() { | ||
| 74 | + return companyId; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public void setCompanyId(String companyId) { | ||
| 78 | + this.companyId = companyId; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public String getSubCompanyId() { | ||
| 82 | + return subCompanyId; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public void setSubCompanyId(String subCompanyId) { | ||
| 86 | + this.subCompanyId = subCompanyId; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public String getCompanyName() { | ||
| 90 | + return companyName; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setCompanyName(String companyName) { | ||
| 94 | + this.companyName = companyName; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public String getSubCompanyName() { | ||
| 98 | + return subCompanyName; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public void setSubCompanyName(String subCompanyName) { | ||
| 102 | + this.subCompanyName = subCompanyName; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public String getLineCode() { | ||
| 106 | + return lineCode; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setLineCode(String lineCode) { | ||
| 110 | + this.lineCode = lineCode; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public String getLineName() { | ||
| 114 | + return lineName; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public void setLineName(String lineName) { | ||
| 118 | + this.lineName = lineName; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public double getZgl() { | ||
| 122 | + return zgl; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public void setZgl(double zgl) { | ||
| 126 | + this.zgl = zgl; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public double getSjyygl() { | ||
| 130 | + return sjyygl; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public void setSjyygl(double sjyygl) { | ||
| 134 | + this.sjyygl = sjyygl; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public double getSjksgl() { | ||
| 138 | + return sjksgl; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public void setSjksgl(double sjksgl) { | ||
| 142 | + this.sjksgl = sjksgl; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public double getSddfgl() { | ||
| 146 | + return sddfgl; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public void setSddfgl(double sddfgl) { | ||
| 150 | + this.sddfgl = sddfgl; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public double getZddfgl() { | ||
| 154 | + return zddfgl; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public void setZddfgl(double zddfgl) { | ||
| 158 | + this.zddfgl = zddfgl; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public double getWqwxhgl() { | ||
| 162 | + return wqwxhgl; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + public void setWqwxhgl(double wqwxhgl) { | ||
| 166 | + this.wqwxhgl = wqwxhgl; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public double getBfwxhgl() { | ||
| 170 | + return bfwxhgl; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + public void setBfwxhgl(double bfwxhgl) { | ||
| 174 | + this.bfwxhgl = bfwxhgl; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + public double getPygl() { | ||
| 178 | + return pygl; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + public void setPygl(double pygl) { | ||
| 182 | + this.pygl = pygl; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + public double getLjgl() { | ||
| 186 | + return ljgl; | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + public void setLjgl(double ljgl) { | ||
| 190 | + this.ljgl = ljgl; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + public double getZrwgl() { | ||
| 194 | + return zrwgl; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + public void setZrwgl(double zrwgl) { | ||
| 198 | + this.zrwgl = zrwgl; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + public String getOther() { | ||
| 202 | + return other; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + public void setOther(String other) { | ||
| 206 | + this.other = other; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + public String getRemarks() { | ||
| 210 | + return remarks; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + public void setRemarks(String remarks) { | ||
| 214 | + this.remarks = remarks; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + public String getRq() { | ||
| 218 | + return rq; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + public void setRq(String rq) { | ||
| 222 | + this.rq = rq; | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + public Date getCreateDate() { | ||
| 226 | + return createDate; | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + public void setCreateDate(Date createDate) { | ||
| 230 | + this.createDate = createDate; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + | ||
| 234 | +} |
src/main/java/com/bsth/entity/report/ScheduleCorrectionReport.java
0 → 100644
| 1 | +package com.bsth.entity.report; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @ClassName: MileageReport.java | ||
| 7 | + * @Description: TODO(营运里程修正报表) | ||
| 8 | + * @author: YouRuiFeng | ||
| 9 | + * @date: 2017-8-14 上午11:09:19 | ||
| 10 | + * | ||
| 11 | + */ | ||
| 12 | +public class ScheduleCorrectionReport { | ||
| 13 | + /** 公司编码 */ | ||
| 14 | + private String companyId; | ||
| 15 | + | ||
| 16 | + /** 分公司编码 */ | ||
| 17 | + private String subCompanyId; | ||
| 18 | + | ||
| 19 | + /** 公司名称 */ | ||
| 20 | + private String companyName; | ||
| 21 | + | ||
| 22 | + /** 分公司名称 */ | ||
| 23 | + private String subCompanyName; | ||
| 24 | + | ||
| 25 | + /** 线路编码 */ | ||
| 26 | + private String lineCode; | ||
| 27 | + | ||
| 28 | + /** 线路名称 */ | ||
| 29 | + private String lineName; | ||
| 30 | + | ||
| 31 | + /** 总营运班次 */ | ||
| 32 | + private int zbc; | ||
| 33 | + | ||
| 34 | + /** 实际运营班次 */ | ||
| 35 | + private int sjyybc; | ||
| 36 | + | ||
| 37 | + /** 实际空驶班次 */ | ||
| 38 | + private int sjksbc; | ||
| 39 | + | ||
| 40 | + /** 手动待发班次 */ | ||
| 41 | + private int sddfbc; | ||
| 42 | + | ||
| 43 | + /** 自动代发班次 */ | ||
| 44 | + private int zddfbc; | ||
| 45 | + | ||
| 46 | + /** 完全无Gps信号班次 */ | ||
| 47 | + private int wqwxhbc; | ||
| 48 | + | ||
| 49 | + /** 部分无Gps班次 */ | ||
| 50 | + private int bfwxhbc; | ||
| 51 | + | ||
| 52 | + /** 漂移班次 */ | ||
| 53 | + private int pybc; | ||
| 54 | + | ||
| 55 | + /** 临加班次 */ | ||
| 56 | + private int ljbc; | ||
| 57 | + | ||
| 58 | + /** 子任务 */ | ||
| 59 | + private int zrwbc; | ||
| 60 | + | ||
| 61 | + /** 其他*/ | ||
| 62 | + private String other; | ||
| 63 | + | ||
| 64 | + /** 备注 */ | ||
| 65 | + private String remarks; | ||
| 66 | + | ||
| 67 | + /** 日期 (班次日期) */ | ||
| 68 | + private String rq; | ||
| 69 | + | ||
| 70 | + private Date createDate; | ||
| 71 | + | ||
| 72 | + public String getCompanyId() { | ||
| 73 | + return companyId; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setCompanyId(String companyId) { | ||
| 77 | + this.companyId = companyId; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public String getSubCompanyId() { | ||
| 81 | + return subCompanyId; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setSubCompanyId(String subCompanyId) { | ||
| 85 | + this.subCompanyId = subCompanyId; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public String getCompanyName() { | ||
| 89 | + return companyName; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setCompanyName(String companyName) { | ||
| 93 | + this.companyName = companyName; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public String getSubCompanyName() { | ||
| 97 | + return subCompanyName; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setSubCompanyName(String subCompanyName) { | ||
| 101 | + this.subCompanyName = subCompanyName; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public String getLineCode() { | ||
| 105 | + return lineCode; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setLineCode(String lineCode) { | ||
| 109 | + this.lineCode = lineCode; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public String getLineName() { | ||
| 113 | + return lineName; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setLineName(String lineName) { | ||
| 117 | + this.lineName = lineName; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public int getZbc() { | ||
| 121 | + return zbc; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setZbc(int zbc) { | ||
| 125 | + this.zbc = zbc; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public int getSjyybc() { | ||
| 129 | + return sjyybc; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public void setSjyybc(int sjyybc) { | ||
| 133 | + this.sjyybc = sjyybc; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public int getSjksbc() { | ||
| 137 | + return sjksbc; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public void setSjksbc(int sjksbc) { | ||
| 141 | + this.sjksbc = sjksbc; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public int getSddfbc() { | ||
| 145 | + return sddfbc; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public void setSddfbc(int sddfbc) { | ||
| 149 | + this.sddfbc = sddfbc; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public int getZddfbc() { | ||
| 153 | + return zddfbc; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public void setZddfbc(int zddfbc) { | ||
| 157 | + this.zddfbc = zddfbc; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public int getWqwxhbc() { | ||
| 161 | + return wqwxhbc; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + public void setWqwxhbc(int wqwxhbc) { | ||
| 165 | + this.wqwxhbc = wqwxhbc; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + public int getBfwxhbc() { | ||
| 169 | + return bfwxhbc; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + public void setBfwxhbc(int bfwxhbc) { | ||
| 173 | + this.bfwxhbc = bfwxhbc; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + public int getPybc() { | ||
| 177 | + return pybc; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + public void setPybc(int pybc) { | ||
| 181 | + this.pybc = pybc; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + public int getLjbc() { | ||
| 185 | + return ljbc; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public void setLjbc(int ljbc) { | ||
| 189 | + this.ljbc = ljbc; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + public int getZrwbc() { | ||
| 193 | + return zrwbc; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + public void setZrwbc(int zrwbc) { | ||
| 197 | + this.zrwbc = zrwbc; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + public String getOther() { | ||
| 201 | + return other; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + public void setOther(String other) { | ||
| 205 | + this.other = other; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + public String getRemarks() { | ||
| 209 | + return remarks; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + public void setRemarks(String remarks) { | ||
| 213 | + this.remarks = remarks; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public String getRq() { | ||
| 217 | + return rq; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + public void setRq(String rq) { | ||
| 221 | + this.rq = rq; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + public Date getCreateDate() { | ||
| 225 | + return createDate; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + public void setCreateDate(Date createDate) { | ||
| 229 | + this.createDate = createDate; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | +} |
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| @@ -3,6 +3,7 @@ package com.bsth.entity.schedule; | @@ -3,6 +3,7 @@ package com.bsth.entity.schedule; | ||
| 3 | import com.bsth.entity.Line; | 3 | import com.bsth.entity.Line; |
| 4 | import com.bsth.service.schedule.rules.rerun.RerunRule_input; | 4 | import com.bsth.service.schedule.rules.rerun.RerunRule_input; |
| 5 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | 5 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 6 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | ||
| 6 | import org.apache.commons.lang3.StringUtils; | 7 | import org.apache.commons.lang3.StringUtils; |
| 7 | 8 | ||
| 8 | import javax.persistence.*; | 9 | import javax.persistence.*; |
| @@ -267,7 +268,8 @@ public class SchedulePlanInfo extends BEntity { | @@ -267,7 +268,8 @@ public class SchedulePlanInfo extends BEntity { | ||
| 267 | List<EmployeeConfigInfo> employeeConfigInfoList, | 268 | List<EmployeeConfigInfo> employeeConfigInfoList, |
| 268 | SchedulePlan schedulePlan, | 269 | SchedulePlan schedulePlan, |
| 269 | boolean isFirstBc, // 是否第一个班次 | 270 | boolean isFirstBc, // 是否第一个班次 |
| 270 | - boolean isLastBc // 是否最后一个班次 | 271 | + boolean isLastBc, // 是否最后一个班次 |
| 272 | + ScheduleRule_Type sType // 类型 | ||
| 271 | ) { | 273 | ) { |
| 272 | 274 | ||
| 273 | // TODO:关联的公司名称 | 275 | // TODO:关联的公司名称 |
| @@ -294,47 +296,51 @@ public class SchedulePlanInfo extends BEntity { | @@ -294,47 +296,51 @@ public class SchedulePlanInfo extends BEntity { | ||
| 294 | this.lpName = ttInfoDetail.getLp().getLpName(); | 296 | this.lpName = ttInfoDetail.getLp().getLpName(); |
| 295 | 297 | ||
| 296 | // 关联的车辆信息 | 298 | // 关联的车辆信息 |
| 297 | - this.cl = carConfigInfo.getCl().getId(); // 车辆id | ||
| 298 | - this.clZbh = carConfigInfo.getCl().getInsideCode(); // 自编号/内部编号 | 299 | + if (sType == ScheduleRule_Type.NORMAL) { |
| 300 | + this.cl = carConfigInfo.getCl().getId(); // 车辆id | ||
| 301 | + this.clZbh = carConfigInfo.getCl().getInsideCode(); // 自编号/内部编号 | ||
| 302 | + } | ||
| 299 | 303 | ||
| 300 | // TODO:报道时间,出场时间没有 | 304 | // TODO:报道时间,出场时间没有 |
| 301 | // 关联的驾驶员 | 305 | // 关联的驾驶员 |
| 302 | - EmployeeConfigInfo employeeConfigInfo = null; | ||
| 303 | - if (isFb) { | ||
| 304 | - if (employeeConfigInfoList.size() > 1) { | ||
| 305 | - employeeConfigInfo = employeeConfigInfoList.get(1); | 306 | + if (sType == ScheduleRule_Type.NORMAL) { |
| 307 | + EmployeeConfigInfo employeeConfigInfo = null; | ||
| 308 | + if (isFb) { | ||
| 309 | + if (employeeConfigInfoList.size() > 1) { | ||
| 310 | + employeeConfigInfo = employeeConfigInfoList.get(1); | ||
| 311 | + } else { | ||
| 312 | + employeeConfigInfo = employeeConfigInfoList.get(0); | ||
| 313 | + } | ||
| 306 | } else { | 314 | } else { |
| 307 | employeeConfigInfo = employeeConfigInfoList.get(0); | 315 | employeeConfigInfo = employeeConfigInfoList.get(0); |
| 308 | } | 316 | } |
| 309 | - } else { | ||
| 310 | - employeeConfigInfo = employeeConfigInfoList.get(0); | ||
| 311 | - } | ||
| 312 | 317 | ||
| 313 | - this.j = employeeConfigInfo.getJsy().getId(); | 318 | + this.j = employeeConfigInfo.getJsy().getId(); |
| 314 | // this.jGh = employeeConfigInfo.getJsy().getJobCode(); | 319 | // this.jGh = employeeConfigInfo.getJsy().getJobCode(); |
| 315 | - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | ||
| 316 | - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | ||
| 317 | - if (jsy_temp.length > 1) { | ||
| 318 | - this.jGh = jsy_temp[1]; | ||
| 319 | - } else { | ||
| 320 | - this.jGh = jsy_temp[0]; | ||
| 321 | - } | ||
| 322 | - } | ||
| 323 | - this.jName = employeeConfigInfo.getJsy().getPersonnelName(); | ||
| 324 | - // 关联的售票员 | ||
| 325 | - if (employeeConfigInfo.getSpy() != null) { | ||
| 326 | - this.s = employeeConfigInfo.getSpy().getId(); | ||
| 327 | -// this.sGh = employeeConfigInfo.getSpy().getJobCode(); | ||
| 328 | - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | ||
| 329 | - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | ||
| 330 | - if (spy_temp.length > 1) { | ||
| 331 | - this.sGh = spy_temp[1]; | 320 | + if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { |
| 321 | + String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | ||
| 322 | + if (jsy_temp.length > 1) { | ||
| 323 | + this.jGh = jsy_temp[1]; | ||
| 332 | } else { | 324 | } else { |
| 333 | - this.sGh = spy_temp[0]; | 325 | + this.jGh = jsy_temp[0]; |
| 334 | } | 326 | } |
| 335 | } | 327 | } |
| 328 | + this.jName = employeeConfigInfo.getJsy().getPersonnelName(); | ||
| 329 | + // 关联的售票员 | ||
| 330 | + if (employeeConfigInfo.getSpy() != null) { | ||
| 331 | + this.s = employeeConfigInfo.getSpy().getId(); | ||
| 332 | +// this.sGh = employeeConfigInfo.getSpy().getJobCode(); | ||
| 333 | + if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | ||
| 334 | + String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | ||
| 335 | + if (spy_temp.length > 1) { | ||
| 336 | + this.sGh = spy_temp[1]; | ||
| 337 | + } else { | ||
| 338 | + this.sGh = spy_temp[0]; | ||
| 339 | + } | ||
| 340 | + } | ||
| 336 | 341 | ||
| 337 | - this.sName = employeeConfigInfo.getSpy().getPersonnelName(); | 342 | + this.sName = employeeConfigInfo.getSpy().getPersonnelName(); |
| 343 | + } | ||
| 338 | } | 344 | } |
| 339 | 345 | ||
| 340 | // 时刻明细数据 | 346 | // 时刻明细数据 |
| @@ -360,42 +366,44 @@ public class SchedulePlanInfo extends BEntity { | @@ -360,42 +366,44 @@ public class SchedulePlanInfo extends BEntity { | ||
| 360 | this.remark = ttInfoDetail.getRemark(); | 366 | this.remark = ttInfoDetail.getRemark(); |
| 361 | 367 | ||
| 362 | // 使用车辆配置的停车场信息 | 368 | // 使用车辆配置的停车场信息 |
| 363 | - String pzType = carConfigInfo.getPzType(); // 配置类型 | ||
| 364 | - if (pzType != null && !pzType.equals("BSY")) { | ||
| 365 | - if ("ZW".equals(pzType)) { // 只看早晚进出场 | ||
| 366 | - if (isFirstBc) { // 第一个班次是出场 | 369 | + if (sType == ScheduleRule_Type.NORMAL) { |
| 370 | + String pzType = carConfigInfo.getPzType(); // 配置类型 | ||
| 371 | + if (pzType != null && !pzType.equals("BSY")) { | ||
| 372 | + if ("ZW".equals(pzType)) { // 只看早晚进出场 | ||
| 373 | + if (isFirstBc) { // 第一个班次是出场 | ||
| 367 | // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | 374 | // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id |
| 368 | - this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code | ||
| 369 | - this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name | 375 | + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code |
| 376 | + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name | ||
| 370 | 377 | ||
| 371 | - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc(); | ||
| 372 | - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); | 378 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc(); |
| 379 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); | ||
| 373 | 380 | ||
| 374 | - } else if (isLastBc) { // 最后一个班次是进场 | 381 | + } else if (isLastBc) { // 最后一个班次是进场 |
| 375 | // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | 382 | // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id |
| 376 | - this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code | ||
| 377 | - this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name | 383 | + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code |
| 384 | + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name | ||
| 378 | 385 | ||
| 379 | - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc(); | ||
| 380 | - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); | ||
| 381 | - } | 386 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc(); |
| 387 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); | ||
| 388 | + } | ||
| 382 | 389 | ||
| 383 | - } else if ("FS".equals(pzType)) { // 所有进出场 | ||
| 384 | - if ("out".equals(this.bcType)) { // 出场班次 | 390 | + } else if ("FS".equals(pzType)) { // 所有进出场 |
| 391 | + if ("out".equals(this.bcType)) { // 出场班次 | ||
| 385 | // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | 392 | // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id |
| 386 | - this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code | ||
| 387 | - this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name | 393 | + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code |
| 394 | + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name | ||
| 388 | 395 | ||
| 389 | - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc(); | ||
| 390 | - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); | 396 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc(); |
| 397 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); | ||
| 391 | 398 | ||
| 392 | - } else if ("in".equals(this.bcType)) { | 399 | + } else if ("in".equals(this.bcType)) { |
| 393 | // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | 400 | // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id |
| 394 | - this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code | ||
| 395 | - this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name | 401 | + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code |
| 402 | + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name | ||
| 396 | 403 | ||
| 397 | - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc(); | ||
| 398 | - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); | 404 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc(); |
| 405 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); | ||
| 406 | + } | ||
| 399 | } | 407 | } |
| 400 | } | 408 | } |
| 401 | } | 409 | } |
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
| @@ -108,7 +108,10 @@ public class PredicatesBuilder { | @@ -108,7 +108,10 @@ public class PredicatesBuilder { | ||
| 108 | String.class.isAssignableFrom(rightType)) { // Date >= String | 108 | String.class.isAssignableFrom(rightType)) { // Date >= String |
| 109 | DateTime dateTime = new DateTime(object); | 109 | DateTime dateTime = new DateTime(object); |
| 110 | return cb.greaterThanOrEqualTo((Path<Date>) expression, dateTime.toDate()); | 110 | return cb.greaterThanOrEqualTo((Path<Date>) expression, dateTime.toDate()); |
| 111 | - } else { | 111 | + } else if (long.class.isAssignableFrom(leftType) && |
| 112 | + String.class.isAssignableFrom(rightType)) { // Long >= String | ||
| 113 | + return cb.greaterThanOrEqualTo((Path<Long>) expression, Long.valueOf(object+"")); | ||
| 114 | + } else { | ||
| 112 | throw new RuntimeException("ge 不支持类型组合:" + expression.getJavaType() + ">=" + object.getClass()); | 115 | throw new RuntimeException("ge 不支持类型组合:" + expression.getJavaType() + ">=" + object.getClass()); |
| 113 | } | 116 | } |
| 114 | } | 117 | } |
| @@ -140,7 +143,10 @@ public class PredicatesBuilder { | @@ -140,7 +143,10 @@ public class PredicatesBuilder { | ||
| 140 | String.class.isAssignableFrom(rightType)) { // Date <= String | 143 | String.class.isAssignableFrom(rightType)) { // Date <= String |
| 141 | DateTime dateTime = new DateTime(object); | 144 | DateTime dateTime = new DateTime(object); |
| 142 | return cb.lessThanOrEqualTo((Path<Date>) expression, dateTime.toDate()); | 145 | return cb.lessThanOrEqualTo((Path<Date>) expression, dateTime.toDate()); |
| 143 | - } else { | 146 | + }else if (long.class.isAssignableFrom(leftType) && |
| 147 | + String.class.isAssignableFrom(rightType)) { // Long <= String | ||
| 148 | + return cb.lessThanOrEqualTo((Path<Long>) expression, Long.valueOf(object + "") ); | ||
| 149 | + } else { | ||
| 144 | throw new RuntimeException("le 不支持类型组合:" + expression.getJavaType() + "<=" + object.getClass()); | 150 | throw new RuntimeException("le 不支持类型组合:" + expression.getJavaType() + "<=" + object.getClass()); |
| 145 | } | 151 | } |
| 146 | } | 152 | } |
src/main/java/com/bsth/entity/sys/Interval.java
| @@ -39,11 +39,11 @@ public class Interval { | @@ -39,11 +39,11 @@ public class Interval { | ||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | - public Integer getCreateBy() { | 42 | + public String getCreateBy() { |
| 43 | return createBy; | 43 | return createBy; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | - public void setCreateBy(Integer createBy) { | 46 | + public void setCreateBy(String createBy) { |
| 47 | this.createBy = createBy; | 47 | this.createBy = createBy; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| @@ -55,11 +55,11 @@ public class Interval { | @@ -55,11 +55,11 @@ public class Interval { | ||
| 55 | this.createDate = createDate; | 55 | this.createDate = createDate; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | - public Integer getUpdateBy() { | 58 | + public String getUpdateBy() { |
| 59 | return updateBy; | 59 | return updateBy; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | - public void setUpdateBy(Integer updateBy) { | 62 | + public void setUpdateBy(String updateBy) { |
| 63 | this.updateBy = updateBy; | 63 | this.updateBy = updateBy; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| @@ -75,13 +75,13 @@ public class Interval { | @@ -75,13 +75,13 @@ public class Interval { | ||
| 75 | private Integer trough; | 75 | private Integer trough; |
| 76 | 76 | ||
| 77 | @Column(name = "create_by") | 77 | @Column(name = "create_by") |
| 78 | - private Integer createBy; | 78 | + private String createBy; |
| 79 | 79 | ||
| 80 | @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | 80 | @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") |
| 81 | private Date createDate; | 81 | private Date createDate; |
| 82 | 82 | ||
| 83 | @Column(name = "update_by") | 83 | @Column(name = "update_by") |
| 84 | - private Integer updateBy; | 84 | + private String updateBy; |
| 85 | 85 | ||
| 86 | @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | 86 | @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") |
| 87 | private Date updateDate; | 87 | private Date updateDate; |
src/main/java/com/bsth/entity/traffic/VehicleInoutStop.java
0 → 100644
| 1 | +package com.bsth.entity.traffic; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.Cars; | ||
| 4 | +import com.bsth.entity.Line; | ||
| 5 | + | ||
| 6 | +import javax.persistence.*; | ||
| 7 | +import java.util.Date; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * | ||
| 11 | + * @ClassName: VehicleInoutStop(车载上报停靠站信息) | ||
| 12 | + * | ||
| 13 | + * @Description: TODO(线路标准信息) | ||
| 14 | + * | ||
| 15 | + * @Author bsth@zq | ||
| 16 | + * | ||
| 17 | + * @Date 2017-9-18 9:34:39 | ||
| 18 | + * | ||
| 19 | + * @Version 公交调度系统BS版 0.1 | ||
| 20 | + * | ||
| 21 | + */ | ||
| 22 | +@Entity | ||
| 23 | +@Table(name = "bsth_c_shreal") | ||
| 24 | +public class VehicleInoutStop { | ||
| 25 | + | ||
| 26 | + @Id | ||
| 27 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 28 | + private Integer id; | ||
| 29 | + | ||
| 30 | + @ManyToOne | ||
| 31 | + private Line line; | ||
| 32 | + | ||
| 33 | + @ManyToOne | ||
| 34 | + private Cars cars; | ||
| 35 | + | ||
| 36 | + // 站点序号 | ||
| 37 | + private Integer stop; | ||
| 38 | + | ||
| 39 | + // 营运状态 | ||
| 40 | + private Integer serviceState; | ||
| 41 | + | ||
| 42 | + // 上下行 | ||
| 43 | + private Integer upDown; | ||
| 44 | + | ||
| 45 | + // 进出站/站内外 | ||
| 46 | + private Integer inOutStop; | ||
| 47 | + | ||
| 48 | + // 上报时间 | ||
| 49 | + private long reportDate; | ||
| 50 | + | ||
| 51 | + public Integer getId() { | ||
| 52 | + return id; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public void setId(Integer id) { | ||
| 56 | + this.id = id; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public Line getLine() { | ||
| 60 | + return line; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void setLine(Line line) { | ||
| 64 | + this.line = line; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public Cars getCars() { | ||
| 68 | + return cars; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public void setCars(Cars cars) { | ||
| 72 | + this.cars = cars; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public Integer getStop() { | ||
| 76 | + return stop; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setStop(Integer stop) { | ||
| 80 | + this.stop = stop; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public Integer getServiceState() { | ||
| 84 | + return serviceState; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setServiceState(Integer serviceState) { | ||
| 88 | + this.serviceState = serviceState; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public Integer getUpDown() { | ||
| 92 | + return upDown; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setUpDown(Integer upDown) { | ||
| 96 | + this.upDown = upDown; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public Integer getInOutStop() { | ||
| 100 | + return inOutStop; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setInOutStop(Integer inOutStop) { | ||
| 104 | + this.inOutStop = inOutStop; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public long getReportDate() { return reportDate; } | ||
| 108 | + | ||
| 109 | + public void setReportDate(long reportDate) { this.reportDate = reportDate; } | ||
| 110 | +} |
src/main/java/com/bsth/filter/AccessLogFilter.java
| 1 | package com.bsth.filter; | 1 | package com.bsth.filter; |
| 2 | 2 | ||
| 3 | -import javax.servlet.FilterChain; | ||
| 4 | -import javax.servlet.ServletException; | ||
| 5 | -import javax.servlet.http.HttpServletRequest; | ||
| 6 | -import javax.servlet.http.HttpServletResponse; | ||
| 7 | - | ||
| 8 | -import org.slf4j.Logger; | ||
| 9 | -import org.slf4j.LoggerFactory; | ||
| 10 | -import org.springframework.stereotype.Component; | ||
| 11 | - | ||
| 12 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | +import com.bsth.entity.sys.SysUser; | ||
| 13 | import com.bsth.security.util.SecurityUtils; | 5 | import com.bsth.security.util.SecurityUtils; |
| 14 | import com.bsth.util.IpUtils; | 6 | import com.bsth.util.IpUtils; |
| 15 | import com.google.common.collect.Lists; | 7 | import com.google.common.collect.Lists; |
| 16 | import com.google.common.collect.Maps; | 8 | import com.google.common.collect.Maps; |
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | +import org.springframework.stereotype.Component; | ||
| 17 | 12 | ||
| 13 | +import javax.servlet.FilterChain; | ||
| 14 | +import javax.servlet.ServletException; | ||
| 15 | +import javax.servlet.http.HttpServletRequest; | ||
| 16 | +import javax.servlet.http.HttpServletResponse; | ||
| 18 | import java.io.IOException; | 17 | import java.io.IOException; |
| 19 | import java.util.Enumeration; | 18 | import java.util.Enumeration; |
| 20 | import java.util.List; | 19 | import java.util.List; |
| @@ -38,7 +37,9 @@ public class AccessLogFilter extends BaseFilter { | @@ -38,7 +37,9 @@ public class AccessLogFilter extends BaseFilter { | ||
| 38 | HttpServletResponse response, FilterChain chain) | 37 | HttpServletResponse response, FilterChain chain) |
| 39 | throws IOException, ServletException { | 38 | throws IOException, ServletException { |
| 40 | 39 | ||
| 41 | - String username = SecurityUtils.getCurrentUser().getName(); | 40 | + SysUser user = SecurityUtils.getCurrentUser(); |
| 41 | + String username = user.getUserName(); | ||
| 42 | + String name = user.getName(); | ||
| 42 | String jsessionId = request.getRequestedSessionId(); | 43 | String jsessionId = request.getRequestedSessionId(); |
| 43 | String ip = IpUtils.getIpAddr(request); | 44 | String ip = IpUtils.getIpAddr(request); |
| 44 | String userAgent = request.getHeader("User-Agent"); | 45 | String userAgent = request.getHeader("User-Agent"); |
| @@ -47,7 +48,7 @@ public class AccessLogFilter extends BaseFilter { | @@ -47,7 +48,7 @@ public class AccessLogFilter extends BaseFilter { | ||
| 47 | String headers = getHeaders(request); | 48 | String headers = getHeaders(request); |
| 48 | 49 | ||
| 49 | StringBuilder s = new StringBuilder(); | 50 | StringBuilder s = new StringBuilder(); |
| 50 | - s.append(getBlock(username)); | 51 | + s.append(getBlock(username + " -" + name)); |
| 51 | s.append(getBlock(jsessionId)); | 52 | s.append(getBlock(jsessionId)); |
| 52 | s.append(getBlock(ip)); | 53 | s.append(getBlock(ip)); |
| 53 | s.append(getBlock(userAgent)); | 54 | s.append(getBlock(userAgent)); |
src/main/java/com/bsth/repository/LineRepository.java
| @@ -41,4 +41,7 @@ public interface LineRepository extends BaseRepository<Line, Integer> { | @@ -41,4 +41,7 @@ public interface LineRepository extends BaseRepository<Line, Integer> { | ||
| 41 | 41 | ||
| 42 | @Query(value = " SELECT l FROM Line l where l.company like %?1% and l.brancheCompany like %?2% and l.lineCode like ?3") | 42 | @Query(value = " SELECT l FROM Line l where l.company like %?1% and l.brancheCompany like %?2% and l.lineCode like ?3") |
| 43 | public List<Line> findLineBygsBm(String gsBm, String fgsBm, String line); | 43 | public List<Line> findLineBygsBm(String gsBm, String fgsBm, String line); |
| 44 | + | ||
| 45 | + @Query("SELECT L FROM Line L where L.destroy=0") | ||
| 46 | + List<Line> findAllService(); | ||
| 44 | } | 47 | } |