Commit 29b8a731ecad0695cd2aea1564e7fddec0a5b3a8
1 parent
66b33865
补工单的报表:1、停站时间分析;2、停站时间分析(汇总);
Showing
9 changed files
with
1796 additions
and
1 deletions
src/main/java/com/bsth/controller/schedule/PeopleCarPlanController.java
| @@ -69,5 +69,15 @@ public class PeopleCarPlanController { | @@ -69,5 +69,15 @@ public class PeopleCarPlanController { | ||
| 69 | return peopleCarPlanService.commandByJghList(map); | 69 | return peopleCarPlanService.commandByJghList(map); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | + @RequestMapping(value="/dwellTime", method = RequestMethod.GET) | ||
| 73 | + public Map<String, Object> dwellTime(@RequestParam Map<String, Object> map){ | ||
| 74 | + return peopleCarPlanService.dwellTime(map); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @RequestMapping(value="/dwellTime_sum", method = RequestMethod.GET) | ||
| 78 | + public Map<String, Object> dwellTime_sum(@RequestParam Map<String, Object> map){ | ||
| 79 | + return peopleCarPlanService.dwellTime_sum(map); | ||
| 80 | + } | ||
| 81 | + | ||
| 72 | 82 | ||
| 73 | } | 83 | } |
src/main/java/com/bsth/service/schedule/PeopleCarPlanService.java
| @@ -22,4 +22,8 @@ public interface PeopleCarPlanService { | @@ -22,4 +22,8 @@ public interface PeopleCarPlanService { | ||
| 22 | List<Map<String, Object>> commandState(Map<String, Object> map); | 22 | List<Map<String, Object>> commandState(Map<String, Object> map); |
| 23 | List<Map<String, Object>> commandByLineList(Map<String, Object> map); | 23 | List<Map<String, Object>> commandByLineList(Map<String, Object> map); |
| 24 | List<Map<String, Object>> commandByJghList(Map<String, Object> map); | 24 | List<Map<String, Object>> commandByJghList(Map<String, Object> map); |
| 25 | + | ||
| 26 | + Map<String, Object> dwellTime(Map<String, Object> map); | ||
| 27 | + Map<String, Object> dwellTime_sum(Map<String, Object> map); | ||
| 28 | + | ||
| 25 | } | 29 | } |
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
| 1 | package com.bsth.service.schedule.impl; | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
| 4 | +import java.math.RoundingMode; | ||
| 4 | import java.sql.ResultSet; | 5 | import java.sql.ResultSet; |
| 5 | import java.sql.SQLException; | 6 | import java.sql.SQLException; |
| 6 | import java.text.DecimalFormat; | 7 | import java.text.DecimalFormat; |
| @@ -8,7 +9,9 @@ import java.text.NumberFormat; | @@ -8,7 +9,9 @@ import java.text.NumberFormat; | ||
| 8 | import java.text.ParseException; | 9 | import java.text.ParseException; |
| 9 | import java.text.SimpleDateFormat; | 10 | import java.text.SimpleDateFormat; |
| 10 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
| 12 | +import java.util.Calendar; | ||
| 11 | import java.util.Collections; | 13 | import java.util.Collections; |
| 14 | +import java.util.Comparator; | ||
| 12 | import java.util.Date; | 15 | import java.util.Date; |
| 13 | import java.util.HashMap; | 16 | import java.util.HashMap; |
| 14 | import java.util.HashSet; | 17 | import java.util.HashSet; |
| @@ -17,6 +20,7 @@ import java.util.List; | @@ -17,6 +20,7 @@ import java.util.List; | ||
| 17 | import java.util.Map; | 20 | import java.util.Map; |
| 18 | import java.util.Set; | 21 | import java.util.Set; |
| 19 | 22 | ||
| 23 | +import org.apache.axis2.databinding.types.soapencoding.Array; | ||
| 20 | import org.springframework.beans.factory.annotation.Autowired; | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | import org.springframework.jdbc.core.JdbcTemplate; | 25 | import org.springframework.jdbc.core.JdbcTemplate; |
| 22 | import org.springframework.jdbc.core.RowMapper; | 26 | import org.springframework.jdbc.core.RowMapper; |
| @@ -2571,4 +2575,1044 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -2571,4 +2575,1044 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 2571 | return list_; | 2575 | return list_; |
| 2572 | } | 2576 | } |
| 2573 | 2577 | ||
| 2578 | + @Override | ||
| 2579 | + public Map<String, Object> dwellTime(Map<String, Object> map) { | ||
| 2580 | + DecimalFormat df = new DecimalFormat("0.##"); | ||
| 2581 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 2582 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | ||
| 2583 | + List<ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>(); | ||
| 2584 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 2585 | + List<String> keyList = new ArrayList<String>(); | ||
| 2586 | + Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>(); | ||
| 2587 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 2588 | + | ||
| 2589 | + String company = ""; | ||
| 2590 | + if(map.get("company")!=null) | ||
| 2591 | + company=map.get("company").toString(); | ||
| 2592 | + String subCompany = ""; | ||
| 2593 | + if(map.get("subCompany")!=null) | ||
| 2594 | + subCompany=map.get("subCompany").toString(); | ||
| 2595 | + String page = map.get("page").toString(); | ||
| 2596 | + String line = map.get("line").toString(); | ||
| 2597 | + String bcType = map.get("bcType").toString(); | ||
| 2598 | + String startDate = map.get("startDate").toString(); | ||
| 2599 | + String endDate = map.get("endDate").toString(); | ||
| 2600 | + String weeks_str = map.get("weeks").toString(); | ||
| 2601 | + String[] weeks = {}; | ||
| 2602 | + String type = map.get("type").toString(); | ||
| 2603 | + if(weeks_str.length() > 0){ | ||
| 2604 | + weeks = weeks_str.split(","); | ||
| 2605 | + } | ||
| 2606 | + | ||
| 2607 | + if(startDate.length() == 0){ | ||
| 2608 | + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | ||
| 2609 | + } | ||
| 2610 | + if(endDate.length() == 0){ | ||
| 2611 | + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | ||
| 2612 | + } | ||
| 2613 | + try { | ||
| 2614 | + List<String> strList = new ArrayList<String>(); | ||
| 2615 | + strList.add(startDate); | ||
| 2616 | + strList.add(endDate); | ||
| 2617 | + | ||
| 2618 | + String sql = "select schedule_date_str,real_exec_date,xl_name,bc_type,gs_name,fgs_name,fgs_bm,bcs,bcsj," | ||
| 2619 | + +"fcno,fcsj,fcsj_actual,zdsj,zdsj_actual,qdz_name,zdz_name,sp_id,cc_service,lp_name" | ||
| 2620 | + +" from bsth_c_s_sp_info_real where schedule_date_str >= ?" | ||
| 2621 | + +" and schedule_date_str <= ?"; | ||
| 2622 | + if(line.length() != 0){ | ||
| 2623 | + sql += " and xl_bm = ?"; | ||
| 2624 | + strList.add(line); | ||
| 2625 | + } | ||
| 2626 | + if(company.length() != 0){ | ||
| 2627 | + sql += " and gs_bm = ?"; | ||
| 2628 | + strList.add(company); | ||
| 2629 | + } | ||
| 2630 | + if(subCompany.length() != 0){ | ||
| 2631 | + sql += " and fgs_bm = ?"; | ||
| 2632 | + strList.add(subCompany); | ||
| 2633 | + } | ||
| 2634 | +// sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; // 这里不过滤,要用来判断有没有回场出场 | ||
| 2635 | +// if(Integer.valueOf(bcType) == 1){ // venting:直放;region:区间; | ||
| 2636 | +// sql += " and bc_type != 'venting' and bc_type != 'region'"; | ||
| 2637 | +// } else if(Integer.valueOf(bcType) == 2){ | ||
| 2638 | +// sql += " and bc_type != 'venting'"; | ||
| 2639 | +// } else if(Integer.valueOf(bcType) == 3){ | ||
| 2640 | +// sql += " and bc_type != 'region'"; | ||
| 2641 | +// } | ||
| 2642 | + sql += " order by schedule_date_str, real_exec_date, lp_name, fcsj"; | ||
| 2643 | + tempList = jdbcTemplate.query(sql, strList.toArray(), | ||
| 2644 | + new RowMapper<ScheduleRealInfo>(){ | ||
| 2645 | + @Override | ||
| 2646 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 2647 | + ScheduleRealInfo schedule = new ScheduleRealInfo(); | ||
| 2648 | + schedule.setScheduleDateStr(rs.getString("schedule_date_str")); | ||
| 2649 | + schedule.setRealExecDate(rs.getString("real_exec_date")); | ||
| 2650 | + schedule.setXlName(rs.getString("xl_name")); | ||
| 2651 | + schedule.setBcType(rs.getString("bc_type")); | ||
| 2652 | + schedule.setGsName(rs.getString("gs_name")); | ||
| 2653 | + schedule.setFgsName(rs.getString("fgs_name")); | ||
| 2654 | + schedule.setFgsBm(rs.getString("fgs_bm")); | ||
| 2655 | + schedule.setBcs(rs.getInt("bcs")); | ||
| 2656 | + schedule.setBcsj(rs.getInt("bcsj")); | ||
| 2657 | + schedule.setFcno(rs.getInt("fcno")); | ||
| 2658 | + schedule.setFcsj(rs.getString("fcsj")); | ||
| 2659 | + schedule.setFcsjActual(rs.getString("fcsj_actual")); | ||
| 2660 | + schedule.setZdsj(rs.getString("zdsj")); | ||
| 2661 | + schedule.setZdsjActual(rs.getString("zdsj_actual")); | ||
| 2662 | + schedule.setQdzName(rs.getString("qdz_name")); | ||
| 2663 | + schedule.setZdzName(rs.getString("zdz_name")); | ||
| 2664 | + schedule.setSpId(rs.getLong("sp_id")); | ||
| 2665 | + schedule.setCcService(rs.getBoolean("cc_service")); | ||
| 2666 | + schedule.setLpName(rs.getString("lp_name")); | ||
| 2667 | + | ||
| 2668 | + if(schedule.getFcsjActual() != null && schedule.getFcsjActual().trim().length() == 0){ | ||
| 2669 | + schedule.setFcsjActual(null); | ||
| 2670 | + } | ||
| 2671 | + if(schedule.getZdsjActual() != null && schedule.getZdsjActual().trim().length() == 0){ | ||
| 2672 | + schedule.setZdsjActual(null); | ||
| 2673 | + } | ||
| 2674 | + if(schedule.getFcsj() != null && schedule.getZdsj() != null){ | ||
| 2675 | + String[] split1 = schedule.getFcsj().split(":"); | ||
| 2676 | + String[] split2 = schedule.getZdsj().split(":"); | ||
| 2677 | + int fcsj = Integer.valueOf(split1[0]) * 60 + Integer.valueOf(split1[1]); | ||
| 2678 | + int zdsj = Integer.valueOf(split2[0]) * 60 + Integer.valueOf(split2[1]); | ||
| 2679 | + if(zdsj < fcsj){ | ||
| 2680 | + zdsj += 1440; | ||
| 2681 | + schedule.setZdsj((zdsj/60>9?zdsj/60:"0"+zdsj/60) + ":" + (zdsj%60>9?zdsj%60:"0"+zdsj%60)); | ||
| 2682 | + } | ||
| 2683 | + schedule.setFcsjT((long)fcsj); | ||
| 2684 | + schedule.setZdsjT((long)zdsj); | ||
| 2685 | + } | ||
| 2686 | + if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null){ | ||
| 2687 | + String[] split3 = schedule.getFcsjActual().split(":"); | ||
| 2688 | + String[] split4 = schedule.getZdsjActual().split(":"); | ||
| 2689 | + int fcsjA = Integer.valueOf(split3[0]) * 60 + Integer.valueOf(split3[1]); | ||
| 2690 | + int zdsjA = Integer.valueOf(split4[0]) * 60 + Integer.valueOf(split4[1]); | ||
| 2691 | + if(fcsjA > zdsjA){ | ||
| 2692 | + zdsjA += 1440; | ||
| 2693 | + schedule.setZdsjActual((zdsjA/60>9?zdsjA/60:"0"+zdsjA/60) + ":" + (zdsjA%60>9?zdsjA%60:"0"+zdsjA%60)); | ||
| 2694 | + } | ||
| 2695 | + schedule.setFcsjActualTime((long)fcsjA); | ||
| 2696 | + schedule.setZdsjActualTime((long)zdsjA); | ||
| 2697 | + } | ||
| 2698 | + | ||
| 2699 | + return schedule; | ||
| 2700 | + } | ||
| 2701 | + }); | ||
| 2702 | + | ||
| 2703 | + } catch (Exception e) { | ||
| 2704 | + // TODO Auto-generated catch block | ||
| 2705 | + e.printStackTrace(); | ||
| 2706 | + } | ||
| 2707 | + | ||
| 2708 | + | ||
| 2709 | + for(ScheduleRealInfo schedule : tempList){ | ||
| 2710 | + if(weeks.length == 0){ | ||
| 2711 | + list.add(schedule); | ||
| 2712 | + } else { | ||
| 2713 | + try { | ||
| 2714 | + Date scheduleDate = sdf.parse(schedule.getScheduleDateStr()); | ||
| 2715 | + Calendar cal = Calendar.getInstance(); | ||
| 2716 | + cal.setTime(scheduleDate); | ||
| 2717 | + int i = cal.get(cal.DAY_OF_WEEK) - 1; | ||
| 2718 | + if(i == 0){ | ||
| 2719 | + i = 7; // 周日 | ||
| 2720 | + } | ||
| 2721 | + if(weeks_str.contains(i+"")){ | ||
| 2722 | + list.add(schedule); | ||
| 2723 | + } | ||
| 2724 | + } catch (Exception e) { | ||
| 2725 | + // TODO Auto-generated catch block | ||
| 2726 | + e.printStackTrace(); | ||
| 2727 | + } | ||
| 2728 | + } | ||
| 2729 | + } | ||
| 2730 | + | ||
| 2731 | + | ||
| 2732 | + ScheduleRealInfo p_schedule = null; | ||
| 2733 | + for(ScheduleRealInfo schedule : list){ // 计划 | ||
| 2734 | + try { | ||
| 2735 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 2736 | + if(schedule.isCcService()){ | ||
| 2737 | + continue; | ||
| 2738 | + } | ||
| 2739 | + if(schedule.isSflj()){ | ||
| 2740 | + continue; | ||
| 2741 | + } | ||
| 2742 | + String scheduleDate = schedule.getScheduleDateStr(); | ||
| 2743 | + String realDate = schedule.getRealExecDate(); | ||
| 2744 | + String gsName = schedule.getGsName(); | ||
| 2745 | + String fgsName = schedule.getFgsName(); | ||
| 2746 | + String xlName = schedule.getXlName(); | ||
| 2747 | + String qdzName = schedule.getQdzName(); | ||
| 2748 | + String lpName = schedule.getLpName(); | ||
| 2749 | + String sBcType = schedule.getBcType(); | ||
| 2750 | + String fcsj = schedule.getFcsj(); | ||
| 2751 | + Integer bcsj = schedule.getBcsj(); | ||
| 2752 | + if(p_schedule == null){ | ||
| 2753 | + p_schedule = schedule; | ||
| 2754 | + continue; | ||
| 2755 | + } else { | ||
| 2756 | + if("in,out,ldks".contains(sBcType) || "in,out,ldks".contains(p_schedule.getBcType()) | ||
| 2757 | + || !(schedule.getScheduleDateStr().equals(p_schedule.getScheduleDateStr())) | ||
| 2758 | + || !(schedule.getLpName().equals(p_schedule.getLpName())) | ||
| 2759 | + || !(schedule.getQdzName().equals(p_schedule.getZdzName())) | ||
| 2760 | + ){ | ||
| 2761 | + p_schedule = schedule; | ||
| 2762 | + continue; | ||
| 2763 | + } | ||
| 2764 | + Long zdsjT = p_schedule.getZdsjT(); | ||
| 2765 | + Long fcsjT = schedule.getFcsjT(); | ||
| 2766 | + if(fcsjT < zdsjT){ | ||
| 2767 | + fcsjT += 1440; | ||
| 2768 | + } | ||
| 2769 | + long jhtz = fcsjT - zdsjT; | ||
| 2770 | + | ||
| 2771 | + if(jhtz >= 110){ // 超过2小时停站时间不计算 | ||
| 2772 | + p_schedule = schedule; | ||
| 2773 | + continue; | ||
| 2774 | + } | ||
| 2775 | + | ||
| 2776 | + String key = gsName + "/" + fgsName + "/" + xlName + "/" + qdzName + "/" + lpName + "/" + fcsj; | ||
| 2777 | + Map<String, Object> temp = new HashMap<String, Object>(); | ||
| 2778 | + temp.put("gsName", gsName); | ||
| 2779 | + temp.put("fgsName", fgsName); | ||
| 2780 | + temp.put("xlName", xlName); | ||
| 2781 | + temp.put("qdzName", qdzName); | ||
| 2782 | + temp.put("lpName", lpName); | ||
| 2783 | + temp.put("sBcType", sBcType); | ||
| 2784 | + temp.put("fcsj", fcsj); | ||
| 2785 | + temp.put("bcsj", bcsj); | ||
| 2786 | + temp.put("jhtz", jhtz); | ||
| 2787 | + | ||
| 2788 | + if(!keyMap.containsKey(key)){ | ||
| 2789 | + keyMap.put(key, new ArrayList<Map<String, Object>>()); | ||
| 2790 | + keyList.add(key); | ||
| 2791 | + keyMap.get(key).add(temp); | ||
| 2792 | + } | ||
| 2793 | + | ||
| 2794 | + p_schedule = schedule; | ||
| 2795 | + } | ||
| 2796 | + | ||
| 2797 | + } catch (Exception e) { | ||
| 2798 | + // TODO: handle exception | ||
| 2799 | + e.printStackTrace(); | ||
| 2800 | + } | ||
| 2801 | + } | ||
| 2802 | + | ||
| 2803 | + | ||
| 2804 | + List<String> keyList_sj = new ArrayList<String>(); | ||
| 2805 | + Map<String, List<ScheduleRealInfo>> keyMap_sj = new HashMap<String, List<ScheduleRealInfo>>(); | ||
| 2806 | + for(ScheduleRealInfo schedule : list){ // 实际班次分组排序(按实际发车时间排序) | ||
| 2807 | + if(schedule.isCcService()){ | ||
| 2808 | + continue; | ||
| 2809 | + } | ||
| 2810 | + if(schedule.getStatus() != -1 | ||
| 2811 | + && schedule.getFcsjActual() != null && schedule.getFcsjActual().trim().length() > 0 | ||
| 2812 | + && schedule.getZdsjActual() != null && schedule.getZdsjActual().trim().length() > 0){ | ||
| 2813 | + String scheduleDate = schedule.getScheduleDateStr(); | ||
| 2814 | + String realDate = schedule.getRealExecDate(); | ||
| 2815 | + String gsName = schedule.getGsName(); | ||
| 2816 | + String fgsName = schedule.getFgsName(); | ||
| 2817 | + String xlName = schedule.getXlName(); | ||
| 2818 | + String lpName = schedule.getLpName(); | ||
| 2819 | + String key = scheduleDate + "/" + realDate + "/" + gsName + "/" + fgsName + "/" + xlName + "/" + lpName; | ||
| 2820 | + if(!keyMap_sj.containsKey(key)){ | ||
| 2821 | + keyMap_sj.put(key, new ArrayList<ScheduleRealInfo>()); | ||
| 2822 | + keyList_sj.add(key); | ||
| 2823 | + } | ||
| 2824 | + keyMap_sj.get(key).add(schedule); | ||
| 2825 | + } | ||
| 2826 | + } | ||
| 2827 | + | ||
| 2828 | + for(String key_sj : keyList_sj){ | ||
| 2829 | + List<ScheduleRealInfo> list_sj = keyMap_sj.get(key_sj); | ||
| 2830 | + //按实际发车时间排序 | ||
| 2831 | + Collections.sort(list_sj, new Comparator<ScheduleRealInfo>() { | ||
| 2832 | + @Override | ||
| 2833 | + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | ||
| 2834 | + String[] split1 = s1.getFcsjActual().split(":"); | ||
| 2835 | + String[] split2 = s2.getFcsjActual().split(":"); | ||
| 2836 | + int fcsj1 = Integer.valueOf(split1[0]) * 60 + Integer.valueOf(split1[1]); | ||
| 2837 | + int fcsj2 = Integer.valueOf(split2[0]) * 60 + Integer.valueOf(split2[1]); | ||
| 2838 | + if((!(s1.getScheduleDateStr().equals(s1.getRealExecDate())) && fcsj1 < 720) | ||
| 2839 | + || s1.getFcsjT() - s1.getFcsjActualTime() > 720){ // 720是12小时,判断是否跨天 | ||
| 2840 | + fcsj1 += 1440; | ||
| 2841 | + } | ||
| 2842 | + if((!(s2.getScheduleDateStr().equals(s2.getRealExecDate())) && fcsj2 < 720) | ||
| 2843 | + || s2.getFcsjT() - s2.getFcsjActualTime() > 720){ // 720是12小时,判断是否跨天 | ||
| 2844 | + fcsj2 += 1440; | ||
| 2845 | + } | ||
| 2846 | + | ||
| 2847 | + // i1 - i2 = 升序; i2 - i1 = 降序; | ||
| 2848 | + int diff = fcsj1 - fcsj2; | ||
| 2849 | + if (diff > 0) { | ||
| 2850 | + return 1; | ||
| 2851 | + }else if (diff < 0) { | ||
| 2852 | + return -1; | ||
| 2853 | + } | ||
| 2854 | + return 0; //相等为0 | ||
| 2855 | + } | ||
| 2856 | + }); | ||
| 2857 | + | ||
| 2858 | + p_schedule = null; | ||
| 2859 | + for(ScheduleRealInfo schedule : list_sj){ | ||
| 2860 | + try { | ||
| 2861 | + String scheduleDate = schedule.getScheduleDateStr(); | ||
| 2862 | + String realDate = schedule.getRealExecDate(); | ||
| 2863 | + String gsName = schedule.getGsName(); | ||
| 2864 | + String fgsName = schedule.getFgsName(); | ||
| 2865 | + String xlName = schedule.getXlName(); | ||
| 2866 | + String qdzName = schedule.getQdzName(); | ||
| 2867 | + String lpName = schedule.getLpName(); | ||
| 2868 | + String sBcType = schedule.getBcType(); | ||
| 2869 | + String fcsj = schedule.getFcsj(); | ||
| 2870 | + Integer bcsj = schedule.getBcsj(); | ||
| 2871 | + if(p_schedule == null){ | ||
| 2872 | + p_schedule = schedule; | ||
| 2873 | + continue; | ||
| 2874 | + } else { | ||
| 2875 | + if("in,out,ldks".contains(sBcType) || "in,out,ldks".contains(p_schedule.getBcType()) | ||
| 2876 | + || !(schedule.getScheduleDateStr().equals(p_schedule.getScheduleDateStr())) | ||
| 2877 | + || !(schedule.getLpName().equals(p_schedule.getLpName())) | ||
| 2878 | + || !(schedule.getQdzName().equals(p_schedule.getZdzName())) | ||
| 2879 | + ){ | ||
| 2880 | + p_schedule = schedule; | ||
| 2881 | + continue; | ||
| 2882 | + } | ||
| 2883 | + | ||
| 2884 | + Long zdsjT = p_schedule.getZdsjT(); | ||
| 2885 | + Long fcsjT = schedule.getFcsjT(); | ||
| 2886 | + if(fcsjT < zdsjT){ | ||
| 2887 | + fcsjT += 1440; | ||
| 2888 | + } | ||
| 2889 | + long jhtz = fcsjT - zdsjT; | ||
| 2890 | + | ||
| 2891 | + Long zdsjAT = p_schedule.getZdsjActualTime(); | ||
| 2892 | + Long fcsjAT = schedule.getFcsjActualTime(); | ||
| 2893 | + if(fcsjAT < zdsjAT){ | ||
| 2894 | + fcsjAT += 1440; | ||
| 2895 | + } | ||
| 2896 | + long sjtz = fcsjAT - zdsjAT; | ||
| 2897 | + | ||
| 2898 | + Long zdsjAT1 = schedule.getZdsjActualTime(); | ||
| 2899 | + if(zdsjAT1 < fcsjAT){ | ||
| 2900 | + zdsjAT1 += 1440; | ||
| 2901 | + } | ||
| 2902 | + long sj_bcsj = zdsjAT1 - fcsjAT; | ||
| 2903 | + | ||
| 2904 | + if(jhtz >= 110 || sjtz >= 110){ // 超过2小时停站时间不计算 | ||
| 2905 | + p_schedule = schedule; | ||
| 2906 | + continue; | ||
| 2907 | + } | ||
| 2908 | + | ||
| 2909 | + String key = gsName + "/" + fgsName + "/" + xlName + "/" + qdzName + "/" + lpName + "/" + fcsj; | ||
| 2910 | + Map<String, Object> temp = new HashMap<String, Object>(); | ||
| 2911 | + temp.put("gsName", gsName); | ||
| 2912 | + temp.put("fgsName", fgsName); | ||
| 2913 | + temp.put("xlName", xlName); | ||
| 2914 | + temp.put("qdzName", qdzName); | ||
| 2915 | + temp.put("lpName", lpName); | ||
| 2916 | + temp.put("sBcType", sBcType); | ||
| 2917 | + temp.put("fcsj", fcsj); | ||
| 2918 | + temp.put("bcsj", bcsj); | ||
| 2919 | + temp.put("jhtz", jhtz); | ||
| 2920 | + temp.put("sjtz", sjtz); | ||
| 2921 | + temp.put("sjBcsj", sj_bcsj); | ||
| 2922 | + | ||
| 2923 | + if(!keyMap.containsKey(key)){ | ||
| 2924 | + keyMap.put(key, new ArrayList<Map<String, Object>>()); | ||
| 2925 | + keyList.add(key); | ||
| 2926 | + } | ||
| 2927 | + keyMap.get(key).add(temp); | ||
| 2928 | + | ||
| 2929 | + p_schedule = schedule; | ||
| 2930 | + } | ||
| 2931 | + } catch (Exception e) { | ||
| 2932 | + // TODO: handle exception | ||
| 2933 | + e.printStackTrace(); | ||
| 2934 | + } | ||
| 2935 | + } | ||
| 2936 | + } | ||
| 2937 | + | ||
| 2938 | + for(String key : keyList){ | ||
| 2939 | + List<Map<String, Object>> mapList = keyMap.get(key); | ||
| 2940 | + Map<String, Object> m_schedule = mapList.get(0); | ||
| 2941 | + List<Long> sjtzs = new ArrayList<Long>(); // 实际停站时间_总 | ||
| 2942 | + List<Long> sjbcsjs = new ArrayList<Long>(); // 实际班次时间_总(运送时间) | ||
| 2943 | + for(Map<String, Object> m : mapList){ | ||
| 2944 | + if(m.containsKey("sjtz")){ | ||
| 2945 | + sjtzs.add(Long.valueOf(m.get("sjtz").toString())); | ||
| 2946 | + } | ||
| 2947 | + if(m.containsKey("sjBcsj")){ | ||
| 2948 | + sjbcsjs.add(Long.valueOf(m.get("sjBcsj").toString())); | ||
| 2949 | + } | ||
| 2950 | + } | ||
| 2951 | + if(sjtzs.size() > 0){ | ||
| 2952 | + long max_sjtz = sjtzs.get(0), min_sjtz = sjtzs.get(0), sum_sjtz = 0; | ||
| 2953 | + for(Long sjtz : sjtzs){ | ||
| 2954 | + if(sjtz > max_sjtz){ | ||
| 2955 | + max_sjtz = sjtz; | ||
| 2956 | + } | ||
| 2957 | + if(sjtz < min_sjtz){ | ||
| 2958 | + min_sjtz = sjtz; | ||
| 2959 | + } | ||
| 2960 | + sum_sjtz += sjtz; | ||
| 2961 | + } | ||
| 2962 | + String average = df.format(new BigDecimal(sum_sjtz).divide( | ||
| 2963 | + new BigDecimal(sjtzs.size()), 2, RoundingMode.HALF_UP)).toString(); | ||
| 2964 | + m_schedule.put("maxSjtz", max_sjtz); | ||
| 2965 | + m_schedule.put("minSjtz", min_sjtz); | ||
| 2966 | + m_schedule.put("aveSjtz", average); | ||
| 2967 | + } else { | ||
| 2968 | + m_schedule.put("maxSjtz", "/"); | ||
| 2969 | + m_schedule.put("minSjtz", "/"); | ||
| 2970 | + m_schedule.put("aveSjtz", "/"); | ||
| 2971 | + } | ||
| 2972 | + if(sjbcsjs.size() > 0){ | ||
| 2973 | + long sum_bcsj = 0; | ||
| 2974 | + for(Long bcsj : sjbcsjs){ | ||
| 2975 | + sum_bcsj += bcsj; | ||
| 2976 | + } | ||
| 2977 | + String average = df.format(new BigDecimal(sum_bcsj).divide( | ||
| 2978 | + new BigDecimal(sjbcsjs.size()), 2, RoundingMode.HALF_UP)).toString(); | ||
| 2979 | + m_schedule.put("aveBcsj", average); | ||
| 2980 | + } else { | ||
| 2981 | + m_schedule.put("aveBcsj", "/"); | ||
| 2982 | + } | ||
| 2983 | + | ||
| 2984 | + if(!("0".equals(bcType)) && bcType.length() > 0){ | ||
| 2985 | + String sBcType = m_schedule.get("sBcType")+""; | ||
| 2986 | + // venting:直放;region:区间; | ||
| 2987 | + if("1".equals(bcType) && !("venting".equals(sBcType)) && !("region".equals(sBcType))){ | ||
| 2988 | + resList.add(m_schedule); | ||
| 2989 | + } else if("2".equals(bcType) && !("venting".equals(sBcType))){ // 非直放 | ||
| 2990 | + resList.add(m_schedule); | ||
| 2991 | + } else if("3".equals(bcType) && !("region".equals(sBcType))){ // 非区间 | ||
| 2992 | + resList.add(m_schedule); | ||
| 2993 | + } | ||
| 2994 | + } else { | ||
| 2995 | + resList.add(m_schedule); | ||
| 2996 | + } | ||
| 2997 | + } | ||
| 2998 | + | ||
| 2999 | + | ||
| 3000 | + //分页 | ||
| 3001 | + if(page.length() != 0 && type.equals("query")){ | ||
| 3002 | + int currPage = Integer.valueOf(page); | ||
| 3003 | + modelMap.put("totalPage", resList.size()%10>0?(resList.size()/10 + 1):resList.size()/10); | ||
| 3004 | + modelMap.put("dataList", resList); | ||
| 3005 | + } else { | ||
| 3006 | + modelMap.put("dataList", resList); | ||
| 3007 | + } | ||
| 3008 | + | ||
| 3009 | + //导出 | ||
| 3010 | + if(type.equals("export")){ | ||
| 3011 | + String lineName = ""; | ||
| 3012 | + if(map.containsKey("lineName")) | ||
| 3013 | + lineName = map.get("lineName").toString(); | ||
| 3014 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 3015 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 3016 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 3017 | + Map<String,Object> m = new HashMap<String, Object>(); | ||
| 3018 | + ReportUtils ee = new ReportUtils(); | ||
| 3019 | + try { | ||
| 3020 | + listI.add(resList.iterator()); | ||
| 3021 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | ||
| 3022 | + ee.excelReplace(listI, new Object[] { m }, path+"mould/dwellTime.xls", | ||
| 3023 | + path+"export/" | ||
| 3024 | + + sdfSimple.format(sdfMonth.parse(startDate)) + "-" | ||
| 3025 | + + sdfSimple.format(sdfMonth.parse(endDate)) + "-" | ||
| 3026 | + +lineName+"-停站时间分析.xls"); | ||
| 3027 | + } catch (Exception e) { | ||
| 3028 | + // TODO: handle exception | ||
| 3029 | + e.printStackTrace(); | ||
| 3030 | + } | ||
| 3031 | + } | ||
| 3032 | + | ||
| 3033 | + return modelMap; | ||
| 3034 | + } | ||
| 3035 | + | ||
| 3036 | + @Override | ||
| 3037 | + public Map<String, Object> dwellTime_sum(Map<String, Object> map) { | ||
| 3038 | + DecimalFormat df = new DecimalFormat("0.##"); | ||
| 3039 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 3040 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | ||
| 3041 | + List<ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>(); | ||
| 3042 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 3043 | + List<String> keyList = new ArrayList<String>(); | ||
| 3044 | + Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>(); | ||
| 3045 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 3046 | + | ||
| 3047 | + String company = ""; | ||
| 3048 | + if(map.get("company")!=null) | ||
| 3049 | + company=map.get("company").toString(); | ||
| 3050 | + String subCompany = ""; | ||
| 3051 | + if(map.get("subCompany")!=null) | ||
| 3052 | + subCompany=map.get("subCompany").toString(); | ||
| 3053 | + String page = map.get("page").toString(); | ||
| 3054 | + String line = map.get("line").toString(); | ||
| 3055 | + String bcType = map.get("bcType").toString(); | ||
| 3056 | + String startDate = map.get("startDate").toString(); | ||
| 3057 | + String endDate = map.get("endDate").toString(); | ||
| 3058 | + String weeks_str = map.get("weeks").toString(); | ||
| 3059 | + String[] weeks = {}; | ||
| 3060 | + String type = map.get("type").toString(); | ||
| 3061 | + if(weeks_str.length() > 0){ | ||
| 3062 | + weeks = weeks_str.split(","); | ||
| 3063 | + } | ||
| 3064 | + | ||
| 3065 | + if(startDate.length() == 0){ | ||
| 3066 | + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | ||
| 3067 | + } | ||
| 3068 | + if(endDate.length() == 0){ | ||
| 3069 | + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | ||
| 3070 | + } | ||
| 3071 | + try { | ||
| 3072 | + List<String> strList = new ArrayList<String>(); | ||
| 3073 | + strList.add(startDate); | ||
| 3074 | + strList.add(endDate); | ||
| 3075 | + | ||
| 3076 | + String sql = "select schedule_date_str,real_exec_date,xl_name,bc_type,gs_name,fgs_name,fgs_bm,bcs,bcsj," | ||
| 3077 | + +"fcno,fcsj,fcsj_actual,zdsj,zdsj_actual,qdz_name,zdz_name,sp_id,cc_service,lp_name,xl_dir" | ||
| 3078 | + +" from bsth_c_s_sp_info_real where schedule_date_str >= ?" | ||
| 3079 | + +" and schedule_date_str <= ?"; | ||
| 3080 | + if(line.length() != 0){ | ||
| 3081 | + sql += " and xl_bm = ?"; | ||
| 3082 | + strList.add(line); | ||
| 3083 | + } | ||
| 3084 | + if(company.length() != 0){ | ||
| 3085 | + sql += " and gs_bm = ?"; | ||
| 3086 | + strList.add(company); | ||
| 3087 | + } | ||
| 3088 | + if(subCompany.length() != 0){ | ||
| 3089 | + sql += " and fgs_bm = ?"; | ||
| 3090 | + strList.add(subCompany); | ||
| 3091 | + } | ||
| 3092 | +// sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; // 这里不过滤,要用来判断有没有回场出场 | ||
| 3093 | +// if(Integer.valueOf(bcType) == 1){ // venting:直放;region:区间; | ||
| 3094 | +// sql += " and bc_type != 'venting' and bc_type != 'region'"; | ||
| 3095 | +// } else if(Integer.valueOf(bcType) == 2){ | ||
| 3096 | +// sql += " and bc_type != 'venting'"; | ||
| 3097 | +// } else if(Integer.valueOf(bcType) == 3){ | ||
| 3098 | +// sql += " and bc_type != 'region'"; | ||
| 3099 | +// } | ||
| 3100 | + sql += " order by schedule_date_str, real_exec_date, lp_name, fcsj"; | ||
| 3101 | + tempList = jdbcTemplate.query(sql, strList.toArray(), | ||
| 3102 | + new RowMapper<ScheduleRealInfo>(){ | ||
| 3103 | + @Override | ||
| 3104 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 3105 | + ScheduleRealInfo schedule = new ScheduleRealInfo(); | ||
| 3106 | + schedule.setScheduleDateStr(rs.getString("schedule_date_str")); | ||
| 3107 | + schedule.setRealExecDate(rs.getString("real_exec_date")); | ||
| 3108 | + schedule.setXlName(rs.getString("xl_name")); | ||
| 3109 | + schedule.setBcType(rs.getString("bc_type")); | ||
| 3110 | + schedule.setGsName(rs.getString("gs_name")); | ||
| 3111 | + schedule.setFgsName(rs.getString("fgs_name")); | ||
| 3112 | + schedule.setFgsBm(rs.getString("fgs_bm")); | ||
| 3113 | + schedule.setBcs(rs.getInt("bcs")); | ||
| 3114 | + schedule.setBcsj(rs.getInt("bcsj")); | ||
| 3115 | + schedule.setFcno(rs.getInt("fcno")); | ||
| 3116 | + schedule.setFcsj(rs.getString("fcsj")); | ||
| 3117 | + schedule.setFcsjActual(rs.getString("fcsj_actual")); | ||
| 3118 | + schedule.setZdsj(rs.getString("zdsj")); | ||
| 3119 | + schedule.setZdsjActual(rs.getString("zdsj_actual")); | ||
| 3120 | + schedule.setQdzName(rs.getString("qdz_name")); | ||
| 3121 | + schedule.setZdzName(rs.getString("zdz_name")); | ||
| 3122 | + schedule.setSpId(rs.getLong("sp_id")); | ||
| 3123 | + schedule.setCcService(rs.getBoolean("cc_service")); | ||
| 3124 | + schedule.setLpName(rs.getString("lp_name")); | ||
| 3125 | + schedule.setXlDir(rs.getString("xl_dir")); | ||
| 3126 | + | ||
| 3127 | + if(schedule.getFcsjActual() != null && schedule.getFcsjActual().trim().length() == 0){ | ||
| 3128 | + schedule.setFcsjActual(null); | ||
| 3129 | + } | ||
| 3130 | + if(schedule.getZdsjActual() != null && schedule.getZdsjActual().trim().length() == 0){ | ||
| 3131 | + schedule.setZdsjActual(null); | ||
| 3132 | + } | ||
| 3133 | + if(schedule.getFcsj() != null && schedule.getZdsj() != null){ | ||
| 3134 | + String[] split1 = schedule.getFcsj().split(":"); | ||
| 3135 | + String[] split2 = schedule.getZdsj().split(":"); | ||
| 3136 | + int fcsj = Integer.valueOf(split1[0]) * 60 + Integer.valueOf(split1[1]); | ||
| 3137 | + int zdsj = Integer.valueOf(split2[0]) * 60 + Integer.valueOf(split2[1]); | ||
| 3138 | + if(zdsj < fcsj){ | ||
| 3139 | + zdsj += 1440; | ||
| 3140 | + schedule.setZdsj((zdsj/60>9?zdsj/60:"0"+zdsj/60) + ":" + (zdsj%60>9?zdsj%60:"0"+zdsj%60)); | ||
| 3141 | + } | ||
| 3142 | + schedule.setFcsjT((long)fcsj); | ||
| 3143 | + schedule.setZdsjT((long)zdsj); | ||
| 3144 | + } | ||
| 3145 | + if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null){ | ||
| 3146 | + String[] split3 = schedule.getFcsjActual().split(":"); | ||
| 3147 | + String[] split4 = schedule.getZdsjActual().split(":"); | ||
| 3148 | + int fcsjA = Integer.valueOf(split3[0]) * 60 + Integer.valueOf(split3[1]); | ||
| 3149 | + int zdsjA = Integer.valueOf(split4[0]) * 60 + Integer.valueOf(split4[1]); | ||
| 3150 | + if(fcsjA > zdsjA){ | ||
| 3151 | + zdsjA += 1440; | ||
| 3152 | + schedule.setZdsjActual((zdsjA/60>9?zdsjA/60:"0"+zdsjA/60) + ":" + (zdsjA%60>9?zdsjA%60:"0"+zdsjA%60)); | ||
| 3153 | + } | ||
| 3154 | + schedule.setFcsjActualTime((long)fcsjA); | ||
| 3155 | + schedule.setZdsjActualTime((long)zdsjA); | ||
| 3156 | + } | ||
| 3157 | + | ||
| 3158 | + return schedule; | ||
| 3159 | + } | ||
| 3160 | + }); | ||
| 3161 | + | ||
| 3162 | + } catch (Exception e) { | ||
| 3163 | + // TODO Auto-generated catch block | ||
| 3164 | + e.printStackTrace(); | ||
| 3165 | + } | ||
| 3166 | + | ||
| 3167 | + | ||
| 3168 | + for(ScheduleRealInfo schedule : tempList){ | ||
| 3169 | + if(weeks.length == 0){ | ||
| 3170 | + list.add(schedule); | ||
| 3171 | + } else { | ||
| 3172 | + try { | ||
| 3173 | + Date scheduleDate = sdf.parse(schedule.getScheduleDateStr()); | ||
| 3174 | + Calendar cal = Calendar.getInstance(); | ||
| 3175 | + cal.setTime(scheduleDate); | ||
| 3176 | + int i = cal.get(cal.DAY_OF_WEEK) - 1; | ||
| 3177 | + if(i == 0){ | ||
| 3178 | + i = 7; // 周日 | ||
| 3179 | + } | ||
| 3180 | + if(weeks_str.contains(i+"")){ | ||
| 3181 | + list.add(schedule); | ||
| 3182 | + } | ||
| 3183 | + } catch (Exception e) { | ||
| 3184 | + // TODO Auto-generated catch block | ||
| 3185 | + e.printStackTrace(); | ||
| 3186 | + } | ||
| 3187 | + } | ||
| 3188 | + } | ||
| 3189 | + | ||
| 3190 | + | ||
| 3191 | + ScheduleRealInfo p_schedule = null; | ||
| 3192 | + for(ScheduleRealInfo schedule : list){ // 计划 | ||
| 3193 | + try { | ||
| 3194 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 3195 | + if(schedule.isCcService()){ | ||
| 3196 | + continue; | ||
| 3197 | + } | ||
| 3198 | + if(schedule.isSflj()){ | ||
| 3199 | + continue; | ||
| 3200 | + } | ||
| 3201 | + String scheduleDate = schedule.getScheduleDateStr(); | ||
| 3202 | + String realDate = schedule.getRealExecDate(); | ||
| 3203 | + String gsName = schedule.getGsName(); | ||
| 3204 | + String fgsName = schedule.getFgsName(); | ||
| 3205 | + String xlName = schedule.getXlName(); | ||
| 3206 | + String qdzName = schedule.getQdzName(); | ||
| 3207 | + String lpName = schedule.getLpName(); | ||
| 3208 | + String xlDir = schedule.getXlDir(); | ||
| 3209 | + String sBcType = schedule.getBcType(); | ||
| 3210 | + String fcsj = schedule.getFcsj(); | ||
| 3211 | + Integer bcsj = schedule.getBcsj(); | ||
| 3212 | + if(p_schedule == null){ | ||
| 3213 | + p_schedule = schedule; | ||
| 3214 | + continue; | ||
| 3215 | + } else { | ||
| 3216 | + if("in,out,ldks".contains(sBcType) || "in,out,ldks".contains(p_schedule.getBcType()) | ||
| 3217 | + || !(schedule.getScheduleDateStr().equals(p_schedule.getScheduleDateStr())) | ||
| 3218 | + || !(schedule.getLpName().equals(p_schedule.getLpName())) | ||
| 3219 | + || !(schedule.getQdzName().equals(p_schedule.getZdzName())) | ||
| 3220 | + ){ | ||
| 3221 | + p_schedule = schedule; | ||
| 3222 | + continue; | ||
| 3223 | + } | ||
| 3224 | + Long zdsjT = p_schedule.getZdsjT(); | ||
| 3225 | + Long fcsjT = schedule.getFcsjT(); | ||
| 3226 | + if(fcsjT < zdsjT){ | ||
| 3227 | + fcsjT += 1440; | ||
| 3228 | + } | ||
| 3229 | + long jhtz = fcsjT - zdsjT; | ||
| 3230 | + | ||
| 3231 | + if(jhtz >= 110){ // 超过2小时停站时间不计算 | ||
| 3232 | + p_schedule = schedule; | ||
| 3233 | + continue; | ||
| 3234 | + } | ||
| 3235 | + | ||
| 3236 | + String key = gsName + "/" + fgsName + "/" + xlName + "/" + qdzName + "/" + lpName + "/" + fcsj; | ||
| 3237 | + Map<String, Object> temp = new HashMap<String, Object>(); | ||
| 3238 | + temp.put("scheduleDate", scheduleDate); | ||
| 3239 | + temp.put("realDate", realDate); | ||
| 3240 | + temp.put("gsName", gsName); | ||
| 3241 | + temp.put("fgsName", fgsName); | ||
| 3242 | + temp.put("xlName", xlName); | ||
| 3243 | + temp.put("qdzName", qdzName); | ||
| 3244 | + temp.put("lpName", lpName); | ||
| 3245 | + temp.put("xlDir", xlDir); | ||
| 3246 | + temp.put("sBcType", sBcType); | ||
| 3247 | + temp.put("fcsj", fcsj); | ||
| 3248 | + temp.put("bcsj", bcsj); | ||
| 3249 | + temp.put("jhtz", jhtz); | ||
| 3250 | + | ||
| 3251 | + if(!keyMap.containsKey(key)){ | ||
| 3252 | + keyMap.put(key, new ArrayList<Map<String, Object>>()); | ||
| 3253 | + keyList.add(key); | ||
| 3254 | + keyMap.get(key).add(temp); | ||
| 3255 | + } | ||
| 3256 | + | ||
| 3257 | + p_schedule = schedule; | ||
| 3258 | + } | ||
| 3259 | + | ||
| 3260 | + } catch (Exception e) { | ||
| 3261 | + // TODO: handle exception | ||
| 3262 | + e.printStackTrace(); | ||
| 3263 | + } | ||
| 3264 | + } | ||
| 3265 | + | ||
| 3266 | + | ||
| 3267 | + List<String> keyList_sj = new ArrayList<String>(); | ||
| 3268 | + Map<String, List<ScheduleRealInfo>> keyMap_sj = new HashMap<String, List<ScheduleRealInfo>>(); | ||
| 3269 | + for(ScheduleRealInfo schedule : list){ // 实际班次分组排序(按实际发车时间排序) | ||
| 3270 | + if(schedule.isCcService()){ | ||
| 3271 | + continue; | ||
| 3272 | + } | ||
| 3273 | + if(schedule.getStatus() != -1 | ||
| 3274 | + && schedule.getFcsjActual() != null && schedule.getFcsjActual().trim().length() > 0 | ||
| 3275 | + && schedule.getZdsjActual() != null && schedule.getZdsjActual().trim().length() > 0){ | ||
| 3276 | + String scheduleDate = schedule.getScheduleDateStr(); | ||
| 3277 | + String realDate = schedule.getRealExecDate(); | ||
| 3278 | + String gsName = schedule.getGsName(); | ||
| 3279 | + String fgsName = schedule.getFgsName(); | ||
| 3280 | + String xlName = schedule.getXlName(); | ||
| 3281 | + String lpName = schedule.getLpName(); | ||
| 3282 | + String key = scheduleDate + "/" + realDate + "/" + gsName + "/" + fgsName + "/" + xlName + "/" + lpName; | ||
| 3283 | + if(!keyMap_sj.containsKey(key)){ | ||
| 3284 | + keyMap_sj.put(key, new ArrayList<ScheduleRealInfo>()); | ||
| 3285 | + keyList_sj.add(key); | ||
| 3286 | + } | ||
| 3287 | + keyMap_sj.get(key).add(schedule); | ||
| 3288 | + } | ||
| 3289 | + } | ||
| 3290 | + | ||
| 3291 | + for(String key_sj : keyList_sj){ | ||
| 3292 | + List<ScheduleRealInfo> list_sj = keyMap_sj.get(key_sj); | ||
| 3293 | + //按实际发车时间排序 | ||
| 3294 | + Collections.sort(list_sj, new Comparator<ScheduleRealInfo>() { | ||
| 3295 | + @Override | ||
| 3296 | + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | ||
| 3297 | + String[] split1 = s1.getFcsjActual().split(":"); | ||
| 3298 | + String[] split2 = s2.getFcsjActual().split(":"); | ||
| 3299 | + int fcsj1 = Integer.valueOf(split1[0]) * 60 + Integer.valueOf(split1[1]); | ||
| 3300 | + int fcsj2 = Integer.valueOf(split2[0]) * 60 + Integer.valueOf(split2[1]); | ||
| 3301 | + if((!(s1.getScheduleDateStr().equals(s1.getRealExecDate())) && fcsj1 < 720) | ||
| 3302 | + || s1.getFcsjT() - s1.getFcsjActualTime() > 720){ // 720是12小时,判断是否跨天 | ||
| 3303 | + fcsj1 += 1440; | ||
| 3304 | + } | ||
| 3305 | + if((!(s2.getScheduleDateStr().equals(s2.getRealExecDate())) && fcsj2 < 720) | ||
| 3306 | + || s2.getFcsjT() - s2.getFcsjActualTime() > 720){ // 720是12小时,判断是否跨天 | ||
| 3307 | + fcsj2 += 1440; | ||
| 3308 | + } | ||
| 3309 | + | ||
| 3310 | + // i1 - i2 = 升序; i2 - i1 = 降序; | ||
| 3311 | + int diff = fcsj1 - fcsj2; | ||
| 3312 | + if (diff > 0) { | ||
| 3313 | + return 1; | ||
| 3314 | + }else if (diff < 0) { | ||
| 3315 | + return -1; | ||
| 3316 | + } | ||
| 3317 | + return 0; //相等为0 | ||
| 3318 | + } | ||
| 3319 | + }); | ||
| 3320 | + | ||
| 3321 | + p_schedule = null; | ||
| 3322 | + for(ScheduleRealInfo schedule : list_sj){ | ||
| 3323 | + try { | ||
| 3324 | + String scheduleDate = schedule.getScheduleDateStr(); | ||
| 3325 | + String realDate = schedule.getRealExecDate(); | ||
| 3326 | + String gsName = schedule.getGsName(); | ||
| 3327 | + String fgsName = schedule.getFgsName(); | ||
| 3328 | + String xlName = schedule.getXlName(); | ||
| 3329 | + String qdzName = schedule.getQdzName(); | ||
| 3330 | + String lpName = schedule.getLpName(); | ||
| 3331 | + String xlDir = schedule.getXlDir(); | ||
| 3332 | + String sBcType = schedule.getBcType(); | ||
| 3333 | + String fcsj = schedule.getFcsj(); | ||
| 3334 | + Integer bcsj = schedule.getBcsj(); | ||
| 3335 | + if(p_schedule == null){ | ||
| 3336 | + p_schedule = schedule; | ||
| 3337 | + continue; | ||
| 3338 | + } else { | ||
| 3339 | + if("in,out,ldks".contains(sBcType) || "in,out,ldks".contains(p_schedule.getBcType()) | ||
| 3340 | + || !(schedule.getScheduleDateStr().equals(p_schedule.getScheduleDateStr())) | ||
| 3341 | + || !(schedule.getLpName().equals(p_schedule.getLpName())) | ||
| 3342 | + || !(schedule.getQdzName().equals(p_schedule.getZdzName())) | ||
| 3343 | + ){ | ||
| 3344 | + p_schedule = schedule; | ||
| 3345 | + continue; | ||
| 3346 | + } | ||
| 3347 | + | ||
| 3348 | + Long zdsjT = p_schedule.getZdsjT(); | ||
| 3349 | + Long fcsjT = schedule.getFcsjT(); | ||
| 3350 | + if(fcsjT < zdsjT){ | ||
| 3351 | + fcsjT += 1440; | ||
| 3352 | + } | ||
| 3353 | + long jhtz = fcsjT - zdsjT; | ||
| 3354 | + | ||
| 3355 | + Long zdsjAT = p_schedule.getZdsjActualTime(); | ||
| 3356 | + Long fcsjAT = schedule.getFcsjActualTime(); | ||
| 3357 | + if(fcsjAT < zdsjAT){ | ||
| 3358 | + fcsjAT += 1440; | ||
| 3359 | + } | ||
| 3360 | + long sjtz = fcsjAT - zdsjAT; | ||
| 3361 | + | ||
| 3362 | + Long zdsjAT1 = schedule.getZdsjActualTime(); | ||
| 3363 | + if(zdsjAT1 < fcsjAT){ | ||
| 3364 | + zdsjAT1 += 1440; | ||
| 3365 | + } | ||
| 3366 | + long sj_bcsj = zdsjAT1 - fcsjAT; | ||
| 3367 | + | ||
| 3368 | + if(jhtz >= 110 || sjtz >= 110){ // 超过2小时停站时间不计算 | ||
| 3369 | + p_schedule = schedule; | ||
| 3370 | + continue; | ||
| 3371 | + } | ||
| 3372 | + | ||
| 3373 | + String key = gsName + "/" + fgsName + "/" + xlName + "/" + qdzName + "/" + lpName + "/" + fcsj; | ||
| 3374 | + Map<String, Object> temp = new HashMap<String, Object>(); | ||
| 3375 | + temp.put("scheduleDate", scheduleDate); | ||
| 3376 | + temp.put("realDate", realDate); | ||
| 3377 | + temp.put("gsName", gsName); | ||
| 3378 | + temp.put("fgsName", fgsName); | ||
| 3379 | + temp.put("xlName", xlName); | ||
| 3380 | + temp.put("qdzName", qdzName); | ||
| 3381 | + temp.put("lpName", lpName); | ||
| 3382 | + temp.put("xlDir", xlDir); | ||
| 3383 | + temp.put("sBcType", sBcType); | ||
| 3384 | + temp.put("fcsj", fcsj); | ||
| 3385 | + temp.put("bcsj", bcsj); | ||
| 3386 | + temp.put("jhtz", jhtz); | ||
| 3387 | + temp.put("sjtz", sjtz); | ||
| 3388 | + temp.put("sjBcsj", sj_bcsj); | ||
| 3389 | + | ||
| 3390 | + if(!keyMap.containsKey(key)){ | ||
| 3391 | + keyMap.put(key, new ArrayList<Map<String, Object>>()); | ||
| 3392 | + keyList.add(key); | ||
| 3393 | + } | ||
| 3394 | + keyMap.get(key).add(temp); | ||
| 3395 | + | ||
| 3396 | + p_schedule = schedule; | ||
| 3397 | + } | ||
| 3398 | + } catch (Exception e) { | ||
| 3399 | + // TODO: handle exception | ||
| 3400 | + e.printStackTrace(); | ||
| 3401 | + } | ||
| 3402 | + } | ||
| 3403 | + } | ||
| 3404 | + | ||
| 3405 | + for(String key : keyList){ | ||
| 3406 | + List<Map<String, Object>> mapList = keyMap.get(key); | ||
| 3407 | + Map<String, Object> m_schedule = mapList.get(0); | ||
| 3408 | + List<Long> sjtzs0 = new ArrayList<Long>(); // 实际停站时间_总(上行) | ||
| 3409 | + List<Long> sjtzs1 = new ArrayList<Long>(); // 实际停站时间_总(下行) | ||
| 3410 | + for(Map<String, Object> m : mapList){ | ||
| 3411 | + if(m.containsKey("sjtz")){ | ||
| 3412 | + if("0".equals(m.get("xlDir").toString())){ | ||
| 3413 | + sjtzs0.add(Long.valueOf(m.get("sjtz").toString())); | ||
| 3414 | + } else if("1".equals(m.get("xlDir").toString())){ | ||
| 3415 | + sjtzs1.add(Long.valueOf(m.get("sjtz").toString())); | ||
| 3416 | + } | ||
| 3417 | + } | ||
| 3418 | + } | ||
| 3419 | + | ||
| 3420 | + // 上行 | ||
| 3421 | + if(sjtzs0.size() > 0){ | ||
| 3422 | + long sum_sjtz0 = 0; | ||
| 3423 | + for(Long sjtz : sjtzs0){ | ||
| 3424 | + sum_sjtz0 += sjtz; | ||
| 3425 | + } | ||
| 3426 | + m_schedule.put("sumSjtz", sum_sjtz0); | ||
| 3427 | + m_schedule.put("numSjtz", sjtzs0.size()); | ||
| 3428 | + | ||
| 3429 | + if(!("0".equals(bcType)) && bcType.length() > 0){ | ||
| 3430 | + String sBcType = m_schedule.get("sBcType")+""; | ||
| 3431 | + // venting:直放;region:区间; | ||
| 3432 | + if("1".equals(bcType) && !("venting".equals(sBcType)) && !("region".equals(sBcType))){ | ||
| 3433 | + resList.add(m_schedule); | ||
| 3434 | + } else if("2".equals(bcType) && !("venting".equals(sBcType))){ // 非直放 | ||
| 3435 | + resList.add(m_schedule); | ||
| 3436 | + } else if("3".equals(bcType) && !("region".equals(sBcType))){ // 非区间 | ||
| 3437 | + resList.add(m_schedule); | ||
| 3438 | + } | ||
| 3439 | + } else { | ||
| 3440 | + resList.add(m_schedule); | ||
| 3441 | + } | ||
| 3442 | + } | ||
| 3443 | + | ||
| 3444 | + // 下行 | ||
| 3445 | + if(sjtzs1.size() > 0){ | ||
| 3446 | + long sum_sjtz1 = 0; | ||
| 3447 | + for(Long sjtz : sjtzs1){ | ||
| 3448 | + sum_sjtz1 += sjtz; | ||
| 3449 | + } | ||
| 3450 | + m_schedule.put("sumSjtz", sum_sjtz1); | ||
| 3451 | + m_schedule.put("numSjtz", sjtzs1.size()); | ||
| 3452 | + | ||
| 3453 | + if(!("0".equals(bcType)) && bcType.length() > 0){ | ||
| 3454 | + String sBcType = m_schedule.get("sBcType")+""; | ||
| 3455 | + // venting:直放;region:区间; | ||
| 3456 | + if("1".equals(bcType) && !("venting".equals(sBcType)) && !("region".equals(sBcType))){ | ||
| 3457 | + resList.add(m_schedule); | ||
| 3458 | + } else if("2".equals(bcType) && !("venting".equals(sBcType))){ // 非直放 | ||
| 3459 | + resList.add(m_schedule); | ||
| 3460 | + } else if("3".equals(bcType) && !("region".equals(sBcType))){ // 非区间 | ||
| 3461 | + resList.add(m_schedule); | ||
| 3462 | + } | ||
| 3463 | + } else { | ||
| 3464 | + resList.add(m_schedule); | ||
| 3465 | + } | ||
| 3466 | + } | ||
| 3467 | + } | ||
| 3468 | + | ||
| 3469 | + | ||
| 3470 | + List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); | ||
| 3471 | + Map<String, Object> map1 = new HashMap<String, Object>(); | ||
| 3472 | + map1.put("times", "首~6:30");mapList.add(map1); | ||
| 3473 | + Map<String, Object> map2 = new HashMap<String, Object>(); | ||
| 3474 | + map2.put("times", "6:31~8:30");mapList.add(map2); | ||
| 3475 | + Map<String, Object> map3 = new HashMap<String, Object>(); | ||
| 3476 | + map3.put("times", "8:31~11:00");mapList.add(map3); | ||
| 3477 | + Map<String, Object> map4 = new HashMap<String, Object>(); | ||
| 3478 | + map4.put("times", "11:01~13:30");mapList.add(map4); | ||
| 3479 | + Map<String, Object> map5 = new HashMap<String, Object>(); | ||
| 3480 | + map5.put("times", "13:31~16:00");mapList.add(map5); | ||
| 3481 | + Map<String, Object> map6 = new HashMap<String, Object>(); | ||
| 3482 | + map6.put("times", "16:01~18:00");mapList.add(map6); | ||
| 3483 | + Map<String, Object> map7 = new HashMap<String, Object>(); | ||
| 3484 | + map7.put("times", "18:01~20:30");mapList.add(map7); | ||
| 3485 | + Map<String, Object> map8 = new HashMap<String, Object>(); | ||
| 3486 | + map8.put("times", "20:31~末");mapList.add(map8); | ||
| 3487 | + | ||
| 3488 | + String gsName = "", fgsName = "", xlName = ""; | ||
| 3489 | + for(Map<String, Object> m : resList){ | ||
| 3490 | + if(xlName.length() == 0){ | ||
| 3491 | + gsName = m.get("gsName").toString(); | ||
| 3492 | + fgsName = m.get("fgsName").toString(); | ||
| 3493 | + xlName = m.get("xlName").toString(); | ||
| 3494 | + } | ||
| 3495 | + String scheduleDate = m.get("scheduleDate").toString(); | ||
| 3496 | + String realDate = m.get("realDate").toString(); | ||
| 3497 | + String[] split = m.get("fcsj").toString().split(":"); | ||
| 3498 | + int fcsj = Integer.valueOf(split[0]) * 60 + Integer.valueOf(split[1]); | ||
| 3499 | + if(!(scheduleDate.equals(realDate))){ | ||
| 3500 | + fcsj += 1440; | ||
| 3501 | + } | ||
| 3502 | + Map<String, Object> mm = null; | ||
| 3503 | + if(fcsj <= (6*60+30)){ | ||
| 3504 | + mm = map1; | ||
| 3505 | + } else if(fcsj <= (8*60+30)){ | ||
| 3506 | + mm = map2; | ||
| 3507 | + } else if(fcsj <= (11*60)){ | ||
| 3508 | + mm = map3; | ||
| 3509 | + } else if(fcsj <= (13*60+30)){ | ||
| 3510 | + mm = map4; | ||
| 3511 | + } else if(fcsj <= (16*60)){ | ||
| 3512 | + mm = map5; | ||
| 3513 | + } else if(fcsj <= (18*60)){ | ||
| 3514 | + mm = map6; | ||
| 3515 | + } else if(fcsj <= (20*60+30)){ | ||
| 3516 | + mm = map7; | ||
| 3517 | + } else { | ||
| 3518 | + mm = map8; | ||
| 3519 | + } | ||
| 3520 | + if(mm != null){ | ||
| 3521 | + if("0".equals(m.get("xlDir").toString())){ | ||
| 3522 | + if(!(mm.containsKey("sumSjtz0"))){ | ||
| 3523 | + mm.put("sumSjtz0", m.get("sumSjtz").toString()); | ||
| 3524 | + mm.put("numSjtz0", m.get("numSjtz").toString()); | ||
| 3525 | + } else { | ||
| 3526 | + long sumSjtz0 = Long.valueOf(mm.get("sumSjtz0").toString()); | ||
| 3527 | + long numSjtz0 = Long.valueOf(mm.get("numSjtz0").toString()); | ||
| 3528 | + long sumSjtz = Long.valueOf(m.get("sumSjtz").toString()); | ||
| 3529 | + long numSjtz = Long.valueOf(m.get("numSjtz").toString()); | ||
| 3530 | + sumSjtz0 += sumSjtz; | ||
| 3531 | + numSjtz0 += numSjtz; | ||
| 3532 | + mm.put("sumSjtz0", sumSjtz0); | ||
| 3533 | + mm.put("numSjtz0", numSjtz0); | ||
| 3534 | + } | ||
| 3535 | + } | ||
| 3536 | + if("1".equals(m.get("xlDir").toString())){ | ||
| 3537 | + if(!(mm.containsKey("sumSjtz1"))){ | ||
| 3538 | + mm.put("sumSjtz1", m.get("sumSjtz").toString()); | ||
| 3539 | + mm.put("numSjtz1", m.get("numSjtz").toString()); | ||
| 3540 | + } else { | ||
| 3541 | + long sumSjtz1 = Long.valueOf(mm.get("sumSjtz1").toString()); | ||
| 3542 | + long numSjtz1 = Long.valueOf(mm.get("numSjtz1").toString()); | ||
| 3543 | + long sumSjtz = Long.valueOf(m.get("sumSjtz").toString()); | ||
| 3544 | + long numSjtz = Long.valueOf(m.get("numSjtz").toString()); | ||
| 3545 | + sumSjtz1 += sumSjtz; | ||
| 3546 | + numSjtz1 += numSjtz; | ||
| 3547 | + mm.put("sumSjtz1", sumSjtz1); | ||
| 3548 | + mm.put("numSjtz1", numSjtz1); | ||
| 3549 | + } | ||
| 3550 | + } | ||
| 3551 | + } | ||
| 3552 | + } | ||
| 3553 | + | ||
| 3554 | + for(Map<String, Object> m : mapList){ | ||
| 3555 | + m.put("gsName", gsName); | ||
| 3556 | + m.put("fgsName", fgsName); | ||
| 3557 | + m.put("xlName", xlName); | ||
| 3558 | + if(m.containsKey("sumSjtz0") && m.containsKey("sumSjtz1")){ | ||
| 3559 | + long sumSjtz = 0, numSjtz = 0; | ||
| 3560 | + if(m.containsKey("sumSjtz0")){ | ||
| 3561 | + long sumSjtz0 = Long.valueOf(m.get("sumSjtz0").toString()); | ||
| 3562 | + long numSjtz0 = Long.valueOf(m.get("numSjtz0").toString()); | ||
| 3563 | + sumSjtz += sumSjtz0; | ||
| 3564 | + numSjtz += numSjtz0; | ||
| 3565 | + String average0 = numSjtz0>0?df.format(new BigDecimal(sumSjtz0).divide( | ||
| 3566 | + new BigDecimal(numSjtz0), 2, RoundingMode.HALF_UP)).toString():"0"; | ||
| 3567 | + m.put("aveSjtz0", average0); | ||
| 3568 | + } | ||
| 3569 | + if(m.containsKey("sumSjtz1")){ | ||
| 3570 | + long sumSjtz1 = Long.valueOf(m.get("sumSjtz1").toString()); | ||
| 3571 | + long numSjtz1 = Long.valueOf(m.get("numSjtz1").toString()); | ||
| 3572 | + sumSjtz += sumSjtz1; | ||
| 3573 | + numSjtz += numSjtz1; | ||
| 3574 | + String average1 = numSjtz1>0?df.format(new BigDecimal(sumSjtz1).divide( | ||
| 3575 | + new BigDecimal(numSjtz1), 2, RoundingMode.HALF_UP)).toString():"0"; | ||
| 3576 | + m.put("aveSjtz1", average1); | ||
| 3577 | + } | ||
| 3578 | + String average = numSjtz>0?df.format(new BigDecimal(sumSjtz).divide( | ||
| 3579 | + new BigDecimal(numSjtz), 2, RoundingMode.HALF_UP)).toString():"0"; | ||
| 3580 | + m.put("aveSjtz", average); | ||
| 3581 | + } else { | ||
| 3582 | + m.put("aveSjtz0", "/"); | ||
| 3583 | + m.put("aveSjtz1", "/"); | ||
| 3584 | + m.put("aveSjtz", "/"); | ||
| 3585 | + } | ||
| 3586 | + } | ||
| 3587 | + | ||
| 3588 | + modelMap.put("dataList", mapList); | ||
| 3589 | + | ||
| 3590 | + | ||
| 3591 | + //导出 | ||
| 3592 | + if(type.equals("export")){ | ||
| 3593 | + String lineName = ""; | ||
| 3594 | + if(map.containsKey("lineName")) | ||
| 3595 | + lineName = map.get("lineName").toString(); | ||
| 3596 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 3597 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 3598 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 3599 | + Map<String,Object> m = new HashMap<String, Object>(); | ||
| 3600 | + ReportUtils ee = new ReportUtils(); | ||
| 3601 | + try { | ||
| 3602 | + listI.add(mapList.iterator()); | ||
| 3603 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | ||
| 3604 | + ee.excelReplace(listI, new Object[] { m }, path+"mould/dwellTime_sum.xls", | ||
| 3605 | + path+"export/" | ||
| 3606 | + + sdfSimple.format(sdfMonth.parse(startDate)) + "-" | ||
| 3607 | + + sdfSimple.format(sdfMonth.parse(endDate)) + "-" | ||
| 3608 | + +lineName+"-停站时间分析(汇总).xls"); | ||
| 3609 | + } catch (Exception e) { | ||
| 3610 | + // TODO: handle exception | ||
| 3611 | + e.printStackTrace(); | ||
| 3612 | + } | ||
| 3613 | + } | ||
| 3614 | + | ||
| 3615 | + return modelMap; | ||
| 3616 | + } | ||
| 3617 | + | ||
| 2574 | } | 3618 | } |
src/main/resources/static/pages/forms/mould/dwellTime.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/dwellTime_sum.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/dwellTime.html
0 → 100644
| 1 | +<style type="text/css"> | ||
| 2 | + .table-bordered { | ||
| 3 | + border: 1px solid; } | ||
| 4 | + .table-bordered > thead > tr > th, | ||
| 5 | + .table-bordered > thead > tr > td, | ||
| 6 | + .table-bordered > tbody > tr > th, | ||
| 7 | + .table-bordered > tbody > tr > td, | ||
| 8 | + .table-bordered > tfoot > tr > th, | ||
| 9 | + .table-bordered > tfoot > tr > td { | ||
| 10 | + border: 1px solid; | ||
| 11 | + text-align: center; } | ||
| 12 | + .table-bordered > thead > tr > th, | ||
| 13 | + .table-bordered > thead > tr > td { | ||
| 14 | + border-bottom-width: 2px; } | ||
| 15 | + | ||
| 16 | + .table > tbody + tbody { | ||
| 17 | + border-top: 1px solid; } | ||
| 18 | +</style> | ||
| 19 | + | ||
| 20 | +<div class="page-head"> | ||
| 21 | + <div class="page-title"> | ||
| 22 | + <h1>停站时间分析</h1> | ||
| 23 | + </div> | ||
| 24 | +</div> | ||
| 25 | + | ||
| 26 | +<div class="row"> | ||
| 27 | + <div class="col-md-12"> | ||
| 28 | + <div class="portlet light porttlet-fit bordered"> | ||
| 29 | + <div class="portlet-title"> | ||
| 30 | + <form id="history" class="form-inline" action=""> | ||
| 31 | + <div style="display: inline-block;margin-left: 33px;" id="company1"> | ||
| 32 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 33 | + <select class="form-control" name="company" id="company" style="width: 150px;"></select> | ||
| 34 | + </div> | ||
| 35 | + <div style="display: inline-block;margin-left: 24px;" id="subCompany1"> | ||
| 36 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 37 | + <select class="form-control" name="subCompany" id="subCompany" style="width: 150px;"></select> | ||
| 38 | + </div> | ||
| 39 | + <div style="display: inline-block;margin-left: 38px;"> | ||
| 40 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 41 | + <select class="form-control" name="line" id="line" style="width: 150px;"></select> | ||
| 42 | + </div> | ||
| 43 | + <div style="display: inline-block;margin-left: 10px;"> | ||
| 44 | + <span class="item-label" style="width: 80px;">班次类型: </span> | ||
| 45 | + <select class="form-control" name="bcType" id="bcType" style="width: 150px;"> | ||
| 46 | + <option value="0">全部班次</option> | ||
| 47 | + <option value="1">非直放非区间</option> | ||
| 48 | + <option value="2">非直放</option> | ||
| 49 | + <option value="3">非区间</option> | ||
| 50 | + </select> | ||
| 51 | + </div> | ||
| 52 | + <div style="margin-top: 10px"></div> | ||
| 53 | + <div style="display: inline-block;margin-left: 5px;"> | ||
| 54 | + <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 55 | + <input class="form-control" type="text" id="startDate" style="width: 150px;"/> | ||
| 56 | + </div> | ||
| 57 | + <div style="display: inline-block;margin-left: 10px;"> | ||
| 58 | + <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 59 | + <input class="form-control" type="text" id="endDate" style="width: 150px;"/> | ||
| 60 | + </div> | ||
| 61 | + <div style="display: inline-block;margin-left: 10px;"> | ||
| 62 | + <span class="item-label" style="width: 80px;">每周时段: </span> | ||
| 63 | + <select multiple="multiple" class="form-control" name="weeks" id="weeks" style="width: 150px;"> | ||
| 64 | + <option value="1">星期一</option> | ||
| 65 | + <option value="2">星期二</option> | ||
| 66 | + <option value="3">星期三</option> | ||
| 67 | + <option value="4">星期四</option> | ||
| 68 | + <option value="5">星期五</option> | ||
| 69 | + <option value="6">星期六</option> | ||
| 70 | + <option value="7">星期日</option> | ||
| 71 | + </select> | ||
| 72 | + </div> | ||
| 73 | + <div class="form-group" style="margin-left: 10px"> | ||
| 74 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 75 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 76 | + </div> | ||
| 77 | + </form> | ||
| 78 | + </div> | ||
| 79 | + <div class="portlet-body"> | ||
| 80 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 81 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 82 | + <thead> | ||
| 83 | + <tr class="hidden"> | ||
| 84 | + <th style="display: none;"></th> | ||
| 85 | + <th width="8%">公司</th> | ||
| 86 | + <th width="8%">分公司</th> | ||
| 87 | + <th width="8%">线路</th> | ||
| 88 | + <th width="8%">起点站名</th> | ||
| 89 | + <th width="6%">路牌</th> | ||
| 90 | + <th width="6%">计发时间</th> | ||
| 91 | + <th width="6%">计划运送<br/>时间(分)</th> | ||
| 92 | + <th width="6%">实际运送<br/>时间(平均)</th> | ||
| 93 | + <th width="6%">计划停站<br/>时间(分)</th> | ||
| 94 | + <th width="6%">最长停站<br/>时间(分)</th> | ||
| 95 | + <th width="6%">最短停站<br/>时间(分)</th> | ||
| 96 | + <th width="6%">平均停站<br/>时间(分)</th> | ||
| 97 | + </tr> | ||
| 98 | + </thead> | ||
| 99 | + <tbody> | ||
| 100 | + | ||
| 101 | + </tbody> | ||
| 102 | + </table> | ||
| 103 | + <div style="text-align: right;"> | ||
| 104 | + <ul id="pagination" class="pagination"></ul> | ||
| 105 | + </div> | ||
| 106 | + </div> | ||
| 107 | + </div> | ||
| 108 | + </div> | ||
| 109 | + </div> | ||
| 110 | +</div> | ||
| 111 | + | ||
| 112 | +<script> | ||
| 113 | + $(function(){ | ||
| 114 | + var page = 0, initPagination; | ||
| 115 | + $('#export').attr('disabled', "true"); | ||
| 116 | + | ||
| 117 | + // 关闭左侧栏 | ||
| 118 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 119 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 120 | + | ||
| 121 | + $("#startDate").datetimepicker({ | ||
| 122 | + format : 'YYYY-MM-DD', | ||
| 123 | + locale : 'zh-cn' | ||
| 124 | + }); | ||
| 125 | + | ||
| 126 | + $("#endDate").datetimepicker({ | ||
| 127 | + format : 'YYYY-MM-DD', | ||
| 128 | + locale : 'zh-cn' | ||
| 129 | + }); | ||
| 130 | + | ||
| 131 | + var d = new Date(); | ||
| 132 | + var year = d.getFullYear(); | ||
| 133 | + var month = d.getMonth() + 1; | ||
| 134 | + var day = d.getDate(); | ||
| 135 | + if(month < 10) | ||
| 136 | + month = "0" + month; | ||
| 137 | + if(day < 10) | ||
| 138 | + day = "0" + day; | ||
| 139 | + $("#startDate").val(year + "-" + month + "-" + day); | ||
| 140 | + $("#endDate").val(year + "-" + month + "-" + day); | ||
| 141 | + | ||
| 142 | + initPinYinSelect2('#weeks',[],''); | ||
| 143 | + | ||
| 144 | + var fage=false; | ||
| 145 | + var xlList; | ||
| 146 | + var obj = []; | ||
| 147 | + | ||
| 148 | + $.get('/report/lineList',function(result){ | ||
| 149 | + xlList=result; | ||
| 150 | + $.get('/user/companyData', function(result){ | ||
| 151 | + obj = result; | ||
| 152 | + var options = ''; | ||
| 153 | + for(var i = 0; i < obj.length; i++){ | ||
| 154 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + if(obj.length ==0){ | ||
| 158 | + $("#company1").css('display','none'); | ||
| 159 | + }else if(obj.length ==1){ | ||
| 160 | + $("#company1").css('display','none'); | ||
| 161 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 162 | + $('#subCompany1').css('display','none'); | ||
| 163 | + } | ||
| 164 | + $('#company').html(options); | ||
| 165 | + updateCompany(); | ||
| 166 | + }); | ||
| 167 | + }) | ||
| 168 | + $("#company").on("change",updateCompany); | ||
| 169 | + function updateCompany(){ | ||
| 170 | + var company = $('#company').val(); | ||
| 171 | + var options = ''; | ||
| 172 | +// var options = '<option value="">全部分公司</option>'; | ||
| 173 | + for(var i = 0; i < obj.length; i++){ | ||
| 174 | + if(obj[i].companyCode == company){ | ||
| 175 | + var children = obj[i].children; | ||
| 176 | + for(var j = 0; j < children.length; j++){ | ||
| 177 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + $('#subCompany').html(options); | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + | ||
| 185 | + var tempData = {}; | ||
| 186 | + $.get('/report/lineList',function(xlList){ | ||
| 187 | + var data = []; | ||
| 188 | + $.get('/user/companyData', function(result){ | ||
| 189 | + for(var i = 0; i < result.length; i++){ | ||
| 190 | + var companyCode = result[i].companyCode; | ||
| 191 | + var children = result[i].children; | ||
| 192 | + for(var j = 0; j < children.length; j++){ | ||
| 193 | + var code = children[j].code; | ||
| 194 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 195 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 196 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 197 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | ||
| 198 | + } | ||
| 199 | + } | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + initPinYinSelect2('#line',data,''); | ||
| 203 | + line = data[0].id; | ||
| 204 | + | ||
| 205 | + }); | ||
| 206 | + }); | ||
| 207 | + | ||
| 208 | + $("#line").on("change", function(){ | ||
| 209 | + if($("#line").val() == " "){ | ||
| 210 | + $("#company").attr("disabled", false); | ||
| 211 | + $("#subCompany").attr("disabled", false); | ||
| 212 | + } else { | ||
| 213 | + var temp = tempData[$("#line").val()].split(":"); | ||
| 214 | + $("#company").val(temp[0]); | ||
| 215 | + updateCompany(); | ||
| 216 | + $("#subCompany").val(temp[1]); | ||
| 217 | + $("#company").attr("disabled", true); | ||
| 218 | +// $("#subCompany").attr("disabled", true); | ||
| 219 | + } | ||
| 220 | + }); | ||
| 221 | + | ||
| 222 | + | ||
| 223 | + $("#query").on("click", function(){ | ||
| 224 | + page = 0; | ||
| 225 | + jsDoQuery(true); | ||
| 226 | + }); | ||
| 227 | + | ||
| 228 | + var list; | ||
| 229 | + var line = $("#line").val(); | ||
| 230 | + var startDate = $("#startDate").val(); | ||
| 231 | + var endDate = $("#endDate").val(); | ||
| 232 | + var weeks = $("#weeks").val(); | ||
| 233 | + var bcType = $('#bcType').val(); | ||
| 234 | + var company = $("#company").val(); | ||
| 235 | + var subCompany = $("#subCompany").val(); | ||
| 236 | + var lineName = $('#line option:selected').text(); | ||
| 237 | + function jsDoQuery(pagination){ | ||
| 238 | + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){ | ||
| 239 | + layer.msg("请选择时间范围!"); | ||
| 240 | + return; | ||
| 241 | + } | ||
| 242 | + if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){ | ||
| 243 | + layer.msg("请选择时间范围!"); | ||
| 244 | + return; | ||
| 245 | + } | ||
| 246 | + var params = {}; | ||
| 247 | +// line = $("#line").val(); | ||
| 248 | + startDate = $("#startDate").val(); | ||
| 249 | + endDate = $("#endDate").val(); | ||
| 250 | + weeks = $("#weeks").val(); | ||
| 251 | + bcType = $("#bcType").val(); | ||
| 252 | + company = $("#company").val(); | ||
| 253 | + subCompany = $("#subCompany").val(); | ||
| 254 | + lineName = $('#line option:selected').text(); | ||
| 255 | + if(lineName == "全部线路") | ||
| 256 | + lineName = $('#subCompany option:selected').text(); | ||
| 257 | + params['page'] = page; | ||
| 258 | + params['line'] = line; | ||
| 259 | + params['startDate'] = startDate; | ||
| 260 | + params['endDate'] = endDate; | ||
| 261 | + if(weeks){ | ||
| 262 | + params['weeks'] = weeks.join(); | ||
| 263 | + } else { | ||
| 264 | + params['weeks'] = weeks; | ||
| 265 | + } | ||
| 266 | + params['bcType'] = bcType; | ||
| 267 | + params['company'] = company; | ||
| 268 | + params['subCompany'] = subCompany; | ||
| 269 | + params['type'] = "query"; | ||
| 270 | + $(".hidden").removeClass("hidden"); | ||
| 271 | + var i = layer.load(2); | ||
| 272 | + $get('/pcpc/dwellTime', params, function(result){ | ||
| 273 | + list = result.dataList; | ||
| 274 | + dataPageChange(page, result.dataList); | ||
| 275 | + layer.close(i); | ||
| 276 | + | ||
| 277 | + if(result.dataList.length == 0) | ||
| 278 | + $("#export").attr('disabled',"true"); | ||
| 279 | + else | ||
| 280 | + $("#export").removeAttr("disabled"); | ||
| 281 | + | ||
| 282 | + if(pagination && result.dataList.length > 0){ | ||
| 283 | + //重新分页 | ||
| 284 | + initPagination = true; | ||
| 285 | + showPagination(result); | ||
| 286 | + | ||
| 287 | + $('#pagination').show(); | ||
| 288 | + } else if(result.dataList.length == 0){ | ||
| 289 | + $('#pagination').hide(); | ||
| 290 | + } | ||
| 291 | + }); | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + function dataPageChange(page, list){ | ||
| 295 | + var tempList = []; | ||
| 296 | + for(var f = page*10; f < list.length && f < (page+1)*10; f++){ | ||
| 297 | + tempList[tempList.length] = list[f]; | ||
| 298 | + } | ||
| 299 | + // 把数据填充到模版中 | ||
| 300 | + var tbodyHtml = template('list_dwellTime',{list:tempList}); | ||
| 301 | + // 把渲染好的模版html文本追加到表格中 | ||
| 302 | + $('#forms tbody').html(tbodyHtml); | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + $("#export").on("click",function(){ | ||
| 306 | + var params = {}; | ||
| 307 | + params['page'] = page; | ||
| 308 | + params['line'] = line; | ||
| 309 | + params['startDate'] = startDate; | ||
| 310 | + params['endDate'] = endDate; | ||
| 311 | + if(weeks){ | ||
| 312 | + params['weeks'] = weeks.join(); | ||
| 313 | + } else { | ||
| 314 | + params['weeks'] = weeks; | ||
| 315 | + } | ||
| 316 | + params['bcType'] = bcType; | ||
| 317 | + params['company'] = company; | ||
| 318 | + params['subCompany'] = subCompany; | ||
| 319 | + params['type'] = "export"; | ||
| 320 | + params['lineName'] = lineName; | ||
| 321 | + var i = layer.load(2); | ||
| 322 | + $get('/pcpc/dwellTime', params, function(result){ | ||
| 323 | + window.open("/downloadFile/download?fileName=" | ||
| 324 | + +moment(startDate).format("YYYYMMDD")+ | ||
| 325 | + "-"+moment(endDate).format("YYYYMMDD") | ||
| 326 | + +"-"+lineName+"-停站时间分析"); | ||
| 327 | + layer.close(i); | ||
| 328 | + }); | ||
| 329 | + }); | ||
| 330 | + | ||
| 331 | + | ||
| 332 | + $("#line").on("change", function(){ | ||
| 333 | + line = $("#line").val(); | ||
| 334 | + if(line == " ") | ||
| 335 | + line = ""; | ||
| 336 | + }); | ||
| 337 | + $('#startDate, #endDate').on("blur", function(){ | ||
| 338 | + startDate = $("#startDate").val(); | ||
| 339 | + endDate = $("#endDate").val(); | ||
| 340 | + }); | ||
| 341 | + | ||
| 342 | + | ||
| 343 | + function showPagination(data){ | ||
| 344 | + //分页 | ||
| 345 | + $('#pagination').jqPaginator({ | ||
| 346 | + totalPages: data.totalPage, | ||
| 347 | + visiblePages: 6, | ||
| 348 | + currentPage: page + 1, | ||
| 349 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | ||
| 350 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | ||
| 351 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | ||
| 352 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | ||
| 353 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | ||
| 354 | + onPageChange: function (num, type) { | ||
| 355 | + if(initPagination){ | ||
| 356 | + initPagination = false; | ||
| 357 | + return; | ||
| 358 | + } | ||
| 359 | + page = num - 1; | ||
| 360 | +// jsDoQuery(false); | ||
| 361 | + dataPageChange(page, list); | ||
| 362 | + } | ||
| 363 | + }); | ||
| 364 | + } | ||
| 365 | + | ||
| 366 | + | ||
| 367 | + }); | ||
| 368 | + | ||
| 369 | +</script> | ||
| 370 | +<script type="text/html" id="list_dwellTime"> | ||
| 371 | + {{each list as obj i}} | ||
| 372 | + <tr> | ||
| 373 | + <th style="display: none;"></th> | ||
| 374 | + <td>{{obj.gsName}}</td> | ||
| 375 | + <td>{{obj.fgsName}}</td> | ||
| 376 | + <td>{{obj.xlName}}</td> | ||
| 377 | + <td>{{obj.qdzName}}</td> | ||
| 378 | + <td>{{obj.lpName}}</td> | ||
| 379 | + <td>{{obj.fcsj}}</td> | ||
| 380 | + <td>{{obj.bcsj}}</td> | ||
| 381 | + <td>{{obj.aveBcsj}}</td> | ||
| 382 | + <td>{{obj.jhtz}}</td> | ||
| 383 | + <td>{{obj.maxSjtz}}</td> | ||
| 384 | + <td>{{obj.minSjtz}}</td> | ||
| 385 | + <td>{{obj.aveSjtz}}</td> | ||
| 386 | + </tr> | ||
| 387 | + {{/each}} | ||
| 388 | + {{if list.length == 0}} | ||
| 389 | + <tr> | ||
| 390 | + <td colspan="15"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 391 | + </tr> | ||
| 392 | + {{/if}} | ||
| 393 | +</script> | ||
| 0 | \ No newline at end of file | 394 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/dwellTime_sum.html
0 → 100644
| 1 | +<style type="text/css"> | ||
| 2 | + .table-bordered { | ||
| 3 | + border: 1px solid; } | ||
| 4 | + .table-bordered > thead > tr > th, | ||
| 5 | + .table-bordered > thead > tr > td, | ||
| 6 | + .table-bordered > tbody > tr > th, | ||
| 7 | + .table-bordered > tbody > tr > td, | ||
| 8 | + .table-bordered > tfoot > tr > th, | ||
| 9 | + .table-bordered > tfoot > tr > td { | ||
| 10 | + border: 1px solid; | ||
| 11 | + text-align: center; } | ||
| 12 | + .table-bordered > thead > tr > th, | ||
| 13 | + .table-bordered > thead > tr > td { | ||
| 14 | + border-bottom-width: 2px; } | ||
| 15 | + | ||
| 16 | + .table > tbody + tbody { | ||
| 17 | + border-top: 1px solid; } | ||
| 18 | +</style> | ||
| 19 | + | ||
| 20 | +<div class="page-head"> | ||
| 21 | + <div class="page-title"> | ||
| 22 | + <h1>停站时间分析(汇总)</h1> | ||
| 23 | + </div> | ||
| 24 | +</div> | ||
| 25 | + | ||
| 26 | +<div class="row"> | ||
| 27 | + <div class="col-md-12"> | ||
| 28 | + <div class="portlet light porttlet-fit bordered"> | ||
| 29 | + <div class="portlet-title"> | ||
| 30 | + <form id="history" class="form-inline" action=""> | ||
| 31 | + <div style="display: inline-block;margin-left: 33px;" id="company1"> | ||
| 32 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 33 | + <select class="form-control" name="company" id="company" style="width: 150px;"></select> | ||
| 34 | + </div> | ||
| 35 | + <div style="display: inline-block;margin-left: 24px;" id="subCompany1"> | ||
| 36 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 37 | + <select class="form-control" name="subCompany" id="subCompany" style="width: 150px;"></select> | ||
| 38 | + </div> | ||
| 39 | + <div style="display: inline-block;margin-left: 38px;"> | ||
| 40 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 41 | + <select class="form-control" name="line" id="line" style="width: 150px;"></select> | ||
| 42 | + </div> | ||
| 43 | + <div style="display: inline-block;margin-left: 10px;"> | ||
| 44 | + <span class="item-label" style="width: 80px;">班次类型: </span> | ||
| 45 | + <select class="form-control" name="bcType" id="bcType" style="width: 150px;"> | ||
| 46 | + <option value="0">全部班次</option> | ||
| 47 | + <option value="1">非直放非区间</option> | ||
| 48 | + <option value="2">非直放</option> | ||
| 49 | + <option value="3">非区间</option> | ||
| 50 | + </select> | ||
| 51 | + </div> | ||
| 52 | + <div style="margin-top: 10px"></div> | ||
| 53 | + <div style="display: inline-block;margin-left: 5px;"> | ||
| 54 | + <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 55 | + <input class="form-control" type="text" id="startDate" style="width: 150px;"/> | ||
| 56 | + </div> | ||
| 57 | + <div style="display: inline-block;margin-left: 10px;"> | ||
| 58 | + <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 59 | + <input class="form-control" type="text" id="endDate" style="width: 150px;"/> | ||
| 60 | + </div> | ||
| 61 | + <div style="display: inline-block;margin-left: 10px;"> | ||
| 62 | + <span class="item-label" style="width: 80px;">每周时段: </span> | ||
| 63 | + <select multiple="multiple" class="form-control" name="weeks" id="weeks" style="width: 150px;"> | ||
| 64 | + <option value="1">星期一</option> | ||
| 65 | + <option value="2">星期二</option> | ||
| 66 | + <option value="3">星期三</option> | ||
| 67 | + <option value="4">星期四</option> | ||
| 68 | + <option value="5">星期五</option> | ||
| 69 | + <option value="6">星期六</option> | ||
| 70 | + <option value="7">星期日</option> | ||
| 71 | + </select> | ||
| 72 | + </div> | ||
| 73 | + <div class="form-group" style="margin-left: 10px"> | ||
| 74 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 75 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 76 | + </div> | ||
| 77 | + </form> | ||
| 78 | + </div> | ||
| 79 | + <div class="portlet-body"> | ||
| 80 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 81 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 82 | + <thead> | ||
| 83 | + <tr class="hidden"> | ||
| 84 | + <th style="display: none;"></th> | ||
| 85 | + <th width="6%">公司</th> | ||
| 86 | + <th width="6%">分公司</th> | ||
| 87 | + <th width="8%">线路</th> | ||
| 88 | + <th width="8%">时间段</th> | ||
| 89 | + <th width="8%">上行平均停站(分)</th> | ||
| 90 | + <th width="8%">下行平均停站(分)</th> | ||
| 91 | + <th width="8%">平均停站(分)</th> | ||
| 92 | + </tr> | ||
| 93 | + </thead> | ||
| 94 | + <tbody> | ||
| 95 | + | ||
| 96 | + </tbody> | ||
| 97 | + </table> | ||
| 98 | + <div style="text-align: right;"> | ||
| 99 | + <ul id="pagination" class="pagination"></ul> | ||
| 100 | + </div> | ||
| 101 | + </div> | ||
| 102 | + </div> | ||
| 103 | + </div> | ||
| 104 | + </div> | ||
| 105 | +</div> | ||
| 106 | + | ||
| 107 | +<script> | ||
| 108 | + $(function(){ | ||
| 109 | + var page = 0, initPagination; | ||
| 110 | + $('#export').attr('disabled', "true"); | ||
| 111 | + | ||
| 112 | + // 关闭左侧栏 | ||
| 113 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 114 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 115 | + | ||
| 116 | + $("#startDate").datetimepicker({ | ||
| 117 | + format : 'YYYY-MM-DD', | ||
| 118 | + locale : 'zh-cn' | ||
| 119 | + }); | ||
| 120 | + | ||
| 121 | + $("#endDate").datetimepicker({ | ||
| 122 | + format : 'YYYY-MM-DD', | ||
| 123 | + locale : 'zh-cn' | ||
| 124 | + }); | ||
| 125 | + | ||
| 126 | + var d = new Date(); | ||
| 127 | + var year = d.getFullYear(); | ||
| 128 | + var month = d.getMonth() + 1; | ||
| 129 | + var day = d.getDate(); | ||
| 130 | + if(month < 10) | ||
| 131 | + month = "0" + month; | ||
| 132 | + if(day < 10) | ||
| 133 | + day = "0" + day; | ||
| 134 | + $("#startDate").val(year + "-" + month + "-" + day); | ||
| 135 | + $("#endDate").val(year + "-" + month + "-" + day); | ||
| 136 | + | ||
| 137 | + initPinYinSelect2('#weeks',[],''); | ||
| 138 | + | ||
| 139 | + var fage=false; | ||
| 140 | + var xlList; | ||
| 141 | + var obj = []; | ||
| 142 | + | ||
| 143 | + $.get('/report/lineList',function(result){ | ||
| 144 | + xlList=result; | ||
| 145 | + $.get('/user/companyData', function(result){ | ||
| 146 | + obj = result; | ||
| 147 | + var options = ''; | ||
| 148 | + for(var i = 0; i < obj.length; i++){ | ||
| 149 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + if(obj.length ==0){ | ||
| 153 | + $("#company1").css('display','none'); | ||
| 154 | + }else if(obj.length ==1){ | ||
| 155 | + $("#company1").css('display','none'); | ||
| 156 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 157 | + $('#subCompany1').css('display','none'); | ||
| 158 | + } | ||
| 159 | + $('#company').html(options); | ||
| 160 | + updateCompany(); | ||
| 161 | + }); | ||
| 162 | + }) | ||
| 163 | + $("#company").on("change",updateCompany); | ||
| 164 | + function updateCompany(){ | ||
| 165 | + var company = $('#company').val(); | ||
| 166 | + var options = ''; | ||
| 167 | +// var options = '<option value="">全部分公司</option>'; | ||
| 168 | + for(var i = 0; i < obj.length; i++){ | ||
| 169 | + if(obj[i].companyCode == company){ | ||
| 170 | + var children = obj[i].children; | ||
| 171 | + for(var j = 0; j < children.length; j++){ | ||
| 172 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + } | ||
| 176 | + $('#subCompany').html(options); | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + | ||
| 180 | + var tempData = {}; | ||
| 181 | + $.get('/report/lineList',function(xlList){ | ||
| 182 | + var data = []; | ||
| 183 | + $.get('/user/companyData', function(result){ | ||
| 184 | + for(var i = 0; i < result.length; i++){ | ||
| 185 | + var companyCode = result[i].companyCode; | ||
| 186 | + var children = result[i].children; | ||
| 187 | + for(var j = 0; j < children.length; j++){ | ||
| 188 | + var code = children[j].code; | ||
| 189 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 190 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 191 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 192 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | + } | ||
| 197 | + initPinYinSelect2('#line',data,''); | ||
| 198 | + line = data[0].id; | ||
| 199 | + | ||
| 200 | + }); | ||
| 201 | + }); | ||
| 202 | + | ||
| 203 | + $("#line").on("change", function(){ | ||
| 204 | + if($("#line").val() == " "){ | ||
| 205 | + $("#company").attr("disabled", false); | ||
| 206 | + $("#subCompany").attr("disabled", false); | ||
| 207 | + } else { | ||
| 208 | + var temp = tempData[$("#line").val()].split(":"); | ||
| 209 | + $("#company").val(temp[0]); | ||
| 210 | + updateCompany(); | ||
| 211 | + $("#subCompany").val(temp[1]); | ||
| 212 | + $("#company").attr("disabled", true); | ||
| 213 | +// $("#subCompany").attr("disabled", true); | ||
| 214 | + } | ||
| 215 | + }); | ||
| 216 | + | ||
| 217 | + | ||
| 218 | + $("#query").on("click", function(){ | ||
| 219 | + page = 0; | ||
| 220 | + jsDoQuery(true); | ||
| 221 | + }); | ||
| 222 | + | ||
| 223 | + var list; | ||
| 224 | + var line = $("#line").val(); | ||
| 225 | + var startDate = $("#startDate").val(); | ||
| 226 | + var endDate = $("#endDate").val(); | ||
| 227 | + var weeks = $("#weeks").val(); | ||
| 228 | + var bcType = $('#bcType').val(); | ||
| 229 | + var company = $("#company").val(); | ||
| 230 | + var subCompany = $("#subCompany").val(); | ||
| 231 | + var lineName = $('#line option:selected').text(); | ||
| 232 | + function jsDoQuery(pagination){ | ||
| 233 | + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){ | ||
| 234 | + layer.msg("请选择时间范围!"); | ||
| 235 | + return; | ||
| 236 | + } | ||
| 237 | + if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){ | ||
| 238 | + layer.msg("请选择时间范围!"); | ||
| 239 | + return; | ||
| 240 | + } | ||
| 241 | + var params = {}; | ||
| 242 | +// line = $("#line").val(); | ||
| 243 | + startDate = $("#startDate").val(); | ||
| 244 | + endDate = $("#endDate").val(); | ||
| 245 | + weeks = $("#weeks").val(); | ||
| 246 | + bcType = $("#bcType").val(); | ||
| 247 | + company = $("#company").val(); | ||
| 248 | + subCompany = $("#subCompany").val(); | ||
| 249 | + lineName = $('#line option:selected').text(); | ||
| 250 | + if(lineName == "全部线路") | ||
| 251 | + lineName = $('#subCompany option:selected').text(); | ||
| 252 | + params['page'] = page; | ||
| 253 | + params['line'] = line; | ||
| 254 | + params['startDate'] = startDate; | ||
| 255 | + params['endDate'] = endDate; | ||
| 256 | + if(weeks){ | ||
| 257 | + params['weeks'] = weeks.join(); | ||
| 258 | + } else { | ||
| 259 | + params['weeks'] = weeks; | ||
| 260 | + } | ||
| 261 | + params['bcType'] = bcType; | ||
| 262 | + params['company'] = company; | ||
| 263 | + params['subCompany'] = subCompany; | ||
| 264 | + params['type'] = "query"; | ||
| 265 | + $(".hidden").removeClass("hidden"); | ||
| 266 | + var i = layer.load(2); | ||
| 267 | + $get('/pcpc/dwellTime_sum', params, function(result){ | ||
| 268 | + // 把数据填充到模版中 | ||
| 269 | + var tbodyHtml = template('list_dwellTime_sum',{list:result.dataList}); | ||
| 270 | + // 把渲染好的模版html文本追加到表格中 | ||
| 271 | + $('#forms tbody').html(tbodyHtml); | ||
| 272 | + | ||
| 273 | + layer.close(i); | ||
| 274 | + | ||
| 275 | + if(result.dataList.length == 0) | ||
| 276 | + $("#export").attr('disabled',"true"); | ||
| 277 | + else | ||
| 278 | + $("#export").removeAttr("disabled"); | ||
| 279 | + | ||
| 280 | + }); | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + | ||
| 284 | + $("#export").on("click",function(){ | ||
| 285 | + var params = {}; | ||
| 286 | + params['page'] = page; | ||
| 287 | + params['line'] = line; | ||
| 288 | + params['startDate'] = startDate; | ||
| 289 | + params['endDate'] = endDate; | ||
| 290 | + if(weeks){ | ||
| 291 | + params['weeks'] = weeks.join(); | ||
| 292 | + } else { | ||
| 293 | + params['weeks'] = weeks; | ||
| 294 | + } | ||
| 295 | + params['bcType'] = bcType; | ||
| 296 | + params['company'] = company; | ||
| 297 | + params['subCompany'] = subCompany; | ||
| 298 | + params['type'] = "export"; | ||
| 299 | + params['lineName'] = lineName; | ||
| 300 | + var i = layer.load(2); | ||
| 301 | + $get('/pcpc/dwellTime_sum', params, function(result){ | ||
| 302 | + window.open("/downloadFile/download?fileName=" | ||
| 303 | + +moment(startDate).format("YYYYMMDD")+ | ||
| 304 | + "-"+moment(endDate).format("YYYYMMDD") | ||
| 305 | + +"-"+lineName+"-停站时间分析(汇总)"); | ||
| 306 | + layer.close(i); | ||
| 307 | + }); | ||
| 308 | + }); | ||
| 309 | + | ||
| 310 | + | ||
| 311 | + $("#line").on("change", function(){ | ||
| 312 | + line = $("#line").val(); | ||
| 313 | + if(line == " ") | ||
| 314 | + line = ""; | ||
| 315 | + }); | ||
| 316 | + $('#startDate, #endDate').on("blur", function(){ | ||
| 317 | + startDate = $("#startDate").val(); | ||
| 318 | + endDate = $("#endDate").val(); | ||
| 319 | + }); | ||
| 320 | + | ||
| 321 | + | ||
| 322 | + }); | ||
| 323 | + | ||
| 324 | +</script> | ||
| 325 | +<script type="text/html" id="list_dwellTime_sum"> | ||
| 326 | + {{each list as obj i}} | ||
| 327 | + <tr> | ||
| 328 | + <th style="display: none;"></th> | ||
| 329 | + <td>{{obj.gsName}}</td> | ||
| 330 | + <td>{{obj.fgsName}}</td> | ||
| 331 | + <td>{{obj.xlName}}</td> | ||
| 332 | + <td>{{obj.times}}</td> | ||
| 333 | + <td>{{obj.aveSjtz0}}</td> | ||
| 334 | + <td>{{obj.aveSjtz1}}</td> | ||
| 335 | + <td>{{obj.aveSjtz}}</td> | ||
| 336 | + </tr> | ||
| 337 | + {{/each}} | ||
| 338 | + {{if list.length == 0}} | ||
| 339 | + <tr> | ||
| 340 | + <td colspan="15"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 341 | + </tr> | ||
| 342 | + {{/if}} | ||
| 343 | +</script> | ||
| 0 | \ No newline at end of file | 344 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/scheduleAnaly.html
| @@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
| 42 | </div> | 42 | </div> |
| 43 | <div style="display: inline-block;margin-left: 10px;"> | 43 | <div style="display: inline-block;margin-left: 10px;"> |
| 44 | <span class="item-label" style="width: 80px;">班次类型: </span> | 44 | <span class="item-label" style="width: 80px;">班次类型: </span> |
| 45 | - <select class="form-control" name="line" id="bcType" style="width: 150px;"> | 45 | + <select class="form-control" name="bcType" id="bcType" style="width: 150px;"> |
| 46 | <option value="0">全部班次</option> | 46 | <option value="0">全部班次</option> |
| 47 | <option value="1">全程</option> | 47 | <option value="1">全程</option> |
| 48 | <option value="2">区间</option> | 48 | <option value="2">区间</option> |
src/main/resources/static/pages/summary/work_hours/list.html
| @@ -251,6 +251,7 @@ | @@ -251,6 +251,7 @@ | ||
| 251 | var data = f.serializeJSON(); | 251 | var data = f.serializeJSON(); |
| 252 | data.page = page; | 252 | data.page = page; |
| 253 | data.size = pageSize; | 253 | data.size = pageSize; |
| 254 | + data.companyId_eq = ""; | ||
| 254 | 255 | ||
| 255 | $.get('/summary/hours', data, function (rs) { | 256 | $.get('/summary/hours', data, function (rs) { |
| 256 | //console.log('data', rs); | 257 | //console.log('data', rs); |