Commit a2fcd51a by huangjy

feat: 长者管理呼叫设备

parent 562c6208
......@@ -110,6 +110,13 @@ public class SaasDeviceController {
return ApiResponseUtils.success();
}
@ApiOperation("设备呼叫设备")
@PostMapping("callingDevice")
@TenantIdIgnore
public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDevice(@RequestBody PlatCallingDeviceDTO dto) {
return ApiResponseUtils.success(platDeviceService.callingDevice(dto));
}
@ApiOperation("设备日志推送")
@PostMapping("devicePushLog")
@TenantIdIgnore
......
......@@ -37,6 +37,7 @@ import com.makeit.mapper.platform.elder.PlatElderMapper;
import com.makeit.module.system.service.SysConfigService;
import com.makeit.module.system.vo.SysConfigVO;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.*;
import com.makeit.service.platform.space.PlatBedService;
import com.makeit.service.platform.space.PlatRoomBedDeviceService;
......@@ -114,6 +115,8 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
private PersonalConfigCacheUtil personalConfigCacheUtil;
@Autowired
private SysConfigService sysConfigService;
@Autowired
private PlatDeviceService platDeviceService;
private LambdaQueryWrapper<PlatElder> lambdaQueryWrapper(PlatElderQueryDTO dto) {
List<String> typeOrgIdList = Lists.newArrayList();
......@@ -215,6 +218,45 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
fill(list);
List<PlatElderListVO> roomIds = list.stream().filter(platElderListVO -> StringUtils.isNotEmpty(platElderListVO.getRoomId())).collect(Collectors.toList());
List<PlatRoomBedDevice> platRoomDevices = platRoomBedDeviceService.list(new QueryWrapper<PlatRoomBedDevice>().lambda()
.in(PlatRoomBedDevice::getRoomId, roomIds)
.isNull(PlatRoomBedDevice::getBedId));
List<PlatRoomBedDevice> platBedDevices = platRoomBedDeviceService.list(new QueryWrapper<PlatRoomBedDevice>().lambda()
.in(PlatRoomBedDevice::getRoomId, roomIds)
.isNotNull(PlatRoomBedDevice::getBedId));
Map<String, List<PlatRoomBedDevice>> roomDeviceMap = StreamUtil.groupBy(platRoomDevices, PlatRoomBedDevice::getRoomId);
Map<String, PlatRoomBedDevice> bedDeviceMap = StreamUtil.toMap(platBedDevices, PlatRoomBedDevice::getBedId);
List<PlatDevice> platDeviceList = platDeviceService.list();
Map<String, PlatDevice> deviceMap = StreamUtil.toMap(platDeviceList, BaseEntity::getId);
for (PlatElderListVO vo : list) {
List<PlatDevice> deviceList = Lists.newArrayList();
if (StringUtils.isNotEmpty(vo.getRoomId())) {
List<PlatRoomBedDevice> platRoomBedDevices = roomDeviceMap.get(vo.getRoomId());
if (CollectionUtils.isNotEmpty(platRoomBedDevices)) {
List<String> tempDeviceIdList = StreamUtil.map(platRoomBedDevices, PlatRoomBedDevice::getDeviceId);
for (String s : tempDeviceIdList) {
PlatDevice platDevice = deviceMap.get(s);
if (platDevice != null) {
deviceList.add(platDevice);
}
}
}
}
if (StringUtils.isNotEmpty(vo.getBedId())) {
PlatRoomBedDevice platRoomBedDevice = bedDeviceMap.get(vo.getBedId());
if (platRoomBedDevice != null) {
PlatDevice platDevice = deviceMap.get(platRoomBedDevice.getDeviceId());
if (platDevice != null) {
deviceList.add(platDevice);
}
}
}
vo.setDeviceList(deviceList);
}
return PageUtil.toPageVO(list, voPage);
}
......
......@@ -592,7 +592,6 @@ public class WorkStationServiceImpl implements WorkStationService {
.isNotNull(PlatRoomBedDevice::getBedId));
Map<String, List<PlatRoomBedDevice>> roomDeviceMap = StreamUtil.groupBy(platRoomDevices, PlatRoomBedDevice::getRoomId);
Map<String, PlatRoomBedDevice> bedDeviceMap = StreamUtil.toMap(platBedDevices, PlatRoomBedDevice::getBedId);
List<String> deviceIdList = StreamUtil.map(platRoomDevices, PlatRoomBedDevice::getDeviceId);
List<PlatDevice> platDeviceList = platDeviceService.list();
Map<String, PlatDevice> deviceMap = StreamUtil.toMap(platDeviceList, BaseEntity::getId);
......
......@@ -2,12 +2,14 @@ package com.makeit.vo.platform.elder;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.makeit.common.dto.BaseTenantDTO;
import com.makeit.entity.platform.device.PlatDevice;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
......@@ -137,5 +139,7 @@ public class PlatElderListVO extends BaseTenantDTO {
private String updateBy;
@ApiModelProperty(value = "头像文件id")
private String avatar;
@ApiModelProperty("设备列表")
private List<PlatDevice> deviceList;
}
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