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