Commit 6f16079f2155ff85fee084333c6d7535fb6f3dfa

Authored by 娄高锋
1 parent 815bcf48

人员配置接口中间添加有售票员的线路其配驾驶员数、配售票员数、配车辆数

src/main/java/com/bsth/server_rs/bigdata/BigscreenService.java
... ... @@ -352,7 +352,7 @@ public class BigscreenService {
352 352  
353 353 if(gpSet.contains(t.get("lineCode").toString())){
354 354 Map<String, Object> gp = new HashMap<String, Object>();
355   - gp.put("type", "起讫站发车准点详情");
  355 + gp.put("type", "挂牌线路发车准点详情");
356 356 gp.put("lineName", t.get("lineName").toString());
357 357 gp.put("jh", t.get("jhszfcs").toString());
358 358 gp.put("sj", t.get("sjszfczds").toString());
... ... @@ -410,7 +410,6 @@ public class BigscreenService {
410 410 dd1.setTime(dd.getTime() - 1l*1000*60*60*24);
411 411 String date1 = sd.format(dd1); //前一天
412 412 List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(date1);
413   - List<ScheduleRealInfo> list_jh = new ArrayList<ScheduleRealInfo>();
414 413 List<ScheduleRealInfo> list_sj = new ArrayList<ScheduleRealInfo>();
415 414 for(ScheduleRealInfo s : findAll){
416 415 if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路
... ... @@ -424,25 +423,25 @@ public class BigscreenService {
424 423 }
425 424 }
426 425 }
427   - double jhyygl = culateJhgl(list_jh);//计划营运公里
  426 + double jhyygl = culateJhgl(findAll);//计划营运公里
428 427 double sjgl = culateSjgl(list_sj);//实际公里
429 428 double sjljgl = culateLjgl(list_sj);//实际临加公里
430 429 double sjyygl = Arith.add(sjgl, sjljgl);//实际营运公里
431   - double lz = culateCJLC(list_jh, "路阻");
432   - double dm = culateCJLC(list_jh, "吊慢");
433   - double gz = culateCJLC(list_jh, "故障");
434   - double jf = culateCJLC(list_jh, "纠纷");
435   - double zs = culateCJLC(list_jh, "肇事");
436   - double qr = culateCJLC(list_jh, "缺人");
437   - double qc = culateCJLC(list_jh, "缺车");
  430 + double lz = culateCJLC(list_sj, "路阻");
  431 + double dm = culateCJLC(list_sj, "吊慢");
  432 + double gz = culateCJLC(list_sj, "故障");
  433 + double jf = culateCJLC(list_sj, "纠纷");
  434 + double zs = culateCJLC(list_sj, "肇事");
  435 + double qr = culateCJLC(list_sj, "缺人");
  436 + double qc = culateCJLC(list_sj, "缺车");
438 437 double qrqc = Arith.add(qr, qc);//缺人缺车
439   - double kx = culateCJLC(list_jh, "客稀");
440   - double qh = culateCJLC(list_jh, "气候");
441   - double yw = culateCJLC(list_jh, "援外");
442   - double lb_pc = culateCJLC(list_jh, "配车");
443   - double lb_by = culateCJLC(list_jh, "保养");
444   - double lb_cj = culateCJLC(list_jh, "抽减");
445   - double lb_qt = culateCJLC(list_jh, "其他");
  438 + double kx = culateCJLC(list_sj, "客稀");
  439 + double qh = culateCJLC(list_sj, "气候");
  440 + double yw = culateCJLC(list_sj, "援外");
  441 + double lb_pc = culateCJLC(list_sj, "配车");
  442 + double lb_by = culateCJLC(list_sj, "保养");
  443 + double lb_cj = culateCJLC(list_sj, "抽减");
  444 + double lb_qt = culateCJLC(list_sj, "其他");
446 445 double qt = Arith.add(Arith.add(lb_pc, lb_by), Arith.add(lb_cj, lb_qt));//其他
447 446  
448 447 Map<String, Object> jhyyglMap = new HashMap<String, Object>();
... ... @@ -548,9 +547,9 @@ public class BigscreenService {
548 547 String lineSql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level,"
549 548 + " a.shanghai_linecode, a.nature from "
550 549 + " bsth_c_line a left join bsth_c_line_config b "
551   - + " on a.id=b.line where "
552   - + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 "
553   - + " and a.remove=0 and a.nature in ('yxl','cgxl','gjxl','csbs','cctxl')";
  550 + + " on a.id=b.line where a.shanghai_linecode is not null"
  551 + + " and a.shanghai_linecode !='' and a.destroy=0 and a.remove=0"
  552 + + " and a.nature in ('yxl','cgxl','gjxl','csbs','cctxl')";
554 553 List<Map<String, Object>> lineList=jdbcTemplate.query(lineSql,
555 554 new RowMapper<Map<String, Object>>(){
556 555 @Override
... ... @@ -662,10 +661,10 @@ public class BigscreenService {
662 661 + " where e.is_cancel = 0 group by e.jsy, e.xl ) a"
663 662 + " left join bsth_c_personnel p on a.jsy = p.id"
664 663 + " group by p.company_code";
665   - List<Map<String, Object>> jsyList=jdbcTemplate.query(gpLineSql,
  664 + List<Map<String, Object>> ecList=jdbcTemplate.query(gpLineSql,
666 665 new RowMapper<Map<String, Object>>(){
667 666 @Override
668   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  667 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
669 668 Map<String, Object> m=new HashMap<String,Object>();
670 669 m.put("company", rs.getString("company_code"));
671 670 m.put("jsy", rs.getString("jsy"));
... ... @@ -674,24 +673,78 @@ public class BigscreenService {
674 673 }
675 674 });
676 675  
677   - for(Map<String, Object> m : jsyList){
  676 + List<Map<String, Object>> jsyList = new ArrayList<Map<String, Object>>();
  677 + Map<String, Object> ygMap = new HashMap<String, Object>();
  678 + ygMap.put("company", "杨高");
  679 + ygMap.put("jsy", "0");
  680 + ygMap.put("line", "0");
  681 + Map<String, Object> snMap = new HashMap<String, Object>();
  682 + snMap.put("company", "上南");
  683 + snMap.put("jsy", "0");
  684 + snMap.put("line", "0");
  685 + Map<String, Object> jgMap = new HashMap<String, Object>();
  686 + jgMap.put("company", "金高");
  687 + jgMap.put("jsy", "0");
  688 + jgMap.put("line", "0");
  689 + Map<String, Object> nhMap = new HashMap<String, Object>();
  690 + nhMap.put("company", "南汇");
  691 + nhMap.put("jsy", "0");
  692 + nhMap.put("line", "0");
  693 + for(Map<String, Object> m : ecList){ //顺序:杨高,上南,金高,南汇
  694 + if("05".equals(m.get("company").toString())){
  695 +// m.put("company", "杨高");
  696 + ygMap.put("jsy", m.get("jsy").toString());
  697 + ygMap.put("line", m.get("line").toString());
  698 + }
678 699 if("55".equals(m.get("company").toString())){
679   - m.put("company", "上南");
  700 +// m.put("company", "上南");
  701 + snMap.put("jsy", m.get("jsy").toString());
  702 + snMap.put("line", m.get("line").toString());
680 703 }
681 704 if("22".equals(m.get("company").toString())){
682   - m.put("company", "金高");
683   - }
684   - if("05".equals(m.get("company").toString())){
685   - m.put("company", "杨高");
  705 +// m.put("company", "金高");
  706 + jgMap.put("jsy", m.get("jsy").toString());
  707 + jgMap.put("line", m.get("line").toString());
686 708 }
687 709 if("26".equals(m.get("company").toString())){
688   - m.put("company", "南汇");
  710 +// m.put("company", "南汇");
  711 + nhMap.put("jsy", m.get("jsy").toString());
  712 + nhMap.put("line", m.get("line").toString());
689 713 }
690 714 }
  715 + jsyList.add(ygMap);
  716 + jsyList.add(snMap);
  717 + jsyList.add(jgMap);
  718 + jsyList.add(nhMap);
  719 +
  720 + String xlSql = "select (select name from bsth_c_line l where l.id = t.xl) line_name, a.jsy, b.spy, c.cl"
  721 + + " from (select xl from bsth_c_s_ecinfo e where e.spy is not null and e.is_cancel = 0 group by xl) t"
  722 + + " left join "
  723 + + " (select a.xl, count(1) jsy from (select a.xl, a.jsy from bsth_c_s_ecinfo a where a.is_cancel = 0 and a.jsy is not null group by xl, jsy) a group by xl) a"
  724 + + " on t.xl = a.xl"
  725 + + " left join"
  726 + + " (select b.xl, count(1) spy from (select b.xl, b.spy from bsth_c_s_ecinfo b where b.is_cancel = 0 and b.spy is not null group by xl, spy) b group by xl) b"
  727 + + " on t.xl = b.xl"
  728 + + " left join"
  729 + + " (select c.xl, count(1) cl from (select c.xl, c.cl from bsth_c_s_ccinfo c where c.is_cancel = 0 and c.cl is not null and c.qyrq < now() group by xl, cl) c group by xl) c"
  730 + + " on t.xl = c.xl";
  731 + List<Map<String, Object>> xlConfigList=jdbcTemplate.query(xlSql,
  732 + new RowMapper<Map<String, Object>>(){
  733 + @Override
  734 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  735 + Map<String, Object> m=new HashMap<String,Object>();
  736 + m.put("lineName", rs.getString("line_name"));
  737 + m.put("jsy", rs.getString("jsy"));
  738 + m.put("spy", rs.getString("spy"));
  739 + m.put("cl", rs.getString("cl"));
  740 + return m;
  741 + }
  742 + });
691 743  
692 744 resMap.put("jsyList", jsyList);
693 745 resMap.put("attList", attList);
694 746 resMap.put("lackList", lackList);
  747 + resMap.put("configList", xlConfigList);
695 748  
696 749 return JSON.parseObject(JSON.toJSONString(resMap));
697 750 }
... ... @@ -703,7 +756,7 @@ public class BigscreenService {
703 756 Map<String, Object> tempMap = new HashMap<String, Object>();
704 757 tempMap.put("type", type);
705 758 String[] split = dates[i].split("-");
706   - tempMap.put("type", split[1] + "/" + split[2]);
  759 + tempMap.put("date", split[1] + "/" + split[2]);
707 760 tempMap.put("jh", "0");
708 761 tempMap.put("sj", "0");
709 762 mapList.add(tempMap);
... ...