Commit 02fb2440e081d4633833fc2597b147b7085ec910

Authored by 娄高锋
1 parent aec65783

行车时刻表统计表

src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
@@ -324,37 +324,24 @@ public class ReportServiceImpl implements ReportService{ @@ -324,37 +324,24 @@ public class ReportServiceImpl implements ReportService{
324 } 324 }
325 return list; 325 return list;
326 } 326 }
  327 +
327 @Override 328 @Override
328 public Map<String, Object> tbodyTime1(String line, String ttinfo) { 329 public Map<String, Object> tbodyTime1(String line, String ttinfo) {
329 DecimalFormat df = new DecimalFormat("#0.00"); 330 DecimalFormat df = new DecimalFormat("#0.00");
  331 + Map<String, Object> map=new HashMap<String,Object>();
330 // TODO Auto-generated method stub 332 // TODO Auto-generated method stub
  333 +
331 //查询配车 334 //查询配车
332 - String sqlPc=" select count(*) from bsth_c_cars where id in("  
333 - + " select cl from bsth_c_s_ccinfo where xl in ( "  
334 - + " select id from bsth_c_line where line_code='"+line+"' )"  
335 - + " group by equipment_code ) ";  
336 -  
337 - Map<String, Object> map=new HashMap<String,Object>();  
338 -  
339 - /*List<Map<String, Object>> listPc= jdbcTemplate.query(sqlPc,  
340 - new RowMapper<Map<String, Object>>(){  
341 - @Override  
342 - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {  
343 - Map<String, Object> m=new HashMap<String,Object>();  
344 - m.put("zbh", rs.getString("cl_zbh"));  
345 - return m;  
346 - }  
347 - });*/ 335 + String sqlPc=" select count(*) from (select lp, count(*) from"
  336 + + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"'"
  337 + + " group by lp ) a";
348 //配车 338 //配车
349 int pcs=jdbcTemplate.queryForObject(sqlPc, Integer.class); 339 int pcs=jdbcTemplate.queryForObject(sqlPc, Integer.class);
350 340
  341 +
351 String sqlPlan=" SELECT jhlc,bc_type,fcsj FROM bsth_c_s_ttinfo_detail " 342 String sqlPlan=" SELECT jhlc,bc_type,fcsj FROM bsth_c_s_ttinfo_detail "
352 +" where ttinfo ='"+ttinfo+"' "; 343 +" where ttinfo ='"+ttinfo+"' ";
353 344
354 - //班次  
355 - int zgf_0 = 6*60+31,zgf_1 = 8*60+30,wgf_0 = 16*60+1,wgf_1 = 18*60;  
356 - int qcBc=0,qjBc=0,zqcBc=0,zqjBc=0,wqcBc=0,wqjBc=0;  
357 - double zlc = 0 , yylc = 0,kslc=0;  
358 //查询班次 345 //查询班次
359 List<Map<String, Object>> listPlan= jdbcTemplate.query(sqlPlan, 346 List<Map<String, Object>> listPlan= jdbcTemplate.query(sqlPlan,
360 new RowMapper<Map<String, Object>>(){ 347 new RowMapper<Map<String, Object>>(){
@@ -368,6 +355,11 @@ public class ReportServiceImpl implements ReportService{ @@ -368,6 +355,11 @@ public class ReportServiceImpl implements ReportService{
368 } 355 }
369 }); 356 });
370 357
  358 + //班次
  359 + int zgf_0 = 6*60+31,zgf_1 = 8*60+30,wgf_0 = 16*60+1,wgf_1 = 18*60;
  360 + int qcBc=0,qjBc=0,zqcBc=0,zqjBc=0,wqcBc=0,wqjBc=0;
  361 + double zlc = 0 , yylc = 0,kslc=0;
  362 +
371 for (int i = 0; i < listPlan.size(); i++) { 363 for (int i = 0; i < listPlan.size(); i++) {
372 Map<String, Object> m=listPlan.get(i); 364 Map<String, Object> m=listPlan.get(i);
373 double jhlc=Double.parseDouble(m.get("jhlc").toString()); 365 double jhlc=Double.parseDouble(m.get("jhlc").toString());
@@ -423,21 +415,23 @@ public class ReportServiceImpl implements ReportService{ @@ -423,21 +415,23 @@ public class ReportServiceImpl implements ReportService{
423 String minfcsj="02:00"; 415 String minfcsj="02:00";
424 List<Line> lineList=lineRepository.findLineByCode(line); 416 List<Line> lineList=lineRepository.findLineByCode(line);
425 if(lineList.size()>0){ 417 if(lineList.size()>0){
426 - String sqlMinYysj="select start_opt from bsth_c_line_config where "  
427 - + " id = ("  
428 - + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"  
429 - + ")";  
430 - minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); 418 + String sql = "select count(*) from bsth_c_line_config where line = '"+lineList.get(0).getId()+"'";
  419 + if(jdbcTemplate.queryForObject(sql, Integer.class) > 0){
  420 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  421 + + " id = ("
  422 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  423 + + ")";
  424 + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  425 + }
431 } 426 }
432 String[] minSjs = minfcsj.split(":"); 427 String[] minSjs = minfcsj.split(":");
433 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]); 428 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
434 //查询时间里程 429 //查询时间里程
435 - String sqlPc=" (SELECT jhlc,fcsj,bc_type,lp,2 as xh, ists FROM bsth_c_s_ttinfo_detail " 430 + String sqlPc=" (SELECT jhlc,fcsj,bc_type,bcsj,lp,2 as xh, ists FROM bsth_c_s_ttinfo_detail "
436 + " where ttinfo ='"+ttinfo+"' and fcsj <='"+minfcsj+"' ) " 431 + " where ttinfo ='"+ttinfo+"' and fcsj <='"+minfcsj+"' ) "
437 + " union " 432 + " union "
438 - + " (SELECT jhlc,fcsj,bc_type,lp,1 as xh, ists FROM bsth_c_s_ttinfo_detail "  
439 - + " where ttinfo ='"+ttinfo+"' and fcsj > '"+minfcsj+"') order by lp,xh,fcsj";  
440 - 433 + + " (SELECT jhlc,fcsj,bc_type,bcsj,lp,1 as xh, ists FROM bsth_c_s_ttinfo_detail "
  434 + + " where ttinfo ='"+ttinfo+"' and fcsj > '"+minfcsj+"' ) order by lp,xh,fcsj";
441 Map<String, Object> map=new HashMap<String,Object>(); 435 Map<String, Object> map=new HashMap<String,Object>();
442 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc, 436 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
443 new RowMapper<Map<String, Object>>(){ 437 new RowMapper<Map<String, Object>>(){
@@ -447,26 +441,31 @@ public class ReportServiceImpl implements ReportService{ @@ -447,26 +441,31 @@ public class ReportServiceImpl implements ReportService{
447 m.put("fcsj", rs.getString("fcsj")); 441 m.put("fcsj", rs.getString("fcsj"));
448 m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc")); 442 m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc"));
449 m.put("bcType", rs.getString("bc_type")); 443 m.put("bcType", rs.getString("bc_type"));
  444 + m.put("bcsj", rs.getString("bcsj"));
450 m.put("lp", rs.getString("lp")); 445 m.put("lp", rs.getString("lp"));
451 m.put("ists", rs.getObject("ists")==null?"0":rs.getString("ists")); 446 m.put("ists", rs.getObject("ists")==null?"0":rs.getString("ists"));
452 return m; 447 return m;
453 } 448 }
454 }); 449 });
455 - int yysj=0 ; 450 +
  451 + int yysj=0;
456 double yycs=0 ,yygl=0; 452 double yycs=0 ,yygl=0;
457 String lp ="0"; 453 String lp ="0";
458 - int sj=0;  
459 - 454 + int sj=0, bcsj = 0;
  455 + int temp = 0;
460 for(int i=0;i<list.size();i++){ 456 for(int i=0;i<list.size();i++){
461 Map<String, Object> m=list.get(i); 457 Map<String, Object> m=list.get(i);
462 String time=m.get("fcsj").toString(); 458 String time=m.get("fcsj").toString();
463 String[] times = time.split(":"); 459 String[] times = time.split(":");
  460 + int sjT = Integer.parseInt(times[0])*60+Integer.parseInt(times[1]);
464 if(lp.equals(m.get("lp").toString())){ 461 if(lp.equals(m.get("lp").toString())){
465 - if(Integer.parseInt(times[0])*60+Integer.parseInt(times[1]) <=minSj){ 462 + if(sjT <= minSj){
466 if(m.get("bcType").equals("in") || m.get("bcType").equals("out")){ 463 if(m.get("bcType").equals("in") || m.get("bcType").equals("out")){
467 if(m.get("bcType").equals("in")){ 464 if(m.get("bcType").equals("in")){
468 if(sj!=0){ 465 if(sj!=0){
469 - yysj +=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1])-sj; 466 +// yysj += sjT + (24*60) - sj;
  467 + yysj += bcsj;
  468 + bcsj = 0;
470 } 469 }
471 sj=0; 470 sj=0;
472 } 471 }
@@ -474,45 +473,62 @@ public class ReportServiceImpl implements ReportService{ @@ -474,45 +473,62 @@ public class ReportServiceImpl implements ReportService{
474 yygl += Double.parseDouble(m.get("yygl").toString()); 473 yygl += Double.parseDouble(m.get("yygl").toString());
475 474
476 if(sj==0){ 475 if(sj==0){
477 - sj=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1]); 476 + sj = sjT + (24*60);
478 }else{ 477 }else{
479 - yysj +=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1])-sj;  
480 - sj=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1]); 478 + yysj += sjT + (24*60) - sj;
  479 + if(m.containsKey("ists") && m.get("ists").equals("1")){
  480 + yysj += Integer.valueOf(m.get("bcsj").toString());
  481 + } else {
  482 + sj = sjT + (24*60);
  483 + }
481 } 484 }
482 } 485 }
483 }else{ 486 }else{
484 if(m.get("bcType").equals("in") || m.get("bcType").equals("out")){ 487 if(m.get("bcType").equals("in") || m.get("bcType").equals("out")){
485 if(m.get("bcType").equals("in")){ 488 if(m.get("bcType").equals("in")){
486 if(sj!=0){ 489 if(sj!=0){
487 - yysj +=Integer.parseInt(times[0])*60+Integer.parseInt(times[1])-sj; 490 +// yysj += sjT - sj;
  491 + yysj += bcsj;
  492 + bcsj = 0;
488 } 493 }
489 sj=0; 494 sj=0;
490 } 495 }
491 - }else{ 496 + } else {
492 yygl += Double.parseDouble(m.get("yygl").toString()); 497 yygl += Double.parseDouble(m.get("yygl").toString());
493 498
494 if(sj==0){ 499 if(sj==0){
495 - sj=Integer.parseInt(times[0])*60+Integer.parseInt(times[1]); 500 + sj = sjT;
496 }else{ 501 }else{
497 - yysj +=Integer.parseInt(times[0])*60+Integer.parseInt(times[1])-sj;  
498 - sj=Integer.parseInt(times[0])*60+Integer.parseInt(times[1]); 502 + yysj += sjT - sj;
  503 + if(m.containsKey("ists") && m.get("ists").equals("1")){
  504 + yysj += Integer.valueOf(m.get("bcsj").toString());
  505 + } else {
  506 + sj = sjT;
  507 + }
499 } 508 }
500 } 509 }
501 } 510 }
502 }else{ 511 }else{
  512 + if(sj == 0){
  513 + yysj += bcsj;
  514 + bcsj = 0;
  515 + }
503 if( !(m.get("bcType").equals("in") || m.get("bcType").equals("out"))){ 516 if( !(m.get("bcType").equals("in") || m.get("bcType").equals("out"))){
504 yygl += Double.parseDouble(m.get("yygl").toString()); 517 yygl += Double.parseDouble(m.get("yygl").toString());
505 - sj =Integer.parseInt(times[0])*60+Integer.parseInt(times[1]); 518 + sj = sjT;
506 }else{ 519 }else{
507 sj=0; 520 sj=0;
508 } 521 }
509 lp=m.get("lp").toString(); 522 lp=m.get("lp").toString();
510 -  
511 } 523 }
  524 +
512 if(m.containsKey("ists") && m.get("ists").equals("1")){ 525 if(m.containsKey("ists") && m.get("ists").equals("1")){
513 sj = 0; 526 sj = 0;
514 } 527 }
  528 + if( !(m.get("bcType").equals("in") || m.get("bcType").equals("out")))
  529 + bcsj = Integer.valueOf(m.get("bcsj").toString());
515 } 530 }
  531 +
516 if(yysj>0){ 532 if(yysj>0){
517 yycs =yygl/(yysj*1.0/60); 533 yycs =yygl/(yysj*1.0/60);
518 } 534 }
@@ -522,6 +538,7 @@ public class ReportServiceImpl implements ReportService{ @@ -522,6 +538,7 @@ public class ReportServiceImpl implements ReportService{
522 map.put("yysj", hh+":"+mm); 538 map.put("yysj", hh+":"+mm);
523 map.put("yycs", df.format(yycs)+"公里/小时"); 539 map.put("yycs", df.format(yycs)+"公里/小时");
524 // map.put(key, value) 540 // map.put(key, value)
  541 +
525 return map; 542 return map;
526 } 543 }
527 544
@@ -529,126 +546,15 @@ public class ReportServiceImpl implements ReportService{ @@ -529,126 +546,15 @@ public class ReportServiceImpl implements ReportService{
529 System.out.println(609360/60); 546 System.out.println(609360/60);
530 System.out.println(609360%60); 547 System.out.println(609360%60);
531 } 548 }
532 - /* @Override  
533 - public List<Map<String, Object>> tbodyTime3(String line, String ttinfo) {  
534 - // TODO Auto-generated method stub  
535 - List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();  
536 -  
537 -  
538 -  
539 - String sqlZd="select a.qdz_name,COUNT(a.cl_zbh) as cls,'zqc' AS lx from ("  
540 - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"' "  
541 - + " and bc_type ='normal'"  
542 - + " and ((fcsj >'06:31' and fcsj<'08:30') or ( fcsj>'6:31' and fcsj<'8:30'))"  
543 - + " group by cl_zbh,qdz_name) a group by a.qdz_name"  
544 - + " union "  
545 - + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'wqc' AS lx from ("  
546 - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"  
547 - + " and bc_type ='normal' "  
548 - + " and fcsj >'16:01' and fcsj<'18:00' group by cl_zbh,qdz_name "  
549 - + " ) a group by a.qdz_name "  
550 - + " union "  
551 - + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'zqj' AS lx from ("  
552 - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"  
553 - + " and bc_type ='region' "  
554 - + " and ((fcsj >'06:31' and fcsj<'08:30') or ( fcsj>'6:31' and fcsj<'8:30'))"  
555 - + " group by cl_zbh,qdz_name) a group by a.qdz_name"  
556 - + " union "  
557 - + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'wqj' AS lx from ("  
558 - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"  
559 - + " and bc_type ='region' and fcsj >'16:01' and fcsj<'18:00'"  
560 - + " group by cl_zbh,qdz_name) a group by a.qdz_name";  
561 - List<Map<String, Object>> lists= jdbcTemplate.query(sqlZd,  
562 - new RowMapper<Map<String, Object>>(){  
563 - @Override  
564 - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {  
565 - Map<String, Object> m=new HashMap<String,Object>();  
566 - m.put("zdm", rs.getString("qdz_name"));  
567 - m.put("cls", rs.getString("cls"));  
568 - m.put("lx", rs.getString("lx"));  
569 - return m;  
570 - }  
571 - });  
572 - int a=0;  
573 - int b=0;  
574 - int c=0;  
575 - int d=0;  
576 - for(int i=0;i<lists.size();i++){  
577 - boolean fage=true;  
578 - Map<String, Object> newMap= new HashMap<String, Object>();  
579 - list.add(newMap);  
580 - Map<String, Object> maps=lists.get(i);  
581 - if(maps.get("lx").equals("zqc")){  
582 - list.get(a).put("zqcZm", maps.get("zdm"));  
583 - list.get(a).put("zqcCls", maps.get("cls"));  
584 - a++;  
585 - fage=false;  
586 - }else if(maps.get("lx").equals("wqc")){  
587 - list.get(b).put("wqcZm", maps.get("zdm"));  
588 - list.get(b).put("wqcCls", maps.get("cls"));  
589 - b++;  
590 - fage=false;  
591 - }else if(maps.get("lx").equals("zqj")){  
592 - list.get(c).put("zqjZm", maps.get("zdm"));  
593 - list.get(c).put("zqjCls", maps.get("cls"));  
594 - c++;  
595 - fage=false;  
596 - }else if(maps.get("lx").equals("wqj")){  
597 - list.get(d).put("wqjZm", maps.get("zdm"));  
598 - list.get(d).put("wqjCls", maps.get("cls"));  
599 - d++;  
600 - fage=false;  
601 - }  
602 - if(fage){  
603 - break;  
604 - }  
605 - }  
606 - boolean status=true;  
607 - while (status) {  
608 - for (int i = 0; i < list.size(); i++) {  
609 - if(list.get(i).isEmpty()){  
610 - list.remove(i);  
611 - status=true;  
612 - }else{  
613 - status=false;  
614 - }  
615 - }  
616 -  
617 - }  
618 - return list;  
619 - }*/ 549 +
620 @Override 550 @Override
621 public List<Map<String, Object>> tbodyTime3(String line, String ttinfo) { 551 public List<Map<String, Object>> tbodyTime3(String line, String ttinfo) {
622 // TODO Auto-generated method stub 552 // TODO Auto-generated method stub
623 List<Map<String, Object>> list=new ArrayList<Map<String,Object>>(); 553 List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
624 List<Map<String, Object>> list_s=new ArrayList<Map<String,Object>>(); 554 List<Map<String, Object>> list_s=new ArrayList<Map<String,Object>>();
625 555
626 -  
627 - /*String sqlZd="select a.qdz_name,COUNT(a.cl_zbh) as cls,'zqc' AS lx from ("  
628 - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"' "  
629 - + " and bc_type ='normal'"  
630 - + " and ((fcsj >'06:31' and fcsj<'08:30') or ( fcsj>'6:31' and fcsj<'8:30'))"  
631 - + " group by cl_zbh,qdz_name) a group by a.qdz_name"  
632 - + " union "  
633 - + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'wqc' AS lx from ("  
634 - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"  
635 - + " and bc_type ='normal' "  
636 - + " and fcsj >'16:01' and fcsj<'18:00' group by cl_zbh,qdz_name "  
637 - + " ) a group by a.qdz_name "  
638 - + " union "  
639 - + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'zqj' AS lx from ("  
640 - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"  
641 - + " and bc_type ='region' "  
642 - + " and ((fcsj >'06:31' and fcsj<'08:30') or ( fcsj>'6:31' and fcsj<'8:30'))"  
643 - + " group by cl_zbh,qdz_name) a group by a.qdz_name"  
644 - + " union "  
645 - + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'wqj' AS lx from ("  
646 - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"  
647 - + " and bc_type ='region' and fcsj >'16:01' and fcsj<'18:00'"  
648 - + " group by cl_zbh,qdz_name) a group by a.qdz_name";*/  
649 -  
650 - String sqlCl="SELECT cl_zbh,qdz_name,bc_type,fcsj,bcsj FROM"  
651 - + " bsth_c_s_sp_info WHERE tt_info = '"+ttinfo+"' " 556 + String sqlCl="SELECT lp cl_zbh,qdz_name,bc_type,fcsj,bcsj FROM"
  557 + + " bsth_c_s_ttinfo_detail WHERE ttinfo = '"+ttinfo+"' "
652 + " AND (bc_type = 'normal' or bc_type='region') order by qdz_name"; 558 + " AND (bc_type = 'normal' or bc_type='region') order by qdz_name";
653 559
654 List<Map<String, Object>> listj= jdbcTemplate.query(sqlCl, 560 List<Map<String, Object>> listj= jdbcTemplate.query(sqlCl,
@@ -665,7 +571,7 @@ public class ReportServiceImpl implements ReportService{ @@ -665,7 +571,7 @@ public class ReportServiceImpl implements ReportService{
665 } 571 }
666 }); 572 });
667 573
668 - String sqlZd="select qdz_name ,bc_type from bsth_c_s_sp_info WHERE tt_info = '"+ttinfo+"' " 574 + String sqlZd="select qdz_name,bc_type from bsth_c_s_ttinfo_detail WHERE ttinfo = '"+ttinfo+"' "
669 + " AND (bc_type = 'normal' or bc_type='region') group by qdz_name ,bc_type " 575 + " AND (bc_type = 'normal' or bc_type='region') group by qdz_name ,bc_type "
670 + " order by qdz_name"; 576 + " order by qdz_name";
671 List<Map<String, Object>> lists= jdbcTemplate.query(sqlZd, 577 List<Map<String, Object>> lists= jdbcTemplate.query(sqlZd,
@@ -807,6 +713,8 @@ public class ReportServiceImpl implements ReportService{ @@ -807,6 +713,8 @@ public class ReportServiceImpl implements ReportService{
807 } 713 }
808 boolean status=true; 714 boolean status=true;
809 while (status) { 715 while (status) {
  716 + if(list.size() == 0)
  717 + break;
810 for (int i = 0; i < list.size(); i++) { 718 for (int i = 0; i < list.size(); i++) {
811 if(list.get(i).isEmpty()){ 719 if(list.get(i).isEmpty()){
812 list.remove(i); 720 list.remove(i);
@@ -815,8 +723,8 @@ public class ReportServiceImpl implements ReportService{ @@ -815,8 +723,8 @@ public class ReportServiceImpl implements ReportService{
815 status=false; 723 status=false;
816 } 724 }
817 } 725 }
818 -  
819 } 726 }
  727 +
820 return list; 728 return list;
821 } 729 }
822 730
@@ -828,11 +736,14 @@ public class ReportServiceImpl implements ReportService{ @@ -828,11 +736,14 @@ public class ReportServiceImpl implements ReportService{
828 String minfcsj="02:00"; 736 String minfcsj="02:00";
829 List<Line> lineList=lineRepository.findLineByCode(line); 737 List<Line> lineList=lineRepository.findLineByCode(line);
830 if(lineList.size()>0){ 738 if(lineList.size()>0){
831 - String sqlMinYysj="select start_opt from bsth_c_line_config where "  
832 - + " id = ("  
833 - + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"  
834 - + ")";  
835 - minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); 739 + String sql = "select count(*) from bsth_c_line_config where line = '"+lineList.get(0).getId()+"'";
  740 + if(jdbcTemplate.queryForObject(sql, Integer.class) > 0){
  741 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  742 + + " id = ("
  743 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  744 + + ")";
  745 + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  746 + }
836 } 747 }
837 748
838 //查询全程 749 //查询全程
@@ -917,11 +828,14 @@ public class ReportServiceImpl implements ReportService{ @@ -917,11 +828,14 @@ public class ReportServiceImpl implements ReportService{
917 String minfcsj="02:00"; 828 String minfcsj="02:00";
918 List<Line> lineList=lineRepository.findLineByCode(line); 829 List<Line> lineList=lineRepository.findLineByCode(line);
919 if(lineList.size()>0){ 830 if(lineList.size()>0){
920 - String sqlMinYysj="select start_opt from bsth_c_line_config where "  
921 - + " id = ("  
922 - + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"  
923 - + ")";  
924 - minfcsj= jdbcTemplate.queryForObject(sqlMinYysj, String.class); 831 + String sql = "select count(*) from bsth_c_line_config where line = '"+lineList.get(0).getId()+"'";
  832 + if(jdbcTemplate.queryForObject(sql, Integer.class) > 0){
  833 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  834 + + " id = ("
  835 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  836 + + ")";
  837 + minfcsj= jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  838 + }
925 } 839 }
926 String[] minSjs = minfcsj.split(":"); 840 String[] minSjs = minfcsj.split(":");
927 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]); 841 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);