Commit 86469c3a137fbefdbf66cb79633f19dfbe951978

Authored by 娄高锋
1 parent f81f2e33

改掉拼接sql

src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -47,7 +47,6 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; @@ -47,7 +47,6 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
47 import com.bsth.service.BusIntervalService; 47 import com.bsth.service.BusIntervalService;
48 import com.bsth.service.LineService; 48 import com.bsth.service.LineService;
49 import com.bsth.service.report.CulateMileageService; 49 import com.bsth.service.report.CulateMileageService;
50 -import com.bsth.service.schedule.PeopleCarPlanService;  
51 import com.bsth.service.sys.DictionaryService; 50 import com.bsth.service.sys.DictionaryService;
52 import com.bsth.service.sys.DutyEmployeeService; 51 import com.bsth.service.sys.DutyEmployeeService;
53 import com.bsth.util.Arith; 52 import com.bsth.util.Arith;
@@ -69,9 +68,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -69,9 +68,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
69 CulateMileageService culateService; 68 CulateMileageService culateService;
70 69
71 @Autowired 70 @Autowired
72 - private PeopleCarPlanService peopleCarPlanService;  
73 -  
74 - @Autowired  
75 private ScheduleRealInfoRepository scheduleRealInfoRepository; 71 private ScheduleRealInfoRepository scheduleRealInfoRepository;
76 72
77 @Autowired 73 @Autowired
@@ -103,33 +99,47 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -103,33 +99,47 @@ public class BusIntervalServiceImpl implements BusIntervalService {
103 99
104 try { 100 try {
105 101
106 - String sql = "select * from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'"; 102 + List<String> objList = new ArrayList<String>();
  103 + String sql = "select * from bsth_c_s_sp_info_real where " +
  104 + "schedule_date_str >= ? and schedule_date_str <= ? " +
  105 + "and fcsj >= ? and fcsj <= ? and gs_bm like ? and fgs_bm like ? " +
  106 + "and bc_type != ? and bc_type != ? and bc_type != ?";
107 if(line.length() != 0){ 107 if(line.length() != 0){
108 - sql += " and xl_bm = '"+line+"'";  
109 - }  
110 - if(times.length() != 0){  
111 - String[] split = times.split("-");  
112 - String[] split0 = split[0].split(":");  
113 - String[] split1 = split[1].split(":");  
114 - int time0 = Integer.valueOf(split0[0])*60 + Integer.valueOf(split0[1]);  
115 - int time1 = Integer.valueOf(split1[0])*60 + Integer.valueOf(split1[1]);  
116 - if(time1 > time0){  
117 - sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'";  
118 - } else {  
119 - sql += " and (fcsj >= '"+split[0]+"' or fcsj <= '"+split[1]+"')";  
120 - }  
121 - }  
122 - if(company.length() != 0){  
123 - sql += " and gs_bm = '"+company+"'"; 108 + sql = "select * from bsth_c_s_sp_info_real where xl_bm = ? " +
  109 + "and schedule_date_str >= ? and schedule_date_str <= ? " +
  110 + "and fcsj >= ? and fcsj <= ? and gs_bm like ? and fgs_bm like ? " +
  111 + "and bc_type != ? and bc_type != ? and bc_type != ?";
  112 + objList.add(line);
  113 + }
  114 + objList.add(startDate);
  115 + objList.add(endDate);
  116 +
  117 + String[] split = times.split("-");
  118 + if(split[0].length() > 0){
  119 + objList.add(split[0]);
  120 + } else {
  121 + objList.add("");
124 } 122 }
125 - if(subCompany.length() != 0){  
126 - sql += " and fgs_bm = '"+subCompany+"'"; 123 + if(split.length > 1 && split[1].length() > 0){
  124 + objList.add(split[1]);
  125 + } else {
  126 + objList.add("23:59");
127 } 127 }
  128 +
  129 + objList.add("%" + company + "%");
  130 + objList.add("%" + subCompany + "%");
  131 +
128 if(normal){ 132 if(normal){
129 - sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; 133 + objList.add("in");
  134 + objList.add("out");
  135 + objList.add("ldks");
  136 + } else {
  137 + objList.add("");
  138 + objList.add("");
  139 + objList.add("");
130 } 140 }
131 -  
132 - list = jdbcTemplate.query(sql, 141 +
  142 + list = jdbcTemplate.query(sql, objList.toArray(new Object[objList.size()]),
133 new RowMapper<ScheduleRealInfo>(){ 143 new RowMapper<ScheduleRealInfo>(){
134 @Override 144 @Override
135 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { 145 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -225,14 +235,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -225,14 +235,11 @@ public class BusIntervalServiceImpl implements BusIntervalService {
225 }); 235 });
226 236
227 if(model.length() != 0){ 237 if(model.length() != 0){
228 -// sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type != 'in' and bc_type != 'out'";  
229 - sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out'" +  
230 - " and bc_type != 'ldks' and schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'";  
231 - if(line.length() != 0){  
232 - sql += " and xl_bm = '"+line+"'";  
233 - } 238 + sql = "select id from bsth_c_s_sp_info where tt_info = ?" +
  239 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'" +
  240 + " and schedule_date >= ? and schedule_date <= ? and xl_bm = ?";
234 241
235 - ttList = jdbcTemplate.query(sql, 242 + ttList = jdbcTemplate.query(sql, new Object[]{model, startDate, endDate, line},
236 new RowMapper<Long>(){ 243 new RowMapper<Long>(){
237 @Override 244 @Override
238 public Long mapRow(ResultSet rs, int rowNum) throws SQLException { 245 public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -308,15 +315,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -308,15 +315,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
308 315
309 String sql = "select id,cc_id,mileage_type,destroy,destroy_reason," + 316 String sql = "select id,cc_id,mileage_type,destroy,destroy_reason," +
310 " mileage,type1,type2,schedule from bsth_c_s_child_task" + 317 " mileage,type1,type2,schedule from bsth_c_s_child_task" +
311 - " where 1=1";  
312 - if(schedule1 != null && schedule1 >= 0){  
313 - sql += " and schedule >= '"+schedule1+"'";  
314 - }  
315 - if(schedule2 != null && schedule2 >= 0){  
316 - sql += " and schedule <= '"+schedule2+"'";  
317 - } 318 + " where schedule >= ? and schedule <= ?";
318 319
319 - list = jdbcTemplate.query(sql, 320 + list = jdbcTemplate.query(sql, new Object[]{schedule1, schedule2},
320 new RowMapper<ChildTaskPlan>(){ 321 new RowMapper<ChildTaskPlan>(){
321 @Override 322 @Override
322 public ChildTaskPlan mapRow(ResultSet rs, int rowNum) throws SQLException { 323 public ChildTaskPlan mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -358,9 +359,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -358,9 +359,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
358 359
359 try { 360 try {
360 361
361 - String sql = "select start_station_name, end_station_name from bsth_c_line where line_code = '"+line+"'"; 362 + String sql = "select start_station_name, end_station_name from bsth_c_line where line_code = ?";
362 363
363 - list = jdbcTemplate.query(sql, 364 + list = jdbcTemplate.query(sql, new Object[]{line},
364 new RowMapper<Map<String, Object>>(){ 365 new RowMapper<Map<String, Object>>(){
365 @Override 366 @Override
366 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 367 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -393,19 +394,16 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -393,19 +394,16 @@ public class BusIntervalServiceImpl implements BusIntervalService {
393 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); 394 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
394 395
395 String line = map.get("line").toString(); 396 String line = map.get("line").toString();
396 - String ttId = map.get("ttId").toString(); 397 +// String ttId = map.get("ttId").toString();
397 398
398 try { 399 try {
399 - String sql = "select td.lp, lp.lp_name from bsth_c_s_ttinfo_detail td" +  
400 - " left join bsth_c_s_gbi lp on td.lp = lp.id" +  
401 - " left join bsth_c_line cl on cl.id = td.xl where 1=1";  
402 - if(line.length() != 0)  
403 - sql += " and cl.line_code = '"+line+"'";  
404 - if(ttId.length() != 0)  
405 - sql += " and td.ttinfo = '"+ttId+"'";  
406 - sql += " group by td.lp, lp.lp_name";  
407 400
408 - list = jdbcTemplate.query(sql, 401 + String sql = "select td.lp, lp.lp_name from bsth_c_line cl" +
  402 + " left join bsth_c_s_ttinfo_detail td on cl.id = td.xl" +
  403 + " left join bsth_c_s_gbi lp on td.lp = lp.id where" +
  404 + " cl.line_code = ? group by td.lp, lp.lp_name";
  405 +
  406 + list = jdbcTemplate.query(sql, new Object[]{line},
409 new RowMapper<Map<String, Object>>(){ 407 new RowMapper<Map<String, Object>>(){
410 @Override 408 @Override
411 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 409 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -804,31 +802,36 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -804,31 +802,36 @@ public class BusIntervalServiceImpl implements BusIntervalService {
804 802
805 try { 803 try {
806 804
807 - String where = ""; 805 + List<String> strList = new ArrayList<String>();
  806 + strList.add(startDate);
  807 + strList.add(endDate);
808 if(line.length() != 0 && statu.equals("1")){ 808 if(line.length() != 0 && statu.equals("1")){
809 - where += " and xl_bm = '"+line+"'"; 809 + strList.add('%' + line + '%');
  810 + } else {
  811 + strList.add("%%");
810 } 812 }
811 if(lp.length() != 0 && statu.equals("1")){ 813 if(lp.length() != 0 && statu.equals("1")){
812 - where += " and lp_name = '"+lp+"'";  
813 - }  
814 - if(company.length() != 0){  
815 - where += " and gs_bm = '"+company+"'";  
816 - }  
817 - if(subCompany.length() != 0){  
818 - where += " and fgs_bm = '"+subCompany+"'"; 814 + strList.add('%' + lp + '%');
  815 + } else {
  816 + strList.add("%%");
819 } 817 }
  818 + strList.add('%' + company + '%');
  819 + strList.add('%' + subCompany + '%');
820 if(sfqr == 1){ 820 if(sfqr == 1){
821 - where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; 821 + strList.add(times1);
  822 + strList.add(times2);
  823 + } else {
  824 + strList.add("");
  825 + strList.add("23:59");
822 } 826 }
823 -// where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";  
824 - where += " and bc_type != 'ldks'";  
825 827
826 String sql = "select id, schedule_date_str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc, bc_type, xl_bm, fgs_bm," 828 String sql = "select id, schedule_date_str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc, bc_type, xl_bm, fgs_bm,"
827 + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id" 829 + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id"
828 - + " ,cc_service from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate+"'"  
829 - + " and schedule_date_str <= '"+endDate+"'"+where+""; 830 + + " ,cc_service from bsth_c_s_sp_info_real where schedule_date_str >= ? and schedule_date_str <= ?"
  831 + + " and xl_bm like ? and lp_name like ? and gs_bm like ? and fgs_bm like ? and zdsj >= ? and fcsj <= ?"
  832 + + " and bc_type != 'ldks'";
830 833
831 - list = jdbcTemplate.query(sql, 834 + List<ScheduleRealInfo> query = jdbcTemplate.query(sql, strList.toArray(),
832 new RowMapper<ScheduleRealInfo>(){ 835 new RowMapper<ScheduleRealInfo>(){
833 @Override 836 @Override
834 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { 837 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -904,27 +907,39 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -904,27 +907,39 @@ public class BusIntervalServiceImpl implements BusIntervalService {
904 return schedule; 907 return schedule;
905 } 908 }
906 }); 909 });
  910 +
  911 + for(ScheduleRealInfo s : query){
  912 + if(line.length() != 0 && statu.equals("1")){
  913 + if(!line.equals(s.getXlBm())){
  914 + continue;
  915 + }
  916 + }
  917 + if(lp.length() != 0 && statu.equals("1")){
  918 + if(!lp.equals(s.getLpName())){
  919 + continue;
  920 + }
  921 + }
  922 + list.add(s);
  923 + }
907 924
908 { 925 {
909 List<Map<String, String>> temp1 = new ArrayList<Map<String, String>>(); 926 List<Map<String, String>> temp1 = new ArrayList<Map<String, String>>();
910 List<Map<String, String>> temp2 = new ArrayList<Map<String, String>>(); 927 List<Map<String, String>> temp2 = new ArrayList<Map<String, String>>();
911 - sql = "select id, lp, fcsj, xl_bm, tt_info from bsth_c_s_sp_info where bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";  
912 -  
913 - if(startDate.equals(endDate)){  
914 - sql += " and schedule_date = '"+startDate+"'";  
915 - } else {  
916 - sql += " and schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'";  
917 - } 928 + List<String> strList1 = new ArrayList<String>();
  929 + strList1.add(startDate);
  930 + strList1.add(endDate);
918 if(line.length() != 0 && statu.equals("1")){ 931 if(line.length() != 0 && statu.equals("1")){
919 - sql += " and xl_bm = '"+line+"'";  
920 - }  
921 - if(company.length() != 0){  
922 - sql += " and gs_bm = '"+company+"'";  
923 - }  
924 - if(subCompany.length() != 0){  
925 - sql += " and fgs_bm = '"+subCompany+"'";  
926 - }  
927 - temp1 = jdbcTemplate.query(sql, 932 + strList1.add("%" + line + "%");
  933 + } else {
  934 + strList1.add("%%");
  935 + }
  936 + strList1.add("%" + company + "%");
  937 + strList1.add("%" + subCompany + "%");
  938 + sql = "select id, lp, fcsj, xl_bm, tt_info from bsth_c_s_sp_info" +
  939 + " where bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'" +
  940 + " and schedule_date >= ? and schedule_date <= ? and xl_bm like ?" +
  941 + " and gs_bm like ? and fgs_bm like ?";
  942 + List<Map<String, String>> query1 = jdbcTemplate.query(sql, strList1.toArray(),
928 new RowMapper<Map<String, String>>(){ 943 new RowMapper<Map<String, String>>(){
929 @Override 944 @Override
930 public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { 945 public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -937,13 +952,22 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -937,13 +952,22 @@ public class BusIntervalServiceImpl implements BusIntervalService {
937 return m; 952 return m;
938 } 953 }
939 }); 954 });
940 - sql = "select * from bsth_c_s_ttinfo_detail where ists = 1"  
941 - + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";  
942 -  
943 - if(line.length() != 0 && statu.equals("1")){  
944 - sql += " and xl = '"+line+"'"; 955 + for(Map<String, String> m : query1){
  956 + if(line.length() != 0 && statu.equals("1")){
  957 + if(!line.equals(m.get("xl_bm").toString())){
  958 + continue;
  959 + }
  960 + }
  961 + temp1.add(m);
945 } 962 }
946 - temp2 = jdbcTemplate.query(sql, 963 +
  964 + sql = "select id, lp, xl, fcsj, ttinfo from bsth_c_s_ttinfo_detail where ists = 1" +
  965 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'" +
  966 + " and xl like ?";
  967 +
  968 + List<Map<String, String>> query2 = jdbcTemplate.query(sql,
  969 + (line.length() != 0 && statu.equals("1"))?
  970 + new Object[]{"%" + line + "%"}:new Object[]{"%%"},
947 new RowMapper<Map<String, String>>(){ 971 new RowMapper<Map<String, String>>(){
948 @Override 972 @Override
949 public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { 973 public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -956,6 +980,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -956,6 +980,14 @@ public class BusIntervalServiceImpl implements BusIntervalService {
956 return m; 980 return m;
957 } 981 }
958 }); 982 });
  983 + for(Map<String, String> m : query2){
  984 + if(line.length() != 0 && statu.equals("1")){
  985 + if(!line.equals(m.get("xl").toString())){
  986 + continue;
  987 + }
  988 + }
  989 + temp2.add(m);
  990 + }
959 991
960 for(Map<String, String> m2 : temp2){ 992 for(Map<String, String> m2 : temp2){
961 for(Map<String, String> m1 : temp1){ 993 for(Map<String, String> m1 : temp1){
@@ -974,10 +1006,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -974,10 +1006,10 @@ public class BusIntervalServiceImpl implements BusIntervalService {
974 if(id1 == 0 || id1 > s.getId()) 1006 if(id1 == 0 || id1 > s.getId())
975 id1 = s.getId(); 1007 id1 = s.getId();
976 } 1008 }
977 - sql = "select destroy, start_date, end_date, mileage, mileage_type, schedule from bsth_c_s_child_task";  
978 - sql += " where id >= "+id1+" and id <= "+id2+" order by start_date"; 1009 + sql = "select destroy, start_date, end_date, mileage, mileage_type, schedule from bsth_c_s_child_task"
  1010 + + " where id >= ? and id <= ? order by start_date";
979 1011
980 - cList = jdbcTemplate.query(sql, 1012 + cList = jdbcTemplate.query(sql, new Object[]{id1, id2},
981 new RowMapper<ChildTaskPlan>(){ 1013 new RowMapper<ChildTaskPlan>(){
982 @Override 1014 @Override
983 public ChildTaskPlan mapRow(ResultSet rs, int rowNum) throws SQLException { 1015 public ChildTaskPlan mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -994,21 +1026,20 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -994,21 +1026,20 @@ public class BusIntervalServiceImpl implements BusIntervalService {
994 1026
995 if(model.length() != 0){ 1027 if(model.length() != 0){
996 sql = "select sp.id from " 1028 sql = "select sp.id from "
997 - + "(select id, tt_info, xl_bm, lp, fcsj from bsth_c_s_sp_info where schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'"  
998 - + " and tt_info = '" + model + "' and bc_type != 'ldks') sp" 1029 + + "(select id, tt_info, xl_bm, lp, fcsj from bsth_c_s_sp_info where schedule_date >= ? and schedule_date <= ?"
  1030 + + " and tt_info = ? and bc_type != 'ldks') sp"
999 + " 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"; 1031 + " 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";
1000 1032
1001 - ttList = jdbcTemplate.query(sql, 1033 + ttList = jdbcTemplate.query(sql, new Object[]{startDate, endDate, model},
1002 new RowMapper<Map<String, Object>>(){ 1034 new RowMapper<Map<String, Object>>(){
1003 @Override 1035 @Override
1004 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 1036 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1005 Map<String, Object> m = new HashMap<String, Object>(); 1037 Map<String, Object> m = new HashMap<String, Object>();
1006 m.put("id", rs.getString("id")); 1038 m.put("id", rs.getString("id"));
1007 -// m.put("ists", rs.getString("ists")!=null?rs.getString("ists"):"0");  
1008 return m; 1039 return m;
1009 } 1040 }
1010 }); 1041 });
1011 - 1042 +
1012 for(Map<String, Object> m : ttList){ 1043 for(Map<String, Object> m : ttList){
1013 ttSet.add(Long.valueOf(m.get("id").toString())); 1044 ttSet.add(Long.valueOf(m.get("id").toString()));
1014 } 1045 }
@@ -1071,15 +1102,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1071,15 +1102,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1071 keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 1102 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
1072 keyMap.get(key).add(schedule); 1103 keyMap.get(key).add(schedule);
1073 } 1104 }
1074 -// for(Map<String, Object> tt : ttList){  
1075 -// long id = Long.valueOf(tt.get("id").toString());  
1076 -// if(id == (long)schedule.getSpId()){  
1077 -// String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName();  
1078 -// if(!keyMap.containsKey(key))  
1079 -// keyMap.put(key, new ArrayList<ScheduleRealInfo>());  
1080 -// keyMap.get(key).add(schedule);  
1081 -// }  
1082 -// }  
1083 }else{ 1105 }else{
1084 if(!keyMap.containsKey(key)) 1106 if(!keyMap.containsKey(key))
1085 keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 1107 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
@@ -1087,7 +1109,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1087,7 +1109,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1087 } 1109 }
1088 } 1110 }
1089 1111
1090 - String companyName = "", subCompanyName = "";  
1091 for(String key : keyMap.keySet()){ 1112 for(String key : keyMap.keySet()){
1092 Map<String, Object> tempMap = new HashMap<String, Object>(); 1113 Map<String, Object> tempMap = new HashMap<String, Object>();
1093 Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>(); 1114 Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>();
@@ -1102,12 +1123,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1102,12 +1123,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1102 long jhyssj1 = 0, sjyssj1 = 0; 1123 long jhyssj1 = 0, sjyssj1 = 0;
1103 double jhlc = 0, sjlc = 0; 1124 double jhlc = 0, sjlc = 0;
1104 for(ScheduleRealInfo schedule : list2){ 1125 for(ScheduleRealInfo schedule : list2){
1105 - if(companyName.trim().length() == 0 && schedule.getGsName() != null){  
1106 - companyName = schedule.getGsName();  
1107 - }  
1108 - if(subCompanyName.trim().length() == 0 && schedule.getFgsName() != null){  
1109 - subCompanyName = schedule.getFgsName();  
1110 - }  
1111 long fcsj = schedule.getFcsjT(); 1126 long fcsj = schedule.getFcsjT();
1112 if(sortMap.containsKey(fcsj)){ 1127 if(sortMap.containsKey(fcsj)){
1113 if(sortMap.get(fcsj).getFcsjActual() != null) 1128 if(sortMap.get(fcsj).getFcsjActual() != null)
@@ -1275,8 +1290,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1275,8 +1290,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1275 } 1290 }
1276 } 1291 }
1277 String[] split = key.split("/"); 1292 String[] split = key.split("/");
1278 - tempMap.put("company", companyName);  
1279 - tempMap.put("subCompany", split[3]); 1293 + tempMap.put("company", BasicData.businessCodeNameMap.get(company));
  1294 + tempMap.put("subCompany", BasicData.businessFgsCodeNameMap.get(split[3] + "_" + company));
1280 tempMap.put("date", split[0]); 1295 tempMap.put("date", split[0]);
1281 tempMap.put("line", split[1]); 1296 tempMap.put("line", split[1]);
1282 tempMap.put("lp", split[2]); 1297 tempMap.put("lp", split[2]);
@@ -1442,7 +1457,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1442,7 +1457,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1442 String[] split = key.split("/"); 1457 String[] split = key.split("/");
1443 tempMap.put("line", split[0]); 1458 tempMap.put("line", split[0]);
1444 tempMap.put("lp", split[1]); 1459 tempMap.put("lp", split[1]);
1445 - tempMap.put("company", companyName); 1460 + tempMap.put("company", BasicData.businessCodeNameMap.get(company));
1446 tempMap.put("subCompany", split[2]); 1461 tempMap.put("subCompany", split[2]);
1447 tempMap.put("date", date); 1462 tempMap.put("date", date);
1448 list4.add(tempMap); 1463 list4.add(tempMap);
@@ -1489,7 +1504,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1489,7 +1504,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1489 String[] split = key.split("/"); 1504 String[] split = key.split("/");
1490 tempMap.put("line", split[0]); 1505 tempMap.put("line", split[0]);
1491 tempMap.put("lp", keyMap4.get(key).size()); 1506 tempMap.put("lp", keyMap4.get(key).size());
1492 - tempMap.put("company", companyName); 1507 + tempMap.put("company", BasicData.businessCodeNameMap.get(company));
1493 tempMap.put("subCompany", split[1]); 1508 tempMap.put("subCompany", split[1]);
1494 tempMap.put("date", date); 1509 tempMap.put("date", date);
1495 tempMap.put("work", keyMap4.get(key)); 1510 tempMap.put("work", keyMap4.get(key));
@@ -1526,8 +1541,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1526,8 +1541,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1526 modelMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP)); 1541 modelMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP));
1527 modelMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP)); 1542 modelMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP));
1528 modelMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP)); 1543 modelMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP));
1529 - modelMap.put("company", companyName);  
1530 - modelMap.put("subCompany", subCompanyName);  
1531 modelMap.put("dataList", dataList); 1544 modelMap.put("dataList", dataList);
1532 } 1545 }
1533 1546
@@ -2225,9 +2238,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2225,9 +2238,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2225 String company = "", subCompany = ""; 2238 String company = "", subCompany = "";
2226 String sfyy = map.get("sfyy").toString(); 2239 String sfyy = map.get("sfyy").toString();
2227 String line = map.get("line").toString(); 2240 String line = map.get("line").toString();
2228 - if(map.get("company")!=null) 2241 + if(map.containsKey("company") && map.get("company")!=null)
2229 company = map.get("company").toString(); 2242 company = map.get("company").toString();
2230 - if(map.get("subCompany")!=null) 2243 + if(map.containsKey("subCompany") && map.get("subCompany")!=null)
2231 subCompany = map.get("subCompany").toString(); 2244 subCompany = map.get("subCompany").toString();
2232 String startDate = map.get("startDate").toString(); 2245 String startDate = map.get("startDate").toString();
2233 String endDate = map.get("endDate").toString(); 2246 String endDate = map.get("endDate").toString();
@@ -2243,32 +2256,26 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2243,32 +2256,26 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2243 } 2256 }
2244 try { 2257 try {
2245 2258
2246 - String sql = "select * from bsth_c_s_sp_info_real where schedule_date_str"  
2247 - + " >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'";  
2248 - if(line.length() != 0){  
2249 - sql += " and xl_bm = '"+line+"'";  
2250 - } 2259 + String sql = "select * from bsth_c_s_sp_info_real where schedule_date_str" +
  2260 + " >= ? and schedule_date_str <= ? and xl_bm like ?" +
  2261 + " and fcsj >= ? and fcsj <= ? and gs_bm like ? and fgs_bm like ?" +
  2262 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
  2263 + List<String> strList = new ArrayList<String>();
  2264 + strList.add(startDate);
  2265 + strList.add(endDate);
  2266 + strList.add('%' + line + '%');
2251 if(sfqr == 1 && times.length() != 0){ 2267 if(sfqr == 1 && times.length() != 0){
2252 String[] split = times.split("-"); 2268 String[] split = times.split("-");
2253 - String[] split0 = split[0].split(":");  
2254 - String[] split1 = split[1].split(":");  
2255 - int time0 = Integer.valueOf(split0[0])*60 + Integer.valueOf(split0[1]);  
2256 - int time1 = Integer.valueOf(split1[0])*60 + Integer.valueOf(split1[1]);  
2257 - if(time1 > time0){  
2258 - sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'";  
2259 - } else {  
2260 - sql += " and (fcsj >= '"+split[0]+"' or fcsj <= '"+split[1]+"')";  
2261 - }  
2262 - }  
2263 - if(company.length() != 0){  
2264 - sql += " and gs_bm = '"+company+"'";  
2265 - }  
2266 - if(subCompany.length() != 0){  
2267 - sql += " and fgs_bm = '"+subCompany+"'"; 2269 + strList.add(split[0]);
  2270 + strList.add(split[1]);
  2271 + } else {
  2272 + strList.add("");
  2273 + strList.add("23:59");
2268 } 2274 }
2269 - sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; 2275 + strList.add('%' + company + '%');
  2276 + strList.add('%' + subCompany + '%');
2270 2277
2271 - list = jdbcTemplate.query(sql, 2278 + List<ScheduleRealInfo> query = jdbcTemplate.query(sql, strList.toArray(),
2272 new RowMapper<ScheduleRealInfo>(){ 2279 new RowMapper<ScheduleRealInfo>(){
2273 @Override 2280 @Override
2274 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { 2281 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -2311,6 +2318,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2311,6 +2318,14 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2311 return schedule; 2318 return schedule;
2312 } 2319 }
2313 }); 2320 });
  2321 + for(ScheduleRealInfo s : query){
  2322 + if(line.length() != 0){
  2323 + if(!line.equals(s.getXlBm())){
  2324 + continue;
  2325 + }
  2326 + }
  2327 + list.add(s);
  2328 + }
2314 }catch (Exception e) { 2329 }catch (Exception e) {
2315 // TODO: handle exception 2330 // TODO: handle exception
2316 e.printStackTrace(); 2331 e.printStackTrace();
@@ -2408,71 +2423,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2408,71 +2423,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2408 resList.add(tempMap); 2423 resList.add(tempMap);
2409 } 2424 }
2410 2425
2411 - /*for(String key : keyMap0.keySet()){  
2412 - Map<String, Object> tempMap = new HashMap<String, Object>();  
2413 - int sjbc = 0, sddf = 0, zddf = 0,  
2414 - dxtz = 0, lbtz = 0;  
2415 - for(Map<String, Object> m : keyMap0.get(key)){  
2416 - sjbc += (int)m.get("sjbc");  
2417 - sddf += (int)m.get("sddf");  
2418 - zddf += (int)m.get("zddf");  
2419 -// dxtz += (int)m.get("dxtz");  
2420 - lbtz += (int)m.get("lbtz");  
2421 - }  
2422 - tempMap.put("date", date);  
2423 - String[] keys = key.split("/");  
2424 - tempMap.put("company", keys[0]);  
2425 - tempMap.put("subCompany", keys[1]);  
2426 - tempMap.put("lines", keyMap0.get(key).size());  
2427 - tempMap.put("sjbc", sjbc);  
2428 - tempMap.put("sddf", sddf);  
2429 - tempMap.put("zddf", zddf);  
2430 - tempMap.put("dfhj", sddf + zddf);  
2431 -// tempMap.put("dxtz", dxtz);  
2432 - tempMap.put("lbtz", lbtz);  
2433 - tempMap.put("correct", sddf + zddf + dxtz + lbtz);  
2434 - tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%");  
2435 - tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%");  
2436 - tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%");  
2437 - tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%");  
2438 -// tempMap.put("workList", keyMap0.get(key));  
2439 -  
2440 - String key1 = keys[0];  
2441 - if(!keyMap1.containsKey(key1))  
2442 - keyMap1.put(key1, new ArrayList<Map<String, Object>>());  
2443 - keyMap1.get(key1).add(tempMap);  
2444 - }*/  
2445 -  
2446 - /*for(String key : keyMap1.keySet()){  
2447 - Map<String, Object> tempMap = new HashMap<String, Object>();  
2448 - int sjbc = 0, sddf = 0, zddf = 0,  
2449 - dxtz = 0, lbtz = 0, lines = 0;  
2450 - for(Map<String, Object> m : keyMap1.get(key)){  
2451 - sjbc += (int)m.get("sjbc");  
2452 - sddf += (int)m.get("sddf");  
2453 - zddf += (int)m.get("zddf");  
2454 -// dxtz += (int)m.get("dxtz");  
2455 - lbtz += (int)m.get("lbtz");  
2456 - lines += (int)m.get("lines");  
2457 - }  
2458 - tempMap.put("date", date);  
2459 - tempMap.put("company", key);  
2460 - tempMap.put("lines", lines);  
2461 - tempMap.put("sjbc", sjbc);  
2462 - tempMap.put("sddf", sddf);  
2463 - tempMap.put("zddf", zddf);  
2464 - tempMap.put("dfhj", sddf + zddf);  
2465 -// tempMap.put("dxtz", dxtz);  
2466 - tempMap.put("lbtz", lbtz);  
2467 - tempMap.put("correct", sddf + zddf + dxtz + lbtz);  
2468 - tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%");  
2469 - tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%");  
2470 - tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%");  
2471 - tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%");  
2472 -// tempMap.put("workList", keyMap1.get(key));  
2473 -  
2474 - resList.add(tempMap);  
2475 - }*/  
2476 2426
2477 if(resList.size() != 0){ 2427 if(resList.size() != 0){
2478 Map<String, Object> tempMap = new HashMap<String, Object>(); 2428 Map<String, Object> tempMap = new HashMap<String, Object>();
@@ -2484,24 +2434,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2484,24 +2434,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2484 zddf += (int)m.get("zddf"); 2434 zddf += (int)m.get("zddf");
2485 // dxtz += (int)m.get("dxtz"); 2435 // dxtz += (int)m.get("dxtz");
2486 lbtz += (int)m.get("lbtz"); 2436 lbtz += (int)m.get("lbtz");
2487 -// lines += (int)m.get("lines");  
2488 - /*for(Map<String, Object> m0 : (List<Map<String, Object>>)m.get("workList")){  
2489 - Map<String, Object> temp = new HashMap<String, Object>();  
2490 - temp.put("date", "合计");  
2491 - temp.put("lines", m0.get("lines"));  
2492 - temp.put("sjbc", m0.get("sjbc"));  
2493 - temp.put("sddf", m0.get("sddf"));  
2494 - temp.put("zddf", m0.get("zddf"));  
2495 - temp.put("dfhj", m0.get("dfhj"));  
2496 -// temp.put("dxtz", m0.get("dxtz"));  
2497 - temp.put("lbtz", m0.get("lbtz"));  
2498 - temp.put("correct", m0.get("correct"));  
2499 - temp.put("dfbl", m0.get("dfbl"));  
2500 - temp.put("dxbl", m0.get("dxbl"));  
2501 - temp.put("lbbl", m0.get("lbbl"));  
2502 - temp.put("correctbl", m0.get("correctbl"));  
2503 -// ((List<Map<String, Object>>)m0.get("workList")).add(temp);  
2504 - }*/  
2505 Map<String, Object> temp = new HashMap<String, Object>(); 2437 Map<String, Object> temp = new HashMap<String, Object>();
2506 temp.put("date", "合计"); 2438 temp.put("date", "合计");
2507 temp.put("lines", m.get("lines")); 2439 temp.put("lines", m.get("lines"));
@@ -2515,8 +2447,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2515,8 +2447,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2515 temp.put("dfbl", m.get("dfbl")); 2447 temp.put("dfbl", m.get("dfbl"));
2516 temp.put("dxbl", m.get("dxbl")); 2448 temp.put("dxbl", m.get("dxbl"));
2517 temp.put("lbbl", m.get("lbbl")); 2449 temp.put("lbbl", m.get("lbbl"));
2518 -// temp.put("correctbl", m.get("correctbl"));  
2519 -// ((List<Map<String, Object>>)m.get("workList")).add(temp);  
2520 } 2450 }
2521 tempMap.put("date", "合计"); 2451 tempMap.put("date", "合计");
2522 tempMap.put("lines", lines); 2452 tempMap.put("lines", lines);
@@ -2534,13 +2464,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2534,13 +2464,17 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2534 resList.add(tempMap); 2464 resList.add(tempMap);
2535 } 2465 }
2536 2466
  2467 + String currDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  2468 +
2537 //计算掉线调整 2469 //计算掉线调整
2538 String sqldot = "select * from " 2470 String sqldot = "select * from "
2539 + "logger_sch_modify where gsbm = ? and fgsbm like ? and rq BETWEEN ? and ? order by line_code,sch_id"; 2471 + "logger_sch_modify where gsbm = ? and fgsbm like ? and rq BETWEEN ? and ? order by line_code,sch_id";
2540 2472
2541 2473
2542 List<SchEditInfoDto> listDot = jdbcTemplate.query(sqldot, 2474 List<SchEditInfoDto> listDot = jdbcTemplate.query(sqldot,
2543 - new BeanPropertyRowMapper(SchEditInfoDto.class),company,"%"+subCompany+"%",map.get("startDate").toString(),map.get("endDate").toString()); 2475 + new BeanPropertyRowMapper(SchEditInfoDto.class),company,"%"+subCompany+"%",
  2476 + map.get("startDate")!=null?map.get("startDate"):"",
  2477 + map.get("endDate")!=null?map.get("endDate"):currDate);
2544 int dxtzz=0; 2478 int dxtzz=0;
2545 Map<String, Object> mapSchId=new HashMap<String,Object>(); 2479 Map<String, Object> mapSchId=new HashMap<String,Object>();
2546 for (int i = 0; i < resList.size(); i++) { 2480 for (int i = 0; i < resList.size(); i++) {
@@ -2665,11 +2599,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2665,11 +2599,11 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2665 String minfcsj="02:00"; 2599 String minfcsj="02:00";
2666 List<Line> lineList=lineRepository.findLineByCode(line); 2600 List<Line> lineList=lineRepository.findLineByCode(line);
2667 if(lineList.size()>0){ 2601 if(lineList.size()>0){
2668 - String sqlMinYysj="select start_opt from bsth_c_line_config where " 2602 + String sqlMinYysj = "select start_opt from bsth_c_line_config where "
2669 + " id = (" 2603 + " id = ("
2670 - + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'" 2604 + + "select max(id) from bsth_c_line_config where line = ?"
2671 + ")"; 2605 + ")";
2672 - minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); 2606 + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class, lineList.get(0).getId());
2673 } 2607 }
2674 2608
2675 for(Ylb ylb : queryYlbByRqXlbm){ 2609 for(Ylb ylb : queryYlbByRqXlbm){
@@ -2885,18 +2819,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2885,18 +2819,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2885 Map.put("ljbc", culateService.culateLjbc(lists, "")); 2819 Map.put("ljbc", culateService.culateLjbc(lists, ""));
2886 int sjbc =culateService.culateLjbc(lists, "")+culateService.culateSjbc(lists, ""); 2820 int sjbc =culateService.culateLjbc(lists, "")+culateService.culateSjbc(lists, "");
2887 Map.put("sjbc", sjbc); 2821 Map.put("sjbc", sjbc);
2888 -// map=new HashMap<String,Object>();  
2889 2822
2890 SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm"); 2823 SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm");
2891 -// String minfcsj="02:00";  
2892 -// List<Line> lineList=lineRepository.findLineByCode(newList.get(0).getXlBm());  
2893 -// if(lineList.size()>0){  
2894 -// String sqlMinYysj="select start_opt from bsth_c_line_config where "  
2895 -// + " id = ("  
2896 -// + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"  
2897 -// + ")";  
2898 -// minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);  
2899 -// }  
2900 String[] minSjs = minfcsj.split(":"); 2824 String[] minSjs = minfcsj.split(":");
2901 Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]); 2825 Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
2902 2826
@@ -3081,17 +3005,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -3081,17 +3005,17 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3081 String sql = "select id, cl_zbh, fcsj, fcsj_actual, j_gh, j_name, lp_name, qdz_name, " + 3005 String sql = "select id, cl_zbh, fcsj, fcsj_actual, j_gh, j_name, lp_name, qdz_name, " +
3082 "schedule_date_str, xl_name, zdsj, zdsj_actual, fgs_bm, fgs_name, gs_name, xl_dir, xl_bm " + 3006 "schedule_date_str, xl_name, zdsj, zdsj_actual, fgs_bm, fgs_name, gs_name, xl_dir, xl_bm " +
3083 "from bsth_c_s_sp_info_real " + 3007 "from bsth_c_s_sp_info_real " +
3084 - "where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"' " + 3008 + "where schedule_date_str >= ? and schedule_date_str <= ? " +
  3009 + "and gs_bm like ? and fgs_bm like ? and xl_bm like ? " +
3085 "and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and cc_service = 0"; 3010 "and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and cc_service = 0";
  3011 + List<String> strList = new ArrayList<String>();
  3012 + strList.add(startDate);
  3013 + strList.add(endDate);
  3014 + strList.add('%' + company + '%');
  3015 + strList.add('%' + subCompany + '%');
  3016 + strList.add('%' + line + '%');
3086 3017
3087 - if(company.length() != 0)  
3088 - sql += " and gs_bm = '"+company+"'";  
3089 - if(subCompany.length() != 0)  
3090 - sql += " and fgs_bm = '"+subCompany+"'";  
3091 - if(line.length() != 0)  
3092 - sql += " and xl_bm = '"+line+"'";  
3093 -  
3094 - List<ScheduleRealInfo> list = jdbcTemplate.query(sql, 3018 + List<ScheduleRealInfo> query = jdbcTemplate.query(sql, strList.toArray(),
3095 new RowMapper<ScheduleRealInfo>(){ 3019 new RowMapper<ScheduleRealInfo>(){
3096 @Override 3020 @Override
3097 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { 3021 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -3114,7 +3038,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -3114,7 +3038,17 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3114 schedule.setjGh(rs.getString("j_gh")); 3038 schedule.setjGh(rs.getString("j_gh"));
3115 schedule.setjName(rs.getString("j_name")); 3039 schedule.setjName(rs.getString("j_name"));
3116 return schedule; 3040 return schedule;
3117 - }}); 3041 + }});
  3042 +
  3043 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  3044 + for(ScheduleRealInfo s : query){
  3045 + if(line.length() != 0){
  3046 + if(!(line.equals(s.getXlBm()))){
  3047 + continue;
  3048 + }
  3049 + }
  3050 + list.add(s);
  3051 + }
3118 3052
3119 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 3053 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
3120 Map<String, Map<String, List<ScheduleRealInfo>>> sches = new HashMap<String, Map<String, List<ScheduleRealInfo>>>(); 3054 Map<String, Map<String, List<ScheduleRealInfo>>> sches = new HashMap<String, Map<String, List<ScheduleRealInfo>>>();
@@ -3136,11 +3070,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -3136,11 +3070,11 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3136 3070
3137 String xl = s.getXlName() + "/" + s.getFgsBm(); 3071 String xl = s.getXlName() + "/" + s.getFgsBm();
3138 String dateStr = s.getScheduleDateStr(); 3072 String dateStr = s.getScheduleDateStr();
3139 - if(!sches.containsKey(xl)){ 3073 + if(!(sches.containsKey(xl))){
3140 sches.put(xl, new HashMap<String, List<ScheduleRealInfo>>()); 3074 sches.put(xl, new HashMap<String, List<ScheduleRealInfo>>());
3141 keyMap.put(xl, new ArrayList<List<Map<String, Object>>>()); 3075 keyMap.put(xl, new ArrayList<List<Map<String, Object>>>());
3142 } 3076 }
3143 - if(!sches.get(xl).containsKey(dateStr)){ 3077 + if(!(sches.get(xl).containsKey(dateStr))){
3144 sches.get(xl).put(dateStr, new ArrayList<ScheduleRealInfo>()); 3078 sches.get(xl).put(dateStr, new ArrayList<ScheduleRealInfo>());
3145 } 3079 }
3146 sches.get(xl).get(dateStr).add(s); 3080 sches.get(xl).get(dateStr).add(s);
@@ -3242,7 +3176,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -3242,7 +3176,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3242 keyMap.put(xl, lists); 3176 keyMap.put(xl, lists);
3243 } 3177 }
3244 3178
3245 - if(!map.containsKey("flag")){ 3179 + if(!(map.containsKey("flag"))){
3246 for(String xl : keyMap.keySet()){ 3180 for(String xl : keyMap.keySet()){
3247 List<List<Map<String, Object>>> list1 = keyMap.get(xl); 3181 List<List<Map<String, Object>>> list1 = keyMap.get(xl);
3248 if(list1.size() == 0 || list1.get(0).size() == 0) 3182 if(list1.size() == 0 || list1.get(0).size() == 0)