Commit 2f9dd0cce853e92bc6fb59edfc5bb20d8f99a2a5

Authored by 潘钊
1 parent 24cac276

update...

src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -48,7 +48,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, @@ -48,7 +48,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
48 public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks, 48 public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
49 @RequestParam String dfsj,String bcType, 49 @RequestParam String dfsj,String bcType,
50 @RequestParam(defaultValue = "") String opType) { 50 @RequestParam(defaultValue = "") String opType) {
51 - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType); 51 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
52 } 52 }
53 53
54 /** 54 /**
@@ -59,7 +59,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -59,7 +59,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
59 public Map<String, Object> destroy(@RequestParam String idsStr 59 public Map<String, Object> destroy(@RequestParam String idsStr
60 /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, 60 /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
61 @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) { 61 @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
62 - return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks, adjustExps/*, spaceNum*/); 62 + return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
63 } 63 }
64 64
65 /** 65 /**
@@ -520,7 +520,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -520,7 +520,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
520 public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){ 520 public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
521 cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson); 521 cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
522 List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class); 522 List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
523 - return scheduleRealInfoService.multi_tzrc(cpcs); 523 + return scheduleRealInfoService.multi_tzrc(cpcs, null);
524 } 524 }
525 525
526 @RequestMapping(value="/multi_dftz", method=RequestMethod.POST) 526 @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
1 package com.bsth.controller.realcontrol; 1 package com.bsth.controller.realcontrol;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONArray;
  5 +import com.alibaba.fastjson.JSONObject;
  6 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  7 +import com.bsth.controller.realcontrol.dto.DftzAndDestroy;
4 import com.bsth.data.BasicData; 8 import com.bsth.data.BasicData;
5 import com.bsth.data.directive.DayOfDirectives; 9 import com.bsth.data.directive.DayOfDirectives;
6 import com.bsth.data.directive.DirectiveCreator; 10 import com.bsth.data.directive.DirectiveCreator;
@@ -8,10 +12,12 @@ import com.bsth.data.directive.GatewayHttpUtils; @@ -8,10 +12,12 @@ import com.bsth.data.directive.GatewayHttpUtils;
8 import com.bsth.data.gpsdata_v2.GpsRealData; 12 import com.bsth.data.gpsdata_v2.GpsRealData;
9 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 13 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
10 import com.bsth.data.schedule.DayOfSchedule; 14 import com.bsth.data.schedule.DayOfSchedule;
  15 +import com.bsth.data.schedule.external.TccExternalService;
11 import com.bsth.entity.directive.D60; 16 import com.bsth.entity.directive.D60;
12 import com.bsth.entity.realcontrol.ScheduleRealInfo; 17 import com.bsth.entity.realcontrol.ScheduleRealInfo;
13 import com.bsth.repository.directive.D60Repository; 18 import com.bsth.repository.directive.D60Repository;
14 import com.google.common.base.Splitter; 19 import com.google.common.base.Splitter;
  20 +import org.apache.commons.lang3.StringEscapeUtils;
15 import org.apache.commons.lang3.StringUtils; 21 import org.apache.commons.lang3.StringUtils;
16 import org.slf4j.Logger; 22 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory; 23 import org.slf4j.LoggerFactory;
@@ -44,12 +50,16 @@ public class ServiceDataInterface { @@ -44,12 +50,16 @@ public class ServiceDataInterface {
44 @Autowired 50 @Autowired
45 GpsRealData gpsRealData; 51 GpsRealData gpsRealData;
46 52
  53 + @Autowired
  54 + TccExternalService tccExternalService;
  55 +
47 /** 56 /**
48 * 获取车辆 和 当前执行班次对照信息 57 * 获取车辆 和 当前执行班次对照信息
  58 + *
49 * @return 59 * @return
50 */ 60 */
51 @RequestMapping("/execSchList") 61 @RequestMapping("/execSchList")
52 - public List<Map<String, Object>> execSchList(@RequestParam String secretKey){ 62 + public List<Map<String, Object>> execSchList(@RequestParam String secretKey) {
53 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY)) 63 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
54 return null; 64 return null;
55 65
@@ -57,8 +67,8 @@ public class ServiceDataInterface { @@ -57,8 +67,8 @@ public class ServiceDataInterface {
57 Collection<ScheduleRealInfo> list = dayOfSchedule.execPlanMap().values(); 67 Collection<ScheduleRealInfo> list = dayOfSchedule.execPlanMap().values();
58 68
59 Map<String, Object> map; 69 Map<String, Object> map;
60 - for(ScheduleRealInfo sch : list){  
61 - if(null == sch) 70 + for (ScheduleRealInfo sch : list) {
  71 + if (null == sch)
62 continue; 72 continue;
63 map = new HashMap<>(); 73 map = new HashMap<>();
64 map.put("clZbh", sch.getClZbh()); 74 map.put("clZbh", sch.getClZbh());
@@ -105,7 +115,7 @@ public class ServiceDataInterface { @@ -105,7 +115,7 @@ public class ServiceDataInterface {
105 } 115 }
106 116
107 @RequestMapping("/returnCCInfo") 117 @RequestMapping("/returnCCInfo")
108 - public List<ScheduleRealInfo> returnCCInfo(@RequestParam String companyId, @RequestParam String secretKey){ 118 + public List<ScheduleRealInfo> returnCCInfo(@RequestParam String companyId, @RequestParam String secretKey) {
109 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY)) 119 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
110 return null; 120 return null;
111 121
@@ -123,7 +133,7 @@ public class ServiceDataInterface { @@ -123,7 +133,7 @@ public class ServiceDataInterface {
123 } 133 }
124 134
125 @RequestMapping("/returnJCInfo") 135 @RequestMapping("/returnJCInfo")
126 - public List<ScheduleRealInfo> returnJCInfo(@RequestParam String companyId, @RequestParam String secretKey){ 136 + public List<ScheduleRealInfo> returnJCInfo(@RequestParam String companyId, @RequestParam String secretKey) {
127 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY)) 137 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
128 return null; 138 return null;
129 139
@@ -141,10 +151,11 @@ public class ServiceDataInterface { @@ -141,10 +151,11 @@ public class ServiceDataInterface {
141 151
142 /** 152 /**
143 * 获取全量的进出场数据, 仅供接口项目调用。 由接口项目负责对外所有场站输出 153 * 获取全量的进出场数据, 仅供接口项目调用。 由接口项目负责对外所有场站输出
  154 + *
144 * @return 155 * @return
145 */ 156 */
146 @RequestMapping("/findCurrInAndOut") 157 @RequestMapping("/findCurrInAndOut")
147 - public List<ScheduleRealInfo> findCurrInAndOut(@RequestParam String secretKey){ 158 + public List<ScheduleRealInfo> findCurrInAndOut(@RequestParam String secretKey) {
148 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY)) 159 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
149 return null; 160 return null;
150 161
@@ -161,30 +172,29 @@ public class ServiceDataInterface { @@ -161,30 +172,29 @@ public class ServiceDataInterface {
161 172
162 /** 173 /**
163 * 向指定的车辆下发消息短语 174 * 向指定的车辆下发消息短语
164 - * @param nbbm  
165 - * @param txt 175 + *
166 * @return 176 * @return
167 */ 177 */
168 @RequestMapping(value = "/send60Phrase", method = RequestMethod.POST) 178 @RequestMapping(value = "/send60Phrase", method = RequestMethod.POST)
169 - public int send60Phrase(@RequestBody Map<String, String> map,@RequestParam String secretKey){  
170 - try{ 179 + public int send60Phrase(@RequestBody Map<String, String> map, @RequestParam String secretKey) {
  180 + try {
171 String nbbm = map.get("nbbm"); 181 String nbbm = map.get("nbbm");
172 String txt = map.get("txt"); 182 String txt = map.get("txt");
173 String sender = map.get("sender"); 183 String sender = map.get("sender");
174 - if(txt.length() > 50) 184 + if (txt.length() > 50)
175 txt = txt.substring(0, 50); 185 txt = txt.substring(0, 50);
176 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY)) 186 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
177 return -500; 187 return -500;
178 188
179 //车辆和设备号对照 189 //车辆和设备号对照
180 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); 190 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
181 - if(StringUtils.isEmpty(deviceId)) 191 + if (StringUtils.isEmpty(deviceId))
182 return -404; 192 return -404;
183 193
184 //检查设备是否在线 194 //检查设备是否在线
185 long t = System.currentTimeMillis(); 195 long t = System.currentTimeMillis();
186 GpsEntity gps = gpsRealData.get(deviceId); 196 GpsEntity gps = gpsRealData.get(deviceId);
187 - if(null == gps || (t - gps.getServerTimestamp()) > 1000 * 60 * 5) 197 + if (null == gps || (t - gps.getServerTimestamp()) > 1000 * 60 * 5)
188 return -405; 198 return -405;
189 199
190 Short dispatchInstruct = 0;//消息短语 200 Short dispatchInstruct = 0;//消息短语
@@ -199,7 +209,7 @@ public class ServiceDataInterface { @@ -199,7 +209,7 @@ public class ServiceDataInterface {
199 209
200 dayOfDirectives.put60(d60); 210 dayOfDirectives.put60(d60);
201 return d60.getMsgId(); 211 return d60.getMsgId();
202 - }catch (Exception e){ 212 + } catch (Exception e) {
203 logger.error("", e); 213 logger.error("", e);
204 return -500; 214 return -500;
205 } 215 }
@@ -207,23 +217,24 @@ public class ServiceDataInterface { @@ -207,23 +217,24 @@ public class ServiceDataInterface {
207 217
208 /** 218 /**
209 * 根据msg id 查询指令响应情况 219 * 根据msg id 查询指令响应情况
210 - * @param msgIDs 220 + *
  221 + * @param msgIds
211 * @return 222 * @return
212 */ 223 */
213 @RequestMapping("/findD60Reply") 224 @RequestMapping("/findD60Reply")
214 - public List<Map<String, Object>> findD60Reply(@RequestParam String msgIds){ 225 + public List<Map<String, Object>> findD60Reply(@RequestParam String msgIds) {
215 List<Map<String, Object>> rs = new ArrayList<>(); 226 List<Map<String, Object>> rs = new ArrayList<>();
216 - try{ 227 + try {
217 Map<String, Object> map = new HashMap(); 228 Map<String, Object> map = new HashMap();
218 229
219 List<String> ids = Splitter.on(",").splitToList(msgIds); 230 List<String> ids = Splitter.on(",").splitToList(msgIds);
220 D60 d60; 231 D60 d60;
221 - for(String id : ids){  
222 - if(StringUtils.isEmpty(id)) 232 + for (String id : ids) {
  233 + if (StringUtils.isEmpty(id))
223 continue; 234 continue;
224 235
225 d60 = dayOfDirectives.get(Integer.parseInt(id)); 236 d60 = dayOfDirectives.get(Integer.parseInt(id));
226 - if(null == d60) 237 + if (null == d60)
227 continue; 238 continue;
228 239
229 map.put("msgId", d60.getMsgId()); 240 map.put("msgId", d60.getMsgId());
@@ -231,7 +242,7 @@ public class ServiceDataInterface { @@ -231,7 +242,7 @@ public class ServiceDataInterface {
231 map.put("jsyReplyTime", d60.getReply47Time()); 242 map.put("jsyReplyTime", d60.getReply47Time());
232 rs.add(map); 243 rs.add(map);
233 } 244 }
234 - }catch (Exception e){ 245 + } catch (Exception e) {
235 logger.error("", e); 246 logger.error("", e);
236 } 247 }
237 return rs; 248 return rs;
@@ -239,18 +250,52 @@ public class ServiceDataInterface { @@ -239,18 +250,52 @@ public class ServiceDataInterface {
239 250
240 /** 251 /**
241 * 获取路牌下所有班次 252 * 获取路牌下所有班次
  253 + *
242 * @param lineCode 254 * @param lineCode
243 * @param lpName 255 * @param lpName
244 * @return 256 * @return
245 */ 257 */
246 @RequestMapping("/findByLpName") 258 @RequestMapping("/findByLpName")
247 - public List<ScheduleRealInfo> findByLpName(@RequestParam String lineCode,@RequestParam String lpName){  
248 - try{ 259 + public List<ScheduleRealInfo> findByLpName(@RequestParam String lineCode, @RequestParam String lpName, @RequestParam String secretKey) {
  260 + try {
  261 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  262 + return null;
  263 +
249 List<ScheduleRealInfo> list = dayOfSchedule.getLpScheduleMap().get(lineCode + "_" + lpName); 264 List<ScheduleRealInfo> list = dayOfSchedule.getLpScheduleMap().get(lineCode + "_" + lpName);
250 return list; 265 return list;
251 - }catch (Exception e){ 266 + } catch (Exception e) {
252 logger.error("", e); 267 logger.error("", e);
253 } 268 }
254 return null; 269 return null;
255 } 270 }
  271 +
  272 + /**
  273 + * 调整出场班次待发,并烂掉后续班次(调派用)
  274 + *
  275 + * @param dad
  276 + * @return
  277 + */
  278 + @RequestMapping(value = "/dftzAndDestroy", method = RequestMethod.POST)
  279 + public Map<String, Object> dftzAndDestroy(@RequestBody DftzAndDestroy dad, @RequestParam String secretKey) {
  280 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  281 + return null;
  282 + return tccExternalService.dftz(dad);
  283 + }
  284 +
  285 + /**
  286 + * 换人换车,(调派用)
  287 + * @return
  288 + */
  289 + @RequestMapping(value = "/tccHrhc", method = RequestMethod.POST)
  290 + public Map<String, Object> hrhc(@RequestBody String jsonStr, @RequestParam String secretKey){
  291 +
  292 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  293 + return null;
  294 +
  295 + jsonStr = StringEscapeUtils.unescapeHtml4(jsonStr);
  296 + JSONObject rootObj = JSON.parseObject(jsonStr);
  297 +
  298 + List<ChangePersonCar> cpcs = JSONArray.parseArray(rootObj.getString("cpcs"), ChangePersonCar.class);
  299 + return tccExternalService.hrhc(cpcs, rootObj.getString("tccCode"), rootObj.getString("userId"));
  300 + }
256 } 301 }
src/main/java/com/bsth/controller/realcontrol/dto/DftzAndDestroy.java 0 → 100644
  1 +package com.bsth.controller.realcontrol.dto;
  2 +
  3 +/**
  4 + * Created by panzhao on 2018/3/22.
  5 + */
  6 +public class DftzAndDestroy {
  7 +
  8 + /**
  9 + * 要调整待发的出场班次ID
  10 + */
  11 + private Long dftzId;
  12 +
  13 + /**
  14 + * 要设置的待发时间
  15 + */
  16 + private String newTimeStr;
  17 +
  18 + /**
  19 + * 要烂掉的班次的 班次id ,号分割多个
  20 + */
  21 + private String destroyIdx;
  22 +
  23 + /**
  24 + * 备注
  25 + */
  26 + private String remarks;
  27 +
  28 + private String reason;
  29 +
  30 + /**
  31 + * 调派工号
  32 + */
  33 + private String userId;
  34 +
  35 + public String getNewTimeStr() {
  36 + return newTimeStr;
  37 + }
  38 +
  39 + public void setNewTimeStr(String newTimeStr) {
  40 + this.newTimeStr = newTimeStr;
  41 + }
  42 +
  43 + public String getDestroyIdx() {
  44 + return destroyIdx;
  45 + }
  46 +
  47 + public void setDestroyIdx(String destroyIdx) {
  48 + this.destroyIdx = destroyIdx;
  49 + }
  50 +
  51 + public String getRemarks() {
  52 + return remarks;
  53 + }
  54 +
  55 + public void setRemarks(String remarks) {
  56 + this.remarks = remarks;
  57 + }
  58 +
  59 + public Long getDftzId() {
  60 + return dftzId;
  61 + }
  62 +
  63 + public void setDftzId(Long dftzId) {
  64 + this.dftzId = dftzId;
  65 + }
  66 +
  67 + public String getReason() {
  68 + return reason;
  69 + }
  70 +
  71 + public void setReason(String reason) {
  72 + this.reason = reason;
  73 + }
  74 +
  75 + public String getUserId() {
  76 + return userId;
  77 + }
  78 +
  79 + public void setUserId(String userId) {
  80 + this.userId = userId;
  81 + }
  82 +}
src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
@@ -129,8 +129,11 @@ public class GpsRealData { @@ -129,8 +129,11 @@ public class GpsRealData {
129 Set<String> nbbmSet = dayOfSchedule.findCarByLineCode(lineCode);//计划用车 129 Set<String> nbbmSet = dayOfSchedule.findCarByLineCode(lineCode);//计划用车
130 130
131 Map<String, String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse(); 131 Map<String, String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
  132 + String deviceId;
132 for(String nbbm : nbbmSet){ 133 for(String nbbm : nbbmSet){
133 - set.add(nbbm2deviceMap.get(nbbm)); 134 + deviceId = nbbm2deviceMap.get(nbbm);
  135 + if(StringUtils.isNotEmpty(deviceId))
  136 + set.add(deviceId);
134 } 137 }
135 138
136 List<GpsEntity> rs = new ArrayList<>(); 139 List<GpsEntity> rs = new ArrayList<>();
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -979,18 +979,21 @@ public class DayOfSchedule { @@ -979,18 +979,21 @@ public class DayOfSchedule {
979 String rq = currSchDateMap.get(lineCode); 979 String rq = currSchDateMap.get(lineCode);
980 if (StringUtils.isNotEmpty(rq)) { 980 if (StringUtils.isNotEmpty(rq)) {
981 List<ScheduleRealInfo> all = findByLineCode(lineCode); 981 List<ScheduleRealInfo> all = findByLineCode(lineCode);
982 - //解除gps 和班次之间的关联  
983 - List<ScheduleRealInfo> unions = calcUnion(all, carExecutePlanMap.values());  
984 - for (ScheduleRealInfo sch : unions) {  
985 - removeExecPlan(sch.getClZbh());  
986 - }  
987 - //解除调度指令和班次的外键约束  
988 - StringBuilder inStr = new StringBuilder("(");  
989 - for (ScheduleRealInfo sch : all) {  
990 - inStr.append(sch.getId() + ","); 982 +
  983 + if(null != all && all.size() > 0){
  984 + //解除gps 和班次之间的关联
  985 + List<ScheduleRealInfo> unions = calcUnion(all, carExecutePlanMap.values());
  986 + for (ScheduleRealInfo sch : unions) {
  987 + removeExecPlan(sch.getClZbh());
  988 + }
  989 + //解除调度指令和班次的外键约束
  990 + StringBuilder inStr = new StringBuilder("(");
  991 + for (ScheduleRealInfo sch : all) {
  992 + inStr.append(sch.getId() + ",");
  993 + }
  994 + inStr.deleteCharAt(inStr.length() - 1).append(")");
  995 + jdbcTemplate.update(Constants.MULTI_REMOVE_DIRECTIVE_SCH_FK + " " + inStr.toString());
991 } 996 }
992 - inStr.deleteCharAt(inStr.length() - 1).append(")");  
993 - jdbcTemplate.update(Constants.MULTI_REMOVE_DIRECTIVE_SCH_FK + " " + inStr.toString());  
994 997
995 //删除班次数据 998 //删除班次数据
996 removeRealSch(lineCode, rq); 999 removeRealSch(lineCode, rq);
src/main/java/com/bsth/data/schedule/edit_logs/FormLogger.java
@@ -37,7 +37,7 @@ public class FormLogger { @@ -37,7 +37,7 @@ public class FormLogger {
37 /** 37 /**
38 * 换人换车情况表 38 * 换人换车情况表
39 */ 39 */
40 - public void saveChangetochange(ScheduleRealInfo sch, ChangePersonCar cpc){ 40 + public void saveChangetochange(ScheduleRealInfo sch, ChangePersonCar cpc, String userId){
41 try { 41 try {
42 String newNbbm = cpc.getClZbh(); 42 String newNbbm = cpc.getClZbh();
43 String newJsy = cpc.getJsy(); 43 String newJsy = cpc.getJsy();
@@ -51,7 +51,6 @@ public class FormLogger { @@ -51,7 +51,6 @@ public class FormLogger {
51 return; 51 return;
52 52
53 Date d = new Date(); 53 Date d = new Date();
54 - SysUser user = SecurityUtils.getCurrentUser();  
55 Changetochange cc = new Changetochange(); 54 Changetochange cc = new Changetochange();
56 cc.setRq(sch.getScheduleDateStr()); 55 cc.setRq(sch.getScheduleDateStr());
57 cc.setGs(sch.getGsBm()); 56 cc.setGs(sch.getGsBm());
@@ -61,8 +60,13 @@ public class FormLogger { @@ -61,8 +60,13 @@ public class FormLogger {
61 cc.setFssj(sch.getFcsj()); 60 cc.setFssj(sch.getFcsj());
62 cc.setXgsj(fmtHHmm.print(d.getTime())); 61 cc.setXgsj(fmtHHmm.print(d.getTime()));
63 cc.setsId(sch.getId()); 62 cc.setsId(sch.getId());
64 - if(user != null) 63 +
  64 + if(StringUtils.isEmpty(userId)){
  65 + SysUser user = SecurityUtils.getCurrentUser();
65 cc.setXgr(user.getUserName()); 66 cc.setXgr(user.getUserName());
  67 + }
  68 + else
  69 + cc.setXgr(userId);
66 70
67 cc.setPcch(sch.getClZbh()); 71 cc.setPcch(sch.getClZbh());
68 cc.setPcry(oldJsy); 72 cc.setPcry(oldJsy);
@@ -86,7 +90,7 @@ public class FormLogger { @@ -86,7 +90,7 @@ public class FormLogger {
86 ChangePersonCar cpc = new ChangePersonCar(); 90 ChangePersonCar cpc = new ChangePersonCar();
87 cpc.setClZbh(nbbm); 91 cpc.setClZbh(nbbm);
88 cpc.setJsy(jsy); 92 cpc.setJsy(jsy);
89 - saveChangetochange(sch, cpc); 93 + saveChangetochange(sch, cpc, null);
90 } 94 }
91 95
92 public void saveDb(){ 96 public void saveDb(){
src/main/java/com/bsth/data/schedule/edit_logs/ScheduleModifyLogger.java
@@ -28,14 +28,14 @@ public class ScheduleModifyLogger { @@ -28,14 +28,14 @@ public class ScheduleModifyLogger {
28 28
29 /** 29 /**
30 * 待发调整 30 * 待发调整
31 - * opType 0: 双击调整、 1:待发调整、2:批量待发调整、3:间隔调整 31 + * opType 0: 双击调整、 1:待发调整、2:批量待发调整、3:间隔调整、4:调派系统调整
32 */ 32 */
33 - public static void dftz(ScheduleRealInfo sch, String opType, String oldDfsj, String nowDfsj, String remarks) { 33 + public static void dftz(ScheduleRealInfo sch, String opType, String oldDfsj, String nowDfsj, String remarks, String userId) {
34 try { 34 try {
35 if (oldDfsj.equals(nowDfsj)) 35 if (oldDfsj.equals(nowDfsj))
36 return; 36 return;
37 37
38 - SchEditInfo sei = SchEditInfo.getInstance(sch); 38 + SchEditInfo sei = SchEditInfo.getInstance(sch, userId);
39 sei.setType(EditType.DFTZ); 39 sei.setType(EditType.DFTZ);
40 sei.setType2(opType); 40 sei.setType2(opType);
41 sei.setRemarks(remarks == null ? "" : remarks); 41 sei.setRemarks(remarks == null ? "" : remarks);
@@ -78,9 +78,9 @@ public class ScheduleModifyLogger { @@ -78,9 +78,9 @@ public class ScheduleModifyLogger {
78 * 78 *
79 * @param remarks 79 * @param remarks
80 */ 80 */
81 - public static void jhlb(ScheduleRealInfo sch, String remarks) { 81 + public static void jhlb(ScheduleRealInfo sch, String remarks, String userId) {
82 try { 82 try {
83 - SchEditInfo sei = SchEditInfo.getInstance(sch); 83 + SchEditInfo sei = SchEditInfo.getInstance(sch, userId);
84 sei.setRemarks(remarks); 84 sei.setRemarks(remarks);
85 sei.setType(EditType.JHLB); 85 sei.setType(EditType.JHLB);
86 86
@@ -182,7 +182,7 @@ public class ScheduleModifyLogger { @@ -182,7 +182,7 @@ public class ScheduleModifyLogger {
182 * @param sch 182 * @param sch
183 * @param cpc 183 * @param cpc
184 */ 184 */
185 - public static void tzrc(ScheduleRealInfo sch, ChangePersonCar cpc) { 185 + public static void tzrc(ScheduleRealInfo sch, ChangePersonCar cpc, String userId) {
186 try { 186 try {
187 String newNbbm = cpc.getClZbh(); 187 String newNbbm = cpc.getClZbh();
188 String newJsy = cpc.getJsy(); 188 String newJsy = cpc.getJsy();
@@ -218,7 +218,7 @@ public class ScheduleModifyLogger { @@ -218,7 +218,7 @@ public class ScheduleModifyLogger {
218 if(jobj.size() == 0) 218 if(jobj.size() == 0)
219 return; 219 return;
220 220
221 - SchEditInfo sei = SchEditInfo.getInstance(sch); 221 + SchEditInfo sei = SchEditInfo.getInstance(sch, userId);
222 sei.setType(EditType.TZRC); 222 sei.setType(EditType.TZRC);
223 223
224 sei.setJsonArray(jobj.toJSONString()); 224 sei.setJsonArray(jobj.toJSONString());
src/main/java/com/bsth/data/schedule/edit_logs/entity/SchEditInfo.java
@@ -160,6 +160,20 @@ public class SchEditInfo { @@ -160,6 +160,20 @@ public class SchEditInfo {
160 return sei; 160 return sei;
161 } 161 }
162 162
  163 + public static SchEditInfo getInstance(ScheduleRealInfo sch, String userId){
  164 + SchEditInfo sei = new SchEditInfo();
  165 + long t = System.currentTimeMillis();
  166 + sei.setTs(t);
  167 + sei.setTimeStr(fmtHHmm.print(t));
  168 + sei.setUser(userId);
  169 + sei.setRq(sch.getScheduleDateStr());
  170 + sei.setSchId(sch.getId());
  171 + sei.setLineCode(sch.getXlBm());
  172 + sei.setGsbm(sch.getGsBm());
  173 + sei.setFgsbm(sch.getFgsBm());
  174 + return sei;
  175 + }
  176 +
163 public String getLineCode() { 177 public String getLineCode() {
164 return lineCode; 178 return lineCode;
165 } 179 }
src/main/java/com/bsth/data/schedule/external/TccExternalService.java 0 → 100644
  1 +package com.bsth.data.schedule.external;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  5 +import com.bsth.controller.realcontrol.dto.DftzAndDestroy;
  6 +import com.bsth.data.schedule.DayOfSchedule;
  7 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  8 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
  9 +import com.bsth.websocket.handler.SendUtils;
  10 +import org.apache.commons.lang3.StringUtils;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +import java.util.*;
  17 +
  18 +/**
  19 + * 对停车场开放的班次调度服务
  20 + * Created by panzhao on 2018/3/22.
  21 + */
  22 +@Component
  23 +public class TccExternalService {
  24 +
  25 + Logger logger = LoggerFactory.getLogger(TccExternalService.class);
  26 +
  27 + @Autowired
  28 + DayOfSchedule dayOfSchedule;
  29 +
  30 + @Autowired
  31 + ScheduleRealInfoService scheduleRealInfoService;
  32 +
  33 + @Autowired
  34 + SendUtils sendUtils;
  35 +
  36 + /**
  37 + * 待发调整
  38 + *
  39 + * @param dad
  40 + * @return
  41 + */
  42 + public Map<String, Object> dftz(DftzAndDestroy dad) {
  43 + Map<String, Object> rs = new HashMap();
  44 + rs.put("status", ResponseCode.ERROR);
  45 + try {
  46 + List<ScheduleRealInfo> updateList = new ArrayList<>();//要刷新的班次
  47 + ScheduleRealInfo sch = dayOfSchedule.get(dad.getDftzId());
  48 + if (null == sch) {
  49 + rs.put("msg", "班次已经不存在了!");
  50 + return rs;
  51 + }
  52 +
  53 + if (!sch.getBcType().equals("out")) {
  54 + rs.put("msg", "只能操作出场班次!");
  55 + return rs;
  56 + }
  57 +
  58 + //调整待发时间
  59 + scheduleRealInfoService.outgoAdjust(sch.getId(), dad.getRemarks(), dad.getNewTimeStr(), sch.getBcType(), "4", dad.getUserId());
  60 + updateList.add(sch);
  61 +
  62 + //需要烂班的班次
  63 + if (StringUtils.isNotEmpty(dad.getDestroyIdx())) {
  64 + Map<String, Object> dMap =
  65 + scheduleRealInfoService.destroy(dad.getDestroyIdx(), dad.getRemarks(), dad.getReason(), dad.getUserId());
  66 +
  67 +
  68 + updateList.addAll((Collection<? extends ScheduleRealInfo>) dMap.get("ts"));
  69 + }
  70 +
  71 + //通知调度客户端更新班次信息
  72 + sendUpdate2Page(updateList);
  73 +
  74 + rs.put("status", ResponseCode.SUCCESS);
  75 + rs.put("t", sch);
  76 + } catch (Exception e) {
  77 + rs.put("msg", "内部调度服务接口出现异常!");
  78 + logger.error("", e);
  79 + }
  80 + return rs;
  81 + }
  82 +
  83 + /**
  84 + * 换人换车
  85 + *
  86 + * @param cpcs
  87 + * @return
  88 + */
  89 + public Map<String, Object> hrhc(List<ChangePersonCar> cpcs,String tccCode, String userId) {
  90 + Map<String, Object> rs = new HashMap();
  91 + rs.put("status", ResponseCode.ERROR);
  92 + try {
  93 + rs = scheduleRealInfoService.multi_tzrc(cpcs, userId);
  94 +
  95 + //通知调度客户端更新班次信息
  96 + sendUpdate2Page(new ArrayList<ScheduleRealInfo>((Set)rs.get("ts")));
  97 +
  98 + //返回更新结果集中指定停车场的进出场班次
  99 + Set<ScheduleRealInfo> ts = (Set<ScheduleRealInfo>) rs.get("ts");
  100 + List<ScheduleRealInfo> list = new ArrayList<>();
  101 + for(ScheduleRealInfo sch : ts){
  102 + if((sch.getBcType().equals("out") && sch.getQdzCode().equals(tccCode))
  103 + || (sch.getBcType().equals("in") && sch.getZdzCode().equals(tccCode)))
  104 + list.add(sch);
  105 + }
  106 + rs.put("list", list);
  107 + rs.remove("ts");
  108 + } catch (Exception e) {
  109 + rs.put("msg", "服务器出现异常!");
  110 + logger.error("", e);
  111 + }
  112 + return rs;
  113 + }
  114 +
  115 +
  116 + public void sendUpdate2Page(List<ScheduleRealInfo> list) {
  117 + sendUtils.refreshSch(list);
  118 + }
  119 +}
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
@@ -8,6 +8,7 @@ import com.bsth.entity.realcontrol.LineConfig; @@ -8,6 +8,7 @@ import com.bsth.entity.realcontrol.LineConfig;
8 import com.bsth.entity.realcontrol.ScheduleRealInfo; 8 import com.bsth.entity.realcontrol.ScheduleRealInfo;
9 import com.bsth.util.Arith; 9 import com.bsth.util.Arith;
10 import com.bsth.websocket.handler.SendUtils; 10 import com.bsth.websocket.handler.SendUtils;
  11 +import com.google.common.collect.ArrayListMultimap;
11 import org.slf4j.Logger; 12 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
13 import org.springframework.beans.BeansException; 14 import org.springframework.beans.BeansException;
@@ -16,8 +17,7 @@ import org.springframework.context.ApplicationContextAware; @@ -16,8 +17,7 @@ import org.springframework.context.ApplicationContextAware;
16 import org.springframework.stereotype.Component; 17 import org.springframework.stereotype.Component;
17 18
18 import java.util.Collection; 19 import java.util.Collection;
19 -import java.util.HashMap;  
20 -import java.util.Map; 20 +import java.util.List;
21 21
22 /** 22 /**
23 * 误点自动调整待发 处理程序 23 * 误点自动调整待发 处理程序
@@ -35,12 +35,14 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -35,12 +35,14 @@ public class LateAdjustHandle implements ApplicationContextAware{
35 35
36 /** 36 /**
37 * 应发未到车辆 和 班次 37 * 应发未到车辆 和 班次
  38 + *
  39 + * 起点相同的,保留最后一个班次
38 */ 40 */
39 - private static Map<String, ScheduleRealInfo> lateSchMap; 41 + private static ArrayListMultimap lateSchMaps;
40 42
41 43
42 static { 44 static {
43 - lateSchMap = new HashMap<>(); 45 + lateSchMaps = ArrayListMultimap.create();
44 } 46 }
45 47
46 /** 48 /**
@@ -48,125 +50,140 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -48,125 +50,140 @@ public class LateAdjustHandle implements ApplicationContextAware{
48 * @param sch 50 * @param sch
49 */ 51 */
50 public static void putLate(ScheduleRealInfo sch){ 52 public static void putLate(ScheduleRealInfo sch){
51 - try {  
52 - //出场班次不需要  
53 - if(sch.getBcType().equals("out"))  
54 - return; 53 + try{
55 //线路配置 54 //线路配置
56 LineConfig config = lineConfigData.get(sch.getXlBm()); 55 LineConfig config = lineConfigData.get(sch.getXlBm());
57 if(sch.getLateMinute() == 0){ 56 if(sch.getLateMinute() == 0){
58 - if(config.isEnableYjtk()){  
59 - sch.setLateMinute(sch.getXlDir().equals("0")?config.getUpStopMinute():config.getDownStopMinute());  
60 - }  
61 - else 57 + if(!config.isEnableYjtk())
62 return; 58 return;
  59 +
  60 + sch.setLateMinute(sch.getXlDir().equals("0")?config.getUpStopMinute():config.getDownStopMinute());
63 } 61 }
64 62
65 if(sch.getDfsj().compareTo(config.getYjtkStart()) > 0 63 if(sch.getDfsj().compareTo(config.getYjtkStart()) > 0
66 && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){ 64 && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){
67 65
68 - ScheduleRealInfo cancel = null;  
69 - //之前存在误点班次没有发出  
70 - ScheduleRealInfo old = lateSchMap.get(sch.getClZbh()); 66 + ScheduleRealInfo old = popLateSch(sch);
  67 + if(null != old){
  68 + //通知客户端
  69 + sch.setLate2(true);
  70 + sendUtils.sendAutoWdtz(sch, old);
71 71
72 - if(old != null && old.getDfsjT() < sch.getDfsjT()){  
73 - //如果之前班次的 待发应到时间已经过了 3 分钟  
74 - long t = System.currentTimeMillis();  
75 - long dfEndTime = old.getDfsjT() + (old.getBcsj() * 60 * 1000);  
76 - if((t - dfEndTime) > 1000 * 60 * 3){  
77 -  
78 - remove(old);  
79 - cancel = old;  
80 - logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!");  
81 - } 72 + logger.info("【应发未到】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");
82 } 73 }
83 -  
84 - lateSchMap.put(sch.getClZbh(), sch);  
85 - //通知客户端  
86 - sch.setLate2(true);  
87 - sendUtils.sendAutoWdtz(sch, cancel);  
88 -  
89 - logger.info("【应发未到】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");  
90 } 74 }
  75 +
91 }catch (Exception e){ 76 }catch (Exception e){
92 logger.error("", e); 77 logger.error("", e);
93 } 78 }
94 } 79 }
95 80
  81 + /**
  82 + * 压入新的误点班次
  83 + * @param sch
  84 + * @return 返回被移除的误点班次
  85 + */
  86 + private static ScheduleRealInfo popLateSch(ScheduleRealInfo sch) {
  87 + List<ScheduleRealInfo> list = lateSchMaps.get(sch.getXlBm());
  88 +
  89 + if(null == list || list.size() == 0)
  90 + lateSchMaps.put(sch.getClZbh(), sch);
  91 + else {
  92 + ScheduleRealInfo old = findExistQdz(list, sch.getQdzCode(), sch.getQdzName());
  93 +
  94 + //同一个起点,保留时间最大的班次
  95 + if(null == old || old.getDfsjT() < sch.getDfsjT()){
  96 + lateSchMaps.remove(old.getClZbh(), old);
  97 + lateSchMaps.put(sch.getClZbh(), sch);
  98 +
  99 + logger.info(sch.getClZbh() + "【应发未到】old 班次 " + old.getId() + " -被覆盖!");
  100 + return old;
  101 + }
  102 + }
  103 +
  104 + return null;
  105 + }
  106 +
  107 + /**
  108 + * 搜索同样起点的班次
  109 + * @param list
  110 + * @return
  111 + */
  112 + private static ScheduleRealInfo findExistQdz(List<ScheduleRealInfo> list, String qdzCode, String qdzName) {
  113 + for(ScheduleRealInfo item : list){
  114 + if(item.getQdzCode().equals(qdzCode)
  115 + || item.getQdzName().equals(qdzName))
  116 + return item;
  117 + }
  118 + return null;
  119 + }
  120 +
96 121
97 /** 122 /**
98 * 获取所有应发未到的班次 123 * 获取所有应发未到的班次
99 * @return 124 * @return
100 */ 125 */
101 public static Collection<ScheduleRealInfo> allLateSch(){ 126 public static Collection<ScheduleRealInfo> allLateSch(){
102 - return lateSchMap.values(); 127 + return lateSchMaps.values();
103 } 128 }
104 129
105 public static void remove(ScheduleRealInfo sch){ 130 public static void remove(ScheduleRealInfo sch){
106 try { 131 try {
107 - if(lateSchMap.get(sch.getClZbh()) == sch){  
108 - lateSchMap.remove(sch.getClZbh()); 132 + if(lateSchMaps.containsEntry(sch.getClZbh(), sch)){
  133 + lateSchMaps.remove(sch.getClZbh(), sch);
  134 +
109 sch.setLate2(false); 135 sch.setLate2(false);
110 sch.setLateMinute(0); 136 sch.setLateMinute(0);
111 sch.setDfAuto(false); 137 sch.setDfAuto(false);
112 138
113 - logger.info("移除误点调整 -" + sch.getClZbh()); 139 + logger.info("移除误点调整 -" + sch.getClZbh() + " -time: " + sch.getDfsj() + " -id: " + sch.getId());
114 } 140 }
115 }catch (Exception e){ 141 }catch (Exception e){
116 logger.error("", e); 142 logger.error("", e);
117 } 143 }
118 } 144 }
119 145
120 -/* public static void remove(String nbbm){  
121 - if(lateSchMap.containsKey(nbbm)){  
122 - ScheduleRealInfo sch = lateSchMap.get(nbbm);  
123 - sch.setLate2(false);  
124 - sch.setLateMinute(0);  
125 - sch.setDfAuto(false);  
126 -  
127 - lateSchMap.remove(nbbm);  
128 - logger.info("移除误点调整 nbbm -" + nbbm);  
129 - }  
130 - }*/  
131 -  
132 /** 146 /**
133 * 车辆到站 147 * 车辆到站
134 * @param gps 148 * @param gps
135 */ 149 */
136 public static void carArrive(GpsEntity gps){ 150 public static void carArrive(GpsEntity gps){
137 try{ 151 try{
138 - if(gps.getInstation() != 1) 152 + List<ScheduleRealInfo> list = lateSchMaps.get(gps.getNbbm());
  153 +
  154 + if(null == list || list.size() == 0)
139 return; 155 return;
140 156
141 - ScheduleRealInfo sch = lateSchMap.get(gps.getNbbm());  
142 - if(sch == null) 157 + String key = gps.getStopNo();
  158 + if(gps.getInstation()==1)//站点名称
  159 + key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo();
  160 +
  161 + gps.setStationName(BasicData.stationCode2NameMap.get(key));
  162 + //根据起点站获取误点班次
  163 + ScheduleRealInfo sch = findExistQdz(list, gps.getStopNo(), gps.getStationName());
  164 +
  165 + if(null == sch)
143 return; 166 return;
144 167
145 //可能是延迟信号,gps时间没有误点 168 //可能是延迟信号,gps时间没有误点
146 if(gps.getTimestamp() <= sch.getDfsjT()){ 169 if(gps.getTimestamp() <= sch.getDfsjT()){
147 sch.setLate2(false); 170 sch.setLate2(false);
148 - lateSchMap.remove(sch.getClZbh()); 171 + lateSchMaps.remove(sch.getClZbh(), sch);
149 return; 172 return;
150 } 173 }
151 - //进的是班次起点(名称一样即可)  
152 - gps.setStationName(BasicData.stationCode2NameMap.get(gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo())); 174 +
153 if(gps.getStationName().equals(sch.getQdzName()) 175 if(gps.getStationName().equals(sch.getQdzName())
154 - /*&& sch.getLateMinute() > 0*/){ 176 + || gps.getStopNo().equals(sch.getQdzCode())){
  177 +
155 //自动调整待发 到达时间 + 停靠时间 178 //自动调整待发 到达时间 + 停靠时间
156 long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000)); 179 long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000));
157 180
158 - //超过2小时最大阈值,放弃 -临时代码,待删除  
159 - if(Math.abs(dt - sch.getDfsjT()) > 1000 * 60 * 60 * 2){  
160 - logger.info(sch.getClZbh() + " 超过误点调整阈值,放弃");  
161 - }  
162 - else{  
163 - sch.setDfsjAll(dt);  
164 - sch.setDfAuto(true);  
165 - //取消应发未到标记  
166 - sch.setLate2(false);  
167 - } 181 + sch.setDfsjAll(dt);
  182 + sch.setDfAuto(true);
  183 + //取消应发未到标记
  184 + sch.setLate2(false);
168 185
169 - lateSchMap.remove(sch.getClZbh()); 186 + lateSchMaps.remove(sch.getClZbh(), sch);
170 logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt); 187 logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt);
171 } 188 }
172 }catch (Exception e){ 189 }catch (Exception e){
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -17,9 +17,9 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -17,9 +17,9 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
17 17
18 Map<String, Collection<ScheduleRealInfo>> findByLines(String lines); 18 Map<String, Collection<ScheduleRealInfo>> findByLines(String lines);
19 19
20 - Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType, String opType); 20 + Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType, String opType,String userId);
21 21
22 - Map<String, Object> destroy(String idsStr/*, int spaceAdjust*/, String remarks, String reason/*, int spaceNum*/); 22 + Map<String, Object> destroy(String idsStr/*, int spaceAdjust*/, String remarks, String reason/*, int spaceNum*/, String userId);
23 23
24 List<Map<String, String>> findDriverByLine(String lineCode); 24 List<Map<String, String>> findDriverByLine(String lineCode);
25 25
@@ -135,7 +135,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -135,7 +135,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
135 135
136 List<Map<String,Object>> yesterdayDataList(String line); 136 List<Map<String,Object>> yesterdayDataList(String line);
137 137
138 - Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs); 138 + Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs, String userId);
139 139
140 Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs); 140 Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs);
141 141
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -229,7 +229,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -229,7 +229,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
229 private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); 229 private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
230 230
231 @Override 231 @Override
232 - public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType, String opType) { 232 + public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType, String opType, String userId) {
233 Map<String, Object> map = new HashMap<>(); 233 Map<String, Object> map = new HashMap<>();
234 try { 234 try {
235 235
@@ -251,7 +251,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -251,7 +251,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
251 } 251 }
252 252
253 //记录日志 253 //记录日志
254 - ScheduleModifyLogger.dftz(schedule,opType, schedule.getDfsj(),dfsj,remarks); 254 + ScheduleModifyLogger.dftz(schedule,opType, schedule.getDfsj(),dfsj,remarks, userId);
255 255
256 schedule.setDfsjAll(dfsj); 256 schedule.setDfsjAll(dfsj);
257 schedule.setDfAuto(false); 257 schedule.setDfAuto(false);
@@ -316,7 +316,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -316,7 +316,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
316 } 316 }
317 317
318 @Override 318 @Override
319 - public Map<String, Object> destroy(String idsStr, /*int spaceAdjust, */String remarks, String reason/*, int spaceNum*/) { 319 + public Map<String, Object> destroy(String idsStr, String remarks, String reason, String userId) {
320 320
321 Map<String, Object> map = new HashMap<>(); 321 Map<String, Object> map = new HashMap<>();
322 List<ScheduleRealInfo> rsList = new ArrayList<>(); 322 List<ScheduleRealInfo> rsList = new ArrayList<>();
@@ -333,7 +333,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -333,7 +333,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
333 return map; 333 return map;
334 } 334 }
335 //记录日志 335 //记录日志
336 - ScheduleModifyLogger.jhlb(schedule, remarks); 336 + ScheduleModifyLogger.jhlb(schedule, remarks, userId);
337 337
338 schedule.setAdjustExps(reason); 338 schedule.setAdjustExps(reason);
339 schedule.destroy(); 339 schedule.destroy();
@@ -1354,7 +1354,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1354,7 +1354,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1354 sch = list.get(i); 1354 sch = list.get(i);
1355 1355
1356 //调整待发 1356 //调整待发
1357 - tempRs = outgoAdjust(sch.getId(), null, fmtHHmm.print(st), null, "3"); 1357 + tempRs = outgoAdjust(sch.getId(), null, fmtHHmm.print(st), null, "3", null);
1358 1358
1359 if(null != tempRs && tempRs.get("ts") != null) 1359 if(null != tempRs && tempRs.get("ts") != null)
1360 tempTs = (List<ScheduleRealInfo>) tempRs.get("ts"); 1360 tempTs = (List<ScheduleRealInfo>) tempRs.get("ts");
@@ -1532,7 +1532,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1532,7 +1532,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1532 */ 1532 */
1533 if (map.get("status") != null 1533 if (map.get("status") != null
1534 && Integer.parseInt(map.get("status").toString()) == -1) { 1534 && Integer.parseInt(map.get("status").toString()) == -1) {
1535 - destroy(sch.getId() + "", "", map.get("adjustExps").toString()); 1535 + destroy(sch.getId() + "", "", map.get("adjustExps").toString(), null);
1536 fLog.log("烂班"); 1536 fLog.log("烂班");
1537 } 1537 }
1538 1538
@@ -1544,7 +1544,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1544,7 +1544,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1544 double jhlcNum = Double.parseDouble(jhlc); 1544 double jhlcNum = Double.parseDouble(jhlc);
1545 //烂班 1545 //烂班
1546 if(jhlcNum == 0 && sch.getJhlcOrig() != 0 && !sch._isInout() && !sch.isDestroy()){ 1546 if(jhlcNum == 0 && sch.getJhlcOrig() != 0 && !sch._isInout() && !sch.isDestroy()){
1547 - destroy(sch.getId() + "", "", map.get("adjustExps").toString()); 1547 + destroy(sch.getId() + "", "", map.get("adjustExps").toString(), null);
1548 fLog.log("里程设置为0,自动烂班"); 1548 fLog.log("里程设置为0,自动烂班");
1549 } 1549 }
1550 else if(jhlcNum != sch.getJhlc()){ 1550 else if(jhlcNum != sch.getJhlc()){
@@ -1600,7 +1600,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1600,7 +1600,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1600 schedule = dayOfSchedule.get(id); 1600 schedule = dayOfSchedule.get(id);
1601 1601
1602 if(schedule != null) 1602 if(schedule != null)
1603 - outgoAdjust(id, null, dfsj, null, "2"); 1603 + outgoAdjust(id, null, dfsj, null, "2", null);
1604 } 1604 }
1605 1605
1606 rs.put("status", ResponseCode.SUCCESS); 1606 rs.put("status", ResponseCode.SUCCESS);
@@ -3179,7 +3179,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3179,7 +3179,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3179 * 批量调整人车 3179 * 批量调整人车
3180 */ 3180 */
3181 @Override 3181 @Override
3182 - public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs) { 3182 + public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs, String userId) {
3183 Map<String, Object> rs = new HashMap<>(); 3183 Map<String, Object> rs = new HashMap<>();
3184 Set<ScheduleRealInfo> set = new HashSet<>(); 3184 Set<ScheduleRealInfo> set = new HashSet<>();
3185 3185
@@ -3218,9 +3218,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3218,9 +3218,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3218 } 3218 }
3219 3219
3220 //为换人换车情况表写入数据 3220 //为换人换车情况表写入数据
3221 - schModifyLog.saveChangetochange(sch, cpc); 3221 + schModifyLog.saveChangetochange(sch, cpc, userId);
3222 //日志记录 3222 //日志记录
3223 - ScheduleModifyLogger.tzrc(sch, cpc); 3223 + ScheduleModifyLogger.tzrc(sch, cpc, userId);
3224 3224
3225 //换驾驶员 3225 //换驾驶员
3226 if (StringUtils.isNotEmpty(cpc.getJsy())) { 3226 if (StringUtils.isNotEmpty(cpc.getJsy())) {
@@ -3232,7 +3232,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3232,7 +3232,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3232 } 3232 }
3233 3233
3234 //换售票员 3234 //换售票员
3235 - if (StringUtils.isNotEmpty(cpc.getSpy())) { 3235 + if (StringUtils.isNotEmpty(cpc.getSpy())
  3236 + && cpc.getSpy().indexOf("/")!=-1
  3237 + && cpc.getSpy().length() > 1) {
3236 sGh = cpc.getSpy().split("/")[0]; 3238 sGh = cpc.getSpy().split("/")[0];
3237 sName = getPersonName(sch.getGsBm(), sGh); 3239 sName = getPersonName(sch.getGsBm(), sGh);
3238 if(StringUtils.isEmpty(sName)){ 3240 if(StringUtils.isEmpty(sName)){
@@ -3322,7 +3324,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3322,7 +3324,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3322 if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj())) 3324 if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj()))
3323 continue; 3325 continue;
3324 3326
3325 - tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null, "2"); 3327 + tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null, "2", null);
3326 3328
3327 if (tempMap.get("status").equals(ResponseCode.SUCCESS)) { 3329 if (tempMap.get("status").equals(ResponseCode.SUCCESS)) {
3328 list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts")); 3330 list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts"));
src/main/java/com/bsth/websocket/dto/WsScheduleRealInfo.java
@@ -6,10 +6,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; @@ -6,10 +6,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
6 import javax.persistence.FetchType; 6 import javax.persistence.FetchType;
7 import javax.persistence.OneToMany; 7 import javax.persistence.OneToMany;
8 import javax.persistence.Transient; 8 import javax.persistence.Transient;
9 -import java.util.ArrayList;  
10 -import java.util.HashSet;  
11 -import java.util.List;  
12 -import java.util.Set; 9 +import java.util.*;
13 10
14 /** 11 /**
15 * 精简字段的实际排班 entity 12 * 精简字段的实际排班 entity
@@ -73,7 +70,7 @@ public class WsScheduleRealInfo { @@ -73,7 +70,7 @@ public class WsScheduleRealInfo {
73 } 70 }
74 71
75 72
76 - public static List<WsScheduleRealInfo> getMultiInstance(List<ScheduleRealInfo> list){ 73 + public static List<WsScheduleRealInfo> getMultiInstance(Collection<ScheduleRealInfo> list){
77 List<WsScheduleRealInfo> rs = new ArrayList<>(); 74 List<WsScheduleRealInfo> rs = new ArrayList<>();
78 for(ScheduleRealInfo sch : list){ 75 for(ScheduleRealInfo sch : list){
79 rs.add(getInstance(sch)); 76 rs.add(getInstance(sch));
src/main/resources/static/real_control_v2/css/main.css
@@ -936,17 +936,25 @@ option.oil_station_opt { @@ -936,17 +936,25 @@ option.oil_station_opt {
936 } 936 }
937 937
938 .park-and-station-wrap { 938 .park-and-station-wrap {
939 - margin-top: 9px;  
940 - border: 1px solid #3dce69; 939 + margin-top: 25px;
  940 + border: 1px solid #b9b9b9;
941 width: 580px; 941 width: 580px;
942 padding: 12px; 942 padding: 12px;
943 border-radius: 5px; 943 border-radius: 5px;
  944 + box-shadow: 0 2px 5px rgba(0,0,0,.1);
  945 + margin-bottom: 15px;
944 } 946 }
945 947
946 .park-and-station-wrap select { 948 .park-and-station-wrap select {
947 width: auto !important; 949 width: auto !important;
948 } 950 }
949 951
  952 +.park-and-station-wrap>span{
  953 + vertical-align: middle;
  954 + margin-top: 9px;
  955 + display: inline-block;
  956 +}
  957 +
950 /** 安全驾驶相关css */ 958 /** 安全驾驶相关css */
951 .safe_driv_pop_wrap { 959 .safe_driv_pop_wrap {
952 position: absolute; 960 position: absolute;
src/main/resources/static/real_control_v2/css/north.css
@@ -330,6 +330,8 @@ @@ -330,6 +330,8 @@
330 padding-top: 20px; 330 padding-top: 20px;
331 overflow: auto; 331 overflow: auto;
332 padding-bottom: 20px; 332 padding-bottom: 20px;
  333 + position: relative;
  334 + padding-left: 45px;
333 } 335 }
334 336
335 #nav-line_config-modal select, 337 #nav-line_config-modal select,
@@ -534,4 +536,9 @@ span.sm-grey{ @@ -534,4 +536,9 @@ span.sm-grey{
534 .voip_call_info_panel ._title{ 536 .voip_call_info_panel ._title{
535 padding: 15px; 537 padding: 15px;
536 background: #e6e6e6; 538 background: #e6e6e6;
  539 +}
  540 +
  541 +#line_config_entity_wrap .uk-list{
  542 + display: block;
  543 + margin-top: 25px;
537 } 544 }
538 \ No newline at end of file 545 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/north/nav/line_config/line_config_entity.html
@@ -108,13 +108,13 @@ @@ -108,13 +108,13 @@
108 </script> 108 </script>
109 109
110 <script id="park-and-station-temp" type="text/html"> 110 <script id="park-and-station-temp" type="text/html">
111 - 停车场 111 + <span>停车场</span>
112 <select class="z-depth-input" name="twinsPark"> 112 <select class="z-depth-input" name="twinsPark">
113 {{each parks as p i}} 113 {{each parks as p i}}
114 <option value="{{p.code}}" {{if p.code==conf.twinsPark}}selected{{/if}}>{{p.name}}</option> 114 <option value="{{p.code}}" {{if p.code==conf.twinsPark}}selected{{/if}}>{{p.name}}</option>
115 {{/each}} 115 {{/each}}
116 </select> 116 </select>
117 - 既是站点 117 + <span>&nbsp;既是站点</span>
118 <select class="z-depth-input" name="twinsStation"> 118 <select class="z-depth-input" name="twinsStation">
119 {{each routes as r i}} 119 {{each routes as r i}}
120 <option value="{{r.stationCode}}" {{if r.stationCode==conf.twinsStation}}selected{{/if}}>{{r.stationName}} 120 <option value="{{r.stationCode}}" {{if r.stationCode==conf.twinsStation}}selected{{/if}}>{{r.stationName}}
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
@@ -163,14 +163,12 @@ var gb_schedule_table = (function () { @@ -163,14 +163,12 @@ var gb_schedule_table = (function () {
163 //计算实发时间差值 163 //计算实发时间差值
164 var calc_sch_real_shift = function (sch) { 164 var calc_sch_real_shift = function (sch) {
165 if (sch['fcsjActualTime']){ 165 if (sch['fcsjActualTime']){
166 - var diff = sch['fcsjActualTime'] - sch['dfsjT'], fcsj_diff;  
167 - fcsj_diff = parseInt(diff / 60000, 10);  
168 - if(diff % 60000 != 0){  
169 - /*if(fcsj_diff > 0)  
170 - fcsj_diff ++;  
171 - else */if(fcsj_diff < 0)  
172 - fcsj_diff --;  
173 - } 166 + var fs = 'YYYY-MM-DD HH:mm'
  167 + ,m1 = moment(sch['fcsjActualTime']).format(fs)
  168 + ,m2 = moment(sch['dfsjT']).format(fs);//去掉秒
  169 +
  170 + var diff = moment(m1, fs).format('X') - moment(m2, fs).format('X')
  171 + ,fcsj_diff = parseInt(diff / 60, 10);;
174 172
175 if(fcsj_diff > 0) 173 if(fcsj_diff > 0)
176 sch.fcsj_diff = '( +' + fcsj_diff + ' )'; 174 sch.fcsj_diff = '( +' + fcsj_diff + ' )';
@@ -181,8 +179,6 @@ var gb_schedule_table = (function () { @@ -181,8 +179,6 @@ var gb_schedule_table = (function () {
181 } 179 }
182 }; 180 };
183 181
184 -  
185 -  
186 function arrayIsNull(array) { 182 function arrayIsNull(array) {
187 return !array || array.length == 0; 183 return !array || array.length == 0;
188 } 184 }