Commit 386c869d5701c0b94a71b36f85a3b1c0b8e88366
1 parent
f23070e0
集群调度修正率
Showing
2 changed files
with
224 additions
and
133 deletions
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -17,17 +17,24 @@ import java.util.List; |
| 17 | 17 | import java.util.Map; |
| 18 | 18 | import java.util.Set; |
| 19 | 19 | |
| 20 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 20 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | |
| 21 | 23 | import org.springframework.jdbc.core.JdbcTemplate; |
| 22 | 24 | import org.springframework.jdbc.core.RowMapper; |
| 23 | 25 | import org.springframework.stereotype.Service; |
| 24 | 26 | |
| 27 | +import com.alibaba.fastjson.JSONArray; | |
| 28 | +import com.alibaba.fastjson.JSONObject; | |
| 29 | +import com.bsth.data.BasicData; | |
| 30 | +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | |
| 25 | 31 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 26 | 32 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 27 | 33 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 28 | 34 | import com.bsth.service.BusIntervalService; |
| 29 | 35 | import com.bsth.service.schedule.PeopleCarPlanService; |
| 30 | 36 | import com.bsth.util.ReportUtils; |
| 37 | +import com.google.gson.Gson; | |
| 31 | 38 | |
| 32 | 39 | |
| 33 | 40 | @Service |
| ... | ... | @@ -666,10 +673,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 666 | 673 | if(sfqr == 1){ |
| 667 | 674 | where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; |
| 668 | 675 | } |
| 669 | -// where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | |
| 670 | - where += " and bc_type != 'ldks'"; | |
| 676 | + where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | |
| 671 | 677 | |
| 672 | - String sql = "select id, schedule_date_Str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc, bc_type," | |
| 678 | + String sql = "select id, schedule_date_Str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc," | |
| 673 | 679 | + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id" |
| 674 | 680 | + " from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"'" |
| 675 | 681 | + " and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"+where+""; |
| ... | ... | @@ -693,7 +699,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 693 | 699 | schedule.setZdsjActual(rs.getString("zdsj_actual")); |
| 694 | 700 | schedule.setQdzName(rs.getString("qdz_name")); |
| 695 | 701 | schedule.setZdzName(rs.getString("zdz_name")); |
| 696 | - schedule.setBcType(rs.getString("bc_type")); | |
| 697 | 702 | schedule.setXlDir(rs.getString("xl_dir")); |
| 698 | 703 | schedule.setStatus(rs.getInt("status")); |
| 699 | 704 | schedule.setRemarks(rs.getString("remarks")); |
| ... | ... | @@ -827,7 +832,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 827 | 832 | if(model.length() != 0){ |
| 828 | 833 | sql = "select sp.id from " |
| 829 | 834 | + "(select id, tt_info, xl_bm, lp, fcsj from bsth_c_s_sp_info where schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'" |
| 830 | - + " and tt_info = '" + model + "' and bc_type != 'ldks') sp" | |
| 835 | + + " and tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks') sp" | |
| 831 | 836 | + " left join bsth_c_s_ttinfo_detail tt on sp.tt_info = tt.ttinfo and sp.xl_bm = tt.xl and sp.lp = tt.lp and sp.fcsj = tt.fcsj"; |
| 832 | 837 | |
| 833 | 838 | ttList = jdbcTemplate.query(sql, |
| ... | ... | @@ -910,7 +915,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 910 | 915 | for(String key : keyMap.keySet()){ |
| 911 | 916 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 912 | 917 | Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>(); |
| 913 | - Map<Long, Map<String, Object>> sortMap1 = new HashMap<Long, Map<String, Object>>(); | |
| 914 | 918 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); |
| 915 | 919 | List<Long> keyList = new ArrayList<Long>(); |
| 916 | 920 | List<Long> keyList2 = new ArrayList<Long>(); |
| ... | ... | @@ -942,25 +946,30 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 942 | 946 | for(int i = 1; i < keyList.size(); i++){ |
| 943 | 947 | ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1)); |
| 944 | 948 | ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i)); |
| 945 | - if(!tsSet.contains(schedule1.getId()) && !schedule1.getBcType().toString().equals("in") && !schedule1.getBcType().toString().equals("out")){ | |
| 946 | - long fcsj1 = schedule1.getFcsjT(); | |
| 947 | - long fcsj2 = schedule2.getFcsjT(); | |
| 948 | - if(tsSet.contains(schedule2.getId()) || schedule2.getBcType().toString().equals("in") || schedule2.getBcType().toString().equals("out")){ | |
| 949 | - fcsj2 = schedule1.getZdsjT(); | |
| 950 | - } | |
| 951 | - if(sfqr == 1 && time1 > fcsj1){ | |
| 952 | - jhyysj += fcsj2 - time1; | |
| 953 | - }else if(sfqr == 1 && time2 < fcsj2){ | |
| 954 | - jhyysj += time2 - fcsj1; | |
| 949 | + if(!tsSet.contains(schedule1.getId())){ | |
| 950 | + if(sfqr == 1 && time1 > schedule1.getFcsjT()){ | |
| 951 | + jhyysj += schedule2.getFcsjT() - time1; | |
| 952 | + }else if(sfqr == 1 && time2 < schedule2.getFcsjT()){ | |
| 953 | + jhyysj += time2 - schedule1.getFcsjT(); | |
| 955 | 954 | }else{ |
| 956 | - jhyysj += fcsj2 - fcsj1; | |
| 957 | - } | |
| 958 | - if(jhyysj < 0){ | |
| 959 | - System.out.println(fcsj2 + " - " + fcsj1); | |
| 955 | + jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT(); | |
| 960 | 956 | } |
| 961 | - jhyysj1 += fcsj2 - fcsj1; | |
| 957 | + jhyysj1 += schedule2.getFcsjT() - schedule1.getFcsjT(); | |
| 958 | + } | |
| 959 | + long zdsj2 = schedule2.getZdsjT(); | |
| 960 | + long fcsj2 = schedule2.getFcsjT(); | |
| 961 | + if(fcsj2 > zdsj2) | |
| 962 | + zdsj2 += 1440l; | |
| 963 | + if(sfqr == 1 && time1 > fcsj2){ | |
| 964 | + jhyssj += zdsj2 - time1; | |
| 965 | + }else if(sfqr == 1 && time2 < zdsj2){ | |
| 966 | + jhyssj += time2 - fcsj2; | |
| 967 | + }else{ | |
| 968 | + jhyssj += zdsj2 - fcsj2; | |
| 962 | 969 | } |
| 963 | - if(i == 1 && schedule1.getBcType().toString().equals("normal")){ | |
| 970 | + jhyssj1 += zdsj2 - fcsj2; | |
| 971 | + jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc(); | |
| 972 | + if(i == 1){ | |
| 964 | 973 | long zdsj1 = schedule1.getZdsjT(); |
| 965 | 974 | long fcsj1 = schedule1.getFcsjT(); |
| 966 | 975 | if(fcsj1 > zdsj1) |
| ... | ... | @@ -975,27 +984,12 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 975 | 984 | jhyssj1 += zdsj1 - fcsj1; |
| 976 | 985 | jhlc += schedule1.getJhlc()==null?0:schedule1.getJhlc(); |
| 977 | 986 | } |
| 978 | - if(schedule2.getBcType().toString().equals("normal")){ | |
| 979 | - long zdsj2 = schedule2.getZdsjT(); | |
| 980 | - long fcsj2 = schedule2.getFcsjT(); | |
| 981 | - if(fcsj2 > zdsj2) | |
| 982 | - zdsj2 += 1440l; | |
| 983 | - if(sfqr == 1 && time1 > fcsj2){ | |
| 984 | - jhyssj += zdsj2 - time1; | |
| 985 | - }else if(sfqr == 1 && time2 < zdsj2){ | |
| 986 | - jhyssj += time2 - fcsj2; | |
| 987 | - }else{ | |
| 988 | - jhyssj += zdsj2 - fcsj2; | |
| 989 | - } | |
| 990 | - jhyssj1 += zdsj2 - fcsj2; | |
| 991 | - jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc(); | |
| 992 | - } | |
| 993 | 987 | } |
| 994 | 988 | |
| 995 | 989 | for(int i = 0; i < keyList.size(); i++){ |
| 996 | 990 | Map<String, Object> m = new HashMap<String, Object>(); |
| 997 | 991 | ScheduleRealInfo schedule = sortMap.get(keyList.get(i)); |
| 998 | - | |
| 992 | + | |
| 999 | 993 | if(cMap.containsKey(schedule.getId())){ |
| 1000 | 994 | List<ChildTaskPlan> cTasks = cMap.get(schedule.getId()); |
| 1001 | 995 | for(ChildTaskPlan childTaskPlan : cTasks){ |
| ... | ... | @@ -1018,7 +1012,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1018 | 1012 | temp.put("fcsj", null); |
| 1019 | 1013 | } |
| 1020 | 1014 | } |
| 1021 | - temp.put("bcType", schedule.getBcType()); | |
| 1022 | 1015 | mapList.add(temp); |
| 1023 | 1016 | } |
| 1024 | 1017 | }else{ |
| ... | ... | @@ -1036,7 +1029,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1036 | 1029 | m.put("zdsj", null); |
| 1037 | 1030 | m.put("fcsj", null); |
| 1038 | 1031 | } |
| 1039 | - m.put("bcType", schedule.getBcType()); | |
| 1040 | 1032 | mapList.add(m); |
| 1041 | 1033 | } |
| 1042 | 1034 | } |
| ... | ... | @@ -1044,7 +1036,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1044 | 1036 | for(Map<String, Object> m : mapList){ |
| 1045 | 1037 | if(m.get("fcsj") != null && m.get("fcsj").toString().trim().length()!=0){ |
| 1046 | 1038 | keyList2.add(Long.valueOf(m.get("fcsj").toString())); |
| 1047 | - sortMap1.put(Long.valueOf(m.get("fcsj").toString()), m); | |
| 1048 | 1039 | } |
| 1049 | 1040 | } |
| 1050 | 1041 | Collections.sort(keyList2); |
| ... | ... | @@ -1052,31 +1043,36 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1052 | 1043 | for(int i = 1; i < keyList2.size(); i++){ |
| 1053 | 1044 | long fcsj1 = keyList2.get(i - 1); |
| 1054 | 1045 | long fcsj2 = keyList2.get(i); |
| 1055 | - Map<String, Object> m1 = sortMap1.get(fcsj1); | |
| 1056 | - Map<String, Object> m2 = sortMap1.get(fcsj2); | |
| 1057 | - if(m1.get("bcType").toString().equals("in") || m1.get("bcType").toString().equals("out")) | |
| 1058 | - continue; | |
| 1059 | - if(m2.get("bcType").toString().equals("in") || m2.get("bcType").toString().equals("out")){ | |
| 1060 | - fcsj2 = Long.valueOf(m1.get("zdsj").toString()); | |
| 1061 | - } else if(i == keyList.size() - 1){ | |
| 1062 | - fcsj2 = Long.valueOf(m2.get("zdsj").toString()); | |
| 1063 | - } | |
| 1064 | - if(sfqr == 1 && time1 > fcsj1){ | |
| 1065 | - sjyysj += fcsj2 - time1; | |
| 1066 | - }else if(sfqr == 1 && time2 < fcsj2){ | |
| 1067 | - sjyysj += time2 - fcsj1; | |
| 1068 | - }else{ | |
| 1069 | - sjyysj += fcsj2 - fcsj1; | |
| 1046 | + if(fcsj2 - fcsj1 < 90){ | |
| 1047 | + if(sfqr == 1 && time1 > fcsj1){ | |
| 1048 | + sjyysj += fcsj2 - time1; | |
| 1049 | + }else if(sfqr == 1 && time2 < fcsj2){ | |
| 1050 | + sjyysj += time2 - fcsj1; | |
| 1051 | + }else{ | |
| 1052 | + sjyysj += fcsj2 - fcsj1; | |
| 1053 | + } | |
| 1054 | + sjyysj1 += fcsj2 - fcsj1; | |
| 1070 | 1055 | } |
| 1071 | - sjyysj1 += fcsj2 - fcsj1; | |
| 1072 | 1056 | } |
| 1073 | 1057 | |
| 1074 | - for(int i = 0; i < mapList.size(); i++){ | |
| 1075 | - Map<String, Object> m = mapList.get(i); | |
| 1076 | - if(m.get("fcsj") != null && m.get("zdsj") != null && | |
| 1077 | - !m.get("bcType").toString().equals("in") && !m.get("bcType").toString().equals("out")){ | |
| 1078 | - long zdsj = Long.valueOf(m.get("zdsj").toString()); | |
| 1079 | - long fcsj = Long.valueOf(m.get("fcsj").toString()); | |
| 1058 | + for(int i = 1; i < mapList.size(); i++){ | |
| 1059 | + Map<String, Object> m1 = mapList.get(i - 1); | |
| 1060 | + Map<String, Object> m2 = mapList.get(i); | |
| 1061 | +// if(m1.get("fcsj") != null && m2.get("fcsj") != null){ | |
| 1062 | +// long fcsj2 = Long.valueOf(m2.get("fcsj").toString()); | |
| 1063 | +// long fcsj1 = Long.valueOf(m1.get("fcsj").toString()); | |
| 1064 | +// if(sfqr == 1 && time1 > fcsj1){ | |
| 1065 | +// sjyysj += fcsj2 - time1; | |
| 1066 | +// }else if(sfqr == 1 && time2 < fcsj2){ | |
| 1067 | +// sjyysj += time2 - fcsj1; | |
| 1068 | +// }else{ | |
| 1069 | +// sjyysj += fcsj2 - fcsj1; | |
| 1070 | +// } | |
| 1071 | +// sjyysj1 += fcsj2 - fcsj1; | |
| 1072 | +// } | |
| 1073 | + if(m2.get("fcsj") != null && m2.get("zdsj") != null){ | |
| 1074 | + long zdsj = Long.valueOf(m2.get("zdsj").toString()); | |
| 1075 | + long fcsj = Long.valueOf(m2.get("fcsj").toString()); | |
| 1080 | 1076 | if(fcsj > zdsj) |
| 1081 | 1077 | zdsj += 1440l; |
| 1082 | 1078 | if(sfqr == 1 && time1 > fcsj){ |
| ... | ... | @@ -1087,7 +1083,22 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1087 | 1083 | sjyssj += zdsj - fcsj; |
| 1088 | 1084 | } |
| 1089 | 1085 | sjyssj1 += zdsj - fcsj; |
| 1090 | - sjlc += Double.valueOf(m.get("lc").toString()); | |
| 1086 | + sjlc += Double.valueOf(m2.get("lc").toString()); | |
| 1087 | + } | |
| 1088 | + if(i == 1 && m1.get("fcsj") != null && m1.get("zdsj") != null){ | |
| 1089 | + long zdsj = Long.valueOf(m1.get("zdsj").toString()); | |
| 1090 | + long fcsj = Long.valueOf(m1.get("fcsj").toString()); | |
| 1091 | + if(fcsj > zdsj) | |
| 1092 | + zdsj += 1440l; | |
| 1093 | + if(sfqr == 1 && time1 > fcsj){ | |
| 1094 | + sjyssj += zdsj - time1; | |
| 1095 | + }else if(sfqr == 1 && time2 < zdsj){ | |
| 1096 | + sjyssj += time2 - fcsj; | |
| 1097 | + }else{ | |
| 1098 | + sjyssj += zdsj - fcsj; | |
| 1099 | + } | |
| 1100 | + sjyssj1 += zdsj - fcsj; | |
| 1101 | + sjlc += Double.valueOf(m1.get("lc").toString()); | |
| 1091 | 1102 | } |
| 1092 | 1103 | } |
| 1093 | 1104 | tempMap.put("company", companyName); |
| ... | ... | @@ -1834,7 +1845,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1834 | 1845 | } |
| 1835 | 1846 | try { |
| 1836 | 1847 | |
| 1837 | - String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"' and fcsj_actual is not null"; | |
| 1848 | + String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d')" | |
| 1849 | + + " >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"; | |
| 1838 | 1850 | if(line.length() != 0){ |
| 1839 | 1851 | sql += " and xl_bm = '"+line+"'"; |
| 1840 | 1852 | } |
| ... | ... | @@ -1861,6 +1873,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1861 | 1873 | public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 1862 | 1874 | ScheduleRealInfo schedule = new ScheduleRealInfo(); |
| 1863 | 1875 | schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); |
| 1876 | + schedule.setXlBm(rs.getString("xl_bm")); | |
| 1864 | 1877 | schedule.setXlName(rs.getString("xl_name")); |
| 1865 | 1878 | schedule.setLpName(rs.getString("lp_name")); |
| 1866 | 1879 | schedule.setBcType(rs.getString("bc_type")); |
| ... | ... | @@ -1914,7 +1927,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1914 | 1927 | for(ScheduleRealInfo schedule : list){ |
| 1915 | 1928 | if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) |
| 1916 | 1929 | continue; |
| 1917 | - String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlName(); | |
| 1930 | + String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlBm(); | |
| 1918 | 1931 | if(!keyMap.containsKey(key)) |
| 1919 | 1932 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 1920 | 1933 | keyMap.get(key).add(schedule); |
| ... | ... | @@ -1925,8 +1938,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1925 | 1938 | int sjbc = 0, sddf = 0, zddf = 0, |
| 1926 | 1939 | dxtz = 0, lbtz = 0; |
| 1927 | 1940 | for(ScheduleRealInfo schedule : keyMap.get(key)){ |
| 1941 | + boolean flag = false; | |
| 1928 | 1942 | if(schedule.getFcsjActual() != null && schedule.getStatus() != -1){ |
| 1929 | - boolean flag = false; | |
| 1930 | 1943 | sjbc++; |
| 1931 | 1944 | if(schedule.getDfsj() != null && !schedule.getDfsj().equals(schedule.getFcsj())){ |
| 1932 | 1945 | flag = true; |
| ... | ... | @@ -1935,17 +1948,16 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1935 | 1948 | zddf++; |
| 1936 | 1949 | else |
| 1937 | 1950 | sddf++; |
| 1938 | - }else if(!schedule.isOnline()){ | |
| 1939 | - flag = true; | |
| 1940 | - schedule.setRemarks("掉线调整"); | |
| 1941 | - dxtz++; | |
| 1942 | - }else if(schedule.getStatus() == 2){ | |
| 1943 | - flag = true; | |
| 1944 | - lbtz++; | |
| 1945 | 1951 | } |
| 1946 | - if(flag) | |
| 1947 | - tempList.add(schedule); | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + } | |
| 1955 | + if(schedule.getStatus() == -1){ | |
| 1956 | + flag = true; | |
| 1957 | + lbtz++; | |
| 1948 | 1958 | } |
| 1959 | + if(flag) | |
| 1960 | + tempList.add(schedule); | |
| 1949 | 1961 | } |
| 1950 | 1962 | tempMap.put("date", date); |
| 1951 | 1963 | String[] keys = key.split("/"); |
| ... | ... | @@ -1956,22 +1968,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1956 | 1968 | tempMap.put("sddf", sddf); |
| 1957 | 1969 | tempMap.put("zddf", zddf); |
| 1958 | 1970 | tempMap.put("dfhj", sddf + zddf); |
| 1959 | - tempMap.put("dxtz", dxtz); | |
| 1971 | +// tempMap.put("dxtz", dxtz); | |
| 1960 | 1972 | tempMap.put("lbtz", lbtz); |
| 1961 | - tempMap.put("correct", sddf + zddf + dxtz + lbtz); | |
| 1973 | + tempMap.put("correct", sddf + zddf + lbtz); | |
| 1962 | 1974 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 1963 | - tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); | |
| 1975 | +// tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); | |
| 1964 | 1976 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 1965 | - tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | |
| 1966 | - tempMap.put("workList", tempList); | |
| 1977 | +// tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | |
| 1978 | +// tempMap.put("workList", tempList); | |
| 1967 | 1979 | |
| 1968 | 1980 | String key0 = keys[0] + "/" + keys[1]; |
| 1969 | - if(!keyMap0.containsKey(key0)) | |
| 1970 | - keyMap0.put(key0, new ArrayList<Map<String, Object>>()); | |
| 1971 | - keyMap0.get(key0).add(tempMap); | |
| 1981 | + /*if(!keyMap0.containsKey(key0)) | |
| 1982 | + keyMap0.put(key0, new ArrayList<Map<String, Object>>());*/ | |
| 1983 | +// keyMap0.get(key0).add(tempMap); | |
| 1984 | + resList.add(tempMap); | |
| 1972 | 1985 | } |
| 1973 | 1986 | |
| 1974 | - for(String key : keyMap0.keySet()){ | |
| 1987 | + /*for(String key : keyMap0.keySet()){ | |
| 1975 | 1988 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1976 | 1989 | int sjbc = 0, sddf = 0, zddf = 0, |
| 1977 | 1990 | dxtz = 0, lbtz = 0; |
| ... | ... | @@ -1979,7 +1992,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1979 | 1992 | sjbc += (int)m.get("sjbc"); |
| 1980 | 1993 | sddf += (int)m.get("sddf"); |
| 1981 | 1994 | zddf += (int)m.get("zddf"); |
| 1982 | - dxtz += (int)m.get("dxtz"); | |
| 1995 | +// dxtz += (int)m.get("dxtz"); | |
| 1983 | 1996 | lbtz += (int)m.get("lbtz"); |
| 1984 | 1997 | } |
| 1985 | 1998 | tempMap.put("date", date); |
| ... | ... | @@ -1991,22 +2004,22 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1991 | 2004 | tempMap.put("sddf", sddf); |
| 1992 | 2005 | tempMap.put("zddf", zddf); |
| 1993 | 2006 | tempMap.put("dfhj", sddf + zddf); |
| 1994 | - tempMap.put("dxtz", dxtz); | |
| 2007 | +// tempMap.put("dxtz", dxtz); | |
| 1995 | 2008 | tempMap.put("lbtz", lbtz); |
| 1996 | 2009 | tempMap.put("correct", sddf + zddf + dxtz + lbtz); |
| 1997 | 2010 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 1998 | 2011 | tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); |
| 1999 | 2012 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 2000 | 2013 | tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); |
| 2001 | - tempMap.put("workList", keyMap0.get(key)); | |
| 2014 | +// tempMap.put("workList", keyMap0.get(key)); | |
| 2002 | 2015 | |
| 2003 | 2016 | String key1 = keys[0]; |
| 2004 | 2017 | if(!keyMap1.containsKey(key1)) |
| 2005 | 2018 | keyMap1.put(key1, new ArrayList<Map<String, Object>>()); |
| 2006 | 2019 | keyMap1.get(key1).add(tempMap); |
| 2007 | - } | |
| 2020 | + }*/ | |
| 2008 | 2021 | |
| 2009 | - for(String key : keyMap1.keySet()){ | |
| 2022 | + /*for(String key : keyMap1.keySet()){ | |
| 2010 | 2023 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 2011 | 2024 | int sjbc = 0, sddf = 0, zddf = 0, |
| 2012 | 2025 | dxtz = 0, lbtz = 0, lines = 0; |
| ... | ... | @@ -2014,7 +2027,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2014 | 2027 | sjbc += (int)m.get("sjbc"); |
| 2015 | 2028 | sddf += (int)m.get("sddf"); |
| 2016 | 2029 | zddf += (int)m.get("zddf"); |
| 2017 | - dxtz += (int)m.get("dxtz"); | |
| 2030 | +// dxtz += (int)m.get("dxtz"); | |
| 2018 | 2031 | lbtz += (int)m.get("lbtz"); |
| 2019 | 2032 | lines += (int)m.get("lines"); |
| 2020 | 2033 | } |
| ... | ... | @@ -2025,17 +2038,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2025 | 2038 | tempMap.put("sddf", sddf); |
| 2026 | 2039 | tempMap.put("zddf", zddf); |
| 2027 | 2040 | tempMap.put("dfhj", sddf + zddf); |
| 2028 | - tempMap.put("dxtz", dxtz); | |
| 2041 | +// tempMap.put("dxtz", dxtz); | |
| 2029 | 2042 | tempMap.put("lbtz", lbtz); |
| 2030 | 2043 | tempMap.put("correct", sddf + zddf + dxtz + lbtz); |
| 2031 | 2044 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 2032 | 2045 | tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); |
| 2033 | 2046 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 2034 | 2047 | tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); |
| 2035 | - tempMap.put("workList", keyMap1.get(key)); | |
| 2048 | +// tempMap.put("workList", keyMap1.get(key)); | |
| 2036 | 2049 | |
| 2037 | 2050 | resList.add(tempMap); |
| 2038 | - } | |
| 2051 | + }*/ | |
| 2039 | 2052 | |
| 2040 | 2053 | if(resList.size() != 0){ |
| 2041 | 2054 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| ... | ... | @@ -2045,10 +2058,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2045 | 2058 | sjbc += (int)m.get("sjbc"); |
| 2046 | 2059 | sddf += (int)m.get("sddf"); |
| 2047 | 2060 | zddf += (int)m.get("zddf"); |
| 2048 | - dxtz += (int)m.get("dxtz"); | |
| 2061 | +// dxtz += (int)m.get("dxtz"); | |
| 2049 | 2062 | lbtz += (int)m.get("lbtz"); |
| 2050 | - lines += (int)m.get("lines"); | |
| 2051 | - for(Map<String, Object> m0 : (List<Map<String, Object>>)m.get("workList")){ | |
| 2063 | +// lines += (int)m.get("lines"); | |
| 2064 | + /*for(Map<String, Object> m0 : (List<Map<String, Object>>)m.get("workList")){ | |
| 2052 | 2065 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 2053 | 2066 | temp.put("date", "合计"); |
| 2054 | 2067 | temp.put("lines", m0.get("lines")); |
| ... | ... | @@ -2056,15 +2069,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2056 | 2069 | temp.put("sddf", m0.get("sddf")); |
| 2057 | 2070 | temp.put("zddf", m0.get("zddf")); |
| 2058 | 2071 | temp.put("dfhj", m0.get("dfhj")); |
| 2059 | - temp.put("dxtz", m0.get("dxtz")); | |
| 2072 | +// temp.put("dxtz", m0.get("dxtz")); | |
| 2060 | 2073 | temp.put("lbtz", m0.get("lbtz")); |
| 2061 | 2074 | temp.put("correct", m0.get("correct")); |
| 2062 | 2075 | temp.put("dfbl", m0.get("dfbl")); |
| 2063 | 2076 | temp.put("dxbl", m0.get("dxbl")); |
| 2064 | 2077 | temp.put("lbbl", m0.get("lbbl")); |
| 2065 | 2078 | temp.put("correctbl", m0.get("correctbl")); |
| 2066 | - ((List<Map<String, Object>>)m0.get("workList")).add(temp); | |
| 2067 | - } | |
| 2079 | +// ((List<Map<String, Object>>)m0.get("workList")).add(temp); | |
| 2080 | + }*/ | |
| 2068 | 2081 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 2069 | 2082 | temp.put("date", "合计"); |
| 2070 | 2083 | temp.put("lines", m.get("lines")); |
| ... | ... | @@ -2072,14 +2085,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2072 | 2085 | temp.put("sddf", m.get("sddf")); |
| 2073 | 2086 | temp.put("zddf", m.get("zddf")); |
| 2074 | 2087 | temp.put("dfhj", m.get("dfhj")); |
| 2075 | - temp.put("dxtz", m.get("dxtz")); | |
| 2088 | +// temp.put("dxtz", m.get("dxtz")); | |
| 2076 | 2089 | temp.put("lbtz", m.get("lbtz")); |
| 2077 | 2090 | temp.put("correct", m.get("correct")); |
| 2078 | 2091 | temp.put("dfbl", m.get("dfbl")); |
| 2079 | 2092 | temp.put("dxbl", m.get("dxbl")); |
| 2080 | 2093 | temp.put("lbbl", m.get("lbbl")); |
| 2081 | - temp.put("correctbl", m.get("correctbl")); | |
| 2082 | - ((List<Map<String, Object>>)m.get("workList")).add(temp); | |
| 2094 | +// temp.put("correctbl", m.get("correctbl")); | |
| 2095 | +// ((List<Map<String, Object>>)m.get("workList")).add(temp); | |
| 2083 | 2096 | } |
| 2084 | 2097 | tempMap.put("date", "合计"); |
| 2085 | 2098 | tempMap.put("lines", lines); |
| ... | ... | @@ -2087,16 +2100,99 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2087 | 2100 | tempMap.put("sddf", sddf); |
| 2088 | 2101 | tempMap.put("zddf", zddf); |
| 2089 | 2102 | tempMap.put("dfhj", sddf + zddf); |
| 2090 | - tempMap.put("dxtz", dxtz); | |
| 2103 | +// tempMap.put("dxtz", dxtz); | |
| 2091 | 2104 | tempMap.put("lbtz", lbtz); |
| 2092 | - tempMap.put("correct", sddf + zddf + dxtz + lbtz); | |
| 2105 | + tempMap.put("correct", sddf + zddf + lbtz); | |
| 2093 | 2106 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 2094 | - tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); | |
| 2107 | + | |
| 2095 | 2108 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 2096 | - tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | |
| 2109 | +// tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | |
| 2097 | 2110 | resList.add(tempMap); |
| 2098 | 2111 | } |
| 2099 | - | |
| 2112 | + //计算掉线调整 | |
| 2113 | + String sqldot = "select * from " | |
| 2114 | + + "logger_sch_modify where gsbm =? and fgsbm=? and rq BETWEEN ? and ? order by line_code,sch_id"; | |
| 2115 | + | |
| 2116 | + ; | |
| 2117 | + List<SchEditInfoDto> listDot = jdbcTemplate.query(sqldot, | |
| 2118 | + new BeanPropertyRowMapper(SchEditInfoDto.class),company,subCompany,map.get("startDate").toString(),map.get("endDate").toString()); | |
| 2119 | + int dxtzz=0; | |
| 2120 | + Map<String, Object> mapSchId=new HashMap<String,Object>(); | |
| 2121 | + for (int i = 0; i < resList.size(); i++) { | |
| 2122 | + Map<String, Object> resMap=resList.get(i); | |
| 2123 | + String date_1=resMap.get("date").toString(); | |
| 2124 | + int sjbc=Integer.parseInt(resMap.get("sjbc").toString()); | |
| 2125 | + int correct=Integer.parseInt(resMap.get("correct").toString()); | |
| 2126 | + | |
| 2127 | + if(date_1.equals("合计")){ | |
| 2128 | + resMap.put("dxtz", dxtzz); | |
| 2129 | + resMap.put("correct",correct+dxtzz); | |
| 2130 | + if(sjbc<=0){ | |
| 2131 | + resMap.put("dxbl", "0"); | |
| 2132 | + resMap.put("correctbl", "0"); | |
| 2133 | + }else{ | |
| 2134 | + resMap.put("dxbl", df.format((double)(dxtzz)/sjbc*100) + "%"); | |
| 2135 | + resMap.put("correctbl", df.format((double)(correct+dxtzz)/sjbc*100) + "%"); | |
| 2136 | + } | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + }else{ | |
| 2140 | + String xlbm=resMap.get("line").toString(); | |
| 2141 | + int dxtzf=0; | |
| 2142 | + for (int j = 0; j < listDot.size(); j++) { | |
| 2143 | + SchEditInfoDto seid=listDot.get(j); | |
| 2144 | + if(seid.getLineCode().equals(xlbm)){ | |
| 2145 | + String jstype=seid.getType(); | |
| 2146 | + String json=""; | |
| 2147 | + if(seid.getJsonArray()!=null){ | |
| 2148 | + json =seid.getJsonArray().toString(); | |
| 2149 | + } | |
| 2150 | + if(!json.equals("")){ | |
| 2151 | + if(jstype.equals("FCXXWT")){ | |
| 2152 | + JSONArray jsonArray = JSONArray.parseArray(json); | |
| 2153 | + for (int x = 0; x < jsonArray.size(); x++) { | |
| 2154 | + Map<String, Object> jsonObject=jsonArray.getJSONObject(x); | |
| 2155 | + String title=jsonObject.get("title")==null?"":jsonObject.get("title").toString(); | |
| 2156 | + if(mapSchId.get(String.valueOf(seid.getSchId()))==null){ | |
| 2157 | + if(title.equals("调整实发时间") || title.equals("调整实达时间")){ | |
| 2158 | + if(jsonObject.get("old")==null){ | |
| 2159 | + dxtzf++; | |
| 2160 | + dxtzz++; | |
| 2161 | + mapSchId.put(String.valueOf(seid.getSchId()), seid.getSchId()); | |
| 2162 | + } | |
| 2163 | + } | |
| 2164 | + } | |
| 2165 | + | |
| 2166 | + } | |
| 2167 | + } | |
| 2168 | + if(jstype.equals("SFTZ")){ | |
| 2169 | + Gson gson = new Gson(); | |
| 2170 | + Map<String, Object> map_js = new HashMap<String, Object>(); | |
| 2171 | + map_js = gson.fromJson(json, map.getClass()); | |
| 2172 | + if(mapSchId.get(String.valueOf(seid.getSchId()))==null){ | |
| 2173 | + if(map_js.get("old")==null){ | |
| 2174 | + dxtzf++; | |
| 2175 | + dxtzz++; | |
| 2176 | + mapSchId.put(String.valueOf(seid.getSchId()), seid.getSchId()); | |
| 2177 | + } | |
| 2178 | + } | |
| 2179 | + } | |
| 2180 | + } | |
| 2181 | + } | |
| 2182 | + } | |
| 2183 | + resMap.put("dxtz", dxtzf); | |
| 2184 | + resMap.put("correct",correct+dxtzf); | |
| 2185 | + if(sjbc<=0){ | |
| 2186 | + resMap.put("dxbl", "0"); | |
| 2187 | + resMap.put("correctbl", "0"); | |
| 2188 | + }else{ | |
| 2189 | + resMap.put("dxbl", df.format((double)(dxtzf)/sjbc*100) + "%"); | |
| 2190 | + resMap.put("correctbl", df.format((double)(correct+dxtzf)/sjbc*100) + "%"); | |
| 2191 | + } | |
| 2192 | + resMap.put("xlname",BasicData.lineCode2NameMap.get(xlbm)); | |
| 2193 | + } | |
| 2194 | + } | |
| 2195 | + | |
| 2100 | 2196 | return resList; |
| 2101 | 2197 | } |
| 2102 | 2198 | ... | ... |
src/main/resources/static/pages/forms/statement/correctStatis.html
| ... | ... | @@ -261,13 +261,12 @@ |
| 261 | 261 | // $(".hidden").removeClass("hidden"); |
| 262 | 262 | $get('/busInterval/correctStatis', params, function(result){ |
| 263 | 263 | // 把数据填充到模版中 |
| 264 | -// var tbodyHtml = template('list_company',{list:result, type:1}); | |
| 265 | - var tbodyHtml = ""; | |
| 266 | - if(result.length != 0){ | |
| 264 | + var tbodyHtml = template('list_company',{list:result});; | |
| 265 | + /* if(result.length != 0){ | |
| 267 | 266 | tbodyHtml = template('list_company',{list:result[0].workList[0].workList, type:3}); |
| 268 | 267 | }else{ |
| 269 | 268 | tbodyHtml = template('list_company',{list:result, type:3}); |
| 270 | - } | |
| 269 | + } */ | |
| 271 | 270 | |
| 272 | 271 | // 把渲染好的模版html文本追加到表格中 |
| 273 | 272 | // $('#forms').html(tbodyHtml); |
| ... | ... | @@ -281,7 +280,7 @@ |
| 281 | 280 | }); |
| 282 | 281 | } |
| 283 | 282 | |
| 284 | - $("#forms").on("click","tbody tr",function(){ | |
| 283 | + /* $("#forms").on("click","tbody tr",function(){ | |
| 285 | 284 | if($(this).children().size() < 2){ |
| 286 | 285 | return; |
| 287 | 286 | } |
| ... | ... | @@ -299,9 +298,9 @@ |
| 299 | 298 | subCompany = g.workList; |
| 300 | 299 | } |
| 301 | 300 | }); |
| 302 | - }); | |
| 301 | + }); */ | |
| 303 | 302 | |
| 304 | - $("#subinfo").on("click","tbody tr",function(){ | |
| 303 | + /* $("#subinfo").on("click","tbody tr",function(){ | |
| 305 | 304 | if($(this).children().size() < 2){ |
| 306 | 305 | return; |
| 307 | 306 | } |
| ... | ... | @@ -318,9 +317,9 @@ |
| 318 | 317 | lines = g.workList; |
| 319 | 318 | } |
| 320 | 319 | }); |
| 321 | - }); | |
| 320 | + }); */ | |
| 322 | 321 | |
| 323 | - $("#lineinfo").on("click","tbody tr",function(){ | |
| 322 | + /* $("#lineinfo").on("click","tbody tr",function(){ | |
| 324 | 323 | if($(this).children().size() < 2){ |
| 325 | 324 | return; |
| 326 | 325 | } |
| ... | ... | @@ -328,13 +327,13 @@ |
| 328 | 327 | $(this).children().each(function(index){ |
| 329 | 328 | params[index] = $(this).text(); |
| 330 | 329 | }); |
| 331 | - $.each(lines, function(i, g){ | |
| 330 | + $.each(lines, function(i, g){ | |
| 332 | 331 | if(g.company == params[1] && g.subCompany == params[2] && g.line == params[3]){ |
| 333 | 332 | var tbodyHtml = template('list_workList',{list:g.workList}); |
| 334 | 333 | $("#lines").html(tbodyHtml); |
| 335 | 334 | } |
| 336 | - }); | |
| 337 | - }); | |
| 335 | + }); | |
| 336 | + }); */ | |
| 338 | 337 | |
| 339 | 338 | // $("#export").on("click", function(){ |
| 340 | 339 | // $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ |
| ... | ... | @@ -381,9 +380,8 @@ |
| 381 | 380 | <th class="hidden"></th> |
| 382 | 381 | <th rowspan="2" width="120px">日期</th> |
| 383 | 382 | <th rowspan="2">公司</th> |
| 384 | - {{if type>1}}<th rowspan="2">分公司</th>{{/if}} | |
| 385 | - {{if type<3}}<th rowspan="2">线路条数</th>{{/if}} | |
| 386 | - {{if type==3}}<th rowspan="2">线路</th>{{/if}} | |
| 383 | + <th rowspan="2">分公司</th> | |
| 384 | + <th rowspan="2">线路</th> | |
| 387 | 385 | <th rowspan="2">实际营运班次</th> |
| 388 | 386 | <th colspan="3" align="center">待发调整数</th> |
| 389 | 387 | <th rowspan="2">掉线调整数</th> |
| ... | ... | @@ -405,18 +403,15 @@ |
| 405 | 403 | {{each list as obj i}} |
| 406 | 404 | <tr> |
| 407 | 405 | {{if obj.date=='合计'}} |
| 408 | - {{if type==1}}<td colspan="2">{{obj.date}}</td>{{/if}} | |
| 409 | - {{if type==2}}<td colspan="3">{{obj.date}}</td>{{/if}} | |
| 410 | - {{if type==3}}<td colspan="4">{{obj.date}}</td>{{/if}} | |
| 406 | + | |
| 407 | + <td colspan="4">{{obj.date}}</td> | |
| 411 | 408 | {{/if}} |
| 412 | 409 | {{if obj.date!='合计'}} |
| 413 | 410 | <td>{{obj.date}}</td> |
| 414 | - | |
| 415 | - {{/if}} | |
| 416 | - {{if obj.date!='合计'}}<td>{{obj.company}}</td>{{/if}} | |
| 417 | - {{if type>1 && obj.date!='合计'}}<td>{{obj.subCompany}}</td>{{/if}} | |
| 418 | - {{if type<3}}<td>{{obj.lines}}</td>{{/if}} | |
| 419 | - {{if type==3 && obj.date!='合计'}}<td>{{obj.line}}</td>{{/if}} | |
| 411 | + <td>{{obj.company}}</td> | |
| 412 | + <td>{{obj.subCompany}}</td> | |
| 413 | + <td>{{obj.xlname}}</td> | |
| 414 | + {{/if}} | |
| 420 | 415 | <td>{{obj.sjbc}}</td> |
| 421 | 416 | <td>{{obj.sddf}}</td> |
| 422 | 417 | <td>{{obj.zddf}}</td> |
| ... | ... | @@ -432,7 +427,7 @@ |
| 432 | 427 | {{/each}} |
| 433 | 428 | {{if list.length == 0}} |
| 434 | 429 | <tr> |
| 435 | - <td colspan="15"><h6 class="muted">没有找到相关数据</h6></td> | |
| 430 | + <td colspan="14"><h6 class="muted">没有找到相关数据</h6></td> | |
| 436 | 431 | </tr> |
| 437 | 432 | {{/if}} |
| 438 | 433 | </tbody> | ... | ... |