Commit ed3d5df25d5dccbac90b0705dcb4e1ec435555ef

Authored by 潘钊
1 parent 3e338bf7

update

src/main/java/com/bsth/controller/directive/DirectiveController.java~HEAD 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/entity/directive/D60.java 0 → 100644
  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 D60Data 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 D60Data {
  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 D60Data getData() {
  202 + return data;
  203 + }
  204 +
  205 + public void setData(D60Data 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 0 → 100644
  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 D64Data data;
  33 +
  34 + @Embeddable
  35 + public static class D64Data {
  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 D64Data getData() {
  78 + return data;
  79 + }
  80 +
  81 + public void setData(D64Data 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 +
  101 + public String getKey(){
  102 + return deviceId + "_" + timestamp;
  103 + }
  104 +}
src/main/java/com/bsth/entity/directive/D80.java 0 → 100644
  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 +import com.bsth.entity.directive.DC0.DC0Data;
  19 +
  20 +/**
  21 + *
  22 + * @ClassName: D80
  23 + * @Description: TODO(驾驶员上报)
  24 + * @author PanZhao
  25 + * @date 2016年6月8日 下午12:36:42
  26 + *
  27 + */
  28 +@Entity
  29 +@Table(name = "bsth_v_report_80")
  30 +@NamedEntityGraphs({
  31 + @NamedEntityGraph(name = "directive80_c0", attributeNodes = {
  32 + @NamedAttributeNode("c0")
  33 + })
  34 +})
  35 +public class D80 {
  36 +
  37 + @Id
  38 + @GeneratedValue
  39 + private Integer id;
  40 +
  41 + /**
  42 + * 设备编号
  43 + */
  44 + private String deviceId;
  45 +
  46 + /**
  47 + * 时间戳(ms)
  48 + */
  49 + private Long timestamp;
  50 +
  51 + /**
  52 + * 一级协议 0xC0
  53 + */
  54 + private Short operCode;
  55 +
  56 + private D80Data data;
  57 +
  58 + /**
  59 + * c0 回复
  60 + */
  61 + @OneToOne(cascade = CascadeType.ALL, fetch=FetchType.LAZY)
  62 + private DC0 c0;
  63 +
  64 + /** 调度员是否确认 */
  65 + private boolean confirm;
  66 +
  67 + /** 处理人 */
  68 + private String handleUser;
  69 +
  70 + /** 处理结果 0:同意 -1:不同意 */
  71 + private int confirmRs;
  72 +
  73 + /** 处理时间 */
  74 + private Date handleTime;
  75 +
  76 + private String remarks;
  77 +
  78 + @Embeddable
  79 + public static class D80Data {
  80 +
  81 + /**
  82 + * 0x86
  83 + */
  84 + private Short operCode2;
  85 +
  86 + /**
  87 + * 请求代码 0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70
  88 + * 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警
  89 + */
  90 + private Short requestCode;
  91 +
  92 + /**
  93 + * 线路编码
  94 + */
  95 + private Integer lineId;
  96 +
  97 + /**
  98 + * 车辆内部编码
  99 + */
  100 + @Transient
  101 + private String nbbm;
  102 +
  103 + public Short getOperCode2() {
  104 + return operCode2;
  105 + }
  106 +
  107 + public void setOperCode2(Short operCode2) {
  108 + this.operCode2 = operCode2;
  109 + }
  110 +
  111 + public Short getRequestCode() {
  112 + return requestCode;
  113 + }
  114 +
  115 + public void setRequestCode(Short requestCode) {
  116 + this.requestCode = requestCode;
  117 + }
  118 +
  119 + public Integer getLineId() {
  120 + return lineId;
  121 + }
  122 +
  123 + public void setLineId(Integer lineId) {
  124 + this.lineId = lineId;
  125 + }
  126 +
  127 + public String getNbbm() {
  128 + return nbbm;
  129 + }
  130 +
  131 + public void setNbbm(String nbbm) {
  132 + this.nbbm = nbbm;
  133 + }
  134 + }
  135 +
  136 + @Transient
  137 + private String timeStr;
  138 +
  139 + public Integer getId() {
  140 + return id;
  141 + }
  142 +
  143 + public void setId(Integer id) {
  144 + this.id = id;
  145 + }
  146 +
  147 + public String getDeviceId() {
  148 + return deviceId;
  149 + }
  150 +
  151 + public void setDeviceId(String deviceId) {
  152 + this.deviceId = deviceId;
  153 + }
  154 +
  155 + public Long getTimestamp() {
  156 + return timestamp;
  157 + }
  158 +
  159 + public void setTimestamp(Long timestamp) {
  160 + this.timestamp = timestamp;
  161 + }
  162 +
  163 + public Short getOperCode() {
  164 + return operCode;
  165 + }
  166 +
  167 + public void setOperCode(Short operCode) {
  168 + this.operCode = operCode;
  169 + }
  170 +
  171 + public D80Data getData() {
  172 + return data;
  173 + }
  174 +
  175 + public void setData(D80Data data) {
  176 + this.data = data;
  177 + }
  178 +
  179 + public DC0 getC0() {
  180 + return c0;
  181 + }
  182 +
  183 + public void setC0(DC0 c0) {
  184 + this.c0 = c0;
  185 + }
  186 +
  187 + public boolean isConfirm() {
  188 + return confirm;
  189 + }
  190 +
  191 + public void setConfirm(boolean confirm) {
  192 + this.confirm = confirm;
  193 + }
  194 +
  195 + public int getConfirmRs() {
  196 + return confirmRs;
  197 + }
  198 +
  199 + public void setConfirmRs(int confirmRs) {
  200 + this.confirmRs = confirmRs;
  201 + }
  202 +
  203 + public String getHandleUser() {
  204 + return handleUser;
  205 + }
  206 +
  207 + public void setHandleUser(String handleUser) {
  208 + this.handleUser = handleUser;
  209 + }
  210 +
  211 + public String getTimeStr() {
  212 + return timeStr;
  213 + }
  214 +
  215 + public void setTimeStr(String timeStr) {
  216 + this.timeStr = timeStr;
  217 + }
  218 +
  219 + public Date getHandleTime() {
  220 + return handleTime;
  221 + }
  222 +
  223 + public void setHandleTime(Date handleTime) {
  224 + this.handleTime = handleTime;
  225 + }
  226 +
  227 + public String getRemarks() {
  228 + return remarks;
  229 + }
  230 +
  231 + public void setRemarks(String remarks) {
  232 + this.remarks = remarks;
  233 + }
  234 +
  235 + public void addRemarks(String remarks) {
  236 + if(null == this.remarks)
  237 + setRemarks(remarks);
  238 + else
  239 + setRemarks(getRemarks() + remarks);
  240 + }
  241 +
  242 + public void setC0(int reply, String handleUser){
  243 + this.setConfirm(true);
  244 + this.setHandleUser(handleUser);
  245 + this.setConfirmRs(reply);
  246 + this.setHandleTime(new Date());
  247 + // 封装C0数据包并回复设备
  248 + DC0 c0 = new DC0();
  249 + c0.setDeviceId(this.getDeviceId());
  250 + c0.setTimestamp(this.getTimestamp());
  251 + c0.setOperCode((short) 0xC0);
  252 + DC0Data data = new DC0Data();
  253 + data.setOperCode2((short) 0x86);
  254 + data.setRequestAck((short) (reply == 0 ? 0x06 : 0x15));
  255 + c0.setData(data);
  256 + this.setC0(c0);
  257 + }
  258 +}
src/main/java/com/bsth/entity/directive/DC0.java 0 → 100644
  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 0 → 100644
  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/entity/directive/DirectiveReponse.java 0 → 100644
  1 +package com.bsth.entity.directive;
  2 +
  3 +/**
  4 + *
  5 + * @ClassName: DirectiveReponse
  6 + * @Description: TODO(指令回复)
  7 + * @author PanZhao
  8 + * @date 2016年8月14日 下午5:43:36
  9 + *
  10 + */
  11 +public class DirectiveReponse {
  12 + // 设备编号
  13 + private String deviceId;
  14 +
  15 + private Integer msgId;
  16 +
  17 + /**
  18 + * operCode 为 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读
  19 + */
  20 + private Integer status;
  21 +
  22 + // 时间戳(ms)
  23 + private Long timestamp;
  24 +
  25 + public String getDeviceId() {
  26 + return deviceId;
  27 + }
  28 +
  29 + public void setDeviceId(String deviceId) {
  30 + this.deviceId = deviceId;
  31 + }
  32 +
  33 + public Integer getMsgId() {
  34 + return msgId;
  35 + }
  36 +
  37 + public void setMsgId(Integer msgId) {
  38 + this.msgId = msgId;
  39 + }
  40 +
  41 + public Long getTimestamp() {
  42 + return timestamp;
  43 + }
  44 +
  45 + public void setTimestamp(Long timestamp) {
  46 + this.timestamp = timestamp;
  47 + }
  48 +
  49 + public Integer getStatus() {
  50 + return status;
  51 + }
  52 +
  53 + public void setStatus(Integer status) {
  54 + this.status = status;
  55 + }
  56 +}