Commit b6dc2454b3f026e51143f1c018e4de1857599699
1 parent
49180b5d
LGF 报表
Showing
9 changed files
with
2382 additions
and
38 deletions
src/main/java/com/bsth/controller/BusIntervalController.java
0 → 100644
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.service.BusIntervalService; | ||
| 13 | + | ||
| 14 | +@RestController | ||
| 15 | +@RequestMapping("busInterval") | ||
| 16 | +public class BusIntervalController { | ||
| 17 | + | ||
| 18 | + @Autowired | ||
| 19 | + private BusIntervalService busIntervalService; | ||
| 20 | + | ||
| 21 | + @RequestMapping(value = "/getDir", method = RequestMethod.GET) | ||
| 22 | + public List<Map<String,Object>> getDir(@RequestParam Map<String, Object> map){ | ||
| 23 | + return busIntervalService.getDir(map); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @RequestMapping(value = "/interval", method = RequestMethod.GET) | ||
| 27 | + public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){ | ||
| 28 | + return busIntervalService.interval(map); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @RequestMapping(value = "/timeAndSpeed", method = RequestMethod.GET) | ||
| 32 | + public Map<String,Object> timeAndSpeed(@RequestParam Map<String, Object> map){ | ||
| 33 | + return busIntervalService.timeAndSpeed(map); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @RequestMapping(value = "/lineTimeAnaliy", method = RequestMethod.GET) | ||
| 37 | + public List<Map<String,Object>> lineTimeAnaliy(@RequestParam Map<String, Object> map){ | ||
| 38 | + return busIntervalService.lineTimeAnaliy(map); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @RequestMapping(value = "/lbStatuAnaly", method = RequestMethod.GET) | ||
| 42 | + public List<Map<String,Object>> lbStatuAnaly(@RequestParam Map<String, Object> map){ | ||
| 43 | + return busIntervalService.lbStatuAnaly(map); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @RequestMapping(value = "/correctStatis", method = RequestMethod.GET) | ||
| 47 | + public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){ | ||
| 48 | + return busIntervalService.correctStatis(map); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | +} |
src/main/java/com/bsth/service/BusIntervalService.java
0 → 100644
| 1 | +package com.bsth.service; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +public interface BusIntervalService { | ||
| 8 | + | ||
| 9 | + List<Map<String, Object>> getDir(Map<String, Object> map); | ||
| 10 | + | ||
| 11 | + List<Map<String, Object>> interval(Map<String, Object> map); | ||
| 12 | + | ||
| 13 | + Map<String, Object> timeAndSpeed(Map<String, Object> map); | ||
| 14 | + | ||
| 15 | + List<Map<String, Object>> lineTimeAnaliy(Map<String, Object> map); | ||
| 16 | + | ||
| 17 | + List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map); | ||
| 18 | + | ||
| 19 | + List<Map<String, Object>> correctStatis(Map<String, Object> map); | ||
| 20 | +} |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.impl; | ||
| 2 | + | ||
| 3 | +import java.sql.ResultSet; | ||
| 4 | +import java.sql.SQLException; | ||
| 5 | +import java.text.DecimalFormat; | ||
| 6 | +import java.text.SimpleDateFormat; | ||
| 7 | +import java.util.ArrayList; | ||
| 8 | +import java.util.Collections; | ||
| 9 | +import java.util.Comparator; | ||
| 10 | +import java.util.Date; | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.List; | ||
| 13 | +import java.util.Map; | ||
| 14 | + | ||
| 15 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 16 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 17 | +import org.springframework.jdbc.core.RowMapper; | ||
| 18 | +import org.springframework.stereotype.Service; | ||
| 19 | + | ||
| 20 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 21 | +import com.bsth.entity.schedule.TTInfoDetail; | ||
| 22 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 23 | +import com.bsth.service.BusIntervalService; | ||
| 24 | +import com.bsth.service.schedule.PeopleCarPlanService; | ||
| 25 | + | ||
| 26 | + | ||
| 27 | +@Service | ||
| 28 | +public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 29 | + | ||
| 30 | + @Autowired | ||
| 31 | + private PeopleCarPlanService peopleCarPlanService; | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + private ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + private JdbcTemplate jdbcTemplate; | ||
| 38 | + | ||
| 39 | + private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 40 | + private DecimalFormat df = new DecimalFormat("##0.00"); | ||
| 41 | + | ||
| 42 | + public List<ScheduleRealInfo> getSchedule(String line, String startDate, String endDate, String model, String times){ | ||
| 43 | + List<TTInfoDetail> ttList = new ArrayList<TTInfoDetail>(); | ||
| 44 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | ||
| 45 | + List<ScheduleRealInfo> resList = new ArrayList<ScheduleRealInfo>(); | ||
| 46 | + | ||
| 47 | + if(startDate.length() == 0){ | ||
| 48 | + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | ||
| 49 | + } | ||
| 50 | + if(endDate.length() == 0){ | ||
| 51 | + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | ||
| 52 | + } | ||
| 53 | + try { | ||
| 54 | + | ||
| 55 | + String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"; | ||
| 56 | + if(line.length() != 0){ | ||
| 57 | + sql += " and xl_bm = '"+line+"'"; | ||
| 58 | + } | ||
| 59 | + if(times.length() != 0){ | ||
| 60 | + String[] split = times.split("-"); | ||
| 61 | + sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'"; | ||
| 62 | + } | ||
| 63 | + sql += " and bc_type = 'normal'"; | ||
| 64 | + | ||
| 65 | + list =jdbcTemplate.query(sql, | ||
| 66 | + new RowMapper<ScheduleRealInfo>(){ | ||
| 67 | + @Override | ||
| 68 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 69 | + ScheduleRealInfo schedule = new ScheduleRealInfo(); | ||
| 70 | + schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); | ||
| 71 | + schedule.setXlName(rs.getString("xl_name")); | ||
| 72 | + schedule.setLpName(rs.getString("lp_name")); | ||
| 73 | + schedule.setBcType(rs.getString("bc_type")); | ||
| 74 | + schedule.setBcs(rs.getInt("bcs")); | ||
| 75 | + schedule.setBcsj(rs.getInt("bcsj")); | ||
| 76 | + schedule.setJhlc(rs.getDouble("jhlc")); | ||
| 77 | + schedule.setDfsj(rs.getString("dfsj")); | ||
| 78 | + schedule.setFcsj(rs.getString("fcsj")); | ||
| 79 | + schedule.setFcsjActual(rs.getString("fcsj_actual")); | ||
| 80 | + schedule.setZdsj(rs.getString("zdsj")); | ||
| 81 | + schedule.setZdsjActual(rs.getString("zdsj_actual")); | ||
| 82 | + schedule.setQdzName(rs.getString("qdz_name")); | ||
| 83 | + schedule.setZdzName(rs.getString("zdz_name")); | ||
| 84 | + schedule.setXlDir(rs.getString("xl_dir")); | ||
| 85 | + schedule.setStatus(rs.getInt("status")); | ||
| 86 | + schedule.setRemarks(rs.getString("remarks")); | ||
| 87 | + return schedule; | ||
| 88 | + } | ||
| 89 | + }); | ||
| 90 | + | ||
| 91 | + if(model.length() != 0){ | ||
| 92 | + sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type = 'normal'"; | ||
| 93 | + | ||
| 94 | + ttList =jdbcTemplate.query(sql, | ||
| 95 | + new RowMapper<TTInfoDetail>(){ | ||
| 96 | + @Override | ||
| 97 | + public TTInfoDetail mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 98 | + TTInfoDetail ttInfo = new TTInfoDetail(); | ||
| 99 | + ttInfo.setBcType(rs.getString("bc_type")); | ||
| 100 | + ttInfo.setBcs(rs.getInt("bcs")); | ||
| 101 | + ttInfo.setFcsj(rs.getString("fcsj")); | ||
| 102 | + ttInfo.setBcsj(rs.getInt("bcsj")); | ||
| 103 | + return ttInfo; | ||
| 104 | + } | ||
| 105 | + }); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + } catch (Exception e) { | ||
| 109 | + // TODO Auto-generated catch block | ||
| 110 | + e.printStackTrace(); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + //分组计算 同时判断是否所选时刻信息 | ||
| 114 | + for(ScheduleRealInfo schedule : list){ | ||
| 115 | + if(schedule.getFcsj() == null) | ||
| 116 | + continue; | ||
| 117 | + String[] fcsj = schedule.getFcsj().split(":"); | ||
| 118 | + String[] zdsj = schedule.getZdsj().split(":"); | ||
| 119 | + schedule.setFcsjT((Long.valueOf(fcsj[0]) * 60) + Long.valueOf(fcsj[1])); | ||
| 120 | + schedule.setZdsjT((Long.valueOf(zdsj[0]) * 60) + Long.valueOf(zdsj[1])); | ||
| 121 | + if(schedule.getFcsjActual() != null){ | ||
| 122 | + String[] fcsj_ = schedule.getFcsjActual().split(":"); | ||
| 123 | + schedule.setFcsjActualTime((Long.valueOf(fcsj_[0]) * 60) + Long.valueOf(fcsj_[1])); | ||
| 124 | + } | ||
| 125 | + if(schedule.getZdsjActual() != null){ | ||
| 126 | + String[] zdsj_ = schedule.getZdsjActual().split(":"); | ||
| 127 | + schedule.setZdsjActualTime((Long.valueOf(zdsj_[0]) * 60) + Long.valueOf(zdsj_[1])); | ||
| 128 | + } | ||
| 129 | + if(schedule.getDfsj() != null){ | ||
| 130 | + String[] dfsj = schedule.getDfsj().split(":"); | ||
| 131 | + schedule.setDfsjT((Long.valueOf(dfsj[0]) * 60) + Long.valueOf(dfsj[1])); | ||
| 132 | + } | ||
| 133 | + DO:{ | ||
| 134 | + if(model.length() != 0){ | ||
| 135 | + for(TTInfoDetail tt : ttList){ | ||
| 136 | + if(tt.getBcs() == schedule.getBcs() && tt.getFcsj().equals(schedule.getFcsj()) | ||
| 137 | + && tt.getBcsj() == schedule.getBcsj()){ | ||
| 138 | + resList.add(schedule); | ||
| 139 | + break DO; | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + } else { | ||
| 143 | + resList.add(schedule); | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + list = new ArrayList<ScheduleRealInfo>(); | ||
| 149 | + List<Long> keyList = new ArrayList<Long>(); | ||
| 150 | + Map<Long, List<ScheduleRealInfo>> keyMap = new HashMap<Long, List<ScheduleRealInfo>>(); | ||
| 151 | + for(ScheduleRealInfo schedule : resList){ | ||
| 152 | + Long key = schedule.getFcsjT(); | ||
| 153 | + if(!keyMap.containsKey(key)){ | ||
| 154 | + keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | ||
| 155 | + keyList.add(key); | ||
| 156 | + } | ||
| 157 | + keyMap.get(key).add(schedule); | ||
| 158 | + } | ||
| 159 | + Collections.sort(keyList); | ||
| 160 | + for(Long key : keyList){ | ||
| 161 | + for(ScheduleRealInfo schedule : keyMap.get(key)){ | ||
| 162 | + list.add(schedule); | ||
| 163 | + } | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + return list; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + @Override | ||
| 170 | + public List<Map<String, Object>> getDir(Map<String, Object> map) { | ||
| 171 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 172 | + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | ||
| 173 | + | ||
| 174 | + String line = map.get("line").toString(); | ||
| 175 | + | ||
| 176 | + try { | ||
| 177 | + | ||
| 178 | + String sql = "select start_station_name, end_station_name from bsth_c_line where line_code = '"+line+"'"; | ||
| 179 | + | ||
| 180 | + list =jdbcTemplate.query(sql, | ||
| 181 | + new RowMapper<Map<String, Object>>(){ | ||
| 182 | + @Override | ||
| 183 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 184 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 185 | + m.put("startStation", rs.getString("start_station_name")); | ||
| 186 | + m.put("endStation", rs.getString("end_station_name")); | ||
| 187 | + return m; | ||
| 188 | + } | ||
| 189 | + }); | ||
| 190 | + | ||
| 191 | + } catch (Exception e) { | ||
| 192 | + // TODO Auto-generated catch block | ||
| 193 | + e.printStackTrace(); | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + for(Map<String, Object> m : list){ | ||
| 197 | + Map<String, Object> tempMap1 = new HashMap<String, Object>(); | ||
| 198 | + Map<String, Object> tempMap2 = new HashMap<String, Object>(); | ||
| 199 | + tempMap1.put("name", m.get("startStation")); | ||
| 200 | + tempMap2.put("name", m.get("endStation")); | ||
| 201 | + resList.add(tempMap1); | ||
| 202 | + resList.add(tempMap2); | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + return resList; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + @Override | ||
| 209 | + public List<Map<String, Object>> interval(Map<String, Object> map) { | ||
| 210 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 211 | + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | ||
| 212 | + | ||
| 213 | + String line = map.get("line").toString(); | ||
| 214 | + String startDate = map.get("startDate").toString(); | ||
| 215 | + String endDate = map.get("endDate").toString(); | ||
| 216 | + String model = map.get("model").toString(); | ||
| 217 | + String times = map.get("times").toString(); | ||
| 218 | + String type = map.get("type").toString(); | ||
| 219 | + | ||
| 220 | + List<ScheduleRealInfo> list = this.getSchedule(line, startDate, endDate, model, times); | ||
| 221 | + | ||
| 222 | + String[] date1 = startDate.split("-"); | ||
| 223 | + String[] date2 = endDate.split("-"); | ||
| 224 | + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; | ||
| 225 | + endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; | ||
| 226 | + | ||
| 227 | + String[] split = times.split("-"); | ||
| 228 | + int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); | ||
| 229 | + int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); | ||
| 230 | + | ||
| 231 | + //分组统计班次间隔 | ||
| 232 | + for(ScheduleRealInfo schedule : list){ | ||
| 233 | + long fcsj = schedule.getFcsjT(); | ||
| 234 | + if(endTime != 0?(fcsj >= startTime && fcsj <= endTime):(fcsj >= startTime)){ | ||
| 235 | + String key = schedule.getXlName() + "/" + schedule.getQdzName(); | ||
| 236 | + if(!keyMap.containsKey(key)) | ||
| 237 | + keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | ||
| 238 | + keyMap.get(key).add(schedule); | ||
| 239 | + } | ||
| 240 | + } | ||
| 241 | + for(String key : keyMap.keySet()){ | ||
| 242 | + long jhInterval = 0; | ||
| 243 | + long sjInterval = 0; | ||
| 244 | + int jhNum = 0; | ||
| 245 | + int sjNum = 0; | ||
| 246 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | ||
| 247 | + Map<String, List<ScheduleRealInfo>> temp = new HashMap<String, List<ScheduleRealInfo>>(); | ||
| 248 | + for(ScheduleRealInfo schedule : keyMap.get(key)){ | ||
| 249 | + String date = schedule.getScheduleDateStr(); | ||
| 250 | + if(!temp.containsKey(date)) | ||
| 251 | + temp.put(date, new ArrayList<ScheduleRealInfo>()); | ||
| 252 | + temp.get(date).add(schedule); | ||
| 253 | + } | ||
| 254 | + for(String date : temp.keySet()){ | ||
| 255 | + List<ScheduleRealInfo> tempList = temp.get(date); | ||
| 256 | + for(int i = 1; i < tempList.size(); i++){ | ||
| 257 | + jhNum++; | ||
| 258 | + ScheduleRealInfo schedule1 = tempList.get(i - 1); | ||
| 259 | + ScheduleRealInfo schedule2 = tempList.get(i); | ||
| 260 | + jhInterval += schedule2.getFcsjT(); | ||
| 261 | + jhInterval -= schedule1.getFcsjT(); | ||
| 262 | + if(schedule1.getFcsjActual()!=null && schedule2.getFcsjActual()!=null){ | ||
| 263 | + sjNum++; | ||
| 264 | + sjInterval += schedule2.getFcsjActualTime(); | ||
| 265 | + sjInterval -= schedule1.getFcsjActualTime(); | ||
| 266 | + } | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + if(startDate.equals(endDate)) | ||
| 270 | + tempMap.put("date", startDate); | ||
| 271 | + else | ||
| 272 | + tempMap.put("date", startDate + "--" + endDate); | ||
| 273 | + String[] keys = key.split("/"); | ||
| 274 | + tempMap.put("line", keys[0]); | ||
| 275 | + tempMap.put("qdz", keys[1]); | ||
| 276 | + tempMap.put("times", times); | ||
| 277 | + if(jhNum != 0) | ||
| 278 | + tempMap.put("jhInterval", jhInterval/jhNum); | ||
| 279 | + else | ||
| 280 | + tempMap.put("jhInterval", "/"); | ||
| 281 | + if(sjNum != 0){ | ||
| 282 | + tempMap.put("sjInterval", sjInterval/sjNum); | ||
| 283 | + tempMap.put("deviation", sjInterval/sjNum - jhInterval/jhNum); | ||
| 284 | + } | ||
| 285 | + else{ | ||
| 286 | + tempMap.put("sjInterval", "/"); | ||
| 287 | + tempMap.put("deviation", "/"); | ||
| 288 | + } | ||
| 289 | + resList.add(tempMap); | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + //排序 | ||
| 293 | + Map<String, List<Map<String, Object>>> temp = new HashMap<String, List<Map<String, Object>>>(); | ||
| 294 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | ||
| 295 | + for(Map<String, Object> m : resList){ | ||
| 296 | + String key = m.get("line").toString(); | ||
| 297 | + if(!temp.containsKey(key)) | ||
| 298 | + temp.put(key, new ArrayList<Map<String, Object>>()); | ||
| 299 | + temp.get(key).add(m); | ||
| 300 | + } | ||
| 301 | + for(String key : temp.keySet()){ | ||
| 302 | + for(Map<String, Object> m : temp.get(key)){ | ||
| 303 | + tempList.add(m); | ||
| 304 | + } | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + return tempList; | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + @Override | ||
| 311 | + public Map<String, Object> timeAndSpeed(Map<String, Object> map) { | ||
| 312 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 313 | + List<Map<String, Object>> dateList = new ArrayList<Map<String, Object>>(); | ||
| 314 | + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | ||
| 315 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 316 | + | ||
| 317 | + String line = map.get("line").toString(); | ||
| 318 | + String startDate = map.get("startDate").toString(); | ||
| 319 | + String endDate = map.get("endDate").toString(); | ||
| 320 | + String model = map.get("model").toString(); | ||
| 321 | + String times = map.get("times").toString(); | ||
| 322 | + String type = map.get("type").toString(); | ||
| 323 | + String zdzName = map.get("upDown").toString(); | ||
| 324 | + | ||
| 325 | + List<ScheduleRealInfo> list = this.getSchedule(line, startDate, endDate, model, times); | ||
| 326 | + | ||
| 327 | + String[] date1 = startDate.split("-"); | ||
| 328 | + String[] date2 = endDate.split("-"); | ||
| 329 | + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; | ||
| 330 | + endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; | ||
| 331 | + | ||
| 332 | + String[] split = times.split("-"); | ||
| 333 | + int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); | ||
| 334 | + int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); | ||
| 335 | + | ||
| 336 | + for(ScheduleRealInfo schedule : list){ | ||
| 337 | + if(zdzName.length() != 0){ | ||
| 338 | + if(!zdzName.equals(schedule.getZdzName())){ | ||
| 339 | + continue; | ||
| 340 | + } | ||
| 341 | + } | ||
| 342 | + int fcsj = Integer.valueOf(schedule.getFcsjT() + ""); | ||
| 343 | + if(!(endTime != 0?(fcsj >= startTime && fcsj < endTime):(fcsj >= startTime))){ | ||
| 344 | + continue; | ||
| 345 | + } | ||
| 346 | + String key = schedule.getXlName() + "/" + schedule.getLpName() + "/" + schedule.getZdzName(); | ||
| 347 | + if(!keyMap.containsKey(key)){ | ||
| 348 | + keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | ||
| 349 | + } | ||
| 350 | + keyMap.get(key).add(schedule); | ||
| 351 | + } | ||
| 352 | + | ||
| 353 | + long yysjSum = 0; | ||
| 354 | + double yysdSum = 0; | ||
| 355 | + long yssjSum = 0; | ||
| 356 | + double yssdSum = 0; | ||
| 357 | + for(String key : keyMap.keySet()){ | ||
| 358 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | ||
| 359 | + long yysj = 0; | ||
| 360 | + double yysd = 0; | ||
| 361 | + long yssj = 0; | ||
| 362 | + double yssd = 0; | ||
| 363 | + int yyNum = 0; | ||
| 364 | + int ysNum = 0; | ||
| 365 | + for(ScheduleRealInfo schedule : keyMap.get(key)){ | ||
| 366 | + if(!tempMap.containsKey("xlDir")) | ||
| 367 | + tempMap.put("xlDir", schedule.getXlDir()); | ||
| 368 | + if(!tempMap.containsKey("qdz_zdz") && schedule.getXlDir().equals("0")) | ||
| 369 | + tempMap.put("qdz_zdz", schedule.getQdzName() + "--" + schedule.getZdzName()); | ||
| 370 | + else if(!tempMap.containsKey("qdz_zdz")) | ||
| 371 | + tempMap.put("qdz_zdz", schedule.getZdzName() + "--" + schedule.getQdzName()); | ||
| 372 | + if(schedule.getBcsj() != null && schedule.getJhlc() != null){ | ||
| 373 | + int bcsj = schedule.getBcsj(); | ||
| 374 | + double jhlc = schedule.getJhlc(); | ||
| 375 | + yysd += jhlc/bcsj; | ||
| 376 | + yysj += bcsj; | ||
| 377 | + yyNum++; | ||
| 378 | + if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null){ | ||
| 379 | + long time = schedule.getZdsjActualTime() - schedule.getFcsjActualTime(); | ||
| 380 | + yssd += jhlc/time; | ||
| 381 | + yssj += time; | ||
| 382 | + ysNum++; | ||
| 383 | + } | ||
| 384 | + } | ||
| 385 | + } | ||
| 386 | + if(startTime != endTime) | ||
| 387 | + tempMap.put("date", startDate + "--" + endDate); | ||
| 388 | + else | ||
| 389 | + tempMap.put("date", startDate); | ||
| 390 | + tempMap.put("times", times); | ||
| 391 | + String[] keys = key.split("/"); | ||
| 392 | + tempMap.put("line", keys[0]); | ||
| 393 | + tempMap.put("lp", keys[1]); | ||
| 394 | + tempMap.put("zdz", keys[2]); | ||
| 395 | + | ||
| 396 | + tempMap.put("yysj", (yysj/60) + "小时" + (yysj%60) + "分钟"); | ||
| 397 | + yysjSum += yysj; | ||
| 398 | + if(yyNum != 0){ | ||
| 399 | + tempMap.put("yysd", df.format((yysd/yyNum)*60) + "公里/小时"); | ||
| 400 | + yysdSum += Double.valueOf(df.format((yysd/yyNum)*60)); | ||
| 401 | + } else { | ||
| 402 | + tempMap.put("yysd", "/"); | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + tempMap.put("yssj", (yssj/60) + "小时" + (yssj%60) + "分钟"); | ||
| 406 | + yssjSum += yssj; | ||
| 407 | + if(ysNum != 0){ | ||
| 408 | + tempMap.put("yssd", df.format((yssd/ysNum)*60) + "公里/小时"); | ||
| 409 | + yssdSum += Double.valueOf(df.format((yssd/ysNum)*60)); | ||
| 410 | + } else { | ||
| 411 | + tempMap.put("yssd", "/"); | ||
| 412 | + } | ||
| 413 | + | ||
| 414 | + dateList.add(tempMap); | ||
| 415 | + } | ||
| 416 | + int size = keyMap.keySet().size(); | ||
| 417 | + size = size == 0 ? 1 : size; | ||
| 418 | + modelMap.put("yysj", (yysjSum/size)/60 + "小时" + (yysjSum/size)%60 + "分钟"); | ||
| 419 | + modelMap.put("yysd", df.format(yysdSum/size) + "公里/小时"); | ||
| 420 | + modelMap.put("yssj", (yssjSum/size)/60 + "小时" + (yssjSum/size)%60 + "分钟"); | ||
| 421 | + modelMap.put("yssd", df.format(yssdSum/size) + "公里/小时"); | ||
| 422 | + | ||
| 423 | + Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>(); | ||
| 424 | + for(Map<String, Object> m : dateList){ | ||
| 425 | + String key = m.get("line").toString(); | ||
| 426 | + if(!keyMap2.containsKey(key)) | ||
| 427 | + keyMap2.put(key, new ArrayList<Map<String, Object>>()); | ||
| 428 | + keyMap2.get(key).add(m); | ||
| 429 | + } | ||
| 430 | + for(String key : keyMap2.keySet()){ | ||
| 431 | + List<Integer> keyList = new ArrayList<Integer>(); | ||
| 432 | + Map<Integer, List<Map<String, Object>>> temp = new HashMap<Integer, List<Map<String,Object>>>(); | ||
| 433 | + for(Map<String, Object> m : keyMap2.get(key)){ | ||
| 434 | + Integer num = Integer.valueOf(m.get("lp").toString())*10+Integer.valueOf(m.get("xlDir").toString()); | ||
| 435 | + if(!temp.containsKey(num)){ | ||
| 436 | + temp.put(num, new ArrayList<Map<String, Object>>()); | ||
| 437 | + keyList.add(num); | ||
| 438 | + } | ||
| 439 | + temp.get(num).add(m); | ||
| 440 | + } | ||
| 441 | + Collections.sort(keyList); | ||
| 442 | + for(Integer lp : keyList){ | ||
| 443 | + List<Map<String, Object>> tempList = temp.get(lp); | ||
| 444 | + for(Map<String, Object> m : tempList){ | ||
| 445 | + resList.add(m); | ||
| 446 | + } | ||
| 447 | + } | ||
| 448 | + } | ||
| 449 | + | ||
| 450 | + modelMap.put("dateList", resList); | ||
| 451 | + return modelMap; | ||
| 452 | + } | ||
| 453 | + | ||
| 454 | + @Override | ||
| 455 | + public List<Map<String, Object>> lineTimeAnaliy(Map<String, Object> map) { | ||
| 456 | + List<Map<String, Object>> list0 = new ArrayList<Map<String,Object>>(); | ||
| 457 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 458 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | ||
| 459 | + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | ||
| 460 | + Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>(); | ||
| 461 | + | ||
| 462 | + String line = map.get("line").toString(); | ||
| 463 | + String startDate = map.get("startDate").toString(); | ||
| 464 | + String endDate = map.get("endDate").toString(); | ||
| 465 | + String model = map.get("model").toString(); | ||
| 466 | + String times = map.get("times").toString(); | ||
| 467 | + String type = map.get("type").toString(); | ||
| 468 | + String qdzName = map.get("upDown").toString(); | ||
| 469 | + | ||
| 470 | + list = getSchedule(line, startDate, endDate, model, times); | ||
| 471 | + | ||
| 472 | + String[] date1 = startDate.split("-"); | ||
| 473 | + String[] date2 = endDate.split("-"); | ||
| 474 | + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; | ||
| 475 | + endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; | ||
| 476 | + | ||
| 477 | + String[] split = times.split("-"); | ||
| 478 | + int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); | ||
| 479 | + int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); | ||
| 480 | + | ||
| 481 | + | ||
| 482 | + for(ScheduleRealInfo schedule : list){ | ||
| 483 | + if(!qdzName.equals(schedule.getQdzName())){ | ||
| 484 | + continue; | ||
| 485 | + } | ||
| 486 | + Long fcsj = schedule.getFcsjT(); | ||
| 487 | + if(!(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){ | ||
| 488 | + continue; | ||
| 489 | + } | ||
| 490 | + String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName() + "/" + schedule.getFcsj(); | ||
| 491 | + if(!keyMap.containsKey(key)) | ||
| 492 | + keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | ||
| 493 | + keyMap.get(key).add(schedule); | ||
| 494 | + } | ||
| 495 | + for(String key : keyMap.keySet()){ | ||
| 496 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | ||
| 497 | + int jhbc = 0; | ||
| 498 | + int sjbc = 0; | ||
| 499 | + int kbc = 0; | ||
| 500 | + int mbc = 0; | ||
| 501 | + long jhdf = 0l; | ||
| 502 | + long sjdf = 0l; | ||
| 503 | + long wddf1 = 0l; | ||
| 504 | + long wddf2 = 0l; | ||
| 505 | + long jhfc = 0l; | ||
| 506 | + long sjfc = 0l; | ||
| 507 | + long wdfc1 = 0l; | ||
| 508 | + long wdfc2 = 0l; | ||
| 509 | + long jhys = 0l; | ||
| 510 | + long sjys = 0l; | ||
| 511 | + long yssjMax = 0l; | ||
| 512 | + long yssjMin = 0l; | ||
| 513 | + long jhtz = 0l; | ||
| 514 | + long sjtz = 0l; | ||
| 515 | + long tzsjMax = 0l; | ||
| 516 | + long tzsjMin = 0l; | ||
| 517 | + for(ScheduleRealInfo schedule : keyMap.get(key)){ | ||
| 518 | + long tzsj = 0l; | ||
| 519 | + long yssj = 0l; | ||
| 520 | + jhbc++; | ||
| 521 | + if(schedule.getDfsj() != null){ | ||
| 522 | + jhtz += schedule.getFcsjT() - schedule.getDfsjT(); | ||
| 523 | + } | ||
| 524 | + jhys += schedule.getZdsjT() - schedule.getFcsjT(); | ||
| 525 | + | ||
| 526 | + if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null){ | ||
| 527 | + sjbc++; | ||
| 528 | + sjfc += schedule.getFcsjActualTime(); | ||
| 529 | + yssj += schedule.getZdsjActualTime() - schedule.getFcsjActualTime(); | ||
| 530 | + if(schedule.getFcsjActualTime() - schedule.getFcsjT() < 0){ | ||
| 531 | + wdfc1 += schedule.getFcsjT() - schedule.getFcsjActualTime(); | ||
| 532 | + kbc++; | ||
| 533 | + } else if(schedule.getFcsjActualTime() - schedule.getFcsjT() > 0){ | ||
| 534 | + wdfc2 += schedule.getFcsjActualTime() - schedule.getFcsjT(); | ||
| 535 | + mbc++; | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + if(schedule.getDfsj() != null){ | ||
| 539 | + sjdf += schedule.getDfsjT(); | ||
| 540 | + tzsj += schedule.getFcsjActualTime() - schedule.getDfsjT(); | ||
| 541 | + if(schedule.getDfsjT() - schedule.getFcsjT() < 0) | ||
| 542 | + wddf1 += schedule.getFcsjT() - schedule.getDfsjT(); | ||
| 543 | + else | ||
| 544 | + wddf2 += schedule.getDfsjT() - schedule.getFcsjT(); | ||
| 545 | + } else { | ||
| 546 | + sjdf += schedule.getFcsjT(); | ||
| 547 | + tzsj += schedule.getFcsjActualTime() - schedule.getFcsjT(); | ||
| 548 | + } | ||
| 549 | + } | ||
| 550 | + | ||
| 551 | + sjys += yssj; | ||
| 552 | + if(yssj > yssjMax || yssjMax == 0l) | ||
| 553 | + yssjMax = yssj; | ||
| 554 | + if(yssj < yssjMin || yssjMin == 0l) | ||
| 555 | + yssjMin = yssj; | ||
| 556 | + | ||
| 557 | + sjtz += tzsj; | ||
| 558 | + if(tzsj > tzsjMax || tzsjMax == 0l) | ||
| 559 | + tzsjMax = tzsj; | ||
| 560 | + if(tzsj < tzsjMin || tzsjMin == 0l) | ||
| 561 | + tzsjMin = tzsj; | ||
| 562 | + } | ||
| 563 | + String[] keys = key.split("/"); | ||
| 564 | + tempMap.put("date", keys[0]); | ||
| 565 | + tempMap.put("line", keys[1]); | ||
| 566 | + tempMap.put("lp", keys[2]); | ||
| 567 | + tempMap.put("jhdf", keys[3]); | ||
| 568 | + tempMap.put("jhfc", keys[3]); | ||
| 569 | + tempMap.put("station", qdzName); | ||
| 570 | + tempMap.put("times", times); | ||
| 571 | + if(startDate.equals(endDate)) | ||
| 572 | + tempMap.put("dates", startDate); | ||
| 573 | + else | ||
| 574 | + tempMap.put("dates", startDate + "--" + endDate); | ||
| 575 | + tempMap.put("jhbc", jhbc); | ||
| 576 | + tempMap.put("sjbc", sjbc); | ||
| 577 | + if(sjbc != 0){ | ||
| 578 | + tempMap.put("sjdf", ((sjdf/sjbc)/60<10?"0"+(sjdf/sjbc)/60:(sjdf/sjbc)/60) + ":" + ((sjdf/sjbc)%60<10?"0"+(sjdf/sjbc)%60:(sjdf/sjbc)%60)); | ||
| 579 | + tempMap.put("wddf1", wddf1 / sjbc + "分"); | ||
| 580 | + tempMap.put("wddf2", wddf2 / sjbc + "分"); | ||
| 581 | + tempMap.put("sjfc", ((sjfc/sjbc)/60<10?"0"+(sjfc/sjbc)/60:(sjfc/sjbc)/60) + ":" + ((sjfc/sjbc)%60<10?"0"+(sjfc/sjbc)%60:(sjfc/sjbc)%60)); | ||
| 582 | + tempMap.put("wdfc1", wdfc1 / sjbc + "分"); | ||
| 583 | + tempMap.put("wdfc2", wdfc2 / sjbc + "分"); | ||
| 584 | +// tempMap.put("kbc", df.format((((double) kbc)/sjbc)*100)+"%"); | ||
| 585 | +// tempMap.put("mbc", df.format((((double) mbc)/sjbc)*100)+"%"); | ||
| 586 | + tempMap.put("pjys", sjys / sjbc + "分"); | ||
| 587 | + tempMap.put("pjtz", sjtz / sjbc + "分"); | ||
| 588 | + } else { | ||
| 589 | + tempMap.put("sjdf", "/"); | ||
| 590 | + tempMap.put("wddf1", "0分"); | ||
| 591 | + tempMap.put("wddf2", "0分"); | ||
| 592 | + tempMap.put("sjfc", "/"); | ||
| 593 | + tempMap.put("wdfc1", "0分"); | ||
| 594 | + tempMap.put("wdfc2", "0分"); | ||
| 595 | +// tempMap.put("kbc", "0%"); | ||
| 596 | +// tempMap.put("mbc", "0%"); | ||
| 597 | + tempMap.put("pjys", "0分"); | ||
| 598 | + tempMap.put("pjtz", "0分"); | ||
| 599 | + } | ||
| 600 | + tempMap.put("kbc", kbc); | ||
| 601 | + tempMap.put("mbc", mbc); | ||
| 602 | + tempMap.put("jhys", jhys); | ||
| 603 | + tempMap.put("sjys", sjys); | ||
| 604 | + tempMap.put("yssjMin", yssjMin); | ||
| 605 | + tempMap.put("yssjMax", yssjMax); | ||
| 606 | + tempMap.put("jhtz", jhtz); | ||
| 607 | + tempMap.put("sjtz", sjtz); | ||
| 608 | + tempMap.put("tzsjMax", tzsjMax); | ||
| 609 | + tempMap.put("tzsjMin", tzsjMin); | ||
| 610 | + list0.add(tempMap); | ||
| 611 | + } | ||
| 612 | + | ||
| 613 | + Collections.sort(list0, new Comparator<Map<String, Object>>() { | ||
| 614 | + | ||
| 615 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | ||
| 616 | + | ||
| 617 | + String[] split1 = o1.get("date").toString().split("-"); | ||
| 618 | + String[] split2 = o2.get("date").toString().split("-"); | ||
| 619 | + Long a = Long.valueOf(split1[0])*10000 + Long.valueOf(split1[1])*100 + Long.valueOf(split1[2]); | ||
| 620 | + Long b = Long.valueOf(split2[0])*10000 + Long.valueOf(split2[1])*100 + Long.valueOf(split2[2]); | ||
| 621 | + | ||
| 622 | + // 升序 | ||
| 623 | + return a.compareTo(b); | ||
| 624 | + } | ||
| 625 | + }); | ||
| 626 | + | ||
| 627 | + for(Map<String, Object> m : list0){ | ||
| 628 | + String key = m.get("line").toString() + "/" + m.get("lp").toString() + "/" + m.get("station").toString(); | ||
| 629 | + if(!keyMap0.containsKey(key)) | ||
| 630 | + keyMap0.put(key, new ArrayList<Map<String, Object>>()); | ||
| 631 | + keyMap0.get(key).add(m); | ||
| 632 | + } | ||
| 633 | + for(String key : keyMap0.keySet()){ | ||
| 634 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | ||
| 635 | + int jhbc = 0; | ||
| 636 | + int sjbc = 0; | ||
| 637 | + int wddf1 = 0; | ||
| 638 | + int wddf2 = 0; | ||
| 639 | + int wdfc1 = 0; | ||
| 640 | + int wdfc2 = 0; | ||
| 641 | + int ys = 0; | ||
| 642 | + int tz = 0; | ||
| 643 | + for(Map<String, Object> m : keyMap0.get(key)){ | ||
| 644 | + jhbc += Integer.valueOf(m.get("jhbc").toString()); | ||
| 645 | + sjbc += Integer.valueOf(m.get("sjbc").toString()); | ||
| 646 | + wddf1 += Integer.valueOf(m.get("wddf1").toString().substring(0, m.get("wddf1").toString().length() - 1)); | ||
| 647 | + wddf2 += Integer.valueOf(m.get("wddf2").toString().substring(0, m.get("wddf2").toString().length() - 1)); | ||
| 648 | + wdfc1 += Integer.valueOf(m.get("wdfc1").toString().substring(0, m.get("wdfc1").toString().length() - 1)); | ||
| 649 | + wdfc2 += Integer.valueOf(m.get("wdfc2").toString().substring(0, m.get("wdfc2").toString().length() - 1)); | ||
| 650 | + ys += Integer.valueOf(m.get("pjys").toString().substring(0, m.get("pjys").toString().length() - 1)); | ||
| 651 | + tz += Integer.valueOf(m.get("pjtz").toString().substring(0, m.get("pjtz").toString().length() - 1)); | ||
| 652 | + } | ||
| 653 | + if(startDate.equals(endDate)) | ||
| 654 | + tempMap.put("dates", startDate); | ||
| 655 | + else | ||
| 656 | + tempMap.put("dates", startDate + "--" + endDate); | ||
| 657 | + String[] keys = key.split("/"); | ||
| 658 | + tempMap.put("line", keys[0]); | ||
| 659 | + tempMap.put("lp", keys[1]); | ||
| 660 | + tempMap.put("station", keys[2]); | ||
| 661 | + tempMap.put("times", times); | ||
| 662 | + tempMap.put("jhbc", jhbc); | ||
| 663 | + tempMap.put("sjbc", sjbc); | ||
| 664 | + tempMap.put("wddf1", wddf1/keyMap0.get(key).size()+"分"); | ||
| 665 | + tempMap.put("wddf2", wddf2/keyMap0.get(key).size()+"分"); | ||
| 666 | + tempMap.put("wdfc1", wdfc1/keyMap0.get(key).size()+"分"); | ||
| 667 | + tempMap.put("wdfc2", wdfc2/keyMap0.get(key).size()+"分"); | ||
| 668 | + tempMap.put("pjys", ys/keyMap0.get(key).size()+"分"); | ||
| 669 | + tempMap.put("pjtz", tz/keyMap0.get(key).size()+"分"); | ||
| 670 | + tempMap.put("workList", keyMap0.get(key)); | ||
| 671 | + resList.add(tempMap); | ||
| 672 | + } | ||
| 673 | + | ||
| 674 | + Collections.sort(resList, new Comparator<Map<String, Object>>() { | ||
| 675 | + | ||
| 676 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | ||
| 677 | + | ||
| 678 | + Integer a = Integer.valueOf(o1.get("lp").toString()); | ||
| 679 | + Integer b = Integer.valueOf(o2.get("lp").toString()); | ||
| 680 | + | ||
| 681 | + // 升序 | ||
| 682 | + return a.compareTo(b); | ||
| 683 | + } | ||
| 684 | + }); | ||
| 685 | + | ||
| 686 | + return resList; | ||
| 687 | + } | ||
| 688 | + | ||
| 689 | + @Override | ||
| 690 | + public List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map) { | ||
| 691 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 692 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | ||
| 693 | + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | ||
| 694 | + | ||
| 695 | + String line = map.get("line").toString(); | ||
| 696 | + String startDate = map.get("startDate").toString(); | ||
| 697 | + String endDate = map.get("endDate").toString(); | ||
| 698 | + String model = map.get("model").toString(); | ||
| 699 | + String times = map.get("times").toString(); | ||
| 700 | + String type = map.get("type").toString(); | ||
| 701 | + | ||
| 702 | + list = getSchedule(line, startDate, endDate, model, times); | ||
| 703 | + | ||
| 704 | + String[] date1 = startDate.split("-"); | ||
| 705 | + String[] date2 = endDate.split("-"); | ||
| 706 | + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; | ||
| 707 | + endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; | ||
| 708 | + | ||
| 709 | + String[] split = times.split("-"); | ||
| 710 | + int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); | ||
| 711 | + int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); | ||
| 712 | + | ||
| 713 | + for(ScheduleRealInfo schedule : list){ | ||
| 714 | + Long fcsj = schedule.getFcsjT(); | ||
| 715 | + if(!(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){ | ||
| 716 | + continue; | ||
| 717 | + } | ||
| 718 | + String key = schedule.getXlName(); | ||
| 719 | + if(!keyMap.containsKey(key)) | ||
| 720 | + keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | ||
| 721 | + keyMap.get(key).add(schedule); | ||
| 722 | + } | ||
| 723 | + for(String key : keyMap.keySet()){ | ||
| 724 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | ||
| 725 | + int jhbc = 0; | ||
| 726 | + int sjbc = 0; | ||
| 727 | + int jhlc = 0; | ||
| 728 | + int sjlc = 0; | ||
| 729 | + int lzbc = 0, lzlc = 0, dmbc = 0, dmlc = 0, | ||
| 730 | + gzbc = 0, gzlc = 0, jfbc = 0, jflc = 0, | ||
| 731 | + zsbc = 0, zslc = 0, qrbc = 0, qrlc = 0, | ||
| 732 | + qcbc = 0, qclc = 0, kxbc = 0, kxlc = 0, | ||
| 733 | + qhbc = 0, qhlc = 0, wybc = 0, wylc = 0; | ||
| 734 | + int qtbc = 0, qtlc = 0; | ||
| 735 | + for(ScheduleRealInfo schedule : keyMap.get(key)){ | ||
| 736 | + jhbc++; | ||
| 737 | + if(schedule.getJhlc() != null) | ||
| 738 | + jhlc += schedule.getJhlc(); | ||
| 739 | + if(schedule.getStatus() == 2){ | ||
| 740 | + sjbc++; | ||
| 741 | + if(schedule.getJhlc() != null) | ||
| 742 | + sjlc += schedule.getJhlc(); | ||
| 743 | + } else if(schedule.getStatus() == -1){ | ||
| 744 | + if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("路阻") != -1){ | ||
| 745 | + lzbc++; | ||
| 746 | + lzlc += schedule.getJhlc(); | ||
| 747 | + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("吊慢") != -1){ | ||
| 748 | + dmbc++; | ||
| 749 | + dmlc += schedule.getJhlc(); | ||
| 750 | + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("故障") != -1){ | ||
| 751 | + gzbc++; | ||
| 752 | + gzlc += schedule.getJhlc(); | ||
| 753 | + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("纠纷") != -1){ | ||
| 754 | + jfbc++; | ||
| 755 | + jflc += schedule.getJhlc(); | ||
| 756 | + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("肇事") != -1){ | ||
| 757 | + zsbc++; | ||
| 758 | + zslc += schedule.getJhlc(); | ||
| 759 | + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("缺人") != -1){ | ||
| 760 | + qrbc++; | ||
| 761 | + qrlc += schedule.getJhlc(); | ||
| 762 | + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("缺车") != -1){ | ||
| 763 | + qcbc++; | ||
| 764 | + qclc += schedule.getJhlc(); | ||
| 765 | + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("客稀") != -1){ | ||
| 766 | + kxbc++; | ||
| 767 | + kxlc += schedule.getJhlc(); | ||
| 768 | + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("气候") != -1){ | ||
| 769 | + qhbc++; | ||
| 770 | + qhlc += schedule.getJhlc(); | ||
| 771 | + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("外援") != -1){ | ||
| 772 | + wybc++; | ||
| 773 | + wylc += schedule.getJhlc(); | ||
| 774 | + } else { | ||
| 775 | + qtbc++; | ||
| 776 | + qtlc += schedule.getJhlc(); | ||
| 777 | + } | ||
| 778 | + } | ||
| 779 | + } | ||
| 780 | + if(startDate.equals(endDate)) | ||
| 781 | + tempMap.put("date", startDate); | ||
| 782 | + else | ||
| 783 | + tempMap.put("date", startDate + "--" + endDate); | ||
| 784 | + tempMap.put("times", times); | ||
| 785 | + tempMap.put("line", key); | ||
| 786 | + tempMap.put("jhbc", jhbc); | ||
| 787 | + tempMap.put("sjbc", sjbc); | ||
| 788 | + tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%"); | ||
| 789 | + tempMap.put("jhlc", jhlc); | ||
| 790 | + tempMap.put("sjlc", sjlc); | ||
| 791 | + tempMap.put("lcbfb", df.format(jhlc>0?(double)sjlc/jhlc*100:0)+"%"); | ||
| 792 | + tempMap.put("lzbc", lzbc); | ||
| 793 | + tempMap.put("lzlc", lzlc); | ||
| 794 | + tempMap.put("lzbfb", df.format(jhlc>0?(double)lzlc/jhlc*100:0)+"%"); | ||
| 795 | + tempMap.put("dmbc", dmbc); | ||
| 796 | + tempMap.put("dmlc", dmlc); | ||
| 797 | + tempMap.put("dmbfb", df.format(jhlc>0?(double)dmlc/jhlc*100:0)+"%"); | ||
| 798 | + tempMap.put("gzbc", gzbc); | ||
| 799 | + tempMap.put("gzlc", gzlc); | ||
| 800 | + tempMap.put("gzbfb", df.format(jhlc>0?(double)gzlc/jhlc*100:0)+"%"); | ||
| 801 | + tempMap.put("jfbc", jfbc); | ||
| 802 | + tempMap.put("jflc", jflc); | ||
| 803 | + tempMap.put("jfbfb", df.format(jhlc>0?(double)jflc/jhlc*100:0)+"%"); | ||
| 804 | + tempMap.put("zsbc", zsbc); | ||
| 805 | + tempMap.put("zslc", zslc); | ||
| 806 | + tempMap.put("zsbfb", df.format(jhlc>0?(double)zslc/jhlc*100:0)+"%"); | ||
| 807 | + tempMap.put("qrbc", qrbc); | ||
| 808 | + tempMap.put("qrlc", qrlc); | ||
| 809 | + tempMap.put("qrbfb", df.format(jhlc>0?(double)qrlc/jhlc*100:0)+"%"); | ||
| 810 | + tempMap.put("qcbc", qcbc); | ||
| 811 | + tempMap.put("qclc", qclc); | ||
| 812 | + tempMap.put("qcbfb", df.format(jhlc>0?(double)qclc/jhlc*100:0)+"%"); | ||
| 813 | + tempMap.put("kxbc", kxbc); | ||
| 814 | + tempMap.put("kxlc", kxlc); | ||
| 815 | + tempMap.put("kxbfb", df.format(jhlc>0?(double)kxlc/jhlc*100:0)+"%"); | ||
| 816 | + tempMap.put("qhbc", qhbc); | ||
| 817 | + tempMap.put("qhlc", qhlc); | ||
| 818 | + tempMap.put("qhbfb", df.format(jhlc>0?(double)qhlc/jhlc*100:0)+"%"); | ||
| 819 | + tempMap.put("wybc", wybc); | ||
| 820 | + tempMap.put("wylc", wylc); | ||
| 821 | + tempMap.put("wybfb", df.format(jhlc>0?(double)wylc/jhlc*100:0)+"%"); | ||
| 822 | + tempMap.put("qtbc", qtbc); | ||
| 823 | + tempMap.put("qtlc", qtlc); | ||
| 824 | + tempMap.put("qtbfb", df.format(jhlc>0?(double)qtlc/jhlc*100:0)+"%"); | ||
| 825 | + | ||
| 826 | + resList.add(tempMap); | ||
| 827 | + } | ||
| 828 | + | ||
| 829 | + return resList; | ||
| 830 | + } | ||
| 831 | + | ||
| 832 | + @Override | ||
| 833 | + public List<Map<String, Object>> correctStatis(Map<String, Object> map) { | ||
| 834 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 835 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | ||
| 836 | + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | ||
| 837 | + | ||
| 838 | + String line = map.get("line").toString(); | ||
| 839 | + String startDate = map.get("startDate").toString(); | ||
| 840 | + String endDate = map.get("endDate").toString(); | ||
| 841 | + String type = map.get("type").toString(); | ||
| 842 | + | ||
| 843 | + if(startDate.length() == 0){ | ||
| 844 | + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | ||
| 845 | + } | ||
| 846 | + if(endDate.length() == 0){ | ||
| 847 | + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | ||
| 848 | + } | ||
| 849 | + try { | ||
| 850 | + | ||
| 851 | + String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"' and fcsj_actual is not null"; | ||
| 852 | + if(line.length() != 0){ | ||
| 853 | + sql += " and xl_bm = '"+line+"'"; | ||
| 854 | + } | ||
| 855 | +// if(times.length() != 0){ | ||
| 856 | +// String[] split = times.split("-"); | ||
| 857 | +// sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'"; | ||
| 858 | +// } | ||
| 859 | + sql += " and bc_type = 'normal'"; | ||
| 860 | + | ||
| 861 | + list =jdbcTemplate.query(sql, | ||
| 862 | + new RowMapper<ScheduleRealInfo>(){ | ||
| 863 | + @Override | ||
| 864 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 865 | + ScheduleRealInfo schedule = new ScheduleRealInfo(); | ||
| 866 | + schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); | ||
| 867 | + schedule.setXlName(rs.getString("xl_name")); | ||
| 868 | + schedule.setLpName(rs.getString("lp_name")); | ||
| 869 | + schedule.setBcType(rs.getString("bc_type")); | ||
| 870 | + schedule.setBcs(rs.getInt("bcs")); | ||
| 871 | + schedule.setBcsj(rs.getInt("bcsj")); | ||
| 872 | + schedule.setJhlc(rs.getDouble("jhlc")); | ||
| 873 | + schedule.setDfsj(rs.getString("dfsj")); | ||
| 874 | + schedule.setFcsj(rs.getString("fcsj")); | ||
| 875 | + schedule.setFcsjActual(rs.getString("fcsj_actual")); | ||
| 876 | + schedule.setZdsj(rs.getString("zdsj")); | ||
| 877 | + schedule.setZdsjActual(rs.getString("zdsj_actual")); | ||
| 878 | + schedule.setQdzName(rs.getString("qdz_name")); | ||
| 879 | + schedule.setZdzName(rs.getString("zdz_name")); | ||
| 880 | + schedule.setXlDir(rs.getString("xl_dir")); | ||
| 881 | + schedule.setStatus(rs.getInt("status")); | ||
| 882 | + schedule.setRemarks(rs.getString("remarks")); | ||
| 883 | + schedule.setGsName(rs.getString("gs_name")); | ||
| 884 | + schedule.setFgsName(rs.getString("fgs_name")); | ||
| 885 | + schedule.setDfAuto(rs.getBoolean("df_auto")); | ||
| 886 | + schedule.setOnline(rs.getBoolean("online")); | ||
| 887 | + return schedule; | ||
| 888 | + } | ||
| 889 | + }); | ||
| 890 | + }catch (Exception e) { | ||
| 891 | + // TODO: handle exception | ||
| 892 | + e.printStackTrace(); | ||
| 893 | + } | ||
| 894 | + | ||
| 895 | + String[] date1 = startDate.split("-"); | ||
| 896 | + String[] date2 = endDate.split("-"); | ||
| 897 | + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; | ||
| 898 | + endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; | ||
| 899 | + | ||
| 900 | + for(ScheduleRealInfo schedule : list){ | ||
| 901 | + String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlName(); | ||
| 902 | + if(!keyMap.containsKey(key)) | ||
| 903 | + keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | ||
| 904 | + keyMap.get(key).add(schedule); | ||
| 905 | + } | ||
| 906 | + for(String key : keyMap.keySet()){ | ||
| 907 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | ||
| 908 | + List<ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>(); | ||
| 909 | + int sjbc = 0, sddf = 0, zddf = 0, | ||
| 910 | + dxtz = 0, lbtz = 0; | ||
| 911 | + for(ScheduleRealInfo schedule : keyMap.get(key)){ | ||
| 912 | + if(schedule.getFcsjActual() != null){ | ||
| 913 | + boolean flag = false; | ||
| 914 | + sjbc++; | ||
| 915 | + if(schedule.getDfsj() != null && !schedule.getDfsj().equals(schedule.getFcsj())){ | ||
| 916 | + flag = true; | ||
| 917 | + if(schedule.isDfAuto()) | ||
| 918 | + zddf++; | ||
| 919 | + else | ||
| 920 | + sddf++; | ||
| 921 | + } | ||
| 922 | + if(!schedule.isOnline()){ | ||
| 923 | + flag = true; | ||
| 924 | + dxtz++; | ||
| 925 | + } | ||
| 926 | + if(schedule.getStatus() == 2){ | ||
| 927 | + flag = true; | ||
| 928 | + lbtz++; | ||
| 929 | + } | ||
| 930 | + if(flag) | ||
| 931 | + tempList.add(schedule); | ||
| 932 | + } | ||
| 933 | + } | ||
| 934 | + if(startDate.equals(endDate)) | ||
| 935 | + tempMap.put("date", startDate); | ||
| 936 | + else | ||
| 937 | + tempMap.put("date", startDate + "--" + endDate); | ||
| 938 | + String[] keys = key.split("/"); | ||
| 939 | + tempMap.put("company", keys[0]); | ||
| 940 | + tempMap.put("subCompany", keys[1]); | ||
| 941 | + tempMap.put("line", keys[2]); | ||
| 942 | + tempMap.put("sjbc", sjbc); | ||
| 943 | + tempMap.put("sddf", sddf); | ||
| 944 | + tempMap.put("zddf", zddf); | ||
| 945 | + tempMap.put("dfhj", sddf + zddf); | ||
| 946 | + tempMap.put("dxtz", dxtz); | ||
| 947 | + tempMap.put("lbtz", lbtz); | ||
| 948 | + tempMap.put("correct", sddf + zddf + dxtz + lbtz); | ||
| 949 | + tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc) + "%"); | ||
| 950 | + tempMap.put("dxbl", df.format((double)(dxtz)/sjbc) + "%"); | ||
| 951 | + tempMap.put("lbbl", df.format((double)(lbtz)/sjbc) + "%"); | ||
| 952 | + tempMap.put("lbbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc) + "%"); | ||
| 953 | + | ||
| 954 | + } | ||
| 955 | + | ||
| 956 | + return resList; | ||
| 957 | + } | ||
| 958 | + | ||
| 959 | + | ||
| 960 | + | ||
| 961 | +} |
src/main/resources/static/pages/forms/statement/busInterval.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 | + .table-bordered > thead > tr > th, | ||
| 12 | + .table-bordered > thead > tr > td { | ||
| 13 | + border-bottom-width: 2px; } | ||
| 14 | + .table > tbody + tbody { | ||
| 15 | + border-top: 1px solid; } | ||
| 16 | +</style> | ||
| 17 | + | ||
| 18 | +<div class="page-head"> | ||
| 19 | + <div class="page-title"> | ||
| 20 | + <h1>班次间隔统计表</h1> | ||
| 21 | + </div> | ||
| 22 | +</div> | ||
| 23 | + | ||
| 24 | +<div class="row"> | ||
| 25 | + <div class="col-md-12"> | ||
| 26 | + <div class="portlet light porttlet-fit bordered"> | ||
| 27 | + <div class="portlet-title"> | ||
| 28 | + <form id="history" class="form-inline" action=""> | ||
| 29 | + <div style="display: inline-block;"> | ||
| 30 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 31 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 32 | + </div> | ||
| 33 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 34 | + <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 35 | + <input class="form-control" type="text" id="startDate" style="width: 180px;"/> | ||
| 36 | + </div> | ||
| 37 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 38 | + <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 39 | + <input class="form-control" type="text" id="endDate" style="width: 180px;"/> | ||
| 40 | + </div> | ||
| 41 | + <br/> | ||
| 42 | + <div style="display: inline-block;"> | ||
| 43 | + <span class="item-label" style="width: 80px;">时刻类型: </span> | ||
| 44 | + <select class="form-control" name="model" id="model" style="width: 180px;"> | ||
| 45 | + <option value="">请选择...</option> | ||
| 46 | + </select> | ||
| 47 | + </div> | ||
| 48 | + <div style="display: inline-block;"> | ||
| 49 | + <span class="item-label" style="width: 80px;">时间段: </span> | ||
| 50 | + <select class="form-control" name="model" id="times" style="width: 180px;"> | ||
| 51 | + <option value="05:00-06:00">05:00-06:00</option> | ||
| 52 | + <option value="06:00-07:00">06:00-07:00</option> | ||
| 53 | + <option value="07:00-08:00">07:00-08:00</option> | ||
| 54 | + <option value="08:00-09:00">08:00-09:00</option> | ||
| 55 | + <option value="09:00-10:00">09:00-10:00</option> | ||
| 56 | + <option value="10:00-11:00">10:00-11:00</option> | ||
| 57 | + <option value="11:00-12:00">11:00-12:00</option> | ||
| 58 | + <option value="12:00-13:00">12:00-13:00</option> | ||
| 59 | + <option value="13:00-14:00">13:00-14:00</option> | ||
| 60 | + <option value="14:00-15:00">14:00-15:00</option> | ||
| 61 | + <option value="15:00-16:00">15:00-16:00</option> | ||
| 62 | + <option value="16:00-17:00">16:00-17:00</option> | ||
| 63 | + <option value="17:00-18:00">17:00-18:00</option> | ||
| 64 | + <option value="18:00-19:00">18:00-19:00</option> | ||
| 65 | + <option value="19:00-20:00">19:00-20:00</option> | ||
| 66 | + <option value="20:00-21:00">20:00-21:00</option> | ||
| 67 | + <option value="21:00-22:00">21:00-22:00</option> | ||
| 68 | + <option value="22:00-23:00">22:00-23:00</option> | ||
| 69 | + <option value="23:00-00:00">23:00-00:00</option> | ||
| 70 | + </select> | ||
| 71 | + </div> | ||
| 72 | + <div class="form-group"> | ||
| 73 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 74 | +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | ||
| 75 | + </div> | ||
| 76 | + </form> | ||
| 77 | + </div> | ||
| 78 | + <div class="portlet-body"> | ||
| 79 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 80 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 81 | + <thead> | ||
| 82 | + <tr class="hidden"> | ||
| 83 | + <th width="130px">日期</th> | ||
| 84 | + <th width="120px">时段</th> | ||
| 85 | + <th>公司</th> | ||
| 86 | + <th>分公司</th> | ||
| 87 | + <th width="120px">线路</th> | ||
| 88 | + <th width="140px">起讫站</th> | ||
| 89 | + <th width="140px">计划车距(分钟)</th> | ||
| 90 | + <th width="140px">实际车距(分钟)</th> | ||
| 91 | + <th width="100px">误差值</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 | + | ||
| 110 | + // 关闭左侧栏 | ||
| 111 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 112 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 113 | + | ||
| 114 | + $("#startDate").datetimepicker({ | ||
| 115 | + format : 'YYYY-MM-DD', | ||
| 116 | + locale : 'zh-cn' | ||
| 117 | + }); | ||
| 118 | + $("#endDate").datetimepicker({ | ||
| 119 | + format : 'YYYY-MM-DD', | ||
| 120 | + locale : 'zh-cn' | ||
| 121 | + }); | ||
| 122 | + | ||
| 123 | + var d = new Date(); | ||
| 124 | + var year = d.getFullYear(); | ||
| 125 | + var month = d.getMonth() + 1; | ||
| 126 | + var day = d.getDate(); | ||
| 127 | + if(month > 9){ | ||
| 128 | + $("#startDate").val(year + "-" + month + "-" + day); | ||
| 129 | + $("#endDate").val(year + "-" + month + "-" + day); | ||
| 130 | + } else { | ||
| 131 | + $("#startDate").val(year + "-0" + month + "-" + day); | ||
| 132 | + $("#endDate").val(year + "-0" + month + "-" + day); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + $.get('/basic/lineCode2Name',function(result){ | ||
| 136 | + var data=[]; | ||
| 137 | + | ||
| 138 | + for(var code in result){ | ||
| 139 | + data.push({id: code, text: result[code]}); | ||
| 140 | + } | ||
| 141 | + console.log(data); | ||
| 142 | + initPinYinSelect2('#line',data,''); | ||
| 143 | + | ||
| 144 | + line = data[0].id; | ||
| 145 | + updateModel(); | ||
| 146 | + }) | ||
| 147 | + | ||
| 148 | +// $('#line').select2({ | ||
| 149 | +// ajax: { | ||
| 150 | +// url: '/realSchedule/findLine', | ||
| 151 | +// type: 'post', | ||
| 152 | +// dataType: 'json', | ||
| 153 | +// delay: 150, | ||
| 154 | +// data: function(params){ | ||
| 155 | +// return{line: params.term}; | ||
| 156 | +// }, | ||
| 157 | +// processResults: function (data) { | ||
| 158 | +// return { | ||
| 159 | +// results: data | ||
| 160 | +// }; | ||
| 161 | +// }, | ||
| 162 | +// cache: true | ||
| 163 | +// }, | ||
| 164 | +// templateResult: function(repo){ | ||
| 165 | +// if (repo.loading) return repo.text; | ||
| 166 | +// var h = '<span>'+repo.text+'</span>'; | ||
| 167 | +// return h; | ||
| 168 | +// }, | ||
| 169 | +// escapeMarkup: function (markup) { return markup; }, | ||
| 170 | +// minimumInputLength: 1, | ||
| 171 | +// templateSelection: function(repo){ | ||
| 172 | +// return repo.text; | ||
| 173 | +// }, | ||
| 174 | +// language: { | ||
| 175 | +// noResults: function(){ | ||
| 176 | +// return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>'; | ||
| 177 | +// }, | ||
| 178 | +// inputTooShort : function(e) { | ||
| 179 | +// return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>'; | ||
| 180 | +// }, | ||
| 181 | +// searching : function() { | ||
| 182 | +// return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>'; | ||
| 183 | +// } | ||
| 184 | +// } | ||
| 185 | +// }); | ||
| 186 | + | ||
| 187 | + $("#query").on("click",jsDoQuery); | ||
| 188 | + | ||
| 189 | + var line = $("#line").val(); | ||
| 190 | + var startDate = $("#startDate").val(); | ||
| 191 | + var endDate = $("#endDate").val(); | ||
| 192 | + var model = $("#model").val(); | ||
| 193 | + var times = $("#times").val(); | ||
| 194 | + function jsDoQuery(pagination){ | ||
| 195 | + var params = {}; | ||
| 196 | + line = $("#line").val(); | ||
| 197 | + startDate = $("#startDate").val(); | ||
| 198 | + endDate = $("#endDate").val(); | ||
| 199 | + model = $("#model").val(); | ||
| 200 | + times = $("#times").val(); | ||
| 201 | + params['line'] = line; | ||
| 202 | + params['startDate'] = startDate; | ||
| 203 | + params['endDate'] = endDate; | ||
| 204 | + params['model'] = model; | ||
| 205 | + params['times'] = times; | ||
| 206 | + params['type'] = "query"; | ||
| 207 | + $(".hidden").removeClass("hidden"); | ||
| 208 | + $get('/busInterval/interval', params, function(result){ | ||
| 209 | + // 把数据填充到模版中 | ||
| 210 | + var tbodyHtml = template('list_workDaily',{list:result}); | ||
| 211 | + // 把渲染好的模版html文本追加到表格中 | ||
| 212 | + $('#forms tbody').html(tbodyHtml); | ||
| 213 | + | ||
| 214 | + }); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + $("#export").on("click",function(){ | ||
| 218 | + $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ | ||
| 219 | + window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD")); | ||
| 220 | + }); | ||
| 221 | + }); | ||
| 222 | + | ||
| 223 | + | ||
| 224 | + $("#line").on("change", function(){ | ||
| 225 | + line = $("#line").val(); | ||
| 226 | + updateModel(); | ||
| 227 | + }); | ||
| 228 | + $('#startDate').on("blur", function(){ | ||
| 229 | + startDate = $("#startDate").val(); | ||
| 230 | + endDate = $("#endDate").val(); | ||
| 231 | + updateModel(); | ||
| 232 | + }); | ||
| 233 | + $('#endDate').on("blur", function(){ | ||
| 234 | + startDate = $("#startDate").val(); | ||
| 235 | + endDate = $("#endDate").val(); | ||
| 236 | + updateModel(); | ||
| 237 | + }); | ||
| 238 | + | ||
| 239 | + var flag = 0; | ||
| 240 | + function updateModel(){ | ||
| 241 | + if(flag == 1) | ||
| 242 | + return; | ||
| 243 | + flag = 1; | ||
| 244 | + var treeData = []; | ||
| 245 | + var params = {}; | ||
| 246 | + params['line'] = line; | ||
| 247 | + params['startDate'] = startDate; | ||
| 248 | + params['endDate'] = endDate; | ||
| 249 | + $get('/pcpc/getModel', params, function(result){ | ||
| 250 | + treeData = createTreeData(result); | ||
| 251 | + var options = '<option value="">请选择...</option>'; | ||
| 252 | + $.each(treeData, function(i, g){ | ||
| 253 | + options += '<option value="'+g.id+'">'+g.name+'</option>'; | ||
| 254 | + }); | ||
| 255 | + $('#model').html(options)/* .select2() */; | ||
| 256 | + flag = 0; | ||
| 257 | + }); | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + | ||
| 261 | + }); | ||
| 262 | + | ||
| 263 | +</script> | ||
| 264 | +<script type="text/html" id="list_workDaily"> | ||
| 265 | + {{each list as obj i}} | ||
| 266 | + <tr> | ||
| 267 | + <td>{{obj.date}}</td> | ||
| 268 | + <td>{{obj.times}}</td> | ||
| 269 | + <td>{{obj.company}}</td> | ||
| 270 | + <td>{{obj.branchCompany}}</td> | ||
| 271 | + <td>{{obj.line}}</td> | ||
| 272 | + <td>{{obj.qdz}}</td> | ||
| 273 | + <td>{{obj.jhInterval}}</td> | ||
| 274 | + <td>{{obj.sjInterval}}</td> | ||
| 275 | + <td>{{obj.deviation}}</td> | ||
| 276 | + </tr> | ||
| 277 | + {{/each}} | ||
| 278 | + {{if list.length == 0}} | ||
| 279 | + <tr> | ||
| 280 | + <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 281 | + </tr> | ||
| 282 | + {{/if}} | ||
| 283 | +</script> | ||
| 0 | \ No newline at end of file | 284 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/firstAndLastBus.html
| @@ -107,43 +107,14 @@ | @@ -107,43 +107,14 @@ | ||
| 107 | $("#date").val(year + "-0" + month + "-" + day); | 107 | $("#date").val(year + "-0" + month + "-" + day); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | - $('#line').select2({ | ||
| 111 | - ajax: { | ||
| 112 | - url: '/realSchedule/findLine', | ||
| 113 | - type: 'post', | ||
| 114 | - dataType: 'json', | ||
| 115 | - delay: 150, | ||
| 116 | - data: function(params){ | ||
| 117 | - return{line: params.term}; | ||
| 118 | - }, | ||
| 119 | - processResults: function (data) { | ||
| 120 | - return { | ||
| 121 | - results: data | ||
| 122 | - }; | ||
| 123 | - }, | ||
| 124 | - cache: true | ||
| 125 | - }, | ||
| 126 | - templateResult: function(repo){ | ||
| 127 | - if (repo.loading) return repo.text; | ||
| 128 | - var h = '<span>'+repo.text+'</span>'; | ||
| 129 | - return h; | ||
| 130 | - }, | ||
| 131 | - escapeMarkup: function (markup) { return markup; }, | ||
| 132 | - minimumInputLength: 1, | ||
| 133 | - templateSelection: function(repo){ | ||
| 134 | - return repo.text; | ||
| 135 | - }, | ||
| 136 | - language: { | ||
| 137 | - noResults: function(){ | ||
| 138 | - return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>'; | ||
| 139 | - }, | ||
| 140 | - inputTooShort : function(e) { | ||
| 141 | - return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>'; | ||
| 142 | - }, | ||
| 143 | - searching : function() { | ||
| 144 | - return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>'; | ||
| 145 | - } | 110 | + $.get('/basic/lineCode2Name',function(result){ |
| 111 | + var data=[]; | ||
| 112 | + | ||
| 113 | + for(var code in result){ | ||
| 114 | + data.push({id: code, text: result[code]}); | ||
| 146 | } | 115 | } |
| 116 | + console.log(data); | ||
| 117 | + initPinYinSelect2('#line',data,''); | ||
| 147 | }); | 118 | }); |
| 148 | 119 | ||
| 149 | $("#query").on("click",jsDoQuery); | 120 | $("#query").on("click",jsDoQuery); |
src/main/resources/static/pages/forms/statement/lbStatuAnaly.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 | + .table-bordered > thead > tr > th, | ||
| 12 | + .table-bordered > thead > tr > td { | ||
| 13 | + border-bottom-width: 2px; } | ||
| 14 | + .table > tbody + tbody { | ||
| 15 | + border-top: 1px solid; } | ||
| 16 | +</style> | ||
| 17 | + | ||
| 18 | +<div class="page-head"> | ||
| 19 | + <div class="page-title"> | ||
| 20 | + <h1>烂班情况分析表</h1> | ||
| 21 | + </div> | ||
| 22 | +</div> | ||
| 23 | + | ||
| 24 | +<div class="row"> | ||
| 25 | + <div class="col-md-12"> | ||
| 26 | + <div class="portlet light porttlet-fit bordered"> | ||
| 27 | + <div class="portlet-title"> | ||
| 28 | + <form id="history" class="form-inline" action=""> | ||
| 29 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 30 | + <span class="item-label" style="width: 80px;">烂班原因: </span> | ||
| 31 | + <input class="form-control" type="checkbox" id="totalLb" style="width: 20px;" checked="true"/>全选 | ||
| 32 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="0" checked="true"/>路阻 | ||
| 33 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="1" checked="true"/>吊慢 | ||
| 34 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="2" checked="true"/>故障 | ||
| 35 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="3" checked="true"/>纠纷 | ||
| 36 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="4" checked="true"/>肇事 | ||
| 37 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="5" checked="true"/>缺人 | ||
| 38 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="6" checked="true"/>缺车 | ||
| 39 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="7" checked="true"/>客稀 | ||
| 40 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="8" checked="true"/>气候 | ||
| 41 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="9" checked="true"/>外援 | ||
| 42 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="10" checked="true"/>其他 | ||
| 43 | + </div> | ||
| 44 | + <br/> | ||
| 45 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 46 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 47 | + <select class="form-control" name="company" id="company" style="width: 180px;"></select> | ||
| 48 | + </div> | ||
| 49 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 50 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 51 | + <select class="form-control" name="subCompany" id="subCompany" style="width: 180px;"></select> | ||
| 52 | + </div> | ||
| 53 | + <div style="display: inline-block;"> | ||
| 54 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 55 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 56 | + </div> | ||
| 57 | + <div style="display: inline-block;"> | ||
| 58 | + <span class="item-label" style="width: 80px;">时刻类型: </span> | ||
| 59 | + <select class="form-control" name="model" id="model" style="width: 180px;"> | ||
| 60 | + <option value="">请选择...</option> | ||
| 61 | + </select> | ||
| 62 | + </div> | ||
| 63 | + <br/> | ||
| 64 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 65 | + <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 66 | + <input class="form-control" type="text" id="startDate" style="width: 180px;"/> | ||
| 67 | + </div> | ||
| 68 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 69 | + <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 70 | + <input class="form-control" type="text" id="endDate" style="width: 180px;"/> | ||
| 71 | + </div> | ||
| 72 | + <div style="display: inline-block;"> | ||
| 73 | + <span class="item-label" style="width: 80px;">时间段: </span> | ||
| 74 | + <select class="form-control" name="model" id="times" style="width: 180px;"> | ||
| 75 | + <option value="05:00-06:00">05:00-06:00</option> | ||
| 76 | + <option value="06:00-07:00">06:00-07:00</option> | ||
| 77 | + <option value="07:00-08:00">07:00-08:00</option> | ||
| 78 | + <option value="08:00-09:00">08:00-09:00</option> | ||
| 79 | + <option value="09:00-10:00">09:00-10:00</option> | ||
| 80 | + <option value="10:00-11:00">10:00-11:00</option> | ||
| 81 | + <option value="11:00-12:00">11:00-12:00</option> | ||
| 82 | + <option value="12:00-13:00">12:00-13:00</option> | ||
| 83 | + <option value="13:00-14:00">13:00-14:00</option> | ||
| 84 | + <option value="14:00-15:00">14:00-15:00</option> | ||
| 85 | + <option value="15:00-16:00">15:00-16:00</option> | ||
| 86 | + <option value="16:00-17:00">16:00-17:00</option> | ||
| 87 | + <option value="17:00-18:00">17:00-18:00</option> | ||
| 88 | + <option value="18:00-19:00">18:00-19:00</option> | ||
| 89 | + <option value="19:00-20:00">19:00-20:00</option> | ||
| 90 | + <option value="20:00-21:00">20:00-21:00</option> | ||
| 91 | + <option value="21:00-22:00">21:00-22:00</option> | ||
| 92 | + <option value="22:00-23:00">22:00-23:00</option> | ||
| 93 | + <option value="23:00-00:00">23:00-00:00</option> | ||
| 94 | + </select> | ||
| 95 | + </div> | ||
| 96 | + <div class="form-group"> | ||
| 97 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 98 | +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | ||
| 99 | + </div> | ||
| 100 | + </form> | ||
| 101 | + </div> | ||
| 102 | + <div class="portlet-body"> | ||
| 103 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 104 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 105 | + <thead> | ||
| 106 | + | ||
| 107 | + </thead> | ||
| 108 | + <tbody> | ||
| 109 | + | ||
| 110 | + </tbody> | ||
| 111 | + </table> | ||
| 112 | + <div style="text-align: right;"> | ||
| 113 | + <ul id="pagination" class="pagination"></ul> | ||
| 114 | + </div> | ||
| 115 | + </div> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + </div> | ||
| 119 | +</div> | ||
| 120 | + | ||
| 121 | +<script> | ||
| 122 | + $(function(){ | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + // 关闭左侧栏 | ||
| 126 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 127 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 128 | + | ||
| 129 | + $("#startDate").datetimepicker({ | ||
| 130 | + format : 'YYYY-MM-DD', | ||
| 131 | + locale : 'zh-cn' | ||
| 132 | + }); | ||
| 133 | + $("#endDate").datetimepicker({ | ||
| 134 | + format : 'YYYY-MM-DD', | ||
| 135 | + locale : 'zh-cn' | ||
| 136 | + }); | ||
| 137 | + | ||
| 138 | + var d = new Date(); | ||
| 139 | + var year = d.getFullYear(); | ||
| 140 | + var month = d.getMonth() + 1; | ||
| 141 | + var day = d.getDate(); | ||
| 142 | + if(month > 9){ | ||
| 143 | + $("#startDate").val(year + "-" + month + "-" + day); | ||
| 144 | + $("#endDate").val(year + "-" + month + "-" + day); | ||
| 145 | + } else { | ||
| 146 | + $("#startDate").val(year + "-0" + month + "-" + day); | ||
| 147 | + $("#endDate").val(year + "-0" + month + "-" + day); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + $.get('/basic/lineCode2Name', function(result){ | ||
| 151 | + var data=[]; | ||
| 152 | + | ||
| 153 | + for(var code in result){ | ||
| 154 | + data.push({id: code, text: result[code]}); | ||
| 155 | + } | ||
| 156 | +// console.log(data); | ||
| 157 | + initPinYinSelect2('#line',data,''); | ||
| 158 | + | ||
| 159 | + line = data[0].id; | ||
| 160 | + updateModel(); | ||
| 161 | + }) | ||
| 162 | + | ||
| 163 | + var obj = []; | ||
| 164 | + $.get('/user/companyData', function(result){ | ||
| 165 | + obj = result; | ||
| 166 | + var options = ''; | ||
| 167 | + for(var i = 0; i < obj.length; i++){ | ||
| 168 | +// alert(obj[i].children.length); | ||
| 169 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 170 | + } | ||
| 171 | + $('#company').html(options); | ||
| 172 | + updateCompany(); | ||
| 173 | + }); | ||
| 174 | + | ||
| 175 | + $("#company").on("change",updateCompany); | ||
| 176 | + function updateCompany(){ | ||
| 177 | + var company = $('#company').val(); | ||
| 178 | + var options = ''; | ||
| 179 | + for(var i = 0; i < obj.length; i++){ | ||
| 180 | + if(obj[i].companyCode == company){ | ||
| 181 | + var children = obj[i].children; | ||
| 182 | + for(var j = 0; j < children.length; j++){ | ||
| 183 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + $('#subCompany').html(options); | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + var lb = 0; //标志是否有选择至少一个烂班类型 | ||
| 191 | + $("#totalLb").on("change", function(){ | ||
| 192 | + var reason = $("input[name='reason']"); | ||
| 193 | + var checked = this.checked; | ||
| 194 | + $.each(reason, function(i, g){ | ||
| 195 | + g.checked = checked; | ||
| 196 | + }); | ||
| 197 | + if(checked == true) | ||
| 198 | + lb = 30; | ||
| 199 | + else | ||
| 200 | + lb = 0; | ||
| 201 | + }); | ||
| 202 | + | ||
| 203 | + $("input[name='reason']").on("change", function(){ | ||
| 204 | + var totalLb = $("#totalLb")[0]; | ||
| 205 | + totalLb.checked = true; | ||
| 206 | + lb = 0; | ||
| 207 | + $.each($("input[name='reason']"), function(i, g){ | ||
| 208 | + if(g.checked == false){ | ||
| 209 | + totalLb.checked = false; | ||
| 210 | + }else{ | ||
| 211 | + lb += 3; | ||
| 212 | + } | ||
| 213 | + }); | ||
| 214 | + }); | ||
| 215 | + | ||
| 216 | + $("#query").on("click",jsDoQuery); | ||
| 217 | + | ||
| 218 | + var line = $("#line").val(); | ||
| 219 | + var startDate = $("#startDate").val(); | ||
| 220 | + var endDate = $("#endDate").val(); | ||
| 221 | + var model = $("#model").val(); | ||
| 222 | + var times = $("#times").val(); | ||
| 223 | + function jsDoQuery(pagination){ | ||
| 224 | + var reason = $("input[name='reason']"); | ||
| 225 | + var params = {}; | ||
| 226 | + line = $("#line").val(); | ||
| 227 | + startDate = $("#startDate").val(); | ||
| 228 | + endDate = $("#endDate").val(); | ||
| 229 | + model = $("#model").val(); | ||
| 230 | + times = $("#times").val(); | ||
| 231 | + params['line'] = line; | ||
| 232 | + params['startDate'] = startDate; | ||
| 233 | + params['endDate'] = endDate; | ||
| 234 | + params['model'] = model; | ||
| 235 | + params['times'] = times; | ||
| 236 | + params['type'] = "query"; | ||
| 237 | +// $(".hidden").removeClass("hidden"); | ||
| 238 | + $get('/busInterval/lbStatuAnaly', params, function(result){ | ||
| 239 | + // 把数据填充到模版中 | ||
| 240 | + var tbodyHtml = template('list_lbAnaly',{list:result, reason:reason, lb:lb}); | ||
| 241 | + // 把渲染好的模版html文本追加到表格中 | ||
| 242 | + $('#forms').html(tbodyHtml); | ||
| 243 | + }); | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + $("#export").on("click", function(){ | ||
| 247 | + $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ | ||
| 248 | + window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD")); | ||
| 249 | + }); | ||
| 250 | + }); | ||
| 251 | + | ||
| 252 | + | ||
| 253 | + $("#line").on("change", function(){ | ||
| 254 | + line = $("#line").val(); | ||
| 255 | + updateModel(); | ||
| 256 | + }); | ||
| 257 | + $('#startDate').on("blur", function(){ | ||
| 258 | + startDate = $("#startDate").val(); | ||
| 259 | + endDate = $("#endDate").val(); | ||
| 260 | + updateModel(); | ||
| 261 | + }); | ||
| 262 | + $('#endDate').on("blur", function(){ | ||
| 263 | + startDate = $("#startDate").val(); | ||
| 264 | + endDate = $("#endDate").val(); | ||
| 265 | + updateModel(); | ||
| 266 | + }); | ||
| 267 | + | ||
| 268 | + var flag = 0; | ||
| 269 | + function updateModel(){ | ||
| 270 | + if(flag == 1) | ||
| 271 | + return; | ||
| 272 | + flag = 1; | ||
| 273 | + var treeData = []; | ||
| 274 | + var params = {}; | ||
| 275 | + params['line'] = line; | ||
| 276 | + params['startDate'] = startDate; | ||
| 277 | + params['endDate'] = endDate; | ||
| 278 | + $get('/pcpc/getModel', params, function(result){ | ||
| 279 | + treeData = createTreeData(result); | ||
| 280 | + var options = '<option value="">请选择...</option>'; | ||
| 281 | + $.each(treeData, function(i, g){ | ||
| 282 | + options += '<option value="'+g.id+'">'+g.name+'</option>'; | ||
| 283 | + }); | ||
| 284 | + $('#model').html(options)/* .select2() */; | ||
| 285 | + flag = 0; | ||
| 286 | + }); | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + | ||
| 290 | + }); | ||
| 291 | + | ||
| 292 | +</script> | ||
| 293 | +<script type="text/html" id="list_lbAnaly"> | ||
| 294 | +<thead> | ||
| 295 | + <tr> | ||
| 296 | + <th class="hidden"></th> | ||
| 297 | + <th rowspan="3">日期</th> | ||
| 298 | + <th rowspan="3">时段</th> | ||
| 299 | + <th rowspan="3">公司</th> | ||
| 300 | + <th rowspan="3">分公司</th> | ||
| 301 | + <th rowspan="3">线路</th> | ||
| 302 | + <th rowspan="2" colspan="3">总班次</th> | ||
| 303 | + <th rowspan="2" colspan="3">总营运公里</th> | ||
| 304 | + {{if lb != 0}} | ||
| 305 | + <th colspan={{lb}}>烂班原因</th> | ||
| 306 | + {{/if}} | ||
| 307 | + </tr> | ||
| 308 | + <tr> | ||
| 309 | + <th class="hidden"></th> | ||
| 310 | + {{if reason[0].checked == true}}<th colspan="3">路阻</th>{{/if}} | ||
| 311 | + {{if reason[1].checked == true}}<th colspan="3">吊慢</th>{{/if}} | ||
| 312 | + {{if reason[2].checked == true}}<th colspan="3">故障</th>{{/if}} | ||
| 313 | + {{if reason[3].checked == true}}<th colspan="3">纠纷</th>{{/if}} | ||
| 314 | + {{if reason[4].checked == true}}<th colspan="3">肇事</th>{{/if}} | ||
| 315 | + {{if reason[5].checked == true}}<th colspan="3">缺人</th>{{/if}} | ||
| 316 | + {{if reason[6].checked == true}}<th colspan="3">缺车</th>{{/if}} | ||
| 317 | + {{if reason[7].checked == true}}<th colspan="3">客稀</th>{{/if}} | ||
| 318 | + {{if reason[8].checked == true}}<th colspan="3">气候</th>{{/if}} | ||
| 319 | + {{if reason[9].checked == true}}<th colspan="3">外援</th>{{/if}} | ||
| 320 | + {{if reason[10].checked == true}}<th colspan="3">其他</th>{{/if}} | ||
| 321 | + </tr> | ||
| 322 | + <tr> | ||
| 323 | + <th class="hidden"></th> | ||
| 324 | + <th>计划</th><th>实际</th><th>百分比</th> | ||
| 325 | + <th>计划</th><th>实际</th><th>百分比</th> | ||
| 326 | + {{if reason[0].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 327 | + {{if reason[1].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 328 | + {{if reason[2].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 329 | + {{if reason[3].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 330 | + {{if reason[4].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 331 | + {{if reason[5].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 332 | + {{if reason[6].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 333 | + {{if reason[7].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 334 | + {{if reason[8].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 335 | + {{if reason[9].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 336 | + {{if reason[10].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | ||
| 337 | + </tr> | ||
| 338 | +</thead> | ||
| 339 | +<tbody> | ||
| 340 | + {{each list as obj i}} | ||
| 341 | + <tr> | ||
| 342 | + <td>{{obj.date}}</td> | ||
| 343 | + <td>{{obj.times}}</td> | ||
| 344 | + <td>{{obj.company}}</td> | ||
| 345 | + <td>{{obj.subCompany}}</td> | ||
| 346 | + <td>{{obj.line}}</td> | ||
| 347 | + <td>{{obj.jhbc}}</td><td>{{obj.sjbc}}</td><td>{{obj.bcbfb}}</td> | ||
| 348 | + <td>{{obj.jhlc}}</td><td>{{obj.sjlc}}</td><td>{{obj.lcbfb}}</td> | ||
| 349 | + {{if reason[0].checked==true}}<td>{{obj.lzbc}}</td><td>{{obj.lzlc}}</td><td>{{obj.lzbfb}}</td>{{/if}} | ||
| 350 | + {{if reason[1].checked==true}}<td>{{obj.dmbc}}</td><td>{{obj.dmlc}}</td><td>{{obj.dmbfb}}</td>{{/if}} | ||
| 351 | + {{if reason[2].checked==true}}<td>{{obj.gzbc}}</td><td>{{obj.gzlc}}</td><td>{{obj.gzbfb}}</td>{{/if}} | ||
| 352 | + {{if reason[3].checked==true}}<td>{{obj.jfbc}}</td><td>{{obj.jflc}}</td><td>{{obj.jfbfb}}</td>{{/if}} | ||
| 353 | + {{if reason[4].checked==true}}<td>{{obj.zsbc}}</td><td>{{obj.zslc}}</td><td>{{obj.zsbfb}}</td>{{/if}} | ||
| 354 | + {{if reason[5].checked==true}}<td>{{obj.qrbc}}</td><td>{{obj.qrlc}}</td><td>{{obj.qrbfb}}</td>{{/if}} | ||
| 355 | + {{if reason[6].checked==true}}<td>{{obj.qcbc}}</td><td>{{obj.qclc}}</td><td>{{obj.qcbfb}}</td>{{/if}} | ||
| 356 | + {{if reason[7].checked==true}}<td>{{obj.kxbc}}</td><td>{{obj.kxlc}}</td><td>{{obj.kxbfb}}</td>{{/if}} | ||
| 357 | + {{if reason[8].checked==true}}<td>{{obj.qhbc}}</td><td>{{obj.qhlc}}</td><td>{{obj.qhbfb}}</td>{{/if}} | ||
| 358 | + {{if reason[9].checked==true}}<td>{{obj.wybc}}</td><td>{{obj.wylc}}</td><td>{{obj.wybfb}}</td>{{/if}} | ||
| 359 | + {{if reason[10].checked==true}}<td>{{obj.qtbc}}</td><td>{{obj.qtlc}}</td><td>{{obj.qtbfb}}</td>{{/if}} | ||
| 360 | + </tr> | ||
| 361 | + {{/each}} | ||
| 362 | + {{if list.length == 0}} | ||
| 363 | + <tr> | ||
| 364 | + <td colspan="41"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 365 | + </tr> | ||
| 366 | + {{/if}} | ||
| 367 | +</tbody> | ||
| 368 | +</script> | ||
| 0 | \ No newline at end of file | 369 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/lineTimeAnaly.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 | + .table-bordered > thead > tr > th, | ||
| 12 | + .table-bordered > thead > tr > td { | ||
| 13 | + border-bottom-width: 2px; } | ||
| 14 | + .table > tbody + tbody { | ||
| 15 | + border-top: 1px solid; } | ||
| 16 | + .merge{ | ||
| 17 | + text-align:center; | ||
| 18 | + vertical-align:middle; | ||
| 19 | + } | ||
| 20 | + #works > tbody > tr{ | ||
| 21 | + background-color: #FFFFFF; | ||
| 22 | + } | ||
| 23 | +</style> | ||
| 24 | + | ||
| 25 | +<div class="page-head"> | ||
| 26 | + <div class="page-title"> | ||
| 27 | + <h1>线路时刻分析</h1> | ||
| 28 | + </div> | ||
| 29 | +</div> | ||
| 30 | + | ||
| 31 | +<div class="row"> | ||
| 32 | + <div class="col-md-12"> | ||
| 33 | + <div class="portlet light porttlet-fit bordered"> | ||
| 34 | + <div class="portlet-title"> | ||
| 35 | + <form id="history" class="form-inline" action=""> | ||
| 36 | + <div style="display: inline-block;"> | ||
| 37 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 38 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 39 | + </div> | ||
| 40 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 41 | + <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 42 | + <input class="form-control" type="text" id="startDate" style="width: 180px;"/> | ||
| 43 | + </div> | ||
| 44 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 45 | + <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 46 | + <input class="form-control" type="text" id="endDate" style="width: 180px;"/> | ||
| 47 | + </div> | ||
| 48 | + <br/> | ||
| 49 | + <div style="display: inline-block;"> | ||
| 50 | + <span class="item-label" style="width: 80px;">时刻类型: </span> | ||
| 51 | + <select class="form-control" name="model" id="model" style="width: 180px;"> | ||
| 52 | + <option value="">请选择...</option> | ||
| 53 | + </select> | ||
| 54 | + </div> | ||
| 55 | + <div style="display: inline-block;"> | ||
| 56 | + <span class="item-label" style="width: 80px;">时间段: </span> | ||
| 57 | + <select class="form-control" name="times" id="times" style="width: 180px;"> | ||
| 58 | + <option value="05:00-06:00">05:00-06:00</option> | ||
| 59 | + <option value="06:00-07:00">06:00-07:00</option> | ||
| 60 | + <option value="07:00-08:00">07:00-08:00</option> | ||
| 61 | + <option value="08:00-09:00">08:00-09:00</option> | ||
| 62 | + <option value="09:00-10:00">09:00-10:00</option> | ||
| 63 | + <option value="10:00-11:00">10:00-11:00</option> | ||
| 64 | + <option value="11:00-12:00">11:00-12:00</option> | ||
| 65 | + <option value="12:00-13:00">12:00-13:00</option> | ||
| 66 | + <option value="13:00-14:00">13:00-14:00</option> | ||
| 67 | + <option value="14:00-15:00">14:00-15:00</option> | ||
| 68 | + <option value="15:00-16:00">15:00-16:00</option> | ||
| 69 | + <option value="16:00-17:00">16:00-17:00</option> | ||
| 70 | + <option value="17:00-18:00">17:00-18:00</option> | ||
| 71 | + <option value="18:00-19:00">18:00-19:00</option> | ||
| 72 | + <option value="19:00-20:00">19:00-20:00</option> | ||
| 73 | + <option value="20:00-21:00">20:00-21:00</option> | ||
| 74 | + <option value="21:00-22:00">21:00-22:00</option> | ||
| 75 | + <option value="22:00-23:00">22:00-23:00</option> | ||
| 76 | + <option value="23:00-00:00">23:00-00:00</option> | ||
| 77 | + </select> | ||
| 78 | + </div> | ||
| 79 | + <div style="display: inline-block;"> | ||
| 80 | + <span class="item-label" style="width: 80px;">方向: </span> | ||
| 81 | + <select class="form-control" name="upDown" id="upDown" style="width: 180px;"> | ||
| 82 | + <option value="">请先选择线路</option> | ||
| 83 | + </select> | ||
| 84 | + </div> | ||
| 85 | + <div class="form-group"> | ||
| 86 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 87 | +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | ||
| 88 | + </div> | ||
| 89 | + </form> | ||
| 90 | + </div> | ||
| 91 | + <div class="portlet-body"> | ||
| 92 | + <div class="row"> | ||
| 93 | + <div class="col-md-3"> | ||
| 94 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 320px;"> | ||
| 95 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 96 | + <thead> | ||
| 97 | + <tr class="hidden"> | ||
| 98 | + <th>公司</th> | ||
| 99 | + <th>日期分段</th> | ||
| 100 | + <th>时段</th> | ||
| 101 | + <th>线路</th> | ||
| 102 | + <th>路牌</th> | ||
| 103 | + <th>站点</th> | ||
| 104 | + <th>计划发车班次数</th> | ||
| 105 | + <th>实际完成班次数</th> | ||
| 106 | + </tr> | ||
| 107 | + </thead> | ||
| 108 | + <tbody> | ||
| 109 | + | ||
| 110 | + </tbody> | ||
| 111 | + </table> | ||
| 112 | + </div> | ||
| 113 | + </div> | ||
| 114 | + <div id="works_hidden" class="hidden"> | ||
| 115 | + <span class="item-label" style="width: 80px;margin-left: 60px;">明细: </span> | ||
| 116 | + <span class="item-label" style="width: 80px;margin-left: 60px;">日期: </span> | ||
| 117 | + <span class="item-label" style="width: 80px;" id="date1"></span> | ||
| 118 | + <span class="item-label" style="width: 80px;margin-left: 60px;">线路: </span> | ||
| 119 | + <span class="item-label" style="width: 80px;" id="line1"></span> | ||
| 120 | + <span class="item-label" style="width: 80px;margin-left: 60px;">路牌: </span> | ||
| 121 | + <span class="item-label" style="width: 80px;" id="lp1"></span> | ||
| 122 | + <span class="item-label" style="width: 80px;margin-left: 60px;">站点: </span> | ||
| 123 | + <span class="item-label" style="width: 80px;" id="station1"></span> | ||
| 124 | + </div> | ||
| 125 | + <div class="col-md-9" id="printArea"> | ||
| 126 | + <table class="table table-bordered table-hover table-checkable" id="works"> | ||
| 127 | + <thead> | ||
| 128 | + <tr class="hidden"> | ||
| 129 | + <th rowspan="2">日期</th> | ||
| 130 | + <th colspan="4">到达时间</th> | ||
| 131 | + <th colspan="4">发车时间</th> | ||
| 132 | + <th colspan="2">误点率</th> | ||
| 133 | + <th colspan="5">运送时间</th> | ||
| 134 | + <th colspan="5">停站时间</th> | ||
| 135 | + </tr> | ||
| 136 | + <tr class="hidden"> | ||
| 137 | + <th width="50px">计划</th> | ||
| 138 | + <th width="50px">实际</th> | ||
| 139 | + <th width="50px">平均提前</th> | ||
| 140 | + <th width="50px">平均延误</th> | ||
| 141 | + <th width="50px">计划</th> | ||
| 142 | + <th width="50px">实际</th> | ||
| 143 | + <th width="50px">平均提前</th> | ||
| 144 | + <th width="50px">平均延误</th> | ||
| 145 | + <th>快</th> | ||
| 146 | + <th>慢</th> | ||
| 147 | + <th>计划</th> | ||
| 148 | + <th>实际</th> | ||
| 149 | + <th>最快</th> | ||
| 150 | + <th>最慢</th> | ||
| 151 | + <th>平均</th> | ||
| 152 | + <th>计划</th> | ||
| 153 | + <th>实际</th> | ||
| 154 | + <th>最大</th> | ||
| 155 | + <th>最小</th> | ||
| 156 | + <th>平均</th> | ||
| 157 | + </tr> | ||
| 158 | + </thead> | ||
| 159 | + <tbody> | ||
| 160 | + | ||
| 161 | + </tbody> | ||
| 162 | + </table> | ||
| 163 | + </div> | ||
| 164 | + <div style="text-align: right;"> | ||
| 165 | + <ul id="pagination" class="pagination"></ul> | ||
| 166 | + </div> | ||
| 167 | + </div> | ||
| 168 | + </div> | ||
| 169 | + </div> | ||
| 170 | + </div> | ||
| 171 | +</div> | ||
| 172 | + | ||
| 173 | +<script> | ||
| 174 | + $(function(){ | ||
| 175 | + var list; | ||
| 176 | + | ||
| 177 | + // 关闭左侧栏 | ||
| 178 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 179 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 180 | + | ||
| 181 | + $("#startDate").datetimepicker({ | ||
| 182 | + format : 'YYYY-MM-DD', | ||
| 183 | + locale : 'zh-cn' | ||
| 184 | + }); | ||
| 185 | + $("#endDate").datetimepicker({ | ||
| 186 | + format : 'YYYY-MM-DD', | ||
| 187 | + locale : 'zh-cn' | ||
| 188 | + }); | ||
| 189 | + | ||
| 190 | + var d = new Date(); | ||
| 191 | + var year = d.getFullYear(); | ||
| 192 | + var month = d.getMonth() + 1; | ||
| 193 | + var day = d.getDate(); | ||
| 194 | + if(month > 9){ | ||
| 195 | + $("#startDate").val(year + "-" + month + "-" + day); | ||
| 196 | + $("#endDate").val(year + "-" + month + "-" + day); | ||
| 197 | + } else { | ||
| 198 | + $("#startDate").val(year + "-0" + month + "-" + day); | ||
| 199 | + $("#endDate").val(year + "-0" + month + "-" + day); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + $.get('/basic/lineCode2Name',function(result){ | ||
| 203 | + var data=[]; | ||
| 204 | + | ||
| 205 | + for(var code in result){ | ||
| 206 | + data.push({id: code, text: result[code]}); | ||
| 207 | + } | ||
| 208 | + console.log(data); | ||
| 209 | + initPinYinSelect2('#line',data,''); | ||
| 210 | + | ||
| 211 | + line = data[0].id; | ||
| 212 | + updateModel(); | ||
| 213 | + }) | ||
| 214 | + | ||
| 215 | + $("#query").on("click", function (){ | ||
| 216 | + line = $("#line").val(); | ||
| 217 | + upDown = $("#upDown").val(); | ||
| 218 | + if(line=="" || line==null){ | ||
| 219 | + layer.msg("请选择线路"); | ||
| 220 | + }else if(upDown==null || upDown==""){ | ||
| 221 | + layer.msg("请选择方向"); | ||
| 222 | + }else{ | ||
| 223 | + jsDoQuery(); | ||
| 224 | + } | ||
| 225 | + }); | ||
| 226 | + | ||
| 227 | + var line = $("#line").val(); | ||
| 228 | + var startDate = $("#startDate").val(); | ||
| 229 | + var endDate = $("#endDate").val(); | ||
| 230 | + var model = $("#model").val(); | ||
| 231 | + var times = $("#times").val(); | ||
| 232 | + var upDown = $("#upDown").val(); | ||
| 233 | + function jsDoQuery(pagination){ | ||
| 234 | + var params = {}; | ||
| 235 | + line = $("#line").val(); | ||
| 236 | + startDate = $("#startDate").val(); | ||
| 237 | + endDate = $("#endDate").val(); | ||
| 238 | + model = $("#model").val(); | ||
| 239 | + times = $("#times").val(); | ||
| 240 | + upDown = $("#upDown").val(); | ||
| 241 | + params['line'] = line; | ||
| 242 | + params['startDate'] = startDate; | ||
| 243 | + params['endDate'] = endDate; | ||
| 244 | + params['model'] = model; | ||
| 245 | + params['times'] = times; | ||
| 246 | + params['upDown'] = upDown; | ||
| 247 | + params['type'] = "query"; | ||
| 248 | + $("#forms .hidden").removeClass("hidden"); | ||
| 249 | + $get('/busInterval/lineTimeAnaliy', params, function(result){ | ||
| 250 | + // 把数据填充到模版中 | ||
| 251 | + var tbodyHtml = template('list_lineTimeAnaly',{list:result}); | ||
| 252 | + // 把渲染好的模版html文本追加到表格中 | ||
| 253 | + $('#forms tbody').html(tbodyHtml); | ||
| 254 | + | ||
| 255 | + list = result; | ||
| 256 | + }); | ||
| 257 | + | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + $("#forms tbody").on("click","tr",function(){ | ||
| 261 | + if($(this).children().size() < 2){ | ||
| 262 | + return; | ||
| 263 | + } | ||
| 264 | + var params = {}; | ||
| 265 | + $(this).children().each(function(index){ | ||
| 266 | + if(index != 0){ | ||
| 267 | + params[index] = $(this).text(); | ||
| 268 | + } | ||
| 269 | + }); | ||
| 270 | + $.each(list, function(i, g){ | ||
| 271 | + if(g.line == params[3] && g.lp == params[4]){ | ||
| 272 | + var tbodyHtml = template('list_workList',{list:g}); | ||
| 273 | + $('#works tbody').html(tbodyHtml); | ||
| 274 | + $("#works_hidden").removeClass("hidden"); | ||
| 275 | + $("#works .hidden").removeClass("hidden"); | ||
| 276 | + $("#date1").html(g.dates); | ||
| 277 | + $("#line1").html(g.line); | ||
| 278 | + $("#lp1").html(g.lp); | ||
| 279 | + $("#station1").html(g.station); | ||
| 280 | + } | ||
| 281 | + }); | ||
| 282 | + }); | ||
| 283 | + | ||
| 284 | + | ||
| 285 | +// $("#export").on("click",function(){ | ||
| 286 | +// $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ | ||
| 287 | +// window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD")); | ||
| 288 | +// }); | ||
| 289 | +// }); | ||
| 290 | + | ||
| 291 | + | ||
| 292 | + $("#line").on("change", function(){ | ||
| 293 | + line = $("#line").val(); | ||
| 294 | + updateModel(); | ||
| 295 | + var params = {}; | ||
| 296 | + params['line'] = line; | ||
| 297 | + $get('/busInterval/getDir', params, function(result){ | ||
| 298 | + dirData = createTreeData(result); | ||
| 299 | + var options = ''; | ||
| 300 | + $.each(dirData, function(i, g){ | ||
| 301 | + options += '<option value="'+g.name+'">'+g.name+'</option>'; | ||
| 302 | + }); | ||
| 303 | + $('#upDown').html(options); | ||
| 304 | + }); | ||
| 305 | + }); | ||
| 306 | + $('#startDate').on("blur", function(){ | ||
| 307 | + startDate = $("#startDate").val(); | ||
| 308 | + endDate = $("#endDate").val(); | ||
| 309 | + updateModel(); | ||
| 310 | + }); | ||
| 311 | + $('#endDate').on("blur", function(){ | ||
| 312 | + startDate = $("#startDate").val(); | ||
| 313 | + endDate = $("#endDate").val(); | ||
| 314 | + updateModel(); | ||
| 315 | + }); | ||
| 316 | + | ||
| 317 | + var flag = 0; | ||
| 318 | + function updateModel(){ | ||
| 319 | + if(flag == 1) | ||
| 320 | + return; | ||
| 321 | + flag = 1; | ||
| 322 | + var treeData = []; | ||
| 323 | + var params = {}; | ||
| 324 | + params['line'] = line; | ||
| 325 | + params['startDate'] = startDate; | ||
| 326 | + params['endDate'] = endDate; | ||
| 327 | + $get('/pcpc/getModel', params, function(result){ | ||
| 328 | + treeData = createTreeData(result); | ||
| 329 | + var options = '<option value="">请选择...</option>'; | ||
| 330 | + $.each(treeData, function(i, g){ | ||
| 331 | + options += '<option value="'+g.id+'">'+g.name+'</option>'; | ||
| 332 | + }); | ||
| 333 | + $('#model').html(options)/* .select2() */; | ||
| 334 | + flag = 0; | ||
| 335 | + }); | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + | ||
| 339 | + }); | ||
| 340 | + | ||
| 341 | +</script> | ||
| 342 | +<script type="text/html" id="list_lineTimeAnaly"> | ||
| 343 | + {{each list as obj i}} | ||
| 344 | + <tr> | ||
| 345 | + <td>{{obj.company}}</td> | ||
| 346 | + <td>{{obj.dates}}</td> | ||
| 347 | + <td>{{obj.times}}</td> | ||
| 348 | + <td>{{obj.line}}</td> | ||
| 349 | + <td>{{obj.lp}}</td> | ||
| 350 | + <td>{{obj.station}}</td> | ||
| 351 | + <td>{{obj.jhbc}}</td> | ||
| 352 | + <td>{{obj.sjbc}}</td> | ||
| 353 | + </tr> | ||
| 354 | + {{/each}} | ||
| 355 | + {{if list.length == 0}} | ||
| 356 | + <tr> | ||
| 357 | + <td colspan="8"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 358 | + </tr> | ||
| 359 | + {{/if}} | ||
| 360 | +</script> | ||
| 361 | +<script type="text/html" id="list_workList"> | ||
| 362 | + {{each list.workList as obj i}} | ||
| 363 | + <tr> | ||
| 364 | + <td>{{obj.date}}</td> | ||
| 365 | + <td>{{obj.jhdf}}</td> | ||
| 366 | + <td>{{obj.sjdf}}</td> | ||
| 367 | + {{if i == 0}} | ||
| 368 | + <td rowspan="{{list.workList.length}}" class="merge">{{list.wddf1}}</td> | ||
| 369 | + <td rowspan="{{list.workList.length}}" class="merge">{{list.wddf2}}</td> | ||
| 370 | + {{/if}} | ||
| 371 | + <td>{{obj.jhfc}}</td> | ||
| 372 | + <td>{{obj.sjfc}}</td> | ||
| 373 | + {{if i == 0}} | ||
| 374 | + <td rowspan="{{list.workList.length}}" class="merge">{{list.wdfc1}}</td> | ||
| 375 | + <td rowspan="{{list.workList.length}}" class="merge">{{list.wdfc2}}</td> | ||
| 376 | + {{/if}} | ||
| 377 | + <td>{{obj.kbc}}</td> | ||
| 378 | + <td>{{obj.mbc}}</td> | ||
| 379 | + <td>{{obj.jhys}}</td> | ||
| 380 | + <td>{{obj.sjys}}</td> | ||
| 381 | + <td>{{obj.yssjMin}}</td> | ||
| 382 | + <td>{{obj.yssjMax}}</td> | ||
| 383 | + {{if i == 0}} | ||
| 384 | + <td rowspan="{{list.workList.length}}" class="merge">{{list.pjys}}</td> | ||
| 385 | + {{/if}} | ||
| 386 | + <td>{{obj.jhtz}}</td> | ||
| 387 | + <td>{{obj.sjtz}}</td> | ||
| 388 | + <td>{{obj.tzsjMax}}</td> | ||
| 389 | + <td>{{obj.tzsjMin}}</td> | ||
| 390 | + {{if i == 0}} | ||
| 391 | + <td rowspan="{{list.workList.length}}" class="merge">{{list.pjtz}}</td> | ||
| 392 | + {{/if}} | ||
| 393 | + </tr> | ||
| 394 | + {{/each}} | ||
| 395 | + {{if list.length == 0}} | ||
| 396 | + <tr> | ||
| 397 | + <td colspan="21"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 398 | + </tr> | ||
| 399 | + {{/if}} | ||
| 400 | +</script> | ||
| 0 | \ No newline at end of file | 401 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/scheduleAnaly.html
| @@ -121,7 +121,10 @@ | @@ -121,7 +121,10 @@ | ||
| 121 | } | 121 | } |
| 122 | console.log(data); | 122 | console.log(data); |
| 123 | initPinYinSelect2('#line',data,''); | 123 | initPinYinSelect2('#line',data,''); |
| 124 | - }) | 124 | + |
| 125 | + line = data[0].id; | ||
| 126 | + updateModel(); | ||
| 127 | + }); | ||
| 125 | 128 | ||
| 126 | $("#query").on("click", function(){ | 129 | $("#query").on("click", function(){ |
| 127 | page = 0; | 130 | page = 0; |
| @@ -203,7 +206,6 @@ | @@ -203,7 +206,6 @@ | ||
| 203 | flag = 0; | 206 | flag = 0; |
| 204 | }); | 207 | }); |
| 205 | } | 208 | } |
| 206 | - updateModel(); | ||
| 207 | 209 | ||
| 208 | 210 | ||
| 209 | function showPagination(data){ | 211 | function showPagination(data){ |
src/main/resources/static/pages/forms/statement/timeAndSpeed.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 | + .table-bordered > thead > tr > th, | ||
| 12 | + .table-bordered > thead > tr > td { | ||
| 13 | + border-bottom-width: 2px; } | ||
| 14 | + .table > tbody + tbody { | ||
| 15 | + border-top: 1px solid; } | ||
| 16 | +</style> | ||
| 17 | + | ||
| 18 | +<div class="page-head"> | ||
| 19 | + <div class="page-title"> | ||
| 20 | + <h1>行驶时间及车速统计表</h1> | ||
| 21 | + </div> | ||
| 22 | +</div> | ||
| 23 | + | ||
| 24 | +<div class="row"> | ||
| 25 | + <div class="col-md-12"> | ||
| 26 | + <div class="portlet light porttlet-fit bordered"> | ||
| 27 | + <div class="portlet-title"> | ||
| 28 | + <form id="history" class="form-inline" action=""> | ||
| 29 | + <div style="display: inline-block;"> | ||
| 30 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 31 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 32 | + </div> | ||
| 33 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 34 | + <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 35 | + <input class="form-control" type="text" id="startDate" style="width: 180px;"/> | ||
| 36 | + </div> | ||
| 37 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 38 | + <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 39 | + <input class="form-control" type="text" id="endDate" style="width: 180px;"/> | ||
| 40 | + </div> | ||
| 41 | + <br/> | ||
| 42 | + <div style="display: inline-block;"> | ||
| 43 | + <span class="item-label" style="width: 80px;">时刻类型: </span> | ||
| 44 | + <select class="form-control" name="model" id="model" style="width: 180px;"> | ||
| 45 | + <option value="">请选择...</option> | ||
| 46 | + </select> | ||
| 47 | + </div> | ||
| 48 | + <div style="display: inline-block;"> | ||
| 49 | + <span class="item-label" style="width: 80px;">时间段: </span> | ||
| 50 | + <select class="form-control" name="times" id="times" style="width: 180px;"> | ||
| 51 | + <option value="05:00-06:00">05:00-06:00</option> | ||
| 52 | + <option value="06:00-07:00">06:00-07:00</option> | ||
| 53 | + <option value="07:00-08:00">07:00-08:00</option> | ||
| 54 | + <option value="08:00-09:00">08:00-09:00</option> | ||
| 55 | + <option value="09:00-10:00">09:00-10:00</option> | ||
| 56 | + <option value="10:00-11:00">10:00-11:00</option> | ||
| 57 | + <option value="11:00-12:00">11:00-12:00</option> | ||
| 58 | + <option value="12:00-13:00">12:00-13:00</option> | ||
| 59 | + <option value="13:00-14:00">13:00-14:00</option> | ||
| 60 | + <option value="14:00-15:00">14:00-15:00</option> | ||
| 61 | + <option value="15:00-16:00">15:00-16:00</option> | ||
| 62 | + <option value="16:00-17:00">16:00-17:00</option> | ||
| 63 | + <option value="17:00-18:00">17:00-18:00</option> | ||
| 64 | + <option value="18:00-19:00">18:00-19:00</option> | ||
| 65 | + <option value="19:00-20:00">19:00-20:00</option> | ||
| 66 | + <option value="20:00-21:00">20:00-21:00</option> | ||
| 67 | + <option value="21:00-22:00">21:00-22:00</option> | ||
| 68 | + <option value="22:00-23:00">22:00-23:00</option> | ||
| 69 | + <option value="23:00-00:00">23:00-00:00</option> | ||
| 70 | + </select> | ||
| 71 | + </div> | ||
| 72 | + <div style="display: inline-block;"> | ||
| 73 | + <span class="item-label" style="width: 80px;">方向: </span> | ||
| 74 | + <select class="form-control" name="upDown" id="upDown" style="width: 180px;"> | ||
| 75 | + <option value="">请先选择线路</option> | ||
| 76 | + </select> | ||
| 77 | + </div> | ||
| 78 | + <div class="form-group"> | ||
| 79 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 80 | +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | ||
| 81 | + </div> | ||
| 82 | + </form> | ||
| 83 | + </div> | ||
| 84 | + <div class="portlet-body"> | ||
| 85 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 86 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 87 | + <thead> | ||
| 88 | + <tr class="hidden"> | ||
| 89 | + <th width="130px">日期</th> | ||
| 90 | + <th width="105px">时段</th> | ||
| 91 | + <th>公司</th> | ||
| 92 | + <th>分公司</th> | ||
| 93 | + <th width="100px">线路</th> | ||
| 94 | + <th width="50px">路牌</th> | ||
| 95 | + <th width="110px">起讫站</th> | ||
| 96 | + <th width="110px">行驶方向</th> | ||
| 97 | + <th width="103px">营运时间(小时/分钟)</th> | ||
| 98 | + <th width="130px">营运车速(公里/小时)</th> | ||
| 99 | + <th width="103px">运送时间(小时/分钟)</th> | ||
| 100 | + <th width="130px">运送车速(公里/小时)</th> | ||
| 101 | + </tr> | ||
| 102 | + </thead> | ||
| 103 | + <tbody> | ||
| 104 | + | ||
| 105 | + </tbody> | ||
| 106 | + </table> | ||
| 107 | + <div style="text-align: right;"> | ||
| 108 | + <ul id="pagination" class="pagination"></ul> | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + </div> | ||
| 112 | + </div> | ||
| 113 | + </div> | ||
| 114 | +</div> | ||
| 115 | + | ||
| 116 | +<script> | ||
| 117 | + $(function(){ | ||
| 118 | + | ||
| 119 | + // 关闭左侧栏 | ||
| 120 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 121 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 122 | + | ||
| 123 | + $("#startDate").datetimepicker({ | ||
| 124 | + format : 'YYYY-MM-DD', | ||
| 125 | + locale : 'zh-cn' | ||
| 126 | + }); | ||
| 127 | + $("#endDate").datetimepicker({ | ||
| 128 | + format : 'YYYY-MM-DD', | ||
| 129 | + locale : 'zh-cn' | ||
| 130 | + }); | ||
| 131 | + | ||
| 132 | + var d = new Date(); | ||
| 133 | + var year = d.getFullYear(); | ||
| 134 | + var month = d.getMonth() + 1; | ||
| 135 | + var day = d.getDate(); | ||
| 136 | + if(month > 9){ | ||
| 137 | + $("#startDate").val(year + "-" + month + "-" + day); | ||
| 138 | + $("#endDate").val(year + "-" + month + "-" + day); | ||
| 139 | + } else { | ||
| 140 | + $("#startDate").val(year + "-0" + month + "-" + day); | ||
| 141 | + $("#endDate").val(year + "-0" + month + "-" + day); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + $.get('/basic/lineCode2Name',function(result){ | ||
| 145 | + var data=[]; | ||
| 146 | + | ||
| 147 | + for(var code in result){ | ||
| 148 | + data.push({id: code, text: result[code]}); | ||
| 149 | + } | ||
| 150 | + console.log(data); | ||
| 151 | + initPinYinSelect2('#line',data,''); | ||
| 152 | + | ||
| 153 | + line = data[0].id; | ||
| 154 | + updateModel(); | ||
| 155 | + }) | ||
| 156 | + | ||
| 157 | + $("#query").on("click", function (){ | ||
| 158 | + line = $("#line").val(); | ||
| 159 | + upDown = $("#upDown").val(); | ||
| 160 | + if(line=="" || line==null){ | ||
| 161 | + layer.msg("请选择线路"); | ||
| 162 | + }else if(upDown==null || upDown==""){ | ||
| 163 | + layer.msg("请选择方向"); | ||
| 164 | + }else{ | ||
| 165 | + jsDoQuery(); | ||
| 166 | + } | ||
| 167 | + }); | ||
| 168 | + | ||
| 169 | + var line = $("#line").val(); | ||
| 170 | + var startDate = $("#startDate").val(); | ||
| 171 | + var endDate = $("#endDate").val(); | ||
| 172 | + var model = $("#model").val(); | ||
| 173 | + var times = $("#times").val(); | ||
| 174 | + var upDown = $("#upDown").val(); | ||
| 175 | + function jsDoQuery(pagination){ | ||
| 176 | + var params = {}; | ||
| 177 | + line = $("#line").val(); | ||
| 178 | + startDate = $("#startDate").val(); | ||
| 179 | + endDate = $("#endDate").val(); | ||
| 180 | + model = $("#model").val(); | ||
| 181 | + times = $("#times").val(); | ||
| 182 | + upDown = $("#upDown").val(); | ||
| 183 | + params['line'] = line; | ||
| 184 | + params['startDate'] = startDate; | ||
| 185 | + params['endDate'] = endDate; | ||
| 186 | + params['model'] = model; | ||
| 187 | + params['times'] = times; | ||
| 188 | + params['upDown'] = upDown; | ||
| 189 | + params['type'] = "query"; | ||
| 190 | + $(".hidden").removeClass("hidden"); | ||
| 191 | + $get('/busInterval/timeAndSpeed', params, function(result){ | ||
| 192 | + // 把数据填充到模版中 | ||
| 193 | + var tbodyHtml = template('list_timeAndSpeed',{list:result}); | ||
| 194 | + // 把渲染好的模版html文本追加到表格中 | ||
| 195 | + $('#forms tbody').html(tbodyHtml); | ||
| 196 | + | ||
| 197 | + }); | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | +// $("#export").on("click",function(){ | ||
| 201 | +// $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ | ||
| 202 | +// window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD")); | ||
| 203 | +// }); | ||
| 204 | +// }); | ||
| 205 | + | ||
| 206 | + | ||
| 207 | + $("#line").on("change", function(){ | ||
| 208 | + line = $("#line").val(); | ||
| 209 | + updateModel(); | ||
| 210 | + var params = {}; | ||
| 211 | + params['line'] = line; | ||
| 212 | + $get('/busInterval/getDir', params, function(result){ | ||
| 213 | + dirData = createTreeData(result); | ||
| 214 | + var options = ''; | ||
| 215 | + $.each(dirData, function(i, g){ | ||
| 216 | + options += '<option value="'+g.name+'">'+g.name+'</option>'; | ||
| 217 | + }); | ||
| 218 | + $('#upDown').html(options); | ||
| 219 | + }); | ||
| 220 | + }); | ||
| 221 | + $('#startDate').on("blur", function(){ | ||
| 222 | + startDate = $("#startDate").val(); | ||
| 223 | + endDate = $("#endDate").val(); | ||
| 224 | + updateModel(); | ||
| 225 | + }); | ||
| 226 | + $('#endDate').on("blur", function(){ | ||
| 227 | + startDate = $("#startDate").val(); | ||
| 228 | + endDate = $("#endDate").val(); | ||
| 229 | + updateModel(); | ||
| 230 | + }); | ||
| 231 | + | ||
| 232 | + var flag = 0; | ||
| 233 | + function updateModel(){ | ||
| 234 | + if(flag == 1) | ||
| 235 | + return; | ||
| 236 | + flag = 1; | ||
| 237 | + var treeData = []; | ||
| 238 | + var params = {}; | ||
| 239 | + params['line'] = line; | ||
| 240 | + params['startDate'] = startDate; | ||
| 241 | + params['endDate'] = endDate; | ||
| 242 | + $get('/pcpc/getModel', params, function(result){ | ||
| 243 | + treeData = createTreeData(result); | ||
| 244 | + var options = '<option value="">请选择...</option>'; | ||
| 245 | + $.each(treeData, function(i, g){ | ||
| 246 | + options += '<option value="'+g.id+'">'+g.name+'</option>'; | ||
| 247 | + }); | ||
| 248 | + $('#model').html(options)/* .select2() */; | ||
| 249 | + flag = 0; | ||
| 250 | + }); | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + | ||
| 254 | + }); | ||
| 255 | + | ||
| 256 | +</script> | ||
| 257 | +<script type="text/html" id="list_timeAndSpeed"> | ||
| 258 | + {{each list.dateList as obj i}} | ||
| 259 | + <tr> | ||
| 260 | + <td>{{obj.date}}</td> | ||
| 261 | + <td>{{obj.times}}</td> | ||
| 262 | + <td>{{obj.company}}</td> | ||
| 263 | + <td>{{obj.branchCompany}}</td> | ||
| 264 | + <td>{{obj.line}}</td> | ||
| 265 | + <td>{{obj.lp}}</td> | ||
| 266 | + <td>{{obj.qdz_zdz}}</td> | ||
| 267 | + <td>{{obj.zdz}}</td> | ||
| 268 | + <td>{{obj.yysj}}</td> | ||
| 269 | + <td>{{obj.yysd}}</td> | ||
| 270 | + <td>{{obj.yssj}}</td> | ||
| 271 | + <td>{{obj.yssd}}</td> | ||
| 272 | + </tr> | ||
| 273 | + {{/each}} | ||
| 274 | + {{if list.dateList.length != 0}} | ||
| 275 | + <tr> | ||
| 276 | + <td colspan="8">汇总平均</td> | ||
| 277 | + <td>{{list.yysj}}</td> | ||
| 278 | + <td>{{list.yysd}}</td> | ||
| 279 | + <td>{{list.yssj}}</td> | ||
| 280 | + <td>{{list.yssd}}</td> | ||
| 281 | + </tr> | ||
| 282 | + {{/if}} | ||
| 283 | + {{if list.dateList.length == 0}} | ||
| 284 | + <tr> | ||
| 285 | + <td colspan="12"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 286 | + </tr> | ||
| 287 | + {{/if}} | ||
| 288 | +</script> | ||
| 0 | \ No newline at end of file | 289 | \ No newline at end of file |