mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-24 14:07:50 +08:00
1078-设置圆形区域
This commit is contained in:
parent
5dd49b3d44
commit
faa0a01b9f
@ -48,22 +48,17 @@ public class JTCircleArea {
|
|||||||
public ByteBuf encode(){
|
public ByteBuf encode(){
|
||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeInt((int) (id & 0xffffffffL));
|
byteBuf.writeInt((int) (id & 0xffffffffL));
|
||||||
System.out.println("attribute: " + attribute.encode().readableBytes());
|
|
||||||
byteBuf.writeBytes(attribute.encode());
|
byteBuf.writeBytes(attribute.encode());
|
||||||
byteBuf.writeInt((int) (Math.round((latitude * 1000000)) & 0xffffffffL));
|
byteBuf.writeInt((int) (Math.round((latitude * 1000000)) & 0xffffffffL));
|
||||||
byteBuf.writeInt((int) (Math.round((longitude * 1000000)) & 0xffffffffL));
|
byteBuf.writeInt((int) (Math.round((longitude * 1000000)) & 0xffffffffL));
|
||||||
byteBuf.writeInt((int) (radius & 0xffffffffL));
|
byteBuf.writeInt((int) (radius & 0xffffffffL));
|
||||||
ByteBuf transform = BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime));
|
|
||||||
ByteBuf transform1 = BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime));
|
|
||||||
System.out.println("startTime: " + transform.readableBytes());
|
|
||||||
System.out.println("endTime: " + transform1.readableBytes());
|
|
||||||
byteBuf.writeBytes(BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)));
|
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.writeBytes(BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime)));
|
||||||
byteBuf.writeShort((short)(maxSpeed & 0xffff));
|
byteBuf.writeShort((short)(maxSpeed & 0xffff));
|
||||||
byteBuf.writeByte(overSpeedDuration);
|
byteBuf.writeByte(overSpeedDuration);
|
||||||
|
byteBuf.writeShort((short)(nighttimeMaxSpeed & 0xffff));
|
||||||
byteBuf.writeShort((short)(name.getBytes(Charset.forName("GBK")).length & 0xffff));
|
byteBuf.writeShort((short)(name.getBytes(Charset.forName("GBK")).length & 0xffff));
|
||||||
byteBuf.writeCharSequence(name, Charset.forName("GBK"));
|
byteBuf.writeCharSequence(name, Charset.forName("GBK"));
|
||||||
System.out.println(byteBuf.readableBytes());
|
|
||||||
return byteBuf;
|
return byteBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ public class JT1078Template {
|
|||||||
private static final String H8401 = "8401";
|
private static final String H8401 = "8401";
|
||||||
private static final String H8500 = "8500";
|
private static final String H8500 = "8500";
|
||||||
private static final String H8600 = "8600";
|
private static final String H8600 = "8600";
|
||||||
|
private static final String H8601 = "8601";
|
||||||
private static final String H9101 = "9101";
|
private static final String H9101 = "9101";
|
||||||
private static final String H9102 = "9102";
|
private static final String H9102 = "9102";
|
||||||
private static final String H9201 = "9201";
|
private static final String H9201 = "9201";
|
||||||
@ -457,4 +458,15 @@ public class JT1078Template {
|
|||||||
.build();
|
.build();
|
||||||
return SessionManager.INSTANCE.request(cmd, timeOut);
|
return SessionManager.INSTANCE.request(cmd, timeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object deleteAreaForCircle(String devId, J8601 j8601, int timeOut) {
|
||||||
|
Cmd cmd = new Cmd.Builder()
|
||||||
|
.setDevId(devId)
|
||||||
|
.setPackageNo(randomInt())
|
||||||
|
.setMsgId(H8601)
|
||||||
|
.setRespId(H0001)
|
||||||
|
.setRs(j8601)
|
||||||
|
.build();
|
||||||
|
return SessionManager.INSTANCE.request(cmd, timeOut);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -529,5 +529,22 @@ public class JT1078Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "1078-删除圆形区域", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||||
|
@Parameter(name = "ids", description = "待删除圆形区域的id,例如1,2,3", required = true)
|
||||||
|
@GetMapping("/area/circle/delete")
|
||||||
|
public WVPResult<Integer> deleteAreaForCircle(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||||
|
|
||||||
|
logger.info("[1078-删除圆形区域] deviceId: {}, ids:{}", deviceId, ids);
|
||||||
|
int result = service.deleteAreaForCircle(deviceId, ids);
|
||||||
|
if (result == 0) {
|
||||||
|
return WVPResult.success(result);
|
||||||
|
}else {
|
||||||
|
WVPResult<Integer> fail = WVPResult.fail(ErrorCode.ERROR100);
|
||||||
|
fail.setData(result);
|
||||||
|
return fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,45 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.proc.response;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.JTCircleArea;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除圆形区域
|
||||||
|
*/
|
||||||
|
@MsgId(id = "8601")
|
||||||
|
public class J8601 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -72,4 +72,5 @@ public interface Ijt1078Service {
|
|||||||
|
|
||||||
int setAreaForCircle(int attribute, String deviceId, List<JTCircleArea> circleAreaList);
|
int setAreaForCircle(int attribute, String deviceId, List<JTCircleArea> circleAreaList);
|
||||||
|
|
||||||
|
int deleteAreaForCircle(String deviceId, List<Long> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -617,4 +617,11 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
j8600.setCircleAreaList(circleAreaList);
|
j8600.setCircleAreaList(circleAreaList);
|
||||||
return (int)jt1078Template.setAreaForCircle(deviceId, j8600, 20);
|
return (int)jt1078Template.setAreaForCircle(deviceId, j8600, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteAreaForCircle(String deviceId, List<Long> ids) {
|
||||||
|
J8601 j8601 = new J8601();
|
||||||
|
j8601.setIdList(ids);
|
||||||
|
return (int)jt1078Template.deleteAreaForCircle(deviceId, j8601, 20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user