Commit b79f715f009f9111b195b6fca7c90a111115107b

Authored by 廖磊
2 parents 4f3f73e8 90164ff0

Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into

minhang

# Conflicts:
#	src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
#	src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
Showing 49 changed files with 3957 additions and 2375 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
... ... @@ -443,4 +408,14 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
443 408 }
444 409 return rs;
445 410 }
  411 +
  412 + @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
  413 + public Map<String, Object> svgAttr(@RequestParam String jsonStr){
  414 + return scheduleRealInfoService.svgAttr(jsonStr);
  415 + }
  416 +
  417 + @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
  418 + public Map<String, Object> findSvgAttr(@RequestParam String idx){
  419 + return scheduleRealInfoService.findSvgAttr(idx);
  420 + }
446 421 }
... ...
src/main/java/com/bsth/data/BasicData.java
... ... @@ -261,26 +261,26 @@ public class BasicData implements CommandLineRunner {
261 261 /**
262 262 * 加载运管处的站点及序号
263 263 * 上行从1开始,下行顺序续编
264   -
265   - List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc();
266   - if(ygcLines != null && ygcLines.size() > 0){
267   - int size = ygcLines.size();
268   - Object[] tempArray ;
269   - int num = 1;
270   - String key;
271   - String lineCode = "";
272   - for (int i = 0; i < size; i ++){
273   - tempArray = ygcLines.get(i);
274   - if(lineCode.equals("")){
275   - lineCode = tempArray[0]+"";
276   - }else if(!lineCode.equals(tempArray[0]+"")){
277   - num = 1;
278   - lineCode = tempArray[0]+"";
279   - }
280   - key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2];
281   - tempStationName2YgcNumber.put(key,num++);
282   - }
283   - }*/
  264 + */
  265 + List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc();
  266 + if(ygcLines != null && ygcLines.size() > 0){
  267 + int size = ygcLines.size();
  268 + Object[] tempArray ;
  269 + int num = 1;
  270 + String key;
  271 + String lineCode = "";
  272 + for (int i = 0; i < size; i ++){
  273 + tempArray = ygcLines.get(i);
  274 + if(lineCode.equals("")){
  275 + lineCode = tempArray[0]+"";
  276 + }else if(!lineCode.equals(tempArray[0]+"")){
  277 + num = 1;
  278 + lineCode = tempArray[0]+"";
  279 + }
  280 + key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2];
  281 + tempStationName2YgcNumber.put(key,num++);
  282 + }
  283 + }
284 284 }
285 285  
286 286 lineId2CodeMap = biMap;
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
... ... @@ -169,6 +169,10 @@ public class InOutStationSignalHandle extends SignalHandle{
169 169  
170 170 if(gps.getStopNo().equals(sch.getZdzCode())){
171 171  
  172 + //进场最多提前1.2小时
  173 + if(sch.getBcType().equals("in") && sch.getZdsjT() - gps.getTimestamp() > MAX_BEFORE_TIME)
  174 + return;
  175 +
172 176 //实达时间不覆盖
173 177 if(StringUtils.isNotEmpty(sch.getZdsjActual()))
174 178 return;
... ...
src/main/java/com/bsth/entity/realcontrol/SvgAttribute.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +
  7 +/**
  8 + * 主页SVG模拟图属性设置
  9 + * Created by panzhao on 2017/1/6.
  10 + */
  11 +@Entity
  12 +@Table(name = "bsth_c_svg_attr")
  13 +public class SvgAttribute {
  14 +
  15 + @Id
  16 + private String lineCode;
  17 +
  18 + /**
  19 + * 要隐藏的站点编码 , 号分割多个
  20 + */
  21 + private String hideStations;
  22 +
  23 + /**
  24 + * 站点别名 json对象字符串
  25 + */
  26 + private String nicknames;
  27 +
  28 + public String getLineCode() {
  29 + return lineCode;
  30 + }
  31 +
  32 + public void setLineCode(String lineCode) {
  33 + this.lineCode = lineCode;
  34 + }
  35 +
  36 + public String getHideStations() {
  37 + return hideStations;
  38 + }
  39 +
  40 + public void setHideStations(String hideStations) {
  41 + this.hideStations = hideStations;
  42 + }
  43 +
  44 + public String getNicknames() {
  45 + return nicknames;
  46 + }
  47 +
  48 + public void setNicknames(String nicknames) {
  49 + this.nicknames = nicknames;
  50 + }
  51 +}
... ...
src/main/java/com/bsth/repository/realcontrol/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/impl/TrafficManageServiceImpl.java
... ... @@ -390,36 +390,44 @@ public class TrafficManageServiceImpl implements TrafficManageService{
390 390 Map<String,Object> map = new HashMap<String,Object>();
391 391 for(Map<String,Object> schRealInfo:listGroup){
392 392 if(schRealInfo != null){
  393 + map.put("insideCode_eq", schRealInfo.get("clZbh")+"");
  394 + Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map));
  395 + /**
  396 + * 如果car==null,则说明该车辆是从线调中换车功能中加进去的,
  397 + * 在cars基础信息中查不到车辆的信息,所以忽略该车辆
  398 + */
  399 + if(car == null){
  400 + continue;
  401 + }
393 402 //计算总公里和空驶公里,营运公里=总公里-空驶公里
394 403 double totalKilometers = 0,emptyKilometers =0;
395 404 sf.append("<LCYH>");
396   - map.put("insideCode_eq", schRealInfo.get("clZbh")+"");
397   - Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map));
398   -// Cars car = carsRepository.findCarByClzbh(schRealInfo.getClZbh());
399 405 sf.append("<RQ>"+date+"</RQ>");
400 406 sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>");
401 407 sf.append("<CPH>"+car.getCarPlate()+"</CPH>");
402   - for(ScheduleRealInfo scheduleRealInfo:list){
403   - if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("clZbh")+"")
404   - .equals(scheduleRealInfo.getClZbh())){
405   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
406   - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
407   - if(childTaskPlans.isEmpty()){
408   - if(scheduleRealInfo.getStatus() == 2){
409   - totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
410   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
411   - || scheduleRealInfo.getBcType().equals("venting")){
412   - emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
  408 + if(list != null && list.size() > 0){
  409 + for(ScheduleRealInfo scheduleRealInfo:list){
  410 + if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("clZbh")+"")
  411 + .equals(scheduleRealInfo.getClZbh())){
  412 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  413 + //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
  414 + if(childTaskPlans.isEmpty()){
  415 + if(scheduleRealInfo.getStatus() == 2){
  416 + totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
  417 + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  418 + || scheduleRealInfo.getBcType().equals("venting")){
  419 + emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
  420 + }
413 421 }
414   - }
415   - }else{
416   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
417   - while(it.hasNext()){
418   - ChildTaskPlan childTaskPlan = it.next();
419   - if(!childTaskPlan.isDestroy()){
420   - totalKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();
421   - if(childTaskPlan.getMileageType().equals("empty")){
422   - emptyKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();;
  422 + }else{
  423 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  424 + while(it.hasNext()){
  425 + ChildTaskPlan childTaskPlan = it.next();
  426 + if(!childTaskPlan.isDestroy()){
  427 + totalKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();
  428 + if(childTaskPlan.getMileageType().equals("empty")){
  429 + emptyKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();;
  430 + }
423 431 }
424 432 }
425 433 }
... ... @@ -604,8 +612,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
604 612 schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzName())).append("</ZDXH>");
605 613 sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>");
606 614 sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>");
607   - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
608   - schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzName())).append("</ZDXH>");
  615 + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
  616 + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzName())).append("</DDXH>");
609 617 sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj()))
610 618 .append("</JHDDSJ>");
611 619 sBuffer.append("</BC>");
... ...
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  
... ... @@ -134,9 +134,10 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
134 134 Map<String,Object> changeBcType(Long id, String bcType, String remarks);
135 135  
136 136 Map<String,Object> historySave(ScheduleRealInfo sch);
137   -
138 137  
139 138 Map<String, Object> MapById(Long id) ;
140 139  
141   -
  140 + Map<String,Object> svgAttr(String jsonStr);
  141 +
  142 + Map<String,Object> findSvgAttr(String idx);
142 143 }
... ...
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;
... ... @@ -26,6 +27,7 @@ import com.bsth.entity.sys.SysUser;
26 27 import com.bsth.repository.LineRepository;
27 28 import com.bsth.repository.realcontrol.ChildTaskPlanRepository;
28 29 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  30 +import com.bsth.repository.realcontrol.SvgAttributeRepository;
29 31 import com.bsth.repository.schedule.CarConfigInfoRepository;
30 32 import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
31 33 import com.bsth.repository.schedule.GuideboardInfoRepository;
... ... @@ -38,18 +40,18 @@ import com.bsth.util.*;
38 40 import com.bsth.websocket.handler.SendUtils;
39 41 import com.google.common.base.Splitter;
40 42 import com.google.common.collect.ArrayListMultimap;
  43 +import com.google.common.collect.BiMap;
41 44 import com.google.common.collect.Lists;
42 45 import com.google.common.collect.Multimap;
  46 +import org.apache.commons.lang3.StringEscapeUtils;
43 47 import org.apache.commons.lang3.StringUtils;
44 48 import org.joda.time.format.DateTimeFormat;
45 49 import org.joda.time.format.DateTimeFormatter;
46   -import org.pentaho.di.core.logging.ChannelLogTable.ID;
47 50 import org.slf4j.Logger;
48 51 import org.slf4j.LoggerFactory;
49 52 import org.springframework.beans.factory.annotation.Autowired;
50 53 import org.springframework.stereotype.Service;
51 54  
52   -import java.net.URLEncoder;
53 55 import java.text.DecimalFormat;
54 56 import java.text.ParseException;
55 57 import java.text.SimpleDateFormat;
... ... @@ -57,429 +59,385 @@ import java.util.*;
57 59  
58 60 @Service
59 61 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
60   - implements ScheduleRealInfoService {
  62 + implements ScheduleRealInfoService {
61 63  
62   - @Autowired
63   - ScheduleRealInfoRepository scheduleRealInfoRepository;
  64 + @Autowired
  65 + ScheduleRealInfoRepository scheduleRealInfoRepository;
64 66  
65   - @Autowired
66   - EmployeeConfigInfoRepository employeeConfigInfoRepository;
  67 + @Autowired
  68 + EmployeeConfigInfoRepository employeeConfigInfoRepository;
67 69  
68   - @Autowired
69   - CarConfigInfoRepository carConfigInfoRepository;
70   -
71   - @Autowired
72   - SectionRouteService sectionRouteService;
73   -
74   - @Autowired
75   - DutyEmployeeService dutyEmployeeService;
76   -
77   - /*@Autowired
78   - BorrowCenter borrowCenter;*/
79   -
80   - @Autowired
81   - LineRepository lineRepository;
82   -
83   - @Autowired
84   - GuideboardInfoRepository guideboardInfoRepository;
85   -
86   - @Autowired
87   - ChildTaskPlanRepository cTaskPlanRepository;
88   -
89   - @Autowired
90   - SendUtils sendUtils;
91   -
92   - @Autowired
93   - DayOfSchedule dayOfSchedule;
94   -
95   - @Autowired
96   - SchAttrCalculator schAttrCalculator;
97   -
98   - @Autowired
99   - LineConfigData lineConfigData;
100   -
101   - Logger logger = LoggerFactory.getLogger(this.getClass());
102   -
103   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
104   - sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"),
105   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
106   -
107   - @Override
108   - public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) {
109   - List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines));
110   -
111   - Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create();
112   -
113   - for (String lineCode : lineList) {
114   - mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode));
115   - }
116   - return mMap.asMap();
117   - }
118   -
119   - private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
120   - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
121   - @Override
122   - public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj/*, String nbbm,String jsy,String spy*/) {
123   - Map<String, Object> map = new HashMap<>();
124   - try {
125   -
126   - ScheduleRealInfo schedule = dayOfSchedule.get(id);
127   -
128   -
129   - LineConfig config = lineConfigData.get(schedule.getXlBm());
130   - //小于线路开始运营时间,则默认跨过24点
131   - if(dfsj.compareTo(config.getStartOpt()) < 0){
132   - schedule.setRealExecDate(fmtyyyyMMdd.print(schedule.getScheduleDate().getTime() + DAY_TIME));
133   - }
134   - else {
135   - schedule.setRealExecDate(schedule.getScheduleDateStr());
136   - }
137   -
138   - schedule.setDfsjAll(dfsj);
139   - schedule.addRemarks(remarks);
140   -
141   - List<ScheduleRealInfo> ts = new ArrayList<>();
142   - ts.add(schedule);
143   - //调整终点时间和下一个班次的应到时间
144   - schedule.calcEndTime();
145   - ScheduleRealInfo nextSch = dayOfSchedule.next(schedule);
146   - if(null != nextSch){
147   - nextSch.setQdzArrDateJH(schedule.getZdsj());
148   - ts.add(nextSch);
149   - }
150   -
151   - // 持久化到数据库
152   - dayOfSchedule.save(schedule);
153   -
154   - map.put("status", ResponseCode.SUCCESS);
155   - map.put("ts", ts);
156   - } catch (Exception e) {
157   - logger.error("", e);
158   - map.put("status", ResponseCode.ERROR);
159   - }
160   - return map;
161   - }
162   -
163   - @Override
164   - public Map<String, Object> destroy(String idsStr, /*int spaceAdjust, */String remarks, String reason/*, int spaceNum*/) {
165   -
166   - Map<String, Object> map = new HashMap<>();
167   - List<ScheduleRealInfo> rsList = new ArrayList<>();
168   - map.put("ts", rsList);
169   - try {
170   - List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr));
171   -
172   - ScheduleRealInfo schedule = null;
173   - for (String id : idList) {
174   - schedule = dayOfSchedule.get(Long.parseLong(id));
175   - if(schedule.isDestroy()){
176   - map.put("status", ResponseCode.ERROR);
177   - map.put("msg", "不必要的重复烂班!");
178   - return map;
179   - }
180   -
181   - schedule.setAdjustExps(reason);
182   - schedule.destroy();
183   - schedule.addRemarks(remarks);
184   -
185   - dayOfSchedule.save(schedule);
186   - rsList.add(schedule);
187   - }
188   -
189   - map.put("status", ResponseCode.SUCCESS);
190   - } catch (Exception e) {
191   - logger.error("", e);
192   - map.put("status", ResponseCode.ERROR);
193   - }
194   - return map;
195   - }
196   -
197   - // 线路id获取驾驶员
198   - @Override
199   - public List<Map<String, String>> findDriverByLine(String lineCode) {
200   - List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
201   -
202   - List<Map<String, String>> rsList = new ArrayList<>();
203   - Map<String, String> map = null;
204   - Personnel driver = null;
205   - String code = null;
206   -
207   - for (EmployeeConfigInfo employee : list) {
208   - driver = employee.getJsy();
209   - if (driver != null) {
210   - map = new HashMap<>();
211   - code = driver.getJobCode();
212   - map.put("id", code + "/" + driver.getPersonnelName());
213   - map.put("text", code + "/" + driver.getPersonnelName());
214   - rsList.add(map);
215   - }
216   - }
217   - return rsList;
218   - }
219   -
220   - // 线路id获取售票员
221   - @Override
222   - public List<Map<String, String>> findConductorByLine(String lineCode) {
223   - List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
224   -
225   - List<Map<String, String>> rsList = new ArrayList<>();
226   - Map<String, String> map = null;
227   - Personnel conductor = null;
228   - String code = null;
229   -
230   - for (EmployeeConfigInfo employee : list) {
231   - conductor = employee.getSpy();
232   - if (conductor != null) {
233   - code = conductor.getJobCode();
234   - map = new HashMap<>();
235   - map.put("id", code + "/" + conductor.getPersonnelName());
236   - map.put("text", code + "/" + conductor.getPersonnelName());
237   - rsList.add(map);
238   - }
239   - }
240   - return rsList;
241   - }
242   -
243   - @Override
244   - public List<Map<String, String>> findCarByLine(String lineCode) {
245   -
246   - List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode);
247   -
248   - List<Map<String, String>> rsList = new ArrayList<>();
249   - Map<String, String> map = null;
250   - Cars car = null;
251   - String code = null;
252   -
253   - for (CarConfigInfo cci : list) {
254   - car = cci.getCl();
255   - if (car != null) {
256   - code = car.getInsideCode();
257   - map = new HashMap<>();
258   - map.put("id", code);
259   - map.put("text", code);
260   - rsList.add(map);
261   - }
262   - }
263   - return rsList;
264   - }
265   -
266   -
267   - /**
268   - * 临加班次
269   - */
270   - @Override
271   - public Map<String, Object> save(ScheduleRealInfo t) {
272   - Map<String, Object> rs = new HashMap<>();
273   - try{
274   - SysUser user = SecurityUtils.getCurrentUser();
275   - String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm());
276   -
277   - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd")
278   - ,sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
279   -
280   - if(StringUtils.isEmpty(t.getjGh())){
281   - rs.put("status", ResponseCode.ERROR);
282   - rs.put("msg", "驾驶员工号不能为空!");
283   - return rs;
284   - }
285   - //截取工号
286   - if(t.getjGh().indexOf("-") != -1){
287   - t.setjGh(t.getjGh().split("-")[1]);
288   - }
289   -
290   - t.setScheduleDateStr(schDate);
291   - t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
292   - t.setRealExecDate(schDate);
293   - t.setCreateBy(user);
294   - t.setSflj(true);
295   - t.setLate(false);
296   - t.setDfsj(t.getFcsj());
297   - t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
298   -
299   -
300   - //班次历时
301   - t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60);
302   -
303   - //起终点名称
304   - String prefix = t.getXlBm() + "_" + t.getXlDir() + "_";
305   - t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix));
306   - t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix));
307   -
308   - //计算班次实际时间
309   - schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t);
310   - if(t.getZdsjT() < t.getFcsjT()){
311   - rs.put("status", ResponseCode.ERROR);
312   - rs.put("msg", "起终点时间异常!");
313   - return rs;
314   - }
315   -
316   - //实时入库
317   - super.save(t);
318   -
319   - // 加入缓存
320   - dayOfSchedule.put(t);
321   -
322   - //更新起点应到时间
323   - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t.getClZbh());
324   -
325   -
326   - rs.put("ts", ts);
327   - rs.put("t", t);
328   - }catch(Exception e){
329   - logger.error("", e);
330   - rs.put("status", ResponseCode.ERROR);
331   - }
332   - return rs;
333   - }
334   -
335   - @Override
336   - public Map<String, Object> delete(Long id) {
337   - Map<String, Object> rs = new HashMap<>();
338   - rs.put("status", ResponseCode.ERROR);
339   -
340   - ScheduleRealInfo sch = dayOfSchedule.get(id);
341   - if(sch == null){
342   - rs.put("msg", "无效的id号");
343   - return rs;
344   - }
345   -
346   - if(!sch.isSflj()){
347   - rs.put("msg", "你只能删除临加班次");
348   - return rs;
349   - }
350   -
351   - dayOfSchedule.delete(sch);
352   - //ScheduleRealInfo sch = dayOfSchedule.delete(id);
353   - //数据库删除
354   - rs = super.delete(id);
355   - //更新起点应到时间
356   - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());
357   - rs.put("ts", ts);
358   - rs.put("delete", sch);
359   -
360   - return rs;
361   - }
362   -
363   - @Override
364   - public List<Map<String, String>> sreachVehic(String nbbm) {
365   - // 转大写
366   - nbbm = nbbm.toUpperCase();
367   -
368   - List<Map<String, String>> list = new ArrayList<>();
369   - Map<String, String> map;
370   - Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
371   -
372   - Line line;
373   - for (String k : allSet) {
374   - if (k.indexOf(nbbm) != -1) {
375   - // 所属线路
376   - map = new HashMap<>();
377   - line = BasicData.nbbm2LineMap.get(k);
378   - map.put("id", k);
379   - map.put("text", k);
380   - if (null != line) {
381   - map.put("lineName", line.getName());
382   - map.put("lineCode", line.getLineCode());
383   - }
384   -
385   - list.add(map);
386   - }
387   -
388   - if (list.size() > 20)
389   - break;
390   - }
391   - return list;
392   - }
  70 + @Autowired
  71 + CarConfigInfoRepository carConfigInfoRepository;
393 72  
394   -/* @Override
395   - public Map<String, Object> adjust(Long id, String nbbm, String jsy, String spy, Integer revertLine, Integer borrowLine, String borrowTimeStr, String revertTimeStr) {
396   - // 班次
397   - ScheduleRealInfo schedule = dayOfSchedule.get(id);
398   - int upDown = Integer.parseInt(schedule.getXlDir());
  73 + @Autowired
  74 + SectionRouteService sectionRouteService;
399 75  
400   - String rq = sdfMonth.format(new Date());
401   - // 换车
402   - if (!StringUtils.isBlank(nbbm)) {
403   - adjustCar(schedule, nbbm);
404   - }
405   -
406   - List<String> tempArray;
407   - // 换驾驶员
408   - if (!StringUtils.isBlank(jsy)) {
409   - tempArray = Splitter.on("/").splitToList(jsy);
410   - adjustDriver(schedule, tempArray.get(0), tempArray.get(1));
411   - }
412   -
413   - // 换售票员
414   - if (!StringUtils.isBlank(spy)) {
415   - tempArray = Splitter.on("/").splitToList(spy);
416   - adjustConductor(schedule, tempArray.get(0), tempArray.get(1));
417   - }
418   -
419   - if(borrowLine != null && borrowTimeStr != null){
420   - try {
421   - //跨线路借车
422   - Long t = sdfMinute.parse(rq + " " + borrowTimeStr).getTime();
423   - //borrowCenter.put(nbbm, borrowLine, 0, t, upDown);
424   - } catch (ParseException e) {
425   - e.printStackTrace();
426   - }
427   - }
428   -
429   - if(revertLine != null && revertTimeStr != null){
430   - //定时还车
431   - try {
432   - Long t = sdfMinute.parse(rq + " " + revertTimeStr).getTime();
433   - //还车的时候不用切走向
434   - //borrowCenter.put(nbbm, revertLine, 1, t, -1);
435   - } catch (ParseException e) {
436   - e.printStackTrace();
437   - }
438   - }
439   -
440   - scheduleRealInfoRepository.save(schedule);
441   - //ScheduleBuffer.persistentList.add(schedule);
442   -
443   - Map<String, Object> map = new HashMap<>();
444   - map.put("status", 200);
445   - map.put("t", schedule);
446   - return map;
447   - }*/
448   -
449   - @Override
450   - public void adjustCar(ScheduleRealInfo schedule, String car) {
451   - schedule.setClZbh(car);
452   - }
453   -
454   - @Override
455   - public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) {
456   - if(driver.indexOf("-") != -1)
457   - driver = driver.split("-")[1];
458   - schedule.setjGh(driver);
459   - schedule.setjName(driverName);
460   - }
461   -
462   - @Override
463   - public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) {
464   - if(conductor.indexOf("-") != -1)
465   - conductor = conductor.split("-")[1];
466   - schedule.setsGh(conductor);
467   - schedule.setsName(conductorName);
468   - }
  76 + /*@Autowired
  77 + BorrowCenter borrowCenter;*/
469 78  
470   - @Override
471   - public List<ScheduleRealInfo> queryUserInfo(String line, String date,String state) {
472   - if(state.equals("2")){
473   - return scheduleRealInfoRepository.queryUserInfo2(line, date);
474   - }else{
475   - return scheduleRealInfoRepository.queryUserInfo3(line, date);
476   - }
477   -
478   - }
479   - /**
480   - *
481   - */
482   - @Override
  79 + @Autowired
  80 + LineRepository lineRepository;
  81 +
  82 + @Autowired
  83 + GuideboardInfoRepository guideboardInfoRepository;
  84 +
  85 + @Autowired
  86 + ChildTaskPlanRepository cTaskPlanRepository;
  87 +
  88 + @Autowired
  89 + SendUtils sendUtils;
  90 +
  91 + @Autowired
  92 + DayOfSchedule dayOfSchedule;
  93 +
  94 + @Autowired
  95 + SchAttrCalculator schAttrCalculator;
  96 +
  97 + @Autowired
  98 + LineConfigData lineConfigData;
  99 +
  100 + @Autowired
  101 + DutyEmployeeService dutyEmployeeService;
  102 +
  103 + Logger logger = LoggerFactory.getLogger(this.getClass());
  104 +
  105 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  106 + sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"),
  107 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  108 +
  109 + @Override
  110 + public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) {
  111 + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines));
  112 +
  113 + Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create();
  114 +
  115 + for (String lineCode : lineList) {
  116 + mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode));
  117 + }
  118 + return mMap.asMap();
  119 + }
  120 +
  121 + private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
  122 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  123 +
  124 + @Override
  125 + public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType) {
  126 + Map<String, Object> map = new HashMap<>();
  127 + try {
  128 +
  129 + ScheduleRealInfo schedule = dayOfSchedule.get(id);
  130 +
  131 +
  132 + LineConfig config = lineConfigData.get(schedule.getXlBm());
  133 + //小于线路开始运营时间,则默认跨过24点
  134 + if (dfsj.compareTo(config.getStartOpt()) < 0) {
  135 + schedule.setRealExecDate(fmtyyyyMMdd.print(schedule.getScheduleDate().getTime() + DAY_TIME));
  136 + } else {
  137 + schedule.setRealExecDate(schedule.getScheduleDateStr());
  138 + }
  139 +
  140 + schedule.setDfsjAll(dfsj);
  141 + schedule.addRemarks(remarks);
  142 +
  143 + List<ScheduleRealInfo> ts = new ArrayList<>();
  144 + ts.add(schedule);
  145 + //调整终点时间和下一个班次的应到时间
  146 + schedule.calcEndTime();
  147 + ScheduleRealInfo nextSch = dayOfSchedule.next(schedule);
  148 + if (null != nextSch) {
  149 + nextSch.setQdzArrDateJH(schedule.getZdsj());
  150 + ts.add(nextSch);
  151 + }
  152 +
  153 + //调整班次类型
  154 + if(StringUtils.isNotEmpty(bcType)){
  155 + schedule.setBcType(bcType);
  156 + }
  157 +
  158 + // 持久化到数据库
  159 + dayOfSchedule.save(schedule);
  160 +
  161 + map.put("status", ResponseCode.SUCCESS);
  162 + map.put("ts", ts);
  163 + } catch (Exception e) {
  164 + logger.error("", e);
  165 + map.put("status", ResponseCode.ERROR);
  166 + }
  167 + return map;
  168 + }
  169 +
  170 + @Override
  171 + public Map<String, Object> destroy(String idsStr, /*int spaceAdjust, */String remarks, String reason/*, int spaceNum*/) {
  172 +
  173 + Map<String, Object> map = new HashMap<>();
  174 + List<ScheduleRealInfo> rsList = new ArrayList<>();
  175 + map.put("ts", rsList);
  176 + try {
  177 + List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr));
  178 +
  179 + ScheduleRealInfo schedule = null;
  180 + for (String id : idList) {
  181 + schedule = dayOfSchedule.get(Long.parseLong(id));
  182 + if (schedule.isDestroy()) {
  183 + map.put("status", ResponseCode.ERROR);
  184 + map.put("msg", "不必要的重复烂班!");
  185 + return map;
  186 + }
  187 +
  188 + schedule.setAdjustExps(reason);
  189 + schedule.destroy();
  190 + schedule.addRemarks(remarks);
  191 +
  192 + dayOfSchedule.save(schedule);
  193 + rsList.add(schedule);
  194 + }
  195 +
  196 + map.put("status", ResponseCode.SUCCESS);
  197 + } catch (Exception e) {
  198 + logger.error("", e);
  199 + map.put("status", ResponseCode.ERROR);
  200 + }
  201 + return map;
  202 + }
  203 +
  204 + // 线路id获取驾驶员
  205 + @Override
  206 + public List<Map<String, String>> findDriverByLine(String lineCode) {
  207 + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
  208 +
  209 + List<Map<String, String>> rsList = new ArrayList<>();
  210 + Map<String, String> map = null;
  211 + Personnel driver = null;
  212 + String code = null;
  213 +
  214 + for (EmployeeConfigInfo employee : list) {
  215 + driver = employee.getJsy();
  216 + if (driver != null) {
  217 + map = new HashMap<>();
  218 + code = driver.getJobCode();
  219 + map.put("id", code + "/" + driver.getPersonnelName());
  220 + map.put("text", code + "/" + driver.getPersonnelName());
  221 + rsList.add(map);
  222 + }
  223 + }
  224 + return rsList;
  225 + }
  226 +
  227 + // 线路id获取售票员
  228 + @Override
  229 + public List<Map<String, String>> findConductorByLine(String lineCode) {
  230 + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode);
  231 +
  232 + List<Map<String, String>> rsList = new ArrayList<>();
  233 + Map<String, String> map = null;
  234 + Personnel conductor = null;
  235 + String code = null;
  236 +
  237 + for (EmployeeConfigInfo employee : list) {
  238 + conductor = employee.getSpy();
  239 + if (conductor != null) {
  240 + code = conductor.getJobCode();
  241 + map = new HashMap<>();
  242 + map.put("id", code + "/" + conductor.getPersonnelName());
  243 + map.put("text", code + "/" + conductor.getPersonnelName());
  244 + rsList.add(map);
  245 + }
  246 + }
  247 + return rsList;
  248 + }
  249 +
  250 + @Override
  251 + public List<Map<String, String>> findCarByLine(String lineCode) {
  252 +
  253 + List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode);
  254 +
  255 + List<Map<String, String>> rsList = new ArrayList<>();
  256 + Map<String, String> map = null;
  257 + Cars car = null;
  258 + String code = null;
  259 +
  260 + for (CarConfigInfo cci : list) {
  261 + car = cci.getCl();
  262 + if (car != null) {
  263 + code = car.getInsideCode();
  264 + map = new HashMap<>();
  265 + map.put("id", code);
  266 + map.put("text", code);
  267 + rsList.add(map);
  268 + }
  269 + }
  270 + return rsList;
  271 + }
  272 +
  273 +
  274 + /**
  275 + * 临加班次
  276 + */
  277 + @Override
  278 + public Map<String, Object> save(ScheduleRealInfo t) {
  279 + Map<String, Object> rs = new HashMap<>();
  280 + try {
  281 + if (BasicData.deviceId2NbbmMap.inverse().get(t.getClZbh()) == null) {
  282 + rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!");
  283 + rs.put("status", ResponseCode.ERROR);
  284 + return rs;
  285 + }
  286 +
  287 + SysUser user = SecurityUtils.getCurrentUser();
  288 + String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm());
  289 +
  290 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  291 +
  292 + if (StringUtils.isEmpty(t.getjGh())) {
  293 + rs.put("status", ResponseCode.ERROR);
  294 + rs.put("msg", "驾驶员工号不能为空!");
  295 + return rs;
  296 + }
  297 + //截取工号
  298 + if (t.getjGh().indexOf("-") != -1) {
  299 + t.setjGh(t.getjGh().split("-")[1]);
  300 + }
  301 +
  302 + t.setScheduleDateStr(schDate);
  303 + t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
  304 + t.setRealExecDate(schDate);
  305 + t.setCreateBy(user);
  306 + t.setSflj(true);
  307 + t.setLate(false);
  308 + t.setDfsj(t.getFcsj());
  309 + t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
  310 +
  311 +
  312 + //班次历时
  313 + t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60);
  314 +
  315 + //起终点名称
  316 + String prefix = t.getXlBm() + "_" + t.getXlDir() + "_";
  317 + t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix));
  318 + t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix));
  319 +
  320 + //计算班次实际时间
  321 + schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t);
  322 + if (t.getZdsjT() < t.getFcsjT()) {
  323 + rs.put("status", ResponseCode.ERROR);
  324 + rs.put("msg", "起终点时间异常!");
  325 + return rs;
  326 + }
  327 +
  328 + //实时入库
  329 + super.save(t);
  330 +
  331 + // 加入缓存
  332 + dayOfSchedule.put(t);
  333 +
  334 + //更新起点应到时间
  335 + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t.getClZbh());
  336 +
  337 +
  338 + rs.put("ts", ts);
  339 + rs.put("t", t);
  340 + } catch (Exception e) {
  341 + logger.error("", e);
  342 + rs.put("status", ResponseCode.ERROR);
  343 + }
  344 + return rs;
  345 + }
  346 +
  347 + @Override
  348 + public Map<String, Object> delete(Long id) {
  349 + Map<String, Object> rs = new HashMap<>();
  350 + rs.put("status", ResponseCode.ERROR);
  351 +
  352 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  353 + if (sch == null) {
  354 + rs.put("msg", "无效的id号");
  355 + return rs;
  356 + }
  357 +
  358 + if (!sch.isSflj()) {
  359 + rs.put("msg", "你只能删除临加班次");
  360 + return rs;
  361 + }
  362 +
  363 + dayOfSchedule.delete(sch);
  364 + //ScheduleRealInfo sch = dayOfSchedule.delete(id);
  365 + //数据库删除
  366 + rs = super.delete(id);
  367 + //更新起点应到时间
  368 + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());
  369 + rs.put("ts", ts);
  370 + rs.put("delete", sch);
  371 +
  372 + return rs;
  373 + }
  374 +
  375 + @Override
  376 + public List<Map<String, String>> sreachVehic(String nbbm) {
  377 + // 转大写
  378 + nbbm = nbbm.toUpperCase();
  379 +
  380 + List<Map<String, String>> list = new ArrayList<>();
  381 + Map<String, String> map;
  382 + Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
  383 +
  384 + Line line;
  385 + for (String k : allSet) {
  386 + if (k.indexOf(nbbm) != -1) {
  387 + // 所属线路
  388 + map = new HashMap<>();
  389 + line = BasicData.nbbm2LineMap.get(k);
  390 + map.put("id", k);
  391 + map.put("text", k);
  392 + if (null != line) {
  393 + map.put("lineName", line.getName());
  394 + map.put("lineCode", line.getLineCode());
  395 + }
  396 +
  397 + list.add(map);
  398 + }
  399 +
  400 + if (list.size() > 20)
  401 + break;
  402 + }
  403 + return list;
  404 + }
  405 +
  406 + @Override
  407 + public void adjustCar(ScheduleRealInfo schedule, String car) {
  408 + schedule.setClZbh(car);
  409 + }
  410 +
  411 + @Override
  412 + public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) {
  413 + if (driver.indexOf("-") != -1)
  414 + driver = driver.split("-")[1];
  415 + schedule.setjGh(driver);
  416 + schedule.setjName(driverName);
  417 + }
  418 +
  419 + @Override
  420 + public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) {
  421 + if (conductor.indexOf("-") != -1)
  422 + conductor = conductor.split("-")[1];
  423 + schedule.setsGh(conductor);
  424 + schedule.setsName(conductorName);
  425 + }
  426 +
  427 + @Override
  428 + public List<ScheduleRealInfo> queryUserInfo(String line, String date, String state) {
  429 + if (state.equals("2")) {
  430 + return scheduleRealInfoRepository.queryUserInfo2(line, date);
  431 + } else {
  432 + return scheduleRealInfoRepository.queryUserInfo3(line, date);
  433 + }
  434 +
  435 + }
  436 +
  437 + /**
  438 + *
  439 + */
  440 + @Override
483 441 public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName,String date,String line) {
484 442 ReportUtils ee = new ReportUtils();
485 443 ReportRelatedUtils rru = new ReportRelatedUtils();
... ... @@ -587,12 +545,1544 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
587 545 path+"export\\" + date+"-"+jName+"-"+clZbh+"-"+lpName+"-行车路单.xls");
588 546 return scheduleRealInfos;
589 547 }
590   -
591   - /**
592   - *
593   - */
  548 +
  549 + @Override
  550 + public List<Map<String, Object>> dailyInfo(String line, String date, String type) {
  551 + DecimalFormat format = new DecimalFormat("0.00");
  552 + ReportUtils ee = new ReportUtils();
  553 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  554 + List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date);
  555 +
  556 + double totalZGL = 0, totalKSGL = 0, totalYH = 0;
  557 + int totalBCS = 0;
  558 + for (int i = 0; i < list.size(); i++) {
  559 + String zgl = format.format(Double.parseDouble(list.get(i).get("zgl") == null ? "0" : list.get(i).get("zgl").toString()));
  560 + String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl") == null ? "0" : list.get(i).get("ksgl").toString()));
  561 + if (type.equals("export")) {
  562 + totalZGL += Double.parseDouble(zgl);
  563 + totalKSGL += Double.parseDouble(ksgl);
  564 + totalBCS += Integer.parseInt(list.get(i).get("bcs").toString());
  565 + }
  566 + list.get(i).put("zgl", zgl);
  567 + list.get(i).put("ksgl", ksgl);
  568 + }
  569 + if (type.equals("export")) {
  570 + Map<String, Object> map = new HashMap<String, Object>();
  571 + map.put("line", line);
  572 + map.put("date", date);
  573 + map.put("totalZGL", totalZGL);
  574 + map.put("totalKSGL", totalKSGL);
  575 + map.put("totalYH", totalYH);
  576 + map.put("totalBCS", totalBCS);
  577 +
  578 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  579 +
  580 + listI.add(list.iterator());
  581 + try {
  582 + ee.excelReplace(listI, new Object[]{map}, path + "mould\\daily.xls",
  583 + path + "export\\班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  584 + } catch (ParseException e) {
  585 + e.printStackTrace();
  586 + }
  587 + }
  588 + return list;
  589 + }
  590 +
  591 + @Override
  592 + public List<Object[]> historyMessage(String line, String date, String code, String type) {
  593 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  594 + long d = 0;
  595 + long t = 0;
  596 + if (date.length() > 0) {
  597 + try {
  598 + d = sdf.parse(date + " 00:00:00").getTime();
  599 + t = sdf.parse(date + " 23:59:59").getTime();
  600 + } catch (ParseException e) {
  601 + // TODO Auto-generated catch block
  602 + e.printStackTrace();
  603 + }
  604 +
  605 + }
  606 +
  607 + List<Object[]> list = scheduleRealInfoRepository.historyMessage(line, d, t, code);
  608 + for (Object[] obj : list) {
  609 + if (obj != null) {
  610 + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString())));
  611 + obj[4] = BasicData.lineCode2NameMap.get(line);
  612 + }
  613 + }
  614 +
  615 + if (type != null && type.length() != 0 && type.equals("export")) {
  616 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  617 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  618 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  619 + Map<String, Object> m = new HashMap<String, Object>();
  620 + ReportUtils ee = new ReportUtils();
  621 + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
  622 + for (int i = 0; i < list.size(); i++) {
  623 + Map<String, Object> map = new HashMap<String, Object>();
  624 + Object[] obj = list.get(i);
  625 + map.put("num", i + 1);
  626 + map.put("line", obj[4]);
  627 + map.put("clZbh", obj[0]);
  628 + map.put("sender", obj[1]);
  629 + map.put("date", obj[3]);
  630 + map.put("text", obj[2]);
  631 + newList.add(map);
  632 + }
  633 + try {
  634 + listI.add(newList.iterator());
  635 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  636 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\historyMessage.xls",
  637 + path + "export\\调度历史消息" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  638 + } catch (Exception e) {
  639 + // TODO: handle exception
  640 + e.printStackTrace();
  641 + }
  642 + }
  643 +
  644 + if (type != null && type.length() != 0 && type.equals("export_msg")) {
  645 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  646 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  647 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  648 + Map<String, Object> m = new HashMap<String, Object>();
  649 + ReportUtils ee = new ReportUtils();
  650 + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
  651 + for (int i = 0; i < list.size(); i++) {
  652 + Map<String, Object> map = new HashMap<String, Object>();
  653 + Object[] obj = list.get(i);
  654 + map.put("num", i + 1);
  655 + map.put("line", obj[4]);
  656 + map.put("clZbh", obj[0]);
  657 + map.put("sender", obj[1]);
  658 + map.put("date", obj[3]);
  659 + map.put("text", obj[2]);
  660 + newList.add(map);
  661 + }
  662 + try {
  663 + listI.add(newList.iterator());
  664 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  665 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\message.xls",
  666 + path + "export\\调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  667 + } catch (Exception e) {
  668 + // TODO: handle exception
  669 + e.printStackTrace();
  670 + }
  671 + }
  672 + return list;
  673 + }
  674 +
  675 + @Override
  676 + public Map<Integer, Integer> trustStatus(String lineStr) {
  677 + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr));
  678 +
  679 + Map<Integer, Integer> map = new HashMap<>();
  680 + /*Integer code;
  681 + for (String lineCode : lineList) {
  682 + code = Integer.parseInt(lineCode);
  683 + if (!ScheduleBuffer.trustMap.containsKey(lineCode))
  684 + ScheduleBuffer.trustMap.put(code, 0);
  685 +
  686 + map.put(code, ScheduleBuffer.trustMap.get(code));
  687 + }*/
  688 + return map;
  689 + }
  690 +
  691 + @Override
  692 + public Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks) {
  693 + Map<String, Object> rs = new HashMap<>();
  694 + List<ScheduleRealInfo> ts = new ArrayList<>();
  695 + try {
  696 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  697 +
  698 + LineConfig config = lineConfigData.get(sch.getXlBm());
  699 + //小于线路开始运营时间,则默认跨过24点
  700 + if (fcsjActual.compareTo(config.getStartOpt()) < 0) {
  701 + sch.setRealExecDate(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME));
  702 + } else {
  703 + sch.setRealExecDate(sch.getScheduleDateStr());
  704 + }
  705 +
  706 + sch.setFcsjActualAll(fcsjActual);
  707 + sch.addRemarks(remarks);
  708 + sch.calcStatus();
  709 +
  710 + dayOfSchedule.save(sch);
  711 + //scheduleRealInfoRepository.save(sch);
  712 +
  713 + ts.add(sch);
  714 +
  715 + rs.put("status", ResponseCode.SUCCESS);
  716 + rs.put("ts", ts);
  717 +
  718 + //通知页面刷新
  719 + sendUtils.refreshSch(ts);
  720 + } catch (Exception e) {
  721 + logger.error("", e);
  722 + rs.put("status", ResponseCode.ERROR);
  723 + }
  724 +
  725 + return rs;
  726 + }
  727 +
  728 + @Override
  729 + public Map<String, Object> revokeDestroy(Long id) {
  730 + Map<String, Object> rs = new HashMap<>();
  731 + try {
  732 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  733 + if (sch.getStatus() != -1) {
  734 + rs.put("status", ResponseCode.ERROR);
  735 + rs.put("msg", "未烂班,无法撤销!");
  736 + } else {
  737 + sch.setStatus(0);
  738 + rs.put("status", ResponseCode.SUCCESS);
  739 + rs.put("t", sch);
  740 +
  741 + }
  742 + } catch (Exception e) {
  743 + logger.error("", e);
  744 + rs.put("status", ResponseCode.ERROR);
  745 + }
  746 + return rs;
  747 + }
  748 +
  749 + @Override
  750 + public Map<String, Object> revokeRealOutgo(Long id) {
  751 + Map<String, Object> rs = new HashMap<>();
  752 + List<ScheduleRealInfo> ts = new ArrayList<>();
  753 +
  754 + try {
  755 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  756 + if (sch.getFcsjActual() == null) {
  757 + rs.put("status", ResponseCode.ERROR);
  758 + rs.put("msg", "无实发时间,无法撤销!");
  759 + } else {
  760 + //将对应的到离站数据标记为不可信
  761 + List<ArrivalEntity> list = ArrivalData_GPS.findByNbbm(sch.getClZbh());
  762 + for (ArrivalEntity arr : list) {
  763 + if (arr.getInOut() == 1
  764 + && arr.getUpDown() == Integer.parseInt(sch.getXlDir())
  765 + && arr.getStopNo().equals(sch.getQdzCode())
  766 + && Math.abs(arr.getTs() - sch.getFcsjActualTime()) < 1000 * 60) {
  767 + arr.setEnable(false);
  768 + break;
  769 + }
  770 + }
  771 +
  772 + sch.clearFcsjActual();
  773 + rs.put("status", ResponseCode.SUCCESS);
  774 +
  775 + ts.add(sch);
  776 + rs.put("ts", ts);
  777 +
  778 + }
  779 + } catch (Exception e) {
  780 + logger.error("", e);
  781 + rs.put("status", ResponseCode.ERROR);
  782 + }
  783 + return rs;
  784 + }
  785 +
  786 + @Override
  787 + public Map<String, Object> spaceAdjust(Long[] ids, Integer space) {
  788 +
  789 + List<ScheduleRealInfo> list = new ArrayList<>(), updateList = new ArrayList<>();
  790 + Map<String, Object> rs = new HashMap<>();
  791 + try {
  792 + ScheduleRealInfo sch, next;
  793 + for (Long id : ids) {
  794 + sch = dayOfSchedule.get(id);
  795 + if (null != sch)
  796 + list.add(sch);
  797 + }
  798 +
  799 + int size = list.size();
  800 + if (size == 0) {
  801 + rs.put("status", ResponseCode.ERROR);
  802 + } else {
  803 + // 按发车时间排序
  804 + Collections.sort(list, new ScheduleComparator.FCSJ());
  805 +
  806 + // 以第一个实际发车/待发时间为起点,调整间隔
  807 + sch = list.get(0);
  808 + Long st = sch.getFcsjActualTime() == null ? sch.getDfsjT() : sch.getFcsjActualTime(), plus = space * 60 * 1000L;
  809 +
  810 + for (int i = 1; i < size; i++) {
  811 + st += plus;
  812 + sch = list.get(i);
  813 + sch.setDfsjAll(st);
  814 + //重新计算终点时间
  815 + sch.calcEndTime();
  816 +
  817 + dayOfSchedule.save(sch);
  818 +
  819 + updateList.add(sch);
  820 + next = dayOfSchedule.next(sch);
  821 + if (next.getQdzName().equals(sch.getZdzName())) {
  822 + next.setQdzArrDateJH(sch.getZdsj());
  823 + updateList.add(next);
  824 + }
  825 + }
  826 +
  827 +
  828 + rs.put("status", ResponseCode.SUCCESS);
  829 + rs.put("ts", updateList);
  830 + }
  831 +
  832 + } catch (Exception e) {
  833 + logger.error("", e);
  834 + rs.put("status", ResponseCode.ERROR);
  835 + }
  836 + return rs;
  837 + }
  838 +
  839 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  840 +
  841 + @Override
  842 + public Map<String, Object> schInfoFineTune(Map<String, String> map) {
  843 + Map<String, Object> rs = new HashMap<>();
  844 + List<ScheduleRealInfo> ts = new ArrayList<>();
  845 + try {
  846 + Long id = Long.parseLong(map.get("id"));
  847 + //班次类型
  848 + //String bcType = map.get("bcType");
  849 + //车辆自编号
  850 + //String clZbh = map.get("clZbh");
  851 + //计划发车时间
  852 + //String fcsj = map.get("fcsj");
  853 + //实际发车时间
  854 + String fcsjActual = map.get("fcsjActual");
  855 + //实际终点时间
  856 + String zdsjActual = map.get("zdsjActual");
  857 + //备注
  858 + String remarks = map.get("remarks");
  859 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  860 + if (null != sch) {
  861 + if (StringUtils.isNotBlank(fcsjActual)) {
  862 + LineConfig config = lineConfigData.get(sch.getXlBm());
  863 + long t = 0L;
  864 + //小于线路开始运营时间,则默认跨过24点
  865 + if (fcsjActual.compareTo(config.getStartOpt()) < 0)
  866 + t = fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME) + fcsjActual);
  867 + else
  868 + t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual);
  869 +
  870 + //调整实发
  871 + if (!fcsjActual.equals(sch.getFcsjActual()))
  872 + sch.setFcsjActualAll(t);
  873 + } else {
  874 + //撤销实发
  875 + if (sch.getFcsjActual() != null)
  876 + revokeRealOutgo(sch.getId());
  877 + }
  878 + //实达时间
  879 + if (StringUtils.isNotBlank(zdsjActual)) {
  880 + if (!zdsjActual.equals(sch.getZdsjActual())) {
  881 + //调整实达
  882 + sch.setZdsjActualAll(zdsjActual);
  883 + //下一班次起点到达时间
  884 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  885 + if (null != next) {
  886 + next.setQdzArrDateSJ(zdsjActual);
  887 + ts.add(next);
  888 + }
  889 +
  890 + //重新计算车辆执行班次
  891 + dayOfSchedule.reCalcExecPlan(sch.getClZbh());
  892 + }
  893 + } else {
  894 + //清除实达时间
  895 + sch.clearZdsjActual();
  896 + //清除下一班次起点到达时间
  897 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  898 + if (null != next) {
  899 + next.setQdzArrDateSJ(null);
  900 + ts.add(next);
  901 + }
  902 + }
  903 + sch.setRemarks(remarks);
  904 +
  905 + try {
  906 + //烂班
  907 + if(map.get("status") != null
  908 + && Integer.parseInt(map.get("status").toString()) == -1){
  909 + destroy(sch.getId() + "", "", map.get("adjustExps").toString());
  910 + }
  911 + } catch (NumberFormatException e) {
  912 + logger.error("", e);
  913 + }
  914 + }
  915 +
  916 + String bcType = map.get("bcType");
  917 + if(StringUtils.isNotEmpty(bcType)){
  918 + sch.setBcType(bcType);
  919 + }
  920 + //班次状态
  921 + sch.calcStatus();
  922 + dayOfSchedule.save(sch);
  923 + //页面需要更新的班次信息
  924 + ts.add(sch);
  925 +
  926 + rs.put("status", ResponseCode.SUCCESS);
  927 + rs.put("ts", ts);
  928 + } catch (Exception e) {
  929 + logger.error("", e);
  930 + rs.put("status", ResponseCode.ERROR);
  931 + }
  932 + return rs;
  933 + }
  934 +
  935 + @Override
  936 + public Map<String, Object> outgoAdjustAll(String params) {
  937 + Map<String, Object> rs = new HashMap<>();
  938 + try {
  939 + JSONArray jsonArray = JSONArray.parseArray(params);
  940 +
  941 + ScheduleRealInfo schedule = null;
  942 + JSONObject jsonObj;
  943 + String dfsj;
  944 + for (int i = 0; i < jsonArray.size(); i++) {
  945 + jsonObj = jsonArray.getJSONObject(i);
  946 + dfsj = jsonObj.getString("t");
  947 + schedule = dayOfSchedule.get(jsonObj.getLong("id"));
  948 + //设置待发时间
  949 + schedule.setDfsjAll(dfsj);
  950 +
  951 + dayOfSchedule.save(schedule);
  952 + }
  953 +
  954 + rs.put("status", ResponseCode.SUCCESS);
  955 + //将更新的最后一个班次返回
  956 + rs.put("t", schedule);
  957 + } catch (Exception e) {
  958 + logger.error("", e);
  959 + rs.put("status", ResponseCode.ERROR);
  960 + }
  961 + return rs;
  962 + }
  963 +
  964 + @Override
  965 + public Map<String, Object> findRouteByLine(String lineCode) {
  966 + Map<String, Object> map = new HashMap<>();
  967 + //上行
  968 + Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode);
  969 + map.put("line.id_eq", lineId);
  970 + map.put("directions_eq", 0);
  971 + List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map);
  972 +
  973 + //下行
  974 + map.put("directions_eq", 1);
  975 + List<Map<String, Object>> downList = sectionRouteService.getSectionRoute(map);
  976 +
  977 + Map<String, Object> rs = new HashMap<>();
  978 +
  979 + String upVectors = "", vec;
  980 + //拼接上行路段
  981 + for (Map<String, Object> temp : upList) {
  982 + vec = temp.get("sectionBsectionVector").toString();
  983 + upVectors += vec.subSequence(11, vec.length() - 2) + " ";
  984 + }
  985 +
  986 + //拼接下行路段
  987 + String downVectors = "";
  988 + for (Map<String, Object> temp : downList) {//LINESTRING(
  989 + vec = temp.get("sectionBsectionVector").toString();
  990 + downVectors += vec.subSequence(11, vec.length() - 2) + " ";
  991 + }
  992 +
  993 +
  994 + rs.put("up", upVectors);
  995 + //上行gcj
  996 + rs.put("up_gcj", BdToGcjString(upVectors));
  997 + rs.put("down", downVectors);
  998 + //下行gcj
  999 + rs.put("down_gcj", BdToGcjString(downVectors));
  1000 + rs.put("lineId", lineId);
  1001 +
  1002 + return rs;
  1003 + }
  1004 +
  1005 + /**
  1006 + * @param @param bdStr
  1007 + * @throws
  1008 + * @Title: BdToGcjString
  1009 + * @Description: TODO(将百度路由字符串 转 成GCJ 字符串)
  1010 + */
  1011 + public String BdToGcjString(String bdStr) {
  1012 + String[] array = bdStr.split(","), subArray;
  1013 + if (array.length == 0 || bdStr.length() < 2)
  1014 + return "";
  1015 +
  1016 + String gcjStr = "";
  1017 + TransGPS.Location location;
  1018 + for (String crd : array) {
  1019 + subArray = crd.split(" ");
  1020 + if (subArray.length != 2)
  1021 + continue;
  1022 + location = TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(subArray[0]), Double.parseDouble(subArray[1])));
  1023 +
  1024 + gcjStr += location.getLng() + " " + location.getLat() + ",";
  1025 + }
  1026 +
  1027 + return gcjStr.substring(0, gcjStr.length() - 1);
  1028 + }
  1029 +
  1030 + public List<Map<String, String>> findLine(String line) {
  1031 + List<Line> listLine = lineRepository.findLine("%" + line + "%");
  1032 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  1033 + Map<String, String> map;
  1034 + for (Line temp : listLine) {
  1035 + if (temp != null) {
  1036 + String xlName = temp.getName();
  1037 + if (xlName.indexOf(line) != -1) {
  1038 + map = new HashMap<String, String>();
  1039 + map.put("id", temp.getLineCode());
  1040 + map.put("text", xlName);
  1041 + list.add(map);
  1042 + }
  1043 + }
  1044 + }
  1045 + return list;
  1046 + }
  1047 +
  1048 + public List<Map<String, String>> findLpName(String lpName) {
  1049 + List<GuideboardInfo> listLpName = guideboardInfoRepository.findLpName("%" + lpName + "%");
  1050 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  1051 + Map<String, String> map;
  1052 + for (GuideboardInfo temp : listLpName) {
  1053 + if (temp != null) {
  1054 + String lp = temp.getLpName();
  1055 + if (lp.indexOf(lpName) != -1) {
  1056 + map = new HashMap<String, String>();
  1057 + map.put("id", lp);
  1058 + map.put("text", lp);
  1059 + list.add(map);
  1060 + }
  1061 + }
  1062 + }
  1063 + return list;
  1064 + }
  1065 +
  1066 + @Override
  1067 + public Map<String, Object> findKMBC2(String jName, String clZbh, String date) {
  1068 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  1069 +
  1070 + DecimalFormat format = new DecimalFormat("0.00");
  1071 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  1072 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  1073 + int jhbc = 0, cjbc = 0, ljbc = 0;
  1074 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0;
  1075 + float addMileage = 0l, remMileage = 0l;
  1076 + String j_Name = "";
  1077 + Map<String, Object> map = new HashMap<String, Object>();
  1078 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1079 + if (scheduleRealInfo != null) {
  1080 + j_Name = scheduleRealInfo.getjName();
  1081 + //计划里程(主任务过滤掉临加班次),
  1082 + //烂班里程(主任务烂班),
  1083 + //临加里程(主任务临加),
  1084 + //计划班次,烂班班次,增加班次
  1085 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1086 + if (scheduleRealInfo.isSflj()) {
  1087 + addMileage += tempJhlc;
  1088 + ljbc++;
  1089 + } else {
  1090 + jhlc += tempJhlc;
  1091 + jhbc++;
  1092 + if (scheduleRealInfo.getStatus() == -1) {
  1093 + remMileage += tempJhlc;
  1094 + cjbc++;
  1095 + }
  1096 + }
  1097 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1098 + //计算营运里程,空驶里程
  1099 + if (childTaskPlans.isEmpty()) {
  1100 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  1101 + || scheduleRealInfo.getBcType().equals("venting")) {
  1102 + ksgl += tempJhlc;
  1103 + } else {
  1104 + yygl += tempJhlc;
  1105 + }
  1106 + } else {
  1107 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1108 + while (it.hasNext()) {
  1109 + ChildTaskPlan childTaskPlan = it.next();
  1110 + if (childTaskPlan.getMileageType().equals("empty")) {
  1111 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1112 + } else {
  1113 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1114 + }
  1115 + }
  1116 + }
  1117 + }
  1118 + }
  1119 + map.put("j_name", j_Name);
  1120 + map.put("jhlc", format.format(jhlc));
  1121 + map.put("remMileage", format.format(remMileage));
  1122 + map.put("addMileage", format.format(addMileage));
  1123 + map.put("yygl", format.format(yygl));
  1124 + map.put("ksgl", format.format(ksgl));
  1125 + map.put("realMileage", format.format(yygl + ksgl));
  1126 + map.put("jhbc", jhbc);
  1127 + map.put("cjbc", cjbc);
  1128 + map.put("ljbc", ljbc);
  1129 + map.put("sjbc", jhbc - cjbc + ljbc);
  1130 + return map;
  1131 + }
  1132 +
  1133 +
  1134 +
  1135 + @Override
  1136 + public Map<String, Object> findKMBC(String jName, String clZbh,
  1137 + String lpName, String date,String line) {
  1138 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line);
  1139 + DecimalFormat format = new DecimalFormat("0.00");
  1140 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  1141 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  1142 + int jhbc = 0, cjbc = 0, ljbc = 0;
  1143 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  1144 + float addMileage = 0l, remMileage = 0l;
  1145 + Map<String, Object> map = new HashMap<String, Object>();
  1146 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1147 + if (scheduleRealInfo != null) {
  1148 + //计划里程(主任务过滤掉临加班次),
  1149 + //烂班里程(主任务烂班),
  1150 + //临加里程(主任务临加),
  1151 + //计划班次,烂班班次,增加班次
  1152 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1153 + if (scheduleRealInfo.isSflj()) {
  1154 + addMileage += tempJhlc;
  1155 + ljbc++;
  1156 + } else {
  1157 + if (!(scheduleRealInfo.getBcType().equals("in")
  1158 + || scheduleRealInfo.getBcType().equals("out"))) {
  1159 + jhbc++;
  1160 + jhlc += tempJhlc;
  1161 + }
  1162 +
  1163 + if (scheduleRealInfo.getStatus() == -1) {
  1164 + remMileage += tempJhlc;
  1165 + cjbc++;
  1166 + }
  1167 + }
  1168 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1169 + //计算营运里程,空驶里程
  1170 + if (childTaskPlans.isEmpty()) {
  1171 + if (scheduleRealInfo.getBcType().equals("in") ||
  1172 + scheduleRealInfo.getBcType().equals("out")) {
  1173 + jcclc += tempJhlc;
  1174 + }
  1175 + //主任务 放空班次属于营运
  1176 +// else if(scheduleRealInfo.getBcType().equals("venting")){
  1177 +// ksgl += tempJhlc;
  1178 +// }
  1179 + else {
  1180 + if (scheduleRealInfo.getStatus() != -1) {
  1181 + yygl += tempJhlc;
  1182 + }
  1183 + }
  1184 + } else {
  1185 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1186 + while (it.hasNext()) {
  1187 + ChildTaskPlan childTaskPlan = it.next();
  1188 + if (childTaskPlan.getMileageType().equals("empty")) {
  1189 + if (childTaskPlan.isDestroy()) {
  1190 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1191 + } else {
  1192 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1193 + }
  1194 + } else {
  1195 + if (childTaskPlan.isDestroy()) {
  1196 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1197 +// cjbc++;
  1198 + } else {
  1199 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1200 + }
  1201 + }
  1202 + }
  1203 + }
  1204 + }
  1205 + }
  1206 + map.put("jhlc", format.format(jhlc));
  1207 + map.put("remMileage", format.format(remMileage));
  1208 + map.put("addMileage", format.format(addMileage));
  1209 + map.put("yygl", format.format(yygl));
  1210 + map.put("ksgl", format.format(ksgl));
  1211 + map.put("realMileage", format.format(yygl + ksgl + jcclc));
  1212 + map.put("jhbc", jhbc);
  1213 + map.put("cjbc", cjbc);
  1214 + map.put("ljbc", ljbc);
  1215 + map.put("sjbc", jhbc - cjbc + ljbc);
  1216 + map.put("jcclc", jcclc);
  1217 + map.put("zkslc", format.format(ksgl + jcclc));
  1218 + return map;
  1219 + }
  1220 +
  1221 +
  1222 + @Override
  1223 + public List<Map<String, Object>> account(String line, String date,
  1224 + String code, String xlName, String type) {
  1225 + List<Object[]> lsitObj = scheduleRealInfoRepository.account(line, date, code);
  1226 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  1227 + Map<String, Object> map;
  1228 + int i = 1;
  1229 + for (Object[] obj : lsitObj) {
  1230 + if (obj != null) {
  1231 + map = new HashMap<String, Object>();
  1232 + map.put("num", i++);
  1233 + map.put("xlName", xlName);
  1234 + map.put("clZbh", obj[3]);
  1235 + map.put("company", obj[0]);
  1236 + map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[1] + "")).toUpperCase());
  1237 + map.put("requestTime", obj[2]);
  1238 + listMap.add(map);
  1239 + }
  1240 + }
  1241 +
  1242 + if (type != null && type.length() != 0 && type.equals("export")) {
  1243 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1244 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1245 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1246 + Map<String, Object> m = new HashMap<String, Object>();
  1247 + ReportUtils ee = new ReportUtils();
  1248 + Map<String, Object> typeMap = new HashMap<String, Object>();
  1249 + typeMap.put("0xA1", "请求恢复运营");
  1250 + typeMap.put("0xA2", "申请调档");
  1251 + typeMap.put("0xA3", "出场请求");
  1252 + typeMap.put("0xA5", "进场请求");
  1253 + typeMap.put("0xA7", "加油请求");
  1254 + typeMap.put("0x50", "车辆故障");
  1255 + typeMap.put("0x70", "路阻报告");
  1256 + typeMap.put("0x60", "事故报告");
  1257 + typeMap.put("0x11", "扣证纠纷");
  1258 + typeMap.put("0x12", "报警");
  1259 + for (Map<String, Object> map1 : listMap) {
  1260 + map1.put("requestText", typeMap.get(map1.get("requestType")));
  1261 + }
  1262 + try {
  1263 + listI.add(listMap.iterator());
  1264 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  1265 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\account.xls",
  1266 + path + "export\\驾驶员请求台账" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1267 + } catch (Exception e) {
  1268 + // TODO: handle exception
  1269 + e.printStackTrace();
  1270 + }
  1271 + }
  1272 +
  1273 + return listMap;
  1274 + }
  1275 +
  1276 + @Override
  1277 + public List<ScheduleRealInfo> correctForm(String line, String startDate,
  1278 + String endDate, String lpName, String code, String type) {
  1279 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line, startDate, endDate, lpName, code);
  1280 +
  1281 + if (type != null && type.length() != 0 && type.equals("export")) {
  1282 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1283 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1284 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1285 + Map<String, Object> m = new HashMap<String, Object>();
  1286 + ReportUtils ee = new ReportUtils();
  1287 + m.put("dates", startDate + " 至 " + endDate);
  1288 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1289 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1290 + for (ScheduleRealInfo schedule : list) {
  1291 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1292 + tempMap.put("xlName", schedule.getXlName() != null ? schedule.getXlName() : "");
  1293 + tempMap.put("lpName", schedule.getLpName() != null ? schedule.getLpName() : "");
  1294 + tempMap.put("clZbh", schedule.getClZbh() != null ? schedule.getClZbh() : "");
  1295 + tempMap.put("jName", schedule.getjName() != null ? schedule.getjName() : "");
  1296 + tempMap.put("sName", schedule.getsName() != null ? schedule.getsName() : "");
  1297 + tempMap.put("fcsj", schedule.getFcsj() != null ? schedule.getFcsj() : "");
  1298 + tempMap.put("fcsjActual", schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "");
  1299 + tempMap.put("zdsj", schedule.getZdsj() != null ? schedule.getZdsj() : "");
  1300 + tempMap.put("zdsjActual", schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "");
  1301 + if (schedule.getUpdateBy() != null) {
  1302 + if (schedule.getUpdateBy().getName() != null)
  1303 + tempMap.put("userName", schedule.getUpdateBy().getName());
  1304 + else
  1305 + tempMap.put("userName", "");
  1306 + } else {
  1307 + tempMap.put("userName", "");
  1308 + }
  1309 + if (schedule.getUpdateDate() != null) {
  1310 + tempMap.put("updateDate", sdf.format(schedule.getUpdateDate()));
  1311 + } else {
  1312 + tempMap.put("updateDate", "");
  1313 + }
  1314 + tempMap.put("remarks", schedule.getRemarks() != null ? schedule.getRemarks() : "");
  1315 + tempList.add(tempMap);
  1316 + }
  1317 + try {
  1318 + listI.add(tempList.iterator());
  1319 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  1320 + ee.excelReplace(listI, new Object[]{m}, path + "mould\\correctForm.xls",
  1321 + path + "export\\修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  1322 + } catch (Exception e) {
  1323 + // TODO: handle exception
  1324 + e.printStackTrace();
  1325 + }
  1326 + Map<String, Object> map = tempList.get(tempList.size() - 1);
  1327 + System.out.println("tempMap:" + map);
  1328 + }
  1329 +
  1330 + return list;
  1331 + }
  1332 +
  1333 + @Override
  1334 + public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
  1335 + String lpName, String date,String line) {
  1336 + List<ScheduleRealInfo> list = null;
  1337 + list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line);
  1338 + for (int i = 0; i < list.size(); i++) {
  1339 + ScheduleRealInfo s = list.get(i);
  1340 + String remarks = "";
  1341 + if (s.getRemarks() != null) {
  1342 + remarks += s.getRemarks();
  1343 + }
  1344 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  1345 + if (!childTaskPlans.isEmpty()) {
  1346 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1347 + while (it.hasNext()) {
  1348 + ChildTaskPlan c = it.next();
  1349 + if (c.getRemarks() != null && c.getRemarks().length() > 0) {
  1350 + remarks += c.getRemarks();
  1351 + }
  1352 +
  1353 + }
  1354 + }
  1355 + s.setRemarks(remarks);
  1356 + }
  1357 +
  1358 + return list;
  1359 + }
  1360 +
  1361 + @Override
  1362 + public Map<String, Object> removeChildTask(Long taskId) {
  1363 + Map<String, Object> rs = new HashMap<>();
  1364 + ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);
  1365 +
  1366 + ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());
  1367 + try {
  1368 +
  1369 + sch.getcTasks().remove(chTask);
  1370 + scheduleRealInfoRepository.save(sch);
  1371 + rs.put("status", ResponseCode.SUCCESS);
  1372 + } catch (Exception e) {
  1373 + logger.error("", e);
  1374 + rs.put("status", ResponseCode.ERROR);
  1375 + }
  1376 + return rs;
  1377 + }
  1378 +
  1379 + @Override
  1380 + public List<Map<String, Object>> statisticsDaily(String line, String date,
  1381 + String xlName) {
  1382 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1383 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  1384 + DecimalFormat format = new DecimalFormat("0.00");
  1385 + double jhlc = 0, tempJhlc = 0, childMileage = 0;
  1386 + float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
  1387 + //班次
  1388 + int sj_0 = 6 * 60 + 31, sj_1 = 8 * 60 + 30, sj_2 = 16 * 60 + 1, sj_3 = 18 * 60;
  1389 + int jhbc = 0, jhbc_m = 0, jhbc_a = 0;
  1390 + int sjbc = 0, sjbc_m = 0, sjbc_a = 0;
  1391 + int ljbc = 0, ljbc_m = 0, ljbc_a = 0;
  1392 + int fzbc = 0, fzbc_m = 0, fzbc_a = 0;
  1393 + int dtbc = 0, dtbc_m = 0, dtbc_a = 0;
  1394 + int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0;
  1395 + Map<String, Object> map = new HashMap<String, Object>();
  1396 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1397 + if (scheduleRealInfo != null) {
  1398 +
  1399 + if (!(scheduleRealInfo.getBcType().equals("in")
  1400 + || scheduleRealInfo.getBcType().equals("out"))) {
  1401 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1402 + //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  1403 + if (childTaskPlans.isEmpty()) {
  1404 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1405 + //临加公里
  1406 + if (scheduleRealInfo.isSflj()) {
  1407 + ljgl += tempJhlc;
  1408 + } else {
  1409 + jhlc += tempJhlc;
  1410 + }
  1411 + if (scheduleRealInfo.getStatus() == 2) {
  1412 + sjgl += tempJhlc;
  1413 + } else if (scheduleRealInfo.getStatus() == -1) {
  1414 + ssgl += tempJhlc;
  1415 + if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("路阻") != -1) {
  1416 + ssgl_lz += tempJhlc;
  1417 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("吊慢") != -1) {
  1418 + ssgl_dm += tempJhlc;
  1419 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("故障") != -1) {
  1420 + ssgl_gz += tempJhlc;
  1421 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("纠纷") != -1) {
  1422 + ssgl_jf += tempJhlc;
  1423 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("肇事") != -1) {
  1424 + ssgl_zs += tempJhlc;
  1425 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺人") != -1) {
  1426 + ssgl_qr += tempJhlc;
  1427 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺车") != -1) {
  1428 + ssgl_qc += tempJhlc;
  1429 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("客稀") != -1) {
  1430 + ssgl_kx += tempJhlc;
  1431 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("气候") != -1) {
  1432 + ssgl_qh += tempJhlc;
  1433 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("援外") != -1) {
  1434 + ssgl_yw += tempJhlc;
  1435 + } else {
  1436 + ssgl_other += tempJhlc;
  1437 + }
  1438 + }
  1439 + } else {
  1440 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1441 + while (it.hasNext()) {
  1442 + ChildTaskPlan childTaskPlan = it.next();
  1443 + childMileage = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1444 + jhlc += childMileage;
  1445 + if (childTaskPlan.isDestroy()) {
  1446 + ssgl += childMileage;
  1447 + if (childTaskPlan.getDestroyReason().equals("路阻")) {
  1448 + ssgl_lz += childTaskPlan.getMileage();
  1449 + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) {
  1450 + ssgl_dm += childTaskPlan.getMileage();
  1451 + } else if (childTaskPlan.getDestroyReason().equals("故障")) {
  1452 + ssgl_gz += childTaskPlan.getMileage();
  1453 + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) {
  1454 + ssgl_jf += childTaskPlan.getMileage();
  1455 + } else if (childTaskPlan.getDestroyReason().equals("肇事")) {
  1456 + ssgl_zs += childTaskPlan.getMileage();
  1457 + } else if (childTaskPlan.getDestroyReason().equals("缺人")) {
  1458 + ssgl_qr += childTaskPlan.getMileage();
  1459 + } else if (childTaskPlan.getDestroyReason().equals("缺车")) {
  1460 + ssgl_qc += childTaskPlan.getMileage();
  1461 + } else if (childTaskPlan.getDestroyReason().equals("客稀")) {
  1462 + ssgl_kx += childTaskPlan.getMileage();
  1463 + } else if (childTaskPlan.getDestroyReason().equals("气候")) {
  1464 + ssgl_qh += childTaskPlan.getMileage();
  1465 + } else if (childTaskPlan.getDestroyReason().equals("援外")) {
  1466 + ssgl_yw += childTaskPlan.getMileage();
  1467 + } else {
  1468 + ssgl_other += childTaskPlan.getMileage();
  1469 + }
  1470 + } else {
  1471 + sjgl += childMileage;
  1472 + }
  1473 + }
  1474 + }
  1475 +
  1476 + //班次
  1477 + jhbc++;
  1478 + String[] fcsj = scheduleRealInfo.getFcsj().split(":");
  1479 + String[] fcsjActual = (scheduleRealInfo.getFcsjActual() == null ? "0:00" : scheduleRealInfo.getFcsjActual()).split(":");
  1480 + if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_0 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_1) {
  1481 + jhbc_m++;
  1482 + } else if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_2 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_3) {
  1483 + jhbc_a++;
  1484 + }
  1485 + if (scheduleRealInfo.getStatus() == 2) {
  1486 + sjbc++;
  1487 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1488 + sjbc_m++;
  1489 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1490 + sjbc_a++;
  1491 + }
  1492 + }
  1493 + if (scheduleRealInfo.isSflj()) {
  1494 + ljbc++;
  1495 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1496 + ljbc_m++;
  1497 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1498 + ljbc_a++;
  1499 + }
  1500 + }
  1501 + if (scheduleRealInfo.getBcType().equals("venting")) {
  1502 + fzbc++;
  1503 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1504 + fzbc_m++;
  1505 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1506 + fzbc_a++;
  1507 + }
  1508 + }
  1509 + }
  1510 + }
  1511 + }
  1512 + map.put("xlName", xlName);
  1513 + map.put("jhlc", format.format(jhlc));
  1514 + map.put("sjgl", format.format(sjgl));
  1515 + map.put("ssgl", format.format(ssgl));
  1516 + map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
  1517 + map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
  1518 + map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
  1519 + map.put("ssgl_jf", ssgl_jf == 0 ? 0 : format.format(ssgl_jf));
  1520 + map.put("ssgl_zs", ssgl_zs == 0 ? 0 : format.format(ssgl_zs));
  1521 + map.put("ssgl_qr", ssgl_qr == 0 ? 0 : format.format(ssgl_qr));
  1522 + map.put("ssgl_qc", ssgl_qc == 0 ? 0 : format.format(ssgl_qc));
  1523 + map.put("ssgl_kx", ssgl_kx == 0 ? 0 : format.format(ssgl_kx));
  1524 + map.put("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh));
  1525 + map.put("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw));
  1526 + map.put("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other));
  1527 + map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl));
  1528 + map.put("jhbc", jhbc);
  1529 + map.put("jhbc_m", jhbc_m);
  1530 + map.put("jhbc_a", jhbc_a);
  1531 + map.put("sjbc", sjbc);
  1532 + map.put("sjbc_m", sjbc_m);
  1533 + map.put("sjbc_a", sjbc_a);
  1534 + map.put("ljbc", ljbc);
  1535 + map.put("ljbc_m", ljbc_m);
  1536 + map.put("ljbc_a", ljbc_a);
  1537 + map.put("fzbc", fzbc);
  1538 + map.put("fzbc_m", fzbc_m);
  1539 + map.put("fzbc_a", fzbc_a);
  1540 + map.put("dtbc", dtbc);
  1541 + map.put("dtbc_m", dtbc_m);
  1542 + map.put("dtbc_a", dtbc_a);
  1543 + map.put("djg", djg);
  1544 + map.put("djg_m", djg_m);
  1545 + map.put("djg_a", djg_a);
  1546 + map.put("djg_time", djg_time);
  1547 + lMap.add(map);
  1548 + return lMap;
  1549 + }
  1550 +
  1551 + @Override
  1552 + public Map<String, Object> scheduleDaily(String line, String date) {
  1553 + Map<String, String> tempMap = null;
  1554 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1555 + Map<String, Object> map = new HashMap<String, Object>();
  1556 + Double jhlc = 0.00;
  1557 + Float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
  1558 + int jhbc = 0;
  1559 + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) {
  1560 + if (scheduleRealInfo != null) {
  1561 + //计算里程(包括子任务)
  1562 + jhlc += scheduleRealInfo.getJhlc();
  1563 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1564 + if (!childTaskPlans.isEmpty()) {
  1565 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1566 + while (it.hasNext()) {
  1567 + ChildTaskPlan childTaskPlan = it.next();
  1568 + //是否烂班,烂班就是少驶
  1569 + if (!childTaskPlan.isDestroy()) {
  1570 + sjgl += childTaskPlan.getMileage();
  1571 + } else {
  1572 + ssgl += childTaskPlan.getMileage();
  1573 + if (childTaskPlan.getDestroyReason().equals("路阻")) {
  1574 + ssgl_lz += childTaskPlan.getMileage();
  1575 + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) {
  1576 + ssgl_dm += childTaskPlan.getMileage();
  1577 + } else if (childTaskPlan.getDestroyReason().equals("故障")) {
  1578 + ssgl_gz += childTaskPlan.getMileage();
  1579 + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) {
  1580 + ssgl_jf += childTaskPlan.getMileage();
  1581 + } else if (childTaskPlan.getDestroyReason().equals("肇事")) {
  1582 + ssgl_zs += childTaskPlan.getMileage();
  1583 + } else if (childTaskPlan.getDestroyReason().equals("缺人")) {
  1584 + ssgl_qr += childTaskPlan.getMileage();
  1585 + } else if (childTaskPlan.getDestroyReason().equals("缺车")) {
  1586 + ssgl_qc += childTaskPlan.getMileage();
  1587 + } else if (childTaskPlan.getDestroyReason().equals("客稀")) {
  1588 + ssgl_kx += childTaskPlan.getMileage();
  1589 + } else if (childTaskPlan.getDestroyReason().equals("气候")) {
  1590 + ssgl_qh += childTaskPlan.getMileage();
  1591 + } else if (childTaskPlan.getDestroyReason().equals("援外")) {
  1592 + ssgl_yw += childTaskPlan.getMileage();
  1593 + } else {
  1594 + ssgl_other += childTaskPlan.getMileage();
  1595 + }
  1596 + }
  1597 + //临加公里
  1598 + if (childTaskPlan.getType1().equals("临加")) {
  1599 + ljgl += childTaskPlan.getMileage();
  1600 + }
  1601 + }
  1602 + }
  1603 + //班次
  1604 + scheduleRealInfo.getFcsjT();
  1605 + scheduleRealInfo.getFcsjActualTime();
  1606 + }
  1607 + }
  1608 + map.put("jhlc", jhlc);
  1609 + map.put("sjgl", sjgl);
  1610 + map.put("ssgl", ssgl);
  1611 + map.put("ssgl_lz", ssgl_lz);
  1612 + map.put("ssgl_dm", ssgl_dm);
  1613 + map.put("ssgl_gz", ssgl_gz);
  1614 + map.put("ssgl_jf", ssgl_jf);
  1615 + map.put("ssgl_zs", ssgl_zs);
  1616 + map.put("ssgl_qr", ssgl_qr);
  1617 + map.put("ssgl_qc", ssgl_qc);
  1618 + map.put("ssgl_kx", ssgl_kx);
  1619 + map.put("ssgl_qh", ssgl_qh);
  1620 + map.put("ssgl_yw", ssgl_yw);
  1621 + map.put("ssgl_other", ssgl_other);
  1622 + map.put("ljgl", ljgl);
  1623 +
  1624 + map.put("jhbc", scheduleRealInfos.size());
  1625 + return null;
  1626 + }
  1627 +
  1628 + @Override
  1629 + public int countByLineCodeAndDate(String xlBm, String schDate) {
  1630 + return scheduleRealInfoRepository.countByLineCodeAndDate(xlBm + "", schDate);
  1631 + }
  1632 +
  1633 + @Override
  1634 + public List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate) {
  1635 + return scheduleRealInfoRepository.findByLineCodeAndDate(xlBm + "", schDate);
  1636 + }
  1637 +
  1638 + @Override
  1639 + public void deleteByLineCodeAndDate(String xlBm, String schDate) {
  1640 + scheduleRealInfoRepository.deleteByLineCodeAndDate(xlBm + "", schDate);
  1641 + }
  1642 +
  1643 + @Override
  1644 + public Long getMaxId() {
  1645 + return scheduleRealInfoRepository.getMaxId();
  1646 + }
  1647 +
  1648 + @Override
  1649 + public List<ScheduleRealInfo> realScheduleList(String line, String date) {
  1650 + /*List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.queryUserInfo(line, date);
  1651 + List<ScheduleRealInfo> listTotal = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1652 + for(ScheduleRealInfo info:listInfo){
  1653 + for(ScheduleRealInfo total:listTotal){
  1654 + if(info.getjGh().equals(total.getjGh()) && info.getLpName().equals(total.getLpName()) && info.getClZbh().equals(total.getClZbh())){
  1655 +
  1656 + }
  1657 + }
  1658 + }*/
  1659 + return scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1660 + }
  1661 +
  1662 +
  1663 + public List<Map<String, Object>> yesterdayDataList(String line, String date) {
  1664 + //前一天日期
  1665 +// String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
  1666 +// String date = "2016-09-20";
  1667 + List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
  1668 +// List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1669 + for (int x = 0; x < yesterdayDataList.size(); x++) {
  1670 + String jName = yesterdayDataList.get(x).get("jGh").toString();
  1671 + String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
  1672 + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  1673 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  1674 + float addMileage = 0l, remMileage = 0l;
  1675 + Map<String, Object> map = new HashMap<String, Object>();
  1676 + boolean fage = true;
  1677 + for (ScheduleRealInfo scheduleRealInfo : lists) {
  1678 + if (fage) {
  1679 + //根据线路代码获取公司
  1680 + Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
  1681 + yesterdayDataList.get(x).put("company", li.getCompany());
  1682 + yesterdayDataList.get(x).put("bCompany", li.getBrancheCompany());
  1683 + fage = false;
  1684 + }
  1685 + if (scheduleRealInfo != null) {
  1686 + //计划里程(主任务过滤掉临加班次),
  1687 + //烂班里程(主任务烂班),
  1688 + //临加里程(主任务临加),
  1689 + //计划班次,烂班班次,增加班次
  1690 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1691 + if (scheduleRealInfo.isSflj()) {
  1692 + addMileage += tempJhlc;
  1693 + } else {
  1694 + if (!(scheduleRealInfo.getBcType().equals("in")
  1695 + || scheduleRealInfo.getBcType().equals("out"))) {
  1696 + jhlc += tempJhlc;
  1697 + }
  1698 +
  1699 + if (scheduleRealInfo.getStatus() == -1) {
  1700 + remMileage += tempJhlc;
  1701 + }
  1702 + }
  1703 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1704 + //计算营运里程,空驶里程
  1705 + if (childTaskPlans.isEmpty()) {
  1706 + if (scheduleRealInfo.getBcType().equals("in") ||
  1707 + scheduleRealInfo.getBcType().equals("out")) {
  1708 + jcclc += tempJhlc;
  1709 + }
  1710 + //主任务 放空班次属于营运
  1711 +// else if(scheduleRealInfo.getBcType().equals("venting")){
  1712 +// ksgl += tempJhlc;
  1713 +// }
  1714 + else {
  1715 + if (scheduleRealInfo.getStatus() != -1) {
  1716 + yygl += tempJhlc;
  1717 + }
  1718 + }
  1719 + } else {
  1720 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1721 + while (it.hasNext()) {
  1722 + ChildTaskPlan childTaskPlan = it.next();
  1723 + if (childTaskPlan.getMileageType().equals("empty")) {
  1724 + if (childTaskPlan.isDestroy()) {
  1725 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1726 + } else {
  1727 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1728 + }
  1729 + } else {
  1730 + if (childTaskPlan.isDestroy()) {
  1731 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1732 + } else {
  1733 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1734 + }
  1735 + }
  1736 + }
  1737 + }
  1738 + }
  1739 + }
  1740 +
  1741 + yesterdayDataList.get(x).put("totalKilometers", yygl + ksgl + jcclc);
  1742 +
  1743 + }
  1744 +
  1745 + /* for(ScheduleRealInfo scheduleRealInfo:list){
  1746 + if(scheduleRealInfo != null){
  1747 + for(int i=0;i<yesterdayDataList.size();i++){
  1748 + if(scheduleRealInfo.getXlBm().equals(yesterdayDataList.get(i).get("xlBm")) && scheduleRealInfo.getClZbh().equals(yesterdayDataList.get(i).get("clZbh"))
  1749 + && scheduleRealInfo.getjGh().equals(yesterdayDataList.get(i).get("jGh"))){
  1750 + //根据线路代码获取公司
  1751 + Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
  1752 + yesterdayDataList.get(i).put("company", li.getCompany());
  1753 + yesterdayDataList.get(i).put("bCompany", li.getBrancheCompany());
  1754 + //计算总公里
  1755 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1756 + //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
  1757 + if(childTaskPlans.isEmpty()){
  1758 + if(scheduleRealInfo.getStatus() == 2){
  1759 + yesterdayDataList.get(i).put("totalKilometers", scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
  1760 + }
  1761 + }else{
  1762 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1763 + while(it.hasNext()){
  1764 + ChildTaskPlan childTaskPlan = it.next();
  1765 + if(!childTaskPlan.isDestroy()){
  1766 + yesterdayDataList.get(i).put("totalKilometers", childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
  1767 + }
  1768 + }
  1769 + }
  1770 + }
  1771 + }
  1772 + }
  1773 + }*/
  1774 + //增加顺序号
  1775 + for (int i = 0; i < yesterdayDataList.size(); i++) {
  1776 + if (i == 0) {
  1777 + yesterdayDataList.get(i).put("seqNumber", 1);
  1778 + } else {
  1779 + if (yesterdayDataList.get(i - 1).get("clZbh").equals(yesterdayDataList.get(i).get("clZbh"))) {
  1780 + yesterdayDataList.get(i).put("seqNumber", 1 + (int) yesterdayDataList.get(i - 1).get("seqNumber"));
  1781 + } else {
  1782 + yesterdayDataList.get(i).put("seqNumber", 1);
  1783 + }
  1784 + }
  1785 + }
  1786 + return yesterdayDataList;
  1787 + }
  1788 +
  1789 + /**
  1790 + * 批量调整人车
  1791 + */
  1792 + @Override
  1793 + public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs) {
  1794 + Map<String, Object> rs = new HashMap<>();
  1795 + Set<ScheduleRealInfo> set = new HashSet<>();
  1796 +
  1797 + ScheduleRealInfo sch;
  1798 + BiMap<String, String> map = BasicData.deviceId2NbbmMap.inverse();
  1799 +
  1800 + for (ChangePersonCar cpc : cpcs) {
  1801 +
  1802 + if (map.get(cpc.getClZbh()) == null) {
  1803 + rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!");
  1804 + rs.put("status", ResponseCode.ERROR);
  1805 + return rs;
  1806 + }
  1807 +
  1808 + sch = dayOfSchedule.get(cpc.getSchId());
  1809 + if (sch == null)
  1810 + continue;
  1811 +
  1812 + if (StringUtils.isNotEmpty(cpc.getJsy())) {
  1813 + //换驾驶员
  1814 + persoChange(sch, cpc.getJsy().split("/")[0]);
  1815 + }
  1816 +
  1817 + //换售票员
  1818 + if (StringUtils.isNotEmpty(cpc.getSpy())) {
  1819 + persoChangeSPY(sch, cpc.getSpy().split("/")[0]);
  1820 + }
  1821 +
  1822 + //换车
  1823 + if (StringUtils.isNotEmpty(cpc.getClZbh())) {
  1824 + set.add(sch);
  1825 + set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh()));
  1826 + }
  1827 +
  1828 + }
  1829 + rs.put("ts", set);
  1830 + rs.put("status", ResponseCode.SUCCESS);
  1831 + return rs;
  1832 + }
  1833 +
  1834 + /**
  1835 + * @Title: persoChange
  1836 + * @Description: TODO(班次换驾驶员)
  1837 + */
  1838 + public void persoChange(ScheduleRealInfo sch, String jGh) {
  1839 + if (sch.getjGh().equals(jGh))
  1840 + return;
  1841 + String jName = BasicData.allPerson.get(jGh);
  1842 + if (StringUtils.isNotEmpty(jName)) {
  1843 + sch.setjGh(jGh);
  1844 + sch.setjName(jName);
  1845 + }
  1846 + }
  1847 +
  1848 + /**
  1849 + * @Title: persoChange
  1850 + * @Description: TODO(班次换售票员)
  1851 + */
  1852 + public void persoChangeSPY(ScheduleRealInfo sch, String sGh) {
  1853 + if (sch.getsGh().equals(sGh))
  1854 + return;
  1855 + String sName = BasicData.allPerson.get(sGh);
  1856 + if (StringUtils.isNotEmpty(sName)) {
  1857 + sch.setsGh(sGh);
  1858 + sch.setsName(sName);
  1859 + }
  1860 + }
  1861 +
  1862 + /**
  1863 + * 批量待发调整
  1864 + */
  1865 + @Override
  1866 + public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) {
  1867 + Map<String, Object> rs = new HashMap<>(), tempMap = new HashMap<>();
  1868 + List<ScheduleRealInfo> list = new ArrayList<>();
  1869 +
  1870 + ScheduleRealInfo sch, next;
  1871 + for (DfsjChange dc : dfsjcs) {
  1872 + if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj()))
  1873 + continue;
  1874 +
  1875 + /*sch = dayOfSchedule.get(dc.getSchId());
  1876 + if(sch==null)
  1877 + continue;
  1878 +
  1879 + sch.setDfsjAll(dc.getNew_dfsj());
  1880 + //重新计算终点时间
  1881 + sch.calcEndTime();
  1882 + list.add(sch);*/
  1883 + tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null);
  1884 +
  1885 + if (tempMap.get("status").equals(ResponseCode.SUCCESS)) {
  1886 + list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts"));
  1887 + }
  1888 + //next=dayOfSchedule.next(sch);
  1889 + /*if(next.getQdzName().equals(sch.getZdzName())){
  1890 + next.setQdzArrDateJH(sch.getZdsj());
  1891 + list.add(next);
  1892 + }*/
  1893 + }
  1894 +
  1895 + rs.put("status", ResponseCode.SUCCESS);
  1896 + rs.put("ts", list);
  1897 + return rs;
  1898 + }
  1899 +
  1900 +
  1901 + @Override
  1902 + public Map<String, Object> findKMBC1(String jName, String clZbh,
  1903 + String date, String enddate) {
  1904 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate);
  1905 + DecimalFormat format = new DecimalFormat("0.00");
  1906 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  1907 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  1908 + int jhbc = 0, cjbc = 0, ljbc = 0;
  1909 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0;
  1910 + float addMileage = 0l, remMileage = 0l;
  1911 + Map<String, Object> map = new HashMap<String, Object>();
  1912 + for (ScheduleRealInfo scheduleRealInfo : list) {
  1913 + if (scheduleRealInfo != null) {
  1914 + //计划里程(主任务过滤掉临加班次),
  1915 + //烂班里程(主任务烂班),
  1916 + //临加里程(主任务临加),
  1917 + //计划班次,烂班班次,增加班次
  1918 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1919 + if (scheduleRealInfo.isSflj()) {
  1920 + addMileage += tempJhlc;
  1921 + ljbc++;
  1922 + } else {
  1923 + jhlc += tempJhlc;
  1924 + jhbc++;
  1925 + if (scheduleRealInfo.getStatus() == -1) {
  1926 + remMileage += tempJhlc;
  1927 + cjbc++;
  1928 + }
  1929 + }
  1930 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1931 + //计算营运里程,空驶里程
  1932 + if (childTaskPlans.isEmpty()) {
  1933 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  1934 + || scheduleRealInfo.getBcType().equals("venting")) {
  1935 + ksgl += tempJhlc;
  1936 + } else {
  1937 + yygl += tempJhlc;
  1938 + }
  1939 + } else {
  1940 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1941 + while (it.hasNext()) {
  1942 + ChildTaskPlan childTaskPlan = it.next();
  1943 + if (childTaskPlan.getMileageType().equals("empty")) {
  1944 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1945 + } else {
  1946 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1947 + }
  1948 + }
  1949 + }
  1950 + }
  1951 + }
  1952 + map.put("jhlc", format.format(jhlc));
  1953 + map.put("remMileage", format.format(remMileage));
  1954 + map.put("addMileage", format.format(addMileage));
  1955 + map.put("yygl", format.format(yygl));
  1956 + map.put("ksgl", format.format(ksgl));
  1957 + map.put("realMileage", format.format(yygl + ksgl));
  1958 + map.put("jhbc", jhbc);
  1959 + map.put("cjbc", cjbc);
  1960 + map.put("ljbc", ljbc);
  1961 + map.put("sjbc", jhbc - cjbc + ljbc);
  1962 + return map;
  1963 + }
  1964 +
  1965 + /**
  1966 + * 调整班次类型
  1967 + *
  1968 + * @param id
  1969 + * @param bcType
  1970 + * @param remarks
  1971 + * @return
  1972 + */
  1973 + @Override
  1974 + public Map<String, Object> changeBcType(Long id, String bcType, String remarks) {
  1975 + Map<String, Object> rs = new HashMap<>();
  1976 +
  1977 + try {
  1978 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  1979 + if (sch != null) {
  1980 + sch.setBcType(bcType);
  1981 + sch.addRemarks(remarks);
  1982 + //有时间记录一下相关变更数据
  1983 + rs.put("status", ResponseCode.SUCCESS);
  1984 + rs.put("t", sch);
  1985 + }
  1986 + } catch (Exception e) {
  1987 + logger.error("", e);
  1988 + rs.put("status", ResponseCode.ERROR);
  1989 + }
  1990 +
  1991 + return rs;
  1992 + }
  1993 +
  1994 + @Override
  1995 + public Map<String, Object> historySave(ScheduleRealInfo sch) {
  1996 + Map<String, Object> rs = new HashMap<>();
  1997 + rs.put("status", ResponseCode.ERROR);
  1998 +
  1999 + ScheduleRealInfo oldSch = super.findById(sch.getId());
  2000 + //修改车辆
  2001 + if (!oldSch.getClZbh().equals(sch.getClZbh())) {
  2002 + Set<String> allCar = BasicData.deviceId2NbbmMap.values();
  2003 + if (!allCar.contains(sch.getClZbh())) {
  2004 + rs.put("msg", "无效的车辆自编号");
  2005 + return rs;
  2006 + } else
  2007 + oldSch.setClZbh(sch.getClZbh());
  2008 + }
  2009 +
  2010 + //修改驾驶员
  2011 + if (!oldSch.getjGh().equals(sch.getjGh())) {
  2012 + Map<String, String> allPer = BasicData.allPerson;
  2013 + if (!allPer.containsKey(sch.getjGh())) {
  2014 + rs.put("msg", "无效的驾驶员");
  2015 + return rs;
  2016 + } else {
  2017 + oldSch.setjGh(sch.getjGh());
  2018 + oldSch.setjName(allPer.get(oldSch.getjGh()));
  2019 + }
  2020 + }
  2021 +
  2022 + //待发时间
  2023 + oldSch.setDfsj(sch.getDfsj());
  2024 + //实发时间
  2025 + oldSch.setFcsjActual(sch.getFcsjActual());
  2026 + //实际终点
  2027 + oldSch.setZdsjActual(sch.getZdsjActual());
  2028 + //备注
  2029 + oldSch.setRemarks(sch.getRemarks());
  2030 +
  2031 + scheduleRealInfoRepository.save(oldSch);
  2032 + rs.put("status", ResponseCode.SUCCESS);
  2033 + return rs;
  2034 + }
  2035 +
  2036 + @Autowired
  2037 + SvgAttributeRepository svgAttributeRepository;
  2038 +
  2039 + @Override
  2040 + public Map<String, Object> svgAttr(String jsonStr) {
  2041 + Map<String, Object> rs = new HashMap<>();
  2042 +
  2043 + try {
  2044 + JSONObject jObj = JSONObject.parseObject(StringEscapeUtils.unescapeHtml4(jsonStr));
  2045 +
  2046 + SvgAttribute svgAttribute = new SvgAttribute();
  2047 + svgAttribute.setLineCode(jObj.getString("lineCode"));
  2048 + svgAttribute.setHideStations(jObj.getString("hideStations"));
  2049 + svgAttribute.setNicknames(jObj.getString("nicknames"));
  2050 + svgAttributeRepository.save(svgAttribute);
  2051 +
  2052 + rs.put("t", svgAttribute);
  2053 + rs.put("status", ResponseCode.SUCCESS);
  2054 + } catch (Exception e) {
  2055 + logger.error("", e);
  2056 + rs.put("status", ResponseCode.ERROR);
  2057 + }
  2058 + return rs;
  2059 + }
  2060 +
  2061 + @Override
  2062 + public Map<String, Object> findSvgAttr(String idx) {
  2063 + Map<String, Object> rs = new HashMap<>();
  2064 + try {
  2065 + List<String> lineCodes = Splitter.on(",").splitToList(idx);
  2066 + List<SvgAttribute> list = svgAttributeRepository.findSvgAttr(lineCodes);
  2067 +
  2068 + rs.put("status", ResponseCode.SUCCESS);
  2069 + rs.put("list", list);
  2070 + } catch (Exception e) {
  2071 + logger.error("", e);
  2072 + rs.put("status", ResponseCode.ERROR);
  2073 + }
  2074 + return rs;
  2075 + }
  2076 +
  2077 + @Override
  2078 + public List<Map<String, Object>> yesterdayDataList(String line) {
  2079 + // TODO Auto-generated method stub
  2080 + return null;
  2081 + }
  2082 +
594 2083 @Override
595   - public List<ScheduleRealInfo> exportWaybillQp( String clZbh,String date,String line) {
  2084 + public List<ScheduleRealInfo> exportWaybillQp(String clZbh, String date, String line) {
  2085 + // TODO Auto-generated method stub
596 2086 ReportUtils ee = new ReportUtils();
597 2087 ReportRelatedUtils rru = new ReportRelatedUtils();
598 2088 List<Iterator<?>> list = new ArrayList<Iterator<?>>();
... ... @@ -705,691 +2195,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
705 2195 }
706 2196  
707 2197 @Override
708   - public List<Map<String, Object>> dailyInfo(String line, String date,String type) {
709   - DecimalFormat format = new DecimalFormat("0.00");
710   - ReportUtils ee = new ReportUtils();
711   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
712   - List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date);
713   -
714   - double totalZGL = 0,totalKSGL=0,totalYH=0;
715   - int totalBCS=0;
716   - for(int i = 0;i < list.size();i++){
717   - String zgl = format.format(Double.parseDouble(list.get(i).get("zgl")==null?"0":list.get(i).get("zgl").toString()));
718   - String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl")==null?"0":list.get(i).get("ksgl").toString()));
719   - if(type.equals("export")){
720   - totalZGL += Double.parseDouble(zgl);
721   - totalKSGL += Double.parseDouble(ksgl);
722   - totalBCS += Integer.parseInt(list.get(i).get("bcs").toString());
723   - }
724   - list.get(i).put("zgl", zgl);
725   - list.get(i).put("ksgl", ksgl);
726   - }
727   - if(type.equals("export")){
728   - Map<String,Object> map = new HashMap<String, Object>();
729   - map.put("line", line);
730   - map.put("date", date);
731   - map.put("totalZGL", totalZGL);
732   - map.put("totalKSGL", totalKSGL);
733   - map.put("totalYH", totalYH);
734   - map.put("totalBCS", totalBCS);
735   -
736   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
737   -
738   - listI.add(list.iterator());
739   - try {
740   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\daily.xls",
741   - path+"export\\班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
742   - } catch (ParseException e) {
743   - e.printStackTrace();
744   - }
745   - }
746   - return list;
747   - }
748   -
749   - @Override
750   - public List<Object[]> historyMessage(String line, String date, String code, String type) {
751   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
752   - long d= 0;
753   - long t=0;
754   - if(date.length()>0){
755   - try {
756   - d=sdf.parse(date+" 00:00:00").getTime();
757   - t=sdf.parse(date+" 23:59:59").getTime();
758   - } catch (ParseException e) {
759   - // TODO Auto-generated catch block
760   - e.printStackTrace();
761   - }
762   -
763   - }
764   -
765   - List<Object[]> list = scheduleRealInfoRepository.historyMessage(line,d,t, code);
766   - for(Object[] obj:list){
767   - if(obj != null){
768   - obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString())));
769   - obj[4] = BasicData.lineCode2NameMap.get(line);
770   - }
771   - }
772   -
773   - if(type != null && type.length() != 0 && type.equals("export")){
774   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
775   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
776   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
777   - Map<String,Object> m = new HashMap<String, Object>();
778   - ReportUtils ee = new ReportUtils();
779   - List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
780   - for(int i = 0; i < list.size(); i++){
781   - Map<String, Object> map = new HashMap<String, Object>();
782   - Object[] obj = list.get(i);
783   - map.put("num", i + 1);
784   - map.put("line", obj[4]);
785   - map.put("clZbh", obj[0]);
786   - map.put("sender", obj[1]);
787   - map.put("date", obj[3]);
788   - map.put("text", obj[2]);
789   - newList.add(map);
790   - }
791   - try {
792   - listI.add(newList.iterator());
793   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
794   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\historyMessage.xls",
795   - path+"export\\调度历史消息" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
796   - } catch (Exception e) {
797   - // TODO: handle exception
798   - e.printStackTrace();
799   - }
800   - }
801   -
802   - return list;
803   - }
804   -
805   - @Override
806   - public Map<Integer, Integer> trustStatus(String lineStr) {
807   - List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr));
808   -
809   - Map<Integer, Integer> map = new HashMap<>();
810   - /*Integer code;
811   - for (String lineCode : lineList) {
812   - code = Integer.parseInt(lineCode);
813   - if (!ScheduleBuffer.trustMap.containsKey(lineCode))
814   - ScheduleBuffer.trustMap.put(code, 0);
815   -
816   - map.put(code, ScheduleBuffer.trustMap.get(code));
817   - }*/
818   - return map;
819   - }
820   -
821   - @Override
822   - public Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks) {
823   - Map<String, Object> rs = new HashMap<>();
824   - List<ScheduleRealInfo> ts = new ArrayList<>();
825   - try {
826   - ScheduleRealInfo sch = dayOfSchedule.get(id);
827   -
828   - LineConfig config = lineConfigData.get(sch.getXlBm());
829   - //小于线路开始运营时间,则默认跨过24点
830   - if(fcsjActual.compareTo(config.getStartOpt()) < 0){
831   - sch.setRealExecDate(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME));
832   - }
833   - else {
834   - sch.setRealExecDate(sch.getScheduleDateStr());
835   - }
836   -
837   - sch.setFcsjActualAll(fcsjActual);
838   - sch.addRemarks(remarks);
839   - sch.calcStatus();
840   -
841   - dayOfSchedule.save(sch);
842   - //scheduleRealInfoRepository.save(sch);
843   -
844   - ts.add(sch);
845   -
846   - rs.put("status", ResponseCode.SUCCESS);
847   - rs.put("ts", ts);
848   -
849   - //通知页面刷新
850   - sendUtils.refreshSch(ts);
851   - } catch (Exception e) {
852   - logger.error("", e);
853   - rs.put("status", ResponseCode.ERROR);
854   - }
855   -
856   - return rs;
857   - }
858   -
859   - @Override
860   - public Map<String, Object> revokeDestroy(Long id) {
861   - Map<String, Object> rs = new HashMap<>();
862   - try {
863   - ScheduleRealInfo sch = dayOfSchedule.get(id);
864   - if (sch.getStatus() != -1) {
865   - rs.put("status", ResponseCode.ERROR);
866   - rs.put("msg", "未烂班,无法撤销!");
867   - } else {
868   - sch.setStatus(0);
869   - rs.put("status", ResponseCode.SUCCESS);
870   - rs.put("t", sch);
871   -
872   - }
873   - } catch (Exception e) {
874   - logger.error("", e);
875   - rs.put("status", ResponseCode.ERROR);
876   - }
877   - return rs;
878   - }
879   -
880   - @Override
881   - public Map<String, Object> revokeRealOutgo(Long id) {
882   - Map<String, Object> rs = new HashMap<>();
883   - List<ScheduleRealInfo> ts = new ArrayList<>();
884   -
885   - try {
886   - ScheduleRealInfo sch = dayOfSchedule.get(id);
887   - if (sch.getFcsjActual() == null) {
888   - rs.put("status", ResponseCode.ERROR);
889   - rs.put("msg", "无实发时间,无法撤销!");
890   - } else {
891   - //将对应的到离站数据标记为不可信
892   - List<ArrivalEntity> list = ArrivalData_GPS.findByNbbm(sch.getClZbh());
893   - for(ArrivalEntity arr : list){
894   - if(arr.getInOut() == 1
895   - && arr.getUpDown() == Integer.parseInt(sch.getXlDir())
896   - && arr.getStopNo().equals(sch.getQdzCode())
897   - && Math.abs(arr.getTs() - sch.getFcsjActualTime()) < 1000 * 60){
898   - arr.setEnable(false);
899   - break;
900   - }
901   - }
902   -
903   - sch.clearFcsjActual();
904   - rs.put("status", ResponseCode.SUCCESS);
905   -
906   - ts.add(sch);
907   - rs.put("ts", ts);
908   -
909   - }
910   - } catch (Exception e) {
911   - logger.error("", e);
912   - rs.put("status", ResponseCode.ERROR);
913   - }
914   - return rs;
915   - }
916   -
917   - @Override
918   - public Map<String, Object> spaceAdjust(Long[] ids, Integer space) {
919   -
920   - List<ScheduleRealInfo> list = new ArrayList<>()
921   - ,updateList = new ArrayList<>();
922   - Map<String, Object> rs = new HashMap<>();
923   - try {
924   - ScheduleRealInfo sch, next;
925   - for (Long id : ids) {
926   - sch = dayOfSchedule.get(id);
927   - if (null != sch)
928   - list.add(sch);
929   - }
930   -
931   - int size = list.size();
932   - if(size == 0){
933   - rs.put("status", ResponseCode.ERROR);
934   - }
935   - else{
936   - // 按发车时间排序
937   - Collections.sort(list, new ScheduleComparator.FCSJ());
938   -
939   - // 以第一个实际发车/待发时间为起点,调整间隔
940   - sch = list.get(0);
941   - Long st = sch.getFcsjActualTime()==null?sch.getDfsjT():sch.getFcsjActualTime()
942   - ,plus = space * 60 * 1000L;
943   -
944   - for(int i = 1; i < size; i ++){
945   - st += plus;
946   - sch = list.get(i);
947   - sch.setDfsjAll(st);
948   - //重新计算终点时间
949   - sch.calcEndTime();
950   -
951   - dayOfSchedule.save(sch);
952   -
953   - updateList.add(sch);
954   - next=dayOfSchedule.next(sch);
955   - if(next.getQdzName().equals(sch.getZdzName())){
956   - next.setQdzArrDateJH(sch.getZdsj());
957   - updateList.add(next);
958   - }
959   - }
960   -
961   -
962   - rs.put("status", ResponseCode.SUCCESS);
963   - rs.put("ts", updateList);
964   - }
965   -
966   - } catch (Exception e) {
967   - logger.error("", e);
968   - rs.put("status", ResponseCode.ERROR);
969   - }
970   - return rs;
971   - }
972   -
973   - private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
974   -
975   - @Override
976   - public Map<String, Object> schInfoFineTune(Map<String, String> map) {
977   - Map<String, Object> rs = new HashMap<>();
978   - List<ScheduleRealInfo> ts = new ArrayList<>();
979   - try {
980   - Long id = Long.parseLong(map.get("id"));
981   - //班次类型
982   - //String bcType = map.get("bcType");
983   - //车辆自编号
984   - //String clZbh = map.get("clZbh");
985   - //计划发车时间
986   - //String fcsj = map.get("fcsj");
987   - //实际发车时间
988   - String fcsjActual = map.get("fcsjActual");
989   -
990   - //实际终点时间
991   - String zdsjActual = map.get("zdsjActual");
992   - //备注
993   - String remarks = map.get("remarks");
994   -
995   - ScheduleRealInfo sch = dayOfSchedule.get(id);
996   - if(null != sch){
997   -// //驾驶员
998   -// if(StringUtils.isNotBlank(map.get("jsy"))){
999   -// String[] jsy = map.get("jsy").split("/");
1000   -// sch.setjGh(jsy[0]);
1001   -// sch.setjName(jsy[1]);
1002   -// }
1003   -
1004   - //售票员
1005   -// if(StringUtils.isNotBlank(map.get("spy"))){
1006   -// String[] spy = map.get("spy").split("/");
1007   -// sch.setsGh(spy[0]);
1008   -// sch.setsName(spy[1]);
1009   -// }
1010   -
1011   - //sch.setBcType(bcType);
1012   - //sch.setClZbh(clZbh);
1013   - //sch.setFcsjAll(fcsj);
1014   -
1015   - if(StringUtils.isNotBlank(fcsjActual)){
1016   - LineConfig config = lineConfigData.get(sch.getXlBm());
1017   - long t=0L;
1018   - //小于线路开始运营时间,则默认跨过24点
1019   - if(fcsjActual.compareTo(config.getStartOpt()) < 0)
1020   - t=fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME)+fcsjActual);
1021   - else
1022   - t=fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+fcsjActual);
1023   -
1024   - //调整实发
1025   - if(!fcsjActual.equals(sch.getFcsjActual()))
1026   - sch.setFcsjActualAll(t);
1027   - }
1028   - else{
1029   - //撤销实发
1030   - if(sch.getFcsjActual() != null)
1031   - revokeRealOutgo(sch.getId());
1032   - }
1033   -
1034   - //实达时间
1035   - if(StringUtils.isNotBlank(zdsjActual)){
1036   - if(!zdsjActual.equals(sch.getZdsjActual())){
1037   - //调整实达
1038   - sch.setZdsjActualAll(zdsjActual);
1039   - //下一班次起点到达时间
1040   - ScheduleRealInfo next = dayOfSchedule.next(sch);
1041   - if(null != next){
1042   - next.setQdzArrDateSJ(zdsjActual);
1043   - ts.add(next);
1044   - }
1045   -
1046   - //重新计算车辆执行班次
1047   - dayOfSchedule.reCalcExecPlan(sch.getClZbh());
1048   - }
1049   - }
1050   - else {
1051   - /*if(sch.getZdsjActual() != null){
1052   - //将对应的到离站数据标记为不可信
1053   - List<ArrivalEntity> list = ArrivalData_GPS.findByNbbm(sch.getClZbh());
1054   - for(ArrivalEntity arr : list){
1055   - if(arr.getInOut() == 0
1056   - && arr.getUpDown() == Integer.parseInt(sch.getXlDir())
1057   - && arr.getStopNo().equals(sch.getZdzCode())
1058   - && Math.abs(arr.getTs() - sch.getZdsjActualTime()) < 1000 * 60){
1059   - arr.setEnable(false);
1060   - break;
1061   - }
1062   - }
1063   - }*/
1064   -
1065   - //清除实达时间
1066   - sch.clearZdsjActual();
1067   - //清除下一班次起点到达时间
1068   - ScheduleRealInfo next = dayOfSchedule.next(sch);
1069   - if(null != next){
1070   - next.setQdzArrDateSJ(null);
1071   - ts.add(next);
1072   - }
1073   - }
1074   -
1075   - sch.setRemarks(remarks);
1076   - }
1077   -
1078   - //班次状态
1079   - sch.calcStatus();
1080   - dayOfSchedule.save(sch);
1081   - //页面需要更新的班次信息
1082   - ts.add(sch);
1083   -
1084   - rs.put("status", ResponseCode.SUCCESS);
1085   - rs.put("ts", ts);
1086   - } catch (Exception e) {
1087   - logger.error("", e);
1088   - rs.put("status", ResponseCode.ERROR);
1089   - }
1090   - return rs;
1091   - }
1092   -
1093   - @Override
1094   - public Map<String, Object> outgoAdjustAll(String params) {
1095   - Map<String, Object> rs = new HashMap<>();
1096   - try{
1097   - JSONArray jsonArray = JSONArray.parseArray(params);
1098   -
1099   - ScheduleRealInfo schedule = null;
1100   - JSONObject jsonObj;
1101   - String dfsj;
1102   - for(int i = 0; i < jsonArray.size(); i ++){
1103   - jsonObj = jsonArray.getJSONObject(i);
1104   - dfsj = jsonObj.getString("t");
1105   - schedule = dayOfSchedule.get(jsonObj.getLong("id"));
1106   - //设置待发时间
1107   - schedule.setDfsjAll(dfsj);
1108   -
1109   - dayOfSchedule.save(schedule);
1110   - }
1111   -
1112   - rs.put("status", ResponseCode.SUCCESS);
1113   - //将更新的最后一个班次返回
1114   - rs.put("t", schedule);
1115   - }catch(Exception e){
1116   - logger.error("", e);
1117   - rs.put("status", ResponseCode.ERROR);
1118   - }
1119   - return rs;
1120   - }
1121   -
1122   - @Override
1123   - public Map<String, Object> findRouteByLine(String lineCode) {
1124   - Map<String, Object> map = new HashMap<>();
1125   - //上行
1126   - Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode);
1127   - map.put("line.id_eq", lineId);
1128   - map.put("directions_eq", 0);
1129   - List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map);
1130   -
1131   - //下行
1132   - map.put("directions_eq", 1);
1133   - List<Map<String, Object>> downList = sectionRouteService.getSectionRoute(map);
1134   -
1135   - Map<String, Object> rs = new HashMap<>();
1136   -
1137   - String upVectors = "", vec;
1138   - //拼接上行路段
1139   - for(Map<String, Object> temp : upList){
1140   - vec = temp.get("sectionBsectionVector").toString();
1141   - upVectors += vec.subSequence(11, vec.length() - 2) + " ";
1142   - }
1143   -
1144   - //拼接下行路段
1145   - String downVectors = "";
1146   - for(Map<String, Object> temp : downList){//LINESTRING(
1147   - vec = temp.get("sectionBsectionVector").toString();
1148   - downVectors += vec.subSequence(11, vec.length() - 2) + " ";
1149   - }
1150   -
1151   -
1152   - rs.put("up", upVectors);
1153   - //上行gcj
1154   - rs.put("up_gcj", BdToGcjString(upVectors));
1155   - rs.put("down", downVectors);
1156   - //下行gcj
1157   - rs.put("down_gcj", BdToGcjString(downVectors));
1158   - rs.put("lineId", lineId);
1159   -
1160   - return rs;
1161   - }
1162   -
1163   - /**
1164   - *
1165   - * @Title: BdToGcjString
1166   - * @Description: TODO(将百度路由字符串 转 成GCJ 字符串)
1167   - * @param @param bdStr
1168   - * @throws
1169   - */
1170   - public String BdToGcjString(String bdStr){
1171   - String[] array = bdStr.split(",")
1172   - ,subArray;
1173   - if(array.length == 0 || bdStr.length() < 2)
1174   - return "";
1175   -
1176   - String gcjStr = "";
1177   - TransGPS.Location location;
1178   - for(String crd : array){
1179   - subArray = crd.split(" ");
1180   - if(subArray.length != 2)
1181   - continue;
1182   - location = TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(subArray[0]), Double.parseDouble(subArray[1])));
1183   -
1184   - gcjStr += location.getLng() + " " + location.getLat() + ",";
1185   - }
1186   -
1187   - return gcjStr.substring(0, gcjStr.length() - 1);
1188   - }
1189   - public List<Map<String, String>> findLine(String line) {
1190   - List<Line> listLine = lineRepository.findLine("%"+line+"%");
1191   - List<Map<String,String>> list = new ArrayList<Map<String,String>>();
1192   - Map<String,String> map;
1193   - for(Line temp:listLine){
1194   - if(temp != null){
1195   - String xlName = temp.getName();
1196   - if(xlName.indexOf(line) != -1){
1197   - map = new HashMap<String, String>();
1198   - map.put("id", temp.getLineCode());
1199   - map.put("text", xlName);
1200   - list.add(map);
1201   - }
1202   - }
1203   - }
1204   - return list;
1205   - }
1206   -
1207   - public List<Map<String, String>> findLpName(String lpName) {
1208   - List<GuideboardInfo> listLpName = guideboardInfoRepository.findLpName("%"+lpName+"%");
1209   - List<Map<String,String>> list = new ArrayList<Map<String,String>>();
1210   - Map<String,String> map;
1211   - for(GuideboardInfo temp:listLpName){
1212   - if(temp != null){
1213   - String lp = temp.getLpName();
1214   - if(lp.indexOf(lpName) != -1){
1215   - map = new HashMap<String, String>();
1216   - map.put("id", lp);
1217   - map.put("text", lp);
1218   - list.add(map);
1219   - }
1220   - }
1221   - }
1222   - return list;
1223   - }
1224   -
1225   - @Override
1226   - public Map<String, Object> findKMBC2(String jName, String clZbh,String date) {
1227   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date);
1228   -
1229   - DecimalFormat format = new DecimalFormat("0.00");
1230   -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1231   -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1232   - int jhbc = 0,cjbc = 0,ljbc = 0;
1233   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
1234   - float addMileage = 0l,remMileage = 0l;
1235   - String j_Name="";
1236   - Map<String,Object> map = new HashMap<String, Object>();
1237   - for(ScheduleRealInfo scheduleRealInfo : list){
1238   - if(scheduleRealInfo != null){
1239   - j_Name=scheduleRealInfo.getjName();
1240   - //计划里程(主任务过滤掉临加班次),
1241   - //烂班里程(主任务烂班),
1242   - //临加里程(主任务临加),
1243   - //计划班次,烂班班次,增加班次
1244   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1245   - if(scheduleRealInfo.isSflj()){
1246   - addMileage += tempJhlc;
1247   - ljbc++;
1248   - }else{
1249   - jhlc += tempJhlc;
1250   - jhbc++;
1251   - if(scheduleRealInfo.getStatus() == -1){
1252   - remMileage += tempJhlc;
1253   - cjbc++;
1254   - }
1255   - }
1256   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1257   - //计算营运里程,空驶里程
1258   - if(childTaskPlans.isEmpty()){
1259   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
1260   - || scheduleRealInfo.getBcType().equals("venting")){
1261   - ksgl += tempJhlc;
1262   - }else{
1263   - yygl += tempJhlc;
1264   - }
1265   - }else{
1266   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1267   - while(it.hasNext()){
1268   - ChildTaskPlan childTaskPlan = it.next();
1269   - if(childTaskPlan.getMileageType().equals("empty")){
1270   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1271   - }else{
1272   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1273   - }
1274   - }
1275   - }
1276   - }
1277   - }
1278   - map.put("j_name", j_Name);
1279   - map.put("jhlc", format.format(jhlc));
1280   - map.put("remMileage", format.format(remMileage));
1281   - map.put("addMileage", format.format(addMileage));
1282   - map.put("yygl", format.format(yygl));
1283   - map.put("ksgl", format.format(ksgl));
1284   - map.put("realMileage", format.format(yygl+ksgl));
1285   - map.put("jhbc", jhbc);
1286   - map.put("cjbc", cjbc);
1287   - map.put("ljbc", ljbc);
1288   - map.put("sjbc", jhbc-cjbc+ljbc);
1289   - return map;
1290   - }
1291   -
1292   -
1293   - @Override
1294   - public Map<String, Object> findKMBC(String jName, String clZbh,
1295   - String lpName,String date,String line) {
1296   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line);
1297   - DecimalFormat format = new DecimalFormat("0.00");
1298   -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1299   -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1300   - int jhbc = 0,cjbc = 0,ljbc = 0;
1301   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
1302   - float addMileage = 0l,remMileage = 0l;
1303   - Map<String,Object> map = new HashMap<String, Object>();
1304   - for(ScheduleRealInfo scheduleRealInfo : list){
1305   - if(scheduleRealInfo != null){
1306   - //计划里程(主任务过滤掉临加班次),
1307   - //烂班里程(主任务烂班),
1308   - //临加里程(主任务临加),
1309   - //计划班次,烂班班次,增加班次
1310   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1311   - if(scheduleRealInfo.isSflj()){
1312   - ljbc++;
1313   - }else{
1314   - if( !(scheduleRealInfo.getBcType().equals("in")
1315   - ||scheduleRealInfo.getBcType().equals("out")) ){
1316   - jhbc++;
1317   - jhlc += tempJhlc;
1318   - }
1319   -
1320   - if(scheduleRealInfo.getStatus() == -1){
1321   - remMileage += tempJhlc;
1322   - cjbc++;
1323   - }
1324   - }
1325   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1326   - //计算营运里程,空驶里程
1327   - if(childTaskPlans.isEmpty()){
1328   - if(scheduleRealInfo.getBcType().equals("in") ||
1329   - scheduleRealInfo.getBcType().equals("out")){
1330   - jcclc +=tempJhlc;
1331   - }
1332   - //主任务 放空班次属于营运
1333   -// else if(scheduleRealInfo.getBcType().equals("venting")){
1334   -// ksgl += tempJhlc;
1335   -// }
1336   - else{
1337   - if(scheduleRealInfo.getStatus() != -1){
1338   - if(scheduleRealInfo.isSflj()){
1339   - addMileage += tempJhlc;
1340   - }
1341   - yygl += tempJhlc;
1342   - }
1343   - }
1344   - }else{
1345   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1346   - while(it.hasNext()){
1347   - ChildTaskPlan childTaskPlan = it.next();
1348   - if(childTaskPlan.getMileageType().equals("empty")){
1349   - if(childTaskPlan.isDestroy()){
1350   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1351   - }else{
1352   - if(scheduleRealInfo.isSflj()){
1353   - addMileage += tempJhlc;
1354   - }
1355   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1356   - }
1357   - }else{
1358   - if(childTaskPlan.isDestroy()){
1359   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1360   -// cjbc++;
1361   - }else{
1362   - if(scheduleRealInfo.isSflj()){
1363   - addMileage += tempJhlc;
1364   - }
1365   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1366   - }
1367   - }
1368   - }
1369   - }
1370   - }
1371   - }
1372   - map.put("jhlc", format.format(jhlc));
1373   - map.put("remMileage", format.format(remMileage));
1374   - map.put("addMileage", format.format(addMileage));
1375   - map.put("yygl", format.format(yygl));
1376   - map.put("ksgl", format.format(ksgl));
1377   - map.put("realMileage", format.format(yygl+ksgl+jcclc));
1378   - map.put("jhbc", jhbc);
1379   - map.put("cjbc", cjbc);
1380   - map.put("ljbc", ljbc);
1381   - map.put("sjbc", jhbc-cjbc+ljbc);
1382   - map.put("jcclc", jcclc);
1383   - map.put("zkslc", format.format(ksgl+jcclc));
1384   - return map;
1385   - }
1386   -
1387   -
1388   -
1389   - @Override
1390   - public Map<String, Object> findKMBCQp( String clZbh,
1391   - String date,String line) {
1392   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill2( clZbh,date,line);
  2198 + public Map<String, Object> findKMBCQp(String clZbh, String date, String line) {
  2199 + // TODO Auto-generated method stub
  2200 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill2( clZbh,date,line);
1393 2201 DecimalFormat format = new DecimalFormat("0.00");
1394 2202 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1395 2203 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
... ... @@ -1483,97 +2291,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1483 2291 return map;
1484 2292 }
1485 2293  
1486   -
1487 2294 @Override
1488   - public List<Map<String, Object>> account(String line, String date,
1489   - String code,String xlName, String type) {
1490   - List<Object[]> lsitObj = scheduleRealInfoRepository.account(line,date,code);
1491   - List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
1492   - Map<String,Object> map;
1493   - int i = 1;
1494   - for(Object[] obj : lsitObj){
1495   - if(obj != null){
1496   - map = new HashMap<String,Object>();
1497   - map.put("num", i++);
1498   - map.put("xlName", xlName);
1499   - map.put("clZbh", obj[3]);
1500   - map.put("company", obj[0]);
1501   - map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[1]+"")).toUpperCase());
1502   - map.put("requestTime", obj[2]);
1503   - listMap.add(map);
1504   - }
1505   - }
1506   -
1507   - if(type != null && type.length() != 0 && type.equals("export")){
1508   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1509   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
1510   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1511   - Map<String,Object> m = new HashMap<String, Object>();
1512   - ReportUtils ee = new ReportUtils();
1513   - Map<String, Object> typeMap = new HashMap<String, Object>();
1514   - typeMap.put("0xA1", "请求恢复运营");
1515   - typeMap.put("0xA2", "申请调档");
1516   - typeMap.put("0xA3", "出场请求");
1517   - typeMap.put("0xA5", "进场请求");
1518   - typeMap.put("0xA7", "加油请求");
1519   - typeMap.put("0x50", "车辆故障");
1520   - typeMap.put("0x70", "路阻报告");
1521   - typeMap.put("0x60", "事故报告");
1522   - typeMap.put("0x11", "扣证纠纷");
1523   - typeMap.put("0x12", "报警");
1524   - for(Map<String, Object> map1 : listMap){
1525   - map1.put("requestText", typeMap.get(map1.get("requestType")));
1526   - }
1527   - try {
1528   - listI.add(listMap.iterator());
1529   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
1530   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\account.xls",
1531   - path+"export\\驾驶员请求台账" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
1532   - } catch (Exception e) {
1533   - // TODO: handle exception
1534   - e.printStackTrace();
1535   - }
1536   - }
1537   -
1538   - return listMap;
1539   - }
1540   -
1541   - @Override
1542   - public List<ScheduleRealInfo> correctForm(String line, String startDate,
1543   - String endDate, String lpName, String code, String type) {
1544   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line,startDate,endDate,lpName,code);
1545   -
1546   - if(type != null && type.length() != 0 && type.equals("export")){
1547   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1548   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
1549   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1550   - Map<String,Object> m = new HashMap<String, Object>();
1551   - ReportUtils ee = new ReportUtils();
1552   - m.put("startDate", startDate);
1553   - m.put("endDate", endDate);
1554   - try {
1555   - listI.add(list.iterator());
1556   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
1557   - ee.excelReplace(listI, new Object[] { m }, path+"mould\\correctForm.xls",
1558   - path+"export\\" + URLEncoder.encode("修正报表", "UTF-8") + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
1559   - } catch (Exception e) {
1560   - // TODO: handle exception
1561   - e.printStackTrace();
1562   - }
1563   - }
1564   -
1565   - return list;
1566   - }
1567   -
1568   - @Override
1569   - public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1570   - String lpName,String date,String line) {
1571   - List <ScheduleRealInfo> list= scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName,date,line);
1572   - for (int i = 0; i < list.size(); i++) {
1573   - ScheduleRealInfo s=list.get(i);
1574   - String remarks="";
1575   - if(s.getRemarks()!=null){
1576   - remarks +=s.getRemarks();
  2295 + public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) {
  2296 + // TODO Auto-generated method stub
  2297 + List <ScheduleRealInfo> list=null;
  2298 + list= scheduleRealInfoRepository.queryListWaybill2(clZbh,date,line);
  2299 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  2300 + for (int i = 0; i < list.size(); i++) {
  2301 + ScheduleRealInfo s=list.get(i);
  2302 + if(!(s.getBcType().equals("in")||s.getBcType().equals("out"))){
  2303 + String remarks="";
  2304 + if(s.getRemarks()!=null){
  2305 + remarks +=s.getRemarks();
1577 2306 }
1578 2307 Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
1579 2308 if(!childTaskPlans.isEmpty()){
... ... @@ -1587,784 +2316,61 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1587 2316 }
1588 2317 }
1589 2318 s.setRemarks(remarks);
  2319 + newList.add(s);
1590 2320 }
1591 2321  
1592   - return list;
1593 2322 }
1594 2323  
1595   - @Override
1596   - public List<ScheduleRealInfo> queryListWaybillQp( String clZbh,String date,String line) {
1597   - List <ScheduleRealInfo> list=null;
1598   - list= scheduleRealInfoRepository.queryListWaybill2(clZbh,date,line);
1599   - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
1600   - for (int i = 0; i < list.size(); i++) {
1601   - ScheduleRealInfo s=list.get(i);
1602   - if(!(s.getBcType().equals("in")||s.getBcType().equals("out"))){
1603   - String remarks="";
1604   - if(s.getRemarks()!=null){
1605   - remarks +=s.getRemarks();
1606   - }
1607   - Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
1608   - if(!childTaskPlans.isEmpty()){
1609   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1610   - while(it.hasNext()){
1611   - ChildTaskPlan c = it.next();
1612   - if(c.getRemarks()!=null && c.getRemarks().length()>0){
1613   - remarks += c.getRemarks();
1614   - }
1615   -
1616   - }
1617   - }
1618   - s.setRemarks(remarks);
1619   - newList.add(s);
1620   - }
1621   -
1622   - }
1623   -
1624   - return newList;
  2324 + return newList;
1625 2325 }
1626 2326  
1627 2327 @Override
1628   - public Map<String, Object> removeChildTask(Long taskId) {
1629   - Map<String, Object> rs = new HashMap<>();
1630   - ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);
1631   -
1632   - ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());
1633   - try {
1634   -
1635   - sch.getcTasks().remove(chTask);
1636   - scheduleRealInfoRepository.save(sch);
1637   - rs.put("status", ResponseCode.SUCCESS);
1638   - } catch (Exception e) {
1639   - logger.error("", e);
1640   - rs.put("status", ResponseCode.ERROR);
1641   - }
1642   - return rs;
1643   - }
1644   -
1645   - @Override
1646   - public List<Map<String, Object>> statisticsDaily(String line, String date,
1647   - String xlName) {
1648   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1649   - List<Map<String,Object>> lMap = new ArrayList<Map<String,Object>>();
1650   - DecimalFormat format = new DecimalFormat("0.00");
1651   - double jhlc = 0, tempJhlc = 0,childMileage = 0;
1652   - float sjgl = 0f,ssgl = 0f,ssgl_lz = 0f,ssgl_dm = 0f,ssgl_gz = 0f,ssgl_jf = 0f,ssgl_zs = 0f,ssgl_qr = 0f
1653   - ,ssgl_qc = 0f,ssgl_kx = 0f,ssgl_qh = 0f,ssgl_yw = 0f,ssgl_other = 0f,ljgl = 0f;
1654   - //班次
1655   - int sj_0 = 6*60+31,sj_1 = 8*60+30,sj_2 = 16*60+1,sj_3 = 18*60;
1656   - int jhbc = 0,jhbc_m = 0,jhbc_a = 0;
1657   - int sjbc = 0,sjbc_m = 0,sjbc_a = 0;
1658   - int ljbc = 0,ljbc_m = 0,ljbc_a = 0;
1659   - int fzbc = 0,fzbc_m = 0,fzbc_a = 0;
1660   - int dtbc = 0,dtbc_m = 0,dtbc_a = 0;
1661   - int djg = 0,djg_m = 0,djg_a = 0,djg_time = 0;
1662   - Map<String,Object> map = new HashMap<String, Object>();
1663   - for(ScheduleRealInfo scheduleRealInfo: list){
1664   - if(scheduleRealInfo != null){
  2328 + public Map<String, Object> MapById(Long id) {
  2329 + // TODO Auto-generated method stub
  2330 + Map<String, Object> map=new HashMap<String, Object>();
  2331 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  2332 + ScheduleRealInfo s=scheduleRealInfoRepository.findOne(id);
  2333 + String xlbm=s.getXlBm();
  2334 + String fcrq=s.getScheduleDateStr();
  2335 +
1665 2336  
1666   - if(!(scheduleRealInfo.getBcType().equals("in")
1667   - ||scheduleRealInfo.getBcType().equals("out")) ){
1668   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1669   - //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
1670   - if(childTaskPlans.isEmpty()){
1671   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1672   - //临加公里
1673   - if(scheduleRealInfo.isSflj()){
1674   - ljgl += tempJhlc;
1675   - }else{
1676   - jhlc += tempJhlc;
1677   - }
1678   - if(scheduleRealInfo.getStatus() == 2){
1679   - sjgl += tempJhlc;
1680   - }else if(scheduleRealInfo.getStatus() == -1){
1681   - ssgl += tempJhlc;
1682   - if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("路阻") != -1){
1683   - ssgl_lz += tempJhlc;
1684   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("吊慢") != -1){
1685   - ssgl_dm += tempJhlc;
1686   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("故障") != -1){
1687   - ssgl_gz += tempJhlc;
1688   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("纠纷") != -1){
1689   - ssgl_jf += tempJhlc;
1690   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("肇事") != -1){
1691   - ssgl_zs += tempJhlc;
1692   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("缺人") != -1){
1693   - ssgl_qr += tempJhlc;
1694   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("缺车") != -1){
1695   - ssgl_qc += tempJhlc;
1696   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("客稀") != -1){
1697   - ssgl_kx += tempJhlc;
1698   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("气候") != -1){
1699   - ssgl_qh += tempJhlc;
1700   - }else if((scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()).indexOf("援外") != -1){
1701   - ssgl_yw += tempJhlc;
1702   - }else{
1703   - ssgl_other += tempJhlc;
1704   - }
1705   - }
1706   - }else{
1707   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1708   - while(it.hasNext()){
1709   - ChildTaskPlan childTaskPlan = it.next();
1710   - childMileage = childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1711   - jhlc += childMileage;
1712   - if(childTaskPlan.isDestroy()){
1713   - ssgl += childMileage;
1714   - if(childTaskPlan.getDestroyReason().equals("路阻")){
1715   - ssgl_lz += childTaskPlan.getMileage();
1716   - }else if(childTaskPlan.getDestroyReason().equals("吊慢")){
1717   - ssgl_dm += childTaskPlan.getMileage();
1718   - }else if(childTaskPlan.getDestroyReason().equals("故障")){
1719   - ssgl_gz += childTaskPlan.getMileage();
1720   - }else if(childTaskPlan.getDestroyReason().equals("纠纷")){
1721   - ssgl_jf += childTaskPlan.getMileage();
1722   - }else if(childTaskPlan.getDestroyReason().equals("肇事")){
1723   - ssgl_zs += childTaskPlan.getMileage();
1724   - }else if(childTaskPlan.getDestroyReason().equals("缺人")){
1725   - ssgl_qr += childTaskPlan.getMileage();
1726   - }else if(childTaskPlan.getDestroyReason().equals("缺车")){
1727   - ssgl_qc += childTaskPlan.getMileage();
1728   - }else if(childTaskPlan.getDestroyReason().equals("客稀")){
1729   - ssgl_kx += childTaskPlan.getMileage();
1730   - }else if(childTaskPlan.getDestroyReason().equals("气候")){
1731   - ssgl_qh += childTaskPlan.getMileage();
1732   - }else if(childTaskPlan.getDestroyReason().equals("援外")){
1733   - ssgl_yw += childTaskPlan.getMileage();
1734   - }else{
1735   - ssgl_other += childTaskPlan.getMileage();
1736   - }
1737   - }else{
1738   - sjgl += childMileage;
1739   - }
1740   - }
1741   - }
1742   -
1743   - //班次
1744   - jhbc++;
1745   - String[] fcsj = scheduleRealInfo.getFcsj().split(":");
1746   - String[] fcsjActual = (scheduleRealInfo.getFcsjActual()==null?"0:00":scheduleRealInfo.getFcsjActual()).split(":");
1747   - if((Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) > sj_0 && (Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) < sj_1){
1748   - jhbc_m++;
1749   - }else if((Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) > sj_2 && (Integer.parseInt(fcsj[0])*60+Integer.parseInt(fcsj[1])) < sj_3){
1750   - jhbc_a++;
1751   - }
1752   - if(scheduleRealInfo.getStatus() == 2){
1753   - sjbc++;
1754   - if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_1){
1755   - sjbc_m++;
1756   - }else if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_3){
1757   - sjbc_a++;
1758   - }
1759   - }
1760   - if(scheduleRealInfo.isSflj()){
1761   - ljbc++;
1762   - if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_1){
1763   - ljbc_m++;
1764   - }else if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_3){
1765   - ljbc_a++;
1766   - }
1767   - }
1768   - if(scheduleRealInfo.getBcType().equals("venting")){
1769   - fzbc++;
1770   - if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_1){
1771   - fzbc_m++;
1772   - }else if((Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0])*60+Integer.parseInt(fcsjActual[1])) < sj_3){
1773   - fzbc_a++;
1774   - }
1775   - }
1776   - }
1777   - }
1778   - }
1779   - map.put("xlName", xlName);
1780   - map.put("jhlc", format.format(jhlc));
1781   - map.put("sjgl", format.format(sjgl));
1782   - map.put("ssgl", format.format(ssgl));
1783   - map.put("ssgl_lz", ssgl_lz==0?0:format.format(ssgl_lz));
1784   - map.put("ssgl_dm", ssgl_dm==0?0:format.format(ssgl_dm));
1785   - map.put("ssgl_gz", ssgl_gz==0?0:format.format(ssgl_gz));
1786   - map.put("ssgl_jf", ssgl_jf==0?0:format.format(ssgl_jf));
1787   - map.put("ssgl_zs", ssgl_zs==0?0:format.format(ssgl_zs));
1788   - map.put("ssgl_qr", ssgl_qr==0?0:format.format(ssgl_qr));
1789   - map.put("ssgl_qc", ssgl_qc==0?0:format.format(ssgl_qc));
1790   - map.put("ssgl_kx", ssgl_kx==0?0:format.format(ssgl_kx));
1791   - map.put("ssgl_qh", ssgl_qh==0?0:format.format(ssgl_qh));
1792   - map.put("ssgl_yw", ssgl_yw==0?0:format.format(ssgl_yw));
1793   - map.put("ssgl_other", ssgl_other==0?0:format.format(ssgl_other));
1794   - map.put("ljgl", ljgl==0?0:format.format(ljgl));
1795   - map.put("jhbc", jhbc);
1796   - map.put("jhbc_m", jhbc_m);
1797   - map.put("jhbc_a", jhbc_a);
1798   - map.put("sjbc", sjbc);
1799   - map.put("sjbc_m", sjbc_m);
1800   - map.put("sjbc_a", sjbc_a);
1801   - map.put("ljbc", ljbc);
1802   - map.put("ljbc_m", ljbc_m);
1803   - map.put("ljbc_a", ljbc_a);
1804   - map.put("fzbc", fzbc);
1805   - map.put("fzbc_m", fzbc_m);
1806   - map.put("fzbc_a", fzbc_a);
1807   - map.put("dtbc", dtbc);
1808   - map.put("dtbc_m", dtbc_m);
1809   - map.put("dtbc_a", dtbc_a);
1810   - map.put("djg", djg);
1811   - map.put("djg_m", djg_m);
1812   - map.put("djg_a", djg_a);
1813   - map.put("djg_time", djg_time);
1814   - lMap.add(map);
1815   - return lMap;
1816   - }
1817   -
1818   - @Override
1819   - public Map<String,Object> scheduleDaily(String line, String date) {
1820   - Map<String,String> tempMap = null;
1821   - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1822   - Map<String, Object> map = new HashMap<String, Object>();
1823   - Double jhlc = 0.00;
1824   - Float sjgl = 0f,ssgl = 0f,ssgl_lz = 0f,ssgl_dm = 0f,ssgl_gz = 0f,ssgl_jf = 0f,ssgl_zs = 0f,ssgl_qr = 0f
1825   - ,ssgl_qc = 0f,ssgl_kx = 0f,ssgl_qh = 0f,ssgl_yw = 0f,ssgl_other = 0f,ljgl = 0f;
1826   - int jhbc = 0;
1827   - for(ScheduleRealInfo scheduleRealInfo:scheduleRealInfos){
1828   - if(scheduleRealInfo != null){
1829   - //计算里程(包括子任务)
1830   - jhlc += scheduleRealInfo.getJhlc();
1831   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1832   - if(!childTaskPlans.isEmpty()){
1833   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1834   - while(it.hasNext()){
1835   - ChildTaskPlan childTaskPlan = it.next();
1836   - //是否烂班,烂班就是少驶
1837   - if(!childTaskPlan.isDestroy()){
1838   - sjgl += childTaskPlan.getMileage();
1839   - }else{
1840   - ssgl += childTaskPlan.getMileage();
1841   - if(childTaskPlan.getDestroyReason().equals("路阻")){
1842   - ssgl_lz += childTaskPlan.getMileage();
1843   - }else if(childTaskPlan.getDestroyReason().equals("吊慢")){
1844   - ssgl_dm += childTaskPlan.getMileage();
1845   - }else if(childTaskPlan.getDestroyReason().equals("故障")){
1846   - ssgl_gz += childTaskPlan.getMileage();
1847   - }else if(childTaskPlan.getDestroyReason().equals("纠纷")){
1848   - ssgl_jf += childTaskPlan.getMileage();
1849   - }else if(childTaskPlan.getDestroyReason().equals("肇事")){
1850   - ssgl_zs += childTaskPlan.getMileage();
1851   - }else if(childTaskPlan.getDestroyReason().equals("缺人")){
1852   - ssgl_qr += childTaskPlan.getMileage();
1853   - }else if(childTaskPlan.getDestroyReason().equals("缺车")){
1854   - ssgl_qc += childTaskPlan.getMileage();
1855   - }else if(childTaskPlan.getDestroyReason().equals("客稀")){
1856   - ssgl_kx += childTaskPlan.getMileage();
1857   - }else if(childTaskPlan.getDestroyReason().equals("气候")){
1858   - ssgl_qh += childTaskPlan.getMileage();
1859   - }else if(childTaskPlan.getDestroyReason().equals("援外")){
1860   - ssgl_yw += childTaskPlan.getMileage();
1861   - }else{
1862   - ssgl_other += childTaskPlan.getMileage();
1863   - }
1864   - }
1865   - //临加公里
1866   - if(childTaskPlan.getType1().equals("临加")){
1867   - ljgl += childTaskPlan.getMileage();
1868   - }
1869   - }
1870   - }
1871   - //班次
1872   - scheduleRealInfo.getFcsjT();
1873   - scheduleRealInfo.getFcsjActualTime();
1874   - }
1875   - }
1876   - map.put("jhlc", jhlc);
1877   - map.put("sjgl", sjgl);
1878   - map.put("ssgl", ssgl);
1879   - map.put("ssgl_lz", ssgl_lz);
1880   - map.put("ssgl_dm", ssgl_dm);
1881   - map.put("ssgl_gz", ssgl_gz);
1882   - map.put("ssgl_jf", ssgl_jf);
1883   - map.put("ssgl_zs", ssgl_zs);
1884   - map.put("ssgl_qr", ssgl_qr);
1885   - map.put("ssgl_qc", ssgl_qc);
1886   - map.put("ssgl_kx", ssgl_kx);
1887   - map.put("ssgl_qh", ssgl_qh);
1888   - map.put("ssgl_yw", ssgl_yw);
1889   - map.put("ssgl_other", ssgl_other);
1890   - map.put("ljgl", ljgl);
1891   -
1892   - map.put("jhbc", scheduleRealInfos.size());
1893   - return null;
1894   - }
1895   -
1896   - @Override
1897   - public int countByLineCodeAndDate(String xlBm, String schDate) {
1898   - return scheduleRealInfoRepository.countByLineCodeAndDate(xlBm + "", schDate);
1899   - }
1900   -
1901   - @Override
1902   - public List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate) {
1903   - return scheduleRealInfoRepository.findByLineCodeAndDate(xlBm + "", schDate);
1904   - }
1905   -
1906   - @Override
1907   - public void deleteByLineCodeAndDate(String xlBm, String schDate) {
1908   - scheduleRealInfoRepository.deleteByLineCodeAndDate(xlBm + "", schDate);
1909   - }
1910   -
1911   - @Override
1912   - public Long getMaxId() {
1913   - return scheduleRealInfoRepository.getMaxId();
1914   - }
1915   -
1916   - @Override
1917   - public List<ScheduleRealInfo> realScheduleList(String line, String date) {
1918   - /*List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.queryUserInfo(line, date);
1919   - List<ScheduleRealInfo> listTotal = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1920   - for(ScheduleRealInfo info:listInfo){
1921   - for(ScheduleRealInfo total:listTotal){
1922   - if(info.getjGh().equals(total.getjGh()) && info.getLpName().equals(total.getLpName()) && info.getClZbh().equals(total.getClZbh())){
1923   -
1924   - }
1925   - }
1926   - }*/
1927   - return scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1928   - }
1929   -
1930   -
1931   - public List<Map<String,Object>> yesterdayDataList(String line,String date) {
1932   - //前一天日期
1933   -// String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
1934   -// String date = "2016-09-20";
1935   - List<Map<String,Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
1936   -// List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1937   - for(int x=0;x<yesterdayDataList.size();x++){
1938   - String jName=yesterdayDataList.get(x).get("jGh").toString();
1939   - String clZbh=yesterdayDataList.get(x).get("clZbh").toString();
1940   - List<ScheduleRealInfo> lists=scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
1941   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
1942   - float addMileage = 0l,remMileage = 0l;
1943   - Map<String,Object> map = new HashMap<String, Object>();
1944   - boolean fage=true;
1945   - for(ScheduleRealInfo scheduleRealInfo : lists){
1946   - if(fage){
1947   - //根据线路代码获取公司
1948   - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
1949   - yesterdayDataList.get(x).put("company", li.getCompany());
1950   - yesterdayDataList.get(x).put("bCompany", li.getBrancheCompany());
1951   - fage=false;
1952   - }
1953   - if(scheduleRealInfo != null){
1954   - //计划里程(主任务过滤掉临加班次),
1955   - //烂班里程(主任务烂班),
1956   - //临加里程(主任务临加),
1957   - //计划班次,烂班班次,增加班次
1958   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
1959   - if(scheduleRealInfo.isSflj()){
1960   - addMileage += tempJhlc;
1961   - }else{
1962   - if( !(scheduleRealInfo.getBcType().equals("in")
1963   - ||scheduleRealInfo.getBcType().equals("out")) ){
1964   - jhlc += tempJhlc;
1965   - }
1966   -
1967   - if(scheduleRealInfo.getStatus() == -1){
1968   - remMileage += tempJhlc;
1969   - }
1970   - }
1971   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1972   - //计算营运里程,空驶里程
1973   - if(childTaskPlans.isEmpty()){
1974   - if(scheduleRealInfo.getBcType().equals("in") ||
1975   - scheduleRealInfo.getBcType().equals("out")){
1976   - jcclc +=tempJhlc;
1977   - }
1978   - //主任务 放空班次属于营运
1979   -// else if(scheduleRealInfo.getBcType().equals("venting")){
1980   -// ksgl += tempJhlc;
1981   -// }
1982   - else{
1983   - if(scheduleRealInfo.getStatus() != -1){
1984   - yygl += tempJhlc;
1985   - }
1986   - }
1987   - }else{
1988   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1989   - while(it.hasNext()){
1990   - ChildTaskPlan childTaskPlan = it.next();
1991   - if(childTaskPlan.getMileageType().equals("empty")){
1992   - if(childTaskPlan.isDestroy()){
1993   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1994   - }else{
1995   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1996   - }
1997   - }else{
1998   - if(childTaskPlan.isDestroy()){
1999   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2000   - }else{
2001   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2002   - }
  2337 + map.put("xlName", s.getXlName());
  2338 + map.put("clZbh", s.getClZbh());
  2339 + map.put("fcsjActual", s.getFcsjActual());
  2340 + map.put("zdzName", s.getZdzName());
  2341 + map.put("scheduleDate", s.getScheduleDateStr());
  2342 + String zdp="",zwdp="",wdp="";
  2343 +
  2344 + List<DutyEmployee> list= dutyEmployeeService.getDutyEmployee(xlbm, fcrq+"00:00", fcrq+"23:59");
  2345 + try {
  2346 + Long fcsj1=sdf.parse(fcrq+" 03:00").getTime();
  2347 + Long fcsj2=sdf.parse(fcrq+" 11:00").getTime();
  2348 + Long fcsj3=sdf.parse(fcrq+" 22:00").getTime();
  2349 + for(int i=0;i<list.size();i++){
  2350 + DutyEmployee t=list.get(i);
  2351 + Long ts=t.getTs();
  2352 + if(ts>fcsj1&&ts<fcsj2){
  2353 + if(zdp.indexOf(t.getuName())==-1){
  2354 + zdp +=t.getuName()+",";
2003 2355 }
2004   - }
2005   - }
2006   - }
2007   - }
2008   -
2009   - yesterdayDataList.get(x).put("totalKilometers", yygl+ksgl+jcclc);
2010   -
2011   - }
2012   -
2013   - /* for(ScheduleRealInfo scheduleRealInfo:list){
2014   - if(scheduleRealInfo != null){
2015   - for(int i=0;i<yesterdayDataList.size();i++){
2016   - if(scheduleRealInfo.getXlBm().equals(yesterdayDataList.get(i).get("xlBm")) && scheduleRealInfo.getClZbh().equals(yesterdayDataList.get(i).get("clZbh"))
2017   - && scheduleRealInfo.getjGh().equals(yesterdayDataList.get(i).get("jGh"))){
2018   - //根据线路代码获取公司
2019   - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
2020   - yesterdayDataList.get(i).put("company", li.getCompany());
2021   - yesterdayDataList.get(i).put("bCompany", li.getBrancheCompany());
2022   - //计算总公里
2023   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2024   - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
2025   - if(childTaskPlans.isEmpty()){
2026   - if(scheduleRealInfo.getStatus() == 2){
2027   - yesterdayDataList.get(i).put("totalKilometers", scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
  2356 + }else if(ts>fcsj2 && ts<fcsj3){
  2357 + if(zwdp.indexOf(t.getuName())==-1){
  2358 + zwdp +=t.getuName()+",";
2028 2359 }
2029 2360 }else{
2030   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2031   - while(it.hasNext()){
2032   - ChildTaskPlan childTaskPlan = it.next();
2033   - if(!childTaskPlan.isDestroy()){
2034   - yesterdayDataList.get(i).put("totalKilometers", childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
2035   - }
  2361 + if(wdp.indexOf(t.getuName())==-1){
  2362 + wdp +=t.getuName()+",";
2036 2363 }
2037 2364 }
2038   - }
2039   - }
2040   - }
2041   - }*/
2042   - //增加顺序号
2043   - for(int i=0;i<yesterdayDataList.size();i++){
2044   - if(i == 0){
2045   - yesterdayDataList.get(i).put("seqNumber", 1);
2046   - }else{
2047   - if(yesterdayDataList.get(i-1).get("clZbh").equals(yesterdayDataList.get(i).get("clZbh"))){
2048   - yesterdayDataList.get(i).put("seqNumber", 1+(int)yesterdayDataList.get(i-1).get("seqNumber"));
2049   - }else{
2050   - yesterdayDataList.get(i).put("seqNumber", 1);
2051   - }
2052   - }
2053   - }
2054   - return yesterdayDataList;
2055   - }
2056   -
2057   - /**
2058   - * 批量调整人车
2059   - */
2060   - @Override
2061   - public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs) {
2062   - Map<String, Object> rs = new HashMap<>();
2063   - Set<ScheduleRealInfo> set = new HashSet<>();
2064   -
2065   - ScheduleRealInfo sch;
2066   -
2067   - for(ChangePersonCar cpc : cpcs){
2068   -
2069   - sch = dayOfSchedule.get(cpc.getSchId());
2070   - if(sch==null)
2071   - continue;
2072   -
2073   - if(StringUtils.isNotEmpty(cpc.getJsy())){
2074   - //换驾驶员
2075   - persoChange(sch, cpc.getJsy().split("/")[0]);
2076   - }
2077   -
2078   - //换售票员
2079   - if(StringUtils.isNotEmpty(cpc.getSpy())){
2080   - persoChangeSPY(sch, cpc.getSpy().split("/")[0]);
2081   - }
2082   -
2083   - //换车
2084   - if(StringUtils.isNotEmpty(cpc.getClZbh())){
2085   - set.add(sch);
2086   - set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh()));
2087   - }
2088   -
2089   - }
2090   - rs.put("ts", set);
2091   - rs.put("status", ResponseCode.SUCCESS);
2092   - return rs;
2093   - }
2094   -
2095   - /**
2096   - *
2097   - * @Title: persoChange
2098   - * @Description: TODO(班次换驾驶员)
2099   - */
2100   - public void persoChange(ScheduleRealInfo sch, String jGh){
2101   - if(sch.getjGh().equals(jGh))
2102   - return;
2103   - String jName = BasicData.allPerson.get(jGh);
2104   - if(StringUtils.isNotEmpty(jName)){
2105   - sch.setjGh(jGh);
2106   - sch.setjName(jName);
2107   - }
2108   - }
2109   -
2110   - /**
2111   - *
2112   - * @Title: persoChange
2113   - * @Description: TODO(班次换售票员)
2114   - */
2115   - public void persoChangeSPY(ScheduleRealInfo sch, String sGh){
2116   - if(sch.getsGh().equals(sGh))
2117   - return;
2118   - String sName = BasicData.allPerson.get(sGh);
2119   - if(StringUtils.isNotEmpty(sName)){
2120   - sch.setsGh(sGh);
2121   - sch.setsName(sName);
2122   - }
2123   - }
2124   -
2125   - /**
2126   - * 批量待发调整
2127   - */
2128   - @Override
2129   - public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) {
2130   - Map<String, Object> rs = new HashMap<>()
2131   - ,tempMap = new HashMap<>();
2132   - List<ScheduleRealInfo> list = new ArrayList<>();
2133   -
2134   - ScheduleRealInfo sch,next;
2135   - for(DfsjChange dc : dfsjcs){
2136   - if(StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj()))
2137   - continue;
2138   -
2139   - /*sch = dayOfSchedule.get(dc.getSchId());
2140   - if(sch==null)
2141   - continue;
2142   -
2143   - sch.setDfsjAll(dc.getNew_dfsj());
2144   - //重新计算终点时间
2145   - sch.calcEndTime();
2146   - list.add(sch);*/
2147   - tempMap = outgoAdjust(dc.getSchId(),"", dc.getNew_dfsj());
2148   -
2149   - if(tempMap.get("status").equals(ResponseCode.SUCCESS)){
2150   - list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts"));
2151   - }
2152   - //next=dayOfSchedule.next(sch);
2153   - /*if(next.getQdzName().equals(sch.getZdzName())){
2154   - next.setQdzArrDateJH(sch.getZdsj());
2155   - list.add(next);
2156   - }*/
2157   - }
2158   -
2159   - rs.put("status", ResponseCode.SUCCESS);
2160   - rs.put("ts", list);
2161   - return rs;
2162   - }
2163   -
2164   -
2165   - @Override
2166   - public Map<String, Object> findKMBC1(String jName, String clZbh,
2167   - String date, String enddate) {
2168   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate);
2169   - DecimalFormat format = new DecimalFormat("0.00");
2170   -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
2171   -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
2172   - int jhbc = 0,cjbc = 0,ljbc = 0;
2173   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
2174   - float addMileage = 0l,remMileage = 0l;
2175   - Map<String,Object> map = new HashMap<String, Object>();
2176   - for(ScheduleRealInfo scheduleRealInfo : list){
2177   - if(scheduleRealInfo != null){
2178   - //计划里程(主任务过滤掉临加班次),
2179   - //烂班里程(主任务烂班),
2180   - //临加里程(主任务临加),
2181   - //计划班次,烂班班次,增加班次
2182   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
2183   - if(scheduleRealInfo.isSflj()){
2184   - addMileage += tempJhlc;
2185   - ljbc++;
2186   - }else{
2187   - jhlc += tempJhlc;
2188   - jhbc++;
2189   - if(scheduleRealInfo.getStatus() == -1){
2190   - remMileage += tempJhlc;
2191   - cjbc++;
2192   - }
2193   - }
2194   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2195   - //计算营运里程,空驶里程
2196   - if(childTaskPlans.isEmpty()){
2197   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
2198   - || scheduleRealInfo.getBcType().equals("venting")){
2199   - ksgl += tempJhlc;
2200   - }else{
2201   - yygl += tempJhlc;
2202   - }
2203   - }else{
2204   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2205   - while(it.hasNext()){
2206   - ChildTaskPlan childTaskPlan = it.next();
2207   - if(childTaskPlan.getMileageType().equals("empty")){
2208   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2209   - }else{
2210   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2211   - }
2212   - }
2213   - }
2214   - }
2215   - }
2216   - map.put("jhlc", format.format(jhlc));
2217   - map.put("remMileage", format.format(remMileage));
2218   - map.put("addMileage", format.format(addMileage));
2219   - map.put("yygl", format.format(yygl));
2220   - map.put("ksgl", format.format(ksgl));
2221   - map.put("realMileage", format.format(yygl+ksgl));
2222   - map.put("jhbc", jhbc);
2223   - map.put("cjbc", cjbc);
2224   - map.put("ljbc", ljbc);
2225   - map.put("sjbc", jhbc-cjbc+ljbc);
2226   - return map;
2227   - }
2228   -
2229   - /**
2230   - * 调整班次类型
2231   - * @param id
2232   - * @param bcType
2233   - * @param remarks
2234   - * @return
2235   - */
2236   - @Override
2237   - public Map<String, Object> changeBcType(Long id, String bcType, String remarks) {
2238   - Map<String, Object> rs = new HashMap<>();
2239   -
2240   - try {
2241   - ScheduleRealInfo sch = dayOfSchedule.get(id);
2242   - if(sch != null){
2243   - sch.setBcType(bcType);
2244   - sch.addRemarks(remarks);
2245   - //有时间记录一下相关变更数据
2246   - rs.put("status", ResponseCode.SUCCESS);
2247   - rs.put("t", sch);
2248   - }
2249   - } catch (Exception e) {
2250   - logger.error("", e);
2251   - rs.put("status", ResponseCode.ERROR);
2252   - }
2253   -
2254   - return rs;
2255   - }
2256   -
2257   - @Override
2258   - public Map<String, Object> historySave(ScheduleRealInfo sch) {
2259   - Map<String, Object> rs = new HashMap<>();
2260   - rs.put("status", ResponseCode.ERROR);
2261   -
2262   - ScheduleRealInfo oldSch = super.findById(sch.getId());
2263   - //修改车辆
2264   - if(!oldSch.getClZbh().equals(sch.getClZbh())){
2265   - Set<String> allCar=BasicData.deviceId2NbbmMap.values();
2266   - if(!allCar.contains(sch.getClZbh())){
2267   - rs.put("msg", "无效的车辆自编号");
2268   - return rs;
2269   - }
2270   - else
2271   - oldSch.setClZbh(sch.getClZbh());
2272   - }
2273   -
2274   - //修改驾驶员
2275   - if(!oldSch.getjGh().equals(sch.getjGh())){
2276   - Map<String, String> allPer = BasicData.allPerson;
2277   - if(!allPer.containsKey(sch.getjGh())){
2278   - rs.put("msg", "无效的驾驶员");
2279   - return rs;
2280   - }
2281   - else{
2282   - oldSch.setjGh(sch.getjGh());
2283   - oldSch.setjName(allPer.get(oldSch.getjGh()));
2284   - }
2285   - }
2286   -
2287   - //修改售票员
2288   -/* if(!oldSch.getsGh().equals(sch.getsGh())){
2289   - Map<String, String> allPer = BasicData.allPerson;
2290   -
2291   - if(StringUtils.isNotEmpty(sch.getsGh())){
2292   - if(!allPer.containsKey(sch.getsGh())){
2293   - rs.put("msg", "无效的售票员");
2294   - return rs;
2295   - }
2296   - }
2297   - oldSch.setsGh(sch.getsGh());
2298   - oldSch.setsName(allPer.get(oldSch.getsGh()));
2299   - }*/
2300   -
2301   - //待发时间
2302   - oldSch.setDfsj(sch.getDfsj());
2303   - //实发时间
2304   - oldSch.setFcsjActual(sch.getFcsjActual());
2305   - //实际终点
2306   - oldSch.setZdsjActual(sch.getZdsjActual());
2307   - //备注
2308   - oldSch.setRemarks(sch.getRemarks());
2309   -
2310   - scheduleRealInfoRepository.save(oldSch);
2311   - rs.put("status", ResponseCode.SUCCESS);
2312   - return rs;
2313   - }
2314   -
2315   - @Override
2316   - public List<Map<String, Object>> yesterdayDataList(String line) {
2317   - // TODO Auto-generated method stub
2318   - return null;
2319   - }
2320   -
2321   - @Override
2322   - public Map<String, Object> MapById(Long id) {
2323   - // TODO Auto-generated method stub
2324   - Map<String, Object> map=new HashMap<String, Object>();
2325   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
2326   - ScheduleRealInfo s=scheduleRealInfoRepository.findOne(id);
2327   - String xlbm=s.getXlBm();
2328   - String fcrq=s.getScheduleDateStr();
2329   -
2330   -
2331   - map.put("xlName", s.getXlName());
2332   - map.put("clZbh", s.getClZbh());
2333   - map.put("fcsjActual", s.getFcsjActual());
2334   - map.put("zdzName", s.getZdzName());
2335   - map.put("scheduleDate", s.getScheduleDateStr());
2336   - String zdp="",zwdp="",wdp="";
2337   -
2338   - List<DutyEmployee> list= dutyEmployeeService.getDutyEmployee(xlbm, fcrq+"00:00", fcrq+"23:59");
2339   - try {
2340   - Long fcsj1=sdf.parse(fcrq+" 03:00").getTime();
2341   - Long fcsj2=sdf.parse(fcrq+" 11:00").getTime();
2342   - Long fcsj3=sdf.parse(fcrq+" 22:00").getTime();
2343   - for(int i=0;i<list.size();i++){
2344   - DutyEmployee t=list.get(i);
2345   - Long ts=t.getTs();
2346   - if(ts>fcsj1&&ts<fcsj2){
2347   - if(zdp.indexOf(t.getuName())==-1){
2348   - zdp +=t.getuName()+",";
2349   - }
2350   - }else if(ts>fcsj2 && ts<fcsj3){
2351   - if(zwdp.indexOf(t.getuName())==-1){
2352   - zwdp +=t.getuName()+",";
2353   - }
2354   - }else{
2355   - if(wdp.indexOf(t.getuName())==-1){
2356   - wdp +=t.getuName()+",";
2357 2365 }
  2366 + } catch (ParseException e) {
  2367 + // TODO Auto-generated catch block
  2368 + e.printStackTrace();
2358 2369 }
2359   - }
2360   - } catch (ParseException e) {
2361   - // TODO Auto-generated catch block
2362   - e.printStackTrace();
2363   - }
2364   - map.put("zdp", zdp);
2365   - map.put("zwdp", zwdp);
2366   - map.put("wdp", wdp);
2367   - return map;
  2370 + map.put("zdp", zdp);
  2371 + map.put("zwdp", zwdp);
  2372 + map.put("wdp", wdp);
  2373 + return map;
2368 2374 }
2369 2375  
2370   -}
  2376 +}
2371 2377 \ No newline at end of file
... ...
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
... ... @@ -17,6 +17,7 @@ import java.util.List;
17 17 import java.util.Map;
18 18 import java.util.Set;
19 19  
  20 +import org.drools.compiler.lang.DRL5Expressions.type_return;
20 21 import org.springframework.beans.factory.annotation.Autowired;
21 22 import org.springframework.jdbc.core.JdbcTemplate;
22 23 import org.springframework.jdbc.core.RowMapper;
... ... @@ -1012,6 +1013,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1012 1013 String line = map.get("line").toString();
1013 1014 String date = map.get("date").toString();
1014 1015 String code = map.get("code").toString();
  1016 + String type = map.get("type").toString();
1015 1017  
1016 1018 if(date.length() == 0)
1017 1019 date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
... ... @@ -1042,8 +1044,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1042 1044 if(company.length() != 0){
1043 1045 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
1044 1046 }
1045   - sql += " order by fcsj";
1046   -
  1047 + sql += " order by xl_name, fcsj";
  1048 +
1047 1049 list = jdbcTemplate.query(sql,
1048 1050 new RowMapper<Map<String, Object>>(){
1049 1051 @Override
... ... @@ -1072,8 +1074,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1072 1074 e.printStackTrace();
1073 1075 }
1074 1076  
  1077 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1078 + List<String> keyList = new ArrayList<String>();
1075 1079 for(Map<String, Object> m : list){
1076 1080 String key = m.get("line") + "/" + m.get("clZbh") + "/" + m.get("jGh") + "/" + m.get("jName");
  1081 + if(!keyList.contains(m.get("line").toString())){
  1082 + keyList.add(m.get("line").toString());
  1083 + }
1077 1084 if(!keyMap.containsKey(key))
1078 1085 keyMap.put(key, new ArrayList<Map<String, Object>>());
1079 1086 keyMap.get(key).add(m);
... ... @@ -1120,7 +1127,58 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1120 1127 tempMap.put("sjf", sjf);
1121 1128 tempMap.put("wqr", wqr);
1122 1129 tempMap.put("workList", keyMap.get(key));
1123   - resList.add(tempMap);
  1130 + tempList.add(tempMap);
  1131 + }
  1132 +
  1133 + for(String key : keyList){
  1134 + for(Map<String, Object> m : tempList){
  1135 + if(key.equals(m.get("line").toString())){
  1136 + resList.add(m);
  1137 + }
  1138 + }
  1139 + }
  1140 +
  1141 + if(type.equals("export")){
  1142 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1143 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1144 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1145 + Map<String,Object> m = new HashMap<String, Object>();
  1146 + ReportUtils ee = new ReportUtils();
  1147 + try {
  1148 + listI.add(resList.iterator());
  1149 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1150 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\commandState.xls",
  1151 + path+"export\\指令状态分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1152 + } catch (Exception e) {
  1153 + // TODO: handle exception
  1154 + e.printStackTrace();
  1155 + }
  1156 + }
  1157 +
  1158 + if(type.equals("export1")){
  1159 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1160 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1161 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1162 + Map<String,Object> m = new HashMap<String, Object>();
  1163 + ReportUtils ee = new ReportUtils();
  1164 + String jsy = map.get("jsy").toString();
  1165 + try {
  1166 + for(Map<String, Object> map1 : resList){
  1167 + if(jsy.equals(map1.get("jsy").toString())){
  1168 + List<Map<String, Object>> temp = (List<Map<String, Object>>)map1.get("workList");
  1169 + listI.add(temp.iterator());
  1170 + m.put("detail", "日期:" + map1.get("date") + " 公司:" + map1.get("company")
  1171 + + " 分公司:" + map1.get("subCompany") + " 线路:" + map1.get("line")
  1172 + + " 车辆:" + map1.get("clZbh") + " 人员:" + map1.get("jsy"));
  1173 + }
  1174 + }
  1175 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1176 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\commandState1.xls",
  1177 + path+"export\\指令状态明细" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1178 + } catch (Exception e) {
  1179 + // TODO: handle exception
  1180 + e.printStackTrace();
  1181 + }
1124 1182 }
1125 1183  
1126 1184 return resList;
... ...
src/main/resources/datatools/ktrs/ttinfodetailDataInput.ktr
... ... @@ -137,6 +137,48 @@
137 137 <bordercolorblue>100</bordercolorblue>
138 138 <drawshadow>Y</drawshadow>
139 139 </notepad>
  140 + <notepad>
  141 + <note>&#x51fa;&#x573a;&#x73ed;&#x6b21;&#xff0c;&#x65b9;&#x5411;&#x6709;&#x65f6;&#x786e;&#x5b9a;&#x4e0d;&#x51c6;&#xff0c;&#xa;&#x7a7a;&#x7684;&#x60c5;&#x51b5;&#x4e0b;&#x8bbe;&#x5b9a;&#x4e3a;0&#xff08;&#x4e0a;&#x884c;&#xff09;</note>
  142 + <xloc>120</xloc>
  143 + <yloc>1016</yloc>
  144 + <width>178</width>
  145 + <heigth>42</heigth>
  146 + <fontname>YaHei Consolas Hybrid</fontname>
  147 + <fontsize>12</fontsize>
  148 + <fontbold>N</fontbold>
  149 + <fontitalic>N</fontitalic>
  150 + <fontcolorred>0</fontcolorred>
  151 + <fontcolorgreen>0</fontcolorgreen>
  152 + <fontcolorblue>0</fontcolorblue>
  153 + <backgroundcolorred>255</backgroundcolorred>
  154 + <backgroundcolorgreen>205</backgroundcolorgreen>
  155 + <backgroundcolorblue>112</backgroundcolorblue>
  156 + <bordercolorred>100</bordercolorred>
  157 + <bordercolorgreen>100</bordercolorgreen>
  158 + <bordercolorblue>100</bordercolorblue>
  159 + <drawshadow>Y</drawshadow>
  160 + </notepad>
  161 + <notepad>
  162 + <note>&#x8fdb;&#x573a;&#x73ed;&#x6b21;&#xff0c;&#x65b9;&#x5411;&#x6709;&#x65f6;&#x786e;&#x5b9a;&#x4e0d;&#x51c6;&#xff0c;&#xa;&#x7a7a;&#x7684;&#x60c5;&#x51b5;&#x4e0b;&#x8bbe;&#x5b9a;&#x4e3a;0&#xff08;&#x4e0a;&#x884c;&#xff09;</note>
  163 + <xloc>578</xloc>
  164 + <yloc>1084</yloc>
  165 + <width>178</width>
  166 + <heigth>42</heigth>
  167 + <fontname>YaHei Consolas Hybrid</fontname>
  168 + <fontsize>12</fontsize>
  169 + <fontbold>N</fontbold>
  170 + <fontitalic>N</fontitalic>
  171 + <fontcolorred>0</fontcolorred>
  172 + <fontcolorgreen>0</fontcolorgreen>
  173 + <fontcolorblue>0</fontcolorblue>
  174 + <backgroundcolorred>255</backgroundcolorred>
  175 + <backgroundcolorgreen>205</backgroundcolorgreen>
  176 + <backgroundcolorblue>112</backgroundcolorblue>
  177 + <bordercolorred>100</bordercolorred>
  178 + <bordercolorgreen>100</bordercolorgreen>
  179 + <bordercolorblue>100</bordercolorblue>
  180 + <drawshadow>Y</drawshadow>
  181 + </notepad>
140 182 </notepads>
141 183 <connection>
142 184 <name>bus_control_variable</name>
... ... @@ -342,10 +384,12 @@
342 384 <hop> <from>&#x67e5;&#x627e;&#x8fdb;&#x573a;&#x73ed;&#x6b21;&#x4e0a;&#x4e00;&#x4e2a;&#x73ed;&#x6b21;&#x7684;&#x7ec8;&#x70b9;&#x7ad9;&#xff0c;&#x5e76;&#x4f5c;&#x4e3a;&#x8fdb;&#x573a;&#x73ed;&#x6b21;&#x7684;&#x8d77;&#x70b9;&#x7ad9;</from><to>&#x67e5;&#x627e;&#x8fdb;&#x573a;&#x8d77;&#x70b9;&#x7ad9;&#x5173;&#x8054;&#x786e;&#x5b9a;&#x4e0a;&#x4e0b;&#x884c;</to><enabled>Y</enabled> </hop>
343 385 <hop> <from>&#x67e5;&#x627e;&#x8fdb;&#x573a;&#x8d77;&#x70b9;&#x7ad9;&#x5173;&#x8054;&#x786e;&#x5b9a;&#x4e0a;&#x4e0b;&#x884c;</from><to>&#x4e0a;&#x4e0b;&#x884c;&#x5b57;&#x5178; 3</to><enabled>Y</enabled> </hop>
344 386 <hop> <from>&#x67e5;&#x627e;&#x7ebf;&#x8def;&#x51fa;&#x573a;&#x91cc;&#x7a0b;&#x65f6;&#x95f4;</from><to>&#x5339;&#x914d;&#x51fa;&#x573a;&#x73ed;&#x6b21;&#x91cc;&#x7a0b;&#x65f6;&#x95f4;</to><enabled>Y</enabled> </hop>
345   - <hop> <from>&#x5339;&#x914d;&#x51fa;&#x573a;&#x73ed;&#x6b21;&#x91cc;&#x7a0b;&#x65f6;&#x95f4;</from><to>&#x7c7b;&#x578b;&#x4fee;&#x6b63; 2</to><enabled>Y</enabled> </hop>
346   - <hop> <from>&#x7c7b;&#x578b;&#x4fee;&#x6b63; 2</from><to>&#x63d2;&#x5165;&#x2f;&#x66f4;&#x65b0;bsth_c_s_ttinfo_detail 2</to><enabled>Y</enabled> </hop>
347 387 <hop> <from>&#x67e5;&#x627e;&#x7ebf;&#x8def;&#x8fdb;&#x573a;&#x91cc;&#x7a0b;&#x65f6;&#x95f4;</from><to>&#x5339;&#x914d;&#x8fdb;&#x573a;&#x73ed;&#x6b21;&#x91cc;&#x7a0b;&#x65f6;&#x95f4;</to><enabled>Y</enabled> </hop>
348   - <hop> <from>&#x5339;&#x914d;&#x8fdb;&#x573a;&#x73ed;&#x6b21;&#x91cc;&#x7a0b;&#x65f6;&#x95f4;</from><to>&#x7c7b;&#x578b;&#x4fee;&#x6b63; 3</to><enabled>Y</enabled> </hop>
  388 + <hop> <from>&#x5339;&#x914d;&#x51fa;&#x573a;&#x73ed;&#x6b21;&#x91cc;&#x7a0b;&#x65f6;&#x95f4;</from><to>&#x4e0a;&#x4e0b;&#x884c;NULL&#x5224;&#x5b9a;</to><enabled>Y</enabled> </hop>
  389 + <hop> <from>&#x4e0a;&#x4e0b;&#x884c;NULL&#x5224;&#x5b9a;</from><to>&#x7c7b;&#x578b;&#x4fee;&#x6b63; 2</to><enabled>Y</enabled> </hop>
  390 + <hop> <from>&#x7c7b;&#x578b;&#x4fee;&#x6b63; 2</from><to>&#x63d2;&#x5165;&#x2f;&#x66f4;&#x65b0;bsth_c_s_ttinfo_detail 2</to><enabled>Y</enabled> </hop>
  391 + <hop> <from>&#x5339;&#x914d;&#x8fdb;&#x573a;&#x73ed;&#x6b21;&#x91cc;&#x7a0b;&#x65f6;&#x95f4;</from><to>&#x4e0a;&#x4e0b;&#x884c;&#x5224;&#x5b9a; 2</to><enabled>Y</enabled> </hop>
  392 + <hop> <from>&#x4e0a;&#x4e0b;&#x884c;&#x5224;&#x5b9a; 2</from><to>&#x7c7b;&#x578b;&#x4fee;&#x6b63; 3</to><enabled>Y</enabled> </hop>
349 393 <hop> <from>&#x7c7b;&#x578b;&#x4fee;&#x6b63; 3</from><to>&#x63d2;&#x5165;&#x2f;&#x66f4;&#x65b0;bsth_c_s_ttinfo_detail 3</to><enabled>Y</enabled> </hop>
350 394 </order>
351 395 <step>
... ... @@ -1051,8 +1095,8 @@
1051 1095 </lookup>
1052 1096 <cluster_schema/>
1053 1097 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
1054   - <xloc>342</xloc>
1055   - <yloc>1031</yloc>
  1098 + <xloc>340</xloc>
  1099 + <yloc>1087</yloc>
1056 1100 <draw>Y</draw>
1057 1101 </GUI>
1058 1102 </step>
... ... @@ -1172,8 +1216,8 @@
1172 1216 </lookup>
1173 1217 <cluster_schema/>
1174 1218 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
1175   - <xloc>875</xloc>
1176   - <yloc>887</yloc>
  1219 + <xloc>845</xloc>
  1220 + <yloc>899</yloc>
1177 1221 <draw>Y</draw>
1178 1222 </GUI>
1179 1223 </step>
... ... @@ -2450,10 +2494,25 @@
2450 2494 <grouping_symbol/>
2451 2495 <currency_symbol/>
2452 2496 <storage_type/>
  2497 + </meta> <meta> <name>sxx</name>
  2498 + <rename>sxx</rename>
  2499 + <type>Integer</type>
  2500 + <length>-2</length>
  2501 + <precision>-2</precision>
  2502 + <conversion_mask/>
  2503 + <date_format_lenient>false</date_format_lenient>
  2504 + <date_format_locale/>
  2505 + <date_format_timezone/>
  2506 + <lenient_string_to_number>false</lenient_string_to_number>
  2507 + <encoding/>
  2508 + <decimal_symbol/>
  2509 + <grouping_symbol/>
  2510 + <currency_symbol/>
  2511 + <storage_type/>
2453 2512 </meta> </fields> <cluster_schema/>
2454 2513 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
2455 2514 <xloc>338</xloc>
2456   - <yloc>949</yloc>
  2515 + <yloc>1008</yloc>
2457 2516 <draw>Y</draw>
2458 2517 </GUI>
2459 2518 </step>
... ... @@ -2500,10 +2559,25 @@
2500 2559 <grouping_symbol/>
2501 2560 <currency_symbol/>
2502 2561 <storage_type/>
  2562 + </meta> <meta> <name>sxx2</name>
  2563 + <rename>sxx2</rename>
  2564 + <type>Integer</type>
  2565 + <length>-2</length>
  2566 + <precision>-2</precision>
  2567 + <conversion_mask/>
  2568 + <date_format_lenient>false</date_format_lenient>
  2569 + <date_format_locale/>
  2570 + <date_format_timezone/>
  2571 + <lenient_string_to_number>false</lenient_string_to_number>
  2572 + <encoding/>
  2573 + <decimal_symbol/>
  2574 + <grouping_symbol/>
  2575 + <currency_symbol/>
  2576 + <storage_type/>
2503 2577 </meta> </fields> <cluster_schema/>
2504 2578 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
2505   - <xloc>875</xloc>
2506   - <yloc>1001</yloc>
  2579 + <xloc>847</xloc>
  2580 + <yloc>1003</yloc>
2507 2581 <draw>Y</draw>
2508 2582 </GUI>
2509 2583 </step>
... ... @@ -2667,10 +2741,78 @@
2667 2741 </GUI>
2668 2742 </step>
2669 2743  
  2744 + <step>
  2745 + <name>&#x4e0a;&#x4e0b;&#x884c;NULL&#x5224;&#x5b9a;</name>
  2746 + <type>IfNull</type>
  2747 + <description/>
  2748 + <distribute>Y</distribute>
  2749 + <custom_distribution/>
  2750 + <copies>1</copies>
  2751 + <partitioning>
  2752 + <method>none</method>
  2753 + <schema_name/>
  2754 + </partitioning>
  2755 + <replaceAllByValue/>
  2756 + <replaceAllMask/>
  2757 + <selectFields>Y</selectFields>
  2758 + <selectValuesType>N</selectValuesType>
  2759 + <setEmptyStringAll>N</setEmptyStringAll>
  2760 + <valuetypes>
  2761 + </valuetypes>
  2762 + <fields>
  2763 + <field>
  2764 + <name>sxx</name>
  2765 + <value>0</value>
  2766 + <mask/>
  2767 + <set_empty_string>N</set_empty_string>
  2768 + </field>
  2769 + </fields>
  2770 + <cluster_schema/>
  2771 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  2772 + <xloc>230</xloc>
  2773 + <yloc>946</yloc>
  2774 + <draw>Y</draw>
  2775 + </GUI>
  2776 + </step>
  2777 +
  2778 + <step>
  2779 + <name>&#x4e0a;&#x4e0b;&#x884c;&#x5224;&#x5b9a; 2</name>
  2780 + <type>IfNull</type>
  2781 + <description/>
  2782 + <distribute>Y</distribute>
  2783 + <custom_distribution/>
  2784 + <copies>1</copies>
  2785 + <partitioning>
  2786 + <method>none</method>
  2787 + <schema_name/>
  2788 + </partitioning>
  2789 + <replaceAllByValue/>
  2790 + <replaceAllMask/>
  2791 + <selectFields>Y</selectFields>
  2792 + <selectValuesType>N</selectValuesType>
  2793 + <setEmptyStringAll>N</setEmptyStringAll>
  2794 + <valuetypes>
  2795 + </valuetypes>
  2796 + <fields>
  2797 + <field>
  2798 + <name>sxx2</name>
  2799 + <value>0</value>
  2800 + <mask/>
  2801 + <set_empty_string>N</set_empty_string>
  2802 + </field>
  2803 + </fields>
  2804 + <cluster_schema/>
  2805 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  2806 + <xloc>804</xloc>
  2807 + <yloc>1081</yloc>
  2808 + <draw>Y</draw>
  2809 + </GUI>
  2810 + </step>
  2811 +
2670 2812 <step_error_handling>
2671 2813 <error>
2672 2814 <source_step>&#x63d2;&#x5165;&#x2f;&#x66f4;&#x65b0;bsth_c_s_ttinfo_detail</source_step>
2673   - <target_step>Excel&#x8f93;&#x51fa;</target_step>
  2815 + <target_step/>
2674 2816 <is_enabled>Y</is_enabled>
2675 2817 <nr_valuename>c1</nr_valuename>
2676 2818 <descriptions_valuename>c2</descriptions_valuename>
... ...
src/main/resources/static/pages/forms/mould/account.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/allline.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/commandState.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/commandState1.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/correctForm.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/daily.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/historyMessage.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/message.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/commandState.html
... ... @@ -50,7 +50,7 @@
50 50 </div>
51 51 <div class="form-group" style="margin-left: 9px">
52 52 <input class="btn btn-default" type="button" id="query" value="筛选"/>
53   -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
  53 + <input class="btn btn-default" type="button" id="export" value="导出"/>
54 54 </div>
55 55 </form>
56 56 </div>
... ... @@ -74,16 +74,23 @@
74 74  
75 75 </tbody>
76 76 </table>
  77 + <div id="box">&nbsp;</div>
77 78 <div id="works_hidden" class="hidden">
78 79 <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
79 80 <span class="item-label" style="width: 80px;margin-left: 60px;">日期 </span>
80 81 <span class="item-label" style="width: 80px;" id="date1"></span>
  82 + <span class="item-label" style="width: 80px;margin-left: 60px;">公司 </span>
  83 + <span class="item-label" style="width: 80px;" id="company2"></span>
  84 + <span class="item-label" style="width: 80px;margin-left: 60px;">分公司 </span>
  85 + <span class="item-label" style="width: 80px;" id="subCompany2"></span>
81 86 <span class="item-label" style="width: 80px;margin-left: 60px;">线路 </span>
82 87 <span class="item-label" style="width: 80px;" id="line1"></span>
83 88 <span class="item-label" style="width: 80px;margin-left: 60px;">车辆 </span>
84 89 <span class="item-label" style="width: 80px;" id="clZbh1"></span>
85 90 <span class="item-label" style="width: 80px;margin-left: 60px;">人员 </span>
86 91 <span class="item-label" style="width: 80px;" id="jsy1"></span>
  92 + <span class="item-label" style="width: 80px;margin-left: 60px;"></span>
  93 + <input class="btn btn-default" type="button" id="export1" value="导出当前明细"/>
87 94 </div>
88 95 <table class="table table-bordered table-hover table-checkable" id="works">
89 96 <thead>
... ... @@ -112,6 +119,7 @@
112 119  
113 120 <script>
114 121 $(function(){
  122 + $('#export').attr('disabled', "true");
115 123 var list;
116 124  
117 125 // 关闭左侧栏
... ... @@ -136,7 +144,7 @@
136 144 $.get('/basic/lineCode2Name',function(result){
137 145 var data=[];
138 146  
139   - data.push({id: "", text: "全部线路"});
  147 + data.push({id: " ", text: "全部线路"});
140 148 for(var code in result){
141 149 data.push({id: code, text: result[code]});
142 150 }
... ... @@ -217,16 +225,26 @@
217 225  
218 226 $("#query").on("click",jsDoQuery);
219 227  
  228 + var line = "";
  229 + var date = $("#date").val();
  230 + var code = $("#code").val();
  231 + var company = $("#company").val();
  232 + var subCompany = $("#subCompany").val();
220 233 function jsDoQuery(pagination){
221 234 var params = {};
222   - var line = $("#line").val();
223   - if(line = " ")
  235 + line = $("#line").val();
  236 + if(line == " ")
224 237 line = "";
  238 + date = $("#date").val();
  239 + code = $("#code").val();
  240 + company = $("#company").val();
  241 + subCompany = $("#subCompany").val();
225 242 params['line'] = line;
226   - params['date'] = $("#date").val();
227   - params['code'] = $("#code").val();
228   - params['company'] = $("#company").val();
229   - params['subCompany'] = $("#subCompany").val();
  243 + params['date'] = date;
  244 + params['code'] = code;
  245 + params['type'] = "query";
  246 + params['company'] = company;
  247 + params['subCompany'] = subCompany;
230 248 $("#forms .hidden").removeClass("hidden");
231 249 $get('/pcpc/commandState', params, function(result){
232 250 // 把数据填充到模版中
... ... @@ -235,29 +253,69 @@
235 253 // 把渲染好的模版html文本追加到表格中
236 254 $('#forms tbody').html(tbodyHtml);
237 255  
  256 + if(result.length == 0){
  257 + $('#export').attr('disabled', "true");
  258 + } else {
  259 + $("#export").removeAttr("disabled");
  260 + }
  261 +
  262 + $("#works_hidden").removeClass("hidden");
  263 + $("#works .hidden").removeClass("hidden");
  264 + $("#works_hidden").addClass("hidden");
  265 + $("#works").addClass("hidden");
  266 +
238 267 });
239 268 }
240 269  
241 270 $("#export").on("click",function(){
242   - $('#forms').tableExport({ type: 'excel', escape: 'false',filename:'(2016-02-29_2016-03-06)'});
  271 + var params = {};
  272 + params['line'] = line;
  273 + params['date'] = date;
  274 + params['code'] = code;
  275 + params['type'] = "export";
  276 + params['company'] = company;
  277 + params['subCompany'] = subCompany;
  278 + $get('/pcpc/commandState', params, function(result){
  279 + window.open("/downloadFile/download?fileName=指令状态分析"+moment(date).format("YYYYMMDD"));
  280 + });
243 281 });
244 282  
  283 + var jsy = "";
245 284 $("#forms tbody").on("click","a",function(){
246   - var jsy = $(this).html();
  285 + jsy = $(this).html();
247 286 $.each(list, function(i, g){
248 287 if(jsy == g.jsy){
249 288 $("#date1").html(g.date);
250 289 $("#line1").html(g.line);
251 290 $("#clZbh1").html(g.clZbh);
252 291 $("#jsy1").html(g.jsy);
  292 + $("#company2").html(g.company);
  293 + $("subCompany2").html(g.subCompany);
253 294 $("#works_hidden").removeClass("hidden");
254   - $("#works .hidden").removeClass("hidden");
  295 + $("#works").removeClass("hidden");
255 296 // 把数据填充到模版中
256 297 var tbodyHtml = template('list_workList',{list:g.workList});
257 298 // 把渲染好的模版html文本追加到表格中
258 299 $('#works tbody').html(tbodyHtml);
259 300 }
260 301 });
  302 +
  303 + $("html,body").animate({scrollTop:$("#box").offset().top},1000);
  304 +
  305 + });
  306 +
  307 + $("#export1").on("click",function(){
  308 + var params = {};
  309 + params['jsy'] = jsy;
  310 + params['line'] = line;
  311 + params['date'] = date;
  312 + params['code'] = code;
  313 + params['type'] = "export1";
  314 + params['company'] = company;
  315 + params['subCompany'] = subCompany;
  316 + $get('/pcpc/commandState', params, function(result){
  317 + window.open("/downloadFile/download?fileName=指令状态明细"+moment(date).format("YYYYMMDD"));
  318 + });
261 319 });
262 320  
263 321  
... ...
src/main/resources/static/pages/forms/statement/correctForm.html
... ... @@ -49,7 +49,7 @@
49 49 </div>
50 50 <div class="form-group">
51 51 <input class="btn btn-default" type="button" id="query" value="筛选"/>
52   -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
  52 + <input class="btn btn-default" type="button" id="export" value="导出"/>
53 53 </div>
54 54 </form>
55 55 </div>
... ...
src/main/resources/static/pages/forms/statement/historyMessage.html
... ... @@ -139,7 +139,7 @@
139 139 code = $("#code").val();
140 140 var type = "query";
141 141 $(".hidden").removeClass("hidden");
142   - $get('/realSchedule/historyMessage',{line:line,date:date,code:code},function(result){
  142 + $get('/realSchedule/historyMessage',{line:line,date:date,code:code,type:type},function(result){
143 143 // 把数据填充到模版中
144 144 var tbodyHtml = template('list_history',{list:result});
145 145 // 把渲染好的模版html文本追加到表格中
... ...
src/main/resources/static/pages/forms/statement/waybillQp.html
... ... @@ -342,7 +342,7 @@
342 342 <td>{{map.jhbc}}</td>
343 343 <td colspan="2">进出场公里</td>
344 344 <td>{{map.jcclc}}</td>
345   - <td >临加公里</td>
  345 + <td >加车公里</td>
346 346 <td>{{map.ljgl}}</td>
347 347 <td colspan="2">损失班次</td>
348 348 <td colspan="1">{{map.ssbc}}</td>
... ... @@ -355,7 +355,7 @@
355 355 <td>{{map.sjbc}}</td>
356 356 <td colspan="2">总公里</td>
357 357 <td>{{map.zgl}}</td>
358   - <td >临加班次</td>
  358 + <td >加车班次</td>
359 359 <td>{{map.ljbc}}</td>
360 360  
361 361 <td colspan="3"></td>
... ...
src/main/resources/static/pages/report/message/message.html
... ... @@ -41,7 +41,7 @@
41 41 </div>
42 42 <div class="form-group" style="display: inline-block;margin-left: 15px;">
43 43 <input class="btn btn-default" type="button" id="query" value="查询"/>
44   -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
  44 + <input class="btn btn-default" type="button" id="export" value="导出"/>
45 45 <input class="btn btn-default" type="button" id="print" value="打印"/>
46 46 <!-- <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/> -->
47 47 </div>
... ... @@ -73,7 +73,7 @@
73 73 <tr class="hidden">
74 74 <th>序号</th>
75 75 <th>线路</th>
76   - <th>路牌</th>
  76 +<!-- <th>路牌</th> -->
77 77 <th>运营车辆</th>
78 78 <th>发送人</th>
79 79 <th>发送时间</th>
... ... @@ -93,7 +93,11 @@
93 93 </div>
94 94  
95 95 <script>
96   - $(function(){
  96 + $(function(){
  97 + $('#print').attr('disabled', "true");
  98 + $('#export').attr('disabled', "true");
  99 + $('#printArea').hide();
  100 +
97 101 // 关闭左侧栏
98 102 if (!$('body').hasClass('page-sidebar-closed'))
99 103 $('.menu-toggler.sidebar-toggler').click();
... ... @@ -106,11 +110,11 @@
106 110 var year = d.getFullYear();
107 111 var month = d.getMonth() + 1;
108 112 var day = d.getDate();
109   - if(month > 9){
110   - $("#date").val(year + "-" + month + "-" + day);
111   - } else {
112   - $("#date").val(year + "-0" + month + "-" + day);
113   - }
  113 + if(month < 9)
  114 + month = "0" + month;
  115 + if(day < 9)
  116 + day = "0" + day;
  117 + $("#date").val(year + "-" + month + "-" + day);
114 118  
115 119 $.get('/basic/lineCode2Name',function(result){
116 120 var data=[];
... ... @@ -161,17 +165,23 @@
161 165 }
162 166 });
163 167  
164   - var date = '';
  168 + var date = '';
  169 + var line = $("#line").val();
165 170 $("#query").on("click",function(){
166   - var line = $("#line").val();
  171 + line = $("#line").val();
167 172 date = $("#date").val();
168   - var code=$("#code").val();
  173 + var code = $("#code").val();
169 174 $(".hidden").removeClass("hidden");
170 175 $get('/report/historyMessageCount',{line:line,date:date,code:code},function(result){
171 176 // 把数据填充到模版中
172 177 var tbodyHtml = template('list_msg_info',{list:result});
173 178 // 把渲染好的模版html文本追加到表格中
174   - $('#info_msg tbody').html(tbodyHtml);
  179 + $('#info_msg tbody').html(tbodyHtml);
  180 +
  181 + $('#print').attr('disabled', "true");
  182 + $('#export').attr('disabled', "true");
  183 + $('#printArea').hide();
  184 +
175 185 });
176 186 });
177 187  
... ... @@ -185,21 +195,28 @@
185 195 params[index] = $(this).text();
186 196 });
187 197 jName = params[1];
188   - var line = $("#line").val();
  198 + line = $("#line").val();
189 199 date = $("#date").val();
190   - $get('/realSchedule/historyMessage',{line:line,date:date,code:jName},function(result){
  200 + $get('/realSchedule/historyMessage',{line:line,date:date,code:jName,type:"query"},function(result){
191 201 var list_history_msg = template('list_history_msg',{list:result});
192 202 // 把渲染好的模版html文本追加到表格中
193   - $('#forms tbody').html(list_history_msg);
  203 + $('#forms tbody').html(list_history_msg);
  204 +
  205 + if(result.length == 0){
  206 + $('#export').attr('disabled', "true");
  207 + $('#print').attr('disabled', "true");
  208 + } else {
  209 + $("#export").removeAttr("disabled");
  210 + $("#print").removeAttr("disabled");
  211 + }
  212 + $('#printArea').show();
  213 +
194 214 });
195 215 });
196 216  
197 217 $("#export").on("click",function(){
198   - if(params.length < 1){
199   - return;
200   - }
201   - $post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){
202   - window.open("/downloadFile/download?fileName="+jName);
  218 + $get('/realSchedule/historyMessage',{line:line,date:date,code:jName,type:"export_msg"},function(result){
  219 + window.open("/downloadFile/download?fileName=调度消息分析"+moment(date).format("YYYYMMDD"));
203 220 });
204 221 });
205 222  
... ... @@ -236,7 +253,7 @@
236 253 <tr>
237 254 <td>{{i+1}}</td>
238 255 <td>{{obj[4]}}</td>
239   - <td>{{obj[6]}}</td>
  256 + <!--<td>{{obj[6]}}</td>-->
240 257 <td>{{obj[0]}}</td>
241 258 <td>{{obj[1]}}</td>
242 259 <td>{{obj[3]}}</td>
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroup.js
... ... @@ -29,7 +29,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
29 29 bindToController: true,
30 30 controller: function($scope) {
31 31 var self = this;
32   - self.$$data = []; // 选择线路后,该线路的人员配置数据
  32 + self.$$dataReal = []; // 选择线路后,该线路的人员配置数据
  33 + self.$$data = []; // 页面最多显示10条,可以通过$$searchText筛选
33 34  
34 35 // 测试数据
35 36 //self.$$data = [
... ... @@ -38,6 +39,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
38 39 // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}
39 40 //];
40 41  
  42 + self.$$searchText = undefined; // 搜索值
41 43 self.$$dataSelected = []; // 选中的人员配置列表
42 44 self.$$dataSelectedStart = undefined; // 起始人员配置
43 45  
... ... @@ -118,6 +120,48 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
118 120 scope[ctrlAs]["$name_attr"] = $name_attr;
119 121 }
120 122  
  123 + // 监听搜索框,keydwon,keyup事件
  124 + tElem.on('keydown', '[name=rysearch]', function(event) {
  125 + if (event.keyCode == 13) { // 阻止回车事件造成的form提交
  126 + return false;
  127 + }
  128 + });
  129 + tElem.on('keyup', '[name=rysearch]', function() {
  130 + console.log(scope[ctrlAs]["$$searchText"]);
  131 + var sText = scope[ctrlAs]["$$searchText"];
  132 + if (sText && sText != "") {
  133 + // 因为在dom事件里修改了model的值,必须写在scope.$apply中,否则页面上绑定效果无
  134 + // 另一种做法可以写在$watch方法中
  135 + scope.$apply(function() {
  136 + scope[ctrlAs].$$data = [];
  137 + for (var k = 0; k < scope[ctrlAs].$$dataReal.length; k++) {
  138 + var upTerm = sText.toUpperCase();
  139 + if (scope[ctrlAs].$$data.length < 10) {
  140 + if (scope[ctrlAs].$$dataReal[k].$fullChars.indexOf(upTerm) != -1
  141 + || scope[ctrlAs].$$dataReal[k].$camelChars.indexOf(upTerm) != -1
  142 + || scope[ctrlAs].$$dataReal[k].$str.indexOf(upTerm) != -1) {
  143 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[k]);
  144 + }
  145 + } else {
  146 + break;
  147 + }
  148 + }
  149 + });
  150 + } else {
  151 + scope.$apply(function() {
  152 + scope[ctrlAs].$$data = [];
  153 + for (var i = 0; i < scope[ctrlAs].$$dataReal.length; i++) {
  154 + if (scope[ctrlAs].$$data.length < 10) {
  155 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[i]);
  156 + } else {
  157 + break;
  158 + }
  159 + }
  160 + });
  161 + }
  162 + });
  163 +
  164 +
121 165 /**
122 166 * 人员配置列表点击(人员配置列表中选中路牌)
123 167 * @param $index
... ... @@ -573,15 +617,37 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
573 617 // 获取值了
574 618 console.log("人员配置获取了");
575 619  
576   - scope[ctrlAs].$$data = [];
577   - for (var i = 0; i < result.content.length; i++) {
578   - scope[ctrlAs].$$data.push({
579   - id: result.content[i].id,
580   - dbbm: result.content[i].dbbm,
581   - jsy: result.content[i].jsy.personnelName,
582   - spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName
  620 + scope[ctrlAs].$$dataReal = [];
  621 + angular.forEach(result.content, function(obj) {
  622 + var n1 = obj.jsy == null ? "" : (obj.jsy.personnelName || "");
  623 + var n2 = obj.spy == null ? "" : (obj.spy.personnelName || "");
  624 + var c1 = obj.jsy == null ? "" : (obj.jsy.jobCode || "");
  625 + var c2 = obj.spy == null ? "" : (obj.spy.jobCode || "");
  626 + var str = [];
  627 + str.push(n1);
  628 + str.push(n2);
  629 + str.push(c1);
  630 + str.push(c2);
  631 + this.push({
  632 + id: obj.id,
  633 + dbbm: obj.dbbm,
  634 + jsy: n1,
  635 + spy: n2,
  636 + '$fullChars': pinyin.getFullChars(str.join("-")), // 全拼
  637 + '$camelChars': pinyin.getCamelChars(str.join("-")), // 简拼
  638 + '$str': str.join("-")
583 639 });
  640 + }, scope[ctrlAs].$$dataReal);
  641 +
  642 + scope[ctrlAs].$$data = [];
  643 + for (var i = 0; i < scope[ctrlAs].$$dataReal.length; i++) {
  644 + if (scope[ctrlAs].$$data.length < 10) {
  645 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[i]);
  646 + } else {
  647 + break;
  648 + }
584 649 }
  650 +
585 651 if (scope[ctrlAs].$$data_init) {
586 652 scope[ctrlAs].$$dataSelected = [];
587 653 scope[ctrlAs].$$dataSelectedStart = undefined;
... ... @@ -591,6 +657,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
591 657 scope[ctrlAs].$$dataFBSelectedStart = undefined;
592 658  
593 659 scope[ctrlAs].$$internalmodel = undefined;
  660 +
  661 + scope[ctrlAs].$$searchText = undefined;
594 662 }
595 663 scope[ctrlAs].$$data_xl_first_init = true;
596 664 },
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroupTemplate.html
... ... @@ -72,15 +72,23 @@
72 72  
73 73 <div class="col-md-12 employee-select">
74 74 <div class="col-md-12 employee-input">
75   - <div class="col-md-9">
76   - 人员列表,共{{$saEmployeegroupCtrl.$$data.length}}组
77   -
  75 + <div class="col-md-7" style="padding-right: 0px;">
  76 + <small>
  77 + 人员列表,共{{$saEmployeegroupCtrl.$$dataReal.length}}组,筛选{{$saEmployeegroupCtrl.$$data.length}}组(最多10组)
  78 + </small>
  79 + </div>
  80 + <div class="col-md-3" style="padding-left: 0px;">
  81 + <input name="rysearch" ng-model="$saEmployeegroupCtrl.$$searchText"
  82 + type="text" class="input-sm" style="width: 120px; height: 20px; border: 1px solid #32C5D2;" placeholder="输入名字或工号..."/>
78 83 </div>
79   - <div class="checkbox col-md-3" style="min-height: 19px; color: black;">
80   - <label>
  84 +
  85 + <div class="col-md-2" style="min-height: 19px; color: black;">
  86 + <div class="col-md-5" style="padding-left: 0px; padding-right: 0px;">
81 87 <input type="checkbox" ng-model="$saEmployeegroupCtrl.$$isFB"/>
82   - 是否分班
83   - </label>
  88 + </div>
  89 + <div class="col-md-7" style="padding-left: 0px; padding-right: 0px;">
  90 + <small>分班</small>
  91 + </div>
84 92 </div>
85 93  
86 94 </div>
... ... @@ -109,8 +117,11 @@
109 117 <!-- 不分班 -->
110 118 <div class="col-md-12 employee-input" ng-if="!$saEmployeegroupCtrl.$$isFB">
111 119 <div class="col-md-12">
112   - 已经选中的人员列表,共{{$saEmployeegroupCtrl.$$dataSelected.length}}组,
113   - 初始人员,{{$saEmployeegroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataSelectedStart + 1) + "组"}}
  120 + <small>
  121 + 已经选中的人员列表,共{{$saEmployeegroupCtrl.$$dataSelected.length}}组,
  122 + 初始人员,{{$saEmployeegroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataSelectedStart + 1) + "组"}}
  123 + </small>
  124 +
114 125 </div>
115 126 </div>
116 127 <div class="col-md-12 employee-select-cont" ng-if="!$saEmployeegroupCtrl.$$isFB">
... ... @@ -140,8 +151,10 @@
140 151 <!-- 分班 -->
141 152 <div class="col-md-12 employee-input" ng-if="$saEmployeegroupCtrl.$$isFB">
142 153 <div class="col-md-12">
143   - 已经选中的分班人员列表,共{{$saEmployeegroupCtrl.$$dataFBSelected.length}}组,
144   - 初始分班人员,{{$saEmployeegroupCtrl.$$dataFBSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataFBSelectedStart + 1) + "组"}}
  154 + <small>
  155 + 已经选中的分班人员列表,共{{$saEmployeegroupCtrl.$$dataFBSelected.length}}组,
  156 + 初始分班人员,{{$saEmployeegroupCtrl.$$dataFBSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataFBSelectedStart + 1) + "组"}}
  157 + </small>
145 158 </div>
146 159 </div>
147 160 <div class="col-md-12 employee-select-cont" ng-if="$saEmployeegroupCtrl.$$isFB">
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroup.js
... ... @@ -29,7 +29,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
29 29 bindToController: true,
30 30 controller: function($scope) {
31 31 var self = this;
32   - self.$$data = []; // 选择线路后,该线路的路牌数据
  32 + self.$$dataReal = []; // 选择线路后,该线路的路牌数据
  33 + self.$$data = []; // 页面最多显示10条,可以通过$$searchText筛选
33 34  
34 35 // 测试数据
35 36 //self.$$data = [
... ... @@ -38,7 +39,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
38 39 // {lpid: 3, lpname: '路3', isstart: false}
39 40 //];
40 41  
41   -
  42 + self.$$searchText = undefined; // 搜索值
42 43 self.$$dataSelected = []; // 选中的路牌列表
43 44 self.$$dataSelectedStart = undefined; // 起始路牌
44 45  
... ... @@ -100,7 +101,48 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
100 101 scope[ctrlAs]["$name_attr"] = $name_attr;
101 102 }
102 103  
103   - // TODO:
  104 + // 监听搜索框,keydwon,keyup事件
  105 + tElem.on('keydown', '[name=lpsearch]', function(event) {
  106 + if (event.keyCode == 13) { // 阻止回车事件造成的form提交
  107 + return false;
  108 + }
  109 + });
  110 + tElem.on('keyup', '[name=lpsearch]', function() {
  111 + console.log(scope[ctrlAs]["$$searchText"]);
  112 + var sText = scope[ctrlAs]["$$searchText"];
  113 + if (sText && sText != "") {
  114 + // 因为在dom事件里修改了model的值,必须写在scope.$apply中,否则页面上绑定效果无
  115 + // 另一种做法可以写在$watch方法中
  116 + scope.$apply(function() {
  117 + scope[ctrlAs].$$data = [];
  118 + for (var k = 0; k < scope[ctrlAs].$$dataReal.length; k++) {
  119 + var upTerm = sText.toUpperCase();
  120 + if (scope[ctrlAs].$$data.length < 10) {
  121 + if (scope[ctrlAs].$$dataReal[k].$fullChars.indexOf(upTerm) != -1
  122 + || scope[ctrlAs].$$dataReal[k].$camelChars.indexOf(upTerm) != -1
  123 + || scope[ctrlAs].$$dataReal[k].lpname.indexOf(upTerm) != -1) {
  124 + //scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$dataReal[k]));
  125 +
  126 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[k]);
  127 + }
  128 + } else {
  129 + break;
  130 + }
  131 + }
  132 + });
  133 + } else {
  134 + scope.$apply(function() {
  135 + scope[ctrlAs].$$data = [];
  136 + for (var i = 0; i < scope[ctrlAs].$$dataReal.length; i++) {
  137 + if (scope[ctrlAs].$$data.length < 10) {
  138 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[i]);
  139 + } else {
  140 + break;
  141 + }
  142 + }
  143 + });
  144 + }
  145 + });
104 146  
105 147  
106 148 /**
... ... @@ -272,7 +314,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
272 314 }
273 315 );
274 316  
275   -
276 317 // 监控线路id的变化
277 318 attr.$observe("xlidvalue", function(value) {
278 319 if (value && value != "") {
... ... @@ -284,18 +325,32 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
284 325 // 获取值了
285 326 console.log("路牌获取了");
286 327  
  328 + scope[ctrlAs].$$dataReal = [];
  329 + angular.forEach(result.content, function(obj) {
  330 + this.push({
  331 + lpid: obj.id,
  332 + lpname: obj.lpName,
  333 + isstart: false,
  334 + '$fullChars': pinyin.getFullChars(obj.lpName), // 全拼
  335 + '$camelChars': pinyin.getCamelChars(obj.lpName) // 简拼
  336 + });
  337 + }, scope[ctrlAs].$$dataReal);
  338 +
287 339 scope[ctrlAs].$$data = [];
288   - for (var i = 0; i < result.content.length; i++) {
289   - scope[ctrlAs].$$data.push({
290   - lpid: result.content[i].id,
291   - lpname: result.content[i].lpName,
292   - isstart: false
293   - });
  340 + for (var i = 0; i < scope[ctrlAs].$$dataReal.length; i++) {
  341 + if (scope[ctrlAs].$$data.length < 10) {
  342 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[i]);
  343 + } else {
  344 + break;
  345 + }
294 346 }
  347 +
295 348 if (scope[ctrlAs].$$data_init) {
296 349 scope[ctrlAs].$$dataSelected = [];
297 350 scope[ctrlAs].$$dataSelectedStart = undefined;
298 351 scope[ctrlAs].$$internalmodel = undefined;
  352 +
  353 + scope[ctrlAs].$$searchText = undefined;
299 354 }
300 355 scope[ctrlAs].$$data_xl_first_init = true;
301 356 },
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroupTemplate.html
... ... @@ -46,8 +46,14 @@
46 46  
47 47 <div class="col-md-12 guideboard-select">
48 48 <div class="col-md-12 guideboard-input">
49   - <div class="col-md-9">
50   - 路牌列表,共{{$saGuideboardgroupCtrl.$$data.length}}个
  49 + <div class="col-md-7" style="padding-right: 0px;">
  50 + <small>
  51 + 路牌列表,共{{$saGuideboardgroupCtrl.$$dataReal.length}}个,筛选{{$saGuideboardgroupCtrl.$$data.length}}个(最多10个)
  52 + </small>
  53 + </div>
  54 + <div class="col-md-3" style="padding-left: 0px;">
  55 + <input name="lpsearch" ng-model="$saGuideboardgroupCtrl.$$searchText"
  56 + type="text" class="input-sm" style="height: 20px; border: 1px solid #32C5D2;" placeholder="输入路牌名字..."/>
51 57 </div>
52 58 </div>
53 59 <div class="col-md-12 guideboard-select-cont">
... ... @@ -62,8 +68,10 @@
62 68 </div>
63 69 <div class="col-md-12 guideboard-input">
64 70 <div class="col-md-12">
65   - 已经选中的路牌列表,共{{$saGuideboardgroupCtrl.$$dataSelected.length}}个,
66   - 初始路牌,{{$saGuideboardgroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saGuideboardgroupCtrl.$$dataSelectedStart + 1) + "个"}}
  71 + <small>
  72 + 已经选中的路牌列表,共{{$saGuideboardgroupCtrl.$$dataSelected.length}}个,
  73 + 初始路牌,{{$saGuideboardgroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saGuideboardgroupCtrl.$$dataSelectedStart + 1) + "个"}}
  74 + </small>
67 75 </div>
68 76 </div>
69 77 <div class="col-md-12 guideboard-select-cont">
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -2234,7 +2234,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
2234 2234 bindToController: true,
2235 2235 controller: function($scope) {
2236 2236 var self = this;
2237   - self.$$data = []; // 选择线路后,该线路的路牌数据
  2237 + self.$$dataReal = []; // 选择线路后,该线路的路牌数据
  2238 + self.$$data = []; // 页面最多显示10条,可以通过$$searchText筛选
2238 2239  
2239 2240 // 测试数据
2240 2241 //self.$$data = [
... ... @@ -2243,7 +2244,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
2243 2244 // {lpid: 3, lpname: '路3', isstart: false}
2244 2245 //];
2245 2246  
2246   -
  2247 + self.$$searchText = undefined; // 搜索值
2247 2248 self.$$dataSelected = []; // 选中的路牌列表
2248 2249 self.$$dataSelectedStart = undefined; // 起始路牌
2249 2250  
... ... @@ -2305,7 +2306,48 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
2305 2306 scope[ctrlAs]["$name_attr"] = $name_attr;
2306 2307 }
2307 2308  
2308   - // TODO:
  2309 + // 监听搜索框,keydwon,keyup事件
  2310 + tElem.on('keydown', '[name=lpsearch]', function(event) {
  2311 + if (event.keyCode == 13) { // 阻止回车事件造成的form提交
  2312 + return false;
  2313 + }
  2314 + });
  2315 + tElem.on('keyup', '[name=lpsearch]', function() {
  2316 + console.log(scope[ctrlAs]["$$searchText"]);
  2317 + var sText = scope[ctrlAs]["$$searchText"];
  2318 + if (sText && sText != "") {
  2319 + // 因为在dom事件里修改了model的值,必须写在scope.$apply中,否则页面上绑定效果无
  2320 + // 另一种做法可以写在$watch方法中
  2321 + scope.$apply(function() {
  2322 + scope[ctrlAs].$$data = [];
  2323 + for (var k = 0; k < scope[ctrlAs].$$dataReal.length; k++) {
  2324 + var upTerm = sText.toUpperCase();
  2325 + if (scope[ctrlAs].$$data.length < 10) {
  2326 + if (scope[ctrlAs].$$dataReal[k].$fullChars.indexOf(upTerm) != -1
  2327 + || scope[ctrlAs].$$dataReal[k].$camelChars.indexOf(upTerm) != -1
  2328 + || scope[ctrlAs].$$dataReal[k].lpname.indexOf(upTerm) != -1) {
  2329 + //scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$dataReal[k]));
  2330 +
  2331 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[k]);
  2332 + }
  2333 + } else {
  2334 + break;
  2335 + }
  2336 + }
  2337 + });
  2338 + } else {
  2339 + scope.$apply(function() {
  2340 + scope[ctrlAs].$$data = [];
  2341 + for (var i = 0; i < scope[ctrlAs].$$dataReal.length; i++) {
  2342 + if (scope[ctrlAs].$$data.length < 10) {
  2343 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[i]);
  2344 + } else {
  2345 + break;
  2346 + }
  2347 + }
  2348 + });
  2349 + }
  2350 + });
2309 2351  
2310 2352  
2311 2353 /**
... ... @@ -2477,7 +2519,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
2477 2519 }
2478 2520 );
2479 2521  
2480   -
2481 2522 // 监控线路id的变化
2482 2523 attr.$observe("xlidvalue", function(value) {
2483 2524 if (value && value != "") {
... ... @@ -2489,18 +2530,32 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
2489 2530 // 获取值了
2490 2531 console.log("路牌获取了");
2491 2532  
  2533 + scope[ctrlAs].$$dataReal = [];
  2534 + angular.forEach(result.content, function(obj) {
  2535 + this.push({
  2536 + lpid: obj.id,
  2537 + lpname: obj.lpName,
  2538 + isstart: false,
  2539 + '$fullChars': pinyin.getFullChars(obj.lpName), // 全拼
  2540 + '$camelChars': pinyin.getCamelChars(obj.lpName) // 简拼
  2541 + });
  2542 + }, scope[ctrlAs].$$dataReal);
  2543 +
2492 2544 scope[ctrlAs].$$data = [];
2493   - for (var i = 0; i < result.content.length; i++) {
2494   - scope[ctrlAs].$$data.push({
2495   - lpid: result.content[i].id,
2496   - lpname: result.content[i].lpName,
2497   - isstart: false
2498   - });
  2545 + for (var i = 0; i < scope[ctrlAs].$$dataReal.length; i++) {
  2546 + if (scope[ctrlAs].$$data.length < 10) {
  2547 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[i]);
  2548 + } else {
  2549 + break;
  2550 + }
2499 2551 }
  2552 +
2500 2553 if (scope[ctrlAs].$$data_init) {
2501 2554 scope[ctrlAs].$$dataSelected = [];
2502 2555 scope[ctrlAs].$$dataSelectedStart = undefined;
2503 2556 scope[ctrlAs].$$internalmodel = undefined;
  2557 +
  2558 + scope[ctrlAs].$$searchText = undefined;
2504 2559 }
2505 2560 scope[ctrlAs].$$data_xl_first_init = true;
2506 2561 },
... ... @@ -2609,7 +2664,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
2609 2664 bindToController: true,
2610 2665 controller: function($scope) {
2611 2666 var self = this;
2612   - self.$$data = []; // 选择线路后,该线路的人员配置数据
  2667 + self.$$dataReal = []; // 选择线路后,该线路的人员配置数据
  2668 + self.$$data = []; // 页面最多显示10条,可以通过$$searchText筛选
2613 2669  
2614 2670 // 测试数据
2615 2671 //self.$$data = [
... ... @@ -2618,6 +2674,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
2618 2674 // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}
2619 2675 //];
2620 2676  
  2677 + self.$$searchText = undefined; // 搜索值
2621 2678 self.$$dataSelected = []; // 选中的人员配置列表
2622 2679 self.$$dataSelectedStart = undefined; // 起始人员配置
2623 2680  
... ... @@ -2698,6 +2755,48 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
2698 2755 scope[ctrlAs]["$name_attr"] = $name_attr;
2699 2756 }
2700 2757  
  2758 + // 监听搜索框,keydwon,keyup事件
  2759 + tElem.on('keydown', '[name=rysearch]', function(event) {
  2760 + if (event.keyCode == 13) { // 阻止回车事件造成的form提交
  2761 + return false;
  2762 + }
  2763 + });
  2764 + tElem.on('keyup', '[name=rysearch]', function() {
  2765 + console.log(scope[ctrlAs]["$$searchText"]);
  2766 + var sText = scope[ctrlAs]["$$searchText"];
  2767 + if (sText && sText != "") {
  2768 + // 因为在dom事件里修改了model的值,必须写在scope.$apply中,否则页面上绑定效果无
  2769 + // 另一种做法可以写在$watch方法中
  2770 + scope.$apply(function() {
  2771 + scope[ctrlAs].$$data = [];
  2772 + for (var k = 0; k < scope[ctrlAs].$$dataReal.length; k++) {
  2773 + var upTerm = sText.toUpperCase();
  2774 + if (scope[ctrlAs].$$data.length < 10) {
  2775 + if (scope[ctrlAs].$$dataReal[k].$fullChars.indexOf(upTerm) != -1
  2776 + || scope[ctrlAs].$$dataReal[k].$camelChars.indexOf(upTerm) != -1
  2777 + || scope[ctrlAs].$$dataReal[k].$str.indexOf(upTerm) != -1) {
  2778 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[k]);
  2779 + }
  2780 + } else {
  2781 + break;
  2782 + }
  2783 + }
  2784 + });
  2785 + } else {
  2786 + scope.$apply(function() {
  2787 + scope[ctrlAs].$$data = [];
  2788 + for (var i = 0; i < scope[ctrlAs].$$dataReal.length; i++) {
  2789 + if (scope[ctrlAs].$$data.length < 10) {
  2790 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[i]);
  2791 + } else {
  2792 + break;
  2793 + }
  2794 + }
  2795 + });
  2796 + }
  2797 + });
  2798 +
  2799 +
2701 2800 /**
2702 2801 * 人员配置列表点击(人员配置列表中选中路牌)
2703 2802 * @param $index
... ... @@ -3153,15 +3252,37 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
3153 3252 // 获取值了
3154 3253 console.log("人员配置获取了");
3155 3254  
3156   - scope[ctrlAs].$$data = [];
3157   - for (var i = 0; i < result.content.length; i++) {
3158   - scope[ctrlAs].$$data.push({
3159   - id: result.content[i].id,
3160   - dbbm: result.content[i].dbbm,
3161   - jsy: result.content[i].jsy.personnelName,
3162   - spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName
  3255 + scope[ctrlAs].$$dataReal = [];
  3256 + angular.forEach(result.content, function(obj) {
  3257 + var n1 = obj.jsy == null ? "" : (obj.jsy.personnelName || "");
  3258 + var n2 = obj.spy == null ? "" : (obj.spy.personnelName || "");
  3259 + var c1 = obj.jsy == null ? "" : (obj.jsy.jobCode || "");
  3260 + var c2 = obj.spy == null ? "" : (obj.spy.jobCode || "");
  3261 + var str = [];
  3262 + str.push(n1);
  3263 + str.push(n2);
  3264 + str.push(c1);
  3265 + str.push(c2);
  3266 + this.push({
  3267 + id: obj.id,
  3268 + dbbm: obj.dbbm,
  3269 + jsy: n1,
  3270 + spy: n2,
  3271 + '$fullChars': pinyin.getFullChars(str.join("-")), // 全拼
  3272 + '$camelChars': pinyin.getCamelChars(str.join("-")), // 简拼
  3273 + '$str': str.join("-")
3163 3274 });
  3275 + }, scope[ctrlAs].$$dataReal);
  3276 +
  3277 + scope[ctrlAs].$$data = [];
  3278 + for (var i = 0; i < scope[ctrlAs].$$dataReal.length; i++) {
  3279 + if (scope[ctrlAs].$$data.length < 10) {
  3280 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$dataReal[i]);
  3281 + } else {
  3282 + break;
  3283 + }
3164 3284 }
  3285 +
3165 3286 if (scope[ctrlAs].$$data_init) {
3166 3287 scope[ctrlAs].$$dataSelected = [];
3167 3288 scope[ctrlAs].$$dataSelectedStart = undefined;
... ... @@ -3171,6 +3292,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
3171 3292 scope[ctrlAs].$$dataFBSelectedStart = undefined;
3172 3293  
3173 3294 scope[ctrlAs].$$internalmodel = undefined;
  3295 +
  3296 + scope[ctrlAs].$$searchText = undefined;
3174 3297 }
3175 3298 scope[ctrlAs].$$data_xl_first_init = true;
3176 3299 },
... ...
src/main/resources/static/real_control_v2/css/home.css
... ... @@ -39,7 +39,7 @@
39 39 border: 1px solid #e6e6e6;
40 40 border-radius: 4px;
41 41 margin: 0 1px 4px 1px;
42   - min-height: 230px;
  42 + min-height: 240px;
43 43 height: calc(100% / 3 - 12px);
44 44 padding: 3px;
45 45 }
... ... @@ -75,30 +75,35 @@
75 75 }
76 76  
77 77 .home-gps-table dl dt:nth-of-type(3), .home-gps-table dl dd:nth-of-type(3) {
78   - width: 11%
  78 + width: 10%
79 79 }
80 80  
81 81 .home-gps-table dl dt:nth-of-type(4), .home-gps-table dl dd:nth-of-type(4) {
82   - width: 19%
  82 + width: 10%
83 83 }
84 84  
85 85 .home-gps-table dl dt:nth-of-type(5), .home-gps-table dl dd:nth-of-type(5) {
86   - width: 18%
  86 + width: 19%
87 87 }
88 88  
89 89 .home-gps-table dl dt:nth-of-type(6), .home-gps-table dl dd:nth-of-type(6) {
90   - width: 10%
  90 + width: 18%
91 91 }
92 92  
93 93 .home-gps-table dl dt:nth-of-type(7), .home-gps-table dl dd:nth-of-type(7) {
94   - width: 9%
  94 + width: 10%
95 95 }
96 96  
97 97 .home-gps-table dl dt:nth-of-type(8), .home-gps-table dl dd:nth-of-type(8) {
98   - width: 8%;
  98 + width: 9%;
99 99 border-right: 0;
100 100 }
101 101  
  102 +/*.home-gps-table dl dt:nth-of-type(9), .home-gps-table dl dd:nth-of-type(9) {
  103 + width: 8%;
  104 + border-right: 0;
  105 +}*/
  106 +
102 107 .data-wrap.up {
103 108 /*border-left: 1px solid #dadada;*/
104 109 }
... ... @@ -234,3 +239,30 @@
234 239 .data-wrap.down::-webkit-scrollbar-thumb{
235 240 box-shadow: 0 0 0 5px rgba(210, 103, 103, 0.44) inset;
236 241 }*/
  242 +
  243 +span.signal-state-outbounds{
  244 + background: #f3ff00;
  245 + color: #d42727;
  246 + padding: 2px 3px;
  247 + border-radius: 3px;
  248 + font-size: 11px;
  249 +}
  250 +
  251 +.home-svg-edit-icon{
  252 + position: absolute;
  253 + right: 10px;
  254 + top: 5px;
  255 + cursor: pointer;
  256 + z-index: 3;
  257 + opacity: 0;
  258 + transition: all .3s ease;
  259 +}
  260 +
  261 +.home-svg-edit-icon:hover{
  262 + opacity: 1;
  263 +}
  264 +
  265 +.home-svg-edit-icon:before{
  266 + font-family: FontAwesome;
  267 + content: "\f040";
  268 +}
237 269 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/css/line_schedule.css
... ... @@ -151,13 +151,13 @@
151 151 }
152 152  
153 153 .ct_table .uk-badge {
154   - padding: 0 1px 0 1px;
155   - text-indent: 0;
156   - font-family: 华文细黑;
  154 + padding: 0 1px 0 1px;
  155 + text-indent: 0;
  156 + font-family: 华文细黑;
157 157 }
158 158  
159 159 .ct_table .uk-badge.uk-badge-notification{
160   - text-indent: -1px;
  160 + text-indent: -1px;
161 161 }
162 162  
163 163 .schedule-body .ct_table dl._active, .schedule-body .ct_table>.ct_table_body dl._active:hover {
... ... @@ -200,7 +200,7 @@
200 200 }
201 201  
202 202 .schedule-body .ct_table dl._search_hide{
203   - display: none !important;
  203 + display: none !important;
204 204 }
205 205  
206 206 .context-menu-list.schedule-ct-menu {
... ... @@ -246,34 +246,34 @@ span.fcsj-diff {
246 246 /** 图例 */
247 247  
248 248 .tl-yzx {
249   - background: #c1ddf0;
  249 + background: rgb( 192,192,255);
250 250 border-top: 1px solid #ebebeb !important;
251 251 color: #444;
252 252 }
253 253  
254 254 .tl-xxfc{
255   - background: #ff7878;
256   - color: #f1f1f1;
  255 + background: rgb(0,255,255);
  256 + color: #484747;
257 257 }
258 258  
259 259 .tl-wd{
260   - background: #dede57;
  260 + background: rgb(255,255,0);
261 261 color: #444;
262 262 }
263 263  
264 264 .tl-xxsd{
265   - background: #e2de94;
266   - color: #444;
  265 + background: rgb(205,133,63);
  266 + color: #f5f4f4;
267 267 }
268 268  
269 269 .tl-xxrd{
270   - background: #c1ddf0;
  270 + background: rgb(255,99,71);
271 271 border-top: 1px solid #ebebeb !important;
272   - color: #444;
  272 + color: #fff;
273 273 }
274 274  
275 275 .tl-qrlb {
276   - background: #7B6B24;
  276 + background: rgb( 128,128,0);
277 277 color: #EAEBEC;
278 278 font-size: 13px;
279 279 }
... ... @@ -283,7 +283,7 @@ span.fcsj-diff {
283 283 }
284 284  
285 285 .tl-zzzx {
286   - background: #96F396;
  286 + background: rgb(173,255,47);
287 287 color: #444;
288 288 }
289 289  
... ... @@ -370,8 +370,8 @@ span.fcsj-diff {
370 370  
371 371 .ct-form-modal span.uk-form-help-inline,
372 372 .ct-form-modal p.uk-form-help-block{
373   - color: #888888;
374   - font-size: 13px;
  373 + color: #888888;
  374 + font-size: 13px;
375 375 }
376 376  
377 377  
... ... @@ -532,8 +532,8 @@ dl.relevance-active dd:nth-child(n+2) {
532 532 }
533 533  
534 534 dl.relevance-active.intimity dd:nth-child(n+2) {
535   - background: #76a6c7 !important;
536   - color: white;
  535 + background: #8baabf !important;
  536 + color: white;
537 537 }
538 538  
539 539 dl.relevance-active.intimity dd:nth-child(n+2) a {
... ... @@ -542,13 +542,24 @@ dl.relevance-active.intimity dd:nth-child(n+2) a {
542 542  
543 543 dl.relevance-active dd.tl-qrlb,
544 544 dl.relevance-active.intimity dd.tl-qrlb{
545   - background: linear-gradient(to right, #7B6B24, #4992c3) !important;
  545 + background: linear-gradient(to right, #a9a911, #808000, #8baabf) !important;
546 546 color: #f8e9cd;
547 547 }
548 548  
  549 +dl.relevance-active dd.tl-wd,
  550 +dl.relevance-active.intimity dd.tl-wd{
  551 + background: linear-gradient(to right, #ffff00, rgb(226, 226, 168), rgb(139, 170, 191)) !important;
  552 +}
  553 +
  554 +dl.relevance-active dd.tl-qrlb,
  555 +dl.relevance-active.intimity dd.tl-yzx{
  556 + background: linear-gradient(to right, #dcdcfd, #c0c0ff, #8baabf) !important;
  557 + color: #272727;
  558 +}
  559 +
549 560 dl.relevance-active dd.tl-zzzx,
550 561 dl.relevance-active.intimity dd.tl-zzzx {
551   - background: linear-gradient(to right, #96F396, #4992c3) !important;
  562 + background: linear-gradient(to right, #def5bb, #adff2f, #8baabf) !important;
552 563 color: #565252;
553 564 }
554 565  
... ... @@ -557,8 +568,23 @@ dl.relevance-active.intimity dd.tl-zzzx span.fcsj-diff {
557 568 color: #5e5a5a
558 569 }
559 570  
  571 +dl.relevance-active dd.tl-xxsd,
  572 +dl.relevance-active.intimity dd.tl-xxsd {
  573 + background: linear-gradient(to right, #8baabf, #cd853f, #dc9958) !important;
  574 +}
  575 +
  576 +dl.relevance-active dd.tl-xxrd,
  577 +dl.relevance-active.intimity dd.tl-xxrd {
  578 + background: linear-gradient(to right, #8baabf, #ff6347, #ff8f7b) !important;
  579 +}
  580 +
  581 +dl.relevance-active dd.tl-xxfc,
  582 +dl.relevance-active.intimity dd.tl-xxfc {
  583 + background: linear-gradient(to right, #8baabf, rgb(43, 185, 185), rgb(0,255,255)) !important;
  584 +}
  585 +
560 586 dl.relevance-active.intimity dd span.fcsj-diff {
561   - color: #d7d6d6;
  587 + color: #616060;
562 588 }
563 589  
564 590 dl.relevance-active dd span.fcsj-diff{
... ... @@ -604,10 +630,10 @@ div.drop-rail.over {
604 630 }
605 631  
606 632 label.destroy-sch{
607   - color: #928e8e;
  633 + color: #928e8e;
608 634 }
609 635 label.destroy-sch small{
610   - color: #e25e5e;
  636 + color: #e25e5e;
611 637 }
612 638  
613 639 .main-schedule-table dl dt:nth-of-type(1), .main-schedule-table dl dd:nth-of-type(1) {
... ... @@ -639,20 +665,20 @@ label.destroy-sch small{
639 665 .main-schedule-table.ct_table dl.active,
640 666 .main-schedule-table.ct_table>.ct_table_body dl.active:hover,
641 667 .main-schedule-table.ct_table>.ct_table_body dl.context-menu-active{
642   - background: #9393bf;
643   - box-shadow: 0 0 4px #656c71;
644   - color: white;
  668 + background: #9393bf;
  669 + box-shadow: 0 0 4px #656c71;
  670 + color: white;
645 671 }
646 672  
647 673 .main-schedule-table span.sjfc-time{
648   - color:#07d
  674 + color:#07d
649 675 }
650 676  
651 677 .main-schedule-table dl.active span.sjfc-time{
652   - background: white;
653   - border-radius: 5px;
654   - padding: 2px 1px;
655   - vertical-align: middle;
  678 + background: white;
  679 + border-radius: 5px;
  680 + padding: 2px 1px;
  681 + vertical-align: middle;
656 682 }
657 683  
658 684 .sub-task-table dl dt:nth-of-type(1), .sub-task-table dl dd:nth-of-type(1) {
... ... @@ -682,7 +708,7 @@ label.destroy-sch small{
682 708 }
683 709  
684 710 .sub-task-table>.ct_table_body>dl:last-child dd{
685   - border-bottom: 0;
  711 + border-bottom: 0;
686 712 }
687 713  
688 714 .add-temp-sch-icon{
... ... @@ -700,16 +726,16 @@ label.destroy-sch small{
700 726  
701 727  
702 728 input.i-cbox[type=checkbox]{
703   - width: 20px;
704   - height: 18px;
705   - vertical-align: middle;
706   - margin-top: -3px;
  729 + width: 20px;
  730 + height: 18px;
  731 + vertical-align: middle;
  732 + margin-top: -3px;
707 733 }
708 734  
709 735 .sys-note-80,
710 736 .sys-note-42{
711   - width: calc(100% - 10px) !important;
712   - margin: 5px !important;
  737 + width: calc(100% - 10px) !important;
  738 + margin: 5px !important;
713 739 cursor: default;
714 740 }
715 741  
... ... @@ -720,21 +746,21 @@ input.i-cbox[type=checkbox]{
720 746  
721 747 .sys-note-80 .uk-panel-box,
722 748 .sys-note-42 .uk-panel-box{
723   - padding: 10px;
  749 + padding: 10px;
724 750 }
725 751 .sys-note-80 .uk-panel-title{
726   - margin-bottom: 3px;
727   - font-size: 15px;
  752 + margin-bottom: 3px;
  753 + font-size: 15px;
728 754 }
729 755  
730 756 .sys-note-42 .title{
731   - font-family: 微软雅黑;
732   - margin-bottom: 3px;
  757 + font-family: 微软雅黑;
  758 + margin-bottom: 3px;
733 759 }
734 760 .sys-note-80 .uk-button-group,
735 761 .sys-note-42 .uk-button-group{
736   - display: block;
737   - margin-top: 5px;
  762 + display: block;
  763 + margin-top: 5px;
738 764 }
739 765  
740 766  
... ... @@ -759,7 +785,7 @@ input.i-cbox[type=checkbox]{
759 785 .sch-tzrc-table.ct_table dl.active,
760 786 .sch-tzrc-table.ct_table>.ct_table_body dl.active:hover,
761 787 .sch-tzrc-table.ct_table>.ct_table_body dl.context-menu-active{
762   - background: #e6e6e6;
  788 + background: #e6e6e6;
763 789 }
764 790  
765 791 .search_sch_panel{
... ... @@ -767,17 +793,17 @@ input.i-cbox[type=checkbox]{
767 793 }
768 794  
769 795 .search_sch_panel .uk-form input[type=text]{
770   - width: 80px;
771   - background: #fafafa;
772   - border: 0;
773   - border-bottom: 1px solid #ddd;
774   - font-size: 14px;
775   - height: 20px;
776   - transition: all .3s ease;
  796 + width: 80px;
  797 + background: #fafafa;
  798 + border: 0;
  799 + border-bottom: 1px solid #ddd;
  800 + font-size: 14px;
  801 + height: 20px;
  802 + transition: all .3s ease;
777 803 }
778 804  
779 805 .search_sch_panel .uk-form div.uk-form-icon.active input[type=text]{
780   - width: 145px;
  806 + width: 145px;
781 807 }
782 808  
783 809 .search_sch_panel .uk-form div.uk-form-icon i.cancel{
... ... @@ -802,8 +828,8 @@ input.i-cbox[type=checkbox]{
802 828 }
803 829  
804 830 .search_sch_panel .uk-form input[type=text]::-webkit-input-placeholder{
805   - font-size: 12px;
806   - color: #cecece;
  831 + font-size: 12px;
  832 + color: #cecece;
807 833 }
808 834 .device_event_str{
809 835 font-size: 10px;
... ... @@ -1057,7 +1083,7 @@ i.signal_state_icon.uk-icon-reply{
1057 1083  
1058 1084 .child-task-status.fail{
1059 1085 color: red;
1060   - text-shadow: red 0px 0px 20px;
  1086 + /*text-shadow: red 0px 0px 20px;*/
1061 1087 }
1062 1088  
1063 1089 .child-task-status.fail span.calc-detail{
... ...
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;
... ... @@ -147,26 +152,36 @@ svg.line-chart text.station_text {
147 152 }
148 153  
149 154 svg.line-chart text.station_text.up {
150   - fill: #5E96D2;
  155 + fill: #4556b6;
151 156 }
152 157  
153 158 svg.line-chart text.station_text.down {
154   - fill: #C92121;
  159 + fill: #c94f21;
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   - height: 18px;
  184 + height: 15px;
170 185 /*fill: #fff;*/
171 186 rx: 4px;
172 187 cursor: pointer;
... ... @@ -188,7 +203,7 @@ svg.line-chart g.gps-wrap&gt;rect.hover {
188 203  
189 204 svg.line-chart g.gps-wrap>text {
190 205 font-size: 13px;
191   - transform: translate(2px, 14px);
  206 + transform: translate(2px, 12px);
192 207 pointer-events: none;
193 208 }
194 209  
... ... @@ -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 {
... ... @@ -506,3 +521,126 @@ li.map-panel{
506 521 fill: #dd3829;
507 522 }
508 523  
  524 +
  525 +.svg-edit-panel-wrap{
  526 + width: 48%;
  527 + border: 1px solid #e1d3d3;
  528 + padding: 12px 0 0 0;
  529 + border-radius: 4px;
  530 + position: relative;
  531 + display: inline-block;
  532 + vertical-align: top;
  533 + height: 440px;
  534 +}
  535 +
  536 +.svg-edit-panel-wrap .title-badge{
  537 + position: absolute;
  538 + top: -10px;
  539 + left: 7px;
  540 + font-size: 13px;
  541 + background: #fff;
  542 + padding: 0 3px;
  543 + color: #888888;
  544 +}
  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 +
  601 +.station-list{
  602 + width: 190px;
  603 + padding: 2px 7px;
  604 + height: 100%;
  605 + overflow: auto;
  606 + display: inline-block;
  607 +}
  608 +
  609 +.station-list .station-item{
  610 + padding: 3px 0;
  611 + margin: 5px 0;
  612 + border-radius: 3px;
  613 + font-size: 13px;
  614 + text-indent: 7px;
  615 + cursor: pointer;
  616 + white-space: nowrap;
  617 + overflow: hidden;
  618 + text-overflow: ellipsis;
  619 +}
  620 +
  621 +.station-list .station-item.disable,
  622 +.station-list .station-item.disable:hover{
  623 + background: #d5c9c9 !important;
  624 + color: #686565 !important;
  625 +}
  626 +
  627 +.station-list.up .station-item{
  628 + background: #5364c3;
  629 + color: white;
  630 +}
  631 +
  632 +.station-list.up .station-item:hover{
  633 + box-shadow: 0px 3px 6px 0 rgba(0, 0, 0, 0.2), 0px 1px 4px 0 rgba(0, 0, 0, 0.19);
  634 + background: #4556b6;
  635 +}
  636 +
  637 +
  638 +.station-list.down .station-item{
  639 + background: #f95858;
  640 + color: white;
  641 +}
  642 +
  643 +.station-list.down .station-item:hover{
  644 + box-shadow: 0px 3px 6px 0 rgba(0, 0, 0, 0.2), 0px 1px 4px 0 rgba(0, 0, 0, 0.19);
  645 + background: #e95151;
  646 +}
509 647 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/home/layout.html
... ... @@ -22,6 +22,7 @@
22 22 <div class="uk-grid home-line-card" data-line-code="{{line.lineCode}}">
23 23 <div class="uk-width-medium-1-5 data-wrap up" id="home_{{line.lineCode}}_0"></div>
24 24 <div class="uk-width-medium-3-5 svg-chart-wrap">
  25 + <div class="home-svg-edit-icon" data-line-code="{{line.lineCode}}"></div>
25 26 <div class="top-center-big-text">
26 27 {{line.name}}
27 28 </div>
... ...
src/main/resources/static/real_control_v2/fragments/home/line_panel.html
... ... @@ -10,12 +10,12 @@
10 10 <dl>
11 11 <dt>车辆编码</dt>
12 12 <dt>速度</dt>
13   - <dt>终点时间</dt>
  13 + <dt>终点</dt>
  14 + <dt>状态</dt>
14 15 <dt>当前站点</dt>
15 16 <dt>终点站</dt>
16 17 <dt>计划到达</dt>
17 18 <dt>驾驶员</dt>
18   - <dt>售票员</dt>
19 19 </dl>
20 20 </div>
21 21 <div class="ct_table_body"></div>
... ... @@ -29,11 +29,29 @@
29 29 <dd title="{{nbbm}}"><a>{{nbbm}}</a></dd>
30 30 <dd>{{speed}}</dd>
31 31 <dd>{{expectStopTime}}</dd>
  32 + <dd>
  33 + {{if abnormal != null}}
  34 + {{if abnormal == 'outBounds'}}
  35 + 越界
  36 + {{/if}}
  37 + {{else}}
  38 + 正常
  39 + {{/if}}
  40 + </dd>
32 41 <dd title="{{stationName}}">{{stationName}}</dd>
33 42 <dd></dd>
34 43 <dd></dd>
35 44 <dd></dd>
36   - <dd></dd>
37 45 </dl>
38   -</script>
  46 + </script>
  47 +
  48 + <script id="home-gps-abnormal-temp" type="text/html">
  49 + {{if abnormal != null}}
  50 + {{if abnormal == 'outBounds'}}
  51 + <span class="signal-state-outbounds">越界</span>
  52 + {{/if}}
  53 + {{else}}
  54 + 正常
  55 + {{/if}}
  56 + </script>
39 57 </div>
... ...
src/main/resources/static/real_control_v2/fragments/home/svg_edit.html 0 → 100644
  1 +<div class="uk-modal" id="home-svg-edit-modal">
  2 + <div class="uk-modal-dialog" style="width: 930px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>主页模拟图数据编辑</h2></div>
  6 +
  7 + <div class="svg-edit-panel-wrap station-list-wrap">
  8 + <span class="title-badge">站点缩略</span>
  9 + </div>
  10 +
  11 +
  12 + <div class="svg-edit-panel-wrap" style="margin-left: 25px;">
  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>
  25 + </div>
  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>
  33 + </div>
  34 +
  35 + <script id="svg-edit-station-list-temp" type="text/html">
  36 + <div class="station-list up">
  37 + {{each list[0] as s i}}
  38 + <div class="station-item" data-code="{{s.stationCode}}">{{s.stationName}}</div>
  39 + {{/each}}
  40 + </div>
  41 +
  42 + <div class="station-list down" style="margin-left: 8px;">
  43 + {{each list[1] as s i}}
  44 + <div class="station-item" data-code="{{s.stationCode}}">{{s.stationName}}</div>
  45 + {{/each}}
  46 + </div>
  47 + </script>
  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 +
  62 + <script>
  63 + (function () {
  64 + var modal = '#home-svg-edit-modal',
  65 + lineCode, names = [], no = 0;
  66 +
  67 + $(modal).on('init', function (e, data) {
  68 + lineCode = data.lineCode;
  69 + var allStationList = gb_data_basic.stationRoutes(lineCode);
  70 + //站点路由
  71 + var routeArray = gb_common.groupBy(allStationList, 'directions');
  72 + //下行倒序
  73 + routeArray[1].sort(function (a, b) {
  74 + return b.stationRouteCode - a.stationRouteCode;
  75 + });
  76 + $('.station-list-wrap', modal).append(template('svg-edit-station-list-temp', {list: routeArray}));
  77 +
  78 + $('.station-item', modal).on('click', function () {
  79 + if ($(this).hasClass('disable')) {
  80 + $(this).removeClass('disable');
  81 + }
  82 + else
  83 + $(this).addClass('disable');
  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 + });
  182 + });
  183 + })();
  184 + </script>
  185 +</div>
... ...
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=' + gb_data_basic.codeToLine[sch.xlBm].id);
  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 () {
... ... @@ -98,11 +115,15 @@ var gb_data_basic = (function () {
98 115 }
99 116  
100 117 return null;
101   - }
  118 + };
102 119  
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/data_gps.js
... ... @@ -3,7 +3,7 @@
3 3 var gb_data_gps = (function() {
4 4  
5 5 //fixed time refresh delay
6   - var delay = 1000 * 6;
  6 + var delay = 1000 * 5;
7 7 //deviceId ——> gps
8 8 var realData = {};
9 9 //refresh after callback
... ... @@ -34,6 +34,7 @@ var gb_data_gps = (function() {
34 34 upArr = [],
35 35 upDownChange = [];
36 36  
  37 + var schArray;
37 38 $.each(rs, function() {
38 39 old = realData[this.deviceId];
39 40 if (old) {
... ... @@ -45,16 +46,26 @@ var gb_data_gps = (function() {
45 46 } else
46 47 addArr.push(this);
47 48  
  49 + //班次信息
  50 + if(this.schId){
  51 + schArray=gb_schedule_table.findScheduleByLine(this.lineId);
  52 + if(schArray)
  53 + this.sch = schArray[this.schId];
  54 + }
  55 +
48 56 //时间格式化
49 57 this.dateStr = moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss');
  58 + //异常检测
  59 + gb_gps_abnormal.check(this);
50 60 realData[this.deviceId] = this;
51 61 });
52 62  
53   - console.log('add array size: ' + addArr.length, 'up array size: ' + upArr.length);
  63 + //console.log('add array size: ' + addArr.length, 'up array size: ' + upArr.length);
54 64 //CCCallFuncN
55 65 $.each(refreshEventCallbacks, function(i, cb) {
56 66 cb(addArr, upArr, upDownChange);
57 67 });
  68 +
58 69 };
59 70  
60 71 var startFixedTime;
... ... @@ -81,11 +92,11 @@ var gb_data_gps = (function() {
81 92 };
82 93  
83 94 var findOne = function(deviceId){
84   - return realData[deviceId];
  95 + return realData[deviceId];
85 96 };
86 97  
87 98 var findGpsByNbbm = function(nbbm){
88   - return realData[gb_data_basic.nbbm2deviceMap()[nbbm]];
  99 + return realData[gb_data_basic.nbbm2deviceMap()[nbbm]];
89 100 };
90 101  
91 102 return {
... ...
src/main/resources/static/real_control_v2/js/data/gps_abnormal.js
... ... @@ -20,11 +20,20 @@ var gb_gps_abnormal = (function () {
20 20 var min, distance;
21 21 $.each(roads, function () {
22 22 distance = minDistanceFromRoad(this.pos, gps);
23   - if(!min || min > distance)
  23 + if (!min || min > distance)
24 24 min = distance;
25 25 });
26 26  
27   - //console.log('最短距离', min, gps);
  27 + //越界阈值 120米
  28 + var threshold = 120;
  29 + if (gps.sch && gps.sch.bcType == 'in')
  30 + return;
  31 +
  32 + if (min > threshold) {
  33 + gps.abnormal = 'outBounds';
  34 + gps.outBoundsDistance = min;
  35 + }
  36 + //console.log('最短距离', min, gps.nbbm);
28 37 };
29 38  
30 39 /**
... ... @@ -46,20 +55,19 @@ var gb_gps_abnormal = (function () {
46 55 });
47 56 //按线路_走向 分组数据
48 57 allRoads = groupByLineAndUpdown(list);
49   - console.log('路段数据', allRoads);
50 58 });
51 59 };
52 60  
53   - function minDistanceFromRoad(pos, gps){
  61 + function minDistanceFromRoad(pos, gps) {
54 62 var distance, min;
55 63 var len = pos.length - 1;
56   - for(var i = 0; i < len; i ++){
  64 + for (var i = 0; i < len; i++) {
57 65 distance = geolib.getDistanceFromLine({
58 66 latitude: gps.lat,
59 67 longitude: gps.lon
60 68 }, pos[i], pos[i + 1]);
61 69  
62   - if(!min || min > distance)
  70 + if (!min || min > distance)
63 71 min = distance;
64 72 }
65 73  
... ... @@ -96,7 +104,7 @@ var gb_gps_abnormal = (function () {
96 104 return {
97 105 initData: initData,
98 106 check: function (gps) {
99   - if(!allRoads){
  107 + if (!allRoads) {
100 108 return;
101 109 }
102 110  
... ...
src/main/resources/static/real_control_v2/js/home/layout.js
1 1 /* home js */
2 2  
3   -var gb_home_layout = (function() {
  3 +var gb_home_layout = (function () {
4 4  
5 5 var temps;
6 6  
7   - var layout = function(cb) {
  7 + var layout = function (cb) {
8 8 //footer line name tabs
9 9 var codeArray = gb_data_basic.line_idx.split(','),
10 10 tabsArray = [],
11 11 len = codeArray.length;
12 12 for (var i = 0; i < len;) {
13   - tabsArray.push(connectArr(codeArray.slice(i, i += 3), ',', function(item) {
  13 + tabsArray.push(connectArr(codeArray.slice(i, i += 3), ',', function (item) {
14 14 return gb_data_basic.codeToLine[item].name;
15 15 }));
16 16 }
17 17 //load template
18   - $.get('/real_control_v2/fragments/home/layout.html', function(dom) {
  18 + $.get('/real_control_v2/fragments/home/layout.html', function (dom) {
19 19 temps = gb_common.compileTempByDom(dom);
20 20  
21 21 var htmlStr = temps['home-layout-tab-temp']({
... ... @@ -26,7 +26,7 @@ var gb_home_layout = (function() {
26 26 //render line panel
27 27 var i = 0,
28 28 data, renderFun = temps['home-layout-line-temp'];
29   - $('ul#home-main-content li').each(function() {
  29 + $('ul#home-main-content li').each(function () {
30 30 data = gb_data_basic.findLineByCodes(codeArray.slice(i, i += 3));
31 31  
32 32 $(this).html(renderFun({list: data}));
... ... @@ -36,7 +36,12 @@ var gb_home_layout = (function() {
36 36  
37 37 cb && cb();
38 38 });
39   - }
  39 + };
  40 +
  41 + //click svg edit icon
  42 + $(document).on('click', '.home-svg-edit-icon', function () {
  43 + open_modal('/real_control_v2/fragments/home/svg_edit.html', {lineCode: $(this).data('line-code')});
  44 + });
40 45  
41 46 //文件载入完毕
42 47 res_load_ep.emitLater('load_home_layout');
... ...
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
... ... @@ -83,21 +83,18 @@ var gb_home_line_panel = (function() {
83 83 $(cells[1]).text(t.speed);
84 84 $(cells[2]).html(t.expectStopTime == null ? '' : t.expectStopTime);
85 85  
  86 + //状态
  87 + $(cells[3]).html(temps['home-gps-abnormal-temp'](t));
  88 +
86 89 if(!t.stationName)
87 90 t.stationName='';
88   - $(cells[3]).text(t.stationName).attr('title', t.stationName);
  91 + $(cells[4]).text(t.stationName).attr('title', t.stationName);
89 92  
90 93 //班次信息
91   - if(t.schId){
92   - var sch=gb_schedule_table.findScheduleByLine(t.lineId)[t.schId];
93   - if(!sch)
94   - return;
95   -
96   - $(cells[4]).text(sch.zdzName);
97   - $(cells[5]).text(sch.zdsj);
98   - $(cells[6]).text(sch.jName);
99   - if(sch.sName)
100   - $(cells[7]).text(sch.sName);
  94 + if(t.sch){
  95 + $(cells[5]).text(t.sch.zdzName);
  96 + $(cells[6]).text(t.sch.zdsj);
  97 + $(cells[7]).text(t.sch.jName);
101 98 }
102 99 };
103 100  
... ...
src/main/resources/static/real_control_v2/js/main.js
... ... @@ -43,12 +43,12 @@ var gb_main_ep = new EventProxy(),
43 43 });
44 44  
45 45 //初始化gps异常判定
46   - //gb_gps_abnormal.initData();
  46 + gb_gps_abnormal.initData();
47 47  
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
... ... @@ -3,9 +3,11 @@
3 3 var gb_svg_chart = (function () {
4 4  
5 5 //chart height
6   - var chart_height = 123;
  6 + var chart_height = 122;
7 7 //left right padding
8 8 var x_padd = 30;
  9 + //上空白部分
  10 + var y_top_padd = 4;
9 11 //text max size
10 12 var t_max_size = 7;
11 13 //svg namespace
... ... @@ -24,11 +26,20 @@ var gb_svg_chart = (function () {
24 26 var h = wrap.actual('outerHeight');
25 27 //隐藏元素取最外层的高度
26 28 return h < 20 ? wrap.parent().actual('outerHeight') - 2 : h;
27   - }
28   -
29   - var draw_line = function (lineCode, wrap) {
  29 + };
30 30  
31   - 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),
32 43 len = data.length;
33 44  
34 45 var w = get_width(wrap),
... ... @@ -40,7 +51,7 @@ var gb_svg_chart = (function () {
40 51 return xScale(i);
41 52 },
42 53 cy = function () {
43   - return (h - chart_height) / 2;
  54 + return (h - chart_height) / 2 + y_top_padd;
44 55 },
45 56 ty = function (d) {
46 57 return cy() + calc_text_y(cat_text(d.name[0]));
... ... @@ -62,7 +73,7 @@ var gb_svg_chart = (function () {
62 73  
63 74 $(that).after(dText);
64 75 return cx(d, i) - 8;
65   - }
  76 + };
66 77  
67 78 //add svg dom
68 79 var svg = d3.select(wrap[0]).append('svg')
... ... @@ -88,6 +99,7 @@ var gb_svg_chart = (function () {
88 99  
89 100 //down station link path
90 101 p_clzz.down = true;
  102 + p_clzz.loop_line = loopLine;
91 103 items.append('path').classed(p_clzz)
92 104 .attr('d', function (d, i) {
93 105 return i < len - 1 ? downLine([i, i + 1]) : '';
... ... @@ -125,7 +137,10 @@ var gb_svg_chart = (function () {
125 137 items.append('text').classed({
126 138 'station_text': true,
127 139 'up': function (d) {
128   - return d.type == 3 ? true : false;
  140 + return d.type == 3 || d.type == 0 ? true : false;
  141 + },
  142 + 'down': function (d) {
  143 + return d.type == 1 ? true : false;
129 144 }
130 145 })
131 146 .text(function (d) {
... ... @@ -168,7 +183,7 @@ var gb_svg_chart = (function () {
168 183 var circle = get_circle(gps.stopNo + '_' + gps.upDown, svg);
169 184 if (!circle) return -100;
170 185  
171   - return circle.attr('cx') - 14;
  186 + return circle.attr('cx') - 17.5;
172 187 },
173 188 gy = function (gps, svg) {
174 189 var circle = get_circle(gps.stopNo + '_' + gps.upDown, svg);
... ... @@ -177,7 +192,7 @@ var gb_svg_chart = (function () {
177 192 var cy = parseInt(circle.attr('cy')),
178 193 index = line_gps_index[gps.lineId][gps.stopNo + '_' + gps.upDown][gps.deviceId];
179 194  
180   - return gps.upDown == 0 ? cy - 25 - (index * 21) : cy + 7 + (index * 21);
  195 + return gps.upDown == 0 ? cy - 22 - (index * 17) : cy + 6 + (index * 19);
181 196 },
182 197 ups_gps = function (d) {
183 198 return d.gpsUps;
... ... @@ -209,8 +224,15 @@ var gb_svg_chart = (function () {
209 224 return d.deviceId;
210 225 },
211 226 gps_update_point = function (e, svg) {
  227 + var x;
212 228 e.transition().attr('x', function (d) {
213   - return gx(d, svg);
  229 + x = gx(d, svg);
  230 + //找不到停靠点,直接隐藏
  231 + if(x == -100)
  232 + $(this).hide();
  233 + else
  234 + $(this).show();
  235 + return x;
214 236 })
215 237 .attr('y', function (d) {
216 238 return gy(d, svg);
... ... @@ -226,7 +248,7 @@ var gb_svg_chart = (function () {
226 248 },
227 249 tx_id = function (d) {
228 250 return 'tx_' + d.deviceId;
229   - }
  251 + };
230 252  
231 253 var setGps = function (lineCode) {
232 254 var svgs = $('.line-chart[data-code=' + lineCode + ']'),
... ... @@ -278,7 +300,7 @@ var gb_svg_chart = (function () {
278 300  
279 301 marker_clusterer_merge(svg, stopNo, gpsArr);
280 302 }
281   - }
  303 + };
282 304  
283 305 var marker_clusterer_merge = function (svg, stopNo, gpsArr) {
284 306 //stop circle
... ... @@ -309,7 +331,7 @@ var gb_svg_chart = (function () {
309 331 mergerG.append('text').text(len)
310 332 .attr('x', x - ((len + '').length * 4))
311 333 .attr('y', isDown ? y + 24 : y - 14);
312   - }
  334 + };
313 335  
314 336 return {
315 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  
... ...