Commit 272f6f5821aa2425098e8f978474322de3865fdf

Authored by 娄高锋
1 parent 9248157a

出勤异常的判断修正

src/main/java/com/bsth/server_rs/bigdata/BigscreenService.java
... ... @@ -1245,6 +1245,7 @@ public class BigscreenService {
1245 1245  
1246 1246 List<Map<String, Object>> attList = new ArrayList<Map<String, Object>>();
1247 1247 List<Map<String, Object>> lackList = new ArrayList<Map<String, Object>>();
  1248 + Set<String> lackSet = new HashSet<String>();
1248 1249  
1249 1250 for(int i = 0; i < dates.length; i++){
1250 1251 Set<String> jhSet = new HashSet<String>();
... ... @@ -1274,8 +1275,10 @@ public class BigscreenService {
1274 1275 if(!(s.getStatus() == -1)){
1275 1276 sjSet.add(s.getjGh() + "/" + s.getjName());
1276 1277 }
1277   -
1278   - if (s.isSflj()){
  1278 + }
  1279 +
  1280 + for(ScheduleRealInfo s : findAll){
  1281 + if (s.isSflj() || isInOut(s)){
1279 1282 continue;
1280 1283 }
1281 1284 Set<ChildTaskPlan> cts;
... ... @@ -1283,38 +1286,42 @@ public class BigscreenService {
1283 1286 //有子任务
1284 1287 if (cts != null && cts.size() > 0) {
1285 1288 for(ChildTaskPlan c : cts){
1286   - if(c.getCcId()==null){
1287   - if(c.getMileageType().equals("service")){
1288   - if(c.isDestroy() && (c.getDestroyReason()==null? "" : c.getDestroyReason()).equals("缺人")){
1289   - Map<String, Object> m = new HashMap<String, Object>();
1290   - m.put("gsName", s.getGsName());
1291   - m.put("lineName", s.getXlName());
1292   - m.put("driverName", s.getjName());
1293   - m.put("date", s.getRealExecDate());
1294   - m.put("time", c.getStartDate());
1295   - if(c.getRemarks() != null && c.getRemarks().trim().length() > 0){
1296   - m.put("explain", c.getRemarks());
1297   - } else {
1298   - m.put("explain", s.getRemarks()!=null?s.getRemarks():"");
1299   - }
1300   - lackList.add(m);
1301   - }
1302   - }
1303   - }
  1289 + if(c.getMileageType().equals("service") && c.getCcId() == null){
  1290 + if(c.isDestroy() && (c.getDestroyReason()==null? "" : c.getDestroyReason()).equals("缺人")){
  1291 + Map<String, Object> m = new HashMap<String, Object>();
  1292 + m.put("gsName", s.getGsName());
  1293 + m.put("lineName", s.getXlName());
  1294 + m.put("driverName", s.getjName());
  1295 + m.put("date", s.getRealExecDate());
  1296 + m.put("time", c.getStartDate());
  1297 + if(c.getRemarks() != null && c.getRemarks().trim().length() > 0){
  1298 + m.put("explain", c.getRemarks());
  1299 + } else {
  1300 + m.put("explain", s.getRemarks()!=null?s.getRemarks():"");
  1301 + }
  1302 +
  1303 + String str = s.getScheduleDateStr()+"/"+s.getXlName()+"/"+s.getjGh()+"/"+s.getjName();
  1304 + if(lackSet.add(str)){
  1305 + lackList.add(m);
  1306 + }
  1307 + }
  1308 + }
1304 1309 }
1305 1310 }
1306 1311 //主任务烂班
1307   - else if(s.getStatus() == -1 && !s.isCcService()){
1308   - if(s.getAdjustExps().equals("缺人")){
1309   - Map<String, Object> m = new HashMap<String, Object>();
1310   - m.put("gsName", s.getGsName());
1311   - m.put("lineName", s.getXlName());
1312   - m.put("driverName", s.getjName());
1313   - m.put("date", s.getRealExecDate());
1314   - m.put("time", s.getFcsj());
1315   - m.put("explain", s.getRemarks()!=null?s.getRemarks():"");
1316   - lackList.add(m);
1317   - }
  1312 + else if(s.getStatus() == -1 && s.getAdjustExps().equals("缺人")){
  1313 + Map<String, Object> m = new HashMap<String, Object>();
  1314 + m.put("gsName", s.getGsName());
  1315 + m.put("lineName", s.getXlName());
  1316 + m.put("driverName", s.getjName());
  1317 + m.put("date", s.getRealExecDate());
  1318 + m.put("time", s.getFcsj());
  1319 + m.put("explain", s.getRemarks()!=null?s.getRemarks():"");
  1320 +
  1321 + String str = s.getScheduleDateStr()+"/"+s.getXlName()+"/"+s.getjGh()+"/"+s.getjName();
  1322 + if(lackSet.add(str)){
  1323 + lackList.add(m);
  1324 + }
1318 1325 }
1319 1326 }
1320 1327  
... ... @@ -1465,6 +1472,7 @@ public class BigscreenService {
1465 1472  
1466 1473 List<Map<String, Object>> attList = new ArrayList<Map<String, Object>>();
1467 1474 List<Map<String, Object>> lackList = new ArrayList<Map<String, Object>>();
  1475 + Set<String> lackSet = new HashSet<String>();
1468 1476  
1469 1477 for(int i = 0; i < dates.length; i++){
1470 1478 Set<String> jhSet = new HashSet<String>();
... ... @@ -1496,8 +1504,10 @@ public class BigscreenService {
1496 1504 if(!(s.getStatus() == -1)){
1497 1505 sjSet.add(s.getjGh() + "/" + s.getjName());
1498 1506 }
1499   -
1500   - if (s.isSflj()){
  1507 + }
  1508 +
  1509 + for(ScheduleRealInfo s : findAll){
  1510 + if (s.isSflj() || isInOut(s)){
1501 1511 continue;
1502 1512 }
1503 1513 Set<ChildTaskPlan> cts;
... ... @@ -1505,38 +1515,42 @@ public class BigscreenService {
1505 1515 //有子任务
1506 1516 if (cts != null && cts.size() > 0) {
1507 1517 for(ChildTaskPlan c : cts){
1508   - if(c.getCcId()==null){
1509   - if(c.getMileageType().equals("service")){
1510   - if(c.isDestroy() && (c.getDestroyReason()==null? "" : c.getDestroyReason()).equals("缺人")){
1511   - Map<String, Object> m = new HashMap<String, Object>();
1512   - m.put("gsName", s.getGsName());
1513   - m.put("lineName", s.getXlName());
1514   - m.put("driverName", s.getjName());
1515   - m.put("date", s.getRealExecDate());
1516   - m.put("time", c.getStartDate());
1517   - if(c.getRemarks() != null && c.getRemarks().trim().length() > 0){
1518   - m.put("explain", c.getRemarks());
1519   - } else {
1520   - m.put("explain", s.getRemarks()!=null?s.getRemarks():"");
1521   - }
1522   - lackList.add(m);
1523   - }
1524   - }
1525   - }
  1518 + if(c.getMileageType().equals("service") && c.getCcId() == null){
  1519 + if(c.isDestroy() && (c.getDestroyReason()==null? "" : c.getDestroyReason()).equals("缺人")){
  1520 + Map<String, Object> m = new HashMap<String, Object>();
  1521 + m.put("gsName", s.getGsName());
  1522 + m.put("lineName", s.getXlName());
  1523 + m.put("driverName", s.getjName());
  1524 + m.put("date", s.getRealExecDate());
  1525 + m.put("time", c.getStartDate());
  1526 + if(c.getRemarks() != null && c.getRemarks().trim().length() > 0){
  1527 + m.put("explain", c.getRemarks());
  1528 + } else {
  1529 + m.put("explain", s.getRemarks()!=null?s.getRemarks():"");
  1530 + }
  1531 +
  1532 + String str = s.getScheduleDateStr()+"/"+s.getXlName()+"/"+s.getjGh()+"/"+s.getjName();
  1533 + if(lackSet.add(str)){
  1534 + lackList.add(m);
  1535 + }
  1536 + }
  1537 + }
1526 1538 }
1527 1539 }
1528 1540 //主任务烂班
1529   - else if(s.getStatus() == -1 && !s.isCcService()){
1530   - if(s.getAdjustExps().equals("缺人")){
1531   - Map<String, Object> m = new HashMap<String, Object>();
1532   - m.put("gsName", s.getGsName());
1533   - m.put("lineName", s.getXlName());
1534   - m.put("driverName", s.getjName());
1535   - m.put("date", s.getRealExecDate());
1536   - m.put("time", s.getFcsj());
1537   - m.put("explain", s.getRemarks()!=null?s.getRemarks():"");
1538   - lackList.add(m);
1539   - }
  1541 + else if(s.getStatus() == -1 && s.getAdjustExps().equals("缺人")){
  1542 + Map<String, Object> m = new HashMap<String, Object>();
  1543 + m.put("gsName", s.getGsName());
  1544 + m.put("lineName", s.getXlName());
  1545 + m.put("driverName", s.getjName());
  1546 + m.put("date", s.getRealExecDate());
  1547 + m.put("time", s.getFcsj());
  1548 + m.put("explain", s.getRemarks()!=null?s.getRemarks():"");
  1549 +
  1550 + String str = s.getScheduleDateStr()+"/"+s.getXlName()+"/"+s.getjGh()+"/"+s.getjName();
  1551 + if(lackSet.add(str)){
  1552 + lackList.add(m);
  1553 + }
1540 1554 }
1541 1555 }
1542 1556  
... ... @@ -1553,10 +1567,10 @@ public class BigscreenService {
1553 1567 + " left join bsth_c_personnel p on a.jsy = p.id"
1554 1568 + " left join bsth_c_business b on p.company_code = b.up_code"
1555 1569 + " and p.branche_company_code = b.business_code"
1556   - + " where p.company_code = '"+gsdm+"'"
  1570 + + " where p.company_code = ?"
1557 1571 + " group by p.branche_company_code, b.business_name"
1558 1572 + " order by p.branche_company_code";
1559   - List<Map<String, Object>> ecList=jdbcTemplate.query(gpLineSql,
  1573 + List<Map<String, Object>> ecList=jdbcTemplate.query(gpLineSql, new Object[]{gsdm},
1560 1574 new RowMapper<Map<String, Object>>(){
1561 1575 @Override
1562 1576 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -1589,22 +1603,22 @@ public class BigscreenService {
1589 1603 + " (select count(1) jsy from (select a.jsy from bsth_c_s_ecinfo a"
1590 1604 + " left join bsth_c_personnel p on a.jsy=p.id where a.is_cancel = 0"
1591 1605 + " and a.spy is not null and a.jsy is not null"
1592   - + " and p.company_code = '"+gsdm+"'"
  1606 + + " and p.company_code = ?"
1593 1607 + " group by jsy) a) a"
1594 1608 + " LEFT JOIN"
1595 1609 + " (select count(1) spy from (select b.spy from bsth_c_s_ecinfo b"
1596 1610 + " left join bsth_c_personnel p on b.spy=p.id where b.is_cancel = 0"
1597   - + " and b.spy is not null and p.company_code = '"+gsdm+"'"
  1611 + + " and b.spy is not null and p.company_code = ?"
1598 1612 + " group by spy) b) b"
1599 1613 + " on 1=1"
1600 1614 + " LEFT JOIN"
1601 1615 + " (select count(1) cl from (select c.cl from bsth_c_s_ccinfo c"
1602 1616 + " left join bsth_c_cars car on c.cl=car.id where c.is_cancel = 0"
1603   - + " and c.cl is not null and car.business_code = '"+gsdm+"'"
  1617 + + " and c.cl is not null and car.business_code = ?"
1604 1618 + " and c.xl in(select e.xl from bsth_c_s_ecinfo e"
1605 1619 + " where e.is_cancel = 0 and e.spy is not null) group by c.cl) c) c"
1606 1620 + " on 1=1";
1607   - List<Map<String, Object>> xlConfigList=jdbcTemplate.query(xlSql,
  1621 + List<Map<String, Object>> xlConfigList=jdbcTemplate.query(xlSql, new Object[]{gsdm, gsdm, gsdm},
1608 1622 new RowMapper<Map<String, Object>>(){
1609 1623 @Override
1610 1624 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ...