Commit bf2b6a9780c8b5fe2bf7500d6792e8f64c8cf28f

Authored by 潘钊
2 parents 4a899e2a 27c32c2e

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

Too many changes to show.

To preserve performance only 10 of 16 files are displayed.

src/main/java/com/bsth/controller/report/SheetController.java
@@ -19,10 +19,10 @@ public class SheetController extends BaseController<Sheet, Integer>{ @@ -19,10 +19,10 @@ public class SheetController extends BaseController<Sheet, Integer>{
19 @Autowired 19 @Autowired
20 SheetService sheetService; 20 SheetService sheetService;
21 @RequestMapping(value = "/saveListSheet",method = RequestMethod.POST) 21 @RequestMapping(value = "/saveListSheet",method = RequestMethod.POST)
22 - public String saveListSheet(){ 22 + public String saveListSheet(@RequestParam String date){
23 String result=""; 23 String result="";
24 try { 24 try {
25 - result = sheetService.saveSheetList(); 25 + result = sheetService.saveSheetList(date);
26 } catch (Exception e) { 26 } catch (Exception e) {
27 // TODO Auto-generated catch block 27 // TODO Auto-generated catch block
28 e.printStackTrace(); 28 e.printStackTrace();
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
@@ -34,7 +34,7 @@ public class CalcOilThread extends Thread{ @@ -34,7 +34,7 @@ public class CalcOilThread extends Thread{
34 dlbService.obtainDsq(); 34 dlbService.obtainDsq();
35 logger.info("计算路单里程加注量结束!"); 35 logger.info("计算路单里程加注量结束!");
36 logger.info("开始计算班次准点率...."); 36 logger.info("开始计算班次准点率....");
37 - sheetService.saveSheetList(); 37 + sheetService.saveSheetList("");
38 logger.info("计算班次准点率结束!"); 38 logger.info("计算班次准点率结束!");
39 //清除安全驾驶数据 先临时蹭这个线程 39 //清除安全驾驶数据 先临时蹭这个线程
40 SafeDrivCenter.clear(); 40 SafeDrivCenter.clear();
src/main/java/com/bsth/repository/oil/DlbRepository.java
@@ -81,7 +81,8 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ @@ -81,7 +81,8 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{
81 + " and nbbm like %?5%",nativeQuery=true) 81 + " and nbbm like %?5%",nativeQuery=true)
82 List<Object[]> sumDlb2(String rq, String gsbm,String fgsbm,String xlbm,String nbbm); 82 List<Object[]> sumDlb2(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
83 83
84 - 84 + @Transactional
  85 + @Modifying
85 @Query(value="UPDATE bsth_c_dlb SET " + 86 @Query(value="UPDATE bsth_c_dlb SET " +
86 " czcd= ?2,"+ 87 " czcd= ?2,"+
87 " jzcd = ?3, " + 88 " jzcd = ?3, " +
src/main/java/com/bsth/repository/sheet/SheetRepository.java
@@ -2,6 +2,8 @@ package com.bsth.repository.sheet; @@ -2,6 +2,8 @@ package com.bsth.repository.sheet;
2 2
3 import com.bsth.entity.sheet.Sheet; 3 import com.bsth.entity.sheet.Sheet;
4 import com.bsth.repository.BaseRepository; 4 import com.bsth.repository.BaseRepository;
  5 +
  6 +import org.springframework.data.jpa.repository.Query;
5 import org.springframework.stereotype.Repository; 7 import org.springframework.stereotype.Repository;
6 8
7 /** 9 /**
@@ -9,4 +11,6 @@ import org.springframework.stereotype.Repository; @@ -9,4 +11,6 @@ import org.springframework.stereotype.Repository;
9 */ 11 */
10 @Repository 12 @Repository
11 public interface SheetRepository extends BaseRepository<Sheet, Integer>{ 13 public interface SheetRepository extends BaseRepository<Sheet, Integer>{
  14 + @Query(value = "select count(*) from Sheet s where s.date = ?1")
  15 + int countByDate(String date);
12 } 16 }
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
@@ -559,8 +559,9 @@ public class FormsServiceImpl implements FormsService { @@ -559,8 +559,9 @@ public class FormsServiceImpl implements FormsService {
559 return sin; 559 return sin;
560 } 560 }
561 }); 561 });
562 - 562 + DecimalFormat df = new DecimalFormat("0.00");
563 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); 563 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
  564 + List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
564 List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLine(xlbm, startDate); 565 List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLine(xlbm, startDate);
565 for (int i = 0; i < list.size(); i++) { 566 for (int i = 0; i < list.size(); i++) {
566 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); 567 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
@@ -569,10 +570,12 @@ public class FormsServiceImpl implements FormsService { @@ -569,10 +570,12 @@ public class FormsServiceImpl implements FormsService {
569 String jsy=sin.getJsy(); 570 String jsy=sin.getJsy();
570 String clzbh=sin.getClzbh(); 571 String clzbh=sin.getClzbh();
571 String xl=sin.getxL(); 572 String xl=sin.getxL();
  573 + String spy=sin.getSgh();
572 sin.setxL(BasicData.lineCode2NameMap.get(xl)); 574 sin.setxL(BasicData.lineCode2NameMap.get(xl));
573 for (int j = 0; j < listReal.size(); j++) { 575 for (int j = 0; j < listReal.size(); j++) {
574 ScheduleRealInfo s=listReal.get(j); 576 ScheduleRealInfo s=listReal.get(j);
575 - if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)&&s.getXlBm().equals(xl)){ 577 + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)
  578 + &&s.getXlBm().equals(xl)&&s.getsGh().equals(spy)){
576 newList.add(s); 579 newList.add(s);
577 } 580 }
578 } 581 }
@@ -584,23 +587,39 @@ public class FormsServiceImpl implements FormsService { @@ -584,23 +587,39 @@ public class FormsServiceImpl implements FormsService {
584 double jcgl=culateMileageService.culateJccgl(newList); 587 double jcgl=culateMileageService.culateJccgl(newList);
585 double zyygl=Arith.add(yygl, ljgl); 588 double zyygl=Arith.add(yygl, ljgl);
586 double zksgl=Arith.add(ksgl, jcgl); 589 double zksgl=Arith.add(ksgl, jcgl);
  590 + double zlc=Arith.add(zyygl,zksgl);
587 sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); 591 sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
588 sin.setEmptMileage(String.valueOf(zksgl)); 592 sin.setEmptMileage(String.valueOf(zksgl));
589 sin.setJhjl(String.valueOf(jhgl)); 593 sin.setJhjl(String.valueOf(jhgl));
590 double yhl=0.0; 594 double yhl=0.0;
591 double jzl=0.0; 595 double jzl=0.0;
592 double fyy=0.0; 596 double fyy=0.0;
  597 + double zlcs=0.0;
593 for (int j = 0; j < listYlb.size(); j++) { 598 for (int j = 0; j < listYlb.size(); j++) {
594 Ylb y=listYlb.get(j); 599 Ylb y=listYlb.get(j);
595 if(y.getJsy().equals(jsy) && y.getNbbm().equals(clzbh)){ 600 if(y.getJsy().equals(jsy) && y.getNbbm().equals(clzbh)){
596 yhl=Arith.add(yhl, y.getYh()==null?0:y.getYh()); 601 yhl=Arith.add(yhl, y.getYh()==null?0:y.getYh());
597 jzl=Arith.add(jzl, y.getJzl()==null?0:y.getJzl()); 602 jzl=Arith.add(jzl, y.getJzl()==null?0:y.getJzl());
598 fyy=Arith.add(fyy, y.getSh()==null?0:y.getSh()); 603 fyy=Arith.add(fyy, y.getSh()==null?0:y.getSh());
  604 + zlcs=Arith.add(zlcs, y.getZlc()==null?0:y.getZlc());
599 } 605 }
600 } 606 }
601 - sin.setHyl(String.valueOf(yhl));  
602 - sin.setJzl(String.valueOf(jzl));  
603 - sin.setUnyyyl(String.valueOf(fyy)); 607 +
  608 + for(int j=0;j<listDlb.size();j++){
  609 + Dlb d=listDlb.get(j);
  610 + if(d.getJsy().equals(jsy)&&d.getNbbm().equals(clzbh)){
  611 + yhl=Arith.add(yhl, d.getHd()==null?0:d.getHd());
  612 + jzl=Arith.add(jzl, d.getCdl()==null?0:d.getCdl());
  613 + fyy=Arith.add(fyy, d.getSh()==null?0:d.getSh());
  614 + zlcs=Arith.add(zlcs, d.getZlc()==null?0:d.getZlc());
  615 + }
  616 + }
  617 + if(zlcs>0){
  618 + double lcbfb= zlc/zlcs;
  619 + sin.setHyl(df.format(yhl*lcbfb));
  620 + sin.setJzl(df.format(jzl*lcbfb));
  621 + sin.setUnyyyl(df.format(fyy*lcbfb));
  622 + }
604 } 623 }
605 return list; 624 return list;
606 } 625 }
@@ -658,6 +677,24 @@ public class FormsServiceImpl implements FormsService { @@ -658,6 +677,24 @@ public class FormsServiceImpl implements FormsService {
658 return y; 677 return y;
659 } 678 }
660 }); 679 });
  680 +
  681 + String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+startDate+"' and '"+endDate+"'";
  682 + if(xlbm.equals("")){
  683 + ylbSql +="and ssgsdm='"+gsdm+"' "
  684 + + " and fgsdm='"+fgsdm+"'";
  685 + }else{
  686 + ylbSql += " and xlbm = '"+xlbm+"'";
  687 + }
  688 + List<Dlb> dlbList= jdbcTemplate.query(dlbSql, new RowMapper<Dlb>() {
  689 + @Override
  690 + public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
  691 + Dlb d = new Dlb();
  692 + d.setCdl(arg0.getDouble("cdl"));
  693 + d.setXlbm(arg0.getString("xlbm"));
  694 + d.setHd(arg0.getDouble("hd"));
  695 + return d;
  696 + }
  697 + });
661 List<ScheduleRealInfo> listReal; 698 List<ScheduleRealInfo> listReal;
662 if(xlbm.equals("")){ 699 if(xlbm.equals("")){
663 listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj(xlbm, startDate, endDate, gsdm, fgsdm); 700 listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj(xlbm, startDate, endDate, gsdm, fgsdm);
@@ -700,6 +737,13 @@ public class FormsServiceImpl implements FormsService { @@ -700,6 +737,13 @@ public class FormsServiceImpl implements FormsService {
700 xhl=Arith.add(xhl, t.getYh()); 737 xhl=Arith.add(xhl, t.getYh());
701 } 738 }
702 } 739 }
  740 + for (int j = 0; j < dlbList.size(); j++) {
  741 + Dlb d=dlbList.get(j);
  742 + if(d.getXlbm().equals(line)){
  743 + jzl=Arith.add(jzl, d.getCdl());
  744 + xhl=Arith.add(xhl, d.getHd());
  745 + }
  746 + }
703 747
704 o.setJzl(String.valueOf(jzl)); 748 o.setJzl(String.valueOf(jzl));
705 o.setXhl(String.valueOf(xhl)); 749 o.setXhl(String.valueOf(xhl));
@@ -731,7 +775,8 @@ public class FormsServiceImpl implements FormsService { @@ -731,7 +775,8 @@ public class FormsServiceImpl implements FormsService {
731 }); 775 });
732 776
733 777
734 - List<Ylb> listYlb= ylbRepository.obtainYl(startDate, "", "", line, "", "xlbm"); 778 + List<Ylb> listYlb= ylbRepository.obtainYl(date, "", "", line, "", "xlbm");
  779 + List<Dlb> listDlb= dlbRepository.obtainDl(date, "", "", line, "", "xlbm");
735 List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); 780 List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
736 for (int i = 0; i < list.size(); i++) { 781 for (int i = 0; i < list.size(); i++) {
737 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); 782 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
@@ -771,6 +816,14 @@ public class FormsServiceImpl implements FormsService { @@ -771,6 +816,14 @@ public class FormsServiceImpl implements FormsService {
771 ns =Arith.add(ns, y.getNs()==null?0:y.getNs()); 816 ns =Arith.add(ns, y.getNs()==null?0:y.getNs());
772 } 817 }
773 } 818 }
  819 + for (int j = 0; j < listDlb.size(); j++) {
  820 + Dlb d=listDlb.get(j);
  821 + if(d.getJsy().equals(jsy) && d.getNbbm().equals(clzbh)){
  822 + yhl=Arith.add(yhl, d.getHd()==null?0:d.getHd());
  823 + jzl=Arith.add(jzl, d.getCdl()==null?0:d.getCdl());
  824 + fyy=Arith.add(fyy, d.getSh()==null?0:d.getSh());
  825 + }
  826 + }
774 sin.setHyl(String.valueOf(yhl)); 827 sin.setHyl(String.valueOf(yhl));
775 sin.setJzl(String.valueOf(jzl)); 828 sin.setJzl(String.valueOf(jzl));
776 sin.setUnyyyl(String.valueOf(fyy)); 829 sin.setUnyyyl(String.valueOf(fyy));
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
@@ -704,15 +704,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -704,15 +704,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
704 // String nbbm =jsonObject.getString("nbbm"); 704 // String nbbm =jsonObject.getString("nbbm");
705 // String rq=jsonObject.getString("rq"); 705 // String rq=jsonObject.getString("rq");
706 repository.dlbUpdate(id, czcd, jzcd, hd, sh, shyy, yhlx); 706 repository.dlbUpdate(id, czcd, jzcd, hd, sh, shyy, yhlx);
707 - /*for (int z = 0; z < cylList.size(); z++) {  
708 - Cyl cyl = cylList.get(z);  
709 - if (nbbm.equals(cyl.getNbbm())) {  
710 - cyl.setCyl(jzyl);  
711 - cyl.setUpdatetime(sdf.parse(rq));  
712 - break;  
713 - }  
714 - cylRepository.save(cyl);  
715 - }*/ 707 +
716 } 708 }
717 newMap.put("status", ResponseCode.SUCCESS); 709 newMap.put("status", ResponseCode.SUCCESS);
718 }catch(Exception e){ 710 }catch(Exception e){
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -731,12 +731,31 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -731,12 +731,31 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
731 state = state + "+1"; 731 state = state + "+1";
732 type = "ASC"; 732 type = "ASC";
733 } 733 }
734 - String sqlPlan = "select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh,"  
735 - + " s.lp_Name as lpName,s.j_Name as jName,min(s.schedule_date_str) as dateStr ,min(s.fcsj) as fcsj" 734 + /*String sqlPlan = "select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh,"
  735 + + " s.lp_Name as lpName,s.j_Name as jName,min(s.schedule_date_str) as dateStr ,"
  736 + + " min(s.fcsj) as fcsj, min(s.schedule_date) as date"
736 + " from bsth_c_s_sp_info_real s " 737 + " from bsth_c_s_sp_info_real s "
737 + " where s.xl_Bm = '" + line + "' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='" + date + "' " 738 + " where s.xl_Bm = '" + line + "' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='" + date + "' "
738 + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name" 739 + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name"
739 - + " order by (" + state + "),dateStr,fcsj " + type; 740 + + " order by (" + state + "),dateStr,fcsj " + type;*/
  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 ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  744 + + ")";
  745 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  746 + String sqlPlan ="select * from (select * from ("
  747 + + " select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, "
  748 + + " s.lp_Name as lpName,s.j_Name as jName,max(s.schedule_date_str) as dateStr ,"
  749 + + " min(s.fcsj) as fcsj,1 as px from bsth_c_s_sp_info_real s where "
  750 + + " s.xl_Bm = '"+line+"' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='"+date+"'"
  751 + + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name ) x where x.fcsj >'"+minfcsj+"'"
  752 + + " UNION "
  753 + + " select * from ( select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, "
  754 + + " s.lp_Name as lpName,s.j_Name as jName, max(s.schedule_date_str) as dateStr,"
  755 + + " min(s.fcsj) as fcsj,2 as px from bsth_c_s_sp_info_real s "
  756 + + " where s.xl_Bm = '"+line+"' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='"+date+"'"
  757 + + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name "
  758 + + " ) y where y.fcsj <='"+minfcsj+"') z order by (" + state + "),dateStr,px " + type;
740 List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan, 759 List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan,
741 new RowMapper<ScheduleRealInfo>() { 760 new RowMapper<ScheduleRealInfo>() {
742 @Override 761 @Override
@@ -747,10 +766,48 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -747,10 +766,48 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
747 t.setClZbh(rs.getString("clZbh")); 766 t.setClZbh(rs.getString("clZbh"));
748 t.setLpName(rs.getString("lpName")); 767 t.setLpName(rs.getString("lpName"));
749 t.setjName(rs.getString("jName")); 768 t.setjName(rs.getString("jName"));
  769 + t.setFcsj(rs.getString("fcsj"));
750 return t; 770 return t;
751 } 771 }
752 }); 772 });
753 if (lpname.equals("lpName")) { 773 if (lpname.equals("lpName")) {
  774 + /* SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  775 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  776 + + " id = ("
  777 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  778 + + ")";
  779 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  780 + String[] minSjs = minfcsj.split(":");
  781 + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
  782 + for (int i = 0; i < list.size(); i++) {
  783 + ScheduleRealInfo s=list.get(i);
  784 + String[] fcsj= s.getFcsj().split(":");
  785 + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]);
  786 +
  787 + Long fscjT=0L;
  788 + if(fcsjL<minSj){
  789 + Calendar calendar = new GregorianCalendar();
  790 + calendar.setTime(s.getScheduleDate());
  791 + calendar.add(calendar.DATE,1);
  792 + s.setScheduleDate(calendar.getTime());
  793 + try {
  794 + fscjT = sdf.parse(sdf.format(s.getScheduleDate())+" "+s.getFcsj()).getTime();
  795 + } catch (ParseException e) {
  796 + // TODO Auto-generated catch block
  797 + e.printStackTrace();
  798 + }
  799 +
  800 + }else{
  801 + try {
  802 + fscjT =sdf.parse(s.getScheduleDateStr()+" "+s.getFcsj()).getTime();
  803 + } catch (ParseException e) {
  804 + // TODO Auto-generated catch block
  805 + e.printStackTrace();
  806 + };
  807 + }
  808 + s.setFcsjT(fscjT);
  809 + }
  810 + Collections.sort(list, new ComparableReal());*/
754 List<ScheduleRealInfo> listNew = new ArrayList<ScheduleRealInfo>(); 811 List<ScheduleRealInfo> listNew = new ArrayList<ScheduleRealInfo>();
755 Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); 812 Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
756 // if (px.equals("desc")) { 813 // if (px.equals("desc")) {
@@ -2617,6 +2674,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2617,6 +2674,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2617 }*/ 2674 }*/
2618 2675
2619 public final Map<String, Object> staticTj(List<ScheduleRealInfo> list){ 2676 public final Map<String, Object> staticTj(List<ScheduleRealInfo> list){
  2677 +
2620 List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>(); 2678 List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
2621 for(int i=0;i<list.size();i++){ 2679 for(int i=0;i<list.size();i++){
2622 ScheduleRealInfo s=list.get(i); 2680 ScheduleRealInfo s=list.get(i);
@@ -2630,57 +2688,59 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2630,57 +2688,59 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2630 } 2688 }
2631 } 2689 }
2632 Map<String, Object> map = new HashMap<String, Object>(); 2690 Map<String, Object> map = new HashMap<String, Object>();
2633 - map.put("xlName", lists.get(0).getXlName());  
2634 - double jhyygl=culateService.culateJhgl(list);//计划营运公里  
2635 - double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)  
2636 - map.put("jhlc", jhyygl);  
2637 - map.put("jcclc", jhjcclc);  
2638 - map.put("jhzlc", Arith.add(jhyygl, jhjcclc));  
2639 -  
2640 - double ljgl= culateService.culateLjgl(lists);  
2641 - double sjyygl= culateService.culateSjgl(lists);  
2642 - double zyygl= Arith.add(sjyygl,ljgl);  
2643 -  
2644 - double sjjccgl=culateService.culateJccgl(lists);  
2645 - double sjksgl=culateService.culateKsgl(lists);  
2646 - double zksgl=Arith.add(sjjccgl, sjksgl);  
2647 - map.put("sjzgl", Arith.add(zyygl, zksgl));  
2648 - map.put("sjgl",zyygl);  
2649 - map.put("sjksgl", zksgl);  
2650 -  
2651 - map.put("ssgl", culateService.culateLbgl(list));  
2652 - map.put("ssgl_lz", culateService.culateCJLC(list, "路阻"));  
2653 - map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢"));  
2654 - map.put("ssgl_gz", culateService.culateCJLC(list, "故障"));  
2655 - map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷"));  
2656 - map.put("ssgl_zs", culateService.culateCJLC(list, "肇事"));  
2657 - map.put("ssgl_qr", culateService.culateCJLC(list, "缺人"));  
2658 - map.put("ssgl_qc", culateService.culateCJLC(list, "缺车"));  
2659 - map.put("ssgl_kx", culateService.culateCJLC(list, "客稀"));  
2660 - map.put("ssgl_qh", culateService.culateCJLC(list, "气候"));  
2661 - map.put("ssgl_yw", culateService.culateCJLC(list, "援外"));  
2662 - map.put("ssgl_other", culateService.culateCJLC(list, "其他"));  
2663 - map.put("ssbc", culateService.culateLbbc(list));  
2664 - map.put("ljgl", ljgl);  
2665 - map.put("jhbc", culateService.culateJhbc(list,""));  
2666 - map.put("jhbc_m", culateService.culateJhbc(list, "zgf"));  
2667 - map.put("jhbc_a", culateService.culateJhbc(list, "wgf"));  
2668 - map.put("sjbc", culateService.culateSjbc(lists,""));  
2669 - map.put("sjbc_m", culateService.culateSjbc(lists,"zgf"));  
2670 - map.put("sjbc_a", culateService.culateSjbc(lists,"wgf"));  
2671 - map.put("ljbc", culateService.culateLjbc(lists,""));  
2672 - map.put("ljbc_m", culateService.culateLjbc(lists,"zgf"));  
2673 - map.put("ljbc_a", culateService.culateLjbc(lists,"wgf"));  
2674 - map.put("fzbc", culateService.culateFzbc(lists, ""));  
2675 - map.put("fzbc_m", culateService.culateFzbc(lists, "zgf"));  
2676 - map.put("fzbc_a", culateService.culateFzbc(lists, "wgf"));  
2677 - map.put("dtbc", 0);  
2678 - map.put("dtbc_m", 0);  
2679 - map.put("dtbc_a", 0);  
2680 - map.put("djg", 0);  
2681 - map.put("djg_m", 0);  
2682 - map.put("djg_a", 0);  
2683 - map.put("djg_time", 0); 2691 + if(list.size()>0){
  2692 + map.put("xlName", list.get(0).getXlName());
  2693 + double jhyygl=culateService.culateJhgl(list);//计划营运公里
  2694 + double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)
  2695 + map.put("jhlc", jhyygl);
  2696 + map.put("jcclc", jhjcclc);
  2697 + map.put("jhzlc", Arith.add(jhyygl, jhjcclc));
  2698 +
  2699 + double ljgl= culateService.culateLjgl(lists);
  2700 + double sjyygl= culateService.culateSjgl(lists);
  2701 + double zyygl= Arith.add(sjyygl,ljgl);
  2702 +
  2703 + double sjjccgl=culateService.culateJccgl(lists);
  2704 + double sjksgl=culateService.culateKsgl(lists);
  2705 + double zksgl=Arith.add(sjjccgl, sjksgl);
  2706 + map.put("sjzgl", Arith.add(zyygl, zksgl));
  2707 + map.put("sjgl",zyygl);
  2708 + map.put("sjksgl", zksgl);
  2709 +
  2710 + map.put("ssgl", culateService.culateLbgl(list));
  2711 + map.put("ssgl_lz", culateService.culateCJLC(list, "路阻"));
  2712 + map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢"));
  2713 + map.put("ssgl_gz", culateService.culateCJLC(list, "故障"));
  2714 + map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷"));
  2715 + map.put("ssgl_zs", culateService.culateCJLC(list, "肇事"));
  2716 + map.put("ssgl_qr", culateService.culateCJLC(list, "缺人"));
  2717 + map.put("ssgl_qc", culateService.culateCJLC(list, "缺车"));
  2718 + map.put("ssgl_kx", culateService.culateCJLC(list, "客稀"));
  2719 + map.put("ssgl_qh", culateService.culateCJLC(list, "气候"));
  2720 + map.put("ssgl_yw", culateService.culateCJLC(list, "援外"));
  2721 + map.put("ssgl_other", culateService.culateCJLC(list, "其他"));
  2722 + map.put("ssbc", culateService.culateLbbc(list));
  2723 + map.put("ljgl", ljgl);
  2724 + map.put("jhbc", culateService.culateJhbc(list,""));
  2725 + map.put("jhbc_m", culateService.culateJhbc(list, "zgf"));
  2726 + map.put("jhbc_a", culateService.culateJhbc(list, "wgf"));
  2727 + map.put("sjbc", culateService.culateSjbc(lists,""));
  2728 + map.put("sjbc_m", culateService.culateSjbc(lists,"zgf"));
  2729 + map.put("sjbc_a", culateService.culateSjbc(lists,"wgf"));
  2730 + map.put("ljbc", culateService.culateLjbc(lists,""));
  2731 + map.put("ljbc_m", culateService.culateLjbc(lists,"zgf"));
  2732 + map.put("ljbc_a", culateService.culateLjbc(lists,"wgf"));
  2733 + map.put("fzbc", culateService.culateFzbc(lists, ""));
  2734 + map.put("fzbc_m", culateService.culateFzbc(lists, "zgf"));
  2735 + map.put("fzbc_a", culateService.culateFzbc(lists, "wgf"));
  2736 + map.put("dtbc", 0);
  2737 + map.put("dtbc_m", 0);
  2738 + map.put("dtbc_a", 0);
  2739 + map.put("djg", 0);
  2740 + map.put("djg_m", 0);
  2741 + map.put("djg_a", 0);
  2742 + map.put("djg_time", 0);
  2743 + }
2684 return map; 2744 return map;
2685 } 2745 }
2686 2746
src/main/java/com/bsth/service/report/SheetService.java
@@ -8,7 +8,7 @@ import com.bsth.service.BaseService; @@ -8,7 +8,7 @@ import com.bsth.service.BaseService;
8 8
9 public interface SheetService extends BaseService<Sheet, Integer>{ 9 public interface SheetService extends BaseService<Sheet, Integer>{
10 public List<Map<String, Object>> bcPunctual(Map<String, Object> map); 10 public List<Map<String, Object>> bcPunctual(Map<String, Object> map);
11 - public String saveSheetList() throws Exception; 11 + public String saveSheetList(String date) throws Exception;
12 public List<Map<String, Object>> countList(Map<String, Object> map); 12 public List<Map<String, Object>> countList(Map<String, Object> map);
13 13
14 public List<Sheet> sheetList(Integer id); 14 public List<Sheet> sheetList(Integer id);
src/main/java/com/bsth/service/report/impl/SheetServiceImpl.java
@@ -82,48 +82,53 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements @@ -82,48 +82,53 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
82 return fage; 82 return fage;
83 } 83 }
84 @Override 84 @Override
85 - public String saveSheetList() throws Exception{ 85 + public String saveSheetList(String rq) throws Exception{
86 Map<String, Object> map=new HashMap<String,Object>(); 86 Map<String, Object> map=new HashMap<String,Object>();
87 String result = "failure"; 87 String result = "failure";
  88 +
88 try { 89 try {
89 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); 90 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
90 - Date dNow = new Date(); //当前时间  
91 - Calendar calendar = Calendar.getInstance(); //得到日历  
92 - calendar.setTime(dNow);//把当前时间赋给日历  
93 - calendar.add(Calendar.DAY_OF_MONTH, -3); //设置为前三天  
94 -  
95 - String rq=sdf.format(calendar.getTime());  
96 -// String rq="2017-05-16";  
97 -  
98 - List<Line> lineList = (List<Line>) lineRepository.findAll();  
99 91
100 - List<ScheduleRealInfo> lists= scheduleRealInfoRepository.findByDate(rq);  
101 - List<Sheet> listAdds=new ArrayList<Sheet>();  
102 - for (int i = 0; i < lineList.size(); i++) {  
103 - List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();  
104 - String line=lineList.get(i).getLineCode();  
105 - for (int j = 0; j < lists.size(); j++) {  
106 - ScheduleRealInfo s=lists.get(j);  
107 - if(!isInOut(s)){  
108 - if(s.getXlBm().equals(line)){  
109 - list.add(s); 92 + if(rq.equals("")){
  93 + Date dNow = new Date(); //当前时间
  94 + Calendar calendar = Calendar.getInstance(); //得到日历
  95 + calendar.setTime(dNow);//把当前时间赋给日历
  96 + calendar.add(Calendar.DAY_OF_MONTH, -3); //设置为前三天
  97 + rq=sdf.format(calendar.getTime());
  98 + }
  99 + int count=sheetRepository.countByDate(rq);
  100 + if(count<=0){
  101 + List<Line> lineList = (List<Line>) lineRepository.findAll();
  102 +
  103 + List<ScheduleRealInfo> lists= scheduleRealInfoRepository.findByDate(rq);
  104 + List<Sheet> listAdds=new ArrayList<Sheet>();
  105 + for (int i = 0; i < lineList.size(); i++) {
  106 + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  107 + String line=lineList.get(i).getLineCode();
  108 + for (int j = 0; j < lists.size(); j++) {
  109 + ScheduleRealInfo s=lists.get(j);
  110 + if(!isInOut(s)){
  111 + if(s.getXlBm().equals(line)){
  112 + list.add(s);
  113 + }
110 } 114 }
111 } 115 }
112 -  
113 - }  
114 - if(list.size()>0){  
115 - List<Sheet> listAdd=punctualByLine(line,list);  
116 - if(listAdd.size()>0){  
117 - listAdds.addAll(listAdd); 116 + if(list.size()>0){
  117 + List<Sheet> listAdd=punctualByLine(line,list);
  118 + if(listAdd.size()>0){
  119 + listAdds.addAll(listAdd);
  120 + }
118 } 121 }
  122 +
119 } 123 }
120 124
121 - }  
122 -  
123 - if(listAdds.size()>0){  
124 - new BatchSaveUtils<Sheet>().saveList(listAdds, Sheet.class);  
125 - }  
126 - result = "success"; 125 + if(listAdds.size()>0){
  126 + new BatchSaveUtils<Sheet>().saveList(listAdds, Sheet.class);
  127 + }
  128 + result = "success";
  129 + }else{
  130 + result ="count";
  131 + }
127 }catch (Exception e) { 132 }catch (Exception e) {
128 // TODO Auto-generated catch block 133 // TODO Auto-generated catch block
129 throw e; 134 throw e;
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
@@ -801,6 +801,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -801,6 +801,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
801 String nbbm = map.get("nbbm").toString(); 801 String nbbm = map.get("nbbm").toString();
802 String type = map.get("type").toString(); 802 String type = map.get("type").toString();
803 803
  804 + String companyName = "";
  805 + String subCompanyName = "";
  806 + String lineName = "";
  807 +
804 if(startDate.length() == 0){ 808 if(startDate.length() == 0){
805 startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 809 startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
806 } 810 }
@@ -934,8 +938,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -934,8 +938,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
934 tempList.add(m7); 938 tempList.add(m7);
935 } 939 }
936 940
937 - String companyName = "";  
938 - String subCompanyName = "";  
939 941
940 //按时间段分组 942 //按时间段分组
941 for(ScheduleRealInfo schedule : list){ 943 for(ScheduleRealInfo schedule : list){
@@ -947,6 +949,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -947,6 +949,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
947 &&schedule.getFgsName().trim().length()!=0){ 949 &&schedule.getFgsName().trim().length()!=0){
948 subCompanyName = schedule.getFgsName(); 950 subCompanyName = schedule.getFgsName();
949 } 951 }
  952 + if(lineName.length()==0&&schedule.getXlName()!=null
  953 + &&schedule.getXlName().trim().length()!=0){
  954 + lineName = schedule.getXlName();
  955 + }
950 956
951 if(schedule.getFcsjActualTime()!=null && schedule.getZdsjActualTime()!=null){ 957 if(schedule.getFcsjActualTime()!=null && schedule.getZdsjActualTime()!=null){
952 Long fcsjA = schedule.getFcsjActualTime(); 958 Long fcsjA = schedule.getFcsjActualTime();
@@ -1005,6 +1011,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1005,6 +1011,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1005 for(String key : keyMap.keySet()){ 1011 for(String key : keyMap.keySet()){
1006 Map<String, Object> m = null; 1012 Map<String, Object> m = null;
1007 for(Map<String, Object> map2 : tempList){ 1013 for(Map<String, Object> map2 : tempList){
  1014 + map2.put("line", lineName.trim());
  1015 + map2.put("company", companyName.trim());
  1016 + map2.put("subCompany", subCompanyName.trim());
1008 if(map2.get("time").toString().equals(key)){ 1017 if(map2.get("time").toString().equals(key)){
1009 m = map2; 1018 m = map2;
1010 } 1019 }
@@ -1020,18 +1029,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1020,18 +1029,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1020 dnbc++; 1029 dnbc++;
1021 dnys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime(); 1030 dnys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime();
1022 } 1031 }
1023 -  
1024 - if(schedule.getXlName() != null && schedule.getXlName().trim().length() != 0){  
1025 - m.put("line", schedule.getXlName());  
1026 - }  
1027 } 1032 }
1028 m.put("upbc", upbc); 1033 m.put("upbc", upbc);
1029 m.put("dnbc", dnbc); 1034 m.put("dnbc", dnbc);
1030 m.put("upys", upbc > 0 ? nf.format((float)upys / upbc) : "/"); 1035 m.put("upys", upbc > 0 ? nf.format((float)upys / upbc) : "/");
1031 m.put("dnys", dnbc > 0 ? nf.format((float)dnys / dnbc) : "/"); 1036 m.put("dnys", dnbc > 0 ? nf.format((float)dnys / dnbc) : "/");
1032 m.put("pjys", (upbc + dnbc) > 0 ? nf.format((float) (upys + dnys) / (upbc + dnbc)) : "/"); 1037 m.put("pjys", (upbc + dnbc) > 0 ? nf.format((float) (upys + dnys) / (upbc + dnbc)) : "/");
1033 - m.put("company", companyName.trim());  
1034 - m.put("subCompany", subCompanyName.trim());  
1035 } 1038 }
1036 1039
1037 if(flag){ 1040 if(flag){