Commit 419ff10d by lzy

空间添加

parent 32b99882
...@@ -107,6 +107,7 @@ public enum CodeMessageEnum { ...@@ -107,6 +107,7 @@ public enum CodeMessageEnum {
PLATFORM_ERROR_SPACE_NOT_DEL(500, "PLATFORM.ERROR.SPACE.NOT.DEL"), PLATFORM_ERROR_SPACE_NOT_DEL(500, "PLATFORM.ERROR.SPACE.NOT.DEL"),
PLATFORM_ERROR_SPACE_NOT_AUTH_PARENT(500, "PLATFORM.ERROR.SPACE.NOT.AUTH.PARENT"), PLATFORM_ERROR_SPACE_NOT_AUTH_PARENT(500, "PLATFORM.ERROR.SPACE.NOT.AUTH.PARENT"),
PLATFORM_ERROR_SPACE_USER_NOT_ADD(500, "PLATFORM.ERROR.SPACE.USER.NOT.ADD"), PLATFORM_ERROR_SPACE_USER_NOT_ADD(500, "PLATFORM.ERROR.SPACE.USER.NOT.ADD"),
PLATFORM_ERROR_SPACE_ROOM_NOT_ADD(500, "PLATFORM.ERROR.SPACE.ROOM.NOT.ADD"),
PLATFORM_ERROR_ROOM_EXIT_BAD(500, "PLATFORM.ERROR.ROOM.EXIT.BED"), PLATFORM_ERROR_ROOM_EXIT_BAD(500, "PLATFORM.ERROR.ROOM.EXIT.BED"),
PLATFORM_ERROR_ROOM_BAD_NUMBER_NOT_AUTH(500, "PLATFORM.ERROR.ROOM.BED.NUMBER.NOT.AUTH"), PLATFORM_ERROR_ROOM_BAD_NUMBER_NOT_AUTH(500, "PLATFORM.ERROR.ROOM.BED.NUMBER.NOT.AUTH"),
PLATFORM_ERROR_ROOM_NAME_EXIT(500, "PLATFORM.ERROR.ROOM.NAME.EXIT"), PLATFORM_ERROR_ROOM_NAME_EXIT(500, "PLATFORM.ERROR.ROOM.NAME.EXIT"),
......
...@@ -100,6 +100,7 @@ PLATFORM.ERROR.SPACE.NAME.DUPLICATE=同一层级,空间名称不能重复 ...@@ -100,6 +100,7 @@ PLATFORM.ERROR.SPACE.NAME.DUPLICATE=同一层级,空间名称不能重复
PLATFORM.ERROR.SPACE.NOT.DEL=该空间下存在下级或者房间,不可删除 PLATFORM.ERROR.SPACE.NOT.DEL=该空间下存在下级或者房间,不可删除
PLATFORM.ERROR.SPACE.NOT.AUTH.PARENT=上级空间不能是自己的下级空间 PLATFORM.ERROR.SPACE.NOT.AUTH.PARENT=上级空间不能是自己的下级空间
PLATFORM.ERROR.SPACE.USER.NOT.ADD=当前用户没有所属组织,请先分配组织 PLATFORM.ERROR.SPACE.USER.NOT.ADD=当前用户没有所属组织,请先分配组织
PLATFORM.ERROR.SPACE.ROOM.NOT.ADD=该空间下已创建房间,不可当做上级空间
PLATFORM.ERROR.ROOM.EXIT.BED=房间中存在已入住的床位,不可删除 PLATFORM.ERROR.ROOM.EXIT.BED=房间中存在已入住的床位,不可删除
PLATFORM.ERROR.ROOM.NAME.EXIT=该房间名称已存在 PLATFORM.ERROR.ROOM.NAME.EXIT=该房间名称已存在
PLATFORM.ERROR.ROOM.BED.NUMBER.NOT.AUTH=床位数量不能改小 PLATFORM.ERROR.ROOM.BED.NUMBER.NOT.AUTH=床位数量不能改小
......
...@@ -82,6 +82,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -82,6 +82,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
public void add(PlatSpaceAddDTO dto) { public void add(PlatSpaceAddDTO dto) {
check(dto); check(dto);
PlatSpace space = BeanDtoVoUtils.convert(dto, PlatSpace.class); PlatSpace space = BeanDtoVoUtils.convert(dto, PlatSpace.class);
if (StringUtil.isEmpty(dto.getParentId())) { if (StringUtil.isEmpty(dto.getParentId())) {
PlatUserVO userVO = PlatUserUtil.getUserVOCanNull(); PlatUserVO userVO = PlatUserUtil.getUserVOCanNull();
if (StringUtil.isEmpty(userVO.getOrgId())) { if (StringUtil.isEmpty(userVO.getOrgId())) {
...@@ -93,6 +94,14 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -93,6 +94,14 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
space.setAttribute(org.getType()); space.setAttribute(org.getType());
} }
} else { } else {
//判断该空间下是否有房间
LambdaQueryWrapper<PlatRoom> queryRoom = new LambdaQueryWrapper<>();
queryRoom.eq(PlatRoom::getSpaceId,dto.getParentId());
if(platRoomService.count(queryRoom) > 0){
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_ROOM_NOT_ADD);
}
//上级空间 //上级空间
PlatSpace parentSpace = getById(dto.getParentId()); PlatSpace parentSpace = getById(dto.getParentId());
space.setOrgId(parentSpace.getOrgId()); space.setOrgId(parentSpace.getOrgId());
......
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