Commit 39264af7 by lzy

Merge branch 'dev' of git.xmmakeit.com:huangjiay/iot-platform-server into dev

parents 5f4b2e09 a9a4f371
...@@ -117,6 +117,10 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i ...@@ -117,6 +117,10 @@ 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);
//删除床位
platBedService.remove(new QueryWrapper<PlatBed>().lambda()
.in(PlatBed::getRoomId, ids));
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
......
...@@ -3,6 +3,7 @@ package com.makeit.service.platform.space.impl; ...@@ -3,6 +3,7 @@ package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import com.makeit.common.dto.BaseIdDTO; import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.vo.ExcelErrorVo; import com.makeit.common.vo.ExcelErrorVo;
import com.makeit.common.vo.ExcelImportVo; import com.makeit.common.vo.ExcelImportVo;
...@@ -107,7 +108,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -107,7 +108,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
space.setLatitude(dto.getLatitude()); space.setLatitude(dto.getLatitude());
space.setLongitude(dto.getLongitude()); space.setLongitude(dto.getLongitude());
space.setParentId(dto.getParentId()); space.setParentId(dto.getParentId());
space.setParentPath(dto.getParentPath()); if(StringUtil.isEmpty(dto.getParentPath())){
space.setParentPath(null);
}else {
space.setParentPath(dto.getParentPath());
}
//上级空间 //上级空间
PlatSpace parentSpace = this.getById(dto.getParentId()); PlatSpace parentSpace = this.getById(dto.getParentId());
...@@ -150,11 +155,38 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -150,11 +155,38 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
queryWrapper.in(PlatSpace::getOrgId, orgIds); queryWrapper.in(PlatSpace::getOrgId, orgIds);
List<PlatSpace> list = this.list(queryWrapper); List<PlatSpace> list = this.list(queryWrapper);
List<PlatSpace> spaceList = new ArrayList<>();
Set<Long> parentIds = new HashSet<>();
if(StringUtil.isNotEmpty(dto.getName())){
List<PlatSpace> arrayList = new ArrayList<>();
for(PlatSpace space : list){
//非一级空间的获取上级空间
if (StringUtil.isNotEmpty(space.getParentId())) {
List<String> parentIdList = new ArrayList<>();
parentIdList.addAll(Arrays.asList(space.getParentPath().split(",")));
parentIdList.add(space.getId());
Set<Long> set = new HashSet(parentIdList);
parentIds.addAll(set);
} else {
arrayList.add(space);
}
}
parentIds.add(-1L);
arrayList = arrayList.stream().filter(e -> !parentIds.contains(Long.valueOf(e.getId()))).collect(Collectors.toList());
spaceList = list(new QueryWrapper<PlatSpace>().lambda()
.in(PlatSpace::getId, parentIds));
if (CollectionUtils.isNotEmpty(arrayList)) {
spaceList.addAll(arrayList);
}
}else {
spaceList = list;
}
//父级 //父级
List<PlatSpace> listParent = list.stream().filter(item -> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList()); List<PlatSpace> listParent = spaceList.stream().filter(item -> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
//子集 //子集
List<PlatSpace> listChild = list.stream().filter(item -> item.getParentId() != null).collect(Collectors.toList()); List<PlatSpace> listChild = spaceList.stream().filter(item -> item.getParentId() != null).collect(Collectors.toList());
Map<String, List<PlatSpace>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpace::getParentId)); Map<String, List<PlatSpace>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
List<PlatSpaceVO> data = new ArrayList<>(); List<PlatSpaceVO> data = new ArrayList<>();
......
...@@ -175,7 +175,8 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -175,7 +175,8 @@ public class WorkStationServiceImpl implements WorkStationService {
} else { } else {
//获取父级的所有子级空间 //获取父级的所有子级空间
spaces = platSpaceService.listChild(dto.getSpaceIds()); spaces = platSpaceService.listChild(dto.getSpaceIds());
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
dto.setSpaceIds(spaceIds);
} }
List<String> elderIdList = new ArrayList<>(); List<String> elderIdList = new ArrayList<>();
...@@ -218,8 +219,7 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -218,8 +219,7 @@ public class WorkStationServiceImpl implements WorkStationService {
//查询睡眠质量分析模型 //查询睡眠质量分析模型
// SaasModelManage modelManage = saasModelManageService.getOne(new QueryWrapper<SaasModelManage>().lambda() // SaasModelManage modelManage = saasModelManageService.getOne(new QueryWrapper<SaasModelManage>().lambda()
// .eq(SaasModelManage::getModelType, ModelManageTypeEnum.SLEEP.getCode()) // .eq(SaasModelManage::getModelType, ModelManageTypeEnum.SLEEP.getCode());
// .last(" limit 1"));
// Integer turnedComparison = 0; // Integer turnedComparison = 0;
// if(modelManage != null){ // if(modelManage != null){
// SaasSleepAnalysisModel model = saasSleepAnalysisModelService.view(modelManage.getModelId()); // SaasSleepAnalysisModel model = saasSleepAnalysisModelService.view(modelManage.getModelId());
...@@ -396,6 +396,8 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -396,6 +396,8 @@ public class WorkStationServiceImpl implements WorkStationService {
} else { } else {
//获取父级的所有子级空间 //获取父级的所有子级空间
spaces = platSpaceService.listChild(dto.getSpaceIds()); spaces = platSpaceService.listChild(dto.getSpaceIds());
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
dto.setSpaceIds(spaceIds);
} }
List<String> elderIdList = new ArrayList<>(); List<String> elderIdList = 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