1078-设置多边形区域...
This commit is contained in:
@@ -0,0 +1,134 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.bean;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
|
||||||
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "多边形区域")
|
||||||
|
public class JTPolygonArea {
|
||||||
|
|
||||||
|
@Schema(description = "区域 ID")
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@Schema(description = "")
|
||||||
|
private JTAreaAttribute attribute;
|
||||||
|
|
||||||
|
@Schema(description = "起始时间, yyyy-MM-dd HH:mm:ss")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@Schema(description = "结束时间, yyyy-MM-dd HH:mm:ss")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
@Schema(description = "最高速度, 单位为千米每小时(km/h)")
|
||||||
|
private int maxSpeed;
|
||||||
|
|
||||||
|
@Schema(description = "超速持续时间, 单位为秒(s)")
|
||||||
|
private int overSpeedDuration;
|
||||||
|
|
||||||
|
@Schema(description = "区域顶点")
|
||||||
|
private List<JTPolygonPoint> polygonPoints;
|
||||||
|
|
||||||
|
@Schema(description = "夜间最高速度, 单位为千米每小时(km/h)")
|
||||||
|
private int nighttimeMaxSpeed;
|
||||||
|
|
||||||
|
@Schema(description = "区域的名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public ByteBuf encode(){
|
||||||
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
|
byteBuf.writeInt((int) (id & 0xffffffffL));
|
||||||
|
byteBuf.writeBytes(attribute.encode());
|
||||||
|
byteBuf.writeBytes(BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)));
|
||||||
|
byteBuf.writeBytes(BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime)));
|
||||||
|
byteBuf.writeShort((short)(maxSpeed & 0xffff));
|
||||||
|
byteBuf.writeByte(overSpeedDuration);
|
||||||
|
|
||||||
|
byteBuf.writeShort((short)(polygonPoints.size() & 0xffff));
|
||||||
|
if (!polygonPoints.isEmpty()) {
|
||||||
|
for (JTPolygonPoint polygonPoint : polygonPoints) {
|
||||||
|
byteBuf.writeBytes(polygonPoint.encode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
byteBuf.writeShort((short)(nighttimeMaxSpeed & 0xffff));
|
||||||
|
byteBuf.writeShort((short)(name.getBytes(Charset.forName("GBK")).length & 0xffff));
|
||||||
|
byteBuf.writeCharSequence(name, Charset.forName("GBK"));
|
||||||
|
return byteBuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JTAreaAttribute getAttribute() {
|
||||||
|
return attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttribute(JTAreaAttribute attribute) {
|
||||||
|
this.attribute = attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JTPolygonPoint> getPolygonPoints() {
|
||||||
|
return polygonPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolygonPoints(List<JTPolygonPoint> polygonPoints) {
|
||||||
|
this.polygonPoints = polygonPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(String startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(String endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxSpeed() {
|
||||||
|
return maxSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxSpeed(int maxSpeed) {
|
||||||
|
this.maxSpeed = maxSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOverSpeedDuration() {
|
||||||
|
return overSpeedDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverSpeedDuration(int overSpeedDuration) {
|
||||||
|
this.overSpeedDuration = overSpeedDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNighttimeMaxSpeed() {
|
||||||
|
return nighttimeMaxSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNighttimeMaxSpeed(int nighttimeMaxSpeed) {
|
||||||
|
this.nighttimeMaxSpeed = nighttimeMaxSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.bean;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
@Schema(description = "多边形区域的顶点")
|
||||||
|
public class JTPolygonPoint {
|
||||||
|
|
||||||
|
@Schema(description = "顶点纬度")
|
||||||
|
private Double latitude;
|
||||||
|
|
||||||
|
@Schema(description = "顶点经度")
|
||||||
|
private Double longitude;
|
||||||
|
|
||||||
|
public ByteBuf encode(){
|
||||||
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
|
byteBuf.writeInt((int) (Math.round((latitude * 1000000)) & 0xffffffffL));
|
||||||
|
byteBuf.writeInt((int) (Math.round((longitude * 1000000)) & 0xffffffffL));
|
||||||
|
return byteBuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getLatitude() {
|
||||||
|
return latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatitude(Double latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getLongitude() {
|
||||||
|
return longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLongitude(Double longitude) {
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.jt1078.controller.bean;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTCircleArea;
|
import com.genersoft.iot.vmp.jt1078.bean.JTCircleArea;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTPhoneBookContact;
|
import com.genersoft.iot.vmp.jt1078.bean.JTPhoneBookContact;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.JTPolygonArea;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTRectangleArea;
|
import com.genersoft.iot.vmp.jt1078.bean.JTRectangleArea;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
@@ -19,6 +20,9 @@ public class SetAreaParam {
|
|||||||
@Schema(description = "矩形区域项")
|
@Schema(description = "矩形区域项")
|
||||||
private List<JTRectangleArea> rectangleAreas;
|
private List<JTRectangleArea> rectangleAreas;
|
||||||
|
|
||||||
|
@Schema(description = "多边形区域")
|
||||||
|
private JTPolygonArea polygonArea;
|
||||||
|
|
||||||
|
|
||||||
public String getDeviceId() {
|
public String getDeviceId() {
|
||||||
return deviceId;
|
return deviceId;
|
||||||
@@ -44,12 +48,21 @@ public class SetAreaParam {
|
|||||||
this.rectangleAreas = rectangleAreas;
|
this.rectangleAreas = rectangleAreas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JTPolygonArea getPolygonArea() {
|
||||||
|
return polygonArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolygonArea(JTPolygonArea polygonArea) {
|
||||||
|
this.polygonArea = polygonArea;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SetAreaParam{" +
|
return "SetAreaParam{" +
|
||||||
"deviceId='" + deviceId + '\'' +
|
"deviceId='" + deviceId + '\'' +
|
||||||
", circleAreaList=" + circleAreaList +
|
", circleAreaList=" + circleAreaList +
|
||||||
", rectangleAreas=" + rectangleAreas +
|
", rectangleAreas=" + rectangleAreas +
|
||||||
|
", polygonArea=" + polygonArea +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.proc.response;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.JTPolygonArea;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.JTRectangleArea;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置多边形区域
|
||||||
|
*/
|
||||||
|
@MsgId(id = "8604")
|
||||||
|
public class J8604 extends Rs {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多边形区域
|
||||||
|
*/
|
||||||
|
private JTPolygonArea polygonArea;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ByteBuf encode() {
|
||||||
|
ByteBuf buffer = Unpooled.buffer();
|
||||||
|
buffer.writeBytes(polygonArea.encode());
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JTPolygonArea getPolygonArea() {
|
||||||
|
return polygonArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolygonArea(JTPolygonArea polygonArea) {
|
||||||
|
this.polygonArea = polygonArea;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.proc.response;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除多边形区域
|
||||||
|
*/
|
||||||
|
@MsgId(id = "8605")
|
||||||
|
public class J8605 extends Rs {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待删除的区域ID
|
||||||
|
*/
|
||||||
|
private List<Long> idList;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ByteBuf encode() {
|
||||||
|
ByteBuf buffer = Unpooled.buffer();
|
||||||
|
if (idList == null || idList.isEmpty()) {
|
||||||
|
buffer.writeByte(0);
|
||||||
|
return buffer;
|
||||||
|
}else {
|
||||||
|
buffer.writeByte(idList.size());
|
||||||
|
}
|
||||||
|
for (Long id : idList) {
|
||||||
|
buffer.writeInt((int) (id & 0xffffffffL));
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> getIdList() {
|
||||||
|
return idList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdList(List<Long> idList) {
|
||||||
|
this.idList = idList;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user