Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iot-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
back-end
iot-service
Commits
d098668d
Commit
d098668d
authored
Aug 13, 2020
by
chenfm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改设备实例查询接口
parent
a3e9907f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
8 deletions
+53
-8
DeviceInstanceController.java
...dule/devicemodel/controller/DeviceInstanceController.java
+4
-2
DeviceInstanceDto.java
...acenter/iot/module/devicemodel/dto/DeviceInstanceDto.java
+15
-2
DeviceInstanceForm.java
...enter/iot/module/devicemodel/form/DeviceInstanceForm.java
+5
-1
DeviceInstanceServiceImpl.java
...e/devicemodel/service/impl/DeviceInstanceServiceImpl.java
+6
-1
DeviceInstanceVO.java
...atacenter/iot/module/devicemodel/vo/DeviceInstanceVO.java
+16
-0
DeviceStateScheduleTask.java
.../com/esv/datacenter/iot/task/DeviceStateScheduleTask.java
+3
-1
logback-spring.xml
src/main/resources/logback-spring.xml
+1
-1
DeviceInstanceDao.xml
src/main/resources/mapper/devicemodel/DeviceInstanceDao.xml
+3
-0
No files found.
src/main/java/com/esv/datacenter/iot/module/devicemodel/controller/DeviceInstanceController.java
View file @
d098668d
...
@@ -5,6 +5,7 @@ import com.esv.datacenter.iot.common.exception.EException;
...
@@ -5,6 +5,7 @@ import com.esv.datacenter.iot.common.exception.EException;
import
com.esv.datacenter.iot.common.response.ECode
;
import
com.esv.datacenter.iot.common.response.ECode
;
import
com.esv.datacenter.iot.common.response.EResponse
;
import
com.esv.datacenter.iot.common.response.EResponse
;
import
com.esv.datacenter.iot.common.validator.groups.*
;
import
com.esv.datacenter.iot.common.validator.groups.*
;
import
com.esv.datacenter.iot.common.vo.PageResultVO
;
import
com.esv.datacenter.iot.module.devicemodel.form.DeviceInstanceForm
;
import
com.esv.datacenter.iot.module.devicemodel.form.DeviceInstanceForm
;
import
com.esv.datacenter.iot.module.devicemodel.service.DeviceInstanceService
;
import
com.esv.datacenter.iot.module.devicemodel.service.DeviceInstanceService
;
import
com.esv.datacenter.iot.module.devicemodel.service.DeviceTypeService
;
import
com.esv.datacenter.iot.module.devicemodel.service.DeviceTypeService
;
...
@@ -99,8 +100,9 @@ public class DeviceInstanceController {
...
@@ -99,8 +100,9 @@ public class DeviceInstanceController {
* @createTime 2020/08/07 14:08
* @createTime 2020/08/07 14:08
**/
**/
@PostMapping
(
"/list"
)
@PostMapping
(
"/list"
)
public
EResponse
list
(
@RequestBody
@Validated
(
ValidatorList
.
class
)
DeviceInstanceForm
form
)
throws
EException
{
public
EResponse
<
PageResultVO
>
list
(
@RequestBody
@Validated
(
ValidatorList
.
class
)
DeviceInstanceForm
form
)
{
return
EResponse
.
ok
(
deviceInstanceService
.
getInstance4Page
(
form
));
PageResultVO
pageResultVO
=
deviceInstanceService
.
getInstance4Page
(
form
);
return
EResponse
.
ok
(
pageResultVO
);
}
}
/**
/**
...
...
src/main/java/com/esv/datacenter/iot/module/devicemodel/dto/DeviceInstanceDto.java
View file @
d098668d
...
@@ -14,9 +14,8 @@ import java.util.Date;
...
@@ -14,9 +14,8 @@ import java.util.Date;
*/
*/
@Data
@Data
public
class
DeviceInstanceDto
{
public
class
DeviceInstanceDto
{
/**
/**
*
*
主键
*/
*/
private
Long
id
;
private
Long
id
;
/**
/**
...
@@ -43,6 +42,20 @@ public class DeviceInstanceDto {
...
@@ -43,6 +42,20 @@ public class DeviceInstanceDto {
* 设备型号
* 设备型号
*/
*/
private
String
deviceModel
;
private
String
deviceModel
;
/**
* 通信ID
**/
private
String
communicationId
;
/**
* 在线状态
**/
private
Integer
onlineState
;
/**
* 在线状态更新时间
**/
private
Date
onlineUpdateTime
;
/**
/**
* 创建者
* 创建者
*/
*/
...
...
src/main/java/com/esv/datacenter/iot/module/devicemodel/form/DeviceInstanceForm.java
View file @
d098668d
...
@@ -27,7 +27,7 @@ public class DeviceInstanceForm {
...
@@ -27,7 +27,7 @@ public class DeviceInstanceForm {
/**
/**
* 设备类型ID
* 设备类型ID
*/
*/
@NotNull
(
message
=
"[设备类型ID]不能为空"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorList
.
class
,
ValidatorListById
.
class
})
//
@NotNull(message = "[设备类型ID]不能为空", groups = {ValidatorInsert.class, ValidatorList.class, ValidatorListById.class})
private
Long
deviceTypeId
;
private
Long
deviceTypeId
;
/**
/**
* 设备名称
* 设备名称
...
@@ -51,6 +51,10 @@ public class DeviceInstanceForm {
...
@@ -51,6 +51,10 @@ public class DeviceInstanceForm {
*/
*/
@Length
(
max
=
200
,
message
=
"[设备型号]长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
,
ValidatorList
.
class
})
@Length
(
max
=
200
,
message
=
"[设备型号]长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
,
ValidatorList
.
class
})
private
String
deviceModel
;
private
String
deviceModel
;
/**
* 在线状态
*/
private
Integer
onlineState
;
/**
/**
* 页码
* 页码
...
...
src/main/java/com/esv/datacenter/iot/module/devicemodel/service/impl/DeviceInstanceServiceImpl.java
View file @
d098668d
...
@@ -151,15 +151,20 @@ public class DeviceInstanceServiceImpl extends ServiceImpl<DeviceInstanceDao, De
...
@@ -151,15 +151,20 @@ public class DeviceInstanceServiceImpl extends ServiceImpl<DeviceInstanceDao, De
@Override
@Override
public
void
changeDeviceOnlineState
(
List
<
String
>
communicationIdList
)
{
public
void
changeDeviceOnlineState
(
List
<
String
>
communicationIdList
)
{
// 将在线设备状态修改为1
UpdateWrapper
<
DeviceInstanceEntity
>
updateWrapper
=
new
UpdateWrapper
<>();
UpdateWrapper
<
DeviceInstanceEntity
>
updateWrapper
=
new
UpdateWrapper
<>();
updateWrapper
.
isNotNull
(
"communication_id"
);
updateWrapper
.
in
(
"communication_id"
,
communicationIdList
);
updateWrapper
.
in
(
"communication_id"
,
communicationIdList
);
updateWrapper
.
ne
(
"online_state"
,
1
);
DeviceInstanceEntity
entity
=
new
DeviceInstanceEntity
();
DeviceInstanceEntity
entity
=
new
DeviceInstanceEntity
();
entity
.
setOnlineUpdateTime
(
new
Date
());
entity
.
setOnlineUpdateTime
(
new
Date
());
entity
.
setOnlineState
(
1
);
entity
.
setOnlineState
(
1
);
baseMapper
.
update
(
entity
,
updateWrapper
);
baseMapper
.
update
(
entity
,
updateWrapper
);
// 将不在线设备状态修改为0
updateWrapper
=
new
UpdateWrapper
<>();
updateWrapper
=
new
UpdateWrapper
<>();
updateWrapper
.
isNotNull
(
"communication_id"
);
updateWrapper
.
notIn
(
"communication_id"
,
communicationIdList
);
updateWrapper
.
notIn
(
"communication_id"
,
communicationIdList
);
updateWrapper
.
ne
(
"online_state"
,
0
);
entity
.
setOnlineState
(
0
);
entity
.
setOnlineState
(
0
);
baseMapper
.
update
(
entity
,
updateWrapper
);
baseMapper
.
update
(
entity
,
updateWrapper
);
}
}
...
...
src/main/java/com/esv/datacenter/iot/module/devicemodel/vo/DeviceInstanceVO.java
View file @
d098668d
...
@@ -4,6 +4,8 @@ import lombok.Data;
...
@@ -4,6 +4,8 @@ import lombok.Data;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.util.Date
;
/**
/**
* @description:
* @description:
* @author: huangchaobin@esvtek.com
* @author: huangchaobin@esvtek.com
...
@@ -41,6 +43,20 @@ public class DeviceInstanceVO {
...
@@ -41,6 +43,20 @@ public class DeviceInstanceVO {
* 设备型号
* 设备型号
*/
*/
private
String
deviceModel
;
private
String
deviceModel
;
/**
* 通信ID
**/
private
String
communicationId
;
/**
* 在线状态
**/
private
Integer
onlineState
;
/**
* 在线状态更新时间
**/
private
Date
onlineUpdateTime
;
/**
/**
* 创建者
* 创建者
*/
*/
...
...
src/main/java/com/esv/datacenter/iot/task/DeviceStateScheduleTask.java
View file @
d098668d
...
@@ -58,7 +58,9 @@ public class DeviceStateScheduleTask {
...
@@ -58,7 +58,9 @@ public class DeviceStateScheduleTask {
}
}
log
.
info
(
"clientId list: {}"
,
JSON
.
toJSONString
(
clientIdList
));
log
.
info
(
"clientId list: {}"
,
JSON
.
toJSONString
(
clientIdList
));
if
(!
clientIdList
.
isEmpty
())
{
deviceInstanceService
.
changeDeviceOnlineState
(
clientIdList
);
deviceInstanceService
.
changeDeviceOnlineState
(
clientIdList
);
}
}
}
}
}
src/main/resources/logback-spring.xml
View file @
d098668d
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/
>
<!-- <include resource="org/springframework/boot/logging/logback/base.xml"/>--
>
<springProperty
scope=
"context"
name=
"LOG_FILE_NAME"
source=
"spring.application.name"
/>
<springProperty
scope=
"context"
name=
"LOG_FILE_NAME"
source=
"spring.application.name"
/>
...
...
src/main/resources/mapper/devicemodel/DeviceInstanceDao.xml
View file @
d098668d
...
@@ -39,6 +39,9 @@
...
@@ -39,6 +39,9 @@
<if
test=
"queryObj.deviceModel != null"
>
<if
test=
"queryObj.deviceModel != null"
>
and a.device_model like CONCAT('%', #{queryObj.deviceModel}, '%')
and a.device_model like CONCAT('%', #{queryObj.deviceModel}, '%')
</if>
</if>
<if
test=
"queryObj.onlineState != null"
>
and a.online_state = #{queryObj.onlineState}
</if>
ORDER BY a.name ASC
ORDER BY a.name ASC
</select>
</select>
...
...
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