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
e9cdaa44
authored
Sep 05, 2023
by
李小龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
设备
parent
f78b115b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
0 deletions
saas-module/src/main/java/com/makeit/controller/saas/SaasDeviceController.java
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceDetailDTO.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
saas-module/src/main/java/com/makeit/controller/saas/SaasDeviceController.java
0 → 100644
View file @
e9cdaa44
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
.
page
(
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
)
{
return
ApiResponseUtils
.
success
(
platDeviceService
.
edit
(
platDevice
));
}
@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
;
}
}
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceDetailDTO.java
0 → 100644
View file @
e9cdaa44
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
;
}
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
View file @
e9cdaa44
package
com
.
makeit
.
service
.
platform
.
device
;
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.entity.platform.device.PlatDevice
;
/**
...
...
@@ -13,4 +16,23 @@ import com.makeit.entity.platform.device.PlatDevice;
*/
public
interface
PlatDeviceService
extends
IService
<
PlatDevice
>
{
/**
* 分页-saas端
* @param pageReqDTO
* @return
*/
PageVO
<
PlatDevice
>
page
(
PageReqDTO
<
PlatDevice
>
pageReqDTO
);
/**
* 设备信息
* @param deviceId
* @return
*/
PlatDeviceDetailDTO
getDetailDTO
(
String
deviceId
);
/**
* 编辑
* @param platDevice
*/
void
edit
(
PlatDevice
platDevice
);
}
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
e9cdaa44
package
com
.
makeit
.
service
.
platform
.
device
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
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.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.PageVO
;
import
com.makeit.dto.platform.device.PlatDeviceDetailDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.mapper.platform.device.PlatDeviceMapper
;
import
com.makeit.service.platform.device.PlatDeviceOtherService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.old.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* <p>
...
...
@@ -17,4 +33,65 @@ import org.springframework.stereotype.Service;
@Service
public
class
PlatDeviceServiceImpl
extends
ServiceImpl
<
PlatDeviceMapper
,
PlatDevice
>
implements
PlatDeviceService
{
@Autowired
private
PlatDeviceOtherService
platDeviceOtherService
;
@Override
@TenantIdIgnore
public
PageVO
<
PlatDevice
>
page
(
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
);
}
}
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