Commit 84188eb7ce502f3bc1b9efc856247feae7378c01
1 parent
f1218320
路单日志发送到邮件
Showing
1 changed file
with
161 additions
and
50 deletions
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| 1 | package com.bsth.service.impl; | 1 | package com.bsth.service.impl; |
| 2 | 2 | ||
| 3 | import com.bsth.data.BasicData; | 3 | import com.bsth.data.BasicData; |
| 4 | +import com.bsth.email.SendEmailController; | ||
| 5 | +import com.bsth.email.entity.EmailBean; | ||
| 4 | import com.bsth.entity.*; | 6 | import com.bsth.entity.*; |
| 5 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 7 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| @@ -109,6 +111,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -109,6 +111,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 109 | @Autowired | 111 | @Autowired |
| 110 | private YgcBasicDataService ygcBasicDataService; | 112 | private YgcBasicDataService ygcBasicDataService; |
| 111 | 113 | ||
| 114 | + // 发送邮件 | ||
| 115 | + @Autowired | ||
| 116 | + private SendEmailController sendEmailController; | ||
| 112 | 117 | ||
| 113 | // 运管处上传接口 | 118 | // 运管处上传接口 |
| 114 | private com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap webServiceSoapUp; | 119 | private com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap webServiceSoapUp; |
| @@ -138,6 +143,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -138,6 +143,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 138 | private final String userNameUp = "user"; | 143 | private final String userNameUp = "user"; |
| 139 | // 密码 | 144 | // 密码 |
| 140 | private final String passwordUp = "user"; | 145 | private final String passwordUp = "user"; |
| 146 | + // 接收邮件人 | ||
| 147 | + private final String emailSendToAddress = "175912183@qq.com"; | ||
| 148 | + // 记录路单上线的成功、失败线路数 | ||
| 149 | + private Integer countSuccess,countFailure; | ||
| 141 | 150 | ||
| 142 | private synchronized com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap getWebServiceSoapUp(){ | 151 | private synchronized com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap getWebServiceSoapUp(){ |
| 143 | try { | 152 | try { |
| @@ -396,20 +405,27 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -396,20 +405,27 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 396 | */ | 405 | */ |
| 397 | private String uploadLD(String theDate){ | 406 | private String uploadLD(String theDate){ |
| 398 | String result = "failure"; | 407 | String result = "failure"; |
| 408 | + countSuccess = 0 ;countFailure = 0; | ||
| 399 | Line line; | 409 | Line line; |
| 400 | // 取昨天 的日期 | 410 | // 取昨天 的日期 |
| 401 | String date = theDate == null ?sdfnyr.format(DateUtils.addDays(new Date(), -1)) : theDate; | 411 | String date = theDate == null ?sdfnyr.format(DateUtils.addDays(new Date(), -1)) : theDate; |
| 402 | StringBuffer sf = new StringBuffer(); | 412 | StringBuffer sf = new StringBuffer(); |
| 403 | - String str; | 413 | + StringBuffer logSuccess = new StringBuffer("成功:"); |
| 414 | + StringBuffer logFailure = new StringBuffer("失败:"); | ||
| 415 | + HashMap logXlbmSuccessMap = new HashMap(); | ||
| 416 | + HashMap logXlbmFailureMap = new HashMap(); | ||
| 417 | + HashMap logXlbmMap = new HashMap(); | ||
| 418 | + Results results = null; | ||
| 419 | + String str = "",xlbm; | ||
| 404 | try { | 420 | try { |
| 405 | int counter = 0; // 计数器 | 421 | int counter = 0; // 计数器 |
| 406 | int per = 10; // 每几条线路上传一次路单 | 422 | int per = 10; // 每几条线路上传一次路单 |
| 407 | 423 | ||
| 408 | List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date); | 424 | List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date); |
| 409 | List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLDGroup(date); | 425 | List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLDGroup(date); |
| 410 | - Map<String,Object> map = new HashMap<String,Object>(); | 426 | + Map<String,Object> map = new HashMap(); |
| 411 | HashMap<String,String> paramMap; | 427 | HashMap<String,String> paramMap; |
| 412 | - HashMap<String,String> otherMap = new HashMap<String, String>(); | 428 | + HashMap<String,String> otherMap = new HashMap(); |
| 413 | for(Map<String,Object> schRealInfo:listGroup){ | 429 | for(Map<String,Object> schRealInfo:listGroup){ |
| 414 | if(schRealInfo != null){ | 430 | if(schRealInfo != null){ |
| 415 | //根据车辆自编号查询车牌号 | 431 | //根据车辆自编号查询车牌号 |
| @@ -425,9 +441,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -425,9 +441,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 425 | sf.append("<DLDS>"); | 441 | sf.append("<DLDS>"); |
| 426 | } | 442 | } |
| 427 | counter ++; | 443 | counter ++; |
| 444 | + xlbm = BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm")+""); | ||
| 445 | + // 保存一次路单的线路编码,用于发送邮箱 | ||
| 446 | + if(logXlbmMap.get(xlbm) == null){ | ||
| 447 | + logXlbmMap.put(xlbm,xlbm); | ||
| 448 | + } | ||
| 428 | sf.append("<DLD>"); | 449 | sf.append("<DLD>"); |
| 429 | sf.append("<RQ>"+date+"</RQ>"); | 450 | sf.append("<RQ>"+date+"</RQ>"); |
| 430 | - sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm")+"")+"</XLBM>"); | 451 | + sf.append("<XLBM>"+xlbm+"</XLBM>"); |
| 431 | sf.append("<LPBH>"+schRealInfo.get("lpName")+"</LPBH>"); | 452 | sf.append("<LPBH>"+schRealInfo.get("lpName")+"</LPBH>"); |
| 432 | sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); | 453 | sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); |
| 433 | sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>"); | 454 | sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>"); |
| @@ -485,39 +506,91 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -485,39 +506,91 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 485 | counter = 0; | 506 | counter = 0; |
| 486 | sf.append("</DLDS>"); | 507 | sf.append("</DLDS>"); |
| 487 | str = sf.toString().replace("'","");// 去掉'号 | 508 | str = sf.toString().replace("'","");// 去掉'号 |
| 488 | - Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); | ||
| 489 | - if(results.isSuccess()){ | ||
| 490 | - result = "success"; | ||
| 491 | - }else{ | ||
| 492 | - result = "failure"; | ||
| 493 | - } | ||
| 494 | - logger.info("setLD:"+str); | ||
| 495 | - logger.info("setLD:"+result); | 509 | + results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); |
| 510 | + // 记录日志 | ||
| 511 | + result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str); | ||
| 496 | } | 512 | } |
| 497 | } | 513 | } |
| 498 | // 每per条线路上传后剩下的数据再上传 | 514 | // 每per条线路上传后剩下的数据再上传 |
| 499 | if(counter > 0){ | 515 | if(counter > 0){ |
| 500 | sf.append("</DLDS>"); | 516 | sf.append("</DLDS>"); |
| 501 | str = sf.toString().replace("'","");// 去掉'号 | 517 | str = sf.toString().replace("'","");// 去掉'号 |
| 502 | - Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); | ||
| 503 | - if(results.isSuccess()){ | ||
| 504 | - result = "success"; | ||
| 505 | - }else{ | ||
| 506 | - result = "failure"; | ||
| 507 | - } | ||
| 508 | - logger.info("setLD:"+str); | ||
| 509 | - logger.info("setLD:"+result); | 518 | + results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); |
| 510 | } | 519 | } |
| 520 | + // 记录日志 | ||
| 521 | + result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str); | ||
| 511 | } catch (Exception e) { | 522 | } catch (Exception e) { |
| 512 | logger.error("setLD:",e); | 523 | logger.error("setLD:",e); |
| 524 | + logFailure.append(e).append("<br/>"); | ||
| 525 | + for (StackTraceElement traceElement : e.getStackTrace()){ | ||
| 526 | + logFailure.append("\r\t").append(traceElement); | ||
| 527 | + } | ||
| 513 | e.printStackTrace(); | 528 | e.printStackTrace(); |
| 514 | }finally{ | 529 | }finally{ |
| 515 | - | 530 | + try { |
| 531 | + //发送邮件 | ||
| 532 | + EmailBean mail = new EmailBean(); | ||
| 533 | + mail.setSubject("闵行路单日志数据"+date); | ||
| 534 | + mail.setContent(logSuccess+"<br/>成功数:"+countSuccess+"<br/>" +logFailure+"<br/>失败数:"+countFailure); | ||
| 535 | + sendEmailController.sendMail(emailSendToAddress, mail); | ||
| 536 | + logger.info("setLD-sendMail:邮件发送成功!"); | ||
| 537 | + }catch (Exception e){ | ||
| 538 | + e.printStackTrace(); | ||
| 539 | + logger.error("setLD-sendMail:",e); | ||
| 540 | + } | ||
| 516 | } | 541 | } |
| 517 | return result; | 542 | return result; |
| 518 | } | 543 | } |
| 519 | 544 | ||
| 520 | /** | 545 | /** |
| 546 | + * 记录日志 | ||
| 547 | + * @param results | ||
| 548 | + * @param logXlbmMap | ||
| 549 | + * @param logXlbmSuccessMap | ||
| 550 | + * @param logXlbmFailureMap | ||
| 551 | + * @param logSuccess | ||
| 552 | + * @param logFailure | ||
| 553 | + * @param str | ||
| 554 | + */ | ||
| 555 | + private String logRecord(Results results,HashMap logXlbmMap,HashMap logXlbmSuccessMap,HashMap logXlbmFailureMap,StringBuffer logSuccess, | ||
| 556 | + StringBuffer logFailure,String str){ | ||
| 557 | + String result = "failure"; | ||
| 558 | + // 记录日志 | ||
| 559 | + if(results != null){ | ||
| 560 | + if(results.isSuccess()){// 上传成功 | ||
| 561 | + // 把上线成功的线路编码放入 logXlbmSuccessMap,并记录logSuccess | ||
| 562 | + countSuccess += fillMailXlbmMap(logXlbmMap,logXlbmSuccessMap,logSuccess); | ||
| 563 | + result = "success"; | ||
| 564 | + }else{// 上传失败 | ||
| 565 | + // 把上线失败的线路编码放入 logXlbmFailureMap,并记录logFailure | ||
| 566 | + countFailure += fillMailXlbmMap(logXlbmMap,logXlbmFailureMap,logFailure); | ||
| 567 | + result = "failure"; | ||
| 568 | + } | ||
| 569 | + logger.info("setLD:"+str); | ||
| 570 | + logger.info("setLD:"+result); | ||
| 571 | + results = null; | ||
| 572 | + logXlbmMap = new HashMap(); | ||
| 573 | + } | ||
| 574 | + return result; | ||
| 575 | + } | ||
| 576 | + /** | ||
| 577 | + * 填充线路编码到相应的map | ||
| 578 | + * @param fromMap | ||
| 579 | + * @param toMap | ||
| 580 | + */ | ||
| 581 | + private int fillMailXlbmMap(HashMap fromMap,HashMap toMap,StringBuffer logStr){ | ||
| 582 | + int tmpCount = 0; | ||
| 583 | + for (Object key : fromMap.keySet()) { | ||
| 584 | + if(toMap.get(key) == null){ | ||
| 585 | + toMap.put(key,fromMap.get(key)); | ||
| 586 | + logStr.append(key).append(","); | ||
| 587 | + tmpCount ++; | ||
| 588 | + } | ||
| 589 | + } | ||
| 590 | + fromMap = new HashMap(); | ||
| 591 | + return tmpCount; | ||
| 592 | + } | ||
| 593 | + /** | ||
| 521 | * 上传路单 xml来自文件 | 594 | * 上传路单 xml来自文件 |
| 522 | * @return 上传成功标识 | 595 | * @return 上传成功标识 |
| 523 | */ | 596 | */ |
| @@ -745,10 +818,26 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -745,10 +818,26 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 745 | } | 818 | } |
| 746 | 819 | ||
| 747 | /** | 820 | /** |
| 821 | + * 上传计划班次 指定日期 yyyy-MM-dd | ||
| 822 | + * @param theDate | ||
| 823 | + * @return | ||
| 824 | + */ | ||
| 825 | + public String setJHBC(String theDate){ | ||
| 826 | + return uploadJHBC(theDate); | ||
| 827 | + } | ||
| 828 | + | ||
| 829 | + /** | ||
| 830 | + * 上传计划班次 | ||
| 831 | + * @return | ||
| 832 | + */ | ||
| 833 | + public String setJHBC(){ | ||
| 834 | + return uploadJHBC(null); | ||
| 835 | + } | ||
| 836 | + /** | ||
| 748 | * 上传线路计划班次表 | 837 | * 上传线路计划班次表 |
| 749 | */ | 838 | */ |
| 750 | - @Override | ||
| 751 | - public String setJHBC() { | 839 | + |
| 840 | + private String uploadJHBC(String theDate) { | ||
| 752 | String result = "failure"; | 841 | String result = "failure"; |
| 753 | Line line; | 842 | Line line; |
| 754 | StringBuffer sBuffer =new StringBuffer(); | 843 | StringBuffer sBuffer =new StringBuffer(); |
| @@ -758,8 +847,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -758,8 +847,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 758 | SchedulePlanInfo schedulePlanInfo; | 847 | SchedulePlanInfo schedulePlanInfo; |
| 759 | String xlbm,zbh = ""; | 848 | String xlbm,zbh = ""; |
| 760 | Long lp = 0L; | 849 | Long lp = 0L; |
| 761 | - // 取明天的日期 | ||
| 762 | - String tomorrow = sdfnyr.format(DateUtils.addDays(new Date(), +1)); | 850 | + // 取得计划班次时间 |
| 851 | + String tomorrow = theDate == null ? sdfnyr.format(DateUtils.addDays(new Date(), +1)) : theDate; | ||
| 763 | // 查询所有班次 | 852 | // 查询所有班次 |
| 764 | List<SchedulePlanInfo> schedulePlanList = schedulePlanInfoRepository.findLineScheduleBc(tomorrow); | 853 | List<SchedulePlanInfo> schedulePlanList = schedulePlanInfoRepository.findLineScheduleBc(tomorrow); |
| 765 | int j = 0; // 初始化标识 | 854 | int j = 0; // 初始化标识 |
| @@ -853,32 +942,42 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -853,32 +942,42 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 853 | public String setSKB(String ids) { | 942 | public String setSKB(String ids) { |
| 854 | String result = "failure"; | 943 | String result = "failure"; |
| 855 | StringBuffer sBuffer = new StringBuffer(); | 944 | StringBuffer sBuffer = new StringBuffer(); |
| 945 | + DecimalFormat df = new DecimalFormat("######0.000"); | ||
| 856 | try { | 946 | try { |
| 857 | String[] idArray = ids.split(","); | 947 | String[] idArray = ids.split(","); |
| 858 | - StringBuffer sBufferA; | ||
| 859 | - StringBuffer sBufferB; | 948 | + StringBuffer sBufferA ,sBufferB = null,sBufferC = null; |
| 949 | + double zlc = 0.0f,yylc = 0.0f,singleLc,emptyLc;// 总里程、营运里程、单程、空放里程 | ||
| 950 | + String bcType,sxx;// 班次类型、上下行 | ||
| 860 | // 上传的时刻表集合 | 951 | // 上传的时刻表集合 |
| 861 | List<TTInfo> ttinfoList = new ArrayList<>(); | 952 | List<TTInfo> ttinfoList = new ArrayList<>(); |
| 862 | TTInfo ttInfo; | 953 | TTInfo ttInfo; |
| 863 | TTInfoDetail ttInfoDetail; | 954 | TTInfoDetail ttInfoDetail; |
| 955 | + LineInformation lineInformation; | ||
| 864 | Iterator<TTInfoDetail> ttInfoDetailIterator; | 956 | Iterator<TTInfoDetail> ttInfoDetailIterator; |
| 865 | - HashMap<String,Object> param = new HashMap<String, Object>(); | 957 | + HashMap<String,Object> param ; |
| 866 | sBuffer.append("<SKBs>"); | 958 | sBuffer.append("<SKBs>"); |
| 867 | HashMap<String,String> paramMap; | 959 | HashMap<String,String> paramMap; |
| 868 | - HashMap<String,String> otherMap = new HashMap<String, String>(); | 960 | + HashMap<String,String> otherMap = new HashMap<>(); |
| 869 | for (int i = 0; i < idArray.length; i++) { | 961 | for (int i = 0; i < idArray.length; i++) { |
| 870 | ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i])); | 962 | ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i])); |
| 871 | if(ttInfo == null) | 963 | if(ttInfo == null) |
| 872 | continue; | 964 | continue; |
| 873 | ttinfoList.add(ttInfo); // 保存时刻表 | 965 | ttinfoList.add(ttInfo); // 保存时刻表 |
| 966 | + // 获得时刻表 | ||
| 967 | + param = new HashMap(); | ||
| 874 | param.put("ttinfo.id_eq", ttInfo.getId()); | 968 | param.put("ttinfo.id_eq", ttInfo.getId()); |
| 875 | ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param), | 969 | ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param), |
| 876 | new Sort(Direction.ASC, "xlDir")).iterator(); | 970 | new Sort(Direction.ASC, "xlDir")).iterator(); |
| 971 | + // 获得lineInformation | ||
| 972 | + param = new HashMap(); | ||
| 973 | + param.put("line.id_eq", ttInfo.getXl().getId()); | ||
| 974 | + lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); | ||
| 877 | if(ttInfoDetailIterator.hasNext()){ | 975 | if(ttInfoDetailIterator.hasNext()){ |
| 878 | sBuffer.append("<SKB>"); | 976 | sBuffer.append("<SKB>"); |
| 879 | sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId())) | 977 | sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId())) |
| 880 | .append("</XLBM>"); | 978 | .append("</XLBM>"); |
| 881 | sBufferB = new StringBuffer(); | 979 | sBufferB = new StringBuffer(); |
| 980 | + sBufferC = new StringBuffer(); | ||
| 882 | sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); | 981 | sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); |
| 883 | // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 | 982 | // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 |
| 884 | sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); | 983 | sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); |
| @@ -886,46 +985,58 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -886,46 +985,58 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 886 | sBufferB.append("<TBYY>").append("").append("</TBYY>"); | 985 | sBufferB.append("<TBYY>").append("").append("</TBYY>"); |
| 887 | sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | 986 | sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); |
| 888 | sBufferB.append("<BCList>"); | 987 | sBufferB.append("<BCList>"); |
| 889 | - int num = 1; | ||
| 890 | while (ttInfoDetailIterator.hasNext()) { | 988 | while (ttInfoDetailIterator.hasNext()) { |
| 891 | ttInfoDetail = ttInfoDetailIterator.next(); | 989 | ttInfoDetail = ttInfoDetailIterator.next(); |
| 892 | - if(ttInfoDetail.getBcType().equals("in") || ttInfoDetail.getBcType().equals("out")){ | 990 | + bcType = ttInfoDetail.getBcType(); |
| 991 | + sxx = ttInfoDetail.getXlDir(); | ||
| 992 | + // 进出场班次 | ||
| 993 | + if(bcType.equals("in") || bcType.equals("out")){ | ||
| 994 | + // 进出班次的计划里程,算空驶里程 | ||
| 995 | + emptyLc = ttInfoDetail.getJhlc(); | ||
| 996 | + // 总里程需要加上空驶里程 | ||
| 997 | + zlc += emptyLc; | ||
| 893 | continue; | 998 | continue; |
| 894 | } | 999 | } |
| 895 | - if(num++ == 1){ | ||
| 896 | - sBufferA = new StringBuffer(); | ||
| 897 | - sBufferA.append("<JHZLC>").append(ttInfoDetail.getJhlc()).append("</JHZLC>"); | ||
| 898 | - sBufferA.append("<JHYYLC>").append(ttInfoDetail.getJhlc()).append("</JHYYLC>"); | ||
| 899 | - sBuffer.append(sBufferA).append(sBufferB); | ||
| 900 | - } | ||
| 901 | // 如果发车时间格式错误,忽略此条 | 1000 | // 如果发车时间格式错误,忽略此条 |
| 902 | if(changeTimeFormat(ttInfoDetail) == null){ | 1001 | if(changeTimeFormat(ttInfoDetail) == null){ |
| 903 | continue; | 1002 | continue; |
| 904 | } | 1003 | } |
| 905 | - sBuffer.append("<BC>"); | ||
| 906 | - sBuffer.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); | ||
| 907 | - sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>"); | ||
| 908 | - sBuffer.append("<FCZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | 1004 | + sBufferC.append("<BC>"); |
| 1005 | + sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); | ||
| 1006 | + sBufferC.append("<SXX>").append(sxx).append("</SXX>"); | ||
| 1007 | + sBufferC.append("<FCZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | ||
| 909 | +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>"); | 1008 | +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>"); |
| 910 | // 起点站的参数 | 1009 | // 起点站的参数 |
| 911 | otherMap.put("stationMark","B"); | 1010 | otherMap.put("stationMark","B"); |
| 912 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | 1011 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 913 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>"); | ||
| 914 | - sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); | ||
| 915 | - sBuffer.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | 1012 | + sBufferC.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>"); |
| 1013 | + sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); | ||
| 1014 | + sBufferC.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | ||
| 916 | +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); | 1015 | +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); |
| 917 | // 起点站的参数 | 1016 | // 起点站的参数 |
| 918 | otherMap.put("stationMark","E"); | 1017 | otherMap.put("stationMark","E"); |
| 919 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | 1018 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 920 | - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>"); | ||
| 921 | - sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); | ||
| 922 | - sBuffer.append("</BC>"); | 1019 | + sBufferC.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>"); |
| 1020 | + sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); | ||
| 1021 | + sBufferC.append("</BC>"); | ||
| 1022 | + // 0:上行;1:下行 | ||
| 1023 | + if("0".equals(sxx)){ | ||
| 1024 | + singleLc = lineInformation.getUpMileage(); | ||
| 1025 | + }else{ | ||
| 1026 | + singleLc = lineInformation.getDownMileage(); | ||
| 1027 | + } | ||
| 1028 | + zlc += singleLc ; | ||
| 1029 | + yylc += singleLc; | ||
| 923 | } | 1030 | } |
| 924 | - sBuffer.append("</BCList>"); | ||
| 925 | - sBuffer.append("</SKB>"); | 1031 | + sBufferC.append("</BCList>"); |
| 1032 | + sBufferC.append("</SKB>"); | ||
| 926 | } | 1033 | } |
| 927 | } | 1034 | } |
| 928 | - sBuffer.append("</SKBs>"); | 1035 | + |
| 1036 | + sBufferA = new StringBuffer(); | ||
| 1037 | + sBufferA.append("<JHZLC>").append(df.format(zlc)).append("</JHZLC>"); | ||
| 1038 | + sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); | ||
| 1039 | + sBuffer.append(sBufferA).append(sBufferB).append(sBufferC).append("</SKBs>"); | ||
| 929 | if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | 1040 | if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ |
| 930 | result = "success"; | 1041 | result = "success"; |
| 931 | SKBUploadLogger skbUploadLogger ; | 1042 | SKBUploadLogger skbUploadLogger ; |