Commit d33094708ba6da23a32e069fb39dc7ac50d0cda6

Authored by zlz
1 parent 3baf9461

运管处路单上传BUG修改

src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -140,51 +140,45 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -140,51 +140,45 @@ public class TrafficManageServiceImpl implements TrafficManageService{
140 try { 140 try {
141 Iterator<Line> lineIterator = lineRepository.findAll().iterator(); 141 Iterator<Line> lineIterator = lineRepository.findAll().iterator();
142 Line line = null; 142 Line line = null;
143 - List<StationRoute> stationsList = null;// 站点路由集 143 + List<StationRoute> upStationsList = null;// 上行站点路由集
  144 + List<StationRoute> downStationsList = null;// 下行站点路由集
144 List<LineInformation> lineInformationsList = null; 145 List<LineInformation> lineInformationsList = null;
145 LineInformation lineInformation = null; 146 LineInformation lineInformation = null;
146 - sBuffer.append("<XLs>"); 147 + sBuffer.append("<Data>");
  148 + sBuffer.append("<RequestOrg>上海巴士拓华科技发展有限公司</RequestOrg>");
  149 + sBuffer.append("<DataList>");
147 while(lineIterator.hasNext()){ 150 while(lineIterator.hasNext()){
148 line = lineIterator.next(); 151 line = lineIterator.next();
  152 + if(!line.getName().equals("浦江4路")){
  153 + continue;
  154 + }
149 if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null 155 if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null
150 || line.getInUse() == 0){ 156 || line.getInUse() == 0){
151 continue; 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 int startId = 1; 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 System.out.println(sBuffer.toString()); 182 System.out.println(sBuffer.toString());
189 if(sBuffer.indexOf("<XL>") != -1){ 183 if(sBuffer.indexOf("<XL>") != -1){
190 portType = new Internal().getInternalHttpSoap11Endpoint(); 184 portType = new Internal().getInternalHttpSoap11Endpoint();
@@ -329,7 +323,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -329,7 +323,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{
329 sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); 323 sf.append("<CPH>"+car.getCarPlate()+"</CPH>");
330 sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>"); 324 sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>");
331 sf.append("<LDList>"); 325 sf.append("<LDList>");
332 -  
333 for(ScheduleRealInfo scheduleRealInfo:list){ 326 for(ScheduleRealInfo scheduleRealInfo:list){
334 if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"") 327 if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"")
335 .equals(scheduleRealInfo.getLpName()) 328 .equals(scheduleRealInfo.getLpName())
@@ -355,7 +348,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -355,7 +348,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
355 sf.append("<SXX>"+scheduleRealInfo.getXlDir()+"</SXX>"); 348 sf.append("<SXX>"+scheduleRealInfo.getXlDir()+"</SXX>");
356 sf.append("<FCZDMC>"+scheduleRealInfo.getQdzName()+"</FCZDMC>"); 349 sf.append("<FCZDMC>"+scheduleRealInfo.getQdzName()+"</FCZDMC>");
357 sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName( 350 sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(
358 - scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getQdzName()) + "</FCZDXH>"); 351 + scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getQdzCode()) + "</FCZDXH>");
359 sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>"); 352 sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>");
360 sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>"); 353 sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>");
361 sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>"); 354 sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>");
@@ -363,7 +356,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -363,7 +356,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
363 sf.append("<FCZDLX>"+""+"</FCZDLX>"); 356 sf.append("<FCZDLX>"+""+"</FCZDLX>");
364 sf.append("<DDZDMC>"+scheduleRealInfo.getZdzName()+"</DDZDMC>"); 357 sf.append("<DDZDMC>"+scheduleRealInfo.getZdzName()+"</DDZDMC>");
365 sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName( 358 sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(
366 - scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getZdzName()) +"</DDZDXH>"); 359 + scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getZdzCode()) +"</DDZDXH>");
367 sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>"); 360 sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>");
368 sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>"); 361 sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>");
369 sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>"); 362 sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>");
@@ -382,6 +375,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -382,6 +375,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
382 Results results = ssop.setLD(userNameOther, passwordOther, sf.toString()); 375 Results results = ssop.setLD(userNameOther, passwordOther, sf.toString());
383 if(results.isSuccess()){ 376 if(results.isSuccess()){
384 result = "success"; 377 result = "success";
  378 + }else{
  379 + result = "failure";
385 } 380 }
386 logger.info("setLD:"+sf.toString()); 381 logger.info("setLD:"+sf.toString());
387 logger.info("setLD:"+result); 382 logger.info("setLD:"+result);
@@ -393,11 +388,12 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -393,11 +388,12 @@ public class TrafficManageServiceImpl implements TrafficManageService{
393 Results results = ssop.setLD(userNameOther, passwordOther, sf.toString()); 388 Results results = ssop.setLD(userNameOther, passwordOther, sf.toString());
394 if(results.isSuccess()){ 389 if(results.isSuccess()){
395 result = "success"; 390 result = "success";
  391 + }else{
  392 + result = "failure";
396 } 393 }
397 logger.info("setLD:"+sf.toString()); 394 logger.info("setLD:"+sf.toString());
398 logger.info("setLD:"+result); 395 logger.info("setLD:"+result);
399 } 396 }
400 -  
401 } catch (Exception e) { 397 } catch (Exception e) {
402 logger.error("setLD:",e); 398 logger.error("setLD:",e);
403 e.printStackTrace(); 399 e.printStackTrace();
@@ -660,11 +656,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -660,11 +656,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{
660 sBuffer.append("<SXX>").append(schedulePlanInfo.getXlDir()).append("</SXX>"); 656 sBuffer.append("<SXX>").append(schedulePlanInfo.getXlDir()).append("</SXX>");
661 sBuffer.append("<FCZDMC>").append(schedulePlanInfo.getQdzName()).append("</FCZDMC>"); 657 sBuffer.append("<FCZDMC>").append(schedulePlanInfo.getQdzName()).append("</FCZDMC>");
662 sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( 658 sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
663 - schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzName())).append("</ZDXH>"); 659 + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzCode())).append("</ZDXH>");
664 sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); 660 sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>");
665 sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); 661 sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>");
666 sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( 662 sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
667 - schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzName())).append("</DDXH>"); 663 + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzCode())).append("</DDXH>");
668 sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) 664 sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj()))
669 .append("</JHDDSJ>"); 665 .append("</JHDDSJ>");
670 sBuffer.append("</BC>"); 666 sBuffer.append("</BC>");
@@ -767,11 +763,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -767,11 +763,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{
767 sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>"); 763 sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>");
768 sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz().getStationName()).append("</FCZDMC>"); 764 sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz().getStationName()).append("</FCZDMC>");
769 sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( 765 sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
770 - lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getQdz().getStationName())).append("</ZDXH>"); 766 + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getQdz().getStationCod())).append("</ZDXH>");
771 sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); 767 sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");
772 sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz().getStationName()).append("</DDZDMC>"); 768 sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz().getStationName()).append("</DDZDMC>");
773 sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( 769 sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
774 - lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getZdz().getStationName())).append("</DDXH>"); 770 + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getZdz().getStationCod())).append("</DDXH>");
775 sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); 771 sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
776 sBuffer.append("</BC>"); 772 sBuffer.append("</BC>");
777 } 773 }
@@ -1131,15 +1127,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1131,15 +1127,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1131 zdlx = "2"; 1127 zdlx = "2";
1132 } 1128 }
1133 sBuffer.append("<Station>"); 1129 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>"); 1130 + sBuffer.append("<STATION_ID>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationCode())).append("</STATION_ID>");
  1131 + sBuffer.append("<UPDDOWN>").append(srRoute.getDirections()).append("</UPDDOWN>");
  1132 + sBuffer.append("<STATION_NO>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationCode())).append("</STATION_NO>");
  1133 + sBuffer.append("<STATION_CODE>").append(srRoute.getStationCode()).append("</STATION_CODE>");
  1134 + sBuffer.append("<STATION_NAME>").append(srRoute.getStationName()).append("</STATION_NAME>");
  1135 + sBuffer.append("<STATION_LON>").append(srRoute.getStation().getgLonx()).append("</STATION_LON>");
  1136 + sBuffer.append("<STATION_LAT>").append(srRoute.getStation().getgLaty()).append("</STATION_LAT>");
  1137 + sBuffer.append("<STATION_TYPE>").append(zdlx).append("</STATION_TYPE>");
  1138 + sBuffer.append("<STATION_DISTANCE>").append(srRoute.getDistances()).append("</STATION_DISTANCE>");
1143 sBuffer.append("</Station>"); 1139 sBuffer.append("</Station>");
1144 startId++; 1140 startId++;
1145 } 1141 }
@@ -1147,15 +1143,47 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1147,15 +1143,47 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1147 } 1143 }
1148 1144
1149 /** 1145 /**
  1146 + * @param stationsList 站点路由集
  1147 + * @param sBuffer sBuffer
  1148 + * @param startId 站点序号起始ID
  1149 + *
  1150 + * @return 站点序号累加后的ID
  1151 + */
  1152 + private int packagStationPointXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId){
  1153 + int size = stationsList.size();
  1154 + StationRoute srRoute;
  1155 + String zdlx ;// 站点类型:0:起点站、1:终点站、2:中途站
  1156 + for (int i = 0; i < size; i++) {
  1157 + srRoute = stationsList.get(i);
  1158 + zdlx = srRoute.getStationMark();
  1159 + if(zdlx.equals("B")){
  1160 + zdlx = "0";
  1161 + }else if(zdlx.equals("E")){
  1162 + zdlx = "1";
  1163 + }else{
  1164 + zdlx = "2";
  1165 + }
  1166 + sBuffer.append("<Point>");
  1167 + sBuffer.append("<POINT_ID>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationCode())).append("</POINT_ID>");
  1168 + sBuffer.append("<UPDDOWN>").append(srRoute.getDirections()).append("</UPDDOWN>");
  1169 + sBuffer.append("<POINTLON>").append(srRoute.getStation().getgLonx()).append("</POINTLON>");
  1170 + sBuffer.append("<POINTLAT>").append(srRoute.getStation().getgLaty()).append("</POINTLAT>");
  1171 + sBuffer.append("</Point>");
  1172 + startId++;
  1173 + }
  1174 + return startId;
  1175 + }
  1176 +
  1177 + /**
1150 * 1178 *
1151 * @param lineCode 线路编码 1179 * @param lineCode 线路编码
1152 * @param direction 线路方向 1180 * @param direction 线路方向
1153 - * @param stationName 让点名称 1181 + * @param stationCode 让点名称
1154 * @return 运管处站点序号 1182 * @return 运管处站点序号
1155 */ 1183 */
1156 - private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(String lineCode,String direction,String stationName){ 1184 + private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(String lineCode,String direction,String stationCode){
1157 Integer number = 0; 1185 Integer number = 0;
1158 - number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationName); 1186 + number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationCode);
1159 return number; 1187 return number;
1160 } 1188 }
1161 } 1189 }