Commit a82d13817792ff368356a019ff40703b2c65df80

Authored by 徐烜
2 parents d023be26 3b26722b

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

Too many changes to show.

To preserve performance only 10 of 51 files are displayed.

src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -36,35 +36,13 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
36 36  
37 37 /**
38 38 *
39   - * 改由通过 websocket 注册监听!!!
40   - *
41   - * @Title: registerLine @Description: TODO(注册线路,后续才能收到数据推送) @param @param
42   - * lineCodes @throws
43   - * 用GET 防止监控模式下被拦截
44   -
45   - @RequestMapping(value = "/registerLine", method = RequestMethod.GET)
46   - public int registerLine(@RequestParam String lineCodes) {
47   - List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(lineCodes);
48   - String userName = SecurityUtils.getCurrentUser().getUserName();
49   - // 注销之前的绑定
50   - for (String line : list)
51   - BasicData.lineCode2SocketUserMap.get(line).remove(userName);
52   - // 重新绑定
53   - for (String line : list)
54   - BasicData.lineCode2SocketUserMap.put(line, userName);
55   -
56   - return 0;
57   - }*/
58   -
59   - /**
60   - *
61 39 * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
62 40 * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
63 41 */
64 42 @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
65 43 public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
66   - @RequestParam String dfsj/*, String clZbh, String jsy, String spy*/) {
67   - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj/*, clZbh, jsy, spy*/);
  44 + @RequestParam String dfsj,@RequestParam String bcType) {
  45 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType);
68 46 }
69 47  
70 48 /**
... ... @@ -125,19 +103,6 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
125 103 public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
126 104 return scheduleRealInfoService.sreachVehic(nbbm);
127 105 }
128   -
129   - /**
130   - *
131   - * @Title: adjust @Description: TODO(调整人车) @param @param id
132   - * 班次ID @param @param nbbm 内部编码 @param @param jsy 驾驶员 @param @param spy
133   - * 售票员 @throws
134   -
135   - @RequestMapping(value = "/adjust", method = RequestMethod.POST)
136   - public Map<String, Object> adjust(@RequestParam Long id, String nbbm, String jsy,
137   - String spy, Integer revertLine, Integer borrowLine, String borrowTimeStr, String revertTimeStr) {
138   - return scheduleRealInfoService.adjust(id, nbbm, jsy, spy, revertLine, borrowLine, borrowTimeStr, revertTimeStr);
139   - }
140   - */
141 106 /**
142 107 *
143 108 * @Title: realOutAdjust
... ... @@ -299,10 +264,17 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
299 264  
300 265 @RequestMapping(value = "/exportWaybill")
301 266 public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
302   - @RequestParam String lpName,@RequestParam String date) {
303   - return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date);
  267 + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
  268 + return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line);
  269 + }
  270 +
  271 + @RequestMapping(value = "/exportWaybillQp")
  272 + public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
  273 + ,@RequestParam String date,@RequestParam String line) {
  274 + return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
304 275 }
305 276  
  277 +
306 278 @RequestMapping(value = "/dailyInfo")
307 279 public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
308 280 return scheduleRealInfoService.dailyInfo(line, date, type);
... ... @@ -321,8 +293,14 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
321 293  
322 294 @RequestMapping(value="/findKMBC")
323 295 public Map<String,Object> findKMBC(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
324   - ,@RequestParam String date){
325   - return scheduleRealInfoService.findKMBC(jName, clZbh,lpName,date);
  296 + ,@RequestParam String date,@RequestParam String line){
  297 + return scheduleRealInfoService.findKMBC(jName, clZbh,lpName,date,line);
  298 + }
  299 +
  300 + @RequestMapping(value="/findKMBCQp")
  301 + public Map<String,Object> findKMBCQp(@RequestParam String clZbh
  302 + ,@RequestParam String date,@RequestParam String line){
  303 + return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
326 304 }
327 305  
328 306 @RequestMapping(value="/findLpName")
... ... @@ -351,16 +329,14 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
351 329 */
352 330 @RequestMapping(value="/queryListWaybill")
353 331 public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
354   - ,@RequestParam String date){
355   - String type="fqp";
356   - return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,type);
  332 + ,@RequestParam String date,@RequestParam String line){
  333 + return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line);
357 334 }
358 335  
359 336 @RequestMapping(value="/queryListWaybillQp")
360   - public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
361   - ,@RequestParam String date){
362   - String type="qp";
363   - return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,type);
  337 + public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
  338 + @RequestParam String date,@RequestParam String line){
  339 + return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
364 340 }
365 341  
366 342 @RequestMapping(value="/statisticsDaily")
... ... @@ -368,6 +344,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
368 344 return scheduleRealInfoService.statisticsDaily(line, date,xlName);
369 345 }
370 346  
  347 + @RequestMapping(value="/MapById",method = RequestMethod.GET)
  348 + public Map<String, Object> MapById(@RequestParam("id") Long id){
  349 + return scheduleRealInfoService.MapById(id);
  350 + }
  351 +
371 352 /**
372 353 * @Title: scheduleDaily
373 354 * @Description: TODO(调度日报表)
... ... @@ -427,4 +408,14 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
427 408 }
428 409 return rs;
429 410 }
  411 +
  412 + @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
  413 + public Map<String, Object> svgAttr(@RequestParam String jsonStr){
  414 + return scheduleRealInfoService.svgAttr(jsonStr);
  415 + }
  416 +
  417 + @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
  418 + public Map<String, Object> findSvgAttr(@RequestParam String idx){
  419 + return scheduleRealInfoService.findSvgAttr(idx);
  420 + }
430 421 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
... ... @@ -169,6 +169,10 @@ public class InOutStationSignalHandle extends SignalHandle{
169 169  
170 170 if(gps.getStopNo().equals(sch.getZdzCode())){
171 171  
  172 + //进场最多提前1.2小时
  173 + if(sch.getBcType().equals("in") && sch.getZdsjT() - gps.getTimestamp() > MAX_BEFORE_TIME)
  174 + return;
  175 +
172 176 //实达时间不覆盖
173 177 if(StringUtils.isNotEmpty(sch.getZdsjActual()))
174 178 return;
... ...
src/main/java/com/bsth/entity/realcontrol/SvgAttribute.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +
  7 +/**
  8 + * 主页SVG模拟图属性设置
  9 + * Created by panzhao on 2017/1/6.
  10 + */
  11 +@Entity
  12 +@Table(name = "bsth_c_svg_attr")
  13 +public class SvgAttribute {
  14 +
  15 + @Id
  16 + private String lineCode;
  17 +
  18 + /**
  19 + * 要隐藏的站点编码 , 号分割多个
  20 + */
  21 + private String hideStations;
  22 +
  23 + /**
  24 + * 站点别名 json对象字符串
  25 + */
  26 + private String nicknames;
  27 +
  28 + public String getLineCode() {
  29 + return lineCode;
  30 + }
  31 +
  32 + public void setLineCode(String lineCode) {
  33 + this.lineCode = lineCode;
  34 + }
  35 +
  36 + public String getHideStations() {
  37 + return hideStations;
  38 + }
  39 +
  40 + public void setHideStations(String hideStations) {
  41 + this.hideStations = hideStations;
  42 + }
  43 +
  44 + public String getNicknames() {
  45 + return nicknames;
  46 + }
  47 +
  48 + public void setNicknames(String nicknames) {
  49 + this.nicknames = nicknames;
  50 + }
  51 +}
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -24,7 +24,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
24 24 @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)")
25 25 List<ScheduleRealInfo> queryUserInfo2(String line,String date);
26 26  
27   - @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)")
  27 + @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.clZbh order by (lpName+1)")
28 28 List<ScheduleRealInfo> queryUserInfo3(String line,String date);
29 29  
30 30 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs")
... ... @@ -79,13 +79,13 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
79 79 + " and clZbh like %?5% order by s.fcsj")
80 80 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
81 81  
82   - @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') order by bcs")
83   - List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date);
  82 + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsjActual")
  83 + List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
84 84  
85   - @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and bcType='normal' order by bcs")
86   - List<ScheduleRealInfo> queryListWaybill2(String jName,String clZbh,String lpName,String date);
  85 + @Query(value="select s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsjActual")
  86 + List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);
87 87  
88   - @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by bcs")
  88 + @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by realExecDate,fcsjActual")
89 89 List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date);
90 90  
91 91 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between str_to_date(?3,'%Y-%m-%d') and str_to_date(?4,'%Y-%m-%d') order by bcs")
... ...
src/main/java/com/bsth/repository/realcontrol/SvgAttributeRepository.java 0 → 100644
  1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.SvgAttribute;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.data.jpa.repository.Query;
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * Created by panzhao on 2017/1/8.
  12 + */
  13 +@Repository
  14 +public interface SvgAttributeRepository extends BaseRepository<SvgAttribute, String> {
  15 + @Query("select s from SvgAttribute s where s.lineCode in ?1")
  16 + List<SvgAttribute> findSvgAttr(List<String> lineCodes);
  17 +}
... ...
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
... ... @@ -11,6 +11,7 @@ import java.util.Collections;
11 11 import java.util.Comparator;
12 12 import java.util.Date;
13 13 import java.util.HashMap;
  14 +import java.util.Iterator;
14 15 import java.util.List;
15 16 import java.util.Map;
16 17 import java.util.Set;
... ... @@ -25,6 +26,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
25 26 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
26 27 import com.bsth.service.BusIntervalService;
27 28 import com.bsth.service.schedule.PeopleCarPlanService;
  29 +import com.bsth.util.ReportUtils;
28 30  
29 31  
30 32 @Service
... ... @@ -514,6 +516,24 @@ public class BusIntervalServiceImpl implements BusIntervalService {
514 516 }
515 517 }
516 518 }
  519 +
  520 + if(type != null && type.length() != 0 && type.equals("export")){
  521 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  522 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  523 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  524 + Map<String, Object> m = new HashMap<String, Object>();
  525 + ReportUtils ee = new ReportUtils();
  526 + try {
  527 + listI.add(resList.iterator());
  528 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  529 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\interval.xls",
  530 + path+"export\\班次间隔统计表" + sdfSimple.format(sdfMonth.parse(startDate))
  531 + + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  532 + } catch (Exception e) {
  533 + // TODO: handle exception
  534 + e.printStackTrace();
  535 + }
  536 + }
517 537  
518 538 return resList;
519 539 }
... ... @@ -672,8 +692,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
672 692 String[] date1 = startDate.split("-");
673 693 String[] date2 = endDate.split("-");
674 694 String date = "";
675   - startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
676   - endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  695 +// startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
  696 +// endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
677 697 if(startDate.equals(endDate)){
678 698 date = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
679 699 } else {
... ... @@ -1044,6 +1064,27 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1044 1064 modelMap.put("dataList", dataList);
1045 1065 }
1046 1066  
  1067 + if(type != null && type.length() != 0 && type.equals("export")){
  1068 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1069 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1070 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1071 + ReportUtils ee = new ReportUtils();
  1072 + if(statu.equals("0"))
  1073 + modelMap.put("lpType", "路牌数量");
  1074 + else if(statu.equals("1"))
  1075 + modelMap.put("lpType", "路牌名");
  1076 + try {
  1077 + listI.add(((List<Map<String, Object>>)modelMap.get("dataList")).iterator());
  1078 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1079 + ee.excelReplace(listI, new Object[] { modelMap }, path+"mould\\timeAndSpeed.xls",
  1080 + path+"export\\行驶时间及车速统计表" + sdfSimple.format(sdfMonth.parse(startDate))
  1081 + + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  1082 + } catch (Exception e) {
  1083 + // TODO: handle exception
  1084 + e.printStackTrace();
  1085 + }
  1086 + }
  1087 +
1047 1088 return modelMap;
1048 1089 }
1049 1090  
... ...
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
3   -import java.io.ByteArrayInputStream;
4   -import java.io.File;
5   -import java.io.InputStream;
6   -import java.text.DecimalFormat;
7   -import java.util.ArrayList;
8   -import java.util.HashMap;
9   -import java.util.List;
10   -import java.util.Map;
11   -import java.util.Properties;
12   -
13   -import org.springframework.beans.factory.annotation.Autowired;
14   -import org.springframework.data.jpa.repository.EntityGraph;
15   -import org.springframework.stereotype.Service;
16   -
17   -import com.alibaba.fastjson.JSON;
18   -import com.alibaba.fastjson.JSONArray;
19   -import com.alibaba.fastjson.serializer.PropertyFilter;
20 3 import com.bsth.common.ResponseCode;
21 4 import com.bsth.entity.Line;
22 5 import com.bsth.entity.Station;
... ... @@ -30,7 +13,14 @@ import com.bsth.util.FTPClientUtils;
30 13 import com.bsth.util.PackTarGZUtils;
31 14 import com.bsth.util.db.DBUtils_MS;
32 15 import com.google.common.base.Splitter;
33   -import com.google.common.collect.Lists;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.stereotype.Service;
  18 +
  19 +import java.io.ByteArrayInputStream;
  20 +import java.io.File;
  21 +import java.io.InputStream;
  22 +import java.text.DecimalFormat;
  23 +import java.util.*;
34 24  
35 25 /**
36 26 *
... ... @@ -985,6 +975,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
985 975 List<String> idx = Splitter.on(',').splitToList(lineIds);
986 976 //路由
987 977 List<StationRoute> list = new ArrayList<>();
  978 +
  979 +
988 980 /**
989 981 * in 查询符 无法和 @EntityGraph 同时配合使用,这可能是一个bug
990 982 * 暂时只能循环单线路查询
... ... @@ -993,9 +985,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
993 985 for(String id : idx){
994 986 list.addAll(repository.findByLineCode(id));
995 987 }
996   -
  988 +
  989 + for(StationRoute sr : list){
  990 + sr.setLine(null);
  991 + }
997 992 //过滤部分字段
998   - String jsonStr = JSON.toJSONString(list, new PropertyFilter() {
  993 + /*String jsonStr = JSON.toJSONString(list, new PropertyFilter() {
999 994  
1000 995 @Override
1001 996 public boolean apply(Object object, String name, Object value) {
... ... @@ -1003,10 +998,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1003 998 return false;
1004 999 return true;
1005 1000 }
1006   - });
  1001 + });*/
1007 1002  
1008 1003 rs.put("status", ResponseCode.SUCCESS);
1009   - rs.put("list", jsonStr);
  1004 + rs.put("list", list);
1010 1005 }catch(Exception e){
1011 1006 logger.error("", e);
1012 1007 rs.put("status", ResponseCode.ERROR);
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -15,7 +15,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
15 15  
16 16 Map<String, Collection<ScheduleRealInfo>> findByLines(String lines);
17 17  
18   - Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj/*,String nbbm,String jsy,String spy*/);
  18 + Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType);
19 19  
20 20 Map<String, Object> destroy(String idsStr/*, int spaceAdjust*/, String remarks, String reason/*, int spaceNum*/);
21 21  
... ... @@ -61,7 +61,9 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
61 61  
62 62 List<ScheduleRealInfo> queryUserInfo(String line,String date,String state);
63 63  
64   - List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName,String date);
  64 + List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName,String date,String line);
  65 +
  66 + List<ScheduleRealInfo> exportWaybillQp(String clZbh,String date,String line);
65 67  
66 68 List<Map<String,Object>> dailyInfo(String line,String date,String type);
67 69  
... ... @@ -87,7 +89,9 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
87 89  
88 90 Map<String,Object> findKMBC1(String jName,String clZbh, String date,String enddate);
89 91  
90   - Map<String,Object> findKMBC(String jName,String clZbh,String lpName,String date);
  92 + Map<String,Object> findKMBC(String jName,String clZbh,String lpName,String date,String line);
  93 +
  94 + Map<String,Object> findKMBCQp(String clZbh,String date,String line);
91 95  
92 96 Map<String,Object> findKMBC2(String jName,String clZbh,String date);
93 97  
... ... @@ -97,8 +101,10 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
97 101  
98 102 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code, String type);
99 103  
100   - List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String type);
  104 + List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
101 105  
  106 + List<ScheduleRealInfo> queryListWaybillQp(String clZbh,String date,String line);
  107 +
102 108 Map<String, Object> removeChildTask(Long taskId);
103 109  
104 110 List<Map<String,Object>> statisticsDaily(String line,String date,String xlName);
... ... @@ -128,4 +134,10 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
128 134 Map<String,Object> changeBcType(Long id, String bcType, String remarks);
129 135  
130 136 Map<String,Object> historySave(ScheduleRealInfo sch);
  137 +
  138 + Map<String, Object> MapById(Long id) ;
  139 +
  140 + Map<String,Object> svgAttr(String jsonStr);
  141 +
  142 + Map<String,Object> findSvgAttr(String idx);
131 143 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -18,13 +18,16 @@ import com.bsth.entity.Personnel;
18 18 import com.bsth.entity.realcontrol.ChildTaskPlan;
19 19 import com.bsth.entity.realcontrol.LineConfig;
20 20 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  21 +import com.bsth.entity.realcontrol.SvgAttribute;
21 22 import com.bsth.entity.schedule.CarConfigInfo;
22 23 import com.bsth.entity.schedule.EmployeeConfigInfo;
23 24 import com.bsth.entity.schedule.GuideboardInfo;
  25 +import com.bsth.entity.sys.DutyEmployee;
24 26 import com.bsth.entity.sys.SysUser;
25 27 import com.bsth.repository.LineRepository;
26 28 import com.bsth.repository.realcontrol.ChildTaskPlanRepository;
27 29 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  30 +import com.bsth.repository.realcontrol.SvgAttributeRepository;
28 31 import com.bsth.repository.schedule.CarConfigInfoRepository;
29 32 import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
30 33 import com.bsth.repository.schedule.GuideboardInfoRepository;
... ... @@ -32,12 +35,15 @@ import com.bsth.security.util.SecurityUtils;
32 35 import com.bsth.service.SectionRouteService;
33 36 import com.bsth.service.impl.BaseServiceImpl;
34 37 import com.bsth.service.realcontrol.ScheduleRealInfoService;
  38 +import com.bsth.service.sys.DutyEmployeeService;
35 39 import com.bsth.util.*;
36 40 import com.bsth.websocket.handler.SendUtils;
37 41 import com.google.common.base.Splitter;
38 42 import com.google.common.collect.ArrayListMultimap;
  43 +import com.google.common.collect.BiMap;
39 44 import com.google.common.collect.Lists;
40 45 import com.google.common.collect.Multimap;
  46 +import org.apache.commons.lang3.StringEscapeUtils;
41 47 import org.apache.commons.lang3.StringUtils;
42 48 import org.joda.time.format.DateTimeFormat;
43 49 import org.joda.time.format.DateTimeFormatter;
... ... @@ -46,7 +52,6 @@ import org.slf4j.LoggerFactory;
46 52 import org.springframework.beans.factory.annotation.Autowired;
47 53 import org.springframework.stereotype.Service;
48 54  
49   -import java.net.URLEncoder;
50 55 import java.text.DecimalFormat;
51 56 import java.text.ParseException;
52 57 import java.text.SimpleDateFormat;
... ... @@ -54,431 +59,390 @@ import java.util.*;
54 59  
55 60 @Service
56 61 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
57   - implements ScheduleRealInfoService {
  62 + implements ScheduleRealInfoService {
58 63  
59   - @Autowired
60   - ScheduleRealInfoRepository scheduleRealInfoRepository;
  64 + @Autowired
  65 + ScheduleRealInfoRepository scheduleRealInfoRepository;
61 66  
62   - @Autowired
63   - EmployeeConfigInfoRepository employeeConfigInfoRepository;
  67 + @Autowired
  68 + EmployeeConfigInfoRepository employeeConfigInfoRepository;
64 69  
65   - @Autowired
66   - CarConfigInfoRepository carConfigInfoRepository;
67   -
68   - @Autowired
69   - SectionRouteService sectionRouteService;
70   -
71   - /*@Autowired
72   - BorrowCenter borrowCenter;*/
73   -
74   - @Autowired
75   - LineRepository lineRepository;
76   -
77   - @Autowired
78   - GuideboardInfoRepository guideboardInfoRepository;
79   -
80   - @Autowired
81   - ChildTaskPlanRepository cTaskPlanRepository;
82   -
83   - @Autowired
84   - SendUtils sendUtils;
85   -
86   - @Autowired
87   - DayOfSchedule dayOfSchedule;
88   -
89   - @Autowired
90   - SchAttrCalculator schAttrCalculator;
91   -
92   - @Autowired
93   - LineConfigData lineConfigData;
94   -
95   - Logger logger = LoggerFactory.getLogger(this.getClass());
96   -
97   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
98   - sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"),
99   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
100   -
101   - @Override
102   - public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) {
103   - List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines));
104   -
105   - Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create();
106   -
107   - for (String lineCode : lineList) {
108   - mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode));
109   - }
110   - return mMap.asMap();
111   - }
112   -
113   - private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
114   - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
115   - @Override
116   - public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj/*, String nbbm,String jsy,String spy*/) {
117   - Map<String, Object> map = new HashMap<>();
118   - try {
119   -
120   - ScheduleRealInfo schedule = dayOfSchedule.get(id);
121   -
122   -
123   - LineConfig config = lineConfigData.get(schedule.getXlBm());
124   - //小于线路开始运营时间,则默认跨过24点
125   - if(dfsj.compareTo(config.getStartOpt()) < 0){
126   - schedule.setRealExecDate(fmtyyyyMMdd.print(schedule.getScheduleDate().getTime() + DAY_TIME));
127   - }
128   - else {
129   - schedule.setRealExecDate(schedule.getScheduleDateStr());
130   - }
131   -
132   - schedule.setDfsjAll(dfsj);
133   - schedule.addRemarks(remarks);
134   -
135   - List<ScheduleRealInfo> ts = new ArrayList<>();
136   - ts.add(schedule);
137   - //调整终点时间和下一个班次的应到时间
138   - schedule.calcEndTime();
139   - ScheduleRealInfo nextSch = dayOfSchedule.next(schedule);
140   - if(null != nextSch){
141   - nextSch.setQdzArrDateJH(schedule.getZdsj());
142   - ts.add(nextSch);
143   - }
144   -
145   - // 持久化到数据库
146   - dayOfSchedule.save(schedule);
147   -
148   - map.put("status", ResponseCode.SUCCESS);
149   - map.put("ts", ts);
150   - } catch (Exception e) {
151   - logger.error("", e);
152   - map.put("status", ResponseCode.ERROR);
153   - }
154   - return map;
155   - }
156   -
157   - @Override
158   - public Map<String, Object> destroy(String idsStr, /*int spaceAdjust, */String remarks, String reason/*, int spaceNum*/) {
159   -
160   - Map<String, Object> map = new HashMap<>();
161   - List<ScheduleRealInfo> rsList = new ArrayList<>();
162   - map.put("ts", rsList);
163   - try {
164   - List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr));
165   -
166   - ScheduleRealInfo schedule = null;
167   - for (String id : idList) {
168   - schedule = dayOfSchedule.get(Long.parseLong(id));
169   - if(schedule.isDestroy()){
170   - map.put("status", ResponseCode.ERROR);
171   - map.put("msg", "不必要的重复烂班!");
172   - return map;
173   - }
174   -
175   - schedule.setAdjustExps(reason);
176   - schedule.destroy();
177   - schedule.addRemarks(remarks);
178   -
179   - dayOfSchedule.save(schedule);
180   - rsList.add(schedule);
181   - }
182   -
183   - map.put("status", ResponseCode.SUCCESS);
184   - } catch (Exception e) {
185   - logger.error("", e);
186   - map.put("status", ResponseCode.ERROR);
187   - }
188   - return map;
189   - }
190   -
191   - // 线路id获取驾驶员
192   - @Override
193   - public List<Map<String, String>> findDriverByLine(String lineCode) {
194   - List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
195   -
196   - List<Map<String, String>> rsList = new ArrayList<>();
197   - Map<String, String> map = null;
198   - Personnel driver = null;
199   - String code = null;
200   -
201   - for (EmployeeConfigInfo employee : list) {
202   - driver = employee.getJsy();
203   - if (driver != null) {
204   - map = new HashMap<>();
205   - code = driver.getJobCode();
206   - map.put("id", code + "/" + driver.getPersonnelName());
207   - map.put("text", code + "/" + driver.getPersonnelName());
208   - rsList.add(map);
209   - }
210   - }
211   - return rsList;
212   - }
213   -
214   - // 线路id获取售票员
215   - @Override
216   - public List<Map<String, String>> findConductorByLine(String lineCode) {
217   - List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
218   -
219   - List<Map<String, String>> rsList = new ArrayList<>();
220   - Map<String, String> map = null;
221   - Personnel conductor = null;
222   - String code = null;
223   -
224   - for (EmployeeConfigInfo employee : list) {
225   - conductor = employee.getSpy();
226   - if (conductor != null) {
227   - code = conductor.getJobCode();
228   - map = new HashMap<>();
229   - map.put("id", code + "/" + conductor.getPersonnelName());
230   - map.put("text", code + "/" + conductor.getPersonnelName());
231   - rsList.add(map);
232   - }
233   - }
234   - return rsList;
235   - }
236   -
237   - @Override
238   - public List<Map<String, String>> findCarByLine(String lineCode) {
239   -
240   - List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode);
241   -
242   - List<Map<String, String>> rsList = new ArrayList<>();
243   - Map<String, String> map = null;
244   - Cars car = null;
245   - String code = null;
246   -
247   - for (CarConfigInfo cci : list) {
248   - car = cci.getCl();
249   - if (car != null) {
250   - code = car.getInsideCode();
251   - map = new HashMap<>();
252   - map.put("id", code);
253   - map.put("text", code);
254   - rsList.add(map);
255   - }
256   - }
257   - return rsList;
258   - }
259   -
260   -
261   - /**
262   - * 临加班次
263   - */
264   - @Override
265   - public Map<String, Object> save(ScheduleRealInfo t) {
266   - Map<String, Object> rs = new HashMap<>();
267   - try{
268   - SysUser user = SecurityUtils.getCurrentUser();
269   - String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm());
270   -
271   - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd")
272   - ,sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
273   -
274   - if(StringUtils.isEmpty(t.getjGh())){
275   - rs.put("status", ResponseCode.ERROR);
276   - rs.put("msg", "驾驶员工号不能为空!");
277   - return rs;
278   - }
279   - //截取工号
280   - if(t.getjGh().indexOf("-") != -1){
281   - t.setjGh(t.getjGh().split("-")[1]);
282   - }
283   -
284   - t.setScheduleDateStr(schDate);
285   - t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
286   - t.setRealExecDate(schDate);
287   - t.setCreateBy(user);
288   - t.setSflj(true);
289   - t.setLate(false);
290   - t.setDfsj(t.getFcsj());
291   - t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
292   -
293   -
294   - //班次历时
295   - t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60);
296   -
297   - //起终点名称
298   - String prefix = t.getXlBm() + "_" + t.getXlDir() + "_";
299   - t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix));
300   - t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix));
301   -
302   - //计算班次实际时间
303   - schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t);
304   - if(t.getZdsjT() < t.getFcsjT()){
305   - rs.put("status", ResponseCode.ERROR);
306   - rs.put("msg", "起终点时间异常!");
307   - return rs;
308   - }
309   -
310   - //实时入库
311   - super.save(t);
312   -
313   - // 加入缓存
314   - dayOfSchedule.put(t);
315   -
316   - //更新起点应到时间
317   - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t.getClZbh());
318   -
319   -
320   - rs.put("ts", ts);
321   - rs.put("t", t);
322   - }catch(Exception e){
323   - logger.error("", e);
324   - rs.put("status", ResponseCode.ERROR);
325   - }
326   - return rs;
327   - }
328   -
329   - @Override
330   - public Map<String, Object> delete(Long id) {
331   - Map<String, Object> rs = new HashMap<>();
332   - rs.put("status", ResponseCode.ERROR);
333   -
334   - ScheduleRealInfo sch = dayOfSchedule.get(id);
335   - if(sch == null){
336   - rs.put("msg", "无效的id号");
337   - return rs;
338   - }
339   -
340   - if(!sch.isSflj()){
341   - rs.put("msg", "你只能删除临加班次");
342   - return rs;
343   - }
344   -
345   - dayOfSchedule.delete(sch);
346   - //ScheduleRealInfo sch = dayOfSchedule.delete(id);
347   - //数据库删除
348   - rs = super.delete(id);
349   - //更新起点应到时间
350   - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());
351   - rs.put("ts", ts);
352   - rs.put("delete", sch);
353   -
354   - return rs;
355   - }
356   -
357   - @Override
358   - public List<Map<String, String>> sreachVehic(String nbbm) {
359   - // 转大写
360   - nbbm = nbbm.toUpperCase();
361   -
362   - List<Map<String, String>> list = new ArrayList<>();
363   - Map<String, String> map;
364   - Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
365   -
366   - Line line;
367   - for (String k : allSet) {
368   - if (k.indexOf(nbbm) != -1) {
369   - // 所属线路
370   - map = new HashMap<>();
371   - line = BasicData.nbbm2LineMap.get(k);
372   - map.put("id", k);
373   - map.put("text", k);
374   - if (null != line) {
375   - map.put("lineName", line.getName());
376   - map.put("lineCode", line.getLineCode());
377   - }
378   -
379   - list.add(map);
380   - }
381   -
382   - if (list.size() > 20)
383   - break;
384   - }
385   - return list;
386   - }
387   -
388   -/* @Override
389   - public Map<String, Object> adjust(Long id, String nbbm, String jsy, String spy, Integer revertLine, Integer borrowLine, String borrowTimeStr, String revertTimeStr) {
390   - // 班次
391   - ScheduleRealInfo schedule = dayOfSchedule.get(id);
392   - int upDown = Integer.parseInt(schedule.getXlDir());
  70 + @Autowired
  71 + CarConfigInfoRepository carConfigInfoRepository;
393 72  
394   - String rq = sdfMonth.format(new Date());
395   - // 换车
396   - if (!StringUtils.isBlank(nbbm)) {
397   - adjustCar(schedule, nbbm);
398   - }
399   -
400   - List<String> tempArray;
401   - // 换驾驶员
402   - if (!StringUtils.isBlank(jsy)) {
403   - tempArray = Splitter.on("/").splitToList(jsy);
404   - adjustDriver(schedule, tempArray.get(0), tempArray.get(1));
405   - }
406   -
407   - // 换售票员
408   - if (!StringUtils.isBlank(spy)) {
409   - tempArray = Splitter.on("/").splitToList(spy);
410   - adjustConductor(schedule, tempArray.get(0), tempArray.get(1));
411   - }
412   -
413   - if(borrowLine != null && borrowTimeStr != null){
414   - try {
415   - //跨线路借车
416   - Long t = sdfMinute.parse(rq + " " + borrowTimeStr).getTime();
417   - //borrowCenter.put(nbbm, borrowLine, 0, t, upDown);
418   - } catch (ParseException e) {
419   - e.printStackTrace();
420   - }
421   - }
422   -
423   - if(revertLine != null && revertTimeStr != null){
424   - //定时还车
425   - try {
426   - Long t = sdfMinute.parse(rq + " " + revertTimeStr).getTime();
427   - //还车的时候不用切走向
428   - //borrowCenter.put(nbbm, revertLine, 1, t, -1);
429   - } catch (ParseException e) {
430   - e.printStackTrace();
431   - }
432   - }
433   -
434   - scheduleRealInfoRepository.save(schedule);
435   - //ScheduleBuffer.persistentList.add(schedule);
436   -
437   - Map<String, Object> map = new HashMap<>();
438   - map.put("status", 200);
439   - map.put("t", schedule);
440   - return map;
441   - }*/
442   -
443   - @Override
444   - public void adjustCar(ScheduleRealInfo schedule, String car) {
445   - schedule.setClZbh(car);
446   - }
447   -
448   - @Override
449   - public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) {
450   - if(driver.indexOf("-") != -1)
451   - driver = driver.split("-")[1];
452   - schedule.setjGh(driver);
453   - schedule.setjName(driverName);
454   - }
  73 + @Autowired
  74 + SectionRouteService sectionRouteService;
455 75  
456   - @Override
457   - public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) {
458   - if(conductor.indexOf("-") != -1)
459   - conductor = conductor.split("-")[1];
460   - schedule.setsGh(conductor);
461   - schedule.setsName(conductorName);
462   - }
  76 + /*@Autowired
  77 + BorrowCenter borrowCenter;*/
463 78  
464   - @Override
465   - public List<ScheduleRealInfo> queryUserInfo(String line, String date,String state) {
466   - if(state.equals("2")){
467   - return scheduleRealInfoRepository.queryUserInfo2(line, date);
468   - }else{
469   - return scheduleRealInfoRepository.queryUserInfo3(line, date);
470   - }
471   -
472   - }
473   - /**
474   - *
475   - */
476   - @Override
477   - public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName,String date) {
  79 + @Autowired
  80 + LineRepository lineRepository;
  81 +
  82 + @Autowired
  83 + GuideboardInfoRepository guideboardInfoRepository;
  84 +
  85 + @Autowired
  86 + ChildTaskPlanRepository cTaskPlanRepository;
  87 +
  88 + @Autowired
  89 + SendUtils sendUtils;
  90 +
  91 + @Autowired
  92 + DayOfSchedule dayOfSchedule;
  93 +
  94 + @Autowired
  95 + SchAttrCalculator schAttrCalculator;
  96 +
  97 + @Autowired
  98 + LineConfigData lineConfigData;
  99 +
  100 + @Autowired
  101 + DutyEmployeeService dutyEmployeeService;
  102 +
  103 + Logger logger = LoggerFactory.getLogger(this.getClass());
  104 +
  105 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  106 + sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"),
  107 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  108 +
  109 + @Override
  110 + public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) {
  111 + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines));
  112 +
  113 + Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create();
  114 +
  115 + for (String lineCode : lineList) {
  116 + mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode));
  117 + }
  118 + return mMap.asMap();
  119 + }
  120 +
  121 + private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
  122 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  123 +
  124 + @Override
  125 + public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType) {
  126 + Map<String, Object> map = new HashMap<>();
  127 + try {
  128 +
  129 + ScheduleRealInfo schedule = dayOfSchedule.get(id);
  130 +
  131 +
  132 + LineConfig config = lineConfigData.get(schedule.getXlBm());
  133 + //小于线路开始运营时间,则默认跨过24点
  134 + if (dfsj.compareTo(config.getStartOpt()) < 0) {
  135 + schedule.setRealExecDate(fmtyyyyMMdd.print(schedule.getScheduleDate().getTime() + DAY_TIME));
  136 + } else {
  137 + schedule.setRealExecDate(schedule.getScheduleDateStr());
  138 + }
  139 +
  140 + schedule.setDfsjAll(dfsj);
  141 + schedule.addRemarks(remarks);
  142 +
  143 + List<ScheduleRealInfo> ts = new ArrayList<>();
  144 + ts.add(schedule);
  145 + //调整终点时间和下一个班次的应到时间
  146 + schedule.calcEndTime();
  147 + ScheduleRealInfo nextSch = dayOfSchedule.next(schedule);
  148 + if (null != nextSch) {
  149 + nextSch.setQdzArrDateJH(schedule.getZdsj());
  150 + ts.add(nextSch);
  151 + }
  152 +
  153 + //调整班次类型
  154 + if(StringUtils.isNotEmpty(bcType)){
  155 + schedule.setBcType(bcType);
  156 + }
  157 +
  158 + // 持久化到数据库
  159 + dayOfSchedule.save(schedule);
  160 +
  161 + map.put("status", ResponseCode.SUCCESS);
  162 + map.put("ts", ts);
  163 + } catch (Exception e) {
  164 + logger.error("", e);
  165 + map.put("status", ResponseCode.ERROR);
  166 + }
  167 + return map;
  168 + }
  169 +
  170 + @Override
  171 + public Map<String, Object> destroy(String idsStr, /*int spaceAdjust, */String remarks, String reason/*, int spaceNum*/) {
  172 +
  173 + Map<String, Object> map = new HashMap<>();
  174 + List<ScheduleRealInfo> rsList = new ArrayList<>();
  175 + map.put("ts", rsList);
  176 + try {
  177 + List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr));
  178 +
  179 + ScheduleRealInfo schedule = null;
  180 + for (String id : idList) {
  181 + schedule = dayOfSchedule.get(Long.parseLong(id));
  182 + if (schedule.isDestroy()) {
  183 + map.put("status", ResponseCode.ERROR);
  184 + map.put("msg", "不必要的重复烂班!");
  185 + return map;
  186 + }
  187 +
  188 + schedule.setAdjustExps(reason);
  189 + schedule.destroy();
  190 + schedule.addRemarks(remarks);
  191 +
  192 + dayOfSchedule.save(schedule);
  193 + rsList.add(schedule);
  194 + }
  195 +
  196 + map.put("status", ResponseCode.SUCCESS);
  197 + } catch (Exception e) {
  198 + logger.error("", e);
  199 + map.put("status", ResponseCode.ERROR);
  200 + }
  201 + return map;
  202 + }
  203 +
  204 + // 线路id获取驾驶员
  205 + @Override
  206 + public List<Map<String, String>> findDriverByLine(String lineCode) {
  207 + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
  208 +
  209 + List<Map<String, String>> rsList = new ArrayList<>();
  210 + Map<String, String> map = null;
  211 + Personnel driver = null;
  212 + String code = null;
  213 +
  214 + for (EmployeeConfigInfo employee : list) {
  215 + driver = employee.getJsy();
  216 + if (driver != null) {
  217 + map = new HashMap<>();
  218 + code = driver.getJobCode();
  219 + map.put("id", code + "/" + driver.getPersonnelName());
  220 + map.put("text", code + "/" + driver.getPersonnelName());
  221 + rsList.add(map);
  222 + }
  223 + }
  224 + return rsList;
  225 + }
  226 +
  227 + // 线路id获取售票员
  228 + @Override
  229 + public List<Map<String, String>> findConductorByLine(String lineCode) {
  230 + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
  231 +
  232 + List<Map<String, String>> rsList = new ArrayList<>();
  233 + Map<String, String> map = null;
  234 + Personnel conductor = null;
  235 + String code = null;
  236 +
  237 + for (EmployeeConfigInfo employee : list) {
  238 + conductor = employee.getSpy();
  239 + if (conductor != null) {
  240 + code = conductor.getJobCode();
  241 + map = new HashMap<>();
  242 + map.put("id", code + "/" + conductor.getPersonnelName());
  243 + map.put("text", code + "/" + conductor.getPersonnelName());
  244 + rsList.add(map);
  245 + }
  246 + }
  247 + return rsList;
  248 + }
  249 +
  250 + @Override
  251 + public List<Map<String, String>> findCarByLine(String lineCode) {
  252 +
  253 + List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode);
  254 +
  255 + List<Map<String, String>> rsList = new ArrayList<>();
  256 + Map<String, String> map = null;
  257 + Cars car = null;
  258 + String code = null;
  259 +
  260 + for (CarConfigInfo cci : list) {
  261 + car = cci.getCl();
  262 + if (car != null) {
  263 + code = car.getInsideCode();
  264 + map = new HashMap<>();
  265 + map.put("id", code);
  266 + map.put("text", code);
  267 + rsList.add(map);
  268 + }
  269 + }
  270 + return rsList;
  271 + }
  272 +
  273 +
  274 + /**
  275 + * 临加班次
  276 + */
  277 + @Override
  278 + public Map<String, Object> save(ScheduleRealInfo t) {
  279 + Map<String, Object> rs = new HashMap<>();
  280 + try {
  281 + if (BasicData.deviceId2NbbmMap.inverse().get(t.getClZbh()) == null) {
  282 + rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!");
  283 + rs.put("status", ResponseCode.ERROR);
  284 + return rs;
  285 + }
  286 +
  287 + SysUser user = SecurityUtils.getCurrentUser();
  288 + String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm());
  289 +
  290 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  291 +
  292 + if (StringUtils.isEmpty(t.getjGh())) {
  293 + rs.put("status", ResponseCode.ERROR);
  294 + rs.put("msg", "驾驶员工号不能为空!");
  295 + return rs;
  296 + }
  297 + //截取工号
  298 + if (t.getjGh().indexOf("-") != -1) {
  299 + t.setjGh(t.getjGh().split("-")[1]);
  300 + }
  301 +
  302 + t.setScheduleDateStr(schDate);
  303 + t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
  304 + t.setRealExecDate(schDate);
  305 + t.setCreateBy(user);
  306 + t.setSflj(true);
  307 + t.setLate(false);
  308 + t.setDfsj(t.getFcsj());
  309 + t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
  310 +
  311 +
  312 + //班次历时
  313 + t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60);
  314 +
  315 + //起终点名称
  316 + String prefix = t.getXlBm() + "_" + t.getXlDir() + "_";
  317 + t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix));
  318 + t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix));
  319 +
  320 + //计算班次实际时间
  321 + schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t);
  322 + if (t.getZdsjT() < t.getFcsjT()) {
  323 + rs.put("status", ResponseCode.ERROR);
  324 + rs.put("msg", "起终点时间异常!");
  325 + return rs;
  326 + }
  327 +
  328 + //实时入库
  329 + super.save(t);
  330 +
  331 + // 加入缓存
  332 + dayOfSchedule.put(t);
  333 +
  334 + //更新起点应到时间
  335 + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t.getClZbh());
  336 +
  337 +
  338 + rs.put("ts", ts);
  339 + rs.put("t", t);
  340 + } catch (Exception e) {
  341 + logger.error("", e);
  342 + rs.put("status", ResponseCode.ERROR);
  343 + }
  344 + return rs;
  345 + }
  346 +
  347 + @Override
  348 + public Map<String, Object> delete(Long id) {
  349 + Map<String, Object> rs = new HashMap<>();
  350 + rs.put("status", ResponseCode.ERROR);
  351 +
  352 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  353 + if (sch == null) {
  354 + rs.put("msg", "无效的id号");
  355 + return rs;
  356 + }
  357 +
  358 + if (!sch.isSflj()) {
  359 + rs.put("msg", "你只能删除临加班次");
  360 + return rs;
  361 + }
  362 +
  363 + dayOfSchedule.delete(sch);
  364 + //ScheduleRealInfo sch = dayOfSchedule.delete(id);
  365 + //数据库删除
  366 + rs = super.delete(id);
  367 + //更新起点应到时间
  368 + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());
  369 + rs.put("ts", ts);
  370 + rs.put("delete", sch);
  371 +
  372 + return rs;
  373 + }
  374 +
  375 + @Override
  376 + public List<Map<String, String>> sreachVehic(String nbbm) {
  377 + // 转大写
  378 + nbbm = nbbm.toUpperCase();
  379 +
  380 + List<Map<String, String>> list = new ArrayList<>();
  381 + Map<String, String> map;
  382 + Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
  383 +
  384 + Line line;
  385 + for (String k : allSet) {
  386 + if (k.indexOf(nbbm) != -1) {
  387 + // 所属线路
  388 + map = new HashMap<>();
  389 + line = BasicData.nbbm2LineMap.get(k);
  390 + map.put("id", k);
  391 + map.put("text", k);
  392 + if (null != line) {
  393 + map.put("lineName", line.getName());
  394 + map.put("lineCode", line.getLineCode());
  395 + }
  396 +
  397 + list.add(map);
  398 + }
  399 +
  400 + if (list.size() > 20)
  401 + break;
  402 + }
  403 + return list;
  404 + }
  405 +
  406 + @Override
  407 + public void adjustCar(ScheduleRealInfo schedule, String car) {
  408 + schedule.setClZbh(car);
  409 + }
  410 +
  411 + @Override
  412 + public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) {
  413 + if (driver.indexOf("-") != -1)
  414 + driver = driver.split("-")[1];
  415 + schedule.setjGh(driver);
  416 + schedule.setjName(driverName);
  417 + }
  418 +
  419 + @Override
  420 + public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) {
  421 + if (conductor.indexOf("-") != -1)
  422 + conductor = conductor.split("-")[1];
  423 + schedule.setsGh(conductor);
  424 + schedule.setsName(conductorName);
  425 + }
  426 +
  427 + @Override
  428 + public List<ScheduleRealInfo> queryUserInfo(String line, String date, String state) {
  429 + if (state.equals("2")) {
  430 + return scheduleRealInfoRepository.queryUserInfo2(line, date);
  431 + } else {
  432 + return scheduleRealInfoRepository.queryUserInfo3(line, date);
  433 + }
  434 +
  435 + }
  436 +
  437 + /**
  438 + *
  439 + */
  440 + @Override
  441 + public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName,String date,String line) {
478 442 ReportUtils ee = new ReportUtils();
479 443 ReportRelatedUtils rru = new ReportRelatedUtils();
480 444 List<Iterator<?>> list = new ArrayList<Iterator<?>>();
481   - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName,date);
  445 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName,date,line);
482 446 List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
483 447  
484 448 DecimalFormat format = new DecimalFormat("0.00");
... ... @@ -499,7 +463,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
499 463 //计划班次,烂班班次,增加班次
500 464 tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
501 465 if(scheduleRealInfo.isSflj()){
502   - addMileage += tempJhlc;
503 466 ljbc++;
504 467 }else{
505 468 jhlc += tempJhlc;
... ... @@ -513,7 +476,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
513 476 //计算营运里程,空驶里程
514 477 if(childTaskPlans.isEmpty()){
515 478 if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
516   - || scheduleRealInfo.getBcType().equals("venting")){
  479 + ){
517 480 ksgl += tempJhlc;
518 481 }else{
519 482 yygl += tempJhlc;
... ... @@ -523,8 +486,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
523 486 while(it.hasNext()){
524 487 ChildTaskPlan childTaskPlan = it.next();
525 488 if(childTaskPlan.getMileageType().equals("empty")){
  489 + if(scheduleRealInfo.isSflj()){
  490 + addMileage += tempJhlc;
  491 + }
526 492 ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
527 493 }else{
  494 + if(scheduleRealInfo.isSflj()){
  495 + addMileage += tempJhlc;
  496 + }
528 497 yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
529 498 }
530 499 }
... ... @@ -573,113 +542,141 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
573 542  
574 543 list.add(listMap.iterator());
575 544 ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould\\waybill_minhang.xls",
576   - path+"export\\" + jName + ".xls");
  545 + path+"export\\" + date+"-"+jName+"-"+clZbh+"-"+lpName+"-行车路单.xls");
577 546 return scheduleRealInfos;
578 547 }
579 548  
580   - @Override
581   - public List<Map<String, Object>> dailyInfo(String line, String date,String type) {
582   - DecimalFormat format = new DecimalFormat("0.00");
583   - ReportUtils ee = new ReportUtils();
584   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
585   - List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date);
586   -
587   - double totalZGL = 0,totalKSGL=0,totalYH=0;
588   - int totalBCS=0;
589   - for(int i = 0;i < list.size();i++){
590   - String zgl = format.format(Double.parseDouble(list.get(i).get("zgl")==null?"0":list.get(i).get("zgl").toString()));
591   - String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl")==null?"0":list.get(i).get("ksgl").toString()));
592   - if(type.equals("export")){
593   - totalZGL += Double.parseDouble(zgl);
594   - totalKSGL += Double.parseDouble(ksgl);
595   - totalBCS += Integer.parseInt(list.get(i).get("bcs").toString());
596   - }
597   - list.get(i).put("zgl", zgl);
598   - list.get(i).put("ksgl", ksgl);
599   - }
600   - if(type.equals("export")){
601   - Map<String,Object> map = new HashMap<String, Object>();
602   - map.put("line", line);
603   - map.put("date", date);
604   - map.put("totalZGL", totalZGL);
605   - map.put("totalKSGL", totalKSGL);
606   - map.put("totalYH", totalYH);
607   - map.put("totalBCS", totalBCS);
608   -
609   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
610   -
611   - listI.add(list.iterator());
612   - try {
613   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\daily.xls",
614   - path+"export\\班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
615   - } catch (ParseException e) {
616   - e.printStackTrace();
617   - }
618   - }
619   - return list;
620   - }
621   -
622   - @Override
623   - public List<Object[]> historyMessage(String line, String date, String code, String type) {
624   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
625   - long d= 0;
626   - long t=0;
627   - if(date.length()>0){
628   - try {
629   - d=sdf.parse(date+" 00:00:00").getTime();
630   - t=sdf.parse(date+" 23:59:59").getTime();
631   - } catch (ParseException e) {
632   - // TODO Auto-generated catch block
633   - e.printStackTrace();
634   - }
635   -
636   - }
637   -
638   - List<Object[]> list = scheduleRealInfoRepository.historyMessage(line,d,t, code);
639   - for(Object[] obj:list){
640   - if(obj != null){
641   - obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString())));
642   - obj[4] = BasicData.lineCode2NameMap.get(line);
643   - }
644   - }
645   -
646   - if(type != null && type.length() != 0 && type.equals("export")){
647   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
648   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
649   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
650   - Map<String,Object> m = new HashMap<String, Object>();
651   - ReportUtils ee = new ReportUtils();
652   - List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
653   - for(int i = 0; i < list.size(); i++){
654   - Map<String, Object> map = new HashMap<String, Object>();
655   - Object[] obj = list.get(i);
656   - map.put("num", i + 1);
657   - map.put("line", obj[4]);
658   - map.put("clZbh", obj[0]);
659   - map.put("sender", obj[1]);
660   - map.put("date", obj[3]);
661   - map.put("text", obj[2]);
662   - newList.add(map);
663   - }
664   - try {
665   - listI.add(newList.iterator());
666   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
667   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\historyMessage.xls",
668   - path+"export\\调度历史消息" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
669   - } catch (Exception e) {
670   - // TODO: handle exception
671   - e.printStackTrace();
672   - }
673   - }
674   -
675   - return list;
676   - }
677   -
678   - @Override
679   - public Map<Integer, Integer> trustStatus(String lineStr) {
680   - List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr));
681   -
682   - Map<Integer, Integer> map = new HashMap<>();
  549 + @Override
  550 + public List<Map<String, Object>> dailyInfo(String line, String date, String type) {
  551 + DecimalFormat format = new DecimalFormat("0.00");
  552 + ReportUtils ee = new ReportUtils();
  553 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  554 + List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date);
  555 +
  556 + double totalZGL = 0, totalKSGL = 0, totalYH = 0;
  557 + int totalBCS = 0;
  558 + for (int i = 0; i < list.size(); i++) {
  559 + String zgl = format.format(Double.parseDouble(list.get(i).get("zgl") == null ? "0" : list.get(i).get("zgl").toString()));
  560 + String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl") == null ? "0" : list.get(i).get("ksgl").toString()));
  561 + if (type.equals("export")) {
  562 + totalZGL += Double.parseDouble(zgl);
  563 + totalKSGL += Double.parseDouble(ksgl);
  564 + totalBCS += Integer.parseInt(list.get(i).get("bcs").toString());
  565 + }
  566 + list.get(i).put("zgl", zgl);
  567 + list.get(i).put("ksgl", ksgl);
  568 + }
  569 + if (type.equals("export")) {
  570 + Map<String, Object> map = new HashMap<String, Object>();
  571 + map.put("line", line);
  572 + map.put("date", date);
  573 + map.put("totalZGL", totalZGL);
  574 + map.put("totalKSGL", totalKSGL);
  575 + map.put("totalYH", totalYH);
  576 + map.put("totalBCS", totalBCS);
  577 +
  578 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  579 +
  580 + listI.add(list.iterator());
  581 + try {
  582 + ee.excelReplace(listI, new Object[]{map}, path + "mould\\daily.xls",
  583 + path + "export\\班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  584 + } catch (ParseException e) {
  585 + e.printStackTrace();
  586 + }
  587 + }
  588 + return list;
  589 + }
  590 +
  591 + @Override
  592 + public List<Object[]> historyMessage(String line, String date, String code, String type) {
  593 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  594 + long d = 0;
  595 + long t = 0;
  596 + if (date.length() > 0) {
  597 + try {
  598 + d = sdf.parse(date + " 00:00:00").getTime();
  599 + t = sdf.parse(date + " 23:59:59").getTime();
  600 + } catch (ParseException e) {
  601 + // TODO Auto-generated catch block
  602 + e.printStackTrace();
  603 + }
  604 +
  605 + }
  606 +
  607 + List<Object[]> list = scheduleRealInfoRepository.historyMessage(line, d, t, code);
  608 + for (Object[] obj : list) {
  609 + if (obj != null) {
  610 + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString())));
  611 + obj[4] = BasicData.lineCode2NameMap.get(line);
  612 + }
  613 + }
  614 +
  615 + if (type != null && type.length() != 0 && type.equals("export")) {
  616 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  617 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  618 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  619 + Map<String, Object> m = new HashMap<String, Object>();
  620 + ReportUtils ee = new ReportUtils();
  621 + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
  622 + for (int i = 0; i < list.size(); i++) {
  623 + Map<String, Object> map = new HashMap<String, Object>();
  624 + Object[] obj = list.get(i);
  625 + map.put("num", i + 1);
  626 + map.put("line", obj[4]);
  627 + map.put("clZbh", obj[0]);
  628 + map.put("sender", obj[1]);
  629 + map.put("date", obj[3]);
  630 + map.put("text", obj[2]);
  631 + newList.add(map);
  632 + }
  633 + try {
  634 + listI.add(newList.iterator());
  635 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  636 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\historyMessage.xls",
  637 + path + "export\\调度历史消息" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  638 + } catch (Exception e) {
  639 + // TODO: handle exception
  640 + e.printStackTrace();
  641 + }
  642 + }
  643 +
  644 + if (type != null && type.length() != 0 && type.equals("export_msg")) {
  645 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  646 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  647 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  648 + Map<String, Object> m = new HashMap<String, Object>();
  649 + ReportUtils ee = new ReportUtils();
  650 + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
  651 + for (int i = 0; i < list.size(); i++) {
  652 + Map<String, Object> map = new HashMap<String, Object>();
  653 + Object[] obj = list.get(i);
  654 + map.put("num", i + 1);
  655 + map.put("line", obj[4]);
  656 + map.put("clZbh", obj[0]);
  657 + map.put("sender", obj[1]);
  658 + map.put("date", obj[3]);
  659 + map.put("text", obj[2]);
  660 + newList.add(map);
  661 + }
  662 + try {
  663 + listI.add(newList.iterator());
  664 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  665 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\message.xls",
  666 + path + "export\\调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  667 + } catch (Exception e) {
  668 + // TODO: handle exception
  669 + e.printStackTrace();
  670 + }
  671 + }
  672 + return list;
  673 + }
  674 +
  675 + @Override
  676 + public Map<Integer, Integer> trustStatus(String lineStr) {
  677 + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr));
  678 +
  679 + Map<Integer, Integer> map = new HashMap<>();
683 680 /*Integer code;
684 681 for (String lineCode : lineList) {
685 682 code = Integer.parseInt(lineCode);
... ... @@ -688,485 +685,1519 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
688 685  
689 686 map.put(code, ScheduleBuffer.trustMap.get(code));
690 687 }*/
691   - return map;
692   - }
693   -
694   - @Override
695   - public Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks) {
696   - Map<String, Object> rs = new HashMap<>();
697   - List<ScheduleRealInfo> ts = new ArrayList<>();
698   - try {
699   - ScheduleRealInfo sch = dayOfSchedule.get(id);
700   -
701   - LineConfig config = lineConfigData.get(sch.getXlBm());
702   - //小于线路开始运营时间,则默认跨过24点
703   - if(fcsjActual.compareTo(config.getStartOpt()) < 0){
704   - sch.setRealExecDate(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME));
705   - }
706   - else {
707   - sch.setRealExecDate(sch.getScheduleDateStr());
  688 + return map;
  689 + }
  690 +
  691 + @Override
  692 + public Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks) {
  693 + Map<String, Object> rs = new HashMap<>();
  694 + List<ScheduleRealInfo> ts = new ArrayList<>();
  695 + try {
  696 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  697 +
  698 + LineConfig config = lineConfigData.get(sch.getXlBm());
  699 + //小于线路开始运营时间,则默认跨过24点
  700 + if (fcsjActual.compareTo(config.getStartOpt()) < 0) {
  701 + sch.setRealExecDate(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME));
  702 + } else {
  703 + sch.setRealExecDate(sch.getScheduleDateStr());
  704 + }
  705 +
  706 + sch.setFcsjActualAll(fcsjActual);
  707 + sch.addRemarks(remarks);
  708 + sch.calcStatus();
  709 +
  710 + dayOfSchedule.save(sch);
  711 + //scheduleRealInfoRepository.save(sch);
  712 +
  713 + ts.add(sch);
  714 +
  715 + rs.put("status", ResponseCode.SUCCESS);
  716 + rs.put("ts", ts);
  717 +
  718 + //通知页面刷新
  719 + sendUtils.refreshSch(ts);
  720 + } catch (Exception e) {
  721 + logger.error("", e);
  722 + rs.put("status", ResponseCode.ERROR);
  723 + }
  724 +
  725 + return rs;
  726 + }
  727 +
  728 + @Override
  729 + public Map<String, Object> revokeDestroy(Long id) {
  730 + Map<String, Object> rs = new HashMap<>();
  731 + try {
  732 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  733 + if (sch.getStatus() != -1) {
  734 + rs.put("status", ResponseCode.ERROR);
  735 + rs.put("msg", "未烂班,无法撤销!");
  736 + } else {
  737 + sch.setStatus(0);
  738 + rs.put("status", ResponseCode.SUCCESS);
  739 + rs.put("t", sch);
  740 +
  741 + }
  742 + } catch (Exception e) {
  743 + logger.error("", e);
  744 + rs.put("status", ResponseCode.ERROR);
  745 + }
  746 + return rs;
  747 + }
  748 +
  749 + @Override
  750 + public Map<String, Object> revokeRealOutgo(Long id) {
  751 + Map<String, Object> rs = new HashMap<>();
  752 + List<ScheduleRealInfo> ts = new ArrayList<>();
  753 +
  754 + try {
  755 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  756 + if (sch.getFcsjActual() == null) {
  757 + rs.put("status", ResponseCode.ERROR);
  758 + rs.put("msg", "无实发时间,无法撤销!");
  759 + } else {
  760 + //将对应的到离站数据标记为不可信
  761 + List<ArrivalEntity> list = ArrivalData_GPS.findByNbbm(sch.getClZbh());
  762 + for (ArrivalEntity arr : list) {
  763 + if (arr.getInOut() == 1
  764 + && arr.getUpDown() == Integer.parseInt(sch.getXlDir())
  765 + && arr.getStopNo().equals(sch.getQdzCode())
  766 + && Math.abs(arr.getTs() - sch.getFcsjActualTime()) < 1000 * 60) {
  767 + arr.setEnable(false);
  768 + break;
  769 + }
  770 + }
  771 +
  772 + sch.clearFcsjActual();
  773 + rs.put("status", ResponseCode.SUCCESS);
  774 +
  775 + ts.add(sch);
  776 + rs.put("ts", ts);
  777 +
  778 + }
  779 + } catch (Exception e) {
  780 + logger.error("", e);
  781 + rs.put("status", ResponseCode.ERROR);
  782 + }
  783 + return rs;
  784 + }
  785 +
  786 + @Override
  787 + public Map<String, Object> spaceAdjust(Long[] ids, Integer space) {
  788 +
  789 + List<ScheduleRealInfo> list = new ArrayList<>(), updateList = new ArrayList<>();
  790 + Map<String, Object> rs = new HashMap<>();
  791 + try {
  792 + ScheduleRealInfo sch, next;
  793 + for (Long id : ids) {
  794 + sch = dayOfSchedule.get(id);
  795 + if (null != sch)
  796 + list.add(sch);
  797 + }
  798 +
  799 + int size = list.size();
  800 + if (size == 0) {
  801 + rs.put("status", ResponseCode.ERROR);
  802 + } else {
  803 + // 按发车时间排序
  804 + Collections.sort(list, new ScheduleComparator.FCSJ());
  805 +
  806 + // 以第一个实际发车/待发时间为起点,调整间隔
  807 + sch = list.get(0);
  808 + Long st = sch.getFcsjActualTime() == null ? sch.getDfsjT() : sch.getFcsjActualTime(), plus = space * 60 * 1000L;
  809 +
  810 + for (int i = 1; i < size; i++) {
  811 + st += plus;
  812 + sch = list.get(i);
  813 + sch.setDfsjAll(st);
  814 + //重新计算终点时间
  815 + sch.calcEndTime();
  816 +
  817 + dayOfSchedule.save(sch);
  818 +
  819 + updateList.add(sch);
  820 + next = dayOfSchedule.next(sch);
  821 + if (next.getQdzName().equals(sch.getZdzName())) {
  822 + next.setQdzArrDateJH(sch.getZdsj());
  823 + updateList.add(next);
  824 + }
  825 + }
  826 +
  827 +
  828 + rs.put("status", ResponseCode.SUCCESS);
  829 + rs.put("ts", updateList);
  830 + }
  831 +
  832 + } catch (Exception e) {
  833 + logger.error("", e);
  834 + rs.put("status", ResponseCode.ERROR);
  835 + }
  836 + return rs;
  837 + }
  838 +
  839 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  840 +
  841 + @Override
  842 + public Map<String, Object> schInfoFineTune(Map<String, String> map) {
  843 + Map<String, Object> rs = new HashMap<>();
  844 + List<ScheduleRealInfo> ts = new ArrayList<>();
  845 + try {
  846 + Long id = Long.parseLong(map.get("id"));
  847 + //班次类型
  848 + //String bcType = map.get("bcType");
  849 + //车辆自编号
  850 + //String clZbh = map.get("clZbh");
  851 + //计划发车时间
  852 + //String fcsj = map.get("fcsj");
  853 + //实际发车时间
  854 + String fcsjActual = map.get("fcsjActual");
  855 + //实际终点时间
  856 + String zdsjActual = map.get("zdsjActual");
  857 + //备注
  858 + String remarks = map.get("remarks");
  859 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  860 + if (null != sch) {
  861 + if (StringUtils.isNotBlank(fcsjActual)) {
  862 + LineConfig config = lineConfigData.get(sch.getXlBm());
  863 + long t = 0L;
  864 + //小于线路开始运营时间,则默认跨过24点
  865 + if (fcsjActual.compareTo(config.getStartOpt()) < 0)
  866 + t = fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME) + fcsjActual);
  867 + else
  868 + t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual);
  869 +
  870 + //调整实发
  871 + if (!fcsjActual.equals(sch.getFcsjActual()))
  872 + sch.setFcsjActualAll(t);
  873 + } else {
  874 + //撤销实发
  875 + if (sch.getFcsjActual() != null)
  876 + revokeRealOutgo(sch.getId());
  877 + }
  878 + //实达时间
  879 + if (StringUtils.isNotBlank(zdsjActual)) {
  880 + if (!zdsjActual.equals(sch.getZdsjActual())) {
  881 + //调整实达
  882 + sch.setZdsjActualAll(zdsjActual);
  883 + //下一班次起点到达时间
  884 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  885 + if (null != next) {
  886 + next.setQdzArrDateSJ(zdsjActual);
  887 + ts.add(next);
  888 + }
  889 +
  890 + //重新计算车辆执行班次
  891 + dayOfSchedule.reCalcExecPlan(sch.getClZbh());
  892 + }
  893 + } else {
  894 + //清除实达时间
  895 + sch.clearZdsjActual();
  896 + //清除下一班次起点到达时间
  897 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  898 + if (null != next) {
  899 + next.setQdzArrDateSJ(null);
  900 + ts.add(next);
  901 + }
  902 + }
  903 + sch.setRemarks(remarks);
  904 +
  905 + try {
  906 + //烂班
  907 + if(map.get("status") != null
  908 + && Integer.parseInt(map.get("status").toString()) == -1){
  909 + destroy(sch.getId() + "", "", map.get("adjustExps").toString());
  910 + }
  911 + } catch (NumberFormatException e) {
  912 + logger.error("", e);
  913 + }
  914 + }
  915 +
  916 + String bcType = map.get("bcType");
  917 + if(StringUtils.isNotEmpty(bcType)){
  918 + sch.setBcType(bcType);
  919 + }
  920 + //班次状态
  921 + sch.calcStatus();
  922 + dayOfSchedule.save(sch);
  923 + //页面需要更新的班次信息
  924 + ts.add(sch);
  925 +
  926 + rs.put("status", ResponseCode.SUCCESS);
  927 + rs.put("ts", ts);
  928 + } catch (Exception e) {
  929 + logger.error("", e);
  930 + rs.put("status", ResponseCode.ERROR);
  931 + }
  932 + return rs;
  933 + }
  934 +
  935 + @Override
  936 + public Map<String, Object> outgoAdjustAll(String params) {
  937 + Map<String, Object> rs = new HashMap<>();
  938 + try {
  939 + JSONArray jsonArray = JSONArray.parseArray(params);
  940 +
  941 + ScheduleRealInfo schedule = null;
  942 + JSONObject jsonObj;
  943 + String dfsj;
  944 + for (int i = 0; i < jsonArray.size(); i++) {
  945 + jsonObj = jsonArray.getJSONObject(i);
  946 + dfsj = jsonObj.getString("t");
  947 + schedule = dayOfSchedule.get(jsonObj.getLong("id"));
  948 + //设置待发时间
  949 + schedule.setDfsjAll(dfsj);
  950 +
  951 + dayOfSchedule.save(schedule);
  952 + }
  953 +
  954 + rs.put("status", ResponseCode.SUCCESS);
  955 + //将更新的最后一个班次返回
  956 + rs.put("t", schedule);
  957 + } catch (Exception e) {
  958 + logger.error("", e);
  959 + rs.put("status", ResponseCode.ERROR);
  960 + }
  961 + return rs;
  962 + }
  963 +
  964 + @Override
  965 + public Map<String, Object> findRouteByLine(String lineCode) {
  966 + Map<String, Object> map = new HashMap<>();
  967 + //上行
  968 + Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode);
  969 + map.put("line.id_eq", lineId);
  970 + map.put("directions_eq", 0);
  971 + List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map);
  972 +
  973 + //下行
  974 + map.put("directions_eq", 1);
  975 + List<Map<String, Object>> downList = sectionRouteService.getSectionRoute(map);
  976 +
  977 + Map<String, Object> rs = new HashMap<>();
  978 +
  979 + String upVectors = "", vec;
  980 + //拼接上行路段
  981 + for (Map<String, Object> temp : upList) {
  982 + vec = temp.get("sectionBsectionVector").toString();
  983 + upVectors += vec.subSequence(11, vec.length() - 2) + " ";
  984 + }
  985 +
  986 + //拼接下行路段
  987 + String downVectors = "";
  988 + for (Map<String, Object> temp : downList) {//LINESTRING(
  989 + vec = temp.get("sectionBsectionVector").toString();
  990 + downVectors += vec.subSequence(11, vec.length() - 2) + " ";
  991 + }
  992 +
  993 +
  994 + rs.put("up", upVectors);
  995 + //上行gcj
  996 + rs.put("up_gcj", BdToGcjString(upVectors));
  997 + rs.put("down", downVectors);
  998 + //下行gcj
  999 + rs.put("down_gcj", BdToGcjString(downVectors));
  1000 + rs.put("lineId", lineId);
  1001 +
  1002 + return rs;
  1003 + }
  1004 +
  1005 + /**
  1006 + * @param @param bdStr
  1007 + * @throws
  1008 + * @Title: BdToGcjString
  1009 + * @Description: TODO(将百度路由字符串 转 成GCJ 字符串)
  1010 + */
  1011 + public String BdToGcjString(String bdStr) {
  1012 + String[] array = bdStr.split(","), subArray;
  1013 + if (array.length == 0 || bdStr.length() < 2)
  1014 + return "";
  1015 +
  1016 + String gcjStr = "";
  1017 + TransGPS.Location location;
  1018 + for (String crd : array) {
  1019 + subArray = crd.split(" ");
  1020 + if (subArray.length != 2)
  1021 + continue;
  1022 + location = TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(subArray[0]), Double.parseDouble(subArray[1])));
  1023 +
  1024 + gcjStr += location.getLng() + " " + location.getLat() + ",";
  1025 + }
  1026 +
  1027 + return gcjStr.substring(0, gcjStr.length() - 1);
  1028 + }
  1029 +
  1030 + public List<Map<String, String>> findLine(String line) {
  1031 + List<Line> listLine = lineRepository.findLine("%" + line + "%");
  1032 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  1033 + Map<String, String> map;
  1034 + for (Line temp : listLine) {
  1035 + if (temp != null) {
  1036 + String xlName = temp.getName();
  1037 + if (xlName.indexOf(line) != -1) {
  1038 + map = new HashMap<String, String>();
  1039 + map.put("id", temp.getLineCode());
  1040 + map.put("text", xlName);
  1041 + list.add(map);
  1042 + }
  1043 + }
  1044 + }
  1045 + return list;
  1046 + }
  1047 +
  1048 + public List<Map<String, String>> findLpName(String lpName) {
  1049 + List<GuideboardInfo> listLpName = guideboardInfoRepository.findLpName("%" + lpName + "%");
  1050 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  1051 + Map<String, String> map;
  1052 + for (GuideboardInfo temp : listLpName) {
  1053 + if (temp != null) {
  1054 + String lp = temp.getLpName();
  1055 + if (lp.indexOf(lpName) != -1) {
  1056 + map = new HashMap<String, String>();
  1057 + map.put("id", lp);
  1058 + map.put("text", lp);
  1059 + list.add(map);
  1060 + }
  1061 + }
  1062 + }
  1063 + return list;
  1064 + }
  1065 +
  1066 + @Override
  1067 + public Map<String, Object> findKMBC2(String jName, String clZbh, String date) {
  1068 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  1069 +
  1070 + DecimalFormat format = new DecimalFormat("0.00");
  1071 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  1072 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  1073 + int jhbc = 0, cjbc = 0, ljbc = 0;
  1074 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0;
  1075 + float addMileage = 0l, remMileage = 0l;
  1076 + String j_Name = "";
  1077 + Map<String, Object> map = new HashMap<String, Object>();
  1078 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1079 + if (scheduleRealInfo != null) {
  1080 + j_Name = scheduleRealInfo.getjName();
  1081 + //计划里程(主任务过滤掉临加班次),
  1082 + //烂班里程(主任务烂班),
  1083 + //临加里程(主任务临加),
  1084 + //计划班次,烂班班次,增加班次
  1085 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1086 + if (scheduleRealInfo.isSflj()) {
  1087 + addMileage += tempJhlc;
  1088 + ljbc++;
  1089 + } else {
  1090 + jhlc += tempJhlc;
  1091 + jhbc++;
  1092 + if (scheduleRealInfo.getStatus() == -1) {
  1093 + remMileage += tempJhlc;
  1094 + cjbc++;
  1095 + }
  1096 + }
  1097 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1098 + //计算营运里程,空驶里程
  1099 + if (childTaskPlans.isEmpty()) {
  1100 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  1101 + || scheduleRealInfo.getBcType().equals("venting")) {
  1102 + ksgl += tempJhlc;
  1103 + } else {
  1104 + yygl += tempJhlc;
  1105 + }
  1106 + } else {
  1107 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1108 + while (it.hasNext()) {
  1109 + ChildTaskPlan childTaskPlan = it.next();
  1110 + if (childTaskPlan.getMileageType().equals("empty")) {
  1111 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1112 + } else {
  1113 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1114 + }
  1115 + }
  1116 + }
  1117 + }
  1118 + }
  1119 + map.put("j_name", j_Name);
  1120 + map.put("jhlc", format.format(jhlc));
  1121 + map.put("remMileage", format.format(remMileage));
  1122 + map.put("addMileage", format.format(addMileage));
  1123 + map.put("yygl", format.format(yygl));
  1124 + map.put("ksgl", format.format(ksgl));
  1125 + map.put("realMileage", format.format(yygl + ksgl));
  1126 + map.put("jhbc", jhbc);
  1127 + map.put("cjbc", cjbc);
  1128 + map.put("ljbc", ljbc);
  1129 + map.put("sjbc", jhbc - cjbc + ljbc);
  1130 + return map;
  1131 + }
  1132 +
  1133 +
  1134 +
  1135 + @Override
  1136 + public Map<String, Object> findKMBC(String jName, String clZbh,
  1137 + String lpName, String date,String line) {
  1138 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line);
  1139 + DecimalFormat format = new DecimalFormat("0.00");
  1140 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  1141 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  1142 + int jhbc = 0, cjbc = 0, ljbc = 0;
  1143 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  1144 + float addMileage = 0l, remMileage = 0l;
  1145 + Map<String, Object> map = new HashMap<String, Object>();
  1146 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1147 + if (scheduleRealInfo != null) {
  1148 + //计划里程(主任务过滤掉临加班次),
  1149 + //烂班里程(主任务烂班),
  1150 + //临加里程(主任务临加),
  1151 + //计划班次,烂班班次,增加班次
  1152 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1153 + if (scheduleRealInfo.isSflj()) {
  1154 + addMileage += tempJhlc;
  1155 + ljbc++;
  1156 + } else {
  1157 + if (!(scheduleRealInfo.getBcType().equals("in")
  1158 + || scheduleRealInfo.getBcType().equals("out"))) {
  1159 + jhbc++;
  1160 + jhlc += tempJhlc;
  1161 + }
  1162 +
  1163 + if (scheduleRealInfo.getStatus() == -1) {
  1164 + remMileage += tempJhlc;
  1165 + cjbc++;
  1166 + }
  1167 + }
  1168 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1169 + //计算营运里程,空驶里程
  1170 + if (childTaskPlans.isEmpty()) {
  1171 + if (scheduleRealInfo.getBcType().equals("in") ||
  1172 + scheduleRealInfo.getBcType().equals("out")) {
  1173 + jcclc += tempJhlc;
  1174 + }
  1175 + //主任务 放空班次属于营运
  1176 +// else if(scheduleRealInfo.getBcType().equals("venting")){
  1177 +// ksgl += tempJhlc;
  1178 +// }
  1179 + else {
  1180 + if (scheduleRealInfo.getStatus() != -1) {
  1181 + yygl += tempJhlc;
  1182 + }
  1183 + }
  1184 + } else {
  1185 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1186 + while (it.hasNext()) {
  1187 + ChildTaskPlan childTaskPlan = it.next();
  1188 + if (childTaskPlan.getMileageType().equals("empty")) {
  1189 + if (childTaskPlan.isDestroy()) {
  1190 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1191 + } else {
  1192 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1193 + }
  1194 + } else {
  1195 + if (childTaskPlan.isDestroy()) {
  1196 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1197 +// cjbc++;
  1198 + } else {
  1199 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1200 + }
  1201 + }
  1202 + }
  1203 + }
  1204 + }
  1205 + }
  1206 + map.put("jhlc", format.format(jhlc));
  1207 + map.put("remMileage", format.format(remMileage));
  1208 + map.put("addMileage", format.format(addMileage));
  1209 + map.put("yygl", format.format(yygl));
  1210 + map.put("ksgl", format.format(ksgl));
  1211 + map.put("realMileage", format.format(yygl + ksgl + jcclc));
  1212 + map.put("jhbc", jhbc);
  1213 + map.put("cjbc", cjbc);
  1214 + map.put("ljbc", ljbc);
  1215 + map.put("sjbc", jhbc - cjbc + ljbc);
  1216 + map.put("jcclc", jcclc);
  1217 + map.put("zkslc", format.format(ksgl + jcclc));
  1218 + return map;
  1219 + }
  1220 +
  1221 +
  1222 + @Override
  1223 + public List<Map<String, Object>> account(String line, String date,
  1224 + String code, String xlName, String type) {
  1225 + List<Object[]> lsitObj = scheduleRealInfoRepository.account(line, date, code);
  1226 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  1227 + Map<String, Object> map;
  1228 + int i = 1;
  1229 + for (Object[] obj : lsitObj) {
  1230 + if (obj != null) {
  1231 + map = new HashMap<String, Object>();
  1232 + map.put("num", i++);
  1233 + map.put("xlName", xlName);
  1234 + map.put("clZbh", obj[3]);
  1235 + map.put("company", obj[0]);
  1236 + map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[1] + "")).toUpperCase());
  1237 + map.put("requestTime", obj[2]);
  1238 + listMap.add(map);
  1239 + }
  1240 + }
  1241 +
  1242 + if (type != null && type.length() != 0 && type.equals("export")) {
  1243 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1244 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1245 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1246 + Map<String, Object> m = new HashMap<String, Object>();
  1247 + ReportUtils ee = new ReportUtils();
  1248 + Map<String, Object> typeMap = new HashMap<String, Object>();
  1249 + typeMap.put("0xA1", "请求恢复运营");
  1250 + typeMap.put("0xA2", "申请调档");
  1251 + typeMap.put("0xA3", "出场请求");
  1252 + typeMap.put("0xA5", "进场请求");
  1253 + typeMap.put("0xA7", "加油请求");
  1254 + typeMap.put("0x50", "车辆故障");
  1255 + typeMap.put("0x70", "路阻报告");
  1256 + typeMap.put("0x60", "事故报告");
  1257 + typeMap.put("0x11", "扣证纠纷");
  1258 + typeMap.put("0x12", "报警");
  1259 + for (Map<String, Object> map1 : listMap) {
  1260 + map1.put("requestText", typeMap.get(map1.get("requestType")));
  1261 + }
  1262 + try {
  1263 + listI.add(listMap.iterator());
  1264 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  1265 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\account.xls",
  1266 + path + "export\\驾驶员请求台账" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1267 + } catch (Exception e) {
  1268 + // TODO: handle exception
  1269 + e.printStackTrace();
  1270 + }
  1271 + }
  1272 +
  1273 + return listMap;
  1274 + }
  1275 +
  1276 + @Override
  1277 + public List<ScheduleRealInfo> correctForm(String line, String startDate,
  1278 + String endDate, String lpName, String code, String type) {
  1279 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line, startDate, endDate, lpName, code);
  1280 +
  1281 + if (type != null && type.length() != 0 && type.equals("export")) {
  1282 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1283 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1284 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1285 + Map<String, Object> m = new HashMap<String, Object>();
  1286 + ReportUtils ee = new ReportUtils();
  1287 + m.put("dates", startDate + " 至 " + endDate);
  1288 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1289 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1290 + for (ScheduleRealInfo schedule : list) {
  1291 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1292 + tempMap.put("xlName", schedule.getXlName() != null ? schedule.getXlName() : "");
  1293 + tempMap.put("lpName", schedule.getLpName() != null ? schedule.getLpName() : "");
  1294 + tempMap.put("clZbh", schedule.getClZbh() != null ? schedule.getClZbh() : "");
  1295 + tempMap.put("jName", schedule.getjName() != null ? schedule.getjName() : "");
  1296 + tempMap.put("sName", schedule.getsName() != null ? schedule.getsName() : "");
  1297 + tempMap.put("fcsj", schedule.getFcsj() != null ? schedule.getFcsj() : "");
  1298 + tempMap.put("fcsjActual", schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "");
  1299 + tempMap.put("zdsj", schedule.getZdsj() != null ? schedule.getZdsj() : "");
  1300 + tempMap.put("zdsjActual", schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "");
  1301 + if (schedule.getUpdateBy() != null) {
  1302 + if (schedule.getUpdateBy().getName() != null)
  1303 + tempMap.put("userName", schedule.getUpdateBy().getName());
  1304 + else
  1305 + tempMap.put("userName", "");
  1306 + } else {
  1307 + tempMap.put("userName", "");
  1308 + }
  1309 + if (schedule.getUpdateDate() != null) {
  1310 + tempMap.put("updateDate", sdf.format(schedule.getUpdateDate()));
  1311 + } else {
  1312 + tempMap.put("updateDate", "");
  1313 + }
  1314 + tempMap.put("remarks", schedule.getRemarks() != null ? schedule.getRemarks() : "");
  1315 + tempList.add(tempMap);
  1316 + }
  1317 + try {
  1318 + listI.add(tempList.iterator());
  1319 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  1320 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\correctForm.xls",
  1321 + path + "export\\修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  1322 + } catch (Exception e) {
  1323 + // TODO: handle exception
  1324 + e.printStackTrace();
  1325 + }
  1326 + Map<String, Object> map = tempList.get(tempList.size() - 1);
  1327 + System.out.println("tempMap:" + map);
  1328 + }
  1329 +
  1330 + return list;
  1331 + }
  1332 +
  1333 + @Override
  1334 + public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
  1335 + String lpName, String date,String line) {
  1336 + List<ScheduleRealInfo> list = null;
  1337 + list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line);
  1338 + for (int i = 0; i < list.size(); i++) {
  1339 + ScheduleRealInfo s = list.get(i);
  1340 + String remarks = "";
  1341 + if (s.getRemarks() != null) {
  1342 + remarks += s.getRemarks();
  1343 + }
  1344 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  1345 + if (!childTaskPlans.isEmpty()) {
  1346 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1347 + while (it.hasNext()) {
  1348 + ChildTaskPlan c = it.next();
  1349 + if (c.getRemarks() != null && c.getRemarks().length() > 0) {
  1350 + remarks += c.getRemarks();
  1351 + }
  1352 +
  1353 + }
  1354 + }
  1355 + s.setRemarks(remarks);
  1356 + }
  1357 +
  1358 + return list;
  1359 + }
  1360 +
  1361 + @Override
  1362 + public Map<String, Object> removeChildTask(Long taskId) {
  1363 + Map<String, Object> rs = new HashMap<>();
  1364 + ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);
  1365 +
  1366 + ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());
  1367 + try {
  1368 +
  1369 + sch.getcTasks().remove(chTask);
  1370 + scheduleRealInfoRepository.save(sch);
  1371 + rs.put("status", ResponseCode.SUCCESS);
  1372 + } catch (Exception e) {
  1373 + logger.error("", e);
  1374 + rs.put("status", ResponseCode.ERROR);
  1375 + }
  1376 + return rs;
  1377 + }
  1378 +
  1379 + @Override
  1380 + public List<Map<String, Object>> statisticsDaily(String line, String date,
  1381 + String xlName) {
  1382 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1383 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  1384 + DecimalFormat format = new DecimalFormat("0.00");
  1385 + double jhlc = 0, tempJhlc = 0, childMileage = 0;
  1386 + float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
  1387 + //班次
  1388 + int sj_0 = 6 * 60 + 31, sj_1 = 8 * 60 + 30, sj_2 = 16 * 60 + 1, sj_3 = 18 * 60;
  1389 + int jhbc = 0, jhbc_m = 0, jhbc_a = 0;
  1390 + int sjbc = 0, sjbc_m = 0, sjbc_a = 0;
  1391 + int ljbc = 0, ljbc_m = 0, ljbc_a = 0;
  1392 + int fzbc = 0, fzbc_m = 0, fzbc_a = 0;
  1393 + int dtbc = 0, dtbc_m = 0, dtbc_a = 0;
  1394 + int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0;
  1395 + Map<String, Object> map = new HashMap<String, Object>();
  1396 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1397 + if (scheduleRealInfo != null) {
  1398 +
  1399 + if (!(scheduleRealInfo.getBcType().equals("in")
  1400 + || scheduleRealInfo.getBcType().equals("out"))) {
  1401 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1402 + //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  1403 + if (childTaskPlans.isEmpty()) {
  1404 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1405 + //临加公里
  1406 + if (scheduleRealInfo.isSflj()) {
  1407 + ljgl += tempJhlc;
  1408 + } else {
  1409 + jhlc += tempJhlc;
  1410 + }
  1411 + if (scheduleRealInfo.getStatus() == 2) {
  1412 + sjgl += tempJhlc;
  1413 + } else if (scheduleRealInfo.getStatus() == -1) {
  1414 + ssgl += tempJhlc;
  1415 + if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("路阻") != -1) {
  1416 + ssgl_lz += tempJhlc;
  1417 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("吊慢") != -1) {
  1418 + ssgl_dm += tempJhlc;
  1419 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("故障") != -1) {
  1420 + ssgl_gz += tempJhlc;
  1421 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("纠纷") != -1) {
  1422 + ssgl_jf += tempJhlc;
  1423 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("肇事") != -1) {
  1424 + ssgl_zs += tempJhlc;
  1425 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺人") != -1) {
  1426 + ssgl_qr += tempJhlc;
  1427 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺车") != -1) {
  1428 + ssgl_qc += tempJhlc;
  1429 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("客稀") != -1) {
  1430 + ssgl_kx += tempJhlc;
  1431 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("气候") != -1) {
  1432 + ssgl_qh += tempJhlc;
  1433 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("援外") != -1) {
  1434 + ssgl_yw += tempJhlc;
  1435 + } else {
  1436 + ssgl_other += tempJhlc;
  1437 + }
  1438 + }
  1439 + } else {
  1440 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1441 + while (it.hasNext()) {
  1442 + ChildTaskPlan childTaskPlan = it.next();
  1443 + childMileage = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1444 + jhlc += childMileage;
  1445 + if (childTaskPlan.isDestroy()) {
  1446 + ssgl += childMileage;
  1447 + if (childTaskPlan.getDestroyReason().equals("路阻")) {
  1448 + ssgl_lz += childTaskPlan.getMileage();
  1449 + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) {
  1450 + ssgl_dm += childTaskPlan.getMileage();
  1451 + } else if (childTaskPlan.getDestroyReason().equals("故障")) {
  1452 + ssgl_gz += childTaskPlan.getMileage();
  1453 + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) {
  1454 + ssgl_jf += childTaskPlan.getMileage();
  1455 + } else if (childTaskPlan.getDestroyReason().equals("肇事")) {
  1456 + ssgl_zs += childTaskPlan.getMileage();
  1457 + } else if (childTaskPlan.getDestroyReason().equals("缺人")) {
  1458 + ssgl_qr += childTaskPlan.getMileage();
  1459 + } else if (childTaskPlan.getDestroyReason().equals("缺车")) {
  1460 + ssgl_qc += childTaskPlan.getMileage();
  1461 + } else if (childTaskPlan.getDestroyReason().equals("客稀")) {
  1462 + ssgl_kx += childTaskPlan.getMileage();
  1463 + } else if (childTaskPlan.getDestroyReason().equals("气候")) {
  1464 + ssgl_qh += childTaskPlan.getMileage();
  1465 + } else if (childTaskPlan.getDestroyReason().equals("援外")) {
  1466 + ssgl_yw += childTaskPlan.getMileage();
  1467 + } else {
  1468 + ssgl_other += childTaskPlan.getMileage();
  1469 + }
  1470 + } else {
  1471 + sjgl += childMileage;
  1472 + }
  1473 + }
  1474 + }
  1475 +
  1476 + //班次
  1477 + jhbc++;
  1478 + String[] fcsj = scheduleRealInfo.getFcsj().split(":");
  1479 + String[] fcsjActual = (scheduleRealInfo.getFcsjActual() == null ? "0:00" : scheduleRealInfo.getFcsjActual()).split(":");
  1480 + if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_0 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_1) {
  1481 + jhbc_m++;
  1482 + } else if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_2 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_3) {
  1483 + jhbc_a++;
  1484 + }
  1485 + if (scheduleRealInfo.getStatus() == 2) {
  1486 + sjbc++;
  1487 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1488 + sjbc_m++;
  1489 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1490 + sjbc_a++;
  1491 + }
  1492 + }
  1493 + if (scheduleRealInfo.isSflj()) {
  1494 + ljbc++;
  1495 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1496 + ljbc_m++;
  1497 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1498 + ljbc_a++;
  1499 + }
  1500 + }
  1501 + if (scheduleRealInfo.getBcType().equals("venting")) {
  1502 + fzbc++;
  1503 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1504 + fzbc_m++;
  1505 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1506 + fzbc_a++;
  1507 + }
  1508 + }
  1509 + }
  1510 + }
  1511 + }
  1512 + map.put("xlName", xlName);
  1513 + map.put("jhlc", format.format(jhlc));
  1514 + map.put("sjgl", format.format(sjgl));
  1515 + map.put("ssgl", format.format(ssgl));
  1516 + map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
  1517 + map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
  1518 + map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
  1519 + map.put("ssgl_jf", ssgl_jf == 0 ? 0 : format.format(ssgl_jf));
  1520 + map.put("ssgl_zs", ssgl_zs == 0 ? 0 : format.format(ssgl_zs));
  1521 + map.put("ssgl_qr", ssgl_qr == 0 ? 0 : format.format(ssgl_qr));
  1522 + map.put("ssgl_qc", ssgl_qc == 0 ? 0 : format.format(ssgl_qc));
  1523 + map.put("ssgl_kx", ssgl_kx == 0 ? 0 : format.format(ssgl_kx));
  1524 + map.put("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh));
  1525 + map.put("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw));
  1526 + map.put("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other));
  1527 + map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl));
  1528 + map.put("jhbc", jhbc);
  1529 + map.put("jhbc_m", jhbc_m);
  1530 + map.put("jhbc_a", jhbc_a);
  1531 + map.put("sjbc", sjbc);
  1532 + map.put("sjbc_m", sjbc_m);
  1533 + map.put("sjbc_a", sjbc_a);
  1534 + map.put("ljbc", ljbc);
  1535 + map.put("ljbc_m", ljbc_m);
  1536 + map.put("ljbc_a", ljbc_a);
  1537 + map.put("fzbc", fzbc);
  1538 + map.put("fzbc_m", fzbc_m);
  1539 + map.put("fzbc_a", fzbc_a);
  1540 + map.put("dtbc", dtbc);
  1541 + map.put("dtbc_m", dtbc_m);
  1542 + map.put("dtbc_a", dtbc_a);
  1543 + map.put("djg", djg);
  1544 + map.put("djg_m", djg_m);
  1545 + map.put("djg_a", djg_a);
  1546 + map.put("djg_time", djg_time);
  1547 + lMap.add(map);
  1548 + return lMap;
  1549 + }
  1550 +
  1551 + @Override
  1552 + public Map<String, Object> scheduleDaily(String line, String date) {
  1553 + Map<String, String> tempMap = null;
  1554 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1555 + Map<String, Object> map = new HashMap<String, Object>();
  1556 + Double jhlc = 0.00;
  1557 + Float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
  1558 + int jhbc = 0;
  1559 + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) {
  1560 + if (scheduleRealInfo != null) {
  1561 + //计算里程(包括子任务)
  1562 + jhlc += scheduleRealInfo.getJhlc();
  1563 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1564 + if (!childTaskPlans.isEmpty()) {
  1565 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1566 + while (it.hasNext()) {
  1567 + ChildTaskPlan childTaskPlan = it.next();
  1568 + //是否烂班,烂班就是少驶
  1569 + if (!childTaskPlan.isDestroy()) {
  1570 + sjgl += childTaskPlan.getMileage();
  1571 + } else {
  1572 + ssgl += childTaskPlan.getMileage();
  1573 + if (childTaskPlan.getDestroyReason().equals("路阻")) {
  1574 + ssgl_lz += childTaskPlan.getMileage();
  1575 + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) {
  1576 + ssgl_dm += childTaskPlan.getMileage();
  1577 + } else if (childTaskPlan.getDestroyReason().equals("故障")) {
  1578 + ssgl_gz += childTaskPlan.getMileage();
  1579 + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) {
  1580 + ssgl_jf += childTaskPlan.getMileage();
  1581 + } else if (childTaskPlan.getDestroyReason().equals("肇事")) {
  1582 + ssgl_zs += childTaskPlan.getMileage();
  1583 + } else if (childTaskPlan.getDestroyReason().equals("缺人")) {
  1584 + ssgl_qr += childTaskPlan.getMileage();
  1585 + } else if (childTaskPlan.getDestroyReason().equals("缺车")) {
  1586 + ssgl_qc += childTaskPlan.getMileage();
  1587 + } else if (childTaskPlan.getDestroyReason().equals("客稀")) {
  1588 + ssgl_kx += childTaskPlan.getMileage();
  1589 + } else if (childTaskPlan.getDestroyReason().equals("气候")) {
  1590 + ssgl_qh += childTaskPlan.getMileage();
  1591 + } else if (childTaskPlan.getDestroyReason().equals("援外")) {
  1592 + ssgl_yw += childTaskPlan.getMileage();
  1593 + } else {
  1594 + ssgl_other += childTaskPlan.getMileage();
  1595 + }
  1596 + }
  1597 + //临加公里
  1598 + if (childTaskPlan.getType1().equals("临加")) {
  1599 + ljgl += childTaskPlan.getMileage();
  1600 + }
  1601 + }
  1602 + }
  1603 + //班次
  1604 + scheduleRealInfo.getFcsjT();
  1605 + scheduleRealInfo.getFcsjActualTime();
  1606 + }
  1607 + }
  1608 + map.put("jhlc", jhlc);
  1609 + map.put("sjgl", sjgl);
  1610 + map.put("ssgl", ssgl);
  1611 + map.put("ssgl_lz", ssgl_lz);
  1612 + map.put("ssgl_dm", ssgl_dm);
  1613 + map.put("ssgl_gz", ssgl_gz);
  1614 + map.put("ssgl_jf", ssgl_jf);
  1615 + map.put("ssgl_zs", ssgl_zs);
  1616 + map.put("ssgl_qr", ssgl_qr);
  1617 + map.put("ssgl_qc", ssgl_qc);
  1618 + map.put("ssgl_kx", ssgl_kx);
  1619 + map.put("ssgl_qh", ssgl_qh);
  1620 + map.put("ssgl_yw", ssgl_yw);
  1621 + map.put("ssgl_other", ssgl_other);
  1622 + map.put("ljgl", ljgl);
  1623 +
  1624 + map.put("jhbc", scheduleRealInfos.size());
  1625 + return null;
  1626 + }
  1627 +
  1628 + @Override
  1629 + public int countByLineCodeAndDate(String xlBm, String schDate) {
  1630 + return scheduleRealInfoRepository.countByLineCodeAndDate(xlBm + "", schDate);
  1631 + }
  1632 +
  1633 + @Override
  1634 + public List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate) {
  1635 + return scheduleRealInfoRepository.findByLineCodeAndDate(xlBm + "", schDate);
  1636 + }
  1637 +
  1638 + @Override
  1639 + public void deleteByLineCodeAndDate(String xlBm, String schDate) {
  1640 + scheduleRealInfoRepository.deleteByLineCodeAndDate(xlBm + "", schDate);
  1641 + }
  1642 +
  1643 + @Override
  1644 + public Long getMaxId() {
  1645 + return scheduleRealInfoRepository.getMaxId();
  1646 + }
  1647 +
  1648 + @Override
  1649 + public List<ScheduleRealInfo> realScheduleList(String line, String date) {
  1650 + /*List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.queryUserInfo(line, date);
  1651 + List<ScheduleRealInfo> listTotal = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1652 + for(ScheduleRealInfo info:listInfo){
  1653 + for(ScheduleRealInfo total:listTotal){
  1654 + if(info.getjGh().equals(total.getjGh()) && info.getLpName().equals(total.getLpName()) && info.getClZbh().equals(total.getClZbh())){
  1655 +
  1656 + }
708 1657 }
  1658 + }*/
  1659 + return scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1660 + }
709 1661  
710   - sch.setFcsjActualAll(fcsjActual);
711   - sch.addRemarks(remarks);
712   - sch.calcStatus();
713   -
714   - dayOfSchedule.save(sch);
715   - //scheduleRealInfoRepository.save(sch);
716   -
717   - ts.add(sch);
718   -
719   - rs.put("status", ResponseCode.SUCCESS);
720   - rs.put("ts", ts);
721   -
722   - //通知页面刷新
723   - sendUtils.refreshSch(ts);
724   - } catch (Exception e) {
725   - logger.error("", e);
726   - rs.put("status", ResponseCode.ERROR);
727   - }
728   -
729   - return rs;
730   - }
731   -
732   - @Override
733   - public Map<String, Object> revokeDestroy(Long id) {
734   - Map<String, Object> rs = new HashMap<>();
735   - try {
736   - ScheduleRealInfo sch = dayOfSchedule.get(id);
737   - if (sch.getStatus() != -1) {
738   - rs.put("status", ResponseCode.ERROR);
739   - rs.put("msg", "未烂班,无法撤销!");
740   - } else {
741   - sch.setStatus(0);
742   - rs.put("status", ResponseCode.SUCCESS);
743   - rs.put("t", sch);
744   -
745   - }
746   - } catch (Exception e) {
747   - logger.error("", e);
748   - rs.put("status", ResponseCode.ERROR);
749   - }
750   - return rs;
751   - }
752 1662  
753   - @Override
754   - public Map<String, Object> revokeRealOutgo(Long id) {
755   - Map<String, Object> rs = new HashMap<>();
756   - List<ScheduleRealInfo> ts = new ArrayList<>();
  1663 + public List<Map<String, Object>> yesterdayDataList(String line, String date) {
  1664 + //前一天日期
  1665 +// String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
  1666 +// String date = "2016-09-20";
  1667 + List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
  1668 +// List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1669 + for (int x = 0; x < yesterdayDataList.size(); x++) {
  1670 + String jName = yesterdayDataList.get(x).get("jGh").toString();
  1671 + String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
  1672 + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  1673 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  1674 + float addMileage = 0l, remMileage = 0l;
  1675 + Map<String, Object> map = new HashMap<String, Object>();
  1676 + boolean fage = true;
  1677 + for (ScheduleRealInfo scheduleRealInfo : lists) {
  1678 + if (fage) {
  1679 + //根据线路代码获取公司
  1680 + Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
  1681 + yesterdayDataList.get(x).put("company", li.getCompany());
  1682 + yesterdayDataList.get(x).put("bCompany", li.getBrancheCompany());
  1683 + fage = false;
  1684 + }
  1685 + if (scheduleRealInfo != null) {
  1686 + //计划里程(主任务过滤掉临加班次),
  1687 + //烂班里程(主任务烂班),
  1688 + //临加里程(主任务临加),
  1689 + //计划班次,烂班班次,增加班次
  1690 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1691 + if (scheduleRealInfo.isSflj()) {
  1692 + addMileage += tempJhlc;
  1693 + } else {
  1694 + if (!(scheduleRealInfo.getBcType().equals("in")
  1695 + || scheduleRealInfo.getBcType().equals("out"))) {
  1696 + jhlc += tempJhlc;
  1697 + }
  1698 +
  1699 + if (scheduleRealInfo.getStatus() == -1) {
  1700 + remMileage += tempJhlc;
  1701 + }
  1702 + }
  1703 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1704 + //计算营运里程,空驶里程
  1705 + if (childTaskPlans.isEmpty()) {
  1706 + if (scheduleRealInfo.getBcType().equals("in") ||
  1707 + scheduleRealInfo.getBcType().equals("out")) {
  1708 + jcclc += tempJhlc;
  1709 + }
  1710 + //主任务 放空班次属于营运
  1711 +// else if(scheduleRealInfo.getBcType().equals("venting")){
  1712 +// ksgl += tempJhlc;
  1713 +// }
  1714 + else {
  1715 + if (scheduleRealInfo.getStatus() != -1) {
  1716 + yygl += tempJhlc;
  1717 + }
  1718 + }
  1719 + } else {
  1720 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1721 + while (it.hasNext()) {
  1722 + ChildTaskPlan childTaskPlan = it.next();
  1723 + if (childTaskPlan.getMileageType().equals("empty")) {
  1724 + if (childTaskPlan.isDestroy()) {
  1725 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1726 + } else {
  1727 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1728 + }
  1729 + } else {
  1730 + if (childTaskPlan.isDestroy()) {
  1731 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1732 + } else {
  1733 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1734 + }
  1735 + }
  1736 + }
  1737 + }
  1738 + }
  1739 + }
  1740 +
  1741 + yesterdayDataList.get(x).put("totalKilometers", yygl + ksgl + jcclc);
  1742 +
  1743 + }
757 1744  
758   - try {
759   - ScheduleRealInfo sch = dayOfSchedule.get(id);
760   - if (sch.getFcsjActual() == null) {
761   - rs.put("status", ResponseCode.ERROR);
762   - rs.put("msg", "无实发时间,无法撤销!");
763   - } else {
764   - //将对应的到离站数据标记为不可信
765   - List<ArrivalEntity> list = ArrivalData_GPS.findByNbbm(sch.getClZbh());
766   - for(ArrivalEntity arr : list){
767   - if(arr.getInOut() == 1
768   - && arr.getUpDown() == Integer.parseInt(sch.getXlDir())
769   - && arr.getStopNo().equals(sch.getQdzCode())
770   - && Math.abs(arr.getTs() - sch.getFcsjActualTime()) < 1000 * 60){
771   - arr.setEnable(false);
772   - break;
773   - }
  1745 + /* for(ScheduleRealInfo scheduleRealInfo:list){
  1746 + if(scheduleRealInfo != null){
  1747 + for(int i=0;i<yesterdayDataList.size();i++){
  1748 + if(scheduleRealInfo.getXlBm().equals(yesterdayDataList.get(i).get("xlBm")) && scheduleRealInfo.getClZbh().equals(yesterdayDataList.get(i).get("clZbh"))
  1749 + && scheduleRealInfo.getjGh().equals(yesterdayDataList.get(i).get("jGh"))){
  1750 + //根据线路代码获取公司
  1751 + Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
  1752 + yesterdayDataList.get(i).put("company", li.getCompany());
  1753 + yesterdayDataList.get(i).put("bCompany", li.getBrancheCompany());
  1754 + //计算总公里
  1755 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1756 + //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
  1757 + if(childTaskPlans.isEmpty()){
  1758 + if(scheduleRealInfo.getStatus() == 2){
  1759 + yesterdayDataList.get(i).put("totalKilometers", scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
  1760 + }
  1761 + }else{
  1762 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1763 + while(it.hasNext()){
  1764 + ChildTaskPlan childTaskPlan = it.next();
  1765 + if(!childTaskPlan.isDestroy()){
  1766 + yesterdayDataList.get(i).put("totalKilometers", childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
  1767 + }
  1768 + }
  1769 + }
  1770 + }
774 1771 }
775   -
776   - sch.clearFcsjActual();
777   - rs.put("status", ResponseCode.SUCCESS);
778   -
779   - ts.add(sch);
780   - rs.put("ts", ts);
781   -
782   - }
783   - } catch (Exception e) {
784   - logger.error("", e);
785   - rs.put("status", ResponseCode.ERROR);
786   - }
787   - return rs;
788   - }
789   -
790   - @Override
791   - public Map<String, Object> spaceAdjust(Long[] ids, Integer space) {
792   -
793   - List<ScheduleRealInfo> list = new ArrayList<>()
794   - ,updateList = new ArrayList<>();
795   - Map<String, Object> rs = new HashMap<>();
796   - try {
797   - ScheduleRealInfo sch, next;
798   - for (Long id : ids) {
799   - sch = dayOfSchedule.get(id);
800   - if (null != sch)
801   - list.add(sch);
802 1772 }
  1773 + }*/
  1774 + //增加顺序号
  1775 + for (int i = 0; i < yesterdayDataList.size(); i++) {
  1776 + if (i == 0) {
  1777 + yesterdayDataList.get(i).put("seqNumber", 1);
  1778 + } else {
  1779 + if (yesterdayDataList.get(i - 1).get("clZbh").equals(yesterdayDataList.get(i).get("clZbh"))) {
  1780 + yesterdayDataList.get(i).put("seqNumber", 1 + (int) yesterdayDataList.get(i - 1).get("seqNumber"));
  1781 + } else {
  1782 + yesterdayDataList.get(i).put("seqNumber", 1);
  1783 + }
  1784 + }
  1785 + }
  1786 + return yesterdayDataList;
  1787 + }
  1788 +
  1789 + /**
  1790 + * 批量调整人车
  1791 + */
  1792 + @Override
  1793 + public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs) {
  1794 + Map<String, Object> rs = new HashMap<>();
  1795 + Set<ScheduleRealInfo> set = new HashSet<>();
  1796 +
  1797 + ScheduleRealInfo sch;
  1798 + BiMap<String, String> map = BasicData.deviceId2NbbmMap.inverse();
  1799 +
  1800 + for (ChangePersonCar cpc : cpcs) {
  1801 +
  1802 + if (map.get(cpc.getClZbh()) == null) {
  1803 + rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!");
  1804 + rs.put("status", ResponseCode.ERROR);
  1805 + return rs;
  1806 + }
  1807 +
  1808 + sch = dayOfSchedule.get(cpc.getSchId());
  1809 + if (sch == null)
  1810 + continue;
  1811 +
  1812 + if (StringUtils.isNotEmpty(cpc.getJsy())) {
  1813 + //换驾驶员
  1814 + persoChange(sch, cpc.getJsy().split("/")[0]);
  1815 + }
  1816 +
  1817 + //换售票员
  1818 + if (StringUtils.isNotEmpty(cpc.getSpy())) {
  1819 + persoChangeSPY(sch, cpc.getSpy().split("/")[0]);
  1820 + }
  1821 +
  1822 + //换车
  1823 + if (StringUtils.isNotEmpty(cpc.getClZbh())) {
  1824 + set.add(sch);
  1825 + set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh()));
  1826 + }
  1827 +
  1828 + }
  1829 + rs.put("ts", set);
  1830 + rs.put("status", ResponseCode.SUCCESS);
  1831 + return rs;
  1832 + }
  1833 +
  1834 + /**
  1835 + * @Title: persoChange
  1836 + * @Description: TODO(班次换驾驶员)
  1837 + */
  1838 + public void persoChange(ScheduleRealInfo sch, String jGh) {
  1839 + if (sch.getjGh().equals(jGh))
  1840 + return;
  1841 + String jName = BasicData.allPerson.get(jGh);
  1842 + if (StringUtils.isNotEmpty(jName)) {
  1843 + sch.setjGh(jGh);
  1844 + sch.setjName(jName);
  1845 + }
  1846 + }
  1847 +
  1848 + /**
  1849 + * @Title: persoChange
  1850 + * @Description: TODO(班次换售票员)
  1851 + */
  1852 + public void persoChangeSPY(ScheduleRealInfo sch, String sGh) {
  1853 + if (sch.getsGh().equals(sGh))
  1854 + return;
  1855 + String sName = BasicData.allPerson.get(sGh);
  1856 + if (StringUtils.isNotEmpty(sName)) {
  1857 + sch.setsGh(sGh);
  1858 + sch.setsName(sName);
  1859 + }
  1860 + }
  1861 +
  1862 + /**
  1863 + * 批量待发调整
  1864 + */
  1865 + @Override
  1866 + public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) {
  1867 + Map<String, Object> rs = new HashMap<>(), tempMap = new HashMap<>();
  1868 + List<ScheduleRealInfo> list = new ArrayList<>();
  1869 +
  1870 + ScheduleRealInfo sch, next;
  1871 + for (DfsjChange dc : dfsjcs) {
  1872 + if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj()))
  1873 + continue;
  1874 +
  1875 + /*sch = dayOfSchedule.get(dc.getSchId());
  1876 + if(sch==null)
  1877 + continue;
  1878 +
  1879 + sch.setDfsjAll(dc.getNew_dfsj());
  1880 + //重新计算终点时间
  1881 + sch.calcEndTime();
  1882 + list.add(sch);*/
  1883 + tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null);
803 1884  
804   - int size = list.size();
805   - if(size == 0){
806   - rs.put("status", ResponseCode.ERROR);
807   - }
808   - else{
809   - // 按发车时间排序
810   - Collections.sort(list, new ScheduleComparator.FCSJ());
811   -
812   - // 以第一个实际发车/待发时间为起点,调整间隔
813   - sch = list.get(0);
814   - Long st = sch.getFcsjActualTime()==null?sch.getDfsjT():sch.getFcsjActualTime()
815   - ,plus = space * 60 * 1000L;
816   -
817   - for(int i = 1; i < size; i ++){
818   - st += plus;
819   - sch = list.get(i);
820   - sch.setDfsjAll(st);
821   - //重新计算终点时间
822   - sch.calcEndTime();
823   -
824   - dayOfSchedule.save(sch);
825   -
826   - updateList.add(sch);
827   - next=dayOfSchedule.next(sch);
828   - if(next.getQdzName().equals(sch.getZdzName())){
829   - next.setQdzArrDateJH(sch.getZdsj());
830   - updateList.add(next);
831   - }
832   - }
  1885 + if (tempMap.get("status").equals(ResponseCode.SUCCESS)) {
  1886 + list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts"));
  1887 + }
  1888 + //next=dayOfSchedule.next(sch);
  1889 + /*if(next.getQdzName().equals(sch.getZdzName())){
  1890 + next.setQdzArrDateJH(sch.getZdsj());
  1891 + list.add(next);
  1892 + }*/
  1893 + }
833 1894  
  1895 + rs.put("status", ResponseCode.SUCCESS);
  1896 + rs.put("ts", list);
  1897 + return rs;
  1898 + }
834 1899  
835   - rs.put("status", ResponseCode.SUCCESS);
836   - rs.put("ts", updateList);
837   - }
838   -
839   - } catch (Exception e) {
840   - logger.error("", e);
841   - rs.put("status", ResponseCode.ERROR);
842   - }
843   - return rs;
844   - }
845 1900  
846   - private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  1901 + @Override
  1902 + public Map<String, Object> findKMBC1(String jName, String clZbh,
  1903 + String date, String enddate) {
  1904 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate);
  1905 + DecimalFormat format = new DecimalFormat("0.00");
  1906 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  1907 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  1908 + int jhbc = 0, cjbc = 0, ljbc = 0;
  1909 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0;
  1910 + float addMileage = 0l, remMileage = 0l;
  1911 + Map<String, Object> map = new HashMap<String, Object>();
  1912 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1913 + if (scheduleRealInfo != null) {
  1914 + //计划里程(主任务过滤掉临加班次),
  1915 + //烂班里程(主任务烂班),
  1916 + //临加里程(主任务临加),
  1917 + //计划班次,烂班班次,增加班次
  1918 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1919 + if (scheduleRealInfo.isSflj()) {
  1920 + addMileage += tempJhlc;
  1921 + ljbc++;
  1922 + } else {
  1923 + jhlc += tempJhlc;
  1924 + jhbc++;
  1925 + if (scheduleRealInfo.getStatus() == -1) {
  1926 + remMileage += tempJhlc;
  1927 + cjbc++;
  1928 + }
  1929 + }
  1930 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1931 + //计算营运里程,空驶里程
  1932 + if (childTaskPlans.isEmpty()) {
  1933 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  1934 + || scheduleRealInfo.getBcType().equals("venting")) {
  1935 + ksgl += tempJhlc;
  1936 + } else {
  1937 + yygl += tempJhlc;
  1938 + }
  1939 + } else {
  1940 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1941 + while (it.hasNext()) {
  1942 + ChildTaskPlan childTaskPlan = it.next();
  1943 + if (childTaskPlan.getMileageType().equals("empty")) {
  1944 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1945 + } else {
  1946 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1947 + }
  1948 + }
  1949 + }
  1950 + }
  1951 + }
  1952 + map.put("jhlc", format.format(jhlc));
  1953 + map.put("remMileage", format.format(remMileage));
  1954 + map.put("addMileage", format.format(addMileage));
  1955 + map.put("yygl", format.format(yygl));
  1956 + map.put("ksgl", format.format(ksgl));
  1957 + map.put("realMileage", format.format(yygl + ksgl));
  1958 + map.put("jhbc", jhbc);
  1959 + map.put("cjbc", cjbc);
  1960 + map.put("ljbc", ljbc);
  1961 + map.put("sjbc", jhbc - cjbc + ljbc);
  1962 + return map;
  1963 + }
  1964 +
  1965 + /**
  1966 + * 调整班次类型
  1967 + *
  1968 + * @param id
  1969 + * @param bcType
  1970 + * @param remarks
  1971 + * @return
  1972 + */
  1973 + @Override
  1974 + public Map<String, Object> changeBcType(Long id, String bcType, String remarks) {
  1975 + Map<String, Object> rs = new HashMap<>();
  1976 +
  1977 + try {
  1978 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  1979 + if (sch != null) {
  1980 + sch.setBcType(bcType);
  1981 + sch.addRemarks(remarks);
  1982 + //有时间记录一下相关变更数据
  1983 + rs.put("status", ResponseCode.SUCCESS);
  1984 + rs.put("t", sch);
  1985 + }
  1986 + } catch (Exception e) {
  1987 + logger.error("", e);
  1988 + rs.put("status", ResponseCode.ERROR);
  1989 + }
  1990 +
  1991 + return rs;
  1992 + }
  1993 +
  1994 + @Override
  1995 + public Map<String, Object> historySave(ScheduleRealInfo sch) {
  1996 + Map<String, Object> rs = new HashMap<>();
  1997 + rs.put("status", ResponseCode.ERROR);
  1998 +
  1999 + ScheduleRealInfo oldSch = super.findById(sch.getId());
  2000 + //修改车辆
  2001 + if (!oldSch.getClZbh().equals(sch.getClZbh())) {
  2002 + Set<String> allCar = BasicData.deviceId2NbbmMap.values();
  2003 + if (!allCar.contains(sch.getClZbh())) {
  2004 + rs.put("msg", "无效的车辆自编号");
  2005 + return rs;
  2006 + } else
  2007 + oldSch.setClZbh(sch.getClZbh());
  2008 + }
  2009 +
  2010 + //修改驾驶员
  2011 + if (!oldSch.getjGh().equals(sch.getjGh())) {
  2012 + Map<String, String> allPer = BasicData.allPerson;
  2013 + if (!allPer.containsKey(sch.getjGh())) {
  2014 + rs.put("msg", "无效的驾驶员");
  2015 + return rs;
  2016 + } else {
  2017 + oldSch.setjGh(sch.getjGh());
  2018 + oldSch.setjName(allPer.get(oldSch.getjGh()));
  2019 + }
  2020 + }
  2021 +
  2022 + //待发时间
  2023 + oldSch.setDfsj(sch.getDfsj());
  2024 + //实发时间
  2025 + oldSch.setFcsjActual(sch.getFcsjActual());
  2026 + //实际终点
  2027 + oldSch.setZdsjActual(sch.getZdsjActual());
  2028 + //备注
  2029 + oldSch.setRemarks(sch.getRemarks());
  2030 +
  2031 + scheduleRealInfoRepository.save(oldSch);
  2032 + rs.put("status", ResponseCode.SUCCESS);
  2033 + return rs;
  2034 + }
  2035 +
  2036 + @Autowired
  2037 + SvgAttributeRepository svgAttributeRepository;
  2038 +
  2039 + @Override
  2040 + public Map<String, Object> svgAttr(String jsonStr) {
  2041 + Map<String, Object> rs = new HashMap<>();
  2042 +
  2043 + try {
  2044 + JSONObject jObj = JSONObject.parseObject(StringEscapeUtils.unescapeHtml4(jsonStr));
  2045 +
  2046 + SvgAttribute svgAttribute = new SvgAttribute();
  2047 + svgAttribute.setLineCode(jObj.getString("lineCode"));
  2048 + svgAttribute.setHideStations(jObj.getString("hideStations"));
  2049 + svgAttribute.setNicknames(jObj.getString("nicknames"));
  2050 + svgAttributeRepository.save(svgAttribute);
  2051 +
  2052 + rs.put("t", svgAttribute);
  2053 + rs.put("status", ResponseCode.SUCCESS);
  2054 + } catch (Exception e) {
  2055 + logger.error("", e);
  2056 + rs.put("status", ResponseCode.ERROR);
  2057 + }
  2058 + return rs;
  2059 + }
  2060 +
  2061 + @Override
  2062 + public Map<String, Object> findSvgAttr(String idx) {
  2063 + Map<String, Object> rs = new HashMap<>();
  2064 + try {
  2065 + List<String> lineCodes = Splitter.on(",").splitToList(idx);
  2066 + List<SvgAttribute> list = svgAttributeRepository.findSvgAttr(lineCodes);
  2067 +
  2068 + rs.put("status", ResponseCode.SUCCESS);
  2069 + rs.put("list", list);
  2070 + } catch (Exception e) {
  2071 + logger.error("", e);
  2072 + rs.put("status", ResponseCode.ERROR);
  2073 + }
  2074 + return rs;
  2075 + }
  2076 +
  2077 + @Override
  2078 + public List<Map<String, Object>> yesterdayDataList(String line) {
  2079 + // TODO Auto-generated method stub
  2080 + return null;
  2081 + }
847 2082  
848 2083 @Override
849   - public Map<String, Object> schInfoFineTune(Map<String, String> map) {
850   - Map<String, Object> rs = new HashMap<>();
851   - List<ScheduleRealInfo> ts = new ArrayList<>();
852   - try {
853   - Long id = Long.parseLong(map.get("id"));
854   - //班次类型
855   - //String bcType = map.get("bcType");
856   - //车辆自编号
857   - //String clZbh = map.get("clZbh");
858   - //计划发车时间
859   - //String fcsj = map.get("fcsj");
860   - //实际发车时间
861   - String fcsjActual = map.get("fcsjActual");
862   -
863   - //实际终点时间
864   - String zdsjActual = map.get("zdsjActual");
865   - //备注
866   - String remarks = map.get("remarks");
867   -
868   - ScheduleRealInfo sch = dayOfSchedule.get(id);
869   - if(null != sch){
870   -// //驾驶员
871   -// if(StringUtils.isNotBlank(map.get("jsy"))){
872   -// String[] jsy = map.get("jsy").split("/");
873   -// sch.setjGh(jsy[0]);
874   -// sch.setjName(jsy[1]);
875   -// }
876   -
877   - //售票员
878   -// if(StringUtils.isNotBlank(map.get("spy"))){
879   -// String[] spy = map.get("spy").split("/");
880   -// sch.setsGh(spy[0]);
881   -// sch.setsName(spy[1]);
882   -// }
883   -
884   - //sch.setBcType(bcType);
885   - //sch.setClZbh(clZbh);
886   - //sch.setFcsjAll(fcsj);
887   -
888   - if(StringUtils.isNotBlank(fcsjActual)){
889   - LineConfig config = lineConfigData.get(sch.getXlBm());
890   - long t=0L;
891   - //小于线路开始运营时间,则默认跨过24点
892   - if(fcsjActual.compareTo(config.getStartOpt()) < 0)
893   - t=fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME)+fcsjActual);
894   - else
895   - t=fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+fcsjActual);
896   -
897   - //调整实发
898   - if(!fcsjActual.equals(sch.getFcsjActual()))
899   - sch.setFcsjActualAll(t);
900   - }
901   - else{
902   - //撤销实发
903   - if(sch.getFcsjActual() != null)
904   - revokeRealOutgo(sch.getId());
905   - }
906   -
907   - //实达时间
908   - if(StringUtils.isNotBlank(zdsjActual)){
909   - if(!zdsjActual.equals(sch.getZdsjActual())){
910   - //调整实达
911   - sch.setZdsjActualAll(zdsjActual);
912   - //下一班次起点到达时间
913   - ScheduleRealInfo next = dayOfSchedule.next(sch);
914   - if(null != next){
915   - next.setQdzArrDateSJ(zdsjActual);
916   - ts.add(next);
917   - }
918   -
919   - //重新计算车辆执行班次
920   - dayOfSchedule.reCalcExecPlan(sch.getClZbh());
921   - }
922   - }
923   - else {
924   - /*if(sch.getZdsjActual() != null){
925   - //将对应的到离站数据标记为不可信
926   - List<ArrivalEntity> list = ArrivalData_GPS.findByNbbm(sch.getClZbh());
927   - for(ArrivalEntity arr : list){
928   - if(arr.getInOut() == 0
929   - && arr.getUpDown() == Integer.parseInt(sch.getXlDir())
930   - && arr.getStopNo().equals(sch.getZdzCode())
931   - && Math.abs(arr.getTs() - sch.getZdsjActualTime()) < 1000 * 60){
932   - arr.setEnable(false);
933   - break;
934   - }
935   - }
936   - }*/
937   -
938   - //清除实达时间
939   - sch.clearZdsjActual();
940   - //清除下一班次起点到达时间
941   - ScheduleRealInfo next = dayOfSchedule.next(sch);
942   - if(null != next){
943   - next.setQdzArrDateSJ(null);
944   - ts.add(next);
945   - }
946   - }
947   -
948   - sch.setRemarks(remarks);
949   - }
950   -
951   - //班次状态
952   - sch.calcStatus();
953   - dayOfSchedule.save(sch);
954   - //页面需要更新的班次信息
955   - ts.add(sch);
956   -
957   - rs.put("status", ResponseCode.SUCCESS);
958   - rs.put("ts", ts);
959   - } catch (Exception e) {
960   - logger.error("", e);
961   - rs.put("status", ResponseCode.ERROR);
962   - }
963   - return rs;
964   - }
965   -
966   - @Override
967   - public Map<String, Object> outgoAdjustAll(String params) {
968   - Map<String, Object> rs = new HashMap<>();
969   - try{
970   - JSONArray jsonArray = JSONArray.parseArray(params);
971   -
972   - ScheduleRealInfo schedule = null;
973   - JSONObject jsonObj;
974   - String dfsj;
975   - for(int i = 0; i < jsonArray.size(); i ++){
976   - jsonObj = jsonArray.getJSONObject(i);
977   - dfsj = jsonObj.getString("t");
978   - schedule = dayOfSchedule.get(jsonObj.getLong("id"));
979   - //设置待发时间
980   - schedule.setDfsjAll(dfsj);
981   -
982   - dayOfSchedule.save(schedule);
983   - }
984   -
985   - rs.put("status", ResponseCode.SUCCESS);
986   - //将更新的最后一个班次返回
987   - rs.put("t", schedule);
988   - }catch(Exception e){
989   - logger.error("", e);
990   - rs.put("status", ResponseCode.ERROR);
991   - }
992   - return rs;
993   - }
994   -
995   - @Override
996   - public Map<String, Object> findRouteByLine(String lineCode) {
997   - Map<String, Object> map = new HashMap<>();
998   - //上行
999   - Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode);
1000   - map.put("line.id_eq", lineId);
1001   - map.put("directions_eq", 0);
1002   - List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map);
1003   -
1004   - //下行
1005   - map.put("directions_eq", 1);
1006   - List<Map<String, Object>> downList = sectionRouteService.getSectionRoute(map);
1007   -
1008   - Map<String, Object> rs = new HashMap<>();
1009   -
1010   - String upVectors = "", vec;
1011   - //拼接上行路段
1012   - for(Map<String, Object> temp : upList){
1013   - vec = temp.get("sectionBsectionVector").toString();
1014   - upVectors += vec.subSequence(11, vec.length() - 2) + " ";
1015   - }
1016   -
1017   - //拼接下行路段
1018   - String downVectors = "";
1019   - for(Map<String, Object> temp : downList){//LINESTRING(
1020   - vec = temp.get("sectionBsectionVector").toString();
1021   - downVectors += vec.subSequence(11, vec.length() - 2) + " ";
1022   - }
1023   -
1024   -
1025   - rs.put("up", upVectors);
1026   - //上行gcj
1027   - rs.put("up_gcj", BdToGcjString(upVectors));
1028   - rs.put("down", downVectors);
1029   - //下行gcj
1030   - rs.put("down_gcj", BdToGcjString(downVectors));
1031   - rs.put("lineId", lineId);
1032   -
1033   - return rs;
1034   - }
1035   -
1036   - /**
1037   - *
1038   - * @Title: BdToGcjString
1039   - * @Description: TODO(将百度路由字符串 转 成GCJ 字符串)
1040   - * @param @param bdStr
1041   - * @throws
1042   - */
1043   - public String BdToGcjString(String bdStr){
1044   - String[] array = bdStr.split(",")
1045   - ,subArray;
1046   - if(array.length == 0 || bdStr.length() < 2)
1047   - return "";
1048   -
1049   - String gcjStr = "";
1050   - TransGPS.Location location;
1051   - for(String crd : array){
1052   - subArray = crd.split(" ");
1053   - if(subArray.length != 2)
1054   - continue;
1055   - location = TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(subArray[0]), Double.parseDouble(subArray[1])));
1056   -
1057   - gcjStr += location.getLng() + " " + location.getLat() + ",";
1058   - }
  2084 + public List<ScheduleRealInfo> exportWaybillQp(String clZbh, String date, String line) {
  2085 + // TODO Auto-generated method stub
  2086 + ReportUtils ee = new ReportUtils();
  2087 + ReportRelatedUtils rru = new ReportRelatedUtils();
  2088 + List<Iterator<?>> list = new ArrayList<Iterator<?>>();
  2089 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill2( clZbh,date,line);
  2090 + List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
1059 2091  
1060   - return gcjStr.substring(0, gcjStr.length() - 1);
1061   - }
1062   - public List<Map<String, String>> findLine(String line) {
1063   - List<Line> listLine = lineRepository.findLine("%"+line+"%");
1064   - List<Map<String,String>> list = new ArrayList<Map<String,String>>();
1065   - Map<String,String> map;
1066   - for(Line temp:listLine){
1067   - if(temp != null){
1068   - String xlName = temp.getName();
1069   - if(xlName.indexOf(line) != -1){
1070   - map = new HashMap<String, String>();
1071   - map.put("id", temp.getLineCode());
1072   - map.put("text", xlName);
1073   - list.add(map);
1074   - }
1075   - }
1076   - }
1077   - return list;
1078   - }
1079   -
1080   - public List<Map<String, String>> findLpName(String lpName) {
1081   - List<GuideboardInfo> listLpName = guideboardInfoRepository.findLpName("%"+lpName+"%");
1082   - List<Map<String,String>> list = new ArrayList<Map<String,String>>();
1083   - Map<String,String> map;
1084   - for(GuideboardInfo temp:listLpName){
1085   - if(temp != null){
1086   - String lp = temp.getLpName();
1087   - if(lp.indexOf(lpName) != -1){
1088   - map = new HashMap<String, String>();
1089   - map.put("id", lp);
1090   - map.put("text", lp);
1091   - list.add(map);
1092   - }
1093   - }
1094   - }
1095   - return list;
1096   - }
1097   -
1098   - @Override
1099   - public Map<String, Object> findKMBC2(String jName, String clZbh,String date) {
1100   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date);
1101   -
1102 2092 DecimalFormat format = new DecimalFormat("0.00");
1103 2093 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1104 2094 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1105 2095 int jhbc = 0,cjbc = 0,ljbc = 0;
1106   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
  2096 + double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
1107 2097 float addMileage = 0l,remMileage = 0l;
1108   - String j_Name="";
1109   - Map<String,Object> map = new HashMap<String, Object>();
1110   - for(ScheduleRealInfo scheduleRealInfo : list){
  2098 +
  2099 + Map<String,Object> map;
  2100 + for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){
1111 2101 if(scheduleRealInfo != null){
1112   - j_Name=scheduleRealInfo.getjName();
1113   - //计划里程(主任务过滤掉临加班次),
1114   - //烂班里程(主任务烂班),
1115   - //临加里程(主任务临加),
1116   - //计划班次,烂班班次,增加班次
1117   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1118   - if(scheduleRealInfo.isSflj()){
1119   - addMileage += tempJhlc;
1120   - ljbc++;
1121   - }else{
1122   - jhlc += tempJhlc;
1123   - jhbc++;
1124   - if(scheduleRealInfo.getStatus() == -1){
1125   - remMileage += tempJhlc;
1126   - cjbc++;
1127   - }
1128   - }
1129   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1130   - //计算营运里程,空驶里程
1131   - if(childTaskPlans.isEmpty()){
1132   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
1133   - || scheduleRealInfo.getBcType().equals("venting")){
1134   - ksgl += tempJhlc;
  2102 + //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
  2103 + //计划里程(主任务过滤掉临加班次),
  2104 + //烂班里程(主任务烂班),
  2105 + //临加里程(主任务临加),
  2106 + //计划班次,烂班班次,增加班次
  2107 + tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  2108 + if(scheduleRealInfo.isSflj()){
  2109 + ljbc++;
1135 2110 }else{
1136   - yygl += tempJhlc;
1137   - }
1138   - }else{
1139   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1140   - while(it.hasNext()){
1141   - ChildTaskPlan childTaskPlan = it.next();
1142   - if(childTaskPlan.getMileageType().equals("empty")){
1143   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  2111 + jhlc += tempJhlc;
  2112 + jhbc++;
  2113 + if(scheduleRealInfo.getStatus() == -1){
  2114 + remMileage += tempJhlc;
  2115 + cjbc++;
  2116 + }
  2117 + }
  2118 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  2119 + //计算营运里程,空驶里程
  2120 + if(childTaskPlans.isEmpty()){
  2121 + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  2122 + || scheduleRealInfo.getBcType().equals("venting")){
  2123 + ksgl += tempJhlc;
1144 2124 }else{
1145   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  2125 + yygl += tempJhlc;
  2126 + }
  2127 + }else{
  2128 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  2129 + while(it.hasNext()){
  2130 + ChildTaskPlan childTaskPlan = it.next();
  2131 + if(childTaskPlan.getMileageType().equals("empty")){
  2132 + if(scheduleRealInfo.isSflj()){
  2133 + addMileage += tempJhlc;
  2134 + }
  2135 + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  2136 + }else{
  2137 + if(scheduleRealInfo.isSflj()){
  2138 + addMileage += tempJhlc;
  2139 + }
  2140 + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  2141 + }
1146 2142 }
1147 2143 }
1148   - }
  2144 +
  2145 + if(!(scheduleRealInfo.getBcType().equals("in")||scheduleRealInfo.getBcType().equals("out"))){
  2146 + map = new HashMap<String, Object>();
  2147 + try {
  2148 + map = rru.getMapValue(scheduleRealInfo);
  2149 + String zdsj = scheduleRealInfo.getZdsj();
  2150 + String zdsjActual = scheduleRealInfo.getZdsjActual();
  2151 + if(zdsj != null && zdsjActual != null &&
  2152 + !zdsj.equals(zdsjActual)){
  2153 + if(zdsj.compareTo(zdsjActual) > 0){
  2154 + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  2155 + map.put("slow", "");
  2156 + } else {
  2157 + map.put("fast", "");
  2158 + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  2159 + }
  2160 + } else {
  2161 + map.put("fast", "");
  2162 + map.put("slow", "");
  2163 + }
  2164 + listMap.add(map);
  2165 + } catch (Exception e) {
  2166 + e.printStackTrace();
  2167 + }
  2168 + }
1149 2169 }
1150 2170 }
1151   - map.put("j_name", j_Name);
1152   - map.put("jhlc", format.format(jhlc));
1153   - map.put("remMileage", format.format(remMileage));
1154   - map.put("addMileage", format.format(addMileage));
1155   - map.put("yygl", format.format(yygl));
  2171 +
  2172 + //计算里程和班次数,并放入Map里
  2173 + map = new HashMap<String, Object>();
  2174 + map.put("jhlc", format.format(jhlc+jcclc));
  2175 + map.put("yygljh", format.format(jhlc));
  2176 + map.put("ssgl", format.format(remMileage));
1156 2177 map.put("ksgl", format.format(ksgl));
1157   - map.put("realMileage", format.format(yygl+ksgl));
  2178 + map.put("yyglsj", format.format(yygl+remMileage));
1158 2179 map.put("jhbc", jhbc);
1159   - map.put("cjbc", cjbc);
1160   - map.put("ljbc", ljbc);
  2180 + map.put("jcclc", jcclc);
  2181 +
  2182 + map.put("ljgl", format.format(addMileage));
  2183 + map.put("ssbc", cjbc);
  2184 + map.put("ysgl", format.format(yygl));
1161 2185 map.put("sjbc", jhbc-cjbc+ljbc);
1162   - return map;
  2186 + map.put("zgl", format.format(yygl+remMileage+ksgl+jcclc));
  2187 + map.put("ljbc", ljbc);
  2188 +
  2189 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  2190 +
  2191 + list.add(listMap.iterator());
  2192 + ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould\\waybill_qingpu.xls",
  2193 + path+"export\\" + date+"-"+clZbh+"-行车路单.xls");
  2194 + return scheduleRealInfos;
1163 2195 }
1164   -
1165   -
  2196 +
1166 2197 @Override
1167   - public Map<String, Object> findKMBC(String jName, String clZbh,
1168   - String lpName,String date) {
1169   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date);
  2198 + public Map<String, Object> findKMBCQp(String clZbh, String date, String line) {
  2199 + // TODO Auto-generated method stub
  2200 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill2( clZbh,date,line);
1170 2201 DecimalFormat format = new DecimalFormat("0.00");
1171 2202 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1172 2203 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
... ... @@ -1182,7 +2213,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1182 2213 //计划班次,烂班班次,增加班次
1183 2214 tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1184 2215 if(scheduleRealInfo.isSflj()){
1185   - addMileage += tempJhlc;
1186 2216 ljbc++;
1187 2217 }else{
1188 2218 if( !(scheduleRealInfo.getBcType().equals("in")
... ... @@ -1203,12 +2233,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1203 2233 scheduleRealInfo.getBcType().equals("out")){
1204 2234 jcclc +=tempJhlc;
1205 2235 }
  2236 +
1206 2237 //主任务 放空班次属于营运
1207 2238 // else if(scheduleRealInfo.getBcType().equals("venting")){
1208 2239 // ksgl += tempJhlc;
1209 2240 // }
1210 2241 else{
1211 2242 if(scheduleRealInfo.getStatus() != -1){
  2243 + if(scheduleRealInfo.isSflj()){
  2244 + addMileage += tempJhlc;
  2245 + }
1212 2246 yygl += tempJhlc;
1213 2247 }
1214 2248 }
... ... @@ -1220,6 +2254,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1220 2254 if(childTaskPlan.isDestroy()){
1221 2255 remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1222 2256 }else{
  2257 + if(scheduleRealInfo.isSflj()){
  2258 + addMileage += tempJhlc;
  2259 + }
1223 2260 ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1224 2261 }
1225 2262 }else{
... ... @@ -1227,6 +2264,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1227 2264 remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1228 2265 // cjbc++;
1229 2266 }else{
  2267 + if(scheduleRealInfo.isSflj()){
  2268 + addMileage += tempJhlc;
  2269 + }
1230 2270 yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1231 2271 }
1232 2272 }
... ... @@ -1234,113 +2274,32 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1234 2274 }
1235 2275 }
1236 2276 }
1237   - map.put("jhlc", format.format(jhlc));
1238   - map.put("remMileage", format.format(remMileage));
1239   - map.put("addMileage", format.format(addMileage));
1240   - map.put("yygl", format.format(yygl));
  2277 + map.put("jhlc", format.format(jhlc+jcclc));
  2278 + map.put("yygljh", format.format(jhlc));
  2279 + map.put("ssgl", format.format(remMileage));
1241 2280 map.put("ksgl", format.format(ksgl));
1242   - map.put("realMileage", format.format(yygl+ksgl+jcclc));
  2281 + map.put("yyglsj", format.format(yygl+remMileage));
1243 2282 map.put("jhbc", jhbc);
1244   - map.put("cjbc", cjbc);
1245   - map.put("ljbc", ljbc);
1246   - map.put("sjbc", jhbc-cjbc+ljbc);
1247 2283 map.put("jcclc", jcclc);
1248   - map.put("zkslc", format.format(ksgl+jcclc));
1249   - return map;
1250   - }
1251   -
1252   - @Override
1253   - public List<Map<String, Object>> account(String line, String date,
1254   - String code,String xlName, String type) {
1255   - List<Object[]> lsitObj = scheduleRealInfoRepository.account(line,date,code);
1256   - List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
1257   - Map<String,Object> map;
1258   - int i = 1;
1259   - for(Object[] obj : lsitObj){
1260   - if(obj != null){
1261   - map = new HashMap<String,Object>();
1262   - map.put("num", i++);
1263   - map.put("xlName", xlName);
1264   - map.put("clZbh", obj[3]);
1265   - map.put("company", obj[0]);
1266   - map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[1]+"")).toUpperCase());
1267   - map.put("requestTime", obj[2]);
1268   - listMap.add(map);
1269   - }
1270   - }
1271   -
1272   - if(type != null && type.length() != 0 && type.equals("export")){
1273   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1274   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
1275   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1276   - Map<String,Object> m = new HashMap<String, Object>();
1277   - ReportUtils ee = new ReportUtils();
1278   - Map<String, Object> typeMap = new HashMap<String, Object>();
1279   - typeMap.put("0xA1", "请求恢复运营");
1280   - typeMap.put("0xA2", "申请调档");
1281   - typeMap.put("0xA3", "出场请求");
1282   - typeMap.put("0xA5", "进场请求");
1283   - typeMap.put("0xA7", "加油请求");
1284   - typeMap.put("0x50", "车辆故障");
1285   - typeMap.put("0x70", "路阻报告");
1286   - typeMap.put("0x60", "事故报告");
1287   - typeMap.put("0x11", "扣证纠纷");
1288   - typeMap.put("0x12", "报警");
1289   - for(Map<String, Object> map1 : listMap){
1290   - map1.put("requestText", typeMap.get(map1.get("requestType")));
1291   - }
1292   - try {
1293   - listI.add(listMap.iterator());
1294   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
1295   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\account.xls",
1296   - path+"export\\驾驶员请求台账" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
1297   - } catch (Exception e) {
1298   - // TODO: handle exception
1299   - e.printStackTrace();
1300   - }
1301   - }
1302   -
1303   - return listMap;
1304   - }
1305   -
1306   - @Override
1307   - public List<ScheduleRealInfo> correctForm(String line, String startDate,
1308   - String endDate, String lpName, String code, String type) {
1309   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line,startDate,endDate,lpName,code);
1310   -
1311   - if(type != null && type.length() != 0 && type.equals("export")){
1312   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1313   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
1314   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1315   - Map<String,Object> m = new HashMap<String, Object>();
1316   - ReportUtils ee = new ReportUtils();
1317   - m.put("startDate", startDate);
1318   - m.put("endDate", endDate);
1319   - try {
1320   - listI.add(list.iterator());
1321   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
1322   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\correctForm.xls",
1323   - path+"export\\" + URLEncoder.encode("修正报表", "UTF-8") + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
1324   - } catch (Exception e) {
1325   - // TODO: handle exception
1326   - e.printStackTrace();
1327   - }
1328   - }
1329 2284  
1330   - return list;
  2285 + map.put("ljgl", format.format(addMileage));
  2286 + map.put("ssbc", cjbc);
  2287 + map.put("ysgl", format.format(yygl));
  2288 + map.put("sjbc", jhbc-cjbc+ljbc);
  2289 + map.put("zgl", format.format(yygl+remMileage+ksgl+jcclc));
  2290 + map.put("ljbc", ljbc);
  2291 + return map;
1331 2292 }
1332 2293  
1333 2294 @Override
1334   - public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1335   - String lpName,String date,String type) {
  2295 + public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) {
  2296 + // TODO Auto-generated method stub
1336 2297 List <ScheduleRealInfo> list=null;
1337   - if(type.equals("qp")){
1338   - list= scheduleRealInfoRepository.queryListWaybill2(jName,clZbh,lpName,date);
1339   - }else{
1340   - list= scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName,date);
1341   - }
1342   - for (int i = 0; i < list.size(); i++) {
1343   - ScheduleRealInfo s=list.get(i);
  2298 + list= scheduleRealInfoRepository.queryListWaybill2(clZbh,date,line);
  2299 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  2300 + for (int i = 0; i < list.size(); i++) {
  2301 + ScheduleRealInfo s=list.get(i);
  2302 + if(!(s.getBcType().equals("in")||s.getBcType().equals("out"))){
1344 2303 String remarks="";
1345 2304 if(s.getRemarks()!=null){
1346 2305 remarks +=s.getRemarks();
... ... @@ -1357,703 +2316,61 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1357 2316 }
1358 2317 }
1359 2318 s.setRemarks(remarks);
  2319 + newList.add(s);
1360 2320 }
1361 2321  
1362   - return list;
1363   - }
1364   -
1365   - @Override
1366   - public Map<String, Object> removeChildTask(Long taskId) {
1367   - Map<String, Object> rs = new HashMap<>();
1368   - ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);
1369   -
1370   - ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());
1371   - try {
1372   -
1373   - sch.getcTasks().remove(chTask);
1374   - scheduleRealInfoRepository.save(sch);
1375   - rs.put("status", ResponseCode.SUCCESS);
1376   - } catch (Exception e) {
1377   - logger.error("", e);
1378   - rs.put("status", ResponseCode.ERROR);
1379   - }
1380   - return rs;
1381   - }
1382   -
1383   - @Override
1384   - public List<Map<String, Object>> statisticsDaily(String line, String date,
1385   - String xlName) {
1386   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1387   - List<Map<String,Object>> lMap = new ArrayList<Map<String,Object>>();
1388   - DecimalFormat format = new DecimalFormat("0.00");
1389   - double jhlc = 0, tempJhlc = 0,childMileage = 0;
1390   - float sjgl = 0f,ssgl = 0f,ssgl_lz = 0f,ssgl_dm = 0f,ssgl_gz = 0f,ssgl_jf = 0f,ssgl_zs = 0f,ssgl_qr = 0f
1391   - ,ssgl_qc = 0f,ssgl_kx = 0f,ssgl_qh = 0f,ssgl_yw = 0f,ssgl_other = 0f,ljgl = 0f;
1392   - //班次
1393   - int sj_0 = 6*60+31,sj_1 = 8*60+30,sj_2 = 16*60+1,sj_3 = 18*60;
1394   - int jhbc = 0,jhbc_m = 0,jhbc_a = 0;
1395   - int sjbc = 0,sjbc_m = 0,sjbc_a = 0;
1396   - int ljbc = 0,ljbc_m = 0,ljbc_a = 0;
1397   - int fzbc = 0,fzbc_m = 0,fzbc_a = 0;
1398   - int dtbc = 0,dtbc_m = 0,dtbc_a = 0;
1399   - int djg = 0,djg_m = 0,djg_a = 0,djg_time = 0;
1400   - Map<String,Object> map = new HashMap<String, Object>();
1401   - for(ScheduleRealInfo scheduleRealInfo: list){
1402   - if(scheduleRealInfo != null){
1403   -
1404   - if(!(scheduleRealInfo.getBcType().equals("in")
1405   - ||scheduleRealInfo.getBcType().equals("out")) ){
1406   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1407   - //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
1408   - if(childTaskPlans.isEmpty()){
1409   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1410   - //临加公里
1411   - if(scheduleRealInfo.isSflj()){
1412   - ljgl += tempJhlc;
1413   - }else{
1414   - jhlc += tempJhlc;
1415   - }
1416   - if(scheduleRealInfo.getStatus() == 2){
1417   - sjgl += tempJhlc;
1418   - }else if(scheduleRealInfo.getStatus() == -1){
1419   - ssgl += tempJhlc;
1420   - if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("路阻") != -1){
1421   - ssgl_lz += tempJhlc;
1422   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("吊慢") != -1){
1423   - ssgl_dm += tempJhlc;
1424   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("故障") != -1){
1425   - ssgl_gz += tempJhlc;
1426   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("纠纷") != -1){
1427   - ssgl_jf += tempJhlc;
1428   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("肇事") != -1){
1429   - ssgl_zs += tempJhlc;
1430   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("缺人") != -1){
1431   - ssgl_qr += tempJhlc;
1432   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("缺车") != -1){
1433   - ssgl_qc += tempJhlc;
1434   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("客稀") != -1){
1435   - ssgl_kx += tempJhlc;
1436   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("气候") != -1){
1437   - ssgl_qh += tempJhlc;
1438   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("援外") != -1){
1439   - ssgl_yw += tempJhlc;
1440   - }else{
1441   - ssgl_other += tempJhlc;
1442   - }
1443   - }
1444   - }else{
1445   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1446   - while(it.hasNext()){
1447   - ChildTaskPlan childTaskPlan = it.next();
1448   - childMileage = childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1449   - jhlc += childMileage;
1450   - if(childTaskPlan.isDestroy()){
1451   - ssgl += childMileage;
1452   - if(childTaskPlan.getDestroyReason().equals("路阻")){
1453   - ssgl_lz += childTaskPlan.getMileage();
1454   - }else if(childTaskPlan.getDestroyReason().equals("吊慢")){
1455   - ssgl_dm += childTaskPlan.getMileage();
1456   - }else if(childTaskPlan.getDestroyReason().equals("故障")){
1457   - ssgl_gz += childTaskPlan.getMileage();
1458   - }else if(childTaskPlan.getDestroyReason().equals("纠纷")){
1459   - ssgl_jf += childTaskPlan.getMileage();
1460   - }else if(childTaskPlan.getDestroyReason().equals("肇事")){
1461   - ssgl_zs += childTaskPlan.getMileage();
1462   - }else if(childTaskPlan.getDestroyReason().equals("缺人")){
1463   - ssgl_qr += childTaskPlan.getMileage();
1464   - }else if(childTaskPlan.getDestroyReason().equals("缺车")){
1465   - ssgl_qc += childTaskPlan.getMileage();
1466   - }else if(childTaskPlan.getDestroyReason().equals("客稀")){
1467   - ssgl_kx += childTaskPlan.getMileage();
1468   - }else if(childTaskPlan.getDestroyReason().equals("气候")){
1469   - ssgl_qh += childTaskPlan.getMileage();
1470   - }else if(childTaskPlan.getDestroyReason().equals("援外")){
1471   - ssgl_yw += childTaskPlan.getMileage();
1472   - }else{
1473   - ssgl_other += childTaskPlan.getMileage();
1474   - }
1475   - }else{
1476   - sjgl += childMileage;
1477   - }
1478   - }
1479   - }
1480   -
1481   - //班次
1482   - jhbc++;
1483   - String[] fcsj = scheduleRealInfo.getFcsj().split(":");
1484   - String[] fcsjActual = (scheduleRealInfo.getFcsjActual()==null?"0:00":scheduleRealInfo.getFcsjActual()).split(":");
1485   - if((Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) > sj_0 && (Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) < sj_1){
1486   - jhbc_m++;
1487   - }else if((Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) > sj_2 && (Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) < sj_3){
1488   - jhbc_a++;
1489   - }
1490   - if(scheduleRealInfo.getStatus() == 2){
1491   - sjbc++;
1492   - if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_1){
1493   - sjbc_m++;
1494   - }else if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_3){
1495   - sjbc_a++;
1496   - }
1497   - }
1498   - if(scheduleRealInfo.isSflj()){
1499   - ljbc++;
1500   - if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_1){
1501   - ljbc_m++;
1502   - }else if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_3){
1503   - ljbc_a++;
1504   - }
1505   - }
1506   - if(scheduleRealInfo.getBcType().equals("venting")){
1507   - fzbc++;
1508   - if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_1){
1509   - fzbc_m++;
1510   - }else if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_3){
1511   - fzbc_a++;
1512   - }
1513   - }
1514   - }
1515   - }
1516   - }
1517   - map.put("xlName", xlName);
1518   - map.put("jhlc", format.format(jhlc));
1519   - map.put("sjgl", format.format(sjgl));
1520   - map.put("ssgl", format.format(ssgl));
1521   - map.put("ssgl_lz", ssgl_lz==0?0:format.format(ssgl_lz));
1522   - map.put("ssgl_dm", ssgl_dm==0?0:format.format(ssgl_dm));
1523   - map.put("ssgl_gz", ssgl_gz==0?0:format.format(ssgl_gz));
1524   - map.put("ssgl_jf", ssgl_jf==0?0:format.format(ssgl_jf));
1525   - map.put("ssgl_zs", ssgl_zs==0?0:format.format(ssgl_zs));
1526   - map.put("ssgl_qr", ssgl_qr==0?0:format.format(ssgl_qr));
1527   - map.put("ssgl_qc", ssgl_qc==0?0:format.format(ssgl_qc));
1528   - map.put("ssgl_kx", ssgl_kx==0?0:format.format(ssgl_kx));
1529   - map.put("ssgl_qh", ssgl_qh==0?0:format.format(ssgl_qh));
1530   - map.put("ssgl_yw", ssgl_yw==0?0:format.format(ssgl_yw));
1531   - map.put("ssgl_other", ssgl_other==0?0:format.format(ssgl_other));
1532   - map.put("ljgl", ljgl==0?0:format.format(ljgl));
1533   - map.put("jhbc", jhbc);
1534   - map.put("jhbc_m", jhbc_m);
1535   - map.put("jhbc_a", jhbc_a);
1536   - map.put("sjbc", sjbc);
1537   - map.put("sjbc_m", sjbc_m);
1538   - map.put("sjbc_a", sjbc_a);
1539   - map.put("ljbc", ljbc);
1540   - map.put("ljbc_m", ljbc_m);
1541   - map.put("ljbc_a", ljbc_a);
1542   - map.put("fzbc", fzbc);
1543   - map.put("fzbc_m", fzbc_m);
1544   - map.put("fzbc_a", fzbc_a);
1545   - map.put("dtbc", dtbc);
1546   - map.put("dtbc_m", dtbc_m);
1547   - map.put("dtbc_a", dtbc_a);
1548   - map.put("djg", djg);
1549   - map.put("djg_m", djg_m);
1550   - map.put("djg_a", djg_a);
1551   - map.put("djg_time", djg_time);
1552   - lMap.add(map);
1553   - return lMap;
1554 2322 }
1555 2323  
1556   - @Override
1557   - public Map<String,Object> scheduleDaily(String line, String date) {
1558   - Map<String,String> tempMap = null;
1559   - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1560   - Map<String, Object> map = new HashMap<String, Object>();
1561   - Double jhlc = 0.00;
1562   - Float sjgl = 0f,ssgl = 0f,ssgl_lz = 0f,ssgl_dm = 0f,ssgl_gz = 0f,ssgl_jf = 0f,ssgl_zs = 0f,ssgl_qr = 0f
1563   - ,ssgl_qc = 0f,ssgl_kx = 0f,ssgl_qh = 0f,ssgl_yw = 0f,ssgl_other = 0f,ljgl = 0f;
1564   - int jhbc = 0;
1565   - for(ScheduleRealInfo scheduleRealInfo:scheduleRealInfos){
1566   - if(scheduleRealInfo != null){
1567   - //计算里程(包括子任务)
1568   - jhlc += scheduleRealInfo.getJhlc();
1569   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1570   - if(!childTaskPlans.isEmpty()){
1571   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1572   - while(it.hasNext()){
1573   - ChildTaskPlan childTaskPlan = it.next();
1574   - //是否烂班,烂班就是少驶
1575   - if(!childTaskPlan.isDestroy()){
1576   - sjgl += childTaskPlan.getMileage();
1577   - }else{
1578   - ssgl += childTaskPlan.getMileage();
1579   - if(childTaskPlan.getDestroyReason().equals("路阻")){
1580   - ssgl_lz += childTaskPlan.getMileage();
1581   - }else if(childTaskPlan.getDestroyReason().equals("吊慢")){
1582   - ssgl_dm += childTaskPlan.getMileage();
1583   - }else if(childTaskPlan.getDestroyReason().equals("故障")){
1584   - ssgl_gz += childTaskPlan.getMileage();
1585   - }else if(childTaskPlan.getDestroyReason().equals("纠纷")){
1586   - ssgl_jf += childTaskPlan.getMileage();
1587   - }else if(childTaskPlan.getDestroyReason().equals("肇事")){
1588   - ssgl_zs += childTaskPlan.getMileage();
1589   - }else if(childTaskPlan.getDestroyReason().equals("缺人")){
1590   - ssgl_qr += childTaskPlan.getMileage();
1591   - }else if(childTaskPlan.getDestroyReason().equals("缺车")){
1592   - ssgl_qc += childTaskPlan.getMileage();
1593   - }else if(childTaskPlan.getDestroyReason().equals("客稀")){
1594   - ssgl_kx += childTaskPlan.getMileage();
1595   - }else if(childTaskPlan.getDestroyReason().equals("气候")){
1596   - ssgl_qh += childTaskPlan.getMileage();
1597   - }else if(childTaskPlan.getDestroyReason().equals("援外")){
1598   - ssgl_yw += childTaskPlan.getMileage();
1599   - }else{
1600   - ssgl_other += childTaskPlan.getMileage();
1601   - }
1602   - }
1603   - //临加公里
1604   - if(childTaskPlan.getType1().equals("临加")){
1605   - ljgl += childTaskPlan.getMileage();
1606   - }
1607   - }
1608   - }
1609   - //班次
1610   - scheduleRealInfo.getFcsjT();
1611   - scheduleRealInfo.getFcsjActualTime();
1612   - }
1613   - }
1614   - map.put("jhlc", jhlc);
1615   - map.put("sjgl", sjgl);
1616   - map.put("ssgl", ssgl);
1617   - map.put("ssgl_lz", ssgl_lz);
1618   - map.put("ssgl_dm", ssgl_dm);
1619   - map.put("ssgl_gz", ssgl_gz);
1620   - map.put("ssgl_jf", ssgl_jf);
1621   - map.put("ssgl_zs", ssgl_zs);
1622   - map.put("ssgl_qr", ssgl_qr);
1623   - map.put("ssgl_qc", ssgl_qc);
1624   - map.put("ssgl_kx", ssgl_kx);
1625   - map.put("ssgl_qh", ssgl_qh);
1626   - map.put("ssgl_yw", ssgl_yw);
1627   - map.put("ssgl_other", ssgl_other);
1628   - map.put("ljgl", ljgl);
1629   -
1630   - map.put("jhbc", scheduleRealInfos.size());
1631   - return null;
1632   - }
1633   -
1634   - @Override
1635   - public int countByLineCodeAndDate(String xlBm, String schDate) {
1636   - return scheduleRealInfoRepository.countByLineCodeAndDate(xlBm + "", schDate);
  2324 + return newList;
1637 2325 }
1638 2326  
1639 2327 @Override
1640   - public List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate) {
1641   - return scheduleRealInfoRepository.findByLineCodeAndDate(xlBm + "", schDate);
1642   - }
1643   -
1644   - @Override
1645   - public void deleteByLineCodeAndDate(String xlBm, String schDate) {
1646   - scheduleRealInfoRepository.deleteByLineCodeAndDate(xlBm + "", schDate);
1647   - }
1648   -
1649   - @Override
1650   - public Long getMaxId() {
1651   - return scheduleRealInfoRepository.getMaxId();
1652   - }
1653   -
1654   - @Override
1655   - public List<ScheduleRealInfo> realScheduleList(String line, String date) {
1656   - /*List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.queryUserInfo(line, date);
1657   - List<ScheduleRealInfo> listTotal = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1658   - for(ScheduleRealInfo info:listInfo){
1659   - for(ScheduleRealInfo total:listTotal){
1660   - if(info.getjGh().equals(total.getjGh()) && info.getLpName().equals(total.getLpName()) && info.getClZbh().equals(total.getClZbh())){
1661   -
1662   - }
1663   - }
1664   - }*/
1665   - return scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1666   - }
1667   -
1668   -
1669   - public List<Map<String,Object>> yesterdayDataList(String line,String date) {
1670   - //前一天日期
1671   -// String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
1672   -// String date = "2016-09-20";
1673   - List<Map<String,Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
1674   -// List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1675   - for(int x=0;x<yesterdayDataList.size();x++){
1676   - String jName=yesterdayDataList.get(x).get("jGh").toString();
1677   - String clZbh=yesterdayDataList.get(x).get("clZbh").toString();
1678   - List<ScheduleRealInfo> lists=scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
1679   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
1680   - float addMileage = 0l,remMileage = 0l;
1681   - Map<String,Object> map = new HashMap<String, Object>();
1682   - boolean fage=true;
1683   - for(ScheduleRealInfo scheduleRealInfo : lists){
1684   - if(fage){
1685   - //根据线路代码获取公司
1686   - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
1687   - yesterdayDataList.get(x).put("company", li.getCompany());
1688   - yesterdayDataList.get(x).put("bCompany", li.getBrancheCompany());
1689   - fage=false;
1690   - }
1691   - if(scheduleRealInfo != null){
1692   - //计划里程(主任务过滤掉临加班次),
1693   - //烂班里程(主任务烂班),
1694   - //临加里程(主任务临加),
1695   - //计划班次,烂班班次,增加班次
1696   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1697   - if(scheduleRealInfo.isSflj()){
1698   - addMileage += tempJhlc;
1699   - }else{
1700   - if( !(scheduleRealInfo.getBcType().equals("in")
1701   - ||scheduleRealInfo.getBcType().equals("out")) ){
1702   - jhlc += tempJhlc;
1703   - }
1704   -
1705   - if(scheduleRealInfo.getStatus() == -1){
1706   - remMileage += tempJhlc;
1707   - }
1708   - }
1709   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1710   - //计算营运里程,空驶里程
1711   - if(childTaskPlans.isEmpty()){
1712   - if(scheduleRealInfo.getBcType().equals("in") ||
1713   - scheduleRealInfo.getBcType().equals("out")){
1714   - jcclc +=tempJhlc;
1715   - }
1716   - //主任务 放空班次属于营运
1717   -// else if(scheduleRealInfo.getBcType().equals("venting")){
1718   -// ksgl += tempJhlc;
1719   -// }
1720   - else{
1721   - if(scheduleRealInfo.getStatus() != -1){
1722   - yygl += tempJhlc;
  2328 + public Map<String, Object> MapById(Long id) {
  2329 + // TODO Auto-generated method stub
  2330 + Map<String, Object> map=new HashMap<String, Object>();
  2331 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  2332 + ScheduleRealInfo s=scheduleRealInfoRepository.findOne(id);
  2333 + String xlbm=s.getXlBm();
  2334 + String fcrq=s.getScheduleDateStr();
  2335 +
  2336 +
  2337 + map.put("xlName", s.getXlName());
  2338 + map.put("clZbh", s.getClZbh());
  2339 + map.put("fcsjActual", s.getFcsjActual());
  2340 + map.put("zdzName", s.getZdzName());
  2341 + map.put("scheduleDate", s.getScheduleDateStr());
  2342 + String zdp="",zwdp="",wdp="";
  2343 +
  2344 + List<DutyEmployee> list= dutyEmployeeService.getDutyEmployee(xlbm, fcrq+"00:00", fcrq+"23:59");
  2345 + try {
  2346 + Long fcsj1=sdf.parse(fcrq+" 03:00").getTime();
  2347 + Long fcsj2=sdf.parse(fcrq+" 11:00").getTime();
  2348 + Long fcsj3=sdf.parse(fcrq+" 22:00").getTime();
  2349 + for(int i=0;i<list.size();i++){
  2350 + DutyEmployee t=list.get(i);
  2351 + Long ts=t.getTs();
  2352 + if(ts>fcsj1&&ts<fcsj2){
  2353 + if(zdp.indexOf(t.getuName())==-1){
  2354 + zdp +=t.getuName()+",";
1723 2355 }
1724   - }
1725   - }else{
1726   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1727   - while(it.hasNext()){
1728   - ChildTaskPlan childTaskPlan = it.next();
1729   - if(childTaskPlan.getMileageType().equals("empty")){
1730   - if(childTaskPlan.isDestroy()){
1731   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1732   - }else{
1733   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1734   - }
1735   - }else{
1736   - if(childTaskPlan.isDestroy()){
1737   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1738   - }else{
1739   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1740   - }
1741   - }
1742   - }
1743   - }
1744   - }
1745   - }
1746   -
1747   - yesterdayDataList.get(x).put("totalKilometers", yygl+ksgl+jcclc);
1748   -
1749   - }
1750   -
1751   - /* for(ScheduleRealInfo scheduleRealInfo:list){
1752   - if(scheduleRealInfo != null){
1753   - for(int i=0;i<yesterdayDataList.size();i++){
1754   - if(scheduleRealInfo.getXlBm().equals(yesterdayDataList.get(i).get("xlBm")) && scheduleRealInfo.getClZbh().equals(yesterdayDataList.get(i).get("clZbh"))
1755   - && scheduleRealInfo.getjGh().equals(yesterdayDataList.get(i).get("jGh"))){
1756   - //根据线路代码获取公司
1757   - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
1758   - yesterdayDataList.get(i).put("company", li.getCompany());
1759   - yesterdayDataList.get(i).put("bCompany", li.getBrancheCompany());
1760   - //计算总公里
1761   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1762   - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
1763   - if(childTaskPlans.isEmpty()){
1764   - if(scheduleRealInfo.getStatus() == 2){
1765   - yesterdayDataList.get(i).put("totalKilometers", scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
  2356 + }else if(ts>fcsj2 && ts<fcsj3){
  2357 + if(zwdp.indexOf(t.getuName())==-1){
  2358 + zwdp +=t.getuName()+",";
1766 2359 }
1767 2360 }else{
1768   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1769   - while(it.hasNext()){
1770   - ChildTaskPlan childTaskPlan = it.next();
1771   - if(!childTaskPlan.isDestroy()){
1772   - yesterdayDataList.get(i).put("totalKilometers", childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
1773   - }
  2361 + if(wdp.indexOf(t.getuName())==-1){
  2362 + wdp +=t.getuName()+",";
1774 2363 }
1775 2364 }
1776   - }
1777   - }
1778   - }
1779   - }*/
1780   - //增加顺序号
1781   - for(int i=0;i<yesterdayDataList.size();i++){
1782   - if(i == 0){
1783   - yesterdayDataList.get(i).put("seqNumber", 1);
1784   - }else{
1785   - if(yesterdayDataList.get(i-1).get("clZbh").equals(yesterdayDataList.get(i).get("clZbh"))){
1786   - yesterdayDataList.get(i).put("seqNumber", 1+(int)yesterdayDataList.get(i-1).get("seqNumber"));
1787   - }else{
1788   - yesterdayDataList.get(i).put("seqNumber", 1);
1789   - }
1790   - }
1791   - }
1792   - return yesterdayDataList;
1793   - }
1794   -
1795   - /**
1796   - * 批量调整人车
1797   - */
1798   - @Override
1799   - public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs) {
1800   - Map<String, Object> rs = new HashMap<>();
1801   - Set<ScheduleRealInfo> set = new HashSet<>();
1802   -
1803   - ScheduleRealInfo sch;
1804   -
1805   - for(ChangePersonCar cpc : cpcs){
1806   -
1807   - sch = dayOfSchedule.get(cpc.getSchId());
1808   - if(sch==null)
1809   - continue;
1810   -
1811   - if(StringUtils.isNotEmpty(cpc.getJsy())){
1812   - //换驾驶员
1813   - persoChange(sch, cpc.getJsy().split("/")[0]);
1814   - }
1815   -
1816   - //换售票员
1817   - if(StringUtils.isNotEmpty(cpc.getSpy())){
1818   - persoChangeSPY(sch, cpc.getSpy().split("/")[0]);
1819   - }
1820   -
1821   - //换车
1822   - if(StringUtils.isNotEmpty(cpc.getClZbh())){
1823   - set.add(sch);
1824   - set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh()));
1825   - }
1826   -
1827   - }
1828   - rs.put("ts", set);
1829   - rs.put("status", ResponseCode.SUCCESS);
1830   - return rs;
1831   - }
1832   -
1833   - /**
1834   - *
1835   - * @Title: persoChange
1836   - * @Description: TODO(班次换驾驶员)
1837   - */
1838   - public void persoChange(ScheduleRealInfo sch, String jGh){
1839   - if(sch.getjGh().equals(jGh))
1840   - return;
1841   - String jName = BasicData.allPerson.get(jGh);
1842   - if(StringUtils.isNotEmpty(jName)){
1843   - sch.setjGh(jGh);
1844   - sch.setjName(jName);
1845   - }
1846   - }
1847   -
1848   - /**
1849   - *
1850   - * @Title: persoChange
1851   - * @Description: TODO(班次换售票员)
1852   - */
1853   - public void persoChangeSPY(ScheduleRealInfo sch, String sGh){
1854   - if(sch.getsGh().equals(sGh))
1855   - return;
1856   - String sName = BasicData.allPerson.get(sGh);
1857   - if(StringUtils.isNotEmpty(sName)){
1858   - sch.setsGh(sGh);
1859   - sch.setsName(sName);
1860   - }
1861   - }
1862   -
1863   - /**
1864   - * 批量待发调整
1865   - */
1866   - @Override
1867   - public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) {
1868   - Map<String, Object> rs = new HashMap<>()
1869   - ,tempMap = new HashMap<>();
1870   - List<ScheduleRealInfo> list = new ArrayList<>();
1871   -
1872   - ScheduleRealInfo sch,next;
1873   - for(DfsjChange dc : dfsjcs){
1874   - if(StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj()))
1875   - continue;
1876   -
1877   - /*sch = dayOfSchedule.get(dc.getSchId());
1878   - if(sch==null)
1879   - continue;
1880   -
1881   - sch.setDfsjAll(dc.getNew_dfsj());
1882   - //重新计算终点时间
1883   - sch.calcEndTime();
1884   - list.add(sch);*/
1885   - tempMap = outgoAdjust(dc.getSchId(),"", dc.getNew_dfsj());
1886   -
1887   - if(tempMap.get("status").equals(ResponseCode.SUCCESS)){
1888   - list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts"));
1889   - }
1890   - //next=dayOfSchedule.next(sch);
1891   - /*if(next.getQdzName().equals(sch.getZdzName())){
1892   - next.setQdzArrDateJH(sch.getZdsj());
1893   - list.add(next);
1894   - }*/
1895   - }
1896   -
1897   - rs.put("status", ResponseCode.SUCCESS);
1898   - rs.put("ts", list);
1899   - return rs;
1900   - }
1901   -
1902   -
1903   - @Override
1904   - public Map<String, Object> findKMBC1(String jName, String clZbh,
1905   - String date, String enddate) {
1906   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate);
1907   - DecimalFormat format = new DecimalFormat("0.00");
1908   -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1909   -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1910   - int jhbc = 0,cjbc = 0,ljbc = 0;
1911   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
1912   - float addMileage = 0l,remMileage = 0l;
1913   - Map<String,Object> map = new HashMap<String, Object>();
1914   - for(ScheduleRealInfo scheduleRealInfo : list){
1915   - if(scheduleRealInfo != null){
1916   - //计划里程(主任务过滤掉临加班次),
1917   - //烂班里程(主任务烂班),
1918   - //临加里程(主任务临加),
1919   - //计划班次,烂班班次,增加班次
1920   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1921   - if(scheduleRealInfo.isSflj()){
1922   - addMileage += tempJhlc;
1923   - ljbc++;
1924   - }else{
1925   - jhlc += tempJhlc;
1926   - jhbc++;
1927   - if(scheduleRealInfo.getStatus() == -1){
1928   - remMileage += tempJhlc;
1929   - cjbc++;
1930   - }
1931   - }
1932   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1933   - //计算营运里程,空驶里程
1934   - if(childTaskPlans.isEmpty()){
1935   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
1936   - || scheduleRealInfo.getBcType().equals("venting")){
1937   - ksgl += tempJhlc;
1938   - }else{
1939   - yygl += tempJhlc;
1940   - }
1941   - }else{
1942   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1943   - while(it.hasNext()){
1944   - ChildTaskPlan childTaskPlan = it.next();
1945   - if(childTaskPlan.getMileageType().equals("empty")){
1946   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1947   - }else{
1948   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1949   - }
1950 2365 }
  2366 + } catch (ParseException e) {
  2367 + // TODO Auto-generated catch block
  2368 + e.printStackTrace();
1951 2369 }
1952   - }
1953   - }
1954   - map.put("jhlc", format.format(jhlc));
1955   - map.put("remMileage", format.format(remMileage));
1956   - map.put("addMileage", format.format(addMileage));
1957   - map.put("yygl", format.format(yygl));
1958   - map.put("ksgl", format.format(ksgl));
1959   - map.put("realMileage", format.format(yygl+ksgl));
1960   - map.put("jhbc", jhbc);
1961   - map.put("cjbc", cjbc);
1962   - map.put("ljbc", ljbc);
1963   - map.put("sjbc", jhbc-cjbc+ljbc);
1964   - return map;
1965   - }
1966   -
1967   - /**
1968   - * 调整班次类型
1969   - * @param id
1970   - * @param bcType
1971   - * @param remarks
1972   - * @return
1973   - */
1974   - @Override
1975   - public Map<String, Object> changeBcType(Long id, String bcType, String remarks) {
1976   - Map<String, Object> rs = new HashMap<>();
1977   -
1978   - try {
1979   - ScheduleRealInfo sch = dayOfSchedule.get(id);
1980   - if(sch != null){
1981   - sch.setBcType(bcType);
1982   - sch.addRemarks(remarks);
1983   - //有时间记录一下相关变更数据
1984   - rs.put("status", ResponseCode.SUCCESS);
1985   - rs.put("t", sch);
1986   - }
1987   - } catch (Exception e) {
1988   - logger.error("", e);
1989   - rs.put("status", ResponseCode.ERROR);
1990   - }
1991   -
1992   - return rs;
1993   - }
1994   -
1995   - @Override
1996   - public Map<String, Object> historySave(ScheduleRealInfo sch) {
1997   - Map<String, Object> rs = new HashMap<>();
1998   - rs.put("status", ResponseCode.ERROR);
1999   -
2000   - ScheduleRealInfo oldSch = super.findById(sch.getId());
2001   - //修改车辆
2002   - if(!oldSch.getClZbh().equals(sch.getClZbh())){
2003   - Set<String> allCar=BasicData.deviceId2NbbmMap.values();
2004   - if(!allCar.contains(sch.getClZbh())){
2005   - rs.put("msg", "无效的车辆自编号");
2006   - return rs;
2007   - }
2008   - else
2009   - oldSch.setClZbh(sch.getClZbh());
2010   - }
2011   -
2012   - //修改驾驶员
2013   - if(!oldSch.getjGh().equals(sch.getjGh())){
2014   - Map<String, String> allPer = BasicData.allPerson;
2015   - if(!allPer.containsKey(sch.getjGh())){
2016   - rs.put("msg", "无效的驾驶员");
2017   - return rs;
2018   - }
2019   - else{
2020   - oldSch.setjGh(sch.getjGh());
2021   - oldSch.setjName(allPer.get(oldSch.getjGh()));
2022   - }
2023   - }
2024   -
2025   - //修改售票员
2026   -/* if(!oldSch.getsGh().equals(sch.getsGh())){
2027   - Map<String, String> allPer = BasicData.allPerson;
2028   -
2029   - if(StringUtils.isNotEmpty(sch.getsGh())){
2030   - if(!allPer.containsKey(sch.getsGh())){
2031   - rs.put("msg", "无效的售票员");
2032   - return rs;
2033   - }
2034   - }
2035   - oldSch.setsGh(sch.getsGh());
2036   - oldSch.setsName(allPer.get(oldSch.getsGh()));
2037   - }*/
2038   -
2039   - //待发时间
2040   - oldSch.setDfsj(sch.getDfsj());
2041   - //实发时间
2042   - oldSch.setFcsjActual(sch.getFcsjActual());
2043   - //实际终点
2044   - oldSch.setZdsjActual(sch.getZdsjActual());
2045   - //备注
2046   - oldSch.setRemarks(sch.getRemarks());
2047   -
2048   - scheduleRealInfoRepository.save(oldSch);
2049   - rs.put("status", ResponseCode.SUCCESS);
2050   - return rs;
2051   - }
2052   -
2053   - @Override
2054   - public List<Map<String, Object>> yesterdayDataList(String line) {
2055   - // TODO Auto-generated method stub
2056   - return null;
  2370 + map.put("zdp", zdp);
  2371 + map.put("zwdp", zwdp);
  2372 + map.put("wdp", wdp);
  2373 + return map;
2057 2374 }
2058 2375  
2059   -}
  2376 +}
2060 2377 \ No newline at end of file
... ...
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
... ... @@ -17,6 +17,7 @@ import java.util.List;
17 17 import java.util.Map;
18 18 import java.util.Set;
19 19  
  20 +import org.drools.compiler.lang.DRL5Expressions.type_return;
20 21 import org.springframework.beans.factory.annotation.Autowired;
21 22 import org.springframework.jdbc.core.JdbcTemplate;
22 23 import org.springframework.jdbc.core.RowMapper;
... ... @@ -1012,6 +1013,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1012 1013 String line = map.get("line").toString();
1013 1014 String date = map.get("date").toString();
1014 1015 String code = map.get("code").toString();
  1016 + String type = map.get("type").toString();
1015 1017  
1016 1018 if(date.length() == 0)
1017 1019 date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
... ... @@ -1042,8 +1044,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1042 1044 if(company.length() != 0){
1043 1045 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
1044 1046 }
1045   - sql += " order by fcsj";
1046   -
  1047 + sql += " order by xl_name, fcsj";
  1048 +
1047 1049 list = jdbcTemplate.query(sql,
1048 1050 new RowMapper<Map<String, Object>>(){
1049 1051 @Override
... ... @@ -1072,8 +1074,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1072 1074 e.printStackTrace();
1073 1075 }
1074 1076  
  1077 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1078 + List<String> keyList = new ArrayList<String>();
1075 1079 for(Map<String, Object> m : list){
1076 1080 String key = m.get("line") + "/" + m.get("clZbh") + "/" + m.get("jGh") + "/" + m.get("jName");
  1081 + if(!keyList.contains(m.get("line").toString())){
  1082 + keyList.add(m.get("line").toString());
  1083 + }
1077 1084 if(!keyMap.containsKey(key))
1078 1085 keyMap.put(key, new ArrayList<Map<String, Object>>());
1079 1086 keyMap.get(key).add(m);
... ... @@ -1120,7 +1127,58 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1120 1127 tempMap.put("sjf", sjf);
1121 1128 tempMap.put("wqr", wqr);
1122 1129 tempMap.put("workList", keyMap.get(key));
1123   - resList.add(tempMap);
  1130 + tempList.add(tempMap);
  1131 + }
  1132 +
  1133 + for(String key : keyList){
  1134 + for(Map<String, Object> m : tempList){
  1135 + if(key.equals(m.get("line").toString())){
  1136 + resList.add(m);
  1137 + }
  1138 + }
  1139 + }
  1140 +
  1141 + if(type.equals("export")){
  1142 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1143 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1144 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1145 + Map<String,Object> m = new HashMap<String, Object>();
  1146 + ReportUtils ee = new ReportUtils();
  1147 + try {
  1148 + listI.add(resList.iterator());
  1149 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1150 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\commandState.xls",
  1151 + path+"export\\指令状态分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1152 + } catch (Exception e) {
  1153 + // TODO: handle exception
  1154 + e.printStackTrace();
  1155 + }
  1156 + }
  1157 +
  1158 + if(type.equals("export1")){
  1159 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1160 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1161 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1162 + Map<String,Object> m = new HashMap<String, Object>();
  1163 + ReportUtils ee = new ReportUtils();
  1164 + String jsy = map.get("jsy").toString();
  1165 + try {
  1166 + for(Map<String, Object> map1 : resList){
  1167 + if(jsy.equals(map1.get("jsy").toString())){
  1168 + List<Map<String, Object>> temp = (List<Map<String, Object>>)map1.get("workList");
  1169 + listI.add(temp.iterator());
  1170 + m.put("detail", "日期:" + map1.get("date") + " 公司:" + map1.get("company")
  1171 + + " 分公司:" + map1.get("subCompany") + " 线路:" + map1.get("line")
  1172 + + " 车辆:" + map1.get("clZbh") + " 人员:" + map1.get("jsy"));
  1173 + }
  1174 + }
  1175 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1176 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\commandState1.xls",
  1177 + path+"export\\指令状态明细" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1178 + } catch (Exception e) {
  1179 + // TODO: handle exception
  1180 + e.printStackTrace();
  1181 + }
1124 1182 }
1125 1183  
1126 1184 return resList;
... ...