Commit b7e2a4324539a0e43c275321ab9990616f5b201b
Merge branch 'minhang' into pudong
Showing
11 changed files
with
267 additions
and
134 deletions
Too many changes to show.
To preserve performance only 11 of 17 files are displayed.
src/main/java/com/bsth/controller/report/SheetController.java
| ... | ... | @@ -19,10 +19,10 @@ public class SheetController extends BaseController<Sheet, Integer>{ |
| 19 | 19 | @Autowired |
| 20 | 20 | SheetService sheetService; |
| 21 | 21 | @RequestMapping(value = "/saveListSheet",method = RequestMethod.POST) |
| 22 | - public String saveListSheet(){ | |
| 22 | + public String saveListSheet(@RequestParam String date){ | |
| 23 | 23 | String result=""; |
| 24 | 24 | try { |
| 25 | - result = sheetService.saveSheetList(); | |
| 25 | + result = sheetService.saveSheetList(date); | |
| 26 | 26 | } catch (Exception e) { |
| 27 | 27 | // TODO Auto-generated catch block |
| 28 | 28 | e.printStackTrace(); | ... | ... |
src/main/java/com/bsth/data/schedule/edit_logs/ScheduleModifyLogger.java
| ... | ... | @@ -187,17 +187,9 @@ public class ScheduleModifyLogger { |
| 187 | 187 | String newNbbm = cpc.getClZbh(); |
| 188 | 188 | String newJsy = cpc.getJsy(); |
| 189 | 189 | String newSpy = cpc.getSpy(); |
| 190 | - //String oldJsy = sch.getjGh() + "/" + sch.getjName(); | |
| 191 | 190 | |
| 192 | 191 | if (newNbbm == null && newJsy == null && newSpy==null) |
| 193 | 192 | return; |
| 194 | - /*if (newNbbm != null && newJsy != null | |
| 195 | - && newNbbm.equals(sch.getClZbh()) && newJsy.equals(oldJsy)) | |
| 196 | - return;*/ | |
| 197 | - | |
| 198 | - | |
| 199 | - SchEditInfo sei = SchEditInfo.getInstance(sch); | |
| 200 | - sei.setType(EditType.TZRC); | |
| 201 | 193 | |
| 202 | 194 | //detail |
| 203 | 195 | JSONObject jobj = new JSONObject(); |
| ... | ... | @@ -213,11 +205,22 @@ public class ScheduleModifyLogger { |
| 213 | 205 | } |
| 214 | 206 | |
| 215 | 207 | String oldSpy = sch.getsGh() + "/" + sch.getsName(); |
| 216 | - if (StringUtils.isNotEmpty(newSpy) && !newSpy.equals(oldSpy)) { | |
| 217 | - jobj.put("old_spy", oldSpy); | |
| 218 | - jobj.put("now_spy", cpc.getSpy()); | |
| 208 | + if(newSpy != null){ | |
| 209 | + if(newSpy.equals("")) | |
| 210 | + newSpy = "/"; | |
| 211 | + | |
| 212 | + if(!newSpy.equals(oldSpy)){ | |
| 213 | + jobj.put("old_spy", oldSpy); | |
| 214 | + jobj.put("now_spy", newSpy); | |
| 215 | + } | |
| 219 | 216 | } |
| 220 | 217 | |
| 218 | + if(jobj.size() == 0) | |
| 219 | + return; | |
| 220 | + | |
| 221 | + SchEditInfo sei = SchEditInfo.getInstance(sch); | |
| 222 | + sei.setType(EditType.TZRC); | |
| 223 | + | |
| 221 | 224 | sei.setJsonArray(jobj.toJSONString()); |
| 222 | 225 | put(sei); |
| 223 | 226 | } catch (Exception e) { | ... | ... |
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
| ... | ... | @@ -34,7 +34,7 @@ public class CalcOilThread extends Thread{ |
| 34 | 34 | dlbService.obtainDsq(); |
| 35 | 35 | logger.info("计算路单里程加注量结束!"); |
| 36 | 36 | logger.info("开始计算班次准点率...."); |
| 37 | - sheetService.saveSheetList(); | |
| 37 | + sheetService.saveSheetList(""); | |
| 38 | 38 | logger.info("计算班次准点率结束!"); |
| 39 | 39 | //清除安全驾驶数据 先临时蹭这个线程 |
| 40 | 40 | SafeDrivCenter.clear(); | ... | ... |
src/main/java/com/bsth/repository/oil/DlbRepository.java
| ... | ... | @@ -81,7 +81,8 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ |
| 81 | 81 | + " and nbbm like %?5%",nativeQuery=true) |
| 82 | 82 | List<Object[]> sumDlb2(String rq, String gsbm,String fgsbm,String xlbm,String nbbm); |
| 83 | 83 | |
| 84 | - | |
| 84 | + @Transactional | |
| 85 | + @Modifying | |
| 85 | 86 | @Query(value="UPDATE bsth_c_dlb SET " + |
| 86 | 87 | " czcd= ?2,"+ |
| 87 | 88 | " jzcd = ?3, " + | ... | ... |
src/main/java/com/bsth/repository/sheet/SheetRepository.java
| ... | ... | @@ -2,6 +2,8 @@ package com.bsth.repository.sheet; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.sheet.Sheet; |
| 4 | 4 | import com.bsth.repository.BaseRepository; |
| 5 | + | |
| 6 | +import org.springframework.data.jpa.repository.Query; | |
| 5 | 7 | import org.springframework.stereotype.Repository; |
| 6 | 8 | |
| 7 | 9 | /** |
| ... | ... | @@ -9,4 +11,6 @@ import org.springframework.stereotype.Repository; |
| 9 | 11 | */ |
| 10 | 12 | @Repository |
| 11 | 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 | 559 | return sin; |
| 560 | 560 | } |
| 561 | 561 | }); |
| 562 | - | |
| 562 | + DecimalFormat df = new DecimalFormat("0.00"); | |
| 563 | 563 | List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); |
| 564 | + List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); | |
| 564 | 565 | List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLine(xlbm, startDate); |
| 565 | 566 | for (int i = 0; i < list.size(); i++) { |
| 566 | 567 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); |
| ... | ... | @@ -569,10 +570,12 @@ public class FormsServiceImpl implements FormsService { |
| 569 | 570 | String jsy=sin.getJsy(); |
| 570 | 571 | String clzbh=sin.getClzbh(); |
| 571 | 572 | String xl=sin.getxL(); |
| 573 | + String spy=sin.getSgh(); | |
| 572 | 574 | sin.setxL(BasicData.lineCode2NameMap.get(xl)); |
| 573 | 575 | for (int j = 0; j < listReal.size(); j++) { |
| 574 | 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 | 579 | newList.add(s); |
| 577 | 580 | } |
| 578 | 581 | } |
| ... | ... | @@ -584,23 +587,39 @@ public class FormsServiceImpl implements FormsService { |
| 584 | 587 | double jcgl=culateMileageService.culateJccgl(newList); |
| 585 | 588 | double zyygl=Arith.add(yygl, ljgl); |
| 586 | 589 | double zksgl=Arith.add(ksgl, jcgl); |
| 590 | + double zlc=Arith.add(zyygl,zksgl); | |
| 587 | 591 | sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); |
| 588 | 592 | sin.setEmptMileage(String.valueOf(zksgl)); |
| 589 | 593 | sin.setJhjl(String.valueOf(jhgl)); |
| 590 | 594 | double yhl=0.0; |
| 591 | 595 | double jzl=0.0; |
| 592 | 596 | double fyy=0.0; |
| 597 | + double zlcs=0.0; | |
| 593 | 598 | for (int j = 0; j < listYlb.size(); j++) { |
| 594 | 599 | Ylb y=listYlb.get(j); |
| 595 | 600 | if(y.getJsy().equals(jsy) && y.getNbbm().equals(clzbh)){ |
| 596 | 601 | yhl=Arith.add(yhl, y.getYh()==null?0:y.getYh()); |
| 597 | 602 | jzl=Arith.add(jzl, y.getJzl()==null?0:y.getJzl()); |
| 598 | 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 | 624 | return list; |
| 606 | 625 | } |
| ... | ... | @@ -658,6 +677,24 @@ public class FormsServiceImpl implements FormsService { |
| 658 | 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 | 698 | List<ScheduleRealInfo> listReal; |
| 662 | 699 | if(xlbm.equals("")){ |
| 663 | 700 | listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj(xlbm, startDate, endDate, gsdm, fgsdm); |
| ... | ... | @@ -700,6 +737,13 @@ public class FormsServiceImpl implements FormsService { |
| 700 | 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 | 748 | o.setJzl(String.valueOf(jzl)); |
| 705 | 749 | o.setXhl(String.valueOf(xhl)); |
| ... | ... | @@ -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 | 780 | List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); |
| 736 | 781 | for (int i = 0; i < list.size(); i++) { |
| 737 | 782 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); |
| ... | ... | @@ -771,6 +816,14 @@ public class FormsServiceImpl implements FormsService { |
| 771 | 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 | 827 | sin.setHyl(String.valueOf(yhl)); |
| 775 | 828 | sin.setJzl(String.valueOf(jzl)); |
| 776 | 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<Dlb,Integer> implements DlbS |
| 704 | 704 | // String nbbm =jsonObject.getString("nbbm"); |
| 705 | 705 | // String rq=jsonObject.getString("rq"); |
| 706 | 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 | 709 | newMap.put("status", ResponseCode.SUCCESS); |
| 718 | 710 | }catch(Exception e){ | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -244,6 +244,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 244 | 244 | schedule.setBcType(bcType); |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | + //如果正在执行该班次 | |
| 248 | + ScheduleRealInfo exec = dayOfSchedule.executeCurr(schedule.getClZbh()); | |
| 249 | + if(exec != null && exec == schedule){ | |
| 250 | + //重新计算正在执行班次 | |
| 251 | + dayOfSchedule.reCalcExecPlan(schedule.getClZbh()); | |
| 252 | + } | |
| 253 | + | |
| 247 | 254 | //重新计算是否误点 |
| 248 | 255 | schedule.reCalcLate(); |
| 249 | 256 | //取消应发未到标记,不再自动调整待发 |
| ... | ... | @@ -724,12 +731,31 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 724 | 731 | state = state + "+1"; |
| 725 | 732 | type = "ASC"; |
| 726 | 733 | } |
| 727 | - String sqlPlan = "select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh," | |
| 728 | - + " 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" | |
| 729 | 737 | + " from bsth_c_s_sp_info_real s " |
| 730 | 738 | + " where s.xl_Bm = '" + line + "' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='" + date + "' " |
| 731 | 739 | + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name" |
| 732 | - + " 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; | |
| 733 | 759 | List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan, |
| 734 | 760 | new RowMapper<ScheduleRealInfo>() { |
| 735 | 761 | @Override |
| ... | ... | @@ -740,10 +766,48 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 740 | 766 | t.setClZbh(rs.getString("clZbh")); |
| 741 | 767 | t.setLpName(rs.getString("lpName")); |
| 742 | 768 | t.setjName(rs.getString("jName")); |
| 769 | + t.setFcsj(rs.getString("fcsj")); | |
| 743 | 770 | return t; |
| 744 | 771 | } |
| 745 | 772 | }); |
| 746 | 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());*/ | |
| 747 | 811 | List<ScheduleRealInfo> listNew = new ArrayList<ScheduleRealInfo>(); |
| 748 | 812 | Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); |
| 749 | 813 | // if (px.equals("desc")) { |
| ... | ... | @@ -2610,6 +2674,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2610 | 2674 | }*/ |
| 2611 | 2675 | |
| 2612 | 2676 | public final Map<String, Object> staticTj(List<ScheduleRealInfo> list){ |
| 2677 | + | |
| 2613 | 2678 | List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>(); |
| 2614 | 2679 | for(int i=0;i<list.size();i++){ |
| 2615 | 2680 | ScheduleRealInfo s=list.get(i); |
| ... | ... | @@ -2623,57 +2688,59 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2623 | 2688 | } |
| 2624 | 2689 | } |
| 2625 | 2690 | Map<String, Object> map = new HashMap<String, Object>(); |
| 2626 | - map.put("xlName", lists.get(0).getXlName()); | |
| 2627 | - double jhyygl=culateService.culateJhgl(list);//计划营运公里 | |
| 2628 | - double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 2629 | - map.put("jhlc", jhyygl); | |
| 2630 | - map.put("jcclc", jhjcclc); | |
| 2631 | - map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 2632 | - | |
| 2633 | - double ljgl= culateService.culateLjgl(lists); | |
| 2634 | - double sjyygl= culateService.culateSjgl(lists); | |
| 2635 | - double zyygl= Arith.add(sjyygl,ljgl); | |
| 2636 | - | |
| 2637 | - double sjjccgl=culateService.culateJccgl(lists); | |
| 2638 | - double sjksgl=culateService.culateKsgl(lists); | |
| 2639 | - double zksgl=Arith.add(sjjccgl, sjksgl); | |
| 2640 | - map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 2641 | - map.put("sjgl",zyygl); | |
| 2642 | - map.put("sjksgl", zksgl); | |
| 2643 | - | |
| 2644 | - map.put("ssgl", culateService.culateLbgl(list)); | |
| 2645 | - map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 2646 | - map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 2647 | - map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 2648 | - map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 2649 | - map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 2650 | - map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 2651 | - map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 2652 | - map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 2653 | - map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 2654 | - map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 2655 | - map.put("ssgl_other", culateService.culateCJLC(list, "其他")); | |
| 2656 | - map.put("ssbc", culateService.culateLbbc(list)); | |
| 2657 | - map.put("ljgl", ljgl); | |
| 2658 | - map.put("jhbc", culateService.culateJhbc(list,"")); | |
| 2659 | - map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 2660 | - map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 2661 | - map.put("sjbc", culateService.culateSjbc(lists,"")); | |
| 2662 | - map.put("sjbc_m", culateService.culateSjbc(lists,"zgf")); | |
| 2663 | - map.put("sjbc_a", culateService.culateSjbc(lists,"wgf")); | |
| 2664 | - map.put("ljbc", culateService.culateLjbc(lists,"")); | |
| 2665 | - map.put("ljbc_m", culateService.culateLjbc(lists,"zgf")); | |
| 2666 | - map.put("ljbc_a", culateService.culateLjbc(lists,"wgf")); | |
| 2667 | - map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 2668 | - map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 2669 | - map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 2670 | - map.put("dtbc", 0); | |
| 2671 | - map.put("dtbc_m", 0); | |
| 2672 | - map.put("dtbc_a", 0); | |
| 2673 | - map.put("djg", 0); | |
| 2674 | - map.put("djg_m", 0); | |
| 2675 | - map.put("djg_a", 0); | |
| 2676 | - 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 | + } | |
| 2677 | 2744 | return map; |
| 2678 | 2745 | } |
| 2679 | 2746 | |
| ... | ... | @@ -3222,8 +3289,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3222 | 3289 | |
| 3223 | 3290 | if (StringUtils.isNotEmpty(cpc.getJsy())) { |
| 3224 | 3291 | //换驾驶员 |
| 3225 | - persoChange(sch, jGh); | |
| 3226 | - set.add(sch); | |
| 3292 | + if(persoChange(sch, jGh)) | |
| 3293 | + set.add(sch); | |
| 3227 | 3294 | } |
| 3228 | 3295 | |
| 3229 | 3296 | //换售票员 |
| ... | ... | @@ -3235,8 +3302,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3235 | 3302 | rs.put("status", ResponseCode.ERROR); |
| 3236 | 3303 | return rs; |
| 3237 | 3304 | } |
| 3238 | - persoChangeSPY(sch, sGh); | |
| 3239 | - set.add(sch); | |
| 3305 | + if(persoChangeSPY(sch, sGh)) | |
| 3306 | + set.add(sch); | |
| 3240 | 3307 | } |
| 3241 | 3308 | else if(StringUtils.isNotEmpty(sch.getsGh())){ |
| 3242 | 3309 | sch.setsGh(""); |
| ... | ... | @@ -3244,12 +3311,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3244 | 3311 | } |
| 3245 | 3312 | |
| 3246 | 3313 | //换车 |
| 3247 | - if (StringUtils.isNotEmpty(cpc.getClZbh())) { | |
| 3314 | + if (StringUtils.isNotEmpty(cpc.getClZbh()) && !cpc.getClZbh().equals(sch.getClZbh())) { | |
| 3248 | 3315 | set.add(sch); |
| 3249 | 3316 | set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh())); |
| 3250 | 3317 | } |
| 3251 | 3318 | |
| 3252 | 3319 | dayOfSchedule.save(sch); |
| 3320 | + set.add(sch); | |
| 3253 | 3321 | |
| 3254 | 3322 | } |
| 3255 | 3323 | rs.put("ts", set); |
| ... | ... | @@ -3261,9 +3329,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3261 | 3329 | * @Title: persoChange |
| 3262 | 3330 | * @Description: TODO(班次换驾驶员) |
| 3263 | 3331 | */ |
| 3264 | - public void persoChange(ScheduleRealInfo sch, String jGh) { | |
| 3332 | + public boolean persoChange(ScheduleRealInfo sch, String jGh) { | |
| 3265 | 3333 | if (sch.getjGh().equals(jGh)) |
| 3266 | - return; | |
| 3334 | + return false; | |
| 3267 | 3335 | String jName = getPersonName(sch.getGsBm() , jGh); |
| 3268 | 3336 | if (StringUtils.isNotEmpty(jName)) { |
| 3269 | 3337 | |
| ... | ... | @@ -3273,16 +3341,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3273 | 3341 | sch.setjGh(jGh); |
| 3274 | 3342 | |
| 3275 | 3343 | sch.setjName(jName); |
| 3344 | + return true; | |
| 3276 | 3345 | } |
| 3346 | + return false; | |
| 3277 | 3347 | } |
| 3278 | 3348 | |
| 3279 | 3349 | /** |
| 3280 | 3350 | * @Title: persoChange |
| 3281 | 3351 | * @Description: TODO(班次换售票员) |
| 3282 | 3352 | */ |
| 3283 | - public void persoChangeSPY(ScheduleRealInfo sch, String sGh) { | |
| 3353 | + public boolean persoChangeSPY(ScheduleRealInfo sch, String sGh) { | |
| 3284 | 3354 | if (sch.getsGh().equals(sGh)) |
| 3285 | - return; | |
| 3355 | + return false; | |
| 3286 | 3356 | String sName = getPersonName(sch.getGsBm() , sGh); |
| 3287 | 3357 | if (StringUtils.isNotEmpty(sName)) { |
| 3288 | 3358 | if (sGh.indexOf("-") != -1) |
| ... | ... | @@ -3290,7 +3360,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3290 | 3360 | else |
| 3291 | 3361 | sch.setsGh(sGh); |
| 3292 | 3362 | sch.setsName(sName); |
| 3363 | + return true; | |
| 3293 | 3364 | } |
| 3365 | + return false; | |
| 3294 | 3366 | } |
| 3295 | 3367 | |
| 3296 | 3368 | /** | ... | ... |
src/main/java/com/bsth/service/report/SheetService.java
| ... | ... | @@ -8,7 +8,7 @@ import com.bsth.service.BaseService; |
| 8 | 8 | |
| 9 | 9 | public interface SheetService extends BaseService<Sheet, Integer>{ |
| 10 | 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 | 12 | public List<Map<String, Object>> countList(Map<String, Object> map); |
| 13 | 13 | |
| 14 | 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<Sheet, Integer> implements |
| 82 | 82 | return fage; |
| 83 | 83 | } |
| 84 | 84 | @Override |
| 85 | - public String saveSheetList() throws Exception{ | |
| 85 | + public String saveSheetList(String rq) throws Exception{ | |
| 86 | 86 | Map<String, Object> map=new HashMap<String,Object>(); |
| 87 | 87 | String result = "failure"; |
| 88 | + | |
| 88 | 89 | try { |
| 89 | 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 | 132 | }catch (Exception e) { |
| 128 | 133 | // TODO Auto-generated catch block |
| 129 | 134 | throw e; | ... | ... |
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
| ... | ... | @@ -801,6 +801,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 801 | 801 | String nbbm = map.get("nbbm").toString(); |
| 802 | 802 | String type = map.get("type").toString(); |
| 803 | 803 | |
| 804 | + String companyName = ""; | |
| 805 | + String subCompanyName = ""; | |
| 806 | + String lineName = ""; | |
| 807 | + | |
| 804 | 808 | if(startDate.length() == 0){ |
| 805 | 809 | startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| 806 | 810 | } |
| ... | ... | @@ -934,8 +938,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 934 | 938 | tempList.add(m7); |
| 935 | 939 | } |
| 936 | 940 | |
| 937 | - String companyName = ""; | |
| 938 | - String subCompanyName = ""; | |
| 939 | 941 | |
| 940 | 942 | //按时间段分组 |
| 941 | 943 | for(ScheduleRealInfo schedule : list){ |
| ... | ... | @@ -947,6 +949,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 947 | 949 | &&schedule.getFgsName().trim().length()!=0){ |
| 948 | 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 | 957 | if(schedule.getFcsjActualTime()!=null && schedule.getZdsjActualTime()!=null){ |
| 952 | 958 | Long fcsjA = schedule.getFcsjActualTime(); |
| ... | ... | @@ -1005,6 +1011,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1005 | 1011 | for(String key : keyMap.keySet()){ |
| 1006 | 1012 | Map<String, Object> m = null; |
| 1007 | 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 | 1017 | if(map2.get("time").toString().equals(key)){ |
| 1009 | 1018 | m = map2; |
| 1010 | 1019 | } |
| ... | ... | @@ -1020,18 +1029,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1020 | 1029 | dnbc++; |
| 1021 | 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 | 1033 | m.put("upbc", upbc); |
| 1029 | 1034 | m.put("dnbc", dnbc); |
| 1030 | 1035 | m.put("upys", upbc > 0 ? nf.format((float)upys / upbc) : "/"); |
| 1031 | 1036 | m.put("dnys", dnbc > 0 ? nf.format((float)dnys / dnbc) : "/"); |
| 1032 | 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 | 1040 | if(flag){ | ... | ... |