Commit 22fab36bd4dafe7c64d0d72dcefeb88e197e6174

Authored by 徐烜
2 parents e7a91a12 33f20edb

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

Too many changes to show.

To preserve performance only 20 of 39 files are displayed.

src/main/java/com/bsth/controller/logger/MileModifyController.java 0 → 100644
  1 +package com.bsth.controller.logger;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.logger.Logger_MileModify;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/3/6.
  10 + */
  11 +@RestController
  12 +@RequestMapping("logger_mile_modify")
  13 +public class MileModifyController extends BaseController<Logger_MileModify, Long>{
  14 +}
... ...
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
... ... @@ -35,6 +35,11 @@ public class LineConfigController extends BaseController&lt;LineConfig, Integer&gt;{
35 35 return lineConfigService.editOutTimeType(lineCode, type);
36 36 }
37 37  
  38 + @RequestMapping(value = "/enableInParkForSource", method = RequestMethod.POST)
  39 + public Map<String, Object> enableInParkForSource(@RequestParam String lineCode, @RequestParam int enable){
  40 + return lineConfigService.enableInParkForSource(lineCode, enable);
  41 + }
  42 +
38 43 @RequestMapping(value = "/getByLineCode")
39 44 public LineConfig getByLineCode(@RequestParam String lineCode){
40 45 return lineConfigService.getByLineCode(lineCode);
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -262,6 +262,12 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
262 262 @RequestParam String date,@RequestParam String state) {
263 263 return scheduleRealInfoService.queryUserInfo(line, date,state);
264 264 }
  265 +
  266 + @RequestMapping(value = "/queryUserInfoPx")
  267 + public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
  268 + @RequestParam String date,@RequestParam String state,@RequestParam String type) {
  269 + return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
  270 + }
265 271  
266 272 @RequestMapping(value = "/exportWaybill")
267 273 public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
... ... @@ -368,6 +374,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
368 374 return scheduleRealInfoService.realScheduleList(line,date);
369 375 }
370 376  
  377 + @RequestMapping(value="/realScheduleListQp")
  378 + public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
  379 + return scheduleRealInfoService.realScheduleListQp(line,date);
  380 + }
  381 +
371 382 @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
372 383 public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
373 384 cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
... ... @@ -451,7 +462,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
451 462 }
452 463  
453 464 @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
454   - public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx){
455   - return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx);
  465 + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
  466 + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
456 467 }
457 468 }
... ...
src/main/java/com/bsth/controller/realcontrol/dto/LpData.java
... ... @@ -19,17 +19,36 @@ public class LpData {
19 19 this.zdsj = sch.getZdsjActualTime();
20 20 }
21 21  
22   - public void appendTo(ScheduleRealInfo sch) {
23   - sch.setjGh(this.jGh);
24   - sch.setjName(this.jName);
25   - sch.setsGh(this.sGh);
26   - sch.setsName(this.sName);
27   - sch.setClZbh(this.nbbm);
28   -
29   - if (this.fcsj != null)
30   - sch.setFcsjActualAll(this.fcsj);
31   - if (this.zdsj != null)
32   - sch.setZdsjActualAll(this.zdsj);
  22 + public void appendTo(ScheduleRealInfo sch, int type) {
  23 +
  24 + if (type == 0) {
  25 + //只换人
  26 + sch.setjGh(this.jGh);
  27 + sch.setjName(this.jName);
  28 + sch.setsGh(this.sGh);
  29 + sch.setsName(this.sName);
  30 + } else if (type == 1) {
  31 + //只换车
  32 + sch.setClZbh(this.nbbm);
  33 +
  34 + if (this.fcsj != null)
  35 + sch.setFcsjActualAll(this.fcsj);
  36 + if (this.zdsj != null)
  37 + sch.setZdsjActualAll(this.zdsj);
  38 +
  39 + } else if (type == 2) {
  40 + //换人并换车
  41 + sch.setjGh(this.jGh);
  42 + sch.setjName(this.jName);
  43 + sch.setsGh(this.sGh);
  44 + sch.setsName(this.sName);
  45 + sch.setClZbh(this.nbbm);
  46 +
  47 + if (this.fcsj != null)
  48 + sch.setFcsjActualAll(this.fcsj);
  49 + if (this.zdsj != null)
  50 + sch.setZdsjActualAll(this.zdsj);
  51 + }
33 52 }
34 53  
35 54 /**
... ...
src/main/java/com/bsth/data/directive/DayOfDirectives.java
1 1 package com.bsth.data.directive;
2 2  
3   -import java.util.ArrayList;
4   -import java.util.Collection;
5   -import java.util.Comparator;
6   -import java.util.HashMap;
7   -import java.util.List;
8   -import java.util.Map;
9   -
10   -import org.slf4j.Logger;
11   -import org.slf4j.LoggerFactory;
12   -import org.springframework.beans.factory.annotation.Autowired;
13   -import org.springframework.stereotype.Component;
14   -
15 3 import com.alibaba.fastjson.JSONObject;
16 4 import com.bsth.data.LineConfigData;
17 5 import com.bsth.entity.directive.D60;
... ... @@ -21,6 +9,12 @@ import com.bsth.entity.directive.DirectiveReponse;
21 9 import com.bsth.entity.realcontrol.ScheduleRealInfo;
22 10 import com.bsth.service.directive.DirectiveService;
23 11 import com.bsth.websocket.handler.SendUtils;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +import java.util.*;
24 18  
25 19 /**
26 20 *
... ... @@ -42,6 +36,9 @@ public class DayOfDirectives {
42 36 //等待C0_A4回复的用户
43 37 //public static Map<K, V>
44 38  
  39 + //等待入库的指令
  40 + public static LinkedList<Directive> pstDirectives;
  41 +
45 42 @Autowired
46 43 DirectiveService directiveService;
47 44  
... ... @@ -57,14 +54,19 @@ public class DayOfDirectives {
57 54 static{
58 55 d60Map = new HashMap<>();
59 56 d64Map = new HashMap<>();
  57 + pstDirectives = new LinkedList<>();
60 58 }
61 59  
62 60 public void put60(D60 d60) {
63 61 d60Map.put(d60.getMsgId(), d60);
  62 + //等待持久化
  63 + pstDirectives.add(d60);
64 64 }
65 65  
66 66 public void put64(D64 d64) {
67 67 d64Map.put(d64.getKey(), d64);
  68 + //等待持久化
  69 + pstDirectives.add(d64);
68 70 }
69 71  
70 72 /**
... ... @@ -98,8 +100,9 @@ public class DayOfDirectives {
98 100 d60.setReply47Time(System.currentTimeMillis());
99 101 break;
100 102 }
101   - // 入库
102   - saveD60(d60);
  103 + // 等待持久化
  104 + if(!pstDirectives.contains(d60))
  105 + pstDirectives.add(d60);
103 106  
104 107 ScheduleRealInfo sch = d60.getSch();
105 108 if (null == sch)
... ... @@ -131,19 +134,20 @@ public class DayOfDirectives {
131 134 logger.warn("64响应 data is null ,json: " + json);
132 135 else {
133 136 d64.setRespAck(data.getShort("requestAck"));
134   - // 响应入库
135   - directiveService.save64(d64);
  137 + // 持久化
  138 + if(!pstDirectives.contains(d64))
  139 + pstDirectives.add(d64);
136 140 }
137 141 }
138 142 }
139 143  
140   - private void saveD60(D60 d60) {
  144 +/* private void saveD60(D60 d60) {
141 145 // 等47再入库
142 146 if (d60.getReply47() == null)
143 147 return;
144 148  
145 149 directiveService.save(d60);
146   - }
  150 + }*/
147 151  
148 152 public void clear(String device){
149 153 int c60 = 0, c64 = 0;
... ...
src/main/java/com/bsth/data/directive/DirectivesPstThread.java 0 → 100644
  1 +package com.bsth.data.directive;
  2 +
  3 +import com.bsth.entity.directive.D60;
  4 +import com.bsth.entity.directive.D64;
  5 +import com.bsth.entity.directive.Directive;
  6 +import com.bsth.repository.directive.D60Repository;
  7 +import com.bsth.repository.directive.D64Repository;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Component;
  12 +
  13 +import java.util.LinkedList;
  14 +
  15 +/**
  16 + * 指令持久化线程
  17 + * Created by panzhao on 2017/3/6.
  18 + */
  19 +@Component
  20 +public class DirectivesPstThread extends Thread {
  21 +
  22 + Logger logger = LoggerFactory.getLogger(this.getClass());
  23 +
  24 + @Autowired
  25 + D60Repository d60Repository;
  26 +
  27 + @Autowired
  28 + D64Repository d64Repository;
  29 +
  30 + @Override
  31 + public void run() {
  32 + LinkedList<Directive> list = DayOfDirectives.pstDirectives;
  33 +
  34 + Directive directive;
  35 + for (int i = 0; i < 1000; i++) {
  36 + try {
  37 + directive = list.poll();
  38 +
  39 + if (directive instanceof D60) {
  40 + d60Repository.save((D60) directive);
  41 + }
  42 +
  43 + if (directive instanceof D64) {
  44 + d64Repository.save((D64) directive);
  45 + }
  46 + } catch (Exception e) {
  47 + logger.error("", e);
  48 + }
  49 + }
  50 + }
  51 +}
... ...
src/main/java/com/bsth/data/directive/FirstScheduleCheckThread.java
1   -package com.bsth.data.directive;
2   -
3   -import java.util.List;
4   -import java.util.Set;
5   -
6   -import org.slf4j.Logger;
7   -import org.slf4j.LoggerFactory;
8   -import org.springframework.beans.factory.annotation.Autowired;
9   -import org.springframework.stereotype.Component;
10   -
11   -import com.bsth.data.match.Arrival2Schedule;
12   -import com.bsth.data.match.ExpectArrivalEnd;
13   -import com.bsth.data.schedule.DayOfSchedule;
14   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
15   -import com.bsth.service.directive.DirectiveService;
16   -
17   -/**
18   - *
19   - * @ClassName: FirstScheduleCheckThread
20   - * @Description: TODO(首班出场检测)
21   - * @author PanZhao
22   - * @date 2016年8月27日 上午1:25:21
23   - *
24   - */
25   -@Component
26   -public class FirstScheduleCheckThread extends Thread{
27   -
28   - @Autowired
29   - DayOfSchedule dayOfSchedule;
30   -
31   - @Autowired
32   - DirectiveService directiveService;
33   -
34   - Logger logger = LoggerFactory.getLogger(this.getClass());
35   -
36   - //提前半小时下发指令
37   - private final static long THREE_MINUTES = 1000 * 60 * 30L;
38   -
39   - @Override
40   - public void run() {
41   - try{
42   - Set<String> cars = dayOfSchedule.allCar();
43   -
44   - long t = System.currentTimeMillis();
45   - List<ScheduleRealInfo> schList;
46   - ScheduleRealInfo first;
47   - for(String car : cars){
48   -
49   - schList = dayOfSchedule.findByNbbm(car);
50   -
51   - if(null == schList || schList.size() == 0)
52   - continue;
53   -
54   - first = schList.get(0);
55   -
56   - if(null != first.getBcType()
57   - && first.getBcType().equals("out")){
58   -
59   - //没有计划里程的出场班次,出场既是首发站,发送下一班次的营运指令
60   - if(first.getJhlc() == null && first.getXlDir().equals(schList.get(1).getXlDir()))
61   - first = schList.get(1);
62   -
63   - //为首班补发指令
64   - if(first.getDirectiveState() == -1
65   - && Math.abs(first.getDfsjT() - t) < THREE_MINUTES){
66   -
67   - directiveService.send60Dispatch(first, dayOfSchedule.doneSum(first.getClZbh()), "定补@系统");
68   - //期望完成出场班次时间
69   - long endTime;
70   -
71   - if(first.getZdsj() != null)
72   - endTime=first.getZdsjT() - 60000;
73   - else
74   - endTime=schList.get(1).getDfsjT() - 60000;
75   -
76   - ExpectArrivalEnd ead = new ExpectArrivalEnd()
77   - ,ead2 = new ExpectArrivalEnd();
78   - ead.setNbbm(car);
79   - ead.setEndStation(first.getQdzCode());
80   - ead.setEndTime(endTime);
81   -
82   - ead2.setNbbm(car);
83   - ead2.setEndStation(first.getZdzCode());
84   - ead2.setEndTime(endTime);
85   -
86   - Arrival2Schedule.addExpect(car, ead);
87   - Arrival2Schedule.addExpect(car, ead2);
88   - }
89   - }
90   - }
91   - }catch(Exception e){
92   - logger.error("", e);
93   - }
94   - }
95   -}
  1 +//package com.bsth.data.directive;
  2 +//
  3 +//import java.util.List;
  4 +//import java.util.Set;
  5 +//
  6 +//import org.slf4j.Logger;
  7 +//import org.slf4j.LoggerFactory;
  8 +//import org.springframework.beans.factory.annotation.Autowired;
  9 +//import org.springframework.stereotype.Component;
  10 +//
  11 +//import com.bsth.data.match.Arrival2Schedule;
  12 +//import com.bsth.data.match.ExpectArrivalEnd;
  13 +//import com.bsth.data.schedule.DayOfSchedule;
  14 +//import com.bsth.entity.realcontrol.ScheduleRealInfo;
  15 +//import com.bsth.service.directive.DirectiveService;
  16 +//
  17 +///**
  18 +// *
  19 +// * @ClassName: FirstScheduleCheckThread
  20 +// * @Description: TODO(首班出场检测)
  21 +// * @author PanZhao
  22 +// * @date 2016年8月27日 上午1:25:21
  23 +// *
  24 +// */
  25 +//@Component
  26 +//public class FirstScheduleCheckThread extends Thread{
  27 +//
  28 +// @Autowired
  29 +// DayOfSchedule dayOfSchedule;
  30 +//
  31 +// @Autowired
  32 +// DirectiveService directiveService;
  33 +//
  34 +// Logger logger = LoggerFactory.getLogger(this.getClass());
  35 +//
  36 +// //提前半小时下发指令
  37 +// private final static long THREE_MINUTES = 1000 * 60 * 30L;
  38 +//
  39 +// @Override
  40 +// public void run() {
  41 +// try{
  42 +// Set<String> cars = dayOfSchedule.allCar();
  43 +//
  44 +// long t = System.currentTimeMillis();
  45 +// List<ScheduleRealInfo> schList;
  46 +// ScheduleRealInfo first;
  47 +// for(String car : cars){
  48 +//
  49 +// schList = dayOfSchedule.findByNbbm(car);
  50 +//
  51 +// if(null == schList || schList.size() == 0)
  52 +// continue;
  53 +//
  54 +// first = schList.get(0);
  55 +//
  56 +// if(null != first.getBcType()
  57 +// && first.getBcType().equals("out")){
  58 +//
  59 +// //没有计划里程的出场班次,出场既是首发站,发送下一班次的营运指令
  60 +// if(first.getJhlc() == null && first.getXlDir().equals(schList.get(1).getXlDir()))
  61 +// first = schList.get(1);
  62 +//
  63 +// //为首班补发指令
  64 +// if(first.getDirectiveState() == -1
  65 +// && Math.abs(first.getDfsjT() - t) < THREE_MINUTES){
  66 +//
  67 +// directiveService.send60Dispatch(first, dayOfSchedule.doneSum(first.getClZbh()), "定补@系统");
  68 +// //期望完成出场班次时间
  69 +// long endTime;
  70 +//
  71 +// if(first.getZdsj() != null)
  72 +// endTime=first.getZdsjT() - 60000;
  73 +// else
  74 +// endTime=schList.get(1).getDfsjT() - 60000;
  75 +//
  76 +// ExpectArrivalEnd ead = new ExpectArrivalEnd()
  77 +// ,ead2 = new ExpectArrivalEnd();
  78 +// ead.setNbbm(car);
  79 +// ead.setEndStation(first.getQdzCode());
  80 +// ead.setEndTime(endTime);
  81 +//
  82 +// ead2.setNbbm(car);
  83 +// ead2.setEndStation(first.getZdzCode());
  84 +// ead2.setEndTime(endTime);
  85 +//
  86 +// Arrival2Schedule.addExpect(car, ead);
  87 +// Arrival2Schedule.addExpect(car, ead2);
  88 +// }
  89 +// }
  90 +// }
  91 +// }catch(Exception e){
  92 +// logger.error("", e);
  93 +// }
  94 +// }
  95 +//}
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONArray;
5 5 import com.bsth.Application;
6 6 import com.bsth.data.BasicData;
7 7 import com.bsth.data.LineConfigData;
8   -import com.bsth.data.directive.FirstScheduleCheckThread;
  8 +import com.bsth.data.directive.DirectivesPstThread;
9 9 import com.bsth.data.gpsdata.GpsRealData;
10 10 import com.bsth.data.gpsdata.recovery.GpsDataRecovery;
11 11 import com.bsth.data.schedule.thread.ScheduleLateThread;
... ... @@ -115,9 +115,6 @@ public class DayOfSchedule implements CommandLineRunner {
115 115 SchedulePstThread schedulePstThread;
116 116  
117 117 @Autowired
118   - FirstScheduleCheckThread firstScheduleCheckThread;
119   -
120   - @Autowired
121 118 ScheduleLateThread scheduleLateThread;
122 119  
123 120 @Autowired
... ... @@ -129,6 +126,9 @@ public class DayOfSchedule implements CommandLineRunner {
129 126 @Autowired
130 127 GpsDataRecovery gpsDataRecovery;
131 128  
  129 + @Autowired
  130 + DirectivesPstThread directivesPstThread;
  131 +
132 132 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), fmtHHmm = DateTimeFormat.forPattern("HH:mm");
133 133  
134 134 @Override
... ... @@ -141,8 +141,6 @@ public class DayOfSchedule implements CommandLineRunner {
141 141 Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
142 142 //入库
143 143 // Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
144   - //首班出场指令补发器
145   -// Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS);
146 144 //班次误点扫描
147 145 // Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
148 146  
... ... @@ -153,6 +151,9 @@ public class DayOfSchedule implements CommandLineRunner {
153 151  
154 152 logger.info(diff / 1000 / 60 + "分钟之后提交到运管处");
155 153 //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
  154 +
  155 + //指令持久化线程
  156 + Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS);
156 157 }
157 158  
158 159 //数据恢复
... ...
src/main/java/com/bsth/entity/logger/Logger.java 0 → 100644
  1 +package com.bsth.entity.logger;
  2 +
  3 +import javax.persistence.GeneratedValue;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.MappedSuperclass;
  6 +
  7 +/**
  8 + * 操作日志通用字段
  9 + * Created by panzhao on 2017/3/6.
  10 + */
  11 +@MappedSuperclass
  12 +public abstract class Logger {
  13 +
  14 + @Id
  15 + @GeneratedValue
  16 + private Long id;
  17 +
  18 + /** 用户信息 */
  19 + private String userName;
  20 + private String name;
  21 +
  22 + /** ########## 客户端信息 ########### */
  23 + /** ip */
  24 + private String clientIp;
  25 + /** 浏览器 */
  26 + private String browser;
  27 + /** 系统平台 */
  28 + private String clientSystem;
  29 + /** 浏览器内核 */
  30 + private String browserCore;
  31 +
  32 + /** 操作时间 */
  33 + private Long ts;
  34 +
  35 + public String getUserName() {
  36 + return userName;
  37 + }
  38 +
  39 + public void setUserName(String userName) {
  40 + this.userName = userName;
  41 + }
  42 +
  43 + public String getName() {
  44 + return name;
  45 + }
  46 +
  47 + public void setName(String name) {
  48 + this.name = name;
  49 + }
  50 +
  51 + public String getClientIp() {
  52 + return clientIp;
  53 + }
  54 +
  55 + public void setClientIp(String clientIp) {
  56 + this.clientIp = clientIp;
  57 + }
  58 +
  59 + public String getBrowser() {
  60 + return browser;
  61 + }
  62 +
  63 + public void setBrowser(String browser) {
  64 + this.browser = browser;
  65 + }
  66 +
  67 + public String getClientSystem() {
  68 + return clientSystem;
  69 + }
  70 +
  71 + public void setClientSystem(String clientSystem) {
  72 + this.clientSystem = clientSystem;
  73 + }
  74 +
  75 + public String getBrowserCore() {
  76 + return browserCore;
  77 + }
  78 +
  79 + public void setBrowserCore(String browserCore) {
  80 + this.browserCore = browserCore;
  81 + }
  82 +
  83 + public Long getTs() {
  84 + return ts;
  85 + }
  86 +
  87 + public void setTs(Long ts) {
  88 + this.ts = ts;
  89 + }
  90 +}
... ...
src/main/java/com/bsth/entity/logger/Logger_MileModify.java 0 → 100644
  1 +package com.bsth.entity.logger;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Table;
  5 +
  6 +/**
  7 + * 操作日志 -修改公里
  8 + * Created by panzhao on 2017/3/6.
  9 + */
  10 +@Entity
  11 +@Table(name = "logger_mile_modify")
  12 +public class Logger_MileModify extends Logger{
  13 +
  14 + /** 之前的公里 */
  15 + private Double beforeMile;
  16 +
  17 + /** 修改之后的公里 */
  18 + private Double afterMile;
  19 +
  20 + /** 线路 code/name */
  21 + private String lineStr;
  22 +
  23 + /** 路牌 */
  24 + private String lp;
  25 +
  26 + /** 车辆自编号 */
  27 + private String nbbm;
  28 +
  29 + /** 发车时间 */
  30 + private String fcsj;
  31 +
  32 + /** 班次ID */
  33 + private Long schId;
  34 +
  35 + /** 备注 */
  36 + private String remarks;
  37 +
  38 + public Double getBeforeMile() {
  39 + return beforeMile;
  40 + }
  41 +
  42 + public void setBeforeMile(Double beforeMile) {
  43 + this.beforeMile = beforeMile;
  44 + }
  45 +
  46 + public Double getAfterMile() {
  47 + return afterMile;
  48 + }
  49 +
  50 + public void setAfterMile(Double afterMile) {
  51 + this.afterMile = afterMile;
  52 + }
  53 +
  54 + public String getLineStr() {
  55 + return lineStr;
  56 + }
  57 +
  58 + public void setLineStr(String lineStr) {
  59 + this.lineStr = lineStr;
  60 + }
  61 +
  62 + public String getLp() {
  63 + return lp;
  64 + }
  65 +
  66 + public void setLp(String lp) {
  67 + this.lp = lp;
  68 + }
  69 +
  70 + public String getNbbm() {
  71 + return nbbm;
  72 + }
  73 +
  74 + public void setNbbm(String nbbm) {
  75 + this.nbbm = nbbm;
  76 + }
  77 +
  78 + public String getFcsj() {
  79 + return fcsj;
  80 + }
  81 +
  82 + public void setFcsj(String fcsj) {
  83 + this.fcsj = fcsj;
  84 + }
  85 +
  86 + public Long getSchId() {
  87 + return schId;
  88 + }
  89 +
  90 + public void setSchId(Long schId) {
  91 + this.schId = schId;
  92 + }
  93 +
  94 + public String getRemarks() {
  95 + return remarks;
  96 + }
  97 +
  98 + public void setRemarks(String remarks) {
  99 + this.remarks = remarks;
  100 + }
  101 +}
... ...
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
... ... @@ -56,6 +56,23 @@ public class LineConfig {
56 56 /** 识别区间调头 */
57 57 private boolean readReverse;
58 58  
  59 + /** 原线路回场 */
  60 + private boolean inParkForSource;
  61 +
  62 + /**
  63 + * 到离站偏移值
  64 + */
  65 +
  66 + //上行进站
  67 + private int upInDiff;
  68 + //上行出站
  69 + private int upOutDiff;
  70 + //下行进站
  71 + private int downInDiff;
  72 + //下行出站
  73 + private int downOutDiff;
  74 +
  75 +
59 76 @OneToMany(cascade = CascadeType.ALL)
60 77 private Set<D80ReplyTemp> d80Temps = new HashSet<>();
61 78  
... ... @@ -151,4 +168,44 @@ public class LineConfig {
151 168 public void setReadReverse(boolean readReverse) {
152 169 this.readReverse = readReverse;
153 170 }
  171 +
  172 + public boolean isInParkForSource() {
  173 + return inParkForSource;
  174 + }
  175 +
  176 + public void setInParkForSource(boolean inParkForSource) {
  177 + this.inParkForSource = inParkForSource;
  178 + }
  179 +
  180 + public int getUpInDiff() {
  181 + return upInDiff;
  182 + }
  183 +
  184 + public void setUpInDiff(int upInDiff) {
  185 + this.upInDiff = upInDiff;
  186 + }
  187 +
  188 + public int getUpOutDiff() {
  189 + return upOutDiff;
  190 + }
  191 +
  192 + public void setUpOutDiff(int upOutDiff) {
  193 + this.upOutDiff = upOutDiff;
  194 + }
  195 +
  196 + public int getDownInDiff() {
  197 + return downInDiff;
  198 + }
  199 +
  200 + public void setDownInDiff(int downInDiff) {
  201 + this.downInDiff = downInDiff;
  202 + }
  203 +
  204 + public int getDownOutDiff() {
  205 + return downOutDiff;
  206 + }
  207 +
  208 + public void setDownOutDiff(int downOutDiff) {
  209 + this.downOutDiff = downOutDiff;
  210 + }
154 211 }
... ...
src/main/java/com/bsth/repository/logger/MileModifyRepository.java 0 → 100644
  1 +package com.bsth.repository.logger;
  2 +
  3 +import com.bsth.entity.logger.Logger_MileModify;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/3/6.
  9 + */
  10 +@Repository
  11 +public interface MileModifyRepository extends BaseRepository<Logger_MileModify, Long>{
  12 +}
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -30,6 +30,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
30 30  
31 31 @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName,s.sGh,s.sName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName,s.sGh,s.sName order by (lpName+1)")
32 32 List<ScheduleRealInfo> queryUserInfo2(String line,String date);
  33 +
  34 + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName,s.sGh,s.sName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName,s.sGh,s.sName order by ?3 desc")
  35 + List<ScheduleRealInfo> queryUserInfoPxDesc(String line,String date,String state);
  36 +
  37 + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName,s.sGh,s.sName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName,s.sGh,s.sName order by ?3 asc")
  38 + List<ScheduleRealInfo> queryUserInfoPxAsc(String line,String date,String state);
33 39  
34 40 @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.clZbh ")
35 41 List<ScheduleRealInfo> queryUserInfo3(String line,String date);
... ... @@ -114,9 +120,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
114 120 void deleteByLineCodeAndDate(String xlBm, String schDate);
115 121  
116 122 //去掉了 xlBm is not null
117   - @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.fcsj")
  123 + @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.realExecDate,s.fcsj, (s.lpName+1)")
118 124 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
119 125  
  126 + @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.fcsj")
  127 + List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);
  128 +
120 129 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
121 130 List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date);
122 131  
... ...
src/main/java/com/bsth/service/logger/MileModifyService.java 0 → 100644
  1 +package com.bsth.service.logger;
  2 +
  3 +import com.bsth.entity.logger.Logger_MileModify;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +/**
  7 + * Created by panzhao on 2017/3/6.
  8 + */
  9 +public interface MileModifyService extends BaseService<Logger_MileModify, Long>{
  10 +}
... ...
src/main/java/com/bsth/service/logger/impl/MileModifyServiceImpl.java 0 → 100644
  1 +package com.bsth.service.logger.impl;
  2 +
  3 +import com.bsth.entity.logger.Logger_MileModify;
  4 +import com.bsth.service.impl.BaseServiceImpl;
  5 +import com.bsth.service.logger.MileModifyService;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/3/6.
  10 + */
  11 +@Service
  12 +public class MileModifyServiceImpl extends BaseServiceImpl<Logger_MileModify, Long> implements MileModifyService {
  13 +}
... ...
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
... ... @@ -16,4 +16,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{
16 16 Map<String, Object> editOutTimeType(String lineCode, int type);
17 17  
18 18 LineConfig getByLineCode(String lineCode);
  19 +
  20 + Map<String,Object> enableInParkForSource(String lineCode, int enable);
19 21 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -62,6 +62,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
62 62  
63 63 List<ScheduleRealInfo> queryUserInfo(String line,String date,String state);
64 64  
  65 + List<ScheduleRealInfo> queryUserInfoPx(String line,String date,String state,String type);
  66 +
65 67 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName,String date,String line);
66 68  
67 69 List<ScheduleRealInfo> exportWaybillQp(String clZbh,String date,String line);
... ... @@ -122,7 +124,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
122 124 Map<String,Object> scheduleDaily(String line,String date);
123 125  
124 126 List<ScheduleRealInfo> realScheduleList(String line,String date);
125   -
  127 + List<ScheduleRealInfo> realScheduleListQp(String line,String date);
126 128  
127 129 List<Map<String,Object>> yesterdayDataList(String line,String date);
128 130  
... ... @@ -152,7 +154,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
152 154  
153 155 List<SchedulePlanInfo> currentSchedulePlan(String lineCode);
154 156  
155   - Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx);
  157 + Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx, int type);
156 158  
157   - void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch);
  159 + void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type);
158 160 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
... ... @@ -6,6 +6,8 @@ import com.bsth.entity.realcontrol.LineConfig;
6 6 import com.bsth.repository.realcontrol.LineConfigRepository;
7 7 import com.bsth.service.impl.BaseServiceImpl;
8 8 import com.bsth.service.realcontrol.LineConfigService;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
9 11 import org.springframework.beans.factory.annotation.Autowired;
10 12 import org.springframework.stereotype.Service;
11 13  
... ... @@ -15,71 +17,103 @@ import java.util.List;
15 17 import java.util.Map;
16 18  
17 19 @Service
18   -public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> implements LineConfigService{
19   -
20   - @Autowired
21   - LineConfigRepository lineConfigRepository;
22   -
23   - @Autowired
24   - LineConfigData lineConfigData;
25   -
26   - @Override
27   - public Map<String, Object> check(String[] codeArray) {
28   - Map<String, Object> rs = new HashMap<>();
29   - List<String> notArr = new ArrayList<>();
30   -
31   - for(String lineCode : codeArray){
32   - if(null == lineConfigData.get(lineCode + ""))
33   - notArr.add(lineCode);
34   - }
35   -
36   - if(notArr.size() > 0){
37   - rs.put("status", 1);
38   - rs.put("not", notArr);
39   - }
40   - else
41   - rs.put("status", 0);
42   - return rs;
43   - }
44   -
45   - @Override
46   - public Integer init(String lineCode) throws Exception{
47   - LineConfig conf = lineConfigData.get(lineCode );
48   -
49   - if(conf == null)
50   - lineConfigData.init(lineCode);
51   -
52   - return 1;
53   - }
54   -
55   - @Override
56   - public Map<String, Object> editStartOptTime(String time, String lineCode) {
57   - Map<String, Object> rs = new HashMap<>();
58   - LineConfig conf = lineConfigData.get(lineCode);
59   - conf.setStartOpt(time);
60   - lineConfigData.set(conf);
61   -
62   - rs.put("status", ResponseCode.SUCCESS);
63   - rs.put("time", time);
64   - return rs;
65   - }
66   -
67   - @Override
68   - public Map<String, Object> editOutTimeType(String lineCode, int type) {
69   - Map<String, Object> rs = new HashMap<>();
70   - LineConfig conf = lineConfigData.get(lineCode);
71   -
72   - conf.setOutConfig(type);
73   - //conf.setInConfig(type);
74   - lineConfigData.set(conf);
75   -
76   - rs.put("status", ResponseCode.SUCCESS);
77   - rs.put("type", type);
78   - return rs;
79   - }
80   -
81   - @Override
82   - public LineConfig getByLineCode(String lineCode) {
83   - return lineConfigData.get(lineCode);
84   - }
  20 +public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> implements LineConfigService {
  21 +
  22 + @Autowired
  23 + LineConfigRepository lineConfigRepository;
  24 +
  25 + @Autowired
  26 + LineConfigData lineConfigData;
  27 +
  28 + Logger logger = LoggerFactory.getLogger(this.getClass());
  29 +
  30 + @Override
  31 + public Map<String, Object> check(String[] codeArray) {
  32 + Map<String, Object> rs = new HashMap<>();
  33 + List<String> notArr = new ArrayList<>();
  34 +
  35 + for (String lineCode : codeArray) {
  36 + if (null == lineConfigData.get(lineCode + ""))
  37 + notArr.add(lineCode);
  38 + }
  39 +
  40 + if (notArr.size() > 0) {
  41 + rs.put("status", 1);
  42 + rs.put("not", notArr);
  43 + } else
  44 + rs.put("status", 0);
  45 + return rs;
  46 + }
  47 +
  48 + @Override
  49 + public Integer init(String lineCode) throws Exception {
  50 + LineConfig conf = lineConfigData.get(lineCode);
  51 +
  52 + if (conf == null)
  53 + lineConfigData.init(lineCode);
  54 +
  55 + return 1;
  56 + }
  57 +
  58 + @Override
  59 + public Map<String, Object> editStartOptTime(String time, String lineCode) {
  60 + Map<String, Object> rs = new HashMap<>();
  61 + try {
  62 + LineConfig conf = lineConfigData.get(lineCode);
  63 + conf.setStartOpt(time);
  64 + lineConfigData.set(conf);
  65 +
  66 + rs.put("status", ResponseCode.SUCCESS);
  67 + rs.put("time", time);
  68 + } catch (Exception e) {
  69 + rs.put("status", ResponseCode.ERROR);
  70 + rs.put("msg", e.getMessage());
  71 + logger.error("", e);
  72 + }
  73 + return rs;
  74 + }
  75 +
  76 + @Override
  77 + public Map<String, Object> editOutTimeType(String lineCode, int type) {
  78 + Map<String, Object> rs = new HashMap<>();
  79 + try {
  80 + LineConfig conf = lineConfigData.get(lineCode);
  81 +
  82 + conf.setOutConfig(type);
  83 + //conf.setInConfig(type);
  84 + lineConfigData.set(conf);
  85 +
  86 + rs.put("status", ResponseCode.SUCCESS);
  87 + rs.put("type", type);
  88 + } catch (Exception e) {
  89 + rs.put("status", ResponseCode.ERROR);
  90 + rs.put("msg", e.getMessage());
  91 + logger.error("", e);
  92 + }
  93 + return rs;
  94 + }
  95 +
  96 + @Override
  97 + public LineConfig getByLineCode(String lineCode) {
  98 + return lineConfigData.get(lineCode);
  99 + }
  100 +
  101 + @Override
  102 + public Map<String, Object> enableInParkForSource(String lineCode, int enable) {
  103 + Map<String, Object> rs = new HashMap<>();
  104 + try {
  105 + LineConfig conf = lineConfigData.get(lineCode);
  106 +
  107 + conf.setInParkForSource(enable==1);
  108 + lineConfigData.set(conf);
  109 +
  110 + rs.put("status", ResponseCode.SUCCESS);
  111 + rs.put("enable", enable);
  112 + } catch (Exception e) {
  113 + rs.put("status", ResponseCode.ERROR);
  114 + rs.put("msg", e.getMessage());
  115 + logger.error("", e);
  116 + }
  117 + return rs;
  118 + }
85 119 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -56,9 +56,13 @@ import org.joda.time.format.DateTimeFormatter;
56 56 import org.slf4j.Logger;
57 57 import org.slf4j.LoggerFactory;
58 58 import org.springframework.beans.factory.annotation.Autowired;
  59 +import org.springframework.jdbc.core.JdbcTemplate;
  60 +import org.springframework.jdbc.core.RowMapper;
59 61 import org.springframework.stereotype.Service;
60 62  
61 63 import java.io.*;
  64 +import java.sql.ResultSet;
  65 +import java.sql.SQLException;
62 66 import java.text.DecimalFormat;
63 67 import java.text.ParseException;
64 68 import java.text.SimpleDateFormat;
... ... @@ -69,7 +73,8 @@ import java.util.zip.ZipOutputStream;
69 73 @Service
70 74 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
71 75 implements ScheduleRealInfoService {
72   -
  76 + @Autowired
  77 + JdbcTemplate jdbcTemplate;
73 78 @Autowired
74 79 ScheduleRealInfoRepository scheduleRealInfoRepository;
75 80  
... ... @@ -448,6 +453,33 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
448 453 }
449 454  
450 455 }
  456 +
  457 + @Override
  458 + public List<ScheduleRealInfo> queryUserInfoPx(String line, String date, String state,String type) {
  459 +// List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  460 + String sqlPlan="select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh,"
  461 + + " s.lp_Name as lpName,s.j_Name as jName,s.s_Gh as sGh,s.s_Name as sName"
  462 + + " from bsth_c_s_sp_info_real s "
  463 + + " where s.xl_Bm = '"+line+"' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='"+date+"' "
  464 + + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name,s.s_Gh,"
  465 + + " s.s_Name order by "+state+" "+type;
  466 + List<ScheduleRealInfo> list= jdbcTemplate.query(sqlPlan,
  467 + new RowMapper<ScheduleRealInfo>(){
  468 + @Override
  469 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  470 + ScheduleRealInfo t=new ScheduleRealInfo();
  471 + t.setId(rs.getLong("id"));
  472 + t.setjGh(rs.getString("jGh"));
  473 + t.setClZbh(rs.getString("clZbh"));
  474 + t.setLpName(rs.getString("lpName"));
  475 + t.setjName(rs.getString("jName"));
  476 + t.setsGh(rs.getString("sGh"));
  477 + t.setsName(rs.getString("sName"));
  478 + return t;
  479 + }
  480 + });
  481 + return list;
  482 + }
451 483  
452 484 /**
453 485 *
... ... @@ -861,12 +893,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
861 893 List<ScheduleRealInfo> ts = new ArrayList<>();
862 894 try {
863 895 Long id = Long.parseLong(map.get("id"));
864   - //班次类型
865   - //String bcType = map.get("bcType");
866   - //车辆自编号
867   - //String clZbh = map.get("clZbh");
868   - //计划发车时间
869   - //String fcsj = map.get("fcsj");
870 896 //实际发车时间
871 897 String fcsjActual = map.get("fcsjActual");
872 898 //实际终点时间
... ... @@ -928,6 +954,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
928 954 } catch (NumberFormatException e) {
929 955 logger.error("", e);
930 956 }
  957 +
  958 + //修改班次里程
  959 + String jhlc = map.get("jhlc");
  960 + if(StringUtils.isNotEmpty(jhlc)
  961 + && Double.parseDouble(jhlc) != sch.getJhlc()){
  962 + sch.setJhlc(Double.parseDouble(jhlc));
  963 + }
931 964 }
932 965  
933 966 String bcType = map.get("bcType");
... ... @@ -1360,39 +1393,50 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1360 1393 if (s.getRemarks() != null) {
1361 1394 remarks += s.getRemarks();
1362 1395 }
1363   -
  1396 +
1364 1397 Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
1365   - if (childTaskPlans.isEmpty()) {
1366   - if(s.getStatus()==-1){
1367   - if(remarks.indexOf("烂班")>-1){
1368   - remarks +="(烂班)";
1369   - }
1370   - s.setRemarks(remarks);
1371   - }
1372   -
1373   - }else{
  1398 + if (!childTaskPlans.isEmpty()) {
1374 1399 s.setFcsjActual("");
1375 1400 s.setZdsjActual("");
1376 1401 }
  1402 +
  1403 + if(s.isDestroy()){
  1404 + s.setFcsjActual("");
  1405 + s.setZdsjActual("");
  1406 + s.setJhlc(0.0);
  1407 + remarks +="(烂班)";
  1408 + s.setRemarks(remarks);
  1409 + }
1377 1410 listSchedule.add(s);
1378   - if(!childTaskPlans.isEmpty()){
1379   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1380   - while (it.hasNext()) {
1381   - ChildTaskPlan c = it.next();
1382   - if(!c.isDestroy()){
1383   - ScheduleRealInfo t=new ScheduleRealInfo();
1384   - t.setFcsjActual(c.getStartDate());
1385   - t.setZdsjActual(c.getEndDate());
1386   - t.setQdzName(c.getStartStationName());
1387   - t.setZdzName(c.getEndStationName());
1388   - t.setJhlc( Double.parseDouble(String.valueOf(c.getMileage())));
1389   - t.setRemarks(c.getRemarks());
1390   - t.setAdjustExps("子");
1391   - listSchedule.add(t);
1392   - }
1393   - }
  1411 + //计算营运里程,空驶里程
  1412 + if (!childTaskPlans.isEmpty()) {
  1413 + String sqlPc="select * from bsth_c_s_child_task where schedule="+s.getId() +" order by start_date ";
  1414 + List<ScheduleRealInfo> lists= jdbcTemplate.query(sqlPc,
  1415 + new RowMapper<ScheduleRealInfo>(){
  1416 + @Override
  1417 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  1418 + ScheduleRealInfo t=new ScheduleRealInfo();
  1419 + if(rs.getInt("destroy")==0){
  1420 + t.setFcsjActual(rs.getString("start_date"));
  1421 + t.setZdsjActual(rs.getString("end_date"));
  1422 + t.setJhlc(rs.getDouble("mileage"));
  1423 + }else{
  1424 + t.setFcsjActual("");
  1425 + t.setZdsjActual("");
  1426 + t.setJhlc(0.0);
  1427 + }
  1428 + t.setQdzName(rs.getString("start_station_name"));
  1429 + t.setZdzName(rs.getString("end_station_name"));
  1430 + t.setRemarks(rs.getString("remarks"));
  1431 + t.setAdjustExps("子");
  1432 + return t;
  1433 + }
  1434 + });
  1435 + for (int j = 0; j < lists.size(); j++) {
  1436 + ScheduleRealInfo t=lists.get(j);
  1437 + listSchedule.add(t);
  1438 + }
1394 1439 }
1395   -
1396 1440 }
1397 1441  
1398 1442 return listSchedule;
... ... @@ -2003,7 +2047,99 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2003 2047 String zdsjActual="";
2004 2048 String zdsj1="";
2005 2049 String zdsjActual1="";
2006   - List<ScheduleRealInfo> listInfo=scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2050 + List<ScheduleRealInfo> listInfo=scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
  2051 + for (int i = 0; i < listInfo.size(); i++) {
  2052 + ScheduleRealInfo t=listInfo.get(i);
  2053 + if(!lpName.equals(t.getLpName())){
  2054 + zdsjActual=t.getZdsjActual();
  2055 + zdsj=t.getZdsj();
  2056 + t.setZdsjActual("");
  2057 + t.setZdsj("");
  2058 + }else{
  2059 + zdsj1=t.getZdsj();
  2060 + zdsjActual1=t.getZdsjActual();
  2061 + t.setZdsjActual(zdsjActual);
  2062 + t.setZdsj(zdsj);
  2063 + zdsj=zdsj1;
  2064 + zdsjActual=zdsjActual1;
  2065 + }
  2066 + lpName=t.getLpName();
  2067 + list.add(t);
  2068 + }
  2069 +
  2070 + List<ScheduleRealInfo> listInfo2=scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2071 + List<ScheduleRealInfo> xList=new ArrayList<ScheduleRealInfo>();
  2072 + List<ScheduleRealInfo> yList=new ArrayList<ScheduleRealInfo>();
  2073 + List<ScheduleRealInfo> zList=new ArrayList<ScheduleRealInfo>();
  2074 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  2075 + if(listInfo2.size()>0){
  2076 + int a=listInfo2.size()%3;
  2077 + int b=listInfo2.size()/3;
  2078 + int x = 0,y=0;
  2079 + if(a==2){
  2080 + x=b+1;y=x*2;;
  2081 + }else if(b==1){
  2082 + x=b+1;y=x*2-1;;
  2083 + }else{
  2084 + x=b;
  2085 + y=2*x;
  2086 +
  2087 + }
  2088 + for (int i = 0; i < listInfo2.size(); i++) {
  2089 + ScheduleRealInfo s=listInfo2.get(i);
  2090 + if(i+1<=x){
  2091 + xList.add(s);
  2092 + }else if((i+1)>x&&(i+1)<=y){
  2093 + yList.add(s);
  2094 + }else{
  2095 + zList.add(s);
  2096 + }
  2097 + }
  2098 + for (int i = 0; i < x; i++) {
  2099 + newList.add(xList.get(i));
  2100 + if(yList.size()>i){
  2101 + newList.add(yList.get(i));
  2102 + }else{
  2103 + newList.add(new ScheduleRealInfo());
  2104 + }
  2105 + if(zList.size()>i){
  2106 + newList.add(zList.get(i));
  2107 + }else{
  2108 + newList.add(new ScheduleRealInfo());
  2109 + }
  2110 +
  2111 + }
  2112 + }
  2113 + for (int i = 0; i < newList.size(); i++) {
  2114 + ScheduleRealInfo t1=newList.get(i);
  2115 + for (int j = 0; j < list.size(); j++) {
  2116 + ScheduleRealInfo t2=list.get(j);
  2117 + if(t1.getId()==t2.getId()){
  2118 + t1=t2;
  2119 + }
  2120 + }
  2121 + }
  2122 + return newList;
  2123 + }
  2124 +
  2125 + @Override
  2126 + public List<ScheduleRealInfo> realScheduleListQp(String line, String date) {
  2127 + /*List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.queryUserInfo(line, date);
  2128 + List<ScheduleRealInfo> listTotal = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2129 + for(ScheduleRealInfo info:listInfo){
  2130 + for(ScheduleRealInfo total:listTotal){
  2131 + if(info.getjGh().equals(total.getjGh()) && info.getLpName().equals(total.getLpName()) && info.getClZbh().equals(total.getClZbh())){
  2132 +
  2133 + }
  2134 + }
  2135 + }*/
  2136 + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  2137 + String lpName="lpName";
  2138 + String zdsj="";
  2139 + String zdsjActual="";
  2140 + String zdsj1="";
  2141 + String zdsjActual1="";
  2142 + List<ScheduleRealInfo> listInfo=scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
2007 2143 for (int i = 0; i < listInfo.size(); i++) {
2008 2144 ScheduleRealInfo t=listInfo.get(i);
2009 2145 if(!lpName.equals(t.getLpName())){
... ... @@ -2038,7 +2174,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2038 2174 return list;
2039 2175 }
2040 2176  
2041   -
2042 2177 public List<Map<String, Object>> yesterdayDataList(String line, String date) {
2043 2178 //前一天日期
2044 2179 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
... ... @@ -3251,7 +3386,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3251 3386  
3252 3387  
3253 3388 @Override
3254   - public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx) {
  3389 + public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx, int type) {
3255 3390 Map<String, Object> rs = new HashMap<>();
3256 3391 List<ScheduleRealInfo> ts = new ArrayList<>();
3257 3392 try {
... ... @@ -3269,10 +3404,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3269 3404 rightSch = dayOfSchedule.get(Long.parseLong(rightList.get(i)));
3270 3405  
3271 3406 //调换路牌
3272   - lpChange(leftSch, rightSch);
  3407 + lpChange(leftSch, rightSch, type);
3273 3408  
3274 3409 ts.add(leftSch);
3275 3410 ts.add(rightSch);
  3411 +
  3412 + dayOfSchedule.save(leftSch);
  3413 + dayOfSchedule.save(rightSch);
3276 3414 }
3277 3415  
3278 3416 rs.put("status", ResponseCode.SUCCESS);
... ... @@ -3287,11 +3425,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3287 3425 }
3288 3426  
3289 3427 @Override
3290   - public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch) {
  3428 + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) {
3291 3429 LpData leftData = new LpData(leftSch);
3292 3430 LpData rightData = new LpData(rightSch);
3293 3431  
3294   - leftData.appendTo(rightSch);
3295   - rightData.appendTo(leftSch);
  3432 + leftData.appendTo(rightSch, type);
  3433 + rightData.appendTo(leftSch, type);
3296 3434 }
3297 3435 }
3298 3436 \ No newline at end of file
... ...
src/main/resources/static/login.html
... ... @@ -16,171 +16,163 @@
16 16 <link href="/metronic_v4.5.4/css/components.css" rel="stylesheet"
17 17 type="text/css" />
18 18  
19   -<style type="text/css">
20   -body>.wrapper {
21   - background-image: url(/assets/img/bg_9b9dcb65ff.png);
22   - background-size: 100px;
23   - background-repeat: repeat;
24   - min-height: 800px;
25   - min-width: 630px;
26   - position: absolute;
27   - top: 0;
28   - bottom: 0;
29   - left: 0;
30   - right: 0;
31   -}
32   -
33   -#loginPanel.dialog-shadow {
34   - width: 450px;
35   - /* height: 400px; */
36   - border: 1px solid #dadada;
37   - border-radius: 10px !important;
38   - position: absolute;
39   - box-shadow: 0 9px 30px -6px rgba(0, 0, 0, .2), 0 18px 20px -10px
40   - rgba(0, 0, 0, .04), 0 18px 20px -10px rgba(0, 0, 0, .04), 0 10px 20px
41   - -10px rgba(0, 0, 0, .04);
42   - background: url(/assets/img/dialog-gray-bg_42c40b3eb6.png) #fff bottom
43   - repeat-x;
44   - top: 50%;
45   - left: 50%;
46   - margin-left: -225px;
47   - margin-top: -300px;
48   - text-align: center;
49   - color: #333;
50   - opacity: .5;
51   - padding-bottom: 56px;
52   - animation: to_center 1s forwards;
53   - animation-delay: .2s;
54   - transition: all .3s ease;
55   -}
56   -
57   -@
58   -keyframes to_center { 0% {
59   - margin-top: -300px;
60   - opacity: .5;
61   -}
62   -
63   -100%
64   -{
65   -margin-top
66   -:
67   -
68   --270
69   -px
70   -;opacity
71   -:
72   -
73   -1;
74   -}
75   -}
76   -h3 {
77   - font-size: 25px;
78   - font-weight: 600;
79   - color: #4a4a4a
80   -}
81   -
82   -.input-icon input {
83   - height: 48px;
84   - border-radius: 5px !important;
85   - transition: all .5s ease;
86   -}
87   -
88   -.input-icon input:FOCUS {
89   - border-color: #c2cad8;
90   - box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0
91   - rgba(0, 0, 0, 0.12) !important;
92   -}
93   -
94   -.input-icon>i {
95   - margin-top: 16px;
96   -}
97   -
98   -#loginPanel #loginBtn.btn {
99   - border-radius: 6px !important;
100   - width: 378px;
101   - height: 48px;
102   - font-size: 20px;
103   - font-family: 微软雅黑;
104   - transition: all .3s ease;
105   - background: #5f7ed7;
106   - background: linear-gradient(#6f97e5, #527ed9);
107   - box-shadow: inset 0 1px 2px #7ea1e8 !important;
108   - color: #fff;
109   - text-shadow: #4f70b3 0 -1px 0;
110   - border: none;
111   -}
112   -
113   -#loginPanel #loginBtn.btn:HOVER {
114   - box-shadow: inset 0 1px 1px #7696de, inset 0 0 2px #627dca, inset 0 -2px
115   - 3px #5a77c7, inset 0 0 100px rgba(48, 77, 147, .4) !important;
116   -}
117   -
118   -#loginPanel.show_msg {
119   - top: calc(50% - 10px);
120   -}
121   -
122   -#loginPanel .alert {
123   - display: none;
124   - padding: 12px;
125   - margin-top: 21px;
126   - border-radius: 0 0 10px 10px !important;
127   - font-size: 13px;
128   - position: absolute;
129   - width: 100%;
130   - border-bottom: 1px solid #dadada;
131   -}
132   -
133   -#loginPanel .alert.login-success {
134   - color: #27a4b0;
135   - background: #abe7ed;
136   - border-color: #abe7ed;
137   -}
138   -
139   -#loginPanel .alert i {
140   - font-size: 16px;
141   - vertical-align: middle;
142   - margin: 0 5px 3px;
143   -}
144   -
145   -#loginPanel.show_msg .alert {
146   - display: block;
147   -}
148   -
149   -#captchaWrap {
150   - display: none;
151   - text-align: left;
152   - border-top: 1px solid #f3f2f2;
153   -}
154   -
155   -img.captcha-img {
156   - cursor: pointer;
157   -}
158   -
159   -.login-footer {
160   - position: fixed;
161   - width: 100%;
162   - bottom: 35px;
163   - text-align: center;
164   - color: #a6a6a6;
165   -}
166   -
167   -h3.logo-text {
168   - font-family: 华文楷体, 华文细黑;
169   - font-size: 28px;
170   -}
171   -
172   -.warn-note {
173   - width: 100%;
174   - position: absolute;
175   - top: 0;
176   - z-index: 2;
177   - text-align: center;
178   - background: #ff4646;
179   - color: white;
180   - padding: 12px;
181   - display: none;
182   -}
183   -</style>
  19 + <style type="text/css">
  20 + body>.wrapper {
  21 + background-image: url(/assets/img/bg_9b9dcb65ff.png);
  22 + background-size: 100px;
  23 + background-repeat: repeat;
  24 + min-height: 800px;
  25 + min-width: 630px;
  26 + position: absolute;
  27 + top: 0;
  28 + bottom: 0;
  29 + left: 0;
  30 + right: 0;
  31 + }
  32 +
  33 + #loginPanel.dialog-shadow {
  34 + width: 450px;
  35 + /* height: 400px; */
  36 + border: 1px solid #dadada;
  37 + border-radius: 10px !important;
  38 + position: absolute;
  39 + box-shadow: 0 9px 30px -6px rgba(0, 0, 0, .2), 0 18px 20px -10px
  40 + rgba(0, 0, 0, .04), 0 18px 20px -10px rgba(0, 0, 0, .04), 0 10px 20px
  41 + -10px rgba(0, 0, 0, .04);
  42 + background: url(/assets/img/dialog-gray-bg_42c40b3eb6.png) #fff bottom
  43 + repeat-x;
  44 + top: 50%;
  45 + left: 50%;
  46 + margin-left: -225px;
  47 + margin-top: -300px;
  48 + text-align: center;
  49 + color: #333;
  50 + opacity: .5;
  51 +
  52 + padding-bottom: 56px;
  53 +
  54 + animation: to_center 1s forwards;
  55 + animation-delay: .2s;
  56 +
  57 + transition: all .3s ease;
  58 + }
  59 +
  60 + @keyframes to_center
  61 + {
  62 + 0% {margin-top: -300px;opacity: .5;}
  63 + 100% {margin-top: -270px;opacity: 1;}
  64 + }
  65 +
  66 +
  67 + h3 {
  68 + font-size: 25px;
  69 + font-weight: 600;
  70 + color: #4a4a4a
  71 + }
  72 +
  73 + .input-icon input {
  74 + height: 48px;
  75 + border-radius: 5px !important;
  76 + transition: all .5s ease;
  77 + }
  78 +
  79 + .input-icon input:FOCUS {
  80 + border-color: #c2cad8;
  81 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12) !important;
  82 + }
  83 +
  84 + .input-icon>i {
  85 + margin-top: 16px;
  86 + }
  87 +
  88 + #loginPanel #loginBtn.btn{
  89 + border-radius: 6px !important;
  90 + width: 378px;
  91 + height: 48px;
  92 + font-size: 20px;
  93 + font-family: 微软雅黑;
  94 + transition: all .3s ease;
  95 +
  96 + background: #5f7ed7;
  97 + background: linear-gradient(#6f97e5,#527ed9);
  98 + box-shadow: inset 0 1px 2px #7ea1e8 !important;
  99 + color: #fff;
  100 + text-shadow: #4f70b3 0 -1px 0;
  101 + border: none;
  102 + }
  103 +
  104 + #loginPanel #loginBtn.btn:HOVER {
  105 + box-shadow: inset 0 1px 1px #7696de,inset 0 0 2px #627dca,inset 0 -2px 3px #5a77c7,inset 0 0 100px rgba(48,77,147,.4) !important;
  106 + }
  107 +
  108 +
  109 + #loginPanel.show_msg{
  110 + top: calc(50% - 10px);
  111 + }
  112 +
  113 + #loginPanel .alert{
  114 + display: none;
  115 + padding: 12px;
  116 + margin-top: 21px;
  117 + border-radius: 0 0 10px 10px !important;
  118 + font-size: 13px;
  119 +
  120 + position: absolute;
  121 + width: 100%;
  122 + border-bottom: 1px solid #dadada;
  123 + }
  124 +
  125 + #loginPanel .alert.login-success{
  126 + color: #27a4b0;
  127 + background: #abe7ed;
  128 + border-color: #abe7ed;
  129 + }
  130 +
  131 + #loginPanel .alert i{
  132 + font-size: 16px;
  133 + vertical-align: middle;
  134 + margin: 0 5px 3px;
  135 + }
  136 +
  137 + #loginPanel.show_msg .alert{
  138 + display: block;
  139 + }
  140 +
  141 + #captchaWrap{
  142 + display: none;
  143 + text-align: left;
  144 + border-top: 1px solid #f3f2f2;
  145 + }
  146 +
  147 + img.captcha-img{
  148 + cursor: pointer;
  149 + }
  150 +
  151 + .login-footer{
  152 + position: fixed;
  153 + width: 100%;
  154 + bottom: 35px;
  155 + text-align: center;
  156 + color: #a6a6a6;
  157 + }
  158 +
  159 + h3.logo-text{
  160 + font-family: 华文楷体,华文细黑;
  161 + font-size: 28px;
  162 + }
  163 +
  164 + .warn-note{
  165 + width: 100%;
  166 + position: absolute;
  167 + top: 0;
  168 + z-index: 2;
  169 + text-align: center;
  170 + background: #ff4646;
  171 + color: white;
  172 + padding: 12px;
  173 + display: none;
  174 + }
  175 + </style>
184 176 </head>
185 177  
186 178 <body>
... ... @@ -252,16 +244,16 @@ window.onload=function(){
252 244 ,nameInput = $('input[name=userName]', form)
253 245 ,pwdInput = $('input[name=password]', form)
254 246 ,msgAlert = $('#loginPanel .alert-danger');
255   -
  247 +
256 248 $('input', form).on('keyup', checkBtnStatus);
257 249  
258 250 var keys;
259 251 $.get('/user/login/jCryptionKey?t='+Math.random(), function(data){
260 252 keys = data.publickey;
261 253 });
262   -
263   -
264   -
  254 +
  255 +
  256 +
265 257 function checkBtnStatus(){
266 258 var es = $('input:visible', form);
267 259 for(var i = 0, e; e = es[i++];){
... ... @@ -273,7 +265,7 @@ window.onload=function(){
273 265 }
274 266 $('#loginBtn').removeAttr('disabled');
275 267 }
276   -
  268 +
277 269 nameInput.on('blur', checkStatus);
278 270 //keyup 事件做延迟
279 271 var uNameKeyup;
... ... @@ -286,23 +278,23 @@ window.onload=function(){
286 278 uNameKeyup = false;
287 279 }, 200);
288 280 });
289   -
  281 +
290 282 //密码框回车事件
291 283 pwdInput.on('keyup', function(e){
292   - if (e.keyCode == 13)
  284 + if (e.keyCode == 13)
293 285 $('#loginBtn').click();
294 286 });
295 287 //验证码框回车事件
296 288 $('input[name=captcha]').on('keyup', function(e){
297   - if (e.keyCode == 13)
  289 + if (e.keyCode == 13)
298 290 $('#loginBtn').click();
299 291 });
300   -
  292 +
301 293 $('#loginBtn').on('click', function(){
302 294 if(lock || $(this).attr('disabled')) return;
303 295 var userName = nameInput.val()
304 296 ,pwd = pwdInput.val();
305   -
  297 +
306 298 //RSA加密
307 299 var encrypt = new JSEncrypt();
308 300 encrypt.setPublicKey(keys);
... ... @@ -311,27 +303,27 @@ window.onload=function(){
311 303 //登录
312 304 login(userName, pwd);
313 305 });
314   -
  306 +
315 307 var lock;
316 308 function login(userName, pwd){
317 309 lock = true;
318 310 $('#loginBtn').attr('disabled', 'disabled');
319 311  
320 312 var params = {
321   - userName: userName,
322   - password: pwd,
  313 + userName: userName,
  314 + password: pwd,
323 315 captcha: $('input[name=captcha]').val()
324 316 };
325 317 $.post('/user/login', params
326 318 ,function(rs){
327   -
  319 +
328 320 $('#loginPanel').addClass('show_msg');
329 321 if(error(rs)){
330 322 lock = false;
331 323 $('#loginBtn').removeAttr('disabled');
332   -
  324 +
333 325 msgAlert.html('<i class="fa fa-times-circle"> </i> 登录失败,' + rs.msg);
334   -
  326 +
335 327 _captcha.refresh();
336 328 checkStatus();
337 329 }
... ... @@ -342,21 +334,21 @@ window.onload=function(){
342 334 }
343 335 });
344 336 }
345   -
  337 +
346 338 function checkStatus(){
347 339 var t = nameInput.val();
348 340 if(!t){
349 341 hide();
350 342 return;
351 343 }
352   -
  344 +
353 345 $.get('/user/login/captchaStatus', {userName: t}, function(rs){
354 346 if(rs >= 3)
355 347 _captcha.show();
356 348 else
357 349 hide();
358 350 });
359   -
  351 +
360 352 function hide(){
361 353 if(!$("#captchaWrap").is(":hidden")){
362 354 _captcha.hide();
... ... @@ -366,8 +358,8 @@ window.onload=function(){
366 358 }
367 359 }
368 360 }
369   -
370   -
  361 +
  362 +
371 363 var _captcha = {
372 364 show: function(){
373 365 if($("#captchaWrap").is(":hidden")){
... ... @@ -386,11 +378,11 @@ window.onload=function(){
386 378 $('input[name=captcha]').val('');
387 379 }
388 380 };
389   -
  381 +
390 382 $('#captchaWrap img.captcha-img').on('click', function(){
391 383 $(this).attr('src', '/captcha.jpg?t=' + Math.random());
392 384 });
393   -
  385 +
394 386 function error(rs){
395 387 return rs.status == 'ERROR' || rs.status == 500;
396 388 }
... ...