1078-设置多边形区域+删除多边形区域

This commit is contained in:
648540858
2024-05-04 21:56:47 +08:00
parent 58401b1444
commit a3149139e2
4 changed files with 75 additions and 0 deletions

View File

@@ -34,6 +34,8 @@ public class JT1078Template {
private static final String H8601 = "8601";
private static final String H8602 = "8602";
private static final String H8603 = "8603";
private static final String H8604 = "8604";
private static final String H8605 = "8605";
private static final String H9101 = "9101";
private static final String H9102 = "9102";
private static final String H9201 = "9201";
@@ -493,4 +495,26 @@ public class JT1078Template {
.build();
return SessionManager.INSTANCE.request(cmd, timeOut);
}
public Object setAreaForPolygon(String devId, J8604 j8604, int timeOut) {
Cmd cmd = new Cmd.Builder()
.setDevId(devId)
.setPackageNo(randomInt())
.setMsgId(H8604)
.setRespId(H0001)
.setRs(j8604)
.build();
return SessionManager.INSTANCE.request(cmd, timeOut);
}
public Object deleteAreaForPolygon(String devId, J8605 j8605, int timeOut) {
Cmd cmd = new Cmd.Builder()
.setDevId(devId)
.setPackageNo(randomInt())
.setMsgId(H8605)
.setRespId(H0001)
.setRs(j8605)
.build();
return SessionManager.INSTANCE.request(cmd, timeOut);
}
}

View File

@@ -612,5 +612,38 @@ public class JT1078Controller {
}
}
@Operation(summary = "1078-设置多边形区域", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "areaParam", description = "设置区域参数", required = true)
@PostMapping("/area/polygon/set")
public WVPResult<Integer> setAreaForPolygon(@RequestBody SetAreaParam areaParam){
logger.info("[1078-设置多边形区域] areaParam: {},", areaParam);
int result = service.setAreaForPolygon(areaParam.getDeviceId(), areaParam.getPolygonArea());
if (result == 0) {
return WVPResult.success(result);
}else {
WVPResult<Integer> fail = WVPResult.fail(ErrorCode.ERROR100);
fail.setData(result);
return fail;
}
}
@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/polygon/delete")
public WVPResult<Integer> deleteAreaForPolygon(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
logger.info("[1078-删除多边形区域] deviceId: {}, ids:{}", deviceId, ids);
int result = service.deleteAreaForPolygon(deviceId, ids);
if (result == 0) {
return WVPResult.success(result);
}else {
WVPResult<Integer> fail = WVPResult.fail(ErrorCode.ERROR100);
fail.setData(result);
return fail;
}
}
}

View File

@@ -77,4 +77,8 @@ public interface Ijt1078Service {
int setAreaForRectangle(int i, String deviceId, List<JTRectangleArea> rectangleAreas);
int deleteAreaForRectangle(String deviceId, List<Long> ids);
int setAreaForPolygon(String deviceId, JTPolygonArea polygonArea);
int deleteAreaForPolygon(String deviceId, List<Long> ids);
}

View File

@@ -639,4 +639,18 @@ public class jt1078ServiceImpl implements Ijt1078Service {
j8603.setIdList(ids);
return (int)jt1078Template.deleteAreaForRectangle(deviceId, j8603, 20);
}
@Override
public int setAreaForPolygon(String deviceId, JTPolygonArea polygonArea) {
J8604 j8604 = new J8604();
j8604.setPolygonArea(polygonArea);
return (int)jt1078Template.setAreaForPolygon(deviceId, j8604, 20);
}
@Override
public int deleteAreaForPolygon(String deviceId, List<Long> ids) {
J8605 j8605 = new J8605();
j8605.setIdList(ids);
return (int)jt1078Template.deleteAreaForPolygon(deviceId, j8605, 20);
}
}