Commit be97e34e572d27a742213f54dc43ed96186b4060

Authored by 潘钊
1 parent 32c6d404

update...

Showing 21 changed files with 2875 additions and 2149 deletions
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
... ... @@ -427,4 +392,14 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
427 392 }
428 393 return rs;
429 394 }
  395 +
  396 + @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
  397 + public Map<String, Object> svgAttr(@RequestParam String jsonStr){
  398 + return scheduleRealInfoService.svgAttr(jsonStr);
  399 + }
  400 +
  401 + @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
  402 + public Map<String, Object> findSvgAttr(@RequestParam String idx){
  403 + return scheduleRealInfoService.findSvgAttr(idx);
  404 + }
430 405 }
... ...
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
1 1 package com.bsth.entity.realcontrol;
2 2  
  3 +import javax.persistence.Entity;
3 4 import javax.persistence.Id;
  5 +import javax.persistence.Table;
4 6  
5 7 /**
6 8 * 主页SVG模拟图属性设置
7 9 * Created by panzhao on 2017/1/6.
8 10 */
  11 +@Entity
  12 +@Table(name = "bsth_c_svg_attr")
9 13 public class SvgAttribute {
10 14  
11 15 @Id
12 16 private String lineCode;
13 17  
14   - /** 要隐藏的站点编码 , 号分割多个 */
  18 + /**
  19 + * 要隐藏的站点编码 , 号分割多个
  20 + */
15 21 private String hideStations;
16 22  
17   - /** 站点别名 json对象字符串 */
  23 + /**
  24 + * 站点别名 json对象字符串
  25 + */
18 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 + }
19 51 }
... ...
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/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  
... ... @@ -128,4 +128,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
128 128 Map<String,Object> changeBcType(Long id, String bcType, String remarks);
129 129  
130 130 Map<String,Object> historySave(ScheduleRealInfo sch);
  131 +
  132 + Map<String,Object> svgAttr(String jsonStr);
  133 +
  134 + Map<String,Object> findSvgAttr(String idx);
131 135 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -18,6 +18,7 @@ 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,6 +26,7 @@ import com.bsth.entity.sys.SysUser;
25 26 import com.bsth.repository.LineRepository;
26 27 import com.bsth.repository.realcontrol.ChildTaskPlanRepository;
27 28 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  29 +import com.bsth.repository.realcontrol.SvgAttributeRepository;
28 30 import com.bsth.repository.schedule.CarConfigInfoRepository;
29 31 import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
30 32 import com.bsth.repository.schedule.GuideboardInfoRepository;
... ... @@ -39,6 +41,7 @@ import com.google.common.collect.ArrayListMultimap;
39 41 import com.google.common.collect.BiMap;
40 42 import com.google.common.collect.Lists;
41 43 import com.google.common.collect.Multimap;
  44 +import org.apache.commons.lang3.StringEscapeUtils;
42 45 import org.apache.commons.lang3.StringUtils;
43 46 import org.joda.time.format.DateTimeFormat;
44 47 import org.joda.time.format.DateTimeFormatter;
... ... @@ -47,7 +50,6 @@ import org.slf4j.LoggerFactory;
47 50 import org.springframework.beans.factory.annotation.Autowired;
48 51 import org.springframework.stereotype.Service;
49 52  
50   -import java.net.URLEncoder;
51 53 import java.text.DecimalFormat;
52 54 import java.text.ParseException;
53 55 import java.text.SimpleDateFormat;
... ... @@ -55,666 +57,616 @@ import java.util.*;
55 57  
56 58 @Service
57 59 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
58   - implements ScheduleRealInfoService {
  60 + implements ScheduleRealInfoService {
59 61  
60   - @Autowired
61   - ScheduleRealInfoRepository scheduleRealInfoRepository;
  62 + @Autowired
  63 + ScheduleRealInfoRepository scheduleRealInfoRepository;
62 64  
63   - @Autowired
64   - EmployeeConfigInfoRepository employeeConfigInfoRepository;
  65 + @Autowired
  66 + EmployeeConfigInfoRepository employeeConfigInfoRepository;
65 67  
66   - @Autowired
67   - CarConfigInfoRepository carConfigInfoRepository;
68   -
69   - @Autowired
70   - SectionRouteService sectionRouteService;
71   -
72   - /*@Autowired
73   - BorrowCenter borrowCenter;*/
74   -
75   - @Autowired
76   - LineRepository lineRepository;
77   -
78   - @Autowired
79   - GuideboardInfoRepository guideboardInfoRepository;
80   -
81   - @Autowired
82   - ChildTaskPlanRepository cTaskPlanRepository;
83   -
84   - @Autowired
85   - SendUtils sendUtils;
86   -
87   - @Autowired
88   - DayOfSchedule dayOfSchedule;
89   -
90   - @Autowired
91   - SchAttrCalculator schAttrCalculator;
92   -
93   - @Autowired
94   - LineConfigData lineConfigData;
95   -
96   - Logger logger = LoggerFactory.getLogger(this.getClass());
97   -
98   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
99   - sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"),
100   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
101   -
102   - @Override
103   - public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) {
104   - List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines));
105   -
106   - Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create();
107   -
108   - for (String lineCode : lineList) {
109   - mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode));
110   - }
111   - return mMap.asMap();
112   - }
113   -
114   - private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
115   - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
116   - @Override
117   - public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj/*, String nbbm,String jsy,String spy*/) {
118   - Map<String, Object> map = new HashMap<>();
119   - try {
120   -
121   - ScheduleRealInfo schedule = dayOfSchedule.get(id);
122   -
123   -
124   - LineConfig config = lineConfigData.get(schedule.getXlBm());
125   - //小于线路开始运营时间,则默认跨过24点
126   - if(dfsj.compareTo(config.getStartOpt()) < 0){
127   - schedule.setRealExecDate(fmtyyyyMMdd.print(schedule.getScheduleDate().getTime() + DAY_TIME));
128   - }
129   - else {
130   - schedule.setRealExecDate(schedule.getScheduleDateStr());
131   - }
132   -
133   - schedule.setDfsjAll(dfsj);
134   - schedule.addRemarks(remarks);
135   -
136   - List<ScheduleRealInfo> ts = new ArrayList<>();
137   - ts.add(schedule);
138   - //调整终点时间和下一个班次的应到时间
139   - schedule.calcEndTime();
140   - ScheduleRealInfo nextSch = dayOfSchedule.next(schedule);
141   - if(null != nextSch){
142   - nextSch.setQdzArrDateJH(schedule.getZdsj());
143   - ts.add(nextSch);
144   - }
145   -
146   - // 持久化到数据库
147   - dayOfSchedule.save(schedule);
148   -
149   - map.put("status", ResponseCode.SUCCESS);
150   - map.put("ts", ts);
151   - } catch (Exception e) {
152   - logger.error("", e);
153   - map.put("status", ResponseCode.ERROR);
154   - }
155   - return map;
156   - }
157   -
158   - @Override
159   - public Map<String, Object> destroy(String idsStr, /*int spaceAdjust, */String remarks, String reason/*, int spaceNum*/) {
160   -
161   - Map<String, Object> map = new HashMap<>();
162   - List<ScheduleRealInfo> rsList = new ArrayList<>();
163   - map.put("ts", rsList);
164   - try {
165   - List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr));
166   -
167   - ScheduleRealInfo schedule = null;
168   - for (String id : idList) {
169   - schedule = dayOfSchedule.get(Long.parseLong(id));
170   - if(schedule.isDestroy()){
171   - map.put("status", ResponseCode.ERROR);
172   - map.put("msg", "不必要的重复烂班!");
173   - return map;
174   - }
  68 + @Autowired
  69 + CarConfigInfoRepository carConfigInfoRepository;
175 70  
176   - schedule.setAdjustExps(reason);
177   - schedule.destroy();
178   - schedule.addRemarks(remarks);
179   -
180   - dayOfSchedule.save(schedule);
181   - rsList.add(schedule);
182   - }
183   -
184   - map.put("status", ResponseCode.SUCCESS);
185   - } catch (Exception e) {
186   - logger.error("", e);
187   - map.put("status", ResponseCode.ERROR);
188   - }
189   - return map;
190   - }
191   -
192   - // 线路id获取驾驶员
193   - @Override
194   - public List<Map<String, String>> findDriverByLine(String lineCode) {
195   - List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
196   -
197   - List<Map<String, String>> rsList = new ArrayList<>();
198   - Map<String, String> map = null;
199   - Personnel driver = null;
200   - String code = null;
201   -
202   - for (EmployeeConfigInfo employee : list) {
203   - driver = employee.getJsy();
204   - if (driver != null) {
205   - map = new HashMap<>();
206   - code = driver.getJobCode();
207   - map.put("id", code + "/" + driver.getPersonnelName());
208   - map.put("text", code + "/" + driver.getPersonnelName());
209   - rsList.add(map);
210   - }
211   - }
212   - return rsList;
213   - }
214   -
215   - // 线路id获取售票员
216   - @Override
217   - public List<Map<String, String>> findConductorByLine(String lineCode) {
218   - List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
219   -
220   - List<Map<String, String>> rsList = new ArrayList<>();
221   - Map<String, String> map = null;
222   - Personnel conductor = null;
223   - String code = null;
224   -
225   - for (EmployeeConfigInfo employee : list) {
226   - conductor = employee.getSpy();
227   - if (conductor != null) {
228   - code = conductor.getJobCode();
229   - map = new HashMap<>();
230   - map.put("id", code + "/" + conductor.getPersonnelName());
231   - map.put("text", code + "/" + conductor.getPersonnelName());
232   - rsList.add(map);
233   - }
234   - }
235   - return rsList;
236   - }
237   -
238   - @Override
239   - public List<Map<String, String>> findCarByLine(String lineCode) {
240   -
241   - List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode);
242   -
243   - List<Map<String, String>> rsList = new ArrayList<>();
244   - Map<String, String> map = null;
245   - Cars car = null;
246   - String code = null;
247   -
248   - for (CarConfigInfo cci : list) {
249   - car = cci.getCl();
250   - if (car != null) {
251   - code = car.getInsideCode();
252   - map = new HashMap<>();
253   - map.put("id", code);
254   - map.put("text", code);
255   - rsList.add(map);
256   - }
257   - }
258   - return rsList;
259   - }
260   -
261   -
262   - /**
263   - * 临加班次
264   - */
265   - @Override
266   - public Map<String, Object> save(ScheduleRealInfo t) {
267   - Map<String, Object> rs = new HashMap<>();
268   - try{
269   - if(BasicData.deviceId2NbbmMap.inverse().get(t.getClZbh()) == null){
270   - rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!");
271   - rs.put("status", ResponseCode.ERROR);
272   - return rs;
273   - }
  71 + @Autowired
  72 + SectionRouteService sectionRouteService;
274 73  
275   - SysUser user = SecurityUtils.getCurrentUser();
276   - String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm());
277   -
278   - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd")
279   - ,sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
280   -
281   - if(StringUtils.isEmpty(t.getjGh())){
282   - rs.put("status", ResponseCode.ERROR);
283   - rs.put("msg", "驾驶员工号不能为空!");
284   - return rs;
285   - }
286   - //截取工号
287   - if(t.getjGh().indexOf("-") != -1){
288   - t.setjGh(t.getjGh().split("-")[1]);
289   - }
290   -
291   - t.setScheduleDateStr(schDate);
292   - t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
293   - t.setRealExecDate(schDate);
294   - t.setCreateBy(user);
295   - t.setSflj(true);
296   - t.setLate(false);
297   - t.setDfsj(t.getFcsj());
298   - t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
299   -
300   -
301   - //班次历时
302   - t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60);
303   -
304   - //起终点名称
305   - String prefix = t.getXlBm() + "_" + t.getXlDir() + "_";
306   - t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix));
307   - t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix));
308   -
309   - //计算班次实际时间
310   - schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t);
311   - if(t.getZdsjT() < t.getFcsjT()){
312   - rs.put("status", ResponseCode.ERROR);
313   - rs.put("msg", "起终点时间异常!");
314   - return rs;
315   - }
316   -
317   - //实时入库
318   - super.save(t);
319   -
320   - // 加入缓存
321   - dayOfSchedule.put(t);
322   -
323   - //更新起点应到时间
324   - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t.getClZbh());
325   -
326   -
327   - rs.put("ts", ts);
328   - rs.put("t", t);
329   - }catch(Exception e){
330   - logger.error("", e);
331   - rs.put("status", ResponseCode.ERROR);
332   - }
333   - return rs;
334   - }
335   -
336   - @Override
337   - public Map<String, Object> delete(Long id) {
338   - Map<String, Object> rs = new HashMap<>();
339   - rs.put("status", ResponseCode.ERROR);
340   -
341   - ScheduleRealInfo sch = dayOfSchedule.get(id);
342   - if(sch == null){
343   - rs.put("msg", "无效的id号");
344   - return rs;
345   - }
346   -
347   - if(!sch.isSflj()){
348   - rs.put("msg", "你只能删除临加班次");
349   - return rs;
350   - }
351   -
352   - dayOfSchedule.delete(sch);
353   - //ScheduleRealInfo sch = dayOfSchedule.delete(id);
354   - //数据库删除
355   - rs = super.delete(id);
356   - //更新起点应到时间
357   - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());
358   - rs.put("ts", ts);
359   - rs.put("delete", sch);
360   -
361   - return rs;
362   - }
363   -
364   - @Override
365   - public List<Map<String, String>> sreachVehic(String nbbm) {
366   - // 转大写
367   - nbbm = nbbm.toUpperCase();
368   -
369   - List<Map<String, String>> list = new ArrayList<>();
370   - Map<String, String> map;
371   - Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
372   -
373   - Line line;
374   - for (String k : allSet) {
375   - if (k.indexOf(nbbm) != -1) {
376   - // 所属线路
377   - map = new HashMap<>();
378   - line = BasicData.nbbm2LineMap.get(k);
379   - map.put("id", k);
380   - map.put("text", k);
381   - if (null != line) {
382   - map.put("lineName", line.getName());
383   - map.put("lineCode", line.getLineCode());
384   - }
  74 + /*@Autowired
  75 + BorrowCenter borrowCenter;*/
385 76  
386   - list.add(map);
387   - }
  77 + @Autowired
  78 + LineRepository lineRepository;
  79 +
  80 + @Autowired
  81 + GuideboardInfoRepository guideboardInfoRepository;
388 82  
389   - if (list.size() > 20)
390   - break;
391   - }
392   - return list;
393   - }
394   -
395   -/* @Override
396   - public Map<String, Object> adjust(Long id, String nbbm, String jsy, String spy, Integer revertLine, Integer borrowLine, String borrowTimeStr, String revertTimeStr) {
397   - // 班次
398   - ScheduleRealInfo schedule = dayOfSchedule.get(id);
399   - int upDown = Integer.parseInt(schedule.getXlDir());
400   -
401   - String rq = sdfMonth.format(new Date());
402   - // 换车
403   - if (!StringUtils.isBlank(nbbm)) {
404   - adjustCar(schedule, nbbm);
405   - }
406   -
407   - List<String> tempArray;
408   - // 换驾驶员
409   - if (!StringUtils.isBlank(jsy)) {
410   - tempArray = Splitter.on("/").splitToList(jsy);
411   - adjustDriver(schedule, tempArray.get(0), tempArray.get(1));
412   - }
413   -
414   - // 换售票员
415   - if (!StringUtils.isBlank(spy)) {
416   - tempArray = Splitter.on("/").splitToList(spy);
417   - adjustConductor(schedule, tempArray.get(0), tempArray.get(1));
418   - }
419   -
420   - if(borrowLine != null && borrowTimeStr != null){
421   - try {
422   - //跨线路借车
423   - Long t = sdfMinute.parse(rq + " " + borrowTimeStr).getTime();
424   - //borrowCenter.put(nbbm, borrowLine, 0, t, upDown);
425   - } catch (ParseException e) {
426   - e.printStackTrace();
427   - }
428   - }
429   -
430   - if(revertLine != null && revertTimeStr != null){
431   - //定时还车
432   - try {
433   - Long t = sdfMinute.parse(rq + " " + revertTimeStr).getTime();
434   - //还车的时候不用切走向
435   - //borrowCenter.put(nbbm, revertLine, 1, t, -1);
436   - } catch (ParseException e) {
437   - e.printStackTrace();
438   - }
439   - }
440   -
441   - scheduleRealInfoRepository.save(schedule);
442   - //ScheduleBuffer.persistentList.add(schedule);
443   -
444   - Map<String, Object> map = new HashMap<>();
445   - map.put("status", 200);
446   - map.put("t", schedule);
447   - return map;
448   - }*/
449   -
450   - @Override
451   - public void adjustCar(ScheduleRealInfo schedule, String car) {
452   - schedule.setClZbh(car);
453   - }
454   -
455   - @Override
456   - public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) {
457   - if(driver.indexOf("-") != -1)
458   - driver = driver.split("-")[1];
459   - schedule.setjGh(driver);
460   - schedule.setjName(driverName);
461   - }
462   -
463   - @Override
464   - public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) {
465   - if(conductor.indexOf("-") != -1)
466   - conductor = conductor.split("-")[1];
467   - schedule.setsGh(conductor);
468   - schedule.setsName(conductorName);
469   - }
470   -
471   - @Override
472   - public List<ScheduleRealInfo> queryUserInfo(String line, String date,String state) {
473   - if(state.equals("2")){
474   - return scheduleRealInfoRepository.queryUserInfo2(line, date);
475   - }else{
476   - return scheduleRealInfoRepository.queryUserInfo3(line, date);
477   - }
478   -
479   - }
480   - /**
481   - *
482   - */
483   - @Override
484   - public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName,String date) {
485   - ReportUtils ee = new ReportUtils();
486   - ReportRelatedUtils rru = new ReportRelatedUtils();
487   - List<Iterator<?>> list = new ArrayList<Iterator<?>>();
488   - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName,date);
489   - List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
490   -
491   - DecimalFormat format = new DecimalFormat("0.00");
  83 + @Autowired
  84 + ChildTaskPlanRepository cTaskPlanRepository;
  85 +
  86 + @Autowired
  87 + SendUtils sendUtils;
  88 +
  89 + @Autowired
  90 + DayOfSchedule dayOfSchedule;
  91 +
  92 + @Autowired
  93 + SchAttrCalculator schAttrCalculator;
  94 +
  95 + @Autowired
  96 + LineConfigData lineConfigData;
  97 +
  98 + Logger logger = LoggerFactory.getLogger(this.getClass());
  99 +
  100 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  101 + sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"),
  102 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  103 +
  104 + @Override
  105 + public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) {
  106 + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines));
  107 +
  108 + Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create();
  109 +
  110 + for (String lineCode : lineList) {
  111 + mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode));
  112 + }
  113 + return mMap.asMap();
  114 + }
  115 +
  116 + private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
  117 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  118 +
  119 + @Override
  120 + public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType) {
  121 + Map<String, Object> map = new HashMap<>();
  122 + try {
  123 +
  124 + ScheduleRealInfo schedule = dayOfSchedule.get(id);
  125 +
  126 +
  127 + LineConfig config = lineConfigData.get(schedule.getXlBm());
  128 + //小于线路开始运营时间,则默认跨过24点
  129 + if (dfsj.compareTo(config.getStartOpt()) < 0) {
  130 + schedule.setRealExecDate(fmtyyyyMMdd.print(schedule.getScheduleDate().getTime() + DAY_TIME));
  131 + } else {
  132 + schedule.setRealExecDate(schedule.getScheduleDateStr());
  133 + }
  134 +
  135 + schedule.setDfsjAll(dfsj);
  136 + schedule.addRemarks(remarks);
  137 +
  138 + List<ScheduleRealInfo> ts = new ArrayList<>();
  139 + ts.add(schedule);
  140 + //调整终点时间和下一个班次的应到时间
  141 + schedule.calcEndTime();
  142 + ScheduleRealInfo nextSch = dayOfSchedule.next(schedule);
  143 + if (null != nextSch) {
  144 + nextSch.setQdzArrDateJH(schedule.getZdsj());
  145 + ts.add(nextSch);
  146 + }
  147 +
  148 + //调整班次类型
  149 + if(StringUtils.isNotEmpty(bcType)){
  150 + schedule.setBcType(bcType);
  151 + }
  152 +
  153 + // 持久化到数据库
  154 + dayOfSchedule.save(schedule);
  155 +
  156 + map.put("status", ResponseCode.SUCCESS);
  157 + map.put("ts", ts);
  158 + } catch (Exception e) {
  159 + logger.error("", e);
  160 + map.put("status", ResponseCode.ERROR);
  161 + }
  162 + return map;
  163 + }
  164 +
  165 + @Override
  166 + public Map<String, Object> destroy(String idsStr, /*int spaceAdjust, */String remarks, String reason/*, int spaceNum*/) {
  167 +
  168 + Map<String, Object> map = new HashMap<>();
  169 + List<ScheduleRealInfo> rsList = new ArrayList<>();
  170 + map.put("ts", rsList);
  171 + try {
  172 + List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr));
  173 +
  174 + ScheduleRealInfo schedule = null;
  175 + for (String id : idList) {
  176 + schedule = dayOfSchedule.get(Long.parseLong(id));
  177 + if (schedule.isDestroy()) {
  178 + map.put("status", ResponseCode.ERROR);
  179 + map.put("msg", "不必要的重复烂班!");
  180 + return map;
  181 + }
  182 +
  183 + schedule.setAdjustExps(reason);
  184 + schedule.destroy();
  185 + schedule.addRemarks(remarks);
  186 +
  187 + dayOfSchedule.save(schedule);
  188 + rsList.add(schedule);
  189 + }
  190 +
  191 + map.put("status", ResponseCode.SUCCESS);
  192 + } catch (Exception e) {
  193 + logger.error("", e);
  194 + map.put("status", ResponseCode.ERROR);
  195 + }
  196 + return map;
  197 + }
  198 +
  199 + // 线路id获取驾驶员
  200 + @Override
  201 + public List<Map<String, String>> findDriverByLine(String lineCode) {
  202 + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
  203 +
  204 + List<Map<String, String>> rsList = new ArrayList<>();
  205 + Map<String, String> map = null;
  206 + Personnel driver = null;
  207 + String code = null;
  208 +
  209 + for (EmployeeConfigInfo employee : list) {
  210 + driver = employee.getJsy();
  211 + if (driver != null) {
  212 + map = new HashMap<>();
  213 + code = driver.getJobCode();
  214 + map.put("id", code + "/" + driver.getPersonnelName());
  215 + map.put("text", code + "/" + driver.getPersonnelName());
  216 + rsList.add(map);
  217 + }
  218 + }
  219 + return rsList;
  220 + }
  221 +
  222 + // 线路id获取售票员
  223 + @Override
  224 + public List<Map<String, String>> findConductorByLine(String lineCode) {
  225 + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
  226 +
  227 + List<Map<String, String>> rsList = new ArrayList<>();
  228 + Map<String, String> map = null;
  229 + Personnel conductor = null;
  230 + String code = null;
  231 +
  232 + for (EmployeeConfigInfo employee : list) {
  233 + conductor = employee.getSpy();
  234 + if (conductor != null) {
  235 + code = conductor.getJobCode();
  236 + map = new HashMap<>();
  237 + map.put("id", code + "/" + conductor.getPersonnelName());
  238 + map.put("text", code + "/" + conductor.getPersonnelName());
  239 + rsList.add(map);
  240 + }
  241 + }
  242 + return rsList;
  243 + }
  244 +
  245 + @Override
  246 + public List<Map<String, String>> findCarByLine(String lineCode) {
  247 +
  248 + List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode);
  249 +
  250 + List<Map<String, String>> rsList = new ArrayList<>();
  251 + Map<String, String> map = null;
  252 + Cars car = null;
  253 + String code = null;
  254 +
  255 + for (CarConfigInfo cci : list) {
  256 + car = cci.getCl();
  257 + if (car != null) {
  258 + code = car.getInsideCode();
  259 + map = new HashMap<>();
  260 + map.put("id", code);
  261 + map.put("text", code);
  262 + rsList.add(map);
  263 + }
  264 + }
  265 + return rsList;
  266 + }
  267 +
  268 +
  269 + /**
  270 + * 临加班次
  271 + */
  272 + @Override
  273 + public Map<String, Object> save(ScheduleRealInfo t) {
  274 + Map<String, Object> rs = new HashMap<>();
  275 + try {
  276 + if (BasicData.deviceId2NbbmMap.inverse().get(t.getClZbh()) == null) {
  277 + rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!");
  278 + rs.put("status", ResponseCode.ERROR);
  279 + return rs;
  280 + }
  281 +
  282 + SysUser user = SecurityUtils.getCurrentUser();
  283 + String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm());
  284 +
  285 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  286 +
  287 + if (StringUtils.isEmpty(t.getjGh())) {
  288 + rs.put("status", ResponseCode.ERROR);
  289 + rs.put("msg", "驾驶员工号不能为空!");
  290 + return rs;
  291 + }
  292 + //截取工号
  293 + if (t.getjGh().indexOf("-") != -1) {
  294 + t.setjGh(t.getjGh().split("-")[1]);
  295 + }
  296 +
  297 + t.setScheduleDateStr(schDate);
  298 + t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
  299 + t.setRealExecDate(schDate);
  300 + t.setCreateBy(user);
  301 + t.setSflj(true);
  302 + t.setLate(false);
  303 + t.setDfsj(t.getFcsj());
  304 + t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
  305 +
  306 +
  307 + //班次历时
  308 + t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60);
  309 +
  310 + //起终点名称
  311 + String prefix = t.getXlBm() + "_" + t.getXlDir() + "_";
  312 + t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix));
  313 + t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix));
  314 +
  315 + //计算班次实际时间
  316 + schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t);
  317 + if (t.getZdsjT() < t.getFcsjT()) {
  318 + rs.put("status", ResponseCode.ERROR);
  319 + rs.put("msg", "起终点时间异常!");
  320 + return rs;
  321 + }
  322 +
  323 + //实时入库
  324 + super.save(t);
  325 +
  326 + // 加入缓存
  327 + dayOfSchedule.put(t);
  328 +
  329 + //更新起点应到时间
  330 + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t.getClZbh());
  331 +
  332 +
  333 + rs.put("ts", ts);
  334 + rs.put("t", t);
  335 + } catch (Exception e) {
  336 + logger.error("", e);
  337 + rs.put("status", ResponseCode.ERROR);
  338 + }
  339 + return rs;
  340 + }
  341 +
  342 + @Override
  343 + public Map<String, Object> delete(Long id) {
  344 + Map<String, Object> rs = new HashMap<>();
  345 + rs.put("status", ResponseCode.ERROR);
  346 +
  347 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  348 + if (sch == null) {
  349 + rs.put("msg", "无效的id号");
  350 + return rs;
  351 + }
  352 +
  353 + if (!sch.isSflj()) {
  354 + rs.put("msg", "你只能删除临加班次");
  355 + return rs;
  356 + }
  357 +
  358 + dayOfSchedule.delete(sch);
  359 + //ScheduleRealInfo sch = dayOfSchedule.delete(id);
  360 + //数据库删除
  361 + rs = super.delete(id);
  362 + //更新起点应到时间
  363 + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());
  364 + rs.put("ts", ts);
  365 + rs.put("delete", sch);
  366 +
  367 + return rs;
  368 + }
  369 +
  370 + @Override
  371 + public List<Map<String, String>> sreachVehic(String nbbm) {
  372 + // 转大写
  373 + nbbm = nbbm.toUpperCase();
  374 +
  375 + List<Map<String, String>> list = new ArrayList<>();
  376 + Map<String, String> map;
  377 + Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
  378 +
  379 + Line line;
  380 + for (String k : allSet) {
  381 + if (k.indexOf(nbbm) != -1) {
  382 + // 所属线路
  383 + map = new HashMap<>();
  384 + line = BasicData.nbbm2LineMap.get(k);
  385 + map.put("id", k);
  386 + map.put("text", k);
  387 + if (null != line) {
  388 + map.put("lineName", line.getName());
  389 + map.put("lineCode", line.getLineCode());
  390 + }
  391 +
  392 + list.add(map);
  393 + }
  394 +
  395 + if (list.size() > 20)
  396 + break;
  397 + }
  398 + return list;
  399 + }
  400 +
  401 + @Override
  402 + public void adjustCar(ScheduleRealInfo schedule, String car) {
  403 + schedule.setClZbh(car);
  404 + }
  405 +
  406 + @Override
  407 + public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) {
  408 + if (driver.indexOf("-") != -1)
  409 + driver = driver.split("-")[1];
  410 + schedule.setjGh(driver);
  411 + schedule.setjName(driverName);
  412 + }
  413 +
  414 + @Override
  415 + public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) {
  416 + if (conductor.indexOf("-") != -1)
  417 + conductor = conductor.split("-")[1];
  418 + schedule.setsGh(conductor);
  419 + schedule.setsName(conductorName);
  420 + }
  421 +
  422 + @Override
  423 + public List<ScheduleRealInfo> queryUserInfo(String line, String date, String state) {
  424 + if (state.equals("2")) {
  425 + return scheduleRealInfoRepository.queryUserInfo2(line, date);
  426 + } else {
  427 + return scheduleRealInfoRepository.queryUserInfo3(line, date);
  428 + }
  429 +
  430 + }
  431 +
  432 + /**
  433 + *
  434 + */
  435 + @Override
  436 + public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName, String date) {
  437 + ReportUtils ee = new ReportUtils();
  438 + ReportRelatedUtils rru = new ReportRelatedUtils();
  439 + List<Iterator<?>> list = new ArrayList<Iterator<?>>();
  440 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date);
  441 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  442 +
  443 + DecimalFormat format = new DecimalFormat("0.00");
492 444 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
493 445 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
494   - int jhbc = 0,cjbc = 0,ljbc = 0;
495   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
496   - float addMileage = 0l,remMileage = 0l;
497   -
498   - Map<String,Object> map;
499   - for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){
500   - if(scheduleRealInfo != null){
501   - //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
502   - if(scheduleRealInfo != null){
503   - //计划里程(主任务过滤掉临加班次),
504   - //烂班里程(主任务烂班),
505   - //临加里程(主任务临加),
506   - //计划班次,烂班班次,增加班次
507   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
508   - if(scheduleRealInfo.isSflj()){
509   - addMileage += tempJhlc;
510   - ljbc++;
511   - }else{
512   - jhlc += tempJhlc;
513   - jhbc++;
514   - if(scheduleRealInfo.getStatus() == -1){
515   - remMileage += tempJhlc;
516   - cjbc++;
517   - }
518   - }
519   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
520   - //计算营运里程,空驶里程
521   - if(childTaskPlans.isEmpty()){
522   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
523   - || scheduleRealInfo.getBcType().equals("venting")){
524   - ksgl += tempJhlc;
525   - }else{
526   - yygl += tempJhlc;
527   - }
528   - }else{
529   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
530   - while(it.hasNext()){
531   - ChildTaskPlan childTaskPlan = it.next();
532   - if(childTaskPlan.getMileageType().equals("empty")){
533   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
534   - }else{
535   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
536   - }
537   - }
538   - }
539   - }
540   -
541   - map = new HashMap<String, Object>();
542   - try {
543   - map = rru.getMapValue(scheduleRealInfo);
544   - String zdsj = scheduleRealInfo.getZdsj();
545   - String zdsjActual = scheduleRealInfo.getZdsjActual();
546   - if(zdsj != null && zdsjActual != null &&
547   - !zdsj.equals(zdsjActual)){
548   - if(zdsj.compareTo(zdsjActual) > 0){
549   - map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
550   - map.put("slow", "");
551   - } else {
552   - map.put("fast", "");
553   - map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
554   - }
555   - } else {
556   - map.put("fast", "");
557   - map.put("slow", "");
558   - }
559   - listMap.add(map);
560   - } catch (Exception e) {
561   - e.printStackTrace();
562   - }
563   - }
564   - }
565   -
566   - //计算里程和班次数,并放入Map里
567   - map = new HashMap<String, Object>();
568   - map.put("jhlc", format.format(jhlc));
569   - map.put("remMileage", format.format(remMileage));
570   - map.put("addMileage", format.format(addMileage));
571   - map.put("yygl", format.format(yygl));
572   - map.put("ksgl", format.format(ksgl));
573   - map.put("realMileage", format.format(yygl+ksgl));
574   - map.put("jhbc", jhbc);
575   - map.put("cjbc", cjbc);
576   - map.put("ljbc", ljbc);
577   - map.put("sjbc", jhbc-cjbc+ljbc);
578   -
579   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
580   -
581   - list.add(listMap.iterator());
582   - ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould\\waybill_minhang.xls",
583   - path+"export\\" + jName + ".xls");
584   - return scheduleRealInfos;
585   - }
586   -
587   - @Override
588   - public List<Map<String, Object>> dailyInfo(String line, String date,String type) {
589   - DecimalFormat format = new DecimalFormat("0.00");
590   - ReportUtils ee = new ReportUtils();
591   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
592   - List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date);
593   -
594   - double totalZGL = 0,totalKSGL=0,totalYH=0;
595   - int totalBCS=0;
596   - for(int i = 0;i < list.size();i++){
597   - String zgl = format.format(Double.parseDouble(list.get(i).get("zgl")==null?"0":list.get(i).get("zgl").toString()));
598   - String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl")==null?"0":list.get(i).get("ksgl").toString()));
599   - if(type.equals("export")){
600   - totalZGL += Double.parseDouble(zgl);
601   - totalKSGL += Double.parseDouble(ksgl);
602   - totalBCS += Integer.parseInt(list.get(i).get("bcs").toString());
603   - }
604   - list.get(i).put("zgl", zgl);
605   - list.get(i).put("ksgl", ksgl);
606   - }
607   - if(type.equals("export")){
608   - Map<String,Object> map = new HashMap<String, Object>();
609   - map.put("line", line);
610   - map.put("date", date);
611   - map.put("totalZGL", totalZGL);
612   - map.put("totalKSGL", totalKSGL);
613   - map.put("totalYH", totalYH);
614   - map.put("totalBCS", totalBCS);
615   -
616   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
617   -
618   - listI.add(list.iterator());
619   - try {
620   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\daily.xls",
621   - path+"export\\班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
622   - } catch (ParseException e) {
623   - e.printStackTrace();
624   - }
625   - }
626   - return list;
627   - }
628   -
629   - @Override
630   - public List<Object[]> historyMessage(String line, String date, String code, String type) {
631   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
632   - long d= 0;
633   - long t=0;
634   - if(date.length()>0){
635   - try {
636   - d=sdf.parse(date+" 00:00:00").getTime();
637   - t=sdf.parse(date+" 23:59:59").getTime();
638   - } catch (ParseException e) {
639   - // TODO Auto-generated catch block
640   - e.printStackTrace();
641   - }
642   -
643   - }
644   -
645   - List<Object[]> list = scheduleRealInfoRepository.historyMessage(line, d, t, code);
646   - for(Object[] obj:list){
647   - if(obj != null){
648   - obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString())));
649   - obj[4] = BasicData.lineCode2NameMap.get(line);
650   - }
651   - }
652   -
653   - if(type != null && type.length() != 0 && type.equals("export")){
654   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
655   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
656   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
657   - Map<String,Object> m = new HashMap<String, Object>();
658   - ReportUtils ee = new ReportUtils();
659   - List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
660   - for(int i = 0; i < list.size(); i++){
661   - Map<String, Object> map = new HashMap<String, Object>();
662   - Object[] obj = list.get(i);
663   - map.put("num", i + 1);
664   - map.put("line", obj[4]);
665   - map.put("clZbh", obj[0]);
666   - map.put("sender", obj[1]);
667   - map.put("date", obj[3]);
668   - map.put("text", obj[2]);
669   - newList.add(map);
670   - }
671   - try {
672   - listI.add(newList.iterator());
673   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
674   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\historyMessage.xls",
675   - path+"export\\调度历史消息" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
676   - } catch (Exception e) {
677   - // TODO: handle exception
678   - e.printStackTrace();
679   - }
680   - }
681   -
682   - if(type != null && type.length() != 0 && type.equals("export_msg")){
683   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
684   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
685   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
686   - Map<String,Object> m = new HashMap<String, Object>();
687   - ReportUtils ee = new ReportUtils();
688   - List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
689   - for(int i = 0; i < list.size(); i++){
690   - Map<String, Object> map = new HashMap<String, Object>();
691   - Object[] obj = list.get(i);
692   - map.put("num", i + 1);
693   - map.put("line", obj[4]);
694   - map.put("clZbh", obj[0]);
695   - map.put("sender", obj[1]);
696   - map.put("date", obj[3]);
697   - map.put("text", obj[2]);
698   - newList.add(map);
699   - }
700   - try {
701   - listI.add(newList.iterator());
702   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
703   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\message.xls",
704   - path+"export\\调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
705   - } catch (Exception e) {
706   - // TODO: handle exception
707   - e.printStackTrace();
708   - }
709   - }
710   - return list;
711   - }
712   -
713   - @Override
714   - public Map<Integer, Integer> trustStatus(String lineStr) {
715   - List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr));
716   -
717   - Map<Integer, Integer> map = new HashMap<>();
  446 + int jhbc = 0, cjbc = 0, ljbc = 0;
  447 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0;
  448 + float addMileage = 0l, remMileage = 0l;
  449 +
  450 + Map<String, Object> map;
  451 + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) {
  452 + if (scheduleRealInfo != null) {
  453 + //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
  454 + if (scheduleRealInfo != null) {
  455 + //计划里程(主任务过滤掉临加班次),
  456 + //烂班里程(主任务烂班),
  457 + //临加里程(主任务临加),
  458 + //计划班次,烂班班次,增加班次
  459 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  460 + if (scheduleRealInfo.isSflj()) {
  461 + addMileage += tempJhlc;
  462 + ljbc++;
  463 + } else {
  464 + jhlc += tempJhlc;
  465 + jhbc++;
  466 + if (scheduleRealInfo.getStatus() == -1) {
  467 + remMileage += tempJhlc;
  468 + cjbc++;
  469 + }
  470 + }
  471 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  472 + //计算营运里程,空驶里程
  473 + if (childTaskPlans.isEmpty()) {
  474 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  475 + || scheduleRealInfo.getBcType().equals("venting")) {
  476 + ksgl += tempJhlc;
  477 + } else {
  478 + yygl += tempJhlc;
  479 + }
  480 + } else {
  481 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  482 + while (it.hasNext()) {
  483 + ChildTaskPlan childTaskPlan = it.next();
  484 + if (childTaskPlan.getMileageType().equals("empty")) {
  485 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  486 + } else {
  487 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  488 + }
  489 + }
  490 + }
  491 + }
  492 +
  493 + map = new HashMap<String, Object>();
  494 + try {
  495 + map = rru.getMapValue(scheduleRealInfo);
  496 + String zdsj = scheduleRealInfo.getZdsj();
  497 + String zdsjActual = scheduleRealInfo.getZdsjActual();
  498 + if (zdsj != null && zdsjActual != null &&
  499 + !zdsj.equals(zdsjActual)) {
  500 + if (zdsj.compareTo(zdsjActual) > 0) {
  501 + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  502 + map.put("slow", "");
  503 + } else {
  504 + map.put("fast", "");
  505 + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  506 + }
  507 + } else {
  508 + map.put("fast", "");
  509 + map.put("slow", "");
  510 + }
  511 + listMap.add(map);
  512 + } catch (Exception e) {
  513 + e.printStackTrace();
  514 + }
  515 + }
  516 + }
  517 +
  518 + //计算里程和班次数,并放入Map里
  519 + map = new HashMap<String, Object>();
  520 + map.put("jhlc", format.format(jhlc));
  521 + map.put("remMileage", format.format(remMileage));
  522 + map.put("addMileage", format.format(addMileage));
  523 + map.put("yygl", format.format(yygl));
  524 + map.put("ksgl", format.format(ksgl));
  525 + map.put("realMileage", format.format(yygl + ksgl));
  526 + map.put("jhbc", jhbc);
  527 + map.put("cjbc", cjbc);
  528 + map.put("ljbc", ljbc);
  529 + map.put("sjbc", jhbc - cjbc + ljbc);
  530 +
  531 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  532 +
  533 + list.add(listMap.iterator());
  534 + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould\\waybill_minhang.xls",
  535 + path + "export\\" + jName + ".xls");
  536 + return scheduleRealInfos;
  537 + }
  538 +
  539 + @Override
  540 + public List<Map<String, Object>> dailyInfo(String line, String date, String type) {
  541 + DecimalFormat format = new DecimalFormat("0.00");
  542 + ReportUtils ee = new ReportUtils();
  543 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  544 + List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date);
  545 +
  546 + double totalZGL = 0, totalKSGL = 0, totalYH = 0;
  547 + int totalBCS = 0;
  548 + for (int i = 0; i < list.size(); i++) {
  549 + String zgl = format.format(Double.parseDouble(list.get(i).get("zgl") == null ? "0" : list.get(i).get("zgl").toString()));
  550 + String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl") == null ? "0" : list.get(i).get("ksgl").toString()));
  551 + if (type.equals("export")) {
  552 + totalZGL += Double.parseDouble(zgl);
  553 + totalKSGL += Double.parseDouble(ksgl);
  554 + totalBCS += Integer.parseInt(list.get(i).get("bcs").toString());
  555 + }
  556 + list.get(i).put("zgl", zgl);
  557 + list.get(i).put("ksgl", ksgl);
  558 + }
  559 + if (type.equals("export")) {
  560 + Map<String, Object> map = new HashMap<String, Object>();
  561 + map.put("line", line);
  562 + map.put("date", date);
  563 + map.put("totalZGL", totalZGL);
  564 + map.put("totalKSGL", totalKSGL);
  565 + map.put("totalYH", totalYH);
  566 + map.put("totalBCS", totalBCS);
  567 +
  568 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  569 +
  570 + listI.add(list.iterator());
  571 + try {
  572 + ee.excelReplace(listI, new Object[]{map}, path + "mould\\daily.xls",
  573 + path + "export\\班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  574 + } catch (ParseException e) {
  575 + e.printStackTrace();
  576 + }
  577 + }
  578 + return list;
  579 + }
  580 +
  581 + @Override
  582 + public List<Object[]> historyMessage(String line, String date, String code, String type) {
  583 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  584 + long d = 0;
  585 + long t = 0;
  586 + if (date.length() > 0) {
  587 + try {
  588 + d = sdf.parse(date + " 00:00:00").getTime();
  589 + t = sdf.parse(date + " 23:59:59").getTime();
  590 + } catch (ParseException e) {
  591 + // TODO Auto-generated catch block
  592 + e.printStackTrace();
  593 + }
  594 +
  595 + }
  596 +
  597 + List<Object[]> list = scheduleRealInfoRepository.historyMessage(line, d, t, code);
  598 + for (Object[] obj : list) {
  599 + if (obj != null) {
  600 + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString())));
  601 + obj[4] = BasicData.lineCode2NameMap.get(line);
  602 + }
  603 + }
  604 +
  605 + if (type != null && type.length() != 0 && type.equals("export")) {
  606 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  607 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  608 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  609 + Map<String, Object> m = new HashMap<String, Object>();
  610 + ReportUtils ee = new ReportUtils();
  611 + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
  612 + for (int i = 0; i < list.size(); i++) {
  613 + Map<String, Object> map = new HashMap<String, Object>();
  614 + Object[] obj = list.get(i);
  615 + map.put("num", i + 1);
  616 + map.put("line", obj[4]);
  617 + map.put("clZbh", obj[0]);
  618 + map.put("sender", obj[1]);
  619 + map.put("date", obj[3]);
  620 + map.put("text", obj[2]);
  621 + newList.add(map);
  622 + }
  623 + try {
  624 + listI.add(newList.iterator());
  625 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  626 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\historyMessage.xls",
  627 + path + "export\\调度历史消息" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  628 + } catch (Exception e) {
  629 + // TODO: handle exception
  630 + e.printStackTrace();
  631 + }
  632 + }
  633 +
  634 + if (type != null && type.length() != 0 && type.equals("export_msg")) {
  635 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  636 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  637 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  638 + Map<String, Object> m = new HashMap<String, Object>();
  639 + ReportUtils ee = new ReportUtils();
  640 + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
  641 + for (int i = 0; i < list.size(); i++) {
  642 + Map<String, Object> map = new HashMap<String, Object>();
  643 + Object[] obj = list.get(i);
  644 + map.put("num", i + 1);
  645 + map.put("line", obj[4]);
  646 + map.put("clZbh", obj[0]);
  647 + map.put("sender", obj[1]);
  648 + map.put("date", obj[3]);
  649 + map.put("text", obj[2]);
  650 + newList.add(map);
  651 + }
  652 + try {
  653 + listI.add(newList.iterator());
  654 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  655 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\message.xls",
  656 + path + "export\\调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  657 + } catch (Exception e) {
  658 + // TODO: handle exception
  659 + e.printStackTrace();
  660 + }
  661 + }
  662 + return list;
  663 + }
  664 +
  665 + @Override
  666 + public Map<Integer, Integer> trustStatus(String lineStr) {
  667 + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr));
  668 +
  669 + Map<Integer, Integer> map = new HashMap<>();
718 670 /*Integer code;
719 671 for (String lineCode : lineList) {
720 672 code = Integer.parseInt(lineCode);
... ... @@ -723,1001 +675,970 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
723 675  
724 676 map.put(code, ScheduleBuffer.trustMap.get(code));
725 677 }*/
726   - return map;
727   - }
728   -
729   - @Override
730   - public Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks) {
731   - Map<String, Object> rs = new HashMap<>();
732   - List<ScheduleRealInfo> ts = new ArrayList<>();
733   - try {
734   - ScheduleRealInfo sch = dayOfSchedule.get(id);
735   -
736   - LineConfig config = lineConfigData.get(sch.getXlBm());
737   - //小于线路开始运营时间,则默认跨过24点
738   - if(fcsjActual.compareTo(config.getStartOpt()) < 0){
739   - sch.setRealExecDate(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME));
740   - }
741   - else {
742   - sch.setRealExecDate(sch.getScheduleDateStr());
743   - }
744   -
745   - sch.setFcsjActualAll(fcsjActual);
746   - sch.addRemarks(remarks);
747   - sch.calcStatus();
748   -
749   - dayOfSchedule.save(sch);
750   - //scheduleRealInfoRepository.save(sch);
751   -
752   - ts.add(sch);
753   -
754   - rs.put("status", ResponseCode.SUCCESS);
755   - rs.put("ts", ts);
756   -
757   - //通知页面刷新
758   - sendUtils.refreshSch(ts);
759   - } catch (Exception e) {
760   - logger.error("", e);
761   - rs.put("status", ResponseCode.ERROR);
762   - }
763   -
764   - return rs;
765   - }
766   -
767   - @Override
768   - public Map<String, Object> revokeDestroy(Long id) {
769   - Map<String, Object> rs = new HashMap<>();
770   - try {
771   - ScheduleRealInfo sch = dayOfSchedule.get(id);
772   - if (sch.getStatus() != -1) {
773   - rs.put("status", ResponseCode.ERROR);
774   - rs.put("msg", "未烂班,无法撤销!");
775   - } else {
776   - sch.setStatus(0);
777   - rs.put("status", ResponseCode.SUCCESS);
778   - rs.put("t", sch);
779   -
780   - }
781   - } catch (Exception e) {
782   - logger.error("", e);
783   - rs.put("status", ResponseCode.ERROR);
784   - }
785   - return rs;
786   - }
787   -
788   - @Override
789   - public Map<String, Object> revokeRealOutgo(Long id) {
790   - Map<String, Object> rs = new HashMap<>();
791   - List<ScheduleRealInfo> ts = new ArrayList<>();
792   -
793   - try {
794   - ScheduleRealInfo sch = dayOfSchedule.get(id);
795   - if (sch.getFcsjActual() == null) {
796   - rs.put("status", ResponseCode.ERROR);
797   - rs.put("msg", "无实发时间,无法撤销!");
798   - } else {
799   - //将对应的到离站数据标记为不可信
800   - List<ArrivalEntity> list = ArrivalData_GPS.findByNbbm(sch.getClZbh());
801   - for(ArrivalEntity arr : list){
802   - if(arr.getInOut() == 1
803   - && arr.getUpDown() == Integer.parseInt(sch.getXlDir())
804   - && arr.getStopNo().equals(sch.getQdzCode())
805   - && Math.abs(arr.getTs() - sch.getFcsjActualTime()) < 1000 * 60){
806   - arr.setEnable(false);
807   - break;
808   - }
809   - }
810   -
811   - sch.clearFcsjActual();
812   - rs.put("status", ResponseCode.SUCCESS);
813   -
814   - ts.add(sch);
815   - rs.put("ts", ts);
816   -
817   - }
818   - } catch (Exception e) {
819   - logger.error("", e);
820   - rs.put("status", ResponseCode.ERROR);
821   - }
822   - return rs;
823   - }
824   -
825   - @Override
826   - public Map<String, Object> spaceAdjust(Long[] ids, Integer space) {
827   -
828   - List<ScheduleRealInfo> list = new ArrayList<>()
829   - ,updateList = new ArrayList<>();
830   - Map<String, Object> rs = new HashMap<>();
831   - try {
832   - ScheduleRealInfo sch, next;
833   - for (Long id : ids) {
834   - sch = dayOfSchedule.get(id);
835   - if (null != sch)
836   - list.add(sch);
837   - }
838   -
839   - int size = list.size();
840   - if(size == 0){
841   - rs.put("status", ResponseCode.ERROR);
842   - }
843   - else{
844   - // 按发车时间排序
845   - Collections.sort(list, new ScheduleComparator.FCSJ());
846   -
847   - // 以第一个实际发车/待发时间为起点,调整间隔
848   - sch = list.get(0);
849   - Long st = sch.getFcsjActualTime()==null?sch.getDfsjT():sch.getFcsjActualTime()
850   - ,plus = space * 60 * 1000L;
851   -
852   - for(int i = 1; i < size; i ++){
853   - st += plus;
854   - sch = list.get(i);
855   - sch.setDfsjAll(st);
856   - //重新计算终点时间
857   - sch.calcEndTime();
858   -
859   - dayOfSchedule.save(sch);
860   -
861   - updateList.add(sch);
862   - next=dayOfSchedule.next(sch);
863   - if(next.getQdzName().equals(sch.getZdzName())){
864   - next.setQdzArrDateJH(sch.getZdsj());
865   - updateList.add(next);
866   - }
867   - }
868   -
869   -
870   - rs.put("status", ResponseCode.SUCCESS);
871   - rs.put("ts", updateList);
872   - }
873   -
874   - } catch (Exception e) {
875   - logger.error("", e);
876   - rs.put("status", ResponseCode.ERROR);
877   - }
878   - return rs;
879   - }
880   -
881   - private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
882   -
883   - @Override
884   - public Map<String, Object> schInfoFineTune(Map<String, String> map) {
885   - Map<String, Object> rs = new HashMap<>();
886   - List<ScheduleRealInfo> ts = new ArrayList<>();
887   - try {
888   - Long id = Long.parseLong(map.get("id"));
889   - //班次类型
890   - //String bcType = map.get("bcType");
891   - //车辆自编号
892   - //String clZbh = map.get("clZbh");
893   - //计划发车时间
894   - //String fcsj = map.get("fcsj");
895   - //实际发车时间
896   - String fcsjActual = map.get("fcsjActual");
897   -
898   - //实际终点时间
899   - String zdsjActual = map.get("zdsjActual");
900   - //备注
901   - String remarks = map.get("remarks");
902   -
903   - ScheduleRealInfo sch = dayOfSchedule.get(id);
904   - if(null != sch){
905   -// //驾驶员
906   -// if(StringUtils.isNotBlank(map.get("jsy"))){
907   -// String[] jsy = map.get("jsy").split("/");
908   -// sch.setjGh(jsy[0]);
909   -// sch.setjName(jsy[1]);
910   -// }
911   -
912   - //售票员
913   -// if(StringUtils.isNotBlank(map.get("spy"))){
914   -// String[] spy = map.get("spy").split("/");
915   -// sch.setsGh(spy[0]);
916   -// sch.setsName(spy[1]);
917   -// }
918   -
919   - //sch.setBcType(bcType);
920   - //sch.setClZbh(clZbh);
921   - //sch.setFcsjAll(fcsj);
922   -
923   - if(StringUtils.isNotBlank(fcsjActual)){
924   - LineConfig config = lineConfigData.get(sch.getXlBm());
925   - long t=0L;
926   - //小于线路开始运营时间,则默认跨过24点
927   - if(fcsjActual.compareTo(config.getStartOpt()) < 0)
928   - t=fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME)+fcsjActual);
929   - else
930   - t=fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+fcsjActual);
931   -
932   - //调整实发
933   - if(!fcsjActual.equals(sch.getFcsjActual()))
934   - sch.setFcsjActualAll(t);
935   - }
936   - else{
937   - //撤销实发
938   - if(sch.getFcsjActual() != null)
939   - revokeRealOutgo(sch.getId());
940   - }
941   -
942   - //实达时间
943   - if(StringUtils.isNotBlank(zdsjActual)){
944   - if(!zdsjActual.equals(sch.getZdsjActual())){
945   - //调整实达
946   - sch.setZdsjActualAll(zdsjActual);
947   - //下一班次起点到达时间
948   - ScheduleRealInfo next = dayOfSchedule.next(sch);
949   - if(null != next){
950   - next.setQdzArrDateSJ(zdsjActual);
951   - ts.add(next);
952   - }
953   -
954   - //重新计算车辆执行班次
955   - dayOfSchedule.reCalcExecPlan(sch.getClZbh());
956   - }
957   - }
958   - else {
959   - /*if(sch.getZdsjActual() != null){
960   - //将对应的到离站数据标记为不可信
961   - List<ArrivalEntity> list = ArrivalData_GPS.findByNbbm(sch.getClZbh());
962   - for(ArrivalEntity arr : list){
963   - if(arr.getInOut() == 0
964   - && arr.getUpDown() == Integer.parseInt(sch.getXlDir())
965   - && arr.getStopNo().equals(sch.getZdzCode())
966   - && Math.abs(arr.getTs() - sch.getZdsjActualTime()) < 1000 * 60){
967   - arr.setEnable(false);
968   - break;
969   - }
970   - }
971   - }*/
972   -
973   - //清除实达时间
974   - sch.clearZdsjActual();
975   - //清除下一班次起点到达时间
976   - ScheduleRealInfo next = dayOfSchedule.next(sch);
977   - if(null != next){
978   - next.setQdzArrDateSJ(null);
979   - ts.add(next);
980   - }
981   - }
982   -
983   - sch.setRemarks(remarks);
984   - }
985   -
986   - //班次状态
987   - sch.calcStatus();
988   - dayOfSchedule.save(sch);
989   - //页面需要更新的班次信息
990   - ts.add(sch);
991   -
992   - rs.put("status", ResponseCode.SUCCESS);
993   - rs.put("ts", ts);
994   - } catch (Exception e) {
995   - logger.error("", e);
996   - rs.put("status", ResponseCode.ERROR);
997   - }
998   - return rs;
999   - }
1000   -
1001   - @Override
1002   - public Map<String, Object> outgoAdjustAll(String params) {
1003   - Map<String, Object> rs = new HashMap<>();
1004   - try{
1005   - JSONArray jsonArray = JSONArray.parseArray(params);
1006   -
1007   - ScheduleRealInfo schedule = null;
1008   - JSONObject jsonObj;
1009   - String dfsj;
1010   - for(int i = 0; i < jsonArray.size(); i ++){
1011   - jsonObj = jsonArray.getJSONObject(i);
1012   - dfsj = jsonObj.getString("t");
1013   - schedule = dayOfSchedule.get(jsonObj.getLong("id"));
1014   - //设置待发时间
1015   - schedule.setDfsjAll(dfsj);
1016   -
1017   - dayOfSchedule.save(schedule);
1018   - }
1019   -
1020   - rs.put("status", ResponseCode.SUCCESS);
1021   - //将更新的最后一个班次返回
1022   - rs.put("t", schedule);
1023   - }catch(Exception e){
1024   - logger.error("", e);
1025   - rs.put("status", ResponseCode.ERROR);
1026   - }
1027   - return rs;
1028   - }
1029   -
1030   - @Override
1031   - public Map<String, Object> findRouteByLine(String lineCode) {
1032   - Map<String, Object> map = new HashMap<>();
1033   - //上行
1034   - Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode);
1035   - map.put("line.id_eq", lineId);
1036   - map.put("directions_eq", 0);
1037   - List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map);
1038   -
1039   - //下行
1040   - map.put("directions_eq", 1);
1041   - List<Map<String, Object>> downList = sectionRouteService.getSectionRoute(map);
1042   -
1043   - Map<String, Object> rs = new HashMap<>();
1044   -
1045   - String upVectors = "", vec;
1046   - //拼接上行路段
1047   - for(Map<String, Object> temp : upList){
1048   - vec = temp.get("sectionBsectionVector").toString();
1049   - upVectors += vec.subSequence(11, vec.length() - 2) + " ";
1050   - }
1051   -
1052   - //拼接下行路段
1053   - String downVectors = "";
1054   - for(Map<String, Object> temp : downList){//LINESTRING(
1055   - vec = temp.get("sectionBsectionVector").toString();
1056   - downVectors += vec.subSequence(11, vec.length() - 2) + " ";
1057   - }
1058   -
1059   -
1060   - rs.put("up", upVectors);
1061   - //上行gcj
1062   - rs.put("up_gcj", BdToGcjString(upVectors));
1063   - rs.put("down", downVectors);
1064   - //下行gcj
1065   - rs.put("down_gcj", BdToGcjString(downVectors));
1066   - rs.put("lineId", lineId);
1067   -
1068   - return rs;
1069   - }
1070   -
1071   - /**
1072   - *
1073   - * @Title: BdToGcjString
1074   - * @Description: TODO(将百度路由字符串 转 成GCJ 字符串)
1075   - * @param @param bdStr
1076   - * @throws
1077   - */
1078   - public String BdToGcjString(String bdStr){
1079   - String[] array = bdStr.split(",")
1080   - ,subArray;
1081   - if(array.length == 0 || bdStr.length() < 2)
1082   - return "";
1083   -
1084   - String gcjStr = "";
1085   - TransGPS.Location location;
1086   - for(String crd : array){
1087   - subArray = crd.split(" ");
1088   - if(subArray.length != 2)
1089   - continue;
1090   - location = TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(subArray[0]), Double.parseDouble(subArray[1])));
1091   -
1092   - gcjStr += location.getLng() + " " + location.getLat() + ",";
1093   - }
1094   -
1095   - return gcjStr.substring(0, gcjStr.length() - 1);
1096   - }
1097   - public List<Map<String, String>> findLine(String line) {
1098   - List<Line> listLine = lineRepository.findLine("%"+line+"%");
1099   - List<Map<String,String>> list = new ArrayList<Map<String,String>>();
1100   - Map<String,String> map;
1101   - for(Line temp:listLine){
1102   - if(temp != null){
1103   - String xlName = temp.getName();
1104   - if(xlName.indexOf(line) != -1){
1105   - map = new HashMap<String, String>();
1106   - map.put("id", temp.getLineCode());
1107   - map.put("text", xlName);
1108   - list.add(map);
1109   - }
1110   - }
1111   - }
1112   - return list;
1113   - }
1114   -
1115   - public List<Map<String, String>> findLpName(String lpName) {
1116   - List<GuideboardInfo> listLpName = guideboardInfoRepository.findLpName("%"+lpName+"%");
1117   - List<Map<String,String>> list = new ArrayList<Map<String,String>>();
1118   - Map<String,String> map;
1119   - for(GuideboardInfo temp:listLpName){
1120   - if(temp != null){
1121   - String lp = temp.getLpName();
1122   - if(lp.indexOf(lpName) != -1){
1123   - map = new HashMap<String, String>();
1124   - map.put("id", lp);
1125   - map.put("text", lp);
1126   - list.add(map);
1127   - }
1128   - }
1129   - }
1130   - return list;
1131   - }
1132   -
1133   - @Override
1134   - public Map<String, Object> findKMBC2(String jName, String clZbh,String date) {
1135   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date);
1136   -
1137   - DecimalFormat format = new DecimalFormat("0.00");
  678 + return map;
  679 + }
  680 +
  681 + @Override
  682 + public Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks) {
  683 + Map<String, Object> rs = new HashMap<>();
  684 + List<ScheduleRealInfo> ts = new ArrayList<>();
  685 + try {
  686 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  687 +
  688 + LineConfig config = lineConfigData.get(sch.getXlBm());
  689 + //小于线路开始运营时间,则默认跨过24点
  690 + if (fcsjActual.compareTo(config.getStartOpt()) < 0) {
  691 + sch.setRealExecDate(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME));
  692 + } else {
  693 + sch.setRealExecDate(sch.getScheduleDateStr());
  694 + }
  695 +
  696 + sch.setFcsjActualAll(fcsjActual);
  697 + sch.addRemarks(remarks);
  698 + sch.calcStatus();
  699 +
  700 + dayOfSchedule.save(sch);
  701 + //scheduleRealInfoRepository.save(sch);
  702 +
  703 + ts.add(sch);
  704 +
  705 + rs.put("status", ResponseCode.SUCCESS);
  706 + rs.put("ts", ts);
  707 +
  708 + //通知页面刷新
  709 + sendUtils.refreshSch(ts);
  710 + } catch (Exception e) {
  711 + logger.error("", e);
  712 + rs.put("status", ResponseCode.ERROR);
  713 + }
  714 +
  715 + return rs;
  716 + }
  717 +
  718 + @Override
  719 + public Map<String, Object> revokeDestroy(Long id) {
  720 + Map<String, Object> rs = new HashMap<>();
  721 + try {
  722 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  723 + if (sch.getStatus() != -1) {
  724 + rs.put("status", ResponseCode.ERROR);
  725 + rs.put("msg", "未烂班,无法撤销!");
  726 + } else {
  727 + sch.setStatus(0);
  728 + rs.put("status", ResponseCode.SUCCESS);
  729 + rs.put("t", sch);
  730 +
  731 + }
  732 + } catch (Exception e) {
  733 + logger.error("", e);
  734 + rs.put("status", ResponseCode.ERROR);
  735 + }
  736 + return rs;
  737 + }
  738 +
  739 + @Override
  740 + public Map<String, Object> revokeRealOutgo(Long id) {
  741 + Map<String, Object> rs = new HashMap<>();
  742 + List<ScheduleRealInfo> ts = new ArrayList<>();
  743 +
  744 + try {
  745 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  746 + if (sch.getFcsjActual() == null) {
  747 + rs.put("status", ResponseCode.ERROR);
  748 + rs.put("msg", "无实发时间,无法撤销!");
  749 + } else {
  750 + //将对应的到离站数据标记为不可信
  751 + List<ArrivalEntity> list = ArrivalData_GPS.findByNbbm(sch.getClZbh());
  752 + for (ArrivalEntity arr : list) {
  753 + if (arr.getInOut() == 1
  754 + && arr.getUpDown() == Integer.parseInt(sch.getXlDir())
  755 + && arr.getStopNo().equals(sch.getQdzCode())
  756 + && Math.abs(arr.getTs() - sch.getFcsjActualTime()) < 1000 * 60) {
  757 + arr.setEnable(false);
  758 + break;
  759 + }
  760 + }
  761 +
  762 + sch.clearFcsjActual();
  763 + rs.put("status", ResponseCode.SUCCESS);
  764 +
  765 + ts.add(sch);
  766 + rs.put("ts", ts);
  767 +
  768 + }
  769 + } catch (Exception e) {
  770 + logger.error("", e);
  771 + rs.put("status", ResponseCode.ERROR);
  772 + }
  773 + return rs;
  774 + }
  775 +
  776 + @Override
  777 + public Map<String, Object> spaceAdjust(Long[] ids, Integer space) {
  778 +
  779 + List<ScheduleRealInfo> list = new ArrayList<>(), updateList = new ArrayList<>();
  780 + Map<String, Object> rs = new HashMap<>();
  781 + try {
  782 + ScheduleRealInfo sch, next;
  783 + for (Long id : ids) {
  784 + sch = dayOfSchedule.get(id);
  785 + if (null != sch)
  786 + list.add(sch);
  787 + }
  788 +
  789 + int size = list.size();
  790 + if (size == 0) {
  791 + rs.put("status", ResponseCode.ERROR);
  792 + } else {
  793 + // 按发车时间排序
  794 + Collections.sort(list, new ScheduleComparator.FCSJ());
  795 +
  796 + // 以第一个实际发车/待发时间为起点,调整间隔
  797 + sch = list.get(0);
  798 + Long st = sch.getFcsjActualTime() == null ? sch.getDfsjT() : sch.getFcsjActualTime(), plus = space * 60 * 1000L;
  799 +
  800 + for (int i = 1; i < size; i++) {
  801 + st += plus;
  802 + sch = list.get(i);
  803 + sch.setDfsjAll(st);
  804 + //重新计算终点时间
  805 + sch.calcEndTime();
  806 +
  807 + dayOfSchedule.save(sch);
  808 +
  809 + updateList.add(sch);
  810 + next = dayOfSchedule.next(sch);
  811 + if (next.getQdzName().equals(sch.getZdzName())) {
  812 + next.setQdzArrDateJH(sch.getZdsj());
  813 + updateList.add(next);
  814 + }
  815 + }
  816 +
  817 +
  818 + rs.put("status", ResponseCode.SUCCESS);
  819 + rs.put("ts", updateList);
  820 + }
  821 +
  822 + } catch (Exception e) {
  823 + logger.error("", e);
  824 + rs.put("status", ResponseCode.ERROR);
  825 + }
  826 + return rs;
  827 + }
  828 +
  829 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  830 +
  831 + @Override
  832 + public Map<String, Object> schInfoFineTune(Map<String, String> map) {
  833 + Map<String, Object> rs = new HashMap<>();
  834 + List<ScheduleRealInfo> ts = new ArrayList<>();
  835 + try {
  836 + Long id = Long.parseLong(map.get("id"));
  837 + //班次类型
  838 + //String bcType = map.get("bcType");
  839 + //车辆自编号
  840 + //String clZbh = map.get("clZbh");
  841 + //计划发车时间
  842 + //String fcsj = map.get("fcsj");
  843 + //实际发车时间
  844 + String fcsjActual = map.get("fcsjActual");
  845 + //实际终点时间
  846 + String zdsjActual = map.get("zdsjActual");
  847 + //备注
  848 + String remarks = map.get("remarks");
  849 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  850 + if (null != sch) {
  851 + if (StringUtils.isNotBlank(fcsjActual)) {
  852 + LineConfig config = lineConfigData.get(sch.getXlBm());
  853 + long t = 0L;
  854 + //小于线路开始运营时间,则默认跨过24点
  855 + if (fcsjActual.compareTo(config.getStartOpt()) < 0)
  856 + t = fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME) + fcsjActual);
  857 + else
  858 + t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual);
  859 +
  860 + //调整实发
  861 + if (!fcsjActual.equals(sch.getFcsjActual()))
  862 + sch.setFcsjActualAll(t);
  863 + } else {
  864 + //撤销实发
  865 + if (sch.getFcsjActual() != null)
  866 + revokeRealOutgo(sch.getId());
  867 + }
  868 + //实达时间
  869 + if (StringUtils.isNotBlank(zdsjActual)) {
  870 + if (!zdsjActual.equals(sch.getZdsjActual())) {
  871 + //调整实达
  872 + sch.setZdsjActualAll(zdsjActual);
  873 + //下一班次起点到达时间
  874 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  875 + if (null != next) {
  876 + next.setQdzArrDateSJ(zdsjActual);
  877 + ts.add(next);
  878 + }
  879 +
  880 + //重新计算车辆执行班次
  881 + dayOfSchedule.reCalcExecPlan(sch.getClZbh());
  882 + }
  883 + } else {
  884 + //清除实达时间
  885 + sch.clearZdsjActual();
  886 + //清除下一班次起点到达时间
  887 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  888 + if (null != next) {
  889 + next.setQdzArrDateSJ(null);
  890 + ts.add(next);
  891 + }
  892 + }
  893 + sch.setRemarks(remarks);
  894 +
  895 + try {
  896 + //烂班
  897 + if(map.get("status") != null
  898 + && Integer.parseInt(map.get("status").toString()) == -1){
  899 + destroy(sch.getId() + "", "", map.get("adjustExps").toString());
  900 + }
  901 + } catch (NumberFormatException e) {
  902 + logger.error("", e);
  903 + }
  904 + }
  905 +
  906 + String bcType = map.get("bcType");
  907 + if(StringUtils.isNotEmpty(bcType)){
  908 + sch.setBcType(bcType);
  909 + }
  910 + //班次状态
  911 + sch.calcStatus();
  912 + dayOfSchedule.save(sch);
  913 + //页面需要更新的班次信息
  914 + ts.add(sch);
  915 +
  916 + rs.put("status", ResponseCode.SUCCESS);
  917 + rs.put("ts", ts);
  918 + } catch (Exception e) {
  919 + logger.error("", e);
  920 + rs.put("status", ResponseCode.ERROR);
  921 + }
  922 + return rs;
  923 + }
  924 +
  925 + @Override
  926 + public Map<String, Object> outgoAdjustAll(String params) {
  927 + Map<String, Object> rs = new HashMap<>();
  928 + try {
  929 + JSONArray jsonArray = JSONArray.parseArray(params);
  930 +
  931 + ScheduleRealInfo schedule = null;
  932 + JSONObject jsonObj;
  933 + String dfsj;
  934 + for (int i = 0; i < jsonArray.size(); i++) {
  935 + jsonObj = jsonArray.getJSONObject(i);
  936 + dfsj = jsonObj.getString("t");
  937 + schedule = dayOfSchedule.get(jsonObj.getLong("id"));
  938 + //设置待发时间
  939 + schedule.setDfsjAll(dfsj);
  940 +
  941 + dayOfSchedule.save(schedule);
  942 + }
  943 +
  944 + rs.put("status", ResponseCode.SUCCESS);
  945 + //将更新的最后一个班次返回
  946 + rs.put("t", schedule);
  947 + } catch (Exception e) {
  948 + logger.error("", e);
  949 + rs.put("status", ResponseCode.ERROR);
  950 + }
  951 + return rs;
  952 + }
  953 +
  954 + @Override
  955 + public Map<String, Object> findRouteByLine(String lineCode) {
  956 + Map<String, Object> map = new HashMap<>();
  957 + //上行
  958 + Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode);
  959 + map.put("line.id_eq", lineId);
  960 + map.put("directions_eq", 0);
  961 + List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map);
  962 +
  963 + //下行
  964 + map.put("directions_eq", 1);
  965 + List<Map<String, Object>> downList = sectionRouteService.getSectionRoute(map);
  966 +
  967 + Map<String, Object> rs = new HashMap<>();
  968 +
  969 + String upVectors = "", vec;
  970 + //拼接上行路段
  971 + for (Map<String, Object> temp : upList) {
  972 + vec = temp.get("sectionBsectionVector").toString();
  973 + upVectors += vec.subSequence(11, vec.length() - 2) + " ";
  974 + }
  975 +
  976 + //拼接下行路段
  977 + String downVectors = "";
  978 + for (Map<String, Object> temp : downList) {//LINESTRING(
  979 + vec = temp.get("sectionBsectionVector").toString();
  980 + downVectors += vec.subSequence(11, vec.length() - 2) + " ";
  981 + }
  982 +
  983 +
  984 + rs.put("up", upVectors);
  985 + //上行gcj
  986 + rs.put("up_gcj", BdToGcjString(upVectors));
  987 + rs.put("down", downVectors);
  988 + //下行gcj
  989 + rs.put("down_gcj", BdToGcjString(downVectors));
  990 + rs.put("lineId", lineId);
  991 +
  992 + return rs;
  993 + }
  994 +
  995 + /**
  996 + * @param @param bdStr
  997 + * @throws
  998 + * @Title: BdToGcjString
  999 + * @Description: TODO(将百度路由字符串 转 成GCJ 字符串)
  1000 + */
  1001 + public String BdToGcjString(String bdStr) {
  1002 + String[] array = bdStr.split(","), subArray;
  1003 + if (array.length == 0 || bdStr.length() < 2)
  1004 + return "";
  1005 +
  1006 + String gcjStr = "";
  1007 + TransGPS.Location location;
  1008 + for (String crd : array) {
  1009 + subArray = crd.split(" ");
  1010 + if (subArray.length != 2)
  1011 + continue;
  1012 + location = TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(subArray[0]), Double.parseDouble(subArray[1])));
  1013 +
  1014 + gcjStr += location.getLng() + " " + location.getLat() + ",";
  1015 + }
  1016 +
  1017 + return gcjStr.substring(0, gcjStr.length() - 1);
  1018 + }
  1019 +
  1020 + public List<Map<String, String>> findLine(String line) {
  1021 + List<Line> listLine = lineRepository.findLine("%" + line + "%");
  1022 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  1023 + Map<String, String> map;
  1024 + for (Line temp : listLine) {
  1025 + if (temp != null) {
  1026 + String xlName = temp.getName();
  1027 + if (xlName.indexOf(line) != -1) {
  1028 + map = new HashMap<String, String>();
  1029 + map.put("id", temp.getLineCode());
  1030 + map.put("text", xlName);
  1031 + list.add(map);
  1032 + }
  1033 + }
  1034 + }
  1035 + return list;
  1036 + }
  1037 +
  1038 + public List<Map<String, String>> findLpName(String lpName) {
  1039 + List<GuideboardInfo> listLpName = guideboardInfoRepository.findLpName("%" + lpName + "%");
  1040 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  1041 + Map<String, String> map;
  1042 + for (GuideboardInfo temp : listLpName) {
  1043 + if (temp != null) {
  1044 + String lp = temp.getLpName();
  1045 + if (lp.indexOf(lpName) != -1) {
  1046 + map = new HashMap<String, String>();
  1047 + map.put("id", lp);
  1048 + map.put("text", lp);
  1049 + list.add(map);
  1050 + }
  1051 + }
  1052 + }
  1053 + return list;
  1054 + }
  1055 +
  1056 + @Override
  1057 + public Map<String, Object> findKMBC2(String jName, String clZbh, String date) {
  1058 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  1059 +
  1060 + DecimalFormat format = new DecimalFormat("0.00");
1138 1061 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1139 1062 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1140   - int jhbc = 0,cjbc = 0,ljbc = 0;
1141   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
1142   - float addMileage = 0l,remMileage = 0l;
1143   - String j_Name="";
1144   - Map<String,Object> map = new HashMap<String, Object>();
1145   - for(ScheduleRealInfo scheduleRealInfo : list){
1146   - if(scheduleRealInfo != null){
1147   - j_Name=scheduleRealInfo.getjName();
1148   - //计划里程(主任务过滤掉临加班次),
1149   - //烂班里程(主任务烂班),
1150   - //临加里程(主任务临加),
1151   - //计划班次,烂班班次,增加班次
1152   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1153   - if(scheduleRealInfo.isSflj()){
1154   - addMileage += tempJhlc;
1155   - ljbc++;
1156   - }else{
1157   - jhlc += tempJhlc;
1158   - jhbc++;
1159   - if(scheduleRealInfo.getStatus() == -1){
1160   - remMileage += tempJhlc;
1161   - cjbc++;
1162   - }
1163   - }
1164   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1165   - //计算营运里程,空驶里程
1166   - if(childTaskPlans.isEmpty()){
1167   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
1168   - || scheduleRealInfo.getBcType().equals("venting")){
1169   - ksgl += tempJhlc;
1170   - }else{
1171   - yygl += tempJhlc;
1172   - }
1173   - }else{
1174   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1175   - while(it.hasNext()){
1176   - ChildTaskPlan childTaskPlan = it.next();
1177   - if(childTaskPlan.getMileageType().equals("empty")){
1178   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1179   - }else{
1180   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1181   - }
1182   - }
1183   - }
1184   - }
1185   - }
1186   - map.put("j_name", j_Name);
1187   - map.put("jhlc", format.format(jhlc));
1188   - map.put("remMileage", format.format(remMileage));
1189   - map.put("addMileage", format.format(addMileage));
1190   - map.put("yygl", format.format(yygl));
1191   - map.put("ksgl", format.format(ksgl));
1192   - map.put("realMileage", format.format(yygl+ksgl));
1193   - map.put("jhbc", jhbc);
1194   - map.put("cjbc", cjbc);
1195   - map.put("ljbc", ljbc);
1196   - map.put("sjbc", jhbc-cjbc+ljbc);
1197   - return map;
1198   - }
1199   -
1200   -
1201   - @Override
1202   - public Map<String, Object> findKMBC(String jName, String clZbh,
1203   - String lpName,String date) {
1204   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date);
1205   - DecimalFormat format = new DecimalFormat("0.00");
  1063 + int jhbc = 0, cjbc = 0, ljbc = 0;
  1064 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0;
  1065 + float addMileage = 0l, remMileage = 0l;
  1066 + String j_Name = "";
  1067 + Map<String, Object> map = new HashMap<String, Object>();
  1068 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1069 + if (scheduleRealInfo != null) {
  1070 + j_Name = scheduleRealInfo.getjName();
  1071 + //计划里程(主任务过滤掉临加班次),
  1072 + //烂班里程(主任务烂班),
  1073 + //临加里程(主任务临加),
  1074 + //计划班次,烂班班次,增加班次
  1075 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1076 + if (scheduleRealInfo.isSflj()) {
  1077 + addMileage += tempJhlc;
  1078 + ljbc++;
  1079 + } else {
  1080 + jhlc += tempJhlc;
  1081 + jhbc++;
  1082 + if (scheduleRealInfo.getStatus() == -1) {
  1083 + remMileage += tempJhlc;
  1084 + cjbc++;
  1085 + }
  1086 + }
  1087 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1088 + //计算营运里程,空驶里程
  1089 + if (childTaskPlans.isEmpty()) {
  1090 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  1091 + || scheduleRealInfo.getBcType().equals("venting")) {
  1092 + ksgl += tempJhlc;
  1093 + } else {
  1094 + yygl += tempJhlc;
  1095 + }
  1096 + } else {
  1097 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1098 + while (it.hasNext()) {
  1099 + ChildTaskPlan childTaskPlan = it.next();
  1100 + if (childTaskPlan.getMileageType().equals("empty")) {
  1101 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1102 + } else {
  1103 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1104 + }
  1105 + }
  1106 + }
  1107 + }
  1108 + }
  1109 + map.put("j_name", j_Name);
  1110 + map.put("jhlc", format.format(jhlc));
  1111 + map.put("remMileage", format.format(remMileage));
  1112 + map.put("addMileage", format.format(addMileage));
  1113 + map.put("yygl", format.format(yygl));
  1114 + map.put("ksgl", format.format(ksgl));
  1115 + map.put("realMileage", format.format(yygl + ksgl));
  1116 + map.put("jhbc", jhbc);
  1117 + map.put("cjbc", cjbc);
  1118 + map.put("ljbc", ljbc);
  1119 + map.put("sjbc", jhbc - cjbc + ljbc);
  1120 + return map;
  1121 + }
  1122 +
  1123 +
  1124 + @Override
  1125 + public Map<String, Object> findKMBC(String jName, String clZbh,
  1126 + String lpName, String date) {
  1127 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date);
  1128 + DecimalFormat format = new DecimalFormat("0.00");
1206 1129 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1207 1130 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1208   - int jhbc = 0,cjbc = 0,ljbc = 0;
1209   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
1210   - float addMileage = 0l,remMileage = 0l;
1211   - Map<String,Object> map = new HashMap<String, Object>();
1212   - for(ScheduleRealInfo scheduleRealInfo : list){
1213   - if(scheduleRealInfo != null){
1214   - //计划里程(主任务过滤掉临加班次),
1215   - //烂班里程(主任务烂班),
1216   - //临加里程(主任务临加),
1217   - //计划班次,烂班班次,增加班次
1218   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1219   - if(scheduleRealInfo.isSflj()){
1220   - addMileage += tempJhlc;
1221   - ljbc++;
1222   - }else{
1223   - if( !(scheduleRealInfo.getBcType().equals("in")
1224   - ||scheduleRealInfo.getBcType().equals("out")) ){
1225   - jhbc++;
1226   - jhlc += tempJhlc;
1227   - }
1228   -
1229   - if(scheduleRealInfo.getStatus() == -1){
1230   - remMileage += tempJhlc;
1231   - cjbc++;
1232   - }
1233   - }
1234   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1235   - //计算营运里程,空驶里程
1236   - if(childTaskPlans.isEmpty()){
1237   - if(scheduleRealInfo.getBcType().equals("in") ||
1238   - scheduleRealInfo.getBcType().equals("out")){
1239   - jcclc +=tempJhlc;
1240   - }
1241   - //主任务 放空班次属于营运
  1131 + int jhbc = 0, cjbc = 0, ljbc = 0;
  1132 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  1133 + float addMileage = 0l, remMileage = 0l;
  1134 + Map<String, Object> map = new HashMap<String, Object>();
  1135 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1136 + if (scheduleRealInfo != null) {
  1137 + //计划里程(主任务过滤掉临加班次),
  1138 + //烂班里程(主任务烂班),
  1139 + //临加里程(主任务临加),
  1140 + //计划班次,烂班班次,增加班次
  1141 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1142 + if (scheduleRealInfo.isSflj()) {
  1143 + addMileage += tempJhlc;
  1144 + ljbc++;
  1145 + } else {
  1146 + if (!(scheduleRealInfo.getBcType().equals("in")
  1147 + || scheduleRealInfo.getBcType().equals("out"))) {
  1148 + jhbc++;
  1149 + jhlc += tempJhlc;
  1150 + }
  1151 +
  1152 + if (scheduleRealInfo.getStatus() == -1) {
  1153 + remMileage += tempJhlc;
  1154 + cjbc++;
  1155 + }
  1156 + }
  1157 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1158 + //计算营运里程,空驶里程
  1159 + if (childTaskPlans.isEmpty()) {
  1160 + if (scheduleRealInfo.getBcType().equals("in") ||
  1161 + scheduleRealInfo.getBcType().equals("out")) {
  1162 + jcclc += tempJhlc;
  1163 + }
  1164 + //主任务 放空班次属于营运
1242 1165 // else if(scheduleRealInfo.getBcType().equals("venting")){
1243 1166 // ksgl += tempJhlc;
1244 1167 // }
1245   - else{
1246   - if(scheduleRealInfo.getStatus() != -1){
1247   - yygl += tempJhlc;
1248   - }
1249   - }
1250   - }else{
1251   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1252   - while(it.hasNext()){
1253   - ChildTaskPlan childTaskPlan = it.next();
1254   - if(childTaskPlan.getMileageType().equals("empty")){
1255   - if(childTaskPlan.isDestroy()){
1256   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1257   - }else{
1258   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1259   - }
1260   - }else{
1261   - if(childTaskPlan.isDestroy()){
1262   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1168 + else {
  1169 + if (scheduleRealInfo.getStatus() != -1) {
  1170 + yygl += tempJhlc;
  1171 + }
  1172 + }
  1173 + } else {
  1174 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1175 + while (it.hasNext()) {
  1176 + ChildTaskPlan childTaskPlan = it.next();
  1177 + if (childTaskPlan.getMileageType().equals("empty")) {
  1178 + if (childTaskPlan.isDestroy()) {
  1179 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1180 + } else {
  1181 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1182 + }
  1183 + } else {
  1184 + if (childTaskPlan.isDestroy()) {
  1185 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
1263 1186 // cjbc++;
1264   - }else{
1265   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1266   - }
1267   - }
1268   - }
1269   - }
1270   - }
1271   - }
1272   - map.put("jhlc", format.format(jhlc));
1273   - map.put("remMileage", format.format(remMileage));
1274   - map.put("addMileage", format.format(addMileage));
1275   - map.put("yygl", format.format(yygl));
1276   - map.put("ksgl", format.format(ksgl));
1277   - map.put("realMileage", format.format(yygl+ksgl+jcclc));
1278   - map.put("jhbc", jhbc);
1279   - map.put("cjbc", cjbc);
1280   - map.put("ljbc", ljbc);
1281   - map.put("sjbc", jhbc-cjbc+ljbc);
1282   - map.put("jcclc", jcclc);
1283   - map.put("zkslc", format.format(ksgl+jcclc));
1284   - return map;
1285   - }
1286   -
1287   - @Override
1288   - public List<Map<String, Object>> account(String line, String date,
1289   - String code,String xlName, String type) {
1290   - List<Object[]> lsitObj = scheduleRealInfoRepository.account(line,date,code);
1291   - List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
1292   - Map<String,Object> map;
1293   - int i = 1;
1294   - for(Object[] obj : lsitObj){
1295   - if(obj != null){
1296   - map = new HashMap<String,Object>();
1297   - map.put("num", i++);
1298   - map.put("xlName", xlName);
1299   - map.put("clZbh", obj[3]);
1300   - map.put("company", obj[0]);
1301   - map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[1]+"")).toUpperCase());
1302   - map.put("requestTime", obj[2]);
1303   - listMap.add(map);
1304   - }
1305   - }
1306   -
1307   - if(type != null && type.length() != 0 && type.equals("export")){
1308   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1309   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
1310   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1311   - Map<String,Object> m = new HashMap<String, Object>();
1312   - ReportUtils ee = new ReportUtils();
1313   - Map<String, Object> typeMap = new HashMap<String, Object>();
1314   - typeMap.put("0xA1", "请求恢复运营");
1315   - typeMap.put("0xA2", "申请调档");
1316   - typeMap.put("0xA3", "出场请求");
1317   - typeMap.put("0xA5", "进场请求");
1318   - typeMap.put("0xA7", "加油请求");
1319   - typeMap.put("0x50", "车辆故障");
1320   - typeMap.put("0x70", "路阻报告");
1321   - typeMap.put("0x60", "事故报告");
1322   - typeMap.put("0x11", "扣证纠纷");
1323   - typeMap.put("0x12", "报警");
1324   - for(Map<String, Object> map1 : listMap){
1325   - map1.put("requestText", typeMap.get(map1.get("requestType")));
1326   - }
1327   - try {
1328   - listI.add(listMap.iterator());
1329   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
1330   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\account.xls",
1331   - path+"export\\驾驶员请求台账" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
1332   - } catch (Exception e) {
1333   - // TODO: handle exception
1334   - e.printStackTrace();
1335   - }
1336   - }
1337   -
1338   - return listMap;
1339   - }
1340   -
1341   - @Override
1342   - public List<ScheduleRealInfo> correctForm(String line, String startDate,
1343   - String endDate, String lpName, String code, String type) {
1344   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line,startDate,endDate,lpName,code);
1345   -
1346   - if(type != null && type.length() != 0 && type.equals("export")){
1347   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1348   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
1349   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1350   - Map<String,Object> m = new HashMap<String, Object>();
1351   - ReportUtils ee = new ReportUtils();
1352   - m.put("dates", startDate + " 至 " + endDate);
1353   - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
1354   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1355   - for(ScheduleRealInfo schedule : list){
1356   - Map<String, Object> tempMap = new HashMap<String, Object>();
1357   - tempMap.put("xlName", schedule.getXlName()!=null?schedule.getXlName():"");
1358   - tempMap.put("lpName", schedule.getLpName()!=null?schedule.getLpName():"");
1359   - tempMap.put("clZbh", schedule.getClZbh()!=null?schedule.getClZbh():"");
1360   - tempMap.put("jName", schedule.getjName()!=null?schedule.getjName():"");
1361   - tempMap.put("sName", schedule.getsName()!=null?schedule.getsName():"");
1362   - tempMap.put("fcsj", schedule.getFcsj()!=null?schedule.getFcsj():"");
1363   - tempMap.put("fcsjActual", schedule.getFcsjActual()!=null?schedule.getFcsjActual():"");
1364   - tempMap.put("zdsj", schedule.getZdsj()!=null?schedule.getZdsj():"");
1365   - tempMap.put("zdsjActual", schedule.getZdsjActual()!=null?schedule.getZdsjActual():"");
1366   - if(schedule.getUpdateBy() != null){
1367   - if(schedule.getUpdateBy().getName() != null)
1368   - tempMap.put("userName", schedule.getUpdateBy().getName());
1369   - else
1370   - tempMap.put("userName", "");
1371   - } else {
1372   - tempMap.put("userName", "");
1373   - }
1374   - if(schedule.getUpdateDate() != null){
1375   - tempMap.put("updateDate", sdf.format(schedule.getUpdateDate()));
1376   - } else {
1377   - tempMap.put("updateDate", "");
1378   - }
1379   - tempMap.put("remarks", schedule.getRemarks()!=null?schedule.getRemarks():"");
1380   - tempList.add(tempMap);
1381   - }
1382   - try {
1383   - listI.add(tempList.iterator());
1384   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
1385   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\correctForm.xls",
1386   - path+"export\\修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
1387   - } catch (Exception e) {
1388   - // TODO: handle exception
1389   - e.printStackTrace();
1390   - }
1391   - Map<String, Object> map = tempList.get(tempList.size() - 1);
1392   - System.out.println("tempMap:" + map);
1393   - }
1394   -
1395   - return list;
1396   - }
1397   -
1398   - @Override
1399   - public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1400   - String lpName,String date,String type) {
1401   - List <ScheduleRealInfo> list=null;
1402   - if(type.equals("qp")){
1403   - list= scheduleRealInfoRepository.queryListWaybill2(jName,clZbh,lpName,date);
1404   - }else{
1405   - list= scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName,date);
1406   - }
1407   - for (int i = 0; i < list.size(); i++) {
1408   - ScheduleRealInfo s=list.get(i);
1409   - String remarks="";
1410   - if(s.getRemarks()!=null){
1411   - remarks +=s.getRemarks();
1412   - }
1413   - Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
1414   - if(!childTaskPlans.isEmpty()){
1415   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1416   - while(it.hasNext()){
1417   - ChildTaskPlan c = it.next();
1418   - if(c.getRemarks()!=null && c.getRemarks().length()>0){
1419   - remarks += c.getRemarks();
1420   - }
1421   -
1422   - }
1423   - }
1424   - s.setRemarks(remarks);
1425   - }
1426   -
1427   - return list;
1428   - }
1429   -
1430   - @Override
1431   - public Map<String, Object> removeChildTask(Long taskId) {
1432   - Map<String, Object> rs = new HashMap<>();
1433   - ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);
1434   -
1435   - ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());
1436   - try {
1437   -
1438   - sch.getcTasks().remove(chTask);
1439   - scheduleRealInfoRepository.save(sch);
1440   - rs.put("status", ResponseCode.SUCCESS);
1441   - } catch (Exception e) {
1442   - logger.error("", e);
1443   - rs.put("status", ResponseCode.ERROR);
1444   - }
1445   - return rs;
1446   - }
1447   -
1448   - @Override
1449   - public List<Map<String, Object>> statisticsDaily(String line, String date,
1450   - String xlName) {
1451   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1452   - List<Map<String,Object>> lMap = new ArrayList<Map<String,Object>>();
1453   - DecimalFormat format = new DecimalFormat("0.00");
1454   - double jhlc = 0, tempJhlc = 0,childMileage = 0;
1455   - float sjgl = 0f,ssgl = 0f,ssgl_lz = 0f,ssgl_dm = 0f,ssgl_gz = 0f,ssgl_jf = 0f,ssgl_zs = 0f,ssgl_qr = 0f
1456   - ,ssgl_qc = 0f,ssgl_kx = 0f,ssgl_qh = 0f,ssgl_yw = 0f,ssgl_other = 0f,ljgl = 0f;
1457   - //班次
1458   - int sj_0 = 6*60+31,sj_1 = 8*60+30,sj_2 = 16*60+1,sj_3 = 18*60;
1459   - int jhbc = 0,jhbc_m = 0,jhbc_a = 0;
1460   - int sjbc = 0,sjbc_m = 0,sjbc_a = 0;
1461   - int ljbc = 0,ljbc_m = 0,ljbc_a = 0;
1462   - int fzbc = 0,fzbc_m = 0,fzbc_a = 0;
1463   - int dtbc = 0,dtbc_m = 0,dtbc_a = 0;
1464   - int djg = 0,djg_m = 0,djg_a = 0,djg_time = 0;
1465   - Map<String,Object> map = new HashMap<String, Object>();
1466   - for(ScheduleRealInfo scheduleRealInfo: list){
1467   - if(scheduleRealInfo != null){
1468   -
1469   - if(!(scheduleRealInfo.getBcType().equals("in")
1470   - ||scheduleRealInfo.getBcType().equals("out")) ){
1471   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1472   - //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
1473   - if(childTaskPlans.isEmpty()){
1474   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1475   - //临加公里
1476   - if(scheduleRealInfo.isSflj()){
1477   - ljgl += tempJhlc;
1478   - }else{
1479   - jhlc += tempJhlc;
1480   - }
1481   - if(scheduleRealInfo.getStatus() == 2){
1482   - sjgl += tempJhlc;
1483   - }else if(scheduleRealInfo.getStatus() == -1){
1484   - ssgl += tempJhlc;
1485   - if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("路阻") != -1){
1486   - ssgl_lz += tempJhlc;
1487   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("吊慢") != -1){
1488   - ssgl_dm += tempJhlc;
1489   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("故障") != -1){
1490   - ssgl_gz += tempJhlc;
1491   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("纠纷") != -1){
1492   - ssgl_jf += tempJhlc;
1493   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("肇事") != -1){
1494   - ssgl_zs += tempJhlc;
1495   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("缺人") != -1){
1496   - ssgl_qr += tempJhlc;
1497   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("缺车") != -1){
1498   - ssgl_qc += tempJhlc;
1499   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("客稀") != -1){
1500   - ssgl_kx += tempJhlc;
1501   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("气候") != -1){
1502   - ssgl_qh += tempJhlc;
1503   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("援外") != -1){
1504   - ssgl_yw += tempJhlc;
1505   - }else{
1506   - ssgl_other += tempJhlc;
1507   - }
1508   - }
1509   - }else{
1510   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1511   - while(it.hasNext()){
1512   - ChildTaskPlan childTaskPlan = it.next();
1513   - childMileage = childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1514   - jhlc += childMileage;
1515   - if(childTaskPlan.isDestroy()){
1516   - ssgl += childMileage;
1517   - if(childTaskPlan.getDestroyReason().equals("路阻")){
1518   - ssgl_lz += childTaskPlan.getMileage();
1519   - }else if(childTaskPlan.getDestroyReason().equals("吊慢")){
1520   - ssgl_dm += childTaskPlan.getMileage();
1521   - }else if(childTaskPlan.getDestroyReason().equals("故障")){
1522   - ssgl_gz += childTaskPlan.getMileage();
1523   - }else if(childTaskPlan.getDestroyReason().equals("纠纷")){
1524   - ssgl_jf += childTaskPlan.getMileage();
1525   - }else if(childTaskPlan.getDestroyReason().equals("肇事")){
1526   - ssgl_zs += childTaskPlan.getMileage();
1527   - }else if(childTaskPlan.getDestroyReason().equals("缺人")){
1528   - ssgl_qr += childTaskPlan.getMileage();
1529   - }else if(childTaskPlan.getDestroyReason().equals("缺车")){
1530   - ssgl_qc += childTaskPlan.getMileage();
1531   - }else if(childTaskPlan.getDestroyReason().equals("客稀")){
1532   - ssgl_kx += childTaskPlan.getMileage();
1533   - }else if(childTaskPlan.getDestroyReason().equals("气候")){
1534   - ssgl_qh += childTaskPlan.getMileage();
1535   - }else if(childTaskPlan.getDestroyReason().equals("援外")){
1536   - ssgl_yw += childTaskPlan.getMileage();
1537   - }else{
1538   - ssgl_other += childTaskPlan.getMileage();
1539   - }
1540   - }else{
1541   - sjgl += childMileage;
1542   - }
1543   - }
1544   - }
1545   -
1546   - //班次
1547   - jhbc++;
1548   - String[] fcsj = scheduleRealInfo.getFcsj().split(":");
1549   - String[] fcsjActual = (scheduleRealInfo.getFcsjActual()==null?"0:00":scheduleRealInfo.getFcsjActual()).split(":");
1550   - if((Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) > sj_0 && (Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) < sj_1){
1551   - jhbc_m++;
1552   - }else if((Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) > sj_2 && (Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) < sj_3){
1553   - jhbc_a++;
1554   - }
1555   - if(scheduleRealInfo.getStatus() == 2){
1556   - sjbc++;
1557   - if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_1){
1558   - sjbc_m++;
1559   - }else if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_3){
1560   - sjbc_a++;
1561   - }
1562   - }
1563   - if(scheduleRealInfo.isSflj()){
1564   - ljbc++;
1565   - if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_1){
1566   - ljbc_m++;
1567   - }else if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_3){
1568   - ljbc_a++;
1569   - }
1570   - }
1571   - if(scheduleRealInfo.getBcType().equals("venting")){
1572   - fzbc++;
1573   - if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_1){
1574   - fzbc_m++;
1575   - }else if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_3){
1576   - fzbc_a++;
1577   - }
1578   - }
1579   - }
1580   - }
1581   - }
1582   - map.put("xlName", xlName);
1583   - map.put("jhlc", format.format(jhlc));
1584   - map.put("sjgl", format.format(sjgl));
1585   - map.put("ssgl", format.format(ssgl));
1586   - map.put("ssgl_lz", ssgl_lz==0?0:format.format(ssgl_lz));
1587   - map.put("ssgl_dm", ssgl_dm==0?0:format.format(ssgl_dm));
1588   - map.put("ssgl_gz", ssgl_gz==0?0:format.format(ssgl_gz));
1589   - map.put("ssgl_jf", ssgl_jf==0?0:format.format(ssgl_jf));
1590   - map.put("ssgl_zs", ssgl_zs==0?0:format.format(ssgl_zs));
1591   - map.put("ssgl_qr", ssgl_qr==0?0:format.format(ssgl_qr));
1592   - map.put("ssgl_qc", ssgl_qc==0?0:format.format(ssgl_qc));
1593   - map.put("ssgl_kx", ssgl_kx==0?0:format.format(ssgl_kx));
1594   - map.put("ssgl_qh", ssgl_qh==0?0:format.format(ssgl_qh));
1595   - map.put("ssgl_yw", ssgl_yw==0?0:format.format(ssgl_yw));
1596   - map.put("ssgl_other", ssgl_other==0?0:format.format(ssgl_other));
1597   - map.put("ljgl", ljgl==0?0:format.format(ljgl));
1598   - map.put("jhbc", jhbc);
1599   - map.put("jhbc_m", jhbc_m);
1600   - map.put("jhbc_a", jhbc_a);
1601   - map.put("sjbc", sjbc);
1602   - map.put("sjbc_m", sjbc_m);
1603   - map.put("sjbc_a", sjbc_a);
1604   - map.put("ljbc", ljbc);
1605   - map.put("ljbc_m", ljbc_m);
1606   - map.put("ljbc_a", ljbc_a);
1607   - map.put("fzbc", fzbc);
1608   - map.put("fzbc_m", fzbc_m);
1609   - map.put("fzbc_a", fzbc_a);
1610   - map.put("dtbc", dtbc);
1611   - map.put("dtbc_m", dtbc_m);
1612   - map.put("dtbc_a", dtbc_a);
1613   - map.put("djg", djg);
1614   - map.put("djg_m", djg_m);
1615   - map.put("djg_a", djg_a);
1616   - map.put("djg_time", djg_time);
1617   - lMap.add(map);
1618   - return lMap;
1619   - }
1620   -
1621   - @Override
1622   - public Map<String,Object> scheduleDaily(String line, String date) {
1623   - Map<String,String> tempMap = null;
1624   - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1625   - Map<String, Object> map = new HashMap<String, Object>();
1626   - Double jhlc = 0.00;
1627   - Float sjgl = 0f,ssgl = 0f,ssgl_lz = 0f,ssgl_dm = 0f,ssgl_gz = 0f,ssgl_jf = 0f,ssgl_zs = 0f,ssgl_qr = 0f
1628   - ,ssgl_qc = 0f,ssgl_kx = 0f,ssgl_qh = 0f,ssgl_yw = 0f,ssgl_other = 0f,ljgl = 0f;
1629   - int jhbc = 0;
1630   - for(ScheduleRealInfo scheduleRealInfo:scheduleRealInfos){
1631   - if(scheduleRealInfo != null){
1632   - //计算里程(包括子任务)
1633   - jhlc += scheduleRealInfo.getJhlc();
1634   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1635   - if(!childTaskPlans.isEmpty()){
1636   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1637   - while(it.hasNext()){
1638   - ChildTaskPlan childTaskPlan = it.next();
1639   - //是否烂班,烂班就是少驶
1640   - if(!childTaskPlan.isDestroy()){
1641   - sjgl += childTaskPlan.getMileage();
1642   - }else{
1643   - ssgl += childTaskPlan.getMileage();
1644   - if(childTaskPlan.getDestroyReason().equals("路阻")){
1645   - ssgl_lz += childTaskPlan.getMileage();
1646   - }else if(childTaskPlan.getDestroyReason().equals("吊慢")){
1647   - ssgl_dm += childTaskPlan.getMileage();
1648   - }else if(childTaskPlan.getDestroyReason().equals("故障")){
1649   - ssgl_gz += childTaskPlan.getMileage();
1650   - }else if(childTaskPlan.getDestroyReason().equals("纠纷")){
1651   - ssgl_jf += childTaskPlan.getMileage();
1652   - }else if(childTaskPlan.getDestroyReason().equals("肇事")){
1653   - ssgl_zs += childTaskPlan.getMileage();
1654   - }else if(childTaskPlan.getDestroyReason().equals("缺人")){
1655   - ssgl_qr += childTaskPlan.getMileage();
1656   - }else if(childTaskPlan.getDestroyReason().equals("缺车")){
1657   - ssgl_qc += childTaskPlan.getMileage();
1658   - }else if(childTaskPlan.getDestroyReason().equals("客稀")){
1659   - ssgl_kx += childTaskPlan.getMileage();
1660   - }else if(childTaskPlan.getDestroyReason().equals("气候")){
1661   - ssgl_qh += childTaskPlan.getMileage();
1662   - }else if(childTaskPlan.getDestroyReason().equals("援外")){
1663   - ssgl_yw += childTaskPlan.getMileage();
1664   - }else{
1665   - ssgl_other += childTaskPlan.getMileage();
1666   - }
1667   - }
1668   - //临加公里
1669   - if(childTaskPlan.getType1().equals("临加")){
1670   - ljgl += childTaskPlan.getMileage();
1671   - }
1672   - }
1673   - }
1674   - //班次
1675   - scheduleRealInfo.getFcsjT();
1676   - scheduleRealInfo.getFcsjActualTime();
1677   - }
1678   - }
1679   - map.put("jhlc", jhlc);
1680   - map.put("sjgl", sjgl);
1681   - map.put("ssgl", ssgl);
1682   - map.put("ssgl_lz", ssgl_lz);
1683   - map.put("ssgl_dm", ssgl_dm);
1684   - map.put("ssgl_gz", ssgl_gz);
1685   - map.put("ssgl_jf", ssgl_jf);
1686   - map.put("ssgl_zs", ssgl_zs);
1687   - map.put("ssgl_qr", ssgl_qr);
1688   - map.put("ssgl_qc", ssgl_qc);
1689   - map.put("ssgl_kx", ssgl_kx);
1690   - map.put("ssgl_qh", ssgl_qh);
1691   - map.put("ssgl_yw", ssgl_yw);
1692   - map.put("ssgl_other", ssgl_other);
1693   - map.put("ljgl", ljgl);
1694   -
1695   - map.put("jhbc", scheduleRealInfos.size());
1696   - return null;
1697   - }
1698   -
1699   - @Override
1700   - public int countByLineCodeAndDate(String xlBm, String schDate) {
1701   - return scheduleRealInfoRepository.countByLineCodeAndDate(xlBm + "", schDate);
1702   - }
1703   -
1704   - @Override
1705   - public List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate) {
1706   - return scheduleRealInfoRepository.findByLineCodeAndDate(xlBm + "", schDate);
1707   - }
1708   -
1709   - @Override
1710   - public void deleteByLineCodeAndDate(String xlBm, String schDate) {
1711   - scheduleRealInfoRepository.deleteByLineCodeAndDate(xlBm + "", schDate);
1712   - }
1713   -
1714   - @Override
1715   - public Long getMaxId() {
1716   - return scheduleRealInfoRepository.getMaxId();
1717   - }
1718   -
1719   - @Override
1720   - public List<ScheduleRealInfo> realScheduleList(String line, String date) {
  1187 + } else {
  1188 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1189 + }
  1190 + }
  1191 + }
  1192 + }
  1193 + }
  1194 + }
  1195 + map.put("jhlc", format.format(jhlc));
  1196 + map.put("remMileage", format.format(remMileage));
  1197 + map.put("addMileage", format.format(addMileage));
  1198 + map.put("yygl", format.format(yygl));
  1199 + map.put("ksgl", format.format(ksgl));
  1200 + map.put("realMileage", format.format(yygl + ksgl + jcclc));
  1201 + map.put("jhbc", jhbc);
  1202 + map.put("cjbc", cjbc);
  1203 + map.put("ljbc", ljbc);
  1204 + map.put("sjbc", jhbc - cjbc + ljbc);
  1205 + map.put("jcclc", jcclc);
  1206 + map.put("zkslc", format.format(ksgl + jcclc));
  1207 + return map;
  1208 + }
  1209 +
  1210 + @Override
  1211 + public List<Map<String, Object>> account(String line, String date,
  1212 + String code, String xlName, String type) {
  1213 + List<Object[]> lsitObj = scheduleRealInfoRepository.account(line, date, code);
  1214 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  1215 + Map<String, Object> map;
  1216 + int i = 1;
  1217 + for (Object[] obj : lsitObj) {
  1218 + if (obj != null) {
  1219 + map = new HashMap<String, Object>();
  1220 + map.put("num", i++);
  1221 + map.put("xlName", xlName);
  1222 + map.put("clZbh", obj[3]);
  1223 + map.put("company", obj[0]);
  1224 + map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[1] + "")).toUpperCase());
  1225 + map.put("requestTime", obj[2]);
  1226 + listMap.add(map);
  1227 + }
  1228 + }
  1229 +
  1230 + if (type != null && type.length() != 0 && type.equals("export")) {
  1231 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1232 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1233 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1234 + Map<String, Object> m = new HashMap<String, Object>();
  1235 + ReportUtils ee = new ReportUtils();
  1236 + Map<String, Object> typeMap = new HashMap<String, Object>();
  1237 + typeMap.put("0xA1", "请求恢复运营");
  1238 + typeMap.put("0xA2", "申请调档");
  1239 + typeMap.put("0xA3", "出场请求");
  1240 + typeMap.put("0xA5", "进场请求");
  1241 + typeMap.put("0xA7", "加油请求");
  1242 + typeMap.put("0x50", "车辆故障");
  1243 + typeMap.put("0x70", "路阻报告");
  1244 + typeMap.put("0x60", "事故报告");
  1245 + typeMap.put("0x11", "扣证纠纷");
  1246 + typeMap.put("0x12", "报警");
  1247 + for (Map<String, Object> map1 : listMap) {
  1248 + map1.put("requestText", typeMap.get(map1.get("requestType")));
  1249 + }
  1250 + try {
  1251 + listI.add(listMap.iterator());
  1252 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  1253 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\account.xls",
  1254 + path + "export\\驾驶员请求台账" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1255 + } catch (Exception e) {
  1256 + // TODO: handle exception
  1257 + e.printStackTrace();
  1258 + }
  1259 + }
  1260 +
  1261 + return listMap;
  1262 + }
  1263 +
  1264 + @Override
  1265 + public List<ScheduleRealInfo> correctForm(String line, String startDate,
  1266 + String endDate, String lpName, String code, String type) {
  1267 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line, startDate, endDate, lpName, code);
  1268 +
  1269 + if (type != null && type.length() != 0 && type.equals("export")) {
  1270 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1271 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1272 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1273 + Map<String, Object> m = new HashMap<String, Object>();
  1274 + ReportUtils ee = new ReportUtils();
  1275 + m.put("dates", startDate + " 至 " + endDate);
  1276 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1277 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1278 + for (ScheduleRealInfo schedule : list) {
  1279 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1280 + tempMap.put("xlName", schedule.getXlName() != null ? schedule.getXlName() : "");
  1281 + tempMap.put("lpName", schedule.getLpName() != null ? schedule.getLpName() : "");
  1282 + tempMap.put("clZbh", schedule.getClZbh() != null ? schedule.getClZbh() : "");
  1283 + tempMap.put("jName", schedule.getjName() != null ? schedule.getjName() : "");
  1284 + tempMap.put("sName", schedule.getsName() != null ? schedule.getsName() : "");
  1285 + tempMap.put("fcsj", schedule.getFcsj() != null ? schedule.getFcsj() : "");
  1286 + tempMap.put("fcsjActual", schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "");
  1287 + tempMap.put("zdsj", schedule.getZdsj() != null ? schedule.getZdsj() : "");
  1288 + tempMap.put("zdsjActual", schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "");
  1289 + if (schedule.getUpdateBy() != null) {
  1290 + if (schedule.getUpdateBy().getName() != null)
  1291 + tempMap.put("userName", schedule.getUpdateBy().getName());
  1292 + else
  1293 + tempMap.put("userName", "");
  1294 + } else {
  1295 + tempMap.put("userName", "");
  1296 + }
  1297 + if (schedule.getUpdateDate() != null) {
  1298 + tempMap.put("updateDate", sdf.format(schedule.getUpdateDate()));
  1299 + } else {
  1300 + tempMap.put("updateDate", "");
  1301 + }
  1302 + tempMap.put("remarks", schedule.getRemarks() != null ? schedule.getRemarks() : "");
  1303 + tempList.add(tempMap);
  1304 + }
  1305 + try {
  1306 + listI.add(tempList.iterator());
  1307 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  1308 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\correctForm.xls",
  1309 + path + "export\\修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  1310 + } catch (Exception e) {
  1311 + // TODO: handle exception
  1312 + e.printStackTrace();
  1313 + }
  1314 + Map<String, Object> map = tempList.get(tempList.size() - 1);
  1315 + System.out.println("tempMap:" + map);
  1316 + }
  1317 +
  1318 + return list;
  1319 + }
  1320 +
  1321 + @Override
  1322 + public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
  1323 + String lpName, String date, String type) {
  1324 + List<ScheduleRealInfo> list = null;
  1325 + if (type.equals("qp")) {
  1326 + list = scheduleRealInfoRepository.queryListWaybill2(jName, clZbh, lpName, date);
  1327 + } else {
  1328 + list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date);
  1329 + }
  1330 + for (int i = 0; i < list.size(); i++) {
  1331 + ScheduleRealInfo s = list.get(i);
  1332 + String remarks = "";
  1333 + if (s.getRemarks() != null) {
  1334 + remarks += s.getRemarks();
  1335 + }
  1336 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  1337 + if (!childTaskPlans.isEmpty()) {
  1338 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1339 + while (it.hasNext()) {
  1340 + ChildTaskPlan c = it.next();
  1341 + if (c.getRemarks() != null && c.getRemarks().length() > 0) {
  1342 + remarks += c.getRemarks();
  1343 + }
  1344 +
  1345 + }
  1346 + }
  1347 + s.setRemarks(remarks);
  1348 + }
  1349 +
  1350 + return list;
  1351 + }
  1352 +
  1353 + @Override
  1354 + public Map<String, Object> removeChildTask(Long taskId) {
  1355 + Map<String, Object> rs = new HashMap<>();
  1356 + ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);
  1357 +
  1358 + ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());
  1359 + try {
  1360 +
  1361 + sch.getcTasks().remove(chTask);
  1362 + scheduleRealInfoRepository.save(sch);
  1363 + rs.put("status", ResponseCode.SUCCESS);
  1364 + } catch (Exception e) {
  1365 + logger.error("", e);
  1366 + rs.put("status", ResponseCode.ERROR);
  1367 + }
  1368 + return rs;
  1369 + }
  1370 +
  1371 + @Override
  1372 + public List<Map<String, Object>> statisticsDaily(String line, String date,
  1373 + String xlName) {
  1374 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1375 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  1376 + DecimalFormat format = new DecimalFormat("0.00");
  1377 + double jhlc = 0, tempJhlc = 0, childMileage = 0;
  1378 + 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;
  1379 + //班次
  1380 + int sj_0 = 6 * 60 + 31, sj_1 = 8 * 60 + 30, sj_2 = 16 * 60 + 1, sj_3 = 18 * 60;
  1381 + int jhbc = 0, jhbc_m = 0, jhbc_a = 0;
  1382 + int sjbc = 0, sjbc_m = 0, sjbc_a = 0;
  1383 + int ljbc = 0, ljbc_m = 0, ljbc_a = 0;
  1384 + int fzbc = 0, fzbc_m = 0, fzbc_a = 0;
  1385 + int dtbc = 0, dtbc_m = 0, dtbc_a = 0;
  1386 + int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0;
  1387 + Map<String, Object> map = new HashMap<String, Object>();
  1388 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1389 + if (scheduleRealInfo != null) {
  1390 +
  1391 + if (!(scheduleRealInfo.getBcType().equals("in")
  1392 + || scheduleRealInfo.getBcType().equals("out"))) {
  1393 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1394 + //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  1395 + if (childTaskPlans.isEmpty()) {
  1396 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1397 + //临加公里
  1398 + if (scheduleRealInfo.isSflj()) {
  1399 + ljgl += tempJhlc;
  1400 + } else {
  1401 + jhlc += tempJhlc;
  1402 + }
  1403 + if (scheduleRealInfo.getStatus() == 2) {
  1404 + sjgl += tempJhlc;
  1405 + } else if (scheduleRealInfo.getStatus() == -1) {
  1406 + ssgl += tempJhlc;
  1407 + if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("路阻") != -1) {
  1408 + ssgl_lz += tempJhlc;
  1409 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("吊慢") != -1) {
  1410 + ssgl_dm += tempJhlc;
  1411 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("故障") != -1) {
  1412 + ssgl_gz += tempJhlc;
  1413 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("纠纷") != -1) {
  1414 + ssgl_jf += tempJhlc;
  1415 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("肇事") != -1) {
  1416 + ssgl_zs += tempJhlc;
  1417 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺人") != -1) {
  1418 + ssgl_qr += tempJhlc;
  1419 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺车") != -1) {
  1420 + ssgl_qc += tempJhlc;
  1421 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("客稀") != -1) {
  1422 + ssgl_kx += tempJhlc;
  1423 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("气候") != -1) {
  1424 + ssgl_qh += tempJhlc;
  1425 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("援外") != -1) {
  1426 + ssgl_yw += tempJhlc;
  1427 + } else {
  1428 + ssgl_other += tempJhlc;
  1429 + }
  1430 + }
  1431 + } else {
  1432 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1433 + while (it.hasNext()) {
  1434 + ChildTaskPlan childTaskPlan = it.next();
  1435 + childMileage = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1436 + jhlc += childMileage;
  1437 + if (childTaskPlan.isDestroy()) {
  1438 + ssgl += childMileage;
  1439 + if (childTaskPlan.getDestroyReason().equals("路阻")) {
  1440 + ssgl_lz += childTaskPlan.getMileage();
  1441 + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) {
  1442 + ssgl_dm += childTaskPlan.getMileage();
  1443 + } else if (childTaskPlan.getDestroyReason().equals("故障")) {
  1444 + ssgl_gz += childTaskPlan.getMileage();
  1445 + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) {
  1446 + ssgl_jf += childTaskPlan.getMileage();
  1447 + } else if (childTaskPlan.getDestroyReason().equals("肇事")) {
  1448 + ssgl_zs += childTaskPlan.getMileage();
  1449 + } else if (childTaskPlan.getDestroyReason().equals("缺人")) {
  1450 + ssgl_qr += childTaskPlan.getMileage();
  1451 + } else if (childTaskPlan.getDestroyReason().equals("缺车")) {
  1452 + ssgl_qc += childTaskPlan.getMileage();
  1453 + } else if (childTaskPlan.getDestroyReason().equals("客稀")) {
  1454 + ssgl_kx += childTaskPlan.getMileage();
  1455 + } else if (childTaskPlan.getDestroyReason().equals("气候")) {
  1456 + ssgl_qh += childTaskPlan.getMileage();
  1457 + } else if (childTaskPlan.getDestroyReason().equals("援外")) {
  1458 + ssgl_yw += childTaskPlan.getMileage();
  1459 + } else {
  1460 + ssgl_other += childTaskPlan.getMileage();
  1461 + }
  1462 + } else {
  1463 + sjgl += childMileage;
  1464 + }
  1465 + }
  1466 + }
  1467 +
  1468 + //班次
  1469 + jhbc++;
  1470 + String[] fcsj = scheduleRealInfo.getFcsj().split(":");
  1471 + String[] fcsjActual = (scheduleRealInfo.getFcsjActual() == null ? "0:00" : scheduleRealInfo.getFcsjActual()).split(":");
  1472 + if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_0 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_1) {
  1473 + jhbc_m++;
  1474 + } else if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_2 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_3) {
  1475 + jhbc_a++;
  1476 + }
  1477 + if (scheduleRealInfo.getStatus() == 2) {
  1478 + sjbc++;
  1479 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1480 + sjbc_m++;
  1481 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1482 + sjbc_a++;
  1483 + }
  1484 + }
  1485 + if (scheduleRealInfo.isSflj()) {
  1486 + ljbc++;
  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 + ljbc_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 + ljbc_a++;
  1491 + }
  1492 + }
  1493 + if (scheduleRealInfo.getBcType().equals("venting")) {
  1494 + fzbc++;
  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 + fzbc_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 + fzbc_a++;
  1499 + }
  1500 + }
  1501 + }
  1502 + }
  1503 + }
  1504 + map.put("xlName", xlName);
  1505 + map.put("jhlc", format.format(jhlc));
  1506 + map.put("sjgl", format.format(sjgl));
  1507 + map.put("ssgl", format.format(ssgl));
  1508 + map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
  1509 + map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
  1510 + map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
  1511 + map.put("ssgl_jf", ssgl_jf == 0 ? 0 : format.format(ssgl_jf));
  1512 + map.put("ssgl_zs", ssgl_zs == 0 ? 0 : format.format(ssgl_zs));
  1513 + map.put("ssgl_qr", ssgl_qr == 0 ? 0 : format.format(ssgl_qr));
  1514 + map.put("ssgl_qc", ssgl_qc == 0 ? 0 : format.format(ssgl_qc));
  1515 + map.put("ssgl_kx", ssgl_kx == 0 ? 0 : format.format(ssgl_kx));
  1516 + map.put("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh));
  1517 + map.put("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw));
  1518 + map.put("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other));
  1519 + map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl));
  1520 + map.put("jhbc", jhbc);
  1521 + map.put("jhbc_m", jhbc_m);
  1522 + map.put("jhbc_a", jhbc_a);
  1523 + map.put("sjbc", sjbc);
  1524 + map.put("sjbc_m", sjbc_m);
  1525 + map.put("sjbc_a", sjbc_a);
  1526 + map.put("ljbc", ljbc);
  1527 + map.put("ljbc_m", ljbc_m);
  1528 + map.put("ljbc_a", ljbc_a);
  1529 + map.put("fzbc", fzbc);
  1530 + map.put("fzbc_m", fzbc_m);
  1531 + map.put("fzbc_a", fzbc_a);
  1532 + map.put("dtbc", dtbc);
  1533 + map.put("dtbc_m", dtbc_m);
  1534 + map.put("dtbc_a", dtbc_a);
  1535 + map.put("djg", djg);
  1536 + map.put("djg_m", djg_m);
  1537 + map.put("djg_a", djg_a);
  1538 + map.put("djg_time", djg_time);
  1539 + lMap.add(map);
  1540 + return lMap;
  1541 + }
  1542 +
  1543 + @Override
  1544 + public Map<String, Object> scheduleDaily(String line, String date) {
  1545 + Map<String, String> tempMap = null;
  1546 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1547 + Map<String, Object> map = new HashMap<String, Object>();
  1548 + Double jhlc = 0.00;
  1549 + 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;
  1550 + int jhbc = 0;
  1551 + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) {
  1552 + if (scheduleRealInfo != null) {
  1553 + //计算里程(包括子任务)
  1554 + jhlc += scheduleRealInfo.getJhlc();
  1555 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1556 + if (!childTaskPlans.isEmpty()) {
  1557 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1558 + while (it.hasNext()) {
  1559 + ChildTaskPlan childTaskPlan = it.next();
  1560 + //是否烂班,烂班就是少驶
  1561 + if (!childTaskPlan.isDestroy()) {
  1562 + sjgl += childTaskPlan.getMileage();
  1563 + } else {
  1564 + ssgl += childTaskPlan.getMileage();
  1565 + if (childTaskPlan.getDestroyReason().equals("路阻")) {
  1566 + ssgl_lz += childTaskPlan.getMileage();
  1567 + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) {
  1568 + ssgl_dm += childTaskPlan.getMileage();
  1569 + } else if (childTaskPlan.getDestroyReason().equals("故障")) {
  1570 + ssgl_gz += childTaskPlan.getMileage();
  1571 + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) {
  1572 + ssgl_jf += childTaskPlan.getMileage();
  1573 + } else if (childTaskPlan.getDestroyReason().equals("肇事")) {
  1574 + ssgl_zs += childTaskPlan.getMileage();
  1575 + } else if (childTaskPlan.getDestroyReason().equals("缺人")) {
  1576 + ssgl_qr += childTaskPlan.getMileage();
  1577 + } else if (childTaskPlan.getDestroyReason().equals("缺车")) {
  1578 + ssgl_qc += childTaskPlan.getMileage();
  1579 + } else if (childTaskPlan.getDestroyReason().equals("客稀")) {
  1580 + ssgl_kx += childTaskPlan.getMileage();
  1581 + } else if (childTaskPlan.getDestroyReason().equals("气候")) {
  1582 + ssgl_qh += childTaskPlan.getMileage();
  1583 + } else if (childTaskPlan.getDestroyReason().equals("援外")) {
  1584 + ssgl_yw += childTaskPlan.getMileage();
  1585 + } else {
  1586 + ssgl_other += childTaskPlan.getMileage();
  1587 + }
  1588 + }
  1589 + //临加公里
  1590 + if (childTaskPlan.getType1().equals("临加")) {
  1591 + ljgl += childTaskPlan.getMileage();
  1592 + }
  1593 + }
  1594 + }
  1595 + //班次
  1596 + scheduleRealInfo.getFcsjT();
  1597 + scheduleRealInfo.getFcsjActualTime();
  1598 + }
  1599 + }
  1600 + map.put("jhlc", jhlc);
  1601 + map.put("sjgl", sjgl);
  1602 + map.put("ssgl", ssgl);
  1603 + map.put("ssgl_lz", ssgl_lz);
  1604 + map.put("ssgl_dm", ssgl_dm);
  1605 + map.put("ssgl_gz", ssgl_gz);
  1606 + map.put("ssgl_jf", ssgl_jf);
  1607 + map.put("ssgl_zs", ssgl_zs);
  1608 + map.put("ssgl_qr", ssgl_qr);
  1609 + map.put("ssgl_qc", ssgl_qc);
  1610 + map.put("ssgl_kx", ssgl_kx);
  1611 + map.put("ssgl_qh", ssgl_qh);
  1612 + map.put("ssgl_yw", ssgl_yw);
  1613 + map.put("ssgl_other", ssgl_other);
  1614 + map.put("ljgl", ljgl);
  1615 +
  1616 + map.put("jhbc", scheduleRealInfos.size());
  1617 + return null;
  1618 + }
  1619 +
  1620 + @Override
  1621 + public int countByLineCodeAndDate(String xlBm, String schDate) {
  1622 + return scheduleRealInfoRepository.countByLineCodeAndDate(xlBm + "", schDate);
  1623 + }
  1624 +
  1625 + @Override
  1626 + public List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate) {
  1627 + return scheduleRealInfoRepository.findByLineCodeAndDate(xlBm + "", schDate);
  1628 + }
  1629 +
  1630 + @Override
  1631 + public void deleteByLineCodeAndDate(String xlBm, String schDate) {
  1632 + scheduleRealInfoRepository.deleteByLineCodeAndDate(xlBm + "", schDate);
  1633 + }
  1634 +
  1635 + @Override
  1636 + public Long getMaxId() {
  1637 + return scheduleRealInfoRepository.getMaxId();
  1638 + }
  1639 +
  1640 + @Override
  1641 + public List<ScheduleRealInfo> realScheduleList(String line, String date) {
1721 1642 /*List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.queryUserInfo(line, date);
1722 1643 List<ScheduleRealInfo> listTotal = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1723 1644 for(ScheduleRealInfo info:listInfo){
... ... @@ -1727,91 +1648,91 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1727 1648 }
1728 1649 }
1729 1650 }*/
1730   - return scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1731   - }
  1651 + return scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1652 + }
1732 1653  
1733 1654  
1734   - public List<Map<String,Object>> yesterdayDataList(String line,String date) {
1735   - //前一天日期
  1655 + public List<Map<String, Object>> yesterdayDataList(String line, String date) {
  1656 + //前一天日期
1736 1657 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
1737 1658 // String date = "2016-09-20";
1738   - List<Map<String,Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
  1659 + List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
1739 1660 // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1740   - for(int x=0;x<yesterdayDataList.size();x++){
1741   - String jName=yesterdayDataList.get(x).get("jGh").toString();
1742   - String clZbh=yesterdayDataList.get(x).get("clZbh").toString();
1743   - List<ScheduleRealInfo> lists=scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
1744   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
1745   - float addMileage = 0l,remMileage = 0l;
1746   - Map<String,Object> map = new HashMap<String, Object>();
1747   - boolean fage=true;
1748   - for(ScheduleRealInfo scheduleRealInfo : lists){
1749   - if(fage){
1750   - //根据线路代码获取公司
1751   - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
1752   - yesterdayDataList.get(x).put("company", li.getCompany());
1753   - yesterdayDataList.get(x).put("bCompany", li.getBrancheCompany());
1754   - fage=false;
1755   - }
1756   - if(scheduleRealInfo != null){
1757   - //计划里程(主任务过滤掉临加班次),
1758   - //烂班里程(主任务烂班),
1759   - //临加里程(主任务临加),
1760   - //计划班次,烂班班次,增加班次
1761   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1762   - if(scheduleRealInfo.isSflj()){
1763   - addMileage += tempJhlc;
1764   - }else{
1765   - if( !(scheduleRealInfo.getBcType().equals("in")
1766   - ||scheduleRealInfo.getBcType().equals("out")) ){
1767   - jhlc += tempJhlc;
1768   - }
1769   -
1770   - if(scheduleRealInfo.getStatus() == -1){
1771   - remMileage += tempJhlc;
1772   - }
1773   - }
1774   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1775   - //计算营运里程,空驶里程
1776   - if(childTaskPlans.isEmpty()){
1777   - if(scheduleRealInfo.getBcType().equals("in") ||
1778   - scheduleRealInfo.getBcType().equals("out")){
1779   - jcclc +=tempJhlc;
1780   - }
1781   - //主任务 放空班次属于营运
  1661 + for (int x = 0; x < yesterdayDataList.size(); x++) {
  1662 + String jName = yesterdayDataList.get(x).get("jGh").toString();
  1663 + String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
  1664 + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  1665 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  1666 + float addMileage = 0l, remMileage = 0l;
  1667 + Map<String, Object> map = new HashMap<String, Object>();
  1668 + boolean fage = true;
  1669 + for (ScheduleRealInfo scheduleRealInfo : lists) {
  1670 + if (fage) {
  1671 + //根据线路代码获取公司
  1672 + Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
  1673 + yesterdayDataList.get(x).put("company", li.getCompany());
  1674 + yesterdayDataList.get(x).put("bCompany", li.getBrancheCompany());
  1675 + fage = false;
  1676 + }
  1677 + if (scheduleRealInfo != null) {
  1678 + //计划里程(主任务过滤掉临加班次),
  1679 + //烂班里程(主任务烂班),
  1680 + //临加里程(主任务临加),
  1681 + //计划班次,烂班班次,增加班次
  1682 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1683 + if (scheduleRealInfo.isSflj()) {
  1684 + addMileage += tempJhlc;
  1685 + } else {
  1686 + if (!(scheduleRealInfo.getBcType().equals("in")
  1687 + || scheduleRealInfo.getBcType().equals("out"))) {
  1688 + jhlc += tempJhlc;
  1689 + }
  1690 +
  1691 + if (scheduleRealInfo.getStatus() == -1) {
  1692 + remMileage += tempJhlc;
  1693 + }
  1694 + }
  1695 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1696 + //计算营运里程,空驶里程
  1697 + if (childTaskPlans.isEmpty()) {
  1698 + if (scheduleRealInfo.getBcType().equals("in") ||
  1699 + scheduleRealInfo.getBcType().equals("out")) {
  1700 + jcclc += tempJhlc;
  1701 + }
  1702 + //主任务 放空班次属于营运
1782 1703 // else if(scheduleRealInfo.getBcType().equals("venting")){
1783 1704 // ksgl += tempJhlc;
1784 1705 // }
1785   - else{
1786   - if(scheduleRealInfo.getStatus() != -1){
1787   - yygl += tempJhlc;
1788   - }
1789   - }
1790   - }else{
1791   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1792   - while(it.hasNext()){
1793   - ChildTaskPlan childTaskPlan = it.next();
1794   - if(childTaskPlan.getMileageType().equals("empty")){
1795   - if(childTaskPlan.isDestroy()){
1796   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1797   - }else{
1798   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1799   - }
1800   - }else{
1801   - if(childTaskPlan.isDestroy()){
1802   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1803   - }else{
1804   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1805   - }
1806   - }
1807   - }
1808   - }
1809   - }
1810   - }
1811   -
1812   - yesterdayDataList.get(x).put("totalKilometers", yygl+ksgl+jcclc);
1813   -
1814   - }
  1706 + else {
  1707 + if (scheduleRealInfo.getStatus() != -1) {
  1708 + yygl += tempJhlc;
  1709 + }
  1710 + }
  1711 + } else {
  1712 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1713 + while (it.hasNext()) {
  1714 + ChildTaskPlan childTaskPlan = it.next();
  1715 + if (childTaskPlan.getMileageType().equals("empty")) {
  1716 + if (childTaskPlan.isDestroy()) {
  1717 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1718 + } else {
  1719 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1720 + }
  1721 + } else {
  1722 + if (childTaskPlan.isDestroy()) {
  1723 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1724 + } else {
  1725 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1726 + }
  1727 + }
  1728 + }
  1729 + }
  1730 + }
  1731 + }
  1732 +
  1733 + yesterdayDataList.get(x).put("totalKilometers", yygl + ksgl + jcclc);
  1734 +
  1735 + }
1815 1736  
1816 1737 /* for(ScheduleRealInfo scheduleRealInfo:list){
1817 1738 if(scheduleRealInfo != null){
... ... @@ -1842,109 +1763,106 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1842 1763 }
1843 1764 }
1844 1765 }*/
1845   - //增加顺序号
1846   - for(int i=0;i<yesterdayDataList.size();i++){
1847   - if(i == 0){
1848   - yesterdayDataList.get(i).put("seqNumber", 1);
1849   - }else{
1850   - if(yesterdayDataList.get(i-1).get("clZbh").equals(yesterdayDataList.get(i).get("clZbh"))){
1851   - yesterdayDataList.get(i).put("seqNumber", 1+(int)yesterdayDataList.get(i-1).get("seqNumber"));
1852   - }else{
1853   - yesterdayDataList.get(i).put("seqNumber", 1);
1854   - }
1855   - }
1856   - }
1857   - return yesterdayDataList;
1858   - }
1859   -
1860   - /**
1861   - * 批量调整人车
1862   - */
1863   - @Override
1864   - public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs) {
1865   - Map<String, Object> rs = new HashMap<>();
1866   - Set<ScheduleRealInfo> set = new HashSet<>();
1867   -
1868   - ScheduleRealInfo sch;
1869   - BiMap<String, String> map = BasicData.deviceId2NbbmMap.inverse();
1870   -
1871   - for(ChangePersonCar cpc : cpcs){
1872   -
1873   - if(map.get(cpc.getClZbh()) == null){
1874   - rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!");
1875   - rs.put("status", ResponseCode.ERROR);
1876   - return rs;
1877   - }
1878   -
1879   - sch = dayOfSchedule.get(cpc.getSchId());
1880   - if(sch==null)
1881   - continue;
1882   -
1883   - if(StringUtils.isNotEmpty(cpc.getJsy())){
1884   - //换驾驶员
1885   - persoChange(sch, cpc.getJsy().split("/")[0]);
1886   - }
1887   -
1888   - //换售票员
1889   - if(StringUtils.isNotEmpty(cpc.getSpy())){
1890   - persoChangeSPY(sch, cpc.getSpy().split("/")[0]);
1891   - }
1892   -
1893   - //换车
1894   - if(StringUtils.isNotEmpty(cpc.getClZbh())){
1895   - set.add(sch);
1896   - set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh()));
1897   - }
1898   -
1899   - }
1900   - rs.put("ts", set);
1901   - rs.put("status", ResponseCode.SUCCESS);
1902   - return rs;
1903   - }
1904   -
1905   - /**
1906   - *
1907   - * @Title: persoChange
1908   - * @Description: TODO(班次换驾驶员)
1909   - */
1910   - public void persoChange(ScheduleRealInfo sch, String jGh){
1911   - if(sch.getjGh().equals(jGh))
1912   - return;
1913   - String jName = BasicData.allPerson.get(jGh);
1914   - if(StringUtils.isNotEmpty(jName)){
1915   - sch.setjGh(jGh);
1916   - sch.setjName(jName);
1917   - }
1918   - }
1919   -
1920   - /**
1921   - *
1922   - * @Title: persoChange
1923   - * @Description: TODO(班次换售票员)
1924   - */
1925   - public void persoChangeSPY(ScheduleRealInfo sch, String sGh){
1926   - if(sch.getsGh().equals(sGh))
1927   - return;
1928   - String sName = BasicData.allPerson.get(sGh);
1929   - if(StringUtils.isNotEmpty(sName)){
1930   - sch.setsGh(sGh);
1931   - sch.setsName(sName);
1932   - }
1933   - }
1934   -
1935   - /**
1936   - * 批量待发调整
1937   - */
1938   - @Override
1939   - public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) {
1940   - Map<String, Object> rs = new HashMap<>()
1941   - ,tempMap = new HashMap<>();
1942   - List<ScheduleRealInfo> list = new ArrayList<>();
1943   -
1944   - ScheduleRealInfo sch,next;
1945   - for(DfsjChange dc : dfsjcs){
1946   - if(StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj()))
1947   - continue;
  1766 + //增加顺序号
  1767 + for (int i = 0; i < yesterdayDataList.size(); i++) {
  1768 + if (i == 0) {
  1769 + yesterdayDataList.get(i).put("seqNumber", 1);
  1770 + } else {
  1771 + if (yesterdayDataList.get(i - 1).get("clZbh").equals(yesterdayDataList.get(i).get("clZbh"))) {
  1772 + yesterdayDataList.get(i).put("seqNumber", 1 + (int) yesterdayDataList.get(i - 1).get("seqNumber"));
  1773 + } else {
  1774 + yesterdayDataList.get(i).put("seqNumber", 1);
  1775 + }
  1776 + }
  1777 + }
  1778 + return yesterdayDataList;
  1779 + }
  1780 +
  1781 + /**
  1782 + * 批量调整人车
  1783 + */
  1784 + @Override
  1785 + public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs) {
  1786 + Map<String, Object> rs = new HashMap<>();
  1787 + Set<ScheduleRealInfo> set = new HashSet<>();
  1788 +
  1789 + ScheduleRealInfo sch;
  1790 + BiMap<String, String> map = BasicData.deviceId2NbbmMap.inverse();
  1791 +
  1792 + for (ChangePersonCar cpc : cpcs) {
  1793 +
  1794 + if (map.get(cpc.getClZbh()) == null) {
  1795 + rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!");
  1796 + rs.put("status", ResponseCode.ERROR);
  1797 + return rs;
  1798 + }
  1799 +
  1800 + sch = dayOfSchedule.get(cpc.getSchId());
  1801 + if (sch == null)
  1802 + continue;
  1803 +
  1804 + if (StringUtils.isNotEmpty(cpc.getJsy())) {
  1805 + //换驾驶员
  1806 + persoChange(sch, cpc.getJsy().split("/")[0]);
  1807 + }
  1808 +
  1809 + //换售票员
  1810 + if (StringUtils.isNotEmpty(cpc.getSpy())) {
  1811 + persoChangeSPY(sch, cpc.getSpy().split("/")[0]);
  1812 + }
  1813 +
  1814 + //换车
  1815 + if (StringUtils.isNotEmpty(cpc.getClZbh())) {
  1816 + set.add(sch);
  1817 + set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh()));
  1818 + }
  1819 +
  1820 + }
  1821 + rs.put("ts", set);
  1822 + rs.put("status", ResponseCode.SUCCESS);
  1823 + return rs;
  1824 + }
  1825 +
  1826 + /**
  1827 + * @Title: persoChange
  1828 + * @Description: TODO(班次换驾驶员)
  1829 + */
  1830 + public void persoChange(ScheduleRealInfo sch, String jGh) {
  1831 + if (sch.getjGh().equals(jGh))
  1832 + return;
  1833 + String jName = BasicData.allPerson.get(jGh);
  1834 + if (StringUtils.isNotEmpty(jName)) {
  1835 + sch.setjGh(jGh);
  1836 + sch.setjName(jName);
  1837 + }
  1838 + }
  1839 +
  1840 + /**
  1841 + * @Title: persoChange
  1842 + * @Description: TODO(班次换售票员)
  1843 + */
  1844 + public void persoChangeSPY(ScheduleRealInfo sch, String sGh) {
  1845 + if (sch.getsGh().equals(sGh))
  1846 + return;
  1847 + String sName = BasicData.allPerson.get(sGh);
  1848 + if (StringUtils.isNotEmpty(sName)) {
  1849 + sch.setsGh(sGh);
  1850 + sch.setsName(sName);
  1851 + }
  1852 + }
  1853 +
  1854 + /**
  1855 + * 批量待发调整
  1856 + */
  1857 + @Override
  1858 + public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) {
  1859 + Map<String, Object> rs = new HashMap<>(), tempMap = new HashMap<>();
  1860 + List<ScheduleRealInfo> list = new ArrayList<>();
  1861 +
  1862 + ScheduleRealInfo sch, next;
  1863 + for (DfsjChange dc : dfsjcs) {
  1864 + if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj()))
  1865 + continue;
1948 1866  
1949 1867 /*sch = dayOfSchedule.get(dc.getSchId());
1950 1868 if(sch==null)
... ... @@ -1954,178 +1872,204 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1954 1872 //重新计算终点时间
1955 1873 sch.calcEndTime();
1956 1874 list.add(sch);*/
1957   - tempMap = outgoAdjust(dc.getSchId(),"", dc.getNew_dfsj());
  1875 + tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null);
1958 1876  
1959   - if(tempMap.get("status").equals(ResponseCode.SUCCESS)){
1960   - list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts"));
1961   - }
1962   - //next=dayOfSchedule.next(sch);
  1877 + if (tempMap.get("status").equals(ResponseCode.SUCCESS)) {
  1878 + list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts"));
  1879 + }
  1880 + //next=dayOfSchedule.next(sch);
1963 1881 /*if(next.getQdzName().equals(sch.getZdzName())){
1964 1882 next.setQdzArrDateJH(sch.getZdsj());
1965 1883 list.add(next);
1966 1884 }*/
1967   - }
1968   -
1969   - rs.put("status", ResponseCode.SUCCESS);
1970   - rs.put("ts", list);
1971   - return rs;
1972   - }
1973   -
1974   -
1975   - @Override
1976   - public Map<String, Object> findKMBC1(String jName, String clZbh,
1977   - String date, String enddate) {
1978   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate);
1979   - DecimalFormat format = new DecimalFormat("0.00");
1980   -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1981   -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1982   - int jhbc = 0,cjbc = 0,ljbc = 0;
1983   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
1984   - float addMileage = 0l,remMileage = 0l;
1985   - Map<String,Object> map = new HashMap<String, Object>();
1986   - for(ScheduleRealInfo scheduleRealInfo : list){
1987   - if(scheduleRealInfo != null){
1988   - //计划里程(主任务过滤掉临加班次),
1989   - //烂班里程(主任务烂班),
1990   - //临加里程(主任务临加),
1991   - //计划班次,烂班班次,增加班次
1992   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1993   - if(scheduleRealInfo.isSflj()){
1994   - addMileage += tempJhlc;
1995   - ljbc++;
1996   - }else{
1997   - jhlc += tempJhlc;
1998   - jhbc++;
1999   - if(scheduleRealInfo.getStatus() == -1){
2000   - remMileage += tempJhlc;
2001   - cjbc++;
2002   - }
2003   - }
2004   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2005   - //计算营运里程,空驶里程
2006   - if(childTaskPlans.isEmpty()){
2007   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
2008   - || scheduleRealInfo.getBcType().equals("venting")){
2009   - ksgl += tempJhlc;
2010   - }else{
2011   - yygl += tempJhlc;
2012   - }
2013   - }else{
2014   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2015   - while(it.hasNext()){
2016   - ChildTaskPlan childTaskPlan = it.next();
2017   - if(childTaskPlan.getMileageType().equals("empty")){
2018   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2019   - }else{
2020   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2021   - }
2022   - }
2023   - }
2024   - }
2025   - }
2026   - map.put("jhlc", format.format(jhlc));
2027   - map.put("remMileage", format.format(remMileage));
2028   - map.put("addMileage", format.format(addMileage));
2029   - map.put("yygl", format.format(yygl));
2030   - map.put("ksgl", format.format(ksgl));
2031   - map.put("realMileage", format.format(yygl+ksgl));
2032   - map.put("jhbc", jhbc);
2033   - map.put("cjbc", cjbc);
2034   - map.put("ljbc", ljbc);
2035   - map.put("sjbc", jhbc-cjbc+ljbc);
2036   - return map;
2037   - }
2038   -
2039   - /**
2040   - * 调整班次类型
2041   - * @param id
2042   - * @param bcType
2043   - * @param remarks
2044   - * @return
2045   - */
2046   - @Override
2047   - public Map<String, Object> changeBcType(Long id, String bcType, String remarks) {
2048   - Map<String, Object> rs = new HashMap<>();
2049   -
2050   - try {
2051   - ScheduleRealInfo sch = dayOfSchedule.get(id);
2052   - if(sch != null){
2053   - sch.setBcType(bcType);
2054   - sch.addRemarks(remarks);
2055   - //有时间记录一下相关变更数据
2056   - rs.put("status", ResponseCode.SUCCESS);
2057   - rs.put("t", sch);
2058   - }
2059   - } catch (Exception e) {
2060   - logger.error("", e);
2061   - rs.put("status", ResponseCode.ERROR);
2062   - }
2063   -
2064   - return rs;
2065   - }
2066   -
2067   - @Override
2068   - public Map<String, Object> historySave(ScheduleRealInfo sch) {
2069   - Map<String, Object> rs = new HashMap<>();
2070   - rs.put("status", ResponseCode.ERROR);
2071   -
2072   - ScheduleRealInfo oldSch = super.findById(sch.getId());
2073   - //修改车辆
2074   - if(!oldSch.getClZbh().equals(sch.getClZbh())){
2075   - Set<String> allCar=BasicData.deviceId2NbbmMap.values();
2076   - if(!allCar.contains(sch.getClZbh())){
2077   - rs.put("msg", "无效的车辆自编号");
2078   - return rs;
2079   - }
2080   - else
2081   - oldSch.setClZbh(sch.getClZbh());
2082   - }
2083   -
2084   - //修改驾驶员
2085   - if(!oldSch.getjGh().equals(sch.getjGh())){
2086   - Map<String, String> allPer = BasicData.allPerson;
2087   - if(!allPer.containsKey(sch.getjGh())){
2088   - rs.put("msg", "无效的驾驶员");
2089   - return rs;
2090   - }
2091   - else{
2092   - oldSch.setjGh(sch.getjGh());
2093   - oldSch.setjName(allPer.get(oldSch.getjGh()));
2094   - }
2095   - }
  1885 + }
2096 1886  
2097   - //修改售票员
2098   -/* if(!oldSch.getsGh().equals(sch.getsGh())){
2099   - Map<String, String> allPer = BasicData.allPerson;
  1887 + rs.put("status", ResponseCode.SUCCESS);
  1888 + rs.put("ts", list);
  1889 + return rs;
  1890 + }
2100 1891  
2101   - if(StringUtils.isNotEmpty(sch.getsGh())){
2102   - if(!allPer.containsKey(sch.getsGh())){
2103   - rs.put("msg", "无效的售票员");
2104   - return rs;
2105   - }
2106   - }
2107   - oldSch.setsGh(sch.getsGh());
2108   - oldSch.setsName(allPer.get(oldSch.getsGh()));
2109   - }*/
2110 1892  
2111   - //待发时间
2112   - oldSch.setDfsj(sch.getDfsj());
2113   - //实发时间
2114   - oldSch.setFcsjActual(sch.getFcsjActual());
2115   - //实际终点
2116   - oldSch.setZdsjActual(sch.getZdsjActual());
2117   - //备注
2118   - oldSch.setRemarks(sch.getRemarks());
2119   -
2120   - scheduleRealInfoRepository.save(oldSch);
2121   - rs.put("status", ResponseCode.SUCCESS);
2122   - return rs;
2123   - }
2124   -
2125   - @Override
2126   - public List<Map<String, Object>> yesterdayDataList(String line) {
2127   - // TODO Auto-generated method stub
2128   - return null;
2129   - }
  1893 + @Override
  1894 + public Map<String, Object> findKMBC1(String jName, String clZbh,
  1895 + String date, String enddate) {
  1896 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate);
  1897 + DecimalFormat format = new DecimalFormat("0.00");
  1898 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  1899 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  1900 + int jhbc = 0, cjbc = 0, ljbc = 0;
  1901 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0;
  1902 + float addMileage = 0l, remMileage = 0l;
  1903 + Map<String, Object> map = new HashMap<String, Object>();
  1904 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1905 + if (scheduleRealInfo != null) {
  1906 + //计划里程(主任务过滤掉临加班次),
  1907 + //烂班里程(主任务烂班),
  1908 + //临加里程(主任务临加),
  1909 + //计划班次,烂班班次,增加班次
  1910 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1911 + if (scheduleRealInfo.isSflj()) {
  1912 + addMileage += tempJhlc;
  1913 + ljbc++;
  1914 + } else {
  1915 + jhlc += tempJhlc;
  1916 + jhbc++;
  1917 + if (scheduleRealInfo.getStatus() == -1) {
  1918 + remMileage += tempJhlc;
  1919 + cjbc++;
  1920 + }
  1921 + }
  1922 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1923 + //计算营运里程,空驶里程
  1924 + if (childTaskPlans.isEmpty()) {
  1925 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  1926 + || scheduleRealInfo.getBcType().equals("venting")) {
  1927 + ksgl += tempJhlc;
  1928 + } else {
  1929 + yygl += tempJhlc;
  1930 + }
  1931 + } else {
  1932 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1933 + while (it.hasNext()) {
  1934 + ChildTaskPlan childTaskPlan = it.next();
  1935 + if (childTaskPlan.getMileageType().equals("empty")) {
  1936 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1937 + } else {
  1938 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1939 + }
  1940 + }
  1941 + }
  1942 + }
  1943 + }
  1944 + map.put("jhlc", format.format(jhlc));
  1945 + map.put("remMileage", format.format(remMileage));
  1946 + map.put("addMileage", format.format(addMileage));
  1947 + map.put("yygl", format.format(yygl));
  1948 + map.put("ksgl", format.format(ksgl));
  1949 + map.put("realMileage", format.format(yygl + ksgl));
  1950 + map.put("jhbc", jhbc);
  1951 + map.put("cjbc", cjbc);
  1952 + map.put("ljbc", ljbc);
  1953 + map.put("sjbc", jhbc - cjbc + ljbc);
  1954 + return map;
  1955 + }
  1956 +
  1957 + /**
  1958 + * 调整班次类型
  1959 + *
  1960 + * @param id
  1961 + * @param bcType
  1962 + * @param remarks
  1963 + * @return
  1964 + */
  1965 + @Override
  1966 + public Map<String, Object> changeBcType(Long id, String bcType, String remarks) {
  1967 + Map<String, Object> rs = new HashMap<>();
  1968 +
  1969 + try {
  1970 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  1971 + if (sch != null) {
  1972 + sch.setBcType(bcType);
  1973 + sch.addRemarks(remarks);
  1974 + //有时间记录一下相关变更数据
  1975 + rs.put("status", ResponseCode.SUCCESS);
  1976 + rs.put("t", sch);
  1977 + }
  1978 + } catch (Exception e) {
  1979 + logger.error("", e);
  1980 + rs.put("status", ResponseCode.ERROR);
  1981 + }
  1982 +
  1983 + return rs;
  1984 + }
  1985 +
  1986 + @Override
  1987 + public Map<String, Object> historySave(ScheduleRealInfo sch) {
  1988 + Map<String, Object> rs = new HashMap<>();
  1989 + rs.put("status", ResponseCode.ERROR);
  1990 +
  1991 + ScheduleRealInfo oldSch = super.findById(sch.getId());
  1992 + //修改车辆
  1993 + if (!oldSch.getClZbh().equals(sch.getClZbh())) {
  1994 + Set<String> allCar = BasicData.deviceId2NbbmMap.values();
  1995 + if (!allCar.contains(sch.getClZbh())) {
  1996 + rs.put("msg", "无效的车辆自编号");
  1997 + return rs;
  1998 + } else
  1999 + oldSch.setClZbh(sch.getClZbh());
  2000 + }
  2001 +
  2002 + //修改驾驶员
  2003 + if (!oldSch.getjGh().equals(sch.getjGh())) {
  2004 + Map<String, String> allPer = BasicData.allPerson;
  2005 + if (!allPer.containsKey(sch.getjGh())) {
  2006 + rs.put("msg", "无效的驾驶员");
  2007 + return rs;
  2008 + } else {
  2009 + oldSch.setjGh(sch.getjGh());
  2010 + oldSch.setjName(allPer.get(oldSch.getjGh()));
  2011 + }
  2012 + }
  2013 +
  2014 + //待发时间
  2015 + oldSch.setDfsj(sch.getDfsj());
  2016 + //实发时间
  2017 + oldSch.setFcsjActual(sch.getFcsjActual());
  2018 + //实际终点
  2019 + oldSch.setZdsjActual(sch.getZdsjActual());
  2020 + //备注
  2021 + oldSch.setRemarks(sch.getRemarks());
  2022 +
  2023 + scheduleRealInfoRepository.save(oldSch);
  2024 + rs.put("status", ResponseCode.SUCCESS);
  2025 + return rs;
  2026 + }
  2027 +
  2028 + @Autowired
  2029 + SvgAttributeRepository svgAttributeRepository;
  2030 +
  2031 + @Override
  2032 + public Map<String, Object> svgAttr(String jsonStr) {
  2033 + Map<String, Object> rs = new HashMap<>();
  2034 +
  2035 + try {
  2036 + JSONObject jObj = JSONObject.parseObject(StringEscapeUtils.unescapeHtml4(jsonStr));
  2037 +
  2038 + SvgAttribute svgAttribute = new SvgAttribute();
  2039 + svgAttribute.setLineCode(jObj.getString("lineCode"));
  2040 + svgAttribute.setHideStations(jObj.getString("hideStations"));
  2041 + svgAttribute.setNicknames(jObj.getString("nicknames"));
  2042 + svgAttributeRepository.save(svgAttribute);
  2043 +
  2044 + rs.put("t", svgAttribute);
  2045 + rs.put("status", ResponseCode.SUCCESS);
  2046 + } catch (Exception e) {
  2047 + logger.error("", e);
  2048 + rs.put("status", ResponseCode.ERROR);
  2049 + }
  2050 + return rs;
  2051 + }
  2052 +
  2053 + @Override
  2054 + public Map<String, Object> findSvgAttr(String idx) {
  2055 + Map<String, Object> rs = new HashMap<>();
  2056 + try {
  2057 + List<String> lineCodes = Splitter.on(",").splitToList(idx);
  2058 + List<SvgAttribute> list = svgAttributeRepository.findSvgAttr(lineCodes);
  2059 +
  2060 + rs.put("status", ResponseCode.SUCCESS);
  2061 + rs.put("list", list);
  2062 + } catch (Exception e) {
  2063 + logger.error("", e);
  2064 + rs.put("status", ResponseCode.ERROR);
  2065 + }
  2066 + return rs;
  2067 + }
  2068 +
  2069 + @Override
  2070 + public List<Map<String, Object>> yesterdayDataList(String line) {
  2071 + // TODO Auto-generated method stub
  2072 + return null;
  2073 + }
2130 2074  
2131 2075 }
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -139,6 +139,11 @@ svg.line-chart path.station_link.down {
139 139 stroke: #c92121;
140 140 }
141 141  
  142 +svg.line-chart path.station_link.down.loop_line{
  143 + stroke-dasharray: 4,3;
  144 + stroke-width: 1px;
  145 +}
  146 +
142 147 svg.line-chart text.station_text {
143 148 writing-mode: tb;
144 149 fill: #3e3e3e;
... ... @@ -155,15 +160,25 @@ svg.line-chart text.station_text.down {
155 160 }
156 161  
157 162 svg.line-chart g.item:first-child>text {
158   - stroke: #5E96D2;
  163 + stroke: #6f6e6e;
159 164 fill: none;
160 165 }
161 166  
162 167 svg.line-chart g.item:nth-last-child(3)>text {
163   - stroke: #C92121;
  168 + stroke: #6f6e6e;
164 169 fill: none;
165 170 }
166 171  
  172 +svg.line-chart g.item:first-child>text.up ,
  173 +svg.line-chart g.item:nth-last-child(3)>text.up {
  174 + stroke: #4556b6;
  175 +}
  176 +
  177 +svg.line-chart g.item:first-child>text.down ,
  178 +svg.line-chart g.item:nth-last-child(3)>text.down {
  179 + stroke: #c94f21;
  180 +}
  181 +
167 182 svg.line-chart g.gps-wrap>rect {
168 183 width: 34px;
169 184 height: 15px;
... ... @@ -201,7 +216,7 @@ svg.line-chart g.gps-wrap&gt;text[updown=&quot;1&quot;] {
201 216 }
202 217  
203 218 svg.line-chart .merge_hide {
204   - display: none;
  219 + display: none !important;
205 220 }
206 221  
207 222 svg.line-chart g.merge-item rect {
... ... @@ -515,6 +530,7 @@ li.map-panel{
515 530 position: relative;
516 531 display: inline-block;
517 532 vertical-align: top;
  533 + height: 440px;
518 534 }
519 535  
520 536 .svg-edit-panel-wrap .title-badge{
... ... @@ -527,10 +543,65 @@ li.map-panel{
527 543 color: #888888;
528 544 }
529 545  
  546 +.svg-edit-panel-wrap .rename-tools{
  547 + height: 21px;
  548 + padding: 0 0 0 9px;
  549 +}
  550 +
  551 +.svg-edit-panel-wrap .rename-item-panel{
  552 + border-bottom: 1px solid #ede5e5;
  553 + padding: 4px;
  554 +}
  555 +
  556 +.svg-edit-panel-wrap .rename-item-panel select{
  557 + width: 150px;
  558 +}
  559 +
  560 +.svg-edit-panel-wrap .rename-item-panel input{
  561 + margin-left: 7px;
  562 +}
  563 +
  564 +.svg-edit-panel-wrap .rename-item-panel input[type=checkbox]{
  565 + margin-top: 2px;
  566 + margin-right: 4px;
  567 +}
  568 +
  569 +.svg-edit-panel-wrap .rename-item-panel.active{
  570 + background: #65c9f8;
  571 + box-shadow: 0px 3px 7px 0 rgba(101, 201, 248, 0.48), 0px 1px 4px 0 rgba(101, 201, 248, 0.32);
  572 +}
  573 +
  574 +.svg-edit-panel-wrap .rename-item-panel.active select,
  575 +.svg-edit-panel-wrap .rename-item-panel.active input{
  576 + background: #65c9f8;
  577 + color: #fff;
  578 +}
  579 +
  580 +.svg-edit-panel-wrap .rename-item-panel.active i{
  581 + color: #e4f6ff;
  582 +}
  583 +
  584 +.svg-edit-panel-wrap .rename-item-panel.active input[type=checkbox]{
  585 + border:none;
  586 +}
  587 +
  588 +.svg-edit-panel-wrap .rename-item-panel.active input[type=checkbox]:before{
  589 + color: #fff;
  590 +}
  591 +
  592 +.svg-edit-panel-wrap .rename-tools a{
  593 + font-size: 14px;
  594 + padding: 5px;
  595 +}
  596 +.svg-edit-panel-wrap .rename-tools a:hover{
  597 + background: #e8edef;
  598 + border-radius: 5px;
  599 +}
  600 +
530 601 .station-list{
531 602 width: 190px;
532 603 padding: 2px 7px;
533   - height: 440px;
  604 + height: 100%;
534 605 overflow: auto;
535 606 display: inline-block;
536 607 }
... ...
src/main/resources/static/real_control_v2/fragments/home/svg_edit.html
... ... @@ -2,42 +2,73 @@
2 2 <div class="uk-modal-dialog" style="width: 930px;">
3 3 <a href="" class="uk-modal-close uk-close"></a>
4 4 <div class="uk-modal-header">
5   - <h2>模拟图数据编辑</h2></div>
  5 + <h2>主页模拟图数据编辑</h2></div>
6 6  
7   - <div class="svg-edit-panel-wrap station-list-wrap" >
  7 + <div class="svg-edit-panel-wrap station-list-wrap">
8 8 <span class="title-badge">站点缩略</span>
9 9 </div>
10 10  
11 11  
12 12 <div class="svg-edit-panel-wrap" style="margin-left: 25px;">
13 13 <span class="title-badge">站点重命名</span>
  14 + <div style="height: 100%;">
  15 + <div style="height: calc(100% - 25px);">
  16 + <form class="uk-form rename-list-form">
  17 + </form>
  18 + </div>
  19 +
  20 + <div class="rename-tools" style="height: 21px;">
  21 + <a class="uk-icon-small uk-icon-hover uk-icon-plus add"></a>
  22 + <a class="uk-icon-small uk-icon-hover uk-icon-minus minus"></a>
  23 + </div>
  24 + </div>
14 25 </div>
15 26  
  27 +
  28 + <div class="uk-modal-footer uk-text-right">
  29 + <button type="button" class="uk-button uk-modal-close">取消</button>
  30 + <button type="button" class="uk-button uk-button-primary submitBtn"><i class="uk-icon-check"></i> 保存
  31 + </button>
  32 + </div>
16 33 </div>
17 34  
18 35 <script id="svg-edit-station-list-temp" type="text/html">
19 36 <div class="station-list up">
20 37 {{each list[0] as s i}}
21   - <div class="station-item">{{s.stationName}}</div>
  38 + <div class="station-item" data-code="{{s.stationCode}}">{{s.stationName}}</div>
22 39 {{/each}}
23 40 </div>
24 41  
25 42 <div class="station-list down" style="margin-left: 8px;">
26 43 {{each list[1] as s i}}
27   - <div class="station-item">{{s.stationName}}</div>
  44 + <div class="station-item" data-code="{{s.stationCode}}">{{s.stationName}}</div>
28 45 {{/each}}
29 46 </div>
30 47 </script>
31 48  
  49 + <script id="svg-edit-rename-item-temp" type="text/html">
  50 + <div class="rename-item-panel">
  51 + <input type="checkbox">
  52 + <select name="renames[{{no}}][name]">
  53 + {{each names as n i}}
  54 + <option value="{{n}}">{{n}}</option>
  55 + {{/each}}
  56 + </select>
  57 + <i class="uk-icon-arrows-h"></i>
  58 + <input type="text" value="{{names[0]}}" name="renames[{{no}}][nickname]">
  59 + </div>
  60 + </script>
  61 +
32 62 <script>
33 63 (function () {
34 64 var modal = '#home-svg-edit-modal',
35   - lineCode;
  65 + lineCode, names = [], no = 0;
36 66  
37 67 $(modal).on('init', function (e, data) {
38 68 lineCode = data.lineCode;
  69 + var allStationList = gb_data_basic.stationRoutes(lineCode);
39 70 //站点路由
40   - var routeArray = gb_common.groupBy(gb_data_basic.stationRoutes(lineCode), 'directions');
  71 + var routeArray = gb_common.groupBy(allStationList, 'directions');
41 72 //下行倒序
42 73 routeArray[1].sort(function (a, b) {
43 74 return b.stationRouteCode - a.stationRouteCode;
... ... @@ -45,12 +76,109 @@
45 76 $('.station-list-wrap', modal).append(template('svg-edit-station-list-temp', {list: routeArray}));
46 77  
47 78 $('.station-item', modal).on('click', function () {
48   - if($(this).hasClass('disable')){
  79 + if ($(this).hasClass('disable')) {
49 80 $(this).removeClass('disable');
50 81 }
51 82 else
52 83 $(this).addClass('disable');
53 84 });
  85 +
  86 + //上下行所有的站点名称
  87 + var nameMap = {};
  88 + $.each(allStationList, function () {
  89 + nameMap[this.stationName] = 1;
  90 + });
  91 + names = gb_common.get_keys(nameMap).sort(function (a, b) {
  92 + return a.localeCompare(b);
  93 + });
  94 +
  95 + //获取配置信息
  96 + var svgAttr = gb_data_basic.getSvgAttr(lineCode);
  97 + var hideStations = svgAttr.hideStations;
  98 + //disable
  99 + $('.station-list-wrap .station-item', modal).each(function () {
  100 + var code = $(this).data('code');
  101 + if (hideStations.indexOf(code) != -1) {
  102 + $(this).addClass('disable');
  103 + }
  104 + });
  105 + //rename items
  106 + var nicknames = svgAttr.nicknames;
  107 + for (var n in nicknames) {
  108 + addRenameItem(function ($e) {
  109 + $e.find('select').val(n);
  110 + $e.find('input[type=text]').val(nicknames[n]);
  111 + });
  112 + }
  113 + });
  114 +
  115 + var addRenameItem = function (cb) {
  116 + var htmlStr = template('svg-edit-rename-item-temp', {names: names, no: no});
  117 + var $e = $(htmlStr);
  118 + $('.rename-list-form', modal).append($e);
  119 + no++;
  120 + cb && cb($e);
  121 + };
  122 +
  123 + //add rename item
  124 + $('.rename-tools .add', modal).on('click', addRenameItem);
  125 +
  126 + //remove rename item
  127 + $('.rename-tools .minus', modal).on('click', function () {
  128 + $('.rename-item-panel.active', modal).remove();
  129 + });
  130 +
  131 + //check
  132 + $(modal).on('click', '.rename-item-panel input[type=checkbox]', function () {
  133 + if ($(this)[0].checked) {
  134 + $(this).parent().addClass('active');
  135 + }
  136 + else {
  137 + $(this).parent().removeClass('active');
  138 + }
  139 + });
  140 +
  141 + //select
  142 + $(modal).on('change', '.rename-item-panel select', function () {
  143 + $(this).nextAll('input').val($(this).val());
  144 + });
  145 +
  146 +
  147 + //提交
  148 + $(modal).on('click', '.submitBtn', function () {
  149 + //重命名数据
  150 + var tempData = $('.rename-list-form', modal).serializeJSON().renames;
  151 + var renameData = {};
  152 + $.each(gb_common.get_vals(tempData), function () {
  153 + if (!$.trim(this.nickname) || this.name == this.nickname)
  154 + return true;
  155 + renameData[this.name] = this.nickname;
  156 + });
  157 +
  158 + //被禁选的站点
  159 + var disableStation = [];
  160 + $('.station-list-wrap .station-item.disable', modal).each(function () {
  161 + disableStation.push($(this).data('code'));
  162 + });
  163 +
  164 + var data = {
  165 + lineCode: lineCode,
  166 + hideStations: disableStation,
  167 + nicknames: renameData
  168 + };
  169 +
  170 + gb_common.$post('/realSchedule/svgAttr', {jsonStr: JSON.stringify(data)}, function (rs) {
  171 + if (rs.t) {
  172 + gb_data_basic.setSvgAttr(rs.t);
  173 + //重新绘制模拟图
  174 + var lineCode = rs.t.lineCode;
  175 + var wrap = $('#home-main-content .home-line-card[data-line-code='+lineCode+'] .svg-chart-wrap');
  176 + wrap.find('svg.line-chart').remove();
  177 + gb_svg_chart.draw_line(lineCode, wrap, true);
  178 +
  179 + UIkit.modal(modal).hide();
  180 + }
  181 + });
54 182 });
55 183 })();
56 184 </script>
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/bc_type_major.html
... ... @@ -35,6 +35,19 @@
35 35 </div>
36 36 </div>
37 37 </div>
  38 +
  39 + <div class="uk-grid">
  40 + <div class="uk-width-1-2">
  41 + <div class="uk-form-row">
  42 + <div class="uk-form-controls" style="margin-left: 0;">
  43 + <label style="color: #827f7f;font-size: 13px;">
  44 + <input class="i-cbox" type="checkbox" name="sendDirective" checked>
  45 + 下发调度指令
  46 + </label>
  47 + </div>
  48 + </div>
  49 + </div>
  50 + </div>
38 51 <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
39 52 <button type="button" class="uk-button uk-modal-close">取消</button>
40 53 <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-send"></i> &nbsp;确认调整并下发指令
... ... @@ -48,10 +61,19 @@
48 61 var modal = '#bctype-major-modal'
49 62 , sch, stationRoutes, parentModal;
50 63  
  64 + $('[name=sendDirective]', modal).on('click', function () {
  65 + if ($(this)[0].checked)
  66 + $('[type=submit]', modal).html('<i class="uk-icon-send"></i> &nbsp;确认调整并下发指令');
  67 + else
  68 + $('[type=submit]', modal).html('<i class="uk-icon-check"></i> &nbsp;确认调整');
  69 + });
  70 +
  71 +
51 72 $('[name=startStation],[name=endStation]', modal).on('change', refreshDirectiveStr);
52 73  
53 74  
54 75 var remarks;
  76 +
55 77 function refreshDirectiveStr() {
56 78  
57 79 var $qdz = $('[name=startStation]')
... ... @@ -61,20 +83,20 @@
61 83 , zdzName = $zdz.find("option:selected").text();
62 84  
63 85 //只修改起点
64   - if(sch.qdzCode != $qdz.val() && sch.zdzCode == $zdz.val()){
65   - remarks = ' 从 '+ sch.qdzName +' 待客至 ' + qdzName + ' ,放站至 ' + zdzName;
  86 + if (sch.qdzCode != $qdz.val() && sch.zdzCode == $zdz.val()) {
  87 + remarks = ' 从 ' + sch.qdzName + ' 待客至 ' + qdzName + ' ,放站至 ' + zdzName;
66 88 }
67 89 //只修改终点
68   - else if(sch.qdzCode == $qdz.val() && sch.zdzCode != $zdz.val()){
69   - remarks = ' 从 '+ sch.qdzName +' 放站至 ' + zdzName + ' 开始待客';
  90 + else if (sch.qdzCode == $qdz.val() && sch.zdzCode != $zdz.val()) {
  91 + remarks = ' 从 ' + sch.qdzName + ' 放站至 ' + zdzName + ' 开始待客';
70 92 }
71 93 //起终点都改变
72   - else if(sch.qdzCode != $qdz.val() && sch.zdzCode != $zdz.val()){
73   - remarks = ' 从 '+ qdzName +' 放站至 ' + zdzName + ' 开始待客';
  94 + else if (sch.qdzCode != $qdz.val() && sch.zdzCode != $zdz.val()) {
  95 + remarks = ' 从 ' + qdzName + ' 放站至 ' + zdzName + ' 开始待客';
74 96 }
75 97 //起终点都不改变
76   - else if(sch.qdzCode == $qdz.val() && sch.zdzCode == $zdz.val()){
77   - remarks = ' 从 '+ qdzName +' 放站至 ' + zdzName;
  98 + else if (sch.qdzCode == $qdz.val() && sch.zdzCode == $zdz.val()) {
  99 + remarks = ' 从 ' + qdzName + ' 放站至 ' + zdzName;
78 100 }
79 101  
80 102 $('[name=directiveStr]', modal).text('班次:' + sch.dfsj + remarks).trigger('input');
... ... @@ -117,16 +139,21 @@
117 139 f.on('success.form.fv', function (e) {
118 140 e.preventDefault();
119 141 var data = $(this).serializeJSON();
120   - // notify_wait('准备下发指令')
121   - //下发指令
122   - $.post('/directive/phrase', {nbbm: sch.clZbh, text: data.directiveStr}, function (rs) {
123   - if (rs == 0) {
124   - notify_succ('指令下发成功');
125   - changeBcType();
126   - }
127   - else
128   - notify_err('指令下发失败');
129   - });
  142 +
  143 + var isSend = $('[name=sendDirective]', modal)[0].checked;
  144 + if (isSend) {
  145 + //下发指令
  146 + $.post('/directive/phrase', {nbbm: sch.clZbh, text: data.directiveStr}, function (rs) {
  147 + if (rs == 0) {
  148 + notify_succ('指令下发成功');
  149 + changeBcType();
  150 + }
  151 + else
  152 + notify_err('指令下发失败');
  153 + });
  154 + }
  155 + else
  156 + changeBcType();
130 157 });
131 158  
132 159 //站点路由
... ... @@ -146,7 +173,10 @@
146 173  
147 174 function changeBcType() {
148 175 //将班次类型调整为放站
149   - gb_common.$post('/realSchedule/changeBcType/'+sch.id, {bcType: 'major', remarks: remarks}, function(rs){
  176 + gb_common.$post('/realSchedule/changeBcType/' + sch.id, {
  177 + bcType: 'major',
  178 + remarks: remarks
  179 + }, function (rs) {
150 180 UIkit.modal(modal).hide();
151 181 gb_schedule_table.updateSchedule(rs.t);
152 182 //触发父容器刷新事件
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/bc_type_venting.html
... ... @@ -23,6 +23,7 @@
23 23 </div>
24 24 </div>
25 25 </div>
  26 +
26 27 <div class="uk-grid">
27 28 <div class="uk-width-1-1">
28 29 <div class="uk-form-row ct-stacked">
... ... @@ -35,6 +36,18 @@
35 36 </div>
36 37 </div>
37 38 </div>
  39 + <div class="uk-grid">
  40 + <div class="uk-width-1-2">
  41 + <div class="uk-form-row">
  42 + <div class="uk-form-controls" style="margin-left: 0;">
  43 + <label style="color: #827f7f;font-size: 13px;">
  44 + <input class="i-cbox" type="checkbox" name="sendDirective" checked>
  45 + 下发调度指令
  46 + </label>
  47 + </div>
  48 + </div>
  49 + </div>
  50 + </div>
38 51 <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
39 52 <button type="button" class="uk-button uk-modal-close">取消</button>
40 53 <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-send"></i> &nbsp;确认调整并下发指令
... ... @@ -48,6 +61,13 @@
48 61 var modal = '#bctype-venting-modal'
49 62 , sch, stationRoutes, parentModal;
50 63  
  64 + $('[name=sendDirective]', modal).on('click', function () {
  65 + if ($(this)[0].checked)
  66 + $('[type=submit]', modal).html('<i class="uk-icon-send"></i> &nbsp;确认调整并下发指令');
  67 + else
  68 + $('[type=submit]', modal).html('<i class="uk-icon-check"></i> &nbsp;确认调整');
  69 + });
  70 +
51 71 $('[name=startStation],[name=endStation]', modal).on('change', refreshDirectiveStr);
52 72  
53 73  
... ... @@ -116,16 +136,20 @@
116 136 f.on('success.form.fv', function (e) {
117 137 e.preventDefault();
118 138 var data = $(this).serializeJSON();
119   - // notify_wait('准备下发指令')
120   - //下发指令
121   - $.post('/directive/phrase', {nbbm: sch.clZbh, text: data.directiveStr}, function (rs) {
122   - if (rs == 0) {
123   - notify_succ('指令下发成功');
124   - changeBcType();
125   - }
126   - else
127   - notify_err('指令下发失败');
128   - });
  139 + var isSend = $('[name=sendDirective]', modal)[0].checked;
  140 + if (isSend) {
  141 + //下发指令
  142 + $.post('/directive/phrase', {nbbm: sch.clZbh, text: data.directiveStr}, function (rs) {
  143 + if (rs == 0) {
  144 + notify_succ('指令下发成功');
  145 + changeBcType();
  146 + }
  147 + else
  148 + notify_err('指令下发失败');
  149 + });
  150 + }
  151 + else
  152 + changeBcType();
129 153 });
130 154  
131 155  
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/dftz.html
... ... @@ -122,24 +122,26 @@
122 122  
123 123 //班次类型字典
124 124 var bctypes=dictionaryUtils.getByGroup('ScheduleType')
125   - ,opts='<option value="'+sch.bcType+'">'+bctypes[sch.bcType]+'</option>';
126   - if(sch.bcType!='normal')
127   - $('select[name=bcType]', modal).attr('disabled','disabled');
  125 + ,opts='';
  126 +
  127 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  128 + $('[name=bcType]', modal).html('<option value="'+sch.bcType+'">'+bctypes[sch.bcType]+'</option>');
  129 + }
128 130 else{
129 131 for(var code in bctypes){
130   - if(code!='venting' && code!='major')
  132 + if(code!='venting' && code!='major' && code != 'normal')
131 133 continue;
132 134 opts+='<option value="'+code+'">'+bctypes[code]+'</option>';
133 135 }
  136 + $('[name=bcType]', modal).html(opts).val(sch.bcType);
134 137 }
135   - $('[name=bcType]', modal).html(opts);
136 138  
137 139 //submit
138 140 var f = $('form', modal).formValidation(gb_form_validation_opts);
139 141 f.on('success.form.fv', function(e) {
140 142 e.preventDefault();
141 143 var data = $(this).serializeJSON();
142   - if(data.dfsj==sch.dfsj && data.remarks==''){
  144 + if(data.dfsj==sch.dfsj && data.remarks=='' && data.bcType == sch.bcType){
143 145 return;
144 146 }
145 147 gb_common.$post('/realSchedule/outgoAdjust', data, function(rs){
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
... ... @@ -129,6 +129,28 @@
129 129 </div>
130 130 </div>
131 131  
  132 + <hr style="height: 1px;border: none;border-top: 1px dashed #d1d1d1;width: calc(100% + 40px);margin-left: -20px;">
  133 + <div class="uk-grid">
  134 + <div class="uk-width-1-2">
  135 + <div class="uk-form-row">
  136 + <label class="uk-form-label" >里程</label>
  137 + <div class="uk-form-controls">
  138 + <input type="text" value="{{if sch.status==-1}}0{{else}}{{sch.jhlc}}{{/if}}" name="jhlc" readonly>
  139 + </div>
  140 + </div>
  141 + </div>
  142 + <div class="uk-width-1-2">
  143 + <div class="uk-form-row">
  144 + <div class="uk-form-controls" style="margin-left: 0;margin-top: 9px;">
  145 + <label>
  146 + <input class="i-cbox destroy-box" type="checkbox" name="status" value="-1" {{if sch.status==-1}}checked disabled{{/if}}>
  147 + 是否烂班
  148 + </label>
  149 + </div>
  150 + </div>
  151 + </div>
  152 + </div>
  153 +
132 154 <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
133 155 <button type="button" class="uk-button uk-modal-close">取消</button>
134 156 <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
... ... @@ -153,6 +175,11 @@
153 175 e.preventDefault();
154 176 var data = $(this).serializeJSON();
155 177  
  178 + if(data.status==-1 && !data.adjustExps){
  179 + notify_err("烂班需要选择调整原因!");
  180 + return;
  181 + }
  182 +
156 183 gb_common.$post('/realSchedule/schInfoFineTune', data, function(rs){
157 184 gb_schedule_table.updateSchedule(rs.ts);
158 185 UIkit.modal(modal).hide();
... ... @@ -163,17 +190,23 @@
163 190 });
164 191  
165 192 //班次类型
166   - if(sch.bcType!='normal')
167   - $('select[name=bcType]', f).attr('disabled','disabled');
168   - else {
169   - //正常班次只能改为直放 和 放大站
170   - $('select[name=bcType] option', f).each(function(){
171   - var whiteList=['venting', 'major', sch.bcType];
172   - if(whiteList.indexOf($(this).val()) == -1)
173   - $(this).remove();
174   - });
  193 + $('select[name=bcType] option', f).each(function(){
  194 + var whiteList=['venting', 'major', 'normal', sch.bcType];
  195 + if(whiteList.indexOf($(this).val()) == -1)
  196 + $(this).remove();
  197 + });
  198 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  199 + $('[name=bcType]', f).attr('disabled', 'disabled');
175 200 }
176 201  
  202 + //是否烂班
  203 + $('.destroy-box', f).on('click', function () {
  204 + if($(this)[0].checked)
  205 + $('input[name=jhlc]', f).val(0);
  206 + else
  207 + $('input[name=jhlc]', f).val(sch.jhlc);
  208 + });
  209 +
177 210 $('[name=adjustExps]', f).on('change', function(){
178 211 var rem=$('[name=remarks]', f);
179 212 rem.val(rem.val() + $(this).val() + ',').trigger('input');
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
... ... @@ -320,6 +320,16 @@
320 320 }, modal_opts);
321 321 };
322 322  
  323 + //出场子任务
  324 + var add_sub_task_out = function () {
  325 + var sch = getActiveSch();
  326 + if (!sch)
  327 + return notify_err('无法获取到主任务信息!');
  328 + open_modal(folder + '/sub_task/add_sub_task_outpark.html', {
  329 + sch: sch
  330 + }, modal_opts);
  331 + };
  332 +
323 333 //删除子任务
324 334 var remove_sub_task = function () {
325 335 var activeDl = $(s_t_body, modal).find('dl.context-menu-active');
... ... @@ -347,7 +357,8 @@
347 357 remove_sch: remove_sch,
348 358 add_sub_task_other: add_sub_task_other,
349 359 add_sub_task_in: add_sub_task_in,
350   - remove_sub_task: remove_sub_task
  360 + remove_sub_task: remove_sub_task,
  361 + add_sub_task_out: add_sub_task_out
351 362 };
352 363  
353 364 //右键菜单
... ... @@ -368,7 +379,10 @@
368 379 name: '回场'
369 380 },
370 381 'add_sub_task_out': {
371   - name: '出场',
  382 + name: '出场'
  383 + },
  384 + 'add_sub_task_range_turn': {
  385 + name: '区间掉头',
372 386 disabled: true
373 387 },
374 388 'add_sub_task_other': {
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_outpark.html 0 → 100644
  1 +<div class="uk-modal" id="add-sub-task-inpark-modal">
  2 + <div class="uk-modal-dialog">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>出场子任务</h2></div>
  6 +
  7 + <div style="width: 100%;padding-left: 1%;">
  8 + <div class="sub-task-card">
  9 + <div class="uk-panel uk-panel-box uk-panel-box-secondary">
  10 + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div>
  11 + <h3 class="uk-panel-title">出场</h3>
  12 + <form class="uk-form uk-form-horizontal inpark_form" empty_form>
  13 + <input type="hidden" name="type2" value="3">
  14 + <input type="hidden" name="mileageType" value="empty">
  15 + <div class="uk-grid">
  16 + <div class="uk-width-3-10">
  17 + <div class="uk-form-row">
  18 + <label class="uk-form-label">班次类型 </label>
  19 + </div>
  20 + </div>
  21 + <div class="uk-width-7-10 pl5">
  22 + <select name="type1" class="ct_focus">
  23 + <option value="正常">正常</option>
  24 + <option value="临加">临加</option>
  25 + </select>
  26 + </div>
  27 + </div>
  28 + <div class="uk-grid">
  29 + <div class="uk-width-3-10">
  30 + <div class="uk-form-row">
  31 + <label class="uk-form-label">起点 </label>
  32 + </div>
  33 + </div>
  34 + <div class="uk-width-7-10 pl5">
  35 + <select name="startStation"></select>
  36 + </div>
  37 + </div>
  38 + <div class="uk-grid">
  39 + <div class="uk-width-3-10">
  40 + <div class="uk-form-row">
  41 + <label class="uk-form-label" disabled>终点 </label>
  42 + </div>
  43 + </div>
  44 + <div class="uk-width-7-10 pl5">
  45 + <select name="endStation" class="ct_focus" disabled></select>
  46 + </div>
  47 + </div>
  48 + <div class="uk-grid">
  49 + <div class="uk-width-3-10">
  50 + <div class="uk-form-row">
  51 + <label class="uk-form-label">空驶里程</label>
  52 + </div>
  53 + </div>
  54 + <div class="uk-width-7-10 pl5">
  55 + <input type="text" name="mileage" required style="width: calc(100% - 62px);">
  56 + <a style="font-size: 12px;color: grey;cursor: default;" target="_blank"
  57 + class="linkToLineInfo">线路标准</a>
  58 + </div>
  59 + </div>
  60 + <div class="uk-grid">
  61 + <div class="uk-width-3-10">
  62 + <div class="uk-form-row">
  63 + <label class="uk-form-label">开始时间</label>
  64 + </div>
  65 + </div>
  66 + <div class="uk-width-7-10 pl5">
  67 + <input type="time" name="startDate" required>
  68 + </div>
  69 + </div>
  70 + <div class="uk-grid">
  71 + <div class="uk-width-3-10">
  72 + <div class="uk-form-row">
  73 + <label class="uk-form-label">结束时间</label>
  74 + </div>
  75 + </div>
  76 + <div class="uk-width-7-10 pl5">
  77 + <input type="time" name="endDate" required>
  78 + </div>
  79 + </div>
  80 + </form>
  81 + </div>
  82 + </div>
  83 +
  84 + <div class="sub-task-card">
  85 + <div class="uk-panel uk-panel-box uk-panel-box-primary">
  86 + <div class="uk-panel-badge uk-badge">营运</div>
  87 + <h3 class="uk-panel-title">线路上站点间</h3>
  88 + <form class="uk-form uk-form-horizontal inpark_form" service_form>
  89 + <input type="hidden" name="type2" value="1">
  90 + <input type="hidden" name="mileageType" value="service">
  91 + <div class="uk-grid">
  92 + <div class="uk-width-3-10">
  93 + <div class="uk-form-row">
  94 + <label class="uk-form-label">班次类型 </label>
  95 + </div>
  96 + </div>
  97 + <div class="uk-width-7-10 pl5">
  98 + <select name="type1" class="ct_focus" disabled>
  99 + <option value="正常">正常</option>
  100 + <option value="临加">临加</option>
  101 + </select>
  102 + </div>
  103 + </div>
  104 + <div class="uk-grid">
  105 + <div class="uk-width-3-10">
  106 + <div class="uk-form-row">
  107 + <label class="uk-form-label">起点 </label>
  108 + </div>
  109 + </div>
  110 + <div class="uk-width-7-10 pl5">
  111 + <select name="startStation" disabled></select>
  112 + </div>
  113 + </div>
  114 + <div class="uk-grid">
  115 + <div class="uk-width-3-10">
  116 + <div class="uk-form-row">
  117 + <label class="uk-form-label">终点 </label>
  118 + </div>
  119 + </div>
  120 + <div class="uk-width-7-10 pl5">
  121 + <select name="endStation" class="ct_focus" disabled></select>
  122 + </div>
  123 + </div>
  124 + <div class="uk-grid">
  125 + <div class="uk-width-3-10">
  126 + <div class="uk-form-row">
  127 + <label class="uk-form-label">营运里程</label>
  128 + </div>
  129 + </div>
  130 + <div class="uk-width-7-10 pl5">
  131 + <input type="text" name="mileage" disabled>
  132 + </div>
  133 + </div>
  134 + <div class="uk-grid">
  135 + <div class="uk-width-3-10">
  136 + <div class="uk-form-row">
  137 + <label class="uk-form-label">开始时间</label>
  138 + </div>
  139 + </div>
  140 + <div class="uk-width-7-10 pl5">
  141 + <input type="time" name="startDate" disabled>
  142 + </div>
  143 + </div>
  144 + <div class="uk-grid">
  145 + <div class="uk-width-3-10">
  146 + <div class="uk-form-row">
  147 + <label class="uk-form-label">结束时间</label>
  148 + </div>
  149 + </div>
  150 + <div class="uk-width-7-10 pl5">
  151 + <input type="time" name="endDate" disabled>
  152 + </div>
  153 + </div>
  154 + </form>
  155 + </div>
  156 + </div>
  157 +
  158 + <form class="uk-form" style="margin-top: 15px; padding: 0 10px 0 0;">
  159 + <textarea placeholder="备注" style="width: 100%;height: 70px;" id="globalRemarks"></textarea>
  160 + </form>
  161 + </div>
  162 +
  163 + <div class="uk-modal-footer uk-text-right">
  164 + <button type="button" class="uk-button uk-modal-close">取消</button>
  165 + <button type="button" class="uk-button uk-button-primary" id="submitChildTaskBtn">提交子任务</button>
  166 + </div>
  167 + </div>
  168 +
  169 + <div class="ct-bottom-drawer">
  170 + <div class="ct-bottom-drawer-body"></div>
  171 + </div>
  172 +
  173 + <script id="sub-task-inpark-form-temp" type="text/html">
  174 + </script>
  175 +
  176 + <script>
  177 + (function () {
  178 + var modal = '#add-sub-task-inpark-modal',
  179 + serviceForm = $('form[service_form]', modal),
  180 + emptyForm = $('form[empty_form]', modal),
  181 + sch, stationRoutes, parks, information, esCode;
  182 + $(modal).on('init', function (e, data) {
  183 + sch = data.sch;
  184 + $('.linkToLineInfo', modal).attr('href', '/pages/base/lineinformation/list.html?no=' + sch.xlBm);
  185 +
  186 + //站点路由
  187 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  188 + return a.stationRouteCode - b.stationRouteCode;
  189 + }), 'directions')[sch.xlDir];
  190 + //空驶起点(停车场)
  191 + $.get('/basic/parks', function (rs) {
  192 + parks = rs;
  193 + var opts = '';
  194 + for (var code in parks) {
  195 + opts += '<option value="' + code + '">' + parks[code] + '</option>';
  196 + }
  197 + $('select[name=startStation]', emptyForm).html(opts).val(information.carPark);
  198 +
  199 + //设置默认值
  200 + setDefaultVal();
  201 + });
  202 + //线路标准
  203 + information = gb_data_basic.getLineInformation(sch.xlBm);
  204 +
  205 + //出场开始时间改变
  206 + $('input[name=startDate]', emptyForm).on('change input', function () {
  207 + var st = moment($(this).val(), 'HH:mm')
  208 + , time = getOutTime();
  209 + if (!time)
  210 + return;
  211 +
  212 + var ets = st.add(time, 'minute').format('HH:mm');
  213 + $('input[name=endDate]', emptyForm).val(ets);
  214 + });
  215 + //出场结束时间改变
  216 + $('input[name=endDate]', emptyForm).on('change input', function () {
  217 + var et = moment($(this).val(), 'HH:mm'), time = getOutTime();
  218 + if (!time)
  219 + return;
  220 +
  221 + var ets = et.subtract(time, 'minute').format('HH:mm');
  222 + $('input[name=startDate]', emptyForm).val(ets);
  223 + });
  224 +
  225 + var dataArray = [];
  226 + var fs = $('form.inpark_form', modal).formValidation({
  227 + framework: 'uikit',
  228 + locale: 'zh_CN'
  229 + });
  230 + fs.on('success.form.fv', function (e) {
  231 + e.preventDefault();
  232 + if ($(this).is(':hidden'))
  233 + return;
  234 + dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this)
  235 + , {remarks: $('#globalRemarks', modal).val(), 'schedule.id': sch.id}));
  236 + $(this).data('valid', true);
  237 +
  238 + if (allValidSuccess()) {
  239 + var i = 0;
  240 + (function () {
  241 + var f = arguments.callee;
  242 + if (i >= dataArray.length) {
  243 + UIkit.modal(modal).hide();
  244 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  245 + return;
  246 + }
  247 + var data = dataArray[i];
  248 + gb_common.$post('/childTask', data, function (rs) {
  249 + notify_succ('子任务添加成功');
  250 + gb_schedule_table.updateSchedule(rs.t);
  251 + i++;
  252 + f();
  253 + });
  254 + })();
  255 + }
  256 + });
  257 +
  258 + //校验不过
  259 + fs.on('err.field.fv', function () {
  260 + $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled');
  261 + });
  262 +
  263 + //submit
  264 + $('#submitChildTaskBtn', modal).on('click', function () {
  265 + $(this).addClass('disabled').attr('disabled', 'disabled');
  266 + dataArray = [];
  267 + fs.data('valid', false);
  268 + fs.formValidation('validate');
  269 + //fs.submit();
  270 + });
  271 + });
  272 +
  273 + /* function outUpOrDown() {
  274 + if (information.carPark != $('select[name=startStation]', emptyForm).val())
  275 + return -1;
  276 +
  277 + return sch.xlDir;
  278 + }*/
  279 +
  280 + function getOutTime() {
  281 + if (information.carPark != $('select[name=startStation]', emptyForm).val())
  282 + return null;
  283 +
  284 + if (sch.xlDir == 0)
  285 + return information.upOutTimer;
  286 + else if (sch.xlDir == 1)
  287 + return information.downOutTimer;
  288 + }
  289 +
  290 + function allValidSuccess() {
  291 + var flag = true;
  292 + $('form.inpark_form:visible', modal).each(function (i, f) {
  293 + if (!$(f).data('valid')) {
  294 + flag = false;
  295 + return false;
  296 + }
  297 + });
  298 + return flag;
  299 + }
  300 +
  301 + //获取表单disabled 项的值
  302 + function getDisabledVal(f) {
  303 + var rs = {};
  304 + $('input,select', f).each(function () {
  305 + if ($(this).attr('disabled')) {
  306 + rs[$(this).attr('name')] = $(this).val();
  307 + }
  308 + });
  309 + return rs;
  310 + }
  311 +
  312 + function setDefaultVal() {
  313 + var routeOpts = '';
  314 + $.each(stationRoutes, function () {
  315 + routeOpts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>';
  316 + });
  317 + esCode = stationRoutes[stationRoutes.length - 1].stationCode;
  318 +
  319 + //营运起终点
  320 + $('select[name=startStation]', serviceForm).html(routeOpts).val(sch.qdzCode);
  321 + $('select[name=endStation]', serviceForm).html(routeOpts).val(sch.zdzCode);
  322 + //营运开始结束时间
  323 + $('input[name=startDate]', serviceForm).val(sch.dfsj);
  324 + $('input[name=endDate]', serviceForm).val(sch.zdsj);
  325 + //营运里程
  326 + $('input[name=mileage]', serviceForm).val(sch.jhlc);
  327 + //营运班次类型
  328 + $('select[name=type1]', serviceForm).val(sch['sflj'] ? '临加' : '正常');
  329 +
  330 +
  331 + //空驶终点
  332 + $('select[name=endStation]', emptyForm).html(routeOpts).val(sch.qdzCode);
  333 + //出场结束时间
  334 + var eDate = moment(sch.dfsj, 'HH:mm').subtract(5, 'minute').format('HH:mm');
  335 + $('input[name=endDate]', emptyForm).val(eDate).trigger('change');
  336 + //空驶里程
  337 + $('input[name=mileage]', emptyForm).val(sch.xlDir == 0 ? information.upOutMileage : information.downOutMileage);
  338 + }
  339 + })();
  340 + </script>
  341 +</div>
0 342 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/js/data/data_basic.js
... ... @@ -2,14 +2,15 @@
2 2  
3 3 var gb_data_basic = (function () {
4 4  
5   - var stationRoutes, lineCode2NameAll, lineInformations, nbbm2deviceMap, allPersonnel;
6   - var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", "nbbm2deviceId", "all_personnel"
7   - , function (routes, code2Name, informations, nbbm2device, all_personnel) {
  5 + var stationRoutes, lineCode2NameAll, lineInformations, nbbm2deviceMap, allPersonnel, svgAttrs;
  6 + var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", "nbbm2deviceId", "all_personnel", "svg_attrs"
  7 + , function (routes, code2Name, informations, nbbm2device, all_personnel, svgAttrMap) {
8 8 stationRoutes = routes;
9 9 lineCode2NameAll = code2Name;
10 10 lineInformations = informations;
11 11 nbbm2deviceMap = nbbm2device;
12 12 allPersonnel = all_personnel;
  13 + svgAttrs = svgAttrMap;
13 14 gb_main_ep.emitLater('data-basic');
14 15 });
15 16  
... ... @@ -30,8 +31,13 @@ var gb_data_basic = (function () {
30 31  
31 32 //站点路由
32 33 gb_common.$get('/stationroute/multiLine', {lineIds: line_idx}, function (rs) {
33   - var list = JSON.parse(rs.list);
34   - ep.emit('stationRoutes', gb_common.groupBy(list, 'lineCode'));
  34 + var list = rs.list;//JSON.parse(rs.list);
  35 + var routeData = gb_common.groupBy(list, 'lineCode');
  36 + //排序
  37 + for (var lineCode in routeData) {
  38 + routeData[lineCode].sort(stationRouteSort);
  39 + }
  40 + ep.emit('stationRoutes', routeData);
35 41 });
36 42  
37 43 //线路标准信息
... ... @@ -47,13 +53,13 @@ var gb_data_basic = (function () {
47 53 //人员信息
48 54 $.get('/basic/all_personnel', function (rs) {
49 55 //转换成自动补全组件需要的数据
50   - var data=[],name;
51   - for(var jobCode in rs){
52   - name=rs[jobCode];
  56 + var data = [], name;
  57 + for (var jobCode in rs) {
  58 + name = rs[jobCode];
53 59 /*if(jobCode.indexOf("-")!=-1)
54   - jobCode=jobCode.split('-')[1];*/
  60 + jobCode=jobCode.split('-')[1];*/
55 61 data.push({
56   - value: jobCode+'/'+name,
  62 + value: jobCode + '/' + name,
57 63 fullChars: pinyin.getFullChars(name).toUpperCase(),
58 64 camelChars: pinyin.getCamelChars(name)
59 65 });
... ... @@ -61,7 +67,7 @@ var gb_data_basic = (function () {
61 67 ep.emit('all_personnel', data);
62 68 });
63 69  
64   - var carparks={};
  70 + var carparks = {};
65 71 //停车场数据
66 72 gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) {
67 73 $.each(rs.list, function () {
... ... @@ -71,7 +77,7 @@ var gb_data_basic = (function () {
71 77  
72 78 var getCarparkByCode = function (code) {
73 79 return carparks[code];
74   - }
  80 + };
75 81  
76 82 //line code to name
77 83 $.get('/basic/lineCode2Name', function (rs) {
... ... @@ -83,6 +89,17 @@ var gb_data_basic = (function () {
83 89 ep.emit('nbbm2deviceId', rs);
84 90 });
85 91  
  92 + //模拟图属性数据
  93 + gb_common.$get('/realSchedule/svgAttr', {idx: line_idx}, function (rs) {
  94 + var data = {};
  95 + $.each(rs.list, function () {
  96 + this.hideStations = JSON.parse(this.hideStations);
  97 + this.nicknames = JSON.parse(this.nicknames);
  98 + data[this.lineCode] = this;
  99 + });
  100 + ep.emit('svg_attrs', data);
  101 + });
  102 +
86 103 function findLineByCodes(codeArr) {
87 104 var rs = [];
88 105 $.each(codeArr, function () {
... ... @@ -103,6 +120,10 @@ var gb_data_basic = (function () {
103 120 var getLineInformation = function (lineCode) {
104 121 return lineInformations[lineCode];
105 122 };
  123 +
  124 + var stationRouteSort = function (a, b) {
  125 + return a.stationRouteCode - b.stationRouteCode;
  126 + };
106 127 //文件载入完毕
107 128 res_load_ep.emitLater('load_data_basic');
108 129  
... ... @@ -125,6 +146,36 @@ var gb_data_basic = (function () {
125 146 return allPersonnel;
126 147 },
127 148 findCodeByLinename: findCodeByLinename,
128   - getCarparkByCode: getCarparkByCode
  149 + getCarparkByCode: getCarparkByCode,
  150 + getSvgAttr: function (lineCode) {
  151 + return svgAttrs[lineCode];
  152 + },
  153 + setSvgAttr: function (attr) {
  154 + attr.hideStations = JSON.parse(attr.hideStations);
  155 + attr.nicknames = JSON.parse(attr.nicknames);
  156 + svgAttrs[attr.lineCode] = attr;
  157 + },
  158 + //是否是环线
  159 + isLoopLine: function (lineCode) {
  160 + var data = gb_common.groupBy(stationRoutes[lineCode], 'directions');
  161 + //如果上行起终点名称相同,并且距离50米内
  162 + var len = data[0].length;
  163 + if(len > 0){
  164 + var first = data[0][0],
  165 + end = data[0][len - 1];
  166 +
  167 + if(first.stationName != end.stationName)
  168 + return false;
  169 +
  170 + var fPoint = {latitude: first.station.gLaty, longitude: first.station.gLonx}
  171 + ,ePoint = {latitude: end.station.gLaty, longitude: end.station.gLonx};
  172 +
  173 + if(geolib.getDistance(fPoint, ePoint) < 40){
  174 + return true;
  175 + }
  176 + }
  177 +
  178 + return false;
  179 + }
129 180 };
130 181 })();
... ...
src/main/resources/static/real_control_v2/js/data/gps_abnormal.js
... ... @@ -55,7 +55,6 @@ var gb_gps_abnormal = (function () {
55 55 });
56 56 //按线路_走向 分组数据
57 57 allRoads = groupByLineAndUpdown(list);
58   - console.log('路段数据', allRoads);
59 58 });
60 59 };
61 60  
... ...
src/main/resources/static/real_control_v2/js/home/line_panel.js
... ... @@ -20,7 +20,7 @@ var gb_home_line_panel = (function() {
20 20 }));
21 21  
22 22 //draw svg
23   - gb_svg_chart.draw_line(line.lineCode, $('.svg-chart-wrap', this));
  23 + gb_svg_chart.draw_line(line.lineCode, $('.svg-chart-wrap', this), true);
24 24 });
25 25  
26 26 //fixed table head
... ...
src/main/resources/static/real_control_v2/js/main.js
... ... @@ -48,7 +48,7 @@ var gb_main_ep = new EventProxy(),
48 48 //嵌入地图页面
49 49 $('li.map-panel', '#main-tab-content').load('/real_control_v2/mapmonitor/real.html');
50 50 //弹出更新说明
51   - //showUpdateDescription();
  51 + showUpdateDescription();
52 52 });
53 53  
54 54 function g_emit(id) {
... ... @@ -177,8 +177,8 @@ var open_modal = function (pageUrl, data, opt) {
177 177 function showUpdateDescription() {
178 178 //更新说明
179 179 var updateDescription = {
180   - date: '2016-12-20',
181   - text: '<h5>1、回场子任务开放使用。</h5>'
  180 + date: '2017-01-07',
  181 + text: '<h5>1、出场子任务开放使用。</h5><h5>2、班次直放调整后可再次修改班次类型。</h5><h5>3、双击实发,可打开发车信息微调,发车信息微调界面可以直接烂班。</h5><h5>4、主页模拟图可以省略、重命名站点。</h5>'
182 182 };
183 183  
184 184 var storage = window.localStorage
... ...
src/main/resources/static/real_control_v2/js/utils/svg_chart.js
... ... @@ -7,7 +7,7 @@ var gb_svg_chart = (function () {
7 7 //left right padding
8 8 var x_padd = 30;
9 9 //上空白部分
10   - var y_top_padd = 14;
  10 + var y_top_padd = 4;
11 11 //text max size
12 12 var t_max_size = 7;
13 13 //svg namespace
... ... @@ -28,9 +28,18 @@ var gb_svg_chart = (function () {
28 28 return h < 20 ? wrap.parent().actual('outerHeight') - 2 : h;
29 29 };
30 30  
31   - var draw_line = function (lineCode, wrap) {
32   -
33   - var data = gb_svg_data_convert.mergeRoute(gb_data_basic.stationRoutes(lineCode)),
  31 + /**
  32 + * 绘制线路模拟图
  33 + * @param lineCode 线路编码
  34 + * @param wrap dom容器
  35 + * @param enableAttr 是否启用配置
  36 + */
  37 + var draw_line = function (lineCode, wrap, enableAttr) {
  38 + //环线
  39 + var loopLine = gb_data_basic.isLoopLine(lineCode);
  40 +
  41 + var routes = gb_data_basic.stationRoutes(lineCode);
  42 + var data = gb_svg_data_convert.mergeRoute(JSON.parse(JSON.stringify(routes)), enableAttr, lineCode),
34 43 len = data.length;
35 44  
36 45 var w = get_width(wrap),
... ... @@ -90,6 +99,7 @@ var gb_svg_chart = (function () {
90 99  
91 100 //down station link path
92 101 p_clzz.down = true;
  102 + p_clzz.loop_line = loopLine;
93 103 items.append('path').classed(p_clzz)
94 104 .attr('d', function (d, i) {
95 105 return i < len - 1 ? downLine([i, i + 1]) : '';
... ... @@ -214,8 +224,15 @@ var gb_svg_chart = (function () {
214 224 return d.deviceId;
215 225 },
216 226 gps_update_point = function (e, svg) {
217   - e.transition().duration(3000).attr('x', function (d) {
218   - return gx(d, svg);
  227 + var x;
  228 + e.transition().attr('x', function (d) {
  229 + x = gx(d, svg);
  230 + //找不到停靠点,直接隐藏
  231 + if(x == -100)
  232 + $(this).hide();
  233 + else
  234 + $(this).show();
  235 + return x;
219 236 })
220 237 .attr('y', function (d) {
221 238 return gy(d, svg);
... ... @@ -283,7 +300,7 @@ var gb_svg_chart = (function () {
283 300  
284 301 marker_clusterer_merge(svg, stopNo, gpsArr);
285 302 }
286   - }
  303 + };
287 304  
288 305 var marker_clusterer_merge = function (svg, stopNo, gpsArr) {
289 306 //stop circle
... ... @@ -314,7 +331,7 @@ var gb_svg_chart = (function () {
314 331 mergerG.append('text').text(len)
315 332 .attr('x', x - ((len + '').length * 4))
316 333 .attr('y', isDown ? y + 24 : y - 14);
317   - }
  334 + };
318 335  
319 336 return {
320 337 draw_line: draw_line,
... ...
src/main/resources/static/real_control_v2/js/utils/svg_data_convert.js
1   -var gb_svg_data_convert = (function() {
  1 +var gb_svg_data_convert = (function () {
2 2  
3 3 /**
4 4 * 合并上下行路由
5 5 * type 0 上行 1 下行 2 同名合并 3 异名合并
  6 + *
  7 + * 有时间再重写一些这块代码!!!!!
  8 + *
  9 + * enableAttr: 是否启用配置信息
6 10 */
7   - function mergeRoute(routes) {
  11 + function mergeRoute(routes, enableAttr, lineCode) {
8 12 //按上下行拆分
9 13 routes = gb_common.groupBy(routes, 'directions');
10 14 var up = routes[0],
... ... @@ -13,6 +17,15 @@ var gb_svg_data_convert = (function() {
13 17 up.sort(upSort);
14 18 down.sort(downSort);
15 19  
  20 + //根据配置处理一下数据
  21 + if (enableAttr) {
  22 + var svgAttr = gb_data_basic.getSvgAttr(lineCode);
  23 + if (svgAttr) {
  24 + up = filterByAttrs(svgAttr, up);
  25 + down = filterByAttrs(svgAttr, down);
  26 + }
  27 + }
  28 +
16 29 //同名站点合并
17 30 var data = [];
18 31 for (var j = 0; j < up.length; j++) {
... ... @@ -26,12 +39,21 @@ var gb_svg_data_convert = (function() {
26 39 };
27 40  
28 41 if (upS.stationName != downS.stationName) {
  42 + //下行站点在上行路由中是否存在
29 43 var dIndex = station_indexof(down, upS, j);
  44 + //上行站点在下行路由中是否存在
  45 + var uIndex = station_indexof(up, downS, j);
30 46 if (dIndex == -1) {
31   - op.type = 0;
32   - op.id = [get_station_code(upS), -1];
33   - //占位
34   - down.splice(j, 0, {});
  47 + if (uIndex == -1) {
  48 + op.type = 3;
  49 + op.name = [upS.stationName, downS.stationName];
  50 + }
  51 + else {
  52 + op.type = 0;
  53 + op.id = [get_station_code(upS), -1];
  54 + //占位
  55 + down.splice(j, 0, {});
  56 + }
35 57 } else {
36 58 for (var t = j; t < dIndex - 1; t++) {
37 59 var temp = down[t];
... ... @@ -76,22 +98,49 @@ var gb_svg_data_convert = (function() {
76 98 }
77 99  
78 100 //上下行GPS容器
79   - $.each(data, function(){
80   - this.gpsUps= [];
81   - this.gpsDowns= [];
  101 + $.each(data, function () {
  102 + this.gpsUps = [];
  103 + this.gpsDowns = [];
82 104 });
83 105 return data;
84   - }
  106 + };
  107 +
  108 + var filterByAttrs = function (svgAttr, routes) {
  109 + var hideStations = svgAttr.hideStations ? svgAttr.hideStations : [];
  110 + var nicknames = svgAttr.nicknames ? svgAttr.nicknames : {};
  111 + var stationCode;
  112 + $.each(routes, function (i) {
  113 + stationCode = this.stationCode
  114 + //要隐藏的站点
  115 + $.each(hideStations, function (j, hide) {
  116 + if (stationCode == hide)
  117 + delete routes[i];
  118 + });
  119 +
  120 + //要重命名的站点
  121 + if (nicknames[this.stationName]) {
  122 + this.stationName = nicknames[this.stationName];
  123 + }
  124 + });
  125 +
  126 + var newRoutes = [];
  127 + $.each(routes, function (i, station) {
  128 + if(station)
  129 + newRoutes.push(station);
  130 + });
  131 +
  132 + return newRoutes;
  133 + };
85 134  
86   - var upSort = function(a, b) {
  135 + var upSort = function (a, b) {
87 136 return a.stationRouteCode - b.stationRouteCode;
88 137 };
89 138  
90   - var downSort = function(a, b) {
  139 + var downSort = function (a, b) {
91 140 return b.stationRouteCode - a.stationRouteCode;
92 141 };
93 142  
94   - var station_indexof = function(array, station, start) {
  143 + var station_indexof = function (array, station, start) {
95 144 var res = -1;
96 145 for (var i = start, obj; obj = array[i++];) {
97 146 if (obj.stationName == station.stationName) {
... ... @@ -102,15 +151,11 @@ var gb_svg_data_convert = (function() {
102 151 return res;
103 152 };
104 153  
105   - var get_station_code=function (station) {
106   - /*if(station.stationMark=='B' || station.stationMark=='E')
107   - return station.stationCode+'_'+station.directions;
108   - else
109   - return station.stationCode;*/
110   - return station.stationCode+'_'+station.directions;
  154 + var get_station_code = function (station) {
  155 + return station.stationCode + '_' + station.directions;
111 156 };
112 157  
113   - var nvl_get = function(list, index) {
  158 + var nvl_get = function (list, index) {
114 159 return list[index] == null ? {} : list[index];
115 160 };
116 161  
... ...