Commit d29c67406515fae25b0ce9e26e5db6c9c08981de

Authored by 娄高锋
1 parent 7ace53b8

只统计营运线路

src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -806,23 +806,38 @@ public class FormsServiceImpl implements FormsService {
806 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 822 List<ScheduleRealInfo> listReal;
810 823 if(xlbm.equals("")){
811 824 listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj(xlbm, startDate, endDate, gsdm, fgsdm);
812 825 }else{
813 826 listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj2(xlbm, startDate, endDate);
814 827 }
815   -
  828 + List<Operationservice> resList = new ArrayList<Operationservice>();
816 829 for (int i = 0; i < list.size(); i++) {
817 830 Operationservice o=list.get(i);
818 831 String line=o.getXlBm();
819 832 String xlname=BasicData.lineCode2NameMap.get(line);
  833 + if(lineSet.contains(xlname))
  834 + continue;
820 835 o.setXlName(xlname);
821 836  
822 837 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
823 838 for (int j = 0; j < listReal.size(); j++) {
824 839 ScheduleRealInfo s=listReal.get(j);
825   - if(s.getXlBm().equals(line)){
  840 + if(s.getXlBm().equals(line) && !lineSet.contains(s.getXlName())){
826 841 newList.add(s);
827 842 }
828 843 }
... ... @@ -858,8 +873,10 @@ public class FormsServiceImpl implements FormsService {
858 873  
859 874 o.setJzl(String.valueOf(jzl));
860 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 966  
950 967 List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
951 968 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  969 + Set<String> lineSet = new HashSet<String>();
952 970 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
953 971 SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
954 972 NumberFormat numberFormat = NumberFormat.getInstance();
... ... @@ -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 1034 for(Line line1 : lineList){
  1035 + if(lineSet.contains(line1.getName())){
  1036 + continue;
  1037 + }
1008 1038 if(line.trim().length() == 0 || line1.getLineCode().equals(line)){
1009 1039 Map<String, Object> m = new HashMap<String, Object>();
1010 1040 m.put("rq", rq);
... ...
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
3 3 import java.math.BigDecimal;
4   -import java.net.URLEncoder;
5 4 import java.sql.ResultSet;
6 5 import java.sql.SQLException;
7 6 import java.text.DecimalFormat;
... ... @@ -140,6 +139,26 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
140 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 162 @Override
144 163 public List<Map<String, Object>> queryPeopleCar(Map<String, Object> map) {
145 164 Map<String, List<SchedulePlanInfo>> keyMap = new HashMap<String, List<SchedulePlanInfo>>();
... ... @@ -288,6 +307,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
288 307 @Override
289 308 public List<Map<String, Object>> workDaily(Map<String, Object> map) {
290 309 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  310 + Set<String> lineSet = getNotOperation();
291 311 DecimalFormat df = new DecimalFormat("###0.##");
292 312  
293 313 String company = map.get("company").toString();
... ... @@ -305,7 +325,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
305 325 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
306 326 for(ScheduleRealInfo schedule : list){
307 327 String key = schedule.getXlName();
308   - if(key == null || key.trim().equals(""))
  328 + if(key == null || key.trim().equals("") || lineSet.contains(key))
309 329 continue;
310 330 if(!keyMap.containsKey(key)){
311 331 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
... ... @@ -457,8 +477,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
457 477 tempMap.put("line", key);
458 478 tempMap.put("jhbc", jhbc);
459 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 482 tempMap.put("upfk", upfk);
463 483 tempMap.put("updk", updk);
464 484 tempMap.put("dnfk", dnfk);
... ... @@ -1197,6 +1217,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1197 1217 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1198 1218 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1199 1219  
  1220 + Set<String> lineSet = getNotOperation();
  1221 +
1200 1222 String company = map.get("company").toString();
1201 1223 String subCompany = map.get("subCompany").toString();
1202 1224 String line = map.get("line").toString();
... ... @@ -1275,6 +1297,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1275 1297 String companyName = "", subCompanyName = "";
1276 1298  
1277 1299 for(ScheduleRealInfo s : list){
  1300 + if(lineSet.contains(s.getXlName())){
  1301 + continue;
  1302 + }
1278 1303 String xlName = s.getXlName();
1279 1304 if(!keyMap.containsKey(xlName))
1280 1305 keyMap.put(xlName, new ArrayList<ScheduleRealInfo>());
... ... @@ -1398,6 +1423,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1398 1423 nf.setMinimumFractionDigits(2);
1399 1424 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1400 1425 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  1426 +
  1427 + Set<String> lineSet = getNotOperation();
1401 1428  
1402 1429 String company = map.get("company").toString();
1403 1430 String subCompany = map.get("subCompany").toString();
... ... @@ -1492,6 +1519,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1492 1519 String companyName = "", subCompanyName = "";
1493 1520  
1494 1521 for(ScheduleRealInfo s : list){
  1522 + if(lineSet.contains(s.getXlName())){
  1523 + continue;
  1524 + }
1495 1525 String xlName = s.getXlName();
1496 1526 String date = s.getScheduleDateStr();
1497 1527 if(!keyMap.containsKey(xlName))
... ...