Commit ba7766fd1cb527b740cf3d56b7f552ef827b5765
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into minhang
Showing
32 changed files
with
685 additions
and
78 deletions
Too many changes to show.
To preserve performance only 32 of 75 files are displayed.
pom.xml
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| ... | ... | @@ -22,6 +22,9 @@ public class BasicDataController { |
| 22 | 22 | @Autowired |
| 23 | 23 | BasicData.BasicDataLoader dataLoader; |
| 24 | 24 | |
| 25 | + @Autowired | |
| 26 | + BasicData basicData; | |
| 27 | + | |
| 25 | 28 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 26 | 29 | |
| 27 | 30 | @RequestMapping("/cars") |
| ... | ... | @@ -114,4 +117,13 @@ public class BasicDataController { |
| 114 | 117 | } |
| 115 | 118 | return rs; |
| 116 | 119 | } |
| 120 | + | |
| 121 | + /** | |
| 122 | + * 车辆自编号和车牌号对照 | |
| 123 | + * @return | |
| 124 | + */ | |
| 125 | + @RequestMapping("/nbbm2PlateNo") | |
| 126 | + public Map<String, String> nbbm2PlateNo(){ | |
| 127 | + return basicData.getNbbm2PlateNo(); | |
| 128 | + } | |
| 117 | 129 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -7,6 +7,7 @@ import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 7 | 7 | import com.bsth.data.BasicData; |
| 8 | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 10 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 10 | 11 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 11 | 12 | import org.apache.commons.lang3.StringEscapeUtils; |
| 12 | 13 | import org.joda.time.format.DateTimeFormat; |
| ... | ... | @@ -439,5 +440,13 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 439 | 440 | public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ |
| 440 | 441 | return scheduleRealInfoService.exportWaybillMore(map); |
| 441 | 442 | } |
| 442 | - | |
| 443 | + | |
| 444 | + /** | |
| 445 | + * 获取当日计划排班 , 从计划表抓取数据 | |
| 446 | + * @return | |
| 447 | + */ | |
| 448 | + @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET) | |
| 449 | + public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){ | |
| 450 | + return scheduleRealInfoService.currentSchedulePlan(lineCode); | |
| 451 | + } | |
| 443 | 452 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
| 1 | 1 | package com.bsth.controller.schedule.core; |
| 2 | 2 | |
| 3 | +import com.bsth.common.Constants; | |
| 4 | +import com.bsth.common.ResponseCode; | |
| 3 | 5 | import com.bsth.controller.schedule.BController; |
| 4 | 6 | import com.bsth.entity.schedule.SchedulePlan; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 8 | +import com.bsth.entity.sys.SysUser; | |
| 5 | 9 | import com.bsth.service.schedule.SchedulePlanService; |
| 10 | +import com.bsth.service.sys.SysUserService; | |
| 6 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 8 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 9 | -import org.springframework.web.bind.annotation.RestController; | |
| 12 | +import org.springframework.web.bind.annotation.*; | |
| 13 | + | |
| 14 | +import javax.servlet.http.HttpSession; | |
| 15 | +import java.util.Date; | |
| 16 | +import java.util.HashMap; | |
| 17 | +import java.util.List; | |
| 18 | +import java.util.Map; | |
| 10 | 19 | |
| 11 | 20 | /** |
| 12 | 21 | * Created by xu on 16/6/16. |
| ... | ... | @@ -16,6 +25,33 @@ import org.springframework.web.bind.annotation.RestController; |
| 16 | 25 | public class SchedulePlanController extends BController<SchedulePlan, Long> { |
| 17 | 26 | @Autowired |
| 18 | 27 | private SchedulePlanService schedulePlanService; |
| 28 | + @Autowired | |
| 29 | + private SysUserService sysUserService; | |
| 30 | + | |
| 31 | + @Override | |
| 32 | + public Map<String, Object> save(@RequestBody SchedulePlan schedulePlan, HttpSession httpSession) { | |
| 33 | + // 用户信息 | |
| 34 | + String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME)); | |
| 35 | + SysUser sysUser = sysUserService.findByUserName(userName); | |
| 36 | + | |
| 37 | + Date cdate = new Date(); | |
| 38 | + schedulePlan.setCreateBy(sysUser); | |
| 39 | + schedulePlan.setCreateDate(cdate); | |
| 40 | + schedulePlan.setUpdateBy(sysUser); | |
| 41 | + schedulePlan.setUpdateDate(cdate); | |
| 42 | + | |
| 43 | + // 如果多个公司,选第一个,以后改成页面控制 | |
| 44 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) httpSession.getAttribute(Constants.COMPANY_AUTHORITYS); | |
| 45 | + if (cmyAuths == null || cmyAuths.size() == 0) | |
| 46 | + schedulePlanService.save(schedulePlan, new CompanyAuthority()); | |
| 47 | + else | |
| 48 | + schedulePlanService.save(schedulePlan, cmyAuths.get(0)); | |
| 49 | + | |
| 50 | + Map<String, Object> rtn = new HashMap<>(); | |
| 51 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 52 | + rtn.put("data", new Object()); | |
| 53 | + return rtn; | |
| 54 | + } | |
| 19 | 55 | |
| 20 | 56 | /** |
| 21 | 57 | * 获取明天的一歌排班计划。 |
| ... | ... | @@ -31,4 +67,24 @@ public class SchedulePlanController extends BController<SchedulePlan, Long> { |
| 31 | 67 | } |
| 32 | 68 | } |
| 33 | 69 | |
| 70 | + /** | |
| 71 | + * 创建指定线路,指定时间范围内的排班计划,使用的时刻表情况 | |
| 72 | + * @param xlid 线路id | |
| 73 | + * @param from 开始时间 | |
| 74 | + * @param to 结束时间 | |
| 75 | + * @return | |
| 76 | + * @throws Exception | |
| 77 | + */ | |
| 78 | + @RequestMapping(value = "/valttinfo/{xlid}/{from}/{to}", method = RequestMethod.GET) | |
| 79 | + public Map<String, Object> validateTTInfo( | |
| 80 | + @PathVariable(value = "xlid") Integer xlid, | |
| 81 | + @PathVariable(value = "from") Date from, | |
| 82 | + @PathVariable(value = "to") Date to | |
| 83 | + ) throws Exception { | |
| 84 | + Map<String, Object> rtn = new HashMap<>(); | |
| 85 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 86 | + rtn.put("data", schedulePlanService.validateTTInfo(xlid, from, to)); | |
| 87 | + return rtn; | |
| 88 | + } | |
| 89 | + | |
| 34 | 90 | } | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -13,6 +13,7 @@ import org.slf4j.Logger; |
| 13 | 13 | import org.slf4j.LoggerFactory; |
| 14 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 15 | import org.springframework.boot.CommandLineRunner; |
| 16 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 16 | 17 | import org.springframework.stereotype.Component; |
| 17 | 18 | |
| 18 | 19 | import java.util.*; |
| ... | ... | @@ -89,6 +90,18 @@ public class BasicData implements CommandLineRunner { |
| 89 | 90 | return name != null? name: stationCode2NameMap.get(prefix + code); |
| 90 | 91 | } |
| 91 | 92 | |
| 93 | + @Autowired | |
| 94 | + JdbcTemplate jdbcTemplate; | |
| 95 | + public Map<String, String> getNbbm2PlateNo(){ | |
| 96 | + 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"); | |
| 97 | + | |
| 98 | + Map<String, String> rs = new HashMap<>(); | |
| 99 | + for(Map<String, Object> map : list){ | |
| 100 | + rs.put(map.get("CAR_CODE").toString(), map.get("CAR_PLATE").toString()); | |
| 101 | + } | |
| 102 | + return rs; | |
| 103 | + } | |
| 104 | + | |
| 92 | 105 | @Component |
| 93 | 106 | public static class BasicDataLoader extends Thread { |
| 94 | 107 | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata; |
| 3 | 3 | import com.bsth.data.BasicData; |
| 4 | 4 | import com.bsth.data.forecast.ForecastRealServer; |
| 5 | 5 | import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; |
| 6 | +import com.bsth.data.gpsdata.thread.OfflineMonitorThread; | |
| 6 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| 7 | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 8 | 9 | import com.google.common.collect.TreeMultimap; |
| ... | ... | @@ -35,6 +36,9 @@ public class GpsRealData implements CommandLineRunner { |
| 35 | 36 | GpsDataLoaderThread gpsDataLoader; |
| 36 | 37 | |
| 37 | 38 | @Autowired |
| 39 | + OfflineMonitorThread offlineMonitorThread; | |
| 40 | + | |
| 41 | + @Autowired | |
| 38 | 42 | DayOfSchedule dayOfSchedule; |
| 39 | 43 | |
| 40 | 44 | @Autowired |
| ... | ... | @@ -52,11 +56,12 @@ public class GpsRealData implements CommandLineRunner { |
| 52 | 56 | public void run(String... arg0) throws Exception { |
| 53 | 57 | logger.info("gpsDataLoader,20,5"); |
| 54 | 58 | //定时从网关获取GPS数据 |
| 55 | - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 15, TimeUnit.SECONDS); | |
| 59 | + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); | |
| 56 | 60 | //定时扫描掉离线 |
| 57 | - | |
| 61 | + //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | |
| 58 | 62 | } |
| 59 | 63 | |
| 64 | + | |
| 60 | 65 | public void put(GpsEntity gps) { |
| 61 | 66 | String device = gps.getDeviceId(); |
| 62 | 67 | GpsEntity old = gpsMap.get(device); | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
| ... | ... | @@ -19,10 +19,22 @@ public abstract class SignalHandle { |
| 19 | 19 | return prevs != null && prevs.size() > 0 && prevs.getTail() != null; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - protected boolean isDriftSignal(GpsEntity gps) { | |
| 22 | +/* protected boolean isDriftSignal(GpsEntity gps) { | |
| 23 | + return gps.getLat() == 0 || gps.getLon() == 0; | |
| 24 | + }*/ | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * gps掉线 | |
| 28 | + * @param gps | |
| 29 | + * @return | |
| 30 | + */ | |
| 31 | + protected boolean isGpsOffline(GpsEntity gps){ | |
| 23 | 32 | return gps.getLat() == 0 || gps.getLon() == 0; |
| 24 | 33 | } |
| 25 | 34 | |
| 35 | + protected boolean isOffline(GpsEntity gps){ | |
| 36 | + return gps.getAbnormalStatus() != null && gps.getAbnormalStatus().equals("offline"); | |
| 37 | + } | |
| 26 | 38 | /** |
| 27 | 39 | * 是不是异常信号 |
| 28 | 40 | * |
| ... | ... | @@ -34,7 +46,7 @@ public abstract class SignalHandle { |
| 34 | 46 | /** |
| 35 | 47 | * 连续异常信号个数统计 |
| 36 | 48 | * |
| 37 | - * @param prevs | |
| 49 | + * @param | |
| 38 | 50 | * @return protected int abnormalCount(CircleQueue<GpsEntity> prevs) { |
| 39 | 51 | * int count = 0; |
| 40 | 52 | * <p> |
| ... | ... | @@ -78,9 +90,9 @@ public abstract class SignalHandle { |
| 78 | 90 | return false; |
| 79 | 91 | |
| 80 | 92 | GpsEntity prev = prevs.getTail(); |
| 81 | - //从漂移状态恢复 | |
| 82 | - if (isDriftSignal(prev) | |
| 83 | - && !isDriftSignal(gps)) { | |
| 93 | + //从异常状态恢复 | |
| 94 | + if (isGpsOffline(prev) | |
| 95 | + && !isGpsOffline(gps)) { | |
| 84 | 96 | return true; |
| 85 | 97 | } |
| 86 | 98 | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/AbnormalStateHandle.java
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| ... | ... | @@ -46,10 +46,13 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 46 | 46 | |
| 47 | 47 | private final static int MAX_BEFORE_TIME = 1000 * 60 * 72; |
| 48 | 48 | |
| 49 | + //最大的班次时间差,防止异常的GPS时间打乱数据 | |
| 50 | + private final static int MAX_NORMAL_DIFF = 1000 * 60 * 60 * 12; | |
| 51 | + | |
| 49 | 52 | @Override |
| 50 | 53 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 51 | - //忽略漂移信号 | |
| 52 | - if(isDriftSignal(gps)) | |
| 54 | + //忽略掉线信号 | |
| 55 | + if(isGpsOffline(gps)) | |
| 53 | 56 | return false; |
| 54 | 57 | |
| 55 | 58 | //从异常状态恢复的第一个信号 |
| ... | ... | @@ -106,8 +109,14 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 106 | 109 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 107 | 110 | String qdzCode = sch.getQdzCode(); |
| 108 | 111 | |
| 112 | + int diff = (int) (sch.getDfsjT() - gps.getTimestamp()); | |
| 113 | + | |
| 109 | 114 | //首班出场最多提前1.2小时 |
| 110 | - if(dayOfSchedule.isFirstOut(sch) && sch.getDfsjT() - gps.getTimestamp() > MAX_BEFORE_TIME) | |
| 115 | + if(dayOfSchedule.isFirstOut(sch) && diff > MAX_BEFORE_TIME) | |
| 116 | + return; | |
| 117 | + | |
| 118 | + //正常班次最大时间差 | |
| 119 | + if(Math.abs(diff) > MAX_NORMAL_DIFF) | |
| 111 | 120 | return; |
| 112 | 121 | |
| 113 | 122 | //起点发车 |
| ... | ... | @@ -169,8 +178,13 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 169 | 178 | |
| 170 | 179 | if(gps.getStopNo().equals(sch.getZdzCode())){ |
| 171 | 180 | |
| 181 | + int diff = (int) (sch.getZdsjT() - gps.getTimestamp()); | |
| 172 | 182 | //进场最多提前1.2小时 |
| 173 | - if(sch.getBcType().equals("in") && sch.getZdsjT() - gps.getTimestamp() > MAX_BEFORE_TIME) | |
| 183 | + if(sch.getBcType().equals("in") && diff > MAX_BEFORE_TIME) | |
| 184 | + return; | |
| 185 | + | |
| 186 | + //正常班次最大时间差 | |
| 187 | + if(Math.abs(diff) > MAX_NORMAL_DIFF) | |
| 174 | 188 | return; |
| 175 | 189 | |
| 176 | 190 | //实达时间不覆盖 |
| ... | ... | @@ -195,7 +209,7 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 195 | 209 | //进站既进场 |
| 196 | 210 | inStationAndInPark(sch, next); |
| 197 | 211 | //将gps转换为下一个班次走向的站内信号 |
| 198 | - transformUpdown(gps, sch); | |
| 212 | + transformUpdown(gps, next); | |
| 199 | 213 | } |
| 200 | 214 | } |
| 201 | 215 | else if(sch.getFcsjActual() == null){ |
| ... | ... | @@ -217,6 +231,11 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 217 | 231 | |
| 218 | 232 | sendUtils.refreshSch(next); |
| 219 | 233 | dayOfSchedule.save(next); |
| 234 | + | |
| 235 | + //分班的时候,需要再跳过1个班次 | |
| 236 | + next = dayOfSchedule.next(next); | |
| 237 | + if(next != null) | |
| 238 | + dayOfSchedule.addExecPlan(next); | |
| 220 | 239 | } |
| 221 | 240 | } |
| 222 | 241 | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/OfflineSignalHandle.java
| ... | ... | @@ -21,9 +21,10 @@ public class OfflineSignalHandle extends SignalHandle{ |
| 21 | 21 | |
| 22 | 22 | @Override |
| 23 | 23 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 24 | - //漂移信号不管 | |
| 25 | - if(isDriftSignal(gps)){ | |
| 24 | + //掉线信号不管 | |
| 25 | + if(isGpsOffline(gps)){ | |
| 26 | 26 | gps.setSignalState("drift"); |
| 27 | + gps.setAbnormalStatus("gps-offline"); | |
| 27 | 28 | return true; |
| 28 | 29 | } |
| 29 | 30 | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
src/main/java/com/bsth/data/gpsdata/thread/OfflineMonitorThread.java
| ... | ... | @@ -2,7 +2,11 @@ package com.bsth.data.gpsdata.thread; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.gpsdata.GpsEntity; |
| 4 | 4 | import com.bsth.data.gpsdata.GpsRealData; |
| 5 | +import com.bsth.websocket.handler.SendUtils; | |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 5 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.stereotype.Component; | |
| 6 | 10 | |
| 7 | 11 | import java.util.Collection; |
| 8 | 12 | |
| ... | ... | @@ -10,35 +14,45 @@ import java.util.Collection; |
| 10 | 14 | * GPS掉离线监控 |
| 11 | 15 | * Created by panzhao on 2017/1/11. |
| 12 | 16 | */ |
| 17 | +@Component | |
| 13 | 18 | public class OfflineMonitorThread extends Thread{ |
| 14 | 19 | |
| 15 | 20 | @Autowired |
| 16 | 21 | GpsRealData gpsRealData; |
| 17 | 22 | |
| 18 | - //有任务时 掉线阈值 | |
| 19 | - private final static int LOSE_TIME = 1000 * 60 * 2; | |
| 23 | + //掉线阈值 | |
| 24 | + private final static int LOSE_TIME = 1000 * 60 * 10; | |
| 25 | + | |
| 26 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 27 | + | |
| 28 | + @Autowired | |
| 29 | + SendUtils sendUtils; | |
| 20 | 30 | |
| 21 | 31 | //无任务时 离线阈值 |
| 22 | - private final static int OFFLINE_TIME = 1000 * 60 * 10; | |
| 32 | + //private final static int OFFLINE_TIME = 1000 * 60 * 10; | |
| 23 | 33 | |
| 24 | 34 | @Override |
| 25 | 35 | public void run() { |
| 26 | - long t = System.currentTimeMillis(); | |
| 27 | - Collection<GpsEntity> list = gpsRealData.all(); | |
| 28 | - | |
| 29 | - String state; | |
| 30 | - for(GpsEntity gps : list){ | |
| 31 | - state = gps.getAbnormalStatus(); | |
| 32 | - | |
| 33 | - if(state.equals("offline")) | |
| 34 | - continue; | |
| 35 | - | |
| 36 | - | |
| 37 | - //if(state.equals("lose")) | |
| 38 | - //if(!state.equals("lose")) | |
| 39 | - //if(state.equals("")) | |
| 40 | - //if(gps.getTimestamp()) | |
| 41 | - //if(gps.getAbnormalStatus().equals("lose")) | |
| 36 | + try{ | |
| 37 | + long t = System.currentTimeMillis(); | |
| 38 | + Collection<GpsEntity> list = gpsRealData.all(); | |
| 39 | + | |
| 40 | + String state; | |
| 41 | + for(GpsEntity gps : list){ | |
| 42 | + state = gps.getAbnormalStatus(); | |
| 43 | + | |
| 44 | + if(state != null && state.equals("offline")) | |
| 45 | + continue; | |
| 46 | + | |
| 47 | + if (t - gps.getTimestamp() > LOSE_TIME){ | |
| 48 | + gps.setAbnormalStatus("offline"); | |
| 49 | + | |
| 50 | + //通知页面有设备掉线 | |
| 51 | + sendUtils.deviceOffline(gps); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + }catch (Exception e){ | |
| 55 | + logger.error("", e); | |
| 42 | 56 | } |
| 43 | 57 | } |
| 44 | 58 | } | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -49,6 +49,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 49 | 49 | |
| 50 | 50 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 51 | 51 | |
| 52 | + //按线路分组的 “计划” 排班数据 | |
| 53 | + public static Map<String, List<SchedulePlanInfo>> schedulePlanMap; | |
| 54 | + | |
| 52 | 55 | // 按车辆分组的班次数据 |
| 53 | 56 | private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap; |
| 54 | 57 | |
| ... | ... | @@ -101,6 +104,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 101 | 104 | currSchDateMap = new HashMap<>(); |
| 102 | 105 | nbbm2SEStationMap = TreeMultimap.create(); |
| 103 | 106 | carExecutePlanMap = new HashMap<>(); |
| 107 | + | |
| 108 | + schedulePlanMap = new HashMap<>(); | |
| 104 | 109 | } |
| 105 | 110 | |
| 106 | 111 | @Autowired |
| ... | ... | @@ -328,6 +333,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 328 | 333 | |
| 329 | 334 | // 查询计划排班 |
| 330 | 335 | List<SchedulePlanInfo> planItr = cleanSchPlanItr(schPlanService.list(data).iterator()); |
| 336 | + //保存一份原始计划排班数据 | |
| 337 | + schedulePlanMap.put(lineCode, planItr); | |
| 331 | 338 | |
| 332 | 339 | // 转换为实际排班 |
| 333 | 340 | realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class); |
| ... | ... | @@ -374,6 +381,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 374 | 381 | } catch (Exception e) { |
| 375 | 382 | logger.error("", e); |
| 376 | 383 | } |
| 384 | + | |
| 377 | 385 | return realList; |
| 378 | 386 | } |
| 379 | 387 | |
| ... | ... | @@ -399,7 +407,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 399 | 407 | new BatchSaveUtils<ScheduleRealInfo>().saveList(list, ScheduleRealInfo.class); |
| 400 | 408 | } |
| 401 | 409 | |
| 402 | - private List<SchedulePlanInfo> cleanSchPlanItr(Iterator<SchedulePlanInfo> itrab) { | |
| 410 | + public List<SchedulePlanInfo> cleanSchPlanItr(Iterator<SchedulePlanInfo> itrab) { | |
| 403 | 411 | List<SchedulePlanInfo> list = new ArrayList<>(); |
| 404 | 412 | |
| 405 | 413 | SchedulePlanInfo sp; | ... | ... |
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| ... | ... | @@ -157,6 +157,7 @@ public class SchedulePlanInfo { |
| 157 | 157 | Line xl, |
| 158 | 158 | ScheduleResult_output scheduleResult_output, |
| 159 | 159 | TTInfoDetail ttInfoDetail, |
| 160 | + Boolean isFb, | |
| 160 | 161 | CarConfigInfo carConfigInfo, |
| 161 | 162 | List<EmployeeConfigInfo> employeeConfigInfoList, |
| 162 | 163 | SchedulePlan schedulePlan) { |
| ... | ... | @@ -191,7 +192,7 @@ public class SchedulePlanInfo { |
| 191 | 192 | // TODO:报道时间,出场时间没有 |
| 192 | 193 | // 关联的驾驶员 |
| 193 | 194 | EmployeeConfigInfo employeeConfigInfo = null; |
| 194 | - if (ttInfoDetail.getIsFB()) { | |
| 195 | + if (isFb) { | |
| 195 | 196 | if (employeeConfigInfoList.size() > 1) { |
| 196 | 197 | employeeConfigInfo = employeeConfigInfoList.get(1); |
| 197 | 198 | } else { | ... | ... |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -28,7 +28,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 28 | 28 | @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)") |
| 29 | 29 | List<ScheduleRealInfo> queryUserInfo(String line,String date); |
| 30 | 30 | |
| 31 | - @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)") | |
| 31 | + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName,s.sGh,s.sName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName,s.sGh,s.sName order by (lpName+1)") | |
| 32 | 32 | List<ScheduleRealInfo> queryUserInfo2(String line,String date); |
| 33 | 33 | |
| 34 | 34 | @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.clZbh ") | ... | ... |
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
| ... | ... | @@ -33,17 +33,18 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI |
| 33 | 33 | "lp_name as lpName, " + |
| 34 | 34 | "cl as clId, " + |
| 35 | 35 | "cl_zbh as clZbh, " + |
| 36 | - "group_concat(distinct fcsj) ccsj, " + | |
| 36 | + "group_concat(fcsj) ccsj, " + | |
| 37 | + "group_concat(bc_type) bctype, " + | |
| 37 | 38 | "group_concat(distinct j) jsyId, " + |
| 38 | 39 | "group_concat(distinct j_gh) jsyGh, " + |
| 39 | 40 | "group_concat(distinct j_name) jsyName, " + |
| 40 | 41 | "group_concat(distinct s) spyId, " + |
| 41 | 42 | "group_concat(distinct s_gh) spyGh, " + |
| 42 | 43 | "group_concat(distinct s_name) spyName, " + |
| 43 | - "max(create_date) as createDate " + | |
| 44 | + "max(create_date) as createDate, " + | |
| 45 | + "group_concat(fcno) fcno " + | |
| 44 | 46 | "from bsth_c_s_sp_info " + |
| 45 | - "where bc_type = 'out' and " + | |
| 46 | - "xl = ?1 and " + | |
| 47 | + "where xl = ?1 and " + | |
| 47 | 48 | "schedule_date = ?2 " + |
| 48 | 49 | "group by xl_name, schedule_date, lp, lp_name, cl, cl_zbh " + |
| 49 | 50 | "order by xl_name, schedule_date, lp ", nativeQuery = true) |
| ... | ... | @@ -71,14 +72,16 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI |
| 71 | 72 | "scpinfo.scheduleDate = :p3 and " + |
| 72 | 73 | "scpinfo.lpName = :p4 and " + |
| 73 | 74 | "scpinfo.fcsj = :p5 and " + |
| 74 | - "scpinfo.bcType = :p6 ") | |
| 75 | + "scpinfo.bcType = :p6 and " + | |
| 76 | + "scpinfo.fcno = :p7 " ) | |
| 75 | 77 | int updateGroupInfo_type_2_4( |
| 76 | 78 | @Param("p1") String fcsj, |
| 77 | 79 | @Param("p2") Integer xlid, |
| 78 | 80 | @Param("p3") Date scheduleDate, |
| 79 | 81 | @Param("p4") String lpName, |
| 80 | 82 | @Param("p5") String fcsj_src, |
| 81 | - @Param("p6") String bcType); | |
| 83 | + @Param("p6") String bcType, | |
| 84 | + @Param("p7") Integer fcno); | |
| 82 | 85 | |
| 83 | 86 | @Modifying |
| 84 | 87 | @Query(value = "update " + | ... | ... |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.service.realcontrol; |
| 3 | 3 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; |
| 4 | 4 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 5 | 5 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 6 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 6 | 7 | import com.bsth.service.BaseService; |
| 7 | 8 | import org.springframework.stereotype.Service; |
| 8 | 9 | |
| ... | ... | @@ -148,4 +149,6 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L |
| 148 | 149 | List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map); |
| 149 | 150 | |
| 150 | 151 | Map<String, Object> exportWaybillMore(Map<String, Object> map); |
| 152 | + | |
| 153 | + List<SchedulePlanInfo> currentSchedulePlan(String lineCode); | |
| 151 | 154 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -24,6 +24,7 @@ import com.bsth.entity.realcontrol.SvgAttribute; |
| 24 | 24 | import com.bsth.entity.schedule.CarConfigInfo; |
| 25 | 25 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 26 | 26 | import com.bsth.entity.schedule.GuideboardInfo; |
| 27 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 27 | 28 | import com.bsth.entity.sys.DutyEmployee; |
| 28 | 29 | import com.bsth.entity.sys.SysUser; |
| 29 | 30 | import com.bsth.repository.LineRepository; |
| ... | ... | @@ -38,6 +39,7 @@ import com.bsth.security.util.SecurityUtils; |
| 38 | 39 | import com.bsth.service.SectionRouteService; |
| 39 | 40 | import com.bsth.service.impl.BaseServiceImpl; |
| 40 | 41 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 42 | +import com.bsth.service.schedule.SchedulePlanInfoService; | |
| 41 | 43 | import com.bsth.service.sys.DutyEmployeeService; |
| 42 | 44 | import com.bsth.util.*; |
| 43 | 45 | import com.bsth.websocket.handler.SendUtils; |
| ... | ... | @@ -55,11 +57,7 @@ import org.slf4j.LoggerFactory; |
| 55 | 57 | import org.springframework.beans.factory.annotation.Autowired; |
| 56 | 58 | import org.springframework.stereotype.Service; |
| 57 | 59 | |
| 58 | -import java.io.BufferedInputStream; | |
| 59 | -import java.io.BufferedOutputStream; | |
| 60 | -import java.io.File; | |
| 61 | -import java.io.FileInputStream; | |
| 62 | -import java.io.FileOutputStream; | |
| 60 | +import java.io.*; | |
| 63 | 61 | import java.text.DecimalFormat; |
| 64 | 62 | import java.text.ParseException; |
| 65 | 63 | import java.text.SimpleDateFormat; |
| ... | ... | @@ -2179,7 +2177,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2179 | 2177 | |
| 2180 | 2178 | for (ChangePersonCar cpc : cpcs) { |
| 2181 | 2179 | |
| 2182 | - if (map.get(cpc.getClZbh()) == null) { | |
| 2180 | + if (cpc.getClZbh() != null && map.get(cpc.getClZbh()) == null) { | |
| 2183 | 2181 | rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); |
| 2184 | 2182 | rs.put("status", ResponseCode.ERROR); |
| 2185 | 2183 | return rs; |
| ... | ... | @@ -3228,5 +3226,25 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3228 | 3226 | map.put("fileName", file.getName()); |
| 3229 | 3227 | return map; |
| 3230 | 3228 | } |
| 3231 | - | |
| 3229 | + | |
| 3230 | + @Autowired | |
| 3231 | + SchedulePlanInfoService schPlanService; | |
| 3232 | + @Override | |
| 3233 | + public List<SchedulePlanInfo> currentSchedulePlan(String lineCode) { | |
| 3234 | + List<SchedulePlanInfo> rs = dayOfSchedule.schedulePlanMap.get(lineCode); | |
| 3235 | + | |
| 3236 | + if(rs==null || rs.size()==0){ | |
| 3237 | + //尝试刷新内存 | |
| 3238 | + Map<String, Object> data = new HashMap<>(); | |
| 3239 | + data.put("scheduleDate_eq", dayOfSchedule.currSchDateMap.get(lineCode)); | |
| 3240 | + data.put("xlBm_eq", lineCode); | |
| 3241 | + List<SchedulePlanInfo> planItr = dayOfSchedule.cleanSchPlanItr(schPlanService.list(data).iterator()); | |
| 3242 | + | |
| 3243 | + if(planItr.size() > 0){ | |
| 3244 | + dayOfSchedule.schedulePlanMap.put(lineCode, planItr); | |
| 3245 | + return planItr; | |
| 3246 | + } | |
| 3247 | + } | |
| 3248 | + return rs; | |
| 3249 | + } | |
| 3232 | 3250 | } |
| 3233 | 3251 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
| ... | ... | @@ -4,6 +4,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | 4 | import com.bsth.service.BaseService; |
| 5 | 5 | import org.joda.time.DateTime; |
| 6 | 6 | |
| 7 | +import java.util.ArrayList; | |
| 7 | 8 | import java.util.Date; |
| 8 | 9 | import java.util.List; |
| 9 | 10 | |
| ... | ... | @@ -117,6 +118,11 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 117 | 118 | /** 创建时间 */ |
| 118 | 119 | private Date createDate; |
| 119 | 120 | |
| 121 | + /** 出场班次1发车的顺序号 */ | |
| 122 | + private Integer fcno1; | |
| 123 | + /** 出场班次2发车的顺序号 */ | |
| 124 | + private Integer fcno2; | |
| 125 | + | |
| 120 | 126 | public GroupInfo() {} |
| 121 | 127 | |
| 122 | 128 | public GroupInfo(Object[] datas) { |
| ... | ... | @@ -132,19 +138,40 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 132 | 138 | this.clId = Integer.valueOf(String.valueOf(datas[4])); |
| 133 | 139 | // 车辆自编号 |
| 134 | 140 | this.clZbh = String.valueOf(datas[5]); |
| 135 | - // 出场时间,如果有多个,需要分开 | |
| 141 | + // 出场时间,出场班次,如果有多个,需要分开 | |
| 136 | 142 | Object ccsj = datas[6]; |
| 143 | + Object bctype = datas[7]; | |
| 144 | + Object fcno = datas[15]; | |
| 145 | + | |
| 137 | 146 | if (ccsj != null) { |
| 138 | 147 | String[] ccsj_array = ((String) ccsj).split(","); |
| 139 | - if (ccsj_array.length > 1) { | |
| 140 | - this.ccsj1 = String.valueOf(ccsj_array[0]); | |
| 141 | - this.ccsj2 = String.valueOf(ccsj_array[1]); | |
| 142 | - } else { | |
| 143 | - this.ccsj1 = String.valueOf(ccsj_array[0]); | |
| 148 | + String[] bctype_array = ((String) bctype).split(","); | |
| 149 | + String[] fcno_array = ((String) fcno).split(","); | |
| 150 | + List<Integer> bctype_index = new ArrayList<>(); | |
| 151 | + | |
| 152 | + for (int i = 0; i < bctype_array.length; i++) { | |
| 153 | + if (bctype_index.size() == 2) { // 只记录2个出场 | |
| 154 | + break; | |
| 155 | + } | |
| 156 | + if (bctype_array[i].equals("out")) { | |
| 157 | + bctype_index.add(i); | |
| 158 | + } | |
| 159 | + } | |
| 160 | + | |
| 161 | + if (bctype_index.size() == 1) { | |
| 162 | + this.ccsj1 = String.valueOf(ccsj_array[bctype_index.get(0)]); | |
| 163 | + this.fcno1 = Integer.valueOf(fcno_array[bctype_index.get(0)]); | |
| 164 | + } else if (bctype_index.size() == 2) { | |
| 165 | + this.ccsj1 = String.valueOf(ccsj_array[bctype_index.get(0)]); | |
| 166 | + this.ccsj2 = String.valueOf(ccsj_array[bctype_index.get(1)]); | |
| 167 | + | |
| 168 | + this.fcno1 = Integer.valueOf(fcno_array[bctype_index.get(0)]); | |
| 169 | + this.fcno2 = Integer.valueOf(fcno_array[bctype_index.get(1)]); | |
| 144 | 170 | } |
| 171 | + | |
| 145 | 172 | } |
| 146 | 173 | // 驾驶员id,如果有多个,需要分开 |
| 147 | - Object jsyId = datas[7]; | |
| 174 | + Object jsyId = datas[8]; | |
| 148 | 175 | if (jsyId != null) { |
| 149 | 176 | String[] jsyId_array = ((String) jsyId).split(","); |
| 150 | 177 | if (jsyId_array.length > 1) { |
| ... | ... | @@ -155,7 +182,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 155 | 182 | } |
| 156 | 183 | } |
| 157 | 184 | // 驾驶员工号,如果有多个,需要分开 |
| 158 | - Object jsyGh = datas[8]; | |
| 185 | + Object jsyGh = datas[9]; | |
| 159 | 186 | if (jsyGh != null) { |
| 160 | 187 | String[] jsyGh_array = ((String) jsyGh).split(","); |
| 161 | 188 | if (jsyGh_array.length > 1) { |
| ... | ... | @@ -166,7 +193,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 166 | 193 | } |
| 167 | 194 | } |
| 168 | 195 | // 驾驶员名字,如果有多个,需要分开 |
| 169 | - Object jsyName = datas[9]; | |
| 196 | + Object jsyName = datas[10]; | |
| 170 | 197 | if (jsyName != null) { |
| 171 | 198 | String[] jsyName_array = ((String) jsyName).split(","); |
| 172 | 199 | if (jsyName_array.length > 1) { |
| ... | ... | @@ -178,7 +205,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 178 | 205 | } |
| 179 | 206 | |
| 180 | 207 | // 售票员id,如果有多个,需要分开 |
| 181 | - Object spyId = datas[10]; | |
| 208 | + Object spyId = datas[11]; | |
| 182 | 209 | if (spyId != null) { |
| 183 | 210 | String[] spyId_array = ((String) spyId).split(","); |
| 184 | 211 | if (spyId_array.length > 1) { |
| ... | ... | @@ -190,7 +217,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 190 | 217 | } |
| 191 | 218 | |
| 192 | 219 | // 售票员工号,如果有多个,需要分开 |
| 193 | - Object spyGh = datas[11]; | |
| 220 | + Object spyGh = datas[12]; | |
| 194 | 221 | if (spyGh != null) { |
| 195 | 222 | String[] spyGh_array = ((String) spyGh).split(","); |
| 196 | 223 | if (spyGh_array.length > 1) { |
| ... | ... | @@ -201,7 +228,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 201 | 228 | } |
| 202 | 229 | } |
| 203 | 230 | // 售票员名字,如果有多个,需要分开 |
| 204 | - Object spyName = datas[12]; | |
| 231 | + Object spyName = datas[13]; | |
| 205 | 232 | if (spyName != null) { |
| 206 | 233 | String[] spyName_array = ((String) spyName).split(","); |
| 207 | 234 | if (spyName_array.length > 1) { |
| ... | ... | @@ -212,7 +239,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 212 | 239 | } |
| 213 | 240 | } |
| 214 | 241 | // 创建时间 |
| 215 | - this.createDate = new DateTime(datas[13]).toDate(); | |
| 242 | + this.createDate = new DateTime(datas[14]).toDate(); | |
| 216 | 243 | |
| 217 | 244 | // TODO:可能还有其他字段 |
| 218 | 245 | } |
| ... | ... | @@ -384,5 +411,21 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 384 | 411 | public void setXlId(Integer xlId) { |
| 385 | 412 | this.xlId = xlId; |
| 386 | 413 | } |
| 414 | + | |
| 415 | + public Integer getFcno1() { | |
| 416 | + return fcno1; | |
| 417 | + } | |
| 418 | + | |
| 419 | + public void setFcno1(Integer fcno1) { | |
| 420 | + this.fcno1 = fcno1; | |
| 421 | + } | |
| 422 | + | |
| 423 | + public Integer getFcno2() { | |
| 424 | + return fcno2; | |
| 425 | + } | |
| 426 | + | |
| 427 | + public void setFcno2(Integer fcno2) { | |
| 428 | + this.fcno2 = fcno2; | |
| 429 | + } | |
| 387 | 430 | } |
| 388 | 431 | } | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoServiceImpl.java
| ... | ... | @@ -55,7 +55,8 @@ public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInf |
| 55 | 55 | groupInfoUpdate.getUpdate().getScheduleDate(), |
| 56 | 56 | groupInfoUpdate.getSrc().getLpName(), |
| 57 | 57 | groupInfoUpdate.getSrc().getCcsj1(), |
| 58 | - "out" | |
| 58 | + "out", | |
| 59 | + groupInfoUpdate.getSrc().getFcno1() | |
| 59 | 60 | ); |
| 60 | 61 | } |
| 61 | 62 | |
| ... | ... | @@ -94,7 +95,8 @@ public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInf |
| 94 | 95 | groupInfoUpdate.getUpdate().getScheduleDate(), |
| 95 | 96 | groupInfoUpdate.getSrc().getLpName(), |
| 96 | 97 | groupInfoUpdate.getSrc().getCcsj2(), |
| 97 | - "out" | |
| 98 | + "out", | |
| 99 | + groupInfoUpdate.getSrc().getFcno2() | |
| 98 | 100 | ); |
| 99 | 101 | } |
| 100 | 102 | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 5 | +import com.bsth.service.schedule.rules.ttinfo2.Result; | |
| 6 | + | |
| 7 | +import java.util.Date; | |
| 4 | 8 | |
| 5 | 9 | /** |
| 6 | 10 | * Created by xu on 16/6/16. |
| 7 | 11 | */ |
| 8 | 12 | public interface SchedulePlanService extends BService<SchedulePlan, Long> { |
| 13 | + | |
| 14 | + SchedulePlan save(SchedulePlan schedulePlan, CompanyAuthority companyAuthority); | |
| 15 | + | |
| 9 | 16 | /** |
| 10 | 17 | * 获取有明日排班的计划。 |
| 11 | 18 | * @return |
| 12 | 19 | */ |
| 13 | 20 | SchedulePlan findSchedulePlanTommorw(); |
| 14 | -} | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 验证使用的时刻表。 | |
| 24 | + * @param xlid 线路id | |
| 25 | + * @param from 开始时间 | |
| 26 | + * @param to 结束时间 | |
| 27 | + * @return | |
| 28 | + */ | |
| 29 | + Result validateTTInfo(Integer xlid, Date from, Date to); | |
| 30 | +} | |
| 15 | 31 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| ... | ... | @@ -3,19 +3,27 @@ package com.bsth.service.schedule.impl; |
| 3 | 3 | import com.bsth.entity.Line; |
| 4 | 4 | import com.bsth.entity.schedule.*; |
| 5 | 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 6 | 7 | import com.bsth.repository.schedule.SchedulePlanInfoRepository; |
| 7 | 8 | import com.bsth.repository.schedule.SchedulePlanRepository; |
| 9 | +import com.bsth.service.LineService; | |
| 8 | 10 | import com.bsth.service.schedule.SchedulePlanService; |
| 11 | +import com.bsth.service.schedule.TTInfoDetailService; | |
| 12 | +import com.bsth.service.schedule.TTInfoService; | |
| 9 | 13 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 10 | 14 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 11 | 15 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 12 | 16 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 13 | 17 | import com.bsth.service.schedule.rules.strategy.IStrategy; |
| 18 | +import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; | |
| 19 | +import com.bsth.service.schedule.rules.ttinfo2.Result; | |
| 14 | 20 | import com.google.common.collect.Multimap; |
| 15 | 21 | import org.apache.commons.lang3.StringUtils; |
| 16 | 22 | import org.joda.time.DateTime; |
| 17 | 23 | import org.kie.api.KieBase; |
| 18 | 24 | import org.kie.api.runtime.KieSession; |
| 25 | +import org.slf4j.Logger; | |
| 26 | +import org.slf4j.LoggerFactory; | |
| 19 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | 28 | import org.springframework.stereotype.Service; |
| 21 | 29 | import org.springframework.transaction.annotation.Isolation; |
| ... | ... | @@ -37,10 +45,18 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 37 | 45 | private SchedulePlanRepository schedulePlanRepository; |
| 38 | 46 | @Autowired |
| 39 | 47 | private SchedulePlanInfoRepository schedulePlanInfoRepository; |
| 48 | + @Autowired | |
| 49 | + private LineService lineService; | |
| 50 | + @Autowired | |
| 51 | + private TTInfoService ttInfoService; | |
| 52 | + @Autowired | |
| 53 | + private TTInfoDetailService ttInfoDetailService; | |
| 54 | + | |
| 55 | + /** 日志记录器 */ | |
| 56 | + private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class); | |
| 40 | 57 | |
| 41 | 58 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 42 | - @Override | |
| 43 | - public SchedulePlan save(SchedulePlan schedulePlan) { | |
| 59 | + public SchedulePlan save(SchedulePlan schedulePlan, CompanyAuthority companyAuthority) { | |
| 44 | 60 | // 1-1、查找线路具体信息 |
| 45 | 61 | Line xl = strategy.getLine(schedulePlan.getXl().getId()); |
| 46 | 62 | // 1-2、查出指定线路的所有规则 |
| ... | ... | @@ -106,18 +122,41 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 106 | 122 | employeeConfigInfoList.add(employeeConfigMaps.get(Long.valueOf(eid))); |
| 107 | 123 | } |
| 108 | 124 | // 排班明细(这个要迭代的) |
| 109 | - Collection<TTInfoDetail> ttInfoDetails = gbdTTinfoMaps.get(scheduleResult_output.getSd().toDate()).get( | |
| 125 | + Collection<TTInfoDetail> ttInfoDetails_ = gbdTTinfoMaps.get(scheduleResult_output.getSd().toDate()).get( | |
| 110 | 126 | Long.parseLong(scheduleResult_output.getGuideboardId())); |
| 127 | + List<TTInfoDetail> ttInfoDetails = new ArrayList<>(ttInfoDetails_); | |
| 128 | + | |
| 129 | + // 排序ttInfoDetails | |
| 130 | + Collections.sort(ttInfoDetails, new Comparator<TTInfoDetail>() { | |
| 131 | + @Override | |
| 132 | + public int compare(TTInfoDetail o1, TTInfoDetail o2) { | |
| 133 | + return o1.getFcno().compareTo(o2.getFcno()); | |
| 134 | + } | |
| 135 | + }); | |
| 136 | + | |
| 137 | + Boolean isFb = false; // 是否分班 | |
| 111 | 138 | for (TTInfoDetail ttInfoDetail : ttInfoDetails) { |
| 139 | + if (ttInfoDetail.getIsFB()) | |
| 140 | + isFb = ttInfoDetail.getIsFB(); | |
| 141 | + | |
| 112 | 142 | SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo( |
| 113 | 143 | xl, |
| 114 | 144 | scheduleResult_output, |
| 115 | 145 | ttInfoDetail, |
| 146 | + isFb, | |
| 116 | 147 | configInfo, |
| 117 | 148 | employeeConfigInfoList, |
| 118 | 149 | schedulePlan); |
| 150 | + | |
| 151 | + // 公司,分公司编码 | |
| 152 | + schedulePlanInfo.setGsBm(companyAuthority.getCompanyCode()); | |
| 153 | + schedulePlanInfo.setGsName(companyAuthority.getCompanyName()); | |
| 154 | + schedulePlanInfo.setFgsBm(companyAuthority.getSubCompanyCode()); | |
| 155 | + schedulePlanInfo.setFgsName(companyAuthority.getSubCompanyName()); | |
| 156 | + | |
| 119 | 157 | schedulePlanInfos.add(schedulePlanInfo); |
| 120 | 158 | ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName()); |
| 159 | + | |
| 121 | 160 | } |
| 122 | 161 | } |
| 123 | 162 | |
| ... | ... | @@ -144,4 +183,36 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 144 | 183 | } |
| 145 | 184 | return null; |
| 146 | 185 | } |
| 186 | + | |
| 187 | + @Override | |
| 188 | + public Result validateTTInfo(Integer xlid, Date from, Date to) { | |
| 189 | + // 构造drools session->载入数据->启动规则->计算->销毁session | |
| 190 | + // 创建session,内部配置的是stateful | |
| 191 | + KieSession session = kieBase.newKieSession(); | |
| 192 | + // 设置gloable对象,在drl中通过别名使用 | |
| 193 | + session.setGlobal("log", logger); | |
| 194 | + session.setGlobal("lineService", lineService); | |
| 195 | + session.setGlobal("ttInfoDetailService", ttInfoDetailService); | |
| 196 | + | |
| 197 | + Result rs = new Result(); // 输出gloable对象 | |
| 198 | + session.setGlobal("rs", rs); | |
| 199 | + | |
| 200 | + // 载入数据 | |
| 201 | + CalcuParam calcuParam = new CalcuParam( | |
| 202 | + new DateTime(from), new DateTime(to), xlid); | |
| 203 | + session.insert(calcuParam); | |
| 204 | + List<TTInfo> ttInfos = ttInfoService.findAll(); | |
| 205 | + for (TTInfo ttInfo: ttInfos) | |
| 206 | + session.insert(ttInfo); | |
| 207 | + | |
| 208 | + | |
| 209 | + // 执行rule | |
| 210 | + session.fireAllRules(); | |
| 211 | + | |
| 212 | + // 执行完毕销毁,有日志的也要关闭 | |
| 213 | + session.dispose(); | |
| 214 | + | |
| 215 | + | |
| 216 | + return rs; | |
| 217 | + } | |
| 147 | 218 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| ... | ... | @@ -169,8 +169,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 169 | 169 | Map<String, Object> ktrParms = new HashMap<>(); |
| 170 | 170 | File ktrFile = new File(this.getClass().getResource( |
| 171 | 171 | dataToolsProperties.getTtinfodetailMetadatainputktr()).toURI()); |
| 172 | +// File ktrFile2 = new File(this.getClass().getResource( | |
| 173 | +// dataToolsProperties.getTtinfodetailDatainputktr()).toURI()); | |
| 172 | 174 | File ktrFile2 = new File(this.getClass().getResource( |
| 173 | - dataToolsProperties.getTtinfodetailDatainputktr()).toURI()); | |
| 175 | + dataToolsProperties.getTtinfodetailDatainputktr2()).toURI()); | |
| 174 | 176 | |
| 175 | 177 | // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径 |
| 176 | 178 | ktrParms.put("transpath", ktrFile.getAbsolutePath()); | ... | ... |
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
| ... | ... | @@ -52,6 +52,9 @@ public class MyDroolsConfiguration { |
| 52 | 52 | // 3.2、写入drl(写法超多,有点混乱) |
| 53 | 53 | // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入 |
| 54 | 54 | // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的 |
| 55 | + kfs.write("src/main/resources/functions.drl", kieServices.getResources() | |
| 56 | + .newInputStreamResource(this.getClass().getResourceAsStream( | |
| 57 | + "/rules/functions.drl"), "UTF-8")); | |
| 55 | 58 | kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources() |
| 56 | 59 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 57 | 60 | "/rules/HelloWorld.drl"), "UTF-8")); |
| ... | ... | @@ -61,6 +64,9 @@ public class MyDroolsConfiguration { |
| 61 | 64 | kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources() |
| 62 | 65 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 63 | 66 | "/rules/ttinfo.drl"), "UTF-8")); |
| 67 | + kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources() | |
| 68 | + .newInputStreamResource(this.getClass().getResourceAsStream( | |
| 69 | + "/rules/ttinfo2.drl"), "UTF-8")); | |
| 64 | 70 | // TODO:还有其他drl.... |
| 65 | 71 | |
| 66 | 72 | // 4、创建KieBuilder,使用KieFileSystem构建 | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/CalcuParam.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo2; | |
| 2 | + | |
| 3 | +import org.joda.time.DateTime; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 时刻表计算参数。 | |
| 7 | + */ | |
| 8 | +public class CalcuParam { | |
| 9 | + /** 开始计算时间 */ | |
| 10 | + private DateTime fromDate; | |
| 11 | + /** 结束计算时间 */ | |
| 12 | + private DateTime toDate; | |
| 13 | + /** 线路id */ | |
| 14 | + private Integer xlId; | |
| 15 | + | |
| 16 | + public CalcuParam() {} | |
| 17 | + public CalcuParam( | |
| 18 | + DateTime fromDate, | |
| 19 | + DateTime toDate, | |
| 20 | + Integer xlId) { | |
| 21 | + this.fromDate = fromDate; | |
| 22 | + this.toDate = toDate; | |
| 23 | + this.xlId = xlId; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public DateTime getFromDate() { | |
| 27 | + return fromDate; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setFromDate(DateTime fromDate) { | |
| 31 | + this.fromDate = fromDate; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public DateTime getToDate() { | |
| 35 | + return toDate; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public void setToDate(DateTime toDate) { | |
| 39 | + this.toDate = toDate; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public Integer getXlId() { | |
| 43 | + return xlId; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public void setXlId(Integer xlId) { | |
| 47 | + this.xlId = xlId; | |
| 48 | + } | |
| 49 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/ErrorBcCountFunction.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo2; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.TTInfoDetail; | |
| 4 | +import org.kie.api.runtime.rule.AccumulateFunction; | |
| 5 | + | |
| 6 | +import java.io.*; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by xu on 17/2/28. | |
| 10 | + */ | |
| 11 | +public class ErrorBcCountFunction implements AccumulateFunction { | |
| 12 | + @Override | |
| 13 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 14 | + } | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 18 | + } | |
| 19 | + | |
| 20 | + protected static class ErrorCountData implements Externalizable { | |
| 21 | + public long errorcount = 0; | |
| 22 | + public TTInfoDetail ttInfoDetail; | |
| 23 | + | |
| 24 | + public ErrorCountData() { | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 29 | + errorcount = in.readLong(); | |
| 30 | + ttInfoDetail = (TTInfoDetail) in.readObject(); | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 35 | + out.writeLong(errorcount); | |
| 36 | + out.writeObject(ttInfoDetail); | |
| 37 | + } | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public Serializable createContext() { | |
| 42 | + return new ErrorCountData(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void init(Serializable context) throws Exception { | |
| 47 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 48 | + errorCountData.errorcount = 0; | |
| 49 | + } | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public void accumulate(Serializable context, Object value) { | |
| 53 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 54 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | |
| 55 | + | |
| 56 | + if (ttInfoDetail.getTtinfo() == null) { | |
| 57 | + errorCountData.errorcount ++; | |
| 58 | + return; | |
| 59 | + } | |
| 60 | + | |
| 61 | + if ("in".equals(ttInfoDetail.getBcType())) { | |
| 62 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getTcc() == null) { | |
| 63 | + errorCountData.errorcount ++; | |
| 64 | + } | |
| 65 | + } else if ("out".equals(ttInfoDetail.getBcType())) { | |
| 66 | + if (ttInfoDetail.getTcc() == null || ttInfoDetail.getZdz() == null) { | |
| 67 | + errorCountData.errorcount ++; | |
| 68 | + } | |
| 69 | + } else { | |
| 70 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getZdz() == null) { | |
| 71 | + errorCountData.errorcount ++; | |
| 72 | + } | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + @Override | |
| 77 | + public void reverse(Serializable context, Object value) throws Exception { | |
| 78 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 79 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | |
| 80 | + | |
| 81 | + if (ttInfoDetail.getTtinfo() == null) { | |
| 82 | + errorCountData.errorcount --; | |
| 83 | + return; | |
| 84 | + } | |
| 85 | + | |
| 86 | + if ("in".equals(ttInfoDetail.getBcType())) { | |
| 87 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getTcc() == null) { | |
| 88 | + errorCountData.errorcount --; | |
| 89 | + } | |
| 90 | + } else if ("out".equals(ttInfoDetail.getBcType())) { | |
| 91 | + if (ttInfoDetail.getTcc() == null || ttInfoDetail.getZdz() == null) { | |
| 92 | + errorCountData.errorcount --; | |
| 93 | + } | |
| 94 | + } else { | |
| 95 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getZdz() == null) { | |
| 96 | + errorCountData.errorcount --; | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + } | |
| 101 | + | |
| 102 | + @Override | |
| 103 | + public Object getResult(Serializable context) throws Exception { | |
| 104 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 105 | + return errorCountData.errorcount; | |
| 106 | + } | |
| 107 | + | |
| 108 | + @Override | |
| 109 | + public boolean supportsReverse() { | |
| 110 | + return true; | |
| 111 | + } | |
| 112 | + | |
| 113 | + @Override | |
| 114 | + public Class<?> getResultType() { | |
| 115 | + return Number.class; | |
| 116 | + } | |
| 117 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/Result.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo2; | |
| 2 | + | |
| 3 | +import java.util.ArrayList; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 输出结果值。 | |
| 8 | + */ | |
| 9 | +public class Result { | |
| 10 | + private List<StatInfo> infos = new ArrayList<>(); | |
| 11 | + | |
| 12 | + public List<StatInfo> getInfos() { | |
| 13 | + return infos; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setInfos(List<StatInfo> infos) { | |
| 17 | + this.infos = infos; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public static class StatInfo { | |
| 21 | + /** 时刻表id */ | |
| 22 | + private Long ttid; | |
| 23 | + /** 时刻表名字 */ | |
| 24 | + private String ttname; | |
| 25 | + | |
| 26 | + /** 所有班次数 */ | |
| 27 | + private Long allbc; | |
| 28 | + /** 进场班次数 */ | |
| 29 | + private Long inbc; | |
| 30 | + /** 出场班次数 */ | |
| 31 | + private Long outbc; | |
| 32 | + /** 营运班次数 */ | |
| 33 | + private Long yybc; | |
| 34 | + | |
| 35 | + /** 错误班次数 */ | |
| 36 | + private Long errorbc; | |
| 37 | + | |
| 38 | + public Long getTtid() { | |
| 39 | + return ttid; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setTtid(Long ttid) { | |
| 43 | + this.ttid = ttid; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getTtname() { | |
| 47 | + return ttname; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setTtname(String ttname) { | |
| 51 | + this.ttname = ttname; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public Long getAllbc() { | |
| 55 | + return allbc; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setAllbc(Long allbc) { | |
| 59 | + this.allbc = allbc; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public Long getInbc() { | |
| 63 | + return inbc; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setInbc(Long inbc) { | |
| 67 | + this.inbc = inbc; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public Long getOutbc() { | |
| 71 | + return outbc; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setOutbc(Long outbc) { | |
| 75 | + this.outbc = outbc; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public Long getYybc() { | |
| 79 | + return yybc; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setYybc(Long yybc) { | |
| 83 | + this.yybc = yybc; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public Long getErrorbc() { | |
| 87 | + return errorbc; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setErrorbc(Long errorbc) { | |
| 91 | + this.errorbc = errorbc; | |
| 92 | + } | |
| 93 | + } | |
| 94 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/utils/DataToolsProperties.java
| ... | ... | @@ -72,6 +72,9 @@ public class DataToolsProperties { |
| 72 | 72 | /** 时刻表明细信息导入 */ |
| 73 | 73 | @NotNull |
| 74 | 74 | private String ttinfodetailDatainputktr; |
| 75 | + /** 时刻表明细信息导入 */ | |
| 76 | + @NotNull | |
| 77 | + private String ttinfodetailDatainputktr2; | |
| 75 | 78 | /** 排班规则信息导入 */ |
| 76 | 79 | @NotNull |
| 77 | 80 | private String scheduleruleDatainputktr; |
| ... | ... | @@ -320,4 +323,12 @@ public class DataToolsProperties { |
| 320 | 323 | public void setGuideboardsDataoutputktr(String guideboardsDataoutputktr) { |
| 321 | 324 | this.guideboardsDataoutputktr = guideboardsDataoutputktr; |
| 322 | 325 | } |
| 326 | + | |
| 327 | + public String getTtinfodetailDatainputktr2() { | |
| 328 | + return ttinfodetailDatainputktr2; | |
| 329 | + } | |
| 330 | + | |
| 331 | + public void setTtinfodetailDatainputktr2(String ttinfodetailDatainputktr2) { | |
| 332 | + this.ttinfodetailDatainputktr2 = ttinfodetailDatainputktr2; | |
| 333 | + } | |
| 323 | 334 | } | ... | ... |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.websocket.handler; |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.bsth.data.BasicData; |
| 5 | 5 | import com.bsth.data.LineConfigData; |
| 6 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 6 | 7 | import com.bsth.data.gpsdata.arrival.entity.SignalState; |
| 7 | 8 | import com.bsth.entity.directive.D80; |
| 8 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| ... | ... | @@ -170,4 +171,17 @@ public class SendUtils{ |
| 170 | 171 | list.add(sch); |
| 171 | 172 | refreshSch(list); |
| 172 | 173 | } |
| 174 | + | |
| 175 | + public void deviceOffline(GpsEntity gps){ | |
| 176 | + Map<String, Object> map = new HashMap<>(); | |
| 177 | + map.put("fn", "deviceOffline"); | |
| 178 | + map.put("gps", gps);; | |
| 179 | + ObjectMapper mapper = new ObjectMapper(); | |
| 180 | + | |
| 181 | + try { | |
| 182 | + socketHandler.sendMessageToLine(gps.getLineId().toString(), mapper.writeValueAsString(map)); | |
| 183 | + } catch (JsonProcessingException e) { | |
| 184 | + logger.error("", e); | |
| 185 | + } | |
| 186 | + } | |
| 173 | 187 | } | ... | ... |
src/main/resources/application-dev.properties
| ... | ... | @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy |
| 8 | 8 | spring.jpa.database= MYSQL |
| 9 | 9 | spring.jpa.show-sql= false |
| 10 | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://192.168.168.201/:3306/mh_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 11 | +spring.datasource.url= jdbc:mysql://localhost:3306/qp_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 12 | 12 | spring.datasource.username= root |
| 13 | -spring.datasource.password= 123456 | |
| 13 | +spring.datasource.password= root | |
| 14 | 14 | #DATASOURCE |
| 15 | 15 | spring.datasource.max-active=100 |
| 16 | 16 | spring.datasource.max-idle=8 | ... | ... |
src/main/resources/datatools/config-dev.properties
| ... | ... | @@ -30,11 +30,13 @@ datatools.guideboards_datainputktr=/datatools/ktrs/guideboardDataInput.ktr |
| 30 | 30 | # 时刻表基础信息导入 |
| 31 | 31 | datatools.ttinfo_datainputktr=/datatools/ktrs/ttinfoDataInput.ktr |
| 32 | 32 | # 时刻表明细信息导入(元数据) |
| 33 | -datatools.ttinfodetail_metadatainputktr=/datatools/ktrs/ttinfodetailMetaData.ktr | |
| 33 | +datatools.ttinfodetail_metadatainputktr=/datatools/ktrs/ttinfodetailDataInputMetaData.ktr | |
| 34 | 34 | # 时刻表明细编辑用数据 |
| 35 | 35 | datatools.ttinfodetail_foreditktr=/datatools/ktrs/ttinfodetailoutputforedit.ktr |
| 36 | 36 | # 时刻表明细信息导入 |
| 37 | 37 | datatools.ttinfodetail_datainputktr=/datatools/ktrs/ttinfodetailDataInput.ktr |
| 38 | +# 时刻表明细信息导入2 | |
| 39 | +datatools.ttinfodetail_datainputktr2=/datatools/ktrs/ttinfodetailDataInput2.ktr | |
| 38 | 40 | |
| 39 | 41 | # 车辆配置信息导入 |
| 40 | 42 | datatools.carsconfig_datainputktr=/datatools/ktrs/carsConfigDataInput.ktr | ... | ... |
src/main/resources/datatools/config-prod.properties
| ... | ... | @@ -31,11 +31,13 @@ datatools.guideboards_datainputktr=/datatools/ktrs/guideboardDataInput.ktr |
| 31 | 31 | # 时刻表基础信息导入 |
| 32 | 32 | datatools.ttinfo_datainputktr=/datatools/ktrs/ttinfoDataInput.ktr |
| 33 | 33 | # 时刻表明细信息导入(元数据) |
| 34 | -datatools.ttinfodetail_metadatainputktr=/datatools/ktrs/ttinfodetailMetaData.ktr | |
| 34 | +datatools.ttinfodetail_metadatainputktr=/datatools/ktrs/ttinfodetailDataInputMetaData.ktr | |
| 35 | 35 | # 时刻表明细编辑用数据 |
| 36 | 36 | datatools.ttinfodetail_foreditktr=/datatools/ktrs/ttinfodetailoutputforedit.ktr |
| 37 | 37 | # 时刻表明细信息导入 |
| 38 | 38 | datatools.ttinfodetail_datainputktr=/datatools/ktrs/ttinfodetailDataInput.ktr |
| 39 | +# 时刻表明细信息导入2 | |
| 40 | +datatools.ttinfodetail_datainputktr2=/datatools/ktrs/ttinfodetailDataInput2.ktr | |
| 39 | 41 | |
| 40 | 42 | # 车辆配置信息导入 |
| 41 | 43 | datatools.carsconfig_datainputktr=/datatools/ktrs/carsConfigDataInput.ktr | ... | ... |