Commit 23f52cc8e553dd0131d4c8e8309cb3751b492c01

Authored by 徐烜
2 parents 80a3fd97 2c33fd45

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

src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -106,6 +106,7 @@ public class YlbController extends BaseController<Ylb, Integer>{
106 106 @RequestParam(defaultValue = "DESC") String direction){
107 107  
108 108 Direction d;
  109 + map.put("xlbm_like", map.get("xlbm_like").toString().trim());
109 110 // try {
110 111 String rq=map.get("rq").toString();
111 112 if(!(rq=="")){
... ...
src/main/java/com/bsth/controller/realcontrol/dto/LpData.java
... ... @@ -17,9 +17,12 @@ public class LpData {
17 17  
18 18 this.fcsj = sch.getFcsjActualTime();
19 19 this.zdsj = sch.getZdsjActualTime();
  20 +
  21 + this.qdName = sch.getQdzName();
  22 + this.zdzName = sch.getZdzName();
20 23 }
21 24  
22   - public void appendTo(ScheduleRealInfo sch, int type) {
  25 + public void appendTo(ScheduleRealInfo sch, int type, boolean changeRealTime) {
23 26  
24 27 if (type == 0) {
25 28 //只换人
... ... @@ -31,10 +34,10 @@ public class LpData {
31 34 //只换车
32 35 sch.setClZbh(this.nbbm);
33 36  
34   - if (this.fcsj != null)
35   - sch.setFcsjActualAll(this.fcsj);
36   - if (this.zdsj != null)
37   - sch.setZdsjActualAll(this.zdsj);
  37 + //换实际时间
  38 + if(changeRealTime){
  39 + changeRealTime(sch);
  40 + }
38 41  
39 42 } else if (type == 2) {
40 43 //换人并换车
... ... @@ -44,13 +47,30 @@ public class LpData {
44 47 sch.setsName(this.sName);
45 48 sch.setClZbh(this.nbbm);
46 49  
47   - if (this.fcsj != null)
48   - sch.setFcsjActualAll(this.fcsj);
49   - if (this.zdsj != null)
50   - sch.setZdsjActualAll(this.zdsj);
  50 + //换实际时间
  51 + if(changeRealTime){
  52 + changeRealTime(sch);
  53 + }
51 54 }
52 55 }
53 56  
  57 + public void changeRealTime(ScheduleRealInfo sch){
  58 + if (this.fcsj != null && this.qdName.equals(sch.getQdzName()))
  59 + sch.setFcsjActualAll(this.fcsj);
  60 + if (this.zdsj != null && this.zdzName.equals(sch.getZdzName()))
  61 + sch.setZdsjActualAll(this.zdsj);
  62 + }
  63 +
  64 + /**
  65 + * 起点站名称
  66 + */
  67 + private String qdName;
  68 +
  69 + /**
  70 + * 终点站名称
  71 + */
  72 + private String zdzName;
  73 +
54 74 /**
55 75 * 驾驶员
56 76 */
... ...
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
... ... @@ -70,10 +70,12 @@ public abstract class SignalHandle {
70 70  
71 71 protected void transformUpdown(GpsEntity gps, ScheduleRealInfo sch) {
72 72 int updown = Integer.parseInt(sch.getXlDir());
  73 + //gps 切换走向
  74 + gps.setUpDown(updown);
  75 +
73 76 List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), updown);
74 77 StationRoute station = GeoUtils.gpsInStation(gps, srs);
75 78 if (station != null) {
76   - gps.setUpDown(updown);
77 79 gps.setStopNo(station.getCode());
78 80 }
79 81 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
... ... @@ -178,7 +178,12 @@ public class InOutStationSignalHandle extends SignalHandle{
178 178  
179 179 if(gps.getStopNo().equals(sch.getZdzCode())){
180 180  
181   - int diff = (int) (sch.getZdsjT() - gps.getTimestamp());
  181 + int diff = 0;
  182 + try{
  183 + diff = (int) (sch.getZdsjT() - gps.getTimestamp());
  184 + }catch(NullPointerException e){
  185 + logger.info("NullPointerException " + sch.getXlName() + " 有班次无班次历时,,,检查一下是否需要出站既出场。");
  186 + }
182 187 //进场最多提前1.2小时
183 188 if(sch.getBcType().equals("in") && diff > MAX_BEFORE_TIME)
184 189 return;
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -623,6 +623,7 @@ public class DayOfSchedule implements CommandLineRunner {
623 623 // }
624 624  
625 625 public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) {
  626 + Collections.sort(nbbmScheduleMap.get(nbbm), schFCSJComparator);
626 627 return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm));
627 628 }
628 629  
... ... @@ -775,6 +776,8 @@ public class DayOfSchedule implements CommandLineRunner {
775 776 public void addExecPlan(ScheduleRealInfo sch) {
776 777 if(sch != null)
777 778 carExecutePlanMap.put(sch.getClZbh(), sch);
  779 + else
  780 + carExecutePlanMap.remove(sch.getClZbh());
778 781 }
779 782  
780 783 public void removeExecPlan(String clzbh) {
... ... @@ -826,6 +829,14 @@ public class DayOfSchedule implements CommandLineRunner {
826 829 return ups;
827 830 }
828 831  
  832 + public void removeNbbm2SchMapp(ScheduleRealInfo sch, String nbbm){
  833 + nbbmScheduleMap.remove(nbbm, sch);
  834 + }
  835 +
  836 + public void addNbbm2SchMapp(ScheduleRealInfo sch, String nbbm){
  837 + nbbmScheduleMap.put(nbbm, sch);
  838 + }
  839 +
829 840 public void reCalcExecPlan(String nbbm){
830 841 carExecutePlanMap.put(nbbm, schAttrCalculator.calcCurrentExecSch(nbbmScheduleMap.get(nbbm)));
831 842 }
... ...
src/main/java/com/bsth/repository/oil/CylRepository.java
1 1 package com.bsth.repository.oil;
2 2  
3 3  
  4 +import java.util.List;
  5 +
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
4 8 import org.springframework.stereotype.Repository;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
5 11 import com.bsth.entity.oil.Cyl;
6 12 import com.bsth.repository.BaseRepository;
7 13  
8 14 @Repository
9 15 public interface CylRepository extends BaseRepository<Cyl, Integer>{
10   -
  16 + @Transactional
  17 + @Modifying
  18 + @Query(value="SELECT * FROM bsth_c_cyl ",nativeQuery=true)
  19 + List<Cyl> obtainCyl();
11 20 }
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -39,8 +39,8 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
39 39  
40 40 @Transactional
41 41 @Modifying
42   - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 ",nativeQuery=true)
43   - List<Ylb> queryListYlb(String rq,String nbbm);
  42 + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3",nativeQuery=true)
  43 + List<Ylb> queryListYlb(String rq,String nbbm,String jgh);
44 44 /**
45 45 * 查询当天总的加注量和总里程
46 46 * @param rq
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -133,7 +133,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
133 133 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
134 134 List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date);
135 135  
136   - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY realExecDate,fcsj,xlBm,clZbh")
  136 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh")
137 137 List<Map<String,Object>> yesterdayDataList(String line,String date);
138 138  
139 139 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -85,6 +85,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
85 85 // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);
86 86 //前一天所有车辆最后进场班次信息
87 87 List<Ylb> ylListBe=repository.obtainYlbefore(rq);
  88 + List<Cyl> clyList=cylRepository.obtainCyl();
88 89 //从排班表中计算出行驶的总里程
89 90 List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("",rq);
90 91  
... ... @@ -106,13 +107,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
106 107 try {
107 108 //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
108 109 if(map.get("seqNumber").toString().equals("1")){
109   - for (int y = 0; y < ylListBe.size(); y++) {
110   - Ylb ylb=ylListBe.get(y);
111   - if(map.get("clZbh").toString().equals(ylb.getNbbm())){
112   - t.setCzyl(ylb.getJzyl());
  110 + for (int y = 0; y < clyList.size(); y++) {
  111 + Cyl cyl=clyList.get(y);
  112 + if(map.get("clZbh").toString().equals(cyl.getNbbm())){
  113 + t.setCzyl(cyl.getCyl());
113 114 break;
114 115 }else{
115   - t.setCzyl(0.0);
  116 + for (int i = 0; i < ylListBe.size(); i++) {
  117 + Ylb ylb=ylListBe.get(i);
  118 + if(map.get("clZbh").toString().equals(ylb.getNbbm())){
  119 + t.setCzyl(ylb.getJzyl());
  120 + break;
  121 + }else{
  122 + t.setCzyl(0.0);
  123 + }
  124 + }
116 125 }
117 126 }
118 127 }
... ... @@ -171,6 +180,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
171 180 List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);
172 181 //前一天所有车辆最后进场班次信息
173 182 List<Ylb> ylListBe=repository.obtainYlbefore(rq);
  183 + List<Cyl> clyList=cylRepository.obtainCyl();
174 184 //从排班表中计算出行驶的总里程
175 185 List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq);
176 186  
... ... @@ -192,13 +202,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
192 202 try {
193 203 //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
194 204 if(map.get("seqNumber").toString().equals("1")){
195   - for (int y = 0; y < ylListBe.size(); y++) {
196   - Ylb ylb=ylListBe.get(y);
197   - if(map.get("clZbh").toString().equals(ylb.getNbbm())){
198   - t.setCzyl(ylb.getJzyl());
  205 + for (int y = 0; y < clyList.size(); y++) {
  206 + Cyl cyl=clyList.get(y);
  207 + if(map.get("clZbh").toString().equals(cyl.getNbbm())){
  208 + t.setCzyl(cyl.getCyl());
199 209 break;
200 210 }else{
201   - t.setCzyl(0.0);
  211 + for (int i = 0; i < ylListBe.size(); i++) {
  212 + Ylb ylb=ylListBe.get(i);
  213 + if(map.get("clZbh").toString().equals(ylb.getNbbm())){
  214 + t.setCzyl(ylb.getJzyl());
  215 + break;
  216 + }else{
  217 + t.setCzyl(0.0);
  218 + }
  219 + }
202 220 }
203 221 }
204 222 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -156,7 +156,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
156 156  
157 157 Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx, int type);
158 158  
159   - void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type);
  159 + void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type, boolean changeRealTime);
160 160  
161 161 Map<String,Object> revokeRealArrive(Long id);
162 162 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -67,14 +67,15 @@ import java.text.DecimalFormat;
67 67 import java.text.ParseException;
68 68 import java.text.SimpleDateFormat;
69 69 import java.util.*;
  70 +import java.util.regex.Pattern;
70 71 import java.util.zip.ZipEntry;
71 72 import java.util.zip.ZipOutputStream;
72 73  
73 74 @Service
74 75 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
75 76 implements ScheduleRealInfoService {
76   - @Autowired
77   - JdbcTemplate jdbcTemplate;
  77 + @Autowired
  78 + JdbcTemplate jdbcTemplate;
78 79 @Autowired
79 80 ScheduleRealInfoRepository scheduleRealInfoRepository;
80 81  
... ... @@ -88,7 +89,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
88 89 SectionRouteService sectionRouteService;
89 90  
90 91 /*@Autowired
91   - BorrowCenter borrowCenter;*/
  92 + BorrowCenter borrowCenter;*/
92 93  
93 94 @Autowired
94 95 LineRepository lineRepository;
... ... @@ -110,13 +111,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
110 111  
111 112 @Autowired
112 113 LineConfigData lineConfigData;
113   -
  114 +
114 115 @Autowired
115 116 DutyEmployeeService dutyEmployeeService;
116   -
  117 +
117 118 @Autowired
118 119 YlxxbRepository ylxxbRepository;
119   -
  120 +
120 121 @Autowired
121 122 YlbRepository ylbRepository;
122 123  
... ... @@ -140,8 +141,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
140 141  
141 142 private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
142 143  
143   - private static int BUF_SIZE = 1024;
144   -
  144 + private static int BUF_SIZE = 1024;
  145 +
145 146 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
146 147  
147 148 @Override
... ... @@ -174,7 +175,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
174 175 }
175 176  
176 177 //调整班次类型
177   - if(StringUtils.isNotEmpty(bcType)){
  178 + if (StringUtils.isNotEmpty(bcType)) {
178 179 schedule.setBcType(bcType);
179 180 }
180 181  
... ... @@ -199,7 +200,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
199 200 try {
200 201 List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr));
201 202  
202   - ScheduleRealInfo schedule = null;
  203 + ScheduleRealInfo schedule = null, execSch, next;
203 204 for (String id : idList) {
204 205 schedule = dayOfSchedule.get(Long.parseLong(id));
205 206 if (schedule.isDestroy()) {
... ... @@ -214,6 +215,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
214 215  
215 216 dayOfSchedule.save(schedule);
216 217 rsList.add(schedule);
  218 +
  219 + //如果正在执行当前班次,跳下一个班次
  220 + execSch = dayOfSchedule.executeCurr(schedule.getClZbh());
  221 + if(execSch != null && execSch.getId().equals(schedule.getId())){
  222 + next = dayOfSchedule.next(schedule);
  223 + dayOfSchedule.addExecPlan(next);
  224 + }
217 225 }
218 226  
219 227 map.put("status", ResponseCode.SUCCESS);
... ... @@ -456,148 +464,207 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
456 464 }
457 465  
458 466 }
459   -
  467 +
460 468 @Override
461   - public List<ScheduleRealInfo> queryUserInfoPx(String line, String date, String state,String type) {
  469 + public List<ScheduleRealInfo> queryUserInfoPx(String line, String date, String state, String type) {
462 470 // List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
463   - state=state+"";
464   - String sqlPlan="select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh,"
465   - + " s.lp_Name as lpName,s.j_Name as jName,s.s_Gh as sGh,s.s_Name as sName"
466   - + " from bsth_c_s_sp_info_real s "
467   - + " where s.xl_Bm = '"+line+"' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='"+date+"' "
468   - + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name,s.s_Gh,"
469   - + " s.s_Name order by ("+state+") "+type;
470   - List<ScheduleRealInfo> list= jdbcTemplate.query(sqlPlan,
471   - new RowMapper<ScheduleRealInfo>(){
472   - @Override
473   - public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
474   - ScheduleRealInfo t=new ScheduleRealInfo();
475   - t.setId(rs.getLong("id"));
476   - t.setjGh(rs.getString("jGh"));
477   - t.setClZbh(rs.getString("clZbh"));
478   - t.setLpName(rs.getString("lpName"));
479   - t.setjName(rs.getString("jName"));
480   - t.setsGh(rs.getString("sGh"));
481   - t.setsName(rs.getString("sName"));
482   - return t;
483   - }
484   - });
485   - return list;
  471 + state = state + "";
  472 + String lpname = state;
  473 + String px = type;
  474 + if (state.equals("lpName")) {
  475 + state = state + "+1";
  476 + type = "asc";
  477 + }
  478 + String sqlPlan = "select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh,"
  479 + + " s.lp_Name as lpName,s.j_Name as jName,s.s_Gh as sGh,s.s_Name as sName"
  480 + + " from bsth_c_s_sp_info_real s "
  481 + + " where s.xl_Bm = '" + line + "' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='" + date + "' "
  482 + + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name,s.s_Gh,"
  483 + + " s.s_Name order by (" + state + ") " + type;
  484 + List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan,
  485 + new RowMapper<ScheduleRealInfo>() {
  486 + @Override
  487 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  488 + ScheduleRealInfo t = new ScheduleRealInfo();
  489 + t.setId(rs.getLong("id"));
  490 + t.setjGh(rs.getString("jGh"));
  491 + t.setClZbh(rs.getString("clZbh"));
  492 + t.setLpName(rs.getString("lpName"));
  493 + t.setjName(rs.getString("jName"));
  494 + t.setsGh(rs.getString("sGh"));
  495 + t.setsName(rs.getString("sName"));
  496 + return t;
  497 + }
  498 + });
  499 + if (lpname.equals("lpName")) {
  500 + List<ScheduleRealInfo> listNew = new ArrayList<ScheduleRealInfo>();
  501 + Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
  502 + if (px.equals("desc")) {
  503 + int zt = 0;
  504 + for (int l = 0; l < 3; l++) {
  505 + for (int i = 0; i < list.size(); i++) {
  506 + ScheduleRealInfo t = list.get(i);
  507 + if (t.getLpName().indexOf("+") != -1) {
  508 + if (zt == 0) {
  509 + listNew.add(t);
  510 + }
  511 +
  512 + } else if (pattern.matcher(t.getLpName()).matches()) {
  513 + if (zt == 1) {
  514 + listNew.add(t);
  515 + }
  516 + } else {
  517 + if (zt == 2) {
  518 + listNew.add(t);
  519 + }
  520 + }
  521 + }
  522 + zt++;
  523 + }
  524 + } else {
  525 + int zt = 0;
  526 + for (int l = 0; l < 3; l++) {
  527 + for (int i = 0; i < list.size(); i++) {
  528 + ScheduleRealInfo t = list.get(i);
  529 + if (t.getLpName().indexOf("+") != -1) {
  530 + if (zt == 2) {
  531 + listNew.add(t);
  532 + }
  533 +
  534 + } else if (pattern.matcher(t.getLpName()).matches()) {
  535 + if (zt == 1) {
  536 + listNew.add(t);
  537 + }
  538 + } else {
  539 + if (zt == 0) {
  540 + listNew.add(t);
  541 + }
  542 + }
  543 + }
  544 + zt++;
  545 + }
  546 +
  547 + }
  548 + return listNew;
  549 + } else {
  550 + return list;
  551 + }
  552 +
486 553 }
487 554  
488 555 /**
489 556 *
490 557 */
491 558 @Override
492   - public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName,String date,String line) {
493   - ReportUtils ee = new ReportUtils();
494   - ReportRelatedUtils rru = new ReportRelatedUtils();
495   - List<Iterator<?>> list = new ArrayList<Iterator<?>>();
496   - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName,date,line);
497   - List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
498   -
499   - DecimalFormat format = new DecimalFormat("0.00");
  559 + public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName, String date, String line) {
  560 + ReportUtils ee = new ReportUtils();
  561 + ReportRelatedUtils rru = new ReportRelatedUtils();
  562 + List<Iterator<?>> list = new ArrayList<Iterator<?>>();
  563 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
  564 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  565 +
  566 + DecimalFormat format = new DecimalFormat("0.00");
500 567 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
501 568 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
502   - int jhbc = 0,cjbc = 0,ljbc = 0;
503   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
504   - float addMileage = 0l,remMileage = 0l;
505   -
506   - Map<String,Object> map;
507   - for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){
508   - if(scheduleRealInfo != null){
509   - //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
510   - if(scheduleRealInfo != null){
511   - //计划里程(主任务过滤掉临加班次),
512   - //烂班里程(主任务烂班),
513   - //临加里程(主任务临加),
514   - //计划班次,烂班班次,增加班次
515   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
516   - if(scheduleRealInfo.isSflj()){
517   - ljbc++;
518   - }else{
519   - jhlc += tempJhlc;
520   - jhbc++;
521   - if(scheduleRealInfo.getStatus() == -1){
522   - remMileage += tempJhlc;
523   - cjbc++;
524   - }
525   - }
526   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
527   - //计算营运里程,空驶里程
528   - if(childTaskPlans.isEmpty()){
529   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
530   - ){
531   - ksgl += tempJhlc;
532   - }else{
533   - yygl += tempJhlc;
534   - }
535   - }else{
536   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
537   - while(it.hasNext()){
538   - ChildTaskPlan childTaskPlan = it.next();
539   - if(childTaskPlan.getMileageType().equals("empty")){
540   - if(scheduleRealInfo.isSflj()){
541   - addMileage += tempJhlc;
542   - }
543   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
544   - }else{
545   - if(scheduleRealInfo.isSflj()){
546   - addMileage += tempJhlc;
547   - }
548   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
549   - }
550   - }
551   - }
552   - }
553   -
554   - map = new HashMap<String, Object>();
555   - try {
556   - scheduleRealInfo.setjName(scheduleRealInfo.getjGh()+scheduleRealInfo.getjName());
557   - scheduleRealInfo.setsName(scheduleRealInfo.getsGh()+scheduleRealInfo.getsName());
558   - map = rru.getMapValue(scheduleRealInfo);
559   - String zdsj = scheduleRealInfo.getZdsj();
560   - String zdsjActual = scheduleRealInfo.getZdsjActual();
561   - if(zdsj != null && zdsjActual != null &&
562   - !zdsj.equals(zdsjActual)){
563   - if(zdsj.compareTo(zdsjActual) > 0){
564   - map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
565   - map.put("slow", "");
566   - } else {
567   - map.put("fast", "");
568   - map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
569   - }
570   - } else {
571   - map.put("fast", "");
572   - map.put("slow", "");
573   - }
574   - listMap.add(map);
575   - } catch (Exception e) {
576   - e.printStackTrace();
577   - }
578   - }
579   - }
580   -
581   - //计算里程和班次数,并放入Map里
582   - map = new HashMap<String, Object>();
583   - map.put("jhlc", format.format(jhlc));
584   - map.put("remMileage", format.format(remMileage));
585   - map.put("addMileage", format.format(addMileage));
586   - map.put("yygl", format.format(yygl));
587   - map.put("ksgl", format.format(ksgl));
588   - map.put("realMileage", format.format(yygl+ksgl));
589   - map.put("jhbc", jhbc);
590   - map.put("cjbc", cjbc);
591   - map.put("ljbc", ljbc);
592   - map.put("sjbc", jhbc-cjbc+ljbc);
593   -
594   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  569 + int jhbc = 0, cjbc = 0, ljbc = 0;
  570 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0;
  571 + float addMileage = 0l, remMileage = 0l;
  572 +
  573 + Map<String, Object> map;
  574 + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) {
  575 + if (scheduleRealInfo != null) {
  576 + //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
  577 + if (scheduleRealInfo != null) {
  578 + //计划里程(主任务过滤掉临加班次),
  579 + //烂班里程(主任务烂班),
  580 + //临加里程(主任务临加),
  581 + //计划班次,烂班班次,增加班次
  582 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  583 + if (scheduleRealInfo.isSflj()) {
  584 + ljbc++;
  585 + } else {
  586 + jhlc += tempJhlc;
  587 + jhbc++;
  588 + if (scheduleRealInfo.getStatus() == -1) {
  589 + remMileage += tempJhlc;
  590 + cjbc++;
  591 + }
  592 + }
  593 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  594 + //计算营运里程,空驶里程
  595 + if (childTaskPlans.isEmpty()) {
  596 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  597 + ) {
  598 + ksgl += tempJhlc;
  599 + } else {
  600 + yygl += tempJhlc;
  601 + }
  602 + } else {
  603 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  604 + while (it.hasNext()) {
  605 + ChildTaskPlan childTaskPlan = it.next();
  606 + if (childTaskPlan.getMileageType().equals("empty")) {
  607 + if (scheduleRealInfo.isSflj()) {
  608 + addMileage += tempJhlc;
  609 + }
  610 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  611 + } else {
  612 + if (scheduleRealInfo.isSflj()) {
  613 + addMileage += tempJhlc;
  614 + }
  615 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  616 + }
  617 + }
  618 + }
  619 + }
  620 +
  621 + map = new HashMap<String, Object>();
  622 + try {
  623 + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName());
  624 + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName());
  625 + map = rru.getMapValue(scheduleRealInfo);
  626 + String zdsj = scheduleRealInfo.getZdsj();
  627 + String zdsjActual = scheduleRealInfo.getZdsjActual();
  628 + if (zdsj != null && zdsjActual != null &&
  629 + !zdsj.equals(zdsjActual)) {
  630 + if (zdsj.compareTo(zdsjActual) > 0) {
  631 + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  632 + map.put("slow", "");
  633 + } else {
  634 + map.put("fast", "");
  635 + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  636 + }
  637 + } else {
  638 + map.put("fast", "");
  639 + map.put("slow", "");
  640 + }
  641 + listMap.add(map);
  642 + } catch (Exception e) {
  643 + e.printStackTrace();
  644 + }
  645 + }
  646 + }
  647 +
  648 + //计算里程和班次数,并放入Map里
  649 + map = new HashMap<String, Object>();
  650 + map.put("jhlc", format.format(jhlc));
  651 + map.put("remMileage", format.format(remMileage));
  652 + map.put("addMileage", format.format(addMileage));
  653 + map.put("yygl", format.format(yygl));
  654 + map.put("ksgl", format.format(ksgl));
  655 + map.put("realMileage", format.format(yygl + ksgl));
  656 + map.put("jhbc", jhbc);
  657 + map.put("cjbc", cjbc);
  658 + map.put("ljbc", ljbc);
  659 + map.put("sjbc", jhbc - cjbc + ljbc);
595 660  
596   - list.add(listMap.iterator());
597   - ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould/waybill_minhang.xls",
598   - path+"export/" + date+"-"+jName+"-"+clZbh+"-"+lpName+"-行车路单.xls");
599   - return scheduleRealInfos;
600   - }
  661 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  662 +
  663 + list.add(listMap.iterator());
  664 + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/waybill_minhang.xls",
  665 + path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
  666 + return scheduleRealInfos;
  667 + }
601 668  
602 669 @Override
603 670 public List<Map<String, Object>> dailyInfo(String line, String date, String type) {
... ... @@ -907,6 +974,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
907 974 String remarks = map.get("remarks");
908 975 ScheduleRealInfo sch = dayOfSchedule.get(id);
909 976 if (null != sch) {
  977 +
  978 + String clZbh = map.get("clZbh");
  979 + if (StringUtils.isNotEmpty(clZbh)) {
  980 + //换车
  981 + BiMap<String, String> clMap = BasicData.deviceId2NbbmMap.inverse();
  982 + if (clMap.get(clZbh) == null) {
  983 + rs.put("status", ResponseCode.ERROR);
  984 + rs.put("msg", "车辆 " + clZbh + " 不存在!");
  985 + return rs;
  986 + } else {
  987 + dayOfSchedule.changeCar(sch, clZbh);
  988 + }
  989 + }
  990 + //换驾驶员
  991 + String jsy = map.get("jsy");
  992 + if (StringUtils.isNotEmpty(jsy) && jsy.indexOf("/") != -1) {
  993 + persoChange(sch, jsy.split("/")[0]);
  994 + }
  995 + //换售票员
  996 + String spy = map.get("spy");
  997 + if (StringUtils.isNotEmpty(spy) && spy.indexOf("/") != -1 && !spy.equals("/")) {
  998 + persoChangeSPY(sch, spy.split("/")[0]);
  999 + }
  1000 + else{
  1001 + sch.setsGh("");
  1002 + sch.setsName("");
  1003 + }
  1004 +
  1005 +
910 1006 if (StringUtils.isNotBlank(fcsjActual)) {
911 1007 LineConfig config = lineConfigData.get(sch.getXlBm());
912 1008 long t = 0L;
... ... @@ -953,8 +1049,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
953 1049  
954 1050 try {
955 1051 //烂班
956   - if(map.get("status") != null
957   - && Integer.parseInt(map.get("status").toString()) == -1){
  1052 + if (map.get("status") != null
  1053 + && Integer.parseInt(map.get("status").toString()) == -1) {
958 1054 destroy(sch.getId() + "", "", map.get("adjustExps").toString());
959 1055 }
960 1056 } catch (NumberFormatException e) {
... ... @@ -963,14 +1059,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
963 1059  
964 1060 //修改班次里程
965 1061 String jhlc = map.get("jhlc");
966   - if(StringUtils.isNotEmpty(jhlc)
967   - && Double.parseDouble(jhlc) != sch.getJhlc()){
  1062 + if (StringUtils.isNotEmpty(jhlc)
  1063 + && Double.parseDouble(jhlc) != sch.getJhlc()) {
968 1064 sch.setJhlc(Double.parseDouble(jhlc));
969 1065 }
970 1066 }
971 1067  
972 1068 String bcType = map.get("bcType");
973   - if(StringUtils.isNotEmpty(bcType)){
  1069 + if (StringUtils.isNotEmpty(bcType)) {
974 1070 sch.setBcType(bcType);
975 1071 }
976 1072 //班次状态
... ... @@ -1187,11 +1283,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1187 1283 }
1188 1284  
1189 1285  
1190   -
1191 1286 @Override
1192 1287 public Map<String, Object> findKMBC(String jName, String clZbh,
1193   - String lpName, String date,String line) {
1194   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line);
  1288 + String lpName, String date, String line) {
  1289 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
1195 1290 DecimalFormat format = new DecimalFormat("0.00");
1196 1291 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1197 1292 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
... ... @@ -1226,7 +1321,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1226 1321 if (childTaskPlans.isEmpty()) {
1227 1322 if (scheduleRealInfo.getBcType().equals("in") ||
1228 1323 scheduleRealInfo.getBcType().equals("out")) {
1229   - jcclc += tempJhlc;
  1324 + if (scheduleRealInfo.getStatus() != -1) {
  1325 + jcclc += tempJhlc;
  1326 + }
  1327 +
1230 1328 }
1231 1329 //主任务 放空班次属于营运
1232 1330 // else if(scheduleRealInfo.getBcType().equals("venting")){
... ... @@ -1388,60 +1486,60 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1388 1486  
1389 1487 @Override
1390 1488 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1391   - String lpName, String date,String line) {
1392   - List<ScheduleRealInfo> listSchedule=new ArrayList<ScheduleRealInfo>();
  1489 + String lpName, String date, String line) {
  1490 + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();
1393 1491 List<ScheduleRealInfo> list = null;
1394   - list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line);
  1492 + list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
1395 1493 for (int i = 0; i < list.size(); i++) {
1396 1494 ScheduleRealInfo s = list.get(i);
1397   - s.setAdjustExps(i+1+"");
  1495 + s.setAdjustExps(i + 1 + "");
1398 1496 String remarks = "";
1399 1497 if (s.getRemarks() != null) {
1400 1498 remarks += s.getRemarks();
1401 1499 }
1402   -
  1500 +
1403 1501 Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
1404 1502 if (!childTaskPlans.isEmpty()) {
1405   - s.setFcsjActual("");
1406   - s.setZdsjActual("");
  1503 + s.setFcsjActual("");
  1504 + s.setZdsjActual("");
1407 1505 }
1408   -
1409   - if(s.isDestroy()){
1410   - s.setFcsjActual("");
1411   - s.setZdsjActual("");
1412   - s.setJhlc(0.0);
1413   - remarks +="(烂班)";
1414   - s.setRemarks(remarks);
  1506 +
  1507 + if (s.isDestroy()) {
  1508 + s.setFcsjActual("");
  1509 + s.setZdsjActual("");
  1510 + s.setJhlc(0.0);
  1511 + remarks += "(烂班)";
  1512 + s.setRemarks(remarks);
1415 1513 }
1416 1514 listSchedule.add(s);
1417 1515 //计算营运里程,空驶里程
1418 1516 if (!childTaskPlans.isEmpty()) {
1419   - String sqlPc="select * from bsth_c_s_child_task where schedule="+s.getId() +" order by start_date ";
1420   - List<ScheduleRealInfo> lists= jdbcTemplate.query(sqlPc,
1421   - new RowMapper<ScheduleRealInfo>(){
1422   - @Override
1423   - public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
1424   - ScheduleRealInfo t=new ScheduleRealInfo();
1425   - if(rs.getInt("destroy")==0){
1426   - t.setFcsjActual(rs.getString("start_date"));
1427   - t.setZdsjActual(rs.getString("end_date"));
1428   - t.setJhlc(rs.getDouble("mileage"));
1429   - }else{
1430   - t.setFcsjActual("");
1431   - t.setZdsjActual("");
1432   - t.setJhlc(0.0);
1433   - }
1434   - t.setQdzName(rs.getString("start_station_name"));
1435   - t.setZdzName(rs.getString("end_station_name"));
1436   - t.setRemarks(rs.getString("remarks"));
1437   - t.setAdjustExps("子");
1438   - return t;
1439   - }
1440   - });
1441   - for (int j = 0; j < lists.size(); j++) {
1442   - ScheduleRealInfo t=lists.get(j);
1443   - listSchedule.add(t);
1444   - }
  1517 + String sqlPc = "select * from bsth_c_s_child_task where schedule=" + s.getId() + " order by start_date ";
  1518 + List<ScheduleRealInfo> lists = jdbcTemplate.query(sqlPc,
  1519 + new RowMapper<ScheduleRealInfo>() {
  1520 + @Override
  1521 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  1522 + ScheduleRealInfo t = new ScheduleRealInfo();
  1523 + if (rs.getInt("destroy") == 0) {
  1524 + t.setFcsjActual(rs.getString("start_date"));
  1525 + t.setZdsjActual(rs.getString("end_date"));
  1526 + t.setJhlc(rs.getDouble("mileage"));
  1527 + } else {
  1528 + t.setFcsjActual("");
  1529 + t.setZdsjActual("");
  1530 + t.setJhlc(0.0);
  1531 + }
  1532 + t.setQdzName(rs.getString("start_station_name"));
  1533 + t.setZdzName(rs.getString("end_station_name"));
  1534 + t.setRemarks(rs.getString("remarks"));
  1535 + t.setAdjustExps("子");
  1536 + return t;
  1537 + }
  1538 + });
  1539 + for (int j = 0; j < lists.size(); j++) {
  1540 + ScheduleRealInfo t = lists.get(j);
  1541 + listSchedule.add(t);
  1542 + }
1445 1543 }
1446 1544 }
1447 1545  
... ... @@ -1469,12 +1567,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1469 1567 @Override
1470 1568 public List<Map<String, Object>> statisticsDaily(String line, String date,
1471 1569 String xlName, String type) {
1472   - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1473   - if(date.length() == 10)
1474   - list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
1475   - else if(date.length() == 7)
1476   - list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
1477   -
  1570 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  1571 + if (date.length() == 10)
  1572 + list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  1573 + else if (date.length() == 7)
  1574 + list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
  1575 +
1478 1576 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
1479 1577 DecimalFormat format = new DecimalFormat("0.00");
1480 1578 double jhlc = 0, tempJhlc = 0, childMileage = 0;
... ... @@ -1488,11 +1586,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1488 1586 int fzbc = 0, fzbc_m = 0, fzbc_a = 0;
1489 1587 int dtbc = 0, dtbc_m = 0, dtbc_a = 0;
1490 1588 int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0;
1491   -
  1589 +
1492 1590 double jhlcZ = 0, tempJhlcZ = 0, childMileageZ = 0;
1493   - float sjglZ = 0f, ssglZ = 0f, ssgl_lzZ = 0f, ssgl_dmZ = 0f,
1494   - ssgl_gzZ = 0f, ssgl_jfZ = 0f, ssgl_zsZ = 0f, ssgl_qrZ = 0f, ssgl_qcZ = 0f,
1495   - ssgl_kxZ = 0f, ssgl_qhZ = 0f, ssgl_ywZ = 0f, ssgl_otherZ = 0f, ljglZ = 0f;
  1591 + float sjglZ = 0f, ssglZ = 0f, ssgl_lzZ = 0f, ssgl_dmZ = 0f,
  1592 + ssgl_gzZ = 0f, ssgl_jfZ = 0f, ssgl_zsZ = 0f, ssgl_qrZ = 0f, ssgl_qcZ = 0f,
  1593 + ssgl_kxZ = 0f, ssgl_qhZ = 0f, ssgl_ywZ = 0f, ssgl_otherZ = 0f, ljglZ = 0f;
1496 1594 //班次
1497 1595 int ssbcZ = 0, ssbc_lzZ = 0, ssbc_dmZ = 0, ssbc_gzZ = 0, ssbc_jfZ = 0, ssbc_zsZ = 0, ssbc_qrZ = 0, ssbc_qcZ = 0, ssbc_kxZ = 0, ssbc_qhZ = 0, ssbc_ywZ = 0, ssbc_otherZ = 0;
1498 1596 int jhbcZ = 0, jhbc_mZ = 0, jhbc_aZ = 0;
... ... @@ -1501,9 +1599,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1501 1599 int fzbcZ = 0, fzbc_mZ = 0, fzbc_aZ = 0;
1502 1600 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
1503 1601 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
1504   - Map<String, Object> map =null;
1505   - for (int i=0; i<list.size();i++) {
1506   - ScheduleRealInfo scheduleRealInfo=list.get(i);
  1602 + Map<String, Object> map = null;
  1603 + for (int i = 0; i < list.size(); i++) {
  1604 + ScheduleRealInfo scheduleRealInfo = list.get(i);
1507 1605 if (scheduleRealInfo != null) {
1508 1606 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1509 1607 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
... ... @@ -1517,7 +1615,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1517 1615 jhlc += tempJhlc;
1518 1616 jhlcZ += tempJhlc;
1519 1617 }
1520   - if (scheduleRealInfo.getStatus() == -1) {
  1618 + if (scheduleRealInfo.getStatus() == -1) {
1521 1619 ssgl += tempJhlc;
1522 1620 ssglZ += tempJhlc;
1523 1621 ssbc++;
... ... @@ -1578,7 +1676,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1578 1676 ssbc_other++;
1579 1677 ssbc_otherZ++;
1580 1678 }
1581   - }else {
  1679 + } else {
1582 1680 sjgl += tempJhlc;
1583 1681 sjglZ += tempJhlc;
1584 1682 }
... ... @@ -1702,12 +1800,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1702 1800 fzbc_aZ++;
1703 1801 }
1704 1802 }
1705   -
1706   - if(i<list.size()-1){
1707   - if(!scheduleRealInfo.getXlBm().equals(list.get(i+1).getXlBm()))
1708   - {
1709   - map= new HashMap<String, Object>();
1710   - map.put("xlName", scheduleRealInfo.getXlName());
  1803 +
  1804 + if (i < list.size() - 1) {
  1805 + if (!scheduleRealInfo.getXlBm().equals(list.get(i + 1).getXlBm())) {
  1806 + map = new HashMap<String, Object>();
  1807 + map.put("xlName", scheduleRealInfo.getXlName());
1711 1808 map.put("jhlc", format.format(jhlc));
1712 1809 map.put("sjgl", format.format(sjgl));
1713 1810 map.put("ssgl", format.format(ssgl));
... ... @@ -1755,21 +1852,47 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1755 1852 map.put("djg_a", djg_a);
1756 1853 map.put("djg_time", djg_time);
1757 1854 lMap.add(map);
1758   - jhlc = 0; tempJhlc = 0; childMileage = 0;
1759   - sjgl = 0f; ssgl = 0f; ssgl_lz = 0f; ssgl_dm = 0f; ssgl_gz = 0f; ssgl_jf = 0f; ssgl_zs = 0f;
1760   - ssgl_qr = 0f; ssgl_qc = 0f; ssgl_kx = 0f; ssgl_qh = 0f; ssgl_yw = 0f;ssgl_other = 0f;
1761   - ljgl = 0f;
  1855 + jhlc = 0;
  1856 + tempJhlc = 0;
  1857 + childMileage = 0;
  1858 + sjgl = 0f;
  1859 + ssgl = 0f;
  1860 + ssgl_lz = 0f;
  1861 + ssgl_dm = 0f;
  1862 + ssgl_gz = 0f;
  1863 + ssgl_jf = 0f;
  1864 + ssgl_zs = 0f;
  1865 + ssgl_qr = 0f;
  1866 + ssgl_qc = 0f;
  1867 + ssgl_kx = 0f;
  1868 + ssgl_qh = 0f;
  1869 + ssgl_yw = 0f;
  1870 + ssgl_other = 0f;
  1871 + ljgl = 0f;
1762 1872 //班次
1763   - jhbc = 0; jhbc_m = 0; jhbc_a = 0;
1764   - sjbc = 0; sjbc_m = 0; sjbc_a = 0;
1765   - ljbc = 0; ljbc_m = 0; ljbc_a = 0;
1766   - fzbc = 0; fzbc_m = 0; fzbc_a = 0;
1767   - dtbc = 0; dtbc_m = 0; dtbc_a = 0;
1768   - djg = 0; djg_m = 0; djg_a = 0; djg_time = 0;
1769   - }
1770   - }else{
1771   - map= new HashMap<String, Object>();
1772   - map.put("xlName", scheduleRealInfo.getXlName());
  1873 + jhbc = 0;
  1874 + jhbc_m = 0;
  1875 + jhbc_a = 0;
  1876 + sjbc = 0;
  1877 + sjbc_m = 0;
  1878 + sjbc_a = 0;
  1879 + ljbc = 0;
  1880 + ljbc_m = 0;
  1881 + ljbc_a = 0;
  1882 + fzbc = 0;
  1883 + fzbc_m = 0;
  1884 + fzbc_a = 0;
  1885 + dtbc = 0;
  1886 + dtbc_m = 0;
  1887 + dtbc_a = 0;
  1888 + djg = 0;
  1889 + djg_m = 0;
  1890 + djg_a = 0;
  1891 + djg_time = 0;
  1892 + }
  1893 + } else {
  1894 + map = new HashMap<String, Object>();
  1895 + map.put("xlName", scheduleRealInfo.getXlName());
1773 1896 map.put("jhlc", format.format(jhlc));
1774 1897 map.put("sjgl", format.format(sjgl));
1775 1898 map.put("ssgl", format.format(ssgl));
... ... @@ -1817,22 +1940,48 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1817 1940 map.put("djg_a", djg_a);
1818 1941 map.put("djg_time", djg_time);
1819 1942 lMap.add(map);
1820   - jhlc = 0; tempJhlc = 0; childMileage = 0;
1821   - sjgl = 0f; ssgl = 0f; ssgl_lz = 0f; ssgl_dm = 0f; ssgl_gz = 0f; ssgl_jf = 0f; ssgl_zs = 0f;
1822   - ssgl_qr = 0f; ssgl_qc = 0f; ssgl_kx = 0f; ssgl_qh = 0f; ssgl_yw = 0f;ssgl_other = 0f;
  1943 + jhlc = 0;
  1944 + tempJhlc = 0;
  1945 + childMileage = 0;
  1946 + sjgl = 0f;
  1947 + ssgl = 0f;
  1948 + ssgl_lz = 0f;
  1949 + ssgl_dm = 0f;
  1950 + ssgl_gz = 0f;
  1951 + ssgl_jf = 0f;
  1952 + ssgl_zs = 0f;
  1953 + ssgl_qr = 0f;
  1954 + ssgl_qc = 0f;
  1955 + ssgl_kx = 0f;
  1956 + ssgl_qh = 0f;
  1957 + ssgl_yw = 0f;
  1958 + ssgl_other = 0f;
1823 1959 ljgl = 0f;
1824   - //班次
1825   - jhbc = 0; jhbc_m = 0; jhbc_a = 0;
1826   - sjbc = 0; sjbc_m = 0; sjbc_a = 0;
1827   - ljbc = 0; ljbc_m = 0; ljbc_a = 0;
1828   - fzbc = 0; fzbc_m = 0; fzbc_a = 0;
1829   - dtbc = 0; dtbc_m = 0; dtbc_a = 0;
1830   - djg = 0; djg_m = 0; djg_a = 0; djg_time = 0;
  1960 + //班次
  1961 + jhbc = 0;
  1962 + jhbc_m = 0;
  1963 + jhbc_a = 0;
  1964 + sjbc = 0;
  1965 + sjbc_m = 0;
  1966 + sjbc_a = 0;
  1967 + ljbc = 0;
  1968 + ljbc_m = 0;
  1969 + ljbc_a = 0;
  1970 + fzbc = 0;
  1971 + fzbc_m = 0;
  1972 + fzbc_a = 0;
  1973 + dtbc = 0;
  1974 + dtbc_m = 0;
  1975 + dtbc_a = 0;
  1976 + djg = 0;
  1977 + djg_m = 0;
  1978 + djg_a = 0;
  1979 + djg_time = 0;
1831 1980 }
1832 1981 }
1833 1982 }
1834   - map= new HashMap<String, Object>();
1835   - map.put("xlName", "合计");
  1983 + map = new HashMap<String, Object>();
  1984 + map.put("xlName", "合计");
1836 1985 map.put("jhlc", format.format(jhlcZ));
1837 1986 map.put("sjgl", format.format(sjglZ));
1838 1987 map.put("ssgl", format.format(ssglZ));
... ... @@ -1918,24 +2067,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1918 2067 m.get("djg_a", djg_a);
1919 2068 m.get("djg_time", djg_time);
1920 2069 }*/
1921   -
1922   - if(type != null && type.length() != 0 && type.equals("export")){
1923   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1924   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
1925   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1926   - Map<String,Object> m = new HashMap<String, Object>();
1927   - ReportUtils ee = new ReportUtils();
1928   - try {
1929   - listI.add(lMap.iterator());
1930   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
1931   - ee.excelReplace(listI, new Object[] { m }, path+"mould/statisticsDaily_.xls",
1932   - path+"export/统计日报" + sdfSimple.format(sdfMonth.parse(date))+".xls");
1933   - } catch (Exception e) {
1934   - // TODO: handle exception
1935   - e.printStackTrace();
1936   - }
  2070 +
  2071 + if (type != null && type.length() != 0 && type.equals("export")) {
  2072 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2073 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2074 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2075 + Map<String, Object> m = new HashMap<String, Object>();
  2076 + ReportUtils ee = new ReportUtils();
  2077 + try {
  2078 + listI.add(lMap.iterator());
  2079 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2080 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls",
  2081 + path + "export/统计日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  2082 + } catch (Exception e) {
  2083 + // TODO: handle exception
  2084 + e.printStackTrace();
  2085 + }
1937 2086 }
1938   -
  2087 +
1939 2088 return lMap;
1940 2089 }
1941 2090  
... ... @@ -2047,84 +2196,88 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2047 2196 }
2048 2197 }
2049 2198 }*/
2050   - List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
2051   - String lpName="lpName";
2052   - String zdsj="";
2053   - String zdsjActual="";
2054   - String zdsj1="";
2055   - String zdsjActual1="";
2056   - List<ScheduleRealInfo> listInfo=scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
2057   - for (int i = 0; i < listInfo.size(); i++) {
2058   - ScheduleRealInfo t=listInfo.get(i);
2059   - if(!lpName.equals(t.getLpName())){
2060   - zdsjActual=t.getZdsjActual();
2061   - zdsj=t.getZdsj();
2062   - t.setZdsjActual("");
2063   - t.setZdsj("");
2064   - }else{
2065   - zdsj1=t.getZdsj();
2066   - zdsjActual1=t.getZdsjActual();
2067   - t.setZdsjActual(zdsjActual);
2068   - t.setZdsj(zdsj);
2069   - zdsj=zdsj1;
2070   - zdsjActual=zdsjActual1;
2071   - }
2072   - lpName=t.getLpName();
2073   - list.add(t);
2074   - }
2075   -
2076   - List<ScheduleRealInfo> listInfo2=scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
2077   - List<ScheduleRealInfo> xList=new ArrayList<ScheduleRealInfo>();
2078   - List<ScheduleRealInfo> yList=new ArrayList<ScheduleRealInfo>();
2079   - List<ScheduleRealInfo> zList=new ArrayList<ScheduleRealInfo>();
2080   - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
2081   - if(listInfo2.size()>0){
2082   - int a=listInfo2.size()%3;
2083   - int b=listInfo2.size()/3;
2084   - int x = 0,y=0;
2085   - if(a==2){
2086   - x=b+1;y=x*2;;
2087   - }else if(b==1){
2088   - x=b+1;y=x*2-1;;
2089   - }else{
2090   - x=b;
2091   - y=2*x;
2092   -
2093   - }
2094   - for (int i = 0; i < listInfo2.size(); i++) {
2095   - ScheduleRealInfo s=listInfo2.get(i);
2096   - if(i+1<=x){
2097   - xList.add(s);
2098   - }else if((i+1)>x&&(i+1)<=y){
2099   - yList.add(s);
2100   - }else{
2101   - zList.add(s);
2102   - }
2103   - }
2104   - for (int i = 0; i < x; i++) {
2105   - newList.add(xList.get(i));
2106   - if(yList.size()>i){
2107   - newList.add(yList.get(i));
2108   - }else{
2109   - newList.add(new ScheduleRealInfo());
2110   - }
2111   - if(zList.size()>i){
2112   - newList.add(zList.get(i));
2113   - }else{
2114   - newList.add(new ScheduleRealInfo());
2115   - }
2116   -
2117   - }
2118   - }
2119   - for (int i = 0; i < newList.size(); i++) {
2120   - ScheduleRealInfo t1=newList.get(i);
2121   - for (int j = 0; j < list.size(); j++) {
2122   - ScheduleRealInfo t2=list.get(j);
2123   - if(t1.getId()==t2.getId()){
2124   - t1=t2;
2125   - }
2126   - }
2127   - }
  2199 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  2200 + String lpName = "lpName";
  2201 + String zdsj = "";
  2202 + String zdsjActual = "";
  2203 + String zdsj1 = "";
  2204 + String zdsjActual1 = "";
  2205 + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
  2206 + for (int i = 0; i < listInfo.size(); i++) {
  2207 + ScheduleRealInfo t = listInfo.get(i);
  2208 + if (!lpName.equals(t.getLpName())) {
  2209 + zdsjActual = t.getZdsjActual();
  2210 + zdsj = t.getZdsj();
  2211 + t.setZdsjActual("");
  2212 + t.setZdsj("");
  2213 + } else {
  2214 + zdsj1 = t.getZdsj();
  2215 + zdsjActual1 = t.getZdsjActual();
  2216 + t.setZdsjActual(zdsjActual);
  2217 + t.setZdsj(zdsj);
  2218 + zdsj = zdsj1;
  2219 + zdsjActual = zdsjActual1;
  2220 + }
  2221 + lpName = t.getLpName();
  2222 + list.add(t);
  2223 + }
  2224 +
  2225 + List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2226 + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>();
  2227 + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>();
  2228 + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>();
  2229 + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>();
  2230 + if (listInfo2.size() > 0) {
  2231 + int a = listInfo2.size() % 3;
  2232 + int b = listInfo2.size() / 3;
  2233 + int x = 0, y = 0;
  2234 + if (a == 2) {
  2235 + x = b + 1;
  2236 + y = x * 2;
  2237 + ;
  2238 + } else if (b == 1) {
  2239 + x = b + 1;
  2240 + y = x * 2 - 1;
  2241 + ;
  2242 + } else {
  2243 + x = b;
  2244 + y = 2 * x;
  2245 +
  2246 + }
  2247 + for (int i = 0; i < listInfo2.size(); i++) {
  2248 + ScheduleRealInfo s = listInfo2.get(i);
  2249 + if (i + 1 <= x) {
  2250 + xList.add(s);
  2251 + } else if ((i + 1) > x && (i + 1) <= y) {
  2252 + yList.add(s);
  2253 + } else {
  2254 + zList.add(s);
  2255 + }
  2256 + }
  2257 + for (int i = 0; i < x; i++) {
  2258 + newList.add(xList.get(i));
  2259 + if (yList.size() > i) {
  2260 + newList.add(yList.get(i));
  2261 + } else {
  2262 + newList.add(new ScheduleRealInfo());
  2263 + }
  2264 + if (zList.size() > i) {
  2265 + newList.add(zList.get(i));
  2266 + } else {
  2267 + newList.add(new ScheduleRealInfo());
  2268 + }
  2269 +
  2270 + }
  2271 + }
  2272 + for (int i = 0; i < newList.size(); i++) {
  2273 + ScheduleRealInfo t1 = newList.get(i);
  2274 + for (int j = 0; j < list.size(); j++) {
  2275 + ScheduleRealInfo t2 = list.get(j);
  2276 + if (t1.getId() == t2.getId()) {
  2277 + t1 = t2;
  2278 + }
  2279 + }
  2280 + }
2128 2281 return newList;
2129 2282 }
2130 2283  
... ... @@ -2139,28 +2292,28 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2139 2292 }
2140 2293 }
2141 2294 }*/
2142   - List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
2143   - String lpName="lpName";
2144   - String zdsj="";
2145   - String zdsjActual="";
2146   - String zdsj1="";
2147   - String zdsjActual1="";
2148   - List<ScheduleRealInfo> listInfo=scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
2149   - for (int i = 0; i < listInfo.size(); i++) {
2150   - ScheduleRealInfo t=listInfo.get(i);
2151   - if(!lpName.equals(t.getLpName())){
2152   - zdsjActual=t.getZdsjActual();
2153   - zdsj=t.getZdsj();
2154   - t.setZdsjActual("");
2155   - t.setZdsj("");
2156   - }else{
2157   - zdsj1=t.getZdsj();
2158   - zdsjActual1=t.getZdsjActual();
2159   - t.setZdsjActual(zdsjActual);
2160   - t.setZdsj(zdsj);
2161   - zdsj=zdsj1;
2162   - zdsjActual=zdsjActual1;
2163   - }
  2295 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  2296 + String lpName = "lpName";
  2297 + String zdsj = "";
  2298 + String zdsjActual = "";
  2299 + String zdsj1 = "";
  2300 + String zdsjActual1 = "";
  2301 + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
  2302 + for (int i = 0; i < listInfo.size(); i++) {
  2303 + ScheduleRealInfo t = listInfo.get(i);
  2304 + if (!lpName.equals(t.getLpName())) {
  2305 + zdsjActual = t.getZdsjActual();
  2306 + zdsj = t.getZdsj();
  2307 + t.setZdsjActual("");
  2308 + t.setZdsj("");
  2309 + } else {
  2310 + zdsj1 = t.getZdsj();
  2311 + zdsjActual1 = t.getZdsjActual();
  2312 + t.setZdsjActual(zdsjActual);
  2313 + t.setZdsj(zdsj);
  2314 + zdsj = zdsj1;
  2315 + zdsjActual = zdsjActual1;
  2316 + }
2164 2317 /*if(i<listInfo.size()-1){
2165 2318 if(s.getLpName().equals(listInfo.get(i+1).getLpName())){
2166 2319 zdsj=s.getZdsj();
... ... @@ -2173,10 +2326,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2173 2326 zdsj=s.getZdsj();
2174 2327 zdsjActual=s.getZdsjActual();
2175 2328 }*/
2176   -
2177   - lpName=t.getLpName();
2178   - list.add(t);
2179   - }
  2329 +
  2330 + lpName = t.getLpName();
  2331 + list.add(t);
  2332 + }
2180 2333 return list;
2181 2334 }
2182 2335  
... ... @@ -2363,7 +2516,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2363 2516 String jName = BasicData.allPerson.get(jGh);
2364 2517 if (StringUtils.isNotEmpty(jName)) {
2365 2518  
2366   - if(jGh.indexOf("-") != -1)
  2519 + if (jGh.indexOf("-") != -1)
2367 2520 sch.setjGh(jGh.substring(jGh.indexOf("-") + 1));
2368 2521 else
2369 2522 sch.setjGh(jGh);
... ... @@ -2381,7 +2534,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2381 2534 return;
2382 2535 String sName = BasicData.allPerson.get(sGh);
2383 2536 if (StringUtils.isNotEmpty(sName)) {
2384   - sch.setsGh(sGh);
  2537 + if (sGh.indexOf("-") != -1)
  2538 + sch.setsGh(sGh.substring(sGh.indexOf("-") + 1));
  2539 + else
  2540 + sch.setsGh(sGh);
2385 2541 sch.setsName(sName);
2386 2542 }
2387 2543 }
... ... @@ -2623,600 +2779,600 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2623 2779 return null;
2624 2780 }
2625 2781  
2626   - @Override
2627   - public List<ScheduleRealInfo> exportWaybillQp(String clZbh, String date, String line) {
2628   - // TODO Auto-generated method stub
2629   - ReportUtils ee = new ReportUtils();
2630   - ReportRelatedUtils rru = new ReportRelatedUtils();
2631   - List<Iterator<?>> list = new ArrayList<Iterator<?>>();
2632   - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill2( clZbh,date,line);
2633   - List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
2634   -
2635   - DecimalFormat format = new DecimalFormat("0.00");
  2782 + @Override
  2783 + public List<ScheduleRealInfo> exportWaybillQp(String clZbh, String date, String line) {
  2784 + // TODO Auto-generated method stub
  2785 + ReportUtils ee = new ReportUtils();
  2786 + ReportRelatedUtils rru = new ReportRelatedUtils();
  2787 + List<Iterator<?>> list = new ArrayList<Iterator<?>>();
  2788 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line);
  2789 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  2790 +
  2791 + DecimalFormat format = new DecimalFormat("0.00");
2636 2792 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
2637 2793 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
2638   - int jhbc = 0,cjbc = 0,ljbc = 0;
2639   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
2640   - float addMileage = 0l,remMileage = 0l, addgl = 0, remgl = 0;
2641   - int xyz=1;
2642   - Map<String,Object> map;
2643   - for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){
2644   - if(scheduleRealInfo != null){
2645   - //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
2646   - //计划里程(主任务过滤掉临加班次),
2647   - //烂班里程(主任务烂班),
2648   - //临加里程(主任务临加),
2649   - //计划班次,烂班班次,增加班次
2650   - double jh = 0, sj = 0;
2651   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
2652   - if(scheduleRealInfo.isSflj()){
2653   - ljbc++;
2654   - }else{
2655   - if( !(scheduleRealInfo.getBcType().equals("in")
2656   - ||scheduleRealInfo.getBcType().equals("out")) ){
2657   - jhbc++;
2658   - jh += tempJhlc;
2659   - }
2660   - if(scheduleRealInfo.getStatus() == -1){
2661   - remMileage += tempJhlc;
2662   - cjbc++;
2663   - }
2664   - }
2665   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2666   - //计算营运里程,空驶里程
2667   - if(childTaskPlans.isEmpty()){
2668   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
2669   - ){
2670   - jcclc +=tempJhlc;
2671   - }
2672   - //主任务 放空班次属于营运
  2794 + int jhbc = 0, cjbc = 0, ljbc = 0;
  2795 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  2796 + float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0;
  2797 + int xyz = 1;
  2798 + Map<String, Object> map;
  2799 + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) {
  2800 + if (scheduleRealInfo != null) {
  2801 + //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
  2802 + //计划里程(主任务过滤掉临加班次),
  2803 + //烂班里程(主任务烂班),
  2804 + //临加里程(主任务临加),
  2805 + //计划班次,烂班班次,增加班次
  2806 + double jh = 0, sj = 0;
  2807 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  2808 + if (scheduleRealInfo.isSflj()) {
  2809 + ljbc++;
  2810 + } else {
  2811 + if (!(scheduleRealInfo.getBcType().equals("in")
  2812 + || scheduleRealInfo.getBcType().equals("out"))) {
  2813 + jhbc++;
  2814 + jh += tempJhlc;
  2815 + }
  2816 + if (scheduleRealInfo.getStatus() == -1) {
  2817 + remMileage += tempJhlc;
  2818 + cjbc++;
  2819 + }
  2820 + }
  2821 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  2822 + //计算营运里程,空驶里程
  2823 + if (childTaskPlans.isEmpty()) {
  2824 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  2825 + ) {
  2826 + jcclc += tempJhlc;
  2827 + }
  2828 + //主任务 放空班次属于营运
2673 2829 // else if(scheduleRealInfo.getBcType().equals("venting")){
2674 2830 // ksgl += tempJhlc;
2675 2831 // }
2676   - else{
2677   - if(scheduleRealInfo.getStatus() != -1){
2678   - if(scheduleRealInfo.isSflj()){
2679   - addMileage += tempJhlc;
2680   - }
2681   - sj += tempJhlc;
2682   - }
2683   - }
2684   - }else{
2685   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2686   - while(it.hasNext()){
2687   - ChildTaskPlan childTaskPlan = it.next();
2688   - if(childTaskPlan.getMileageType().equals("empty")){
2689   - if(childTaskPlan.isDestroy()){
2690   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2691   - }else{
2692   - if(scheduleRealInfo.isSflj()){
2693   - addMileage += tempJhlc;
2694   - }
2695   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2696   - }
2697   - }else{
2698   - if(childTaskPlan.isDestroy()){
2699   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2700   -// cjbc++;
2701   - }else{
2702   - if(scheduleRealInfo.isSflj()){
2703   - addMileage += tempJhlc;
2704   - }
2705   - sj += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2706   - }
2707   - }
2708   - }
2709   - }
2710   -
2711   - if(!(scheduleRealInfo.getBcType().equals("in")||scheduleRealInfo.getBcType().equals("out"))){
2712   - map = new HashMap<String, Object>();
2713   - try {
2714   - scheduleRealInfo.setBcs(xyz);
2715   - xyz++;
2716   - Set<ChildTaskPlan> cs = scheduleRealInfo.getcTasks();
2717   - Double sjlc=0.0;
2718   - if(!cs.isEmpty()){
2719   - Iterator<ChildTaskPlan> it = cs.iterator();
2720   - while(it.hasNext()){
2721   - ChildTaskPlan c = it.next();
2722   - if(!c.isDestroy()){
2723   - sjlc += c.getMileage()==null?0:c.getMileage();
2724   - }
2725   -
2726   - }
2727   - }else{
2728   - if(scheduleRealInfo.getStatus() != -1){
2729   - sjlc =scheduleRealInfo.getJhlc();
2730   - }
2731   - }
2732   - scheduleRealInfo.setjName(scheduleRealInfo.getjGh()+scheduleRealInfo.getjName());
2733   - scheduleRealInfo.setsName(scheduleRealInfo.getsGh()+scheduleRealInfo.getsName());
2734   - scheduleRealInfo.setSjlc(format.format(sjlc));
2735   - map = rru.getMapValue(scheduleRealInfo);
2736   - String zdsj = scheduleRealInfo.getZdsj();
2737   - String zdsjActual = scheduleRealInfo.getZdsjActual();
2738   - if(zdsj != null && zdsjActual != null &&
2739   - !zdsj.equals(zdsjActual)){
2740   - if(zdsj.compareTo(zdsjActual) > 0){
2741   - map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
2742   - map.put("slow", "");
2743   - } else {
2744   - map.put("fast", "");
2745   - map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
2746   - }
2747   - } else {
2748   - map.put("fast", "");
2749   - map.put("slow", "");
2750   - }
2751   - System.out.println(map);
2752   - listMap.add(map);
2753   - } catch (Exception e) {
2754   - e.printStackTrace();
2755   - }
2756   - }
2757   - jhlc += jh;
2758   - yygl += sj;
2759   - if(jh > sj){
2760   - remgl += jh - sj;
2761   - } else {
2762   - addgl += sj - jh;
2763   - }
2764   - }
2765   - }
2766   -
2767   -
2768   - List<Ylxxb> listYlxxb=ylxxbRepository.queryListYlxxb( clZbh, date);
2769   - Double jzl=0.0;
2770   - for(int t=0;t<listYlxxb.size();t++){
2771   - Ylxxb y=listYlxxb.get(t);
2772   - jzl += y.getJzl();
2773   - }
2774   -
2775   - //计算里程和班次数,并放入Map里
2776   - map = new HashMap<String, Object>();
2777   - map.put("jzl", jzl);
2778   - map.put("jhlc", format.format(jhlc+jcclc));
2779   - map.put("yygljh", format.format(jhlc));
2780   - map.put("ssgl", format.format(remMileage));
2781   - map.put("ksgl", format.format(ksgl));
2782   - map.put("yyglsj", format.format(yygl));
2783   - map.put("jhbc", jhbc);
2784   - map.put("jcclc", jcclc);
2785   -
2786   - map.put("ljgl", format.format(addMileage));
2787   - map.put("ssbc", cjbc);
2788   - map.put("ysgl", format.format(yygl));
2789   - map.put("sjbc", jhbc-cjbc+ljbc);
2790   - map.put("zgl", format.format(yygl+ksgl+jcclc));
2791   - map.put("ljbc", ljbc);
2792   - String zdp="",zwdp="",wdp="";
2793   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
2794   - List<DutyEmployee> listDtuy= dutyEmployeeService.getDutyEmployee(line, date+"00:00", date+"23:59");
2795   - try {
2796   - Long fcsj1=sdf.parse(date+" 03:00").getTime();
2797   - Long fcsj2=sdf.parse(date+" 11:00").getTime();
2798   - Long fcsj3=sdf.parse(date+" 22:00").getTime();
2799   - for(int i=0;i<listDtuy.size();i++){
2800   - DutyEmployee t=listDtuy.get(i);
2801   - Long ts=t.getTs();
2802   - if(ts>fcsj1&&ts<fcsj2){
2803   - if(zdp.indexOf(t.getuName())==-1){
2804   - zdp +=t.getuName()+",";
2805   -
2806   - }
2807   - }else if(ts>fcsj2 && ts<fcsj3){
2808   - if(zwdp.indexOf(t.getuName())==-1){
2809   - zwdp +=t.getuName()+",";
2810   - }
2811   - }else{
2812   - if(wdp.indexOf(t.getuName())==-1){
2813   - wdp +=t.getuName()+",";
2814   - }
2815   - }
2816   - }
2817   - }catch (ParseException e) {
2818   - // TODO Auto-generated catch block
2819   - e.printStackTrace();
2820   - }
2821   - map.put("zdp", zdp);
2822   - map.put("zwdp", zwdp);
2823   - map.put("wdp", wdp);
2824   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
2825   - list.add(listMap.iterator());
2826   - ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould/waybill_qingpu.xls",
2827   - path+"export/" + date+"-"+clZbh+"-行车路单.xls");
2828   -
2829   - return scheduleRealInfos;
2830   - }
2831   -
2832   - @Override
2833   - public Map<String, Object> findKMBCQp(String clZbh, String date, String line) {
2834   - // TODO Auto-generated method stub
2835   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill2( clZbh,date,line);
2836   - DecimalFormat format = new DecimalFormat("0.00");
  2832 + else {
  2833 + if (scheduleRealInfo.getStatus() != -1) {
  2834 + if (scheduleRealInfo.isSflj()) {
  2835 + addMileage += tempJhlc;
  2836 + }
  2837 + sj += tempJhlc;
  2838 + }
  2839 + }
  2840 + } else {
  2841 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  2842 + while (it.hasNext()) {
  2843 + ChildTaskPlan childTaskPlan = it.next();
  2844 + if (childTaskPlan.getMileageType().equals("empty")) {
  2845 + if (childTaskPlan.isDestroy()) {
  2846 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2847 + } else {
  2848 + if (scheduleRealInfo.isSflj()) {
  2849 + addMileage += tempJhlc;
  2850 + }
  2851 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2852 + }
  2853 + } else {
  2854 + if (childTaskPlan.isDestroy()) {
  2855 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2856 +// cjbc++;
  2857 + } else {
  2858 + if (scheduleRealInfo.isSflj()) {
  2859 + addMileage += tempJhlc;
  2860 + }
  2861 + sj += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2862 + }
  2863 + }
  2864 + }
  2865 + }
  2866 +
  2867 + if (!(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out"))) {
  2868 + map = new HashMap<String, Object>();
  2869 + try {
  2870 + scheduleRealInfo.setBcs(xyz);
  2871 + xyz++;
  2872 + Set<ChildTaskPlan> cs = scheduleRealInfo.getcTasks();
  2873 + Double sjlc = 0.0;
  2874 + if (!cs.isEmpty()) {
  2875 + Iterator<ChildTaskPlan> it = cs.iterator();
  2876 + while (it.hasNext()) {
  2877 + ChildTaskPlan c = it.next();
  2878 + if (!c.isDestroy()) {
  2879 + sjlc += c.getMileage() == null ? 0 : c.getMileage();
  2880 + }
  2881 +
  2882 + }
  2883 + } else {
  2884 + if (scheduleRealInfo.getStatus() != -1) {
  2885 + sjlc = scheduleRealInfo.getJhlc();
  2886 + }
  2887 + }
  2888 + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName());
  2889 + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName());
  2890 + scheduleRealInfo.setSjlc(format.format(sjlc));
  2891 + map = rru.getMapValue(scheduleRealInfo);
  2892 + String zdsj = scheduleRealInfo.getZdsj();
  2893 + String zdsjActual = scheduleRealInfo.getZdsjActual();
  2894 + if (zdsj != null && zdsjActual != null &&
  2895 + !zdsj.equals(zdsjActual)) {
  2896 + if (zdsj.compareTo(zdsjActual) > 0) {
  2897 + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  2898 + map.put("slow", "");
  2899 + } else {
  2900 + map.put("fast", "");
  2901 + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  2902 + }
  2903 + } else {
  2904 + map.put("fast", "");
  2905 + map.put("slow", "");
  2906 + }
  2907 + System.out.println(map);
  2908 + listMap.add(map);
  2909 + } catch (Exception e) {
  2910 + e.printStackTrace();
  2911 + }
  2912 + }
  2913 + jhlc += jh;
  2914 + yygl += sj;
  2915 + if (jh > sj) {
  2916 + remgl += jh - sj;
  2917 + } else {
  2918 + addgl += sj - jh;
  2919 + }
  2920 + }
  2921 + }
  2922 +
  2923 +
  2924 + List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(clZbh, date);
  2925 + Double jzl = 0.0;
  2926 + for (int t = 0; t < listYlxxb.size(); t++) {
  2927 + Ylxxb y = listYlxxb.get(t);
  2928 + jzl += y.getJzl();
  2929 + }
  2930 +
  2931 + //计算里程和班次数,并放入Map里
  2932 + map = new HashMap<String, Object>();
  2933 + map.put("jzl", jzl);
  2934 + map.put("jhlc", format.format(jhlc + jcclc));
  2935 + map.put("yygljh", format.format(jhlc));
  2936 + map.put("ssgl", format.format(remMileage));
  2937 + map.put("ksgl", format.format(ksgl));
  2938 + map.put("yyglsj", format.format(yygl));
  2939 + map.put("jhbc", jhbc);
  2940 + map.put("jcclc", jcclc);
  2941 +
  2942 + map.put("ljgl", format.format(addMileage));
  2943 + map.put("ssbc", cjbc);
  2944 + map.put("ysgl", format.format(yygl));
  2945 + map.put("sjbc", jhbc - cjbc + ljbc);
  2946 + map.put("zgl", format.format(yygl + ksgl + jcclc));
  2947 + map.put("ljbc", ljbc);
  2948 + String zdp = "", zwdp = "", wdp = "";
  2949 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  2950 + List<DutyEmployee> listDtuy = dutyEmployeeService.getDutyEmployee(line, date + "00:00", date + "23:59");
  2951 + try {
  2952 + Long fcsj1 = sdf.parse(date + " 03:00").getTime();
  2953 + Long fcsj2 = sdf.parse(date + " 11:00").getTime();
  2954 + Long fcsj3 = sdf.parse(date + " 22:00").getTime();
  2955 + for (int i = 0; i < listDtuy.size(); i++) {
  2956 + DutyEmployee t = listDtuy.get(i);
  2957 + Long ts = t.getTs();
  2958 + if (ts > fcsj1 && ts < fcsj2) {
  2959 + if (zdp.indexOf(t.getuName()) == -1) {
  2960 + zdp += t.getuName() + ",";
  2961 +
  2962 + }
  2963 + } else if (ts > fcsj2 && ts < fcsj3) {
  2964 + if (zwdp.indexOf(t.getuName()) == -1) {
  2965 + zwdp += t.getuName() + ",";
  2966 + }
  2967 + } else {
  2968 + if (wdp.indexOf(t.getuName()) == -1) {
  2969 + wdp += t.getuName() + ",";
  2970 + }
  2971 + }
  2972 + }
  2973 + } catch (ParseException e) {
  2974 + // TODO Auto-generated catch block
  2975 + e.printStackTrace();
  2976 + }
  2977 + map.put("zdp", zdp);
  2978 + map.put("zwdp", zwdp);
  2979 + map.put("wdp", wdp);
  2980 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2981 + list.add(listMap.iterator());
  2982 + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/waybill_qingpu.xls",
  2983 + path + "export/" + date + "-" + clZbh + "-行车路单.xls");
  2984 +
  2985 + return scheduleRealInfos;
  2986 + }
  2987 +
  2988 + @Override
  2989 + public Map<String, Object> findKMBCQp(String clZbh, String date, String line) {
  2990 + // TODO Auto-generated method stub
  2991 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line);
  2992 + DecimalFormat format = new DecimalFormat("0.00");
2837 2993 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
2838 2994 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
2839   - int jhbc = 0,cjbc = 0,ljbc = 0;
2840   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
2841   - float addMileage = 0l,remMileage = 0l, addgl = 0, remgl = 0;
2842   - Map<String,Object> map = new HashMap<String, Object>();
2843   - for(ScheduleRealInfo scheduleRealInfo : list){
2844   - if(scheduleRealInfo != null){
2845   - //计划里程(主任务过滤掉临加班次),
2846   - //烂班里程(主任务烂班),
2847   - //临加里程(主任务临加),
2848   - //计划班次,烂班班次,增加班次
2849   - double jh = 0, sj = 0;
2850   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
2851   - if(scheduleRealInfo.isSflj()){
2852   - ljbc++;
2853   - }else{
2854   - if( !(scheduleRealInfo.getBcType().equals("in")
2855   - ||scheduleRealInfo.getBcType().equals("out")) ){
2856   - jhbc++;
2857   - jh += tempJhlc;
2858   - }
2859   -
2860   - if(scheduleRealInfo.getStatus() == -1){
2861   - remMileage += tempJhlc;
2862   - cjbc++;
2863   - }
2864   - }
2865   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2866   - //计算营运里程,空驶里程
2867   - if(childTaskPlans.isEmpty()){
2868   - if(scheduleRealInfo.getBcType().equals("in") ||
2869   - scheduleRealInfo.getBcType().equals("out")){
2870   - jcclc +=tempJhlc;
2871   - }
2872   -
2873   - //主任务 放空班次属于营运
  2995 + int jhbc = 0, cjbc = 0, ljbc = 0;
  2996 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  2997 + float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0;
  2998 + Map<String, Object> map = new HashMap<String, Object>();
  2999 + for (ScheduleRealInfo scheduleRealInfo : list) {
  3000 + if (scheduleRealInfo != null) {
  3001 + //计划里程(主任务过滤掉临加班次),
  3002 + //烂班里程(主任务烂班),
  3003 + //临加里程(主任务临加),
  3004 + //计划班次,烂班班次,增加班次
  3005 + double jh = 0, sj = 0;
  3006 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  3007 + if (scheduleRealInfo.isSflj()) {
  3008 + ljbc++;
  3009 + } else {
  3010 + if (!(scheduleRealInfo.getBcType().equals("in")
  3011 + || scheduleRealInfo.getBcType().equals("out"))) {
  3012 + jhbc++;
  3013 + jh += tempJhlc;
  3014 + }
  3015 +
  3016 + if (scheduleRealInfo.getStatus() == -1) {
  3017 + remMileage += tempJhlc;
  3018 + cjbc++;
  3019 + }
  3020 + }
  3021 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  3022 + //计算营运里程,空驶里程
  3023 + if (childTaskPlans.isEmpty()) {
  3024 + if (scheduleRealInfo.getBcType().equals("in") ||
  3025 + scheduleRealInfo.getBcType().equals("out")) {
  3026 + jcclc += tempJhlc;
  3027 + }
  3028 +
  3029 + //主任务 放空班次属于营运
2874 3030 // else if(scheduleRealInfo.getBcType().equals("venting")){
2875 3031 // ksgl += tempJhlc;
2876 3032 // }
2877   - else{
2878   - if(scheduleRealInfo.getStatus() != -1){
2879   - if(scheduleRealInfo.isSflj()){
2880   - addMileage += tempJhlc;
2881   - }
2882   - sj += tempJhlc;
2883   - }
2884   - }
2885   - }else{
2886   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2887   - while(it.hasNext()){
2888   - ChildTaskPlan childTaskPlan = it.next();
2889   - if(childTaskPlan.getMileageType().equals("empty")){
2890   - if(childTaskPlan.isDestroy()){
2891   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2892   - }else{
2893   - if(scheduleRealInfo.isSflj()){
2894   - addMileage += tempJhlc;
2895   - }
2896   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2897   - }
2898   - }else{
2899   - if(childTaskPlan.isDestroy()){
2900   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  3033 + else {
  3034 + if (scheduleRealInfo.getStatus() != -1) {
  3035 + if (scheduleRealInfo.isSflj()) {
  3036 + addMileage += tempJhlc;
  3037 + }
  3038 + sj += tempJhlc;
  3039 + }
  3040 + }
  3041 + } else {
  3042 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  3043 + while (it.hasNext()) {
  3044 + ChildTaskPlan childTaskPlan = it.next();
  3045 + if (childTaskPlan.getMileageType().equals("empty")) {
  3046 + if (childTaskPlan.isDestroy()) {
  3047 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  3048 + } else {
  3049 + if (scheduleRealInfo.isSflj()) {
  3050 + addMileage += tempJhlc;
  3051 + }
  3052 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  3053 + }
  3054 + } else {
  3055 + if (childTaskPlan.isDestroy()) {
  3056 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2901 3057 // cjbc++;
2902   - }else{
2903   - if(scheduleRealInfo.isSflj()){
2904   - addMileage += tempJhlc;
2905   - }
2906   - sj += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2907   - }
2908   - }
2909   - }
2910   - }
2911   - jhlc += jh;
2912   - yygl += sj;
2913   - if(jh > sj){
2914   - remgl += jh - sj;
2915   - } else if(sj > jh){
2916   - addgl += sj - jh;
2917   - }
2918   - }
2919   - }
2920   - map.put("jhlc", format.format(jhlc+jcclc));
2921   - map.put("yygljh", format.format(jhlc));
2922   - map.put("ssgl", format.format(remMileage));
2923   - map.put("ksgl", format.format(ksgl));
2924   - map.put("yyglsj", format.format(yygl));
2925   - map.put("jhbc", jhbc);
2926   - map.put("jcclc", jcclc);
2927   -
2928   - map.put("ljgl", format.format(addMileage));
2929   - map.put("ssbc", cjbc);
2930   - map.put("ysgl", format.format(yygl));
2931   - map.put("sjbc", jhbc-cjbc+ljbc);
2932   - map.put("zgl", format.format(yygl+ksgl+jcclc));
2933   - map.put("ljbc", ljbc);
2934   -
2935   - return map;
2936   - }
2937   -
2938   - @Override
2939   - public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) {
2940   - // TODO Auto-generated method stub
2941   - DecimalFormat format = new DecimalFormat("0.00");
2942   - List <ScheduleRealInfo> list=null;
2943   - list= scheduleRealInfoRepository.queryListWaybill2(clZbh,date,line);
2944   - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
2945   - for (int i = 0; i < list.size(); i++) {
2946   - ScheduleRealInfo s=list.get(i);
2947   - if(!(s.getBcType().equals("in")||s.getBcType().equals("out"))){
2948   - String remarks="";
2949   - Double sjlc=0.0;
2950   - if(s.getRemarks()!=null){
2951   - remarks +=s.getRemarks();
2952   - }
2953   - Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
2954   - if(!childTaskPlans.isEmpty()){
2955   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2956   - while(it.hasNext()){
2957   - ChildTaskPlan c = it.next();
2958   - if(c.getRemarks()!=null && c.getRemarks().length()>0){
2959   - if(remarks.indexOf(c.getRemarks())==-1){
2960   - remarks += c.getRemarks();
2961   - }
2962   - }
2963   -
2964   - if(!c.isDestroy()){
2965   - sjlc += c.getMileage()==null?0:c.getMileage();
2966   - }
2967   -
2968   - }
2969   - }else{
2970   - if(s.getStatus() != -1){
2971   - sjlc =s.getJhlc();
2972   - }
2973   - }
2974   - s.setSjlc(format.format(sjlc));
2975   - s.setRemarks(remarks);
2976   - newList.add(s);
2977   - }
2978   -
2979   - }
2980   -
2981   - return newList;
2982   - }
2983   -
2984   - @Override
2985   - public Map<String, Object> MapById(Long id) {
2986   - // TODO Auto-generated method stub
2987   - Map<String, Object> map=new HashMap<String, Object>();
2988   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
2989   - ScheduleRealInfo s=scheduleRealInfoRepository.findOne(id);
2990   - String xlbm=s.getXlBm();
2991   - String fcrq=s.getScheduleDateStr();
2992   -
2993   - List<Ylxxb> listYlxxb=ylxxbRepository.queryListYlxxb( s.getClZbh(), fcrq);
2994   - Double jzl=0.0;
2995   - for(int t=0;t<listYlxxb.size();t++){
2996   - Ylxxb y=listYlxxb.get(t);
2997   - jzl += y.getJzl();
2998   - }
2999   -
3000   - List<Ylb> listYlb=ylbRepository.queryListYlb( fcrq,s.getClZbh());
3001   - Double ccyl=0.0;
3002   - Double jcyl=0.0;
3003   - Double yh=0.0;
3004   - for (int i = 0; i < listYlb.size(); i++) {
3005   - Ylb y=listYlb.get(i);
3006   - ccyl +=y.getCzyl();
3007   - jcyl+= y.getJzyl();
3008   - yh+=y.getYh();
3009   -
3010   - }
3011   - map.put("jzl", jzl);
3012   - map.put("yh", yh);
3013   - map.put("ccyl", ccyl);
3014   - map.put("jcyl", jcyl);
3015   - map.put("xlName", s.getXlName());
3016   - map.put("clZbh", s.getClZbh());
3017   - map.put("fcsjActual", s.getFcsjActual());
3018   - map.put("zdzName", s.getZdzName());
3019   - map.put("scheduleDate", s.getScheduleDateStr());
3020   - String zdp="",zwdp="",wdp="";
3021   - String zdpT="",zwdpT="",wdpT="";
3022   -
3023   - List<DutyEmployee> list= dutyEmployeeService.getDutyEmployee(xlbm, fcrq+"00:00", fcrq+"23:59");
3024   - try {
3025   - Long fcsj1=sdf.parse(fcrq+" 03:00").getTime();
3026   - Long fcsj2=sdf.parse(fcrq+" 11:00").getTime();
3027   - Long fcsj3=sdf.parse(fcrq+" 22:00").getTime();
3028   - for(int i=0;i<list.size();i++){
3029   - DutyEmployee t=list.get(i);
3030   - Long ts=t.getTs();
3031   - if(ts>fcsj1&&ts<fcsj2){
3032   - if(zdp.indexOf(t.getuName())==-1){
3033   - if(!(zdp.length()>0)){
3034   - zdpT =t.getuName()+"...";
3035   - }
3036   - zdp +=t.getuName()+",";
3037   -
3038   - }
3039   - }else if(ts>fcsj2 && ts<fcsj3){
3040   - if(zwdp.indexOf(t.getuName())==-1){
3041   - if(!(zwdp.length()>0)){
3042   - zwdpT =t.getuName()+"...";
3043   - }
3044   - zwdp +=t.getuName()+",";
3045   - }
3046   - }else{
3047   - if(wdp.indexOf(t.getuName())==-1){
3048   - if(!(wdp.length()>0)){
3049   - wdpT =t.getuName()+"...";
3050   - }
3051   - wdp +=t.getuName()+",";
3052   - }
3053   - }
3054   - }
3055   - } catch (ParseException e) {
3056   - // TODO Auto-generated catch block
3057   - e.printStackTrace();
3058   - }
3059   - map.put("zdp", zdp);
3060   - map.put("zwdp", zwdp);
3061   - map.put("wdp", wdp);
3062   - map.put("zdpT", zdpT);
3063   - map.put("zwdpT", zwdpT);
3064   - map.put("wdpT", wdpT);
3065   - return map;
3066   - }
3067   -
3068   - @Override
3069   - public List<Map<String, Object>> scheduleDailyQp(String line, String date) {
3070   - // TODO Auto-generated method stub
3071   - List<Map<String, Object>> list=new ArrayList<Map<String, Object>>();
3072   - List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.scheduleDailyQp(line, date);
3073   - Map<String, Object> map=null;
3074   - String lp="lp";
3075   - String jgh="jgh";
3076   - String clzbh="clzbh";
3077   - int bcs=0;
3078   - String thclzbh="";
3079   - String sgh="sgh";
3080   - for(int i=0;i<scheduleRealInfos.size();i++){
3081   - ScheduleRealInfo scheduleRealInfo=scheduleRealInfos.get(i);
3082   - if(scheduleRealInfo.getLpName().equals(lp)){
3083   - bcs++;
3084   - String fcsj=scheduleRealInfo.getFcsj();
3085   -
3086   - if(!clzbh.equals(scheduleRealInfo.getClZbh())){
3087   - clzbh=scheduleRealInfo.getClZbh();
3088   - if(thclzbh==""){
3089   - thclzbh +=scheduleRealInfo.getClZbh()+",";
3090   - }else{
3091   - thclzbh +=scheduleRealInfo.getClZbh();
3092   - }
3093   - map.put("thclzbh", thclzbh);
3094   - }
3095   -
3096   - if(!jgh.equals(scheduleRealInfo.getjGh())){
3097   - jgh=scheduleRealInfo.getjGh();
3098   - if(map.get("jjb2")!=null){
3099   - map.put("jjb3", scheduleRealInfo.getjGh()+"/"+
3100   - scheduleRealInfo.getFcsjActual());
3101   -
3102   - }else{
3103   - map.put("jjb2", scheduleRealInfo.getjGh()+"/"+
3104   - scheduleRealInfo.getFcsjActual());
3105   - }
3106   -
3107   - }
3108   -
3109   - if(scheduleRealInfo.getsGh()!=null){
3110   - if(!scheduleRealInfo.getsGh().equals(sgh)){
3111   - sgh=scheduleRealInfo.getsGh();
3112   - if(map.get("sjb1")!=null){
3113   - if(map.get("sjb2")!=null){
3114   - map.put("sjb3", scheduleRealInfo.getsGh()+"/"+
3115   - scheduleRealInfo.getFcsjActual());
3116   - }else{
3117   - map.put("sjb2", scheduleRealInfo.getsGh()+"/"+
3118   - scheduleRealInfo.getFcsjActual());
3119   - }
3120   - }else{
3121   - map.put("sjb1", scheduleRealInfo.getsGh()+"/"+
3122   - scheduleRealInfo.getFcsjActual());
3123   - }
3124   - }
3125   - }
3126   - if(scheduleRealInfo.getFcsjActual()!=null){
3127   - String fcsjs[]=fcsj.split(":");
3128   - String fcsjActuals[]=scheduleRealInfo.getFcsjActual().split(":");
3129   - int a=Integer.parseInt(fcsjActuals[0])*60+Integer.parseInt(fcsjActuals[1]);
3130   - int b=Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1]);
3131   - map.put("cz"+bcs, b-a);
3132   - }else{
3133   - map.put("cz"+bcs, "无");
3134   - }
3135   - map.put("lp", scheduleRealInfo.getLpName());
3136   - map.put("dd"+bcs, scheduleRealInfo.getZdsjActual());
3137   - map.put("kc"+bcs, scheduleRealInfo.getFcsjActual());
3138   -
3139   - if(i<scheduleRealInfos.size()-1){
3140   - if(!scheduleRealInfos.get(i+1).getLpName().equals
3141   - (scheduleRealInfos.get(i).getLpName())){
3142   - list.add(map);
3143   - lp="lp";
3144   - jgh="jgh";
3145   - clzbh="clzbh";
3146   - bcs=0;
3147   - thclzbh="";
3148   - sgh="sgh";
3149   - }
3150   - }else{
3151   - list.add(map);
3152   - }
3153   - }else{
3154   - bcs=1;
3155   - map=new HashMap<String,Object>();
3156   - lp=scheduleRealInfo.getLpName();
3157   - jgh=scheduleRealInfo.getjGh();
3158   - clzbh=scheduleRealInfo.getClZbh();
3159   - if(scheduleRealInfo.getsGh()!=null){
3160   - sgh=scheduleRealInfo.getsGh();
3161   - map.put("sjb1",scheduleRealInfo.getsGh()+"/"+
3162   - scheduleRealInfo.getFcsjActual());
3163   - }
3164   - String fcsj=scheduleRealInfo.getFcsj();
3165   - scheduleRealInfo.getFcsjActual();
3166   - map.put("jjb1", jgh+"/"+scheduleRealInfo.getFcsjActual());
3167   - map.put("cccl", clzbh);
3168   -
3169   - if(scheduleRealInfo.getFcsjActual()!=null){
3170   - String fcsjs[]=fcsj.split(":");
3171   - String fcsjActuals[]=scheduleRealInfo.getFcsjActual().split(":");
3172   - int a=Integer.parseInt(fcsjActuals[0])*60+Integer.parseInt(fcsjActuals[1]);
3173   - int b=Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1]);
3174   - map.put("cz"+bcs, b-a);
3175   - }else{
3176   - map.put("cz"+bcs, "无");
3177   - }
3178   -
3179   -
3180   - map.put("lp", scheduleRealInfo.getLpName());
3181   - map.put("dd"+bcs, scheduleRealInfo.getZdsjActual());
3182   - map.put("kc"+bcs, scheduleRealInfo.getFcsjActual());
3183   -
3184   - if(i<scheduleRealInfos.size()-1){
3185   - if(!scheduleRealInfos.get(i+1).getLpName().equals
3186   - (scheduleRealInfos.get(i).getLpName())){
3187   - list.add(map);
3188   - lp="lp";
3189   - jgh="jgh";
3190   - clzbh="clzbh";
3191   - bcs=0;
3192   - thclzbh="";
3193   - sgh="sgh";
3194   - }
3195   - }else{
3196   - list.add(map);
3197   - }
3198   - }
3199   -
3200   - }
3201   - return list;
3202   - }
3203   -
3204   -
3205   - @Override
3206   - public List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map){
3207   - String line = map.get("line").toString();
3208   - String date = map.get("date").toString();
3209   - String xlName = map.get("xlName").toString();
3210   - String state = map.get("state").toString();
3211   - String type = map.get("type").toString();
3212   -
3213   - List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>();
3214   - List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>();
3215   - List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null);
3216   - List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state);
3217   - List<ScheduleRealInfo> list3 = this.realScheduleList(line, date);
3218   -
3219   - for(Map<String, Object> m : list1){
  3058 + } else {
  3059 + if (scheduleRealInfo.isSflj()) {
  3060 + addMileage += tempJhlc;
  3061 + }
  3062 + sj += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  3063 + }
  3064 + }
  3065 + }
  3066 + }
  3067 + jhlc += jh;
  3068 + yygl += sj;
  3069 + if (jh > sj) {
  3070 + remgl += jh - sj;
  3071 + } else if (sj > jh) {
  3072 + addgl += sj - jh;
  3073 + }
  3074 + }
  3075 + }
  3076 + map.put("jhlc", format.format(jhlc + jcclc));
  3077 + map.put("yygljh", format.format(jhlc));
  3078 + map.put("ssgl", format.format(remMileage));
  3079 + map.put("ksgl", format.format(ksgl));
  3080 + map.put("yyglsj", format.format(yygl));
  3081 + map.put("jhbc", jhbc);
  3082 + map.put("jcclc", jcclc);
  3083 +
  3084 + map.put("ljgl", format.format(addMileage));
  3085 + map.put("ssbc", cjbc);
  3086 + map.put("ysgl", format.format(yygl));
  3087 + map.put("sjbc", jhbc - cjbc + ljbc);
  3088 + map.put("zgl", format.format(yygl + ksgl + jcclc));
  3089 + map.put("ljbc", ljbc);
  3090 +
  3091 + return map;
  3092 + }
  3093 +
  3094 + @Override
  3095 + public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) {
  3096 + // TODO Auto-generated method stub
  3097 + DecimalFormat format = new DecimalFormat("0.00");
  3098 + List<ScheduleRealInfo> list = null;
  3099 + list = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line);
  3100 + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>();
  3101 + for (int i = 0; i < list.size(); i++) {
  3102 + ScheduleRealInfo s = list.get(i);
  3103 + if (!(s.getBcType().equals("in") || s.getBcType().equals("out"))) {
  3104 + String remarks = "";
  3105 + Double sjlc = 0.0;
  3106 + if (s.getRemarks() != null) {
  3107 + remarks += s.getRemarks();
  3108 + }
  3109 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  3110 + if (!childTaskPlans.isEmpty()) {
  3111 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  3112 + while (it.hasNext()) {
  3113 + ChildTaskPlan c = it.next();
  3114 + if (c.getRemarks() != null && c.getRemarks().length() > 0) {
  3115 + if (remarks.indexOf(c.getRemarks()) == -1) {
  3116 + remarks += c.getRemarks();
  3117 + }
  3118 + }
  3119 +
  3120 + if (!c.isDestroy()) {
  3121 + sjlc += c.getMileage() == null ? 0 : c.getMileage();
  3122 + }
  3123 +
  3124 + }
  3125 + } else {
  3126 + if (s.getStatus() != -1) {
  3127 + sjlc = s.getJhlc();
  3128 + }
  3129 + }
  3130 + s.setSjlc(format.format(sjlc));
  3131 + s.setRemarks(remarks);
  3132 + newList.add(s);
  3133 + }
  3134 +
  3135 + }
  3136 +
  3137 + return newList;
  3138 + }
  3139 +
  3140 + @Override
  3141 + public Map<String, Object> MapById(Long id) {
  3142 + // TODO Auto-generated method stub
  3143 + Map<String, Object> map = new HashMap<String, Object>();
  3144 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  3145 + ScheduleRealInfo s = scheduleRealInfoRepository.findOne(id);
  3146 + String xlbm = s.getXlBm();
  3147 + String fcrq = s.getScheduleDateStr();
  3148 +
  3149 + List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(s.getClZbh(), fcrq);
  3150 + Double jzl = 0.0;
  3151 + for (int t = 0; t < listYlxxb.size(); t++) {
  3152 + Ylxxb y = listYlxxb.get(t);
  3153 + jzl += y.getJzl();
  3154 + }
  3155 +
  3156 + List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh());
  3157 + Double ccyl = 0.0;
  3158 + Double jcyl = 0.0;
  3159 + Double yh = 0.0;
  3160 + for (int i = 0; i < listYlb.size(); i++) {
  3161 + Ylb y = listYlb.get(i);
  3162 + ccyl += y.getCzyl();
  3163 + jcyl += y.getJzyl();
  3164 + yh += y.getYh();
  3165 +
  3166 + }
  3167 + map.put("jzl", jzl);
  3168 + map.put("yh", yh);
  3169 + map.put("ccyl", ccyl);
  3170 + map.put("jcyl", jcyl);
  3171 + map.put("xlName", s.getXlName());
  3172 + map.put("clZbh", s.getClZbh());
  3173 + map.put("fcsjActual", s.getFcsjActual());
  3174 + map.put("zdzName", s.getZdzName());
  3175 + map.put("scheduleDate", s.getScheduleDateStr());
  3176 + String zdp = "", zwdp = "", wdp = "";
  3177 + String zdpT = "", zwdpT = "", wdpT = "";
  3178 +
  3179 + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:00", fcrq + "23:59");
  3180 + try {
  3181 + Long fcsj1 = sdf.parse(fcrq + " 03:00").getTime();
  3182 + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime();
  3183 + Long fcsj3 = sdf.parse(fcrq + " 22:00").getTime();
  3184 + for (int i = 0; i < list.size(); i++) {
  3185 + DutyEmployee t = list.get(i);
  3186 + Long ts = t.getTs();
  3187 + if (ts > fcsj1 && ts < fcsj2) {
  3188 + if (zdp.indexOf(t.getuName()) == -1) {
  3189 + if (!(zdp.length() > 0)) {
  3190 + zdpT = t.getuName() + "...";
  3191 + }
  3192 + zdp += t.getuName() + ",";
  3193 +
  3194 + }
  3195 + } else if (ts > fcsj2 && ts < fcsj3) {
  3196 + if (zwdp.indexOf(t.getuName()) == -1) {
  3197 + if (!(zwdp.length() > 0)) {
  3198 + zwdpT = t.getuName() + "...";
  3199 + }
  3200 + zwdp += t.getuName() + ",";
  3201 + }
  3202 + } else {
  3203 + if (wdp.indexOf(t.getuName()) == -1) {
  3204 + if (!(wdp.length() > 0)) {
  3205 + wdpT = t.getuName() + "...";
  3206 + }
  3207 + wdp += t.getuName() + ",";
  3208 + }
  3209 + }
  3210 + }
  3211 + } catch (ParseException e) {
  3212 + // TODO Auto-generated catch block
  3213 + e.printStackTrace();
  3214 + }
  3215 + map.put("zdp", zdp);
  3216 + map.put("zwdp", zwdp);
  3217 + map.put("wdp", wdp);
  3218 + map.put("zdpT", zdpT);
  3219 + map.put("zwdpT", zwdpT);
  3220 + map.put("wdpT", wdpT);
  3221 + return map;
  3222 + }
  3223 +
  3224 + @Override
  3225 + public List<Map<String, Object>> scheduleDailyQp(String line, String date) {
  3226 + // TODO Auto-generated method stub
  3227 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  3228 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleDailyQp(line, date);
  3229 + Map<String, Object> map = null;
  3230 + String lp = "lp";
  3231 + String jgh = "jgh";
  3232 + String clzbh = "clzbh";
  3233 + int bcs = 0;
  3234 + String thclzbh = "";
  3235 + String sgh = "sgh";
  3236 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  3237 + ScheduleRealInfo scheduleRealInfo = scheduleRealInfos.get(i);
  3238 + if (scheduleRealInfo.getLpName().equals(lp)) {
  3239 + bcs++;
  3240 + String fcsj = scheduleRealInfo.getFcsj();
  3241 +
  3242 + if (!clzbh.equals(scheduleRealInfo.getClZbh())) {
  3243 + clzbh = scheduleRealInfo.getClZbh();
  3244 + if (thclzbh == "") {
  3245 + thclzbh += scheduleRealInfo.getClZbh() + ",";
  3246 + } else {
  3247 + thclzbh += scheduleRealInfo.getClZbh();
  3248 + }
  3249 + map.put("thclzbh", thclzbh);
  3250 + }
  3251 +
  3252 + if (!jgh.equals(scheduleRealInfo.getjGh())) {
  3253 + jgh = scheduleRealInfo.getjGh();
  3254 + if (map.get("jjb2") != null) {
  3255 + map.put("jjb3", scheduleRealInfo.getjGh() + "/" +
  3256 + scheduleRealInfo.getFcsjActual());
  3257 +
  3258 + } else {
  3259 + map.put("jjb2", scheduleRealInfo.getjGh() + "/" +
  3260 + scheduleRealInfo.getFcsjActual());
  3261 + }
  3262 +
  3263 + }
  3264 +
  3265 + if (scheduleRealInfo.getsGh() != null) {
  3266 + if (!scheduleRealInfo.getsGh().equals(sgh)) {
  3267 + sgh = scheduleRealInfo.getsGh();
  3268 + if (map.get("sjb1") != null) {
  3269 + if (map.get("sjb2") != null) {
  3270 + map.put("sjb3", scheduleRealInfo.getsGh() + "/" +
  3271 + scheduleRealInfo.getFcsjActual());
  3272 + } else {
  3273 + map.put("sjb2", scheduleRealInfo.getsGh() + "/" +
  3274 + scheduleRealInfo.getFcsjActual());
  3275 + }
  3276 + } else {
  3277 + map.put("sjb1", scheduleRealInfo.getsGh() + "/" +
  3278 + scheduleRealInfo.getFcsjActual());
  3279 + }
  3280 + }
  3281 + }
  3282 + if (scheduleRealInfo.getFcsjActual() != null) {
  3283 + String fcsjs[] = fcsj.split(":");
  3284 + String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":");
  3285 + int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]);
  3286 + int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]);
  3287 + map.put("cz" + bcs, b - a);
  3288 + } else {
  3289 + map.put("cz" + bcs, "无");
  3290 + }
  3291 + map.put("lp", scheduleRealInfo.getLpName());
  3292 + map.put("dd" + bcs, scheduleRealInfo.getZdsjActual());
  3293 + map.put("kc" + bcs, scheduleRealInfo.getFcsjActual());
  3294 +
  3295 + if (i < scheduleRealInfos.size() - 1) {
  3296 + if (!scheduleRealInfos.get(i + 1).getLpName().equals
  3297 + (scheduleRealInfos.get(i).getLpName())) {
  3298 + list.add(map);
  3299 + lp = "lp";
  3300 + jgh = "jgh";
  3301 + clzbh = "clzbh";
  3302 + bcs = 0;
  3303 + thclzbh = "";
  3304 + sgh = "sgh";
  3305 + }
  3306 + } else {
  3307 + list.add(map);
  3308 + }
  3309 + } else {
  3310 + bcs = 1;
  3311 + map = new HashMap<String, Object>();
  3312 + lp = scheduleRealInfo.getLpName();
  3313 + jgh = scheduleRealInfo.getjGh();
  3314 + clzbh = scheduleRealInfo.getClZbh();
  3315 + if (scheduleRealInfo.getsGh() != null) {
  3316 + sgh = scheduleRealInfo.getsGh();
  3317 + map.put("sjb1", scheduleRealInfo.getsGh() + "/" +
  3318 + scheduleRealInfo.getFcsjActual());
  3319 + }
  3320 + String fcsj = scheduleRealInfo.getFcsj();
  3321 + scheduleRealInfo.getFcsjActual();
  3322 + map.put("jjb1", jgh + "/" + scheduleRealInfo.getFcsjActual());
  3323 + map.put("cccl", clzbh);
  3324 +
  3325 + if (scheduleRealInfo.getFcsjActual() != null) {
  3326 + String fcsjs[] = fcsj.split(":");
  3327 + String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":");
  3328 + int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]);
  3329 + int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]);
  3330 + map.put("cz" + bcs, b - a);
  3331 + } else {
  3332 + map.put("cz" + bcs, "无");
  3333 + }
  3334 +
  3335 +
  3336 + map.put("lp", scheduleRealInfo.getLpName());
  3337 + map.put("dd" + bcs, scheduleRealInfo.getZdsjActual());
  3338 + map.put("kc" + bcs, scheduleRealInfo.getFcsjActual());
  3339 +
  3340 + if (i < scheduleRealInfos.size() - 1) {
  3341 + if (!scheduleRealInfos.get(i + 1).getLpName().equals
  3342 + (scheduleRealInfos.get(i).getLpName())) {
  3343 + list.add(map);
  3344 + lp = "lp";
  3345 + jgh = "jgh";
  3346 + clzbh = "clzbh";
  3347 + bcs = 0;
  3348 + thclzbh = "";
  3349 + sgh = "sgh";
  3350 + }
  3351 + } else {
  3352 + list.add(map);
  3353 + }
  3354 + }
  3355 +
  3356 + }
  3357 + return list;
  3358 + }
  3359 +
  3360 +
  3361 + @Override
  3362 + public List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map) {
  3363 + String line = map.get("line").toString();
  3364 + String date = map.get("date").toString();
  3365 + String xlName = map.get("xlName").toString();
  3366 + String state = map.get("state").toString();
  3367 + String type = map.get("type").toString();
  3368 +
  3369 + List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>();
  3370 + List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>();
  3371 + List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null);
  3372 + List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state);
  3373 + List<ScheduleRealInfo> list3 = this.realScheduleList(line, date);
  3374 +
  3375 + for (Map<String, Object> m : list1) {
3220 3376 // m.put("ssgl", m.get("ssgl"));
3221 3377 // m.put("ssbc", m.get("ssbc"));
3222 3378 // m.put("ssgl_lz", m.get("ssgl_lz") + " / " + m.get("ssbc_lz"));
... ... @@ -3230,181 +3386,182 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3230 3386 // m.put("ssgl_qh", m.get("ssgl_qh") + " / " + m.get("ssbc_qh"));
3231 3387 // m.put("ssgl_yw", m.get("ssgl_yw") + " / " + m.get("ssbc_yw"));
3232 3388 // m.put("ssgl_other", m.get("ssgl_other") + " / " + m.get("ssbc_other"));
3233   - }
3234   -
3235   - int size = 0;
3236   - Map<String, Object> tempMap = new HashMap<String, Object>();
3237   - for(int i = 0; i < list2.size(); i++){
3238   - Object obj = (Object)list2.get(i);
3239   - Object[] objs = (Object[])obj;
3240   - if(size == 5){
3241   - size = 0;
3242   - dataList2.add(tempMap);
3243   - tempMap = new HashMap<String, Object>();
3244   - }
3245   - tempMap.put("lp" + size, objs[3]);
3246   - tempMap.put("ch" + size, objs[2]);
3247   - tempMap.put("jz" + size, objs[1] + "/" + objs[4]);
3248   - tempMap.put("sz" + size, "");
3249   - tempMap.put("jw" + size, "");
3250   - tempMap.put("sw" + size, "");
3251   -
3252   - size++;
3253   - }
3254   - if(size < 5){
3255   - for(;size < 5; size++){
3256   - tempMap.put("lp" + size, "");
3257   - tempMap.put("ch" + size, "");
3258   - tempMap.put("jz" + size, "");
3259   - tempMap.put("sz" + size, "");
3260   - tempMap.put("jw" + size, "");
3261   - tempMap.put("sw" + size, "");
3262   - }
3263   - }
3264   -
3265   - dataList2.add(tempMap);
3266   -
3267   - size = 0;
3268   - tempMap = new HashMap<String, Object>();
3269   - for(ScheduleRealInfo schedule : list3){
3270   - if(size == 3){
3271   - size = 0;
3272   - dataList3.add(tempMap);
3273   - tempMap = new HashMap<String, Object>();
3274   - }
3275   - tempMap.put("lpName" + size, schedule.getLpName());
3276   - tempMap.put("qdzName" + size, schedule.getQdzName());
3277   - tempMap.put("zdsj" + size, schedule.getZdsj());
3278   - tempMap.put("zdsjActual" + size, schedule.getZdsjActual()!=null?schedule.getZdsjActual():"");
3279   - tempMap.put("zdsjk" + size, "");
3280   - tempMap.put("zdsjm" + size, "");
3281   - tempMap.put("fcsj" + size, schedule.getFcsj());
3282   - tempMap.put("fcsjActual" + size, schedule.getFcsjActual()!=null?schedule.getFcsjActual():"");
3283   - tempMap.put("fcsjk" + size, "");
3284   - tempMap.put("fcsjm" + size, "");
3285   - tempMap.put("remarks" + size, schedule.getRemarks()!=null?schedule.getRemarks():"");
3286   -
3287   - size++;
3288   - }
3289   - if(size < 3){
3290   - for(; size < 3; size++){
3291   - tempMap.put("lpName" + size, "");
3292   - tempMap.put("qdzName" + size, "");
3293   - tempMap.put("zdsj" + size, "");
3294   - tempMap.put("zdsjActual" + size, "");
3295   - tempMap.put("zdsjk" + size, "");
3296   - tempMap.put("zdsjm" + size, "");
3297   - tempMap.put("fcsj" + size, "");
3298   - tempMap.put("fcsjActual" + size, "");
3299   - tempMap.put("fcsjk" + size, "");
3300   - tempMap.put("fcsjm" + size, "");
3301   - tempMap.put("remarks" + size, "");
3302   - }
3303   - }
3304   -
3305   - dataList3.add(tempMap);
  3389 + }
  3390 +
  3391 + int size = 0;
  3392 + Map<String, Object> tempMap = new HashMap<String, Object>();
  3393 + for (int i = 0; i < list2.size(); i++) {
  3394 + Object obj = (Object) list2.get(i);
  3395 + Object[] objs = (Object[]) obj;
  3396 + if (size == 5) {
  3397 + size = 0;
  3398 + dataList2.add(tempMap);
  3399 + tempMap = new HashMap<String, Object>();
  3400 + }
  3401 + tempMap.put("lp" + size, objs[3]);
  3402 + tempMap.put("ch" + size, objs[2]);
  3403 + tempMap.put("jz" + size, objs[1] + "/" + objs[4]);
  3404 + tempMap.put("sz" + size, "");
  3405 + tempMap.put("jw" + size, "");
  3406 + tempMap.put("sw" + size, "");
  3407 +
  3408 + size++;
  3409 + }
  3410 + if (size < 5) {
  3411 + for (; size < 5; size++) {
  3412 + tempMap.put("lp" + size, "");
  3413 + tempMap.put("ch" + size, "");
  3414 + tempMap.put("jz" + size, "");
  3415 + tempMap.put("sz" + size, "");
  3416 + tempMap.put("jw" + size, "");
  3417 + tempMap.put("sw" + size, "");
  3418 + }
  3419 + }
  3420 +
  3421 + dataList2.add(tempMap);
  3422 +
  3423 + size = 0;
  3424 + tempMap = new HashMap<String, Object>();
  3425 + for (ScheduleRealInfo schedule : list3) {
  3426 + if (size == 3) {
  3427 + size = 0;
  3428 + dataList3.add(tempMap);
  3429 + tempMap = new HashMap<String, Object>();
  3430 + }
  3431 + tempMap.put("lpName" + size, schedule.getLpName());
  3432 + tempMap.put("qdzName" + size, schedule.getQdzName());
  3433 + tempMap.put("zdsj" + size, schedule.getZdsj());
  3434 + tempMap.put("zdsjActual" + size, schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "");
  3435 + tempMap.put("zdsjk" + size, "");
  3436 + tempMap.put("zdsjm" + size, "");
  3437 + tempMap.put("fcsj" + size, schedule.getFcsj());
  3438 + tempMap.put("fcsjActual" + size, schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "");
  3439 + tempMap.put("fcsjk" + size, "");
  3440 + tempMap.put("fcsjm" + size, "");
  3441 + tempMap.put("remarks" + size, schedule.getRemarks() != null ? schedule.getRemarks() : "");
  3442 +
  3443 + size++;
  3444 + }
  3445 + if (size < 3) {
  3446 + for (; size < 3; size++) {
  3447 + tempMap.put("lpName" + size, "");
  3448 + tempMap.put("qdzName" + size, "");
  3449 + tempMap.put("zdsj" + size, "");
  3450 + tempMap.put("zdsjActual" + size, "");
  3451 + tempMap.put("zdsjk" + size, "");
  3452 + tempMap.put("zdsjm" + size, "");
  3453 + tempMap.put("fcsj" + size, "");
  3454 + tempMap.put("fcsjActual" + size, "");
  3455 + tempMap.put("fcsjk" + size, "");
  3456 + tempMap.put("fcsjm" + size, "");
  3457 + tempMap.put("remarks" + size, "");
  3458 + }
  3459 + }
  3460 +
  3461 + dataList3.add(tempMap);
3306 3462  
3307 3463 if (type.equals("export")) {
3308   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
3309   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
3310   - Map<String, Object> m = new HashMap<String, Object>();
3311   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
3312   - ReportUtils ee = new ReportUtils();
3313   - try {
3314   - listI.add(list1.iterator());
3315   - listI.add(dataList2.iterator());
3316   - listI.add(dataList3.iterator());
3317   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
3318   - String sourcePath = path+"mould/scheduleDaily.xls";
3319   - if(date.length() == 7){
3320   - sdfMonth = new SimpleDateFormat("yyyy-MM");
3321   - sdfSimple = new SimpleDateFormat("yyyyMM");
3322   - sourcePath = path+"mould/scheduleDaily_m.xls";
3323   - }
3324   - ee.excelReplace(listI, new Object[] { m }, sourcePath,
3325   - path+"export/调度日报" + sdfSimple.format(sdfMonth.parse(date))+".xls");
3326   - } catch (Exception e) {
3327   - // TODO: handle exception
3328   - e.printStackTrace();
3329   - }
  3464 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3465 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3466 + Map<String, Object> m = new HashMap<String, Object>();
  3467 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3468 + ReportUtils ee = new ReportUtils();
  3469 + try {
  3470 + listI.add(list1.iterator());
  3471 + listI.add(dataList2.iterator());
  3472 + listI.add(dataList3.iterator());
  3473 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3474 + String sourcePath = path + "mould/scheduleDaily.xls";
  3475 + if (date.length() == 7) {
  3476 + sdfMonth = new SimpleDateFormat("yyyy-MM");
  3477 + sdfSimple = new SimpleDateFormat("yyyyMM");
  3478 + sourcePath = path + "mould/scheduleDaily_m.xls";
  3479 + }
  3480 + ee.excelReplace(listI, new Object[]{m}, sourcePath,
  3481 + path + "export/调度日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  3482 + } catch (Exception e) {
  3483 + // TODO: handle exception
  3484 + e.printStackTrace();
  3485 + }
3330 3486 }
3331   -
3332   - return new ArrayList<Map<String, Object>>();
3333   - }
3334   -
3335   - @Override
3336   - public Map<String, Object> exportWaybillMore(Map<String, Object> map) {
3337   - String date = map.get("date").toString();
3338   - String line = map.get("line").toString();
3339   - List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class);
3340   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/export/";
3341   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
3342   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
3343   - int num = 0;
3344   - File file = null;
3345   - try {
3346   - while (true) {
3347   - String fileUrl = path+"行车路单"+sdfSimple.format(sdfMonth.parse(date));
3348   - file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/"));
3349   - if(file.exists()){
3350   - num++;
3351   - } else {
3352   - break;
3353   - }
3354   - }
3355   - file.mkdirs();
3356   -
3357   - for(List<String> list : lists){
3358   - String jName = list.get(0);
3359   - String clZbh = list.get(1);
3360   - String lpName = list.get(2);
3361   - this.exportWaybill(jName, clZbh, lpName, date, line);
3362   - File temp = new File(path+date+"-"+jName+"-"+clZbh+"-"+lpName+"-行车路单.xls");
3363   - String fileName = file.getName();
3364   - temp.renameTo(new File(path + fileName + "/" + temp.getName()));
3365   -
3366   - File[] listFiles = file.listFiles();
3367   - ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path+file.getName()+".zip")));
  3487 +
  3488 + return new ArrayList<Map<String, Object>>();
  3489 + }
  3490 +
  3491 + @Override
  3492 + public Map<String, Object> exportWaybillMore(Map<String, Object> map) {
  3493 + String date = map.get("date").toString();
  3494 + String line = map.get("line").toString();
  3495 + List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class);
  3496 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/";
  3497 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3498 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3499 + int num = 0;
  3500 + File file = null;
  3501 + try {
  3502 + while (true) {
  3503 + String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date));
  3504 + file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/"));
  3505 + if (file.exists()) {
  3506 + num++;
  3507 + } else {
  3508 + break;
  3509 + }
  3510 + }
  3511 + file.mkdirs();
  3512 +
  3513 + for (List<String> list : lists) {
  3514 + String jName = list.get(0);
  3515 + String clZbh = list.get(1);
  3516 + String lpName = list.get(2);
  3517 + this.exportWaybill(jName, clZbh, lpName, date, line);
  3518 + File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
  3519 + String fileName = file.getName();
  3520 + temp.renameTo(new File(path + fileName + "/" + temp.getName()));
  3521 +
  3522 + File[] listFiles = file.listFiles();
  3523 + ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip")));
3368 3524 // zos.setEncoding("gbk");
3369 3525 // zos.putNextEntry(new ZipEntry(fileName + "/"));
3370   - for(int i = 0; i < listFiles.length; i++){
3371   - zos.putNextEntry(new ZipEntry(fileName+"/"+listFiles[i].getName()));
3372   - BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i]));
3373   - BufferedOutputStream bos = new BufferedOutputStream(zos);
3374   - int bytesRead = 0;
3375   - for(byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1);){
  3526 + for (int i = 0; i < listFiles.length; i++) {
  3527 + zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName()));
  3528 + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i]));
  3529 + BufferedOutputStream bos = new BufferedOutputStream(zos);
  3530 + int bytesRead = 0;
  3531 + for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) {
3376 3532 // zos.write(buffer, 0, bytesRead);
3377 3533 // zos.flush();
3378   - bos.write(buffer, 0, bytesRead);
3379   - bos.flush();
3380   - }
3381   - }
3382   - zos.close();
3383   - }
3384   -
3385   - } catch (Exception e) {
3386   - // TODO: handle exception
3387   - e.printStackTrace();
3388   - }
3389   -
3390   - map.put("fileName", file.getName());
3391   - return map;
3392   - }
  3534 + bos.write(buffer, 0, bytesRead);
  3535 + bos.flush();
  3536 + }
  3537 + }
  3538 + zos.close();
  3539 + }
  3540 +
  3541 + } catch (Exception e) {
  3542 + // TODO: handle exception
  3543 + e.printStackTrace();
  3544 + }
  3545 +
  3546 + map.put("fileName", file.getName());
  3547 + return map;
  3548 + }
3393 3549  
3394 3550 @Autowired
3395 3551 SchedulePlanInfoService schPlanService;
  3552 +
3396 3553 @Override
3397 3554 public List<SchedulePlanInfo> currentSchedulePlan(String lineCode) {
3398 3555 List<SchedulePlanInfo> rs = dayOfSchedule.schedulePlanMap.get(lineCode);
3399 3556  
3400   - if(rs==null || rs.size()==0){
  3557 + if (rs == null || rs.size() == 0) {
3401 3558 //尝试刷新内存
3402 3559 Map<String, Object> data = new HashMap<>();
3403 3560 data.put("scheduleDate_eq", dayOfSchedule.currSchDateMap.get(lineCode));
3404 3561 data.put("xlBm_eq", lineCode);
3405 3562 List<SchedulePlanInfo> planItr = dayOfSchedule.cleanSchPlanItr(schPlanService.list(data).iterator());
3406 3563  
3407   - if(planItr.size() > 0){
  3564 + if (planItr.size() > 0) {
3408 3565 dayOfSchedule.schedulePlanMap.put(lineCode, planItr);
3409 3566 return planItr;
3410 3567 }
... ... @@ -3416,34 +3573,53 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3416 3573 @Override
3417 3574 public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx, int type) {
3418 3575 Map<String, Object> rs = new HashMap<>();
3419   - List<ScheduleRealInfo> ts = new ArrayList<>();
  3576 + Set<ScheduleRealInfo> ts = new HashSet<>();
3420 3577 try {
3421 3578 List<String> leftList = Splitter.on(",").splitToList(leftIdx);
3422 3579 List<String> rightList = Splitter.on(",").splitToList(rightIdx);
3423   - if(leftList.size() != rightList.size()){
3424   - rs.put("status", ResponseCode.ERROR);
3425   - rs.put("msg", "不对称的对调!");
3426   - return rs;
  3580 +
  3581 + //有班次变更的车辆
  3582 + Set<String> cars = new HashSet<>();
  3583 +
  3584 + List<ScheduleRealInfo> largeList, smallList;
  3585 + if (leftList.size() > rightList.size()) {
  3586 + largeList = getByIdx(leftList);
  3587 + smallList = getByIdx(rightList);
  3588 + } else {
  3589 + largeList = getByIdx(rightList);
  3590 + smallList = getByIdx(leftList);
3427 3591 }
3428 3592  
3429   - ScheduleRealInfo leftSch, rightSch;
3430   - for(int i = 0; i < leftList.size(); i ++){
3431   - leftSch = dayOfSchedule.get(Long.parseLong(leftList.get(i)));
3432   - rightSch = dayOfSchedule.get(Long.parseLong(rightList.get(i)));
  3593 + ScheduleRealInfo leftSch, rightSch = null;
  3594 + boolean changeRealTime = true;
  3595 + for (int i = 0; i < largeList.size(); i++) {
  3596 + leftSch = largeList.get(i);
  3597 + if (i < smallList.size()) {
  3598 + rightSch = smallList.get(i);
  3599 + ts.add(rightSch);
  3600 + } else
  3601 + changeRealTime = false;
3433 3602  
3434 3603 //调换路牌
3435   - lpChange(leftSch, rightSch, type);
3436   -
  3604 + lpChange(leftSch, rightSch, type, changeRealTime);
3437 3605 ts.add(leftSch);
3438   - ts.add(rightSch);
3439 3606  
3440   - dayOfSchedule.save(leftSch);
3441   - dayOfSchedule.save(rightSch);
  3607 + cars.add(leftSch.getClZbh());
  3608 + cars.add(rightSch.getClZbh());
  3609 + }
  3610 +
  3611 + //重新计算起点应到时间
  3612 + for(String nbbm : cars){
  3613 + ts.addAll(dayOfSchedule.updateQdzTimePlan(nbbm));
  3614 + }
  3615 +
  3616 + for (ScheduleRealInfo sch : ts) {
  3617 + dayOfSchedule.save(sch);
3442 3618 }
3443 3619  
3444 3620 rs.put("status", ResponseCode.SUCCESS);
3445 3621 rs.put("ts", ts);
3446   - }catch(Exception e){
  3622 + } catch (Exception e) {
3447 3623 logger.error("", e);
3448 3624 rs.put("status", ResponseCode.ERROR);
3449 3625 rs.put("msg", e.getMessage());
... ... @@ -3452,13 +3628,28 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3452 3628 return rs;
3453 3629 }
3454 3630  
  3631 + private List<ScheduleRealInfo> getByIdx(List<String> idList) {
  3632 + List<ScheduleRealInfo> list = new ArrayList<>();
  3633 + for (String id : idList) {
  3634 + list.add(dayOfSchedule.get(Long.parseLong(id)));
  3635 + }
  3636 + return list;
  3637 + }
  3638 +
3455 3639 @Override
3456   - public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) {
  3640 + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type, boolean changeRealTime) {
3457 3641 LpData leftData = new LpData(leftSch);
3458 3642 LpData rightData = new LpData(rightSch);
3459 3643  
3460   - leftData.appendTo(rightSch, type);
3461   - rightData.appendTo(leftSch, type);
  3644 + leftData.appendTo(rightSch, type, changeRealTime);
  3645 + rightData.appendTo(leftSch, type, changeRealTime);
  3646 +
  3647 + //更新车辆和班次映射信息
  3648 + dayOfSchedule.removeNbbm2SchMapp(leftSch, leftData.getNbbm());
  3649 + dayOfSchedule.removeNbbm2SchMapp(rightSch, rightData.getNbbm());
  3650 +
  3651 + dayOfSchedule.addNbbm2SchMapp(leftSch, rightData.getNbbm());
  3652 + dayOfSchedule.addNbbm2SchMapp(rightSch, leftData.getNbbm());
3462 3653 }
3463 3654  
3464 3655 @Override
... ... @@ -3468,11 +3659,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3468 3659  
3469 3660 try {
3470 3661 ScheduleRealInfo sch = dayOfSchedule.get(id);
3471   - if (sch.getZdsjActual() == null) {
  3662 + if (sch.getZdsjActual() == null && sch.getFcsjActual() == null) {
3472 3663 rs.put("status", ResponseCode.ERROR);
3473   - rs.put("msg", "无实际到达时间,无法撤销!");
  3664 + rs.put("msg", "班次未执行,无法撤销!");
3474 3665 } else {
3475 3666  
  3667 + sch.clearFcsjActual();
3476 3668 sch.clearZdsjActual();
3477 3669 //清除下一个班次的起点到达时间
3478 3670 ScheduleRealInfo next = dayOfSchedule.next(sch);
... ...
src/main/resources/static/pages/forms/statement/waybill.html
... ... @@ -207,7 +207,7 @@
207 207 line = $("#line").val();
208 208 date = $("#date").val();
209 209 $(".hidden").removeClass("hidden");
210   - $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"(lpName+1)",type:type},function(result){
  210 + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"lpName",type:type},function(result){
211 211 if(type=="desc"){
212 212 type ="asc";
213 213 }else{
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -82,7 +82,7 @@
82 82 线路:
83 83 </td>
84 84 <td colspan="3">
85   - <select class="form-control" name="xlbm_eq" id="xlbm" style="width: 120px;"></select>
  85 + <select class="form-control" name="xlbm_like" id="xlbm" style="width: 120px;"></select>
86 86 &nbsp;
87 87 </td>
88 88 <td >
... ... @@ -231,7 +231,9 @@
231 231 }
232 232 }
233 233 });
  234 + var i = layer.load(2);
234 235 $get('/ylb/checkYl', params, function () {
  236 + layer.close(i);
235 237 jsDoQuery(null, true);
236 238 });
237 239 } else {
... ... @@ -255,7 +257,9 @@
255 257 }
256 258 }
257 259 });
  260 + var i = layer.load(2);
258 261 $get('/ylb/outAndIn', params, function () {
  262 + layer.close(i);
259 263 jsDoQuery(null, true);
260 264 });
261 265 } else {
... ... @@ -273,11 +277,12 @@
273 277 //获取输入的进场存油
274 278 var jzyl = $('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').html();
275 279 // $("#jzyl" + id).html();
276   - console.log(jzyl);
277 280 var params = {};
278 281 params['jzyl'] = jzyl;
279 282 params['id'] = id;
  283 + var i = layer.load(2);
280 284 $get('/ylb/sort', params, function () {
  285 + layer.close(i);
281 286 jsDoQuery(null, true);
282 287 });
283 288  
... ... @@ -302,7 +307,9 @@
302 307 }
303 308 }
304 309 });
  310 + var i = layer.load(2);
305 311 $get('/ylb/obtain', params, function () {
  312 + layer.close(i);
306 313 jsDoQuery(params, true);
307 314 });
308 315 } else {
... ... @@ -530,7 +537,7 @@
530 537 //搜索线路
531 538 $.get('/basic/lineCode2Name',function(result){
532 539 var data=[];
533   -
  540 + data.push({id: " ", text: "全部线路"});
534 541 for(var code in result){
535 542 data.push({id: code, text: result[code]});
536 543 }
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -716,16 +716,16 @@ li.map-panel {
716 716 }
717 717  
718 718 #schedule-lp_change-modal .sch-list dl dt:nth-of-type(1), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(1) {
719   - width: 7%;
  719 + width: 5%;
720 720 border-left: 1px solid #dedede;
721 721 }
722 722  
723 723 #schedule-lp_change-modal .sch-list dl dt:nth-of-type(2), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(2) {
724   - width: 25%;
  724 + width: 22%;
725 725 }
726 726  
727 727 #schedule-lp_change-modal .sch-list dl dt:nth-of-type(3), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(3) {
728   - width: 20%;
  728 + width: 17%;
729 729 }
730 730  
731 731 #schedule-lp_change-modal .sch-list dl dt:nth-of-type(4), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(4) {
... ... @@ -733,39 +733,47 @@ li.map-panel {
733 733 }
734 734  
735 735 #schedule-lp_change-modal .sch-list dl dt:nth-of-type(5), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(5) {
736   - width: 22%;
  736 + width: 21%;
737 737 }
738 738  
739 739 #schedule-lp_change-modal .sch-list dl dt:nth-of-type(6), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(6) {
740   - width: 15%;
  740 + width: 10%;
  741 +}
  742 +
  743 +#schedule-lp_change-modal .sch-list dl dt:nth-of-type(7), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(7) {
  744 + width: 14%;
741 745 }
742 746  
743 747  
744 748  
745 749  
746 750 #schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(1), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(1) {
747   - width: 7%;
  751 + width: 5%;
748 752 border-left: 1px solid #dedede;
749 753 }
750 754  
751 755 #schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(2), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(2) {
752   - width: 15%;
  756 + width: 14%;
753 757 }
754 758  
755 759 #schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(3), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(3) {
756   - width: 22%;
  760 + width: 10%;
757 761 }
758 762  
759 763 #schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(4), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(4) {
760   - width: 10%;
  764 + width: 21%;
761 765 }
762 766  
763 767 #schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(5), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(5) {
764   - width: 20%;
  768 + width: 10%;
765 769 }
766 770  
767 771 #schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(6), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(6) {
768   - width: 25%;
  772 + width: 17%;
  773 +}
  774 +
  775 +#schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(7), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(7) {
  776 + width: 22%;
769 777 }
770 778  
771 779 #schedule-lp_change-modal .ct_table.sch-list .ct_table_body dl.active {
... ... @@ -838,4 +846,21 @@ svg rect.offline{
838 846 font-size: 12px;
839 847 margin-left: 5px;
840 848 display: none;
  849 +}
  850 +
  851 +.operation-real-text{
  852 + position: absolute;
  853 + top: 9px;
  854 + width: 100%;
  855 + left: 0;
  856 + text-align: center;
  857 + pointer-events: none;
  858 +}
  859 +
  860 +.operation-real-text span{
  861 + padding: 15px;
  862 + background: #ff4f4f;
  863 + color: white;
  864 + box-shadow: 0px 4px 6px 0 rgba(0, 0, 0, 0.2), 0px 4px 10px 0 rgba(0, 0, 0, 0.19);
  865 + border-radius: 1px 1px 4px 4px;
841 866 }
842 867 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
... ... @@ -33,7 +33,9 @@
33 33 <div class="uk-form-row">
34 34 <label class="uk-form-label" >车辆编码</label>
35 35 <div class="uk-form-controls">
36   - <input type="text" value="{{sch.clZbh}}" disabled>
  36 + <div class="uk-autocomplete uk-form car-autocom">
  37 + <input type="text" value="{{sch.clZbh}}" name="clZbh" required>
  38 + </div>
37 39 </div>
38 40 </div>
39 41 </div>
... ... @@ -52,7 +54,9 @@
52 54 <div class="uk-form-row">
53 55 <label class="uk-form-label" >驾驶员</label>
54 56 <div class="uk-form-controls">
55   - <input type="text" value="{{sch.jGh}}/{{sch.jName}}" disabled>
  57 + <div class="uk-autocomplete uk-form jsy-autocom">
  58 + <input type="text" value="{{sch.jGh}}/{{sch.jName}}" name="jsy" required>
  59 + </div>
56 60 </div>
57 61 </div>
58 62 </div>
... ... @@ -60,7 +64,9 @@
60 64 <div class="uk-form-row">
61 65 <label class="uk-form-label" >售票员</label>
62 66 <div class="uk-form-controls">
63   - <input type="text" value="{{sch.sGh}}/{{sch.sName}}" disabled>
  67 + <div class="uk-autocomplete uk-form spy-autocom">
  68 + <input type="text" value="{{sch.sGh}}/{{sch.sName}}" name="spy">
  69 + </div>
64 70 </div>
65 71 </div>
66 72 </div>
... ... @@ -170,6 +176,15 @@
170 176 //字典转换
171 177 dictionaryUtils.transformDom($('.nt-dictionary', modal));
172 178  
  179 + //车辆自动补全
  180 + $.get('/basic/cars', function (rs) {
  181 + gb_common.carAutocomplete($('.car-autocom', modal), rs);
  182 + });
  183 + //驾驶员自动补全
  184 + gb_common.personAutocomplete($('.jsy-autocom', modal));
  185 + //售票员
  186 + gb_common.personAutocomplete($('.spy-autocom', modal));
  187 +
173 188 //submit
174 189 var f = $('form', modal).formValidation(gb_form_validation_opts);
175 190 f.on('success.form.fv', function(e) {
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lp_change.html
1 1 <div class="uk-modal" id="schedule-lp_change-modal">
2   - <div class="uk-modal-dialog" style="width: 1200px;">
  2 + <div class="uk-modal-dialog" style="width: 1240px;">
3 3 <a href="" class="uk-modal-close uk-close"></a>
4 4 <div class="uk-modal-header">
5 5 <h2>路牌对调</h2></div>
6 6  
  7 + <div class="operation-real-text">
  8 + <span></span>
  9 + </div>
7 10 <div class="uk-grid uk-grid-divider">
8 11 <div class="uk-width-1-2">
9 12 <form class="uk-form uk-form-horizontal">
... ... @@ -23,7 +26,8 @@
23 26 <dt>车辆</dt>
24 27 <dt>路牌</dt>
25 28 <dt>起点站</dt>
26   - <dt>时间</dt>
  29 + <dt>实发</dt>
  30 + <dt>计发</dt>
27 31 </dl>
28 32 </div>
29 33 <div class="ct_table_body">
... ... @@ -45,7 +49,8 @@
45 49 <div class="ct_table_head">
46 50 <dl>
47 51 <dt><input type="checkbox" class="global_box"></dt>
48   - <dt>时间</dt>
  52 + <dt>计发</dt>
  53 + <dt>实发</dt>
49 54 <dt>起点站</dt>
50 55 <dt>路牌</dt>
51 56 <dt>车辆</dt>
... ... @@ -65,7 +70,7 @@
65 70 </div>
66 71 <button type="button" class="uk-button uk-modal-close">取消</button>
67 72 <button type="submit" data-type="0" class="uk-button uk-button-success"><i class="uk-icon-user"></i> &nbsp;只调人</button>
68   - <button type="submit" data-type="1" class="uk-button uk-button-success"><i class="uk-icon-bus"></i> &nbsp;只调车</button>
  73 + <button title="如起点站相同,则实发时间跟随车辆对调!" data-uk-tooltip type="submit" data-type="1" class="uk-button uk-button-success"><i class="uk-icon-bus"></i> &nbsp;只调车</button>
69 74 <button type="submit" data-type="2" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;调人并调车</button>
70 75 </div>
71 76 </div>
... ... @@ -73,12 +78,13 @@
73 78 <script id="schedule-lp_change-list-temp" type="text/html">
74 79 {{if order == 0}}
75 80 {{each array as sch i}}
76   - <dl data-id="{{sch.id}}">
  81 + <dl data-id="{{sch.id}}" data-jsy="{{sch.jGh}}/{{sch.jName}}" data-nbbm="{{sch.clZbh}}">
77 82 <dd><input type="checkbox"></dd>
78 83 <dd>{{sch.jGh}}/{{sch.jName}}</dd>
79 84 <dd>{{sch.clZbh}}</dd>
80 85 <dd>{{sch.lpName}}</dd>
81 86 <dd>{{sch.qdzName}}</dd>
  87 + <dd style="color:#07d;">{{sch.fcsjActual}}</dd>
82 88 <dd>{{sch.dfsj}}
83 89 {{if sch.bcType == "out"}}
84 90 <span class="uk-badge uk-badge-success">出</span>
... ... @@ -94,7 +100,7 @@
94 100 {{/each}}
95 101 {{else if order == 1}}
96 102 {{each array as sch i}}
97   - <dl data-id="{{sch.id}}">
  103 + <dl data-id="{{sch.id}}" data-jsy="{{sch.jGh}}/{{sch.jName}}" data-nbbm="{{sch.clZbh}}">
98 104 <dd><input type="checkbox"></dd>
99 105 <dd>{{sch.dfsj}}{{if sch.bcType == "out"}}
100 106 <span class="uk-badge uk-badge-success">出</span>
... ... @@ -106,6 +112,7 @@
106 112 <span class="uk-badge uk-badge-danger">放</span>
107 113 {{/if}}
108 114 </dd>
  115 + <dd style="color:#07d;">{{sch.fcsjActual}}</dd>
109 116 <dd>{{sch.qdzName}}</dd>
110 117 <dd>{{sch.lpName}}</dd>
111 118 <dd>{{sch.clZbh}}</dd>
... ... @@ -119,6 +126,9 @@
119 126 (function () {
120 127 var modal = '#schedule-lp_change-modal'
121 128 , sch, list = [{}, {}];
  129 +
  130 + var opTextPanel = $('.operation-real-text span');
  131 +
122 132 $(modal).on('init', function (e, data) {
123 133 e.stopPropagation();
124 134 sch = data.sch;
... ... @@ -204,26 +214,137 @@
204 214 dl.removeClass('active');
205 215 dl.find('input[type=checkbox]')[0].checked = false;
206 216 }
207   -
  217 +
  218 + /**
  219 + * 校验左右数据是否可对调
  220 + **/
208 221 function disabledSubmitBtn() {
209   - //同一个路牌不能对调
210   - var leftLP = $('[name=lineSelect]:eq(0)', modal).val() + '_' + $('[name=lpName]:eq(0)', modal).val();
211   - var rightLP = $('[name=lineSelect]:eq(1)', modal).val() + '_' + $('[name=lpName]:eq(1)', modal).val();
  222 + opTextPanel.text('').show();
212 223 var $submitBtn = $('button[type=submit]', modal);
213   - if(leftLP == rightLP)
  224 +
  225 + var leftArray = $('.sch-list:eq(0) .ct_table_body dl.active', modal);
  226 + var rightArray = $('.sch-list:eq(1) .ct_table_body dl.active', modal);
  227 + if(leftArray.length == 0 && rightArray.length==0){
  228 + opTextPanel.text('请勾选班次');
214 229 $submitBtn.attr('disabled', 'disabled');
  230 + return;
  231 + }
  232 +
  233 + if(leftArray.length == 0){
  234 + opTextPanel.text('请勾选左侧班次');
  235 + $submitBtn.attr('disabled', 'disabled');
  236 + return;
  237 + }
  238 +
  239 + if(rightArray.length == 0){
  240 + opTextPanel.text('请勾选右侧班次');
  241 + $submitBtn.attr('disabled', 'disabled');
  242 + return;
  243 + }
  244 +
  245 +
  246 + //是否可调人
  247 + var $perSubmit = $('button[type=submit][data-type=0]', modal);
  248 + if(!isTransferPerson(leftArray, rightArray)){
  249 + $perSubmit.attr('disabled', 'disabled');
  250 + }
  251 + else
  252 + $perSubmit.removeAttr('disabled');
  253 +
  254 + //是否可调车
  255 + var $carSubmit = $('button[type=submit][data-type=1]', modal);
  256 + if(!isTransferCar(leftArray, rightArray)){
  257 + $carSubmit.attr('disabled', 'disabled');
  258 + }
  259 + else
  260 + $carSubmit.removeAttr('disabled');
  261 +
  262 +
  263 + //人车都可以调
  264 + var $threeSubmitBtn = $('button[type=submit][data-type=2]', modal);
  265 + if(!$perSubmit.attr('disabled') && !$carSubmit.attr('disabled')){
  266 + $threeSubmitBtn.removeAttr('disabled');
  267 + opTextPanel.hide();
  268 + }
  269 + else
  270 + $threeSubmitBtn.attr('disabled', 'disabled');
  271 + }
  272 +
  273 + function appendText(text) {
  274 + opTextPanel.text(opTextPanel.text() + text);
  275 + }
  276 +
  277 + function isTransferPerson(leftArray, rightArray) {
  278 + if(extractPerson(leftArray).toString() == extractPerson(rightArray).toString()){
  279 + appendText('(无法调人)同一个驾驶员');
  280 + return false;
  281 + }
  282 +
  283 + if(leftArray.length != rightArray.length){
  284 + if(extractPerson(leftArray).length > 1){
  285 + appendText('(无法调人)不对称时,左侧勾选班次只能有一个驾驶员');
  286 + return false;
  287 + }
  288 + if(extractPerson(rightArray).length > 1){
  289 + appendText('(无法调人)不对称时,右侧勾选班次只能有一个驾驶员');
  290 + return false;
  291 + }
  292 +
  293 + return true;
  294 + }
215 295 else{
  296 + return true;
  297 + }
  298 + }
  299 +
  300 + function isTransferCar(leftArray, rightArray) {
  301 + if(extractCar(leftArray).toString() == extractCar(rightArray).toString()){
  302 + appendText('(无法调车)同一辆车');
  303 + return false;
  304 + }
216 305  
217   - var leftSize = $('.sch-list:eq(0) dl.active', modal).length;
218   - var rightSize = $('.sch-list:eq(1) dl.active', modal).length;
219   - if(leftSize != rightSize)
220   - $submitBtn.attr('disabled', 'disabled');
221   - else
222   - $submitBtn.removeAttr('disabled');
  306 + if(leftArray.length != rightArray.length){
  307 + if(extractCar(leftArray).length > 1){
  308 + appendText('(无法调车)不对称时,左侧勾选班次只能有一辆车');
  309 + return false;
  310 + }
  311 + if(extractCar(rightArray).length > 1){
  312 + appendText('(无法调车)不对称时,右侧勾选班次只能有一辆车');
  313 + return false;
  314 + }
  315 +
  316 + return true;
  317 + }
  318 + else{
  319 + return true;
223 320 }
224 321 }
225 322  
226 323  
  324 + /**
  325 + * 从dl 里提取出所有的驾驶员
  326 + * @param list
  327 + */
  328 + function extractPerson(list){
  329 + var jsyMap = {};
  330 + $.each(list, function () {
  331 + jsyMap[$(this).data('jsy')] = 1;
  332 + });
  333 + return gb_common.get_keys(jsyMap);
  334 + }
  335 +
  336 + /**
  337 + *从dl 里提取出所有的车辆
  338 + * @param list
  339 + */
  340 + function extractCar(list) {
  341 + var carMap = {};
  342 + $.each(list, function () {
  343 + carMap[$(this).data('nbbm')] = 1;
  344 + });
  345 + return gb_common.get_keys(carMap);
  346 + }
  347 +
227 348 //全选
228 349 $('.global_box', modal).on('click', function () {
229 350 var $table = $(this).parents('.ct_table.sch-list');
... ... @@ -252,10 +373,10 @@
252 373 var leftList = $('.sch-list:eq(0) .ct_table_body dl.active', modal);
253 374 var rightList = $('.sch-list:eq(1) .ct_table_body dl.active', modal);
254 375  
255   - if(leftList.length != rightList.length){
  376 + /*if(leftList.length != rightList.length){
256 377 alert('左右不对称,无法提交!!');
257 378 return;
258   - }
  379 + }*/
259 380  
260 381 var leftIdx = '', rightIdx = '';
261 382 $.each(leftList, function () {
... ... @@ -292,6 +413,7 @@
292 413 this.checked = false;
293 414 });
294 415 }
  416 +
295 417 })();
296 418 </script>
297 419 </div>
... ...
src/main/resources/static/real_control_v2/js/common.js
... ... @@ -82,7 +82,7 @@ var gb_common = (function () {
82 82 function successHandle(json, handle) {
83 83 var status = json.status;
84 84 if (status == 407) {
85   - location.href = '/real_control_v2/login.html';
  85 + location.href = '/login.html';
86 86 return;
87 87 }
88 88  
... ...
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
... ... @@ -197,10 +197,12 @@ var gb_schedule_table = (function () {
197 197  
198 198 var tMaps = {};
199 199 $.each(schArr, function () {
200   - line2Schedule[this.xlBm][this.id] = this;
201   - updateDom(this);
202   - //线路_车辆 过滤重复数据
203   - tMaps[this.xlBm + '_' + this.clZbh] = 1;
  200 + try {
  201 + line2Schedule[this.xlBm][this.id] = this;
  202 + updateDom(this);
  203 + //线路_车辆 过滤重复数据
  204 + tMaps[this.xlBm + '_' + this.clZbh] = 1;
  205 + }catch(e){}
204 206 });
205 207  
206 208 /* //重新标记末班
... ...