Commit 50f37b34f2379c89084a293983b52fe7546c79b4

Authored by 游瑞烽
2 parents 7b71578f 668bce79

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

Showing 24 changed files with 1260 additions and 306 deletions
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/assets/plugins/uikit-2.27.1/components/lightbox.js 0 → 100644
  1 +/*! UIkit 2.25.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2 +(function(addon) {
  3 +
  4 + var component;
  5 +
  6 + if (window.UIkit) {
  7 + component = addon(UIkit);
  8 + }
  9 +
  10 + if (typeof define == "function" && define.amd) { // AMD
  11 + define("uikit-lightbox", ["uikit"], function(){
  12 + return component || addon(UIkit);
  13 + });
  14 + }
  15 +
  16 +})(function(UI){
  17 +
  18 + "use strict";
  19 +
  20 + var modal, cache = {};
  21 +
  22 + UI.component('lightbox', {
  23 +
  24 + defaults: {
  25 + "group" : false,
  26 + "duration" : 400,
  27 + "keyboard" : true
  28 + },
  29 +
  30 + index : 0,
  31 + items : false,
  32 +
  33 + boot: function() {
  34 +
  35 + UI.$html.on('click', '[data-uk-lightbox]', function(e){
  36 +
  37 + e.preventDefault();
  38 +
  39 + var link = UI.$(this);
  40 +
  41 + if (!link.data("lightbox")) {
  42 +
  43 + UI.lightbox(link, UI.Utils.options(link.attr("data-uk-lightbox")));
  44 + }
  45 +
  46 + link.data("lightbox").show(link);
  47 + });
  48 +
  49 + // keyboard navigation
  50 + UI.$doc.on('keyup', function(e) {
  51 +
  52 + if (modal && modal.is(':visible') && modal.lightbox.options.keyboard) {
  53 +
  54 + e.preventDefault();
  55 +
  56 + switch(e.keyCode) {
  57 + case 37:
  58 + modal.lightbox.previous();
  59 + break;
  60 + case 39:
  61 + modal.lightbox.next();
  62 + break;
  63 + }
  64 + }
  65 + });
  66 + },
  67 +
  68 + init: function() {
  69 +
  70 + var siblings = [];
  71 +
  72 + this.index = 0;
  73 + this.siblings = [];
  74 +
  75 + if (this.element && this.element.length) {
  76 +
  77 + var domSiblings = this.options.group ? UI.$([
  78 + '[data-uk-lightbox*="'+this.options.group+'"]',
  79 + "[data-uk-lightbox*='"+this.options.group+"']"
  80 + ].join(',')) : this.element;
  81 +
  82 + domSiblings.each(function() {
  83 +
  84 + var ele = UI.$(this);
  85 +
  86 + siblings.push({
  87 + 'source': ele.attr('href'),
  88 + 'title' : ele.attr('data-title') || ele.attr('title'),
  89 + 'type' : ele.attr("data-lightbox-type") || 'auto',
  90 + 'link' : ele
  91 + });
  92 + });
  93 +
  94 + this.index = domSiblings.index(this.element);
  95 + this.siblings = siblings;
  96 +
  97 + } else if (this.options.group && this.options.group.length) {
  98 + this.siblings = this.options.group;
  99 + }
  100 +
  101 + this.trigger('lightbox-init', [this]);
  102 + },
  103 +
  104 + show: function(index) {
  105 +
  106 + this.modal = getModal(this);
  107 +
  108 + // stop previous animation
  109 + this.modal.dialog.stop();
  110 + this.modal.content.stop();
  111 +
  112 + var $this = this, promise = UI.$.Deferred(), data, item;
  113 +
  114 + index = index || 0;
  115 +
  116 + // index is a jQuery object or DOM element
  117 + if (typeof(index) == 'object') {
  118 +
  119 + this.siblings.forEach(function(s, idx){
  120 +
  121 + if (index[0] === s.link[0]) {
  122 + index = idx;
  123 + }
  124 + });
  125 + }
  126 +
  127 + // fix index if needed
  128 + if ( index < 0 ) {
  129 + index = this.siblings.length - index;
  130 + } else if (!this.siblings[index]) {
  131 + index = 0;
  132 + }
  133 +
  134 + item = this.siblings[index];
  135 +
  136 + data = {
  137 + "lightbox" : $this,
  138 + "source" : item.source,
  139 + "type" : item.type,
  140 + "index" : index,
  141 + "promise" : promise,
  142 + "title" : item.title,
  143 + "item" : item,
  144 + "meta" : {
  145 + "content" : '',
  146 + "width" : null,
  147 + "height" : null
  148 + }
  149 + };
  150 +
  151 + this.index = index;
  152 +
  153 + this.modal.content.empty();
  154 +
  155 + if (!this.modal.is(':visible')) {
  156 + this.modal.content.css({width:'', height:''}).empty();
  157 + this.modal.modal.show();
  158 + }
  159 +
  160 + this.modal.loader.removeClass('uk-hidden');
  161 +
  162 + promise.promise().done(function() {
  163 +
  164 + $this.data = data;
  165 + $this.fitSize(data);
  166 +
  167 + }).fail(function(){
  168 +
  169 + data.meta.content = '<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>';
  170 + data.meta.width = 400;
  171 + data.meta.height = 300;
  172 +
  173 + $this.data = data;
  174 + $this.fitSize(data);
  175 + });
  176 +
  177 + $this.trigger('showitem.uk.lightbox', [data]);
  178 + },
  179 +
  180 + fitSize: function() {
  181 +
  182 + var $this = this,
  183 + data = this.data,
  184 + pad = this.modal.dialog.outerWidth() - this.modal.dialog.width(),
  185 + dpadTop = parseInt(this.modal.dialog.css('margin-top'), 10),
  186 + dpadBot = parseInt(this.modal.dialog.css('margin-bottom'), 10),
  187 + dpad = dpadTop + dpadBot,
  188 + content = data.meta.content,
  189 + duration = $this.options.duration;
  190 +
  191 + if (this.siblings.length > 1) {
  192 +
  193 + content = [
  194 + content,
  195 + '<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>',
  196 + '<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'
  197 + ].join('');
  198 + }
  199 +
  200 + // calculate width
  201 + var tmp = UI.$('<div>&nbsp;</div>').css({
  202 + 'opacity' : 0,
  203 + 'position' : 'absolute',
  204 + 'top' : 0,
  205 + 'left' : 0,
  206 + 'width' : '100%',
  207 + 'max-width' : $this.modal.dialog.css('max-width'),
  208 + 'padding' : $this.modal.dialog.css('padding'),
  209 + 'margin' : $this.modal.dialog.css('margin')
  210 + }), maxwidth, maxheight, w = data.meta.width, h = data.meta.height;
  211 +
  212 + tmp.appendTo('body').width();
  213 +
  214 + maxwidth = tmp.width();
  215 + maxheight = window.innerHeight - dpad;
  216 +
  217 + tmp.remove();
  218 +
  219 + this.modal.dialog.find('.uk-modal-caption').remove();
  220 +
  221 + if (data.title) {
  222 + this.modal.dialog.append('<div class="uk-modal-caption">'+data.title+'</div>');
  223 + maxheight -= this.modal.dialog.find('.uk-modal-caption').outerHeight();
  224 + }
  225 +
  226 + if (maxwidth < data.meta.width) {
  227 +
  228 + h = Math.floor( h * (maxwidth / w) );
  229 + w = maxwidth;
  230 + }
  231 +
  232 + if (maxheight < h) {
  233 +
  234 + h = Math.floor(maxheight);
  235 + w = Math.ceil(data.meta.width * (maxheight/data.meta.height));
  236 + }
  237 +
  238 + this.modal.content.css('opacity', 0).width(w).html(content);
  239 +
  240 + if (data.type == 'iframe') {
  241 + this.modal.content.find('iframe:first').height(h);
  242 + }
  243 +
  244 + var dh = h + pad,
  245 + t = Math.floor(window.innerHeight/2 - dh/2) - dpad;
  246 +
  247 + if (t < 0) { t = 0; }
  248 +
  249 + this.modal.closer.addClass('uk-hidden');
  250 +
  251 + if ($this.modal.data('mwidth') == w && $this.modal.data('mheight') == h) {
  252 + duration = 0;
  253 + }
  254 +
  255 + this.modal.dialog.animate({width: w + pad, height: h + pad, top: t }, duration, 'swing', function() {
  256 + $this.modal.loader.addClass('uk-hidden');
  257 + $this.modal.content.css({width:''}).animate({'opacity': 1}, function() {
  258 + $this.modal.closer.removeClass('uk-hidden');
  259 + });
  260 +
  261 + $this.modal.data({'mwidth': w, 'mheight': h});
  262 + });
  263 + },
  264 +
  265 + next: function() {
  266 + this.show(this.siblings[(this.index+1)] ? (this.index+1) : 0);
  267 + },
  268 +
  269 + previous: function() {
  270 + this.show(this.siblings[(this.index-1)] ? (this.index-1) : this.siblings.length-1);
  271 + }
  272 + });
  273 +
  274 +
  275 + // Plugins
  276 +
  277 + UI.plugin('lightbox', 'image', {
  278 +
  279 + init: function(lightbox) {
  280 +
  281 + lightbox.on("showitem.uk.lightbox", function(e, data){
  282 +
  283 + if (data.type == 'image' || data.source && data.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)) {
  284 +
  285 + var resolve = function(source, width, height) {
  286 +
  287 + data.meta = {
  288 + "content" : '<img class="uk-responsive-width" width="'+width+'" height="'+height+'" src ="'+source+'">',
  289 + "width" : width,
  290 + "height" : height
  291 + };
  292 +
  293 + data.type = 'image';
  294 +
  295 + data.promise.resolve();
  296 + };
  297 +
  298 + if (!cache[data.source]) {
  299 +
  300 + var img = new Image();
  301 +
  302 + img.onerror = function(){
  303 + data.promise.reject('Loading image failed');
  304 + };
  305 +
  306 + img.onload = function(){
  307 + cache[data.source] = {width: img.width, height: img.height};
  308 + resolve(data.source, cache[data.source].width, cache[data.source].height);
  309 + };
  310 +
  311 + img.src = data.source;
  312 +
  313 + } else {
  314 + resolve(data.source, cache[data.source].width, cache[data.source].height);
  315 + }
  316 + }
  317 + });
  318 + }
  319 + });
  320 +
  321 + UI.plugin("lightbox", "youtube", {
  322 +
  323 + init: function(lightbox) {
  324 +
  325 + var youtubeRegExp = /(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,
  326 + youtubeRegExpShort = /youtu\.be\/(.*)/;
  327 +
  328 +
  329 + lightbox.on("showitem.uk.lightbox", function(e, data){
  330 +
  331 + var id, matches, resolve = function(id, width, height) {
  332 +
  333 + data.meta = {
  334 + 'content': '<iframe src="//www.youtube.com/embed/'+id+'" width="'+width+'" height="'+height+'" style="max-width:100%;"></iframe>',
  335 + 'width': width,
  336 + 'height': height
  337 + };
  338 +
  339 + data.type = 'iframe';
  340 +
  341 + data.promise.resolve();
  342 + };
  343 +
  344 + if (matches = data.source.match(youtubeRegExp)) {
  345 + id = matches[2];
  346 + }
  347 +
  348 + if (matches = data.source.match(youtubeRegExpShort)) {
  349 + id = matches[1];
  350 + }
  351 +
  352 + if (id) {
  353 +
  354 + if(!cache[id]) {
  355 +
  356 + var img = new Image(), lowres = false;
  357 +
  358 + img.onerror = function(){
  359 + cache[id] = {width:640, height:320};
  360 + resolve(id, cache[id].width, cache[id].height);
  361 + };
  362 +
  363 + img.onload = function(){
  364 + //youtube default 404 thumb, fall back to lowres
  365 + if (img.width == 120 && img.height == 90) {
  366 + if (!lowres) {
  367 + lowres = true;
  368 + img.src = '//img.youtube.com/vi/' + id + '/0.jpg';
  369 + } else {
  370 + cache[id] = {width: 640, height: 320};
  371 + resolve(id, cache[id].width, cache[id].height);
  372 + }
  373 + } else {
  374 + cache[id] = {width: img.width, height: img.height};
  375 + resolve(id, img.width, img.height);
  376 + }
  377 + };
  378 +
  379 + img.src = '//img.youtube.com/vi/'+id+'/maxresdefault.jpg';
  380 +
  381 + } else {
  382 + resolve(id, cache[id].width, cache[id].height);
  383 + }
  384 +
  385 + e.stopImmediatePropagation();
  386 + }
  387 + });
  388 + }
  389 + });
  390 +
  391 +
  392 + UI.plugin("lightbox", "vimeo", {
  393 +
  394 + init: function(lightbox) {
  395 +
  396 + var regex = /(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/, matches;
  397 +
  398 +
  399 + lightbox.on("showitem.uk.lightbox", function(e, data){
  400 +
  401 + var id, resolve = function(id, width, height) {
  402 +
  403 + data.meta = {
  404 + 'content': '<iframe src="//player.vimeo.com/video/'+id+'" width="'+width+'" height="'+height+'" style="width:100%;box-sizing:border-box;"></iframe>',
  405 + 'width': width,
  406 + 'height': height
  407 + };
  408 +
  409 + data.type = 'iframe';
  410 +
  411 + data.promise.resolve();
  412 + };
  413 +
  414 + if (matches = data.source.match(regex)) {
  415 +
  416 + id = matches[2];
  417 +
  418 + if(!cache[id]) {
  419 +
  420 + UI.$.ajax({
  421 + type : 'GET',
  422 + url : 'http://vimeo.com/api/oembed.json?url=' + encodeURI(data.source),
  423 + jsonp : 'callback',
  424 + dataType : 'jsonp',
  425 + success : function(data) {
  426 + cache[id] = {width:data.width, height:data.height};
  427 + resolve(id, cache[id].width, cache[id].height);
  428 + }
  429 + });
  430 +
  431 + } else {
  432 + resolve(id, cache[id].width, cache[id].height);
  433 + }
  434 +
  435 + e.stopImmediatePropagation();
  436 + }
  437 + });
  438 + }
  439 + });
  440 +
  441 + UI.plugin("lightbox", "video", {
  442 +
  443 + init: function(lightbox) {
  444 +
  445 + lightbox.on("showitem.uk.lightbox", function(e, data){
  446 +
  447 +
  448 + var resolve = function(source, width, height) {
  449 +
  450 + data.meta = {
  451 + 'content': '<video class="uk-responsive-width" src="'+source+'" width="'+width+'" height="'+height+'" controls></video>',
  452 + 'width': width,
  453 + 'height': height
  454 + };
  455 +
  456 + data.type = 'video';
  457 +
  458 + data.promise.resolve();
  459 + };
  460 +
  461 + if (data.type == 'video' || data.source.match(/\.(mp4|webm|ogv)$/i)) {
  462 +
  463 + if (!cache[data.source]) {
  464 +
  465 + var vid = UI.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr('src', data.source).appendTo('body');
  466 +
  467 + var idle = setInterval(function() {
  468 +
  469 + if (vid[0].videoWidth) {
  470 + clearInterval(idle);
  471 + cache[data.source] = {width: vid[0].videoWidth, height: vid[0].videoHeight};
  472 + resolve(data.source, cache[data.source].width, cache[data.source].height);
  473 + vid.remove();
  474 + }
  475 +
  476 + }, 20);
  477 +
  478 + } else {
  479 + resolve(data.source, cache[data.source].width, cache[data.source].height);
  480 + }
  481 + }
  482 + });
  483 + }
  484 + });
  485 +
  486 +
  487 + function getModal(lightbox) {
  488 +
  489 + if (modal) {
  490 + modal.lightbox = lightbox;
  491 + return modal;
  492 + }
  493 +
  494 + // init lightbox container
  495 + modal = UI.$([
  496 + '<div class="uk-modal">',
  497 + '<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2 - 200)+'px;">',
  498 + '<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>',
  499 + '<div class="uk-lightbox-content"></div>',
  500 + '<div class="uk-modal-spinner uk-hidden"></div>',
  501 + '</div>',
  502 + '</div>'
  503 + ].join('')).appendTo('body');
  504 +
  505 + modal.dialog = modal.find('.uk-modal-dialog:first');
  506 + modal.content = modal.find('.uk-lightbox-content:first');
  507 + modal.loader = modal.find('.uk-modal-spinner:first');
  508 + modal.closer = modal.find('.uk-close.uk-close-alt');
  509 + modal.modal = UI.modal(modal, {modal:false, bgclose: false});
  510 +
  511 + // next / previous
  512 +/* modal.on("swipeRight swipeLeft", function(e) {
  513 + modal.lightbox[e.type=='swipeLeft' ? 'next':'previous']();
  514 + }).on("click", "[data-lightbox-previous], [data-lightbox-next]", function(e){
  515 + e.preventDefault();
  516 + modal.lightbox[UI.$(this).is('[data-lightbox-next]') ? 'next':'previous']();
  517 + });*/
  518 +
  519 + // destroy content on modal hide
  520 + modal.on("hide.uk.modal", function(e) {
  521 + modal.content.html('');
  522 + });
  523 +
  524 + UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(e){
  525 + if (modal.is(':visible') && !UI.Utils.isFullscreen()) modal.lightbox.fitSize();
  526 + }.bind(this), 100));
  527 +
  528 + modal.lightbox = lightbox;
  529 +
  530 + return modal;
  531 + }
  532 +
  533 + UI.lightbox.create = function(items, options) {
  534 +
  535 + if (!items) return;
  536 +
  537 + var group = [], o;
  538 +
  539 + items.forEach(function(item) {
  540 +
  541 + group.push(UI.$.extend({
  542 + 'source' : '',
  543 + 'title' : '',
  544 + 'type' : 'auto',
  545 + 'link' : false
  546 + }, (typeof(item) == 'string' ? {'source': item} : item)));
  547 + });
  548 +
  549 + o = UI.lightbox(UI.$.extend({}, options, {'group':group}));
  550 +
  551 + return o;
  552 + };
  553 +
  554 + return UI.lightbox;
  555 +});
src/main/resources/static/real_control_v2/assets/plugins/uikit-2.27.1/components/lightbox.min.js
1 -/* UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */  
2 -!function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-lightbox",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";function t(t){if(e)return e.lightbox=t,e;e=i.$(['<div class="uk-modal">','<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2-200)+'px;">','<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>','<div class="uk-lightbox-content"></div>','<div class="uk-modal-spinner uk-hidden"></div>',"</div>","</div>"].join("")).appendTo("body"),e.dialog=e.find(".uk-modal-dialog:first"),e.content=e.find(".uk-lightbox-content:first"),e.loader=e.find(".uk-modal-spinner:first"),e.closer=e.find(".uk-close.uk-close-alt"),e.modal=i.modal(e,{modal:!1}),e.on("swipeRight swipeLeft",function(i){e.lightbox["swipeLeft"==i.type?"next":"previous"]()}).on("click","[data-lightbox-previous], [data-lightbox-next]",function(t){t.preventDefault(),e.lightbox[i.$(this).is("[data-lightbox-next]")?"next":"previous"]()}),e.on("hide.uk.modal",function(){e.content.html("")});var o={w:window.innerWidth,h:window.innerHeight};return i.$win.on("load resize orientationchange",i.Utils.debounce(function(){o.w!==window.innerWidth&&e.is(":visible")&&!i.Utils.isFullscreen()&&e.lightbox.fitSize(),o={w:window.innerWidth,h:window.innerHeight}},100)),e.lightbox=t,e}var e,o={};return i.component("lightbox",{defaults:{allowfullscreen:!0,duration:400,group:!1,keyboard:!0},index:0,items:!1,boot:function(){i.$html.on("click","[data-uk-lightbox]",function(t){t.preventDefault();var e=i.$(this);e.data("lightbox")||i.lightbox(e,i.Utils.options(e.attr("data-uk-lightbox"))),e.data("lightbox").show(e)}),i.$doc.on("keyup",function(i){if(e&&e.is(":visible")&&e.lightbox.options.keyboard)switch(i.preventDefault(),i.keyCode){case 37:e.lightbox.previous();break;case 39:e.lightbox.next()}})},init:function(){var t=[];if(this.index=0,this.siblings=[],this.element&&this.element.length){var e=this.options.group?i.$(['[data-uk-lightbox*="'+this.options.group+'"]',"[data-uk-lightbox*='"+this.options.group+"']"].join(",")):this.element;e.each(function(){var e=i.$(this);t.push({source:e.attr("href"),title:e.attr("data-title")||e.attr("title"),type:e.attr("data-lightbox-type")||"auto",link:e})}),this.index=e.index(this.element),this.siblings=t}else this.options.group&&this.options.group.length&&(this.siblings=this.options.group);this.trigger("lightbox-init",[this])},show:function(e){this.modal=t(this),this.modal.dialog.stop(),this.modal.content.stop();var o,n,s=this,h=i.$.Deferred();e=e||0,"object"==typeof e&&this.siblings.forEach(function(i,t){e[0]===i.link[0]&&(e=t)}),0>e?e=this.siblings.length-e:this.siblings[e]||(e=0),n=this.siblings[e],o={lightbox:s,source:n.source,type:n.type,index:e,promise:h,title:n.title,item:n,meta:{content:"",width:null,height:null}},this.index=e,this.modal.content.empty(),this.modal.is(":visible")||(this.modal.content.css({width:"",height:""}).empty(),this.modal.modal.show()),this.modal.loader.removeClass("uk-hidden"),h.promise().done(function(){s.data=o,s.fitSize(o)}).fail(function(){o.meta.content='<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>',o.meta.width=400,o.meta.height=300,s.data=o,s.fitSize(o)}),s.trigger("showitem.uk.lightbox",[o])},fitSize:function(){var t=this,e=this.data,o=this.modal.dialog.outerWidth()-this.modal.dialog.width(),n=parseInt(this.modal.dialog.css("margin-top"),10),s=parseInt(this.modal.dialog.css("margin-bottom"),10),h=n+s,a=e.meta.content,l=t.options.duration;this.siblings.length>1&&(a=[a,'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>','<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'].join(""));var d,r,u=i.$("<div>&nbsp;</div>").css({opacity:0,position:"absolute",top:0,left:0,width:"100%","max-width":t.modal.dialog.css("max-width"),padding:t.modal.dialog.css("padding"),margin:t.modal.dialog.css("margin")}),c=e.meta.width,g=e.meta.height;u.appendTo("body").width(),d=u.width(),r=window.innerHeight-h,u.remove(),this.modal.dialog.find(".uk-modal-caption").remove(),e.title&&(this.modal.dialog.append('<div class="uk-modal-caption">'+e.title+"</div>"),r-=this.modal.dialog.find(".uk-modal-caption").outerHeight()),d<e.meta.width&&(g=Math.floor(g*(d/c)),c=d),g>r&&(g=Math.floor(r),c=Math.ceil(e.meta.width*(r/e.meta.height))),this.modal.content.css("opacity",0).width(c).html(a),"iframe"==e.type&&this.modal.content.find("iframe:first").height(g);var m=g+o,p=Math.floor(window.innerHeight/2-m/2)-h;0>p&&(p=0),this.modal.closer.addClass("uk-hidden"),t.modal.data("mwidth")==c&&t.modal.data("mheight")==g&&(l=0),this.modal.dialog.animate({width:c+o,height:g+o,top:p},l,"swing",function(){t.modal.loader.addClass("uk-hidden"),t.modal.content.css({width:""}).animate({opacity:1},function(){t.modal.closer.removeClass("uk-hidden")}),t.modal.data({mwidth:c,mheight:g})})},next:function(){this.show(this.siblings[this.index+1]?this.index+1:0)},previous:function(){this.show(this.siblings[this.index-1]?this.index-1:this.siblings.length-1)}}),i.plugin("lightbox","image",{init:function(i){i.on("showitem.uk.lightbox",function(i,t){if("image"==t.type||t.source&&t.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)){var e=function(i,e,o){t.meta={content:'<img class="uk-responsive-width" width="'+e+'" height="'+o+'" src ="'+i+'">',width:e,height:o},t.type="image",t.promise.resolve()};if(o[t.source])e(t.source,o[t.source].width,o[t.source].height);else{var n=new Image;n.onerror=function(){t.promise.reject("Loading image failed")},n.onload=function(){o[t.source]={width:n.width,height:n.height},e(t.source,o[t.source].width,o[t.source].height)},n.src=t.source}}})}}),i.plugin("lightbox","youtube",{init:function(i){var t=/(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,n=/youtu\.be\/(.*)/;i.on("showitem.uk.lightbox",function(i,s){var h,a,l=function(i,t,o){s.meta={content:'<iframe src="//www.youtube.com/embed/'+i+'" width="'+t+'" height="'+o+'" style="max-width:100%;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},s.type="iframe",s.promise.resolve()};if((a=s.source.match(t))&&(h=a[2]),(a=s.source.match(n))&&(h=a[1]),h){if(o[h])l(h,o[h].width,o[h].height);else{var d=new Image,r=!1;d.onerror=function(){o[h]={width:640,height:320},l(h,o[h].width,o[h].height)},d.onload=function(){120==d.width&&90==d.height?r?(o[h]={width:640,height:320},l(h,o[h].width,o[h].height)):(r=!0,d.src="//img.youtube.com/vi/"+h+"/0.jpg"):(o[h]={width:d.width,height:d.height},l(h,d.width,d.height))},d.src="//img.youtube.com/vi/"+h+"/maxresdefault.jpg"}i.stopImmediatePropagation()}})}}),i.plugin("lightbox","vimeo",{init:function(t){var n,s=/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/;t.on("showitem.uk.lightbox",function(t,h){var a,l=function(i,t,o){h.meta={content:'<iframe src="//player.vimeo.com/video/'+i+'" width="'+t+'" height="'+o+'" style="width:100%;box-sizing:border-box;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},h.type="iframe",h.promise.resolve()};(n=h.source.match(s))&&(a=n[2],o[a]?l(a,o[a].width,o[a].height):i.$.ajax({type:"GET",url:"//vimeo.com/api/oembed.json?url="+encodeURI(h.source),jsonp:"callback",dataType:"jsonp",success:function(i){o[a]={width:i.width,height:i.height},l(a,o[a].width,o[a].height)}}),t.stopImmediatePropagation())})}}),i.plugin("lightbox","video",{init:function(t){t.on("showitem.uk.lightbox",function(t,e){var n=function(i,t,o){e.meta={content:'<video class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+o+'" controls></video>',width:t,height:o},e.type="video",e.promise.resolve()};if("video"==e.type||e.source.match(/\.(mp4|webm|ogv)$/i))if(o[e.source])n(e.source,o[e.source].width,o[e.source].height);else var s=i.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr("src",e.source).appendTo("body"),h=setInterval(function(){s[0].videoWidth&&(clearInterval(h),o[e.source]={width:s[0].videoWidth,height:s[0].videoHeight},n(e.source,o[e.source].width,o[e.source].height),s.remove())},20)})}}),UIkit.plugin("lightbox","iframe",{init:function(i){i.on("showitem.uk.lightbox",function(t,o){var n=function(i,t,n){o.meta={content:'<iframe class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+n+'"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:n},o.type="iframe",o.promise.resolve()};("iframe"===o.type||o.source.match(/\.(html|php)$/))&&n(o.source,i.options.width||800,i.options.height||600)})}}),i.lightbox.create=function(t,e){if(t){var o,n=[];return t.forEach(function(t){n.push(i.$.extend({source:"",title:"",type:"auto",link:!1},"string"==typeof t?{source:t}:t))}),o=i.lightbox(i.$.extend({},e,{group:n}))}},i.lightbox});  
3 \ No newline at end of file 1 \ No newline at end of file
  2 +(function(addon){var component;if(window.UIkit){component=addon(UIkit)}if(typeof define=="function"&&define.amd){define("uikit-lightbox",["uikit"],function(){return component||addon(UIkit)})}})(function(UI){"use strict";var modal,cache={};UI.component('lightbox',{defaults:{"group":false,"duration":400,"keyboard":true},index:0,items:false,boot:function(){UI.$html.on('click','[data-uk-lightbox]',function(e){e.preventDefault();var link=UI.$(this);if(!link.data("lightbox")){UI.lightbox(link,UI.Utils.options(link.attr("data-uk-lightbox")))}link.data("lightbox").show(link)});UI.$doc.on('keyup',function(e){if(modal&&modal.is(':visible')&&modal.lightbox.options.keyboard){e.preventDefault();switch(e.keyCode){case 37:modal.lightbox.previous();break;case 39:modal.lightbox.next();break}}})},init:function(){var siblings=[];this.index=0;this.siblings=[];if(this.element&&this.element.length){var domSiblings=this.options.group?UI.$(['[data-uk-lightbox*="'+this.options.group+'"]',"[data-uk-lightbox*='"+this.options.group+"']"].join(',')):this.element;domSiblings.each(function(){var ele=UI.$(this);siblings.push({'source':ele.attr('href'),'title':ele.attr('data-title')||ele.attr('title'),'type':ele.attr("data-lightbox-type")||'auto','link':ele})});this.index=domSiblings.index(this.element);this.siblings=siblings}else if(this.options.group&&this.options.group.length){this.siblings=this.options.group}this.trigger('lightbox-init',[this])},show:function(index){this.modal=getModal(this);this.modal.dialog.stop();this.modal.content.stop();var $this=this,promise=UI.$.Deferred(),data,item;index=index||0;if(typeof(index)=='object'){this.siblings.forEach(function(s,idx){if(index[0]===s.link[0]){index=idx}})}if(index<0){index=this.siblings.length-index}else if(!this.siblings[index]){index=0}item=this.siblings[index];data={"lightbox":$this,"source":item.source,"type":item.type,"index":index,"promise":promise,"title":item.title,"item":item,"meta":{"content":'',"width":null,"height":null}};this.index=index;this.modal.content.empty();if(!this.modal.is(':visible')){this.modal.content.css({width:'',height:''}).empty();this.modal.modal.show()}this.modal.loader.removeClass('uk-hidden');promise.promise().done(function(){$this.data=data;$this.fitSize(data)}).fail(function(){data.meta.content='<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>';data.meta.width=400;data.meta.height=300;$this.data=data;$this.fitSize(data)});$this.trigger('showitem.uk.lightbox',[data])},fitSize:function(){var $this=this,data=this.data,pad=this.modal.dialog.outerWidth()-this.modal.dialog.width(),dpadTop=parseInt(this.modal.dialog.css('margin-top'),10),dpadBot=parseInt(this.modal.dialog.css('margin-bottom'),10),dpad=dpadTop+dpadBot,content=data.meta.content,duration=$this.options.duration;if(this.siblings.length>1){content=[content,'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>','<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'].join('')}var tmp=UI.$('<div>&nbsp;</div>').css({'opacity':0,'position':'absolute','top':0,'left':0,'width':'100%','max-width':$this.modal.dialog.css('max-width'),'padding':$this.modal.dialog.css('padding'),'margin':$this.modal.dialog.css('margin')}),maxwidth,maxheight,w=data.meta.width,h=data.meta.height;tmp.appendTo('body').width();maxwidth=tmp.width();maxheight=window.innerHeight-dpad;tmp.remove();this.modal.dialog.find('.uk-modal-caption').remove();if(data.title){this.modal.dialog.append('<div class="uk-modal-caption">'+data.title+'</div>');maxheight-=this.modal.dialog.find('.uk-modal-caption').outerHeight()}if(maxwidth<data.meta.width){h=Math.floor(h*(maxwidth/w));w=maxwidth}if(maxheight<h){h=Math.floor(maxheight);w=Math.ceil(data.meta.width*(maxheight/data.meta.height))}this.modal.content.css('opacity',0).width(w).html(content);if(data.type=='iframe'){this.modal.content.find('iframe:first').height(h)}var dh=h+pad,t=Math.floor(window.innerHeight/2-dh/2)-dpad;if(t<0){t=0}this.modal.closer.addClass('uk-hidden');if($this.modal.data('mwidth')==w&&$this.modal.data('mheight')==h){duration=0}this.modal.dialog.animate({width:w+pad,height:h+pad,top:t},duration,'swing',function(){$this.modal.loader.addClass('uk-hidden');$this.modal.content.css({width:''}).animate({'opacity':1},function(){$this.modal.closer.removeClass('uk-hidden')});$this.modal.data({'mwidth':w,'mheight':h})})},next:function(){this.show(this.siblings[(this.index+1)]?(this.index+1):0)},previous:function(){this.show(this.siblings[(this.index-1)]?(this.index-1):this.siblings.length-1)}});UI.plugin('lightbox','image',{init:function(lightbox){lightbox.on("showitem.uk.lightbox",function(e,data){if(data.type=='image'||data.source&&data.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)){var resolve=function(source,width,height){data.meta={"content":'<img class="uk-responsive-width" width="'+width+'" height="'+height+'" src ="'+source+'">',"width":width,"height":height};data.type='image';data.promise.resolve()};if(!cache[data.source]){var img=new Image();img.onerror=function(){data.promise.reject('Loading image failed')};img.onload=function(){cache[data.source]={width:img.width,height:img.height};resolve(data.source,cache[data.source].width,cache[data.source].height)};img.src=data.source}else{resolve(data.source,cache[data.source].width,cache[data.source].height)}}})}});UI.plugin("lightbox","youtube",{init:function(lightbox){var youtubeRegExp=/(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,youtubeRegExpShort=/youtu\.be\/(.*)/;lightbox.on("showitem.uk.lightbox",function(e,data){var id,matches,resolve=function(id,width,height){data.meta={'content':'<iframe src="//www.youtube.com/embed/'+id+'" width="'+width+'" height="'+height+'" style="max-width:100%;"></iframe>','width':width,'height':height};data.type='iframe';data.promise.resolve()};if(matches=data.source.match(youtubeRegExp)){id=matches[2]}if(matches=data.source.match(youtubeRegExpShort)){id=matches[1]}if(id){if(!cache[id]){var img=new Image(),lowres=false;img.onerror=function(){cache[id]={width:640,height:320};resolve(id,cache[id].width,cache[id].height)};img.onload=function(){if(img.width==120&&img.height==90){if(!lowres){lowres=true;img.src='//img.youtube.com/vi/'+id+'/0.jpg'}else{cache[id]={width:640,height:320};resolve(id,cache[id].width,cache[id].height)}}else{cache[id]={width:img.width,height:img.height};resolve(id,img.width,img.height)}};img.src='//img.youtube.com/vi/'+id+'/maxresdefault.jpg'}else{resolve(id,cache[id].width,cache[id].height)}e.stopImmediatePropagation()}})}});UI.plugin("lightbox","vimeo",{init:function(lightbox){var regex=/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/,matches;lightbox.on("showitem.uk.lightbox",function(e,data){var id,resolve=function(id,width,height){data.meta={'content':'<iframe src="//player.vimeo.com/video/'+id+'" width="'+width+'" height="'+height+'" style="width:100%;box-sizing:border-box;"></iframe>','width':width,'height':height};data.type='iframe';data.promise.resolve()};if(matches=data.source.match(regex)){id=matches[2];if(!cache[id]){UI.$.ajax({type:'GET',url:'http://vimeo.com/api/oembed.json?url='+encodeURI(data.source),jsonp:'callback',dataType:'jsonp',success:function(data){cache[id]={width:data.width,height:data.height};resolve(id,cache[id].width,cache[id].height)}})}else{resolve(id,cache[id].width,cache[id].height)}e.stopImmediatePropagation()}})}});UI.plugin("lightbox","video",{init:function(lightbox){lightbox.on("showitem.uk.lightbox",function(e,data){var resolve=function(source,width,height){data.meta={'content':'<video class="uk-responsive-width" src="'+source+'" width="'+width+'" height="'+height+'" controls></video>','width':width,'height':height};data.type='video';data.promise.resolve()};if(data.type=='video'||data.source.match(/\.(mp4|webm|ogv)$/i)){if(!cache[data.source]){var vid=UI.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr('src',data.source).appendTo('body');var idle=setInterval(function(){if(vid[0].videoWidth){clearInterval(idle);cache[data.source]={width:vid[0].videoWidth,height:vid[0].videoHeight};resolve(data.source,cache[data.source].width,cache[data.source].height);vid.remove()}},20)}else{resolve(data.source,cache[data.source].width,cache[data.source].height)}}})}});function getModal(lightbox){if(modal){modal.lightbox=lightbox;return modal}modal=UI.$(['<div class="uk-modal">','<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2-200)+'px;">','<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>','<div class="uk-lightbox-content"></div>','<div class="uk-modal-spinner uk-hidden"></div>','</div>','</div>'].join('')).appendTo('body');modal.dialog=modal.find('.uk-modal-dialog:first');modal.content=modal.find('.uk-lightbox-content:first');modal.loader=modal.find('.uk-modal-spinner:first');modal.closer=modal.find('.uk-close.uk-close-alt');modal.modal=UI.modal(modal,{modal:false,bgclose:false});modal.on("hide.uk.modal",function(e){modal.content.html('')});UI.$win.on('load resize orientationchange',UI.Utils.debounce(function(e){if(modal.is(':visible')&&!UI.Utils.isFullscreen())modal.lightbox.fitSize()}.bind(this),100));modal.lightbox=lightbox;return modal}UI.lightbox.create=function(items,options){if(!items)return;var group=[],o;items.forEach(function(item){group.push(UI.$.extend({'source':'','title':'','type':'auto','link':false},(typeof(item)=='string'?{'source':item}:item)))});o=UI.lightbox(UI.$.extend({},options,{'group':group}));return o};return UI.lightbox});
4 \ No newline at end of file 3 \ No newline at end of file
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,
@@ -500,4 +502,43 @@ span.sm-red{ @@ -500,4 +502,43 @@ span.sm-red{
500 span.sm-grey{ 502 span.sm-grey{
501 font-size: 12px; 503 font-size: 12px;
502 color: grey; 504 color: grey;
  505 +}
  506 +
  507 +.voip_call_info_panel{
  508 + width: 258px;
  509 + background: #ffffff;
  510 + display: inline-block;
  511 + vertical-align: bottom;
  512 + border-left: 1px solid #d8cece;
  513 +}
  514 +
  515 +.uk-lightbox-content>img{
  516 + display: inline-block;
  517 +}
  518 +
  519 +.voip_call_info_panel form{
  520 + padding: 15px 15px 0 15px;
  521 + vertical-align: bottom;
  522 +}
  523 +
  524 +.voip_call_info_panel .uk-form-horizontal .uk-form-label{
  525 + width: 70px;
  526 +}
  527 +
  528 +.voip_call_info_panel .uk-form-horizontal .uk-form-controls{
  529 + margin-left: 72px;
  530 +}
  531 +
  532 +.voip_call_info_panel .state_txt{
  533 + text-align: center;
  534 +}
  535 +
  536 +.voip_call_info_panel ._title{
  537 + padding: 15px;
  538 + background: #e6e6e6;
  539 +}
  540 +
  541 +#line_config_entity_wrap .uk-list{
  542 + display: block;
  543 + margin-top: 25px;
503 } 544 }
504 \ 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/fragments/north/nav/safeDriving.html
@@ -79,7 +79,7 @@ @@ -79,7 +79,7 @@
79 <a class="image_link" href="{{sd.url}}.gif" data-uk-lightbox="{group:'gif_group2'}" title="{{sd.title}}">查看</a> 79 <a class="image_link" href="{{sd.url}}.gif" data-uk-lightbox="{group:'gif_group2'}" title="{{sd.title}}">查看</a>
80 </td> 80 </td>
81 <td> 81 <td>
82 - <a data-type="{{sd.yczltype}}" class="show_vedio_modal">DVR</a> 82 + <a data-type="{{sd.yczltype}}" class="show_vedio_modal" style="color: grey">DVR</a>
83 </td> 83 </td>
84 </tr> 84 </tr>
85 {{/each}} 85 {{/each}}
@@ -136,7 +136,11 @@ @@ -136,7 +136,11 @@
136 url = stm.format('YYYYMMDD')+'/'+p+'/'+p; 136 url = stm.format('YYYYMMDD')+'/'+p+'/'+p;
137 this.url = gb_safe_driv.urlPath + url; 137 this.url = gb_safe_driv.urlPath + url;
138 //title 138 //title
139 - this.title = this.clzbh+' '+stm.format('HH时mm分ss秒')+' '+this.yczlText; 139 + var call_btn_html = '<button class="uk-button uk-button-mini uk-button-primary" ' +
  140 + 'id="m_voip_call_btn_001" ' +
  141 + 'type="button" ' +
  142 + 'data-nbbm="'+this.clzbh+'">打电话</button>';
  143 + this.title = this.clzbh+' '+stm.format('HH时mm分ss秒')+' '+this.yczlText + '&nbsp;' + call_btn_html;
140 }); 144 });
141 145
142 var bodyHtml = template('all-safe_dring-table-temp', { 146 var bodyHtml = template('all-safe_dring-table-temp', {
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 }
src/main/resources/static/real_control_v2/js/modal_extend.js
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 $(document).on('hide.uk.modal', '.uk-modal', function () { 2 $(document).on('hide.uk.modal', '.uk-modal', function () {
3 //放过灯箱 3 //放过灯箱
4 if($('.uk-modal-dialog', this).hasClass('uk-modal-dialog-lightbox')){ 4 if($('.uk-modal-dialog', this).hasClass('uk-modal-dialog-lightbox')){
  5 + gb_call_phone.hangup();
5 return; 6 return;
6 } 7 }
7 $(this).trigger('ct-destroy').remove(); 8 $(this).trigger('ct-destroy').remove();
src/main/resources/static/real_control_v2/js/safe_driv/call_phone.js
1 var gb_call_phone = function () { 1 var gb_call_phone = function () {
2 2
3 - var basePath = "http://180.168.57.114:4244";  
4 - var wsUri = "ws://180.168.57.114:21892/"; 3 + /**
  4 + * 0 已挂断
  5 + * 1 通话中
  6 + * @type {number}
  7 + */
  8 + var phoneStatus=0;
5 9
6 - var nbbm2tel = {  
7 - "S0E-178":"915618938041",  
8 - "S0E-179":"915618937546",  
9 - "S0E-182":"915618938047",  
10 - "S0E-183":"915618937940",  
11 - "S0E-186":"915601989452",  
12 - "S0E-187":"915618846405",  
13 - "S0E-043":"915618847457",  
14 - "S0E-044":"915618845487",  
15 - "S2F-070":"915618846479",  
16 - "S2F-071":"915601989461",  
17 - "S2F-072":"915618937945",  
18 - "S2F-073":"915618937845",  
19 - "S2F-075":"915618847416",  
20 - "S2F-076":"915618847410",  
21 - "S2F-077":"915618847413",  
22 - "S2F-078":"915618847415",  
23 - "S2F-079":"915618847417",  
24 - "S2F-080":"915618847418",  
25 - "S2F-083":"915618847420",  
26 - "S2F-119":"915601987406",  
27 - "W0F-018":"915618209534",  
28 - "W0F-019":"915601987405",  
29 - "W0F-020":"915618278604",  
30 - "W0F-021":"915618278614",  
31 - "W0F-022":"915618012546",  
32 - "W0F-023":"915618278704",  
33 - "W0F-024":"915618278594",  
34 - "W0F-025":"915601989450",  
35 - "W0F-026":"915618209194",  
36 - "W0F-027":"915618208724",  
37 - "W0F-028":"915618278624",  
38 - "W0F-029":"915601988491",  
39 - "W0F-030":"915618936848",  
40 - "W0F-031":"915618928940",  
41 - "W0F-069":"915618011142",  
42 - "W0F-070":"915618279534",  
43 - "W0F-071":"915601989439",  
44 - "W0F-072":"915618011245",  
45 - "W0F-073":"915618010242",  
46 - "W0F-074":"915618279594",  
47 - "W0F-075":"915618010947",  
48 - "W0F-089":"915618011747",  
49 - "W0F-090":"915618279574",  
50 - "S2F-069":"915618938143",  
51 - "S2F-081":"915601986481"  
52 - }; 10 + var _nbbm;
  11 + var simNo;
  12 + var agentID;
  13 + var dn;
  14 + var wrap = '.voip_call_info_panel';
  15 + var storage = window.localStorage;
  16 + var loc_dn_key = 'control_sd_voip_dn';
  17 + var callMaxTime = 7;//拨号超时时间-秒
  18 + var $stateBtnTxt;
  19 + var init = function (nbbm) {
  20 + $stateBtnTxt = $('.state_txt>button', wrap);
53 21
54 - var locData = window.localStorage.getItem('test_nbbm2tel_json');  
55 - if(locData){  
56 - nbbm2tel = JSON.parse(locData);  
57 - } 22 + _nbbm = nbbm;
  23 + agentID = $('[name=agentID]', wrap).val();
  24 + dn = $('[name=dn]', wrap).val();
58 25
59 - var login = function (cb) {  
60 - var agentID = '1002';  
61 - var dn = '6002'; 26 + //从本地读取分机号
  27 + var locDn = storage.getItem(loc_dn_key);
  28 + if(!dn && locDn){
  29 + dn = locDn;
  30 + $('[name=dn]', wrap).val(locDn);
  31 + }
62 32
63 - var options = {  
64 - AgentID: agentID,  
65 - DN: dn,  
66 - wsUri: wsUri,  
67 - setbtnStatus: function (stateName) {  
68 - //setState(stateName);  
69 - console.log('stateName', stateName); 33 + if(!dn){
  34 + waitInputDn();
  35 + return;
  36 + }
70 37
71 - cb && cb(stateName) 38 + //将分机号写入本地
  39 + storage.setItem(loc_dn_key, $('[name=dn]', wrap).val());
  40 + var $simInput = $('[name=simNo]', wrap);
  41 + var eq = EventProxy.create('pluginInit', 'getSimNo', function () {
  42 + simNo = ('9' + simNo);
  43 + $simInput.val(simNo);
  44 + if(!simNo){
  45 + $stateBtnTxt.text('获取SIM卡号失败!');
  46 + return;
72 } 47 }
73 - };  
74 - $.CallCenterInit(options); 48 +
  49 + _t = 0;
  50 + $stateBtnTxt.text('正在拨号(0)')
  51 + .attr('disabled', 'disabled');
  52 + //拨号
  53 + $.PhonePluginFun.Dialing(simNo);
  54 + startTimer();
  55 + });
  56 +
  57 + //初始化插件
  58 + pluginInit(agentID, dn, function () {
  59 + eq.emitLater('pluginInit');
  60 + });
  61 +
  62 + //获取SIM
  63 + $.PhonePluginFun.GetSimCardNo(nbbm, function (no) {
  64 + simNo = no;
  65 + eq.emitLater('getSimNo');
  66 + });
  67 + };
  68 +
  69 + var waitInputDn = function () {
  70 + $stateBtnTxt.text('输入分机号,点击拨号!')
  71 + .removeAttr('disabled')
  72 + .addClass('uk-button-primary')
  73 + .one('click', function () {
  74 + init(_nbbm);
  75 + });;
  76 + $('[name=dn]', wrap).focus();
75 }; 77 };
76 78
77 - var call = function (nbbm, loginSucc, loginFailed, callSucc) {  
78 - var telNumber = nbbm2tel[nbbm];  
79 - if(!telNumber){  
80 - alert('没有该车辆的对照表..');  
81 - loginFailed && loginFailed(); 79 + /**
  80 + * 开始计时器
  81 + */
  82 + var _t = 0, timer;
  83 + var startTimer = function () {
  84 + if(_t >= callMaxTime){
  85 + shutdown();
82 return; 86 return;
83 } 87 }
84 - login(function (sname) {  
85 - if(sname=='login'){  
86 - loginSucc && loginSucc(); 88 + _t ++;
  89 + $stateBtnTxt.text('正在拨号('+_t+')');
  90 + timer = setTimeout(startTimer, 1000);
  91 + };
  92 +
  93 + var shutdown = function () {
  94 + _hangup(true);
  95 + $stateBtnTxt.text('已超时,点击重拨!')
  96 + .removeAttr('disabled')
  97 + .addClass('uk-button-primary')
  98 + .one('click', function () {
  99 + init(_nbbm);
  100 + });;
  101 + };
87 102
88 - $.CallCenterPublicFun.Dialing(telNumber);  
89 - setTimeout(function () {  
90 - callSucc && callSucc();  
91 - }, 1000);  
92 - }  
93 - else{  
94 - //loginFailed && loginFailed();  
95 - }  
96 - }); 103 + var talking = function () {
  104 + console.log('talking');
  105 + clearTimeout(timer);
  106 + timer = null;
  107 + phoneStatus = 1;
  108 + setTimeout(function () {
  109 + var $stateBtnTxt = $('.state_txt>button', wrap);
  110 + $stateBtnTxt.text('已接通,点击挂断!')
  111 + .removeClass('uk-button-primary')
  112 + .addClass('uk-button-danger')
  113 + .removeAttr('disabled')
  114 + .off('click')
  115 + .one('click', function () {
  116 + _hangup();
  117 + _hold();
  118 + });
  119 + }, 1000);
97 }; 120 };
  121 +
  122 + var _hold = function () {
  123 + console.log('_hold');
  124 + phoneStatus = 0;
98 125
99 - var hangup = function () { 126 + var $stateBtnTxt = $('.state_txt>button', wrap);
  127 + $stateBtnTxt.text('点击拨号')
  128 + .removeClass('uk-button-danger')
  129 + .addClass('uk-button-primary')
  130 + .off('click')
  131 + .one('click', function () {
  132 + init(_nbbm);
  133 + });
  134 + };
  135 +
  136 + var pluginInit = function (agentID, dn, cb) {
  137 + var options = {
  138 + AgentID: agentID,
  139 + DN: dn,
  140 + /*接通事件*/
  141 + OnTalking: talking,
  142 + /*挂机事件*/
  143 + OnHold: _hold
  144 + };
  145 + $.PhonePluginFun.init(options);
  146 + cb && cb();
  147 + };
  148 +
  149 + var _hangup = function (flag) {
  150 + clearTimeout(timer);
  151 + timer = null;
  152 + if(!flag && phoneStatus==0)
  153 + return;
100 console.log('hangup...'); 154 console.log('hangup...');
101 $.CallCenterPublicFun.Hangup(); 155 $.CallCenterPublicFun.Hangup();
102 $.CallCenterPublicFun.LoginOff(); 156 $.CallCenterPublicFun.LoginOff();
103 - }; 157 + phoneStatus = 0;
  158 + }
104 159
105 return { 160 return {
106 - call: call,  
107 - hangup: hangup,  
108 - setNbbm2tel: function (json) {  
109 - nbbm2tel = json;  
110 -  
111 - window.localStorage.setItem('test_nbbm2tel_json', JSON.stringify(nbbm2tel));  
112 - },  
113 - getNbbm2tel: function () {  
114 - return nbbm2tel;  
115 - } 161 + init: init,
  162 + hangup: _hangup
116 } 163 }
117 }(); 164 }();
118 \ No newline at end of file 165 \ No newline at end of file
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
@@ -20,11 +20,6 @@ var gb_safe_driv = (function () { @@ -20,11 +20,6 @@ var gb_safe_driv = (function () {
20 var max = 5; 20 var max = 5;
21 21
22 var pop = function (sd) { 22 var pop = function (sd) {
23 - /*//只有admin用户能收到  
24 - var user = gb_northToolbar.user();  
25 - if (!user || user.userName.indexOf('admin') == -1)  
26 - return;*/  
27 -  
28 //时间格式化 23 //时间格式化
29 var stm = moment(sd.ts); 24 var stm = moment(sd.ts);
30 sd.timeStr = stm.format('HH时mm分ss秒'); 25 sd.timeStr = stm.format('HH时mm分ss秒');
@@ -43,29 +38,22 @@ var gb_safe_driv = (function () { @@ -43,29 +38,22 @@ var gb_safe_driv = (function () {
43 $wrap.append(htmlStr); 38 $wrap.append(htmlStr);
44 }; 39 };
45 40
46 -/* var vedioModal = '<div id="ssspVedioModal" class="uk-modal ct_move_modal">' +  
47 - '<div class="uk-modal-dialog uk-modal-dialog-large">' +  
48 - '<button type="button" class="uk-modal-close uk-close"></button>' +  
49 - '<div class="uk-modal-header"> <h2>实时视频</h2> </div> '+  
50 - '<p class="loading"><i class="uk-icon-spinner uk-icon-spin"></i> 载入资源...</p><iframe id="vedioIframe" src="http://222.66.0.204:8910/transport_server/dvr_monitor1.jsp?deviceId=229L0650&channel=^^channel^^"></iframe>' +  
51 - '</div>' +  
52 - '</div>';*/  
53 -  
54 - var phoneModal = '<div id="callPhoneModal" class="uk-modal ct_move_modal">' +  
55 - '<div class="uk-modal-dialog">' +  
56 - '<button type="button" class="uk-modal-close uk-close"></button>' +  
57 - '<div class="uk-modal-header"> <h2>打电话</h2> </div> '+  
58 - '<p class="loading"><i class="uk-icon-spinner uk-icon-spin"></i> 载入资源...</p><iframe style="width: 100%;height: 280px;" id="phoneIframe" src="/real_control_v2/js/safe_driv/CallCenterPluginDemo.html"></iframe>' +  
59 - '</div>' +  
60 - '</div>'; 41 +
61 42
62 $wrap.on('click', '.safe_driv_pop', function () { 43 $wrap.on('click', '.safe_driv_pop', function () {
63 - var title = $(this).data('title');// + '&nbsp;<button data-nbbm="'+$(this).data('nbbm')+'" class="uk-button uk-button-mini uk-button-primary" id="openPhoneModalBtn" type="button">打电话</button>'; 44 + var nbbm = $(this).data('nbbm');
  45 + var call_btn_html = '<button class="uk-button uk-button-mini uk-button-primary" ' +
  46 + 'id="m_voip_call_btn_001" ' +
  47 + 'type="button" ' +
  48 + 'data-nbbm="'+nbbm+'">打电话</button>';
  49 +
  50 + var title = $(this).data('title') + '&nbsp;' + call_btn_html;
64 var url = $(this).data('url'); 51 var url = $(this).data('url');
65 $(this).remove(); 52 $(this).remove();
  53 +
66 var lightbox = UIkit.lightbox.create([ 54 var lightbox = UIkit.lightbox.create([
67 {title: title, 'source': url} 55 {title: title, 'source': url}
68 - ]); 56 + ], {keyboard: false});
69 57
70 lightbox.show(); 58 lightbox.show();
71 }); 59 });
@@ -80,7 +68,7 @@ var gb_safe_driv = (function () { @@ -80,7 +68,7 @@ var gb_safe_driv = (function () {
80 'A6': 2, 68 'A6': 2,
81 'A7': 2 69 'A7': 2
82 }; 70 };
83 - var showVedioModal = function (type) { 71 +/* var showVedioModal = function (type) {
84 var channel = channelMap[type]?channelMap[type]:1; 72 var channel = channelMap[type]?channelMap[type]:1;
85 open_modal_dom(vedioModal.replace('^^channel^^', channel) ,{}, {modal: false}); 73 open_modal_dom(vedioModal.replace('^^channel^^', channel) ,{}, {modal: false});
86 $('#ssspVedioModal #vedioIframe').on('load', function () { 74 $('#ssspVedioModal #vedioIframe').on('load', function () {
@@ -90,14 +78,14 @@ var gb_safe_driv = (function () { @@ -90,14 +78,14 @@ var gb_safe_driv = (function () {
90 $('#ssspVedioModal p.loading').remove(); 78 $('#ssspVedioModal p.loading').remove();
91 }, 500); 79 }, 500);
92 }); 80 });
93 - }; 81 + };*/
94 82
95 - $(document).on('click', '#openVedioModalBtn', function () { 83 +/* $(document).on('click', '#openVedioModalBtn', function () {
96 showVedioModal($(this).data('type')); 84 showVedioModal($(this).data('type'));
97 - }); 85 + });*/
98 86
99 87
100 - var showCallPhoneModal = function () { 88 +/* var showCallPhoneModal = function () {
101 open_modal_dom(phoneModal ,{}, {modal: false}); 89 open_modal_dom(phoneModal ,{}, {modal: false});
102 $('#callPhoneModal #phoneIframe').on('load', function () { 90 $('#callPhoneModal #phoneIframe').on('load', function () {
103 var that = this; 91 var that = this;
@@ -116,38 +104,30 @@ var gb_safe_driv = (function () { @@ -116,38 +104,30 @@ var gb_safe_driv = (function () {
116 $('#callPhoneModal p.loading').remove(); 104 $('#callPhoneModal p.loading').remove();
117 }, 700); 105 }, 700);
118 }); 106 });
119 - }; 107 + };*/
  108 +
  109 + $(document).on('click', '#m_voip_call_btn_001', function () {
  110 + //debugger
  111 + var $lb = $('.uk-modal-dialog-lightbox');
  112 + var X = $lb.offset().top + $lb.height() - 240;
  113 + var Y = $lb.offset().left + $lb.width();
  114 +
  115 + var nbbm = $(this).data('nbbm');
120 116
121 - $(document).on('click', '#openPhoneModalBtn', function () {  
122 - var t = $(this).text();  
123 - if(t == '挂断!'){  
124 - gb_call_phone.hangup();  
125 - $(this).text('打电话').removeClass('uk-button-danger');  
126 - return;  
127 - }  
128 - else if(t == '打电话'){  
129 - var nbbm = $(this).data('nbbm');  
130 - var btn = this;  
131 -  
132 - $(btn).text('登录坐席..');  
133 - gb_call_phone.call(nbbm, function () {  
134 - $(btn).text('拨号中..');  
135 - }, function () {  
136 - $(btn).text('登录坐席失败');  
137 - setTimeout(function () {  
138 - $(btn).text('打电话');  
139 - }, 1200);  
140 - }, function () {  
141 - $(btn).text('挂断!').addClass('uk-button-danger');  
142 - });  
143 - } 117 + var style = 'top: '+X+'px;left: '+Y+'px;height: '+$lb.height()+'px';
  118 + var htmlStr = template('voip_call_info_panel-temp', {style: style, nbbm: nbbm});
  119 + $lb.css('width', ($lb.width() + 260) + 'px');
  120 + $('.uk-lightbox-content', $lb.parent()).append(htmlStr);
  121 +
  122 + $(this).remove();
  123 + gb_call_phone.init(nbbm);
144 }); 124 });
145 125
146 126
147 return { 127 return {
148 pop: pop, 128 pop: pop,
149 safeCode: codes, 129 safeCode: codes,
150 - urlPath: path,  
151 - showVedioModal: showVedioModal 130 + urlPath: path//,
  131 + //showVedioModal: showVedioModal
152 } 132 }
153 })(); 133 })();
154 \ No newline at end of file 134 \ No newline at end of file
src/main/resources/static/real_control_v2/main.html
@@ -237,10 +237,47 @@ @@ -237,10 +237,47 @@
237 <script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> 237 <script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script>
238 <!-- #### 安全驾驶 end ### --> 238 <!-- #### 安全驾驶 end ### -->
239 239
240 -<!-- 打电话  
241 -<script src="http://180.168.57.114:4244/Scripts/CallCenter.js" ></script> 240 +<!-- 打电话 -->
  241 +<script src="http://114.80.178.12:9003/forward/voip/callCenterJs"></script>
  242 +<script src="http://114.80.178.12:9003/forward/voip/phonePluginJs"></script>
242 <script src="/real_control_v2/js/safe_driv/call_phone.js" ></script> 243 <script src="/real_control_v2/js/safe_driv/call_phone.js" ></script>
243 ---> 244 +
  245 +<script id="voip_call_info_panel-temp" type="text/html">
  246 + <div class="voip_call_info_panel" style="{{style}}">
  247 + <p class="_title">VOIP</p>
  248 + <form class="uk-form uk-form-horizontal">
  249 +
  250 + <div class="uk-form-row">
  251 + <label class="uk-form-label" >工号:</label>
  252 + <div class="uk-form-controls">
  253 + <input type="text" name="agentID" value="1002" disabled>
  254 + </div>
  255 + </div>
  256 + <div class="uk-form-row">
  257 + <label class="uk-form-label" ">分机号:</label>
  258 + <div class="uk-form-controls">
  259 + <input type="text" name="dn" value="" >
  260 + </div>
  261 + </div>
  262 + <div class="uk-form-row">
  263 + <label class="uk-form-label" >自编号:</label>
  264 + <div class="uk-form-controls">
  265 + <input type="text" value="{{nbbm}}" disabled>
  266 + </div>
  267 + </div>
  268 + <div class="uk-form-row">
  269 + <label class="uk-form-label" >SIM号:</label>
  270 + <div class="uk-form-controls">
  271 + <input type="text" name="simNo" disabled>
  272 + </div>
  273 + </div>
  274 + <hr>
  275 + <h4 class="state_txt">
  276 + <button class="uk-button uk-button-large" type="button" disabled>获取SIM卡号...</button>
  277 + </h4>
  278 + </form>
  279 + </div>
  280 +</script>
244 </body> 281 </body>
245 282
246 </html> 283 </html>