Commit c8524501 by 朱淼

代码调整

parent af5ff95a
......@@ -2,6 +2,7 @@ package com.makeit.module.iot.vo.space;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -26,10 +27,13 @@ public class DeviceInfoContentSpace {
@JsonProperty("mode")
private Integer mode;
@JsonProperty("distance")
@ApiModelProperty("人体目标距离雷达位置 范围:0-1000,单位cm")
private Integer distance;
@JsonProperty("personState")
@ApiModelProperty("0表示无人 ,1表示有人")
private Integer personState;
@JsonProperty("angle")
@ApiModelProperty("人体目标偏离雷达法线角度范围:±60,单位°")
private Integer angle;
@JsonProperty("mount")
private Integer mount;
......
......@@ -6,6 +6,7 @@ import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import com.makeit.dto.platform.space.PlatRegionSettingListDTO;
import com.makeit.dto.platform.space.PlatRegionSettingLocateDTO;
import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO;
import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.service.platform.space.PlatRegionSettingService;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import io.swagger.annotations.Api;
......@@ -54,15 +55,15 @@ public class PlatRegionSettingController {
@ApiOperation("定位(时间范围内定位)")
@PostMapping("locate")
public ApiResponseEntity<List<PlatElderCoordinateVO>> locate(@RequestBody PlatRegionSettingLocateDTO dto) {
List<PlatElderCoordinateVO> list = platRegionSettingService.locate(dto);
public ApiResponseEntity<List<DeviceInfoContentSpace.Properties>> locate(@RequestBody PlatRegionSettingLocateDTO dto) {
List<DeviceInfoContentSpace.Properties> list = platRegionSettingService.locate(dto);
return ApiResponseUtils.success(list);
}
@ApiOperation("实时定位")
@PostMapping("nowDataLocate")
public ApiResponseEntity<PlatElderCoordinateVO> nowDataLocate(@RequestBody PlatRegionSettingLocateDTO dto) {
PlatElderCoordinateVO vo = platRegionSettingService.nowDataLocate(dto);
public ApiResponseEntity<DeviceInfoContentSpace.Properties> nowDataLocate(@RequestBody PlatRegionSettingLocateDTO dto) {
DeviceInfoContentSpace.Properties vo = platRegionSettingService.nowDataLocate(dto);
return ApiResponseUtils.success(vo);
}
......
......@@ -6,6 +6,7 @@ import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import com.makeit.dto.platform.space.PlatRegionSettingListDTO;
import com.makeit.dto.platform.space.PlatRegionSettingLocateDTO;
import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO;
import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.service.platform.space.PlatRegionSettingService;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import io.swagger.annotations.Api;
......@@ -55,15 +56,15 @@ public class PlatRegionSettingWechatController {
@ApiOperation("定位(时间范围内定位)")
@PostMapping("locate")
public ApiResponseEntity<List<PlatElderCoordinateVO>> locate(@RequestBody PlatRegionSettingLocateDTO dto) {
List<PlatElderCoordinateVO> list = platRegionSettingService.locate(dto);
public ApiResponseEntity<List<DeviceInfoContentSpace.Properties>> locate(@RequestBody PlatRegionSettingLocateDTO dto) {
List<DeviceInfoContentSpace.Properties> list = platRegionSettingService.locate(dto);
return ApiResponseUtils.success(list);
}
@ApiOperation("实时定位")
@PostMapping("nowDataLocate")
public ApiResponseEntity<PlatElderCoordinateVO> nowDataLocate(@RequestBody PlatRegionSettingLocateDTO dto) {
PlatElderCoordinateVO vo = platRegionSettingService.nowDataLocate(dto);
public ApiResponseEntity<DeviceInfoContentSpace.Properties> nowDataLocate(@RequestBody PlatRegionSettingLocateDTO dto) {
DeviceInfoContentSpace.Properties vo = platRegionSettingService.nowDataLocate(dto);
return ApiResponseUtils.success(vo);
}
}
......@@ -5,6 +5,7 @@ import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import com.makeit.dto.platform.space.PlatRegionSettingLocateDTO;
import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO;
import com.makeit.entity.platform.space.PlatRegionSetting;
import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import java.util.List;
......@@ -45,7 +46,7 @@ public interface PlatRegionSettingService extends IService<PlatRegionSetting> {
void batchEdit(List<PlatRegionSettingDTO> dtos);
List<PlatElderCoordinateVO> locate(PlatRegionSettingLocateDTO dto);
List<DeviceInfoContentSpace.Properties> locate(PlatRegionSettingLocateDTO dto);
PlatElderCoordinateVO nowDataLocate(PlatRegionSettingLocateDTO dto);
DeviceInfoContentSpace.Properties nowDataLocate(PlatRegionSettingLocateDTO dto);
}
......@@ -162,33 +162,26 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
}
@Override
public List<PlatElderCoordinateVO> locate(PlatRegionSettingLocateDTO dto) {
List<PlatElderCoordinateVO> vos = new ArrayList<>();
public List<DeviceInfoContentSpace.Properties> locate(PlatRegionSettingLocateDTO dto) {
List<DeviceInfoContentSpace.Properties> vos = new ArrayList<>();
List<DeviceOperationLogEntity> list = iotProductDeviceService.getDeviceLogByTimeRange(dto.getDeviceId(), "reportProperty", 100, dto.getStartTime(), dto.getEndTime());
for(DeviceOperationLogEntity log : list){
DeviceInfoContentSpace space = JsonUtil.toObj((String) log.getContent(), DeviceInfoContentSpace.class);
if(space.getProperties()!=null){
PlatElderCoordinateVO vo = new PlatElderCoordinateVO();
vo.setX(new BigDecimal(space.getProperties().getDistance()).multiply(new BigDecimal(Math.cos(space.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo.setY(new BigDecimal(space.getProperties().getDistance()).multiply(new BigDecimal(Math.sin(space.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vos.add(vo);
vos.add(space.getProperties());
}
}
return vos;
}
@Override
public PlatElderCoordinateVO nowDataLocate(PlatRegionSettingLocateDTO dto) {
PlatElderCoordinateVO vo = new PlatElderCoordinateVO();
public DeviceInfoContentSpace.Properties nowDataLocate(PlatRegionSettingLocateDTO dto) {
DeviceInfoContentSpace space = iotProductDeviceService.getLastDeviceLogSpace(dto.getDeviceId(), 10);
if(space == null){
return null;
}
if(space.getProperties()!=null){
vo.setX(new BigDecimal(space.getProperties().getDistance()).multiply(new BigDecimal(Math.cos(space.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo.setY(new BigDecimal(space.getProperties().getDistance()).multiply(new BigDecimal(Math.sin(space.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
}
return vo;
return space.getProperties();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment