Commit dc1f3334ca8c854f691fb6a707a056159ac556e6
1 parent
1219d3f0
update...
Showing
25 changed files
with
1116 additions
and
539 deletions
src/main/java/com/bsth/controller/directive/DirectiveController.java
| ... | ... | @@ -195,4 +195,16 @@ public class DirectiveController { |
| 195 | 195 | //DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class); |
| 196 | 196 | return directiveService.sendC0A5(json); |
| 197 | 197 | } |
| 198 | + | |
| 199 | + /** | |
| 200 | + * 设备参数查询 | |
| 201 | + * @return | |
| 202 | + */ | |
| 203 | + @RequestMapping(value = "/deviceCofigList", method = RequestMethod.GET) | |
| 204 | + public Map<String, Object> deviceCofigList( | |
| 205 | + @RequestParam Map<String, String> map, | |
| 206 | + @RequestParam(defaultValue = "0") int page, | |
| 207 | + @RequestParam(defaultValue = "10") int size){ | |
| 208 | + return directiveService.deviceCofigList(map, page, size); | |
| 209 | + } | |
| 198 | 210 | } | ... | ... |
src/main/java/com/bsth/controller/directive/UpstreamEntrance.java
| 1 | 1 | package com.bsth.controller.directive; |
| 2 | 2 | |
| 3 | +import org.apache.commons.lang3.StringUtils; | |
| 3 | 4 | import org.slf4j.Logger; |
| 4 | 5 | import org.slf4j.LoggerFactory; |
| 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -59,7 +60,8 @@ public class UpstreamEntrance { |
| 59 | 60 | case 0x26: |
| 60 | 61 | // 驾驶员上报 |
| 61 | 62 | D80 d80 = JSON.toJavaObject(jsonParam, D80.class); |
| 62 | - pilotReport.report(d80); | |
| 63 | + if(d80!=null && StringUtils.isNotEmpty(d80.getDeviceId())) | |
| 64 | + pilotReport.report(d80); | |
| 63 | 65 | break; |
| 64 | 66 | |
| 65 | 67 | case 0xA4: |
| ... | ... | @@ -67,9 +69,9 @@ public class UpstreamEntrance { |
| 67 | 69 | data.put("posPort", data.getString("posPort").trim()); |
| 68 | 70 | data.put("posIpAddress", data.getString("posIpAddress").trim()); |
| 69 | 71 | data.put("ipAddress", data.getString("ipAddress").trim()); |
| 70 | - | |
| 72 | + | |
| 71 | 73 | DC0_A4 c0a4 = JSON.toJavaObject(jsonParam, DC0_A4.class); |
| 72 | - System.out.println(c0a4); | |
| 74 | + pilotReport.report(c0a4); | |
| 73 | 75 | break; |
| 74 | 76 | } |
| 75 | 77 | ... | ... |
src/main/java/com/bsth/data/directive/DirectiveCreator.java
| 1 | 1 | package com.bsth.data.directive; |
| 2 | 2 | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | -import java.util.Date; | |
| 5 | -import java.util.HashMap; | |
| 6 | -import java.util.Map; | |
| 7 | - | |
| 8 | -import org.slf4j.Logger; | |
| 9 | -import org.slf4j.LoggerFactory; | |
| 10 | - | |
| 11 | 3 | import com.alibaba.fastjson.JSON; |
| 12 | 4 | import com.bsth.data.BasicData; |
| 13 | 5 | import com.bsth.entity.directive.D60; |
| 14 | 6 | import com.bsth.entity.directive.D60.D60Data; |
| 15 | 7 | import com.bsth.entity.directive.D64; |
| 16 | 8 | import com.bsth.entity.directive.D64.D64Data; |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 11 | + | |
| 12 | +import java.text.SimpleDateFormat; | |
| 13 | +import java.util.Date; | |
| 14 | +import java.util.HashMap; | |
| 15 | +import java.util.Map; | |
| 17 | 16 | |
| 18 | 17 | /** |
| 19 | 18 | * |
| ... | ... | @@ -81,7 +80,7 @@ public class DirectiveCreator { |
| 81 | 80 | } |
| 82 | 81 | |
| 83 | 82 | |
| 84 | - public D60 createD60_02(String nbbm, String text, int upDown, int state, Date alarmTime){ | |
| 83 | + public D60 createD60_01(String nbbm, String text, int upDown, int state, Date alarmTime){ | |
| 85 | 84 | SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm"); |
| 86 | 85 | |
| 87 | 86 | Long timestamp = System.currentTimeMillis(); |
| ... | ... | @@ -102,7 +101,7 @@ public class DirectiveCreator { |
| 102 | 101 | directive.setMsgId(msgId); |
| 103 | 102 | // 构造数据 |
| 104 | 103 | data.setDeviceId(deviceId); |
| 105 | - data.setDispatchInstruct((short) 0x02); | |
| 104 | + data.setDispatchInstruct((short) 0x01); | |
| 106 | 105 | data.setTimestamp(timestamp); |
| 107 | 106 | data.setCompanyCode(company); |
| 108 | 107 | data.setMsgId(msgId); | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| ... | ... | @@ -307,4 +307,28 @@ public class GpsEntity { |
| 307 | 307 | public void setSource(int source) { |
| 308 | 308 | this.source = source; |
| 309 | 309 | } |
| 310 | + | |
| 311 | + public void offline(){ | |
| 312 | + this.setAbnormalStatus("offline"); | |
| 313 | + } | |
| 314 | + | |
| 315 | + public boolean isOnline(){ | |
| 316 | + if(isOffline()) | |
| 317 | + return false; | |
| 318 | + | |
| 319 | + long t = System.currentTimeMillis(); | |
| 320 | + | |
| 321 | + if((t - this.getTimestamp()) > 1000 * 60){ | |
| 322 | + return false; | |
| 323 | + } | |
| 324 | + | |
| 325 | + if((this.getTimestamp() - t) > 1000 * 60 * 3){ | |
| 326 | + return false; | |
| 327 | + } | |
| 328 | + return true; | |
| 329 | + } | |
| 330 | + | |
| 331 | + public boolean isOffline(){ | |
| 332 | + return this.getAbnormalStatus() != null && this.getAbnormalStatus().equals("offline"); | |
| 333 | + } | |
| 310 | 334 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/OfflineMonitorThread.java
src/main/java/com/bsth/data/pilot80/PilotReport.java
| ... | ... | @@ -8,13 +8,16 @@ import com.bsth.data.msg_queue.DirectivePushQueue; |
| 8 | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | 9 | import com.bsth.entity.Line; |
| 10 | 10 | import com.bsth.entity.directive.D80; |
| 11 | +import com.bsth.entity.directive.DC0_A4; | |
| 11 | 12 | import com.bsth.entity.realcontrol.D80ReplyTemp; |
| 12 | 13 | import com.bsth.entity.realcontrol.LineConfig; |
| 13 | 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 14 | 15 | import com.bsth.repository.directive.D80Repository; |
| 16 | +import com.bsth.repository.directive.DC0A4Repository; | |
| 15 | 17 | import com.bsth.service.directive.DirectiveService; |
| 16 | 18 | import com.bsth.websocket.handler.SendUtils; |
| 17 | 19 | import com.google.common.collect.ArrayListMultimap; |
| 20 | +import org.apache.commons.lang3.StringUtils; | |
| 18 | 21 | import org.slf4j.Logger; |
| 19 | 22 | import org.slf4j.LoggerFactory; |
| 20 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -27,7 +30,7 @@ import java.util.List; |
| 27 | 30 | /** |
| 28 | 31 | * |
| 29 | 32 | * @ClassName: PilotReport |
| 30 | - * @Description: TODO(驾驶员上报) | |
| 33 | + * @Description: TODO(设备80协议上报处理) | |
| 31 | 34 | * @author PanZhao |
| 32 | 35 | * @date 2016年8月14日 下午11:37:51 |
| 33 | 36 | * |
| ... | ... | @@ -37,31 +40,26 @@ public class PilotReport { |
| 37 | 40 | |
| 38 | 41 | @Autowired |
| 39 | 42 | D80Repository d80Repository; |
| 40 | - | |
| 41 | 43 | @Autowired |
| 42 | 44 | DayOfSchedule dayOfSchedule; |
| 43 | - | |
| 44 | 45 | @Autowired |
| 45 | 46 | LineConfigData lineConfigData; |
| 46 | - | |
| 47 | 47 | @Autowired |
| 48 | 48 | DirectiveService directiveService; |
| 49 | - | |
| 50 | 49 | @Autowired |
| 51 | 50 | GpsRealData gpsRealData; |
| 52 | - | |
| 53 | 51 | @Autowired |
| 54 | 52 | SendUtils sendUtils; |
| 55 | - | |
| 56 | - //private static ScheduleComparator.FCNO schComp; | |
| 57 | - | |
| 53 | + | |
| 54 | + @Autowired | |
| 55 | + DC0A4Repository dc0A4Repository; | |
| 56 | + | |
| 58 | 57 | private static ArrayListMultimap<String, D80> d80MultiMap; |
| 59 | 58 | |
| 60 | 59 | Logger logger = LoggerFactory.getLogger(PilotReport.class); |
| 61 | 60 | |
| 62 | 61 | static{ |
| 63 | 62 | d80MultiMap = ArrayListMultimap.create(); |
| 64 | - //schComp = new ScheduleComparator.FCNO(); | |
| 65 | 63 | } |
| 66 | 64 | |
| 67 | 65 | public void report(D80 d80){ |
| ... | ... | @@ -95,22 +93,31 @@ public class PilotReport { |
| 95 | 93 | |
| 96 | 94 | case 0xA5: |
| 97 | 95 | //进场请求 |
| 98 | - ScheduleRealInfo inSch = dayOfSchedule.nextByBcType(nbbm, "in"); | |
| 96 | + //ScheduleRealInfo inSch = dayOfSchedule.nextByBcType(nbbm, "in"); | |
| 99 | 97 | //如果有对应出场班次 |
| 100 | - if(inSch != null){ | |
| 101 | - d80.setRemarks("计划进场时间:" + inSch.getDfsj()); | |
| 98 | + //if(inSch != null){ | |
| 99 | + /*d80.setRemarks("计划进场时间:" + inSch.getDfsj()); | |
| 102 | 100 | //当前GPS位置 |
| 103 | 101 | GpsEntity gps = gpsRealData.get(d80.getDeviceId()); |
| 104 | 102 | if(null != gps) |
| 105 | - d80.addRemarks("<br> 位置:" + coordHtmlStr(gps)); | |
| 106 | - }else | |
| 107 | - d80.setRemarks("没有进场计划"); | |
| 103 | + d80.addRemarks("<br> 位置:" + coordHtmlStr(gps));*/ | |
| 104 | + //}/*else | |
| 105 | + // d80.setRemarks("没有进场计划");*/ | |
| 108 | 106 | break; |
| 109 | 107 | } |
| 110 | 108 | |
| 111 | 109 | //推送到页面 |
| 112 | 110 | sendUtils.send80ToPage(d80); |
| 113 | 111 | } |
| 112 | + | |
| 113 | + public void report(DC0_A4 c0a4){ | |
| 114 | + String deviceId = c0a4.getData().getDeviceId(); | |
| 115 | + if(StringUtils.isNotEmpty(deviceId)) | |
| 116 | + c0a4.setId(deviceId); | |
| 117 | + | |
| 118 | + //入库 | |
| 119 | + dc0A4Repository.save(c0a4); | |
| 120 | + } | |
| 114 | 121 | |
| 115 | 122 | /** |
| 116 | 123 | * | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.bsth.common.Constants; |
| 6 | 6 | import com.bsth.common.ResponseCode; |
| 7 | +import com.bsth.data.BasicData; | |
| 7 | 8 | import com.bsth.data.LineConfigData; |
| 9 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 8 | 10 | import com.bsth.data.gpsdata.GpsRealData; |
| 9 | 11 | import com.bsth.data.gpsdata.recovery.GpsDataRecovery; |
| 12 | +import com.bsth.data.msg_queue.DirectivePushQueue; | |
| 10 | 13 | import com.bsth.entity.realcontrol.LineConfig; |
| 11 | 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 12 | 15 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| ... | ... | @@ -937,7 +940,22 @@ public class DayOfSchedule { |
| 937 | 940 | public void reCalcExecPlan(String nbbm){ |
| 938 | 941 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm); |
| 939 | 942 | Collections.sort(list, schFCSJComparator); |
| 940 | - carExecutePlanMap.put(nbbm, schAttrCalculator.calcCurrentExecSch(list)); | |
| 943 | + | |
| 944 | + ScheduleRealInfo sch = schAttrCalculator.calcCurrentExecSch(list); | |
| 945 | + carExecutePlanMap.put(nbbm, sch); | |
| 946 | + | |
| 947 | + try { | |
| 948 | + GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); | |
| 949 | + if(gps != null && gps.isOnline()){ | |
| 950 | + if(!gps.getLineId().equals(sch.getXlBm())){ | |
| 951 | + //下发线路切换指令 | |
| 952 | + DirectivePushQueue.put64(nbbm, sch.getXlBm(), "系统"); | |
| 953 | + logger.info("车辆" + nbbm + "切换至" + sch.getXlBm() + " -原" + gps.getLineId() + " --重新计算当前执行班次!"); | |
| 954 | + } | |
| 955 | + } | |
| 956 | + }catch (Exception e){ | |
| 957 | + logger.error("", e); | |
| 958 | + } | |
| 941 | 959 | } |
| 942 | 960 | |
| 943 | 961 | /** | ... | ... |
src/main/java/com/bsth/entity/directive/DC0_A4.java
| ... | ... | @@ -13,13 +13,21 @@ import javax.persistence.*; |
| 13 | 13 | @Entity |
| 14 | 14 | @Table(name = "bsth_v_C0_A4") |
| 15 | 15 | public class DC0_A4 extends Directive{ |
| 16 | - | |
| 16 | + | |
| 17 | + | |
| 17 | 18 | @Id |
| 18 | - @GeneratedValue | |
| 19 | - private Integer id; | |
| 19 | + private String id; | |
| 20 | 20 | |
| 21 | 21 | private DC0A4Data data; |
| 22 | - | |
| 22 | + | |
| 23 | + public String getId() { | |
| 24 | + return id; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setId(String id) { | |
| 28 | + this.id = id; | |
| 29 | + } | |
| 30 | + | |
| 23 | 31 | @Embeddable |
| 24 | 32 | public static class DC0A4Data { |
| 25 | 33 | /** |
| ... | ... | @@ -164,14 +172,6 @@ public class DC0_A4 extends Directive{ |
| 164 | 172 | } |
| 165 | 173 | } |
| 166 | 174 | |
| 167 | - public Integer getId() { | |
| 168 | - return id; | |
| 169 | - } | |
| 170 | - | |
| 171 | - public void setId(Integer id) { | |
| 172 | - this.id = id; | |
| 173 | - } | |
| 174 | - | |
| 175 | 175 | public DC0A4Data getData() { |
| 176 | 176 | return data; |
| 177 | 177 | } | ... | ... |
src/main/java/com/bsth/repository/directive/DC0A4Repository.java
0 → 100644
| 1 | +package com.bsth.repository.directive; | |
| 2 | + | |
| 3 | +import com.bsth.entity.directive.DC0_A4; | |
| 4 | +import com.bsth.repository.BaseRepository; | |
| 5 | +import org.springframework.stereotype.Repository; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * C0_A4 设备回复(设备参数) | |
| 9 | + * Created by panzhao on 2017/6/28. | |
| 10 | + */ | |
| 11 | +@Repository | |
| 12 | +public interface DC0A4Repository extends BaseRepository<DC0_A4, String>{ | |
| 13 | +} | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveService.java
| ... | ... | @@ -95,4 +95,6 @@ public interface DirectiveService extends BaseService<D60, Integer>{ |
| 95 | 95 | int refreshLineFile(String deviceId); |
| 96 | 96 | |
| 97 | 97 | int stateChange(String nbbm, Integer upDown, Integer state, String userName); |
| 98 | + | |
| 99 | + Map<String,Object> deviceCofigList(Map<String, String> map, int page, int size); | |
| 98 | 100 | } | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -18,6 +18,7 @@ import com.bsth.repository.directive.D60Repository; |
| 18 | 18 | import com.bsth.repository.directive.D64Repository; |
| 19 | 19 | import com.bsth.repository.directive.D80Repository; |
| 20 | 20 | import com.bsth.security.util.SecurityUtils; |
| 21 | +import com.bsth.service.directive.dto.DeviceConfigDto; | |
| 21 | 22 | import com.bsth.service.impl.BaseServiceImpl; |
| 22 | 23 | import com.bsth.websocket.handler.RealControlSocketHandler; |
| 23 | 24 | import com.fasterxml.jackson.core.JsonProcessingException; |
| ... | ... | @@ -29,6 +30,8 @@ import org.joda.time.format.DateTimeFormatter; |
| 29 | 30 | import org.slf4j.Logger; |
| 30 | 31 | import org.slf4j.LoggerFactory; |
| 31 | 32 | import org.springframework.beans.factory.annotation.Autowired; |
| 33 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | |
| 34 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 32 | 35 | import org.springframework.stereotype.Service; |
| 33 | 36 | |
| 34 | 37 | import java.util.*; |
| ... | ... | @@ -36,486 +39,512 @@ import java.util.*; |
| 36 | 39 | @Service |
| 37 | 40 | public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implements DirectiveService { |
| 38 | 41 | |
| 39 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 40 | - | |
| 41 | - @Autowired | |
| 42 | - D60Repository d60Repository; | |
| 43 | - | |
| 44 | - @Autowired | |
| 45 | - GpsRealData gpsRealDataBuffer; | |
| 46 | - | |
| 47 | - @Autowired | |
| 48 | - D64Repository d64Repository; | |
| 49 | - | |
| 50 | - @Autowired | |
| 51 | - RealControlSocketHandler socketHandler; | |
| 52 | - | |
| 53 | - @Autowired | |
| 54 | - D80Repository d80Repository; | |
| 55 | - | |
| 56 | - @Autowired | |
| 57 | - DayOfDirectives dayOfDirectives; | |
| 58 | - | |
| 59 | - @Autowired | |
| 60 | - PilotReport pilotReport; | |
| 61 | - | |
| 62 | - @Autowired | |
| 63 | - DayOfSchedule dayOfSchedule; | |
| 64 | - | |
| 65 | - //static Long schDiff = 1000 * 60 * 60L; | |
| 66 | - | |
| 67 | - private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm") | |
| 68 | - ,fmtHHmm_CN = DateTimeFormat.forPattern("HH点mm分"); | |
| 69 | - | |
| 70 | - @Override | |
| 71 | - public int send60Phrase(String nbbm, String text, String sender) { | |
| 72 | - D60 d60 = null; | |
| 73 | - try { | |
| 74 | - d60 = create60Data(nbbm, text, (short) 0x00, null); | |
| 75 | - } catch (Exception e) { | |
| 76 | - logger.error("发送消息短语出现异常", e); | |
| 77 | - return -1; | |
| 78 | - } | |
| 79 | - | |
| 80 | - if (null == d60) | |
| 81 | - return -1; | |
| 82 | - | |
| 83 | - // 发送指令 | |
| 84 | - int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60)); | |
| 85 | - if(null != sender) | |
| 86 | - d60.setSender(sender); | |
| 87 | - d60.setHttpCode(code); | |
| 88 | - | |
| 89 | - if (code == 0) { | |
| 90 | - // 添加到缓存 | |
| 91 | - dayOfDirectives.put60(d60, true); | |
| 92 | - } | |
| 93 | - else{ | |
| 94 | - d60.setErrorText("网关通讯失败, code: " + code); | |
| 95 | - d60Repository.save(d60); | |
| 96 | - dayOfDirectives.put60(d60, false); | |
| 97 | - } | |
| 98 | - return code; | |
| 99 | - } | |
| 100 | - | |
| 101 | - @Override | |
| 102 | - public int send60Dispatch(ScheduleRealInfo sch, int finish, String sender) { | |
| 103 | - D60 d60 = null; | |
| 104 | - try { | |
| 105 | - if(sch.isDestroy()){ | |
| 106 | - logger.warn("烂班不允许发送调度指令...."); | |
| 107 | - return -1; | |
| 108 | - } | |
| 109 | - String text = "已完成" + finish + "个班次,下一发车时间" + fmtHHmm_CN.print(sch.getDfsjT()) + ",由" | |
| 110 | - + sch.getQdzName() + "发往" + sch.getZdzName(); | |
| 111 | - | |
| 112 | - //下发0x02指令 调度指令(闹钟有效) | |
| 113 | - Long alarmTime = System.currentTimeMillis() + 1000 * 30; | |
| 114 | - d60 = new DirectiveCreator().createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir()) | |
| 115 | - , 0, new Date(alarmTime)); | |
| 116 | - } catch (Exception e) { | |
| 117 | - logger.error("生成调度指令时出现异常", e); | |
| 118 | - return -1; | |
| 119 | - } | |
| 120 | - | |
| 121 | - if (null == d60) | |
| 122 | - return -1; | |
| 123 | - | |
| 124 | - d60.setSender(sender); | |
| 125 | - | |
| 126 | - JSONObject jObj = JSON.parseObject(JSON.toJSONString(d60)); | |
| 127 | - | |
| 128 | - //进场或者出场班次时,附加lock 标识 | |
| 129 | - if(null != sch.getBcType() | |
| 130 | - && (sch.getBcType().equals("out") || sch.getBcType().equals("in"))){ | |
| 131 | - | |
| 132 | - jObj.put("lock", 1); | |
| 133 | - } | |
| 134 | - | |
| 135 | - // 发送指令 | |
| 136 | - int code = GatewayHttpUtils.postJson(jObj.toJSONString()); | |
| 137 | - | |
| 138 | - d60.setDispatch(true); | |
| 139 | - d60.setSch(sch); | |
| 140 | - d60.setHttpCode(code); | |
| 141 | - | |
| 142 | - if (code == 0) { | |
| 143 | - sch.setDirectiveState(60); | |
| 144 | - // 添加到缓存,延迟入库 | |
| 145 | - dayOfDirectives.put60(d60, true); | |
| 146 | - // 通知页面 | |
| 147 | - sendD60ToPage(sch); | |
| 148 | - } | |
| 149 | - else{ | |
| 150 | - d60.setErrorText("网关通讯失败, code: " + code); | |
| 151 | - dayOfDirectives.put60(d60, false); | |
| 152 | - d60Repository.save(d60); | |
| 153 | - } | |
| 154 | - return code; | |
| 155 | - } | |
| 156 | - | |
| 157 | - /** | |
| 158 | - * | |
| 159 | - * @Title: sendDirectiveState @Description: TODO(向页面推送班次指令状态) @throws | |
| 160 | - */ | |
| 161 | - @Override | |
| 162 | - public void sendD60ToPage(ScheduleRealInfo sch) { | |
| 163 | - Map<String, Object> map = new HashMap<>(); | |
| 164 | - map.put("fn", "directive"); | |
| 165 | - map.put("t", sch); | |
| 166 | - | |
| 167 | - ObjectMapper mapper = new ObjectMapper(); | |
| 168 | - | |
| 169 | - try { | |
| 170 | - socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map)); | |
| 171 | - } catch (JsonProcessingException e) { | |
| 172 | - logger.error("", e); | |
| 173 | - } | |
| 174 | - } | |
| 175 | - | |
| 176 | - @Override | |
| 177 | - public int send60Dispatch(Long id, String sender) { | |
| 178 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 179 | - // 车辆已完成班次 | |
| 180 | - int finish = dayOfSchedule.doneSum(sch.getClZbh()); | |
| 181 | - return send60Dispatch(sch, finish, sender); | |
| 182 | - } | |
| 183 | - | |
| 184 | - @Override | |
| 185 | - public int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender) { | |
| 186 | - logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); | |
| 187 | - | |
| 188 | - String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); | |
| 189 | - D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state); | |
| 190 | - | |
| 191 | - if (null == d60) | |
| 192 | - return -1; | |
| 193 | - if(null != sender) | |
| 194 | - d60.setSender(sender); | |
| 195 | - else | |
| 196 | - d60.setSender("系统"); | |
| 197 | - // 发送指令 | |
| 198 | - int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60)); | |
| 199 | - // 添加到缓存,等待入库 | |
| 200 | - d60.setHttpCode(code); | |
| 201 | - if (null != sch) | |
| 202 | - d60.setSch(sch); | |
| 203 | - | |
| 204 | - | |
| 205 | - if (code == 0) { | |
| 206 | - dayOfDirectives.put60(d60, true); | |
| 207 | - } | |
| 208 | - else{ | |
| 209 | - d60.setErrorText("网关通讯失败, code: " + code); | |
| 210 | - d60Repository.save(d60); | |
| 211 | - dayOfDirectives.put60(d60, false); | |
| 212 | - } | |
| 213 | - return code; | |
| 214 | - } | |
| 215 | - | |
| 216 | - /** | |
| 217 | - * 线路切换 | |
| 218 | - */ | |
| 219 | - @Override | |
| 220 | - public int lineChange(String nbbm, String lineCode, String sender) { | |
| 221 | - return lineChangeByDeviceId(BasicData.deviceId2NbbmMap.inverse().get(nbbm), lineCode, sender); | |
| 222 | - } | |
| 223 | - | |
| 224 | - | |
| 225 | - @Override | |
| 226 | - public int lineChangeByDeviceId(String deviceId, String lineCode, String sender){ | |
| 227 | - DirectiveCreator crt = new DirectiveCreator(); | |
| 228 | - Long t = System.currentTimeMillis(); | |
| 229 | - //生成64数据包 | |
| 230 | - D64 d64 = crt.create64(deviceId, lineCode, t); | |
| 231 | - | |
| 232 | - if(null != sender) | |
| 233 | - d64.setSender(sender); | |
| 234 | - else | |
| 235 | - d64.setSender("系统"); | |
| 236 | - | |
| 237 | - //String deviceId = d64.getDeviceId(); | |
| 238 | - int code = GatewayHttpUtils.postJson(JSON.toJSONString(d64)); | |
| 239 | - // 入库 | |
| 240 | - d64.setHttpCode(code); | |
| 241 | - d64.getData().setTxtContent("切换线路[" + lineCode + "]"); | |
| 242 | - dayOfDirectives.put64(d64); | |
| 243 | - | |
| 244 | - // 通知设备刷新线路文件,忽略结果 | |
| 245 | - if (code == 0) | |
| 246 | - GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode)); | |
| 247 | - else | |
| 248 | - d64.setErrorText(" 网关通讯失败, code: " + code); | |
| 249 | - | |
| 250 | - d64Repository.save(d64); | |
| 251 | - return code; | |
| 252 | - } | |
| 253 | - | |
| 254 | - public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) { | |
| 255 | - | |
| 256 | - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 257 | - if (null == deviceId) { | |
| 258 | - logger.error("没有设备号对照的车辆:" + nbbm); | |
| 259 | - return null; | |
| 260 | - } | |
| 261 | - // 根据当前GPS确定 上下行和营运状态 | |
| 262 | - Byte upDown = null; | |
| 263 | - Integer state = null; | |
| 264 | - if (null == sch) { | |
| 265 | - GpsEntity gpsData = gpsRealDataBuffer.get(deviceId); | |
| 266 | - if (null == gpsData) { | |
| 267 | - /* | |
| 42 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 43 | + | |
| 44 | + @Autowired | |
| 45 | + D60Repository d60Repository; | |
| 46 | + | |
| 47 | + @Autowired | |
| 48 | + GpsRealData gpsRealDataBuffer; | |
| 49 | + | |
| 50 | + @Autowired | |
| 51 | + D64Repository d64Repository; | |
| 52 | + | |
| 53 | + @Autowired | |
| 54 | + RealControlSocketHandler socketHandler; | |
| 55 | + | |
| 56 | + @Autowired | |
| 57 | + D80Repository d80Repository; | |
| 58 | + | |
| 59 | + @Autowired | |
| 60 | + DayOfDirectives dayOfDirectives; | |
| 61 | + | |
| 62 | + @Autowired | |
| 63 | + PilotReport pilotReport; | |
| 64 | + | |
| 65 | + @Autowired | |
| 66 | + DayOfSchedule dayOfSchedule; | |
| 67 | + | |
| 68 | + @Autowired | |
| 69 | + JdbcTemplate jdbcTemplate; | |
| 70 | + | |
| 71 | + //static Long schDiff = 1000 * 60 * 60L; | |
| 72 | + | |
| 73 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"), fmtHHmm_CN = DateTimeFormat.forPattern("HH点mm分"); | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public int send60Phrase(String nbbm, String text, String sender) { | |
| 77 | + D60 d60 = null; | |
| 78 | + try { | |
| 79 | + d60 = create60Data(nbbm, text, (short) 0x00, null); | |
| 80 | + } catch (Exception e) { | |
| 81 | + logger.error("发送消息短语出现异常", e); | |
| 82 | + return -1; | |
| 83 | + } | |
| 84 | + | |
| 85 | + if (null == d60) | |
| 86 | + return -1; | |
| 87 | + | |
| 88 | + // 发送指令 | |
| 89 | + int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60)); | |
| 90 | + if (null != sender) | |
| 91 | + d60.setSender(sender); | |
| 92 | + d60.setHttpCode(code); | |
| 93 | + | |
| 94 | + if (code == 0) { | |
| 95 | + // 添加到缓存 | |
| 96 | + dayOfDirectives.put60(d60, true); | |
| 97 | + } else { | |
| 98 | + d60.setErrorText("网关通讯失败, code: " + code); | |
| 99 | + d60Repository.save(d60); | |
| 100 | + dayOfDirectives.put60(d60, false); | |
| 101 | + } | |
| 102 | + return code; | |
| 103 | + } | |
| 104 | + | |
| 105 | + @Override | |
| 106 | + public int send60Dispatch(ScheduleRealInfo sch, int finish, String sender) { | |
| 107 | + D60 d60 = null; | |
| 108 | + try { | |
| 109 | + if (sch.isDestroy()) { | |
| 110 | + logger.warn("烂班不允许发送调度指令...."); | |
| 111 | + return -1; | |
| 112 | + } | |
| 113 | + String text = "已完成" + finish + "个班次,下一发车时间" + fmtHHmm_CN.print(sch.getDfsjT()) + ",由" | |
| 114 | + + sch.getQdzName() + "发往" + sch.getZdzName(); | |
| 115 | + | |
| 116 | + //下发0x01指令 调度指令(闹钟有效) | |
| 117 | + long t = System.currentTimeMillis(), alarmTime; | |
| 118 | + alarmTime = sch.getDfsjT(); | |
| 119 | + if (sch.getDfsjT() < t) | |
| 120 | + alarmTime = t + 1000 * 30; | |
| 121 | + | |
| 122 | + d60 = new DirectiveCreator().createD60_01(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir()) | |
| 123 | + , 0, new Date(alarmTime)); | |
| 124 | + } catch (Exception e) { | |
| 125 | + logger.error("生成调度指令时出现异常", e); | |
| 126 | + return -1; | |
| 127 | + } | |
| 128 | + | |
| 129 | + if (null == d60) | |
| 130 | + return -1; | |
| 131 | + | |
| 132 | + d60.setSender(sender); | |
| 133 | + | |
| 134 | + JSONObject jObj = JSON.parseObject(JSON.toJSONString(d60)); | |
| 135 | + | |
| 136 | + //进场或者出场班次时,附加lock 标识 | |
| 137 | + if (null != sch.getBcType() | |
| 138 | + && (sch.getBcType().equals("out") || sch.getBcType().equals("in"))) { | |
| 139 | + | |
| 140 | + jObj.put("lock", 1); | |
| 141 | + } | |
| 142 | + | |
| 143 | + // 发送指令 | |
| 144 | + int code = GatewayHttpUtils.postJson(jObj.toJSONString()); | |
| 145 | + | |
| 146 | + d60.setDispatch(true); | |
| 147 | + d60.setSch(sch); | |
| 148 | + d60.setHttpCode(code); | |
| 149 | + | |
| 150 | + if (code == 0) { | |
| 151 | + sch.setDirectiveState(60); | |
| 152 | + // 添加到缓存,延迟入库 | |
| 153 | + dayOfDirectives.put60(d60, true); | |
| 154 | + // 通知页面 | |
| 155 | + sendD60ToPage(sch); | |
| 156 | + } else { | |
| 157 | + d60.setErrorText("网关通讯失败, code: " + code); | |
| 158 | + dayOfDirectives.put60(d60, false); | |
| 159 | + d60Repository.save(d60); | |
| 160 | + } | |
| 161 | + return code; | |
| 162 | + } | |
| 163 | + | |
| 164 | + /** | |
| 165 | + * @Title: sendDirectiveState @Description: TODO(向页面推送班次指令状态) @throws | |
| 166 | + */ | |
| 167 | + @Override | |
| 168 | + public void sendD60ToPage(ScheduleRealInfo sch) { | |
| 169 | + Map<String, Object> map = new HashMap<>(); | |
| 170 | + map.put("fn", "directive"); | |
| 171 | + map.put("t", sch); | |
| 172 | + | |
| 173 | + ObjectMapper mapper = new ObjectMapper(); | |
| 174 | + | |
| 175 | + try { | |
| 176 | + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map)); | |
| 177 | + } catch (JsonProcessingException e) { | |
| 178 | + logger.error("", e); | |
| 179 | + } | |
| 180 | + } | |
| 181 | + | |
| 182 | + @Override | |
| 183 | + public int send60Dispatch(Long id, String sender) { | |
| 184 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 185 | + // 车辆已完成班次 | |
| 186 | + int finish = dayOfSchedule.doneSum(sch.getClZbh()); | |
| 187 | + return send60Dispatch(sch, finish, sender); | |
| 188 | + } | |
| 189 | + | |
| 190 | + @Override | |
| 191 | + public int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender) { | |
| 192 | + logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); | |
| 193 | + | |
| 194 | + String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); | |
| 195 | + D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state); | |
| 196 | + | |
| 197 | + if (null == d60) | |
| 198 | + return -1; | |
| 199 | + if (null != sender) | |
| 200 | + d60.setSender(sender); | |
| 201 | + else | |
| 202 | + d60.setSender("系统"); | |
| 203 | + // 发送指令 | |
| 204 | + int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60)); | |
| 205 | + // 添加到缓存,等待入库 | |
| 206 | + d60.setHttpCode(code); | |
| 207 | + if (null != sch) | |
| 208 | + d60.setSch(sch); | |
| 209 | + | |
| 210 | + | |
| 211 | + if (code == 0) { | |
| 212 | + dayOfDirectives.put60(d60, true); | |
| 213 | + } else { | |
| 214 | + d60.setErrorText("网关通讯失败, code: " + code); | |
| 215 | + d60Repository.save(d60); | |
| 216 | + dayOfDirectives.put60(d60, false); | |
| 217 | + } | |
| 218 | + return code; | |
| 219 | + } | |
| 220 | + | |
| 221 | + /** | |
| 222 | + * 线路切换 | |
| 223 | + */ | |
| 224 | + @Override | |
| 225 | + public int lineChange(String nbbm, String lineCode, String sender) { | |
| 226 | + return lineChangeByDeviceId(BasicData.deviceId2NbbmMap.inverse().get(nbbm), lineCode, sender); | |
| 227 | + } | |
| 228 | + | |
| 229 | + | |
| 230 | + @Override | |
| 231 | + public int lineChangeByDeviceId(String deviceId, String lineCode, String sender) { | |
| 232 | + DirectiveCreator crt = new DirectiveCreator(); | |
| 233 | + Long t = System.currentTimeMillis(); | |
| 234 | + //生成64数据包 | |
| 235 | + D64 d64 = crt.create64(deviceId, lineCode, t); | |
| 236 | + | |
| 237 | + if (null != sender) | |
| 238 | + d64.setSender(sender); | |
| 239 | + else | |
| 240 | + d64.setSender("系统"); | |
| 241 | + | |
| 242 | + //String deviceId = d64.getDeviceId(); | |
| 243 | + int code = GatewayHttpUtils.postJson(JSON.toJSONString(d64)); | |
| 244 | + // 入库 | |
| 245 | + d64.setHttpCode(code); | |
| 246 | + d64.getData().setTxtContent("切换线路[" + lineCode + "]"); | |
| 247 | + dayOfDirectives.put64(d64); | |
| 248 | + | |
| 249 | + // 通知设备刷新线路文件,忽略结果 | |
| 250 | + if (code == 0) | |
| 251 | + GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode)); | |
| 252 | + else | |
| 253 | + d64.setErrorText(" 网关通讯失败, code: " + code); | |
| 254 | + | |
| 255 | + d64Repository.save(d64); | |
| 256 | + return code; | |
| 257 | + } | |
| 258 | + | |
| 259 | + public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) { | |
| 260 | + | |
| 261 | + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 262 | + if (null == deviceId) { | |
| 263 | + logger.error("没有设备号对照的车辆:" + nbbm); | |
| 264 | + return null; | |
| 265 | + } | |
| 266 | + // 根据当前GPS确定 上下行和营运状态 | |
| 267 | + Byte upDown = null; | |
| 268 | + Integer state = null; | |
| 269 | + if (null == sch) { | |
| 270 | + GpsEntity gpsData = gpsRealDataBuffer.get(deviceId); | |
| 271 | + if (null == gpsData) { | |
| 272 | + /* | |
| 268 | 273 | * 短语指令不会变更设备状态,所以在没有gps状态对照的情况下可以下发 |
| 269 | 274 | * 其他指令在不确定状态的情况下,一律不允许 |
| 270 | 275 | */ |
| 271 | - if(dispatchInstruct == 0){ | |
| 272 | - upDown = 0; | |
| 273 | - state = 0; | |
| 274 | - } | |
| 275 | - else{ | |
| 276 | - logger.error("没有找到gps对照,无法确认营运状态和上下行:" + nbbm); | |
| 277 | - return null; | |
| 278 | - } | |
| 279 | - } | |
| 280 | - else{ | |
| 281 | - upDown = gpsData.getUpDown(); | |
| 282 | - state = gpsData.getState(); | |
| 283 | - } | |
| 284 | - } else { | |
| 285 | - upDown = Byte.parseByte(sch.getXlDir()); | |
| 286 | - state = 0; | |
| 287 | - } | |
| 288 | - | |
| 289 | - return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state); | |
| 290 | - } | |
| 291 | - | |
| 292 | - @Override | |
| 293 | - public int upDownChange(String nbbm, Integer upDown, String sender) { | |
| 294 | - return send60Operation(nbbm, 0, upDown, null, sender); | |
| 295 | - } | |
| 296 | - | |
| 297 | - | |
| 298 | - @Override | |
| 299 | - public Map<String, List<D80>> findNoCofm80(String lineCodes) { | |
| 300 | - List<String> lineList = Splitter.on(",").trimResults().splitToList(lineCodes); | |
| 301 | - | |
| 302 | - Map<String, List<D80>> rs = new HashMap<>(); | |
| 303 | - for (String code : lineList) | |
| 304 | - rs.put(code, pilotReport.unconfirmed80(Integer.parseInt(code))); | |
| 305 | - | |
| 306 | - return rs; | |
| 307 | - } | |
| 308 | - | |
| 309 | - @Override | |
| 310 | - public Map<String, Object> reply80(int id, int reply) { | |
| 311 | - Map<String, Object> rs = new HashMap<>(); | |
| 312 | - | |
| 313 | - D80 d80 = pilotReport.findById(id); | |
| 314 | - if (null == d80) { | |
| 315 | - rs.put("status", ResponseCode.ERROR); | |
| 316 | - rs.put("msg", "服务器没有找到对应数据!"); | |
| 317 | - } else if (d80.isConfirm()) { | |
| 318 | - rs.put("status", ResponseCode.ERROR); | |
| 319 | - rs.put("msg", "该数据已经被处理了!"); | |
| 320 | - } else { | |
| 321 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 322 | - d80.setC0(reply, user.getUserName()); | |
| 323 | - // 入库 | |
| 324 | - d80Repository.save(d80); | |
| 325 | - //回复网关 | |
| 326 | - int code = GatewayHttpUtils.postJson(JSON.toJSONString(d80.getC0())); | |
| 327 | - | |
| 328 | - rs.put("status", ResponseCode.SUCCESS); | |
| 329 | - if (code != 0) | |
| 330 | - rs.put("msg", "发送C0响应指令到车载设备失败,但该操作已经被系统记录!"); | |
| 331 | - | |
| 332 | - pilotReport.reply(d80); | |
| 333 | - // 通知页面 | |
| 334 | - Map<String, Object> sockMap = new HashMap<>(); | |
| 335 | - sockMap.put("fn", "d80Confirm"); | |
| 336 | - sockMap.put("id", d80.getId()); | |
| 337 | - sockMap.put("lineId", d80.getData().getLineId()); | |
| 338 | - socketHandler.sendMessageToLine(d80.getData().getLineId().toString(), JSON.toJSONString(sockMap)); | |
| 339 | - } | |
| 340 | - | |
| 341 | - return rs; | |
| 342 | - } | |
| 343 | - | |
| 344 | - @Override | |
| 345 | - public Map<String, Object> findDirective(String nbbm, int dType, int page, int size) { | |
| 346 | - Map<String, Object> rsMap = new HashMap<>(); | |
| 347 | - List<Directive> list = new ArrayList<>(); | |
| 348 | - | |
| 349 | - switch (dType) { | |
| 350 | - case -1: | |
| 351 | - //所有指令 | |
| 352 | - list = new ArrayList<>(dayOfDirectives.all()); | |
| 353 | - break; | |
| 354 | - case 0: | |
| 355 | - //调度指令 | |
| 356 | - Collection<D60> dptArray = dayOfDirectives.all60(); | |
| 357 | - for(D60 d60 : dptArray){ | |
| 358 | - if(d60.isDispatch()) | |
| 359 | - list.add(d60); | |
| 360 | - } | |
| 361 | - break; | |
| 362 | - case 1: | |
| 363 | - //运营指令 | |
| 364 | - Collection<D60> yyArray = dayOfDirectives.all60(); | |
| 365 | - for(D60 d60 : yyArray){ | |
| 366 | - if(d60 != null && d60.getData().getDispatchInstruct() == (short)0x03 | |
| 367 | - && !d60.isDispatch()) | |
| 368 | - list.add(d60); | |
| 369 | - } | |
| 370 | - break; | |
| 371 | - case 2: | |
| 372 | - //线路切换指令 | |
| 373 | - list.addAll(dayOfDirectives.all64()); | |
| 374 | - break; | |
| 375 | - case 3: | |
| 376 | - //消息短语 | |
| 377 | - Collection<D60> dyArray = dayOfDirectives.all60(); | |
| 378 | - for(D60 d60 : dyArray){ | |
| 379 | - if(d60 != null && d60.getData().getDispatchInstruct() == (short)0x00 | |
| 380 | - && !d60.isDispatch()) | |
| 381 | - list.add(d60); | |
| 382 | - } | |
| 383 | - break; | |
| 384 | - } | |
| 385 | - | |
| 386 | - // 时间倒序 | |
| 387 | - Collections.sort(list, new DayOfDirectives.DComparator()); | |
| 388 | - if(StringUtils.isNotBlank(nbbm)){ | |
| 389 | - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 390 | - //按车辆过滤 | |
| 391 | - List<Directive> subList = new ArrayList<>(); | |
| 392 | - for(Directive d : list){ | |
| 393 | - if(d.getDeviceId().equals(deviceId)){ | |
| 394 | - subList.add(d); | |
| 395 | - } | |
| 396 | - } | |
| 397 | - list = subList; | |
| 398 | - } | |
| 399 | - | |
| 400 | - int count = list.size(); | |
| 401 | - // 分页 | |
| 402 | - int s = page * size, e = s + size; | |
| 403 | - | |
| 404 | - if (e > count) | |
| 405 | - e = count; | |
| 406 | - | |
| 407 | - List<Directive> rs = list.subList(s, e); | |
| 408 | - | |
| 409 | - // 时间格式化,车辆自编号转换 | |
| 410 | - for (Directive d : rs) { | |
| 411 | - if (d.getTimeHHmm() == null) | |
| 412 | - d.setTimeHHmm(fmtHHmm.print(d.getTimestamp())); | |
| 413 | - if (d.getNbbm() == null) | |
| 414 | - d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId())); | |
| 415 | - } | |
| 416 | - | |
| 417 | - rsMap.put("list", rs); | |
| 418 | - rsMap.put("totalPages", count % size == 0 ? (count / size - 1) : count / size); | |
| 419 | - rsMap.put("page", page); | |
| 420 | - return rsMap; | |
| 421 | - } | |
| 422 | - | |
| 423 | - @Override | |
| 424 | - public Map<String, Object> findAll80(Map<String, Object> map, int page, int size) { | |
| 425 | - List<D80> d80s = new ArrayList<>(); | |
| 426 | - | |
| 427 | - Object nbbm = map.get("nbbm"); | |
| 428 | - if(null != nbbm && StringUtils.isNotEmpty(nbbm.toString())){ | |
| 429 | - d80s.addAll(pilotReport.findByCar(nbbm.toString())); | |
| 430 | - } | |
| 431 | - else{ | |
| 432 | - d80s.addAll(pilotReport.findAll()); | |
| 433 | - } | |
| 434 | - | |
| 435 | - Short requestCode = Short.parseShort(map.get("requestCode").toString()); | |
| 436 | - if(requestCode != -1){ | |
| 437 | - List<D80> temps = new ArrayList<>(); | |
| 438 | - for(D80 d80 : d80s){ | |
| 439 | - if(d80.getData().getRequestCode().equals(requestCode)) | |
| 440 | - temps.add(d80); | |
| 441 | - } | |
| 442 | - d80s = temps; | |
| 443 | - } | |
| 444 | - | |
| 445 | - //排序 | |
| 446 | - Collections.sort(d80s, new Comparator<D80>() { | |
| 447 | - @Override | |
| 448 | - public int compare(D80 o1, D80 o2) { | |
| 449 | - return (int) (o2.getTimestamp() - o1.getTimestamp()); | |
| 450 | - } | |
| 451 | - }); | |
| 452 | - | |
| 453 | - //分页 | |
| 454 | - int count = d80s.size(); | |
| 455 | - // 分页 | |
| 456 | - int s = page * size, e = s + size; | |
| 457 | - | |
| 458 | - if (e > count) | |
| 459 | - e = count; | |
| 460 | - | |
| 461 | - //SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 462 | - List<D80> rs = d80s.subList(s, e); | |
| 463 | - for(D80 d80 : rs){ | |
| 464 | - d80.setTimeStr(fmtHHmm.print(d80.getTimestamp())); | |
| 465 | - } | |
| 466 | - | |
| 467 | - Map<String, Object> rsMap = new HashMap<>(); | |
| 468 | - rsMap.put("list", rs); | |
| 469 | - rsMap.put("totalPages", count % size == 0 ? count / size -1 : count / size); | |
| 470 | - rsMap.put("page", page); | |
| 471 | - | |
| 472 | - return rsMap; | |
| 473 | - } | |
| 474 | - | |
| 475 | - @Override | |
| 476 | - public D64 save64(D64 d64) { | |
| 477 | - return d64Repository.save(d64); | |
| 478 | - } | |
| 479 | - | |
| 480 | - @Override | |
| 481 | - public int sendC0A4(String nbbm) { | |
| 482 | - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 483 | - | |
| 484 | - Map<String, Object> c0a4 = new HashMap<>(); | |
| 485 | - c0a4.put("deviceId", deviceId); | |
| 486 | - c0a4.put("timestamp", System.currentTimeMillis()); | |
| 487 | - c0a4.put("operCode", (short)0xC0); | |
| 488 | - | |
| 489 | - Map<String, Object> data = new HashMap<>(); | |
| 490 | - data.put("deviceId", deviceId); | |
| 491 | - data.put("operCode2", (short)0xA4); | |
| 492 | - c0a4.put("data", data); | |
| 493 | - | |
| 494 | - return GatewayHttpUtils.postJson(JSON.toJSONString(c0a4)); | |
| 495 | - } | |
| 496 | - | |
| 497 | - @Override | |
| 498 | - public int sendC0A3(DC0_A3 c0a3) { | |
| 499 | - GatewayHttpUtils.postJson(JSON.toJSONString(c0a3)); | |
| 500 | - return 0; | |
| 501 | - } | |
| 502 | - | |
| 503 | - @Override | |
| 504 | - public int sendC0A5(String json) { | |
| 505 | - return GatewayHttpUtils.postJson(json); | |
| 506 | - } | |
| 507 | - | |
| 508 | - @Override | |
| 509 | - public int refreshLineFile(String deviceId) { | |
| 510 | - GpsEntity gps = gpsRealDataBuffer.get(deviceId); | |
| 511 | - if(gps == null) | |
| 512 | - return -1; | |
| 513 | - | |
| 514 | - return GatewayHttpUtils.postJson(new DirectiveCreator().createDeviceRefreshData(deviceId, gps.getLineId())); | |
| 515 | - } | |
| 516 | - | |
| 517 | - @Override | |
| 518 | - public int stateChange(String nbbm, Integer upDown, Integer state, String userName) { | |
| 519 | - return send60Operation(nbbm, state, upDown, null, userName); | |
| 520 | - } | |
| 276 | + if (dispatchInstruct == 0) { | |
| 277 | + upDown = 0; | |
| 278 | + state = 0; | |
| 279 | + } else { | |
| 280 | + logger.error("没有找到gps对照,无法确认营运状态和上下行:" + nbbm); | |
| 281 | + return null; | |
| 282 | + } | |
| 283 | + } else { | |
| 284 | + upDown = gpsData.getUpDown(); | |
| 285 | + state = gpsData.getState(); | |
| 286 | + } | |
| 287 | + } else { | |
| 288 | + upDown = Byte.parseByte(sch.getXlDir()); | |
| 289 | + state = 0; | |
| 290 | + } | |
| 291 | + | |
| 292 | + return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state); | |
| 293 | + } | |
| 294 | + | |
| 295 | + @Override | |
| 296 | + public int upDownChange(String nbbm, Integer upDown, String sender) { | |
| 297 | + return send60Operation(nbbm, 0, upDown, null, sender); | |
| 298 | + } | |
| 299 | + | |
| 300 | + | |
| 301 | + @Override | |
| 302 | + public Map<String, List<D80>> findNoCofm80(String lineCodes) { | |
| 303 | + List<String> lineList = Splitter.on(",").trimResults().splitToList(lineCodes); | |
| 304 | + | |
| 305 | + Map<String, List<D80>> rs = new HashMap<>(); | |
| 306 | + for (String code : lineList) | |
| 307 | + rs.put(code, pilotReport.unconfirmed80(Integer.parseInt(code))); | |
| 308 | + | |
| 309 | + return rs; | |
| 310 | + } | |
| 311 | + | |
| 312 | + @Override | |
| 313 | + public Map<String, Object> reply80(int id, int reply) { | |
| 314 | + Map<String, Object> rs = new HashMap<>(); | |
| 315 | + D80 d80 = pilotReport.findById(id); | |
| 316 | + try { | |
| 317 | + if (null == d80) { | |
| 318 | + rs.put("status", ResponseCode.ERROR); | |
| 319 | + rs.put("msg", "服务器没有找到对应数据!"); | |
| 320 | + } else if (d80.isConfirm()) { | |
| 321 | + rs.put("status", ResponseCode.ERROR); | |
| 322 | + rs.put("msg", "该数据已经被处理了!"); | |
| 323 | + } else { | |
| 324 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 325 | + d80.setC0(reply, user.getUserName()); | |
| 326 | + // 入库 | |
| 327 | + d80Repository.save(d80); | |
| 328 | + //回复网关 | |
| 329 | + int code = GatewayHttpUtils.postJson(JSON.toJSONString(d80.getC0())); | |
| 330 | + | |
| 331 | + rs.put("status", ResponseCode.SUCCESS); | |
| 332 | + if (code != 0) | |
| 333 | + rs.put("msg", "发送C0响应指令到车载设备失败,但该操作已经被系统记录!"); | |
| 334 | + | |
| 335 | + pilotReport.reply(d80); | |
| 336 | + } | |
| 337 | + } catch (Exception e) { | |
| 338 | + logger.error("80响应出现异常...", e); | |
| 339 | + rs.put("status", ResponseCode.SUCCESS); | |
| 340 | + } | |
| 341 | + // 通知页面 | |
| 342 | + Map<String, Object> sockMap = new HashMap<>(); | |
| 343 | + sockMap.put("fn", "d80Confirm"); | |
| 344 | + sockMap.put("id", d80.getId()); | |
| 345 | + sockMap.put("lineId", d80.getData().getLineId()); | |
| 346 | + socketHandler.sendMessageToLine(d80.getData().getLineId().toString(), JSON.toJSONString(sockMap)); | |
| 347 | + | |
| 348 | + return rs; | |
| 349 | + } | |
| 350 | + | |
| 351 | + @Override | |
| 352 | + public Map<String, Object> findDirective(String nbbm, int dType, int page, int size) { | |
| 353 | + Map<String, Object> rsMap = new HashMap<>(); | |
| 354 | + List<Directive> list = new ArrayList<>(); | |
| 355 | + | |
| 356 | + switch (dType) { | |
| 357 | + case -1: | |
| 358 | + //所有指令 | |
| 359 | + list = new ArrayList<>(dayOfDirectives.all()); | |
| 360 | + break; | |
| 361 | + case 0: | |
| 362 | + //调度指令 | |
| 363 | + Collection<D60> dptArray = dayOfDirectives.all60(); | |
| 364 | + for (D60 d60 : dptArray) { | |
| 365 | + if (d60.isDispatch()) | |
| 366 | + list.add(d60); | |
| 367 | + } | |
| 368 | + break; | |
| 369 | + case 1: | |
| 370 | + //运营指令 | |
| 371 | + Collection<D60> yyArray = dayOfDirectives.all60(); | |
| 372 | + for (D60 d60 : yyArray) { | |
| 373 | + if (d60 != null && d60.getData().getDispatchInstruct() == (short) 0x03 | |
| 374 | + && !d60.isDispatch()) | |
| 375 | + list.add(d60); | |
| 376 | + } | |
| 377 | + break; | |
| 378 | + case 2: | |
| 379 | + //线路切换指令 | |
| 380 | + list.addAll(dayOfDirectives.all64()); | |
| 381 | + break; | |
| 382 | + case 3: | |
| 383 | + //消息短语 | |
| 384 | + Collection<D60> dyArray = dayOfDirectives.all60(); | |
| 385 | + for (D60 d60 : dyArray) { | |
| 386 | + if (d60 != null && d60.getData().getDispatchInstruct() == (short) 0x00 | |
| 387 | + && !d60.isDispatch()) | |
| 388 | + list.add(d60); | |
| 389 | + } | |
| 390 | + break; | |
| 391 | + } | |
| 392 | + | |
| 393 | + // 时间倒序 | |
| 394 | + Collections.sort(list, new DayOfDirectives.DComparator()); | |
| 395 | + if (StringUtils.isNotBlank(nbbm)) { | |
| 396 | + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 397 | + //按车辆过滤 | |
| 398 | + List<Directive> subList = new ArrayList<>(); | |
| 399 | + for (Directive d : list) { | |
| 400 | + if (d.getDeviceId().equals(deviceId)) { | |
| 401 | + subList.add(d); | |
| 402 | + } | |
| 403 | + } | |
| 404 | + list = subList; | |
| 405 | + } | |
| 406 | + | |
| 407 | + int count = list.size(); | |
| 408 | + // 分页 | |
| 409 | + int s = page * size, e = s + size; | |
| 410 | + | |
| 411 | + if (e > count) | |
| 412 | + e = count; | |
| 413 | + | |
| 414 | + List<Directive> rs = list.subList(s, e); | |
| 415 | + | |
| 416 | + // 时间格式化,车辆自编号转换 | |
| 417 | + for (Directive d : rs) { | |
| 418 | + if (d.getTimeHHmm() == null) | |
| 419 | + d.setTimeHHmm(fmtHHmm.print(d.getTimestamp())); | |
| 420 | + if (d.getNbbm() == null) | |
| 421 | + d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId())); | |
| 422 | + } | |
| 423 | + | |
| 424 | + rsMap.put("list", rs); | |
| 425 | + rsMap.put("totalPages", count % size == 0 ? (count / size - 1) : count / size); | |
| 426 | + rsMap.put("page", page); | |
| 427 | + return rsMap; | |
| 428 | + } | |
| 429 | + | |
| 430 | + @Override | |
| 431 | + public Map<String, Object> findAll80(Map<String, Object> map, int page, int size) { | |
| 432 | + List<D80> d80s = new ArrayList<>(); | |
| 433 | + | |
| 434 | + Object nbbm = map.get("nbbm"); | |
| 435 | + if (null != nbbm && StringUtils.isNotEmpty(nbbm.toString())) { | |
| 436 | + d80s.addAll(pilotReport.findByCar(nbbm.toString())); | |
| 437 | + } else { | |
| 438 | + d80s.addAll(pilotReport.findAll()); | |
| 439 | + } | |
| 440 | + | |
| 441 | + Short requestCode = Short.parseShort(map.get("requestCode").toString()); | |
| 442 | + if (requestCode != -1) { | |
| 443 | + List<D80> temps = new ArrayList<>(); | |
| 444 | + for (D80 d80 : d80s) { | |
| 445 | + if (d80.getData().getRequestCode().equals(requestCode)) | |
| 446 | + temps.add(d80); | |
| 447 | + } | |
| 448 | + d80s = temps; | |
| 449 | + } | |
| 450 | + | |
| 451 | + //排序 | |
| 452 | + Collections.sort(d80s, new Comparator<D80>() { | |
| 453 | + @Override | |
| 454 | + public int compare(D80 o1, D80 o2) { | |
| 455 | + return (int) (o2.getTimestamp() - o1.getTimestamp()); | |
| 456 | + } | |
| 457 | + }); | |
| 458 | + | |
| 459 | + //分页 | |
| 460 | + int count = d80s.size(); | |
| 461 | + // 分页 | |
| 462 | + int s = page * size, e = s + size; | |
| 463 | + | |
| 464 | + if (e > count) | |
| 465 | + e = count; | |
| 466 | + | |
| 467 | + //SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 468 | + List<D80> rs = d80s.subList(s, e); | |
| 469 | + for (D80 d80 : rs) { | |
| 470 | + d80.setTimeStr(fmtHHmm.print(d80.getTimestamp())); | |
| 471 | + } | |
| 472 | + | |
| 473 | + Map<String, Object> rsMap = new HashMap<>(); | |
| 474 | + rsMap.put("list", rs); | |
| 475 | + rsMap.put("totalPages", count % size == 0 ? count / size - 1 : count / size); | |
| 476 | + rsMap.put("page", page); | |
| 477 | + | |
| 478 | + return rsMap; | |
| 479 | + } | |
| 480 | + | |
| 481 | + @Override | |
| 482 | + public D64 save64(D64 d64) { | |
| 483 | + return d64Repository.save(d64); | |
| 484 | + } | |
| 485 | + | |
| 486 | + @Override | |
| 487 | + public int sendC0A4(String nbbm) { | |
| 488 | + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 489 | + | |
| 490 | + Map<String, Object> c0a4 = new HashMap<>(); | |
| 491 | + c0a4.put("deviceId", deviceId); | |
| 492 | + c0a4.put("timestamp", System.currentTimeMillis()); | |
| 493 | + c0a4.put("operCode", (short) 0xC0); | |
| 494 | + | |
| 495 | + Map<String, Object> data = new HashMap<>(); | |
| 496 | + data.put("deviceId", deviceId); | |
| 497 | + data.put("operCode2", (short) 0xA4); | |
| 498 | + c0a4.put("data", data); | |
| 499 | + | |
| 500 | + return GatewayHttpUtils.postJson(JSON.toJSONString(c0a4)); | |
| 501 | + } | |
| 502 | + | |
| 503 | + @Override | |
| 504 | + public int sendC0A3(DC0_A3 c0a3) { | |
| 505 | + GatewayHttpUtils.postJson(JSON.toJSONString(c0a3)); | |
| 506 | + return 0; | |
| 507 | + } | |
| 508 | + | |
| 509 | + @Override | |
| 510 | + public int sendC0A5(String json) { | |
| 511 | + return GatewayHttpUtils.postJson(json); | |
| 512 | + } | |
| 513 | + | |
| 514 | + @Override | |
| 515 | + public int refreshLineFile(String deviceId) { | |
| 516 | + GpsEntity gps = gpsRealDataBuffer.get(deviceId); | |
| 517 | + if (gps == null) | |
| 518 | + return -1; | |
| 519 | + | |
| 520 | + return GatewayHttpUtils.postJson(new DirectiveCreator().createDeviceRefreshData(deviceId, gps.getLineId())); | |
| 521 | + } | |
| 522 | + | |
| 523 | + @Override | |
| 524 | + public int stateChange(String nbbm, Integer upDown, Integer state, String userName) { | |
| 525 | + return send60Operation(nbbm, state, upDown, null, userName); | |
| 526 | + } | |
| 527 | + | |
| 528 | + @Override | |
| 529 | + public Map<String, Object> deviceCofigList(Map<String, String> map, int page, int size) { | |
| 530 | + Map<String, Object> rs = new HashMap<>(); | |
| 531 | + try { | |
| 532 | + int count = jdbcTemplate.queryForObject("select count(*) from bsth_c_cars", Integer.class); | |
| 533 | + int totalPages = count % size == 0 ? count / size : count / size + 1; | |
| 534 | + int s = page * size; | |
| 535 | + | |
| 536 | + String sql = "select * from (select inside_code, equipment_code from bsth_c_cars) t1 left join bsth_v_c0_a4 t2 on t1.equipment_code=t2.id order by t2.`timestamp` desc LIMIT " + s + "," + size; | |
| 537 | + List<DeviceConfigDto> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(DeviceConfigDto.class)); | |
| 538 | + | |
| 539 | + rs.put("status", ResponseCode.SUCCESS); | |
| 540 | + rs.put("list", list); | |
| 541 | + rs.put("totalPages", totalPages); | |
| 542 | + rs.put("page", page); | |
| 543 | + } catch (Exception e) { | |
| 544 | + e.printStackTrace(); | |
| 545 | + logger.error("", e); | |
| 546 | + rs.put("status", ResponseCode.ERROR); | |
| 547 | + } | |
| 548 | + return rs; | |
| 549 | + } | |
| 521 | 550 | } | ... | ... |
src/main/java/com/bsth/service/directive/dto/DeviceConfigDto.java
0 → 100644
| 1 | +package com.bsth.service.directive.dto; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by panzhao on 2017/6/28. | |
| 5 | + */ | |
| 6 | +public class DeviceConfigDto { | |
| 7 | + | |
| 8 | + private String id; | |
| 9 | + private String insideCode; | |
| 10 | + private String equipmentCode; | |
| 11 | + /** 网关IP地址 */ | |
| 12 | + private String ipAddress; | |
| 13 | + /** 网关端口 */ | |
| 14 | + private Integer port; | |
| 15 | + /** 定时定距上报模式 */ | |
| 16 | + private Short reportMode; | |
| 17 | + /** 定时上报时间间隔 */ | |
| 18 | + private Integer interval; | |
| 19 | + /** 定距上报距离间隔 */ | |
| 20 | + private String distance; | |
| 21 | + /** 非线路状态超速阀门 */ | |
| 22 | + private Short speedingThreshold; | |
| 23 | + /** 预警阀门 */ | |
| 24 | + private Short alarmThreshold; | |
| 25 | + /** pos机IP地址 */ | |
| 26 | + private String posIpAddress; | |
| 27 | + /** pos机端口 */ | |
| 28 | + private String posPort; | |
| 29 | + /** 延迟机关时间 */ | |
| 30 | + private Integer delay; | |
| 31 | + /** 中门视频切换到码表界面速度阀门 默认45 */ | |
| 32 | + private Short speedThreshold1; | |
| 33 | + /** 码表界面切换到中门视频速度阀门 默认35 */ | |
| 34 | + private Short speedThreshold2; | |
| 35 | + /** 对比度 */ | |
| 36 | + private Short contrast; | |
| 37 | + /** 亮度 */ | |
| 38 | + private Short brightness; | |
| 39 | + /** 饱和度 */ | |
| 40 | + private Short saturation; | |
| 41 | + | |
| 42 | + private Long timestamp; | |
| 43 | + | |
| 44 | + public String getId() { | |
| 45 | + return id; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setId(String id) { | |
| 49 | + this.id = id; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public String getEquipmentCode() { | |
| 53 | + return equipmentCode; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setEquipmentCode(String equipmentCode) { | |
| 57 | + this.equipmentCode = equipmentCode; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getIpAddress() { | |
| 61 | + return ipAddress; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setIpAddress(String ipAddress) { | |
| 65 | + this.ipAddress = ipAddress; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public Integer getPort() { | |
| 69 | + return port; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void setPort(Integer port) { | |
| 73 | + this.port = port; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public Short getReportMode() { | |
| 77 | + return reportMode; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void setReportMode(Short reportMode) { | |
| 81 | + this.reportMode = reportMode; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public Integer getInterval() { | |
| 85 | + return interval; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public void setInterval(Integer interval) { | |
| 89 | + this.interval = interval; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public String getDistance() { | |
| 93 | + return distance; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public void setDistance(String distance) { | |
| 97 | + this.distance = distance; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public Short getSpeedingThreshold() { | |
| 101 | + return speedingThreshold; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public void setSpeedingThreshold(Short speedingThreshold) { | |
| 105 | + this.speedingThreshold = speedingThreshold; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public Short getAlarmThreshold() { | |
| 109 | + return alarmThreshold; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public void setAlarmThreshold(Short alarmThreshold) { | |
| 113 | + this.alarmThreshold = alarmThreshold; | |
| 114 | + } | |
| 115 | + | |
| 116 | + public String getPosIpAddress() { | |
| 117 | + return posIpAddress; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public void setPosIpAddress(String posIpAddress) { | |
| 121 | + this.posIpAddress = posIpAddress; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public String getPosPort() { | |
| 125 | + return posPort; | |
| 126 | + } | |
| 127 | + | |
| 128 | + public void setPosPort(String posPort) { | |
| 129 | + this.posPort = posPort; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public Integer getDelay() { | |
| 133 | + return delay; | |
| 134 | + } | |
| 135 | + | |
| 136 | + public void setDelay(Integer delay) { | |
| 137 | + this.delay = delay; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public Short getSpeedThreshold1() { | |
| 141 | + return speedThreshold1; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public void setSpeedThreshold1(Short speedThreshold1) { | |
| 145 | + this.speedThreshold1 = speedThreshold1; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public Short getSpeedThreshold2() { | |
| 149 | + return speedThreshold2; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public void setSpeedThreshold2(Short speedThreshold2) { | |
| 153 | + this.speedThreshold2 = speedThreshold2; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public Short getContrast() { | |
| 157 | + return contrast; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public void setContrast(Short contrast) { | |
| 161 | + this.contrast = contrast; | |
| 162 | + } | |
| 163 | + | |
| 164 | + public Short getBrightness() { | |
| 165 | + return brightness; | |
| 166 | + } | |
| 167 | + | |
| 168 | + public void setBrightness(Short brightness) { | |
| 169 | + this.brightness = brightness; | |
| 170 | + } | |
| 171 | + | |
| 172 | + public Short getSaturation() { | |
| 173 | + return saturation; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public void setSaturation(Short saturation) { | |
| 177 | + this.saturation = saturation; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public Long getTimestamp() { | |
| 181 | + return timestamp; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public void setTimestamp(Long timestamp) { | |
| 185 | + this.timestamp = timestamp; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public String getInsideCode() { | |
| 189 | + return insideCode; | |
| 190 | + } | |
| 191 | + | |
| 192 | + public void setInsideCode(String insideCode) { | |
| 193 | + this.insideCode = insideCode; | |
| 194 | + } | |
| 195 | +} | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -260,6 +260,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 260 | 260 | schedule.setLate2(false); |
| 261 | 261 | LateAdjustHandle.remove(schedule); |
| 262 | 262 | } |
| 263 | + | |
| 264 | + try { | |
| 265 | + if(!schedule.getDirectiveState().equals(-1) && schedule.getStatus()==0){ | |
| 266 | + //重新下发调度指令 | |
| 267 | + directiveService.send60Dispatch(schedule.getId(), "待发@系统"); | |
| 268 | + } | |
| 269 | + }catch (Exception e){ | |
| 270 | + logger.error("", e); | |
| 271 | + } | |
| 272 | + | |
| 263 | 273 | // 持久化到数据库 |
| 264 | 274 | dayOfSchedule.save(schedule); |
| 265 | 275 | ... | ... |
src/main/resources/static/real_control_v2/css/main.css
| ... | ... | @@ -1174,3 +1174,78 @@ ul.left_tabs_lg li{ |
| 1174 | 1174 | background: #8c8c8c; |
| 1175 | 1175 | background-image: linear-gradient(to bottom,#a7a7a7,#8c8c8c); |
| 1176 | 1176 | } |
| 1177 | + | |
| 1178 | +.ct_layer_modal{ | |
| 1179 | + background: #e5e5e5; | |
| 1180 | + height: 100%; | |
| 1181 | + width: 100%; | |
| 1182 | + overflow: auto; | |
| 1183 | +} | |
| 1184 | + | |
| 1185 | +.layui-layer-setwin{ | |
| 1186 | + | |
| 1187 | +} | |
| 1188 | + | |
| 1189 | +.device_config_table dl dt:nth-of-type(1), .device_config_table dl dd:nth-of-type(1){ | |
| 1190 | + width: 6%; | |
| 1191 | +} | |
| 1192 | +.device_config_table dl dt:nth-of-type(2), .device_config_table dl dd:nth-of-type(2){ | |
| 1193 | + width: 6%; | |
| 1194 | +} | |
| 1195 | +.device_config_table dl dt:nth-of-type(3), .device_config_table dl dd:nth-of-type(3){ | |
| 1196 | + width: 8%; | |
| 1197 | +} | |
| 1198 | +.device_config_table dl dt:nth-of-type(4), .device_config_table dl dd:nth-of-type(4){ | |
| 1199 | + width: 5%; | |
| 1200 | +} | |
| 1201 | +.device_config_table dl dt:nth-of-type(5), .device_config_table dl dd:nth-of-type(5){ | |
| 1202 | + width: 3%; | |
| 1203 | +} | |
| 1204 | +.device_config_table dl dt:nth-of-type(6), .device_config_table dl dd:nth-of-type(6){ | |
| 1205 | + width: 5%; | |
| 1206 | +} | |
| 1207 | +.device_config_table dl dt:nth-of-type(7), .device_config_table dl dd:nth-of-type(7){ | |
| 1208 | + width: 5%; | |
| 1209 | +} | |
| 1210 | +.device_config_table dl dt:nth-of-type(8), .device_config_table dl dd:nth-of-type(8){ | |
| 1211 | + width: 5%; | |
| 1212 | +} | |
| 1213 | +.device_config_table dl dt:nth-of-type(9), .device_config_table dl dd:nth-of-type(9){ | |
| 1214 | + width: 5%; | |
| 1215 | +} | |
| 1216 | +.device_config_table dl dt:nth-of-type(10), .device_config_table dl dd:nth-of-type(10){ | |
| 1217 | + width: 9%; | |
| 1218 | +} | |
| 1219 | +.device_config_table dl dt:nth-of-type(11), .device_config_table dl dd:nth-of-type(11){ | |
| 1220 | + width: 5%; | |
| 1221 | +} | |
| 1222 | +.device_config_table dl dt:nth-of-type(12), .device_config_table dl dd:nth-of-type(12){ | |
| 1223 | + width: 5%; | |
| 1224 | +} | |
| 1225 | +.device_config_table dl dt:nth-of-type(13), .device_config_table dl dd:nth-of-type(13){ | |
| 1226 | + width: 5%; | |
| 1227 | +} | |
| 1228 | +.device_config_table dl dt:nth-of-type(14), .device_config_table dl dd:nth-of-type(14){ | |
| 1229 | + width: 5%; | |
| 1230 | +} | |
| 1231 | +.device_config_table dl dt:nth-of-type(15), .device_config_table dl dd:nth-of-type(15){ | |
| 1232 | + width: 4%; | |
| 1233 | +} | |
| 1234 | +.device_config_table dl dt:nth-of-type(16), .device_config_table dl dd:nth-of-type(16){ | |
| 1235 | + width: 3%; | |
| 1236 | +} | |
| 1237 | +.device_config_table dl dt:nth-of-type(17), .device_config_table dl dd:nth-of-type(17){ | |
| 1238 | + width: 4%; | |
| 1239 | +} | |
| 1240 | +.device_config_table dl dt:nth-of-type(18), .device_config_table dl dd:nth-of-type(18){ | |
| 1241 | + width: 11%; | |
| 1242 | +} | |
| 1243 | + | |
| 1244 | +.uk-tooltip{ | |
| 1245 | + z-index: 29999999; | |
| 1246 | +} | |
| 1247 | + | |
| 1248 | +.device_config_table.ct_table dl dd, | |
| 1249 | +.device_config_table.ct_table dl dt{ | |
| 1250 | + border-right: 1px solid #dedede !important; | |
| 1251 | +} | |
| 1177 | 1252 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/device_config/list.html
0 → 100644
| 1 | +<div class="ct_layer_modal device_configs_manager"> | |
| 2 | + | |
| 3 | + <div style="height: calc(100% - 20px);"> | |
| 4 | + <div class="ct_table_wrap ct_table_no_border" style="height: 100%;overflow: hidden;"> | |
| 5 | + <div class="ct_table device_config_table"> | |
| 6 | + <div class="ct_table_head" style="top: 0px;"> | |
| 7 | + <dl> | |
| 8 | + <dt data-uk-tooltip title="车辆">车辆</dt> | |
| 9 | + <dt data-uk-tooltip title="设备号">设备号</dt> | |
| 10 | + <dt data-uk-tooltip title="网关IP">网关IP</dt> | |
| 11 | + <dt data-uk-tooltip title="网关端口">网关端口</dt> | |
| 12 | + <dt data-uk-tooltip title="定时定距上报模式">模式</dt> | |
| 13 | + <dt data-uk-tooltip title="定时上报时间间隔">时间间隔</dt> | |
| 14 | + <dt data-uk-tooltip title="定距上报距离间隔">距离间隔</dt> | |
| 15 | + <dt data-uk-tooltip title="非线路状态超速阀门">超速阀门</dt> | |
| 16 | + <dt data-uk-tooltip title="预警阀门">预警阀门</dt> | |
| 17 | + <dt data-uk-tooltip title="pos机IP地址">POS机IP</dt> | |
| 18 | + <dt data-uk-tooltip title="pos机端口">POS端口</dt> | |
| 19 | + <dt data-uk-tooltip title="延迟关机时间">延迟关机</dt> | |
| 20 | + <dt data-uk-tooltip title="中门视频切换到码表界面速度阀门">中码阀门</dt> | |
| 21 | + <dt data-uk-tooltip title="码表界面切换到中门视频速度阀门">码中阀门</dt> | |
| 22 | + <dt data-uk-tooltip title="对比度">对比度</dt> | |
| 23 | + <dt data-uk-tooltip title="亮度">亮度</dt> | |
| 24 | + <dt data-uk-tooltip title="饱和度">饱和度</dt> | |
| 25 | + <dt data-uk-tooltip title="参数上报时间">参数上报时间</dt> | |
| 26 | + </dl> | |
| 27 | + </div> | |
| 28 | + <div class="ct_table_body"></div> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + | |
| 33 | + <script id="device_configs_table-temp" type="text/html"> | |
| 34 | + {{each list as c i}} | |
| 35 | + <dl> | |
| 36 | + <dd>{{c.insideCode}}</dd> | |
| 37 | + <dd>{{c.id}}</dd> | |
| 38 | + <dd>{{c.ipAddress}}</dd> | |
| 39 | + <dd>{{c.port}}</dd> | |
| 40 | + <dd>{{c.reportMode}}</dd> | |
| 41 | + <dd>{{c.interval}}</dd> | |
| 42 | + <dd>{{c.distance}}</dd> | |
| 43 | + <dd>{{c.speedingThreshold}}</dd> | |
| 44 | + <dd>{{c.alarmThreshold}}</dd> | |
| 45 | + <dd>{{c.posIpAddress}}</dd> | |
| 46 | + <dd>{{c.posPort}}</dd> | |
| 47 | + <dd> | |
| 48 | + {{if c.delay != null}} | |
| 49 | + {{c.delay}}分钟 | |
| 50 | + {{/if}} | |
| 51 | + </dd> | |
| 52 | + <dd>{{c.speedThreshold1}}</dd> | |
| 53 | + <dd>{{c.speedThreshold2}}</dd> | |
| 54 | + <dd>{{c.contrast}}</dd> | |
| 55 | + <dd>{{c.brightness}}</dd> | |
| 56 | + <dd>{{c.saturation}}</dd> | |
| 57 | + <dd>{{c.timeStr}}</dd> | |
| 58 | + </dl> | |
| 59 | + {{/each}} | |
| 60 | + </script> | |
| 61 | + <script> | |
| 62 | + (function () { | |
| 63 | + var modal = $('.ct_layer_modal.device_configs_manager'); | |
| 64 | + | |
| 65 | + var page=0,size=12; | |
| 66 | + gb_common.$get('/directive/deviceCofigList', {page:page,size:size}, function (rs) { | |
| 67 | + var f = 'YYYY-MM-DD HH:mm'; | |
| 68 | + $.each(rs.list, function () { | |
| 69 | + if(this.timestamp){ | |
| 70 | + this.timeStr = moment(this.timestamp).format(f); | |
| 71 | + } | |
| 72 | + }); | |
| 73 | + | |
| 74 | + var htmlStr = template('device_configs_table-temp', {list: rs.list}); | |
| 75 | + $('.device_config_table .ct_table_body', modal).html(htmlStr); | |
| 76 | + }); | |
| 77 | + })(); | |
| 78 | + </script> | |
| 79 | +</div> | |
| 0 | 80 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/home/c0_a3.html
| ... | ... | @@ -84,8 +84,9 @@ |
| 84 | 84 | var modal = '#home-c0a3-modal'; |
| 85 | 85 | $(modal).on('init', function(e, data) { |
| 86 | 86 | e.stopPropagation(); |
| 87 | - $.post('/directive/c0a4', {nbbm: 'B-99999'}); | |
| 88 | - //console.log('init...'); | |
| 87 | + console.log('data', data); | |
| 88 | + $.post('/directive/c0a4', {nbbm: data.nbbm}); | |
| 89 | + | |
| 89 | 90 | setTimeout(function() { |
| 90 | 91 | $('.modal-loading .text', modal).text('等待设备响应数据...'); |
| 91 | 92 | }, 1500); | ... | ... |
src/main/resources/static/real_control_v2/fragments/north/nav/all_devices.html
| ... | ... | @@ -174,6 +174,16 @@ |
| 174 | 174 | }) |
| 175 | 175 | }; |
| 176 | 176 | |
| 177 | + var state_up_0 = function(device) { | |
| 178 | + var nbbm = gb_data_basic.device2nbbmMap()[device]; | |
| 179 | + stateChange(nbbm, 0, 0); | |
| 180 | + }; | |
| 181 | + | |
| 182 | + var state_down_0 = function(device) { | |
| 183 | + var nbbm = gb_data_basic.device2nbbmMap()[device]; | |
| 184 | + stateChange(nbbm, 1, 0); | |
| 185 | + }; | |
| 186 | + | |
| 177 | 187 | var resetPagination = true; |
| 178 | 188 | var pagination = function(pages, currentPage) { |
| 179 | 189 | var wrap = $('.pagination-wrap', modal).empty() |
| ... | ... | @@ -238,8 +248,25 @@ |
| 238 | 248 | query(); |
| 239 | 249 | }); |
| 240 | 250 | }, '确定从清册中移除'); |
| 241 | - } | |
| 242 | - } | |
| 251 | + }, | |
| 252 | + state_up_0: state_up_0, | |
| 253 | + state_down_0: state_down_0 | |
| 254 | + }; | |
| 255 | + | |
| 256 | + | |
| 257 | + //营运状态和上下行切换 | |
| 258 | + var stateChange = function (nbbm, updown, state) { | |
| 259 | + $.post('/directive/stateChange', { | |
| 260 | + nbbm: nbbm, | |
| 261 | + upDown: updown, | |
| 262 | + state: state | |
| 263 | + }, function(rs) { | |
| 264 | + if (rs == 0) | |
| 265 | + notify_succ('指令已发出'); | |
| 266 | + else | |
| 267 | + notify_err('发送失败,原因参考【指令下发记录】'); | |
| 268 | + }); | |
| 269 | + }; | |
| 243 | 270 | |
| 244 | 271 | $.contextMenu({ |
| 245 | 272 | selector: '#all-devices-modal table>tbody>tr', |
| ... | ... | @@ -252,6 +279,17 @@ |
| 252 | 279 | 'change_line': { |
| 253 | 280 | name: '切换线路' |
| 254 | 281 | }, |
| 282 | + 'change_up_down': { | |
| 283 | + name: '切换上下行', | |
| 284 | + items: { | |
| 285 | + 'state_up_0': { | |
| 286 | + 'name': '上行营运' | |
| 287 | + }, | |
| 288 | + 'state_down_0': { | |
| 289 | + 'name': '下行营运' | |
| 290 | + } | |
| 291 | + } | |
| 292 | + }, | |
| 255 | 293 | 'refresh_line_file':{ |
| 256 | 294 | name: '刷新线路文件' |
| 257 | 295 | }, | ... | ... |
src/main/resources/static/real_control_v2/js/common.js
| ... | ... | @@ -363,6 +363,15 @@ var gb_common = (function () { |
| 363 | 363 | return result; |
| 364 | 364 | }; |
| 365 | 365 | |
| 366 | + var inverse = function (map) { | |
| 367 | + var rs = {}; | |
| 368 | + for(var k in map){ | |
| 369 | + rs[map[k]] = k; | |
| 370 | + } | |
| 371 | + | |
| 372 | + return rs; | |
| 373 | + }; | |
| 374 | + | |
| 366 | 375 | return { |
| 367 | 376 | reqCode80: reqCode80, |
| 368 | 377 | groupBy: groupBy, |
| ... | ... | @@ -385,7 +394,8 @@ var gb_common = (function () { |
| 385 | 394 | numSubtr: numSubtr, |
| 386 | 395 | trim: trim, |
| 387 | 396 | remarksAutocomplete: remarksAutocomplete, |
| 388 | - flatpickrDateTimeConfig: flatpickrDateTimeConfig | |
| 397 | + flatpickrDateTimeConfig: flatpickrDateTimeConfig, | |
| 398 | + inverse: inverse | |
| 389 | 399 | |
| 390 | 400 | //whichTransitionEvent:whichTransitionEvent |
| 391 | 401 | }; | ... | ... |
src/main/resources/static/real_control_v2/js/data/data_basic.js
| ... | ... | @@ -2,13 +2,14 @@ |
| 2 | 2 | |
| 3 | 3 | var gb_data_basic = (function () { |
| 4 | 4 | |
| 5 | - var stationRoutes, lineCode2NameAll, lineInformations, nbbm2deviceMap, allPersonnel, svgAttrs; | |
| 5 | + var stationRoutes, lineCode2NameAll, lineInformations, nbbm2deviceMap, device2nbbmMap, allPersonnel, svgAttrs; | |
| 6 | 6 | var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", "nbbm2deviceId", "all_personnel", "svg_attrs" |
| 7 | 7 | , function (routes, code2Name, informations, nbbm2device, all_personnel, svgAttrMap) { |
| 8 | 8 | stationRoutes = routes; |
| 9 | 9 | lineCode2NameAll = code2Name; |
| 10 | 10 | lineInformations = informations; |
| 11 | 11 | nbbm2deviceMap = nbbm2device; |
| 12 | + device2nbbmMap = gb_common.inverse(nbbm2deviceMap); | |
| 12 | 13 | allPersonnel = all_personnel; |
| 13 | 14 | svgAttrs = svgAttrMap; |
| 14 | 15 | gb_main_ep.emitLater('data-basic'); |
| ... | ... | @@ -167,6 +168,9 @@ var gb_data_basic = (function () { |
| 167 | 168 | nbbm2deviceMap: function () { |
| 168 | 169 | return nbbm2deviceMap; |
| 169 | 170 | }, |
| 171 | + device2nbbmMap: function () { | |
| 172 | + return device2nbbmMap; | |
| 173 | + }, | |
| 170 | 174 | getLineInformation: getLineInformation, |
| 171 | 175 | allInformations: function () { |
| 172 | 176 | return lineInformations; | ... | ... |
src/main/resources/static/real_control_v2/js/forms/wrap.html
| ... | ... | @@ -101,8 +101,8 @@ |
| 101 | 101 | sd=d.subtract(3, 'days').format(f); |
| 102 | 102 | |
| 103 | 103 | $('#date', '.form-page-content').data('DateTimePicker') |
| 104 | - .defaultDate(d) | |
| 105 | - .maxDate(ed).minDate(sd); | |
| 104 | + .defaultDate(d); | |
| 105 | + //.maxDate(ed).minDate(sd); | |
| 106 | 106 | |
| 107 | 107 | if($("#ddrbBody").length > 0){ |
| 108 | 108 | $("#ddrbBody").height("620px"); | ... | ... |
src/main/resources/static/real_control_v2/js/home/context_menu.js
| ... | ... | @@ -205,7 +205,8 @@ var gb_home_context_menu = (function() { |
| 205 | 205 | }; |
| 206 | 206 | |
| 207 | 207 | var C0_A3 = function(){ |
| 208 | - open_modal('/real_control_v2/fragments/home/c0_a3.html', {}, {center: false, bgclose: false}); | |
| 208 | + //open_modal('/real_control_v2/fragments/home/c0_a3.html', {nbbm: active_car}, {center: false, bgclose: false}); | |
| 209 | + open_layer_modal('/real_control_v2/fragments/device_config/list.html', {}, 1288, 600, '设备参数管理(功能调试中...)'); | |
| 209 | 210 | }; |
| 210 | 211 | |
| 211 | 212 | var callbackHandler = { |
| ... | ... | @@ -256,12 +257,7 @@ var gb_home_context_menu = (function() { |
| 256 | 257 | }, |
| 257 | 258 | 'sep2': '---------', |
| 258 | 259 | 'C0_A3': { |
| 259 | - name: '设备参数管理', | |
| 260 | - disabled:true | |
| 261 | - }, | |
| 262 | - 'C0_A5': { | |
| 263 | - name: '程序更新', | |
| 264 | - disabled:true | |
| 260 | + name: '设备参数管理' | |
| 265 | 261 | } |
| 266 | 262 | } |
| 267 | 263 | }); | ... | ... |
src/main/resources/static/real_control_v2/js/modal_extend.js
| ... | ... | @@ -30,6 +30,28 @@ var open_modal = function (pageUrl, data, opt) { |
| 30 | 30 | }); |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | +var open_layer_modal = function (pageUrl, data, w, h, t) { | |
| 34 | + if(!w) w = 1200; | |
| 35 | + if(!h) h = 650; | |
| 36 | + $.get(pageUrl, function (dom) { | |
| 37 | + var index = layer.open({ | |
| 38 | + type: 1, | |
| 39 | + title: t, | |
| 40 | + shadeClose: true, | |
| 41 | + shade: false, | |
| 42 | + maxmin: true, //开启最大化最小化按钮 | |
| 43 | + area: [w+'px', h+'px'], | |
| 44 | + skin:'layui-layer-molv play_back-layer', | |
| 45 | + content: dom, | |
| 46 | + //zIndex: layer.zIndex, | |
| 47 | + success: function(layero){ | |
| 48 | + layer.setTop(layero); | |
| 49 | + //$('.gps-play-back-panel-v3').trigger('init', {deviceId: deviceId, nbbm: nbbm}); | |
| 50 | + } | |
| 51 | + }); | |
| 52 | + }); | |
| 53 | +}; | |
| 54 | + | |
| 33 | 55 | var open_modal_dom = function (dom, data, opt) { |
| 34 | 56 | if (!$(dom).hasClass('uk-modal')) { |
| 35 | 57 | alert('无效的dom片段!'); | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
| ... | ... | @@ -1409,4 +1409,17 @@ span.flatpickr-weekday{ |
| 1409 | 1409 | right: 15px; |
| 1410 | 1410 | top: 20px; |
| 1411 | 1411 | font-size: 12px; |
| 1412 | +} | |
| 1413 | + | |
| 1414 | +ul.base_line_list>li:nth-child(odd)>a { | |
| 1415 | + color: #60a6dd; | |
| 1416 | +} | |
| 1417 | + | |
| 1418 | +ul.base_line_list>li:nth-child(even)>a { | |
| 1419 | + color: #ac443d; | |
| 1420 | +} | |
| 1421 | + | |
| 1422 | +ul.base_line_list>li>a:hover{ | |
| 1423 | + color: #fff !important; | |
| 1424 | + background: #848686 !important; | |
| 1412 | 1425 | } |
| 1413 | 1426 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/right.html
| ... | ... | @@ -30,6 +30,15 @@ |
| 30 | 30 | </div> |
| 31 | 31 | </div> |
| 32 | 32 | </label> |
| 33 | + <label> | |
| 34 | + <div class="uk-button-dropdown" data-uk-dropdown=""> | |
| 35 | + <a title="默认跟随GPS,选择后将固定底图。每次搜索会重置">线路底图 <i class="uk-icon-angle-down"></i></a> | |
| 36 | + <div class="uk-dropdown uk-dropdown-scrollable" style="max-height: 300px;"> | |
| 37 | + <ul class="uk-nav uk-nav-dropdown base_line_list"> | |
| 38 | + </ul> | |
| 39 | + </div> | |
| 40 | + </div> | |
| 41 | + </label> | |
| 33 | 42 | </form> |
| 34 | 43 | </div> |
| 35 | 44 | |
| ... | ... | @@ -102,6 +111,7 @@ |
| 102 | 111 | trailPolyline=null; |
| 103 | 112 | map.clearOverlays(); |
| 104 | 113 | parkPolygons={}; |
| 114 | + autoChange=true; | |
| 105 | 115 | } |
| 106 | 116 | |
| 107 | 117 | function replaceSymbol(s){ |
| ... | ... | @@ -262,12 +272,13 @@ |
| 262 | 272 | gpsMarker.setIcon(new BMap.Icon(gb_map_imap.createCarIconRotation(gps, width), new BMap.Size(width, 75))); |
| 263 | 273 | } |
| 264 | 274 | |
| 265 | - if(gps.lineId!=xlPolyline.lineId || gps.upDown!=xlPolyline.upDown){ | |
| 275 | + if(autoChange && (gps.lineId!=xlPolyline.lineId || gps.upDown!=xlPolyline.upDown)){ | |
| 266 | 276 | drawXlPolyline(gps.lineId, gps.upDown); |
| 267 | 277 | } |
| 268 | 278 | } |
| 269 | 279 | |
| 270 | 280 | var bform = $('.buffer_area_form', rightWrap); |
| 281 | + var autoChange=true; | |
| 271 | 282 | function drawXlPolyline(lineCode, upDown) { |
| 272 | 283 | if(upDown!=0 && upDown!=1){ |
| 273 | 284 | //upDown = xlPolyline.upDown?xlPolyline.upDown:0; |
| ... | ... | @@ -657,6 +668,23 @@ |
| 657 | 668 | }); |
| 658 | 669 | })(); |
| 659 | 670 | |
| 671 | + //初始化线路地图下拉菜单 | |
| 672 | + (function () { | |
| 673 | + var opts=''; | |
| 674 | + $.each(gb_data_basic.activeLines, function () { | |
| 675 | + opts+='<li data-code="'+this.lineCode+'" data-dir="0"><a>'+this.name+'上行</a></li><li data-code="'+this.lineCode+'" data-dir="1"><a>'+this.name+'下行</a></li>'; | |
| 676 | + }); | |
| 677 | + $('.base_line_list', rightWrap).html(opts); | |
| 678 | + | |
| 679 | + //切换线路底图 | |
| 680 | + $(rightWrap).on('click', '.base_line_list>li', function () { | |
| 681 | + var code = $(this).data('code'); | |
| 682 | + var updown = $(this).data('dir'); | |
| 683 | + autoChange = false; | |
| 684 | + drawXlPolyline(code, updown); | |
| 685 | + }); | |
| 686 | + })(); | |
| 687 | + | |
| 660 | 688 | |
| 661 | 689 | function formData() { |
| 662 | 690 | var fs = 'YYYY-MM-DD HH:mm'; | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/playback.js
| ... | ... | @@ -27,7 +27,7 @@ var gb_map_play_back = (function () { |
| 27 | 27 | shadeClose: true, |
| 28 | 28 | shade: false, |
| 29 | 29 | maxmin: true, //开启最大化最小化按钮 |
| 30 | - area: ['1214px', '754px'], | |
| 30 | + area: ['1299px', '754px'], | |
| 31 | 31 | //moveOut: true, |
| 32 | 32 | skin:'layui-layer-molv play_back-layer', |
| 33 | 33 | content: dom, | ... | ... |