Commit ae3cab804d96fdb702369f9619d011bc85dc5648

Authored by 潘钊
1 parent 895569f1

update..

还原 components.css  ,该文件被打乱格式导致按钮背景消失

Too many changes to show.

To preserve performance only 19 of 33 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
... ... @@ -451,7 +451,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
451 451 }
452 452  
453 453 @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
454   - public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx){
455   - return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx);
  454 + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
  455 + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
456 456 }
457 457 }
... ...
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/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
... ... @@ -152,7 +152,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
152 152  
153 153 List<SchedulePlanInfo> currentSchedulePlan(String lineCode);
154 154  
155   - Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx);
  155 + Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx, int type);
156 156  
157   - void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch);
  157 + void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type);
158 158 }
... ...
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
... ... @@ -861,12 +861,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
861 861 List<ScheduleRealInfo> ts = new ArrayList<>();
862 862 try {
863 863 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 864 //实际发车时间
871 865 String fcsjActual = map.get("fcsjActual");
872 866 //实际终点时间
... ... @@ -928,6 +922,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
928 922 } catch (NumberFormatException e) {
929 923 logger.error("", e);
930 924 }
  925 +
  926 + //修改班次里程
  927 + String jhlc = map.get("jhlc");
  928 + if(StringUtils.isNotEmpty(jhlc)
  929 + && Double.parseDouble(jhlc) != sch.getJhlc()){
  930 + sch.setJhlc(Double.parseDouble(jhlc));
  931 + }
931 932 }
932 933  
933 934 String bcType = map.get("bcType");
... ... @@ -3251,7 +3252,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3251 3252  
3252 3253  
3253 3254 @Override
3254   - public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx) {
  3255 + public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx, int type) {
3255 3256 Map<String, Object> rs = new HashMap<>();
3256 3257 List<ScheduleRealInfo> ts = new ArrayList<>();
3257 3258 try {
... ... @@ -3269,10 +3270,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3269 3270 rightSch = dayOfSchedule.get(Long.parseLong(rightList.get(i)));
3270 3271  
3271 3272 //调换路牌
3272   - lpChange(leftSch, rightSch);
  3273 + lpChange(leftSch, rightSch, type);
3273 3274  
3274 3275 ts.add(leftSch);
3275 3276 ts.add(rightSch);
  3277 +
  3278 + dayOfSchedule.save(leftSch);
  3279 + dayOfSchedule.save(rightSch);
3276 3280 }
3277 3281  
3278 3282 rs.put("status", ResponseCode.SUCCESS);
... ... @@ -3287,11 +3291,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3287 3291 }
3288 3292  
3289 3293 @Override
3290   - public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch) {
  3294 + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) {
3291 3295 LpData leftData = new LpData(leftSch);
3292 3296 LpData rightData = new LpData(rightSch);
3293 3297  
3294   - leftData.appendTo(rightSch);
3295   - rightData.appendTo(leftSch);
  3298 + leftData.appendTo(rightSch, type);
  3299 + rightData.appendTo(leftSch, type);
3296 3300 }
3297 3301 }
3298 3302 \ 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 }
... ...