Commit a884f08187bcde04e01ed5c9c0eaa8a7d93c0712

Authored by 娄高锋
1 parent 56b9c321

时刻表分析

src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
@@ -565,7 +565,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -565,7 +565,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
565 } 565 }
566 try { 566 try {
567 567
568 - String sql = "select * from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'"; 568 + String sql = "select schedule_date_str,xl_name,bc_type,gs_name,fgs_name,bcs,fcno,"
  569 + +"fcsj,fcsj_actual,zdsj,zdsj_actual,bcsj,qdz_name,sp_id,cc_service"
  570 + +" from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate
  571 + +"' and schedule_date_str <= '"+endDate+"'";
569 if(line.length() != 0){ 572 if(line.length() != 0){
570 sql += " and xl_bm = '"+line+"'"; 573 sql += " and xl_bm = '"+line+"'";
571 } 574 }
@@ -636,8 +639,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -636,8 +639,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
636 639
637 if(model.length() != 0){ 640 if(model.length() != 0){
638 // sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type != 'in' and bc_type != 'out'"; 641 // sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type != 'in' and bc_type != 'out'";
639 - sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out'" +  
640 - " and bc_type != 'ldks' and schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'"; 642 + sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out'"
  643 + + " and bc_type != 'ldks' and schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'";
641 if(line.length() != 0){ 644 if(line.length() != 0){
642 sql += " and xl_bm = '"+line+"'"; 645 sql += " and xl_bm = '"+line+"'";
643 } 646 }
@@ -656,21 +659,21 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -656,21 +659,21 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
656 e.printStackTrace(); 659 e.printStackTrace();
657 } 660 }
658 661
  662 + Set<Long> ttSet = new HashSet<Long>();
  663 + for(Long tt : ttList){
  664 + ttSet.add(tt);
  665 + }
659 //分组计算 同时判断是否所选时刻信息 666 //分组计算 同时判断是否所选时刻信息
660 for(ScheduleRealInfo schedule : list){ 667 for(ScheduleRealInfo schedule : list){
661 if(schedule.isCcService()){ 668 if(schedule.isCcService()){
662 continue; 669 continue;
663 } 670 }
664 - DO:{  
665 if(model.length() != 0){ 671 if(model.length() != 0){
666 - for(Long tt : ttList){  
667 - if((long)tt == (long)schedule.getSpId()){  
668 - String key = schedule.getXlName()+"/"+schedule.getQdzName()+"/"+schedule.getFcsj();  
669 - if(!keyMap.containsKey(key))  
670 - keyMap.put(key, new ArrayList<ScheduleRealInfo>());  
671 - keyMap.get(key).add(schedule);  
672 - break DO;  
673 - } 672 + if(ttSet.contains(schedule.getSpId())){
  673 + String key = schedule.getXlName()+"/"+schedule.getQdzName()+"/"+schedule.getFcsj();
  674 + if(!keyMap.containsKey(key))
  675 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  676 + keyMap.get(key).add(schedule);
674 } 677 }
675 } else { 678 } else {
676 String key = schedule.getXlName()+"/"+schedule.getQdzName()+"/"+schedule.getFcsj(); 679 String key = schedule.getXlName()+"/"+schedule.getQdzName()+"/"+schedule.getFcsj();
@@ -678,7 +681,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -678,7 +681,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
678 keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 681 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
679 keyMap.get(key).add(schedule); 682 keyMap.get(key).add(schedule);
680 } 683 }
681 - }  
682 } 684 }
683 String companyName = "", subCompanyName = ""; 685 String companyName = "", subCompanyName = "";
684 for(String key : keyMap.keySet()){ 686 for(String key : keyMap.keySet()){
@@ -800,7 +802,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -800,7 +802,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
800 if(page.length() != 0 && type.equals("query")){ 802 if(page.length() != 0 && type.equals("query")){
801 int currPage = Integer.valueOf(page); 803 int currPage = Integer.valueOf(page);
802 modelMap.put("totalPage", resList.size()%10>0?(resList.size()/10 + 1):resList.size()/10); 804 modelMap.put("totalPage", resList.size()%10>0?(resList.size()/10 + 1):resList.size()/10);
803 - modelMap.put("dataList", resList.subList(currPage*10,((currPage+1)*10)>=resList.size()?resList.size():(currPage+1)*10)); 805 +// modelMap.put("dataList", resList.subList(currPage*10,((currPage+1)*10)>=resList.size()?resList.size():(currPage+1)*10));
  806 + modelMap.put("dataList", resList);
804 } else { 807 } else {
805 modelMap.put("dataList", resList); 808 modelMap.put("dataList", resList);
806 } 809 }
src/main/resources/static/pages/forms/statement/scheduleAnaly.html
@@ -218,6 +218,7 @@ @@ -218,6 +218,7 @@
218 jsDoQuery(true); 218 jsDoQuery(true);
219 }); 219 });
220 220
  221 + var list;
221 var line = $("#line").val(); 222 var line = $("#line").val();
222 var startDate = $("#startDate").val(); 223 var startDate = $("#startDate").val();
223 var endDate = $("#endDate").val(); 224 var endDate = $("#endDate").val();
@@ -254,10 +255,8 @@ @@ -254,10 +255,8 @@
254 $(".hidden").removeClass("hidden"); 255 $(".hidden").removeClass("hidden");
255 var i = layer.load(2); 256 var i = layer.load(2);
256 $get('/pcpc/scheduleAnaly', params, function(result){ 257 $get('/pcpc/scheduleAnaly', params, function(result){
257 - // 把数据填充到模版中  
258 - var tbodyHtml = template('list_scheduleAnaly',{list:result.dataList});  
259 - // 把渲染好的模版html文本追加到表格中  
260 - $('#forms tbody').html(tbodyHtml); 258 + list = result.dataList;
  259 + dataPageChange(page, result.dataList);
261 layer.close(i); 260 layer.close(i);
262 261
263 if(result.dataList.length == 0) 262 if(result.dataList.length == 0)
@@ -277,6 +276,17 @@ @@ -277,6 +276,17 @@
277 }); 276 });
278 } 277 }
279 278
  279 + function dataPageChange(page, list){
  280 + var tempList = [];
  281 + for(var f = page*10; f < list.length && f < (page+1)*10; f++){
  282 + tempList[tempList.length] = list[f];
  283 + }
  284 + // 把数据填充到模版中
  285 + var tbodyHtml = template('list_scheduleAnaly',{list:tempList});
  286 + // 把渲染好的模版html文本追加到表格中
  287 + $('#forms tbody').html(tbodyHtml);
  288 + }
  289 +
280 $("#export").on("click",function(){ 290 $("#export").on("click",function(){
281 var params = {}; 291 var params = {};
282 params['page'] = page; 292 params['page'] = page;
@@ -387,7 +397,8 @@ @@ -387,7 +397,8 @@
387 return; 397 return;
388 } 398 }
389 page = num - 1; 399 page = num - 1;
390 - jsDoQuery(false); 400 +// jsDoQuery(false);
  401 + dataPageChange(page, list);
391 } 402 }
392 }); 403 });
393 } 404 }