Commit 6639acb3 by lzy

绑定设备

parent 8a1817d7
...@@ -6,10 +6,10 @@ import com.makeit.common.page.PageVO; ...@@ -6,10 +6,10 @@ import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity; import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils; import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.device.PlatDeviceDTO; import com.makeit.dto.platform.device.PlatDeviceDTO;
import com.makeit.dto.platform.space.PlatBedDeviceQueryDTO;
import com.makeit.dto.platform.space.PlatBedEditDTO; import com.makeit.dto.platform.space.PlatBedEditDTO;
import com.makeit.dto.platform.space.PlatBedQueryDTO; import com.makeit.dto.platform.space.PlatBedQueryDTO;
import com.makeit.entity.platform.space.PlatBed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.space.PlatBedService; import com.makeit.service.platform.space.PlatBedService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/9/6 11:56 * @Date:2023/9/6 11:56
...@@ -68,4 +70,11 @@ public class PlatBedController { ...@@ -68,4 +70,11 @@ public class PlatBedController {
return ApiResponseUtils.success(data); return ApiResponseUtils.success(data);
} }
@ApiOperation("绑定设备列表")
@PostMapping("listBindDevice")
public ApiResponseEntity<List<PlatDeviceDTO>> listBindDevice(@RequestBody PlatBedDeviceQueryDTO dto) {
List<PlatDeviceDTO> data = platBedService.listBindDevice(dto);
return ApiResponseUtils.success(data);
}
} }
...@@ -13,6 +13,9 @@ import lombok.Data; ...@@ -13,6 +13,9 @@ import lombok.Data;
@ApiModel("PlatDeviceDTO 模型") @ApiModel("PlatDeviceDTO 模型")
public class PlatDeviceDTO { public class PlatDeviceDTO {
@ApiModelProperty(value = "ID")
private String id;
@ApiModelProperty(value = "原始设备ID") @ApiModelProperty(value = "原始设备ID")
private String oriDeviceId; private String oriDeviceId;
...@@ -24,4 +27,10 @@ public class PlatDeviceDTO { ...@@ -24,4 +27,10 @@ public class PlatDeviceDTO {
@ApiModelProperty(value = "状态 数据字典 1 在线 0离线") @ApiModelProperty(value = "状态 数据字典 1 在线 0离线")
private String status; private String status;
@ApiModelProperty(value = "心率")
private int heart;
@ApiModelProperty(value = "床位名称")
private String bedName;
} }
package com.makeit.dto.platform.space;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author:lzy
* @Date:2023/9/6 16:32
* @Describe:
*/
@Data
@ApiModel("PlatBedDeviceQueryDTO 参数")
public class PlatBedDeviceQueryDTO {
@ApiModelProperty("房间Id")
private String roomId;
}
...@@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.device.PlatDeviceDTO; import com.makeit.dto.platform.device.PlatDeviceDTO;
import com.makeit.dto.platform.space.PlatBedDeviceQueryDTO;
import com.makeit.dto.platform.space.PlatBedEditDTO; import com.makeit.dto.platform.space.PlatBedEditDTO;
import com.makeit.dto.platform.space.PlatBedQueryDTO; import com.makeit.dto.platform.space.PlatBedQueryDTO;
import com.makeit.entity.platform.space.PlatBed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.entity.platform.space.PlatRoom; import com.makeit.entity.platform.space.PlatRoom;
import java.util.List;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 15:08 * @Date:2023/8/31 15:08
...@@ -55,5 +58,14 @@ public interface PlatBedService extends IService<PlatBed> { ...@@ -55,5 +58,14 @@ public interface PlatBedService extends IService<PlatBed> {
*/ */
PageVO<PlatDeviceDTO> pageDevice(PageReqDTO<PlatDeviceDTO> pageReqDTO); PageVO<PlatDeviceDTO> pageDevice(PageReqDTO<PlatDeviceDTO> pageReqDTO);
/**
* 已绑定设备
* @param dto
* @return
*/
List<PlatDeviceDTO> listBindDevice(PlatBedDeviceQueryDTO dto);
} }
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.device.PlatDeviceDTO; import com.makeit.dto.platform.device.PlatDeviceDTO;
import com.makeit.dto.platform.space.PlatBedDeviceQueryDTO;
import com.makeit.dto.platform.space.PlatBedEditDTO; import com.makeit.dto.platform.space.PlatBedEditDTO;
import com.makeit.dto.platform.space.PlatBedQueryDTO; import com.makeit.dto.platform.space.PlatBedQueryDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
...@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -147,4 +149,31 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl ...@@ -147,4 +149,31 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl
return PageUtil.toPageVO(listRecord, pages); return PageUtil.toPageVO(listRecord, pages);
} }
@Override
public List<PlatDeviceDTO> listBindDevice(PlatBedDeviceQueryDTO dto) {
LambdaQueryWrapper<PlatBed> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.select(PlatBed::getEquipmentId,PlatBed::getName);
queryWrapper1.isNotNull(PlatBed::getEquipmentId);
queryWrapper1.eq(PlatBed::getRoomId,dto.getRoomId());
List<PlatBed> listBed = list(queryWrapper1);
List<String> listEquipmentIds = listBed.stream().map(item->item.getEquipmentId()).collect(Collectors.toList());
Map<String,String> map = listBed.stream().collect(Collectors.toMap(PlatBed::getEquipmentId,PlatBed::getName,(k1,k2)->k1));
List<PlatDeviceDTO> data = new ArrayList<>();
if(!listEquipmentIds.isEmpty()){
LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatDevice::getCategory, PlatDeviceEnum.CategoryEnum.HEART);
queryWrapper.in(PlatDevice::getId,listEquipmentIds);
List<PlatDevice> listDevices = platDeviceService.list(queryWrapper);
data = BeanDtoVoUtils.listVo(listDevices,PlatDeviceDTO.class);
data.forEach(item->{
item.setBedName(map.get(item.getId()));
});
}
return data;
}
} }
...@@ -79,7 +79,6 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i ...@@ -79,7 +79,6 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_ROOM_EXIT_BAD); throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_ROOM_EXIT_BAD);
} }
removeByIds(ids); removeByIds(ids);
} }
@Override @Override
......
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