Commit 412540f4 by 杨伟程

设备建表

parents 2fd32ce3 4c65feae
Showing with 698 additions and 13 deletions
CREATE TABLE `plat_space`
(
`id` VARCHAR(64) NOT NULL COMMENT 'id',
`name` VARCHAR(128) NOT NULL COMMENT '名称',
`parent_id` VARCHAR(64) DEFAULT NULL COMMENT '上级空间',
`type` VARCHAR(4) NOT NULL COMMENT '空间类型 1:小区/社区/街道 2:楼栋 3:单元 4 楼层',
`address` VARCHAR(256) DEFAULT NULL COMMENT '地址',
`longitude` VARCHAR(64) DEFAULT NULL COMMENT '经度',
`latitude` VARCHAR(64) DEFAULT NULL COMMENT '纬度',
`province` VARCHAR(64) DEFAULT NULL COMMENT '省(预留字段)',
`city` VARCHAR(64) DEFAULT NULL COMMENT '市(预留字段)',
`district` VARCHAR(64) DEFAULT NULL COMMENT '区(预留字段)',
`parent_path` VARCHAR(64) DEFAULT NULL COMMENT '父级全路径',
`create_by` VARCHAR(64) DEFAULT NULL COMMENT '创建者',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` VARCHAR(64) DEFAULT NULL COMMENT '更新者',
`update_date` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` INT(1) DEFAULT '0' COMMENT '删除标记',
`tenant_id` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ' 租户id ',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = INNODB
DEFAULT CHARSET = utf8mb4 COMMENT = '空间管理';
CREATE TABLE `plat_room`
(
`id` VARCHAR(64) NOT NULL COMMENT 'id',
`name` VARCHAR(128) NOT NULL COMMENT '名称',
`space_id` VARCHAR(64) NOT NULL COMMENT '空间id',
`space_path` VARCHAR(512) NOT NULL COMMENT '空间全路径',
`bed_number` INT(4) NOT NULL COMMENT '床位数量',
`description` VARCHAR(1024) DEFAULT NULL COMMENT '床位描述',
`create_by` VARCHAR(64) DEFAULT NULL COMMENT '创建者',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` VARCHAR(64) DEFAULT NULL COMMENT '更新者',
`update_date` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` INT(1) DEFAULT '0' COMMENT '删除标记',
`tenant_id` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ' 租户id ',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = INNODB
DEFAULT CHARSET = utf8mb4 COMMENT = '房间管理';
CREATE TABLE `plat_bed`
(
`id` varchar(64) NOT NULL COMMENT 'id',
`name` varchar(128) NOT NULL COMMENT '床位名称 床位1,床位2',
`room_id` varchar(64) NOT NULL COMMENT '房间id',
`space_id` varchar(64) NOT NULL COMMENT '空间id',
`equipment_id` varchar(64) DEFAULT NULL COMMENT '设备id',
`status` char(1) DEFAULT 1 COMMENT '是否空闲 1 是 0 否 ',
`create_by` varchar(64) DEFAULT NULL COMMENT '创建者',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT NULL COMMENT '更新者',
`update_date` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int(1) DEFAULT '0' COMMENT '删除标记',
`tenant_id` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ' 租户id ',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='床位管理';
-- 待完善 区域设置表
CREATE TABLE `plat_region_setting`
(
`id` varchar(64) NOT NULL COMMENT 'id',
`name` varchar(128) NOT NULL COMMENT '区域名称',
`room_id` varchar(64) NOT NULL COMMENT '房间id',
`range_map` varchar(1024) NOT NULL COMMENT '区域地图 json',
`create_by` varchar(64) DEFAULT NULL COMMENT '创建者',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT NULL COMMENT '更新者',
`update_date` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int(1) DEFAULT '0' COMMENT '删除标记',
`tenant_id` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ' 租户id ',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='区域设置';
CREATE TABLE `plat_region_setting_location`
(
`id` varchar(64) NOT NULL COMMENT 'id',
`region_setting_id` varchar(64) NOT NULL COMMENT '区域设置Id',
`install_type` char(1) NOT NULL COMMENT '安装方式 0-顶装 1-侧装',
`toward` char(1) NOT NULL COMMENT '设备朝向 0-上 1-下 2-左 3-右',
`region_name` varchar(64) DEFAULT NULL COMMENT '区域名称',
`region_range` varchar(128) DEFAULT NULL COMMENT '区域定位',
`room_range` varchar(128) DEFAULT NULL COMMENT '房间门定位',
`equipment_range` varchar(128) DEFAULT NULL COMMENT '设备定位',
`equipment_id` varchar(64) DEFAULT NULL COMMENT '设备Id',
`create_by` varchar(64) DEFAULT NULL COMMENT '创建者',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT NULL COMMENT '更新者',
`update_date` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int(1) DEFAULT '0' COMMENT '删除标记',
`tenant_id` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ' 租户id ',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='区域设置定位';
package com.makeit.controller.saas;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.device.PlatDeviceDetailDTO;
import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.service.platform.device.PlatDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "租户管理-租户设备管理")
@RestController
@RequestMapping("/saas/device")
public class SaasDeviceController {
@Autowired
private PlatDeviceService platDeviceService;
@ApiOperation("列表")
@PostMapping("page")
public ApiResponseEntity<PageVO<PlatDevice>> page(@RequestBody PageReqDTO<PlatDevice> pageReqDTO) {
return ApiResponseUtils.success(platDeviceService.pageSaas(pageReqDTO));
}
@ApiOperation("设备信息")
@PostMapping("detail")
public ApiResponseEntity<PlatDeviceDetailDTO> detail(@RequestBody BaseIdDTO baseIdDTO) {
return ApiResponseUtils.success(platDeviceService.getDetailDTO(baseIdDTO.getId()));
}
@ApiOperation("设备编辑")
@PostMapping("edit")
public ApiResponseEntity<Void> edit(@RequestBody PlatDevice platDevice) {
platDeviceService.edit(platDevice);
return ApiResponseUtils.success();
}
@ApiOperation("实时数据")
@PostMapping("realTimeDate")
public ApiResponseEntity<PlatDevice> realTimeDate(@RequestBody PlatDevice platDevice) {
//todo
return null;
}
@ApiOperation("数据分析")
@PostMapping("dataAnalysis")
public ApiResponseEntity<PlatDevice> dataAnalysis(@RequestBody PlatDevice platDevice) {
//todo
return null;
}
}
...@@ -95,7 +95,7 @@ public enum CodeMessageEnum { ...@@ -95,7 +95,7 @@ public enum CodeMessageEnum {
PLATFORM_ERROR_SPACE_NAME_DUPLICATE(500,"PLATFORM.ERROR.SPACE.NAME.DUPLICATE"), PLATFORM_ERROR_SPACE_NAME_DUPLICATE(500,"PLATFORM.ERROR.SPACE.NAME.DUPLICATE"),
PLATFORM_ERROR_SPACE_NOT_DEL(500,"PLATFORM.ERROR.SPACE.NOT.DEL"),
......
...@@ -54,7 +54,7 @@ SYSTEM.ERROR.TMP.TOKEN.BLANK=验证码不匹配 ...@@ -54,7 +54,7 @@ SYSTEM.ERROR.TMP.TOKEN.BLANK=验证码不匹配
SYSTEM.ERROR.TOKEN.BLANK.OR.NOT.EXIST=token失效或不存在 SYSTEM.ERROR.TOKEN.BLANK.OR.NOT.EXIST=token失效或不存在
SYSTEM.ERROR.NO.PERMISSION=无权限访问 SYSTEM.ERROR.NO.PERMISSION=无权限访问
SYSTEM.ERROR.TENANT.ID.NOT.BLANK=厂别id不能为空 SYSTEM.ERROR.TENANT.ID.NOT.BLANK=租户id不能为空
SYSTEM.ERROR.TENANT.NOT.EXIST=该厂别不存在或者被禁用 SYSTEM.ERROR.TENANT.NOT.EXIST=该厂别不存在或者被禁用
SYSTEM.ERROR.DUPLICATE.REQUEST=请勿重复请求 SYSTEM.ERROR.DUPLICATE.REQUEST=请勿重复请求
...@@ -90,4 +90,5 @@ SYSTEM.ERROR.SMS.CODE.NOT.CORRECT=验证码不正确 ...@@ -90,4 +90,5 @@ SYSTEM.ERROR.SMS.CODE.NOT.CORRECT=验证码不正确
PLATFORM.ERROR.ELDER.CERTIFICATENUMBER.DUPLICATE=证件号不能重复 PLATFORM.ERROR.ELDER.CERTIFICATENUMBER.DUPLICATE=证件号不能重复
PLATFORM.ERROR.SPACE.NAME.DUPLICATE=同一层级,空间名称不能重复 PLATFORM.ERROR.SPACE.NAME.DUPLICATE=同一层级,空间名称不能重复
\ No newline at end of file PLATFORM.ERROR.SPACE.NOT.DEL=该空间下存在下级或者房间,不可删除
\ No newline at end of file
package com.makeit.module.controller.space;
import com.makeit.common.dto.BaseBatchIdDTO;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.space.PlatRoomDTO;
import com.makeit.dto.platform.space.PlatRoomQueryDTO;
import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.service.platform.space.PlatRoomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author:lzy
* @Date:2023/9/5 14:59
* @Describe:
*/
@Api(tags = "房间管理")
@RestController
@RequestMapping("/plat/room")
public class PlatRoomController {
@Autowired
private PlatRoomService platRoomService;
@ApiOperation("新增")
@PostMapping("add")
public ApiResponseEntity<?> add(@Validated @RequestBody PlatRoomDTO dto) {
platRoomService.add(dto);
return ApiResponseUtils.success();
}
@ApiOperation("编辑")
@PostMapping("edit")
public ApiResponseEntity<?> edit(@Validated @RequestBody PlatRoomDTO dto) {
platRoomService.edit(dto);
return ApiResponseUtils.success();
}
@ApiOperation("详情")
@PostMapping("view")
public ApiResponseEntity<PlatRoomDTO> edit(@RequestBody BaseIdDTO baseIdDTO) {
PlatRoomDTO data = platRoomService.view(baseIdDTO.getId());
return ApiResponseUtils.success(data);
}
@ApiOperation("删除")
@PostMapping("del")
public ApiResponseEntity<PlatRoomDTO> del(@RequestBody BaseBatchIdDTO baseBatchIdDTO) {
platRoomService.del(baseBatchIdDTO.getIdList());
return ApiResponseUtils.success();
}
@ApiOperation("列表")
@PostMapping("page")
public ApiResponseEntity<PageVO<PlatRoom>> page(@RequestBody PageReqDTO<PlatRoomQueryDTO> page) {
PageVO<PlatRoom> data = platRoomService.page(page);
return ApiResponseUtils.success(data);
}
}
package com.makeit.module.controller.space; package com.makeit.module.controller.space;
import com.makeit.common.dto.BaseIdDTO;
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.space.PlatSpaceAddDTO; import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.dto.platform.space.PlatSpaceVO;
import com.makeit.service.platform.space.PlatSpaceService; import com.makeit.service.platform.space.PlatSpaceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -13,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -13,6 +16,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/4 16:52 * @Date:2023/9/4 16:52
...@@ -33,5 +38,39 @@ public class PlatSpaceController { ...@@ -33,5 +38,39 @@ public class PlatSpaceController {
return ApiResponseUtils.success(); return ApiResponseUtils.success();
} }
@ApiOperation("编辑")
@PostMapping("edit")
public ApiResponseEntity<?> edit(@Validated @RequestBody PlatSpaceAddDTO dto) {
spaceService.edit(dto);
return ApiResponseUtils.success();
}
@ApiOperation("详情")
@PostMapping("view")
public ApiResponseEntity<PlatSpaceAddDTO> view(@RequestBody BaseIdDTO baseIdDTO) {
PlatSpaceAddDTO data = spaceService.view(baseIdDTO.getId());
return ApiResponseUtils.success(data);
}
@ApiOperation("删除")
@PostMapping("del")
public ApiResponseEntity<?> del(@RequestBody BaseIdDTO baseIdDTO) {
spaceService.del(baseIdDTO.getId());
return ApiResponseUtils.success();
}
@ApiOperation("树")
@PostMapping("tree")
public ApiResponseEntity<List<PlatSpaceVO>> tree(@RequestBody PlatSpaceQueryDTO dto) {
List<PlatSpaceVO> data = spaceService.tree(dto);
return ApiResponseUtils.success(data);
}
@ApiOperation("树-无权限")
@PostMapping("listTreeAuthIgnore")
public ApiResponseEntity<List<PlatSpaceVO>> listTreeAuthIgnore(@RequestBody PlatSpaceQueryDTO dto) {
List<PlatSpaceVO> data = spaceService.tree(dto);
return ApiResponseUtils.success(data);
}
} }
package com.makeit.dto.platform.device;
import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.device.PlatDeviceOther;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PlatDeviceDetailDTO {
@ApiModelProperty(value = "基本信息")
private PlatDevice platDevice;
@ApiModelProperty(value = "其他信息")
private PlatDeviceOther platDeviceOther;
}
package com.makeit.dto.platform.space;
import com.makeit.common.dto.BaseIdDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* @Author:lzy
* @Date:2023/9/5 14:54
* @Describe:
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlatRoomDTO对象", description = "房间DTO")
public class PlatRoomDTO extends BaseIdDTO {
@NotBlank(message = "房间名称不能为空")
@Size(max = 50, message = "房间名称最长为50个字符")
@ApiModelProperty(value = "房间名称",required = true)
private String name;
@ApiModelProperty(value = "空间ID",required = true)
private String spaceId;
@ApiModelProperty(value = "空间全路径",required = true)
private String spacePath;
@ApiModelProperty(value = "空间全路径名称")
private String spacePathName;
@ApiModelProperty(value = "床位数量")
private int bedNumber;
@Size(max = 200, message = "描述最长为200个字符")
@ApiModelProperty(value = "描述")
private String description;
}
package com.makeit.dto.platform.space;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author:lzy
* @Date:2023/9/5 15:20
* @Describe:
*/
@Data
@ApiModel("PlatRoomQueryDTO 参数")
public class PlatRoomQueryDTO {
@ApiModelProperty("房间名称")
private String name;
}
package com.makeit.dto.platform.space; package com.makeit.dto.platform.space;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.dto.BaseTenantDTO; import com.makeit.common.dto.BaseTenantDTO;
import com.makeit.enums.platform.space.PlatSpaceEnum; import com.makeit.enums.platform.space.PlatSpaceEnum;
import com.makeit.global.validator.DictEnum; import com.makeit.global.validator.DictEnum;
...@@ -19,15 +20,15 @@ import javax.validation.constraints.Size; ...@@ -19,15 +20,15 @@ import javax.validation.constraints.Size;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlatSpaceAddDTO对象", description = "空间添加") @ApiModel(value = "PlatSpaceAddDTO对象", description = "空间添加")
public class PlatSpaceAddDTO extends BaseTenantDTO { public class PlatSpaceAddDTO extends BaseIdDTO {
@NotBlank(message = "空间名称不能为空") @NotBlank(message = "空间名称不能为空")
@Size(max = 50, message = "空间名称最长为50个字符") @Size(max = 50, message = "空间名称最长为50个字符")
@ApiModelProperty(value = "空间名称") @ApiModelProperty(value = "空间名称",required = true)
private String name; private String name;
@DictEnum(em = PlatSpaceEnum.TypeEnum.class, message = "空间类型可选值为{m}") @DictEnum(em = PlatSpaceEnum.TypeEnum.class, message = "空间类型可选值为{m}")
@ApiModelProperty(value = "空间类型 数据字典 1:小区/社区/街道 2:楼栋 3:单元 4 楼层") @ApiModelProperty(value = "空间类型 数据字典 1:小区/社区/街道 2:楼栋 3:单元 4 楼层",required = true)
private String type; private String type;
@ApiModelProperty(value = "上级空间") @ApiModelProperty(value = "上级空间")
...@@ -42,4 +43,7 @@ public class PlatSpaceAddDTO extends BaseTenantDTO { ...@@ -42,4 +43,7 @@ public class PlatSpaceAddDTO extends BaseTenantDTO {
@ApiModelProperty(value = "纬度") @ApiModelProperty(value = "纬度")
private String latitude; private String latitude;
@ApiModelProperty(value = "上级全路径",required = true)
private String parentPath;
} }
package com.makeit.dto.platform.space;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author:lzy
* @Date:2023/9/5 11:45
* @Describe:
*/
@Data
@ApiModel("PlatSpaceQueryDTO参数")
public class PlatSpaceQueryDTO {
@ApiModelProperty("空间名称")
private String name;
}
package com.makeit.dto.platform.space;
import com.makeit.common.dto.BaseIdDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Author:lzy
* @Date:2023/9/5 11:41
* @Describe:
*/
@Data
@ApiModel("PlatSpaceVO参数")
public class PlatSpaceVO extends BaseIdDTO {
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("父级Id")
private String parentId;
@ApiModelProperty("子集")
private List<PlatSpaceVO> child;
}
package com.makeit.entity.platform.space; package com.makeit.entity.platform.space;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.makeit.common.entity.BaseBusEntity; import com.makeit.common.entity.BaseBusEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -26,12 +28,10 @@ public class PlatRoom extends BaseBusEntity { ...@@ -26,12 +28,10 @@ public class PlatRoom extends BaseBusEntity {
@ApiModelProperty(value = "空间全路径") @ApiModelProperty(value = "空间全路径")
private String spacePath; private String spacePath;
@ApiModelProperty(value = "空间全路径名称")
private String spacePathName;
@ApiModelProperty(value = "床位数量") @ApiModelProperty(value = "床位数量")
private int bedNumber; private int bedNumber;
@TableField(updateStrategy = FieldStrategy.IGNORED)
@ApiModelProperty(value = "描述") @ApiModelProperty(value = "描述")
private String description; private String description;
} }
...@@ -43,5 +43,8 @@ public class PlatSpace extends BaseBusEntity { ...@@ -43,5 +43,8 @@ public class PlatSpace extends BaseBusEntity {
@ApiModelProperty(value = "区") @ApiModelProperty(value = "区")
private String district; private String district;
@ApiModelProperty(value = "上级全路径")
private String parentPath;
} }
...@@ -30,6 +30,7 @@ import com.makeit.enums.CommonEnum; ...@@ -30,6 +30,7 @@ import com.makeit.enums.CommonEnum;
import com.makeit.enums.IsTenantAccountEnum; import com.makeit.enums.IsTenantAccountEnum;
import com.makeit.enums.biz.auth.SysEnum; import com.makeit.enums.biz.auth.SysEnum;
import com.makeit.exception.BusinessException; import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.global.aspect.tenant.TenantIdUtil; import com.makeit.global.aspect.tenant.TenantIdUtil;
import com.makeit.mapper.platform.auth.PlatUserMapper; import com.makeit.mapper.platform.auth.PlatUserMapper;
import com.makeit.module.admin.dto.plat.PlatMenuDTOVO; import com.makeit.module.admin.dto.plat.PlatMenuDTOVO;
...@@ -130,7 +131,10 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -130,7 +131,10 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.like(StringUtils.isNotBlank(dto.getAccount()), PlatUser::getAccount, dto.getAccount()) .like(StringUtils.isNotBlank(dto.getAccount()), PlatUser::getAccount, dto.getAccount())
.like(StringUtils.isNotBlank(dto.getUsername()), PlatUser::getUsername, dto.getUsername()) .like(StringUtils.isNotBlank(dto.getUsername()), PlatUser::getUsername, dto.getUsername())
.like(StringUtils.isNotBlank(dto.getMobile()), PlatUser::getMobile, dto.getMobile()) .like(StringUtils.isNotBlank(dto.getMobile()), PlatUser::getMobile, dto.getMobile())
.eq(StringUtils.isNotBlank(dto.getStatus()), PlatUser::getStatus, dto.getStatus()); .eq(StringUtils.isNotBlank(dto.getStatus()), PlatUser::getStatus, dto.getStatus())
.eq(StringUtils.isNotBlank(dto.getTenantId()),PlatUser::getTenantId,dto.getTenantId())
.like(StringUtils.isNotBlank(dto.getOrgId()),PlatUser::getOrgPath,dto.getOrgId())
;
if (consumer != null) { if (consumer != null) {
consumer.accept(lambdaQueryWrapper); consumer.accept(lambdaQueryWrapper);
...@@ -334,6 +338,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -334,6 +338,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
} }
@Override @Override
@TenantIdIgnore
public PlatUserLoginVO login(LoginDTO loginDTO) { public PlatUserLoginVO login(LoginDTO loginDTO) {
if (StringUtils.isBlank(loginDTO.getAccount())) { if (StringUtils.isBlank(loginDTO.getAccount())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR);
...@@ -364,7 +369,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -364,7 +369,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
/** /**
* 校验机场 * 校验机场
*/ */
checkUserOrg(platUser); //checkUserOrg(platUser);
PlatUserLoginVO userLoginVO = BeanDtoVoUtils.convert(platUser, PlatUserLoginVO.class); PlatUserLoginVO userLoginVO = BeanDtoVoUtils.convert(platUser, PlatUserLoginVO.class);
......
...@@ -3,6 +3,7 @@ package com.makeit.service.platform.device; ...@@ -3,6 +3,7 @@ package com.makeit.service.platform.device;
import com.baomidou.mybatisplus.extension.service.IService; 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.PlatDeviceDetailDTO;
import com.makeit.dto.platform.device.PlatDeviceEditDTO; import com.makeit.dto.platform.device.PlatDeviceEditDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO; import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
...@@ -33,4 +34,26 @@ public interface PlatDeviceService extends IService<PlatDevice> { ...@@ -33,4 +34,26 @@ public interface PlatDeviceService extends IService<PlatDevice> {
void wechatEdit(PlatDeviceEditWechatDTO dto); void wechatEdit(PlatDeviceEditWechatDTO dto);
/*小程序*/ /*小程序*/
/**
* 分页-saas端
*
* @param pageReqDTO
* @return
*/
PageVO<PlatDevice> pageSaas(PageReqDTO<PlatDevice> pageReqDTO);
/**
* 设备信息
*
* @param deviceId
* @return
*/
PlatDeviceDetailDTO getDetailDTO(String deviceId);
/**
* 编辑
*
* @param platDevice
*/
void edit(PlatDevice platDevice);
} }
package com.makeit.service.platform.device.impl; package com.makeit.service.platform.device.impl;
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.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.common.entity.BaseBusEntity;
import com.makeit.common.entity.BaseEntity;
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.PlatDeviceDetailDTO;
import com.makeit.dto.platform.device.PlatDeviceEditDTO; import com.makeit.dto.platform.device.PlatDeviceEditDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO; import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
...@@ -14,6 +20,7 @@ import com.makeit.entity.platform.device.PlatDevice; ...@@ -14,6 +20,7 @@ import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.device.PlatDeviceOther; import com.makeit.entity.platform.device.PlatDeviceOther;
import com.makeit.enums.CodeMessageEnum; import com.makeit.enums.CodeMessageEnum;
import com.makeit.exception.BusinessException; import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.mapper.platform.device.PlatDeviceMapper; import com.makeit.mapper.platform.device.PlatDeviceMapper;
import com.makeit.service.platform.auth.PlatOrgService; import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.device.PlatDeviceOtherService; import com.makeit.service.platform.device.PlatDeviceOtherService;
...@@ -164,4 +171,63 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -164,4 +171,63 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
platDeviceOtherService.saveOrUpdate(other); platDeviceOtherService.saveOrUpdate(other);
} }
@Override
@TenantIdIgnore
public PageVO<PlatDevice> pageSaas(PageReqDTO<PlatDevice> pageReqDTO) {
PlatDevice param = pageReqDTO.getData();
Page<PlatDevice> page = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper<PlatDevice> lambdaQueryWrapper = getLambdaQueryWrapper(param);
Page<PlatDevice> devicePage = page(page, lambdaQueryWrapper);
return PageUtil.toPageVO(devicePage);
}
/**
* 设备信息
*
* @param deviceId
* @return
*/
@Override
public PlatDeviceDetailDTO getDetailDTO(String deviceId) {
PlatDevice platDevice = getById(deviceId);
if (platDevice == null) {
return null;
}
LambdaQueryWrapper<PlatDeviceOther> deviceOtherLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceOtherLambdaQueryWrapper.eq(PlatDeviceOther::getDeviceId, platDevice.getId());
PlatDeviceOther platDeviceOther = platDeviceOtherService.getOne(deviceOtherLambdaQueryWrapper, false);
PlatDeviceDetailDTO detailDTO = new PlatDeviceDetailDTO();
detailDTO.setPlatDevice(platDevice);
detailDTO.setPlatDeviceOther(platDeviceOther);
return detailDTO;
}
private LambdaQueryWrapper<PlatDevice> getLambdaQueryWrapper(PlatDevice param) {
return new LambdaQueryWrapper<PlatDevice>()
.eq(StringUtils.isNotBlank(param.getOriDeviceId()), PlatDevice::getOriDeviceId, param.getOriDeviceId())
.like(StringUtils.isNotBlank(param.getName()), PlatDevice::getName, param.getName())
.eq(StringUtils.isNotBlank(param.getStatus()), PlatDevice::getStatus, param.getStatus())
.like(StringUtils.isNotBlank(param.getProductName()), PlatDevice::getProductName, param.getProductName())
.eq(StringUtils.isNotBlank(param.getTenantId()), BaseBusEntity::getTenantId, param.getTenantId())
.orderByDesc(BaseEntity::getUpdateDate);
}
/**
* 编辑
*
* @param platDevice
*/
@Override
@Transactional
public void edit(PlatDevice platDevice) {
LambdaUpdateWrapper<PlatDevice> updateWrapper = Wrappers.lambdaUpdate(PlatDevice.class)
.eq(BaseEntity::getId, platDevice.getId())
.set(PlatDevice::getOriDeviceId, platDevice.getOriDeviceId())
.set(PlatDevice::getName, platDevice.getName())
.set(PlatDevice::getProductName, platDevice.getProductName())
.set(PlatDevice::getDescription, platDevice.getDescription());
this.update(updateWrapper);
}
} }
package com.makeit.service.platform.space; package com.makeit.service.platform.space;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.elder.PlatElderQueryDTO;
import com.makeit.dto.platform.space.PlatRoomDTO;
import com.makeit.dto.platform.space.PlatRoomQueryDTO;
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 16:15 * @Date:2023/8/31 16:15
* @Describe: * @Describe:
*/ */
public interface PlatRoomService extends IService<PlatRoom> { public interface PlatRoomService extends IService<PlatRoom> {
/**
* 添加房间
* @param dto
*/
void add(PlatRoomDTO dto);
/**
*
* @param dto
*/
void edit(PlatRoomDTO dto);
/**
* 详情
* @param id
* @return
*/
PlatRoomDTO view(String id);
/**
* 删除
* @param ids
*/
void del(List<String> ids);
/**
* 列表
* @param page
* @return
*/
PageVO<PlatRoom> page(PageReqDTO<PlatRoomQueryDTO> page);
} }
...@@ -2,8 +2,12 @@ package com.makeit.service.platform.space; ...@@ -2,8 +2,12 @@ package com.makeit.service.platform.space;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.dto.platform.space.PlatSpaceAddDTO; import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.dto.platform.space.PlatSpaceVO;
import com.makeit.entity.platform.space.PlatSpace; import com.makeit.entity.platform.space.PlatSpace;
import java.util.List;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 16:17 * @Date:2023/8/31 16:17
...@@ -28,4 +32,18 @@ public interface PlatSpaceService extends IService<PlatSpace> { ...@@ -28,4 +32,18 @@ public interface PlatSpaceService extends IService<PlatSpace> {
* @param id * @param id
*/ */
void del(String id); void del(String id);
/**
* 树结构
* @param dto
* @return
*/
List<PlatSpaceVO> tree(PlatSpaceQueryDTO dto);
/**
* 详情
* @param id
* @return
*/
PlatSpaceAddDTO view(String id);
} }
package com.makeit.service.platform.space.impl; package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.space.PlatRoomDTO;
import com.makeit.dto.platform.space.PlatRoomQueryDTO;
import com.makeit.entity.platform.space.PlatRoom; import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.mapper.platform.space.PlatRoomMapper; import com.makeit.mapper.platform.space.PlatRoomMapper;
import com.makeit.service.platform.space.PlatRoomService; import com.makeit.service.platform.space.PlatRoomService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.PageUtil;
import jodd.util.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 16:15 * @Date:2023/8/31 16:15
* @Describe: * @Describe:
*/ */
@Service
public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> implements PlatRoomService { public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> implements PlatRoomService {
@Override
@Transactional
public void add(PlatRoomDTO dto) {
PlatRoom platRoom = BeanDtoVoUtils.convert(dto,PlatRoom.class);
save(platRoom);
}
@Override
@Transactional
public void edit(PlatRoomDTO dto) {
PlatRoom platRoom = getById(dto.getId());
platRoom.setName(dto.getName());
platRoom.setBedNumber(dto.getBedNumber());
platRoom.setDescription(dto.getDescription());
platRoom.setSpaceId(dto.getSpaceId());
platRoom.setSpacePath(dto.getSpacePath());
updateById(platRoom);
}
@Override
public PlatRoomDTO view(String id) {
PlatRoom room = getById(id);
PlatRoomDTO data = BeanDtoVoUtils.convert(room,PlatRoomDTO.class);
return data;
}
@Override
public void del(List<String> ids) {
//TODO 判断是否有床位
removeByIds(ids);
}
@Override
public PageVO<PlatRoom> page(PageReqDTO<PlatRoomQueryDTO> page) {
PlatRoomQueryDTO dto = page.getData();
Page<PlatRoom> p = PageUtil.toMpPage(page);
LambdaQueryWrapper<PlatRoom> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()),PlatRoom::getName,dto.getName());
Page<PlatRoom> pages = page(p,queryWrapper);
return PageUtil.toPageVO(pages.getRecords(), pages);
}
} }
...@@ -3,6 +3,8 @@ package com.makeit.service.platform.space.impl; ...@@ -3,6 +3,8 @@ 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.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.dto.platform.space.PlatSpaceAddDTO; import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.dto.platform.space.PlatSpaceVO;
import com.makeit.entity.platform.space.PlatSpace; import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.CodeMessageEnum; import com.makeit.enums.CodeMessageEnum;
import com.makeit.exception.BusinessException; import com.makeit.exception.BusinessException;
...@@ -13,6 +15,11 @@ import jodd.util.StringUtil; ...@@ -13,6 +15,11 @@ import jodd.util.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 16:17 * @Date:2023/8/31 16:17
...@@ -24,9 +31,15 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -24,9 +31,15 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
private void check(PlatSpaceAddDTO dto){ private void check(PlatSpaceAddDTO dto){
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatSpace::getParentId,dto.getParentId());
queryWrapper.eq(PlatSpace::getName,dto.getName()); queryWrapper.eq(PlatSpace::getName,dto.getName());
queryWrapper.ne(StringUtil.isNotEmpty(dto.getId()), PlatSpace::getId,dto.getId()); queryWrapper.ne(StringUtil.isNotEmpty(dto.getId()), PlatSpace::getId,dto.getId());
if(StringUtil.isEmpty(dto.getParentId())){
queryWrapper.isNull(PlatSpace::getParentId);
}else{
queryWrapper.eq(PlatSpace::getParentId,dto.getParentId());
}
if(this.count(queryWrapper) > 0){ if(this.count(queryWrapper) > 0){
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NAME_DUPLICATE); throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NAME_DUPLICATE);
} }
...@@ -53,13 +66,79 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -53,13 +66,79 @@ 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());
this.updateById(space); this.updateById(space);
} }
@Override @Override
public void del(String id) { public void del(String id) {
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatSpace::getParentId,id);
if(count(queryWrapper) > 0){
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NOT_DEL);
}
//TODO 房间的判断
this.removeById(id); this.removeById(id);
} }
@Override
public List<PlatSpaceVO> tree(PlatSpaceQueryDTO dto) {
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()),PlatSpace::getName,dto.getName());
List<PlatSpace> list = this.list(queryWrapper);
//父级
List<PlatSpace> listParent = list.stream().filter(item->StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
//子集
List<PlatSpace> listChild = list.stream().filter(item->item.getParentId() != null).collect(Collectors.toList());
Map<String,List<PlatSpace>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
List<PlatSpaceVO> data = new ArrayList<>();
for(PlatSpace space:listParent){
PlatSpaceVO vo = convertToVO(space);
vo = child(vo,map);
data.add(vo);
}
return data;
}
@Override
public PlatSpaceAddDTO view(String id) {
PlatSpace space = getById(id);
PlatSpaceAddDTO data = BeanDtoVoUtils.convert(space,PlatSpaceAddDTO.class);
return data;
}
private PlatSpaceVO child(PlatSpaceVO vo,Map<String,List<PlatSpace>> map){
if(!map.containsKey(vo.getId())){
return vo;
}
List<PlatSpace> list = map.get(vo.getId());
List<PlatSpaceVO> listChild = new ArrayList<>();
for(PlatSpace item:list){
PlatSpaceVO dto = convertToVO(item);
this.child(dto,map);
listChild.add(dto);
}
vo.setChild(listChild);
return vo;
}
private PlatSpaceVO convertToVO(PlatSpace space){
PlatSpaceVO vo = new PlatSpaceVO();
vo.setName(space.getName());
vo.setParentId(space.getId());
vo.setId(space.getId());
return vo;
}
} }
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