Commit 553f02e78e0e01252b8d00ea6e6463cecfcc9235
1 parent
8d5ad135
注释掉未完成的模块
Showing
13 changed files
with
1597 additions
and
1457 deletions
src/main/java/com/bsth/controller/directive/DirectiveController.java
0 → 100644
| 1 | +//package com.bsth.controller.directive; | ||
| 2 | +// | ||
| 3 | +//import java.util.List; | ||
| 4 | +//import java.util.Map; | ||
| 5 | +// | ||
| 6 | +//import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +//import org.springframework.data.domain.Page; | ||
| 8 | +//import org.springframework.data.domain.PageRequest; | ||
| 9 | +//import org.springframework.data.domain.Sort; | ||
| 10 | +//import org.springframework.data.domain.Sort.Direction; | ||
| 11 | +//import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | +//import org.springframework.web.bind.annotation.RequestMethod; | ||
| 13 | +//import org.springframework.web.bind.annotation.RequestParam; | ||
| 14 | +//import org.springframework.web.bind.annotation.RestController; | ||
| 15 | +// | ||
| 16 | +//import com.bsth.entity.directive.D80; | ||
| 17 | +//import com.bsth.entity.sys.SysUser; | ||
| 18 | +//import com.bsth.security.util.SecurityUtils; | ||
| 19 | +//import com.bsth.service.directive.DirectiveService; | ||
| 20 | +// | ||
| 21 | +///** | ||
| 22 | +// * | ||
| 23 | +// * @ClassName: DirectiveController | ||
| 24 | +// * @Description: TODO(页面下发调度指令) .0 | ||
| 25 | +// * @author PanZhao | ||
| 26 | +// * @date 2016年6月8日 上午9:34:51 | ||
| 27 | +// * | ||
| 28 | +// */ | ||
| 29 | +//@RestController | ||
| 30 | +//@RequestMapping("/directive") | ||
| 31 | +//public class DirectiveController { | ||
| 32 | +// | ||
| 33 | +// @Autowired | ||
| 34 | +// DirectiveService directiveService; | ||
| 35 | +// | ||
| 36 | +// /** | ||
| 37 | +// * | ||
| 38 | +// * @Title: send60 | ||
| 39 | +// * @Description: TODO(60协议短语下发) | ||
| 40 | +// * @throws | ||
| 41 | +// */ | ||
| 42 | +// @RequestMapping(value = "/phrase", method = RequestMethod.POST) | ||
| 43 | +// public int send60Phrase(@RequestParam String nbbm, @RequestParam String text){ | ||
| 44 | +// SysUser user = SecurityUtils.getCurrentUser(); | ||
| 45 | +// return directiveService.send60Phrase(nbbm, text, user.getUserName()); | ||
| 46 | +// } | ||
| 47 | +// | ||
| 48 | +// /** | ||
| 49 | +// * | ||
| 50 | +// * @Title: send60Dispatch | ||
| 51 | +// * @Description: TODO(班次信息下发) | ||
| 52 | +// * @param @param id | ||
| 53 | +// * @throws | ||
| 54 | +// */ | ||
| 55 | +// @RequestMapping(value = "/dispatch", method = RequestMethod.POST) | ||
| 56 | +// public int send60Dispatch(@RequestParam Long id){ | ||
| 57 | +// SysUser user = SecurityUtils.getCurrentUser(); | ||
| 58 | +// return directiveService.send60Dispatch(id, user.getUserName()); | ||
| 59 | +// } | ||
| 60 | +// | ||
| 61 | +// /** | ||
| 62 | +// * | ||
| 63 | +// * @Title: lineChange | ||
| 64 | +// * @Description: TODO(切换线路) | ||
| 65 | +// * @param @param nbbm 车辆内部编码 | ||
| 66 | +// * @param @param lineId 新线路编码 | ||
| 67 | +// * @throws | ||
| 68 | +// */ | ||
| 69 | +// @RequestMapping(value = "/lineChnage", method = RequestMethod.POST) | ||
| 70 | +// public int lineChange(@RequestParam String nbbm, @RequestParam Integer lineId){ | ||
| 71 | +// SysUser user = SecurityUtils.getCurrentUser(); | ||
| 72 | +// return directiveService.lineChange(nbbm, lineId, user.getUserName()); | ||
| 73 | +// } | ||
| 74 | +// | ||
| 75 | +// /** | ||
| 76 | +// * | ||
| 77 | +// * @Title: upDownChange | ||
| 78 | +// * @Description: TODO(上下行切换) | ||
| 79 | +// * @param @param nbbm 车辆内部编码 | ||
| 80 | +// * @param @param upDon | ||
| 81 | +// * @throws | ||
| 82 | +// */ | ||
| 83 | +// @RequestMapping(value = "/upDownChange", method = RequestMethod.POST) | ||
| 84 | +// public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){ | ||
| 85 | +// SysUser user = SecurityUtils.getCurrentUser(); | ||
| 86 | +// return directiveService.upDownChange(nbbm, upDown, user.getUserName()); | ||
| 87 | +// } | ||
| 88 | +// | ||
| 89 | +// /** | ||
| 90 | +// * | ||
| 91 | +// * @Title: findNoCofm80 | ||
| 92 | +// * @Description: TODO(根据线路获取未确认的80驾驶员上报数据) | ||
| 93 | +// * @throws | ||
| 94 | +// */ | ||
| 95 | +// @RequestMapping(value = "/findNoCofm80", method = RequestMethod.GET) | ||
| 96 | +// public Map<String, List<D80>> findNoCofm80(@RequestParam String lineCodes){ | ||
| 97 | +// return directiveService.findNoCofm80(lineCodes); | ||
| 98 | +// } | ||
| 99 | +// | ||
| 100 | +// @RequestMapping(value = "/findAll80", method = RequestMethod.GET) | ||
| 101 | +// public Page<D80> findAll80(@RequestParam Map<String, Object> map, | ||
| 102 | +// @RequestParam(defaultValue = "0") int page, | ||
| 103 | +// @RequestParam(defaultValue = "12") int size){ | ||
| 104 | +// | ||
| 105 | +// return directiveService.findAll80(map, new PageRequest(page, size, new Sort(Direction.DESC, "timestamp"))); | ||
| 106 | +// } | ||
| 107 | +// | ||
| 108 | +// /** | ||
| 109 | +// * | ||
| 110 | +// * @Title: reply80 | ||
| 111 | +// * @Description: TODO(回复80) | ||
| 112 | +// * @param @param reply 0:同意 -1:不同意 | ||
| 113 | +// * @throws | ||
| 114 | +// */ | ||
| 115 | +// @RequestMapping(value = "/reply80", method = RequestMethod.POST) | ||
| 116 | +// public Map<String, Object> reply80(@RequestParam int id, @RequestParam int reply){ | ||
| 117 | +// return directiveService.reply80(id, reply); | ||
| 118 | +// } | ||
| 119 | +// | ||
| 120 | +// /** | ||
| 121 | +// * | ||
| 122 | +// * @Title: findDirective | ||
| 123 | +// * @Description: TODO(查询调度指令) | ||
| 124 | +// * @param @param nbbm 车辆 | ||
| 125 | +// * @param @param dType 类型 | ||
| 126 | +// * @param @param page 页号 | ||
| 127 | +// * @param @param size 每页数量 | ||
| 128 | +// * @throws | ||
| 129 | +// */ | ||
| 130 | +// @RequestMapping(value = "/list", method = RequestMethod.GET) | ||
| 131 | +// public Map<String, Object> findDirective(String nbbm,@RequestParam int dType | ||
| 132 | +// , @RequestParam(defaultValue = "0") int page, | ||
| 133 | +// @RequestParam(defaultValue = "10") int size){ | ||
| 134 | +// | ||
| 135 | +// return directiveService.findDirective(nbbm, dType, page, size); | ||
| 136 | +// } | ||
| 137 | +//} |
src/main/java/com/bsth/data/BasicData.java
| @@ -76,8 +76,11 @@ public class BasicData { | @@ -76,8 +76,11 @@ public class BasicData { | ||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | @Component | 78 | @Component |
| 79 | - public class BasicDataLoader{ | 79 | + public static class BasicDataLoader{ |
| 80 | 80 | ||
| 81 | + public BasicDataLoader() { | ||
| 82 | + } | ||
| 83 | + | ||
| 81 | @Autowired | 84 | @Autowired |
| 82 | CarsRepository carsRepository; | 85 | CarsRepository carsRepository; |
| 83 | 86 |
src/main/java/com/bsth/entity/directive/D60.java
| 1 | -package com.bsth.entity.directive; | ||
| 2 | - | ||
| 3 | -import javax.persistence.Embeddable; | ||
| 4 | -import javax.persistence.Entity; | ||
| 5 | -import javax.persistence.FetchType; | ||
| 6 | -import javax.persistence.GeneratedValue; | ||
| 7 | -import javax.persistence.Id; | ||
| 8 | -import javax.persistence.ManyToOne; | ||
| 9 | -import javax.persistence.NamedAttributeNode; | ||
| 10 | -import javax.persistence.NamedEntityGraph; | ||
| 11 | -import javax.persistence.NamedEntityGraphs; | ||
| 12 | -import javax.persistence.Table; | ||
| 13 | -import javax.persistence.Transient; | ||
| 14 | - | ||
| 15 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 16 | -import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 17 | - | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * | ||
| 21 | - * @ClassName: D60 | ||
| 22 | - * @Description: TODO(调度指令) | ||
| 23 | - * @author PanZhao | ||
| 24 | - * @date 2016年6月7日 上午10:21:59 | ||
| 25 | - * | ||
| 26 | - */ | ||
| 27 | -@Entity | ||
| 28 | -@Table(name = "bsth_v_directive_60") | ||
| 29 | -@NamedEntityGraphs({ | ||
| 30 | - @NamedEntityGraph(name = "directive60_sch", attributeNodes = { | ||
| 31 | - @NamedAttributeNode("sch") | ||
| 32 | - }) | ||
| 33 | -}) | ||
| 34 | -public class D60 extends Directive{ | ||
| 35 | - | ||
| 36 | - @Id | ||
| 37 | - @GeneratedValue | ||
| 38 | - private Integer id; | ||
| 39 | - | ||
| 40 | - /** | ||
| 41 | - * 数据 | ||
| 42 | - */ | ||
| 43 | - private DirectiveData data; | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * 唯一标识 | ||
| 47 | - */ | ||
| 48 | - @Transient | ||
| 49 | - private Integer msgId; | ||
| 50 | - | ||
| 51 | - /** | ||
| 52 | - * 46上行 | ||
| 53 | - */ | ||
| 54 | - private Short reply46 = -1; | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * 47上行 | ||
| 58 | - */ | ||
| 59 | - private Short reply47 = -1; | ||
| 60 | - | ||
| 61 | - /** | ||
| 62 | - * 是否是调度指令 | ||
| 63 | - * 目前调度指令和消息短语都是短语下发,所以从协议上无法区分 | ||
| 64 | - */ | ||
| 65 | - private boolean isDispatch; | ||
| 66 | - | ||
| 67 | - /** | ||
| 68 | - * 相关联的班次 | ||
| 69 | - */ | ||
| 70 | - @JsonIgnore | ||
| 71 | - @ManyToOne(fetch = FetchType.LAZY) | ||
| 72 | - private ScheduleRealInfo sch; | ||
| 73 | - | ||
| 74 | - @Embeddable | ||
| 75 | - public static class DirectiveData { | ||
| 76 | - // 公司代码 | ||
| 77 | - private short companyCode; | ||
| 78 | - | ||
| 79 | - // 设备号 | ||
| 80 | - @Transient | ||
| 81 | - private String deviceId; | ||
| 82 | - | ||
| 83 | - // 时间戳 | ||
| 84 | - @Transient | ||
| 85 | - private Long timestamp; | ||
| 86 | - | ||
| 87 | - // 保留 默认0 | ||
| 88 | - private short instructType = 0; | ||
| 89 | - | ||
| 90 | - /* | ||
| 91 | - * 调度指令 调度指令。 | ||
| 92 | - * 0X00表示信息短语 | ||
| 93 | - * 0X01表示取消上次指令+调度指令(闹钟有效) | ||
| 94 | - * 0x02表示为调度指令(闹钟有效) | ||
| 95 | - * 0x03表示运营状态指令(闹钟无效) | ||
| 96 | - * 0x04表示其他指令 | ||
| 97 | - */ | ||
| 98 | - private Short dispatchInstruct; | ||
| 99 | - | ||
| 100 | - // 唯一标识 | ||
| 101 | - private int msgId; | ||
| 102 | - | ||
| 103 | - // 闹钟 | ||
| 104 | - private Long alarmTime; | ||
| 105 | - | ||
| 106 | - // 多个运营状态字节 | ||
| 107 | - private Long serviceState; | ||
| 108 | - | ||
| 109 | - // 消息文本 | ||
| 110 | - private String txtContent; | ||
| 111 | - | ||
| 112 | - public short getCompanyCode() { | ||
| 113 | - return companyCode; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - public void setCompanyCode(short companyCode) { | ||
| 117 | - this.companyCode = companyCode; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - public String getDeviceId() { | ||
| 121 | - return deviceId; | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - public void setDeviceId(String deviceId) { | ||
| 125 | - this.deviceId = deviceId; | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - public Long getTimestamp() { | ||
| 129 | - return timestamp; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - public void setTimestamp(Long timestamp) { | ||
| 133 | - this.timestamp = timestamp; | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - public short getInstructType() { | ||
| 137 | - return instructType; | ||
| 138 | - } | ||
| 139 | - | ||
| 140 | - public void setInstructType(short instructType) { | ||
| 141 | - this.instructType = instructType; | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - public Short getDispatchInstruct() { | ||
| 145 | - return dispatchInstruct; | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - public void setDispatchInstruct(Short dispatchInstruct) { | ||
| 149 | - this.dispatchInstruct = dispatchInstruct; | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - public int getMsgId() { | ||
| 153 | - return msgId; | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - public void setMsgId(int msgId) { | ||
| 157 | - this.msgId = msgId; | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - public Long getAlarmTime() { | ||
| 161 | - return alarmTime; | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | - public void setAlarmTime(Long alarmTime) { | ||
| 165 | - this.alarmTime = alarmTime; | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - public Long getServiceState() { | ||
| 169 | - return serviceState; | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - public void setServiceState(Long serviceState) { | ||
| 173 | - this.serviceState = serviceState; | ||
| 174 | - } | ||
| 175 | - | ||
| 176 | - public String getTxtContent() { | ||
| 177 | - return txtContent; | ||
| 178 | - } | ||
| 179 | - | ||
| 180 | - public void setTxtContent(String txtContent) { | ||
| 181 | - this.txtContent = txtContent; | ||
| 182 | - } | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | - public Integer getId() { | ||
| 186 | - return id; | ||
| 187 | - } | ||
| 188 | - | ||
| 189 | - public void setId(Integer id) { | ||
| 190 | - this.id = id; | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - public short getOperCode() { | ||
| 194 | - return operCode; | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - public void setOperCode(short operCode) { | ||
| 198 | - this.operCode = operCode; | ||
| 199 | - } | ||
| 200 | - | ||
| 201 | - public DirectiveData getData() { | ||
| 202 | - return data; | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - public void setData(DirectiveData data) { | ||
| 206 | - this.data = data; | ||
| 207 | - } | ||
| 208 | - | ||
| 209 | - public Integer getMsgId() { | ||
| 210 | - if(this.msgId != null) | ||
| 211 | - return this.msgId; | ||
| 212 | - else | ||
| 213 | - return this.getData().getMsgId(); | ||
| 214 | - } | ||
| 215 | - | ||
| 216 | - public void setMsgId(Integer msgId) { | ||
| 217 | - this.msgId = msgId; | ||
| 218 | - } | ||
| 219 | - | ||
| 220 | - @Override | ||
| 221 | - public void setTimestamp(Long timestamp) { | ||
| 222 | - if(this.data != null) | ||
| 223 | - this.data.setTimestamp(timestamp); | ||
| 224 | - | ||
| 225 | - this.timestamp = timestamp; | ||
| 226 | - } | ||
| 227 | - | ||
| 228 | - @Override | ||
| 229 | - public void setDeviceId(String deviceId) { | ||
| 230 | - if(this.data != null) | ||
| 231 | - this.data.setDeviceId(deviceId); | ||
| 232 | - | ||
| 233 | - this.deviceId = deviceId; | ||
| 234 | - } | ||
| 235 | - | ||
| 236 | - public Short getReply46() { | ||
| 237 | - return reply46; | ||
| 238 | - } | ||
| 239 | - | ||
| 240 | - public void setReply46(Short reply46) { | ||
| 241 | - this.reply46 = reply46; | ||
| 242 | - } | ||
| 243 | - | ||
| 244 | - public Short getReply47() { | ||
| 245 | - return reply47; | ||
| 246 | - } | ||
| 247 | - | ||
| 248 | - public void setReply47(Short reply47) { | ||
| 249 | - this.reply47 = reply47; | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - public boolean isDispatch() { | ||
| 253 | - return isDispatch; | ||
| 254 | - } | ||
| 255 | - | ||
| 256 | - public void setDispatch(boolean isDispatch) { | ||
| 257 | - this.isDispatch = isDispatch; | ||
| 258 | - } | ||
| 259 | - | ||
| 260 | - public ScheduleRealInfo getSch() { | ||
| 261 | - return sch; | ||
| 262 | - } | ||
| 263 | - | ||
| 264 | - public void setSch(ScheduleRealInfo sch) { | ||
| 265 | - this.sch = sch; | ||
| 266 | - } | ||
| 267 | -} | 1 | +//package com.bsth.entity.directive; |
| 2 | +// | ||
| 3 | +//import javax.persistence.Embeddable; | ||
| 4 | +//import javax.persistence.Entity; | ||
| 5 | +//import javax.persistence.FetchType; | ||
| 6 | +//import javax.persistence.GeneratedValue; | ||
| 7 | +//import javax.persistence.Id; | ||
| 8 | +//import javax.persistence.ManyToOne; | ||
| 9 | +//import javax.persistence.NamedAttributeNode; | ||
| 10 | +//import javax.persistence.NamedEntityGraph; | ||
| 11 | +//import javax.persistence.NamedEntityGraphs; | ||
| 12 | +//import javax.persistence.Table; | ||
| 13 | +//import javax.persistence.Transient; | ||
| 14 | +// | ||
| 15 | +//import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 16 | +//import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 17 | +// | ||
| 18 | +// | ||
| 19 | +///** | ||
| 20 | +// * | ||
| 21 | +// * @ClassName: D60 | ||
| 22 | +// * @Description: TODO(调度指令) | ||
| 23 | +// * @author PanZhao | ||
| 24 | +// * @date 2016年6月7日 上午10:21:59 | ||
| 25 | +// * | ||
| 26 | +// */ | ||
| 27 | +//@Entity | ||
| 28 | +//@Table(name = "bsth_v_directive_60") | ||
| 29 | +//@NamedEntityGraphs({ | ||
| 30 | +// @NamedEntityGraph(name = "directive60_sch", attributeNodes = { | ||
| 31 | +// @NamedAttributeNode("sch") | ||
| 32 | +// }) | ||
| 33 | +//}) | ||
| 34 | +//public class D60 extends Directive{ | ||
| 35 | +// | ||
| 36 | +// @Id | ||
| 37 | +// @GeneratedValue | ||
| 38 | +// private Integer id; | ||
| 39 | +// | ||
| 40 | +// /** | ||
| 41 | +// * 数据 | ||
| 42 | +// */ | ||
| 43 | +// private DirectiveData data; | ||
| 44 | +// | ||
| 45 | +// /** | ||
| 46 | +// * 唯一标识 | ||
| 47 | +// */ | ||
| 48 | +// @Transient | ||
| 49 | +// private Integer msgId; | ||
| 50 | +// | ||
| 51 | +// /** | ||
| 52 | +// * 46上行 | ||
| 53 | +// */ | ||
| 54 | +// private Short reply46 = -1; | ||
| 55 | +// | ||
| 56 | +// /** | ||
| 57 | +// * 47上行 | ||
| 58 | +// */ | ||
| 59 | +// private Short reply47 = -1; | ||
| 60 | +// | ||
| 61 | +// /** | ||
| 62 | +// * 是否是调度指令 | ||
| 63 | +// * 目前调度指令和消息短语都是短语下发,所以从协议上无法区分 | ||
| 64 | +// */ | ||
| 65 | +// private boolean isDispatch; | ||
| 66 | +// | ||
| 67 | +// /** | ||
| 68 | +// * 相关联的班次 | ||
| 69 | +// */ | ||
| 70 | +// @JsonIgnore | ||
| 71 | +// @ManyToOne(fetch = FetchType.LAZY) | ||
| 72 | +// private ScheduleRealInfo sch; | ||
| 73 | +// | ||
| 74 | +// @Embeddable | ||
| 75 | +// public static class DirectiveData { | ||
| 76 | +// // 公司代码 | ||
| 77 | +// private short companyCode; | ||
| 78 | +// | ||
| 79 | +// // 设备号 | ||
| 80 | +// @Transient | ||
| 81 | +// private String deviceId; | ||
| 82 | +// | ||
| 83 | +// // 时间戳 | ||
| 84 | +// @Transient | ||
| 85 | +// private Long timestamp; | ||
| 86 | +// | ||
| 87 | +// // 保留 默认0 | ||
| 88 | +// private short instructType = 0; | ||
| 89 | +// | ||
| 90 | +// /* | ||
| 91 | +// * 调度指令 调度指令。 | ||
| 92 | +// * 0X00表示信息短语 | ||
| 93 | +// * 0X01表示取消上次指令+调度指令(闹钟有效) | ||
| 94 | +// * 0x02表示为调度指令(闹钟有效) | ||
| 95 | +// * 0x03表示运营状态指令(闹钟无效) | ||
| 96 | +// * 0x04表示其他指令 | ||
| 97 | +// */ | ||
| 98 | +// private Short dispatchInstruct; | ||
| 99 | +// | ||
| 100 | +// // 唯一标识 | ||
| 101 | +// private int msgId; | ||
| 102 | +// | ||
| 103 | +// // 闹钟 | ||
| 104 | +// private Long alarmTime; | ||
| 105 | +// | ||
| 106 | +// // 多个运营状态字节 | ||
| 107 | +// private Long serviceState; | ||
| 108 | +// | ||
| 109 | +// // 消息文本 | ||
| 110 | +// private String txtContent; | ||
| 111 | +// | ||
| 112 | +// public short getCompanyCode() { | ||
| 113 | +// return companyCode; | ||
| 114 | +// } | ||
| 115 | +// | ||
| 116 | +// public void setCompanyCode(short companyCode) { | ||
| 117 | +// this.companyCode = companyCode; | ||
| 118 | +// } | ||
| 119 | +// | ||
| 120 | +// public String getDeviceId() { | ||
| 121 | +// return deviceId; | ||
| 122 | +// } | ||
| 123 | +// | ||
| 124 | +// public void setDeviceId(String deviceId) { | ||
| 125 | +// this.deviceId = deviceId; | ||
| 126 | +// } | ||
| 127 | +// | ||
| 128 | +// public Long getTimestamp() { | ||
| 129 | +// return timestamp; | ||
| 130 | +// } | ||
| 131 | +// | ||
| 132 | +// public void setTimestamp(Long timestamp) { | ||
| 133 | +// this.timestamp = timestamp; | ||
| 134 | +// } | ||
| 135 | +// | ||
| 136 | +// public short getInstructType() { | ||
| 137 | +// return instructType; | ||
| 138 | +// } | ||
| 139 | +// | ||
| 140 | +// public void setInstructType(short instructType) { | ||
| 141 | +// this.instructType = instructType; | ||
| 142 | +// } | ||
| 143 | +// | ||
| 144 | +// public Short getDispatchInstruct() { | ||
| 145 | +// return dispatchInstruct; | ||
| 146 | +// } | ||
| 147 | +// | ||
| 148 | +// public void setDispatchInstruct(Short dispatchInstruct) { | ||
| 149 | +// this.dispatchInstruct = dispatchInstruct; | ||
| 150 | +// } | ||
| 151 | +// | ||
| 152 | +// public int getMsgId() { | ||
| 153 | +// return msgId; | ||
| 154 | +// } | ||
| 155 | +// | ||
| 156 | +// public void setMsgId(int msgId) { | ||
| 157 | +// this.msgId = msgId; | ||
| 158 | +// } | ||
| 159 | +// | ||
| 160 | +// public Long getAlarmTime() { | ||
| 161 | +// return alarmTime; | ||
| 162 | +// } | ||
| 163 | +// | ||
| 164 | +// public void setAlarmTime(Long alarmTime) { | ||
| 165 | +// this.alarmTime = alarmTime; | ||
| 166 | +// } | ||
| 167 | +// | ||
| 168 | +// public Long getServiceState() { | ||
| 169 | +// return serviceState; | ||
| 170 | +// } | ||
| 171 | +// | ||
| 172 | +// public void setServiceState(Long serviceState) { | ||
| 173 | +// this.serviceState = serviceState; | ||
| 174 | +// } | ||
| 175 | +// | ||
| 176 | +// public String getTxtContent() { | ||
| 177 | +// return txtContent; | ||
| 178 | +// } | ||
| 179 | +// | ||
| 180 | +// public void setTxtContent(String txtContent) { | ||
| 181 | +// this.txtContent = txtContent; | ||
| 182 | +// } | ||
| 183 | +// } | ||
| 184 | +// | ||
| 185 | +// public Integer getId() { | ||
| 186 | +// return id; | ||
| 187 | +// } | ||
| 188 | +// | ||
| 189 | +// public void setId(Integer id) { | ||
| 190 | +// this.id = id; | ||
| 191 | +// } | ||
| 192 | +// | ||
| 193 | +// public short getOperCode() { | ||
| 194 | +// return operCode; | ||
| 195 | +// } | ||
| 196 | +// | ||
| 197 | +// public void setOperCode(short operCode) { | ||
| 198 | +// this.operCode = operCode; | ||
| 199 | +// } | ||
| 200 | +// | ||
| 201 | +// public DirectiveData getData() { | ||
| 202 | +// return data; | ||
| 203 | +// } | ||
| 204 | +// | ||
| 205 | +// public void setData(DirectiveData data) { | ||
| 206 | +// this.data = data; | ||
| 207 | +// } | ||
| 208 | +// | ||
| 209 | +// public Integer getMsgId() { | ||
| 210 | +// if(this.msgId != null) | ||
| 211 | +// return this.msgId; | ||
| 212 | +// else | ||
| 213 | +// return this.getData().getMsgId(); | ||
| 214 | +// } | ||
| 215 | +// | ||
| 216 | +// public void setMsgId(Integer msgId) { | ||
| 217 | +// this.msgId = msgId; | ||
| 218 | +// } | ||
| 219 | +// | ||
| 220 | +// @Override | ||
| 221 | +// public void setTimestamp(Long timestamp) { | ||
| 222 | +// if(this.data != null) | ||
| 223 | +// this.data.setTimestamp(timestamp); | ||
| 224 | +// | ||
| 225 | +// this.timestamp = timestamp; | ||
| 226 | +// } | ||
| 227 | +// | ||
| 228 | +// @Override | ||
| 229 | +// public void setDeviceId(String deviceId) { | ||
| 230 | +// if(this.data != null) | ||
| 231 | +// this.data.setDeviceId(deviceId); | ||
| 232 | +// | ||
| 233 | +// this.deviceId = deviceId; | ||
| 234 | +// } | ||
| 235 | +// | ||
| 236 | +// public Short getReply46() { | ||
| 237 | +// return reply46; | ||
| 238 | +// } | ||
| 239 | +// | ||
| 240 | +// public void setReply46(Short reply46) { | ||
| 241 | +// this.reply46 = reply46; | ||
| 242 | +// } | ||
| 243 | +// | ||
| 244 | +// public Short getReply47() { | ||
| 245 | +// return reply47; | ||
| 246 | +// } | ||
| 247 | +// | ||
| 248 | +// public void setReply47(Short reply47) { | ||
| 249 | +// this.reply47 = reply47; | ||
| 250 | +// } | ||
| 251 | +// | ||
| 252 | +// public boolean isDispatch() { | ||
| 253 | +// return isDispatch; | ||
| 254 | +// } | ||
| 255 | +// | ||
| 256 | +// public void setDispatch(boolean isDispatch) { | ||
| 257 | +// this.isDispatch = isDispatch; | ||
| 258 | +// } | ||
| 259 | +// | ||
| 260 | +// public ScheduleRealInfo getSch() { | ||
| 261 | +// return sch; | ||
| 262 | +// } | ||
| 263 | +// | ||
| 264 | +// public void setSch(ScheduleRealInfo sch) { | ||
| 265 | +// this.sch = sch; | ||
| 266 | +// } | ||
| 267 | +//} |
src/main/java/com/bsth/entity/directive/D64.java
| 1 | -package com.bsth.entity.directive; | ||
| 2 | - | ||
| 3 | -import javax.persistence.Table; | ||
| 4 | -import javax.persistence.Transient; | ||
| 5 | -import javax.persistence.Embeddable; | ||
| 6 | -import javax.persistence.Entity; | ||
| 7 | -import javax.persistence.GeneratedValue; | ||
| 8 | -import javax.persistence.Id; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * | ||
| 12 | - * @ClassName: D64 | ||
| 13 | - * @Description: TODO(线路切换指令) | ||
| 14 | - * @author PanZhao | ||
| 15 | - * @date 2016年6月8日 下午1:41:15 | ||
| 16 | - * | ||
| 17 | - */ | ||
| 18 | -@Entity | ||
| 19 | -@Table(name = "bsth_v_directive_64") | ||
| 20 | -public class D64 extends Directive{ | ||
| 21 | - | ||
| 22 | - @Id | ||
| 23 | - @GeneratedValue | ||
| 24 | - private Integer id; | ||
| 25 | - | ||
| 26 | - /** | ||
| 27 | - * 设备响应应答字 | ||
| 28 | - * 0x06同意 0x15不同意 | ||
| 29 | - */ | ||
| 30 | - private Short respAck; | ||
| 31 | - | ||
| 32 | - private LineChangeData data; | ||
| 33 | - | ||
| 34 | - @Embeddable | ||
| 35 | - public static class LineChangeData { | ||
| 36 | - | ||
| 37 | - private Short cityCode; | ||
| 38 | - | ||
| 39 | - @Transient | ||
| 40 | - private String deviceId; | ||
| 41 | - | ||
| 42 | - private String lineId; | ||
| 43 | - | ||
| 44 | - public Short getCityCode() { | ||
| 45 | - return cityCode; | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - public void setCityCode(Short cityCode) { | ||
| 49 | - this.cityCode = cityCode; | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - public String getDeviceId() { | ||
| 53 | - return deviceId; | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - public void setDeviceId(String deviceId) { | ||
| 57 | - this.deviceId = deviceId; | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - public String getLineId() { | ||
| 61 | - return lineId; | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - public void setLineId(String lineId) { | ||
| 65 | - this.lineId = lineId; | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - public Integer getId() { | ||
| 70 | - return id; | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - public void setId(Integer id) { | ||
| 74 | - this.id = id; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - public LineChangeData getData() { | ||
| 78 | - return data; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - public void setData(LineChangeData data) { | ||
| 82 | - this.data = data; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - public Short getRespAck() { | ||
| 86 | - return respAck; | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - public void setRespAck(Short respAck) { | ||
| 90 | - this.respAck = respAck; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - @Override | ||
| 94 | - public void setDeviceId(String deviceId) { | ||
| 95 | - if(this.data != null) | ||
| 96 | - this.data.setDeviceId(deviceId); | ||
| 97 | - | ||
| 98 | - this.deviceId = deviceId; | ||
| 99 | - } | ||
| 100 | -} | 1 | +//package com.bsth.entity.directive; |
| 2 | +// | ||
| 3 | +//import javax.persistence.Table; | ||
| 4 | +//import javax.persistence.Transient; | ||
| 5 | +//import javax.persistence.Embeddable; | ||
| 6 | +//import javax.persistence.Entity; | ||
| 7 | +//import javax.persistence.GeneratedValue; | ||
| 8 | +//import javax.persistence.Id; | ||
| 9 | +// | ||
| 10 | +///** | ||
| 11 | +// * | ||
| 12 | +// * @ClassName: D64 | ||
| 13 | +// * @Description: TODO(线路切换指令) | ||
| 14 | +// * @author PanZhao | ||
| 15 | +// * @date 2016年6月8日 下午1:41:15 | ||
| 16 | +// * | ||
| 17 | +// */ | ||
| 18 | +//@Entity | ||
| 19 | +//@Table(name = "bsth_v_directive_64") | ||
| 20 | +//public class D64 extends Directive{ | ||
| 21 | +// | ||
| 22 | +// @Id | ||
| 23 | +// @GeneratedValue | ||
| 24 | +// private Integer id; | ||
| 25 | +// | ||
| 26 | +// /** | ||
| 27 | +// * 设备响应应答字 | ||
| 28 | +// * 0x06同意 0x15不同意 | ||
| 29 | +// */ | ||
| 30 | +// private Short respAck; | ||
| 31 | +// | ||
| 32 | +// private LineChangeData data; | ||
| 33 | +// | ||
| 34 | +// @Embeddable | ||
| 35 | +// public static class LineChangeData { | ||
| 36 | +// | ||
| 37 | +// private Short cityCode; | ||
| 38 | +// | ||
| 39 | +// @Transient | ||
| 40 | +// private String deviceId; | ||
| 41 | +// | ||
| 42 | +// private String lineId; | ||
| 43 | +// | ||
| 44 | +// public Short getCityCode() { | ||
| 45 | +// return cityCode; | ||
| 46 | +// } | ||
| 47 | +// | ||
| 48 | +// public void setCityCode(Short cityCode) { | ||
| 49 | +// this.cityCode = cityCode; | ||
| 50 | +// } | ||
| 51 | +// | ||
| 52 | +// public String getDeviceId() { | ||
| 53 | +// return deviceId; | ||
| 54 | +// } | ||
| 55 | +// | ||
| 56 | +// public void setDeviceId(String deviceId) { | ||
| 57 | +// this.deviceId = deviceId; | ||
| 58 | +// } | ||
| 59 | +// | ||
| 60 | +// public String getLineId() { | ||
| 61 | +// return lineId; | ||
| 62 | +// } | ||
| 63 | +// | ||
| 64 | +// public void setLineId(String lineId) { | ||
| 65 | +// this.lineId = lineId; | ||
| 66 | +// } | ||
| 67 | +// } | ||
| 68 | +// | ||
| 69 | +// public Integer getId() { | ||
| 70 | +// return id; | ||
| 71 | +// } | ||
| 72 | +// | ||
| 73 | +// public void setId(Integer id) { | ||
| 74 | +// this.id = id; | ||
| 75 | +// } | ||
| 76 | +// | ||
| 77 | +// public LineChangeData getData() { | ||
| 78 | +// return data; | ||
| 79 | +// } | ||
| 80 | +// | ||
| 81 | +// public void setData(LineChangeData data) { | ||
| 82 | +// this.data = data; | ||
| 83 | +// } | ||
| 84 | +// | ||
| 85 | +// public Short getRespAck() { | ||
| 86 | +// return respAck; | ||
| 87 | +// } | ||
| 88 | +// | ||
| 89 | +// public void setRespAck(Short respAck) { | ||
| 90 | +// this.respAck = respAck; | ||
| 91 | +// } | ||
| 92 | +// | ||
| 93 | +// @Override | ||
| 94 | +// public void setDeviceId(String deviceId) { | ||
| 95 | +// if(this.data != null) | ||
| 96 | +// this.data.setDeviceId(deviceId); | ||
| 97 | +// | ||
| 98 | +// this.deviceId = deviceId; | ||
| 99 | +// } | ||
| 100 | +//} |
src/main/java/com/bsth/entity/directive/D80.java
| 1 | -package com.bsth.entity.directive; | ||
| 2 | - | ||
| 3 | -import java.util.Date; | ||
| 4 | - | ||
| 5 | -import javax.persistence.CascadeType; | ||
| 6 | -import javax.persistence.Embeddable; | ||
| 7 | -import javax.persistence.Entity; | ||
| 8 | -import javax.persistence.FetchType; | ||
| 9 | -import javax.persistence.GeneratedValue; | ||
| 10 | -import javax.persistence.Id; | ||
| 11 | -import javax.persistence.NamedAttributeNode; | ||
| 12 | -import javax.persistence.NamedEntityGraph; | ||
| 13 | -import javax.persistence.NamedEntityGraphs; | ||
| 14 | -import javax.persistence.OneToOne; | ||
| 15 | -import javax.persistence.Table; | ||
| 16 | -import javax.persistence.Transient; | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * | ||
| 20 | - * @ClassName: D80 | ||
| 21 | - * @Description: TODO(驾驶员上报) | ||
| 22 | - * @author PanZhao | ||
| 23 | - * @date 2016年6月8日 下午12:36:42 | ||
| 24 | - * | ||
| 25 | - */ | ||
| 26 | -@Entity | ||
| 27 | -@Table(name = "bsth_v_report_80") | ||
| 28 | -@NamedEntityGraphs({ | ||
| 29 | - @NamedEntityGraph(name = "directive80_c0", attributeNodes = { | ||
| 30 | - @NamedAttributeNode("c0") | ||
| 31 | - }) | ||
| 32 | -}) | ||
| 33 | -public class D80 { | ||
| 34 | - | ||
| 35 | - @Id | ||
| 36 | - @GeneratedValue | ||
| 37 | - private Integer id; | ||
| 38 | - | ||
| 39 | - /** | ||
| 40 | - * 设备编号 | ||
| 41 | - */ | ||
| 42 | - private String deviceId; | ||
| 43 | - | ||
| 44 | - /** | ||
| 45 | - * 时间戳(ms) | ||
| 46 | - */ | ||
| 47 | - private Long timestamp; | ||
| 48 | - | ||
| 49 | - /** | ||
| 50 | - * 一级协议 0xC0 | ||
| 51 | - */ | ||
| 52 | - private Short operCode; | ||
| 53 | - | ||
| 54 | - private DriverReportData data; | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * c0 回复 | ||
| 58 | - */ | ||
| 59 | - @OneToOne(cascade = CascadeType.ALL, fetch=FetchType.LAZY) | ||
| 60 | - private DC0 c0; | ||
| 61 | - | ||
| 62 | - /** 调度员是否确认 */ | ||
| 63 | - private boolean confirm; | ||
| 64 | - | ||
| 65 | - /** 处理人 */ | ||
| 66 | - private String handleUser; | ||
| 67 | - | ||
| 68 | - /** 处理结果 0:同意 -1:不同意 */ | ||
| 69 | - private int confirmRs; | ||
| 70 | - | ||
| 71 | - /** 处理时间 */ | ||
| 72 | - private Date handleTime; | ||
| 73 | - | ||
| 74 | - @Embeddable | ||
| 75 | - public static class DriverReportData { | ||
| 76 | - | ||
| 77 | - /** | ||
| 78 | - * 0x86 | ||
| 79 | - */ | ||
| 80 | - private Short operCode2; | ||
| 81 | - | ||
| 82 | - /** | ||
| 83 | - * 请求代码 0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 | ||
| 84 | - * 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 | ||
| 85 | - */ | ||
| 86 | - private Short requestCode; | ||
| 87 | - | ||
| 88 | - /** | ||
| 89 | - * 线路编码 | ||
| 90 | - */ | ||
| 91 | - private Integer lineId; | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * 车辆内部编码 | ||
| 95 | - */ | ||
| 96 | - @Transient | ||
| 97 | - private String nbbm; | ||
| 98 | - | ||
| 99 | - public Short getOperCode2() { | ||
| 100 | - return operCode2; | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - public void setOperCode2(Short operCode2) { | ||
| 104 | - this.operCode2 = operCode2; | ||
| 105 | - } | ||
| 106 | - | ||
| 107 | - public Short getRequestCode() { | ||
| 108 | - return requestCode; | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - public void setRequestCode(Short requestCode) { | ||
| 112 | - this.requestCode = requestCode; | ||
| 113 | - } | ||
| 114 | - | ||
| 115 | - public Integer getLineId() { | ||
| 116 | - return lineId; | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - public void setLineId(Integer lineId) { | ||
| 120 | - this.lineId = lineId; | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - public String getNbbm() { | ||
| 124 | - return nbbm; | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - public void setNbbm(String nbbm) { | ||
| 128 | - this.nbbm = nbbm; | ||
| 129 | - } | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - @Transient | ||
| 133 | - private String timeStr; | ||
| 134 | - | ||
| 135 | - public Integer getId() { | ||
| 136 | - return id; | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - public void setId(Integer id) { | ||
| 140 | - this.id = id; | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - public String getDeviceId() { | ||
| 144 | - return deviceId; | ||
| 145 | - } | ||
| 146 | - | ||
| 147 | - public void setDeviceId(String deviceId) { | ||
| 148 | - this.deviceId = deviceId; | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - public Long getTimestamp() { | ||
| 152 | - return timestamp; | ||
| 153 | - } | ||
| 154 | - | ||
| 155 | - public void setTimestamp(Long timestamp) { | ||
| 156 | - this.timestamp = timestamp; | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | - public Short getOperCode() { | ||
| 160 | - return operCode; | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - public void setOperCode(Short operCode) { | ||
| 164 | - this.operCode = operCode; | ||
| 165 | - } | ||
| 166 | - | ||
| 167 | - public DriverReportData getData() { | ||
| 168 | - return data; | ||
| 169 | - } | ||
| 170 | - | ||
| 171 | - public void setData(DriverReportData data) { | ||
| 172 | - this.data = data; | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - public DC0 getC0() { | ||
| 176 | - return c0; | ||
| 177 | - } | ||
| 178 | - | ||
| 179 | - public void setC0(DC0 c0) { | ||
| 180 | - this.c0 = c0; | ||
| 181 | - } | ||
| 182 | - | ||
| 183 | - public boolean isConfirm() { | ||
| 184 | - return confirm; | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - public void setConfirm(boolean confirm) { | ||
| 188 | - this.confirm = confirm; | ||
| 189 | - } | ||
| 190 | - | ||
| 191 | - public int getConfirmRs() { | ||
| 192 | - return confirmRs; | ||
| 193 | - } | ||
| 194 | - | ||
| 195 | - public void setConfirmRs(int confirmRs) { | ||
| 196 | - this.confirmRs = confirmRs; | ||
| 197 | - } | ||
| 198 | - | ||
| 199 | - public String getHandleUser() { | ||
| 200 | - return handleUser; | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - public void setHandleUser(String handleUser) { | ||
| 204 | - this.handleUser = handleUser; | ||
| 205 | - } | ||
| 206 | - | ||
| 207 | - public String getTimeStr() { | ||
| 208 | - return timeStr; | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | - public void setTimeStr(String timeStr) { | ||
| 212 | - this.timeStr = timeStr; | ||
| 213 | - } | ||
| 214 | - | ||
| 215 | - public Date getHandleTime() { | ||
| 216 | - return handleTime; | ||
| 217 | - } | ||
| 218 | - | ||
| 219 | - public void setHandleTime(Date handleTime) { | ||
| 220 | - this.handleTime = handleTime; | ||
| 221 | - } | ||
| 222 | -} | 1 | +//package com.bsth.entity.directive; |
| 2 | +// | ||
| 3 | +//import java.util.Date; | ||
| 4 | +// | ||
| 5 | +//import javax.persistence.CascadeType; | ||
| 6 | +//import javax.persistence.Embeddable; | ||
| 7 | +//import javax.persistence.Entity; | ||
| 8 | +//import javax.persistence.FetchType; | ||
| 9 | +//import javax.persistence.GeneratedValue; | ||
| 10 | +//import javax.persistence.Id; | ||
| 11 | +//import javax.persistence.NamedAttributeNode; | ||
| 12 | +//import javax.persistence.NamedEntityGraph; | ||
| 13 | +//import javax.persistence.NamedEntityGraphs; | ||
| 14 | +//import javax.persistence.OneToOne; | ||
| 15 | +//import javax.persistence.Table; | ||
| 16 | +//import javax.persistence.Transient; | ||
| 17 | +// | ||
| 18 | +///** | ||
| 19 | +// * | ||
| 20 | +// * @ClassName: D80 | ||
| 21 | +// * @Description: TODO(驾驶员上报) | ||
| 22 | +// * @author PanZhao | ||
| 23 | +// * @date 2016年6月8日 下午12:36:42 | ||
| 24 | +// * | ||
| 25 | +// */ | ||
| 26 | +//@Entity | ||
| 27 | +//@Table(name = "bsth_v_report_80") | ||
| 28 | +//@NamedEntityGraphs({ | ||
| 29 | +// @NamedEntityGraph(name = "directive80_c0", attributeNodes = { | ||
| 30 | +// @NamedAttributeNode("c0") | ||
| 31 | +// }) | ||
| 32 | +//}) | ||
| 33 | +//public class D80 { | ||
| 34 | +// | ||
| 35 | +// @Id | ||
| 36 | +// @GeneratedValue | ||
| 37 | +// private Integer id; | ||
| 38 | +// | ||
| 39 | +// /** | ||
| 40 | +// * 设备编号 | ||
| 41 | +// */ | ||
| 42 | +// private String deviceId; | ||
| 43 | +// | ||
| 44 | +// /** | ||
| 45 | +// * 时间戳(ms) | ||
| 46 | +// */ | ||
| 47 | +// private Long timestamp; | ||
| 48 | +// | ||
| 49 | +// /** | ||
| 50 | +// * 一级协议 0xC0 | ||
| 51 | +// */ | ||
| 52 | +// private Short operCode; | ||
| 53 | +// | ||
| 54 | +// private DriverReportData data; | ||
| 55 | +// | ||
| 56 | +// /** | ||
| 57 | +// * c0 回复 | ||
| 58 | +// */ | ||
| 59 | +// @OneToOne(cascade = CascadeType.ALL, fetch=FetchType.LAZY) | ||
| 60 | +// private DC0 c0; | ||
| 61 | +// | ||
| 62 | +// /** 调度员是否确认 */ | ||
| 63 | +// private boolean confirm; | ||
| 64 | +// | ||
| 65 | +// /** 处理人 */ | ||
| 66 | +// private String handleUser; | ||
| 67 | +// | ||
| 68 | +// /** 处理结果 0:同意 -1:不同意 */ | ||
| 69 | +// private int confirmRs; | ||
| 70 | +// | ||
| 71 | +// /** 处理时间 */ | ||
| 72 | +// private Date handleTime; | ||
| 73 | +// | ||
| 74 | +// @Embeddable | ||
| 75 | +// public static class DriverReportData { | ||
| 76 | +// | ||
| 77 | +// /** | ||
| 78 | +// * 0x86 | ||
| 79 | +// */ | ||
| 80 | +// private Short operCode2; | ||
| 81 | +// | ||
| 82 | +// /** | ||
| 83 | +// * 请求代码 0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 | ||
| 84 | +// * 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 | ||
| 85 | +// */ | ||
| 86 | +// private Short requestCode; | ||
| 87 | +// | ||
| 88 | +// /** | ||
| 89 | +// * 线路编码 | ||
| 90 | +// */ | ||
| 91 | +// private Integer lineId; | ||
| 92 | +// | ||
| 93 | +// /** | ||
| 94 | +// * 车辆内部编码 | ||
| 95 | +// */ | ||
| 96 | +// @Transient | ||
| 97 | +// private String nbbm; | ||
| 98 | +// | ||
| 99 | +// public Short getOperCode2() { | ||
| 100 | +// return operCode2; | ||
| 101 | +// } | ||
| 102 | +// | ||
| 103 | +// public void setOperCode2(Short operCode2) { | ||
| 104 | +// this.operCode2 = operCode2; | ||
| 105 | +// } | ||
| 106 | +// | ||
| 107 | +// public Short getRequestCode() { | ||
| 108 | +// return requestCode; | ||
| 109 | +// } | ||
| 110 | +// | ||
| 111 | +// public void setRequestCode(Short requestCode) { | ||
| 112 | +// this.requestCode = requestCode; | ||
| 113 | +// } | ||
| 114 | +// | ||
| 115 | +// public Integer getLineId() { | ||
| 116 | +// return lineId; | ||
| 117 | +// } | ||
| 118 | +// | ||
| 119 | +// public void setLineId(Integer lineId) { | ||
| 120 | +// this.lineId = lineId; | ||
| 121 | +// } | ||
| 122 | +// | ||
| 123 | +// public String getNbbm() { | ||
| 124 | +// return nbbm; | ||
| 125 | +// } | ||
| 126 | +// | ||
| 127 | +// public void setNbbm(String nbbm) { | ||
| 128 | +// this.nbbm = nbbm; | ||
| 129 | +// } | ||
| 130 | +// } | ||
| 131 | +// | ||
| 132 | +// @Transient | ||
| 133 | +// private String timeStr; | ||
| 134 | +// | ||
| 135 | +// public Integer getId() { | ||
| 136 | +// return id; | ||
| 137 | +// } | ||
| 138 | +// | ||
| 139 | +// public void setId(Integer id) { | ||
| 140 | +// this.id = id; | ||
| 141 | +// } | ||
| 142 | +// | ||
| 143 | +// public String getDeviceId() { | ||
| 144 | +// return deviceId; | ||
| 145 | +// } | ||
| 146 | +// | ||
| 147 | +// public void setDeviceId(String deviceId) { | ||
| 148 | +// this.deviceId = deviceId; | ||
| 149 | +// } | ||
| 150 | +// | ||
| 151 | +// public Long getTimestamp() { | ||
| 152 | +// return timestamp; | ||
| 153 | +// } | ||
| 154 | +// | ||
| 155 | +// public void setTimestamp(Long timestamp) { | ||
| 156 | +// this.timestamp = timestamp; | ||
| 157 | +// } | ||
| 158 | +// | ||
| 159 | +// public Short getOperCode() { | ||
| 160 | +// return operCode; | ||
| 161 | +// } | ||
| 162 | +// | ||
| 163 | +// public void setOperCode(Short operCode) { | ||
| 164 | +// this.operCode = operCode; | ||
| 165 | +// } | ||
| 166 | +// | ||
| 167 | +// public DriverReportData getData() { | ||
| 168 | +// return data; | ||
| 169 | +// } | ||
| 170 | +// | ||
| 171 | +// public void setData(DriverReportData data) { | ||
| 172 | +// this.data = data; | ||
| 173 | +// } | ||
| 174 | +// | ||
| 175 | +// public DC0 getC0() { | ||
| 176 | +// return c0; | ||
| 177 | +// } | ||
| 178 | +// | ||
| 179 | +// public void setC0(DC0 c0) { | ||
| 180 | +// this.c0 = c0; | ||
| 181 | +// } | ||
| 182 | +// | ||
| 183 | +// public boolean isConfirm() { | ||
| 184 | +// return confirm; | ||
| 185 | +// } | ||
| 186 | +// | ||
| 187 | +// public void setConfirm(boolean confirm) { | ||
| 188 | +// this.confirm = confirm; | ||
| 189 | +// } | ||
| 190 | +// | ||
| 191 | +// public int getConfirmRs() { | ||
| 192 | +// return confirmRs; | ||
| 193 | +// } | ||
| 194 | +// | ||
| 195 | +// public void setConfirmRs(int confirmRs) { | ||
| 196 | +// this.confirmRs = confirmRs; | ||
| 197 | +// } | ||
| 198 | +// | ||
| 199 | +// public String getHandleUser() { | ||
| 200 | +// return handleUser; | ||
| 201 | +// } | ||
| 202 | +// | ||
| 203 | +// public void setHandleUser(String handleUser) { | ||
| 204 | +// this.handleUser = handleUser; | ||
| 205 | +// } | ||
| 206 | +// | ||
| 207 | +// public String getTimeStr() { | ||
| 208 | +// return timeStr; | ||
| 209 | +// } | ||
| 210 | +// | ||
| 211 | +// public void setTimeStr(String timeStr) { | ||
| 212 | +// this.timeStr = timeStr; | ||
| 213 | +// } | ||
| 214 | +// | ||
| 215 | +// public Date getHandleTime() { | ||
| 216 | +// return handleTime; | ||
| 217 | +// } | ||
| 218 | +// | ||
| 219 | +// public void setHandleTime(Date handleTime) { | ||
| 220 | +// this.handleTime = handleTime; | ||
| 221 | +// } | ||
| 222 | +//} |
src/main/java/com/bsth/entity/directive/DC0.java
| 1 | -package com.bsth.entity.directive; | ||
| 2 | - | ||
| 3 | -import javax.persistence.Embeddable; | ||
| 4 | -import javax.persistence.Entity; | ||
| 5 | -import javax.persistence.GeneratedValue; | ||
| 6 | -import javax.persistence.Id; | ||
| 7 | -import javax.persistence.Table; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * | ||
| 11 | - * @ClassName: DC0 | ||
| 12 | - * @Description: TODO(C0协议,回复驾驶员上报) | ||
| 13 | - * @author PanZhao | ||
| 14 | - * @date 2016年7月8日 上午10:19:23 | ||
| 15 | - * | ||
| 16 | - */ | ||
| 17 | -@Entity | ||
| 18 | -@Table(name = "bsth_v_C0") | ||
| 19 | -public class DC0 { | ||
| 20 | - | ||
| 21 | - @Id | ||
| 22 | - @GeneratedValue | ||
| 23 | - private Integer id; | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * 设备号 | ||
| 27 | - */ | ||
| 28 | - private String deviceId; | ||
| 29 | - | ||
| 30 | - /** | ||
| 31 | - * 时间戳 | ||
| 32 | - */ | ||
| 33 | - private Long timestamp; | ||
| 34 | - | ||
| 35 | - /** | ||
| 36 | - * 一级协议 | ||
| 37 | - */ | ||
| 38 | - private Short operCode; | ||
| 39 | - | ||
| 40 | - private DC0Data data; | ||
| 41 | - | ||
| 42 | - @Embeddable | ||
| 43 | - public static class DC0Data { | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * 二级协议 | ||
| 47 | - */ | ||
| 48 | - private Short operCode2; | ||
| 49 | - | ||
| 50 | - /** | ||
| 51 | - * 请求应答字 0x06同意 0x15不同意 | ||
| 52 | - */ | ||
| 53 | - private Short requestAck; | ||
| 54 | - | ||
| 55 | - public Short getOperCode2() { | ||
| 56 | - return operCode2; | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - public void setOperCode2(Short operCode2) { | ||
| 60 | - this.operCode2 = operCode2; | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - public Short getRequestAck() { | ||
| 64 | - return requestAck; | ||
| 65 | - } | ||
| 66 | - | ||
| 67 | - public void setRequestAck(Short requestAck) { | ||
| 68 | - this.requestAck = requestAck; | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - public Integer getId() { | ||
| 73 | - return id; | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - public void setId(Integer id) { | ||
| 77 | - this.id = id; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - public String getDeviceId() { | ||
| 81 | - return deviceId; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - public void setDeviceId(String deviceId) { | ||
| 85 | - this.deviceId = deviceId; | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - public Long getTimestamp() { | ||
| 89 | - return timestamp; | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - public void setTimestamp(Long timestamp) { | ||
| 93 | - this.timestamp = timestamp; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - public Short getOperCode() { | ||
| 97 | - return operCode; | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - public void setOperCode(Short operCode) { | ||
| 101 | - this.operCode = operCode; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - public DC0Data getData() { | ||
| 105 | - return data; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - public void setData(DC0Data data) { | ||
| 109 | - this.data = data; | ||
| 110 | - } | ||
| 111 | -} | 1 | +//package com.bsth.entity.directive; |
| 2 | +// | ||
| 3 | +//import javax.persistence.Embeddable; | ||
| 4 | +//import javax.persistence.Entity; | ||
| 5 | +//import javax.persistence.GeneratedValue; | ||
| 6 | +//import javax.persistence.Id; | ||
| 7 | +//import javax.persistence.Table; | ||
| 8 | +// | ||
| 9 | +///** | ||
| 10 | +// * | ||
| 11 | +// * @ClassName: DC0 | ||
| 12 | +// * @Description: TODO(C0协议,回复驾驶员上报) | ||
| 13 | +// * @author PanZhao | ||
| 14 | +// * @date 2016年7月8日 上午10:19:23 | ||
| 15 | +// * | ||
| 16 | +// */ | ||
| 17 | +//@Entity | ||
| 18 | +//@Table(name = "bsth_v_C0") | ||
| 19 | +//public class DC0 { | ||
| 20 | +// | ||
| 21 | +// @Id | ||
| 22 | +// @GeneratedValue | ||
| 23 | +// private Integer id; | ||
| 24 | +// | ||
| 25 | +// /** | ||
| 26 | +// * 设备号 | ||
| 27 | +// */ | ||
| 28 | +// private String deviceId; | ||
| 29 | +// | ||
| 30 | +// /** | ||
| 31 | +// * 时间戳 | ||
| 32 | +// */ | ||
| 33 | +// private Long timestamp; | ||
| 34 | +// | ||
| 35 | +// /** | ||
| 36 | +// * 一级协议 | ||
| 37 | +// */ | ||
| 38 | +// private Short operCode; | ||
| 39 | +// | ||
| 40 | +// private DC0Data data; | ||
| 41 | +// | ||
| 42 | +// @Embeddable | ||
| 43 | +// public static class DC0Data { | ||
| 44 | +// | ||
| 45 | +// /** | ||
| 46 | +// * 二级协议 | ||
| 47 | +// */ | ||
| 48 | +// private Short operCode2; | ||
| 49 | +// | ||
| 50 | +// /** | ||
| 51 | +// * 请求应答字 0x06同意 0x15不同意 | ||
| 52 | +// */ | ||
| 53 | +// private Short requestAck; | ||
| 54 | +// | ||
| 55 | +// public Short getOperCode2() { | ||
| 56 | +// return operCode2; | ||
| 57 | +// } | ||
| 58 | +// | ||
| 59 | +// public void setOperCode2(Short operCode2) { | ||
| 60 | +// this.operCode2 = operCode2; | ||
| 61 | +// } | ||
| 62 | +// | ||
| 63 | +// public Short getRequestAck() { | ||
| 64 | +// return requestAck; | ||
| 65 | +// } | ||
| 66 | +// | ||
| 67 | +// public void setRequestAck(Short requestAck) { | ||
| 68 | +// this.requestAck = requestAck; | ||
| 69 | +// } | ||
| 70 | +// } | ||
| 71 | +// | ||
| 72 | +// public Integer getId() { | ||
| 73 | +// return id; | ||
| 74 | +// } | ||
| 75 | +// | ||
| 76 | +// public void setId(Integer id) { | ||
| 77 | +// this.id = id; | ||
| 78 | +// } | ||
| 79 | +// | ||
| 80 | +// public String getDeviceId() { | ||
| 81 | +// return deviceId; | ||
| 82 | +// } | ||
| 83 | +// | ||
| 84 | +// public void setDeviceId(String deviceId) { | ||
| 85 | +// this.deviceId = deviceId; | ||
| 86 | +// } | ||
| 87 | +// | ||
| 88 | +// public Long getTimestamp() { | ||
| 89 | +// return timestamp; | ||
| 90 | +// } | ||
| 91 | +// | ||
| 92 | +// public void setTimestamp(Long timestamp) { | ||
| 93 | +// this.timestamp = timestamp; | ||
| 94 | +// } | ||
| 95 | +// | ||
| 96 | +// public Short getOperCode() { | ||
| 97 | +// return operCode; | ||
| 98 | +// } | ||
| 99 | +// | ||
| 100 | +// public void setOperCode(Short operCode) { | ||
| 101 | +// this.operCode = operCode; | ||
| 102 | +// } | ||
| 103 | +// | ||
| 104 | +// public DC0Data getData() { | ||
| 105 | +// return data; | ||
| 106 | +// } | ||
| 107 | +// | ||
| 108 | +// public void setData(DC0Data data) { | ||
| 109 | +// this.data = data; | ||
| 110 | +// } | ||
| 111 | +//} |
src/main/java/com/bsth/entity/directive/Directive.java
| 1 | -package com.bsth.entity.directive; | ||
| 2 | - | ||
| 3 | -import javax.persistence.MappedSuperclass; | ||
| 4 | -import javax.persistence.Transient; | ||
| 5 | - | ||
| 6 | -/** | ||
| 7 | - * | ||
| 8 | - * @ClassName: Directive | ||
| 9 | - * @Description: TODO(指令基础类) | ||
| 10 | - * @author PanZhao | ||
| 11 | - * @date 2016年7月31日 下午8:35:56 | ||
| 12 | - * | ||
| 13 | - */ | ||
| 14 | -@MappedSuperclass | ||
| 15 | -public class Directive { | ||
| 16 | - | ||
| 17 | - /** | ||
| 18 | - * 一级协议 | ||
| 19 | - */ | ||
| 20 | - protected short operCode; | ||
| 21 | - | ||
| 22 | - /** | ||
| 23 | - * 设备号 | ||
| 24 | - */ | ||
| 25 | - protected String deviceId; | ||
| 26 | - | ||
| 27 | - /** | ||
| 28 | - * 时间戳 | ||
| 29 | - */ | ||
| 30 | - protected Long timestamp; | ||
| 31 | - | ||
| 32 | - /** | ||
| 33 | - * 时间 HH:mm | ||
| 34 | - */ | ||
| 35 | - @Transient | ||
| 36 | - private String timeHHmm; | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | - * 车辆内部编码 | ||
| 40 | - */ | ||
| 41 | - @Transient | ||
| 42 | - private String nbbm; | ||
| 43 | - | ||
| 44 | - private String errorText; | ||
| 45 | - | ||
| 46 | - private int httpCode; | ||
| 47 | - | ||
| 48 | - /** | ||
| 49 | - * 发送人 | ||
| 50 | - */ | ||
| 51 | - private String sender; | ||
| 52 | - | ||
| 53 | - public short getOperCode() { | ||
| 54 | - return operCode; | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - public void setOperCode(short operCode) { | ||
| 58 | - this.operCode = operCode; | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - public String getDeviceId() { | ||
| 62 | - return deviceId; | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - public void setDeviceId(String deviceId) { | ||
| 66 | - this.deviceId = deviceId; | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - public Long getTimestamp() { | ||
| 70 | - return timestamp; | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - public void setTimestamp(Long timestamp) { | ||
| 74 | - this.timestamp = timestamp; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - public String getTimeHHmm() { | ||
| 78 | - return timeHHmm; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - public void setTimeHHmm(String timeHHmm) { | ||
| 82 | - this.timeHHmm = timeHHmm; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - public String getNbbm() { | ||
| 86 | - return nbbm; | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - public void setNbbm(String nbbm) { | ||
| 90 | - this.nbbm = nbbm; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - public String getErrorText() { | ||
| 94 | - return errorText; | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - public void setErrorText(String errorText) { | ||
| 98 | - this.errorText = errorText; | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - public int getHttpCode() { | ||
| 102 | - return httpCode; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - public void setHttpCode(int httpCode) { | ||
| 106 | - this.httpCode = httpCode; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - public String getSender() { | ||
| 110 | - return sender; | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - public void setSender(String sender) { | ||
| 114 | - this.sender = sender; | ||
| 115 | - } | ||
| 116 | -} | 1 | +//package com.bsth.entity.directive; |
| 2 | +// | ||
| 3 | +//import javax.persistence.MappedSuperclass; | ||
| 4 | +//import javax.persistence.Transient; | ||
| 5 | +// | ||
| 6 | +///** | ||
| 7 | +// * | ||
| 8 | +// * @ClassName: Directive | ||
| 9 | +// * @Description: TODO(指令基础类) | ||
| 10 | +// * @author PanZhao | ||
| 11 | +// * @date 2016年7月31日 下午8:35:56 | ||
| 12 | +// * | ||
| 13 | +// */ | ||
| 14 | +//@MappedSuperclass | ||
| 15 | +//public class Directive { | ||
| 16 | +// | ||
| 17 | +// /** | ||
| 18 | +// * 一级协议 | ||
| 19 | +// */ | ||
| 20 | +// protected short operCode; | ||
| 21 | +// | ||
| 22 | +// /** | ||
| 23 | +// * 设备号 | ||
| 24 | +// */ | ||
| 25 | +// protected String deviceId; | ||
| 26 | +// | ||
| 27 | +// /** | ||
| 28 | +// * 时间戳 | ||
| 29 | +// */ | ||
| 30 | +// protected Long timestamp; | ||
| 31 | +// | ||
| 32 | +// /** | ||
| 33 | +// * 时间 HH:mm | ||
| 34 | +// */ | ||
| 35 | +// @Transient | ||
| 36 | +// private String timeHHmm; | ||
| 37 | +// | ||
| 38 | +// /** | ||
| 39 | +// * 车辆内部编码 | ||
| 40 | +// */ | ||
| 41 | +// @Transient | ||
| 42 | +// private String nbbm; | ||
| 43 | +// | ||
| 44 | +// private String errorText; | ||
| 45 | +// | ||
| 46 | +// private int httpCode; | ||
| 47 | +// | ||
| 48 | +// /** | ||
| 49 | +// * 发送人 | ||
| 50 | +// */ | ||
| 51 | +// private String sender; | ||
| 52 | +// | ||
| 53 | +// public short getOperCode() { | ||
| 54 | +// return operCode; | ||
| 55 | +// } | ||
| 56 | +// | ||
| 57 | +// public void setOperCode(short operCode) { | ||
| 58 | +// this.operCode = operCode; | ||
| 59 | +// } | ||
| 60 | +// | ||
| 61 | +// public String getDeviceId() { | ||
| 62 | +// return deviceId; | ||
| 63 | +// } | ||
| 64 | +// | ||
| 65 | +// public void setDeviceId(String deviceId) { | ||
| 66 | +// this.deviceId = deviceId; | ||
| 67 | +// } | ||
| 68 | +// | ||
| 69 | +// public Long getTimestamp() { | ||
| 70 | +// return timestamp; | ||
| 71 | +// } | ||
| 72 | +// | ||
| 73 | +// public void setTimestamp(Long timestamp) { | ||
| 74 | +// this.timestamp = timestamp; | ||
| 75 | +// } | ||
| 76 | +// | ||
| 77 | +// public String getTimeHHmm() { | ||
| 78 | +// return timeHHmm; | ||
| 79 | +// } | ||
| 80 | +// | ||
| 81 | +// public void setTimeHHmm(String timeHHmm) { | ||
| 82 | +// this.timeHHmm = timeHHmm; | ||
| 83 | +// } | ||
| 84 | +// | ||
| 85 | +// public String getNbbm() { | ||
| 86 | +// return nbbm; | ||
| 87 | +// } | ||
| 88 | +// | ||
| 89 | +// public void setNbbm(String nbbm) { | ||
| 90 | +// this.nbbm = nbbm; | ||
| 91 | +// } | ||
| 92 | +// | ||
| 93 | +// public String getErrorText() { | ||
| 94 | +// return errorText; | ||
| 95 | +// } | ||
| 96 | +// | ||
| 97 | +// public void setErrorText(String errorText) { | ||
| 98 | +// this.errorText = errorText; | ||
| 99 | +// } | ||
| 100 | +// | ||
| 101 | +// public int getHttpCode() { | ||
| 102 | +// return httpCode; | ||
| 103 | +// } | ||
| 104 | +// | ||
| 105 | +// public void setHttpCode(int httpCode) { | ||
| 106 | +// this.httpCode = httpCode; | ||
| 107 | +// } | ||
| 108 | +// | ||
| 109 | +// public String getSender() { | ||
| 110 | +// return sender; | ||
| 111 | +// } | ||
| 112 | +// | ||
| 113 | +// public void setSender(String sender) { | ||
| 114 | +// this.sender = sender; | ||
| 115 | +// } | ||
| 116 | +//} |
src/main/java/com/bsth/repository/directive/D60Repository.java
| 1 | -package com.bsth.repository.directive; | ||
| 2 | - | ||
| 3 | -import java.util.List; | ||
| 4 | - | ||
| 5 | -import org.springframework.data.domain.Page; | ||
| 6 | -import org.springframework.data.domain.Pageable; | ||
| 7 | -import org.springframework.data.jpa.domain.Specification; | ||
| 8 | -import org.springframework.data.jpa.repository.EntityGraph; | ||
| 9 | -import org.springframework.data.jpa.repository.Query; | ||
| 10 | -import org.springframework.stereotype.Repository; | ||
| 11 | - | ||
| 12 | -import com.bsth.entity.directive.D60; | ||
| 13 | -import com.bsth.repository.BaseRepository; | ||
| 14 | - | ||
| 15 | -@Repository | ||
| 16 | -public interface D60Repository extends BaseRepository<D60, Integer>{ | ||
| 17 | - | ||
| 18 | - @EntityGraph(value = "directive60_sch", type = EntityGraph.EntityGraphType.FETCH) | ||
| 19 | - @Query("select d from Directive60 d where d.timestamp > ?1") | ||
| 20 | - public List<D60> findByGtTime(Long ts); | ||
| 21 | - | ||
| 22 | - @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(msg_id) as num FROM bsth_v_directive_60) d", nativeQuery = true) | ||
| 23 | - Integer maxMsgId(); | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - @EntityGraph(value = "directive60_sch", type = EntityGraph.EntityGraphType.FETCH) | ||
| 27 | - @Override | ||
| 28 | - Page<D60> findAll(Specification<D60> spec, Pageable pageable); | ||
| 29 | - | ||
| 30 | - @EntityGraph(value = "directive60_sch", type = EntityGraph.EntityGraphType.FETCH) | ||
| 31 | - @Override | ||
| 32 | - List<D60> findAll(Specification<D60> spec); | ||
| 33 | -} | 1 | +//package com.bsth.repository.directive; |
| 2 | +// | ||
| 3 | +//import java.util.List; | ||
| 4 | +// | ||
| 5 | +//import org.springframework.data.domain.Page; | ||
| 6 | +//import org.springframework.data.domain.Pageable; | ||
| 7 | +//import org.springframework.data.jpa.domain.Specification; | ||
| 8 | +//import org.springframework.data.jpa.repository.EntityGraph; | ||
| 9 | +//import org.springframework.data.jpa.repository.Query; | ||
| 10 | +//import org.springframework.stereotype.Repository; | ||
| 11 | +// | ||
| 12 | +//import com.bsth.entity.directive.D60; | ||
| 13 | +//import com.bsth.repository.BaseRepository; | ||
| 14 | +// | ||
| 15 | +//@Repository | ||
| 16 | +//public interface D60Repository extends BaseRepository<D60, Integer>{ | ||
| 17 | +// | ||
| 18 | +// @EntityGraph(value = "directive60_sch", type = EntityGraph.EntityGraphType.FETCH) | ||
| 19 | +// @Query("select d from Directive60 d where d.timestamp > ?1") | ||
| 20 | +// public List<D60> findByGtTime(Long ts); | ||
| 21 | +// | ||
| 22 | +// @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(msg_id) as num FROM bsth_v_directive_60) d", nativeQuery = true) | ||
| 23 | +// Integer maxMsgId(); | ||
| 24 | +// | ||
| 25 | +// | ||
| 26 | +// @EntityGraph(value = "directive60_sch", type = EntityGraph.EntityGraphType.FETCH) | ||
| 27 | +// @Override | ||
| 28 | +// Page<D60> findAll(Specification<D60> spec, Pageable pageable); | ||
| 29 | +// | ||
| 30 | +// @EntityGraph(value = "directive60_sch", type = EntityGraph.EntityGraphType.FETCH) | ||
| 31 | +// @Override | ||
| 32 | +// List<D60> findAll(Specification<D60> spec); | ||
| 33 | +//} |
src/main/java/com/bsth/repository/directive/D64Repository.java
| 1 | -package com.bsth.repository.directive; | ||
| 2 | - | ||
| 3 | -import org.springframework.stereotype.Repository; | ||
| 4 | - | ||
| 5 | -import com.bsth.entity.directive.D64; | ||
| 6 | -import com.bsth.repository.BaseRepository; | ||
| 7 | - | ||
| 8 | -@Repository | ||
| 9 | -public interface D64Repository extends BaseRepository<D64, Integer>{ | ||
| 10 | - | ||
| 11 | -} | 1 | +//package com.bsth.repository.directive; |
| 2 | +// | ||
| 3 | +//import org.springframework.stereotype.Repository; | ||
| 4 | +// | ||
| 5 | +//import com.bsth.entity.directive.D64; | ||
| 6 | +//import com.bsth.repository.BaseRepository; | ||
| 7 | +// | ||
| 8 | +//@Repository | ||
| 9 | +//public interface D64Repository extends BaseRepository<D64, Integer>{ | ||
| 10 | +// | ||
| 11 | +//} |
src/main/java/com/bsth/repository/directive/D80Repository.java
| 1 | -package com.bsth.repository.directive; | ||
| 2 | - | ||
| 3 | -import java.util.List; | ||
| 4 | - | ||
| 5 | -import org.springframework.data.domain.Page; | ||
| 6 | -import org.springframework.data.domain.Pageable; | ||
| 7 | -import org.springframework.data.jpa.domain.Specification; | ||
| 8 | -import org.springframework.data.jpa.repository.EntityGraph; | ||
| 9 | -import org.springframework.data.jpa.repository.Query; | ||
| 10 | -import org.springframework.stereotype.Repository; | ||
| 11 | - | ||
| 12 | -import com.bsth.entity.directive.D80; | ||
| 13 | -import com.bsth.repository.BaseRepository; | ||
| 14 | - | ||
| 15 | -@Repository | ||
| 16 | -public interface D80Repository extends BaseRepository<D80, Integer>{ | ||
| 17 | - | ||
| 18 | - @EntityGraph(value = "directive80_c0", type = EntityGraph.EntityGraphType.FETCH) | ||
| 19 | - @Override | ||
| 20 | - Page<D80> findAll(Specification<D80> spec, Pageable pageable); | ||
| 21 | - | ||
| 22 | - @EntityGraph(value = "directive80_c0", type = EntityGraph.EntityGraphType.FETCH) | ||
| 23 | - @Query("select d from Directive80 d where d.timestamp > ?1") | ||
| 24 | - List<D80> findByGtTime(long timestamp); | ||
| 25 | -} | 1 | +//package com.bsth.repository.directive; |
| 2 | +// | ||
| 3 | +//import java.util.List; | ||
| 4 | +// | ||
| 5 | +//import org.springframework.data.domain.Page; | ||
| 6 | +//import org.springframework.data.domain.Pageable; | ||
| 7 | +//import org.springframework.data.jpa.domain.Specification; | ||
| 8 | +//import org.springframework.data.jpa.repository.EntityGraph; | ||
| 9 | +//import org.springframework.data.jpa.repository.Query; | ||
| 10 | +//import org.springframework.stereotype.Repository; | ||
| 11 | +// | ||
| 12 | +//import com.bsth.entity.directive.D80; | ||
| 13 | +//import com.bsth.repository.BaseRepository; | ||
| 14 | +// | ||
| 15 | +//@Repository | ||
| 16 | +//public interface D80Repository extends BaseRepository<D80, Integer>{ | ||
| 17 | +// | ||
| 18 | +// @EntityGraph(value = "directive80_c0", type = EntityGraph.EntityGraphType.FETCH) | ||
| 19 | +// @Override | ||
| 20 | +// Page<D80> findAll(Specification<D80> spec, Pageable pageable); | ||
| 21 | +// | ||
| 22 | +// @EntityGraph(value = "directive80_c0", type = EntityGraph.EntityGraphType.FETCH) | ||
| 23 | +// @Query("select d from Directive80 d where d.timestamp > ?1") | ||
| 24 | +// List<D80> findByGtTime(long timestamp); | ||
| 25 | +//} |
src/main/java/com/bsth/repository/directive/DC0Repository.java
| 1 | -package com.bsth.repository.directive; | ||
| 2 | - | ||
| 3 | -import org.springframework.stereotype.Repository; | ||
| 4 | - | ||
| 5 | -import com.bsth.entity.directive.DC0; | ||
| 6 | -import com.bsth.repository.BaseRepository; | ||
| 7 | - | ||
| 8 | -@Repository | ||
| 9 | -public interface DC0Repository extends BaseRepository<DC0, Integer>{ | ||
| 10 | - | ||
| 11 | -} | 1 | +//package com.bsth.repository.directive; |
| 2 | +// | ||
| 3 | +//import org.springframework.stereotype.Repository; | ||
| 4 | +// | ||
| 5 | +//import com.bsth.entity.directive.DC0; | ||
| 6 | +//import com.bsth.repository.BaseRepository; | ||
| 7 | +// | ||
| 8 | +//@Repository | ||
| 9 | +//public interface DC0Repository extends BaseRepository<DC0, Integer>{ | ||
| 10 | +// | ||
| 11 | +//} |
src/main/java/com/bsth/service/directive/DirectiveService.java
| 1 | -package com.bsth.service.directive; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | -import java.util.List; | ||
| 5 | -import java.util.Map; | ||
| 6 | - | ||
| 7 | -import org.springframework.data.domain.Page; | ||
| 8 | -import org.springframework.data.domain.PageRequest; | ||
| 9 | - | ||
| 10 | -import com.bsth.entity.directive.D60; | ||
| 11 | -import com.bsth.entity.directive.D80; | ||
| 12 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 13 | -import com.bsth.service.BaseService; | ||
| 14 | - | ||
| 15 | -public interface DirectiveService extends BaseService<D60, Integer>{ | ||
| 16 | - | ||
| 17 | - /** | ||
| 18 | - * | ||
| 19 | - * @Title: send60Phrase | ||
| 20 | - * @Description: TODO(60短语下发) | ||
| 21 | - * @param @param nbbm 车辆内部编码 | ||
| 22 | - * @param @param text 短语 | ||
| 23 | - * @return int 返回类型 | ||
| 24 | - * @throws | ||
| 25 | - */ | ||
| 26 | - int send60Phrase(String nbbm, String text, String sender); | ||
| 27 | - | ||
| 28 | - /** | ||
| 29 | - * | ||
| 30 | - * @Title: send60Dispatch | ||
| 31 | - * @Description: TODO(调度指令下发) | ||
| 32 | - * @param @param sch 要下发的班次 | ||
| 33 | - * @param @param finish 已完成的班次数 | ||
| 34 | - * @throws | ||
| 35 | - */ | ||
| 36 | - int send60Dispatch(ScheduleRealInfo sch, int finish, String sender); | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | - * | ||
| 40 | - * @Title: send60Dispatch | ||
| 41 | - * @Description: TODO(调度指令下发) | ||
| 42 | - * @param @param id 班次ID | ||
| 43 | - * @throws | ||
| 44 | - */ | ||
| 45 | - int send60Dispatch(Long id, String sender); | ||
| 46 | - | ||
| 47 | - //60营运指令 | ||
| 48 | - int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender); | ||
| 49 | - | ||
| 50 | - /** | ||
| 51 | - * | ||
| 52 | - * @Title: lineChange | ||
| 53 | - * @Description: TODO(线路切换) | ||
| 54 | - * @param @param nbbm 车辆内部编码 | ||
| 55 | - * @param @param lineId 新线路编码 | ||
| 56 | - * @throws | ||
| 57 | - */ | ||
| 58 | - int lineChange(String nbbm, Integer lineId, String sender); | ||
| 59 | - | ||
| 60 | - /** | ||
| 61 | - * | ||
| 62 | - * @Title: upDownChange | ||
| 63 | - * @Description: TODO(切换上下行) | ||
| 64 | - * @param @param nbbm 车辆内部编码 | ||
| 65 | - * @param @param upDonw 上下行 0 上行 1 下行 | ||
| 66 | - * @throws | ||
| 67 | - */ | ||
| 68 | - int upDownChange(String nbbm, Integer upDown, String sender); | ||
| 69 | - | ||
| 70 | - /** | ||
| 71 | - * | ||
| 72 | - * @Title: sendDirectiveState | ||
| 73 | - * @Description: TODO(向页面推送班次指令状态) | ||
| 74 | - * @throws | ||
| 75 | - */ | ||
| 76 | - void sendDirectiveToPage(ScheduleRealInfo sch); | ||
| 77 | - | ||
| 78 | - Map<String, List<D80>> findNoCofm80(String lineCodes); | ||
| 79 | - | ||
| 80 | - Map<String, Object> reply80(int id, int reply); | ||
| 81 | - | ||
| 82 | - Map<String, Object> findDirective(String nbbm, int dType, int page, int size); | ||
| 83 | - | ||
| 84 | - Page<D80> findAll80(Map<String, Object> map, PageRequest pageRequest); | ||
| 85 | -} | 1 | +//package com.bsth.service.directive; |
| 2 | +// | ||
| 3 | +// | ||
| 4 | +//import java.util.List; | ||
| 5 | +//import java.util.Map; | ||
| 6 | +// | ||
| 7 | +//import org.springframework.data.domain.Page; | ||
| 8 | +//import org.springframework.data.domain.PageRequest; | ||
| 9 | +// | ||
| 10 | +//import com.bsth.entity.directive.D60; | ||
| 11 | +//import com.bsth.entity.directive.D80; | ||
| 12 | +//import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 13 | +//import com.bsth.service.BaseService; | ||
| 14 | +// | ||
| 15 | +//public interface DirectiveService extends BaseService<D60, Integer>{ | ||
| 16 | +// | ||
| 17 | +// /** | ||
| 18 | +// * | ||
| 19 | +// * @Title: send60Phrase | ||
| 20 | +// * @Description: TODO(60短语下发) | ||
| 21 | +// * @param @param nbbm 车辆内部编码 | ||
| 22 | +// * @param @param text 短语 | ||
| 23 | +// * @return int 返回类型 | ||
| 24 | +// * @throws | ||
| 25 | +// */ | ||
| 26 | +// int send60Phrase(String nbbm, String text, String sender); | ||
| 27 | +// | ||
| 28 | +// /** | ||
| 29 | +// * | ||
| 30 | +// * @Title: send60Dispatch | ||
| 31 | +// * @Description: TODO(调度指令下发) | ||
| 32 | +// * @param @param sch 要下发的班次 | ||
| 33 | +// * @param @param finish 已完成的班次数 | ||
| 34 | +// * @throws | ||
| 35 | +// */ | ||
| 36 | +// int send60Dispatch(ScheduleRealInfo sch, int finish, String sender); | ||
| 37 | +// | ||
| 38 | +// /** | ||
| 39 | +// * | ||
| 40 | +// * @Title: send60Dispatch | ||
| 41 | +// * @Description: TODO(调度指令下发) | ||
| 42 | +// * @param @param id 班次ID | ||
| 43 | +// * @throws | ||
| 44 | +// */ | ||
| 45 | +// int send60Dispatch(Long id, String sender); | ||
| 46 | +// | ||
| 47 | +// //60营运指令 | ||
| 48 | +// int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender); | ||
| 49 | +// | ||
| 50 | +// /** | ||
| 51 | +// * | ||
| 52 | +// * @Title: lineChange | ||
| 53 | +// * @Description: TODO(线路切换) | ||
| 54 | +// * @param @param nbbm 车辆内部编码 | ||
| 55 | +// * @param @param lineId 新线路编码 | ||
| 56 | +// * @throws | ||
| 57 | +// */ | ||
| 58 | +// int lineChange(String nbbm, Integer lineId, String sender); | ||
| 59 | +// | ||
| 60 | +// /** | ||
| 61 | +// * | ||
| 62 | +// * @Title: upDownChange | ||
| 63 | +// * @Description: TODO(切换上下行) | ||
| 64 | +// * @param @param nbbm 车辆内部编码 | ||
| 65 | +// * @param @param upDonw 上下行 0 上行 1 下行 | ||
| 66 | +// * @throws | ||
| 67 | +// */ | ||
| 68 | +// int upDownChange(String nbbm, Integer upDown, String sender); | ||
| 69 | +// | ||
| 70 | +// /** | ||
| 71 | +// * | ||
| 72 | +// * @Title: sendDirectiveState | ||
| 73 | +// * @Description: TODO(向页面推送班次指令状态) | ||
| 74 | +// * @throws | ||
| 75 | +// */ | ||
| 76 | +// void sendDirectiveToPage(ScheduleRealInfo sch); | ||
| 77 | +// | ||
| 78 | +// Map<String, List<D80>> findNoCofm80(String lineCodes); | ||
| 79 | +// | ||
| 80 | +// Map<String, Object> reply80(int id, int reply); | ||
| 81 | +// | ||
| 82 | +// Map<String, Object> findDirective(String nbbm, int dType, int page, int size); | ||
| 83 | +// | ||
| 84 | +// Page<D80> findAll80(Map<String, Object> map, PageRequest pageRequest); | ||
| 85 | +//} |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| 1 | -package com.bsth.service.directive; | ||
| 2 | - | ||
| 3 | -import java.text.SimpleDateFormat; | ||
| 4 | -import java.util.ArrayList; | ||
| 5 | -import java.util.Collections; | ||
| 6 | -import java.util.Date; | ||
| 7 | -import java.util.HashMap; | ||
| 8 | -import java.util.List; | ||
| 9 | -import java.util.Map; | ||
| 10 | - | ||
| 11 | -import org.apache.commons.lang3.StringUtils; | ||
| 12 | -import org.slf4j.Logger; | ||
| 13 | -import org.slf4j.LoggerFactory; | ||
| 14 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | -import org.springframework.data.domain.Page; | ||
| 16 | -import org.springframework.data.domain.PageRequest; | ||
| 17 | -import org.springframework.stereotype.Service; | ||
| 18 | - | ||
| 19 | -import com.alibaba.fastjson.JSON; | ||
| 20 | -import com.alibaba.fastjson.JSONObject; | ||
| 21 | -import com.bsth.common.ResponseCode; | ||
| 22 | -import com.bsth.entity.directive.D60; | ||
| 23 | -import com.bsth.entity.directive.D64; | ||
| 24 | -import com.bsth.entity.directive.D80; | ||
| 25 | -import com.bsth.entity.directive.DC0; | ||
| 26 | -import com.bsth.entity.directive.DC0.DC0Data; | ||
| 27 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 28 | -import com.bsth.entity.search.CustomerSpecs; | ||
| 29 | -import com.bsth.entity.sys.SysUser; | ||
| 30 | -import com.bsth.repository.directive.D60Repository; | ||
| 31 | -import com.bsth.repository.directive.D64Repository; | ||
| 32 | -import com.bsth.repository.directive.D80Repository; | ||
| 33 | -import com.bsth.security.util.SecurityUtils; | ||
| 34 | -import com.bsth.service.impl.BaseServiceImpl; | ||
| 35 | -import com.bsth.service.realcontrol.buffer.ScheduleBuffer; | ||
| 36 | -import com.bsth.util.DateUtils; | ||
| 37 | -import com.bsth.vehicle.common.CommonMapped; | ||
| 38 | -import com.bsth.vehicle.directive.buffer.DirectiveBuffer; | ||
| 39 | -import com.bsth.vehicle.directive.entity.Directive; | ||
| 40 | -import com.bsth.vehicle.directive.util.DirectiveDataFactory; | ||
| 41 | -import com.bsth.vehicle.directive.util.HttpUtils; | ||
| 42 | -import com.bsth.vehicle.gpsdata.buffer.GpsRealDataBuffer; | ||
| 43 | -import com.bsth.vehicle.gpsdata.entity.GpsRealData; | ||
| 44 | -import com.bsth.websocket.handler.RealControlSocketHandler; | ||
| 45 | -import com.google.common.base.Splitter; | ||
| 46 | - | ||
| 47 | -@Service | ||
| 48 | -public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implements DirectiveService { | ||
| 49 | - | ||
| 50 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 51 | - | ||
| 52 | - @Autowired | ||
| 53 | - D60Repository d60Repository; | ||
| 54 | - | ||
| 55 | - @Autowired | ||
| 56 | - GpsRealDataBuffer gpsRealDataBuffer; | ||
| 57 | - | ||
| 58 | - @Autowired | ||
| 59 | - D64Repository d64Repository; | ||
| 60 | - | ||
| 61 | - @Autowired | ||
| 62 | - RealControlSocketHandler socketHandler; | ||
| 63 | - | ||
| 64 | - @Autowired | ||
| 65 | - D80Repository d80Repository; | ||
| 66 | - | ||
| 67 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH点mm分"), sdfHHmm2 = new SimpleDateFormat("HH:mm"); | ||
| 68 | - | ||
| 69 | - static Long schDiff = 1000 * 60 * 60L; | ||
| 70 | - | ||
| 71 | - @Override | ||
| 72 | - public int send60Phrase(String nbbm, String text, String sender) { | ||
| 73 | - D60 directive = null; | ||
| 74 | - try { | ||
| 75 | - directive = create60Data(nbbm, text, (short) 0x00, null); | ||
| 76 | - } catch (Exception e) { | ||
| 77 | - logger.error("发送消息短语出现异常", e); | ||
| 78 | - return -1; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - if (null == directive) | ||
| 82 | - return -1; | ||
| 83 | - | ||
| 84 | - // 发送指令 | ||
| 85 | - int code = HttpUtils.postJson(JSON.toJSONString(directive)); | ||
| 86 | - if(null != sender) | ||
| 87 | - directive.setSender(sender); | ||
| 88 | - directive.setHttpCode(code); | ||
| 89 | - // 添加到缓存,等待入库 | ||
| 90 | - //DirectiveBuffer.put(directive); | ||
| 91 | - | ||
| 92 | - if (code != 0) { | ||
| 93 | - directive.setErrorText("网关通讯失败, code: " + code); | ||
| 94 | - //DirectiveBuffer.transientList.add(directive); | ||
| 95 | - } | ||
| 96 | - return code; | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - @Override | ||
| 100 | - public int send60Dispatch(ScheduleRealInfo sch, int finish, String sender) { | ||
| 101 | - D60 directive = null; | ||
| 102 | - try { | ||
| 103 | - // 如果发车时间距当前时间较远,则不发送 | ||
| 104 | - /*if (Math.abs(sch.getFcsjT() - System.currentTimeMillis()) > schDiff) { | ||
| 105 | - return -2; | ||
| 106 | - }*/ | ||
| 107 | - | ||
| 108 | - String text = "已完成" + finish + "个班次,下一发车时间" + sdfHHmm.format(new Date(sch.getDfsjT())) + ",由" | ||
| 109 | - + sch.getQdzName() + "发往" + sch.getZdzName(); | ||
| 110 | - | ||
| 111 | - ScheduleRealInfo nextSch = ScheduleBuffer.getNext(sch); | ||
| 112 | - //下发0x02指令 调度指令(闹钟有效) | ||
| 113 | - /*directive = DirectiveDataFactory.createDirective6002(sch.getClZbh(), text, (short) 0x02 | ||
| 114 | - , Integer.parseInt(nextSch.getXlDir()), 0, new Date(System.currentTimeMillis() + 1000 * 30));*/ | ||
| 115 | - } catch (Exception e) { | ||
| 116 | - logger.error("生成调度指令时出现异常", e); | ||
| 117 | - return -1; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - if (null == directive) | ||
| 121 | - return -1; | ||
| 122 | - if(null != sender) | ||
| 123 | - directive.setSender(sender); | ||
| 124 | - else | ||
| 125 | - directive.setSender("系统"); | ||
| 126 | - | ||
| 127 | - // 发送指令 | ||
| 128 | - int code = HttpUtils.postJson(JSON.toJSONString(directive)); | ||
| 129 | - | ||
| 130 | - sch.setDirectiveState(60); | ||
| 131 | - // 添加到缓存,等待入库 | ||
| 132 | - directive.setDispatch(true); | ||
| 133 | - directive.setSch(sch); | ||
| 134 | - directive.setHttpCode(code); | ||
| 135 | - //DirectiveBuffer.put(directive); | ||
| 136 | - | ||
| 137 | - if (code == 0) { | ||
| 138 | - // 通知页面,消息已发出 | ||
| 139 | - sendDirectiveToPage(sch); | ||
| 140 | - } else { | ||
| 141 | - directive.setErrorText("网关通讯失败, code: " + code); | ||
| 142 | - //DirectiveBuffer.transientList.add(directive); | ||
| 143 | - } | ||
| 144 | - return code; | ||
| 145 | - } | ||
| 146 | - | ||
| 147 | - /** | ||
| 148 | - * | ||
| 149 | - * @Title: sendDirectiveState @Description: TODO(向页面推送班次指令状态) @throws | ||
| 150 | - */ | ||
| 151 | - @Override | ||
| 152 | - public void sendDirectiveToPage(ScheduleRealInfo sch) { | ||
| 153 | - JSONObject json = new JSONObject(); | ||
| 154 | - json.put("fn", "directive"); | ||
| 155 | - json.put("t", sch); | ||
| 156 | - socketHandler.sendMessageToLine(Integer.parseInt(sch.getXlBm()), json.toJSONString()); | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | - @Override | ||
| 160 | - public int send60Dispatch(Long id, String sender) { | ||
| 161 | - ScheduleRealInfo sch = ScheduleBuffer.findOne(id); | ||
| 162 | - // 车辆已完成班次 | ||
| 163 | - int finish = ScheduleBuffer.getFinishSchNo(sch.getClZbh()); | ||
| 164 | - return send60Dispatch(sch, finish, sender); | ||
| 165 | - } | ||
| 166 | - | ||
| 167 | - @Override | ||
| 168 | - public int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender) { | ||
| 169 | - logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); | ||
| 170 | - | ||
| 171 | - String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); | ||
| 172 | - D60 directive = /*DirectiveDataFactory.createDirective60(nbbm, text, (short) 0x03, upDown, state)*/null; | ||
| 173 | - | ||
| 174 | - if (null == directive) | ||
| 175 | - return -1; | ||
| 176 | - if(null != sender) | ||
| 177 | - directive.setSender(sender); | ||
| 178 | - else | ||
| 179 | - directive.setSender("系统"); | ||
| 180 | - // 发送指令 | ||
| 181 | - int code = HttpUtils.postJson(JSON.toJSONString(directive)); | ||
| 182 | - // 添加到缓存,等待入库 | ||
| 183 | - directive.setHttpCode(code); | ||
| 184 | - if (null != sch) | ||
| 185 | - directive.setSch(sch); | ||
| 186 | - //DirectiveBuffer.put(directive); | ||
| 187 | - | ||
| 188 | - if (code != 0) { | ||
| 189 | - directive.setErrorText("网关通讯失败, code: " + code); | ||
| 190 | - //DirectiveBuffer.transientList.add(directive); | ||
| 191 | - } | ||
| 192 | - return code; | ||
| 193 | - } | ||
| 194 | - | ||
| 195 | - /** | ||
| 196 | - * 线路切换 | ||
| 197 | - */ | ||
| 198 | - @Override | ||
| 199 | - public int lineChange(String nbbm, Integer lineCode, String sender) { | ||
| 200 | - Long t = System.currentTimeMillis(); | ||
| 201 | - /*String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | ||
| 202 | - | ||
| 203 | - Directive64 change = new Directive64(); | ||
| 204 | - LineChangeData data = new LineChangeData(); | ||
| 205 | - data.setCityCode(cityCode); | ||
| 206 | - data.setDeviceId(deviceId); | ||
| 207 | - data.setLineId("00" + String.valueOf(lineCode)); | ||
| 208 | - | ||
| 209 | - change.setDeviceId(deviceId); | ||
| 210 | - change.setOperCode((short) 0X64); | ||
| 211 | - change.setTimestamp(t); | ||
| 212 | - change.setData(data);*/ | ||
| 213 | - D64 d64 = /*DirectiveDataFactory.createDirective64(nbbm, lineCode, t)*/null; | ||
| 214 | - | ||
| 215 | - if(null != sender) | ||
| 216 | - d64.setSender(sender); | ||
| 217 | - else | ||
| 218 | - d64.setSender("系统"); | ||
| 219 | - | ||
| 220 | - String deviceId = d64.getDeviceId(); | ||
| 221 | - int code = HttpUtils.postJson(JSON.toJSONString(d64)); | ||
| 222 | - // 入库 | ||
| 223 | - d64.setHttpCode(code); | ||
| 224 | - //DirectiveBuffer.changeMap.put(deviceId + '_' + t, d64); | ||
| 225 | - | ||
| 226 | - // 通知设备刷新线路文件,忽略结果 | ||
| 227 | - if (code == 0) | ||
| 228 | - HttpUtils.postJson(DirectiveDataFactory.createDeviceRefreshData(deviceId, lineCode)); | ||
| 229 | - else | ||
| 230 | - d64.setErrorText("网关通讯失败, code: " + code); | ||
| 231 | - | ||
| 232 | - d64Repository.save(d64); | ||
| 233 | - return code; | ||
| 234 | - } | ||
| 235 | - | ||
| 236 | - public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) { | ||
| 237 | - | ||
| 238 | - String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | ||
| 239 | - if (null == deviceId) { | ||
| 240 | - logger.error("没有设备号对照的车辆:" + nbbm); | ||
| 241 | - return null; | ||
| 242 | - } | ||
| 243 | - // 上下行和营运状态 | ||
| 244 | - Integer upDown = null, state = null; | ||
| 245 | - if (null == sch) { | ||
| 246 | - GpsRealData gpsData = gpsRealDataBuffer.findOneByDeviceId(deviceId); | ||
| 247 | - if (null == gpsData) { | ||
| 248 | - logger.error("没有找到gps对照,无法确认营运状态和上下行:" + nbbm); | ||
| 249 | - return null; | ||
| 250 | - } | ||
| 251 | - upDown = gpsData.getUpDown(); | ||
| 252 | - state = gpsData.getState(); | ||
| 253 | - } else { | ||
| 254 | - upDown = Integer.parseInt(sch.getXlDir()); | ||
| 255 | - state = 0; | ||
| 256 | - } | ||
| 257 | - | ||
| 258 | - return /*DirectiveDataFactory.createDirective60(nbbm, text, dispatchInstruct, upDown, state)*/null; | ||
| 259 | - } | ||
| 260 | - | ||
| 261 | -/* public Directive60 createDirective60(String nbbm, String text, Short dispatchInstruct, int upDown, int state) { | ||
| 262 | - Long timestamp = System.currentTimeMillis(); | ||
| 263 | - | ||
| 264 | - Short company = Short.parseShort(CommonMapped.vehicCompanyMap.get(nbbm)); | ||
| 265 | - String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | ||
| 266 | - | ||
| 267 | - int msgId = MsgIdGenerator.getMsgId(); | ||
| 268 | - | ||
| 269 | - Directive60 directive = new Directive60(); | ||
| 270 | - DirectiveData data = new DirectiveData(); | ||
| 271 | - // 一级协议 | ||
| 272 | - directive.setOperCode((short) 0x60); | ||
| 273 | - // 设备号 | ||
| 274 | - directive.setDeviceId(deviceId); | ||
| 275 | - // 时间戳 | ||
| 276 | - directive.setTimestamp(timestamp); | ||
| 277 | - directive.setMsgId(msgId); | ||
| 278 | - // 构造数据 | ||
| 279 | - data.setDeviceId(deviceId); | ||
| 280 | - data.setDispatchInstruct(dispatchInstruct); | ||
| 281 | - data.setTimestamp(timestamp); | ||
| 282 | - data.setCompanyCode(company); | ||
| 283 | - data.setMsgId(msgId); | ||
| 284 | - directive.setData(data); | ||
| 285 | - long serviceState; | ||
| 286 | - try { | ||
| 287 | - serviceState = Consts.SERVICE_STATE[upDown][state]; | ||
| 288 | - } catch (IndexOutOfBoundsException e) { | ||
| 289 | - // 未知营运状态的直接默认为上行非营运 | ||
| 290 | - serviceState = Consts.SERVICE_STATE[0][1]; | ||
| 291 | - } | ||
| 292 | - data.setServiceState(serviceState); | ||
| 293 | - data.setTxtContent(text); | ||
| 294 | - | ||
| 295 | - return directive; | ||
| 296 | - }*/ | ||
| 297 | - | ||
| 298 | - @Override | ||
| 299 | - public int upDownChange(String nbbm, Integer upDown, String sender) { | ||
| 300 | - return send60Operation(nbbm, 0, upDown, null, sender); | ||
| 301 | - } | ||
| 302 | - | ||
| 303 | - /** | ||
| 304 | - * | ||
| 305 | - * @Title: createDeviceRefreshData @Description: | ||
| 306 | - * TODO(生成设备线路刷新数据包) @param @return 设定文件 @return String 返回类型 @throws | ||
| 307 | - */ | ||
| 308 | -/* public String createDeviceRefreshData(String deviceId, Integer lineId) { | ||
| 309 | - Long t = System.currentTimeMillis(); | ||
| 310 | - Map<String, Object> param = new HashMap<String, Object>(); | ||
| 311 | - param.put("deviceId", deviceId); | ||
| 312 | - param.put("timestamp", t); | ||
| 313 | - param.put("operCode", 0Xc0); | ||
| 314 | - | ||
| 315 | - Map<String, Object> data = new HashMap<String, Object>(); | ||
| 316 | - data.put("operCode2", 0xa1); | ||
| 317 | - data.put("cityCode", cityCode); | ||
| 318 | - data.put("deviceId", deviceId); | ||
| 319 | - data.put("timestamp", t); | ||
| 320 | - data.put("centerId", 1); | ||
| 321 | - data.put("lineId", lineId); | ||
| 322 | - data.put("lineVersion", 0); | ||
| 323 | - data.put("carparkDataVersion", 0); | ||
| 324 | - param.put("data", data); | ||
| 325 | - | ||
| 326 | - return JSON.toJSONString(param); | ||
| 327 | - }*/ | ||
| 328 | - | ||
| 329 | - @Override | ||
| 330 | - public Map<String, List<D80>> findNoCofm80(String lineCodes) { | ||
| 331 | - List<String> lineList = Splitter.on(",").trimResults().splitToList(lineCodes); | ||
| 332 | - | ||
| 333 | - Map<String, List<D80>> rs = new HashMap<>(); | ||
| 334 | - for (String code : lineList) { | ||
| 335 | - rs.put(code, /*DirectiveBuffer.findNoCofm80(Integer.parseInt(code))*/null); | ||
| 336 | - } | ||
| 337 | - | ||
| 338 | - return rs; | ||
| 339 | - } | ||
| 340 | - | ||
| 341 | - @Override | ||
| 342 | - public Map<String, Object> reply80(int id, int reply) { | ||
| 343 | - Map<String, Object> rs = new HashMap<>(); | ||
| 344 | - | ||
| 345 | - D80 d80 = /*DirectiveBuffer.findById80(id)*/null; | ||
| 346 | - if (null == d80) { | ||
| 347 | - rs.put("status", ResponseCode.ERROR); | ||
| 348 | - rs.put("msg", "服务器没有找到对应数据!"); | ||
| 349 | - } else if (d80.isConfirm()) { | ||
| 350 | - rs.put("status", ResponseCode.ERROR); | ||
| 351 | - rs.put("msg", "该数据已经被处理了!"); | ||
| 352 | - } else { | ||
| 353 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 354 | - | ||
| 355 | - d80.setConfirm(true); | ||
| 356 | - d80.setHandleUser(user.getUserName()); | ||
| 357 | - d80.setConfirmRs(reply); | ||
| 358 | - d80.setHandleTime(new Date()); | ||
| 359 | - // 封装C0数据包并回复设备 | ||
| 360 | - DC0 c0 = new DC0(); | ||
| 361 | - c0.setDeviceId(d80.getDeviceId()); | ||
| 362 | - c0.setTimestamp(d80.getTimestamp()); | ||
| 363 | - c0.setOperCode((short) 0xC0); | ||
| 364 | - | ||
| 365 | - DC0Data data = new DC0Data(); | ||
| 366 | - data.setOperCode2((short) 0x86); | ||
| 367 | - data.setRequestAck((short) (reply == 0 ? 0x06 : 0x15)); | ||
| 368 | - | ||
| 369 | - c0.setData(data); | ||
| 370 | - | ||
| 371 | - d80.setC0(c0); | ||
| 372 | - // 入库 | ||
| 373 | - d80Repository.save(d80); | ||
| 374 | - | ||
| 375 | - int code = HttpUtils.postJson(JSON.toJSONString(c0)); | ||
| 376 | - | ||
| 377 | - rs.put("status", ResponseCode.SUCCESS); | ||
| 378 | - if (code != 0) | ||
| 379 | - rs.put("msg", "发送C0响应指令到车载设备失败,但该操作已经被系统记录!"); | ||
| 380 | - | ||
| 381 | - // 通知页面 | ||
| 382 | - Map<String, Object> sockMap = new HashMap<>(); | ||
| 383 | - sockMap.put("fn", "d80Confirm"); | ||
| 384 | - sockMap.put("id", d80.getId()); | ||
| 385 | - socketHandler.sendMessageToLine(d80.getData().getLineId(), JSON.toJSONString(sockMap)); | ||
| 386 | - } | ||
| 387 | - | ||
| 388 | - return rs; | ||
| 389 | - } | ||
| 390 | - | ||
| 391 | - @Override | ||
| 392 | - public Map<String, Object> findDirective(String nbbm, int dType, int page, int size) { | ||
| 393 | - Map<String, Object> rsMap = new HashMap<>(); | ||
| 394 | - List<Directive> list = null; | ||
| 395 | - | ||
| 396 | - switch (dType) { | ||
| 397 | - case -1: | ||
| 398 | - //所有指令 | ||
| 399 | - list = DirectiveBuffer.findAll(); | ||
| 400 | - break; | ||
| 401 | - case 0: | ||
| 402 | - //调度指令 | ||
| 403 | - list = DirectiveBuffer.findDispatch(); | ||
| 404 | - break; | ||
| 405 | - case 1: | ||
| 406 | - //运营指令 | ||
| 407 | - list = DirectiveBuffer.findByDispatchInstruct((short)0x03); | ||
| 408 | - break; | ||
| 409 | - case 2: | ||
| 410 | - //线路切换指令 | ||
| 411 | - list = DirectiveBuffer.findLineChange(); | ||
| 412 | - break; | ||
| 413 | - case 3: | ||
| 414 | - //消息短语 | ||
| 415 | - list = DirectiveBuffer.findByDispatchInstruct((short)0x00); | ||
| 416 | - break; | ||
| 417 | - } | ||
| 418 | - | ||
| 419 | - // 时间倒序 | ||
| 420 | - Collections.sort(list, new DirectiveBuffer.DComparator()); | ||
| 421 | - if(StringUtils.isNotBlank(nbbm)){ | ||
| 422 | - String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | ||
| 423 | - //按车辆过滤 | ||
| 424 | - List<Directive> subList = new ArrayList<>(); | ||
| 425 | - for(Directive d : list){ | ||
| 426 | - if(d.getDeviceId().equals(deviceId)){ | ||
| 427 | - subList.add(d); | ||
| 428 | - } | ||
| 429 | - } | ||
| 430 | - list = subList; | ||
| 431 | - } | ||
| 432 | - | ||
| 433 | - int count = list.size(); | ||
| 434 | - // 分页 | ||
| 435 | - int s = page * size, e = s + size; | ||
| 436 | - | ||
| 437 | - if (e > count) | ||
| 438 | - e = count; | ||
| 439 | - | ||
| 440 | - List<Directive> rs = list.subList(s, e); | ||
| 441 | - | ||
| 442 | - // 时间格式化,车辆自编号转换 | ||
| 443 | - for (Directive d : rs) { | ||
| 444 | - if (d.getTimeHHmm() == null) | ||
| 445 | - d.setTimeHHmm(sdfHHmm2.format(new Date(d.getTimestamp()))); | ||
| 446 | - if (d.getNbbm() == null) | ||
| 447 | - d.setNbbm(CommonMapped.vehicDeviceBiMap.get(d.getDeviceId())); | ||
| 448 | - } | ||
| 449 | - | ||
| 450 | - rsMap.put("list", rs); | ||
| 451 | - rsMap.put("totalPages", count % size == 0 ? count / size : count / size + 1); | ||
| 452 | - rsMap.put("page", page); | ||
| 453 | - return rsMap; | ||
| 454 | - } | ||
| 455 | - | ||
| 456 | - @Override | ||
| 457 | - public Page<D80> findAll80(Map<String, Object> map, PageRequest pageRequest) { | ||
| 458 | - //默认只查看当天的 | ||
| 459 | - map.put("timestamp_gt", DateUtils.getTimestamp()); | ||
| 460 | - | ||
| 461 | - Object nbbm = map.get("nbbm"); | ||
| 462 | - if(null != nbbm && StringUtils.isNotBlank(nbbm.toString())){ | ||
| 463 | - map.put("deviceId_eq", CommonMapped.vehicDeviceBiMap.inverse().get(nbbm.toString())); | ||
| 464 | - } | ||
| 465 | - | ||
| 466 | - Page<D80> pageData = d80Repository.findAll(new CustomerSpecs<D80>(map), pageRequest); | ||
| 467 | - //格式化时间和转换车辆自编号 | ||
| 468 | - List<D80> list = pageData.getContent(); | ||
| 469 | - for(D80 d80 : list){ | ||
| 470 | - d80.setTimeStr(sdfHHmm2.format(new Date(d80.getTimestamp()))); | ||
| 471 | - d80.getData().setNbbm(CommonMapped.vehicDeviceBiMap.get(d80.getDeviceId())); | ||
| 472 | - } | ||
| 473 | - return pageData; | ||
| 474 | - } | ||
| 475 | -} | 1 | +//package com.bsth.service.directive; |
| 2 | +// | ||
| 3 | +//import java.text.SimpleDateFormat; | ||
| 4 | +//import java.util.ArrayList; | ||
| 5 | +//import java.util.Collections; | ||
| 6 | +//import java.util.Date; | ||
| 7 | +//import java.util.HashMap; | ||
| 8 | +//import java.util.List; | ||
| 9 | +//import java.util.Map; | ||
| 10 | +// | ||
| 11 | +//import org.apache.commons.lang3.StringUtils; | ||
| 12 | +//import org.slf4j.Logger; | ||
| 13 | +//import org.slf4j.LoggerFactory; | ||
| 14 | +//import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | +//import org.springframework.data.domain.Page; | ||
| 16 | +//import org.springframework.data.domain.PageRequest; | ||
| 17 | +//import org.springframework.stereotype.Service; | ||
| 18 | +// | ||
| 19 | +//import com.alibaba.fastjson.JSON; | ||
| 20 | +//import com.alibaba.fastjson.JSONObject; | ||
| 21 | +//import com.bsth.common.ResponseCode; | ||
| 22 | +//import com.bsth.entity.directive.D60; | ||
| 23 | +//import com.bsth.entity.directive.D64; | ||
| 24 | +//import com.bsth.entity.directive.D80; | ||
| 25 | +//import com.bsth.entity.directive.DC0; | ||
| 26 | +//import com.bsth.entity.directive.DC0.DC0Data; | ||
| 27 | +//import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 28 | +//import com.bsth.entity.search.CustomerSpecs; | ||
| 29 | +//import com.bsth.entity.sys.SysUser; | ||
| 30 | +//import com.bsth.repository.directive.D60Repository; | ||
| 31 | +//import com.bsth.repository.directive.D64Repository; | ||
| 32 | +//import com.bsth.repository.directive.D80Repository; | ||
| 33 | +//import com.bsth.security.util.SecurityUtils; | ||
| 34 | +//import com.bsth.service.impl.BaseServiceImpl; | ||
| 35 | +//import com.bsth.service.realcontrol.buffer.ScheduleBuffer; | ||
| 36 | +//import com.bsth.util.DateUtils; | ||
| 37 | +//import com.bsth.vehicle.common.CommonMapped; | ||
| 38 | +//import com.bsth.vehicle.directive.buffer.DirectiveBuffer; | ||
| 39 | +//import com.bsth.vehicle.directive.entity.Directive; | ||
| 40 | +//import com.bsth.vehicle.directive.util.DirectiveDataFactory; | ||
| 41 | +//import com.bsth.vehicle.directive.util.HttpUtils; | ||
| 42 | +//import com.bsth.vehicle.gpsdata.buffer.GpsRealDataBuffer; | ||
| 43 | +//import com.bsth.vehicle.gpsdata.entity.GpsRealData; | ||
| 44 | +//import com.bsth.websocket.handler.RealControlSocketHandler; | ||
| 45 | +//import com.google.common.base.Splitter; | ||
| 46 | +// | ||
| 47 | +//@Service | ||
| 48 | +//public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implements DirectiveService { | ||
| 49 | +// | ||
| 50 | +// Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 51 | +// | ||
| 52 | +// @Autowired | ||
| 53 | +// D60Repository d60Repository; | ||
| 54 | +// | ||
| 55 | +// @Autowired | ||
| 56 | +// GpsRealDataBuffer gpsRealDataBuffer; | ||
| 57 | +// | ||
| 58 | +// @Autowired | ||
| 59 | +// D64Repository d64Repository; | ||
| 60 | +// | ||
| 61 | +// @Autowired | ||
| 62 | +// RealControlSocketHandler socketHandler; | ||
| 63 | +// | ||
| 64 | +// @Autowired | ||
| 65 | +// D80Repository d80Repository; | ||
| 66 | +// | ||
| 67 | +// SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH点mm分"), sdfHHmm2 = new SimpleDateFormat("HH:mm"); | ||
| 68 | +// | ||
| 69 | +// static Long schDiff = 1000 * 60 * 60L; | ||
| 70 | +// | ||
| 71 | +// @Override | ||
| 72 | +// public int send60Phrase(String nbbm, String text, String sender) { | ||
| 73 | +// D60 directive = null; | ||
| 74 | +// try { | ||
| 75 | +// directive = create60Data(nbbm, text, (short) 0x00, null); | ||
| 76 | +// } catch (Exception e) { | ||
| 77 | +// logger.error("发送消息短语出现异常", e); | ||
| 78 | +// return -1; | ||
| 79 | +// } | ||
| 80 | +// | ||
| 81 | +// if (null == directive) | ||
| 82 | +// return -1; | ||
| 83 | +// | ||
| 84 | +// // 发送指令 | ||
| 85 | +// int code = HttpUtils.postJson(JSON.toJSONString(directive)); | ||
| 86 | +// if(null != sender) | ||
| 87 | +// directive.setSender(sender); | ||
| 88 | +// directive.setHttpCode(code); | ||
| 89 | +// // 添加到缓存,等待入库 | ||
| 90 | +// //DirectiveBuffer.put(directive); | ||
| 91 | +// | ||
| 92 | +// if (code != 0) { | ||
| 93 | +// directive.setErrorText("网关通讯失败, code: " + code); | ||
| 94 | +// //DirectiveBuffer.transientList.add(directive); | ||
| 95 | +// } | ||
| 96 | +// return code; | ||
| 97 | +// } | ||
| 98 | +// | ||
| 99 | +// @Override | ||
| 100 | +// public int send60Dispatch(ScheduleRealInfo sch, int finish, String sender) { | ||
| 101 | +// D60 directive = null; | ||
| 102 | +// try { | ||
| 103 | +// // 如果发车时间距当前时间较远,则不发送 | ||
| 104 | +// /*if (Math.abs(sch.getFcsjT() - System.currentTimeMillis()) > schDiff) { | ||
| 105 | +// return -2; | ||
| 106 | +// }*/ | ||
| 107 | +// | ||
| 108 | +// String text = "已完成" + finish + "个班次,下一发车时间" + sdfHHmm.format(new Date(sch.getDfsjT())) + ",由" | ||
| 109 | +// + sch.getQdzName() + "发往" + sch.getZdzName(); | ||
| 110 | +// | ||
| 111 | +// ScheduleRealInfo nextSch = ScheduleBuffer.getNext(sch); | ||
| 112 | +// //下发0x02指令 调度指令(闹钟有效) | ||
| 113 | +// /*directive = DirectiveDataFactory.createDirective6002(sch.getClZbh(), text, (short) 0x02 | ||
| 114 | +// , Integer.parseInt(nextSch.getXlDir()), 0, new Date(System.currentTimeMillis() + 1000 * 30));*/ | ||
| 115 | +// } catch (Exception e) { | ||
| 116 | +// logger.error("生成调度指令时出现异常", e); | ||
| 117 | +// return -1; | ||
| 118 | +// } | ||
| 119 | +// | ||
| 120 | +// if (null == directive) | ||
| 121 | +// return -1; | ||
| 122 | +// if(null != sender) | ||
| 123 | +// directive.setSender(sender); | ||
| 124 | +// else | ||
| 125 | +// directive.setSender("系统"); | ||
| 126 | +// | ||
| 127 | +// // 发送指令 | ||
| 128 | +// int code = HttpUtils.postJson(JSON.toJSONString(directive)); | ||
| 129 | +// | ||
| 130 | +// sch.setDirectiveState(60); | ||
| 131 | +// // 添加到缓存,等待入库 | ||
| 132 | +// directive.setDispatch(true); | ||
| 133 | +// directive.setSch(sch); | ||
| 134 | +// directive.setHttpCode(code); | ||
| 135 | +// //DirectiveBuffer.put(directive); | ||
| 136 | +// | ||
| 137 | +// if (code == 0) { | ||
| 138 | +// // 通知页面,消息已发出 | ||
| 139 | +// sendDirectiveToPage(sch); | ||
| 140 | +// } else { | ||
| 141 | +// directive.setErrorText("网关通讯失败, code: " + code); | ||
| 142 | +// //DirectiveBuffer.transientList.add(directive); | ||
| 143 | +// } | ||
| 144 | +// return code; | ||
| 145 | +// } | ||
| 146 | +// | ||
| 147 | +// /** | ||
| 148 | +// * | ||
| 149 | +// * @Title: sendDirectiveState @Description: TODO(向页面推送班次指令状态) @throws | ||
| 150 | +// */ | ||
| 151 | +// @Override | ||
| 152 | +// public void sendDirectiveToPage(ScheduleRealInfo sch) { | ||
| 153 | +// JSONObject json = new JSONObject(); | ||
| 154 | +// json.put("fn", "directive"); | ||
| 155 | +// json.put("t", sch); | ||
| 156 | +// socketHandler.sendMessageToLine(Integer.parseInt(sch.getXlBm()), json.toJSONString()); | ||
| 157 | +// } | ||
| 158 | +// | ||
| 159 | +// @Override | ||
| 160 | +// public int send60Dispatch(Long id, String sender) { | ||
| 161 | +// ScheduleRealInfo sch = ScheduleBuffer.findOne(id); | ||
| 162 | +// // 车辆已完成班次 | ||
| 163 | +// int finish = ScheduleBuffer.getFinishSchNo(sch.getClZbh()); | ||
| 164 | +// return send60Dispatch(sch, finish, sender); | ||
| 165 | +// } | ||
| 166 | +// | ||
| 167 | +// @Override | ||
| 168 | +// public int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender) { | ||
| 169 | +// logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); | ||
| 170 | +// | ||
| 171 | +// String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); | ||
| 172 | +// D60 directive = /*DirectiveDataFactory.createDirective60(nbbm, text, (short) 0x03, upDown, state)*/null; | ||
| 173 | +// | ||
| 174 | +// if (null == directive) | ||
| 175 | +// return -1; | ||
| 176 | +// if(null != sender) | ||
| 177 | +// directive.setSender(sender); | ||
| 178 | +// else | ||
| 179 | +// directive.setSender("系统"); | ||
| 180 | +// // 发送指令 | ||
| 181 | +// int code = HttpUtils.postJson(JSON.toJSONString(directive)); | ||
| 182 | +// // 添加到缓存,等待入库 | ||
| 183 | +// directive.setHttpCode(code); | ||
| 184 | +// if (null != sch) | ||
| 185 | +// directive.setSch(sch); | ||
| 186 | +// //DirectiveBuffer.put(directive); | ||
| 187 | +// | ||
| 188 | +// if (code != 0) { | ||
| 189 | +// directive.setErrorText("网关通讯失败, code: " + code); | ||
| 190 | +// //DirectiveBuffer.transientList.add(directive); | ||
| 191 | +// } | ||
| 192 | +// return code; | ||
| 193 | +// } | ||
| 194 | +// | ||
| 195 | +// /** | ||
| 196 | +// * 线路切换 | ||
| 197 | +// */ | ||
| 198 | +// @Override | ||
| 199 | +// public int lineChange(String nbbm, Integer lineCode, String sender) { | ||
| 200 | +// Long t = System.currentTimeMillis(); | ||
| 201 | +// /*String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | ||
| 202 | +// | ||
| 203 | +// Directive64 change = new Directive64(); | ||
| 204 | +// LineChangeData data = new LineChangeData(); | ||
| 205 | +// data.setCityCode(cityCode); | ||
| 206 | +// data.setDeviceId(deviceId); | ||
| 207 | +// data.setLineId("00" + String.valueOf(lineCode)); | ||
| 208 | +// | ||
| 209 | +// change.setDeviceId(deviceId); | ||
| 210 | +// change.setOperCode((short) 0X64); | ||
| 211 | +// change.setTimestamp(t); | ||
| 212 | +// change.setData(data);*/ | ||
| 213 | +// D64 d64 = /*DirectiveDataFactory.createDirective64(nbbm, lineCode, t)*/null; | ||
| 214 | +// | ||
| 215 | +// if(null != sender) | ||
| 216 | +// d64.setSender(sender); | ||
| 217 | +// else | ||
| 218 | +// d64.setSender("系统"); | ||
| 219 | +// | ||
| 220 | +// String deviceId = d64.getDeviceId(); | ||
| 221 | +// int code = HttpUtils.postJson(JSON.toJSONString(d64)); | ||
| 222 | +// // 入库 | ||
| 223 | +// d64.setHttpCode(code); | ||
| 224 | +// //DirectiveBuffer.changeMap.put(deviceId + '_' + t, d64); | ||
| 225 | +// | ||
| 226 | +// // 通知设备刷新线路文件,忽略结果 | ||
| 227 | +// if (code == 0) | ||
| 228 | +// HttpUtils.postJson(DirectiveDataFactory.createDeviceRefreshData(deviceId, lineCode)); | ||
| 229 | +// else | ||
| 230 | +// d64.setErrorText("网关通讯失败, code: " + code); | ||
| 231 | +// | ||
| 232 | +// d64Repository.save(d64); | ||
| 233 | +// return code; | ||
| 234 | +// } | ||
| 235 | +// | ||
| 236 | +// public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) { | ||
| 237 | +// | ||
| 238 | +// String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | ||
| 239 | +// if (null == deviceId) { | ||
| 240 | +// logger.error("没有设备号对照的车辆:" + nbbm); | ||
| 241 | +// return null; | ||
| 242 | +// } | ||
| 243 | +// // 上下行和营运状态 | ||
| 244 | +// Integer upDown = null, state = null; | ||
| 245 | +// if (null == sch) { | ||
| 246 | +// GpsRealData gpsData = gpsRealDataBuffer.findOneByDeviceId(deviceId); | ||
| 247 | +// if (null == gpsData) { | ||
| 248 | +// logger.error("没有找到gps对照,无法确认营运状态和上下行:" + nbbm); | ||
| 249 | +// return null; | ||
| 250 | +// } | ||
| 251 | +// upDown = gpsData.getUpDown(); | ||
| 252 | +// state = gpsData.getState(); | ||
| 253 | +// } else { | ||
| 254 | +// upDown = Integer.parseInt(sch.getXlDir()); | ||
| 255 | +// state = 0; | ||
| 256 | +// } | ||
| 257 | +// | ||
| 258 | +// return /*DirectiveDataFactory.createDirective60(nbbm, text, dispatchInstruct, upDown, state)*/null; | ||
| 259 | +// } | ||
| 260 | +// | ||
| 261 | +///* public Directive60 createDirective60(String nbbm, String text, Short dispatchInstruct, int upDown, int state) { | ||
| 262 | +// Long timestamp = System.currentTimeMillis(); | ||
| 263 | +// | ||
| 264 | +// Short company = Short.parseShort(CommonMapped.vehicCompanyMap.get(nbbm)); | ||
| 265 | +// String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | ||
| 266 | +// | ||
| 267 | +// int msgId = MsgIdGenerator.getMsgId(); | ||
| 268 | +// | ||
| 269 | +// Directive60 directive = new Directive60(); | ||
| 270 | +// DirectiveData data = new DirectiveData(); | ||
| 271 | +// // 一级协议 | ||
| 272 | +// directive.setOperCode((short) 0x60); | ||
| 273 | +// // 设备号 | ||
| 274 | +// directive.setDeviceId(deviceId); | ||
| 275 | +// // 时间戳 | ||
| 276 | +// directive.setTimestamp(timestamp); | ||
| 277 | +// directive.setMsgId(msgId); | ||
| 278 | +// // 构造数据 | ||
| 279 | +// data.setDeviceId(deviceId); | ||
| 280 | +// data.setDispatchInstruct(dispatchInstruct); | ||
| 281 | +// data.setTimestamp(timestamp); | ||
| 282 | +// data.setCompanyCode(company); | ||
| 283 | +// data.setMsgId(msgId); | ||
| 284 | +// directive.setData(data); | ||
| 285 | +// long serviceState; | ||
| 286 | +// try { | ||
| 287 | +// serviceState = Consts.SERVICE_STATE[upDown][state]; | ||
| 288 | +// } catch (IndexOutOfBoundsException e) { | ||
| 289 | +// // 未知营运状态的直接默认为上行非营运 | ||
| 290 | +// serviceState = Consts.SERVICE_STATE[0][1]; | ||
| 291 | +// } | ||
| 292 | +// data.setServiceState(serviceState); | ||
| 293 | +// data.setTxtContent(text); | ||
| 294 | +// | ||
| 295 | +// return directive; | ||
| 296 | +// }*/ | ||
| 297 | +// | ||
| 298 | +// @Override | ||
| 299 | +// public int upDownChange(String nbbm, Integer upDown, String sender) { | ||
| 300 | +// return send60Operation(nbbm, 0, upDown, null, sender); | ||
| 301 | +// } | ||
| 302 | +// | ||
| 303 | +// /** | ||
| 304 | +// * | ||
| 305 | +// * @Title: createDeviceRefreshData @Description: | ||
| 306 | +// * TODO(生成设备线路刷新数据包) @param @return 设定文件 @return String 返回类型 @throws | ||
| 307 | +// */ | ||
| 308 | +///* public String createDeviceRefreshData(String deviceId, Integer lineId) { | ||
| 309 | +// Long t = System.currentTimeMillis(); | ||
| 310 | +// Map<String, Object> param = new HashMap<String, Object>(); | ||
| 311 | +// param.put("deviceId", deviceId); | ||
| 312 | +// param.put("timestamp", t); | ||
| 313 | +// param.put("operCode", 0Xc0); | ||
| 314 | +// | ||
| 315 | +// Map<String, Object> data = new HashMap<String, Object>(); | ||
| 316 | +// data.put("operCode2", 0xa1); | ||
| 317 | +// data.put("cityCode", cityCode); | ||
| 318 | +// data.put("deviceId", deviceId); | ||
| 319 | +// data.put("timestamp", t); | ||
| 320 | +// data.put("centerId", 1); | ||
| 321 | +// data.put("lineId", lineId); | ||
| 322 | +// data.put("lineVersion", 0); | ||
| 323 | +// data.put("carparkDataVersion", 0); | ||
| 324 | +// param.put("data", data); | ||
| 325 | +// | ||
| 326 | +// return JSON.toJSONString(param); | ||
| 327 | +// }*/ | ||
| 328 | +// | ||
| 329 | +// @Override | ||
| 330 | +// public Map<String, List<D80>> findNoCofm80(String lineCodes) { | ||
| 331 | +// List<String> lineList = Splitter.on(",").trimResults().splitToList(lineCodes); | ||
| 332 | +// | ||
| 333 | +// Map<String, List<D80>> rs = new HashMap<>(); | ||
| 334 | +// for (String code : lineList) { | ||
| 335 | +// rs.put(code, /*DirectiveBuffer.findNoCofm80(Integer.parseInt(code))*/null); | ||
| 336 | +// } | ||
| 337 | +// | ||
| 338 | +// return rs; | ||
| 339 | +// } | ||
| 340 | +// | ||
| 341 | +// @Override | ||
| 342 | +// public Map<String, Object> reply80(int id, int reply) { | ||
| 343 | +// Map<String, Object> rs = new HashMap<>(); | ||
| 344 | +// | ||
| 345 | +// D80 d80 = /*DirectiveBuffer.findById80(id)*/null; | ||
| 346 | +// if (null == d80) { | ||
| 347 | +// rs.put("status", ResponseCode.ERROR); | ||
| 348 | +// rs.put("msg", "服务器没有找到对应数据!"); | ||
| 349 | +// } else if (d80.isConfirm()) { | ||
| 350 | +// rs.put("status", ResponseCode.ERROR); | ||
| 351 | +// rs.put("msg", "该数据已经被处理了!"); | ||
| 352 | +// } else { | ||
| 353 | +// SysUser user = SecurityUtils.getCurrentUser(); | ||
| 354 | +// | ||
| 355 | +// d80.setConfirm(true); | ||
| 356 | +// d80.setHandleUser(user.getUserName()); | ||
| 357 | +// d80.setConfirmRs(reply); | ||
| 358 | +// d80.setHandleTime(new Date()); | ||
| 359 | +// // 封装C0数据包并回复设备 | ||
| 360 | +// DC0 c0 = new DC0(); | ||
| 361 | +// c0.setDeviceId(d80.getDeviceId()); | ||
| 362 | +// c0.setTimestamp(d80.getTimestamp()); | ||
| 363 | +// c0.setOperCode((short) 0xC0); | ||
| 364 | +// | ||
| 365 | +// DC0Data data = new DC0Data(); | ||
| 366 | +// data.setOperCode2((short) 0x86); | ||
| 367 | +// data.setRequestAck((short) (reply == 0 ? 0x06 : 0x15)); | ||
| 368 | +// | ||
| 369 | +// c0.setData(data); | ||
| 370 | +// | ||
| 371 | +// d80.setC0(c0); | ||
| 372 | +// // 入库 | ||
| 373 | +// d80Repository.save(d80); | ||
| 374 | +// | ||
| 375 | +// int code = HttpUtils.postJson(JSON.toJSONString(c0)); | ||
| 376 | +// | ||
| 377 | +// rs.put("status", ResponseCode.SUCCESS); | ||
| 378 | +// if (code != 0) | ||
| 379 | +// rs.put("msg", "发送C0响应指令到车载设备失败,但该操作已经被系统记录!"); | ||
| 380 | +// | ||
| 381 | +// // 通知页面 | ||
| 382 | +// Map<String, Object> sockMap = new HashMap<>(); | ||
| 383 | +// sockMap.put("fn", "d80Confirm"); | ||
| 384 | +// sockMap.put("id", d80.getId()); | ||
| 385 | +// socketHandler.sendMessageToLine(d80.getData().getLineId(), JSON.toJSONString(sockMap)); | ||
| 386 | +// } | ||
| 387 | +// | ||
| 388 | +// return rs; | ||
| 389 | +// } | ||
| 390 | +// | ||
| 391 | +// @Override | ||
| 392 | +// public Map<String, Object> findDirective(String nbbm, int dType, int page, int size) { | ||
| 393 | +// Map<String, Object> rsMap = new HashMap<>(); | ||
| 394 | +// List<Directive> list = null; | ||
| 395 | +// | ||
| 396 | +// switch (dType) { | ||
| 397 | +// case -1: | ||
| 398 | +// //所有指令 | ||
| 399 | +// list = DirectiveBuffer.findAll(); | ||
| 400 | +// break; | ||
| 401 | +// case 0: | ||
| 402 | +// //调度指令 | ||
| 403 | +// list = DirectiveBuffer.findDispatch(); | ||
| 404 | +// break; | ||
| 405 | +// case 1: | ||
| 406 | +// //运营指令 | ||
| 407 | +// list = DirectiveBuffer.findByDispatchInstruct((short)0x03); | ||
| 408 | +// break; | ||
| 409 | +// case 2: | ||
| 410 | +// //线路切换指令 | ||
| 411 | +// list = DirectiveBuffer.findLineChange(); | ||
| 412 | +// break; | ||
| 413 | +// case 3: | ||
| 414 | +// //消息短语 | ||
| 415 | +// list = DirectiveBuffer.findByDispatchInstruct((short)0x00); | ||
| 416 | +// break; | ||
| 417 | +// } | ||
| 418 | +// | ||
| 419 | +// // 时间倒序 | ||
| 420 | +// Collections.sort(list, new DirectiveBuffer.DComparator()); | ||
| 421 | +// if(StringUtils.isNotBlank(nbbm)){ | ||
| 422 | +// String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | ||
| 423 | +// //按车辆过滤 | ||
| 424 | +// List<Directive> subList = new ArrayList<>(); | ||
| 425 | +// for(Directive d : list){ | ||
| 426 | +// if(d.getDeviceId().equals(deviceId)){ | ||
| 427 | +// subList.add(d); | ||
| 428 | +// } | ||
| 429 | +// } | ||
| 430 | +// list = subList; | ||
| 431 | +// } | ||
| 432 | +// | ||
| 433 | +// int count = list.size(); | ||
| 434 | +// // 分页 | ||
| 435 | +// int s = page * size, e = s + size; | ||
| 436 | +// | ||
| 437 | +// if (e > count) | ||
| 438 | +// e = count; | ||
| 439 | +// | ||
| 440 | +// List<Directive> rs = list.subList(s, e); | ||
| 441 | +// | ||
| 442 | +// // 时间格式化,车辆自编号转换 | ||
| 443 | +// for (Directive d : rs) { | ||
| 444 | +// if (d.getTimeHHmm() == null) | ||
| 445 | +// d.setTimeHHmm(sdfHHmm2.format(new Date(d.getTimestamp()))); | ||
| 446 | +// if (d.getNbbm() == null) | ||
| 447 | +// d.setNbbm(CommonMapped.vehicDeviceBiMap.get(d.getDeviceId())); | ||
| 448 | +// } | ||
| 449 | +// | ||
| 450 | +// rsMap.put("list", rs); | ||
| 451 | +// rsMap.put("totalPages", count % size == 0 ? count / size : count / size + 1); | ||
| 452 | +// rsMap.put("page", page); | ||
| 453 | +// return rsMap; | ||
| 454 | +// } | ||
| 455 | +// | ||
| 456 | +// @Override | ||
| 457 | +// public Page<D80> findAll80(Map<String, Object> map, PageRequest pageRequest) { | ||
| 458 | +// //默认只查看当天的 | ||
| 459 | +// map.put("timestamp_gt", DateUtils.getTimestamp()); | ||
| 460 | +// | ||
| 461 | +// Object nbbm = map.get("nbbm"); | ||
| 462 | +// if(null != nbbm && StringUtils.isNotBlank(nbbm.toString())){ | ||
| 463 | +// map.put("deviceId_eq", CommonMapped.vehicDeviceBiMap.inverse().get(nbbm.toString())); | ||
| 464 | +// } | ||
| 465 | +// | ||
| 466 | +// Page<D80> pageData = d80Repository.findAll(new CustomerSpecs<D80>(map), pageRequest); | ||
| 467 | +// //格式化时间和转换车辆自编号 | ||
| 468 | +// List<D80> list = pageData.getContent(); | ||
| 469 | +// for(D80 d80 : list){ | ||
| 470 | +// d80.setTimeStr(sdfHHmm2.format(new Date(d80.getTimestamp()))); | ||
| 471 | +// d80.getData().setNbbm(CommonMapped.vehicDeviceBiMap.get(d80.getDeviceId())); | ||
| 472 | +// } | ||
| 473 | +// return pageData; | ||
| 474 | +// } | ||
| 475 | +//} |