Commit d29c67406515fae25b0ce9e26e5db6c9c08981de
1 parent
7ace53b8
只统计营运线路
Showing
2 changed files
with
68 additions
and
8 deletions
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| @@ -806,23 +806,38 @@ public class FormsServiceImpl implements FormsService { | @@ -806,23 +806,38 @@ public class FormsServiceImpl implements FormsService { | ||
| 806 | return d; | 806 | return d; |
| 807 | } | 807 | } |
| 808 | }); | 808 | }); |
| 809 | + | ||
| 810 | + Set<String> lineSet = new HashSet<String>(); | ||
| 811 | + List<String> strList = new ArrayList<>(); | ||
| 812 | + sql = "select name from bsth_c_line where sfyy = 0"; | ||
| 813 | + strList = jdbcTemplate.query(sql, | ||
| 814 | + new RowMapper<String>(){ | ||
| 815 | + @Override | ||
| 816 | + public String mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 817 | + return rs.getString("name"); | ||
| 818 | + } | ||
| 819 | + }); | ||
| 820 | + lineSet.addAll(strList); | ||
| 821 | + | ||
| 809 | List<ScheduleRealInfo> listReal; | 822 | List<ScheduleRealInfo> listReal; |
| 810 | if(xlbm.equals("")){ | 823 | if(xlbm.equals("")){ |
| 811 | listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj(xlbm, startDate, endDate, gsdm, fgsdm); | 824 | listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj(xlbm, startDate, endDate, gsdm, fgsdm); |
| 812 | }else{ | 825 | }else{ |
| 813 | listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj2(xlbm, startDate, endDate); | 826 | listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj2(xlbm, startDate, endDate); |
| 814 | } | 827 | } |
| 815 | - | 828 | + List<Operationservice> resList = new ArrayList<Operationservice>(); |
| 816 | for (int i = 0; i < list.size(); i++) { | 829 | for (int i = 0; i < list.size(); i++) { |
| 817 | Operationservice o=list.get(i); | 830 | Operationservice o=list.get(i); |
| 818 | String line=o.getXlBm(); | 831 | String line=o.getXlBm(); |
| 819 | String xlname=BasicData.lineCode2NameMap.get(line); | 832 | String xlname=BasicData.lineCode2NameMap.get(line); |
| 833 | + if(lineSet.contains(xlname)) | ||
| 834 | + continue; | ||
| 820 | o.setXlName(xlname); | 835 | o.setXlName(xlname); |
| 821 | 836 | ||
| 822 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | 837 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); |
| 823 | for (int j = 0; j < listReal.size(); j++) { | 838 | for (int j = 0; j < listReal.size(); j++) { |
| 824 | ScheduleRealInfo s=listReal.get(j); | 839 | ScheduleRealInfo s=listReal.get(j); |
| 825 | - if(s.getXlBm().equals(line)){ | 840 | + if(s.getXlBm().equals(line) && !lineSet.contains(s.getXlName())){ |
| 826 | newList.add(s); | 841 | newList.add(s); |
| 827 | } | 842 | } |
| 828 | } | 843 | } |
| @@ -858,8 +873,10 @@ public class FormsServiceImpl implements FormsService { | @@ -858,8 +873,10 @@ public class FormsServiceImpl implements FormsService { | ||
| 858 | 873 | ||
| 859 | o.setJzl(String.valueOf(jzl)); | 874 | o.setJzl(String.valueOf(jzl)); |
| 860 | o.setXhl(String.valueOf(xhl)); | 875 | o.setXhl(String.valueOf(xhl)); |
| 876 | + | ||
| 877 | + resList.add(o); | ||
| 861 | } | 878 | } |
| 862 | - return list; | 879 | + return resList; |
| 863 | } | 880 | } |
| 864 | 881 | ||
| 865 | 882 | ||
| @@ -949,6 +966,7 @@ public class FormsServiceImpl implements FormsService { | @@ -949,6 +966,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 949 | 966 | ||
| 950 | List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | 967 | List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); |
| 951 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 968 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 969 | + Set<String> lineSet = new HashSet<String>(); | ||
| 952 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 970 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 953 | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日"); | 971 | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日"); |
| 954 | NumberFormat numberFormat = NumberFormat.getInstance(); | 972 | NumberFormat numberFormat = NumberFormat.getInstance(); |
| @@ -1002,9 +1020,21 @@ public class FormsServiceImpl implements FormsService { | @@ -1002,9 +1020,21 @@ public class FormsServiceImpl implements FormsService { | ||
| 1002 | } | 1020 | } |
| 1003 | 1021 | ||
| 1004 | }); | 1022 | }); |
| 1005 | - | 1023 | + sql = "select name from bsth_c_line where sfyy = 0"; |
| 1024 | + List<String> strList = new ArrayList<>(); | ||
| 1025 | + strList = jdbcTemplate.query(sql, | ||
| 1026 | + new RowMapper<String>(){ | ||
| 1027 | + @Override | ||
| 1028 | + public String mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 1029 | + return rs.getString("name"); | ||
| 1030 | + } | ||
| 1031 | + }); | ||
| 1032 | + lineSet.addAll(strList); | ||
| 1006 | 1033 | ||
| 1007 | for(Line line1 : lineList){ | 1034 | for(Line line1 : lineList){ |
| 1035 | + if(lineSet.contains(line1.getName())){ | ||
| 1036 | + continue; | ||
| 1037 | + } | ||
| 1008 | if(line.trim().length() == 0 || line1.getLineCode().equals(line)){ | 1038 | if(line.trim().length() == 0 || line1.getLineCode().equals(line)){ |
| 1009 | Map<String, Object> m = new HashMap<String, Object>(); | 1039 | Map<String, Object> m = new HashMap<String, Object>(); |
| 1010 | m.put("rq", rq); | 1040 | m.put("rq", rq); |
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
| 1 | package com.bsth.service.schedule.impl; | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
| 4 | -import java.net.URLEncoder; | ||
| 5 | import java.sql.ResultSet; | 4 | import java.sql.ResultSet; |
| 6 | import java.sql.SQLException; | 5 | import java.sql.SQLException; |
| 7 | import java.text.DecimalFormat; | 6 | import java.text.DecimalFormat; |
| @@ -140,6 +139,26 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -140,6 +139,26 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 140 | return list; | 139 | return list; |
| 141 | } | 140 | } |
| 142 | 141 | ||
| 142 | + public Set<String> getNotOperation(){ | ||
| 143 | + Set<String> lineSet = new HashSet<String>(); | ||
| 144 | + try { | ||
| 145 | + String sql = "select name from bsth_c_line where sfyy = 0"; | ||
| 146 | + List<String> lineList = new ArrayList<>(); | ||
| 147 | + lineList = jdbcTemplate.query(sql, | ||
| 148 | + new RowMapper<String>(){ | ||
| 149 | + @Override | ||
| 150 | + public String mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 151 | + return rs.getString("name"); | ||
| 152 | + } | ||
| 153 | + }); | ||
| 154 | + lineSet.addAll(lineList); | ||
| 155 | + } catch (Exception e) { | ||
| 156 | + // TODO: handle exception | ||
| 157 | + e.printStackTrace(); | ||
| 158 | + } | ||
| 159 | + return lineSet; | ||
| 160 | + } | ||
| 161 | + | ||
| 143 | @Override | 162 | @Override |
| 144 | public List<Map<String, Object>> queryPeopleCar(Map<String, Object> map) { | 163 | public List<Map<String, Object>> queryPeopleCar(Map<String, Object> map) { |
| 145 | Map<String, List<SchedulePlanInfo>> keyMap = new HashMap<String, List<SchedulePlanInfo>>(); | 164 | Map<String, List<SchedulePlanInfo>> keyMap = new HashMap<String, List<SchedulePlanInfo>>(); |
| @@ -288,6 +307,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -288,6 +307,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 288 | @Override | 307 | @Override |
| 289 | public List<Map<String, Object>> workDaily(Map<String, Object> map) { | 308 | public List<Map<String, Object>> workDaily(Map<String, Object> map) { |
| 290 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 309 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 310 | + Set<String> lineSet = getNotOperation(); | ||
| 291 | DecimalFormat df = new DecimalFormat("###0.##"); | 311 | DecimalFormat df = new DecimalFormat("###0.##"); |
| 292 | 312 | ||
| 293 | String company = map.get("company").toString(); | 313 | String company = map.get("company").toString(); |
| @@ -305,7 +325,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -305,7 +325,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 305 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 325 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
| 306 | for(ScheduleRealInfo schedule : list){ | 326 | for(ScheduleRealInfo schedule : list){ |
| 307 | String key = schedule.getXlName(); | 327 | String key = schedule.getXlName(); |
| 308 | - if(key == null || key.trim().equals("")) | 328 | + if(key == null || key.trim().equals("") || lineSet.contains(key)) |
| 309 | continue; | 329 | continue; |
| 310 | if(!keyMap.containsKey(key)){ | 330 | if(!keyMap.containsKey(key)){ |
| 311 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 331 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| @@ -457,8 +477,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -457,8 +477,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 457 | tempMap.put("line", key); | 477 | tempMap.put("line", key); |
| 458 | tempMap.put("jhbc", jhbc); | 478 | tempMap.put("jhbc", jhbc); |
| 459 | tempMap.put("dftz", dftz); | 479 | tempMap.put("dftz", dftz); |
| 460 | - tempMap.put("dftzl", df.format(((float)dftz/jhbc)*100) + "%"); | ||
| 461 | - tempMap.put("ccl", df.format(((float)sjcc/jhcc)*100) + "%"); | 480 | + tempMap.put("dftzl", jhbc==0?"0%":(df.format(((float)dftz/jhbc)*100) + "%")); |
| 481 | + tempMap.put("ccl", jhcc==0?"100%":(df.format(((float)sjcc/jhcc)*100) + "%")); | ||
| 462 | tempMap.put("upfk", upfk); | 482 | tempMap.put("upfk", upfk); |
| 463 | tempMap.put("updk", updk); | 483 | tempMap.put("updk", updk); |
| 464 | tempMap.put("dnfk", dnfk); | 484 | tempMap.put("dnfk", dnfk); |
| @@ -1197,6 +1217,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1197,6 +1217,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1197 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | 1217 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 1198 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1218 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1199 | 1219 | ||
| 1220 | + Set<String> lineSet = getNotOperation(); | ||
| 1221 | + | ||
| 1200 | String company = map.get("company").toString(); | 1222 | String company = map.get("company").toString(); |
| 1201 | String subCompany = map.get("subCompany").toString(); | 1223 | String subCompany = map.get("subCompany").toString(); |
| 1202 | String line = map.get("line").toString(); | 1224 | String line = map.get("line").toString(); |
| @@ -1275,6 +1297,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1275,6 +1297,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1275 | String companyName = "", subCompanyName = ""; | 1297 | String companyName = "", subCompanyName = ""; |
| 1276 | 1298 | ||
| 1277 | for(ScheduleRealInfo s : list){ | 1299 | for(ScheduleRealInfo s : list){ |
| 1300 | + if(lineSet.contains(s.getXlName())){ | ||
| 1301 | + continue; | ||
| 1302 | + } | ||
| 1278 | String xlName = s.getXlName(); | 1303 | String xlName = s.getXlName(); |
| 1279 | if(!keyMap.containsKey(xlName)) | 1304 | if(!keyMap.containsKey(xlName)) |
| 1280 | keyMap.put(xlName, new ArrayList<ScheduleRealInfo>()); | 1305 | keyMap.put(xlName, new ArrayList<ScheduleRealInfo>()); |
| @@ -1398,6 +1423,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1398,6 +1423,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1398 | nf.setMinimumFractionDigits(2); | 1423 | nf.setMinimumFractionDigits(2); |
| 1399 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | 1424 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 1400 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1425 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1426 | + | ||
| 1427 | + Set<String> lineSet = getNotOperation(); | ||
| 1401 | 1428 | ||
| 1402 | String company = map.get("company").toString(); | 1429 | String company = map.get("company").toString(); |
| 1403 | String subCompany = map.get("subCompany").toString(); | 1430 | String subCompany = map.get("subCompany").toString(); |
| @@ -1492,6 +1519,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1492,6 +1519,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1492 | String companyName = "", subCompanyName = ""; | 1519 | String companyName = "", subCompanyName = ""; |
| 1493 | 1520 | ||
| 1494 | for(ScheduleRealInfo s : list){ | 1521 | for(ScheduleRealInfo s : list){ |
| 1522 | + if(lineSet.contains(s.getXlName())){ | ||
| 1523 | + continue; | ||
| 1524 | + } | ||
| 1495 | String xlName = s.getXlName(); | 1525 | String xlName = s.getXlName(); |
| 1496 | String date = s.getScheduleDateStr(); | 1526 | String date = s.getScheduleDateStr(); |
| 1497 | if(!keyMap.containsKey(xlName)) | 1527 | if(!keyMap.containsKey(xlName)) |