Commit 68257dd4de88d495d0bd0c96fc32ab014bbe9831

Authored by 娄高锋
1 parent 83d7ff67

LGF 报表加单双线

src/main/java/com/bsth/controller/BusIntervalController.java
@@ -22,6 +22,11 @@ public class BusIntervalController { @@ -22,6 +22,11 @@ public class BusIntervalController {
22 public List<Map<String,Object>> getDir(@RequestParam Map<String, Object> map){ 22 public List<Map<String,Object>> getDir(@RequestParam Map<String, Object> map){
23 return busIntervalService.getDir(map); 23 return busIntervalService.getDir(map);
24 } 24 }
  25 +
  26 + @RequestMapping(value = "/getLp", method = RequestMethod.GET)
  27 + public List<Map<String,Object>> getLp(@RequestParam Map<String, Object> map){
  28 + return busIntervalService.getLp(map);
  29 + }
25 30
26 @RequestMapping(value = "/interval", method = RequestMethod.GET) 31 @RequestMapping(value = "/interval", method = RequestMethod.GET)
27 public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){ 32 public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){
src/main/java/com/bsth/service/BusIntervalService.java
@@ -8,6 +8,8 @@ public interface BusIntervalService { @@ -8,6 +8,8 @@ public interface BusIntervalService {
8 8
9 List<Map<String, Object>> getDir(Map<String, Object> map); 9 List<Map<String, Object>> getDir(Map<String, Object> map);
10 10
  11 + List<Map<String, Object>> getLp(Map<String, Object> map);
  12 +
11 List<Map<String, Object>> interval(Map<String, Object> map); 13 List<Map<String, Object>> interval(Map<String, Object> map);
12 14
13 Map<String, Object> timeAndSpeed(Map<String, Object> map); 15 Map<String, Object> timeAndSpeed(Map<String, Object> map);
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
  3 +import java.math.BigDecimal;
  4 +import java.math.RoundingMode;
3 import java.sql.ResultSet; 5 import java.sql.ResultSet;
4 import java.sql.SQLException; 6 import java.sql.SQLException;
5 import java.text.DecimalFormat; 7 import java.text.DecimalFormat;
@@ -11,12 +13,14 @@ import java.util.Date; @@ -11,12 +13,14 @@ import java.util.Date;
11 import java.util.HashMap; 13 import java.util.HashMap;
12 import java.util.List; 14 import java.util.List;
13 import java.util.Map; 15 import java.util.Map;
  16 +import java.util.Set;
14 17
15 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.jdbc.core.JdbcTemplate; 19 import org.springframework.jdbc.core.JdbcTemplate;
17 import org.springframework.jdbc.core.RowMapper; 20 import org.springframework.jdbc.core.RowMapper;
18 import org.springframework.stereotype.Service; 21 import org.springframework.stereotype.Service;
19 22
  23 +import com.bsth.entity.realcontrol.ChildTaskPlan;
20 import com.bsth.entity.realcontrol.ScheduleRealInfo; 24 import com.bsth.entity.realcontrol.ScheduleRealInfo;
21 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 25 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
22 import com.bsth.service.BusIntervalService; 26 import com.bsth.service.BusIntervalService;
@@ -36,9 +40,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -36,9 +40,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
36 private JdbcTemplate jdbcTemplate; 40 private JdbcTemplate jdbcTemplate;
37 41
38 private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 42 private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
39 - private DecimalFormat df = new DecimalFormat("##0.00"); 43 + private DecimalFormat df = new DecimalFormat("0.##");
40 44
41 - public List<ScheduleRealInfo> getSchedule(String company, String subCompany, String line, String startDate, String endDate, String model, String times){ 45 + public List<ScheduleRealInfo> getSchedule(String company, String subCompany, String line, String startDate, String endDate, String model, String times, boolean normal){
42 List<Long> ttList = new ArrayList<Long>(); 46 List<Long> ttList = new ArrayList<Long>();
43 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 47 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
44 List<ScheduleRealInfo> resList = new ArrayList<ScheduleRealInfo>(); 48 List<ScheduleRealInfo> resList = new ArrayList<ScheduleRealInfo>();
@@ -56,14 +60,18 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -56,14 +60,18 @@ public class BusIntervalServiceImpl implements BusIntervalService {
56 if(company.length() != 0){ 60 if(company.length() != 0){
57 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; 61 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
58 } 62 }
59 - sql += " and bc_type = 'normal'"; 63 + if(normal){
  64 + sql += " and bc_type != 'in' and bc_type != 'out'";
  65 + }
60 66
61 - list =jdbcTemplate.query(sql, 67 + list = jdbcTemplate.query(sql,
62 new RowMapper<ScheduleRealInfo>(){ 68 new RowMapper<ScheduleRealInfo>(){
63 @Override 69 @Override
64 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { 70 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
65 ScheduleRealInfo schedule = new ScheduleRealInfo(); 71 ScheduleRealInfo schedule = new ScheduleRealInfo();
66 schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); 72 schedule.setScheduleDateStr(rs.getString("schedule_date_Str"));
  73 + schedule.setRealExecDate(rs.getString("real_exec_date"));
  74 + schedule.setXlBm(rs.getString("xl_bm"));
67 schedule.setXlName(rs.getString("xl_name")); 75 schedule.setXlName(rs.getString("xl_name"));
68 schedule.setLpName(rs.getString("lp_name")); 76 schedule.setLpName(rs.getString("lp_name"));
69 schedule.setBcType(rs.getString("bc_type")); 77 schedule.setBcType(rs.getString("bc_type"));
@@ -75,6 +83,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -75,6 +83,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
75 schedule.setFcsjActual(rs.getString("fcsj_actual")); 83 schedule.setFcsjActual(rs.getString("fcsj_actual"));
76 schedule.setZdsj(rs.getString("zdsj")); 84 schedule.setZdsj(rs.getString("zdsj"));
77 schedule.setZdsjActual(rs.getString("zdsj_actual")); 85 schedule.setZdsjActual(rs.getString("zdsj_actual"));
  86 + schedule.setQdzCode(rs.getString("qdz_code"));
78 schedule.setQdzName(rs.getString("qdz_name")); 87 schedule.setQdzName(rs.getString("qdz_name"));
79 schedule.setZdzName(rs.getString("zdz_name")); 88 schedule.setZdzName(rs.getString("zdz_name"));
80 schedule.setXlDir(rs.getString("xl_dir")); 89 schedule.setXlDir(rs.getString("xl_dir"));
@@ -88,15 +97,57 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -88,15 +97,57 @@ public class BusIntervalServiceImpl implements BusIntervalService {
88 schedule.setjGh(rs.getString("j_gh")); 97 schedule.setjGh(rs.getString("j_gh"));
89 schedule.setjName(rs.getString("j_name")); 98 schedule.setjName(rs.getString("j_name"));
90 schedule.setSpId(rs.getLong("sp_id")); 99 schedule.setSpId(rs.getLong("sp_id"));
  100 + schedule.setSflj(rs.getBoolean("sflj"));
  101 +
  102 + String[] split1 = schedule.getFcsj().split(":");
  103 + String[] split3 = schedule.getZdsj().split(":");
  104 + long fcsj = Long.valueOf(split1[0]) * 60 + Long.valueOf(split1[1]);
  105 + long zdsj = Long.valueOf(split3[0]) * 60 + Long.valueOf(split3[1]);
  106 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())){
  107 + fcsj += 1440l;
  108 + zdsj += 1440l;
  109 + }
  110 + if(zdsj < fcsj)
  111 + zdsj += 1440l;
  112 + if(schedule.getDfsj() != null){
  113 + String[] split0 = schedule.getDfsj().split(":");
  114 + long dfsj = Long.valueOf(split0[0]) * 60 + Long.valueOf(split0[1]);
  115 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  116 + dfsj += 1440l;
  117 + schedule.setDfsj(dfsj/60 + ":" + dfsj%60);
  118 + schedule.setDfsjT(dfsj);
  119 + }
  120 + if(schedule.getFcsjActual() != null){
  121 + String[] split2 = schedule.getFcsjActual().split(":");
  122 + long fcsjA = Long.valueOf(split2[0]) * 60 + Long.valueOf(split2[1]);
  123 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  124 + fcsjA += 1440l;
  125 + schedule.setFcsjActual(fcsjA/60 + ":" + fcsjA%60);
  126 + schedule.setFcsjActualTime(fcsjA);
  127 + }
  128 + if(schedule.getZdsjActual() != null){
  129 + String[] split4 = schedule.getZdsjActual().split(":");
  130 + long zdsjA = Long.valueOf(split4[0]) * 60 + Long.valueOf(split4[1]);
  131 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  132 + zdsjA += 1440l;
  133 + if(schedule.getFcsjActualTime() != null && zdsjA < schedule.getFcsjActualTime())
  134 + zdsjA += 1440l;
  135 + schedule.setZdsjActual(zdsjA/60 + ":" + zdsjA%60);
  136 + schedule.setZdsjActualTime(zdsjA);
  137 + }
  138 + schedule.setFcsj(fcsj/60 + ":" + fcsj%60);
  139 + schedule.setZdsj(zdsj/60 + ":" + zdsj%60);
  140 + schedule.setFcsjT(fcsj);
  141 + schedule.setZdsjT(zdsj);
91 return schedule; 142 return schedule;
92 } 143 }
93 }); 144 });
94 145
95 if(model.length() != 0){ 146 if(model.length() != 0){
96 -// sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type = 'normal'";  
97 - sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type = 'normal'"; 147 +// sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type != 'in' and bc_type != 'out'";
  148 + sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out'";
98 149
99 - ttList =jdbcTemplate.query(sql, 150 + ttList = jdbcTemplate.query(sql,
100 new RowMapper<Long>(){ 151 new RowMapper<Long>(){
101 @Override 152 @Override
102 public Long mapRow(ResultSet rs, int rowNum) throws SQLException { 153 public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -143,7 +194,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -143,7 +194,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
143 } 194 }
144 } 195 }
145 } 196 }
146 - 197 +
147 list = new ArrayList<ScheduleRealInfo>(); 198 list = new ArrayList<ScheduleRealInfo>();
148 List<Long> keyList = new ArrayList<Long>(); 199 List<Long> keyList = new ArrayList<Long>();
149 Map<Long, List<ScheduleRealInfo>> keyMap = new HashMap<Long, List<ScheduleRealInfo>>(); 200 Map<Long, List<ScheduleRealInfo>> keyMap = new HashMap<Long, List<ScheduleRealInfo>>();
@@ -161,7 +212,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -161,7 +212,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
161 list.add(schedule); 212 list.add(schedule);
162 } 213 }
163 } 214 }
164 - 215 +
165 return list; 216 return list;
166 } 217 }
167 218
@@ -176,7 +227,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -176,7 +227,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
176 227
177 String sql = "select start_station_name, end_station_name from bsth_c_line where line_code = '"+line+"'"; 228 String sql = "select start_station_name, end_station_name from bsth_c_line where line_code = '"+line+"'";
178 229
179 - list =jdbcTemplate.query(sql, 230 + list = jdbcTemplate.query(sql,
180 new RowMapper<Map<String, Object>>(){ 231 new RowMapper<Map<String, Object>>(){
181 @Override 232 @Override
182 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 233 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -205,8 +256,45 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -205,8 +256,45 @@ public class BusIntervalServiceImpl implements BusIntervalService {
205 } 256 }
206 257
207 @Override 258 @Override
  259 + public List<Map<String, Object>> getLp(Map<String, Object> map){
  260 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  261 +
  262 + String line = map.get("line").toString();
  263 + String ttId = map.get("ttId").toString();
  264 +
  265 + try {
  266 + String sql = "select td.lp, lp.lp_name from bsth_c_s_ttinfo_detail td" +
  267 + " left join bsth_c_s_gbi lp on td.lp = lp.id" +
  268 + " left join bsth_c_line cl on cl.id = td.xl where 1=1";
  269 + if(line.length() != 0)
  270 + sql += " and cl.line_code = '"+line+"'";
  271 + if(ttId.length() != 0)
  272 + sql += " and td.ttinfo = '"+ttId+"'";
  273 + sql += " group by td.lp";
  274 +
  275 + list = jdbcTemplate.query(sql,
  276 + new RowMapper<Map<String, Object>>(){
  277 + @Override
  278 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  279 + Map<String, Object> map = new HashMap<String, Object>();
  280 + map.put("id", rs.getString("lp"));
  281 + map.put("name", rs.getString("lp_name"));
  282 + return map;
  283 + }
  284 +
  285 + });
  286 + } catch (Exception e) {
  287 + // TODO: handle exception
  288 + e.printStackTrace();
  289 + }
  290 +
  291 + return list;
  292 + }
  293 +
  294 + @Override
208 public List<Map<String, Object>> interval(Map<String, Object> map) { 295 public List<Map<String, Object>> interval(Map<String, Object> map) {
209 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 296 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  297 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
210 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); 298 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
211 299
212 String company = map.get("company").toString(); 300 String company = map.get("company").toString();
@@ -215,7 +303,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -215,7 +303,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
215 String startDate = map.get("startDate").toString(); 303 String startDate = map.get("startDate").toString();
216 String endDate = map.get("endDate").toString(); 304 String endDate = map.get("endDate").toString();
217 String model = map.get("model").toString(); 305 String model = map.get("model").toString();
218 - String times = map.get("times").toString(); 306 + String statu = map.get("statu").toString();
  307 +// String times = map.get("times").toString();
219 String type = map.get("type").toString(); 308 String type = map.get("type").toString();
220 309
221 if(startDate.length() == 0){ 310 if(startDate.length() == 0){
@@ -224,273 +313,737 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -224,273 +313,737 @@ public class BusIntervalServiceImpl implements BusIntervalService {
224 if(endDate.length() == 0){ 313 if(endDate.length() == 0){
225 endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 314 endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
226 } 315 }
227 - if(times.length() == 0){  
228 - times = "06:00-07:00"; 316 + if(statu.equals("0")){
  317 + line = "";
229 } 318 }
  319 +// if(times.length() == 0){
  320 +// times = "06:00-07:00";
  321 +// }
230 322
231 - List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, startDate, endDate, model, times); 323 + List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, startDate, endDate, model, "", true);
232 324
233 String[] date1 = startDate.split("-"); 325 String[] date1 = startDate.split("-");
234 String[] date2 = endDate.split("-"); 326 String[] date2 = endDate.split("-");
235 startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; 327 startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
236 endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; 328 endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  329 + String Date = "";
  330 + if(startDate.equals(endDate))
  331 + Date = startDate;
  332 + else
  333 + Date = startDate + "--" + endDate;
237 334
238 - String[] split = times.split("-");  
239 - int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);  
240 - int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); 335 +// String[] split = times.split("-");
  336 +// int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
  337 +// int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
241 338
242 - //分组统计班次间隔  
243 for(ScheduleRealInfo schedule : list){ 339 for(ScheduleRealInfo schedule : list){
244 - long fcsj = schedule.getFcsjT();  
245 - if(endTime != 0?(fcsj >= startTime && fcsj <= endTime):(fcsj >= startTime)){  
246 - String key = schedule.getXlName() + "/" + schedule.getQdzName();  
247 - if(!keyMap.containsKey(key))  
248 - keyMap.put(key, new ArrayList<ScheduleRealInfo>());  
249 - keyMap.get(key).add(schedule);  
250 - } 340 + String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName();
  341 + if(!keyMap.containsKey(key))
  342 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  343 + keyMap.get(key).add(schedule);
251 } 344 }
  345 +
  346 + List<String> keyList = new ArrayList<String>();
  347 + Map<String, List<Long>> temp0 = new HashMap<String, List<Long>>();
  348 + Map<String, List<Long>> temp1 = new HashMap<String, List<Long>>();
  349 + String companyName = "", subCompanyName = "";
252 for(String key : keyMap.keySet()){ 350 for(String key : keyMap.keySet()){
253 - long jhInterval = 0;  
254 - long sjInterval = 0;  
255 - int jhNum = 0;  
256 - int sjNum = 0;  
257 - String companyName = "", subCompanyName = "";  
258 - Map<String, Object> tempMap = new HashMap<String, Object>();  
259 - Map<String, List<ScheduleRealInfo>> temp = new HashMap<String, List<ScheduleRealInfo>>(); 351 + if(keyMap.get(key).size() < 2)
  352 + continue;
  353 + Map<String, List<ScheduleRealInfo>> keyMap2 = new HashMap<String, List<ScheduleRealInfo>>();
260 for(ScheduleRealInfo schedule : keyMap.get(key)){ 354 for(ScheduleRealInfo schedule : keyMap.get(key)){
  355 + if(companyName.length() == 0 && schedule.getGsName() != null)
  356 + companyName = schedule.getGsName();
  357 + if(subCompanyName.length() == 0 && schedule.getFgsName() != null)
  358 + subCompanyName = schedule.getFgsName();
261 String date = schedule.getScheduleDateStr(); 359 String date = schedule.getScheduleDateStr();
262 - if(!temp.containsKey(date))  
263 - temp.put(date, new ArrayList<ScheduleRealInfo>());  
264 - temp.get(date).add(schedule); 360 + if(!keyMap2.containsKey(date))
  361 + keyMap2.put(date, new ArrayList<ScheduleRealInfo>());
  362 + keyMap2.get(date).add(schedule);
265 } 363 }
266 - for(String date : temp.keySet()){  
267 - List<ScheduleRealInfo> tempList = temp.get(date);  
268 - for(int i = 1; i < tempList.size(); i++){  
269 - jhNum++;  
270 - ScheduleRealInfo schedule1 = tempList.get(i - 1);  
271 - ScheduleRealInfo schedule2 = tempList.get(i);  
272 -  
273 - if(schedule1.getGsName() != null && companyName.length() == 0)  
274 - companyName = schedule1.getGsName();  
275 - if(schedule1.getFgsName() != null && subCompanyName.length() == 0)  
276 - subCompanyName = schedule1.getFgsName();  
277 -  
278 - jhInterval += schedule2.getFcsjT();  
279 - jhInterval -= schedule1.getFcsjT();  
280 - if(schedule1.getFcsjActual()!=null && schedule2.getFcsjActual()!=null){  
281 - sjNum++;  
282 - sjInterval += schedule2.getFcsjActualTime();  
283 - sjInterval -= schedule1.getFcsjActualTime(); 364 + Map<Long, List<Long>> timeMap0 = new HashMap<Long, List<Long>>();
  365 + Map<Long, List<Long>> timeMap1 = new HashMap<Long, List<Long>>();
  366 + List<Long> timeList = new ArrayList<Long>();
  367 + for(String date : keyMap2.keySet()){
  368 + if(keyMap2.get(date).size() < 2)
  369 + continue;
  370 + List<Long> fcsjs = new ArrayList<Long>();
  371 + List<Long> fcsjAs = new ArrayList<Long>();
  372 + for(ScheduleRealInfo schedule : keyMap2.get(date)){
  373 + if(schedule.getFcsjT() != null && !schedule.isSflj())
  374 + fcsjs.add(schedule.getFcsjT());
  375 + if(schedule.getFcsjActualTime() != null && schedule.getStatus() != -1)
  376 + fcsjAs.add(schedule.getFcsjActualTime());
  377 + }
  378 + Collections.sort(fcsjs);
  379 + Collections.sort(fcsjAs);
  380 +
  381 + if(statu.equals("1")){
  382 + for(int i = 1; i < fcsjs.size(); i++){
  383 + long fcsj1 = fcsjs.get(i - 1);
  384 + long fcsj2 = fcsjs.get(i);
  385 + Long time = fcsj1/60;
  386 + if(!timeMap0.containsKey(time) && !timeMap1.containsKey(time)){
  387 + timeMap0.put(time, new ArrayList<Long>());
  388 + timeMap1.put(time, new ArrayList<Long>());
  389 + timeList.add(time);
  390 + }
  391 + timeMap0.get(time).add(fcsj2 - fcsj1);
  392 + }
  393 + for(int i = 1; i < fcsjAs.size(); i++){
  394 + long fcsj1 = fcsjAs.get(i - 1);
  395 + long fcsj2 = fcsjAs.get(i);
  396 + Long time = fcsj1/60;
  397 + if(timeMap1.containsKey(time)){
  398 + timeMap1.get(time).add(fcsj2 - fcsj1);
  399 + }
  400 + }
  401 + }else if(statu.equals("0")){
  402 + for(int i = 1; i < fcsjs.size(); i++){
  403 + long fcsj1 = fcsjs.get(i - 1);
  404 + long fcsj2 = fcsjs.get(i);
  405 + if(!temp0.containsKey(key) && !temp1.containsKey(key)){
  406 + temp0.put(key, new ArrayList<Long>());
  407 + temp1.put(key, new ArrayList<Long>());
  408 + if(!keyList.contains(key))
  409 + keyList.add(key);
  410 + }
  411 + temp0.get(key).add(fcsj2 - fcsj1);
  412 + }
  413 + for(int i = 1; i < fcsjAs.size(); i++){
  414 + long fcsj1 = fcsjAs.get(i - 1);
  415 + long fcsj2 = fcsjAs.get(i);
  416 + temp1.get(key).add(fcsj2 - fcsj1);
284 } 417 }
285 } 418 }
286 } 419 }
287 - if(startDate.equals(endDate))  
288 - tempMap.put("date", startDate);  
289 - else  
290 - tempMap.put("date", startDate + "--" + endDate);  
291 - String[] keys = key.split("/");  
292 - tempMap.put("line", keys[0]);  
293 - tempMap.put("qdz", keys[1]);  
294 - tempMap.put("times", times);  
295 - tempMap.put("company", companyName);  
296 - tempMap.put("subCompany", subCompanyName);  
297 - if(jhNum != 0)  
298 - tempMap.put("jhInterval", jhInterval/jhNum);  
299 - else  
300 - tempMap.put("jhInterval", "/");  
301 - if(sjNum != 0){  
302 - tempMap.put("sjInterval", sjInterval/sjNum);  
303 - tempMap.put("deviation", sjInterval/sjNum - jhInterval/jhNum);  
304 - }  
305 - else{  
306 - tempMap.put("sjInterval", "/");  
307 - tempMap.put("deviation", "/"); 420 +
  421 + if(statu.equals("1")){
  422 + for(Long time : timeList){
  423 + Map<String, Object> tempMap = new HashMap<String, Object>();
  424 + List<Long> fcsjs = timeMap0.get(time);
  425 + List<Long> fcsjAs = timeMap1.get(time);
  426 + Collections.sort(fcsjs);
  427 + Collections.sort(fcsjAs);
  428 + String[] split = key.split("/");
  429 + tempMap.put("date", Date);
  430 + tempMap.put("line", split[1]);
  431 + tempMap.put("qdz", split[2]);
  432 + tempMap.put("company", companyName);
  433 + tempMap.put("subCompany", subCompanyName);
  434 + long jhInterval = 0l;
  435 + long sjInterval = 0l;
  436 + for(Long i : fcsjs)
  437 + jhInterval += i;
  438 + for(Long i : fcsjAs)
  439 + sjInterval += i;
  440 + tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)jhInterval/fcsjs.size()):"/");
  441 + tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)sjInterval/fcsjAs.size()):"/");
  442 + tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/");
  443 + tempMap.put("MinInterval", fcsjAs.size()>0?fcsjAs.get(0):"/");
  444 + tempMap.put("times", (time>9?time:"0"+time) + ":00-" + (time+1>9?(time+1):"0"+(time+1)) + ":00");
  445 + if(tempMap.get("jhInterval").toString().equals("/")
  446 + ||tempMap.get("sjInterval").toString().equals("/")){
  447 + tempMap.put("deviation", "/");
  448 + } else {
  449 + tempMap.put("deviation", df.format(Double.valueOf(tempMap.get("sjInterval").toString())
  450 + - Double.valueOf(tempMap.get("jhInterval").toString())));
  451 + }
  452 + tempList.add(tempMap);
  453 + }
308 } 454 }
309 - if(tempMap.get("jhInterval") != null && !tempMap.get("jhInterval").toString().equals("0") && !tempMap.get("jhInterval").toString().equals("/"))  
310 - resList.add(tempMap);  
311 } 455 }
312 456
313 - //排序  
314 - Map<String, List<Map<String, Object>>> temp = new HashMap<String, List<Map<String, Object>>>();  
315 - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();  
316 - for(Map<String, Object> m : resList){  
317 - String key = m.get("line").toString();  
318 - if(!temp.containsKey(key))  
319 - temp.put(key, new ArrayList<Map<String, Object>>());  
320 - temp.get(key).add(m);  
321 - }  
322 - for(String key : temp.keySet()){  
323 - for(Map<String, Object> m : temp.get(key)){  
324 - tempList.add(m); 457 + if(statu.equals("1")){
  458 + List<Long> sortList = new ArrayList<Long>();
  459 + Map<Long, List<Map<String, Object>>> sortMap = new HashMap<Long, List<Map<String, Object>>>();
  460 + for(Map<String, Object> m : tempList){
  461 + Long sort = Long.valueOf(m.get("times").toString().substring(0, 2));
  462 + if(!sortMap.containsKey(sort)){
  463 + sortMap.put(sort, new ArrayList<Map<String, Object>>());
  464 + sortList.add(sort);
  465 + }
  466 + sortMap.get(sort).add(m);
  467 + }
  468 + Collections.sort(sortList);
  469 + for(Long sort : sortList){
  470 + for(Map<String, Object> m : sortMap.get(sort))
  471 + resList.add(m);
  472 + }
  473 + }else if(statu.equals("0")){
  474 + List<Long> longList = new ArrayList<Long>();
  475 + for(String key : keyList){
  476 + long xlBm = Long.valueOf(key.split("/")[0]);
  477 + if(!longList.contains(xlBm))
  478 + longList.add(xlBm);
  479 + Collections.sort(longList);
  480 + }
  481 + for(long xlBm : longList){
  482 + for(String key : keyList){
  483 + String[] split = key.split("/");
  484 + if((long)Long.valueOf(split[0]) == xlBm){
  485 + Map<String, Object> tempMap = new HashMap<String, Object>();
  486 + List<Long> fcsjs = temp0.get(key);
  487 + List<Long> fcsjAs = temp1.get(key);
  488 + Collections.sort(fcsjs);
  489 + Collections.sort(fcsjAs);
  490 + long fcsj = 0l;
  491 + long fcsjA = 0l;
  492 + for(long l : fcsjs)
  493 + fcsj += l;
  494 + for(long l : fcsjAs)
  495 + fcsjA += l;
  496 + tempMap.put("date", Date);
  497 + tempMap.put("line", split[1]);
  498 + tempMap.put("qdz", split[2]);
  499 + tempMap.put("company", companyName);
  500 + tempMap.put("subCompany", subCompanyName);
  501 + tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/");
  502 + tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/");
  503 + tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/");
  504 + tempMap.put("MinInterval", fcsjAs.size()>0?fcsjAs.get(0):"/");
  505 + if(tempMap.get("jhInterval").toString().equals("/")
  506 + ||tempMap.get("sjInterval").toString().equals("/")){
  507 + tempMap.put("deviation", "/");
  508 + } else {
  509 + tempMap.put("deviation", df.format(Double.valueOf(tempMap.get("sjInterval").toString())
  510 + - Double.valueOf(tempMap.get("jhInterval").toString())));
  511 + }
  512 + resList.add(tempMap);
  513 + }
  514 + }
325 } 515 }
326 } 516 }
327 517
328 - return tempList; 518 + return resList;
329 } 519 }
330 520
331 @Override 521 @Override
332 public Map<String, Object> timeAndSpeed(Map<String, Object> map) { 522 public Map<String, Object> timeAndSpeed(Map<String, Object> map) {
  523 + List<Long> ttList = new ArrayList<Long>();
  524 + List<ChildTaskPlan> cList = new ArrayList<ChildTaskPlan>();
  525 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
333 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 526 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
334 - List<Map<String, Object>> dateList = new ArrayList<Map<String, Object>>(); 527 + List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
335 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); 528 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
  529 + Map<String, List<ChildTaskPlan>> cMap = new HashMap<String, List<ChildTaskPlan>>();
336 Map<String, Object> modelMap = new HashMap<String, Object>(); 530 Map<String, Object> modelMap = new HashMap<String, Object>();
337 - 531 +
338 String company = map.get("company").toString(); 532 String company = map.get("company").toString();
339 String subCompany = map.get("subCompany").toString(); 533 String subCompany = map.get("subCompany").toString();
  534 + String lp = map.get("lp").toString();
340 String line = map.get("line").toString(); 535 String line = map.get("line").toString();
  536 + String statu = map.get("statu").toString();
341 String startDate = map.get("startDate").toString(); 537 String startDate = map.get("startDate").toString();
342 String endDate = map.get("endDate").toString(); 538 String endDate = map.get("endDate").toString();
343 String model = map.get("model").toString(); 539 String model = map.get("model").toString();
344 - String times = map.get("times").toString();  
345 String type = map.get("type").toString(); 540 String type = map.get("type").toString();
346 - String zdzName = map.get("upDown").toString();  
347 - 541 +
348 if(startDate.length() == 0){ 542 if(startDate.length() == 0){
349 startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 543 startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
350 } 544 }
351 if(endDate.length() == 0){ 545 if(endDate.length() == 0){
352 endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 546 endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
353 } 547 }
354 - if(times.length() == 0){  
355 - times = "06:00-07:00"; 548 +
  549 + try {
  550 +
  551 + 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+"'";
  552 + if(line.length() != 0 && statu.equals("1")){
  553 + sql += " and xl_bm = '"+line+"'";
  554 + }
  555 + if(lp.length() != 0 && statu.equals("1")){
  556 + sql += " and lp_name = '"+lp+"'";
  557 + }
  558 + if(company.length() != 0){
  559 + sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
  560 + }
  561 + sql += " and bc_type != 'in' and bc_type != 'out' order by fcsj";
  562 +
  563 + list = jdbcTemplate.query(sql,
  564 + new RowMapper<ScheduleRealInfo>(){
  565 + @Override
  566 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  567 + ScheduleRealInfo schedule = new ScheduleRealInfo();
  568 + schedule.setId(rs.getLong("id"));
  569 + schedule.setScheduleDateStr(rs.getString("schedule_date_Str"));
  570 + schedule.setRealExecDate(rs.getString("real_exec_date"));
  571 + schedule.setXlName(rs.getString("xl_name"));
  572 + schedule.setLpName(rs.getString("lp_name"));
  573 + schedule.setBcType(rs.getString("bc_type"));
  574 + schedule.setBcs(rs.getInt("bcs"));
  575 + schedule.setBcsj(rs.getInt("bcsj"));
  576 + schedule.setJhlc(rs.getDouble("jhlc"));
  577 + schedule.setDfsj(rs.getString("dfsj"));
  578 + schedule.setFcsj(rs.getString("fcsj"));
  579 + schedule.setFcsjActual(rs.getString("fcsj_actual"));
  580 + schedule.setZdsj(rs.getString("zdsj"));
  581 + schedule.setZdsjActual(rs.getString("zdsj_actual"));
  582 + schedule.setQdzName(rs.getString("qdz_name"));
  583 + schedule.setZdzName(rs.getString("zdz_name"));
  584 + schedule.setXlDir(rs.getString("xl_dir"));
  585 + schedule.setStatus(rs.getInt("status"));
  586 + schedule.setRemarks(rs.getString("remarks"));
  587 + schedule.setGsName(rs.getString("gs_name"));
  588 + schedule.setFgsName(rs.getString("fgs_name"));
  589 + schedule.setDfAuto(rs.getBoolean("df_auto"));
  590 + schedule.setOnline(rs.getBoolean("online"));
  591 + schedule.setClZbh(rs.getString("cl_zbh"));
  592 + schedule.setjGh(rs.getString("j_gh"));
  593 + schedule.setjName(rs.getString("j_name"));
  594 + schedule.setStatus(rs.getInt("status"));
  595 + schedule.setSpId(rs.getLong("sp_id"));
  596 + if(schedule.getDfsj() != null){
  597 + String[] split0 = schedule.getDfsj().split(":");
  598 + long dfsj = Long.valueOf(split0[0]) * 60 + Long.valueOf(split0[1]);
  599 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  600 + dfsj += 1440l;
  601 + schedule.setDfsj(dfsj/60 + ":" + dfsj%60);
  602 + schedule.setDfsjT(dfsj);
  603 + }
  604 + if(schedule.getFcsjActual() != null){
  605 + String[] split2 = schedule.getFcsjActual().split(":");
  606 + long fcsjA = Long.valueOf(split2[0]) * 60 + Long.valueOf(split2[1]);
  607 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  608 + fcsjA += 1440l;
  609 + schedule.setFcsjActual(fcsjA/60 + ":" + fcsjA%60);
  610 + schedule.setFcsjActualTime(fcsjA);
  611 + }
  612 + if(schedule.getZdsjActual() != null){
  613 + String[] split4 = schedule.getZdsjActual().split(":");
  614 + long zdsjA = Long.valueOf(split4[0]) * 60 + Long.valueOf(split4[1]);
  615 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  616 + zdsjA += 1440l;
  617 + schedule.setZdsjActual(zdsjA/60 + ":" + zdsjA%60);
  618 + schedule.setZdsjActualTime(zdsjA);
  619 + }
  620 + String[] split1 = schedule.getFcsj().split(":");
  621 + String[] split3 = schedule.getZdsj().split(":");
  622 + long fcsj = Long.valueOf(split1[0]) * 60 + Long.valueOf(split1[1]);
  623 + long zdsj = Long.valueOf(split3[0]) * 60 + Long.valueOf(split3[1]);
  624 +
  625 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())){
  626 + fcsj += 1440l;
  627 + zdsj += 1440l;
  628 + }
  629 + schedule.setFcsj(fcsj/60 + ":" + fcsj%60);
  630 + schedule.setZdsj(zdsj/60 + ":" + zdsj%60);
  631 + schedule.setFcsjT(fcsj);
  632 + schedule.setZdsjT(zdsj);
  633 + return schedule;
  634 + }
  635 + });
  636 +
  637 + sql = "select * from bsth_c_s_child_task order by start_date";
  638 +
  639 + cList = jdbcTemplate.query(sql,
  640 + new RowMapper<ChildTaskPlan>(){
  641 + @Override
  642 + public ChildTaskPlan mapRow(ResultSet rs, int rowNum) throws SQLException {
  643 + ChildTaskPlan cTask = new ChildTaskPlan();
  644 + cTask.setDestroy(rs.getBoolean("destroy"));
  645 + cTask.setStartDate(rs.getString("start_date"));
  646 + cTask.setEndDate(rs.getString("end_date"));
  647 + cTask.setMileage(rs.getFloat("mileage"));
  648 + cTask.setMileageType(rs.getString("mileage_type"));
  649 + cTask.setRemarks(rs.getString("schedule"));
  650 + return cTask;
  651 + }
  652 + });
  653 +
  654 + if(model.length() != 0){
  655 + sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out'";
  656 +
  657 + ttList = jdbcTemplate.query(sql,
  658 + new RowMapper<Long>(){
  659 + @Override
  660 + public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
  661 + return rs.getLong("id");
  662 + }
  663 + });
  664 + }
  665 +
  666 + } catch (Exception e) {
  667 + // TODO: handle exception
  668 + e.printStackTrace();
356 } 669 }
357 -  
358 - List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, startDate, endDate, model, times);  
359 670
  671 +
360 String[] date1 = startDate.split("-"); 672 String[] date1 = startDate.split("-");
361 String[] date2 = endDate.split("-"); 673 String[] date2 = endDate.split("-");
  674 + String date = "";
362 startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; 675 startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
363 endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; 676 endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
364 -  
365 - String[] split = times.split("-");  
366 - int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);  
367 - int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); 677 + if(startDate.equals(endDate)){
  678 + date = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
  679 + } else {
  680 + date = date1[0] + "年" + date1[1] + "月" + date1[2] + "日--" +
  681 + date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  682 + }
  683 +
  684 + for(ChildTaskPlan cTask : cList){
  685 + String key = cTask.getRemarks();
  686 + if(!cMap.containsKey(key))
  687 + cMap.put(key, new ArrayList<ChildTaskPlan>());
  688 + cMap.get(key).add(cTask);
  689 + }
368 690
369 for(ScheduleRealInfo schedule : list){ 691 for(ScheduleRealInfo schedule : list){
370 - if(zdzName.length() != 0 && !zdzName.equals(schedule.getZdzName())){  
371 - continue;  
372 - }  
373 - int fcsj = Integer.valueOf(schedule.getFcsjT() + "");  
374 - if(!(endTime != 0?(fcsj >= startTime && fcsj < endTime):(fcsj >= startTime))){  
375 - continue;  
376 - }  
377 - String key = schedule.getXlName() + "/" + schedule.getLpName() + "/" + schedule.getZdzName();  
378 - if(!keyMap.containsKey(key)){  
379 - keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 692 + if(model.length() != 0){
  693 + for(Long tt : ttList)
  694 + if((long) tt == (long)schedule.getSpId()){
  695 + String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName();
  696 + if(!keyMap.containsKey(key))
  697 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  698 + keyMap.get(key).add(schedule);
  699 + }
  700 + }else{
  701 + String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName();
  702 + if(!keyMap.containsKey(key))
  703 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  704 + keyMap.get(key).add(schedule);
380 } 705 }
381 - keyMap.get(key).add(schedule);  
382 } 706 }
383 -  
384 - long yysjSum = 0;  
385 - double yysdSum = 0;  
386 - long yssjSum = 0;  
387 - double yssdSum = 0; 707 +
  708 + String companyName = "", subCompanyName = "";
388 for(String key : keyMap.keySet()){ 709 for(String key : keyMap.keySet()){
389 Map<String, Object> tempMap = new HashMap<String, Object>(); 710 Map<String, Object> tempMap = new HashMap<String, Object>();
390 - long yysj = 0;  
391 - double yysd = 0;  
392 - long yssj = 0;  
393 - double yssd = 0;  
394 - int yyNum = 0;  
395 - int ysNum = 0;  
396 - String companyName = "", subCompanyName = "";  
397 - for(ScheduleRealInfo schedule : keyMap.get(key)){  
398 - if(schedule.getGsName() != null && companyName.length() == 0) 711 + Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>();
  712 + List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
  713 + List<Long> keyList = new ArrayList<Long>();
  714 + List<ScheduleRealInfo> list2 = keyMap.get(key);
  715 + long jhyysj = 0, sjyysj = 0;
  716 + long jhyssj = 0, sjyssj = 0;
  717 + double jhlc = 0, sjlc = 0;
  718 + for(ScheduleRealInfo schedule : list2){
  719 + if(companyName.length() == 0 && schedule.getGsName() != null){
399 companyName = schedule.getGsName(); 720 companyName = schedule.getGsName();
400 - if(schedule.getFgsName() != null && subCompanyName.length() == 0) 721 + }
  722 + if(subCompanyName.length() == 0 && schedule.getFgsName() != null){
401 subCompanyName = schedule.getFgsName(); 723 subCompanyName = schedule.getFgsName();
402 - if(!tempMap.containsKey("xlDir"))  
403 - tempMap.put("xlDir", schedule.getXlDir());  
404 - if(!tempMap.containsKey("qdz_zdz") && schedule.getXlDir().equals("0"))  
405 - tempMap.put("qdz_zdz", schedule.getQdzName() + "--" + schedule.getZdzName());  
406 - else if(!tempMap.containsKey("qdz_zdz"))  
407 - tempMap.put("qdz_zdz", schedule.getZdzName() + "--" + schedule.getQdzName());  
408 - if(schedule.getBcsj() != null && schedule.getJhlc() != null){  
409 - int bcsj = schedule.getBcsj();  
410 - double jhlc = schedule.getJhlc();  
411 - yysd += jhlc/bcsj;  
412 - yysj += bcsj;  
413 - yyNum++;  
414 - if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null){  
415 - long time = schedule.getZdsjActualTime() - schedule.getFcsjActualTime();  
416 - yssd += jhlc/time;  
417 - yssj += time;  
418 - ysNum++; 724 + }
  725 + long fcsj = schedule.getFcsjT();
  726 + if(sortMap.containsKey(fcsj)){
  727 + if(sortMap.get(fcsj).getFcsjActual() != null)
  728 + continue;
  729 + } else {
  730 + keyList.add(fcsj);
  731 + }
  732 + sortMap.put(fcsj, schedule);
  733 + }
  734 + Collections.sort(keyList);
  735 +
  736 + for(int i = 1; i < keyList.size(); i++){
  737 + ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1));
  738 + ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i));
  739 + jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT();
  740 +
  741 + long zdsj2 = schedule2.getZdsjT();
  742 + long fcsj2 = schedule2.getFcsjT();
  743 + if(fcsj2 > zdsj2)
  744 + zdsj2 += 1440l;
  745 + jhyssj += zdsj2 - fcsj2;
  746 + jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc();
  747 + if(i == 1){
  748 + long zdsj1 = schedule1.getZdsjT();
  749 + long fcsj1 = schedule1.getFcsjT();
  750 + if(fcsj1 > zdsj1)
  751 + zdsj1 += 1440l;
  752 + jhyssj += zdsj1 - fcsj1;
  753 + jhlc += schedule1.getJhlc()==null?0:schedule1.getJhlc();
  754 + }
  755 + }
  756 +
  757 + for(int i = 0; i < keyList.size(); i++){
  758 + Map<String, Object> m = new HashMap<String, Object>();
  759 + ScheduleRealInfo schedule = sortMap.get(keyList.get(i));
  760 +
  761 + if(cMap.containsKey(schedule.getId())){
  762 + List<ChildTaskPlan> cTasks = cMap.get(schedule.getId());
  763 + for(ChildTaskPlan childTaskPlan : cTasks){
  764 + Map<String, Object> temp = new HashMap<String, Object>();
  765 + if(childTaskPlan.getMileageType().equals("empty") || childTaskPlan.isDestroy()){
  766 + temp.put("lc", null);
  767 + temp.put("fcsj", null);
  768 + temp.put("zdsj", null);
  769 + }else{
  770 + temp.put("lc", childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage());
  771 + if(childTaskPlan.getStartDate() != null && childTaskPlan.getEndDate() != null){
  772 + String[] split1 = childTaskPlan.getStartDate().split(":");
  773 + Long fcsj = Long.valueOf(split1[0])*60 + Long.valueOf(split1[1]);
  774 + temp.put("fcsj", fcsj);
  775 + String[] split2 = childTaskPlan.getEndDate().split(":");
  776 + Long zdsj = Long.valueOf(split2[0])*60 + Long.valueOf(split2[1]);
  777 + temp.put("zdsj", zdsj);
  778 + }else{
  779 + temp.put("zdsj", null);
  780 + temp.put("fcsj", null);
  781 + }
  782 + }
  783 + mapList.add(temp);
419 } 784 }
  785 + }else{
  786 + m.put("lc", schedule.getJhlc()==null?0:schedule.getJhlc());
  787 + if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null && schedule.getStatus() != -1){
  788 + String[] split1 = schedule.getFcsjActual().split(":");
  789 + Long fcsj = Long.valueOf(split1[0])*60 + Long.valueOf(split1[1]);
  790 + schedule.setFcsjActualTime(fcsj);
  791 + m.put("fcsj", fcsj);
  792 + String[] split2 = schedule.getZdsjActual().split(":");
  793 + Long zdsj = Long.valueOf(split2[0])*60 + Long.valueOf(split2[1]);
  794 + schedule.setZdsjActualTime(zdsj);
  795 + m.put("zdsj", zdsj);
  796 + }else{
  797 + m.put("zdsj", null);
  798 + m.put("fcsj", null);
  799 + }
  800 + mapList.add(m);
  801 + }
  802 + }
  803 + for(int i = 1; i < mapList.size(); i++){
  804 + Map<String, Object> m1 = mapList.get(i - 1);
  805 + Map<String, Object> m2 = mapList.get(i);
  806 + if(m1.get("fcsj") != null && m2.get("fcsj") != null){
  807 + sjyysj += Long.valueOf(m2.get("fcsj").toString()) - Long.valueOf(m1.get("fcsj").toString());
  808 + }
  809 + if(m2.get("fcsj") != null){
  810 + long zdsj = Long.valueOf(m2.get("zdsj").toString());
  811 + long fcsj = Long.valueOf(m2.get("fcsj").toString());
  812 + if(fcsj > zdsj)
  813 + zdsj += 1440l;
  814 + sjyssj += zdsj - fcsj;
  815 + sjlc += Double.valueOf(m2.get("lc").toString());
  816 + }
  817 + if(i == 1 && m1.get("fcsj") != null){
  818 + long zdsj = Long.valueOf(m1.get("zdsj").toString());
  819 + long fcsj = Long.valueOf(m1.get("fcsj").toString());
  820 + if(fcsj > zdsj)
  821 + zdsj += 1440l;
  822 + sjyssj += zdsj - fcsj;
  823 + sjlc += Double.valueOf(m1.get("lc").toString());
420 } 824 }
421 } 825 }
422 - if(startTime != endTime)  
423 - tempMap.put("date", startDate + "--" + endDate);  
424 - else  
425 - tempMap.put("date", startDate);  
426 - tempMap.put("times", times);  
427 - String[] keys = key.split("/");  
428 - tempMap.put("line", keys[0]);  
429 - tempMap.put("lp", keys[1]);  
430 - tempMap.put("zdz", keys[2]);  
431 tempMap.put("company", companyName); 826 tempMap.put("company", companyName);
432 tempMap.put("subCompany", subCompanyName); 827 tempMap.put("subCompany", subCompanyName);
  828 + String[] split = key.split("/");
  829 + tempMap.put("date", split[0]);
  830 + tempMap.put("line", split[1]);
  831 + tempMap.put("lp", split[2]);
  832 + tempMap.put("jhlc", jhlc);
  833 + tempMap.put("sjlc", sjlc);
  834 +
  835 + if(jhyysj == 0){
  836 + tempMap.put("jhyysj", "0");
  837 + tempMap.put("jhyycs", "0");
  838 + } else {
  839 + tempMap.put("jhyysj", df.format((float)jhyysj / 60));
  840 + tempMap.put("jhyycs", df.format(jhlc == 0 ? 0 : jhlc / jhyysj * 60));
  841 + }
433 842
434 - tempMap.put("yysj", (yysj/60) + "小时" + (yysj%60) + "分钟");  
435 - yysjSum += yysj;  
436 - if(yyNum != 0){  
437 - tempMap.put("yysd", df.format((yysd/yyNum)*60) + "公里/小时");  
438 - yysdSum += Double.valueOf(df.format((yysd/yyNum)*60)); 843 + if(jhyssj == 0){
  844 + tempMap.put("jhyssj", "0");
  845 + tempMap.put("jhyscs", "0");
439 } else { 846 } else {
440 - tempMap.put("yysd", "/"); 847 + tempMap.put("jhyssj", df.format((float)jhyssj / 60));
  848 + tempMap.put("jhyscs", df.format(jhlc == 0 ? 0 : jhlc / jhyssj * 60));
441 } 849 }
442 850
443 - tempMap.put("yssj", (yssj/60) + "小时" + (yssj%60) + "分钟");  
444 - yssjSum += yssj;  
445 - if(ysNum != 0){  
446 - tempMap.put("yssd", df.format((yssd/ysNum)*60) + "公里/小时");  
447 - yssdSum += Double.valueOf(df.format((yssd/ysNum)*60)); 851 + if(sjyysj == 0){
  852 + tempMap.put("sjyysj", "0");
  853 + tempMap.put("sjyycs", "0");
448 } else { 854 } else {
449 - tempMap.put("yssd", "/"); 855 + tempMap.put("sjyysj", df.format((float)sjyysj / 60));
  856 + tempMap.put("sjyycs", df.format(sjlc == 0 ? 0 : sjlc / sjyysj * 60));
450 } 857 }
451 858
452 - dateList.add(tempMap); 859 + if(sjyssj == 0){
  860 + tempMap.put("sjyssj", "0");
  861 + tempMap.put("sjyscs", "0");
  862 + } else {
  863 + tempMap.put("sjyssj", df.format((float)sjyssj / 60));
  864 + tempMap.put("sjyscs", df.format(sjlc == 0 ? 0 : sjlc / sjyssj * 60));
  865 + }
  866 + resList.add(tempMap);
453 } 867 }
454 - int size = keyMap.keySet().size();  
455 - size = size == 0 ? 1 : size;  
456 - modelMap.put("yysj", (yysjSum/size)/60 + "小时" + (yysjSum/size)%60 + "分钟");  
457 - modelMap.put("yysd", df.format(yysdSum/size) + "公里/小时");  
458 - modelMap.put("yssj", (yssjSum/size)/60 + "小时" + (yssjSum/size)%60 + "分钟");  
459 - modelMap.put("yssd", df.format(yssdSum/size) + "公里/小时");  
460 -  
461 Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>(); 868 Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>();
462 - for(Map<String, Object> m : dateList){  
463 - String key = m.get("line").toString(); 869 + for(Map<String, Object> m : resList){
  870 + String key = m.get("line").toString() + "/" + m.get("lp").toString();
464 if(!keyMap2.containsKey(key)) 871 if(!keyMap2.containsKey(key))
465 keyMap2.put(key, new ArrayList<Map<String, Object>>()); 872 keyMap2.put(key, new ArrayList<Map<String, Object>>());
466 keyMap2.get(key).add(m); 873 keyMap2.get(key).add(m);
467 } 874 }
468 - for(String key : keyMap2.keySet()){  
469 - List<Integer> keyList = new ArrayList<Integer>();  
470 - Map<Integer, List<Map<String, Object>>> temp = new HashMap<Integer, List<Map<String,Object>>>();  
471 - for(Map<String, Object> m : keyMap2.get(key)){  
472 - String lp = m.get("lp").toString();  
473 - String str = "";  
474 - for(int i = 0; i < lp.length(); i++){  
475 - str += (int)lp.charAt(i); 875 + Set<String> keySet = keyMap2.keySet();
  876 + List<String> list3 = new ArrayList<String>();
  877 + List<Map<String, Object>> list4 = new ArrayList<Map<String, Object>>();
  878 + list3.addAll(keySet);
  879 + Collections.sort(list3, new Comparator<String>() {
  880 +
  881 + public int compare(String o1, String o2) {
  882 +
  883 + Long a = 0l;
  884 + Long b = 0l;
  885 + String[] split1 = o1.split("/");
  886 + String[] split2 = o2.split("/");
  887 + char[] charArray1 = split1[1].toCharArray();
  888 + char[] charArray2 = split2[1].toCharArray();
  889 + for(int i = 0; i < charArray1.length; i++){
  890 + long temp = 1l;
  891 + for(int j = 0; j < i; j++)
  892 + temp *= 10;
  893 + a += (long)charArray1[charArray1.length - 1 - i] * temp;
476 } 894 }
477 - Integer num = Integer.valueOf(str)*10+Integer.valueOf(m.get("xlDir").toString());  
478 - if(!temp.containsKey(num)){  
479 - temp.put(num, new ArrayList<Map<String, Object>>());  
480 - keyList.add(num); 895 + for(int i = 0; i < charArray2.length; i++){
  896 + long temp = 1l;
  897 + for(int j = 0; j < i; j++)
  898 + temp *= 10;
  899 + b += (long)charArray2[charArray2.length - 1 - i] * temp;
481 } 900 }
482 - temp.get(num).add(m); 901 +
  902 + return a.compareTo(b);
483 } 903 }
484 - Collections.sort(keyList);  
485 - for(Integer lp : keyList){  
486 - List<Map<String, Object>> tempList = temp.get(lp);  
487 - for(Map<String, Object> m : tempList){  
488 - resList.add(m); 904 + });
  905 + Collections.sort(list3, new Comparator<String>() {
  906 +
  907 + public int compare(String o1, String o2) {
  908 +
  909 + Long a = 0l;
  910 + Long b = 0l;
  911 + String[] split1 = o1.split("/");
  912 + String[] split2 = o2.split("/");
  913 + char[] charArray1 = split1[0].toCharArray();
  914 + char[] charArray2 = split2[0].toCharArray();
  915 + for(int i = 0; i < charArray1.length; i++){
  916 + long temp = 1l;
  917 + for(int j = 0; j < i; j++)
  918 + temp *= 10;
  919 + a += (long)charArray1[charArray1.length - 1 - i] * temp;
  920 + }
  921 + for(int i = 0; i < charArray2.length; i++){
  922 + long temp = 1l;
  923 + for(int j = 0; j < i; j++)
  924 + temp *= 10;
  925 + b += (long)charArray2[charArray2.length - 1 - i] * temp;
  926 + }
  927 +
  928 + return a.compareTo(b);
  929 + }
  930 + });
  931 + for(String key : list3){
  932 + Map<String, Object> tempMap = new HashMap<String, Object>();
  933 + BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0);
  934 + BigDecimal jhyycs = new BigDecimal(0), jhyscs = new BigDecimal(0);
  935 + BigDecimal sjyysj = new BigDecimal(0), sjyssj = new BigDecimal(0);
  936 + BigDecimal sjyycs = new BigDecimal(0), sjyscs = new BigDecimal(0);
  937 + for(Map<String, Object> m : keyMap2.get(key)){
  938 + jhyysj = jhyysj.add(new BigDecimal(m.get("jhyysj").toString()));
  939 + jhyssj = jhyssj.add(new BigDecimal(m.get("jhyssj").toString()));
  940 + jhyycs = jhyycs.add(new BigDecimal(m.get("jhyycs").toString()));
  941 + jhyscs = jhyscs.add(new BigDecimal(m.get("jhyscs").toString()));
  942 + sjyysj = sjyysj.add(new BigDecimal(m.get("sjyysj").toString()));
  943 + sjyssj = sjyssj.add(new BigDecimal(m.get("sjyssj").toString()));
  944 + sjyycs = sjyycs.add(new BigDecimal(m.get("sjyycs").toString()));
  945 + sjyscs = sjyscs.add(new BigDecimal(m.get("sjyscs").toString()));
  946 + }
  947 + BigDecimal size = new BigDecimal(keyMap2.get(key).size());
  948 + tempMap.put("jhyysj", jhyysj.equals(0)?0:jhyysj.divide(size, 2, RoundingMode.HALF_UP));
  949 + tempMap.put("jhyssj", jhyssj.equals(0)?0:jhyssj.divide(size, 2, RoundingMode.HALF_UP));
  950 + tempMap.put("jhyycs", jhyycs.equals(0)?0:jhyycs.divide(size, 2, RoundingMode.HALF_UP));
  951 + tempMap.put("jhyscs", jhyscs.equals(0)?0:jhyscs.divide(size, 2, RoundingMode.HALF_UP));
  952 + tempMap.put("sjyysj", sjyysj.equals(0)?0:sjyysj.divide(size, 2, RoundingMode.HALF_UP));
  953 + tempMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP));
  954 + tempMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP));
  955 + tempMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP));
  956 + String[] split = key.split("/");
  957 + tempMap.put("line", split[0]);
  958 + tempMap.put("lp", split[1]);
  959 + tempMap.put("company", companyName);
  960 + tempMap.put("subCompany", subCompanyName);
  961 + tempMap.put("date", date);
  962 + list4.add(tempMap);
  963 + }
  964 + modelMap.put("dataList", list4);
  965 +
  966 + if(statu.equals("0")){
  967 + Map<String, List<Map<String, Object>>> keyMap4 = new HashMap<String, List<Map<String, Object>>>();
  968 + List<Map<String, Object>> list5 = new ArrayList<Map<String, Object>>();
  969 + List<String> keyList = new ArrayList<String>();
  970 + for(Map<String, Object> m : list4){
  971 + String key = m.get("line").toString();
  972 + if(!keyMap4.containsKey(key)){
  973 + keyList.add(key);
  974 + keyMap4.put(key, new ArrayList<Map<String, Object>>());
489 } 975 }
  976 + keyMap4.get(key).add(m);
  977 + }
  978 + for(String key : keyList){
  979 + Map<String, Object> tempMap = new HashMap<String, Object>();
  980 + BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0);
  981 + BigDecimal jhyycs = new BigDecimal(0), jhyscs = new BigDecimal(0);
  982 + BigDecimal sjyysj = new BigDecimal(0), sjyssj = new BigDecimal(0);
  983 + BigDecimal sjyycs = new BigDecimal(0), sjyscs = new BigDecimal(0);
  984 + for(Map<String, Object> m : keyMap4.get(key)){
  985 + jhyysj = jhyysj.add(new BigDecimal(m.get("jhyysj").toString()));
  986 + jhyssj = jhyssj.add(new BigDecimal(m.get("jhyssj").toString()));
  987 + jhyycs = jhyycs.add(new BigDecimal(m.get("jhyycs").toString()));
  988 + jhyscs = jhyscs.add(new BigDecimal(m.get("jhyscs").toString()));
  989 + sjyysj = sjyysj.add(new BigDecimal(m.get("sjyysj").toString()));
  990 + sjyssj = sjyssj.add(new BigDecimal(m.get("sjyssj").toString()));
  991 + sjyycs = sjyycs.add(new BigDecimal(m.get("sjyycs").toString()));
  992 + sjyscs = sjyscs.add(new BigDecimal(m.get("sjyscs").toString()));
  993 + }
  994 + BigDecimal size = new BigDecimal(keyMap4.get(key).size());
  995 + tempMap.put("jhyysj", jhyysj.equals(0)?0:jhyysj.divide(size, 2, RoundingMode.HALF_UP));
  996 + tempMap.put("jhyssj", jhyssj.equals(0)?0:jhyssj.divide(size, 2, RoundingMode.HALF_UP));
  997 + tempMap.put("jhyycs", jhyycs.equals(0)?0:jhyycs.divide(size, 2, RoundingMode.HALF_UP));
  998 + tempMap.put("jhyscs", jhyscs.equals(0)?0:jhyscs.divide(size, 2, RoundingMode.HALF_UP));
  999 + tempMap.put("sjyysj", sjyysj.equals(0)?0:sjyysj.divide(size, 2, RoundingMode.HALF_UP));
  1000 + tempMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP));
  1001 + tempMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP));
  1002 + tempMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP));
  1003 + tempMap.put("line", key);
  1004 + tempMap.put("lp", keyMap4.get(key).size());
  1005 + tempMap.put("company", companyName);
  1006 + tempMap.put("subCompany", subCompanyName);
  1007 + tempMap.put("date", date);
  1008 + tempMap.put("work", keyMap4.get(key));
  1009 + list5.add(tempMap);
  1010 + }
  1011 +
  1012 +
  1013 + modelMap.put("dataList", list5);
  1014 + }
  1015 + modelMap.put("statu", statu);
  1016 +
  1017 + dataList = (List<Map<String, Object>>)modelMap.get("dataList");
  1018 + if(dataList.size() != 0){
  1019 + BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0);
  1020 + BigDecimal jhyycs = new BigDecimal(0), jhyscs = new BigDecimal(0);
  1021 + BigDecimal sjyysj = new BigDecimal(0), sjyssj = new BigDecimal(0);
  1022 + BigDecimal sjyycs = new BigDecimal(0), sjyscs = new BigDecimal(0);
  1023 + for(Map<String, Object> m : dataList){
  1024 + jhyysj = jhyysj.add(new BigDecimal(m.get("jhyysj").toString()));
  1025 + jhyssj = jhyssj.add(new BigDecimal(m.get("jhyssj").toString()));
  1026 + jhyycs = jhyycs.add(new BigDecimal(m.get("jhyycs").toString()));
  1027 + jhyscs = jhyscs.add(new BigDecimal(m.get("jhyscs").toString()));
  1028 + sjyysj = sjyysj.add(new BigDecimal(m.get("sjyysj").toString()));
  1029 + sjyssj = sjyssj.add(new BigDecimal(m.get("sjyssj").toString()));
  1030 + sjyycs = sjyycs.add(new BigDecimal(m.get("sjyycs").toString()));
  1031 + sjyscs = sjyscs.add(new BigDecimal(m.get("sjyscs").toString()));
490 } 1032 }
  1033 + BigDecimal size = new BigDecimal(dataList.size());
  1034 + modelMap.put("jhyysj", jhyysj.equals(0)?0:jhyysj.divide(size, 2, RoundingMode.HALF_UP));
  1035 + modelMap.put("jhyssj", jhyssj.equals(0)?0:jhyssj.divide(size, 2, RoundingMode.HALF_UP));
  1036 + modelMap.put("jhyycs", jhyycs.equals(0)?0:jhyycs.divide(size, 2, RoundingMode.HALF_UP));
  1037 + modelMap.put("jhyscs", jhyscs.equals(0)?0:jhyscs.divide(size, 2, RoundingMode.HALF_UP));
  1038 + modelMap.put("sjyysj", sjyysj.equals(0)?0:sjyysj.divide(size, 2, RoundingMode.HALF_UP));
  1039 + modelMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP));
  1040 + modelMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP));
  1041 + modelMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP));
  1042 + modelMap.put("company", companyName);
  1043 + modelMap.put("subCompany", subCompanyName);
  1044 + modelMap.put("dataList", dataList);
491 } 1045 }
492 1046
493 - modelMap.put("dateList", resList);  
494 return modelMap; 1047 return modelMap;
495 } 1048 }
496 1049
@@ -523,7 +1076,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -523,7 +1076,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
523 times = "06:00-07:00"; 1076 times = "06:00-07:00";
524 } 1077 }
525 1078
526 - list = getSchedule(company, subCompany, line, startDate, endDate, model, times); 1079 + list = getSchedule(company, subCompany, line, startDate, endDate, model, times, true);
527 1080
528 String[] date1 = startDate.split("-"); 1081 String[] date1 = startDate.split("-");
529 String[] date2 = endDate.split("-"); 1082 String[] date2 = endDate.split("-");
@@ -534,7 +1087,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -534,7 +1087,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
534 int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); 1087 int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
535 int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); 1088 int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
536 1089
537 -  
538 for(ScheduleRealInfo schedule : list){ 1090 for(ScheduleRealInfo schedule : list){
539 if(qdzName.length() != 0 && !qdzName.equals(schedule.getQdzName())){ 1091 if(qdzName.length() != 0 && !qdzName.equals(schedule.getQdzName())){
540 continue; 1092 continue;
@@ -550,26 +1102,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -550,26 +1102,11 @@ public class BusIntervalServiceImpl implements BusIntervalService {
550 } 1102 }
551 for(String key : keyMap.keySet()){ 1103 for(String key : keyMap.keySet()){
552 Map<String, Object> tempMap = new HashMap<String, Object>(); 1104 Map<String, Object> tempMap = new HashMap<String, Object>();
553 - int jhbc = 0;  
554 - int sjbc = 0;  
555 - int kbc = 0;  
556 - int mbc = 0;  
557 - long jhdf = 0l;  
558 - long sjdf = 0l;  
559 - long wddf1 = 0l;  
560 - long wddf2 = 0l;  
561 - long jhfc = 0l;  
562 - long sjfc = 0l;  
563 - long wdfc1 = 0l;  
564 - long wdfc2 = 0l;  
565 - long jhys = 0l;  
566 - long sjys = 0l;  
567 - long yssjMax = 0l;  
568 - long yssjMin = 0l;  
569 - long jhtz = 0l;  
570 - long sjtz = 0l;  
571 - long tzsjMax = 0l;  
572 - long tzsjMin = 0l; 1105 + int jhbc = 0, sjbc = 0, kbc = 0, mbc = 0;
  1106 + long jhdf = 0l, sjdf = 0l, wddf1 = 0l, wddf2 = 0l;
  1107 + long jhfc = 0l, sjfc = 0l, wdfc1 = 0l, wdfc2 = 0l;
  1108 + long jhys = 0l, sjys = 0l, yssjMax = 0l, yssjMin = 0l;
  1109 + long jhtz = 0l, sjtz = 0l, tzsjMax = 0l, tzsjMin = 0l;
573 String companyName = "", subCompanyName = ""; 1110 String companyName = "", subCompanyName = "";
574 for(ScheduleRealInfo schedule : keyMap.get(key)){ 1111 for(ScheduleRealInfo schedule : keyMap.get(key)){
575 if(schedule.getGsName() != null && companyName.length() == 0) 1112 if(schedule.getGsName() != null && companyName.length() == 0)
@@ -776,7 +1313,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -776,7 +1313,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
776 1313
777 return resList; 1314 return resList;
778 } 1315 }
779 - 1316 +
780 @Override 1317 @Override
781 public List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map) { 1318 public List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map) {
782 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 1319 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
@@ -802,7 +1339,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -802,7 +1339,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
802 times = "06:00-07:00"; 1339 times = "06:00-07:00";
803 } 1340 }
804 1341
805 - list = getSchedule(company, subCompany, line, startDate, endDate, model, times); 1342 + list = getSchedule(company, subCompany, line, startDate, endDate, model, times, true);
806 1343
807 String[] date1 = startDate.split("-"); 1344 String[] date1 = startDate.split("-");
808 String[] date2 = endDate.split("-"); 1345 String[] date2 = endDate.split("-");
@@ -974,9 +1511,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -974,9 +1511,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
974 if(company.length() != 0){ 1511 if(company.length() != 0){
975 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; 1512 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
976 } 1513 }
977 - sql += " and bc_type = 'normal'"; 1514 + sql += " and bc_type != 'in' and bc_type != 'out'";
978 1515
979 - list =jdbcTemplate.query(sql, 1516 + list = jdbcTemplate.query(sql,
980 new RowMapper<ScheduleRealInfo>(){ 1517 new RowMapper<ScheduleRealInfo>(){
981 @Override 1518 @Override
982 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { 1519 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
src/main/resources/static/pages/forms/statement/busInterval.html
@@ -31,40 +31,47 @@ @@ -31,40 +31,47 @@
31 <form id="history" class="form-inline" action=""> 31 <form id="history" class="form-inline" action="">
32 <div style="display: inline-block; margin-left: 33px;" id="company1"> 32 <div style="display: inline-block; margin-left: 33px;" id="company1">
33 <span class="item-label" style="width: 80px;">公司: </span> 33 <span class="item-label" style="width: 80px;">公司: </span>
34 - <select class="form-control" name="company" id="company" style="width: 180px;"></select> 34 + <select class="form-control" name="company" id="company" style="width: 140px;"></select>
35 </div> 35 </div>
36 <div style="display: inline-block; margin-left: 24px;" id="subCompany1"> 36 <div style="display: inline-block; margin-left: 24px;" id="subCompany1">
37 <span class="item-label" style="width: 80px;">分公司: </span> 37 <span class="item-label" style="width: 80px;">分公司: </span>
38 - <select class="form-control" name="subCompany" id="subCompany" style="width: 180px;"></select> 38 + <select class="form-control" name="subCompany" id="subCompany" style="width: 140px;"></select>
39 </div> 39 </div>
40 - <div style="display: inline-block; margin-left: 24px;"> 40 + <div style="display: inline-block; margin-left: 10px;">
41 <span class="item-label" style="width: 80px;">线路: </span> 41 <span class="item-label" style="width: 80px;">线路: </span>
42 - <select class="form-control" name="line" id="line" style="width: 180px;"></select> 42 + <select class="form-control" name="statu" id="statu" style="width: 140px;">
  43 + <option value="0">多线</option>
  44 + <option value="1">单线</option>
  45 + </select>
  46 + </div>
  47 + <div style="display: inline-block; margin-left: 0px;" id="line1">
  48 + <span class="item-label" style="width: 80px;"> - </span>
  49 + <select class="form-control" name="line" id="line" style="width: 140px;"/>
43 </div> 50 </div>
44 <div style="display: inline-block; margin-left: 10px"> 51 <div style="display: inline-block; margin-left: 10px">
45 <span class="item-label" style="width: 80px;">时刻类型: </span> 52 <span class="item-label" style="width: 80px;">时刻类型: </span>
46 - <select class="form-control" name="model" id="model" style="width: 180px;"> 53 + <select class="form-control" name="model" id="model" style="width: 165px;">
47 <option value="">请选择...</option> 54 <option value="">请选择...</option>
48 </select> 55 </select>
49 </div> 56 </div>
50 <div style="margin-top: 10px"></div> 57 <div style="margin-top: 10px"></div>
51 <div style="display: inline-block;margin-left: 5px;"> 58 <div style="display: inline-block;margin-left: 5px;">
52 <span class="item-label" style="width: 80px;">开始时间: </span> 59 <span class="item-label" style="width: 80px;">开始时间: </span>
53 - <input class="form-control" type="text" id="startDate" style="width: 180px;"/> 60 + <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
54 </div> 61 </div>
55 <div style="display: inline-block;margin-left: 10px;"> 62 <div style="display: inline-block;margin-left: 10px;">
56 <span class="item-label" style="width: 80px;">结束时间: </span> 63 <span class="item-label" style="width: 80px;">结束时间: </span>
57 - <input class="form-control" type="text" id="endDate" style="width: 180px;"/> 64 + <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
58 </div> 65 </div>
59 - <div style="display: inline-block;margin-left: 10px;">  
60 - <span class="item-label" style="width: 80px;">时间段: </span>  
61 - <input class="form-control" type="text" id="times1" style="width: 80px;"/>  
62 - </div>  
63 - <div style="display: inline-block;">  
64 - <span class="item-label" style="width: 80px;"> - </span>  
65 - <input class="form-control" type="text" id="times2" style="width: 80px;"/>  
66 - </div>  
67 - <div class="form-group" style="margin-left: 10px"> 66 +<!-- <div style="display: inline-block;margin-left: 10px;"> -->
  67 +<!-- <span class="item-label" style="width: 80px;">时间段: </span> -->
  68 +<!-- <input class="form-control" type="text" id="times1" style="width: 80px;"/> -->
  69 +<!-- </div> -->
  70 +<!-- <div style="display: inline-block;"> -->
  71 +<!-- <span class="item-label" style="width: 80px;"> - </span> -->
  72 +<!-- <input class="form-control" type="text" id="times2" style="width: 80px;"/> -->
  73 +<!-- </div> -->
  74 + <div class="form-group" style="margin-left: 14px">
68 <input class="btn btn-default" type="button" id="query" value="筛选"/> 75 <input class="btn btn-default" type="button" id="query" value="筛选"/>
69 <!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> 76 <!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
70 </div> 77 </div>
@@ -74,17 +81,7 @@ @@ -74,17 +81,7 @@
74 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> 81 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
75 <table class="table table-bordered table-hover table-checkable" id="forms"> 82 <table class="table table-bordered table-hover table-checkable" id="forms">
76 <thead> 83 <thead>
77 - <tr class="hidden">  
78 - <th>日期</th>  
79 - <th>时段</th>  
80 - <th>公司</th>  
81 - <th>分公司</th>  
82 - <th>线路</th>  
83 - <th>起讫站</th>  
84 - <th>计划车距(分钟)</th>  
85 - <th>实际车距(分钟)</th>  
86 - <th>误差值</th>  
87 - </tr> 84 +
88 </thead> 85 </thead>
89 <tbody> 86 <tbody>
90 87
@@ -115,14 +112,14 @@ @@ -115,14 +112,14 @@
115 locale : 'zh-cn' 112 locale : 'zh-cn'
116 }); 113 });
117 114
118 - $("#times1").datetimepicker({  
119 - format : 'HH:mm',  
120 - locale : 'zh-cn'  
121 - });  
122 - $("#times2").datetimepicker({  
123 - format : 'HH:mm',  
124 - locale : 'zh-cn'  
125 - }); 115 +// $("#times1").datetimepicker({
  116 +// format : 'HH:mm',
  117 +// locale : 'zh-cn'
  118 +// });
  119 +// $("#times2").datetimepicker({
  120 +// format : 'HH:mm',
  121 +// locale : 'zh-cn'
  122 +// });
126 123
127 var d = new Date(); 124 var d = new Date();
128 var year = d.getFullYear(); 125 var year = d.getFullYear();
@@ -135,8 +132,8 @@ @@ -135,8 +132,8 @@
135 $("#startDate").val(year + "-" + month + "-" + day); 132 $("#startDate").val(year + "-" + month + "-" + day);
136 $("#endDate").val(year + "-" + month + "-" + day); 133 $("#endDate").val(year + "-" + month + "-" + day);
137 134
138 - $("#times1").val("06:00");  
139 - $("#times2").val("07:00"); 135 +// $("#times1").val("06:00");
  136 +// $("#times2").val("07:00");
140 137
141 var obj = []; 138 var obj = [];
142 $.get('/user/companyData', function(result){ 139 $.get('/user/companyData', function(result){
@@ -170,14 +167,15 @@ @@ -170,14 +167,15 @@
170 167
171 $.get('/basic/lineCode2Name',function(result){ 168 $.get('/basic/lineCode2Name',function(result){
172 var data=[]; 169 var data=[];
173 - data.push({id:" ", text:"全部线路"}); 170 +// data.push({id:" ", text:"全部线路"});
174 for(var code in result){ 171 for(var code in result){
175 data.push({id: code, text: result[code]}); 172 data.push({id: code, text: result[code]});
176 } 173 }
177 console.log(data); 174 console.log(data);
178 initPinYinSelect2('#line',data,''); 175 initPinYinSelect2('#line',data,'');
179 176
180 - line = ""; 177 +// line = "";
  178 + line = data[0].id;
181 updateModel(); 179 updateModel();
182 }) 180 })
183 181
@@ -223,10 +221,11 @@ @@ -223,10 +221,11 @@
223 $("#query").on("click",jsDoQuery); 221 $("#query").on("click",jsDoQuery);
224 222
225 var line = $("#line").val(); 223 var line = $("#line").val();
  224 + var statu = $("#statu").val();
226 var startDate = $("#startDate").val(); 225 var startDate = $("#startDate").val();
227 var endDate = $("#endDate").val(); 226 var endDate = $("#endDate").val();
228 var model = $("#model").val(); 227 var model = $("#model").val();
229 - var times = $("#times1").val() + "-" + $("#times2").val(); 228 +// var times = $("#times1").val() + "-" + $("#times2").val();
230 var company = $("#company").val(); 229 var company = $("#company").val();
231 var subCompany = $("#subCompany").val(); 230 var subCompany = $("#subCompany").val();
232 function jsDoQuery(pagination){ 231 function jsDoQuery(pagination){
@@ -235,23 +234,24 @@ @@ -235,23 +234,24 @@
235 startDate = $("#startDate").val(); 234 startDate = $("#startDate").val();
236 endDate = $("#endDate").val(); 235 endDate = $("#endDate").val();
237 model = $("#model").val(); 236 model = $("#model").val();
238 - times = $("#times1").val() + "-" + $("#times2").val(); 237 +// times = $("#times1").val() + "-" + $("#times2").val();
239 company = $("#company").val(); 238 company = $("#company").val();
240 subCompany = $("#subCompany").val(); 239 subCompany = $("#subCompany").val();
241 params['line'] = line; 240 params['line'] = line;
  241 + params['statu'] = statu;
242 params['startDate'] = startDate; 242 params['startDate'] = startDate;
243 params['endDate'] = endDate; 243 params['endDate'] = endDate;
244 params['model'] = model; 244 params['model'] = model;
245 - params['times'] = times; 245 +// params['times'] = times;
246 params['company'] = company; 246 params['company'] = company;
247 params['subCompany'] = subCompany; 247 params['subCompany'] = subCompany;
248 params['type'] = "query"; 248 params['type'] = "query";
249 - $(".hidden").removeClass("hidden"); 249 +// $(".hidden").removeClass("hidden");
250 $get('/busInterval/interval', params, function(result){ 250 $get('/busInterval/interval', params, function(result){
251 // 把数据填充到模版中 251 // 把数据填充到模版中
252 - var tbodyHtml = template('list_workDaily',{list:result}); 252 + var tbodyHtml = template('list_workDaily',{list:result,statu:statu});
253 // 把渲染好的模版html文本追加到表格中 253 // 把渲染好的模版html文本追加到表格中
254 - $('#forms tbody').html(tbodyHtml); 254 + $('#forms').html(tbodyHtml);
255 _w_table_rowspan("#forms tbody", 1); 255 _w_table_rowspan("#forms tbody", 1);
256 _w_table_rowspan("#forms tbody", 2); 256 _w_table_rowspan("#forms tbody", 2);
257 _w_table_rowspan("#forms tbody", 3); 257 _w_table_rowspan("#forms tbody", 3);
@@ -266,12 +266,25 @@ @@ -266,12 +266,25 @@
266 // window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD")); 266 // window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD"));
267 // }); 267 // });
268 // }); 268 // });
269 -  
270 - 269 +
  270 +
  271 + $("#lp1").hide();
  272 + $("#line1").hide();
  273 + $("#statu").on("change", function(){
  274 + statu = $("#statu").val();
  275 + if(statu == 0){
  276 + $("#line1").hide();
  277 + $("#lp1").hide();
  278 + }else{
  279 + $("#line1").show();
  280 + $("#lp1").show();
  281 + }
  282 + updateModel();
  283 + });
271 $("#line").on("change", function(){ 284 $("#line").on("change", function(){
272 line = $("#line").val(); 285 line = $("#line").val();
273 - if(line == " ")  
274 - line = ""; 286 +// if(line == " ")
  287 +// line = "";
275 updateModel(); 288 updateModel();
276 }); 289 });
277 $('#startDate').on("blur", function(){ 290 $('#startDate').on("blur", function(){
@@ -292,7 +305,10 @@ @@ -292,7 +305,10 @@
292 flag = 1; 305 flag = 1;
293 var treeData = []; 306 var treeData = [];
294 var params = {}; 307 var params = {};
295 - params['line'] = line; 308 + if(statu == 0)
  309 + params['line'] = "";
  310 + if(statu == 1)
  311 + params['line'] = line;
296 params['startDate'] = startDate; 312 params['startDate'] = startDate;
297 params['endDate'] = endDate; 313 params['endDate'] = endDate;
298 $get('/pcpc/getModel', params, function(result){ 314 $get('/pcpc/getModel', params, function(result){
@@ -335,22 +351,45 @@ @@ -335,22 +351,45 @@
335 351
336 </script> 352 </script>
337 <script type="text/html" id="list_workDaily"> 353 <script type="text/html" id="list_workDaily">
  354 +<thead>
  355 + <tr>
  356 + <th>日期</th>
  357 + <th>公司</th>
  358 + <th>分公司</th>
  359 + <th>线路</th>
  360 + {{if statu == 1}}
  361 + <th>时段</th>
  362 + {{/if}}
  363 + <th>起讫站</th>
  364 + <th>计划车距(分钟)</th>
  365 + <th>实际车距(分钟)</th>
  366 + <th>最大车距(分钟)</th>
  367 + <th>最小车距(分钟)</th>
  368 + <th>误差值</th>
  369 + </tr>
  370 +</thead>
  371 +<tbody>
338 {{each list as obj i}} 372 {{each list as obj i}}
339 <tr> 373 <tr>
340 - <td style='text-align:center;vertical-align:middle;'>{{obj.date}}</td>  
341 - <td style='text-align:center;vertical-align:middle;'>{{obj.times}}</td> 374 + <td style='text-align:center;vertical-align:middle;' width='80px'>{{obj.date}}</td>
342 <td style='text-align:center;vertical-align:middle;'>{{obj.company}}</td> 375 <td style='text-align:center;vertical-align:middle;'>{{obj.company}}</td>
343 <td style='text-align:center;vertical-align:middle;'>{{obj.subCompany}}</td> 376 <td style='text-align:center;vertical-align:middle;'>{{obj.subCompany}}</td>
344 <td style='text-align:center;vertical-align:middle;'>{{obj.line}}</td> 377 <td style='text-align:center;vertical-align:middle;'>{{obj.line}}</td>
  378 + {{if statu == 1}}
  379 + <td style='text-align:center;vertical-align:middle;'>{{obj.times}}</td>
  380 + {{/if}}
345 <td>{{obj.qdz}}</td> 381 <td>{{obj.qdz}}</td>
346 <td>{{obj.jhInterval}}</td> 382 <td>{{obj.jhInterval}}</td>
347 <td>{{obj.sjInterval}}</td> 383 <td>{{obj.sjInterval}}</td>
  384 + <td>{{obj.MaxInterval}}</td>
  385 + <td>{{obj.MinInterval}}</td>
348 <td>{{obj.deviation}}</td> 386 <td>{{obj.deviation}}</td>
349 </tr> 387 </tr>
350 {{/each}} 388 {{/each}}
351 {{if list.length == 0}} 389 {{if list.length == 0}}
352 <tr> 390 <tr>
353 - <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td> 391 + <td colspan="11"><h6 class="muted">没有找到相关数据</h6></td>
354 </tr> 392 </tr>
355 {{/if}} 393 {{/if}}
  394 +</tbody>
356 </script> 395 </script>
357 \ No newline at end of file 396 \ No newline at end of file
src/main/resources/static/pages/forms/statement/timeAndSpeed.html
@@ -16,6 +16,13 @@ @@ -16,6 +16,13 @@
16 #forms > tbody > tr{ 16 #forms > tbody > tr{
17 background-color: #FFFFFF; 17 background-color: #FFFFFF;
18 } 18 }
  19 + #works > tbody > tr{
  20 + background-color: #FFFFFF;
  21 + }
  22 + tbody > tr > td{
  23 + text-align: center;
  24 + vertical-align: middle;
  25 + }
19 </style> 26 </style>
20 27
21 <div class="page-head"> 28 <div class="page-head">
@@ -37,16 +44,23 @@ @@ -37,16 +44,23 @@
37 <span class="item-label" style="width: 80px;">分公司: </span> 44 <span class="item-label" style="width: 80px;">分公司: </span>
38 <select class="form-control" name="subCompany" id="subCompany" style="width: 140px;"></select> 45 <select class="form-control" name="subCompany" id="subCompany" style="width: 140px;"></select>
39 </div> 46 </div>
40 - <div style="display: inline-block; margin-left: 24px;"> 47 + <div style="display: inline-block; margin-left: 10px;">
41 <span class="item-label" style="width: 80px;">线路: </span> 48 <span class="item-label" style="width: 80px;">线路: </span>
42 - <select class="form-control" name="line" id="line" style="width: 140px;"></select>  
43 - </div>  
44 - <div style="display: inline-block; margin-left: 8px;">  
45 - <span class="item-label" style="width: 80px;">方向: </span>  
46 - <select class="form-control" name="upDown" id="upDown" style="width: 140px;">  
47 - <option value="">请先选择线路</option> 49 + <select class="form-control" name="statu" id="statu" style="width: 140px;">
  50 + <option value="0">多线</option>
  51 + <option value="1">单线</option>
48 </select> 52 </select>
49 </div> 53 </div>
  54 + <div style="display: inline-block; margin-left: 0px;" id="line1">
  55 + <span class="item-label" style="width: 80px;"> - </span>
  56 + <select class="form-control" name="line" id="line" style="width: 140px;"/>
  57 + </div>
  58 +<!-- <div style="display: inline-block; margin-left: 8px;"> -->
  59 +<!-- <span class="item-label" style="width: 80px;">方向: </span> -->
  60 +<!-- <select class="form-control" name="upDown" id="upDown" style="width: 140px;"> -->
  61 +<!-- <option value="">请先选择线路</option> -->
  62 +<!-- </select> -->
  63 +<!-- </div> -->
50 <div style="display: inline-block; margin-left: 10px"> 64 <div style="display: inline-block; margin-left: 10px">
51 <span class="item-label" style="width: 80px;">时刻类型: </span> 65 <span class="item-label" style="width: 80px;">时刻类型: </span>
52 <select class="form-control" name="model" id="model" style="width: 165px;"> 66 <select class="form-control" name="model" id="model" style="width: 165px;">
@@ -62,15 +76,11 @@ @@ -62,15 +76,11 @@
62 <span class="item-label" style="width: 80px;">结束时间: </span> 76 <span class="item-label" style="width: 80px;">结束时间: </span>
63 <input class="form-control" type="text" id="endDate" style="width: 140px;"/> 77 <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
64 </div> 78 </div>
65 - <div style="display: inline-block; margin-left: 10px;">  
66 - <span class="item-label" style="width: 80px;">时间段: </span>  
67 - <input class="form-control" type="text" id="times1" style="width: 60px;"/> 79 + <div style="display: inline-block; margin-left: 10px" id="lp1">
  80 + <span class="item-label" style="width: 80px;">路牌: </span>
  81 + <select class="form-control" name="lp" id="lp" style="width: 140px;"></select>
68 </div> 82 </div>
69 - <div style="display: inline-block;">  
70 - <span class="item-label" style="width: 80px;"> - </span>  
71 - <input class="form-control" type="text" id="times2" style="width: 60px;"/>  
72 - </div>  
73 - <div class="form-group" style="margin-left: 10px"> 83 + <div class="form-group" style="margin-left: 14px">
74 <input class="btn btn-default" type="button" id="query" value="筛选"/> 84 <input class="btn btn-default" type="button" id="query" value="筛选"/>
75 <!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> 85 <!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
76 </div> 86 </div>
@@ -79,26 +89,20 @@ @@ -79,26 +89,20 @@
79 <div class="portlet-body"> 89 <div class="portlet-body">
80 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> 90 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
81 <table class="table table-bordered table-hover table-checkable" id="forms"> 91 <table class="table table-bordered table-hover table-checkable" id="forms">
82 - <thead>  
83 - <tr class="hidden">  
84 - <th>日期</th>  
85 - <th>时段</th>  
86 - <th>公司</th>  
87 - <th>分公司</th>  
88 - <th>线路</th>  
89 - <th>路牌</th>  
90 - <th>起讫站</th>  
91 - <th>行驶方向</th>  
92 - <th>营运时间(小时/分钟)</th>  
93 - <th>营运车速(公里/小时)</th>  
94 - <th>运送时间(小时/分钟)</th>  
95 - <th>运送车速(公里/小时)</th>  
96 - </tr>  
97 - </thead>  
98 - <tbody>  
99 -  
100 - </tbody>  
101 </table> 92 </table>
  93 + <div id="works_hidden" class="hidden">
  94 + <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
  95 + <span class="item-label" style="width: 80px;margin-left: 60px;">日期: </span>
  96 + <span class="item-label" style="width: 80px;" id="date0"></span>
  97 + <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span>
  98 + <span class="item-label" style="width: 80px;" id="company0"></span>
  99 + <span class="item-label" style="width: 80px;margin-left: 60px;">分公司: </span>
  100 + <span class="item-label" style="width: 80px;" id="subCompany0"></span>
  101 + <span class="item-label" style="width: 80px;margin-left: 60px;">线路: </span>
  102 + <span class="item-label" style="width: 80px;" id="line0"></span>
  103 + <table class="table table-bordered table-hover table-checkable" id="works">
  104 + </table>
  105 + </div>
102 <div style="text-align: right;"> 106 <div style="text-align: right;">
103 <ul id="pagination" class="pagination"></ul> 107 <ul id="pagination" class="pagination"></ul>
104 </div> 108 </div>
@@ -110,7 +114,7 @@ @@ -110,7 +114,7 @@
110 114
111 <script> 115 <script>
112 $(function(){ 116 $(function(){
113 - 117 +
114 // 关闭左侧栏 118 // 关闭左侧栏
115 if (!$('body').hasClass('page-sidebar-closed')) 119 if (!$('body').hasClass('page-sidebar-closed'))
116 $('.menu-toggler.sidebar-toggler').click(); 120 $('.menu-toggler.sidebar-toggler').click();
@@ -123,15 +127,7 @@ @@ -123,15 +127,7 @@
123 format : 'YYYY-MM-DD', 127 format : 'YYYY-MM-DD',
124 locale : 'zh-cn' 128 locale : 'zh-cn'
125 }); 129 });
126 - $("#times1").datetimepicker({  
127 - format : 'HH:mm',  
128 - locale : 'zh-cn'  
129 - });  
130 - $("#times2").datetimepicker({  
131 - format : 'HH:mm',  
132 - locale : 'zh-cn'  
133 - });  
134 - 130 +
135 var d = new Date(); 131 var d = new Date();
136 var year = d.getFullYear(); 132 var year = d.getFullYear();
137 var month = d.getMonth() + 1; 133 var month = d.getMonth() + 1;
@@ -142,10 +138,7 @@ @@ -142,10 +138,7 @@
142 day = "0" + day; 138 day = "0" + day;
143 $("#startDate").val(year + "-" + month + "-" + day); 139 $("#startDate").val(year + "-" + month + "-" + day);
144 $("#endDate").val(year + "-" + month + "-" + day); 140 $("#endDate").val(year + "-" + month + "-" + day);
145 -  
146 - $("#times1").val("06:00");  
147 - $("#times2").val("07:00");  
148 - 141 +
149 var obj = []; 142 var obj = [];
150 $.get('/user/companyData', function(result){ 143 $.get('/user/companyData', function(result){
151 obj = result; 144 obj = result;
@@ -179,71 +172,83 @@ @@ -179,71 +172,83 @@
179 $.get('/basic/lineCode2Name',function(result){ 172 $.get('/basic/lineCode2Name',function(result){
180 var data=[]; 173 var data=[];
181 174
182 - data.push({id: " ", text: "全部线路"});  
183 for(var code in result){ 175 for(var code in result){
184 data.push({id: code, text: result[code]}); 176 data.push({id: code, text: result[code]});
185 } 177 }
186 console.log(data); 178 console.log(data);
187 initPinYinSelect2('#line',data,''); 179 initPinYinSelect2('#line',data,'');
188 180
189 - line = "";  
190 - updateModel(); 181 + line = data[0].id;
191 182
192 - var params = {};  
193 - params['line'] = line;  
194 - $get('/busInterval/getDir', params, function(result){  
195 - dirData = createTreeData(result);  
196 - var options = '<option value="">全部方向</option>';;  
197 - $.each(dirData, function(i, g){  
198 - options += '<option value="'+g.name+'">'+g.name+'</option>';  
199 - });  
200 - $('#upDown').html(options);  
201 - }); 183 + updateModel();
  184 + updateLp("");
202 }) 185 })
203 186
204 $("#query").on("click", function (){ 187 $("#query").on("click", function (){
205 jsDoQuery(); 188 jsDoQuery();
206 }); 189 });
207 - 190 +
  191 + var list = [];
208 var line = $("#line").val(); 192 var line = $("#line").val();
  193 + var statu = $("#statu").val();
209 var startDate = $("#startDate").val(); 194 var startDate = $("#startDate").val();
210 var endDate = $("#endDate").val(); 195 var endDate = $("#endDate").val();
211 var model = $("#model").val(); 196 var model = $("#model").val();
212 - var times = $("#times1").val() + "-" + $("#times2").val();  
213 - var upDown = $("#upDown").val();  
214 var company = $("#company").val(); 197 var company = $("#company").val();
215 var subCompany = $("#subCompany").val(); 198 var subCompany = $("#subCompany").val();
  199 + var lp = $("#lp").val();
216 function jsDoQuery(pagination){ 200 function jsDoQuery(pagination){
217 var params = {}; 201 var params = {};
218 -// line = $("#line").val(); 202 + line = $("#line").val();
219 startDate = $("#startDate").val(); 203 startDate = $("#startDate").val();
220 endDate = $("#endDate").val(); 204 endDate = $("#endDate").val();
221 model = $("#model").val(); 205 model = $("#model").val();
222 - times = $("#times1").val() + "-" + $("#times2").val();  
223 - upDown = $("#upDown").val();  
224 company = $("#company").val(); 206 company = $("#company").val();
225 subCompany = $("#subCompany").val(); 207 subCompany = $("#subCompany").val();
  208 + lp = $("#lp").val();
  209 + params['lp'] = lp;
226 params['line'] = line; 210 params['line'] = line;
  211 + params['statu'] = statu;
227 params['startDate'] = startDate; 212 params['startDate'] = startDate;
228 params['endDate'] = endDate; 213 params['endDate'] = endDate;
229 params['model'] = model; 214 params['model'] = model;
230 - params['times'] = times;  
231 - params['upDown'] = upDown;  
232 params['company'] = company; 215 params['company'] = company;
233 params['subCompany'] = subCompany; 216 params['subCompany'] = subCompany;
234 params['type'] = "query"; 217 params['type'] = "query";
235 - $(".hidden").removeClass("hidden"); 218 +// $(".hidden").removeClass("hidden");
236 $get('/busInterval/timeAndSpeed', params, function(result){ 219 $get('/busInterval/timeAndSpeed', params, function(result){
237 // 把数据填充到模版中 220 // 把数据填充到模版中
238 - var tbodyHtml = template('list_timeAndSpeed',{list:result}); 221 + var tbodyHtml = template('list_timeAndSpeed', {list:result});
239 // 把渲染好的模版html文本追加到表格中 222 // 把渲染好的模版html文本追加到表格中
240 - $('#forms tbody').html(tbodyHtml);  
241 - _w_table_rowspan("#forms tbody", 1);  
242 - _w_table_rowspan("#forms tbody", 2);  
243 - _w_table_rowspan("#forms tbody", 3);  
244 - _w_table_rowspan("#forms tbody", 4);  
245 - _w_table_rowspan("#forms tbody", 5);  
246 - 223 + $('#forms').html(tbodyHtml);
  224 + list = result;
  225 + $("#works_hidden").addClass("hidden");
  226 +
  227 + _w_table_rowspan("#forms", 1);
  228 + _w_table_rowspan("#forms", 2);
  229 + _w_table_rowspan("#forms", 3);
  230 + _w_table_rowspan("#forms", 4);
  231 +
  232 + if(result.statu == 0)
  233 + $("#forms tbody").on("click", "a", function(){
  234 + var key = $(this).parent().prev().html();
  235 + $.each(list.dataList, function(i, g){
  236 + if(g.line == key){
  237 + var tbodyHtml = template('list_workList',{list:g});
  238 + $("#works_hidden").removeClass("hidden");
  239 + $("#date0").html(g.date);
  240 + $("#line0").html(g.line);
  241 + $("#company0").html(g.company);
  242 + $("#subCompany0").html(g.subCompany);
  243 + $("#works").html(tbodyHtml);
  244 +
  245 + _w_table_rowspan("#works", 1);
  246 + _w_table_rowspan("#works", 2);
  247 + _w_table_rowspan("#works", 3);
  248 + _w_table_rowspan("#works", 4);
  249 + }
  250 + });
  251 + });
247 }); 252 });
248 } 253 }
249 254
@@ -254,21 +259,28 @@ @@ -254,21 +259,28 @@
254 // }); 259 // });
255 260
256 261
  262 + $("#lp1").hide();
  263 + $("#line1").hide();
  264 + $("#statu").on("change", function(){
  265 + statu = $("#statu").val();
  266 + if(statu == 0){
  267 + $("#line1").hide();
  268 + $("#lp1").hide();
  269 + }else{
  270 + $("#line1").show();
  271 + $("#lp1").show();
  272 + updateLp("");
  273 + }
  274 + updateModel();
  275 + });
257 $("#line").on("change", function(){ 276 $("#line").on("change", function(){
258 line = $("#line").val(); 277 line = $("#line").val();
259 - if(line == " ")  
260 - line = "";  
261 updateModel(); 278 updateModel();
262 - var params = {};  
263 - params['line'] = line;  
264 - $get('/busInterval/getDir', params, function(result){  
265 - dirData = createTreeData(result);  
266 - var options = '<option value="">全部方向</option>';  
267 - $.each(dirData, function(i, g){  
268 - options += '<option value="'+g.name+'">'+g.name+'</option>';  
269 - });  
270 - $('#upDown').html(options);  
271 - }); 279 + updateLp("");
  280 + });
  281 + $("#model").on("change", function(){
  282 + model = $("#model").val();
  283 + updateLp(model);
272 }); 284 });
273 $('#startDate').on("blur", function(){ 285 $('#startDate').on("blur", function(){
274 startDate = $("#startDate").val(); 286 startDate = $("#startDate").val();
@@ -288,7 +300,10 @@ @@ -288,7 +300,10 @@
288 flag = 1; 300 flag = 1;
289 var treeData = []; 301 var treeData = [];
290 var params = {}; 302 var params = {};
291 - params['line'] = line; 303 + if(statu == 0)
  304 + params['line'] = "";
  305 + if(statu == 1)
  306 + params['line'] = line;
292 params['startDate'] = startDate; 307 params['startDate'] = startDate;
293 params['endDate'] = endDate; 308 params['endDate'] = endDate;
294 $get('/pcpc/getModel', params, function(result){ 309 $get('/pcpc/getModel', params, function(result){
@@ -297,11 +312,26 @@ @@ -297,11 +312,26 @@
297 $.each(treeData, function(i, g){ 312 $.each(treeData, function(i, g){
298 options += '<option value="'+g.id+'">'+g.name+'</option>'; 313 options += '<option value="'+g.id+'">'+g.name+'</option>';
299 }); 314 });
300 - $('#model').html(options)/* .select2() */; 315 + $('#model').html(options);
301 flag = 0; 316 flag = 0;
302 }); 317 });
303 } 318 }
304 319
  320 + function updateLp(ttId){
  321 + var treeData = [];
  322 + var params = {};
  323 + params['line'] = line;
  324 + params['ttId'] = ttId;
  325 + $get('/busInterval/getLp', params, function(result){
  326 + treeData = createTreeData(result);
  327 + var options = '<option value="">全部路牌</option>';
  328 + $.each(treeData, function(i, g){
  329 +// options += '<option value="'+g.id+'">'+g.name+'</option>';
  330 + options += '<option value="'+g.name+'">'+g.name+'</option>';
  331 + });
  332 + $('#lp').html(options);
  333 + });
  334 + }
305 335
306 function _w_table_rowspan(_w_table_id, _w_table_colnum){ 336 function _w_table_rowspan(_w_table_id, _w_table_colnum){
307 _w_table_firsttd = ""; 337 _w_table_firsttd = "";
@@ -330,35 +360,118 @@ @@ -330,35 +360,118 @@
330 }); 360 });
331 361
332 </script> 362 </script>
  363 +
333 <script type="text/html" id="list_timeAndSpeed"> 364 <script type="text/html" id="list_timeAndSpeed">
334 - {{each list.dateList as obj i}} 365 +<thead>
  366 + <tr>
  367 + <th width='80px'>日期</th>
  368 + <th style='text-align:center;'>公司</th>
  369 + <th style='text-align:center;'>分公司</th>
  370 + <th style='text-align:center;'>线路</th>
  371 + {{if list.statu == 0}}<th style='text-align:center;'>路牌数</th>{{/if}}
  372 + {{if list.statu == 1}}<th style='text-align:center;'>路牌</th>{{/if}}
  373 + <th>计划营运时间(小时)</th>
  374 + <th>计划营运车速(公里/小时)</th>
  375 + <th>实际营运时间(小时)</th>
  376 + <th>实际营运车速(公里/小时)</th>
  377 + <th>计划运送时间(小时)</th>
  378 + <th>计划运送车速(公里/小时)</th>
  379 + <th>实际运送时间(小时)</th>
  380 + <th>实际运送车速(公里/小时)</th>
  381 + </tr>
  382 +</thead>
  383 +<tbody>
  384 + {{each list.dataList as obj i}}
  385 + <tr>
  386 + <td style='vertical-align:middle;'>{{obj.date}}</td>
  387 + <td style='vertical-align:middle;'>{{obj.company}}</td>
  388 + <td style='vertical-align:middle;'>{{obj.subCompany}}</td>
  389 + <td style='vertical-align:middle;'>{{obj.line}}</td>
  390 + {{if list.statu == 0}}<td><a>{{obj.lp}}</a></td>{{/if}}
  391 + {{if list.statu == 1}}<td>{{obj.lp}}</td>{{/if}}
  392 + <td>{{obj.jhyysj}}</td>
  393 + <td>{{obj.jhyycs}}</td>
  394 + <td>{{obj.sjyysj}}</td>
  395 + <td>{{obj.sjyycs}}</td>
  396 + <td>{{obj.jhyssj}}</td>
  397 + <td>{{obj.jhyscs}}</td>
  398 + <td>{{obj.sjyssj}}</td>
  399 + <td>{{obj.sjyscs}}</td>
  400 + </tr>
  401 + {{/each}}
  402 + {{if list.dataList.length > 1}}
  403 + <tr>
  404 + <td style='vertical-align:middle;' colspan='5'>合计平均值</td>
  405 + <td>{{list.jhyysj}}</td>
  406 + <td>{{list.jhyycs}}</td>
  407 + <td>{{list.sjyysj}}</td>
  408 + <td>{{list.sjyycs}}</td>
  409 + <td>{{list.jhyssj}}</td>
  410 + <td>{{list.jhyscs}}</td>
  411 + <td>{{list.sjyssj}}</td>
  412 + <td>{{list.sjyscs}}</td>
  413 + </tr>
  414 + {{/if}}
  415 + {{if list.dataList.length == 0}}
  416 + <tr>
  417 + <td colspan="13"><h6 class="muted">没有找到相关数据</h6></td>
  418 + </tr>
  419 + {{/if}}
  420 +</tbody>
  421 +</script>
  422 +<script type="text/html" id="list_workList">
  423 +<thead>
  424 + <tr>
  425 + <th width='80px'>日期</th>
  426 + <th style='text-align:center;'>公司</th>
  427 + <th style='text-align:center;'>分公司</th>
  428 + <th style='text-align:center;'>线路</th>
  429 + <th style='text-align:center;'>路牌</th>
  430 + <th>计划营运时间(小时)</th>
  431 + <th>计划营运车速(公里/小时)</th>
  432 + <th>实际营运时间(小时)</th>
  433 + <th>实际营运车速(公里/小时)</th>
  434 + <th>计划运送时间(小时)</th>
  435 + <th>计划运送车速(公里/小时)</th>
  436 + <th>实际运送时间(小时)</th>
  437 + <th>实际运送车速(公里/小时)</th>
  438 + </tr>
  439 +</thead>
  440 +<tbody>
  441 + {{each list.work as obj i}}
335 <tr> 442 <tr>
336 - <td style='text-align:center;vertical-align:middle;'>{{obj.date}}</td>  
337 - <td style='text-align:center;vertical-align:middle;'>{{obj.times}}</td>  
338 - <td style='text-align:center;vertical-align:middle;'>{{obj.company}}</td>  
339 - <td style='text-align:center;vertical-align:middle;'>{{obj.subCompany}}</td>  
340 - <td style='text-align:center;vertical-align:middle;'>{{obj.line}}</td> 443 + <td style='vertical-align:middle;'>{{obj.date}}</td>
  444 + <td style='vertical-align:middle;'>{{obj.company}}</td>
  445 + <td style='vertical-align:middle;'>{{obj.subCompany}}</td>
  446 + <td style='vertical-align:middle;'>{{obj.line}}</td>
341 <td>{{obj.lp}}</td> 447 <td>{{obj.lp}}</td>
342 - <td>{{obj.qdz_zdz}}</td>  
343 - <td>{{obj.zdz}}</td>  
344 - <td>{{obj.yysj}}</td>  
345 - <td>{{obj.yysd}}</td>  
346 - <td>{{obj.yssj}}</td>  
347 - <td>{{obj.yssd}}</td> 448 + <td>{{obj.jhyysj}}</td>
  449 + <td>{{obj.jhyycs}}</td>
  450 + <td>{{obj.sjyysj}}</td>
  451 + <td>{{obj.sjyycs}}</td>
  452 + <td>{{obj.jhyssj}}</td>
  453 + <td>{{obj.jhyscs}}</td>
  454 + <td>{{obj.sjyssj}}</td>
  455 + <td>{{obj.sjyscs}}</td>
348 </tr> 456 </tr>
349 {{/each}} 457 {{/each}}
350 - {{if list.dateList.length != 0}} 458 + {{if list.work.length > 1}}
351 <tr> 459 <tr>
352 - <td colspan="8">汇总平均</td>  
353 - <td>{{list.yysj}}</td>  
354 - <td>{{list.yysd}}</td>  
355 - <td>{{list.yssj}}</td>  
356 - <td>{{list.yssd}}</td> 460 + <td style='vertical-align:middle;' colspan='5'>合计平均值</td>
  461 + <td>{{list.jhyysj}}</td>
  462 + <td>{{list.jhyycs}}</td>
  463 + <td>{{list.sjyysj}}</td>
  464 + <td>{{list.sjyycs}}</td>
  465 + <td>{{list.jhyssj}}</td>
  466 + <td>{{list.jhyscs}}</td>
  467 + <td>{{list.sjyssj}}</td>
  468 + <td>{{list.sjyscs}}</td>
357 </tr> 469 </tr>
358 {{/if}} 470 {{/if}}
359 - {{if list.dateList.length == 0}} 471 + {{if list.work.length == 0}}
360 <tr> 472 <tr>
361 - <td colspan="12"><h6 class="muted">没有找到相关数据</h6></td> 473 + <td colspan="13"><h6 class="muted">没有找到相关数据</h6></td>
362 </tr> 474 </tr>
363 {{/if}} 475 {{/if}}
  476 +</tbody>
364 </script> 477 </script>
365 \ No newline at end of file 478 \ No newline at end of file