电子围栏-位置检查

This commit is contained in:
2025-09-12 09:04:47 +08:00
parent ee8840d657
commit 1722f92328
12 changed files with 28 additions and 46 deletions

View File

@ -32,11 +32,12 @@ import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/fys-equipment/fenceAccessRecord")
@RequestMapping("/api/equipment/fenceAccessRecord")
public class DeviceFenceAccessRecordController extends BaseController {
private final IDeviceFenceAccessRecordService deviceFenceAccessRecordService;
/**
* 查询围栏进出记录列表
*/
@ -47,10 +48,10 @@ public class DeviceFenceAccessRecordController extends BaseController {
}
/**
* 围栏进出记录列表
* 导出围栏进出记录列表
*/
@SaCheckPermission("fys-equipment:fenceAccessRecord:export")
@Log(title = "围栏进出记录", businessType = BusinessType.EXPORT)
@Log(title = "导出围栏进出记录列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(DeviceFenceAccessRecordBo bo, HttpServletResponse response) {
List<DeviceFenceAccessRecordVo> list = deviceFenceAccessRecordService.queryList(bo);

View File

@ -35,11 +35,12 @@ import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/fys-equipment/geoFence")
@RequestMapping("/api/equipment/geoFence")
public class DeviceGeoFenceController extends BaseController {
private final IDeviceGeoFenceService deviceGeoFenceService;
/**
* 查询电子围栏列表
*/
@ -50,10 +51,10 @@ public class DeviceGeoFenceController extends BaseController {
}
/**
* 电子围栏列表
* 导出电子围栏列表
*/
@SaCheckPermission("fys-equipment:geoFence:export")
@Log(title = "电子围栏", businessType = BusinessType.EXPORT)
@Log(title = "导出电子围栏列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(DeviceGeoFenceBo bo, HttpServletResponse response) {
List<DeviceGeoFenceVo> list = deviceGeoFenceService.queryList(bo);
@ -109,7 +110,7 @@ public class DeviceGeoFenceController extends BaseController {
/**
* 位置检查
* 电子围栏-位置检查
*
* @param request
* @return

View File

@ -69,10 +69,4 @@ public class DeviceFenceAccessRecord extends BaseEntity {
*/
private Date eventTime;
/**
* 记录创建时间
*/
private Date createdTime;
}

View File

@ -59,20 +59,5 @@ public class DeviceGeoFence extends BaseEntity {
*/
private Long isActive;
/**
* 创建人
*/
private Long createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updatedTime;
}

View File

@ -77,7 +77,7 @@ public class DeviceFenceAccessRecordBo extends BaseEntity {
/**
* 记录创建时间
*/
private Date createdTime;
private Date createTime;
}

View File

@ -61,20 +61,15 @@ public class DeviceGeoFenceBo extends BaseEntity {
*/
private Long isActive;
/**
* 创建人
*/
private Long createdBy;
/**
* 创建时间
*/
private Date createdTime;
private Date createTime;
/**
* 更新时间
*/
private Date updatedTime;
private Date updateTime;
}

View File

@ -35,5 +35,6 @@ public class FenceCheckRequest {
/**
* 定位精度(米)
*/
private Double accuracy;
private Long accuracy;
}

View File

@ -88,7 +88,7 @@ public class DeviceFenceAccessRecordVo implements Serializable {
* 记录创建时间
*/
@ExcelProperty(value = "记录创建时间")
private Date createdTime;
private Date createTime;
}

View File

@ -76,19 +76,19 @@ public class DeviceGeoFenceVo implements Serializable {
* 创建人
*/
@ExcelProperty(value = "创建人")
private Long createdBy;
private Long createBy;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private Date createdTime;
private Date createTime;
/**
* 更新时间
*/
@ExcelProperty(value = "更新时间")
private Date updatedTime;
private Date updateTime;
}

View File

@ -82,7 +82,7 @@ public class DeviceFenceAccessRecordServiceImpl implements IDeviceFenceAccessRec
lqw.eq(bo.getLongitude() != null, DeviceFenceAccessRecord::getLongitude, bo.getLongitude());
lqw.eq(bo.getAccuracy() != null, DeviceFenceAccessRecord::getAccuracy, bo.getAccuracy());
lqw.eq(bo.getEventTime() != null, DeviceFenceAccessRecord::getEventTime, bo.getEventTime());
lqw.eq(bo.getCreatedTime() != null, DeviceFenceAccessRecord::getCreatedTime, bo.getCreatedTime());
lqw.eq(bo.getCreateTime() != null, DeviceFenceAccessRecord::getCreateTime, bo.getCreateTime());
return lqw;
}

View File

@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Collection;
@ -85,9 +86,9 @@ public class DeviceGeoFenceServiceImpl implements IDeviceGeoFenceService {
lqw.eq(StringUtils.isNotBlank(bo.getCoordinates()), DeviceGeoFence::getCoordinates, bo.getCoordinates());
lqw.eq(bo.getRadius() != null, DeviceGeoFence::getRadius, bo.getRadius());
lqw.eq(bo.getIsActive() != null, DeviceGeoFence::getIsActive, bo.getIsActive());
lqw.eq(bo.getCreatedBy() != null, DeviceGeoFence::getCreatedBy, bo.getCreatedBy());
lqw.eq(bo.getCreatedTime() != null, DeviceGeoFence::getCreatedTime, bo.getCreatedTime());
lqw.eq(bo.getUpdatedTime() != null, DeviceGeoFence::getUpdatedTime, bo.getUpdatedTime());
lqw.eq(bo.getCreateBy() != null, DeviceGeoFence::getCreateBy, bo.getCreateBy());
lqw.eq(bo.getCreateTime() != null, DeviceGeoFence::getCreateTime, bo.getCreateTime());
lqw.eq(bo.getUpdateTime() != null, DeviceGeoFence::getUpdateTime, bo.getUpdateTime());
return lqw;
}
@ -181,13 +182,16 @@ public class DeviceGeoFenceServiceImpl implements IDeviceGeoFenceService {
}
FenceCheckResponse.FenceInfo fenceInfo = new FenceCheckResponse.FenceInfo();
List<FenceCheckResponse.FenceInfo> list = new ArrayList<>();
boolean pointInFence = GeoFenceChecker.isPointInFence(request.getLatitude(), request.getLongitude(), fence.getAreaType(), coordinateList, fence.getRadius());
if (pointInFence) {
fenceInfo.setFenceId(fence.getId());
fenceInfo.setFenceName(fence.getName());
fenceInfo.setFenceType(fence.getAreaType());
response.setEnteredFences(list);
response.getEnteredFences().add(fenceInfo);
} else {
response.setExitedFences(list);
response.getExitedFences().add(fenceInfo);
}
}

View File

@ -238,7 +238,8 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
DeviceTypeQueryCriteria deviceTypeQueryCriteria = new DeviceTypeQueryCriteria();
deviceTypeQueryCriteria.setDeviceTypeId(deviceAssignments.getDeviceId());
deviceTypeQueryCriteria.setCustomerId(LoginHelper.getUserId());
// 被授权的客户
// deviceTypeQueryCriteria.setCustomerId(LoginHelper.getUserId());
List<DeviceType> deviceTypes = deviceTypeMapper.findAll(deviceTypeQueryCriteria);
if (deviceTypes.isEmpty()) {
throw new Exception("设备类型不存在!!!");