Compare commits
3 Commits
ee8840d657
...
8597dc5a9f
| Author | SHA1 | Date | |
|---|---|---|---|
| 8597dc5a9f | |||
| 01a1a6e25b | |||
| 1722f92328 |
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -69,10 +69,4 @@ public class DeviceFenceAccessRecord extends BaseEntity {
|
||||
*/
|
||||
private Date eventTime;
|
||||
|
||||
/**
|
||||
* 记录创建时间
|
||||
*/
|
||||
private Date createdTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -59,20 +59,5 @@ public class DeviceGeoFence extends BaseEntity {
|
||||
*/
|
||||
private Long isActive;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updatedTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -55,13 +55,13 @@ public class DeviceFenceAccessRecordBo extends BaseEntity {
|
||||
* 纬度
|
||||
*/
|
||||
@NotNull(message = "纬度不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long latitude;
|
||||
private Double latitude;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@NotNull(message = "经度不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long longitude;
|
||||
private Double longitude;
|
||||
|
||||
/**
|
||||
* 定位精度
|
||||
@ -77,7 +77,7 @@ public class DeviceFenceAccessRecordBo extends BaseEntity {
|
||||
/**
|
||||
* 记录创建时间
|
||||
*/
|
||||
private Date createdTime;
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -35,5 +35,6 @@ public class FenceCheckRequest {
|
||||
/**
|
||||
* 定位精度(米)
|
||||
*/
|
||||
private Double accuracy;
|
||||
private Long accuracy;
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.fuyuanshen.equipment.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
@ -15,7 +16,6 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 围栏进出记录视图对象 device_fence_access_record
|
||||
*
|
||||
@ -33,31 +33,44 @@ public class DeviceFenceAccessRecordVo implements Serializable {
|
||||
/**
|
||||
* 记录ID
|
||||
*/
|
||||
@ExcelProperty(value = "记录ID")
|
||||
// @ExcelProperty(value = "记录ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 围栏ID
|
||||
*/
|
||||
@ExcelProperty(value = "围栏ID")
|
||||
// @ExcelProperty(value = "围栏ID")
|
||||
private Long fenceId;
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
@ExcelProperty(value = "围栏名称")
|
||||
private String fenceName;
|
||||
|
||||
/**
|
||||
* 设备标识
|
||||
*/
|
||||
@ExcelProperty(value = "设备标识")
|
||||
private String deviceId;
|
||||
// @ExcelProperty(value = "设备标识")
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ExcelProperty(value = "用户ID")
|
||||
// @ExcelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@ExcelProperty(value = "事件类型")
|
||||
@ExcelProperty(value = "事件类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=进入围栏,2=离开围栏")
|
||||
private Long eventType;
|
||||
|
||||
/**
|
||||
@ -88,7 +101,7 @@ public class DeviceFenceAccessRecordVo implements Serializable {
|
||||
* 记录创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "记录创建时间")
|
||||
private Date createdTime;
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
package com.fuyuanshen.equipment.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import com.fuyuanshen.equipment.domain.DeviceFenceAccessRecord;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceFenceAccessRecordVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 围栏进出记录Mapper接口
|
||||
@ -12,4 +18,16 @@ import com.fuyuanshen.equipment.domain.vo.DeviceFenceAccessRecordVo;
|
||||
*/
|
||||
public interface DeviceFenceAccessRecordMapper extends BaseMapperPlus<DeviceFenceAccessRecord, DeviceFenceAccessRecordVo> {
|
||||
|
||||
/**
|
||||
* 分页查询围栏进出记录列表(包含围栏名称和设备名称)
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param wrapper 查询条件
|
||||
* @return 围栏进出记录分页列表
|
||||
*/
|
||||
Page<DeviceFenceAccessRecordVo> selectVoPageWithFenceAndDeviceName(Page<DeviceFenceAccessRecord> page, @Param(Constants.WRAPPER) Wrapper<DeviceFenceAccessRecord> wrapper);
|
||||
|
||||
List<DeviceFenceAccessRecordVo> selectVoPageWithFenceAndDeviceName(@Param(Constants.WRAPPER) Wrapper<DeviceFenceAccessRecord> wrapper);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public class DeviceFenceAccessRecordServiceImpl implements IDeviceFenceAccessRec
|
||||
@Override
|
||||
public TableDataInfo<DeviceFenceAccessRecordVo> queryPageList(DeviceFenceAccessRecordBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<DeviceFenceAccessRecord> lqw = buildQueryWrapper(bo);
|
||||
Page<DeviceFenceAccessRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
Page<DeviceFenceAccessRecordVo> result = baseMapper.selectVoPageWithFenceAndDeviceName(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@ -67,13 +67,13 @@ public class DeviceFenceAccessRecordServiceImpl implements IDeviceFenceAccessRec
|
||||
@Override
|
||||
public List<DeviceFenceAccessRecordVo> queryList(DeviceFenceAccessRecordBo bo) {
|
||||
LambdaQueryWrapper<DeviceFenceAccessRecord> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
return baseMapper.selectVoPageWithFenceAndDeviceName(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<DeviceFenceAccessRecord> buildQueryWrapper(DeviceFenceAccessRecordBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<DeviceFenceAccessRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(DeviceFenceAccessRecord::getId);
|
||||
// lqw.orderByAsc(DeviceFenceAccessRecord::getId);
|
||||
lqw.eq(bo.getFenceId() != null, DeviceFenceAccessRecord::getFenceId, bo.getFenceId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceId()), DeviceFenceAccessRecord::getDeviceId, bo.getDeviceId());
|
||||
lqw.eq(bo.getUserId() != null, DeviceFenceAccessRecord::getUserId, bo.getUserId());
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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("设备类型不存在!!!");
|
||||
|
||||
@ -4,4 +4,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuyuanshen.equipment.mapper.DeviceFenceAccessRecordMapper">
|
||||
|
||||
<!-- 分页查询围栏进出记录列表 -->
|
||||
<select id="selectVoPageWithFenceAndDeviceName"
|
||||
resultType="com.fuyuanshen.equipment.domain.vo.DeviceFenceAccessRecordVo">
|
||||
SELECT
|
||||
r.id,
|
||||
r.fence_id,
|
||||
f.name AS fence_name,
|
||||
r.device_id,
|
||||
d.device_name,
|
||||
r.user_id,
|
||||
r.event_type,
|
||||
r.latitude,
|
||||
r.longitude,
|
||||
r.accuracy,
|
||||
r.event_time,
|
||||
r.create_time
|
||||
FROM device_fence_access_record r
|
||||
LEFT JOIN device_geo_fence f ON r.fence_id = f.id
|
||||
LEFT JOIN device d ON r.device_id = d.id
|
||||
<where>
|
||||
${ew.customSqlSegment}
|
||||
</where>
|
||||
ORDER BY r.id ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user