Commit cb883e25a39e2dc554b88e11a9d7c6512bcf5c03
1 parent
fa0b3cfb
BUG修复(上传线路站级,出现站点序号为0的情况)
Showing
3 changed files
with
58 additions
and
12 deletions
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -274,6 +274,17 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -274,6 +274,17 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 274 | "ORDER BY " + | 274 | "ORDER BY " + |
| 275 | "lineCode,directions,stationRouteCode") | 275 | "lineCode,directions,stationRouteCode") |
| 276 | List<Map<String, String>> findAllLineWithYgc(); | 276 | List<Map<String, String>> findAllLineWithYgc(); |
| 277 | + | ||
| 278 | + @Query("SELECT new map(" + | ||
| 279 | + "lineCode as lineCode,directions as directions,stationName as stationName,stationCode as stationCode," + | ||
| 280 | + "line.linePlayType as linePlayType,s.stationMark as stationMark) " + | ||
| 281 | + "FROM " + | ||
| 282 | + "StationRoute s " + | ||
| 283 | + "WHERE " + | ||
| 284 | + "s.destroy = 0 and s.lineCode = ?1 " + | ||
| 285 | + "ORDER BY " + | ||
| 286 | + "lineCode,directions,stationRouteCode") | ||
| 287 | + List<Map<String, String>> findLineWithYgcByLine(String lineCode); | ||
| 277 | 288 | ||
| 278 | @Modifying | 289 | @Modifying |
| 279 | @Query(value="update bsth_c_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) | 290 | @Query(value="update bsth_c_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| @@ -200,13 +200,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -200,13 +200,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 200 | 200 | ||
| 201 | // 先查上行 | 201 | // 先查上行 |
| 202 | upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0); | 202 | upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0); |
| 203 | + Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode()); | ||
| 203 | int startId = 1; | 204 | int startId = 1; |
| 204 | - startId = packagStationXml(upStationsList, sBuffer, startId); | 205 | + startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap); |
| 205 | // 环线不查下行 | 206 | // 环线不查下行 |
| 206 | if(line.getLinePlayType() != 1){ | 207 | if(line.getLinePlayType() != 1){ |
| 207 | // 再查下行 | 208 | // 再查下行 |
| 208 | downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1); | 209 | downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1); |
| 209 | - packagStationXml(downStationsList, sBuffer, startId); | 210 | + packagStationXml(downStationsList, sBuffer, startId,stationNumMap); |
| 210 | } | 211 | } |
| 211 | sBuffer.append("</StationList>"); | 212 | sBuffer.append("</StationList>"); |
| 212 | 213 | ||
| @@ -223,6 +224,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -223,6 +224,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 223 | sBuffer.append("</LinePointList>"); | 224 | sBuffer.append("</LinePointList>"); |
| 224 | sBuffer.append("</XL>"); | 225 | sBuffer.append("</XL>"); |
| 225 | sBuffer.append("</XLs>"); | 226 | sBuffer.append("</XLs>"); |
| 227 | + // 临时添加,后面删除 | ||
| 228 | + if(sBuffer.indexOf("<ZDXH>0</ZDXH>") != -1){ | ||
| 229 | + return "0"; | ||
| 230 | + } | ||
| 226 | // 调用上传方法 | 231 | // 调用上传方法 |
| 227 | if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,sBuffer.toString()).isSuccess()){ | 232 | if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,sBuffer.toString()).isSuccess()){ |
| 228 | result = "success"; | 233 | result = "success"; |
| @@ -240,6 +245,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -240,6 +245,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 240 | } | 245 | } |
| 241 | 246 | ||
| 242 | /** | 247 | /** |
| 248 | + * 加载运管处的站点及序号 | ||
| 249 | + * 上行从1开始,下行顺序续编 | ||
| 250 | + */ | ||
| 251 | + private Map<String, Integer> getStationName2YgcNumberMap (String lineCode){ | ||
| 252 | + Map<String, Integer> resultMap = new HashMap<>(); | ||
| 253 | + List<Map<String, String>> ygcLines = stationRouteRepository.findLineWithYgcByLine(lineCode); | ||
| 254 | + if(ygcLines != null && ygcLines.size() > 0){ | ||
| 255 | + int size = ygcLines.size(); | ||
| 256 | + Map<String, String> tempMap ; | ||
| 257 | + int num = 1; | ||
| 258 | + String key; | ||
| 259 | + for (int i = 0; i < size; i ++){ | ||
| 260 | + tempMap = ygcLines.get(i); | ||
| 261 | + key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions")) | ||
| 262 | + + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark"); | ||
| 263 | + resultMap.put(key,num++); | ||
| 264 | + } | ||
| 265 | + } | ||
| 266 | + return resultMap; | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | + /** | ||
| 243 | * 上传线路信息(按in_use上传) | 270 | * 上传线路信息(按in_use上传) |
| 244 | */ | 271 | */ |
| 245 | @Override | 272 | @Override |
| @@ -431,7 +458,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -431,7 +458,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 431 | // 起点站的参数 | 458 | // 起点站的参数 |
| 432 | otherMap.put("stationMark","B"); | 459 | otherMap.put("stationMark","B"); |
| 433 | paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); | 460 | paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); |
| 434 | - sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap) + "</FCZDXH>"); | 461 | + sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null) + "</FCZDXH>"); |
| 435 | sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>"); | 462 | sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>"); |
| 436 | sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>"); | 463 | sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>"); |
| 437 | sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>"); | 464 | sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>"); |
| @@ -441,7 +468,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -441,7 +468,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 441 | // 终点站的参数 | 468 | // 终点站的参数 |
| 442 | otherMap.put("stationMark","E"); | 469 | otherMap.put("stationMark","E"); |
| 443 | paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); | 470 | paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); |
| 444 | - sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap) +"</DDZDXH>"); | 471 | + sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null) +"</DDZDXH>"); |
| 445 | sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>"); | 472 | sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>"); |
| 446 | sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>"); | 473 | sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>"); |
| 447 | sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>"); | 474 | sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>"); |
| @@ -768,13 +795,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -768,13 +795,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 768 | // 起点站的参数 | 795 | // 起点站的参数 |
| 769 | otherMap.put("stationMark","B"); | 796 | otherMap.put("stationMark","B"); |
| 770 | paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); | 797 | paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); |
| 771 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</ZDXH>"); | 798 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>"); |
| 772 | sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); | 799 | sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); |
| 773 | sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); | 800 | sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); |
| 774 | // 起点站的参数 | 801 | // 起点站的参数 |
| 775 | otherMap.put("stationMark","E"); | 802 | otherMap.put("stationMark","E"); |
| 776 | paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); | 803 | paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); |
| 777 | - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</DDXH>"); | 804 | + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>"); |
| 778 | sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) | 805 | sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) |
| 779 | .append("</JHDDSJ>"); | 806 | .append("</JHDDSJ>"); |
| 780 | sBuffer.append("</BC>"); | 807 | sBuffer.append("</BC>"); |
| @@ -883,14 +910,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -883,14 +910,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 883 | // 起点站的参数 | 910 | // 起点站的参数 |
| 884 | otherMap.put("stationMark","B"); | 911 | otherMap.put("stationMark","B"); |
| 885 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | 912 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 886 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</ZDXH>"); | 913 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>"); |
| 887 | sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); | 914 | sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); |
| 888 | sBuffer.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | 915 | sBuffer.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() |
| 889 | +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); | 916 | +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); |
| 890 | // 起点站的参数 | 917 | // 起点站的参数 |
| 891 | otherMap.put("stationMark","E"); | 918 | otherMap.put("stationMark","E"); |
| 892 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | 919 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 893 | - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</DDXH>"); | 920 | + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>"); |
| 894 | sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); | 921 | sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); |
| 895 | sBuffer.append("</BC>"); | 922 | sBuffer.append("</BC>"); |
| 896 | } | 923 | } |
| @@ -1214,7 +1241,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1214,7 +1241,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1214 | * | 1241 | * |
| 1215 | * @return 站点序号累加后的ID | 1242 | * @return 站点序号累加后的ID |
| 1216 | */ | 1243 | */ |
| 1217 | - private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId){ | 1244 | + private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId,Map<String, Integer> stationNumMap){ |
| 1218 | int size = stationsList.size(); | 1245 | int size = stationsList.size(); |
| 1219 | StationRoute srRoute; | 1246 | StationRoute srRoute; |
| 1220 | HashMap<String,String> paraMap; | 1247 | HashMap<String,String> paraMap; |
| @@ -1231,7 +1258,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1231,7 +1258,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1231 | } | 1258 | } |
| 1232 | paraMap = packageYgcStationNumParam(srRoute,null); | 1259 | paraMap = packageYgcStationNumParam(srRoute,null); |
| 1233 | sBuffer.append("<Station>"); | 1260 | sBuffer.append("<Station>"); |
| 1234 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap)).append("</ZDXH>"); | 1261 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap,stationNumMap)).append("</ZDXH>"); |
| 1235 | sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>"); | 1262 | sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>"); |
| 1236 | sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>"); | 1263 | sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>"); |
| 1237 | sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>"); | 1264 | sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>"); |
| @@ -1287,7 +1314,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1287,7 +1314,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1287 | * @param map | 1314 | * @param map |
| 1288 | * @return 运管处站点序号 | 1315 | * @return 运管处站点序号 |
| 1289 | */ | 1316 | */ |
| 1290 | - private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map){ | 1317 | + private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map,Map<String, Integer> stationNumMap){ |
| 1291 | // 线路编码 | 1318 | // 线路编码 |
| 1292 | String lineCode = map.get("lineCode"); | 1319 | String lineCode = map.get("lineCode"); |
| 1293 | // 线路走向 0:上行 1:下行 | 1320 | // 线路走向 0:上行 1:下行 |
| @@ -1305,9 +1332,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1305,9 +1332,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1305 | }else if(stationMark.equals("Z")){ | 1332 | }else if(stationMark.equals("Z")){ |
| 1306 | marks= new String[]{"Z"}; | 1333 | marks= new String[]{"Z"}; |
| 1307 | } | 1334 | } |
| 1335 | + // 默认从缓存BasicData.stationName2YgcNumber | ||
| 1336 | + Map<String, Integer> tempMap = BasicData.stationName2YgcNumber; | ||
| 1337 | + // 如果传入的stationNumMap不为空,则不是缓存取,而从stationNumMap取 | ||
| 1338 | + if(stationNumMap != null){ | ||
| 1339 | + tempMap = stationNumMap; | ||
| 1340 | + } | ||
| 1308 | Integer number = null; | 1341 | Integer number = null; |
| 1309 | for (int i = 0 ;i < marks.length ; i ++){ | 1342 | for (int i = 0 ;i < marks.length ; i ++){ |
| 1310 | - number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]); | 1343 | + number = tempMap.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]); |
| 1311 | if(number != null){ | 1344 | if(number != null){ |
| 1312 | break; | 1345 | break; |
| 1313 | } | 1346 | } |
src/main/resources/static/pages/trafficManage/js/lineStationUpload.js
| @@ -111,6 +111,8 @@ | @@ -111,6 +111,8 @@ | ||
| 111 | success:function(data) { | 111 | success:function(data) { |
| 112 | if(data == 'success'){ | 112 | if(data == 'success'){ |
| 113 | alert("上传成功"); | 113 | alert("上传成功"); |
| 114 | + }else if(data == '0'){ | ||
| 115 | + alert("上传失败,线路编号有0"); | ||
| 114 | }else{ | 116 | }else{ |
| 115 | alert("上传失败"); | 117 | alert("上传失败"); |
| 116 | } | 118 | } |