Commit d394a7b1e762f05507192224e6af6ae6cdf2843a

Authored by 徐烜
2 parents 5c838643 49f3e8a9

Merge branch 'pudong' of http://222.66.0.204:8090//panzhaov5/bsth_control into pudong

src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -948,8 +948,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -948,8 +948,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
948 String result = "failure"; 948 String result = "failure";
949 StringBuffer sBuffer = new StringBuffer(); 949 StringBuffer sBuffer = new StringBuffer();
950 DecimalFormat df = new DecimalFormat("######0.000"); 950 DecimalFormat df = new DecimalFormat("######0.000");
951 - Map<String,String> lsStationCode2NameMap;  
952 - Map<String, Integer> lsStationName2YgcNumber; 951 + Map<String,String> lsStationCode2NameMap = null;
  952 + Map<String, Integer> lsStationName2YgcNumber = null;
953 try { 953 try {
954 String[] idArray = ids.split(","); 954 String[] idArray = ids.split(",");
955 StringBuffer sBufferA ,sBufferB ,sBufferC ; 955 StringBuffer sBufferA ,sBufferB ,sBufferC ;
@@ -963,16 +963,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -963,16 +963,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{
963 Iterator<TTInfoDetail> ttInfoDetailIterator; 963 Iterator<TTInfoDetail> ttInfoDetailIterator;
964 HashMap<String,Object> param ; 964 HashMap<String,Object> param ;
965 sBuffer.append("<SKBs>"); 965 sBuffer.append("<SKBs>");
966 - HashMap<String,String> paramMap; 966 + HashMap<String,String> paramMap = null;
967 HashMap<String,String> otherMap = new HashMap<>(); 967 HashMap<String,String> otherMap = new HashMap<>();
  968 + // 得到时刻表版本号
  969 + int lineVersion = -1;
  970 + long ttinfoId = -1L;
  971 + // 是否输出站点信息
  972 + boolean isLogStation;
968 for (int i = 0; i < idArray.length; i++) { 973 for (int i = 0; i < idArray.length; i++) {
969 - long ttinfoId = Long.valueOf(idArray[i]); 974 + ttinfoId = Long.valueOf(idArray[i]);
970 ttInfo = ttInfoRepository.findOne(ttinfoId); 975 ttInfo = ttInfoRepository.findOne(ttinfoId);
971 if(ttInfo == null) 976 if(ttInfo == null)
972 continue; 977 continue;
973 ttinfoList.add(ttInfo); // 保存时刻表 978 ttinfoList.add(ttInfo); // 保存时刻表
974 // 得到时刻表版本号 979 // 得到时刻表版本号
975 - int lineVersion = ttInfo.getLineVersion(); 980 + lineVersion = ttInfo.getLineVersion();
976 // 查询历史站点路由 981 // 查询历史站点路由
977 lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); 982 lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion);
978 // 查询历史站点路由 983 // 查询历史站点路由
@@ -988,6 +993,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -988,6 +993,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
988 param = new HashMap(); 993 param = new HashMap();
989 param.put("line.id_eq", ttInfo.getXl().getId()); 994 param.put("line.id_eq", ttInfo.getXl().getId());
990 lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); 995 lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param));
  996 + // 初始化
  997 + isLogStation = true;
991 if(ttInfoDetailIterator.hasNext()){ 998 if(ttInfoDetailIterator.hasNext()){
992 sBuffer.append("<SKB>"); 999 sBuffer.append("<SKB>");
993 sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId())) 1000 sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId()))
@@ -1029,13 +1036,20 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1029,13 +1036,20 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1029 // 起点站的参数 1036 // 起点站的参数
1030 otherMap.put("stationMark","B"); 1037 otherMap.put("stationMark","B");
1031 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 1038 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
  1039 + if(isLogStation){// 输出起点站信息
  1040 + logger.info("setSKB:"+"起点站信息:"+paramMap);
  1041 + }
1032 sBufferC.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</ZDXH>"); 1042 sBufferC.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</ZDXH>");
1033 sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); 1043 sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");
1034 sBufferC.append("<DDZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() 1044 sBufferC.append("<DDZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()
1035 +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); 1045 +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>");
1036 - // 点站的参数 1046 + // 点站的参数
1037 otherMap.put("stationMark","E"); 1047 otherMap.put("stationMark","E");
1038 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 1048 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
  1049 + if(isLogStation){// 输出终点站信息
  1050 + logger.info("setSKB:"+"终点站信息:"+paramMap);
  1051 + }
  1052 + isLogStation = false; // 一条线路只输出一次,后面的不输出了
1039 sBufferC.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</DDXH>"); 1053 sBufferC.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</DDXH>");
1040 sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); 1054 sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
1041 sBufferC.append("</BC>"); 1055 sBufferC.append("</BC>");
@@ -1055,6 +1069,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1055,6 +1069,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1055 sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); 1069 sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>");
1056 sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); 1070 sBuffer.append(sBufferA).append(sBufferB).append(sBufferC);
1057 } 1071 }
  1072 + logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber);
1058 } 1073 }
1059 sBuffer.append("</SKBs>"); 1074 sBuffer.append("</SKBs>");
1060 if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ 1075 if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){