Commit 26762860 by 杨伟程
parents e76fb33b 5f2cda52
......@@ -86,8 +86,8 @@ CREATE TABLE `plat_region_setting`
`install_type` char(1) DEFAULT NULL COMMENT '安装方式 0-顶装 1-侧装',
`toward` char(1) DEFAULT NULL COMMENT '设备朝向 0-上 1-下 2-左 3-右',
`region_name` varchar(64) DEFAULT NULL COMMENT '区域名称',
`region_range` varchar(128) DEFAULT NULL COMMENT '区域定位',
`room_range` varchar(128) DEFAULT NULL COMMENT '房间门定位',
`region_range` varchar(500) DEFAULT NULL COMMENT '区域定位',
`room_range` varchar(500) DEFAULT NULL COMMENT '房间门定位',
`equipment_range` varchar(128) DEFAULT NULL COMMENT '设备定位',
`device_id` varchar(64) DEFAULT NULL COMMENT '设备Id',
`create_by` varchar(64) DEFAULT NULL COMMENT '创建者',
......
......@@ -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;
......
......@@ -96,7 +96,7 @@ PLATFORM.ERROR.SPACE.NAME.DUPLICATE=同一层级,空间名称不能重复
PLATFORM.ERROR.SPACE.NOT.DEL=该空间下存在下级或者房间,不可删除
PLATFORM.ERROR.SPACE.NOT.AUTH.PARENT=上级空间不能是自己的下级空间
PLATFORM.ERROR.SPACE.USER.NOT.ADD=当前用户没有所属组织,请先分配组织
PLATFORM.ERROR.ROOM.EXIT.BAD=房间中存在床位,不可删除
PLATFORM.ERROR.ROOM.EXIT.BAD=房间中存在已入住的床位,不可删除
PLATFORM.ERROR.ROOM.NAME.EXIT=该房间名称已存在
PLATFORM.ERROR.ROOM.BAD.NUMBER.NOT.AUTH=床位数量不能改小
PLATFORM.ERROR.BAD.NAME.EXIT=床位名称已存在
......
......@@ -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);
}
}
......@@ -37,4 +37,7 @@ public class PlatDeviceDTO {
@ApiModelProperty(value = "床位Id")
private String bedId;
@ApiModelProperty(value = "设备类型 0-呼吸心率雷达 1-空间人体雷达 2-跌倒检测雷达")
private String category;
}
......@@ -42,6 +42,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -329,7 +330,7 @@ public class DataScreenServiceImpl implements DataScreenService {
}
}
}
Map<String,List<PlatElder>> elderMap = elders.stream().collect(Collectors.groupingBy(PlatElder::getSpaceId));
Map<String,List<PlatElder>> elderMap = elders.stream().filter(t->StringUtil.isNotEmpty(t.getSpaceId())).collect(Collectors.groupingBy(PlatElder::getSpaceId));
Map<String,PlatElder> platElderMap = elders.stream().collect(Collectors.toMap(PlatElder::getId, Function.identity()));
//今日告警
List<PlatAlarmRecord> alarmRecords = platAlarmRecordService.list(new QueryWrapper<PlatAlarmRecord>().lambda()
......@@ -427,8 +428,10 @@ public class DataScreenServiceImpl implements DataScreenService {
Map<String,String> elderNameMap = platElders.stream().collect(Collectors.toMap(PlatElder::getId,PlatElder::getName));
Map<String, PlatElderListVO> elderBedPathMap = mapElderBedPath(platElders);
List<PlatAlarmStatisticsListVo> list = new ArrayList<>();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dft = new SimpleDateFormat("HH:mm:ss");
// DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
// DateFormat dft = new SimpleDateFormat("HH:mm:ss");
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
DateTimeFormatter dft = DateTimeFormatter.ofPattern("HH:mm:ss");
for (PlatAlarmRecord record : alarmRecords){
List<String> elderIds = Arrays.asList(record.getElderIds().split(","));
......@@ -459,8 +462,8 @@ public class DataScreenServiceImpl implements DataScreenService {
listVo.setPath(pathName);
listVo.setElderName(elderName);
listVo.setType(record.getAlarmType());
listVo.setAlarmDate(df.format(record.getAlarmDate()));
listVo.setAlarmTime(dft.format(record.getAlarmDate()));
listVo.setAlarmDate(record.getAlarmDate().format(df));
listVo.setAlarmTime(record.getAlarmDate().format(dft));
list.add(listVo);
}
......
......@@ -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);
if(space.getProperties()!=null && space.getProperties().getPersonState() == 1){
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();
}
}
......@@ -36,6 +36,8 @@ import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
......@@ -65,6 +67,12 @@ public class WorkStationServiceImpl implements WorkStationService {
@Override
public WorkStationInstitutionStatisticsVO institutionStatistics(WorkStationQueryDTO dto) {
WorkStationInstitutionStatisticsVO vo = new WorkStationInstitutionStatisticsVO();
if(dto.getStartTime() == null){
dto.setStartTime(LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MIN));
}
if(dto.getEndTime() == null){
dto.setEndTime(LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MAX));
}
if (dto.getOrgIds().isEmpty()) {
//获取该账号的权限组织
List<PlatOrg> orgs = belongToScopeList(PlatOrgEnum.OrgTypeEnum.INSTITUTION.getValue());
......@@ -171,7 +179,10 @@ public class WorkStationServiceImpl implements WorkStationService {
elderIds.forEach(e -> {
elderIdList.addAll(Arrays.asList(e.split(",")));
});
dto.setElderIds(elderIdList);
if(StringUtil.isNotEmpty(dto.getAlarmType())){
dto.setElderIds(elderIdList);
}
//长者对应的报警类型
Map<String, Map<String,String>> elderAlarmTypeMap = mapElderAlarmType(alarmRecords);
Page<WorkStationInstitutionRoomVO> pages = platRoomService.workStationPage(
......@@ -265,6 +276,12 @@ public class WorkStationServiceImpl implements WorkStationService {
@Override
public WorkStationHomeStatisticsVO homeStatistics(WorkStationQueryDTO dto) {
if(dto.getStartTime() == null){
dto.setStartTime(LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MIN));
}
if(dto.getEndTime() == null){
dto.setEndTime(LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MAX));
}
WorkStationHomeStatisticsVO vo = new WorkStationHomeStatisticsVO();
if (dto.getOrgIds().isEmpty()) {
//获取该账号的权限组织
......@@ -350,7 +367,10 @@ public class WorkStationServiceImpl implements WorkStationService {
elderIds.forEach(e -> {
elderIdList.addAll(Arrays.asList(e.split(",")));
});
dto.setElderIds(elderIdList);
if(StringUtil.isNotEmpty(dto.getAlarmType())){
dto.setElderIds(elderIdList);
}
//长者对应的报警类型
Map<String, Map<String,String>> elderAlarmTypeMap = mapElderAlarmType(alarmRecords);
......
......@@ -70,7 +70,7 @@ public class PlatElderCenterWechatServiceImpl implements PlatElderCenterWechatSe
homeVo.setElderNumber(0);
return homeVo;
}
List<String> elderIds = elders.stream().map(PlatElder::getId).collect(Collectors.toList());
// List<String> elderIds = elders.stream().map(PlatElder::getId).collect(Collectors.toList());
//获取父级的所有子级空间
List<PlatSpace> spaces = platSpaceService.listChild(Arrays.asList(dto.getSpaceId()));
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
......@@ -84,7 +84,7 @@ public class PlatElderCenterWechatServiceImpl implements PlatElderCenterWechatSe
WorkStationQueryDTO queryDTO = new WorkStationQueryDTO();
queryDTO.setSpaceIds(spaceIds);
queryDTO.setElderIds(elderIds);
// queryDTO.setElderIds(elderIds);
List<WorkStationHomeBedVO> list = platBedService.selectByCondition(queryDTO);
JoinUtil.joinSplit(list, platSpaceService, WorkStationHomeBedVO::getSpacePath, PlatSpace::getId, (e, l) -> {
......@@ -124,7 +124,7 @@ public class PlatElderCenterWechatServiceImpl implements PlatElderCenterWechatSe
);
List<String> elderIds = elders.stream().map(PlatElder::getId).collect(Collectors.toList());
// List<String> elderIds = elders.stream().map(PlatElder::getId).collect(Collectors.toList());
//获取父级的所有子级空间
List<PlatSpace> spaces = platSpaceService.listChild(Arrays.asList(dto.getSpaceId()));
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
......@@ -136,7 +136,7 @@ public class PlatElderCenterWechatServiceImpl implements PlatElderCenterWechatSe
);
WorkStationQueryDTO queryDTO = new WorkStationQueryDTO();
queryDTO.setSpaceIds(spaceIds);
queryDTO.setElderIds(elderIds);
// queryDTO.setElderIds(elderIds);
List<WorkStationInstitutionRoomVO> roomVOList = platRoomService.workStationList(queryDTO);
if (roomVOList.isEmpty()) {
institutionRoomVO.setList(new ArrayList<>());
......
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