Commit 0f83cf34fb9b64139aea8da98ec692975981d10c
1 parent
e2819b05
首末班准点率表:实驶班次如果有首末班时点准时的班次就认为准点(实驶不一定是第一班或最后一班)。
Showing
1 changed file
with
302 additions
and
8 deletions
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
| @@ -1291,6 +1291,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1291,6 +1291,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1291 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1291 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 1292 | NumberFormat nf = NumberFormat.getNumberInstance(); | 1292 | NumberFormat nf = NumberFormat.getNumberInstance(); |
| 1293 | nf.setMinimumFractionDigits(2); | 1293 | nf.setMinimumFractionDigits(2); |
| 1294 | + Map<Long, String> spMap = new HashMap<Long, String>(); | ||
| 1294 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | 1295 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 1295 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1296 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1296 | 1297 | ||
| @@ -1309,6 +1310,48 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1309,6 +1310,48 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1309 | date = sdf.format(new Date()); | 1310 | date = sdf.format(new Date()); |
| 1310 | 1311 | ||
| 1311 | try { | 1312 | try { |
| 1313 | + List<SchedulePlanInfo> listSp = new ArrayList<SchedulePlanInfo>(); | ||
| 1314 | + | ||
| 1315 | + ArrayList<String> objList = new ArrayList<String>(); | ||
| 1316 | + String sql = "select a.id, a.bc_type" | ||
| 1317 | + + " from bsth_c_s_sp_info a where schedule_date = ?"; | ||
| 1318 | + objList.add(date); | ||
| 1319 | + if(line.trim().length() != 0){ | ||
| 1320 | + sql += " and xl_bm = ?"; | ||
| 1321 | + objList.add(line); | ||
| 1322 | + } | ||
| 1323 | + if(company.length() != 0){ | ||
| 1324 | + sql += " and gs_bm = ?"; | ||
| 1325 | + objList.add(company); | ||
| 1326 | + } | ||
| 1327 | + if(subCompany.length() != 0){ | ||
| 1328 | + sql += " and fgs_bm = ?"; | ||
| 1329 | + objList.add(subCompany); | ||
| 1330 | + } | ||
| 1331 | + | ||
| 1332 | + listSp = jdbcTemplate.query(sql, | ||
| 1333 | + objList.toArray(), | ||
| 1334 | + new RowMapper<SchedulePlanInfo>(){ | ||
| 1335 | + @Override | ||
| 1336 | + public SchedulePlanInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 1337 | + SchedulePlanInfo schedule = new SchedulePlanInfo(); | ||
| 1338 | + schedule.setId(rs.getLong("id")); | ||
| 1339 | + schedule.setBcType(rs.getString("bc_type")); | ||
| 1340 | + | ||
| 1341 | + return schedule; | ||
| 1342 | + } | ||
| 1343 | + }); | ||
| 1344 | + | ||
| 1345 | + for(SchedulePlanInfo sp : listSp){ | ||
| 1346 | + spMap.put(sp.getId(), sp.getBcType()); | ||
| 1347 | + } | ||
| 1348 | + | ||
| 1349 | + } catch (Exception e) { | ||
| 1350 | + // TODO: handle exception | ||
| 1351 | + e.printStackTrace(); | ||
| 1352 | + } | ||
| 1353 | + | ||
| 1354 | + try { | ||
| 1312 | List<String> objList = new ArrayList<String>(); | 1355 | List<String> objList = new ArrayList<String>(); |
| 1313 | String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," | 1356 | String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," |
| 1314 | + " a.xl_bm, a.fgs_bm, a.cc_service, (select start_opt from bsth_c_line_config where id =" | 1357 | + " a.xl_bm, a.fgs_bm, a.cc_service, (select start_opt from bsth_c_line_config where id =" |
| @@ -1472,11 +1515,62 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1472,11 +1515,62 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1472 | Collections.sort(up1); | 1515 | Collections.sort(up1); |
| 1473 | Collections.sort(up2); | 1516 | Collections.sort(up2); |
| 1474 | ScheduleRealInfo s1 = up1Map.get(up1.get(0)); | 1517 | ScheduleRealInfo s1 = up1Map.get(up1.get(0)); |
| 1518 | + for(Long jhfcsj : up1){ | ||
| 1519 | + s1 = up1Map.get(jhfcsj); | ||
| 1520 | + String bcType = s1.getBcType(); | ||
| 1521 | + if(s1.getSpId() != null && spMap.containsKey(s1.getSpId())){ | ||
| 1522 | + bcType = spMap.get(s1.getSpId()); | ||
| 1523 | + } | ||
| 1524 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1525 | + || bcType.equals("major")){ | ||
| 1526 | + continue; | ||
| 1527 | + } | ||
| 1528 | + break; | ||
| 1529 | + } | ||
| 1475 | ScheduleRealInfo s2 = up2Map.get(up2.get(0)); | 1530 | ScheduleRealInfo s2 = up2Map.get(up2.get(0)); |
| 1531 | + for(Long sjfcsj : up2){ | ||
| 1532 | + ScheduleRealInfo temp2 = up2Map.get(sjfcsj); | ||
| 1533 | + String bcType = temp2.getBcType(); | ||
| 1534 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1535 | + || bcType.equals("major")){ | ||
| 1536 | + continue; | ||
| 1537 | + } | ||
| 1538 | + long delayFirst0 = s1.getFcsjT() - temp2.getFcsjActualTime(); | ||
| 1539 | + if(delayFirst0 <= 1l && delayFirst0 >= -2l){ | ||
| 1540 | + s2 = temp2; | ||
| 1541 | + break; | ||
| 1542 | + } | ||
| 1543 | + } | ||
| 1476 | ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1)); | 1544 | ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1)); |
| 1545 | + for(int i = up1.size() - 1; i >= 0; i--){ | ||
| 1546 | + s3 = up1Map.get(up1.get(i)); | ||
| 1547 | + String bcType = s3.getBcType(); | ||
| 1548 | + if(s3.getSpId() != null && spMap.containsKey(s3.getSpId())){ | ||
| 1549 | + bcType = spMap.get(s3.getSpId()); | ||
| 1550 | + } | ||
| 1551 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1552 | + || bcType.equals("major")){ | ||
| 1553 | + continue; | ||
| 1554 | + } | ||
| 1555 | + break; | ||
| 1556 | + } | ||
| 1477 | ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1)); | 1557 | ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1)); |
| 1478 | - long delayFirst0 = up1.get(0) - up2.get(0); | ||
| 1479 | - long delayLast0 = up1.get(up1.size()-1) - up2.get(up2.size()-1); | 1558 | + for(int i = up2.size() - 1; i >= 0; i--){ |
| 1559 | + ScheduleRealInfo temp4 = up2Map.get(up2.get(i)); | ||
| 1560 | + String bcType = temp4.getBcType(); | ||
| 1561 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1562 | + || bcType.equals("major")){ | ||
| 1563 | + continue; | ||
| 1564 | + } | ||
| 1565 | + long delayLast0 = s3.getFcsjT() - temp4.getFcsjActualTime(); | ||
| 1566 | + if(delayLast0 <= 1l && delayLast0 >= -2l){ | ||
| 1567 | + s4 = temp4; | ||
| 1568 | + break; | ||
| 1569 | + } | ||
| 1570 | + break; | ||
| 1571 | + } | ||
| 1572 | + long delayFirst0 = s1.getFcsjT() - s2.getFcsjActualTime(); | ||
| 1573 | + long delayLast0 = s3.getFcsjT() - s4.getFcsjActualTime(); | ||
| 1480 | tempMap.put("qdzFirst0", s1.getQdzName()); | 1574 | tempMap.put("qdzFirst0", s1.getQdzName()); |
| 1481 | tempMap.put("jhfcFirst0", s1.getFcsj()); | 1575 | tempMap.put("jhfcFirst0", s1.getFcsj()); |
| 1482 | tempMap.put("sjfcFirst0", s2.getFcsjActual()); | 1576 | tempMap.put("sjfcFirst0", s2.getFcsjActual()); |
| @@ -1499,11 +1593,63 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1499,11 +1593,63 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1499 | Collections.sort(dn1); | 1593 | Collections.sort(dn1); |
| 1500 | Collections.sort(dn2); | 1594 | Collections.sort(dn2); |
| 1501 | ScheduleRealInfo s1 = dn1Map.get(dn1.get(0)); | 1595 | ScheduleRealInfo s1 = dn1Map.get(dn1.get(0)); |
| 1596 | + for(Long jhfcsj : dn1){ | ||
| 1597 | + s1 = dn1Map.get(jhfcsj); | ||
| 1598 | + String bcType = s1.getBcType(); | ||
| 1599 | + if(s1.getSpId() != null && spMap.containsKey(s1.getSpId())){ | ||
| 1600 | + bcType = spMap.get(s1.getSpId()); | ||
| 1601 | + } | ||
| 1602 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1603 | + || bcType.equals("major")){ | ||
| 1604 | + continue; | ||
| 1605 | + } | ||
| 1606 | + break; | ||
| 1607 | + } | ||
| 1502 | ScheduleRealInfo s2 = dn2Map.get(dn2.get(0)); | 1608 | ScheduleRealInfo s2 = dn2Map.get(dn2.get(0)); |
| 1609 | + for(Long sjfcsj : dn2){ | ||
| 1610 | + ScheduleRealInfo temp2 = dn2Map.get(sjfcsj); | ||
| 1611 | + String bcType = temp2.getBcType(); | ||
| 1612 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1613 | + || bcType.equals("major")){ | ||
| 1614 | + continue; | ||
| 1615 | + } | ||
| 1616 | + long delayFirst1 = s1.getFcsjT() - temp2.getFcsjActualTime(); | ||
| 1617 | + if(delayFirst1 <= 1l && delayFirst1 >= -2l){ | ||
| 1618 | + s2 = temp2; | ||
| 1619 | + break; | ||
| 1620 | + } | ||
| 1621 | + break; | ||
| 1622 | + } | ||
| 1503 | ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1)); | 1623 | ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1)); |
| 1624 | + for(int i = dn1.size() - 1; i >= 0; i--){ | ||
| 1625 | + s3 = dn1Map.get(dn1.get(i)); | ||
| 1626 | + String bcType = s3.getBcType(); | ||
| 1627 | + if(s3.getSpId() != null && spMap.containsKey(s3.getSpId())){ | ||
| 1628 | + bcType = spMap.get(s3.getSpId()); | ||
| 1629 | + } | ||
| 1630 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1631 | + || bcType.equals("major")){ | ||
| 1632 | + continue; | ||
| 1633 | + } | ||
| 1634 | + break; | ||
| 1635 | + } | ||
| 1504 | ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1)); | 1636 | ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1)); |
| 1505 | - long delayFirst1 = dn1.get(0) - dn2.get(0); | ||
| 1506 | - long delayLast1 = dn1.get(dn1.size()-1) - dn2.get(dn2.size()-1); | 1637 | + for(int i = dn2.size() - 1; i >= 0; i--){ |
| 1638 | + ScheduleRealInfo temp4 = dn2Map.get(dn2.get(i)); | ||
| 1639 | + String bcType = temp4.getBcType(); | ||
| 1640 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1641 | + || bcType.equals("major")){ | ||
| 1642 | + continue; | ||
| 1643 | + } | ||
| 1644 | + long delayLast1 = s3.getFcsjT() - temp4.getFcsjActualTime(); | ||
| 1645 | + if(delayLast1 <= 1l && delayLast1 >= -2l){ | ||
| 1646 | + s4 = temp4; | ||
| 1647 | + break; | ||
| 1648 | + } | ||
| 1649 | + break; | ||
| 1650 | + } | ||
| 1651 | + long delayFirst1 = s1.getFcsjT() - s2.getFcsjActualTime(); | ||
| 1652 | + long delayLast1 = s3.getFcsjT() - s4.getFcsjActualTime(); | ||
| 1507 | tempMap.put("qdzFirst1", s1.getQdzName()); | 1653 | tempMap.put("qdzFirst1", s1.getQdzName()); |
| 1508 | tempMap.put("jhfcFirst1", s1.getFcsj()); | 1654 | tempMap.put("jhfcFirst1", s1.getFcsj()); |
| 1509 | tempMap.put("sjfcFirst1", s2.getFcsjActual()); | 1655 | tempMap.put("sjfcFirst1", s2.getFcsjActual()); |
| @@ -1558,6 +1704,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1558,6 +1704,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1558 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1704 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 1559 | NumberFormat nf = NumberFormat.getNumberInstance(); | 1705 | NumberFormat nf = NumberFormat.getNumberInstance(); |
| 1560 | nf.setMinimumFractionDigits(2); | 1706 | nf.setMinimumFractionDigits(2); |
| 1707 | + Map<Long, String> spMap = new HashMap<Long, String>(); | ||
| 1561 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | 1708 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 1562 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1709 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1563 | 1710 | ||
| @@ -1591,6 +1738,50 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1591,6 +1738,50 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1591 | } | 1738 | } |
| 1592 | 1739 | ||
| 1593 | try { | 1740 | try { |
| 1741 | + List<SchedulePlanInfo> listSp = new ArrayList<SchedulePlanInfo>(); | ||
| 1742 | + | ||
| 1743 | + ArrayList<String> objList = new ArrayList<String>(); | ||
| 1744 | + String sql = "select a.id, a.bc_type" | ||
| 1745 | + + " from bsth_c_s_sp_info a where" | ||
| 1746 | + + " schedule_date >= ? and schedule_date <= ?"; | ||
| 1747 | + objList.add(startDate); | ||
| 1748 | + objList.add(endDate); | ||
| 1749 | + if(line.trim().length() != 0){ | ||
| 1750 | + sql += " and xl_bm = ?"; | ||
| 1751 | + objList.add(line); | ||
| 1752 | + } | ||
| 1753 | + if(company.length() != 0){ | ||
| 1754 | + sql += " and gs_bm = ?"; | ||
| 1755 | + objList.add(company); | ||
| 1756 | + } | ||
| 1757 | + if(subCompany.length() != 0){ | ||
| 1758 | + sql += " and fgs_bm = ?"; | ||
| 1759 | + objList.add(subCompany); | ||
| 1760 | + } | ||
| 1761 | + | ||
| 1762 | + listSp = jdbcTemplate.query(sql, | ||
| 1763 | + objList.toArray(), | ||
| 1764 | + new RowMapper<SchedulePlanInfo>(){ | ||
| 1765 | + @Override | ||
| 1766 | + public SchedulePlanInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 1767 | + SchedulePlanInfo schedule = new SchedulePlanInfo(); | ||
| 1768 | + schedule.setId(rs.getLong("id")); | ||
| 1769 | + schedule.setBcType(rs.getString("bc_type")); | ||
| 1770 | + | ||
| 1771 | + return schedule; | ||
| 1772 | + } | ||
| 1773 | + }); | ||
| 1774 | + | ||
| 1775 | + for(SchedulePlanInfo sp : listSp){ | ||
| 1776 | + spMap.put(sp.getId(), sp.getBcType()); | ||
| 1777 | + } | ||
| 1778 | + | ||
| 1779 | + } catch (Exception e) { | ||
| 1780 | + // TODO: handle exception | ||
| 1781 | + e.printStackTrace(); | ||
| 1782 | + } | ||
| 1783 | + | ||
| 1784 | + try { | ||
| 1594 | List<String> objList = new ArrayList<String>(); | 1785 | List<String> objList = new ArrayList<String>(); |
| 1595 | String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," | 1786 | String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," |
| 1596 | + " a.fgs_bm, a.cc_service, a.remarks, a.adjust_exps, (select start_opt from bsth_c_line_config where id = " | 1787 | + " a.fgs_bm, a.cc_service, a.remarks, a.adjust_exps, (select start_opt from bsth_c_line_config where id = " |
| @@ -1783,11 +1974,62 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1783,11 +1974,62 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1783 | Collections.sort(up1); | 1974 | Collections.sort(up1); |
| 1784 | Collections.sort(up2); | 1975 | Collections.sort(up2); |
| 1785 | ScheduleRealInfo s1 = up1Map.get(up1.get(0)); | 1976 | ScheduleRealInfo s1 = up1Map.get(up1.get(0)); |
| 1977 | + for(Long jhfcsj : up1){ | ||
| 1978 | + s1 = up1Map.get(jhfcsj); | ||
| 1979 | + String bcType = s1.getBcType(); | ||
| 1980 | + if(s1.getSpId() != null && spMap.containsKey(s1.getSpId())){ | ||
| 1981 | + bcType = spMap.get(s1.getSpId()); | ||
| 1982 | + } | ||
| 1983 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1984 | + || bcType.equals("major")){ | ||
| 1985 | + continue; | ||
| 1986 | + } | ||
| 1987 | + break; | ||
| 1988 | + } | ||
| 1786 | ScheduleRealInfo s2 = up2Map.get(up2.get(0)); | 1989 | ScheduleRealInfo s2 = up2Map.get(up2.get(0)); |
| 1990 | + for(Long sjfcsj : up2){ | ||
| 1991 | + ScheduleRealInfo temp2 = up2Map.get(sjfcsj); | ||
| 1992 | + String bcType = temp2.getBcType(); | ||
| 1993 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 1994 | + || bcType.equals("major")){ | ||
| 1995 | + continue; | ||
| 1996 | + } | ||
| 1997 | + long delayFirst0 = s1.getFcsjT() - temp2.getFcsjActualTime(); | ||
| 1998 | + if(delayFirst0 <= 1l && delayFirst0 >= -2l){ | ||
| 1999 | + s2 = temp2; | ||
| 2000 | + break; | ||
| 2001 | + } | ||
| 2002 | + } | ||
| 1787 | ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1)); | 2003 | ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1)); |
| 2004 | + for(int i = up1.size() - 1; i >= 0; i--){ | ||
| 2005 | + s3 = up1Map.get(up1.get(i)); | ||
| 2006 | + String bcType = s3.getBcType(); | ||
| 2007 | + if(s3.getSpId() != null && spMap.containsKey(s3.getSpId())){ | ||
| 2008 | + bcType = spMap.get(s3.getSpId()); | ||
| 2009 | + } | ||
| 2010 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 2011 | + || bcType.equals("major")){ | ||
| 2012 | + continue; | ||
| 2013 | + } | ||
| 2014 | + break; | ||
| 2015 | + } | ||
| 1788 | ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1)); | 2016 | ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1)); |
| 1789 | - long delayFirst0 = up1.get(0) - up2.get(0); | ||
| 1790 | - long delayLast0 = up1.get(up1.size()-1) - up2.get(up2.size()-1); | 2017 | + for(int i = up2.size() - 1; i >= 0; i--){ |
| 2018 | + ScheduleRealInfo temp4 = up2Map.get(up2.get(i)); | ||
| 2019 | + String bcType = temp4.getBcType(); | ||
| 2020 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 2021 | + || bcType.equals("major")){ | ||
| 2022 | + continue; | ||
| 2023 | + } | ||
| 2024 | + long delayLast0 = s3.getFcsjT() - temp4.getFcsjActualTime(); | ||
| 2025 | + if(delayLast0 <= 1l && delayLast0 >= -2l){ | ||
| 2026 | + s4 = temp4; | ||
| 2027 | + break; | ||
| 2028 | + } | ||
| 2029 | + break; | ||
| 2030 | + } | ||
| 2031 | + long delayFirst0 = s1.getFcsjT() - s2.getFcsjActualTime(); | ||
| 2032 | + long delayLast0 = s3.getFcsjT() - s4.getFcsjActualTime(); | ||
| 1791 | temp.put("qdzFirst0", s1.getQdzName()); | 2033 | temp.put("qdzFirst0", s1.getQdzName()); |
| 1792 | temp.put("jhfcFirst0", s1.getFcsj()); | 2034 | temp.put("jhfcFirst0", s1.getFcsj()); |
| 1793 | temp.put("sjfcFirst0", s2.getFcsjActual()); | 2035 | temp.put("sjfcFirst0", s2.getFcsjActual()); |
| @@ -1849,11 +2091,63 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1849,11 +2091,63 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1849 | Collections.sort(dn1); | 2091 | Collections.sort(dn1); |
| 1850 | Collections.sort(dn2); | 2092 | Collections.sort(dn2); |
| 1851 | ScheduleRealInfo s1 = dn1Map.get(dn1.get(0)); | 2093 | ScheduleRealInfo s1 = dn1Map.get(dn1.get(0)); |
| 2094 | + for(Long jhfcsj : dn1){ | ||
| 2095 | + s1 = dn1Map.get(jhfcsj); | ||
| 2096 | + String bcType = s1.getBcType(); | ||
| 2097 | + if(s1.getSpId() != null && spMap.containsKey(s1.getSpId())){ | ||
| 2098 | + bcType = spMap.get(s1.getSpId()); | ||
| 2099 | + } | ||
| 2100 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 2101 | + || bcType.equals("major")){ | ||
| 2102 | + continue; | ||
| 2103 | + } | ||
| 2104 | + break; | ||
| 2105 | + } | ||
| 1852 | ScheduleRealInfo s2 = dn2Map.get(dn2.get(0)); | 2106 | ScheduleRealInfo s2 = dn2Map.get(dn2.get(0)); |
| 2107 | + for(Long sjfcsj : dn2){ | ||
| 2108 | + ScheduleRealInfo temp2 = dn2Map.get(sjfcsj); | ||
| 2109 | + String bcType = temp2.getBcType(); | ||
| 2110 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 2111 | + || bcType.equals("major")){ | ||
| 2112 | + continue; | ||
| 2113 | + } | ||
| 2114 | + long delayFirst1 = s1.getFcsjT() - temp2.getFcsjActualTime(); | ||
| 2115 | + if(delayFirst1 <= 1l && delayFirst1 >= -2l){ | ||
| 2116 | + s2 = temp2; | ||
| 2117 | + break; | ||
| 2118 | + } | ||
| 2119 | + break; | ||
| 2120 | + } | ||
| 1853 | ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1)); | 2121 | ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1)); |
| 2122 | + for(int i = dn1.size() - 1; i >= 0; i--){ | ||
| 2123 | + s3 = dn1Map.get(dn1.get(i)); | ||
| 2124 | + String bcType = s3.getBcType(); | ||
| 2125 | + if(s3.getSpId() != null && spMap.containsKey(s3.getSpId())){ | ||
| 2126 | + bcType = spMap.get(s3.getSpId()); | ||
| 2127 | + } | ||
| 2128 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 2129 | + || bcType.equals("major")){ | ||
| 2130 | + continue; | ||
| 2131 | + } | ||
| 2132 | + break; | ||
| 2133 | + } | ||
| 1854 | ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1)); | 2134 | ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1)); |
| 1855 | - long delayFirst1 = dn1.get(0) - dn2.get(0); | ||
| 1856 | - long delayLast1 = dn1.get(dn1.size()-1) - dn2.get(dn2.size()-1); | 2135 | + for(int i = dn2.size() - 1; i >= 0; i--){ |
| 2136 | + ScheduleRealInfo temp4 = dn2Map.get(dn2.get(i)); | ||
| 2137 | + String bcType = temp4.getBcType(); | ||
| 2138 | + if(bcType.equals("region") || bcType.equals("venting") | ||
| 2139 | + || bcType.equals("major")){ | ||
| 2140 | + continue; | ||
| 2141 | + } | ||
| 2142 | + long delayLast1 = s3.getFcsjT() - temp4.getFcsjActualTime(); | ||
| 2143 | + if(delayLast1 <= 1l && delayLast1 >= -2l){ | ||
| 2144 | + s4 = temp4; | ||
| 2145 | + break; | ||
| 2146 | + } | ||
| 2147 | + break; | ||
| 2148 | + } | ||
| 2149 | + long delayFirst1 = s1.getFcsjT() - s2.getFcsjActualTime(); | ||
| 2150 | + long delayLast1 = s3.getFcsjT() - s4.getFcsjActualTime(); | ||
| 1857 | temp.put("qdzFirst1", s1.getQdzName()); | 2151 | temp.put("qdzFirst1", s1.getQdzName()); |
| 1858 | temp.put("jhfcFirst1", s1.getFcsj()); | 2152 | temp.put("jhfcFirst1", s1.getFcsj()); |
| 1859 | temp.put("sjfcFirst1", s2.getFcsjActual()); | 2153 | temp.put("sjfcFirst1", s2.getFcsjActual()); |