mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-26 06:57:50 +08:00
1078-优化列表展示效果
This commit is contained in:
parent
d4c531dc12
commit
23a72e94e6
@ -14,13 +14,25 @@ public class JTDevice {
|
|||||||
* 省域ID
|
* 省域ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "省域ID")
|
@Schema(description = "省域ID")
|
||||||
private int provinceId;
|
private String provinceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 省域文字描述
|
||||||
|
*/
|
||||||
|
@Schema(description = "省域文字描述")
|
||||||
|
private String provinceText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 市县域ID
|
* 市县域ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "市县域ID")
|
@Schema(description = "市县域ID")
|
||||||
private int cityId;
|
private String cityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 市县域文字描述
|
||||||
|
*/
|
||||||
|
@Schema(description = "市县域文字描述")
|
||||||
|
private String cityText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 制造商ID
|
* 制造商ID
|
||||||
@ -38,6 +50,12 @@ public class JTDevice {
|
|||||||
* 终端ID
|
* 终端ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "终端ID")
|
@Schema(description = "终端ID")
|
||||||
|
private String terminalId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "设备ID")
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,22 +98,46 @@ public class JTDevice {
|
|||||||
@Schema(description = "状态")
|
@Schema(description = "状态")
|
||||||
private boolean status;
|
private boolean status;
|
||||||
|
|
||||||
public int getProvinceId() {
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProvinceId() {
|
||||||
return provinceId;
|
return provinceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProvinceId(int provinceId) {
|
public void setProvinceId(String provinceId) {
|
||||||
this.provinceId = provinceId;
|
this.provinceId = provinceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCityId() {
|
public String getProvinceText() {
|
||||||
|
return provinceText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProvinceText(String provinceText) {
|
||||||
|
this.provinceText = provinceText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCityId() {
|
||||||
return cityId;
|
return cityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCityId(int cityId) {
|
public void setCityId(String cityId) {
|
||||||
this.cityId = cityId;
|
this.cityId = cityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCityText() {
|
||||||
|
return cityText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCityText(String cityText) {
|
||||||
|
this.cityText = cityText;
|
||||||
|
}
|
||||||
|
|
||||||
public String getMakerId() {
|
public String getMakerId() {
|
||||||
return makerId;
|
return makerId;
|
||||||
}
|
}
|
||||||
@ -112,6 +154,14 @@ public class JTDevice {
|
|||||||
this.deviceModel = deviceModel;
|
this.deviceModel = deviceModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTerminalId() {
|
||||||
|
return terminalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalId(String terminalId) {
|
||||||
|
this.terminalId = terminalId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDeviceId() {
|
public String getDeviceId() {
|
||||||
return deviceId;
|
return deviceId;
|
||||||
}
|
}
|
||||||
@ -184,11 +234,21 @@ public class JTDevice {
|
|||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
@Override
|
||||||
return id;
|
public String toString() {
|
||||||
}
|
return "JTDevice{" +
|
||||||
|
", 省域ID='" + provinceId + '\'' +
|
||||||
public void setId(int id) {
|
", 省域文字描述='" + provinceText + '\'' +
|
||||||
this.id = id;
|
", 市县域ID='" + cityId + '\'' +
|
||||||
|
", 市县域文字描述='" + cityText + '\'' +
|
||||||
|
", 制造商ID='" + makerId + '\'' +
|
||||||
|
", 终端型号='" + deviceModel + '\'' +
|
||||||
|
", 终端ID='" + terminalId + '\'' +
|
||||||
|
", 设备ID='" + deviceId + '\'' +
|
||||||
|
", 车牌颜色=" + plateColor +
|
||||||
|
", 车牌='" + plateNo + '\'' +
|
||||||
|
", 鉴权码='" + authenticationCode + '\'' +
|
||||||
|
", status=" + status +
|
||||||
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,9 +50,9 @@ public class Jt808Decoder extends ByteToMessageDecoder {
|
|||||||
if (header.is2019Version()) {
|
if (header.is2019Version()) {
|
||||||
header.setVersion(buf.readUnsignedByte());
|
header.setVersion(buf.readUnsignedByte());
|
||||||
String devId = ByteBufUtil.hexDump(buf.readSlice(10));
|
String devId = ByteBufUtil.hexDump(buf.readSlice(10));
|
||||||
header.setDevId(devId.replaceFirst("^0*", ""));
|
header.setTerminalId(devId.replaceFirst("^0*", ""));
|
||||||
} else {
|
} else {
|
||||||
header.setDevId(ByteBufUtil.hexDump(buf.readSlice(6)).replaceFirst("^0*", ""));
|
header.setTerminalId(ByteBufUtil.hexDump(buf.readSlice(6)).replaceFirst("^0*", ""));
|
||||||
}
|
}
|
||||||
header.setSn(buf.readUnsignedShort());
|
header.setSn(buf.readUnsignedShort());
|
||||||
|
|
||||||
|
|||||||
@ -65,12 +65,12 @@ public class Jt808EncoderCmd extends MessageToByteEncoder<Cmd> {
|
|||||||
byteBuf.writeByte(header.getVersion());
|
byteBuf.writeByte(header.getVersion());
|
||||||
|
|
||||||
// 终端手机号
|
// 终端手机号
|
||||||
byteBuf.writeBytes(ByteBufUtil.decodeHexDump(Bin.strHexPaddingLeft(header.getDevId(), 20)));
|
byteBuf.writeBytes(ByteBufUtil.decodeHexDump(Bin.strHexPaddingLeft(header.getTerminalId(), 20)));
|
||||||
} else {
|
} else {
|
||||||
// 消息体属性
|
// 消息体属性
|
||||||
byteBuf.writeShort(encode.readableBytes());
|
byteBuf.writeShort(encode.readableBytes());
|
||||||
|
|
||||||
byteBuf.writeBytes(ByteBufUtil.decodeHexDump(Bin.strHexPaddingLeft(header.getDevId(), 12)));
|
byteBuf.writeBytes(ByteBufUtil.decodeHexDump(Bin.strHexPaddingLeft(header.getTerminalId(), 12)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 消息体流水号
|
// 消息体流水号
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import io.netty.handler.timeout.IdleState;
|
|||||||
import io.netty.handler.timeout.IdleStateEvent;
|
import io.netty.handler.timeout.IdleStateEvent;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author QingtaiJiang
|
* @author QingtaiJiang
|
||||||
@ -20,6 +21,13 @@ public class Jt808Handler extends ChannelInboundHandlerAdapter {
|
|||||||
|
|
||||||
private final static Logger log = LoggerFactory.getLogger(Jt808Handler.class);
|
private final static Logger log = LoggerFactory.getLogger(Jt808Handler.class);
|
||||||
|
|
||||||
|
private ApplicationEventPublisher applicationEventPublisher = null;
|
||||||
|
|
||||||
|
|
||||||
|
public Jt808Handler(ApplicationEventPublisher applicationEventPublisher) {
|
||||||
|
this.applicationEventPublisher = applicationEventPublisher;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
if (msg instanceof Rs) {
|
if (msg instanceof Rs) {
|
||||||
@ -42,6 +50,8 @@ public class Jt808Handler extends ChannelInboundHandlerAdapter {
|
|||||||
Session session = ctx.channel().attr(Session.KEY).get();
|
Session session = ctx.channel().attr(Session.KEY).get();
|
||||||
log.info("< Tcp disconnect {}", session);
|
log.info("< Tcp disconnect {}", session);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
|
|
||||||
|
applicationEventPublisher.publishEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public class TcpServer {
|
|||||||
.addLast(new Jt808Decoder(applicationEventPublisher, service))
|
.addLast(new Jt808Decoder(applicationEventPublisher, service))
|
||||||
.addLast(new Jt808Encoder())
|
.addLast(new Jt808Encoder())
|
||||||
.addLast(new Jt808EncoderCmd())
|
.addLast(new Jt808EncoderCmd())
|
||||||
.addLast(new Jt808Handler());
|
.addLast(new Jt808Handler(applicationEventPublisher));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ChannelFuture channelFuture = bootstrap.bind(port).sync();
|
ChannelFuture channelFuture = bootstrap.bind(port).sync();
|
||||||
|
|||||||
@ -8,23 +8,26 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface JTDeviceMapper {
|
public interface JTDeviceMapper {
|
||||||
|
|
||||||
@Select("SELECT * FROM wvp_device de where device_id=${devId}")
|
@Select("SELECT * FROM wvp_jt_device where terminal_id=#{terminalId}")
|
||||||
JTDevice getDevice(@Param("devId") String devId);
|
JTDevice getDevice(@Param("terminalId") String terminalId);
|
||||||
|
|
||||||
@Update(value = {" <script>" +
|
@Update(value = {" <script>" +
|
||||||
"UPDATE wvp_jt_device " +
|
"UPDATE wvp_jt_device " +
|
||||||
"SET update_time=#{updateTime}" +
|
"SET update_time=#{updateTime}" +
|
||||||
|
"<if test=\"deviceId != null\">, device_id=#{deviceId}</if>" +
|
||||||
"<if test=\"provinceId != null\">, province_id=#{provinceId}</if>" +
|
"<if test=\"provinceId != null\">, province_id=#{provinceId}</if>" +
|
||||||
|
"<if test=\"provinceText != null\">, province_text=#{provinceText}</if>" +
|
||||||
"<if test=\"cityId != null\">, city_id=#{cityId}</if>" +
|
"<if test=\"cityId != null\">, city_id=#{cityId}</if>" +
|
||||||
|
"<if test=\"cityText != null\">, city_text=#{cityText}</if>" +
|
||||||
"<if test=\"makerId != null\">, maker_id=#{makerId}</if>" +
|
"<if test=\"makerId != null\">, maker_id=#{makerId}</if>" +
|
||||||
"<if test=\"deviceModel != null\">, device_model=#{deviceModel}</if>" +
|
"<if test=\"deviceModel != null\">, device_model=#{deviceModel}</if>" +
|
||||||
"<if test=\"plateColor != null\">, plate_color=#{plateColor}</if>" +
|
"<if test=\"plateColor != null\">, plate_color=#{plateColor}</if>" +
|
||||||
"<if test=\"plateNo != null\">, plate_no=#{plateNo}</if>" +
|
"<if test=\"plateNo != null\">, plate_no=#{plateNo}</if>" +
|
||||||
"<if test=\"authenticationCode != null\">, authentication_code=#{localIp}</if>" +
|
"<if test=\"authenticationCode != null\">, authentication_code=#{authenticationCode}</if>" +
|
||||||
"<if test=\"longitude != null\">, longitude=#{longitude}</if>" +
|
"<if test=\"longitude != null\">, longitude=#{longitude}</if>" +
|
||||||
"<if test=\"latitude != null\">, latitude=#{latitude}</if>" +
|
"<if test=\"latitude != null\">, latitude=#{latitude}</if>" +
|
||||||
"<if test=\"status != null\">, status=#{status}</if>" +
|
"<if test=\"status != null\">, status=#{status}</if>" +
|
||||||
"WHERE device_id=#{deviceId}"+
|
"WHERE terminal_id=#{terminalId}"+
|
||||||
" </script>"})
|
" </script>"})
|
||||||
void updateDevice(JTDevice device);
|
void updateDevice(JTDevice device);
|
||||||
@Select(value = {" <script>" +
|
@Select(value = {" <script>" +
|
||||||
@ -34,6 +37,7 @@ public interface JTDeviceMapper {
|
|||||||
"WHERE " +
|
"WHERE " +
|
||||||
"1=1" +
|
"1=1" +
|
||||||
" <if test='query != null'> AND (" +
|
" <if test='query != null'> AND (" +
|
||||||
|
"jd.terminal_id LIKE concat('%',#{query},'%') " +
|
||||||
"jd.province_id LIKE concat('%',#{query},'%') " +
|
"jd.province_id LIKE concat('%',#{query},'%') " +
|
||||||
"OR jd.city_id LIKE concat('%',#{query},'%') " +
|
"OR jd.city_id LIKE concat('%',#{query},'%') " +
|
||||||
"OR jd.maker_id LIKE concat('%',#{query},'%') " +
|
"OR jd.maker_id LIKE concat('%',#{query},'%') " +
|
||||||
@ -48,8 +52,11 @@ public interface JTDeviceMapper {
|
|||||||
List<JTDevice> getDeviceList(@Param("query") String query, @Param("online") Boolean online);
|
List<JTDevice> getDeviceList(@Param("query") String query, @Param("online") Boolean online);
|
||||||
|
|
||||||
@Insert("INSERT INTO wvp_jt_device (" +
|
@Insert("INSERT INTO wvp_jt_device (" +
|
||||||
|
"terminal_id,"+
|
||||||
"province_id,"+
|
"province_id,"+
|
||||||
|
"province_text,"+
|
||||||
"city_id,"+
|
"city_id,"+
|
||||||
|
"city_text,"+
|
||||||
"maker_id,"+
|
"maker_id,"+
|
||||||
"device_id,"+
|
"device_id,"+
|
||||||
"device_model,"+
|
"device_model,"+
|
||||||
@ -61,8 +68,11 @@ public interface JTDeviceMapper {
|
|||||||
"create_time,"+
|
"create_time,"+
|
||||||
"update_time"+
|
"update_time"+
|
||||||
") VALUES (" +
|
") VALUES (" +
|
||||||
|
"#{terminalId}," +
|
||||||
"#{provinceId}," +
|
"#{provinceId}," +
|
||||||
|
"#{provinceText}," +
|
||||||
"#{cityId}," +
|
"#{cityId}," +
|
||||||
|
"#{cityText}," +
|
||||||
"#{makerId}," +
|
"#{makerId}," +
|
||||||
"#{deviceId}," +
|
"#{deviceId}," +
|
||||||
"#{deviceModel}," +
|
"#{deviceModel}," +
|
||||||
@ -76,6 +86,6 @@ public interface JTDeviceMapper {
|
|||||||
")")
|
")")
|
||||||
void addDevice(JTDevice device);
|
void addDevice(JTDevice device);
|
||||||
|
|
||||||
@Delete("delete from wvp_jt_device where device_id = #{deviceId}")
|
@Delete("delete from wvp_jt_device where terminal_id = #{terminalId}")
|
||||||
void deleteDeviceByDeviceId(@Param("deviceId") String deviceId);
|
void deleteDeviceByTerminalId(@Param("terminalId") String terminalId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,11 +15,12 @@ public class Header {
|
|||||||
Integer msgPro;
|
Integer msgPro;
|
||||||
|
|
||||||
// 标识
|
// 标识
|
||||||
String devId;
|
String terminalId;
|
||||||
|
|
||||||
// 消息体流水号
|
// 消息体流水号
|
||||||
Integer sn;
|
Integer sn;
|
||||||
|
|
||||||
|
|
||||||
// 协议版本号
|
// 协议版本号
|
||||||
Short version = -1;
|
Short version = -1;
|
||||||
|
|
||||||
@ -40,12 +41,12 @@ public class Header {
|
|||||||
this.msgPro = msgPro;
|
this.msgPro = msgPro;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDevId() {
|
public String getTerminalId() {
|
||||||
return devId;
|
return terminalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDevId(String devId) {
|
public void setTerminalId(String terminalId) {
|
||||||
this.devId = devId;
|
this.terminalId = terminalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSn() {
|
public Integer getSn() {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public class J0001 extends Re {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||||
SessionManager.INSTANCE.response(header.getDevId(), "0001", (long) respNo, JSON.toJSONString(this));
|
SessionManager.INSTANCE.response(header.getTerminalId(), "0001", (long) respNo, JSON.toJSONString(this));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.proc.Header;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.session.Session;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.ByteBufUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端注销
|
||||||
|
*/
|
||||||
|
@MsgId(id = "0003")
|
||||||
|
public class J0003 extends Re {
|
||||||
|
|
||||||
|
private final static Logger log = LoggerFactory.getLogger(J0003.class);
|
||||||
|
int respNo;
|
||||||
|
String respId;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||||
|
respNo = buf.readUnsignedShort();
|
||||||
|
respId = ByteBufUtil.hexDump(buf.readSlice(2));
|
||||||
|
result = buf.readUnsignedByte();
|
||||||
|
log.info("[JT-注销] 设备: {}", header.getTerminalId());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||||
|
SessionManager.INSTANCE.response(header.getTerminalId(), "0001", (long) respNo, JSON.toJSONString(this));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRespNo() {
|
||||||
|
return respNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRespId() {
|
||||||
|
return respId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplicationEvent getEvent() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.jt1078.proc.request;
|
package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.CivilCodePo;
|
||||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
||||||
import com.genersoft.iot.vmp.jt1078.codec.netty.Jt808Handler;
|
import com.genersoft.iot.vmp.jt1078.codec.netty.Jt808Handler;
|
||||||
@ -9,6 +10,7 @@ import com.genersoft.iot.vmp.jt1078.proc.response.J8100;
|
|||||||
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||||
import com.genersoft.iot.vmp.jt1078.session.Session;
|
import com.genersoft.iot.vmp.jt1078.session.Session;
|
||||||
|
import com.genersoft.iot.vmp.utils.CivilCodeUtil;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -34,9 +36,9 @@ public class J0100 extends Re {
|
|||||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||||
Short version = header.getVersion();
|
Short version = header.getVersion();
|
||||||
device = new JTDevice();
|
device = new JTDevice();
|
||||||
device.setProvinceId(buf.readUnsignedShort());
|
device.setProvinceId(buf.readUnsignedShort() + "");
|
||||||
if (version >= 1) {
|
if (version >= 1) {
|
||||||
device.setCityId(buf.readUnsignedShort());
|
device.setCityId(buf.readUnsignedShort() + "");
|
||||||
// decode as 2019
|
// decode as 2019
|
||||||
byte[] bytes11 = new byte[11];
|
byte[] bytes11 = new byte[11];
|
||||||
buf.readBytes(bytes11);
|
buf.readBytes(bytes11);
|
||||||
@ -59,7 +61,7 @@ public class J0100 extends Re {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// decode as 2013
|
// decode as 2013
|
||||||
device.setCityId(buf.readUnsignedShort());
|
device.setCityId(buf.readUnsignedShort() + "");
|
||||||
// decode as 2019
|
// decode as 2019
|
||||||
byte[] bytes5 = new byte[5];
|
byte[] bytes5 = new byte[5];
|
||||||
buf.readBytes(bytes5);
|
buf.readBytes(bytes5);
|
||||||
@ -90,17 +92,34 @@ public class J0100 extends Re {
|
|||||||
J8100 j8100 = new J8100();
|
J8100 j8100 = new J8100();
|
||||||
j8100.setRespNo(header.getSn());
|
j8100.setRespNo(header.getSn());
|
||||||
// 从数据库判断这个设备是否合法
|
// 从数据库判断这个设备是否合法
|
||||||
JTDevice deviceInDb = service.getDevice(header.getDevId());
|
JTDevice deviceInDb = service.getDevice(header.getTerminalId());
|
||||||
if (deviceInDb != null) {
|
if (deviceInDb != null) {
|
||||||
j8100.setResult(J8100.SUCCESS);
|
j8100.setResult(J8100.SUCCESS);
|
||||||
String authenticationCode = UUID.randomUUID().toString();
|
String authenticationCode = UUID.randomUUID().toString();
|
||||||
j8100.setCode(authenticationCode);
|
j8100.setCode(authenticationCode);
|
||||||
deviceInDb.setAuthenticationCode(authenticationCode);
|
deviceInDb.setAuthenticationCode(authenticationCode);
|
||||||
deviceInDb.setStatus(true);
|
deviceInDb.setStatus(true);
|
||||||
|
deviceInDb.setProvinceId(device.getProvinceId());
|
||||||
|
CivilCodePo provinceCivilCodePo = CivilCodeUtil.INSTANCE.get(device.getProvinceId());
|
||||||
|
if (provinceCivilCodePo != null) {
|
||||||
|
deviceInDb.setProvinceText(provinceCivilCodePo.getName());
|
||||||
|
}
|
||||||
|
deviceInDb.setCityId(device.getCityId());
|
||||||
|
CivilCodePo cityCivilCodePo = CivilCodeUtil.INSTANCE.get(device.getProvinceId() +
|
||||||
|
String.format("%04d", Integer.parseInt(device.getCityId())));
|
||||||
|
if (cityCivilCodePo != null) {
|
||||||
|
deviceInDb.setCityText(cityCivilCodePo.getName());
|
||||||
|
}
|
||||||
|
deviceInDb.setDeviceModel(device.getDeviceModel());
|
||||||
|
deviceInDb.setMakerId(device.getMakerId());
|
||||||
|
deviceInDb.setDeviceId(device.getDeviceId());
|
||||||
|
// TODO 支持直接展示车牌颜色的描述
|
||||||
|
deviceInDb.setPlateColor(device.getPlateColor());
|
||||||
|
deviceInDb.setPlateNo(device.getPlateNo());
|
||||||
service.updateDevice(deviceInDb);
|
service.updateDevice(deviceInDb);
|
||||||
log.info("[注册成功] 设备: {}", device.getDeviceId());
|
log.info("[JT-注册成功] 设备: {}", deviceInDb);
|
||||||
}else {
|
}else {
|
||||||
log.info("[注册失败] 未授权设备: {}", device.getDeviceId());
|
log.info("[JT-注册失败] 未授权设备: {}", header.getTerminalId());
|
||||||
j8100.setResult(J8100.FAIL);
|
j8100.setResult(J8100.FAIL);
|
||||||
// 断开连接,清理资源
|
// 断开连接,清理资源
|
||||||
if (session.isRegistered()) {
|
if (session.isRegistered()) {
|
||||||
|
|||||||
@ -51,7 +51,7 @@ public class J1205 extends Re {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||||
SessionManager.INSTANCE.response(header.getDevId(), "1205", (long) respNo, JSON.toJSONString(this));
|
SessionManager.INSTANCE.response(header.getTerminalId(), "1205", (long) respNo, JSON.toJSONString(this));
|
||||||
|
|
||||||
J8001 j8001 = new J8001();
|
J8001 j8001 = new J8001();
|
||||||
j8001.setRespNo(header.getSn());
|
j8001.setRespNo(header.getSn());
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public abstract class Re {
|
|||||||
|
|
||||||
public Rs decode(ByteBuf buf, Header header, Session session, Ijt1078Service service) {
|
public Rs decode(ByteBuf buf, Header header, Session session, Ijt1078Service service) {
|
||||||
if (session != null && !StringUtils.hasLength(session.getDevId())) {
|
if (session != null && !StringUtils.hasLength(session.getDevId())) {
|
||||||
session.register(header.getDevId(), (int) header.getVersion(), header);
|
session.register(header.getTerminalId(), (int) header.getVersion(), header);
|
||||||
}
|
}
|
||||||
Rs rs = decode0(buf, header, session);
|
Rs rs = decode0(buf, header, session);
|
||||||
Rs rsHand = handler(header, session, service);
|
Rs rsHand = handler(header, session, service);
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import com.github.pagehelper.PageInfo;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface Ijt1078Service {
|
public interface Ijt1078Service {
|
||||||
JTDevice getDevice(String devId);
|
JTDevice getDevice(String terminalId);
|
||||||
|
|
||||||
void updateDevice(JTDevice deviceInDb);
|
void updateDevice(JTDevice deviceInDb);
|
||||||
|
|
||||||
|
|||||||
@ -19,8 +19,8 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JTDevice getDevice(String devId) {
|
public JTDevice getDevice(String terminalId) {
|
||||||
return jtDeviceMapper.getDevice(devId);
|
return jtDeviceMapper.getDevice(terminalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,6 +45,6 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteDeviceByDeviceId(String deviceId) {
|
public void deleteDeviceByDeviceId(String deviceId) {
|
||||||
jtDeviceMapper.deleteDeviceByDeviceId(deviceId);
|
jtDeviceMapper.deleteDeviceByTerminalId(deviceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,6 +27,10 @@ public enum CivilCodeUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CivilCodePo get(String code) {
|
||||||
|
return civilCodeMap.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
public CivilCodePo getParentCode(String code) {
|
public CivilCodePo getParentCode(String code) {
|
||||||
if (code.length() > 8) {
|
if (code.length() > 8) {
|
||||||
return null;
|
return null;
|
||||||
@ -45,6 +49,5 @@ public enum CivilCodeUtil {
|
|||||||
}
|
}
|
||||||
return civilCodeMap.get(parentCode);
|
return civilCodeMap.get(parentCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,21 +11,23 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--设备列表-->
|
<!--设备列表-->
|
||||||
<el-table :data="deviceList" style="width: 100%;font-size: 12px;" :height="winHeight" header-row-class-name="table-header">
|
<el-table :data="deviceList" style="width: 100%;font-size: 12px;" :height="winHeight" header-row-class-name="table-header">
|
||||||
<el-table-column prop="provinceId" label="省域ID" min-width="160">
|
<el-table-column prop="terminalId" label="终端ID" min-width="160">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="cityId" label="市县域ID" min-width="200" >
|
<el-table-column prop="provinceText" label="省域" min-width="160">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="makerId" label="制造商ID" min-width="200" >
|
<el-table-column prop="cityText" label="市县域" min-width="160" >
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="deviceModel" label="终端型号" min-width="200" >
|
<el-table-column prop="makerId" label="制造商ID" min-width="160" >
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="deviceId" label="终端ID" min-width="200" >
|
<el-table-column prop="deviceModel" label="终端型号" min-width="160" >
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="plateColor" label="车牌颜色" min-width="200" >
|
<el-table-column prop="deviceId" label="设备ID" min-width="160" >
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="plateNo" label="车牌" min-width="200" >
|
<el-table-column prop="plateColor" label="车牌颜色" min-width="160" >
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" min-width="120">
|
<el-table-column prop="plateNo" label="车牌" min-width="160" >
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" min-width="160">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div slot="reference" class="name-wrapper">
|
<div slot="reference" class="name-wrapper">
|
||||||
<el-tag size="medium" v-if="scope.row.status">在线</el-tag>
|
<el-tag size="medium" v-if="scope.row.status">在线</el-tag>
|
||||||
|
|||||||
@ -11,8 +11,8 @@
|
|||||||
>
|
>
|
||||||
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
|
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
|
||||||
<el-form ref="form" :rules="rules" :model="form" label-width="200px" >
|
<el-form ref="form" :rules="rules" :model="form" label-width="200px" >
|
||||||
<el-form-item label="设备编号" prop="deviceId">
|
<el-form-item label="终端ID" prop="terminalId">
|
||||||
<el-input v-model="form.deviceId" clearable></el-input>
|
<el-input v-model="form.terminalId" clearable></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
|
|||||||
@ -317,9 +317,12 @@ create table wvp_resources_tree (
|
|||||||
|
|
||||||
create table wvp_jt_device (
|
create table wvp_jt_device (
|
||||||
id serial primary key,
|
id serial primary key,
|
||||||
device_id character varying(50) not null,
|
device_id character varying(50),
|
||||||
|
terminal_id character varying(50) not null,
|
||||||
province_id character varying(50),
|
province_id character varying(50),
|
||||||
|
province_text character varying(100),
|
||||||
city_id character varying(50),
|
city_id character varying(50),
|
||||||
|
city_text character varying(100),
|
||||||
maker_id character varying(50),
|
maker_id character varying(50),
|
||||||
device_model character varying(50),
|
device_model character varying(50),
|
||||||
plate_color character varying(50),
|
plate_color character varying(50),
|
||||||
@ -330,7 +333,7 @@ create table wvp_jt_device (
|
|||||||
status bool default false,
|
status bool default false,
|
||||||
update_time character varying(50) not null,
|
update_time character varying(50) not null,
|
||||||
create_time character varying(50) not null,
|
create_time character varying(50) not null,
|
||||||
constraint uk_jt_device_id_device_id unique (id, device_id)
|
constraint uk_jt_device_id_device_id unique (id, terminal_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
/*初始数据*/
|
/*初始数据*/
|
||||||
|
|||||||
@ -317,9 +317,12 @@ create table wvp_resources_tree (
|
|||||||
|
|
||||||
create table wvp_jt_device (
|
create table wvp_jt_device (
|
||||||
id serial primary key,
|
id serial primary key,
|
||||||
device_id character varying(50) not null,
|
device_id character varying(50),
|
||||||
|
terminal_id character varying(50) not null,
|
||||||
province_id character varying(50),
|
province_id character varying(50),
|
||||||
|
province_text character varying(100),
|
||||||
city_id character varying(50),
|
city_id character varying(50),
|
||||||
|
city_text character varying(100),
|
||||||
maker_id character varying(50),
|
maker_id character varying(50),
|
||||||
device_model character varying(50),
|
device_model character varying(50),
|
||||||
plate_color character varying(50),
|
plate_color character varying(50),
|
||||||
@ -330,7 +333,7 @@ create table wvp_jt_device (
|
|||||||
status bool default false,
|
status bool default false,
|
||||||
update_time character varying(50) not null,
|
update_time character varying(50) not null,
|
||||||
create_time character varying(50) not null,
|
create_time character varying(50) not null,
|
||||||
constraint uk_jt_device_id_device_id unique (id, device_id)
|
constraint uk_jt_device_id_device_id unique (id, terminal_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
/*初始数据*/
|
/*初始数据*/
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
create table wvp_jt_device (
|
create table wvp_jt_device (
|
||||||
id serial primary key,
|
id serial primary key,
|
||||||
device_id character varying(50) not null,
|
device_id character varying(50),
|
||||||
|
terminal_id character varying(50) not null,
|
||||||
province_id character varying(50),
|
province_id character varying(50),
|
||||||
|
province_text character varying(100),
|
||||||
city_id character varying(50),
|
city_id character varying(50),
|
||||||
|
city_text character varying(100),
|
||||||
maker_id character varying(50),
|
maker_id character varying(50),
|
||||||
device_model character varying(50),
|
device_model character varying(50),
|
||||||
plate_color character varying(50),
|
plate_color character varying(50),
|
||||||
@ -13,5 +16,5 @@ create table wvp_jt_device (
|
|||||||
status bool default false,
|
status bool default false,
|
||||||
update_time character varying(50) not null,
|
update_time character varying(50) not null,
|
||||||
create_time character varying(50) not null,
|
create_time character varying(50) not null,
|
||||||
constraint uk_jt_device_id_device_id unique (id, device_id)
|
constraint uk_jt_device_id_device_id unique (id, terminal_id)
|
||||||
);
|
);
|
||||||
@ -1,8 +1,11 @@
|
|||||||
create table wvp_jt_device (
|
create table wvp_jt_device (
|
||||||
id serial primary key,
|
id serial primary key,
|
||||||
device_id character varying(50) not null,
|
device_id character varying(50),
|
||||||
|
terminal_id character varying(50) not null,
|
||||||
province_id character varying(50),
|
province_id character varying(50),
|
||||||
|
province_text character varying(100),
|
||||||
city_id character varying(50),
|
city_id character varying(50),
|
||||||
|
city_text character varying(100),
|
||||||
maker_id character varying(50),
|
maker_id character varying(50),
|
||||||
device_model character varying(50),
|
device_model character varying(50),
|
||||||
plate_color character varying(50),
|
plate_color character varying(50),
|
||||||
@ -13,5 +16,5 @@ create table wvp_jt_device (
|
|||||||
status bool default false,
|
status bool default false,
|
||||||
update_time character varying(50) not null,
|
update_time character varying(50) not null,
|
||||||
create_time character varying(50) not null,
|
create_time character varying(50) not null,
|
||||||
constraint uk_jt_device_id_device_id unique (id, device_id)
|
constraint uk_jt_device_id_device_id unique (id, terminal_id)
|
||||||
);
|
);
|
||||||
Loading…
Reference in New Issue
Block a user