Commit af4c8c907718e1843dcc00d8d23a3365bd829d65
1 parent
40d6caca
帮周勤提交一下代码
Showing
3 changed files
with
151 additions
and
70 deletions
src/main/java/com/bsth/data/BasicData.java
| 1 | package com.bsth.data; | 1 | package com.bsth.data; |
| 2 | 2 | ||
| 3 | -import java.util.ArrayList; | ||
| 4 | -import java.util.HashMap; | ||
| 5 | -import java.util.Iterator; | ||
| 6 | -import java.util.List; | ||
| 7 | -import java.util.Map; | ||
| 8 | -import java.util.concurrent.TimeUnit; | ||
| 9 | - | 3 | +import com.bsth.Application; |
| 4 | +import com.bsth.entity.*; | ||
| 5 | +import com.bsth.entity.schedule.CarConfigInfo; | ||
| 6 | +import com.bsth.repository.*; | ||
| 7 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | ||
| 8 | +import com.google.common.collect.BiMap; | ||
| 9 | +import com.google.common.collect.HashBiMap; | ||
| 10 | import org.apache.commons.lang3.StringUtils; | 10 | import org.apache.commons.lang3.StringUtils; |
| 11 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 12 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| @@ -14,24 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -14,24 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | import org.springframework.boot.CommandLineRunner; | 14 | import org.springframework.boot.CommandLineRunner; |
| 15 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 16 | 16 | ||
| 17 | -import com.bsth.Application; | ||
| 18 | -import com.bsth.entity.CarPark; | ||
| 19 | -import com.bsth.entity.Cars; | ||
| 20 | -import com.bsth.entity.Line; | ||
| 21 | -import com.bsth.entity.Personnel; | ||
| 22 | -import com.bsth.entity.Station; | ||
| 23 | -import com.bsth.entity.StationRoute; | ||
| 24 | -import com.bsth.entity.schedule.CarConfigInfo; | ||
| 25 | -import com.bsth.repository.CarParkRepository; | ||
| 26 | -import com.bsth.repository.CarsRepository; | ||
| 27 | -import com.bsth.repository.LineRepository; | ||
| 28 | -import com.bsth.repository.PersonnelRepository; | ||
| 29 | -import com.bsth.repository.StationRepository; | ||
| 30 | -import com.bsth.repository.StationRouteRepository; | ||
| 31 | -import com.bsth.repository.schedule.CarConfigInfoRepository; | ||
| 32 | -import com.google.common.collect.BiMap; | ||
| 33 | -import com.google.common.collect.HashBiMap; | ||
| 34 | -import com.google.common.collect.TreeMultimap; | 17 | +import java.util.*; |
| 18 | +import java.util.concurrent.TimeUnit; | ||
| 35 | 19 | ||
| 36 | /** | 20 | /** |
| 37 | * @author PanZhao | 21 | * @author PanZhao |
| @@ -85,6 +69,9 @@ public class BasicData implements CommandLineRunner { | @@ -85,6 +69,9 @@ public class BasicData implements CommandLineRunner { | ||
| 85 | //全量员工 工号和姓名对照 | 69 | //全量员工 工号和姓名对照 |
| 86 | public static Map<String, String> allPerson; | 70 | public static Map<String, String> allPerson; |
| 87 | 71 | ||
| 72 | + //站点名和运管处编号 对照 | ||
| 73 | + public static Map<String, Map<String, Map>> stationName2YgcNumber; | ||
| 74 | + | ||
| 88 | 75 | ||
| 89 | static Logger logger = LoggerFactory.getLogger(BasicData.class); | 76 | static Logger logger = LoggerFactory.getLogger(BasicData.class); |
| 90 | 77 | ||
| @@ -245,7 +232,14 @@ public class BasicData implements CommandLineRunner { | @@ -245,7 +232,14 @@ public class BasicData implements CommandLineRunner { | ||
| 245 | * @Title: loadLineInfo | 232 | * @Title: loadLineInfo |
| 246 | * @Description: TODO(加载线路相关信息) | 233 | * @Description: TODO(加载线路相关信息) |
| 247 | */ | 234 | */ |
| 248 | - public void loadLineInfo() { | 235 | + public void loadLineInfo(){ |
| 236 | + List<StationRoute> stationsList = null;// 站点路由集 | ||
| 237 | + StationRoute stationRoute = null; | ||
| 238 | + int size = 0; | ||
| 239 | + Map<String, Integer> station2Number ; | ||
| 240 | + Map<String, Map> dirs2Statioin ; | ||
| 241 | + int[] dirs = {0,1};// 运行方向 上下行 | ||
| 242 | + int num = 1; | ||
| 249 | Iterator<Line> iterator = lineRepository.findAll().iterator(); | 243 | Iterator<Line> iterator = lineRepository.findAll().iterator(); |
| 250 | 244 | ||
| 251 | Line line; | 245 | Line line; |
| @@ -253,19 +247,46 @@ public class BasicData implements CommandLineRunner { | @@ -253,19 +247,46 @@ public class BasicData implements CommandLineRunner { | ||
| 253 | Map<String, String> code2name = new HashMap<>(); | 247 | Map<String, String> code2name = new HashMap<>(); |
| 254 | Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); | 248 | Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); |
| 255 | Map<String, String> code2SHcode = new HashMap<String, String>(); | 249 | Map<String, String> code2SHcode = new HashMap<String, String>(); |
| 250 | + Map<String, Map<String, Map>> tempStationName2YgcNumber = new HashMap<String, Map<String, Map>>(); | ||
| 256 | 251 | ||
| 257 | - while (iterator.hasNext()) { | 252 | + while(iterator.hasNext()){ |
| 258 | line = iterator.next(); | 253 | line = iterator.next(); |
| 259 | biMap.put(line.getId(), line.getLineCode()); | 254 | biMap.put(line.getId(), line.getLineCode()); |
| 260 | code2name.put(line.getLineCode(), line.getName()); | 255 | code2name.put(line.getLineCode(), line.getName()); |
| 261 | - id2SHcode.put(line.getId(), line.getShanghaiLinecode()); | 256 | + id2SHcode.put(line.getId(),line.getShanghaiLinecode()); |
| 262 | code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); | 257 | code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); |
| 258 | + | ||
| 259 | + /** | ||
| 260 | + * 加载运管处的站点及序号 | ||
| 261 | + * 上行从1开始,下行顺序续编 | ||
| 262 | + | ||
| 263 | + num = 1; | ||
| 264 | + dirs2Statioin = new HashMap<String, Map>(); | ||
| 265 | + for (int i = 0; i < dirs.length; i++) { | ||
| 266 | + // 分别取得上下行的站点 | ||
| 267 | + stationsList = stationRouteRepository.findByLine(line.getLineCode(), dirs[i]); | ||
| 268 | + size = stationsList == null ? 0 :stationsList.size(); | ||
| 269 | + if(size > 0 ){ | ||
| 270 | + station2Number = new HashMap<String, Integer>(); | ||
| 271 | + for (int j = 0; j < size; j++) { | ||
| 272 | + stationRoute = stationsList.get(j); | ||
| 273 | + // map保存为(站点名称 -->序号) | ||
| 274 | + station2Number.put(stationRoute.getStationName(), num++); | ||
| 275 | + } | ||
| 276 | + // 保存两个数据,(0 --> station2Number)(1 --> station2Number) 0上行 1 下行 | ||
| 277 | + dirs2Statioin.put(dirs[i]+"", station2Number); | ||
| 278 | + } | ||
| 279 | + } | ||
| 280 | + // 保存(站点编码 --> dirs2Statioin) | ||
| 281 | + tempStationName2YgcNumber.put(line.getLineCode(), dirs2Statioin); | ||
| 282 | + */ | ||
| 263 | } | 283 | } |
| 264 | 284 | ||
| 265 | lineId2CodeMap = biMap; | 285 | lineId2CodeMap = biMap; |
| 266 | lineCode2NameMap = code2name; | 286 | lineCode2NameMap = code2name; |
| 267 | lineId2ShangHaiCodeMap = id2SHcode; | 287 | lineId2ShangHaiCodeMap = id2SHcode; |
| 268 | lineCode2ShangHaiCodeMap = code2SHcode; | 288 | lineCode2ShangHaiCodeMap = code2SHcode; |
| 289 | + stationName2YgcNumber = tempStationName2YgcNumber; | ||
| 269 | } | 290 | } |
| 270 | 291 | ||
| 271 | /** | 292 | /** |
src/main/java/com/bsth/service/TrafficManageService.java
| 1 | package com.bsth.service; | 1 | package com.bsth.service; |
| 2 | 2 | ||
| 3 | -import com.bsth.entity.Line; | ||
| 4 | - | ||
| 5 | /** | 3 | /** |
| 6 | - * | 4 | + * |
| 7 | * @Interface: LineService(线路service业务层实现接口) | 5 | * @Interface: LineService(线路service业务层实现接口) |
| 8 | - * | 6 | + * |
| 9 | * @extends : BaseService | 7 | * @extends : BaseService |
| 10 | - * | 8 | + * |
| 11 | * @Description: TODO(线路service业务层实现接口) | 9 | * @Description: TODO(线路service业务层实现接口) |
| 12 | - * | 10 | + * |
| 13 | * @Author bsth@lq | 11 | * @Author bsth@lq |
| 14 | - * | 12 | + * |
| 15 | * @Date 2016年4月28日 上午9:21:17 | 13 | * @Date 2016年4月28日 上午9:21:17 |
| 16 | * | 14 | * |
| 17 | * @Version 公交调度系统BS版 0.1 | 15 | * @Version 公交调度系统BS版 0.1 |
| 18 | - * | 16 | + * |
| 19 | */ | 17 | */ |
| 20 | public interface TrafficManageService { | 18 | public interface TrafficManageService { |
| 21 | - | 19 | + |
| 22 | /** | 20 | /** |
| 23 | * 上传线路信息 | 21 | * 上传线路信息 |
| 24 | - * | 22 | + * |
| 25 | * @return 调用接口返回信息 | 23 | * @return 调用接口返回信息 |
| 26 | */ | 24 | */ |
| 27 | String setXL(); | 25 | String setXL(); |
| 28 | - | 26 | + |
| 29 | /** | 27 | /** |
| 30 | * 上传车辆信息 | 28 | * 上传车辆信息 |
| 31 | - * | 29 | + * |
| 32 | * @return 调用接口返回信息 | 30 | * @return 调用接口返回信息 |
| 33 | */ | 31 | */ |
| 34 | String setCL(); | 32 | String setCL(); |
| 35 | - | 33 | + |
| 36 | /** | 34 | /** |
| 37 | * 上传司机信息 | 35 | * 上传司机信息 |
| 38 | * @return 调用接口返回信息 | 36 | * @return 调用接口返回信息 |
| 39 | */ | 37 | */ |
| 40 | String setSJ(); | 38 | String setSJ(); |
| 41 | - | 39 | + |
| 42 | /** | 40 | /** |
| 43 | * 上传超速数据 | 41 | * 上传超速数据 |
| 44 | - * | 42 | + * |
| 45 | * @return 调用接口返回信息 | 43 | * @return 调用接口返回信息 |
| 46 | */ | 44 | */ |
| 47 | String setCS(); | 45 | String setCS(); |
| 48 | - | 46 | + |
| 49 | /** | 47 | /** |
| 50 | * 上传线路班次时刻表数据 | 48 | * 上传线路班次时刻表数据 |
| 51 | - * | 49 | + * |
| 52 | * @return 调用接口返回信息 | 50 | * @return 调用接口返回信息 |
| 53 | */ | 51 | */ |
| 54 | String setSKB(String ids); | 52 | String setSKB(String ids); |
| 55 | - | 53 | + |
| 56 | /** | 54 | /** |
| 57 | * 线路人员车辆配置信息 | 55 | * 线路人员车辆配置信息 |
| 58 | * @return 调用接口返回信息 | 56 | * @return 调用接口返回信息 |
| 59 | */ | 57 | */ |
| 60 | String setXLPC(); | 58 | String setXLPC(); |
| 61 | - | 59 | + |
| 62 | /** | 60 | /** |
| 63 | * 线路计划班次表 | 61 | * 线路计划班次表 |
| 64 | * @return 调用接口返回信息 | 62 | * @return 调用接口返回信息 |
| 65 | */ | 63 | */ |
| 66 | String setJHBC(); | 64 | String setJHBC(); |
| 67 | - | 65 | + |
| 68 | String setLD(); | 66 | String setLD(); |
| 69 | - | 67 | + |
| 70 | String setLCYH(); | 68 | String setLCYH(); |
| 71 | - | ||
| 72 | - String setDDRB(); | 69 | + |
| 70 | + String setDDRB(); | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 下载全量的公交基础数据 | ||
| 74 | + * @return | ||
| 75 | + */ | ||
| 76 | + String getDownLoadAllDataFile(); | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 下载增量的公交基础数据 | ||
| 80 | + * @return | ||
| 81 | + */ | ||
| 82 | + String getDownLoadIncreaseDataFile(); | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 指定线路查询方式公交基础数据下载 | ||
| 86 | + * @return | ||
| 87 | + */ | ||
| 88 | + String getDownLoadWarrantsBusLineStation(); | ||
| 73 | } | 89 | } |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| @@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory; | @@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory; | ||
| 22 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | import org.springframework.data.domain.Sort; | 23 | import org.springframework.data.domain.Sort; |
| 24 | import org.springframework.data.domain.Sort.Direction; | 24 | import org.springframework.data.domain.Sort.Direction; |
| 25 | +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; | ||
| 25 | import org.springframework.stereotype.Service; | 26 | import org.springframework.stereotype.Service; |
| 26 | 27 | ||
| 27 | import com.bsth.data.BasicData; | 28 | import com.bsth.data.BasicData; |
| @@ -119,6 +120,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -119,6 +120,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 119 | @Autowired | 120 | @Autowired |
| 120 | private ScheduleRealInfoRepository scheduleRealInfoRepository; | 121 | private ScheduleRealInfoRepository scheduleRealInfoRepository; |
| 121 | 122 | ||
| 123 | + @Autowired | ||
| 124 | + NamedParameterJdbcTemplate jdbcTemplate; | ||
| 125 | + | ||
| 126 | + | ||
| 122 | // 运管处接口 | 127 | // 运管处接口 |
| 123 | private InternalPortType portType = new Internal().getInternalHttpSoap11Endpoint(); | 128 | private InternalPortType portType = new Internal().getInternalHttpSoap11Endpoint(); |
| 124 | private WebServiceSoap ssop ; | 129 | private WebServiceSoap ssop ; |
| @@ -163,9 +168,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -163,9 +168,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 163 | sBuffer.append("<XLs>"); | 168 | sBuffer.append("<XLs>"); |
| 164 | while(lineIterator.hasNext()){ | 169 | while(lineIterator.hasNext()){ |
| 165 | line = lineIterator.next(); | 170 | line = lineIterator.next(); |
| 166 | - if(line.getLinePlayType() == null){ | ||
| 167 | - continue; | ||
| 168 | - } | ||
| 169 | if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){ | 171 | if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){ |
| 170 | continue; | 172 | continue; |
| 171 | } | 173 | } |
| @@ -189,7 +191,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -189,7 +191,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 189 | sBuffer.append("<QZLC>").append(upMileage).append("</QZLC>"); | 191 | sBuffer.append("<QZLC>").append(upMileage).append("</QZLC>"); |
| 190 | sBuffer.append("<ZQLC>").append(downMileage).append("</ZQLC>"); | 192 | sBuffer.append("<ZQLC>").append(downMileage).append("</ZQLC>"); |
| 191 | } | 193 | } |
| 192 | - sBuffer.append("<XLGH>").append(line.getLinePlayType()).append("</XLGH>"); | 194 | + sBuffer.append("<XLGH>").append(line.getLinePlayType() == null ?"0":line.getLinePlayType()) |
| 195 | + .append("</XLGH>"); | ||
| 193 | // 循环添加站点信息 | 196 | // 循环添加站点信息 |
| 194 | sBuffer.append("<StationList>"); | 197 | sBuffer.append("<StationList>"); |
| 195 | // 先查上行 | 198 | // 先查上行 |
| @@ -334,21 +337,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -334,21 +337,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 334 | 337 | ||
| 335 | int seqNumber = 0; | 338 | int seqNumber = 0; |
| 336 | for(ScheduleRealInfo scheduleRealInfo:list){ | 339 | for(ScheduleRealInfo scheduleRealInfo:list){ |
| 337 | - if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getLpName().equals(scheduleRealInfo.getLpName()) | 340 | + if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getLpName() |
| 341 | + .equals(scheduleRealInfo.getLpName()) | ||
| 338 | && schRealInfo.getClZbh().equals(scheduleRealInfo.getClZbh())){ | 342 | && schRealInfo.getClZbh().equals(scheduleRealInfo.getClZbh())){ |
| 343 | + if(scheduleRealInfo.getFcsjActual() == null ||scheduleRealInfo.getBcType().equals("in") | ||
| 344 | + || scheduleRealInfo.getBcType().equals("out")){ | ||
| 345 | + continue; | ||
| 346 | + } | ||
| 339 | scheduleRealInfo.getQdzCode(); | 347 | scheduleRealInfo.getQdzCode(); |
| 340 | sf.append("<LD>"); | 348 | sf.append("<LD>"); |
| 341 | sf.append("<SJGH>"+scheduleRealInfo.getjGh()+"</SJGH>"); | 349 | sf.append("<SJGH>"+scheduleRealInfo.getjGh()+"</SJGH>"); |
| 342 | sf.append("<SXX>"+scheduleRealInfo.getXlDir()+"</SXX>"); | 350 | sf.append("<SXX>"+scheduleRealInfo.getXlDir()+"</SXX>"); |
| 343 | sf.append("<FCZDMC>"+scheduleRealInfo.getQdzName()+"</FCZDMC>"); | 351 | sf.append("<FCZDMC>"+scheduleRealInfo.getQdzName()+"</FCZDMC>"); |
| 344 | - sf.append("<FCZDXH>" + ++seqNumber + "</FCZDXH>"); | 352 | + sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 353 | + scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getQdzName()) + "</FCZDXH>"); | ||
| 345 | sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>"); | 354 | sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>"); |
| 346 | sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>"); | 355 | sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>"); |
| 347 | sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>"); | 356 | sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>"); |
| 348 | sf.append("<SJFCSJ>"+scheduleRealInfo.getFcsjActual()+"</SJFCSJ>"); | 357 | sf.append("<SJFCSJ>"+scheduleRealInfo.getFcsjActual()+"</SJFCSJ>"); |
| 349 | sf.append("<FCZDLX>"+""+"</FCZDLX>"); | 358 | sf.append("<FCZDLX>"+""+"</FCZDLX>"); |
| 350 | sf.append("<DDZDMC>"+scheduleRealInfo.getZdzName()+"</DDZDMC>"); | 359 | sf.append("<DDZDMC>"+scheduleRealInfo.getZdzName()+"</DDZDMC>"); |
| 351 | - sf.append("<DDZDXH>"+ seqNumber +"</DDZDXH>"); | 360 | + sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 361 | + scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getZdzName()) +"</DDZDXH>"); | ||
| 352 | sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>"); | 362 | sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>"); |
| 353 | sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>"); | 363 | sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>"); |
| 354 | sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>"); | 364 | sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>"); |
| @@ -404,7 +414,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -404,7 +414,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 404 | sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.getXlBm())+"</XLBM>"); | 414 | sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.getXlBm())+"</XLBM>"); |
| 405 | sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); | 415 | sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); |
| 406 | for(ScheduleRealInfo scheduleRealInfo:list){ | 416 | for(ScheduleRealInfo scheduleRealInfo:list){ |
| 407 | - if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getClZbh().equals(scheduleRealInfo.getClZbh())){ | 417 | + if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getClZbh() |
| 418 | + .equals(scheduleRealInfo.getClZbh())){ | ||
| 408 | Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | 419 | Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); |
| 409 | //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班 | 420 | //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班 |
| 410 | if(childTaskPlans.isEmpty()){ | 421 | if(childTaskPlans.isEmpty()){ |
| @@ -412,7 +423,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -412,7 +423,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 412 | totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | 423 | totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); |
| 413 | if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | 424 | if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") |
| 414 | || scheduleRealInfo.getBcType().equals("venting")){ | 425 | || scheduleRealInfo.getBcType().equals("venting")){ |
| 415 | - emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();; | 426 | + emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); |
| 416 | } | 427 | } |
| 417 | } | 428 | } |
| 418 | }else{ | 429 | }else{ |
| @@ -588,14 +599,19 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -588,14 +599,19 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 588 | if(xlbm.equals(schedulePlanInfo.getXlBm()) | 599 | if(xlbm.equals(schedulePlanInfo.getXlBm()) |
| 589 | && zbh.equals(schedulePlanInfo.getClZbh()) | 600 | && zbh.equals(schedulePlanInfo.getClZbh()) |
| 590 | && lp == schedulePlanInfo.getLp()){ | 601 | && lp == schedulePlanInfo.getLp()){ |
| 602 | + if(schedulePlanInfo.getBcType().equals("in") || schedulePlanInfo.getBcType().equals("out")){ | ||
| 603 | + continue; | ||
| 604 | + } | ||
| 591 | sBuffer.append("<BC>"); | 605 | sBuffer.append("<BC>"); |
| 592 | sBuffer.append("<SJGH>").append(schedulePlanInfo.getjGh()).append("</SJGH>"); | 606 | sBuffer.append("<SJGH>").append(schedulePlanInfo.getjGh()).append("</SJGH>"); |
| 593 | sBuffer.append("<SXX>").append(schedulePlanInfo.getXlDir()).append("</SXX>"); | 607 | sBuffer.append("<SXX>").append(schedulePlanInfo.getXlDir()).append("</SXX>"); |
| 594 | sBuffer.append("<FCZDMC>").append(schedulePlanInfo.getQdzName()).append("</FCZDMC>"); | 608 | sBuffer.append("<FCZDMC>").append(schedulePlanInfo.getQdzName()).append("</FCZDMC>"); |
| 595 | - sBuffer.append("<ZDXH>").append(++startSerialNum).append("</ZDXH>"); | 609 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 610 | + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzName())).append("</ZDXH>"); | ||
| 596 | sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); | 611 | sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); |
| 597 | sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); | 612 | sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); |
| 598 | - sBuffer.append("<ZDXH>").append(++endSerialNum).append("</ZDXH>"); | 613 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 614 | + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzName())).append("</ZDXH>"); | ||
| 599 | sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) | 615 | sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) |
| 600 | .append("</JHDDSJ>"); | 616 | .append("</JHDDSJ>"); |
| 601 | sBuffer.append("</BC>"); | 617 | sBuffer.append("</BC>"); |
| @@ -643,6 +659,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -643,6 +659,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 643 | Iterator<TTInfoDetail> ttInfoDetailIterator; | 659 | Iterator<TTInfoDetail> ttInfoDetailIterator; |
| 644 | HashMap<String,Object> param = new HashMap<String, Object>(); | 660 | HashMap<String,Object> param = new HashMap<String, Object>(); |
| 645 | String ttinfoJhlc = null;//计划总里程 | 661 | String ttinfoJhlc = null;//计划总里程 |
| 662 | + String lineCode ; | ||
| 646 | sBuffer.append("<SKBs>"); | 663 | sBuffer.append("<SKBs>"); |
| 647 | for (int i = 0; i < idArray.length; i++) { | 664 | for (int i = 0; i < idArray.length; i++) { |
| 648 | ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i])); | 665 | ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i])); |
| @@ -652,7 +669,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -652,7 +669,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 652 | ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param), | 669 | ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param), |
| 653 | new Sort(Direction.ASC, "xlDir")).iterator(); | 670 | new Sort(Direction.ASC, "xlDir")).iterator(); |
| 654 | sBuffer.append("<SKB>"); | 671 | sBuffer.append("<SKB>"); |
| 655 | - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl())).append("</XLBM>"); | 672 | + sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId())) |
| 673 | + .append("</XLBM>"); | ||
| 656 | ttinfoJhlc = new String(); | 674 | ttinfoJhlc = new String(); |
| 657 | sBuffer.append("<JHZLC>").append(ttinfoJhlc).append("</JHZLC>"); | 675 | sBuffer.append("<JHZLC>").append(ttinfoJhlc).append("</JHZLC>"); |
| 658 | sBuffer.append("<JHYYLC>").append(ttinfoJhlc).append("</JHYYLC>"); | 676 | sBuffer.append("<JHYYLC>").append(ttinfoJhlc).append("</JHYYLC>"); |
| @@ -662,23 +680,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -662,23 +680,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 662 | sBuffer.append("<TBYY>").append("").append("</TBYY>"); | 680 | sBuffer.append("<TBYY>").append("").append("</TBYY>"); |
| 663 | sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | 681 | sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); |
| 664 | int num = 1; | 682 | int num = 1; |
| 683 | + // 加上<BCList> | ||
| 684 | + if(ttInfoDetailIterator.hasNext()){ | ||
| 685 | + sBuffer.append("<BCList>"); | ||
| 686 | + } | ||
| 665 | while (ttInfoDetailIterator.hasNext()) { | 687 | while (ttInfoDetailIterator.hasNext()) { |
| 666 | ttInfoDetail = ttInfoDetailIterator.next(); | 688 | ttInfoDetail = ttInfoDetailIterator.next(); |
| 689 | + if(ttInfoDetail.getBcType().equals("in") || ttInfoDetail.getBcType().equals("out")){ | ||
| 690 | + continue; | ||
| 691 | + } | ||
| 667 | ttinfoJhlc = ttInfoDetail.getJhlc()+"";// 设置计划总里程 | 692 | ttinfoJhlc = ttInfoDetail.getJhlc()+"";// 设置计划总里程 |
| 668 | - sBuffer.append("<BCList>"); | 693 | + lineCode = ttInfoDetail.getXl().getLineCode(); |
| 669 | sBuffer.append("<BC>"); | 694 | sBuffer.append("<BC>"); |
| 670 | sBuffer.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); | 695 | sBuffer.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); |
| 671 | sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>"); | 696 | sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>"); |
| 672 | - sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz()).append("</FCZDMC>"); | ||
| 673 | - sBuffer.append("<ZDXH>").append(num).append("</ZDXH>"); | 697 | + sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz().getStationName()).append("</FCZDMC>"); |
| 698 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( | ||
| 699 | + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getQdz().getStationName())).append("</ZDXH>"); | ||
| 674 | sBuffer.append("<JHFCSJ>").append(ttInfoDetail.getFcsj()).append("</JHFCSJ>"); | 700 | sBuffer.append("<JHFCSJ>").append(ttInfoDetail.getFcsj()).append("</JHFCSJ>"); |
| 675 | - sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz()).append("</DDZDMC>"); | ||
| 676 | - sBuffer.append("<ZDXH>").append(num).append("</ZDXH>"); | 701 | + sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz().getStationName()).append("</DDZDMC>"); |
| 702 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( | ||
| 703 | + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getZdz().getStationName())).append("</ZDXH>"); | ||
| 677 | sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); | 704 | sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); |
| 678 | sBuffer.append("</BC>"); | 705 | sBuffer.append("</BC>"); |
| 679 | - sBuffer.append("</BCList>"); | 706 | + |
| 680 | num++; | 707 | num++; |
| 681 | } | 708 | } |
| 709 | + if(sBuffer.indexOf("<BCList>") != -1){ | ||
| 710 | + sBuffer.append("</BCList>"); | ||
| 711 | + } | ||
| 682 | sBuffer.append("</SKB>"); | 712 | sBuffer.append("</SKB>"); |
| 683 | } | 713 | } |
| 684 | sBuffer.append("</SKBs>"); | 714 | sBuffer.append("</SKBs>"); |
| @@ -1008,7 +1038,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1008,7 +1038,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1008 | zdlx = "2"; | 1038 | zdlx = "2"; |
| 1009 | } | 1039 | } |
| 1010 | sBuffer.append("<Station>"); | 1040 | sBuffer.append("<Station>"); |
| 1011 | - sBuffer.append("<ZDXH>").append(startId).append("</ZDXH>"); | 1041 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationName())).append("</ZDXH>"); |
| 1012 | sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>"); | 1042 | sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>"); |
| 1013 | sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>"); | 1043 | sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>"); |
| 1014 | sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>"); | 1044 | sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>"); |
| @@ -1023,4 +1053,18 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1023,4 +1053,18 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1023 | return startId; | 1053 | return startId; |
| 1024 | } | 1054 | } |
| 1025 | 1055 | ||
| 1056 | + /** | ||
| 1057 | + * | ||
| 1058 | + * @param lineCode 线路编码 | ||
| 1059 | + * @param direction 线路方向 | ||
| 1060 | + * @param stationName 让点名称 | ||
| 1061 | + * @return 运管处站点序号 | ||
| 1062 | + */ | ||
| 1063 | + private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(String lineCode,String direction,String stationName){ | ||
| 1064 | + Integer number = 0; | ||
| 1065 | + Map<String, Map> dirs2Statioin = BasicData.stationName2YgcNumber.get(lineCode); | ||
| 1066 | + Map<String, Integer> station2Number = dirs2Statioin.get(direction); | ||
| 1067 | + number = station2Number.get(stationName); | ||
| 1068 | + return number; | ||
| 1069 | + } | ||
| 1026 | } | 1070 | } |