Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2fd32ce3
authored
Sep 05, 2023
by
杨伟程
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
设备相关接口
parent
45260e49
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
695 additions
and
151 deletions
db/inti-elder.sql
db/sys.sql
server-common/src/main/java/com/makeit/utils/sql/join/JoinUtil.java
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderChildrenInfoController.java
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderController.java
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderHealthInfoController.java
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderMedicalExaminationInfoController.java
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderOtherInfoController.java
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderSocialRelationController.java
server-generator/src/main/java/com/makeit/com/makeit/controller/PlatDeviceController.java
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
server-module/src/main/java/com/makeit/module/controller/wechat/device/PlatDeviceWechatController.java
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceEditDTO.java
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceQueryDTO.java
server-service/src/main/java/com/makeit/dto/wechat/device/PlatDeviceEditWechatDTO.java
server-service/src/main/java/com/makeit/dto/wechat/device/PlatDeviceSetupDTO.java
server-service/src/main/java/com/makeit/entity/platform/device/PlatDevice.java
server-service/src/main/java/com/makeit/enums/platform/device/PlatDeviceEnum.java
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
server-service/src/main/java/com/makeit/vo/platform/device/PlatDeviceListVO.java
server-service/src/main/java/com/makeit/vo/platform/device/PlatDeviceViewVO.java
db/inti-elder.sql
View file @
2fd32ce3
...
@@ -238,6 +238,7 @@ CREATE TABLE `plat_device`
...
@@ -238,6 +238,7 @@ CREATE TABLE `plat_device`
`id`
varchar
(
64
)
NOT
NULL
COMMENT
'id'
,
`id`
varchar
(
64
)
NOT
NULL
COMMENT
'id'
,
ori_device_id
varchar
(
64
)
NOT
NULL
COMMENT
'原始设备ID'
,
ori_device_id
varchar
(
64
)
NOT
NULL
COMMENT
'原始设备ID'
,
name
varchar
(
100
)
NOT
NULL
COMMENT
'设备名称'
,
name
varchar
(
100
)
NOT
NULL
COMMENT
'设备名称'
,
product_id
varchar
(
100
)
NULL
COMMENT
'产品id'
,
product_name
varchar
(
100
)
NOT
NULL
COMMENT
'产品名称'
,
product_name
varchar
(
100
)
NOT
NULL
COMMENT
'产品名称'
,
firmware_version
varchar
(
100
)
NOT
NULL
COMMENT
'固件版本'
,
firmware_version
varchar
(
100
)
NOT
NULL
COMMENT
'固件版本'
,
registration_date
datetime
NOT
NULL
COMMENT
'注册时间'
,
registration_date
datetime
NOT
NULL
COMMENT
'注册时间'
,
...
...
db/sys.sql
View file @
2fd32ce3
...
@@ -26,6 +26,10 @@ INSERT INTO sys_dictionary_category (id, code, name, create_date, update_date, d
...
@@ -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'
);
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
)
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'
);
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
...
@@ -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
)
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'
);
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
(
'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
);
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
);
...
...
server-common/src/main/java/com/makeit/utils/sql/join/JoinUtil.java
View file @
2fd32ce3
...
@@ -164,6 +164,10 @@ public class JoinUtil {
...
@@ -164,6 +164,10 @@ public class JoinUtil {
joinSplit
(
list
,
service
,
null
,
getNid
,
getMid
,
consumer
);
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
)
{
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
())
{
if
(
list
.
isEmpty
())
{
...
...
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderChildrenInfoController.java
deleted
100644 → 0
View file @
45260e49
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
{
}
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderController.java
deleted
100644 → 0
View file @
45260e49
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
{
}
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderHealthInfoController.java
deleted
100644 → 0
View file @
45260e49
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
{
}
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderMedicalExaminationInfoController.java
deleted
100644 → 0
View file @
45260e49
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
{
}
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderOtherInfoController.java
deleted
100644 → 0
View file @
45260e49
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
{
}
server-generator/src/main/java/com/makeit/com/makeit/controller/ElderSocialRelationController.java
deleted
100644 → 0
View file @
45260e49
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
{
}
server-generator/src/main/java/com/makeit/com/makeit/controller/PlatDeviceController.java
deleted
100644 → 0
View file @
45260e49
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
{
}
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
0 → 100644
View file @
2fd32ce3
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
()));
}
}
server-module/src/main/java/com/makeit/module/controller/wechat/device/PlatDeviceWechatController.java
0 → 100644
View file @
2fd32ce3
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
();
}
}
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceEditDTO.java
0 → 100644
View file @
2fd32ce3
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
;
}
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceQueryDTO.java
0 → 100644
View file @
2fd32ce3
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
;
}
server-service/src/main/java/com/makeit/dto/wechat/device/PlatDeviceEditWechatDTO.java
0 → 100644
View file @
2fd32ce3
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
;
}
server-service/src/main/java/com/makeit/dto/wechat/device/PlatDeviceSetupDTO.java
0 → 100644
View file @
2fd32ce3
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
;
}
server-service/src/main/java/com/makeit/entity/platform/device/PlatDevice.java
View file @
2fd32ce3
package
com
.
makeit
.
entity
.
platform
.
device
;
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
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
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
java.time.LocalDateTime
;
/**
/**
* <p>
* <p>
* 设备
* 设备
...
@@ -19,7 +18,7 @@ import lombok.EqualsAndHashCode;
...
@@ -19,7 +18,7 @@ import lombok.EqualsAndHashCode;
*/
*/
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"PlatDevice对象"
,
description
=
"设备"
)
@ApiModel
(
value
=
"PlatDevice对象"
,
description
=
"设备"
)
public
class
PlatDevice
extends
BaseBusEntity
{
public
class
PlatDevice
extends
BaseBusEntity
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -33,6 +32,9 @@ public class PlatDevice extends BaseBusEntity {
...
@@ -33,6 +32,9 @@ public class PlatDevice extends BaseBusEntity {
@ApiModelProperty
(
value
=
"产品名称"
)
@ApiModelProperty
(
value
=
"产品名称"
)
private
String
productName
;
private
String
productName
;
@ApiModelProperty
(
value
=
"产品id"
)
private
String
productId
;
@ApiModelProperty
(
value
=
"固件版本"
)
@ApiModelProperty
(
value
=
"固件版本"
)
private
String
firmwareVersion
;
private
String
firmwareVersion
;
...
...
server-service/src/main/java/com/makeit/enums/platform/device/PlatDeviceEnum.java
0 → 100644
View file @
2fd32ce3
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
);
}
}
}
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
View file @
2fd32ce3
package
com
.
makeit
.
service
.
platform
.
device
;
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.PageVO
;
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.entity.platform.device.PlatDevice
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
import
com.makeit.vo.platform.device.PlatDeviceViewVO
;
/**
/**
* <p>
* <p>
...
@@ -13,4 +21,16 @@ import com.makeit.entity.platform.device.PlatDevice;
...
@@ -13,4 +21,16 @@ import com.makeit.entity.platform.device.PlatDevice;
*/
*/
public
interface
PlatDeviceService
extends
IService
<
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
);
/*小程序*/
}
}
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
2fd32ce3
package
com
.
makeit
.
service
.
platform
.
device
.
impl
;
package
com
.
makeit
.
service
.
platform
.
device
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
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.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.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.exception.BusinessException
;
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.device.PlatDeviceOtherService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
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.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
/**
* <p>
* <p>
...
@@ -17,4 +43,125 @@ import org.springframework.stereotype.Service;
...
@@ -17,4 +43,125 @@ import org.springframework.stereotype.Service;
@Service
@Service
public
class
PlatDeviceServiceImpl
extends
ServiceImpl
<
PlatDeviceMapper
,
PlatDevice
>
implements
PlatDeviceService
{
public
class
PlatDeviceServiceImpl
extends
ServiceImpl
<
PlatDeviceMapper
,
PlatDevice
>
implements
PlatDeviceService
{
@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
);
}
}
}
server-service/src/main/java/com/makeit/vo/platform/device/PlatDeviceListVO.java
0 → 100644
View file @
2fd32ce3
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
;
}
server-service/src/main/java/com/makeit/vo/platform/device/PlatDeviceViewVO.java
0 → 100644
View file @
2fd32ce3
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
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment