Commit 819094988d6688f3ceae7602442d1717659638fe
1 parent
f0d23567
运管处bug修改
Showing
1 changed file
with
33 additions
and
8 deletions
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| @@ -37,6 +37,8 @@ import java.sql.ResultSet; | @@ -37,6 +37,8 @@ import java.sql.ResultSet; | ||
| 37 | import java.text.DecimalFormat; | 37 | import java.text.DecimalFormat; |
| 38 | import java.text.SimpleDateFormat; | 38 | import java.text.SimpleDateFormat; |
| 39 | import java.util.*; | 39 | import java.util.*; |
| 40 | +import java.util.regex.Pattern; | ||
| 41 | + | ||
| 40 | /** | 42 | /** |
| 41 | * | 43 | * |
| 42 | * @ClassName: TrafficManageServiceImpl(运管处接口service业务层实现类) | 44 | * @ClassName: TrafficManageServiceImpl(运管处接口service业务层实现类) |
| @@ -299,6 +301,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -299,6 +301,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 299 | */ | 301 | */ |
| 300 | public String setLD(){ | 302 | public String setLD(){ |
| 301 | String result = "failure"; | 303 | String result = "failure"; |
| 304 | + Line line; | ||
| 302 | // 取昨天 的日期 | 305 | // 取昨天 的日期 |
| 303 | String date = sdfnyr.format(DateUtils.addDays(new Date(), -1)); | 306 | String date = sdfnyr.format(DateUtils.addDays(new Date(), -1)); |
| 304 | StringBuffer sf = new StringBuffer(); | 307 | StringBuffer sf = new StringBuffer(); |
| @@ -312,6 +315,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -312,6 +315,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 312 | //根据车辆自编号查询车牌号 | 315 | //根据车辆自编号查询车牌号 |
| 313 | map.put("insideCode_eq", schRealInfo.getClZbh()); | 316 | map.put("insideCode_eq", schRealInfo.getClZbh()); |
| 314 | Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map)); | 317 | Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map)); |
| 318 | + // 获取线路是否使用标识,如果未使用,则不查该线路数据 | ||
| 319 | + line = lineRepository.findByLineCode(schRealInfo.getXlBm()); | ||
| 320 | + if(line.getInUse() == null || line.getInUse() == 0){ | ||
| 321 | + continue; | ||
| 322 | + } | ||
| 315 | sf.append("<DLD>"); | 323 | sf.append("<DLD>"); |
| 316 | sf.append("<RQ>"+schRealInfo.getScheduleDateStr()+"</RQ>"); | 324 | sf.append("<RQ>"+schRealInfo.getScheduleDateStr()+"</RQ>"); |
| 317 | sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.getXlBm())+"</XLBM>"); | 325 | sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.getXlBm())+"</XLBM>"); |
| @@ -557,14 +565,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -557,14 +565,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 557 | @Override | 565 | @Override |
| 558 | public String setJHBC() { | 566 | public String setJHBC() { |
| 559 | String result = "failure"; | 567 | String result = "failure"; |
| 568 | + Line line; | ||
| 560 | StringBuffer sBuffer =new StringBuffer(); | 569 | StringBuffer sBuffer =new StringBuffer(); |
| 561 | try { | 570 | try { |
| 562 | sBuffer.append("<JHBCs>"); | 571 | sBuffer.append("<JHBCs>"); |
| 563 | // 声明变量 | 572 | // 声明变量 |
| 564 | - SchedulePlanInfo schedulePlanInfo = null; | ||
| 565 | - String xlbm = "",zbh = ""; | 573 | + SchedulePlanInfo schedulePlanInfo; |
| 574 | + String xlbm,zbh = ""; | ||
| 566 | Long lp = 0L; | 575 | Long lp = 0L; |
| 567 | - int startSerialNum = 0,endSerialNum = 0;; | ||
| 568 | // 取明天的日期 | 576 | // 取明天的日期 |
| 569 | String tomorrow = sdfnyr.format(DateUtils.addDays(new Date(), +1)); | 577 | String tomorrow = sdfnyr.format(DateUtils.addDays(new Date(), +1)); |
| 570 | // 查询所有班次 | 578 | // 查询所有班次 |
| @@ -573,8 +581,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -573,8 +581,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 573 | int size = schedulePlanList.size(); | 581 | int size = schedulePlanList.size(); |
| 574 | for (int i = 0; i < size; i++) { | 582 | for (int i = 0; i < size; i++) { |
| 575 | schedulePlanInfo = schedulePlanList.get(i); | 583 | schedulePlanInfo = schedulePlanList.get(i); |
| 584 | + xlbm = schedulePlanInfo.getXlBm(); | ||
| 585 | + // 获取线路是否使用标识,如果未使用,则不查该线路数据 | ||
| 586 | + line = lineRepository.findByLineCode(xlbm); | ||
| 587 | + if(line.getInUse() == null || line.getInUse() == 0){ | ||
| 588 | + continue; | ||
| 589 | + } | ||
| 576 | if(i == 0){// 第一次,则初始化值 | 590 | if(i == 0){// 第一次,则初始化值 |
| 577 | - xlbm = schedulePlanInfo.getXlBm(); | ||
| 578 | zbh = schedulePlanInfo.getClZbh(); | 591 | zbh = schedulePlanInfo.getClZbh(); |
| 579 | lp = schedulePlanInfo.getLp(); | 592 | lp = schedulePlanInfo.getLp(); |
| 580 | // 拼装XML | 593 | // 拼装XML |
| @@ -605,18 +618,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -605,18 +618,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 605 | sBuffer.append("</JHBC>"); | 618 | sBuffer.append("</JHBC>"); |
| 606 | } | 619 | } |
| 607 | }else{ | 620 | }else{ |
| 608 | - xlbm = schedulePlanInfo.getXlBm(); | ||
| 609 | zbh = schedulePlanInfo.getClZbh(); | 621 | zbh = schedulePlanInfo.getClZbh(); |
| 610 | lp = schedulePlanInfo.getLp(); | 622 | lp = schedulePlanInfo.getLp(); |
| 611 | sBuffer.append("</BCList>"); | 623 | sBuffer.append("</BCList>"); |
| 612 | sBuffer.append("</JHBC>"); | 624 | sBuffer.append("</JHBC>"); |
| 613 | - startSerialNum = 0; | ||
| 614 | - endSerialNum = 0; | ||
| 615 | // 拼装XML | 625 | // 拼装XML |
| 616 | assembleJHBC(sBuffer, schedulePlanInfo, xlbm, zbh, lp); | 626 | assembleJHBC(sBuffer, schedulePlanInfo, xlbm, zbh, lp); |
| 617 | } | 627 | } |
| 618 | } | 628 | } |
| 619 | } | 629 | } |
| 630 | + // 判断XML是否以</BCList>结尾,如果不是,则加上 | ||
| 631 | + String regex = "^*</JHBC>$"; | ||
| 632 | + Pattern p = Pattern.compile(regex); | ||
| 633 | + java.util.regex.Matcher m = p.matcher(sBuffer); | ||
| 634 | + boolean isEndWithTrueFlag = false; | ||
| 635 | + while (m.find()) { | ||
| 636 | + isEndWithTrueFlag = true; | ||
| 637 | + } | ||
| 638 | + // 加上缺失的标签 | ||
| 639 | + if(!isEndWithTrueFlag){ | ||
| 640 | + sBuffer.append("</BCList>"); | ||
| 641 | + sBuffer.append("</JHBC>"); | ||
| 642 | + } | ||
| 620 | sBuffer.append("</JHBCs>"); | 643 | sBuffer.append("</JHBCs>"); |
| 621 | if(ssop.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | 644 | if(ssop.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ |
| 622 | result = "success"; | 645 | result = "success"; |
| @@ -643,7 +666,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -643,7 +666,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 643 | StringBuffer sBufferA; | 666 | StringBuffer sBufferA; |
| 644 | StringBuffer sBufferB; | 667 | StringBuffer sBufferB; |
| 645 | TTInfo ttInfo; | 668 | TTInfo ttInfo; |
| 646 | - TTInfoDetail ttInfoDetail = null; | 669 | + TTInfoDetail ttInfoDetail; |
| 647 | Iterator<TTInfoDetail> ttInfoDetailIterator; | 670 | Iterator<TTInfoDetail> ttInfoDetailIterator; |
| 648 | HashMap<String,Object> param = new HashMap<String, Object>(); | 671 | HashMap<String,Object> param = new HashMap<String, Object>(); |
| 649 | String lineCode ; | 672 | String lineCode ; |
| @@ -1027,6 +1050,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1027,6 +1050,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1027 | company = "浦东金高公交公司"; | 1050 | company = "浦东金高公交公司"; |
| 1028 | }else if(company.equals("南汇公司")){ | 1051 | }else if(company.equals("南汇公司")){ |
| 1029 | company = "浦东南汇公交公司"; | 1052 | company = "浦东南汇公交公司"; |
| 1053 | + }else if(company.equals("青浦公交")){ | ||
| 1054 | + company = "浦东青浦公交公司"; | ||
| 1030 | } | 1055 | } |
| 1031 | } | 1056 | } |
| 1032 | /** | 1057 | /** |