Commit 494e12ff3934343542d58f0024139434fadf33de
Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing
3 changed files
with
103 additions
and
56 deletions
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -289,7 +289,7 @@ public class BasicData implements CommandLineRunner { |
| 289 | 289 | num = 1; |
| 290 | 290 | lineCode = tempArray[0]+""; |
| 291 | 291 | } |
| 292 | - key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2]; | |
| 292 | + key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[3]; | |
| 293 | 293 | tempStationName2YgcNumber.put(key,num++); |
| 294 | 294 | } |
| 295 | 295 | } | ... | ... |
src/main/java/com/bsth/repository/StationRouteRepository.java
| ... | ... | @@ -3,7 +3,6 @@ package com.bsth.repository; |
| 3 | 3 | import java.util.List; |
| 4 | 4 | import java.util.Map; |
| 5 | 5 | |
| 6 | -import com.bsth.entity.schedule.CarConfigInfo; | |
| 7 | 6 | import org.springframework.data.domain.Page; |
| 8 | 7 | import org.springframework.data.domain.Pageable; |
| 9 | 8 | import org.springframework.data.domain.Sort; |
| ... | ... | @@ -15,7 +14,6 @@ import org.springframework.stereotype.Repository; |
| 15 | 14 | import org.springframework.transaction.annotation.Transactional; |
| 16 | 15 | |
| 17 | 16 | import com.bsth.entity.Line; |
| 18 | -import com.bsth.entity.LineInformation; | |
| 19 | 17 | import com.bsth.entity.StationRoute; |
| 20 | 18 | |
| 21 | 19 | /** |
| ... | ... | @@ -262,7 +260,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int |
| 262 | 260 | List<StationRoute> findByLineCode(String lineCode); |
| 263 | 261 | |
| 264 | 262 | @Query("SELECT " + |
| 265 | - "lineCode,directions,stationName,stationRouteCode " + | |
| 263 | + "lineCode,directions,stationName,stationCode " + | |
| 266 | 264 | "FROM " + |
| 267 | 265 | "StationRoute s " + |
| 268 | 266 | "WHERE " + | ... | ... |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -140,51 +140,45 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 140 | 140 | try { |
| 141 | 141 | Iterator<Line> lineIterator = lineRepository.findAll().iterator(); |
| 142 | 142 | Line line = null; |
| 143 | - List<StationRoute> stationsList = null;// 站点路由集 | |
| 143 | + List<StationRoute> upStationsList = null;// 上行站点路由集 | |
| 144 | + List<StationRoute> downStationsList = null;// 下行站点路由集 | |
| 144 | 145 | List<LineInformation> lineInformationsList = null; |
| 145 | 146 | LineInformation lineInformation = null; |
| 146 | - sBuffer.append("<XLs>"); | |
| 147 | + sBuffer.append("<Data>"); | |
| 148 | + sBuffer.append("<RequestOrg>上海巴士拓华科技发展有限公司</RequestOrg>"); | |
| 149 | + sBuffer.append("<DataList>"); | |
| 147 | 150 | while(lineIterator.hasNext()){ |
| 148 | 151 | line = lineIterator.next(); |
| 152 | + if(!line.getName().equals("浦江4路")){ | |
| 153 | + continue; | |
| 154 | + } | |
| 149 | 155 | if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null |
| 150 | 156 | || line.getInUse() == 0){ |
| 151 | 157 | continue; |
| 152 | 158 | } |
| 153 | - sBuffer.append("<XL>"); | |
| 154 | - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>"); | |
| 155 | - sBuffer.append("<XLMC>").append(line.getName()).append("</XLMC>"); | |
| 156 | - sBuffer.append("<QDZ>").append(line.getStartStationName()).append("</QDZ>"); | |
| 157 | - sBuffer.append("<ZDZ>").append(line.getEndStationName()).append("</ZDZ>"); | |
| 158 | - // 线路标准信息实体 | |
| 159 | - lineInformationsList = lineInformationRepository.findByLine(line); | |
| 160 | - int size = lineInformationsList.size(); | |
| 161 | - if(lineInformationsList != null && size > 0){ | |
| 162 | - double upMileage = 0.0; // 上行里程 | |
| 163 | - double downMileage = 0.0; // 下行里程 | |
| 164 | - // 如果线路标准有多个,累加上行里程和下行里程 | |
| 165 | - for (int i = 0; i < size; i++) { | |
| 166 | - lineInformation = lineInformationsList.get(i); | |
| 167 | - upMileage +=lineInformation.getUpMileage(); | |
| 168 | - downMileage +=lineInformation.getDownMileage(); | |
| 169 | - } | |
| 170 | - sBuffer.append("<QZLC>").append(upMileage).append("</QZLC>"); | |
| 171 | - sBuffer.append("<ZQLC>").append(downMileage).append("</ZQLC>"); | |
| 172 | - } | |
| 173 | - sBuffer.append("<XLGH>").append(line.getLinePlayType() == null ?"0":line.getLinePlayType()) | |
| 174 | - .append("</XLGH>"); | |
| 159 | + sBuffer.append("<LINE_ID>").append(line.getId()).append("</LINE_ID>"); | |
| 160 | + sBuffer.append("<LINE_CODE>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</LINE_CODE>"); | |
| 161 | + sBuffer.append("<LINE_NAME>").append(line.getName()).append("</LINE_NAME>"); | |
| 175 | 162 | // 循环添加站点信息 |
| 176 | - sBuffer.append("<StationList>"); | |
| 163 | + sBuffer.append("<LineStationList>"); | |
| 177 | 164 | // 先查上行 |
| 178 | - stationsList = stationRouteRepository.findByLine(line.getLineCode(), 0); | |
| 165 | + upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0); | |
| 179 | 166 | int startId = 1; |
| 180 | - startId = packagStationXml(stationsList, sBuffer, startId); | |
| 167 | + startId = packagStationXml(upStationsList, sBuffer, startId); | |
| 181 | 168 | // 再查下行 |
| 182 | - stationsList = stationRouteRepository.findByLine(line.getLineCode(), 1); | |
| 183 | - packagStationXml(stationsList, sBuffer, startId); | |
| 184 | - sBuffer.append("</StationList>"); | |
| 185 | - sBuffer.append("</XL>"); | |
| 169 | + downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1); | |
| 170 | + packagStationXml(downStationsList, sBuffer, startId); | |
| 171 | + sBuffer.append("</LineStationList>"); | |
| 172 | + | |
| 173 | + // 循环添加站点点位信息 | |
| 174 | + sBuffer.append("<LinePointList>"); | |
| 175 | + startId = 1; | |
| 176 | + startId = packagStationPointXml(upStationsList, sBuffer, startId); | |
| 177 | + packagStationPointXml(downStationsList, sBuffer, startId); | |
| 178 | + sBuffer.append("</LinePointList>"); | |
| 186 | 179 | } |
| 187 | - sBuffer.append("</XLs>"); | |
| 180 | + sBuffer.append("</DataList>"); | |
| 181 | + sBuffer.append("</Data>"); | |
| 188 | 182 | System.out.println(sBuffer.toString()); |
| 189 | 183 | if(sBuffer.indexOf("<XL>") != -1){ |
| 190 | 184 | portType = new Internal().getInternalHttpSoap11Endpoint(); |
| ... | ... | @@ -329,7 +323,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 329 | 323 | sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); |
| 330 | 324 | sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>"); |
| 331 | 325 | sf.append("<LDList>"); |
| 332 | - | |
| 333 | 326 | for(ScheduleRealInfo scheduleRealInfo:list){ |
| 334 | 327 | if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"") |
| 335 | 328 | .equals(scheduleRealInfo.getLpName()) |
| ... | ... | @@ -355,7 +348,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 355 | 348 | sf.append("<SXX>"+scheduleRealInfo.getXlDir()+"</SXX>"); |
| 356 | 349 | sf.append("<FCZDMC>"+scheduleRealInfo.getQdzName()+"</FCZDMC>"); |
| 357 | 350 | sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 358 | - scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getQdzName()) + "</FCZDXH>"); | |
| 351 | + scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getQdzCode()) + "</FCZDXH>"); | |
| 359 | 352 | sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>"); |
| 360 | 353 | sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>"); |
| 361 | 354 | sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>"); |
| ... | ... | @@ -363,7 +356,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 363 | 356 | sf.append("<FCZDLX>"+""+"</FCZDLX>"); |
| 364 | 357 | sf.append("<DDZDMC>"+scheduleRealInfo.getZdzName()+"</DDZDMC>"); |
| 365 | 358 | sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 366 | - scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getZdzName()) +"</DDZDXH>"); | |
| 359 | + scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getZdzCode()) +"</DDZDXH>"); | |
| 367 | 360 | sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>"); |
| 368 | 361 | sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>"); |
| 369 | 362 | sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>"); |
| ... | ... | @@ -382,6 +375,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 382 | 375 | Results results = ssop.setLD(userNameOther, passwordOther, sf.toString()); |
| 383 | 376 | if(results.isSuccess()){ |
| 384 | 377 | result = "success"; |
| 378 | + }else{ | |
| 379 | + result = "failure"; | |
| 385 | 380 | } |
| 386 | 381 | logger.info("setLD:"+sf.toString()); |
| 387 | 382 | logger.info("setLD:"+result); |
| ... | ... | @@ -393,11 +388,33 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 393 | 388 | Results results = ssop.setLD(userNameOther, passwordOther, sf.toString()); |
| 394 | 389 | if(results.isSuccess()){ |
| 395 | 390 | result = "success"; |
| 391 | + }else{ | |
| 392 | + result = "failure"; | |
| 396 | 393 | } |
| 397 | 394 | logger.info("setLD:"+sf.toString()); |
| 398 | 395 | logger.info("setLD:"+result); |
| 399 | 396 | } |
| 397 | + } catch (Exception e) { | |
| 398 | + logger.error("setLD:",e); | |
| 399 | + e.printStackTrace(); | |
| 400 | + }finally{ | |
| 400 | 401 | |
| 402 | + } | |
| 403 | + return result; | |
| 404 | + } | |
| 405 | + | |
| 406 | + /** | |
| 407 | + * 上传路单 xml来自文件 | |
| 408 | + * @return 上传成功标识 | |
| 409 | + */ | |
| 410 | + public String setLDFile(){ | |
| 411 | + String result = "failure"; | |
| 412 | + try { | |
| 413 | + String tmp = readXmlFromFile("E:/ld.txt"); | |
| 414 | + Results rss = ssop.setLD(userNameOther, passwordOther, tmp); | |
| 415 | + if(rss.isSuccess()){ | |
| 416 | + result = "success"; | |
| 417 | + } | |
| 401 | 418 | } catch (Exception e) { |
| 402 | 419 | logger.error("setLD:",e); |
| 403 | 420 | e.printStackTrace(); |
| ... | ... | @@ -660,11 +677,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 660 | 677 | sBuffer.append("<SXX>").append(schedulePlanInfo.getXlDir()).append("</SXX>"); |
| 661 | 678 | sBuffer.append("<FCZDMC>").append(schedulePlanInfo.getQdzName()).append("</FCZDMC>"); |
| 662 | 679 | sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 663 | - schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzName())).append("</ZDXH>"); | |
| 680 | + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzCode())).append("</ZDXH>"); | |
| 664 | 681 | sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); |
| 665 | 682 | sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); |
| 666 | 683 | sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 667 | - schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzName())).append("</DDXH>"); | |
| 684 | + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzCode())).append("</DDXH>"); | |
| 668 | 685 | sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) |
| 669 | 686 | .append("</JHDDSJ>"); |
| 670 | 687 | sBuffer.append("</BC>"); |
| ... | ... | @@ -767,11 +784,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 767 | 784 | sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>"); |
| 768 | 785 | sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz().getStationName()).append("</FCZDMC>"); |
| 769 | 786 | sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 770 | - lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getQdz().getStationName())).append("</ZDXH>"); | |
| 787 | + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getQdz().getStationCod())).append("</ZDXH>"); | |
| 771 | 788 | sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); |
| 772 | 789 | sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz().getStationName()).append("</DDZDMC>"); |
| 773 | 790 | sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( |
| 774 | - lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getZdz().getStationName())).append("</DDXH>"); | |
| 791 | + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getZdz().getStationCod())).append("</DDXH>"); | |
| 775 | 792 | sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); |
| 776 | 793 | sBuffer.append("</BC>"); |
| 777 | 794 | } |
| ... | ... | @@ -1131,15 +1148,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1131 | 1148 | zdlx = "2"; |
| 1132 | 1149 | } |
| 1133 | 1150 | sBuffer.append("<Station>"); |
| 1134 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationName())).append("</ZDXH>"); | |
| 1135 | - sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>"); | |
| 1136 | - sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>"); | |
| 1137 | - sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>"); | |
| 1138 | - sBuffer.append("<ZDJD>").append(srRoute.getStation().getgLonx()).append("</ZDJD>"); | |
| 1139 | - sBuffer.append("<ZDWD>").append(srRoute.getStation().getgLaty()).append("</ZDWD>"); | |
| 1140 | - sBuffer.append("<ZZ>").append(srRoute.getStation().getAddr()).append("</ZZ>");//站点的具体地址 | |
| 1141 | - sBuffer.append("<ZDLX>").append(zdlx).append("</ZDLX>"); | |
| 1142 | - sBuffer.append("<ZJLC>").append(srRoute.getDistances()).append("</ZJLC>"); | |
| 1151 | + sBuffer.append("<STATION_ID>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationCode())).append("</STATION_ID>"); | |
| 1152 | + sBuffer.append("<UPDDOWN>").append(srRoute.getDirections()).append("</UPDDOWN>"); | |
| 1153 | + sBuffer.append("<STATION_NO>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationCode())).append("</STATION_NO>"); | |
| 1154 | + sBuffer.append("<STATION_CODE>").append(srRoute.getStationCode()).append("</STATION_CODE>"); | |
| 1155 | + sBuffer.append("<STATION_NAME>").append(srRoute.getStationName()).append("</STATION_NAME>"); | |
| 1156 | + sBuffer.append("<STATION_LON>").append(srRoute.getStation().getgLonx()).append("</STATION_LON>"); | |
| 1157 | + sBuffer.append("<STATION_LAT>").append(srRoute.getStation().getgLaty()).append("</STATION_LAT>"); | |
| 1158 | + sBuffer.append("<STATION_TYPE>").append(zdlx).append("</STATION_TYPE>"); | |
| 1159 | + sBuffer.append("<STATION_DISTANCE>").append(srRoute.getDistances()).append("</STATION_DISTANCE>"); | |
| 1143 | 1160 | sBuffer.append("</Station>"); |
| 1144 | 1161 | startId++; |
| 1145 | 1162 | } |
| ... | ... | @@ -1147,15 +1164,47 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1147 | 1164 | } |
| 1148 | 1165 | |
| 1149 | 1166 | /** |
| 1167 | + * @param stationsList 站点路由集 | |
| 1168 | + * @param sBuffer sBuffer | |
| 1169 | + * @param startId 站点序号起始ID | |
| 1170 | + * | |
| 1171 | + * @return 站点序号累加后的ID | |
| 1172 | + */ | |
| 1173 | + private int packagStationPointXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId){ | |
| 1174 | + int size = stationsList.size(); | |
| 1175 | + StationRoute srRoute; | |
| 1176 | + String zdlx ;// 站点类型:0:起点站、1:终点站、2:中途站 | |
| 1177 | + for (int i = 0; i < size; i++) { | |
| 1178 | + srRoute = stationsList.get(i); | |
| 1179 | + zdlx = srRoute.getStationMark(); | |
| 1180 | + if(zdlx.equals("B")){ | |
| 1181 | + zdlx = "0"; | |
| 1182 | + }else if(zdlx.equals("E")){ | |
| 1183 | + zdlx = "1"; | |
| 1184 | + }else{ | |
| 1185 | + zdlx = "2"; | |
| 1186 | + } | |
| 1187 | + sBuffer.append("<Point>"); | |
| 1188 | + sBuffer.append("<POINT_ID>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationCode())).append("</POINT_ID>"); | |
| 1189 | + sBuffer.append("<UPDDOWN>").append(srRoute.getDirections()).append("</UPDDOWN>"); | |
| 1190 | + sBuffer.append("<POINTLON>").append(srRoute.getStation().getgLonx()).append("</POINTLON>"); | |
| 1191 | + sBuffer.append("<POINTLAT>").append(srRoute.getStation().getgLaty()).append("</POINTLAT>"); | |
| 1192 | + sBuffer.append("</Point>"); | |
| 1193 | + startId++; | |
| 1194 | + } | |
| 1195 | + return startId; | |
| 1196 | + } | |
| 1197 | + | |
| 1198 | + /** | |
| 1150 | 1199 | * |
| 1151 | 1200 | * @param lineCode 线路编码 |
| 1152 | 1201 | * @param direction 线路方向 |
| 1153 | - * @param stationName 让点名称 | |
| 1202 | + * @param stationCode 让点名称 | |
| 1154 | 1203 | * @return 运管处站点序号 |
| 1155 | 1204 | */ |
| 1156 | - private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(String lineCode,String direction,String stationName){ | |
| 1205 | + private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(String lineCode,String direction,String stationCode){ | |
| 1157 | 1206 | Integer number = 0; |
| 1158 | - number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationName); | |
| 1159 | - return number; | |
| 1207 | + number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationCode); | |
| 1208 | + return number == null ? 0 : number; | |
| 1160 | 1209 | } |
| 1161 | 1210 | } | ... | ... |