Commit a8912075 by 朱淼

fix bug

parent 14312720
...@@ -57,6 +57,13 @@ public class PlatRoomBedDeviceController { ...@@ -57,6 +57,13 @@ public class PlatRoomBedDeviceController {
return ApiResponseUtils.success(data); return ApiResponseUtils.success(data);
} }
@ApiOperation("已绑定设备分页")
@PostMapping("pageBindDevice")
public ApiResponseEntity<PageVO<PlatDeviceDTO>> pageBindDevice(@RequestBody PageReqDTO<PlatBedDeviceQueryDTO> page) {
PageVO<PlatDeviceDTO> data = platRoomBedDeviceService.pageBindDevice(page);
return ApiResponseUtils.success(data);
}
@ApiOperation("绑定设备") @ApiOperation("绑定设备")
@PostMapping("bindingDevice") @PostMapping("bindingDevice")
public ApiResponseEntity<?> bindingDevice(@RequestBody PlatRoomBindDeviceDTO dto) { public ApiResponseEntity<?> bindingDevice(@RequestBody PlatRoomBindDeviceDTO dto) {
......
...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel; ...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/9/18 11:38 * @Date:2023/9/18 11:38
...@@ -41,7 +42,7 @@ public class PlatSpaceImportDTO { ...@@ -41,7 +42,7 @@ public class PlatSpaceImportDTO {
@ExcelProperty({BIG_TITLE, "床位数量"}) @ExcelProperty({BIG_TITLE, "床位数量"})
@ApiModelProperty(value = "床位数量") @ApiModelProperty(value = "床位数量")
private Integer bedNumber; private String bedNumber;
......
...@@ -47,6 +47,8 @@ import org.springframework.stereotype.Service; ...@@ -47,6 +47,8 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
...@@ -300,6 +302,12 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -300,6 +302,12 @@ public class DataScreenServiceImpl implements DataScreenService {
@Override @Override
public List<PlatMapStatisticsVO> mapStatistics(PlatDataScreenQueryDTO dto) { public List<PlatMapStatisticsVO> mapStatistics(PlatDataScreenQueryDTO 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));
}
List<PlatMapStatisticsVO> list = new ArrayList<>(); List<PlatMapStatisticsVO> list = new ArrayList<>();
if(dto.getOrgIds().isEmpty()){ if(dto.getOrgIds().isEmpty()){
//获取该账号的权限组织 //获取该账号的权限组织
...@@ -542,7 +550,12 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -542,7 +550,12 @@ public class DataScreenServiceImpl implements DataScreenService {
if (elderIds.size() > 0) { if (elderIds.size() > 0) {
if (platElderMap.get(elderIds.get(0)) != null) { if (platElderMap.get(elderIds.get(0)) != null) {
PlatAlarmRecordStatisticsVo statisticsVo = BeanDtoVoUtils.convert(record, PlatAlarmRecordStatisticsVo.class); PlatAlarmRecordStatisticsVo statisticsVo = BeanDtoVoUtils.convert(record, PlatAlarmRecordStatisticsVo.class);
statisticsVo.setSpaceId(platElderMap.get(elderIds.get(0)).getSpaceId()); if(StringUtil.isNotEmpty(platElderMap.get(elderIds.get(0)).getSpacePath())){
String spacePath = platElderMap.get(elderIds.get(0)).getSpacePath();
String spaceId = Arrays.asList(spacePath.split(",")).get(0);
statisticsVo.setSpaceId(spaceId);
}
statisticsVos.add(statisticsVo); statisticsVos.add(statisticsVo);
} }
} }
......
...@@ -55,4 +55,6 @@ public interface PlatRoomBedDeviceService extends IService<PlatRoomBedDevice> { ...@@ -55,4 +55,6 @@ public interface PlatRoomBedDeviceService extends IService<PlatRoomBedDevice> {
List<PlatDevice> getSpaceDevice(String bedId); List<PlatDevice> getSpaceDevice(String bedId);
List<PlatDevice> getFallDevice(String bedId); List<PlatDevice> getFallDevice(String bedId);
PageVO<PlatDeviceDTO> pageBindDevice(PageReqDTO<PlatBedDeviceQueryDTO> page);
} }
...@@ -254,4 +254,46 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM ...@@ -254,4 +254,46 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
public List<PlatDevice> getFallDevice(String bedId) { public List<PlatDevice> getFallDevice(String bedId) {
return getDeviceInternal(bedId, PlatDeviceEnum.CategoryEnum.FALL.getValue()); return getDeviceInternal(bedId, PlatDeviceEnum.CategoryEnum.FALL.getValue());
} }
@Override
public PageVO<PlatDeviceDTO> pageBindDevice(PageReqDTO<PlatBedDeviceQueryDTO> pageReqDTO) {
PlatBedDeviceQueryDTO dto = pageReqDTO.getData();
Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper<PlatRoomBedDevice> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(PlatRoomBedDevice::getRoomId, dto.getRoomId());
queryWrapper1.eq(StringUtil.isNotEmpty(dto.getBedId()), PlatRoomBedDevice::getBedId, dto.getBedId());
List<PlatRoomBedDevice> list = list(queryWrapper1);
List<String> listEquipmentIds = list.stream().map(item -> item.getDeviceId()).collect(Collectors.toList());
List<String> listBedIds = list.stream().map(item -> item.getBedId()).collect(Collectors.toList());
LambdaQueryWrapper<PlatBed> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.in(PlatBed::getId, listBedIds);
List<PlatBed> listBeds = platBedService.list(queryWrapper2);
Map<String, String> map = listBeds.stream().collect(Collectors.toMap(PlatBed::getId, PlatBed::getName, (k1, k2) -> k1));
Map<String, String> mapName = new HashMap<>(20);
Map<String, String> mapBedId = new HashMap<>(20);
list.forEach(item -> {
if (map.containsKey(item.getBedId())) {
mapName.put(item.getDeviceId(), map.get(item.getBedId()));
mapBedId.put(item.getDeviceId(), item.getBedId());
}
});
if (!listEquipmentIds.isEmpty()) {
LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>();
//queryWrapper.eq(PlatDevice::getCategory, PlatDeviceEnum.CategoryEnum.HEART);
queryWrapper.in(PlatDevice::getId, listEquipmentIds);
Page<PlatDevice> pages = platDeviceService.page(p, queryWrapper);
List<PlatDeviceDTO> data = BeanDtoVoUtils.listVo(pages.getRecords(), PlatDeviceDTO.class);
data.forEach(item -> {
item.setBedName(mapName.get(item.getId()));
item.setBedId(mapBedId.get(item.getId()));
});
return PageUtil.toPageVO(data, pages);
}else {
return new PageVO<>();
}
}
} }
...@@ -39,6 +39,8 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -39,6 +39,8 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.*; import java.util.*;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -413,6 +415,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -413,6 +415,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
Integer errorCount = 0; Integer errorCount = 0;
Integer successCount = 0; Integer successCount = 0;
boolean errorFlag = false; boolean errorFlag = false;
Pattern pattern = Pattern.compile("^\\d+$");
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
PlatSpaceImportDTO item = list.get(i); PlatSpaceImportDTO item = list.get(i);
...@@ -449,6 +452,17 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -449,6 +452,17 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
} }
listKey.add(key+"-"+item.getRoomName()); listKey.add(key+"-"+item.getRoomName());
if(StringUtil.isNotEmpty(item.getBedNumber())){
Matcher matcher = pattern.matcher(item.getBedNumber());
// 进行匹配
if(!matcher.find()){
errorVoList.add(new ExcelErrorVo(i + 3, excelField.get(4), "床位数量格式错误"));
}
}
if (errorFlag) { if (errorFlag) {
errorCount++; errorCount++;
} else { } else {
...@@ -572,8 +586,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -572,8 +586,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
//房间 //房间
PlatRoomDTO platRoomDTO = new PlatRoomDTO(); PlatRoomDTO platRoomDTO = new PlatRoomDTO();
platRoomDTO.setName(item.getRoomName()); platRoomDTO.setName(item.getRoomName());
if(item.getBedNumber()!=null){ if(StringUtil.isNotEmpty(item.getBedNumber())){
platRoomDTO.setBedNumber(item.getBedNumber()); platRoomDTO.setBedNumber(Integer.valueOf(item.getBedNumber()));
}else { }else {
platRoomDTO.setBedNumber(0); platRoomDTO.setBedNumber(0);
} }
......
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