Commit 3c3bb6c2dcd75170d58ce952b95089a4b232c0e0

Authored by 娄高锋
1 parent a2d14a12

线路首末班准点率

src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
3   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
4   -import com.bsth.entity.schedule.SchedulePlanInfo;
5   -import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
6   -import com.bsth.util.ReportUtils;
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.jdbc.core.JdbcTemplate;
9   -import org.springframework.jdbc.core.RowMapper;
10   -import org.springframework.stereotype.Service;
11   -
12 3 import java.math.BigDecimal;
  4 +import java.net.URLEncoder;
13 5 import java.sql.ResultSet;
14 6 import java.sql.SQLException;
15 7 import java.text.DecimalFormat;
16 8 import java.text.NumberFormat;
17 9 import java.text.ParseException;
18 10 import java.text.SimpleDateFormat;
19   -import java.util.*;
20   -
  11 +import java.util.ArrayList;
  12 +import java.util.Collections;
  13 +import java.util.Date;
  14 +import java.util.HashMap;
  15 +import java.util.HashSet;
  16 +import java.util.Iterator;
  17 +import java.util.List;
  18 +import java.util.Map;
  19 +import java.util.Set;
21 20  
22 21 import org.springframework.beans.factory.annotation.Autowired;
23 22 import org.springframework.jdbc.core.JdbcTemplate;
... ... @@ -404,20 +403,22 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
404 403 }
405 404 }
406 405  
407   - if(!schedule.getBcType().equals("in") && !schedule.getBcType().equals("out")){
408   - String clZbh = schedule.getClZbh();
409   - if(!listMap.containsKey(clZbh))
410   - listMap.put(clZbh, new ArrayList<ScheduleRealInfo>());
411   - listMap.get(clZbh).add(schedule);
  406 + if(!schedule.getBcType().equals("in") && !schedule.getBcType().equals("out")
  407 + && schedule.getFcsjActual() != null){
  408 +// String clZbh = schedule.getClZbh();
  409 + String xlDir = schedule.getXlDir();
  410 + if(!listMap.containsKey(xlDir))
  411 + listMap.put(xlDir, new ArrayList<ScheduleRealInfo>());
  412 + listMap.get(xlDir).add(schedule);
412 413 }
413 414 }
414 415  
415 416 //求首末班准点率
416   - for(String clZbh : listMap.keySet()){
  417 + for(String xlDir : listMap.keySet()){
417 418 Map<Integer, ScheduleRealInfo> temp = new HashMap<Integer, ScheduleRealInfo>();
418 419 List <ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>();
419 420 List<Integer> sort = new ArrayList<Integer>();
420   - for(ScheduleRealInfo schedule : listMap.get(clZbh)){
  421 + for(ScheduleRealInfo schedule : listMap.get(xlDir)){
421 422 String[] split = schedule.getFcsj().split(":");
422 423 int min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
423 424 temp.put(min, schedule);
... ... @@ -762,7 +763,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
762 763 return modelMap;
763 764 }
764 765  
765   -// @Override
  766 + @Override
766 767 public Map<String, Object> scheduleAnaly_sum(Map<String, Object> map) {
767 768 DecimalFormat df = new DecimalFormat("00");
768 769 NumberFormat nf = NumberFormat.getNumberInstance();
... ... @@ -1180,6 +1181,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1180 1181 }
1181 1182 }
1182 1183  
  1184 + if(longList0.size() == 0 && longList1.size() == 0){
  1185 + continue;
  1186 + }
  1187 +
1183 1188 if(longList0.size() != 0){
1184 1189 Collections.sort(longList0);
1185 1190 ScheduleRealInfo shouban0 = temp0.get(longList0.get(0));
... ... @@ -1297,7 +1302,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1297 1302 return resList;
1298 1303 }
1299 1304  
1300   -// @Override
  1305 + @Override
1301 1306 public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) {
1302 1307 NumberFormat nf = NumberFormat.getNumberInstance();
1303 1308 nf.setMinimumFractionDigits(2);
... ... @@ -1355,6 +1360,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1355 1360 }
1356 1361 }
1357 1362  
  1363 + if(longList0.size() == 0 && longList1.size() == 0){
  1364 + continue;
  1365 + }
1358 1366 int jhbc = 0;
1359 1367 int sjbc = 0;
1360 1368  
... ... @@ -1415,7 +1423,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1415 1423 tempMap.put("subCompany", subCompanyName);
1416 1424 tempMap.put("line", key);
1417 1425 resList.add(tempMap);
1418   - System.out.println(tempMap);
1419 1426 }
1420 1427  
1421 1428 if(type.equals("export")){
... ... @@ -1427,8 +1434,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1427 1434 try {
1428 1435 listI.add(resList.iterator());
1429 1436 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
1430   - ee.excelReplace(listI, new Object[] { m }, path+"mould/firstAndLastBus.xls",
1431   - path+"export/线路首末班" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1437 + ee.excelReplace(listI, new Object[] { m }, path+"mould/firstAndLastBus_sum.xls",
  1438 + path+"export/线路首末班准点率" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
1432 1439 } catch (Exception e) {
1433 1440 // TODO: handle exception
1434 1441 e.printStackTrace();
... ...
src/main/resources/static/pages/forms/mould/firstAndLastBus_sum.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
... ... @@ -205,6 +205,10 @@
205 205 }
206 206  
207 207 $("#export").on("click",function(){
  208 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  209 + layer.msg("请选择时间!");
  210 + return;
  211 + }
208 212 var params = {};
209 213 params['company'] = company;
210 214 params['subCompany'] = subCompany;
... ... @@ -212,8 +216,8 @@
212 216 params['line'] = line;
213 217 params['date'] = date;
214 218 params['type'] = "export";
215   - $get('/pcpc/firstAndLastBus', params, function(result){
216   - window.open("/downloadFile/download?fileName=线路首末班"+moment(date).format("YYYYMMDD"));
  219 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  220 + window.open("/downloadFile/download?fileName=线路首末班准点率"+moment(date).format("YYYYMMDD"));
217 221 });
218 222 });
219 223  
... ...