Commit d8baa8a11e39eed7b627d612a7a1824edd4ec114
1 parent
b09e420d
行驶时间及车速表 实际营运时间重新排序计算
Showing
1 changed file
with
44 additions
and
16 deletions
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -114,15 +114,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 114 | 114 | long fcsj = Long.valueOf(split1[0]) * 60 + Long.valueOf(split1[1]); |
| 115 | 115 | long zdsj = Long.valueOf(split3[0]) * 60 + Long.valueOf(split3[1]); |
| 116 | 116 | if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())){ |
| 117 | - fcsj += 1440l; | |
| 118 | - zdsj += 1440l; | |
| 117 | + if(fcsj<23*60) fcsj += 1440l; | |
| 118 | + if(zdsj<23*60) zdsj += 1440l; | |
| 119 | 119 | } |
| 120 | 120 | if(zdsj < fcsj) |
| 121 | 121 | zdsj += 1440l; |
| 122 | 122 | if(schedule.getDfsj() != null){ |
| 123 | 123 | String[] split0 = schedule.getDfsj().split(":"); |
| 124 | 124 | long dfsj = Long.valueOf(split0[0]) * 60 + Long.valueOf(split0[1]); |
| 125 | - if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())) | |
| 125 | + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())&&dfsj<23*60) | |
| 126 | 126 | dfsj += 1440l; |
| 127 | 127 | schedule.setDfsj(dfsj/60 + ":" + dfsj%60); |
| 128 | 128 | schedule.setDfsjT(dfsj); |
| ... | ... | @@ -130,7 +130,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 130 | 130 | if(schedule.getFcsjActual() != null){ |
| 131 | 131 | String[] split2 = schedule.getFcsjActual().split(":"); |
| 132 | 132 | long fcsjA = Long.valueOf(split2[0]) * 60 + Long.valueOf(split2[1]); |
| 133 | - if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())) | |
| 133 | + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())&&fcsjA<23*60) | |
| 134 | 134 | fcsjA += 1440l; |
| 135 | 135 | schedule.setFcsjActual(fcsjA/60 + ":" + fcsjA%60); |
| 136 | 136 | schedule.setFcsjActualTime(fcsjA); |
| ... | ... | @@ -138,7 +138,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 138 | 138 | if(schedule.getZdsjActual() != null){ |
| 139 | 139 | String[] split4 = schedule.getZdsjActual().split(":"); |
| 140 | 140 | long zdsjA = Long.valueOf(split4[0]) * 60 + Long.valueOf(split4[1]); |
| 141 | - if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())) | |
| 141 | + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())&&zdsjA<23*60) | |
| 142 | 142 | zdsjA += 1440l; |
| 143 | 143 | if(schedule.getFcsjActualTime() != null && zdsjA < schedule.getFcsjActualTime()) |
| 144 | 144 | zdsjA += 1440l; |
| ... | ... | @@ -648,7 +648,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 648 | 648 | if(schedule.getDfsj() != null){ |
| 649 | 649 | String[] split0 = schedule.getDfsj().split(":"); |
| 650 | 650 | long dfsj = Long.valueOf(split0[0]) * 60 + Long.valueOf(split0[1]); |
| 651 | - if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())) | |
| 651 | + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())&&dfsj<23*60) | |
| 652 | 652 | dfsj += 1440l; |
| 653 | 653 | schedule.setDfsj(dfsj/60 + ":" + dfsj%60); |
| 654 | 654 | schedule.setDfsjT(dfsj); |
| ... | ... | @@ -656,7 +656,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 656 | 656 | if(schedule.getFcsjActual() != null){ |
| 657 | 657 | String[] split2 = schedule.getFcsjActual().split(":"); |
| 658 | 658 | long fcsjA = Long.valueOf(split2[0]) * 60 + Long.valueOf(split2[1]); |
| 659 | - if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())) | |
| 659 | + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())&&fcsjA<23*60) | |
| 660 | 660 | fcsjA += 1440l; |
| 661 | 661 | schedule.setFcsjActual(fcsjA/60 + ":" + fcsjA%60); |
| 662 | 662 | schedule.setFcsjActualTime(fcsjA); |
| ... | ... | @@ -664,7 +664,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 664 | 664 | if(schedule.getZdsjActual() != null){ |
| 665 | 665 | String[] split4 = schedule.getZdsjActual().split(":"); |
| 666 | 666 | long zdsjA = Long.valueOf(split4[0]) * 60 + Long.valueOf(split4[1]); |
| 667 | - if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())) | |
| 667 | + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())&&zdsjA<23*60) | |
| 668 | 668 | zdsjA += 1440l; |
| 669 | 669 | schedule.setZdsjActual(zdsjA/60 + ":" + zdsjA%60); |
| 670 | 670 | schedule.setZdsjActualTime(zdsjA); |
| ... | ... | @@ -675,8 +675,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 675 | 675 | long zdsj = Long.valueOf(split3[0]) * 60 + Long.valueOf(split3[1]); |
| 676 | 676 | |
| 677 | 677 | if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())){ |
| 678 | - fcsj += 1440l; | |
| 679 | - zdsj += 1440l; | |
| 678 | + if(fcsj<23*60) fcsj += 1440l; | |
| 679 | + if(zdsj<23*60) zdsj += 1440l; | |
| 680 | 680 | } |
| 681 | 681 | schedule.setFcsj(fcsj/60 + ":" + fcsj%60); |
| 682 | 682 | schedule.setZdsj(zdsj/60 + ":" + zdsj%60); |
| ... | ... | @@ -773,6 +773,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 773 | 773 | Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>(); |
| 774 | 774 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); |
| 775 | 775 | List<Long> keyList = new ArrayList<Long>(); |
| 776 | + List<Long> keyList2 = new ArrayList<Long>(); | |
| 776 | 777 | List<ScheduleRealInfo> list2 = keyMap.get(key); |
| 777 | 778 | long jhyysj = 0, sjyysj = 0; |
| 778 | 779 | long jhyssj = 0, sjyssj = 0; |
| ... | ... | @@ -794,6 +795,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 794 | 795 | keyList.add(fcsj); |
| 795 | 796 | } |
| 796 | 797 | sortMap.put(fcsj, schedule); |
| 798 | + | |
| 797 | 799 | } |
| 798 | 800 | Collections.sort(keyList); |
| 799 | 801 | |
| ... | ... | @@ -884,12 +886,20 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 884 | 886 | mapList.add(m); |
| 885 | 887 | } |
| 886 | 888 | } |
| 887 | - for(int i = 1; i < mapList.size(); i++){ | |
| 888 | - Map<String, Object> m1 = mapList.get(i - 1); | |
| 889 | - Map<String, Object> m2 = mapList.get(i); | |
| 890 | - if(m1.get("fcsj") != null && m2.get("fcsj") != null){ | |
| 891 | - long fcsj2 = Long.valueOf(m2.get("fcsj").toString()); | |
| 892 | - long fcsj1 = Long.valueOf(m1.get("fcsj").toString()); | |
| 889 | + | |
| 890 | + for(Map<String, Object> m : mapList){ | |
| 891 | + if(m.get("fcsj") != null && m.get("fcsj").toString().trim().length()!=0){ | |
| 892 | + keyList2.add(Long.valueOf(m.get("fcsj").toString())); | |
| 893 | + } | |
| 894 | + } | |
| 895 | + Collections.sort(keyList2); | |
| 896 | + for(long l : keyList2){ | |
| 897 | + System.out.println(l); | |
| 898 | + } | |
| 899 | + for(int i = 1; i < keyList2.size(); i++){ | |
| 900 | + long fcsj1 = keyList2.get(i - 1); | |
| 901 | + long fcsj2 = keyList2.get(i); | |
| 902 | + if(fcsj2 - fcsj1 < 90){ | |
| 893 | 903 | if(sfqr == 1 && time1 > fcsj1){ |
| 894 | 904 | sjyysj += fcsj2 - time1; |
| 895 | 905 | }else if(sfqr == 1 && time2 < fcsj2){ |
| ... | ... | @@ -898,7 +908,25 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 898 | 908 | sjyysj += fcsj2 - fcsj1; |
| 899 | 909 | } |
| 900 | 910 | sjyysj1 += fcsj2 - fcsj1; |
| 911 | + System.out.println("---"+(fcsj2-fcsj1)+"---"+sjyysj+"---"+sjyysj1); | |
| 901 | 912 | } |
| 913 | + } | |
| 914 | + | |
| 915 | + for(int i = 1; i < mapList.size(); i++){ | |
| 916 | + Map<String, Object> m1 = mapList.get(i - 1); | |
| 917 | + Map<String, Object> m2 = mapList.get(i); | |
| 918 | +// if(m1.get("fcsj") != null && m2.get("fcsj") != null){ | |
| 919 | +// long fcsj2 = Long.valueOf(m2.get("fcsj").toString()); | |
| 920 | +// long fcsj1 = Long.valueOf(m1.get("fcsj").toString()); | |
| 921 | +// if(sfqr == 1 && time1 > fcsj1){ | |
| 922 | +// sjyysj += fcsj2 - time1; | |
| 923 | +// }else if(sfqr == 1 && time2 < fcsj2){ | |
| 924 | +// sjyysj += time2 - fcsj1; | |
| 925 | +// }else{ | |
| 926 | +// sjyysj += fcsj2 - fcsj1; | |
| 927 | +// } | |
| 928 | +// sjyysj1 += fcsj2 - fcsj1; | |
| 929 | +// } | |
| 902 | 930 | if(m2.get("fcsj") != null && m2.get("zdsj") != null){ |
| 903 | 931 | long zdsj = Long.valueOf(m2.get("zdsj").toString()); |
| 904 | 932 | long fcsj = Long.valueOf(m2.get("fcsj").toString()); | ... | ... |