Commit c9c64ac7a645f787abae53e7b37d04d8cf9e4bf0

Authored by 廖磊
1 parent 5906cdb4

报表中计算实际里程班次去掉没有实到实发的班次信息

src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -114,8 +114,15 @@ public class FormsServiceImpl implements FormsService {
114 114 List<ScheduleRealInfo> listInfo=new ArrayList<ScheduleRealInfo>();
115 115 for (int j = 0; j < realList.size(); j++) {
116 116 ScheduleRealInfo s=realList.get(j);
117   - if(w.getNbbm().equals(s.getClZbh()) && w.getJgh().equals(w.getJgh())){
118   - listInfo.add(s);
  117 + if(w.getNbbm().equals(s.getClZbh()) && w.getJgh().equals(s.getjGh())){
  118 + Set<ChildTaskPlan> cts = s.getcTasks();
  119 + if(cts != null && cts.size() > 0){
  120 + listInfo.add(s);
  121 + }else{
  122 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  123 + listInfo.add(s);
  124 + }
  125 + }
119 126 }
120 127 }
121 128  
... ... @@ -290,9 +297,11 @@ public class FormsServiceImpl implements FormsService {
290 297 });
291 298  
292 299 List<ScheduleRealInfo> sList;
  300 + List<ScheduleRealInfo> list_s;
293 301 List<ScheduleRealInfo> lists=scheduleRealInfoRepository.scheduleByDateAndLineYbb(map.get("line").toString(), map.get("startDate").toString(), map.get("endDate").toString());
294 302 for(int i=0;i<list.size();i++){
295 303 sList =new ArrayList<ScheduleRealInfo>();
  304 + list_s =new ArrayList<ScheduleRealInfo>();
296 305 Shiftuehiclemanth d=list.get(i);
297 306 for (int j = 0; j < lists.size(); j++) {
298 307 ScheduleRealInfo s=lists.get(j);
... ... @@ -302,31 +311,56 @@ public class FormsServiceImpl implements FormsService {
302 311 if(empnames.equals("驾驶员")){
303 312 if(d.getJgh().equals(s.getjGh())){
304 313 sList.add(s);
  314 + Set<ChildTaskPlan> cts = s.getcTasks();
  315 + if(cts != null && cts.size() > 0){
  316 + list_s.add(s);
  317 + }else{
  318 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  319 + list_s.add(s);
  320 + }
  321 + }
  322 +
305 323 }
306 324 }else if(empnames.equals("售票员")){
307 325 String sgh=s.getsGh()==null?"":s.getsGh();
308 326 if(d.getSgh().equals(sgh)){
309 327 sList.add(s);
  328 + Set<ChildTaskPlan> cts = s.getcTasks();
  329 + if(cts != null && cts.size() > 0){
  330 + list_s.add(s);
  331 + }else{
  332 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  333 + list_s.add(s);
  334 + }
  335 + }
310 336 }
311 337 }else if(empnames.equals("车辆自编号")){
312 338 if(d.getjName().equals(s.getClZbh())){
313 339 sList.add(s);
  340 + Set<ChildTaskPlan> cts = s.getcTasks();
  341 + if(cts != null && cts.size() > 0){
  342 + list_s.add(s);
  343 + }else{
  344 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  345 + list_s.add(s);
  346 + }
  347 + }
314 348 }
315 349 }
316 350  
317 351 }
318 352  
319   - double ksgl=culateMileageService.culateKsgl(sList);
320   - double jccgl=culateMileageService.culateJccgl(sList);
  353 + double ksgl=culateMileageService.culateKsgl(list_s);
  354 + double jccgl=culateMileageService.culateJccgl(list_s);
321 355 double zksgl=Arith.add(ksgl, jccgl);
322   - double ljgl=culateMileageService.culateLjgl(sList);
323   - double sjgl=culateMileageService.culateSjgl(sList);
  356 + double ljgl=culateMileageService.culateLjgl(list_s);
  357 + double sjgl=culateMileageService.culateSjgl(list_s);
324 358 double zyygl=Arith.add(ljgl, sjgl);
325 359 int cjbc=culateMileageService.culateLbbc(sList);
326   - int ljbc=culateMileageService.culateLjbc(sList,"");
327   - int sjbc=culateMileageService.culateSjbc(sList, "");
  360 + int ljbc=culateMileageService.culateLjbc(list_s,"");
  361 + int sjbc=culateMileageService.culateSjbc(list_s, "");
328 362 double cjgl=culateMileageService.culateLbgl(sList);
329   - double zjgl=culateMileageService.culateLjgl(sList);
  363 + double zjgl=culateMileageService.culateLjgl(list_s);
330 364 d.setEmptMileage(String.valueOf(zksgl));//空驶公里
331 365 d.setTotalm(String.valueOf(Arith.add(zksgl, zyygl)));//总公里
332 366 d.setSjbc(String.valueOf(sjbc+ljbc));
... ... @@ -418,30 +452,40 @@ public class FormsServiceImpl implements FormsService {
418 452  
419 453 });
420 454 List<ScheduleRealInfo> sList;
  455 + List<ScheduleRealInfo> list_s;
421 456 List<ScheduleRealInfo> lists=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(map.get("line").toString(), map.get("date").toString());
422 457 for(int i=0;i<list.size();i++){
423 458 sList =new ArrayList<ScheduleRealInfo>();
  459 + list_s =new ArrayList<ScheduleRealInfo>();
424 460 Shifday d=list.get(i);
425 461 for (int j = 0; j < lists.size(); j++) {
426 462 ScheduleRealInfo s=lists.get(j);
427 463 if(d.getJgh().equals(s.getjGh()) && d.getCarPlate().equals(s.getClZbh())){
428 464 sList.add(s);
  465 + Set<ChildTaskPlan> cts = s.getcTasks();
  466 + if(cts != null && cts.size() > 0){
  467 + list_s.add(s);
  468 + }else{
  469 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  470 + list_s.add(s);
  471 + }
  472 + }
429 473 }
430 474 }
431 475  
432   - double ksgl=culateMileageService.culateKsgl(sList);
433   - double jccgl=culateMileageService.culateJccgl(sList);
  476 + double ksgl=culateMileageService.culateKsgl(list_s);
  477 + double jccgl=culateMileageService.culateJccgl(list_s);
434 478 double zksgl=Arith.add(ksgl, jccgl);
435   - double ljgl=culateMileageService.culateLjgl(sList);
436   - double sjgl=culateMileageService.culateSjgl(sList);
  479 + double ljgl=culateMileageService.culateLjgl(list_s);
  480 + double sjgl=culateMileageService.culateSjgl(list_s);
437 481 double zyygl=Arith.add(ljgl, sjgl);
438 482 double jhgl=culateMileageService.culateJhgl(sList);
439 483 double cjgl=culateMileageService.culateLbgl(sList);
440   - int jhbc =culateMileageService.culateJhbc(sList,"");
  484 + int jhbc=culateMileageService.culateJhbc(sList,"");
441 485 int cjbc=culateMileageService.culateLbbc(sList);
442   - int ljbc=culateMileageService.culateLjbc(sList,"");
443   - int sjbc=culateMileageService.culateSjbc(sList, "");
444   - double zjgl=culateMileageService.culateLjgl(sList);
  486 + int ljbc=culateMileageService.culateLjbc(list_s,"");
  487 + int sjbc=culateMileageService.culateSjbc(list_s, "");
  488 + double zjgl=culateMileageService.culateLjgl(list_s);
445 489 d.setEmptMileage(String.valueOf(zksgl));//空驶公里
446 490 d.setTotalm(String.valueOf(Arith.add(zksgl, zyygl)));//总公里
447 491 d.setSjbc(String.valueOf(sjbc+ljbc));
... ... @@ -1610,10 +1654,19 @@ public class FormsServiceImpl implements FormsService {
1610 1654 for (int j = 0; j < lists.size(); j++) {
1611 1655 ScheduleRealInfo s=lists.get(j);
1612 1656 if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){
1613   - sList.add(s);
  1657 + Set<ChildTaskPlan> cts = s.getcTasks();
  1658 + if(cts != null && cts.size() > 0){
  1659 + sList.add(s);
  1660 + }else{
  1661 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  1662 + sList.add(s);
  1663 + }
  1664 + }
  1665 +
1614 1666 }
1615 1667 }
1616 1668  
  1669 +
1617 1670 double ksgl=culateMileageService.culateKsgl(sList);
1618 1671 double jccgl=culateMileageService.culateJccgl(sList);
1619 1672 double zksgl=Arith.add(ksgl, jccgl);
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -797,7 +797,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
797 797 + " min(s.fcsj) as fcsj,2 as px from bsth_c_s_sp_info_real s "
798 798 + " where s.xl_Bm = '"+line+"' and s.schedule_date_str ='"+date+"'"
799 799 + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name "
800   - + " ) y where y.fcsj <='"+minfcsj+"') z order by (" + state + "),dateStr,px " + type;
  800 + + " ) y where y.fcsj <='"+minfcsj+"') z order by (" + state + "),dateStr,px,fcsj " + type;
801 801 List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan,
802 802 new RowMapper<ScheduleRealInfo>() {
803 803 @Override
... ... @@ -2616,11 +2616,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2616 2616 map.put("dtbc", 0);
2617 2617 map.put("dtbc_m", 0);
2618 2618 map.put("dtbc_a", 0);
2619   - Map<String, Object> m_=culateService.culateDjg(list_s, list.get(0).getXlBm());
2620   - map.put("djg", m_.get("djgcsq"));
2621   - map.put("djg_m", m_.get("djgcsz"));
2622   - map.put("djg_a", m_.get("djgcsw"));
2623   - map.put("djg_time", m_.get("djgsj"));
  2619 + if(list.size()>0){
  2620 + Map<String, Object> m_=culateService.culateDjg(list_s, list.get(0).getXlBm());
  2621 + map.put("djg", m_.get("djgcsq"));
  2622 + map.put("djg_m", m_.get("djgcsz"));
  2623 + map.put("djg_a", m_.get("djgcsw"));
  2624 + map.put("djg_time", m_.get("djgsj"));
  2625 + }else{
  2626 + map.put("djg", "0");
  2627 + map.put("djg_m", "0");
  2628 + map.put("djg_a", "0");
  2629 + map.put("djg_time", "0");
  2630 + }
2624 2631 lMap.add(map);
2625 2632 if (type != null && type.length() != 0 && type.equals("export")) {
2626 2633 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
... ...
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
... ... @@ -1383,7 +1383,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1383 1383 djgcsz ++;
1384 1384 djgcsq ++;
1385 1385 if(fscjNext-fcsjTime>djcsj){
1386   - djcsj=(fscjNext-fcsjTime)/1000;
  1386 + djcsj=(fscjNext-fcsjTime)/60000;
1387 1387 }
1388 1388 }
1389 1389 }else if((fcsj>=wgf1&&fcsj<=wgf2)){
... ... @@ -1392,7 +1392,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1392 1392 djgcsw ++;
1393 1393 djgcsq ++;
1394 1394 if(fscjNext-fcsjTime>djcsj){
1395   - djcsj=(fscjNext-fcsjTime)/1000;
  1395 + djcsj=(fscjNext-fcsjTime)/60000;
1396 1396 }
1397 1397 }
1398 1398 }else{
... ... @@ -1400,7 +1400,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1400 1400 if(fscjNext-fcsjTime>djg){
1401 1401 djgcsq ++;
1402 1402 if(fscjNext-fcsjTime>djcsj){
1403   - djcsj=(fscjNext-fcsjTime)/1000;
  1403 + djcsj=(fscjNext-fcsjTime)/60000;
1404 1404 }
1405 1405 }
1406 1406 }
... ... @@ -1421,7 +1421,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1421 1421 djgcsz ++;
1422 1422 djgcsq ++;
1423 1423 if(fscjNext-fcsjTime>djcsj){
1424   - djcsj=(fscjNext-fcsjTime)/1000;
  1424 + djcsj=(fscjNext-fcsjTime)/60000;
1425 1425 }
1426 1426 }
1427 1427 }else if(fcsj>=wgf1&&fcsj<=wgf2){
... ... @@ -1430,7 +1430,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1430 1430 djgcsw ++;
1431 1431 djgcsq ++;
1432 1432 if(fscjNext-fcsjTime>djcsj){
1433   - djcsj=(fscjNext-fcsjTime)/1000;
  1433 + djcsj=(fscjNext-fcsjTime)/60000;
1434 1434 }
1435 1435 }
1436 1436 }else{
... ... @@ -1438,7 +1438,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1438 1438 if(fscjNext-fcsjTime>djg){
1439 1439 djgcsq ++;
1440 1440 if(fscjNext-fcsjTime>djcsj){
1441   - djcsj=(fscjNext-fcsjTime)/1000;
  1441 + djcsj=(fscjNext-fcsjTime)/60000;
1442 1442 }
1443 1443 }
1444 1444 }
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -3089,15 +3089,26 @@ public class ReportServiceImpl implements ReportService{
3089 3089 ScheduleRealInfo sinfo=list.get(j);
3090 3090 try {
3091 3091 if(sinfo.getXlBm().equals(lineCode)){
3092   - list_.add(sinfo);
3093   - ScheduleRealInfo s=checkBc(sinfo);
3094   - String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
3095   - if(!fcsj.equals("")){
3096   - Long fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
3097   - s.setFcsjActualTime(fcsjAcual);
3098   - s.setFcsjActual(fcsj);
3099   - listInfo.add(s);
3100   - }
  3092 + boolean type_=false;
  3093 + Set<ChildTaskPlan> cts = sinfo.getcTasks();
  3094 + if(cts != null && cts.size() > 0){
  3095 + type_=true;
  3096 + }else{
  3097 + if(sinfo.getZdsjActual()!=null && sinfo.getFcsjActual()!=null){
  3098 + type_=true;
  3099 + }
  3100 + }
  3101 + if(type_){
  3102 + list_.add(sinfo);
  3103 + ScheduleRealInfo s=checkBc(sinfo);
  3104 + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
  3105 + if(!fcsj.equals("")){
  3106 + Long fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
  3107 + s.setFcsjActualTime(fcsjAcual);
  3108 + s.setFcsjActual(fcsj);
  3109 + listInfo.add(s);
  3110 + }
  3111 + }
3101 3112  
3102 3113 }
3103 3114 } catch (ParseException e) {
... ...