Commit 78cb1dd169d5dc19c1f05fb02e44c82acd5e7c06

Authored by 娄高锋
1 parent 26abe0ca

营运线路出车率统计表

src/main/java/com/bsth/controller/forms/ExportController.java
@@ -330,69 +330,22 @@ public class ExportController { @@ -330,69 +330,22 @@ public class ExportController {
330 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 330 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
331 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 331 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
332 ReportUtils ee = new ReportUtils(); 332 ReportUtils ee = new ReportUtils();
333 - List<Turnoutrate> turnoutrate = formsService.turnoutrate(map);  
334 Map<String, Object> map1 = new HashMap<String, Object>(); 333 Map<String, Object> map1 = new HashMap<String, Object>();
335 - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();  
336 - String xlts="";  
337 - String zsgs="";  
338 - String jh="";  
339 - Float j=0f;  
340 - Float sj=0f;  
341 - Float qz=0f;  
342 - Float ccl=0f;  
343 - Float bcjh=0f;  
344 - String bcsj="";  
345 - Float bczxl=0f;  
346 - String gs="";  
347 - String zhgs="";  
348 334
349 - for (Turnoutrate l : turnoutrate) {  
350 - Map<String, Object> m = new HashMap<String, Object>();  
351 -  
352 - xlts +=l.getGsgs()==""?0:String.valueOf(l.getGsgs());  
353 - zsgs +=l.getFgsgs()==""?0:String.valueOf(l.getFgsgs());  
354 - jh +=l.getXl()==""?0:String.valueOf(l.getXl());  
355 - sj +=l.getCchjh()==""?0f:Float.valueOf(l.getCchjh());  
356 - ccl +=l.getCchsj()==""?0f:Float.valueOf(l.getCchsj());  
357 - bcjh +=l.getCchqz()==""?0f:Float.valueOf(l.getCchqz());  
358 - bcsj +=l.getChl()==""?0:String.valueOf(l.getChl());  
359 - bczxl +=l.getBcjh()==""?0f:Float.valueOf(l.getBcjh());  
360 - gs +=l.getBcsj()==""?0:String.valueOf(l.getBcsj());  
361 - zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl());  
362 -  
363 -  
364 - m.put("rq", l.getRq());  
365 - m.put("gs", l.getGs());  
366 - m.put("zhgs", l.getZhgs());  
367 - m.put("xl", l.getXl());  
368 - m.put("cchjh", l.getCchjh());  
369 - m.put("cchsj", l.getCchsj());  
370 - m.put("cchqz", l.getCchqz());  
371 - m.put("chl", l.getChl());  
372 - m.put("bcjh", l.getBcjh());  
373 - m.put("bcsj", l.getBcsj());  
374 - m.put("bbzxl", l.getBbzxl());  
375 - m.put("sm", l.getSm());  
376 - resList.add(m);  
377 -  
378 -  
379 -  
380 - m=new HashMap<String,Object>();  
381 - m.put("total_xlts", xlts);  
382 - m.put("total_zhgs", zsgs);  
383 - m.put("total_jh", jh);  
384 - m.put("total_sj", sj);  
385 - m.put("total_qz", ccl);  
386 - m.put("total_ccl", bcjh);  
387 - m.put("total_bcjh",bcsj);  
388 - m.put("total_bcsj", bczxl);  
389 - m.put("total_bczxl", bczxl);  
390 - m.put("total_gs", zhgs);  
391 -  
392 -  
393 - map1 = m;  
394 - }  
395 - 335 + List<Map<String, Object>> resList = formsService.turnoutrate(map);
  336 + Map<String, Object> m = resList.get(resList.size() - 1);
  337 + map1.put("line", m.get("line"));
  338 + map1.put("jhcc", m.get("jhcc"));
  339 + map1.put("sjcc", m.get("sjcc"));
  340 + map1.put("jhbc", m.get("jhbc"));
  341 + map1.put("sjbc", m.get("sjbc"));
  342 + map1.put("ccl", m.get("ccl"));
  343 + map1.put("zxl", m.get("zxl"));
  344 + map1.put("qz", m.get("qz"));
  345 + map1.put("sm", m.get("sm"));
  346 +
  347 + resList.remove(m);
  348 +
396 try { 349 try {
397 listI.add(resList.iterator()); 350 listI.add(resList.iterator());
398 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 351 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
@@ -94,7 +94,7 @@ public class MCY_FormsController { @@ -94,7 +94,7 @@ public class MCY_FormsController {
94 94
95 // 营运线路出车率统计表 95 // 营运线路出车率统计表
96 @RequestMapping(value = "/turnoutrate", method = RequestMethod.POST) 96 @RequestMapping(value = "/turnoutrate", method = RequestMethod.POST)
97 - public List<Turnoutrate> turnoutrate(@RequestParam Map<String, Object> map) { 97 + public List<Map<String, Object>> turnoutrate(@RequestParam Map<String, Object> map) {
98 98
99 return formsService.turnoutrate(map); 99 return formsService.turnoutrate(map);
100 } 100 }
src/main/java/com/bsth/repository/LineRepository.java
@@ -38,4 +38,7 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; { @@ -38,4 +38,7 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; {
38 List<Line> findLine(String line); 38 List<Line> findLine(String line);
39 39
40 public Line findByLineCode(String string); 40 public Line findByLineCode(String string);
  41 +
  42 + @Query(value = " SELECT l FROM Line l where l.company like ?1 and l.brancheCompany like ?2 and l.lineCode like ?3")
  43 + public List<Line> findLineBygsBm(String gsBm, String fgsBm, String line);
41 } 44 }
src/main/java/com/bsth/service/forms/FormsService.java
@@ -35,7 +35,7 @@ public interface FormsService { @@ -35,7 +35,7 @@ public interface FormsService {
35 35
36 public List<Operationservice> operationservice(Map<String, Object> map); 36 public List<Operationservice> operationservice(Map<String, Object> map);
37 37
38 - public List<Turnoutrate> turnoutrate(Map<String, Object> map); 38 + public List<Map<String, Object>> turnoutrate(Map<String, Object> map);
39 39
40 public List<Executionrate> executionrate(Map<String, Object> map); 40 public List<Executionrate> executionrate(Map<String, Object> map);
41 41
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
@@ -9,14 +9,17 @@ import java.text.SimpleDateFormat; @@ -9,14 +9,17 @@ import java.text.SimpleDateFormat;
9 import java.util.ArrayList; 9 import java.util.ArrayList;
10 import java.util.Date; 10 import java.util.Date;
11 import java.util.HashMap; 11 import java.util.HashMap;
  12 +import java.util.HashSet;
12 import java.util.List; 13 import java.util.List;
13 import java.util.Map; 14 import java.util.Map;
  15 +import java.util.Set;
14 16
15 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.jdbc.core.JdbcTemplate; 18 import org.springframework.jdbc.core.JdbcTemplate;
17 import org.springframework.jdbc.core.RowMapper; 19 import org.springframework.jdbc.core.RowMapper;
18 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
19 21
  22 +import com.bsth.entity.Line;
20 import com.bsth.entity.mcy_forms.Linepasswengerflow; 23 import com.bsth.entity.mcy_forms.Linepasswengerflow;
21 import com.bsth.entity.mcy_forms.Operationservice; 24 import com.bsth.entity.mcy_forms.Operationservice;
22 import com.bsth.entity.mcy_forms.Shifday; 25 import com.bsth.entity.mcy_forms.Shifday;
@@ -27,6 +30,8 @@ import com.bsth.entity.mcy_forms.Vehicleloading; @@ -27,6 +30,8 @@ import com.bsth.entity.mcy_forms.Vehicleloading;
27 import com.bsth.entity.mcy_forms.Waybillday; 30 import com.bsth.entity.mcy_forms.Waybillday;
28 import com.bsth.entity.oil.Ylb; 31 import com.bsth.entity.oil.Ylb;
29 import com.bsth.entity.realcontrol.ScheduleRealInfo; 32 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  33 +import com.bsth.entity.schedule.SchedulePlanInfo;
  34 +import com.bsth.repository.LineRepository;
30 import com.bsth.repository.oil.YlbRepository; 35 import com.bsth.repository.oil.YlbRepository;
31 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 36 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
32 import com.bsth.data.BasicData; 37 import com.bsth.data.BasicData;
@@ -60,6 +65,10 @@ public class FormsServiceImpl implements FormsService { @@ -60,6 +65,10 @@ public class FormsServiceImpl implements FormsService {
60 65
61 @Autowired 66 @Autowired
62 YlbRepository ylbRepository; 67 YlbRepository ylbRepository;
  68 +
  69 + @Autowired
  70 + LineRepository lineRepository;
  71 +
63 72
64 // 行车路单日报表 73 // 行车路单日报表
65 @Override 74 @Override
@@ -486,7 +495,7 @@ public class FormsServiceImpl implements FormsService { @@ -486,7 +495,7 @@ public class FormsServiceImpl implements FormsService {
486 // + " on y.nbbm=t.cl_zbh and y.jsy= t.j_gh"; 495 // + " on y.nbbm=t.cl_zbh and y.jsy= t.j_gh";
487 496
488 String sql="select r.s_gh,r.s_name, " 497 String sql="select r.s_gh,r.s_name, "
489 - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" 498 + + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"
490 + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'"; 499 + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'";
491 if(xlbm.equals("")){ 500 if(xlbm.equals("")){
492 sql +="and r.gs_bm='"+gsdm+"' " 501 sql +="and r.gs_bm='"+gsdm+"' "
@@ -495,7 +504,7 @@ public class FormsServiceImpl implements FormsService { @@ -495,7 +504,7 @@ public class FormsServiceImpl implements FormsService {
495 sql += " and r.xl_bm = '"+xlbm+"'"; 504 sql += " and r.xl_bm = '"+xlbm+"'";
496 } 505 }
497 sql += " group by r.s_gh,r.s_name," 506 sql += " group by r.s_gh,r.s_name,"
498 - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm"; 507 + + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm";
499 508
500 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 509 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
501 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 510 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -503,7 +512,7 @@ public class FormsServiceImpl implements FormsService { @@ -503,7 +512,7 @@ public class FormsServiceImpl implements FormsService {
503 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 512 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
504 Singledata sin = new Singledata(); 513 Singledata sin = new Singledata();
505 sin.setrQ(startDate); 514 sin.setrQ(startDate);
506 - sin.setxL(arg0.getString("xl_bm")); 515 + sin.setxL(arg0.getString("xl_name"));
507 sin.setClzbh(arg0.getString("cl_zbh")); 516 sin.setClzbh(arg0.getString("cl_zbh"));
508 sin.setJsy(arg0.getString("j_gh")); 517 sin.setJsy(arg0.getString("j_gh"));
509 sin.setjName(arg0.getString("j_name")); 518 sin.setjName(arg0.getString("j_name"));
@@ -520,7 +529,6 @@ public class FormsServiceImpl implements FormsService { @@ -520,7 +529,6 @@ public class FormsServiceImpl implements FormsService {
520 for (int i = 0; i < list.size(); i++) { 529 for (int i = 0; i < list.size(); i++) {
521 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); 530 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
522 Singledata sin=list.get(i); 531 Singledata sin=list.get(i);
523 - sin.setxL(BasicData.lineCode2NameMap.get(sin.getxL()));  
524 String jsy=sin.getJsy(); 532 String jsy=sin.getJsy();
525 String clzbh=sin.getClzbh(); 533 String clzbh=sin.getClzbh();
526 for (int j = 0; j < listReal.size(); j++) { 534 for (int j = 0; j < listReal.size(); j++) {
@@ -734,11 +742,13 @@ public class FormsServiceImpl implements FormsService { @@ -734,11 +742,13 @@ public class FormsServiceImpl implements FormsService {
734 742
735 // 营运线路出车率统计表 743 // 营运线路出车率统计表
736 @Override 744 @Override
737 - public List<Turnoutrate> turnoutrate(Map<String, Object> map) { 745 + public List<Map<String, Object>> turnoutrate(Map<String, Object> map) {
738 746
739 - List<Turnoutrate> resList = new ArrayList<Turnoutrate>(); 747 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
740 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 748 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
741 SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日"); 749 SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
  750 + NumberFormat numberFormat = NumberFormat.getInstance();
  751 + numberFormat.setMaximumFractionDigits(2);
742 Date d = null; 752 Date d = null;
743 Date d1 = null; 753 Date d1 = null;
744 try { 754 try {
@@ -750,68 +760,134 @@ public class FormsServiceImpl implements FormsService { @@ -750,68 +760,134 @@ public class FormsServiceImpl implements FormsService {
750 } 760 }
751 String rq2 = sdf1.format(d); 761 String rq2 = sdf1.format(d);
752 String rq3 = sdf1.format(d1); 762 String rq3 = sdf1.format(d1);
  763 + String company = map.get("gsdmTurn").toString();
  764 + String subCompany = map.get("fgsdmTurn").toString();
  765 + String line = map.get("line").toString();
  766 + String startDate = map.get("startDate").toString();
  767 + String endDate = map.get("endDate").toString();
753 768
754 rq = rq2 + "-" + rq3; 769 rq = rq2 + "-" + rq3;
755 770
756 - String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,b.warrant_car,a.bc_type from "  
757 - + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type"  
758 - + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"+ map.get("startDate").toString() + "' "  
759 - + " and '" + map.get("endDate").toString() + "' and xl_bm='"+ map.get("line").toString() + "' "  
760 - + " AND gs_bm is not null "  
761 - + " AND bc_type NOT IN ('in', 'out')"  
762 - + " and gs_bm='"+ map.get("gsdmTurn").toString() + "'"  
763 - + " and fgs_bm='"+ map.get("fgsdmTurn").toString() + "'"  
764 -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type "  
765 - + " ) a left JOIN ("  
766 - + " SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl,t.warrant_car "  
767 - + " from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "  
768 - + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '"  
769 - + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString()  
770 - + "' AND gs_bm is not null "  
771 - + " AND bc_type NOT IN ('in', 'out')"  
772 -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type "  
773 - + " ) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on "  
774 - + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";  
775 - List<Turnoutrate> list = jdbcTemplate.query(sql, new RowMapper<Turnoutrate>() { 771 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, startDate, endDate, company, subCompany);
  772 + List<Line> lineList = lineRepository.findLineBygsBm(company, subCompany, line);
  773 +
  774 + String sql = "select * from bsth_c_s_sp_info where gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"' "
  775 + + "and DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"+startDate+"' and '"+endDate+"' ";
  776 + if(line.trim().length() != 0){
  777 + sql += "and xl_bm = '"+line+"' ";
  778 + }
  779 + List<SchedulePlanInfo> planList = jdbcTemplate.query(sql, new RowMapper<SchedulePlanInfo>() {
776 780
777 @Override 781 @Override
778 - public Turnoutrate mapRow(ResultSet arg0, int arg1) throws SQLException {  
779 - Turnoutrate tu = new Turnoutrate();  
780 - NumberFormat numberFormat = NumberFormat.getInstance();  
781 - numberFormat.setMaximumFractionDigits(2);  
782 - int scl = arg0.getString("scl")!=null&&arg0.getString("scl").trim().length()!=0?Integer.parseInt(arg0.getString("scl")):0;  
783 - int jcl = arg0.getString("jcl")!=null&&arg0.getString("jcl").trim().length()!=0?Integer.parseInt(arg0.getString("jcl")):0;  
784 - int sbc = arg0.getString("sbc")!=null&&arg0.getString("sbc").trim().length()!=0?Integer.parseInt(arg0.getString("sbc")):0;  
785 - int jbc = arg0.getString("jbc")!=null&&arg0.getString("jbc").trim().length()!=0?Integer.parseInt(arg0.getString("jbc")):0;  
786 - String result1 = numberFormat.format((float) scl / (float) jcl * 100);  
787 - String result2 = numberFormat.format((float) sbc / (float) jbc * 100);  
788 - tu.setRq(rq);  
789 - if(arg0.getString("gs_name") == null || arg0.getString("gs_name").trim().length() == 0)  
790 - return tu;  
791 - tu.setGs(arg0.getString("gs_name").toString());  
792 - tu.setZhgs(arg0.getString("fgs_name").toString());  
793 -// tu.setXl(arg0.getString("xlgs")!=null&&arg0.getString("xlgs").trim().length()!=0?arg0.getString("xlgs"):"0");  
794 - tu.setXl(arg0.getString("jxl")!=null&&arg0.getString("jxl").trim().length()!=0?arg0.getString("jxl"):"0");  
795 - tu.setXlmc(arg0.getString("sxl")!=null&&arg0.getString("sxl").trim().length()!=0?arg0.getString("sxl"):"0");  
796 - tu.setCchjh("" + jcl);  
797 - tu.setCchsj("" + scl);  
798 - tu.setCchqz(arg0.getString("sxl")!=null&&arg0.getString("sxl").trim().length()!=0?arg0.getString("sxl"):"0");  
799 - tu.setChl(result1 + "%");// 出车率  
800 - tu.setBcjh("" + jbc);  
801 - tu.setBcsj("" + sbc);  
802 - tu.setBbzxl(result2 + "%");// 班次执行率  
803 - tu.setSm(arg0.getString("gs_name").toString());  
804 - tu.setGsgs(arg0.getString("gslsbm").toString());  
805 - tu.setFgsgs(arg0.getString("fgsbm").toString());  
806 - return tu; 782 + public SchedulePlanInfo mapRow(ResultSet arg0, int arg1) throws SQLException {
  783 + SchedulePlanInfo schedule = new SchedulePlanInfo();
  784 + schedule.setGsName(arg0.getString("gs_name"));
  785 + schedule.setFgsName(arg0.getString("fgs_name"));
  786 + schedule.setClZbh(arg0.getString("cl_zbh"));
  787 + schedule.setFcsj(arg0.getString("fcsj"));
  788 + schedule.setBcType(arg0.getString("bc_type"));
  789 + schedule.setXlBm(arg0.getString("xl_bm"));
  790 + schedule.setXlName(arg0.getString("xl_name"));
  791 + schedule.setScheduleDate(arg0.getDate("schedule_date"));
  792 + return schedule;
807 } 793 }
808 794
809 }); 795 });
810 796
811 - for(Turnoutrate t : list){  
812 - if(t.getGs() != null && t.getGs().trim().length() != 0)  
813 - resList.add(t); 797 +
  798 + for(Line line1 : lineList){
  799 + if(line.trim().length() == 0 || line1.getLineCode().equals(line)){
  800 + Map<String, Object> m = new HashMap<String, Object>();
  801 + m.put("rq", rq);
  802 + m.put("line", line1.getName());
  803 + m.put("xlBm", line1.getLineCode());
  804 + m.put("qz", line1.getWarrantCar()!=null?line1.getWarrantCar():0);
  805 + m.put("sm", "");
  806 + resList.add(m);
  807 + }
  808 + }
  809 + for(Map<String, Object> m : resList){
  810 + String xlBm = m.get("xlBm").toString();
  811 + List<ScheduleRealInfo> reals = new ArrayList<ScheduleRealInfo>();
  812 + List<SchedulePlanInfo> plans = new ArrayList<SchedulePlanInfo>();
  813 + for(ScheduleRealInfo schedule : list){
  814 + if(schedule.getXlBm().equals(xlBm)){
  815 + reals.add(schedule);
  816 + }
  817 + }
  818 + for(SchedulePlanInfo schedule : planList){
  819 + if(schedule.getXlBm().equals(xlBm)){
  820 + plans.add(schedule);
  821 + }
  822 + }
  823 + Set<String> jhcc = new HashSet<String>();
  824 + Set<String> sjcc = new HashSet<String>();
  825 + for(SchedulePlanInfo schedule : plans){
  826 + if(!m.containsKey("gsName") && schedule.getGsName()!=null && schedule.getGsName().trim().length()!=0){
  827 + m.put("gsName", schedule.getGsName());
  828 + }
  829 + if(!m.containsKey("fgsName") && schedule.getFgsName()!=null && schedule.getFgsName().trim().length()!=0){
  830 + m.put("fgsName", schedule.getFgsName());
  831 + }
  832 + jhcc.add(schedule.getClZbh() + sdf.format(schedule.getScheduleDate()));
  833 + }
  834 + for(ScheduleRealInfo schedule : reals){
  835 + if(!m.containsKey("gsName") && schedule.getGsName()!=null && schedule.getGsName().trim().length()!=0){
  836 + m.put("gsName", schedule.getGsName());
  837 + }
  838 + if(!m.containsKey("fgsName") && schedule.getFgsName()!=null && schedule.getFgsName().trim().length()!=0){
  839 + m.put("fgsName", schedule.getFgsName());
  840 + }
  841 + sjcc.add(schedule.getClZbh() + sdf.format(schedule.getScheduleDate()));
  842 + }
  843 + m.put("jhcc", jhcc.size());
  844 + m.put("sjcc", sjcc.size());
  845 + if(jhcc.size() != 0 && sjcc.size() != 0){
  846 + m.put("ccl", numberFormat.format(((float)sjcc.size() / jhcc.size())*100)+"%");
  847 + }else{
  848 + m.put("ccl", "--");
  849 + }
  850 + int jhbc = culateMileageService.culateJhbc(reals, "");
  851 + int sjbc = culateMileageService.culateSjbc(reals, "");
  852 + m.put("jhbc", jhbc);
  853 + m.put("sjbc", sjbc);
  854 + if(jhbc != 0 && sjbc != 0){
  855 + m.put("zxl", numberFormat.format(((float)sjbc / jhbc)*100)+"%");
  856 + }else{
  857 + m.put("zxl", "--");
  858 + }
  859 + }
  860 + Map<String, Object> tempMap = new HashMap<String, Object>();
  861 + int jhcc = 0;
  862 + int sjcc = 0;
  863 + int jhbc = 0;
  864 + int sjbc = 0;
  865 + int qz = 0;
  866 + for(Map<String, Object> m : resList){
  867 + jhcc += Integer.valueOf(m.get("jhcc").toString());
  868 + sjcc += Integer.valueOf(m.get("sjcc").toString());
  869 + jhbc += Integer.valueOf(m.get("jhbc").toString());
  870 + sjbc += Integer.valueOf(m.get("sjbc").toString());
  871 + qz += Integer.valueOf(m.get("qz").toString());
  872 + }
  873 + tempMap.put("rq", "分类汇总");
  874 + tempMap.put("line", "共" + resList.size() + "条线路");
  875 + tempMap.put("jhcc", jhcc);
  876 + tempMap.put("sjcc", sjcc);
  877 + tempMap.put("jhbc", jhbc);
  878 + tempMap.put("sjbc", sjbc);
  879 + tempMap.put("qz", qz);
  880 + if(jhcc != 0 && sjcc != 0){
  881 + tempMap.put("ccl", numberFormat.format(((float)sjcc / jhcc)*100)+"%");
  882 + }else{
  883 + tempMap.put("ccl", "--");
  884 + }
  885 + if(jhbc != 0 && sjbc != 0){
  886 + tempMap.put("zxl", numberFormat.format(((float)sjbc / jhbc)*100)+"%");
  887 + }else{
  888 + tempMap.put("zxl", "--");
814 } 889 }
  890 + resList.add(tempMap);
815 891
816 return resList; 892 return resList;
817 } 893 }
src/main/resources/static/pages/forms/mould/turnoutrate.xls
No preview for this file type
src/main/resources/static/pages/mforms/turnoutrates/turnoutrate.html
@@ -92,20 +92,20 @@ @@ -92,20 +92,20 @@
92 <tbody id="tbody"> 92 <tbody id="tbody">
93 93
94 </tbody> 94 </tbody>
95 - <tr>  
96 - <td colspan="1">分类汇总</td>  
97 - <td><span id="total_gs">&nbsp;</span></td>  
98 - <td><span id="total_zhgs">&nbsp;</span></td>  
99 - <td><span id="total_xlts">&nbsp;</span></td>  
100 - <td><span id="total_jh">&nbsp;</span></td>  
101 - <td><span id="total_sj">&nbsp;</span></td>  
102 - <td><span id="total_qz">&nbsp;</span></td>  
103 - <td><span id="total_ccl">&nbsp;</span></td>  
104 - <td><span id="total_bcjh">&nbsp;</span></td>  
105 - <td><span id="total_bcsj">&nbsp;</span></td>  
106 - <td><span id="total_bczxl">&nbsp;</span></td>  
107 - <td><span id="total_sm">&nbsp;</span></td>  
108 - </tr> 95 +<!-- <tr> -->
  96 +<!-- <td colspan="1">分类汇总</td> -->
  97 +<!-- <td><span id="total_gs">&nbsp;</span></td> -->
  98 +<!-- <td><span id="total_zhgs">&nbsp;</span></td> -->
  99 +<!-- <td><span id="total_xlts">&nbsp;</span></td> -->
  100 +<!-- <td><span id="total_jh">&nbsp;</span></td> -->
  101 +<!-- <td><span id="total_sj">&nbsp;</span></td> -->
  102 +<!-- <td><span id="total_qz">&nbsp;</span></td> -->
  103 +<!-- <td><span id="total_ccl">&nbsp;</span></td> -->
  104 +<!-- <td><span id="total_bcjh">&nbsp;</span></td> -->
  105 +<!-- <td><span id="total_bcsj">&nbsp;</span></td> -->
  106 +<!-- <td><span id="total_bczxl">&nbsp;</span></td> -->
  107 +<!-- <td><span id="total_sm">&nbsp;</span></td> -->
  108 +<!-- </tr> -->
109 </table> 109 </table>
110 </div> 110 </div>
111 </div> 111 </div>
@@ -197,53 +197,53 @@ @@ -197,53 +197,53 @@
197 $("#query").on("click",function(){ 197 $("#query").on("click",function(){
198 198
199 line = $("#line").val(); 199 line = $("#line").val();
200 - startDate1=$("#startDate").val();  
201 - endDate1=$("#endDate").val(); 200 + startDate=$("#startDate").val();
  201 + endDate=$("#endDate").val();
202 gsdmTurn=$("#gsdmTurn").val(); 202 gsdmTurn=$("#gsdmTurn").val();
203 fgsdmTurn=$("#fgsdmTurn").val(); 203 fgsdmTurn=$("#fgsdmTurn").val();
204 - if(startDate1!=''&&endDate1!=''){ 204 + if(startDate!=''&&endDate!=''){
205 $post('/mcy_forms/turnoutrate', 205 $post('/mcy_forms/turnoutrate',
206 - { gsdmTurn:gsdmTurn,fgsdmTurn:fgsdmTurn, line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ 206 + { gsdmTurn:gsdmTurn,fgsdmTurn:fgsdmTurn, line:line,startDate:startDate,endDate:endDate,type:'query'},function(result){
207 // var result=[]; 207 // var result=[];
208 // 把数据填充到模版中 208 // 把数据填充到模版中
209 var tbodyHtml = template('turnoutrate',{list:result}); 209 var tbodyHtml = template('turnoutrate',{list:result});
210 // 把渲染好的模版html文本追加到表格中 210 // 把渲染好的模版html文本追加到表格中
211 $('#tbody').html(tbodyHtml); 211 $('#tbody').html(tbodyHtml);
212 - line = $("#line").val();  
213 - startDate = $("#startDate").val();  
214 - endDate = $("#endDate").val();  
215 - $("#sDate").text(startDate);  
216 - $("#eDate").text(endDate); 212 + line = $("#line").val();
  213 + startDate = $("#startDate").val();
  214 + endDate = $("#endDate").val();
  215 + $("#sDate").text(startDate);
  216 + $("#eDate").text(endDate);
217 217
218 - var total_xlts = 0,total_jh = 0;  
219 - var total_sj = 0,total_qz = 0,total_ccl = 0,total_bcjh = 0;  
220 - var total_bcjh = 0,total_bcsj = 0,total_bczxl = 0;  
221 - var total_gs=0;  
222 - var total_zhgs=0;  
223 - $.each(result, function(i, obj) {  
224 - total_gs +=Number(obj.gsgs);  
225 - total_zhgs +=Number(obj.fgsgs);  
226 - total_xlts += Number(obj.xl);  
227 - total_jh = Number(obj.cchjh)+Number(total_jh);  
228 - total_sj = Number(obj.cchsj)+Number(total_sj);  
229 - total_qz = Number(obj.cchqz)+Number(total_qz); 218 +// var total_xlts = 0,total_jh = 0;
  219 +// var total_sj = 0,total_qz = 0,total_ccl = 0,total_bcjh = 0;
  220 +// var total_bcjh = 0,total_bcsj = 0,total_bczxl = 0;
  221 +// var total_gs=0;
  222 +// var total_zhgs=0;
  223 +// $.each(result, function(i, obj) {
  224 +// total_gs +=Number(obj.gsgs);
  225 +// total_zhgs +=Number(obj.fgsgs);
  226 +// total_xlts += Number(obj.xl);
  227 +// total_jh = Number(obj.cchjh)+Number(total_jh);
  228 +// total_sj = Number(obj.cchsj)+Number(total_sj);
  229 +// total_qz = Number(obj.cchqz)+Number(total_qz);
230 230
231 - total_ccl =(Number(total_sj)/Number(total_jh))*100;  
232 - total_bcjh = Number(obj.bcjh)+Number(total_bcjh);  
233 - total_bcsj = Number(obj.bcsj)+Number(total_bcsj);  
234 - total_bczxl = (Number(total_bcsj)/Number(total_bcjh))*100; 231 +// total_ccl =(Number(total_sj)/Number(total_jh))*100;
  232 +// total_bcjh = Number(obj.bcjh)+Number(total_bcjh);
  233 +// total_bcsj = Number(obj.bcsj)+Number(total_bcsj);
  234 +// total_bczxl = (Number(total_bcsj)/Number(total_bcjh))*100;
235 235
236 - });  
237 - $("#total_gs").text(total_gs);  
238 - $("#total_zhgs").text(total_zhgs);  
239 - $("#total_xlts").text(total_xlts);  
240 - $("#total_jh").text(total_jh);  
241 - $("#total_sj").text(total_sj);  
242 - $("#total_qz").text(total_qz);  
243 - $("#total_ccl").text(total_ccl.toFixed(2)+'%');  
244 - $("#total_bcjh").text(total_bcjh);  
245 - $("#total_bcsj").text(total_bcsj);  
246 - $("#total_bczxl").text(total_bczxl.toFixed(2)+'%'); 236 +// });
  237 +// $("#total_gs").text(total_gs);
  238 +// $("#total_zhgs").text(total_zhgs);
  239 +// $("#total_xlts").text(total_xlts);
  240 +// $("#total_jh").text(total_jh);
  241 +// $("#total_sj").text(total_sj);
  242 +// $("#total_qz").text(total_qz);
  243 +// $("#total_ccl").text(total_ccl.toFixed(2)+'%');
  244 +// $("#total_bcjh").text(total_bcjh);
  245 +// $("#total_bcsj").text(total_bcsj);
  246 +// $("#total_bczxl").text(total_bczxl.toFixed(2)+'%');
247 247
248 var temp = {}; 248 var temp = {};
249 var today_account = 0; 249 var today_account = 0;
@@ -278,18 +278,23 @@ @@ -278,18 +278,23 @@
278 <script type="text/html" id="turnoutrate"> 278 <script type="text/html" id="turnoutrate">
279 {{each list as obj i}} 279 {{each list as obj i}}
280 <tr> 280 <tr>
281 - <td>{{obj.rq}}</td>  
282 - <td>{{obj.gs}}</td>  
283 - <td>{{obj.zhgs}}</td>  
284 - <td>{{obj.xl}}</td>  
285 - <td>{{obj.cchjh}}</td>  
286 - <td>{{obj.cchsj}}</td>  
287 - <td>{{obj.cchqz}}</td>  
288 - <td>{{obj.chl}}</td>  
289 - <td>{{obj.bcjh}}</td>  
290 - <td>{{obj.bcsj}}</td>  
291 - <td>{{obj.bbzxl}}</td>  
292 - <td>{{obj.gs}}</td> 281 + {{if obj.rq == '分类汇总'}}
  282 + <td colspan='3'>{{obj.rq}}</td>
  283 + {{/if}}
  284 + {{if obj.rq != '分类汇总'}}
  285 + <td>{{obj.rq}}</td>
  286 + <td>{{obj.gsName}}</td>
  287 + <td>{{obj.fgsName}}</td>
  288 + {{/if}}
  289 + <td>{{obj.line}}</td>
  290 + <td>{{obj.jhcc}}</td>
  291 + <td>{{obj.sjcc}}</td>
  292 + <td>{{obj.qz}}</td>
  293 + <td>{{obj.ccl}}</td>
  294 + <td>{{obj.jhbc}}</td>
  295 + <td>{{obj.sjbc}}</td>
  296 + <td>{{obj.zxl}}</td>
  297 + <td>{{obj.sm}}</td>
293 </tr> 298 </tr>
294 {{/each}} 299 {{/each}}
295 {{if list.length == 0}} 300 {{if list.length == 0}}