Commit 0c93240d by huangjy

Merge remote-tracking branch 'origin/dev' into dev

parents b878669f 412540f4
Showing with 938 additions and 165 deletions
......@@ -238,6 +238,7 @@ CREATE TABLE `plat_device`
`id` varchar(64) NOT NULL COMMENT 'id',
ori_device_id varchar(64) NOT NULL COMMENT '原始设备ID',
name varchar(100) NOT NULL COMMENT '设备名称',
product_id varchar(100) NULL COMMENT '产品id',
product_name varchar(100) NOT NULL COMMENT '产品名称',
firmware_version varchar(100) NOT NULL COMMENT '固件版本',
registration_date datetime NOT NULL COMMENT '注册时间',
......
......@@ -27,7 +27,6 @@ CREATE TABLE `plat_room`
`name` VARCHAR(128) NOT NULL COMMENT '名称',
`space_id` VARCHAR(64) NOT NULL COMMENT '空间id',
`space_path` VARCHAR(512) NOT NULL COMMENT '空间全路径',
`space_path_name` 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 '创建者',
......
......@@ -26,6 +26,10 @@ INSERT INTO sys_dictionary_category (id, code, name, create_date, update_date, d
VALUES ('203', 'alarm.notifyWay', '告警配置通知对象', '2022-05-16 17:08:33', '2022-05-16 17:08:37', '0');
INSERT INTO sys_dictionary_category (id, code, name, create_date, update_date, del_flag)
VALUES ('300', 'device.status', '设备状态', '2022-05-16 17:08:33', '2022-05-16 17:08:37', '0');
INSERT INTO sys_dictionary (id, code, name, value, sort, description, category_id, create_date, update_date, del_flag)
VALUES ('1', 'common.status.yes', '是', '1', 1, '', '2', '2022-05-16 17:13:23', '2022-05-16 17:13:27', '0');
......@@ -99,6 +103,12 @@ VALUES ('230', 'alarm.notifyWay.all', '全部', '1', 1, '', '203', '2022-05-16 1
INSERT INTO sys_dictionary (id, code, name, value, sort, description, category_id, create_date, update_date, del_flag)
VALUES ('231', 'alarm.notifyWay.choose', '选择人员', '2', 2, '', '203', '2022-05-16 17:13:23', '2022-05-16 17:13:27', '0');
INSERT INTO sys_dictionary (id, code, name, value, sort, description, category_id, create_date, update_date, del_flag)
VALUES ('300', 'device.status.online', '在线', '1', 1, '', '300', '2022-05-16 17:13:23', '2022-05-16 17:13:27', '0');
INSERT INTO sys_dictionary (id, code, name, value, sort, description, category_id, create_date, update_date, del_flag)
VALUES ('400', 'device.status.offline', '离线', '0', 0, '', '300', '2022-05-16 17:13:23', '2022-05-16 17:13:27', '0');
INSERT INTO sys_config_category (id, tenant_id, code, name, create_date, update_date, del_flag, create_by, update_by, eng_name) VALUES ('1', '0', 'elder.certificateType', '长者证件类型', '2023-07-11 10:55:06', '2023-07-11 10:55:08', '0', null, null, null);
INSERT INTO sys_config_category (id, tenant_id, code, name, create_date, update_date, del_flag, create_by, update_by, eng_name) VALUES ('2', '0', 'elder.blood', '长者血型', '2023-07-11 10:55:06', '2023-07-11 10:55:08', '0', null, null, null);
......
......@@ -26,7 +26,7 @@ public class SaasDeviceController {
@ApiOperation("列表")
@PostMapping("page")
public ApiResponseEntity<PageVO<PlatDevice>> page(@RequestBody PageReqDTO<PlatDevice> pageReqDTO) {
return ApiResponseUtils.success(platDeviceService.page(pageReqDTO));
return ApiResponseUtils.success(platDeviceService.pageSaas(pageReqDTO));
}
@ApiOperation("设备信息")
......
......@@ -95,7 +95,7 @@ public enum CodeMessageEnum {
PLATFORM_ERROR_SPACE_NAME_DUPLICATE(500,"PLATFORM.ERROR.SPACE.NAME.DUPLICATE"),
PLATFORM_ERROR_SPACE_NOT_DEL(500,"PLATFORM.ERROR.SPACE.NOT.DEL"),
......
......@@ -164,6 +164,10 @@ public class JoinUtil {
joinSplit(list, service, null, getNid, getMid, consumer);
}
public static <T, M extends BaseEntity> void joinSplit(List<T> list, IService<M> service, Function<T, String> getNid, BiConsumer<T, List<M>> consumer) {
joinSplit(list, service, null, getNid, BaseEntity::getId, consumer);
}
public static <T, M> void joinMany(List<T> list, IService<M> service, Consumer<LambdaQueryWrapper<M>> extQuery, Function<T, String> getNid, SFunction<M, String> getMid, BiConsumer<T, List<M>> consumer) {
if (list.isEmpty()) {
......
......@@ -91,3 +91,4 @@ PLATFORM.ERROR.ELDER.CERTIFICATENUMBER.DUPLICATE=证件号不能重复
PLATFORM.ERROR.SPACE.NAME.DUPLICATE=同一层级,空间名称不能重复
PLATFORM.ERROR.SPACE.NOT.DEL=该空间下存在下级或者房间,不可删除
\ No newline at end of file
package com.makeit.com.makeit.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 长者子女账号 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@RestController
@RequestMapping("/elder-children-info")
public class ElderChildrenInfoController {
}
package com.makeit.com.makeit.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 长者基本信息 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@RestController
@RequestMapping("/elder")
public class ElderController {
}
package com.makeit.com.makeit.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 长者健康状态 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@RestController
@RequestMapping("/elder-health-info")
public class ElderHealthInfoController {
}
package com.makeit.com.makeit.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 长者体检报告信息 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@RestController
@RequestMapping("/elder-medical-examination-info")
public class ElderMedicalExaminationInfoController {
}
package com.makeit.com.makeit.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 长者其他信息 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@RestController
@RequestMapping("/elder-other-info")
public class ElderOtherInfoController {
}
package com.makeit.com.makeit.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 长者社会关系 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@RestController
@RequestMapping("/elder-social-relation")
public class ElderSocialRelationController {
}
package com.makeit.com.makeit.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 设备 前端控制器
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@RestController
@RequestMapping("/plat-device")
public class PlatDeviceController {
}
package com.makeit.module.controller.device;
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.PlatDeviceEditDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.vo.platform.device.PlatDeviceListVO;
import com.makeit.vo.platform.device.PlatDeviceViewVO;
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;
/**
* <p>
* 设备 前端控制器
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Api(tags = "设备")
@RestController
@RequestMapping("/plat/device")
public class PlatDeviceController {
@Autowired
private PlatDeviceService platDeviceService;
@ApiOperation("分页列表")
@PostMapping("page")
public ApiResponseEntity<PageVO<PlatDeviceListVO>> page(@RequestBody PageReqDTO<PlatDeviceQueryDTO> pageReqDTO) {
return ApiResponseUtils.success(platDeviceService.page(pageReqDTO));
}
@ApiOperation("编辑")
@PostMapping("edit")
public ApiResponseEntity<?> edit(@Validated @RequestBody PlatDeviceEditDTO dto) {
platDeviceService.edit(dto);
return ApiResponseUtils.success();
}
@ApiOperation("详情")
@PostMapping("view")
public ApiResponseEntity<PlatDeviceViewVO> view(@RequestBody BaseIdDTO baseIdDTO) {
return ApiResponseUtils.success(platDeviceService.view(baseIdDTO.getId()));
}
}
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.wechat.device;
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.PlatDeviceQueryDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.vo.platform.device.PlatDeviceListVO;
import com.makeit.vo.platform.device.PlatDeviceViewVO;
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;
/**
* <p>
* 设备 前端控制器
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Api(tags = "设备-小程序")
@RestController
@RequestMapping("/wechat/plat/device")
public class PlatDeviceWechatController {
@Autowired
private PlatDeviceService platDeviceService;
@ApiOperation("分页列表")
@PostMapping("page")
public ApiResponseEntity<PageVO<PlatDeviceListVO>> page(@RequestBody PageReqDTO<PlatDeviceQueryDTO> pageReqDTO) {
return ApiResponseUtils.success(platDeviceService.page(pageReqDTO));
}
@ApiOperation("详情")
@PostMapping("view")
public ApiResponseEntity<PlatDeviceViewVO> view(@RequestBody BaseIdDTO baseIdDTO) {
return ApiResponseUtils.success(platDeviceService.view(baseIdDTO.getId()));
}
@ApiOperation("配网")
@PostMapping("setUp")
public ApiResponseEntity<?> setup(@Validated @RequestBody PlatDeviceSetupDTO dto) {
platDeviceService.setup(dto);
return ApiResponseUtils.success();
}
@ApiOperation("编辑")
@PostMapping("edit")
public ApiResponseEntity<?> edit(@Validated @RequestBody PlatDeviceEditWechatDTO dto) {
platDeviceService.wechatEdit(dto);
return ApiResponseUtils.success();
}
}
package com.makeit.dto.platform.device;
import com.makeit.common.dto.BaseTenantDTO;
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;
/**
* <p>
* 设备
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlatDevice对象", description = "设备")
public class PlatDeviceEditDTO extends BaseTenantDTO {
@NotBlank(message = "设备名称不能为空")
@Size(max = 50, message = "设备名称最长为50个字符")
@ApiModelProperty(value = "设备名称")
private String name;
@ApiModelProperty(value = "说明")
private String description;
}
package com.makeit.dto.platform.device;
import com.makeit.common.dto.BaseTenantDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 设备
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlatDevice对象", description = "设备")
public class PlatDeviceQueryDTO extends BaseTenantDTO {
@ApiModelProperty(value = "原始设备ID")
private String oriDeviceId;
@ApiModelProperty(value = "设备名称")
private String name;
@ApiModelProperty(value = "产品id")
private String productId;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "状态 数据字典 1 在线 0离线")
private String status;
@ApiModelProperty(value = "组织id")
private String orgId;
}
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.wechat.device;
import com.makeit.common.dto.BaseTenantDTO;
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;
/**
* <p>
* 设备
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlatDevice对象", description = "设备")
public class PlatDeviceEditWechatDTO extends BaseTenantDTO {
@NotBlank(message = "设备名称不能为空")
@Size(max = 50, message = "设备名称最长为50个字符")
@ApiModelProperty(value = "设备名称")
private String name;
@ApiModelProperty(value = "设备安装方式")
private String installation;
@ApiModelProperty(value = "开关指示灯")
private String indicatorLight;
@ApiModelProperty(value = "设备属性json")
private String attribute;
}
package com.makeit.dto.wechat.device;
import com.makeit.common.dto.BaseTenantDTO;
import com.makeit.common.entity.BaseBusEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* <p>
* 设备
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlatDevice对象", description = "设备")
public class PlatDeviceSetupDTO extends BaseTenantDTO {
@ApiModelProperty(value = "原始设备ID")
private String oriDeviceId;
@ApiModelProperty(value = "wifi名称")
private String wifiName;
@ApiModelProperty(value = "wifi密码")
private String wifiPassword;
@ApiModelProperty(value = "协议地址")
private String protocolAddress;
@ApiModelProperty(value = "协议端口")
private String protocolPort;
@ApiModelProperty(value = "协议账号")
private String protocolAccount;
@ApiModelProperty(value = "协议密码")
private String protocolPassword;
@ApiModelProperty(value = "组织id")
private String orgId;
@ApiModelProperty(value = "城市组织id")
private String cityOrgId;
@ApiModelProperty(value = "区组织id")
private String districtOrgId;
@ApiModelProperty(value = "街道组织id")
private String streetOrgId;
@ApiModelProperty(value = "组织路径")
private String orgPath;
}
package com.makeit.entity.platform.device;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.makeit.common.entity.BaseBusEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* <p>
* 设备
......@@ -19,7 +18,7 @@ import lombok.EqualsAndHashCode;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="PlatDevice对象", description="设备")
@ApiModel(value = "PlatDevice对象", description = "设备")
public class PlatDevice extends BaseBusEntity {
private static final long serialVersionUID = 1L;
......@@ -33,6 +32,9 @@ public class PlatDevice extends BaseBusEntity {
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "产品id")
private String productId;
@ApiModelProperty(value = "固件版本")
private String firmwareVersion;
......
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -26,12 +28,10 @@ public class PlatRoom extends BaseBusEntity {
@ApiModelProperty(value = "空间全路径")
private String spacePath;
@ApiModelProperty(value = "空间全路径名称")
private String spacePathName;
@ApiModelProperty(value = "床位数量")
private int bedNumber;
@TableField(updateStrategy = FieldStrategy.IGNORED)
@ApiModelProperty(value = "描述")
private String description;
}
package com.makeit.enums.platform.device;
import com.makeit.enums.BaseEnum;
import com.makeit.utils.sys.SysDictUtil;
public class PlatDeviceEnum {
public enum StatusEnum implements BaseEnum {
ONLINE("device.status.online"), OFFLINE("device.status.offline");
private String code;
StatusEnum(String code) {
this.code = code;
}
public String getValue() {
return SysDictUtil.getValue(code);
}
}
}
......@@ -4,7 +4,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.common.page.PageReqDTO;
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.PlatDeviceQueryDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.vo.platform.device.PlatDeviceListVO;
import com.makeit.vo.platform.device.PlatDeviceViewVO;
/**
* <p>
......@@ -16,15 +22,29 @@ import com.makeit.entity.platform.device.PlatDevice;
*/
public interface PlatDeviceService extends IService<PlatDevice> {
PageVO<PlatDeviceListVO> page(PageReqDTO<PlatDeviceQueryDTO> pageReqDTO);
void edit(PlatDeviceEditDTO dto);
PlatDeviceViewVO view(String id);
/*小程序*/
void setup(PlatDeviceSetupDTO dto);
void wechatEdit(PlatDeviceEditWechatDTO dto);
/*小程序*/
/**
* 分页-saas端
*
* @param pageReqDTO
* @return
*/
PageVO<PlatDevice> page(PageReqDTO<PlatDevice> pageReqDTO);
PageVO<PlatDevice> pageSaas(PageReqDTO<PlatDevice> pageReqDTO);
/**
* 设备信息
*
* @param deviceId
* @return
*/
......@@ -32,6 +52,7 @@ public interface PlatDeviceService extends IService<PlatDevice> {
/**
* 编辑
*
* @param platDevice
*/
void edit(PlatDevice platDevice);
......
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.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -10,18 +11,34 @@ import com.makeit.common.entity.BaseEntity;
import com.makeit.common.page.PageReqDTO;
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.PlatDeviceQueryDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.device.PlatDeviceOther;
import com.makeit.enums.CodeMessageEnum;
import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.mapper.platform.device.PlatDeviceMapper;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.device.PlatDeviceOtherService;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.old.StringUtils;
import com.makeit.utils.sql.join.JoinUtil;
import com.makeit.vo.platform.device.PlatDeviceListVO;
import com.makeit.vo.platform.device.PlatDeviceViewVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 设备 服务实现类
......@@ -36,9 +53,128 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
@Autowired
private PlatDeviceOtherService platDeviceOtherService;
@Autowired
private PlatOrgService platOrgService;
@Override
public PageVO<PlatDeviceListVO> page(PageReqDTO<PlatDeviceQueryDTO> pageReqDTO) {
PlatDeviceQueryDTO dto = pageReqDTO.getData();
Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO);
Page<PlatDevice> page = page(p, new QueryWrapper<PlatDevice>().lambda()
.like(StringUtils.isNotBlank(dto.getOriDeviceId()), PlatDevice::getOriDeviceId, dto.getOriDeviceId())
.like(StringUtils.isNotBlank(dto.getName()), PlatDevice::getName, dto.getName())
.eq(StringUtils.isNotBlank(dto.getStatus()), PlatDevice::getStatus, dto.getStatus())
.like(StringUtils.isNotBlank(dto.getProductName()), PlatDevice::getProductName, dto.getProductName())
.eq(StringUtils.isNotBlank(dto.getProductId()), PlatDevice::getProductId, dto.getProductId())
.apply(StringUtils.isNotBlank(dto.getOrgId()), "find_in_set('" + dto.getOrgId() + "',org_path)")
);
List<PlatDeviceListVO> voList = BeanDtoVoUtils.listVo(page.getRecords(), PlatDeviceListVO.class);
JoinUtil.join(voList, platOrgService, PlatDeviceListVO::getOrgId, (d, o) -> {
d.setOrgName(o.getName());
});
JoinUtil.joinSplit(voList, platOrgService, PlatDeviceListVO::getOrgId, (d, o) -> {
d.setOrgName(StreamUtil.join(o, PlatOrg::getName));
});
return PageUtil.toPageVO(voList, page);
}
private void check(PlatDeviceEditDTO dto) {
PlatDevice old = getOne(new QueryWrapper<PlatDevice>().lambda()
.eq(PlatDevice::getName, dto.getName()));
if (old != null && !old.getId().equals(dto.getId())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_NAME_DUPLICATE);
}
}
@Transactional
@Override
public void edit(PlatDeviceEditDTO dto) {
check(dto);
PlatDevice db = getById(dto.getId());
BeanUtils.copyProperties(dto, db);
updateById(db);
}
@Override
public PlatDeviceViewVO view(String id) {
PlatDevice db = getById(id);
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getDeviceId, id));
PlatDeviceViewVO vo = BeanDtoVoUtils.convert(db, PlatDeviceViewVO.class);
BeanUtils.copyProperties(other, vo);
vo.setId(db.getId());
return vo;
}
@Override
public void setup(PlatDeviceSetupDTO dto) {
PlatDevice db = getOne(new QueryWrapper<PlatDevice>().lambda()
.eq(PlatDevice::getOriDeviceId, dto.getOriDeviceId()));
String id = db.getId();
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, dto.getOriDeviceId()));
if (other == null) {
other = new PlatDeviceOther();
}
BeanUtils.copyProperties(dto, db);
db.setId(id);
BeanUtils.copyProperties(dto, other);
other.setDeviceId(id);
updateById(db);
platDeviceOtherService.saveOrUpdate(other);
}
@Override
public void wechatEdit(PlatDeviceEditWechatDTO dto) {
PlatDevice db = getById(dto.getId());
String id = db.getId();
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getDeviceId, db.getId()));
if (other == null) {
other = new PlatDeviceOther();
}
BeanUtils.copyProperties(dto, db);
db.setId(id);
BeanUtils.copyProperties(dto, other);
other.setDeviceId(id);
updateById(db);
platDeviceOtherService.saveOrUpdate(other);
}
@Override
@TenantIdIgnore
public PageVO<PlatDevice> page(PageReqDTO<PlatDevice> pageReqDTO) {
public PageVO<PlatDevice> pageSaas(PageReqDTO<PlatDevice> pageReqDTO) {
PlatDevice param = pageReqDTO.getData();
Page<PlatDevice> page = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper<PlatDevice> lambdaQueryWrapper = getLambdaQueryWrapper(param);
......@@ -55,11 +191,11 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
@Override
public PlatDeviceDetailDTO getDetailDTO(String deviceId) {
PlatDevice platDevice = getById(deviceId);
if(platDevice == null ){
if (platDevice == null) {
return null;
}
LambdaQueryWrapper<PlatDeviceOther> deviceOtherLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceOtherLambdaQueryWrapper.eq(PlatDeviceOther::getDeviceId,platDevice.getId());
deviceOtherLambdaQueryWrapper.eq(PlatDeviceOther::getDeviceId, platDevice.getId());
PlatDeviceOther platDeviceOther = platDeviceOtherService.getOne(deviceOtherLambdaQueryWrapper, false);
PlatDeviceDetailDTO detailDTO = new PlatDeviceDetailDTO();
......@@ -70,10 +206,10 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
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.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);
}
......
package com.makeit.service.platform.space;
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 java.util.List;
/**
* @Author:lzy
* @Date:2023/8/31 16:15
* @Describe:
*/
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);
}
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.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.mapper.platform.space.PlatRoomMapper;
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
* @Date:2023/8/31 16:15
* @Describe:
*/
@Service
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);
}
}
......@@ -73,6 +73,14 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
@Override
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);
}
......
package com.makeit.vo.platform.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.makeit.common.dto.BaseTenantDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* <p>
* 设备
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="PlatDevice对象", description="设备")
public class PlatDeviceListVO extends BaseTenantDTO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "原始设备ID")
private String oriDeviceId;
@ApiModelProperty(value = "设备名称")
private String name;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "产品id")
private String productId;
@ApiModelProperty(value = "说明")
private String description;
@ApiModelProperty(value = "状态 数据字典 1 在线 0离线")
private String status;
@ApiModelProperty(value = "组织id")
private String orgId;
@ApiModelProperty(value = "组织名称")
private String orgName;
@ApiModelProperty(value = "城市组织id")
private String cityOrgId;
@ApiModelProperty(value = "区组织id")
private String districtOrgId;
@ApiModelProperty(value = "街道组织id")
private String streetOrgId;
@ApiModelProperty(value = "组织路径")
private String orgPath;
@ApiModelProperty(value = "组织路径名称")
private String orgPathName;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间", required = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createDate;
}
package com.makeit.vo.platform.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.makeit.common.dto.BaseTenantDTO;
import com.makeit.common.entity.BaseBusEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* <p>
* 设备
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="PlatDevice对象", description="设备")
public class PlatDeviceViewVO extends BaseTenantDTO {
@ApiModelProperty(value = "原始设备ID")
private String oriDeviceId;
@ApiModelProperty(value = "设备名称")
private String name;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "产品id")
private String productId;
@ApiModelProperty(value = "固件版本")
private String firmwareVersion;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "注册时间")
private LocalDateTime registrationDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "最后上线时间")
private LocalDateTime lastOnlineData;
@ApiModelProperty(value = "说明")
private String description;
@ApiModelProperty(value = "状态 数据字典 1 在线 0离线")
private String status;
@ApiModelProperty(value = "组织id")
private String orgId;
@ApiModelProperty(value = "城市组织id")
private String cityOrgId;
@ApiModelProperty(value = "区组织id")
private String districtOrgId;
@ApiModelProperty(value = "街道组织id")
private String streetOrgId;
@ApiModelProperty(value = "组织路径")
private String orgPath;
@ApiModelProperty(value = "设备安装方式")
private String installation;
@ApiModelProperty(value = "开关指示灯")
private String indicatorLight;
@ApiModelProperty(value = "设备属性json")
private String attribute;
@ApiModelProperty(value = "wifi名称")
private String wifiName;
@ApiModelProperty(value = "wifi密码")
private String wifiPassword;
@ApiModelProperty(value = "协议地址")
private String protocolAddress;
@ApiModelProperty(value = "协议端口")
private String protocolPort;
@ApiModelProperty(value = "协议账号")
private String protocolAccount;
@ApiModelProperty(value = "协议密码")
private String protocolPassword;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间", required = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createDate;
}
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