Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
a083a7a5
Commit
a083a7a5
authored
Jul 14, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备列表导出优化
parent
90fee9b6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
3 deletions
+19
-3
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
...ortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
+1
-1
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+14
-1
device-manager/src/main/java/com/mortals/xhx/common/key/ErrorCode.java
...r/src/main/java/com/mortals/xhx/common/key/ErrorCode.java
+3
-0
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
.../java/com/mortals/httpclient/device/DeviceController.http
+1
-1
No files found.
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
View file @
a083a7a5
...
@@ -56,7 +56,7 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
...
@@ -56,7 +56,7 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
@Override
@Override
protected
List
<
GetResponse
>
doPoll
(
long
durationInMillis
)
{
protected
List
<
GetResponse
>
doPoll
(
long
durationInMillis
)
{
List
<
GetResponse
>
result
=
queues
.
s
tream
()
List
<
GetResponse
>
result
=
queues
.
parallelS
tream
()
.
map
(
queue
->
{
.
map
(
queue
->
{
try
{
try
{
GetResponse
getResponse
=
channel
.
basicGet
(
queue
,
true
);
GetResponse
getResponse
=
channel
.
basicGet
(
queue
,
true
);
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
a083a7a5
...
@@ -113,7 +113,7 @@ public class DeviceApiController {
...
@@ -113,7 +113,7 @@ public class DeviceApiController {
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
DeviceResp
deviceResp
=
new
DeviceResp
();
DeviceResp
deviceResp
=
new
DeviceResp
();
try
{
try
{
DeviceEntity
deviceEntity
=
checkDeviceExist
(
req
);
DeviceEntity
deviceEntity
=
checkDeviceExist
AndCreate
(
req
);
if
(
deviceEntity
.
getDeviceStatus
()
==
DeviceStatusEnum
.
未激活
.
getValue
())
{
if
(
deviceEntity
.
getDeviceStatus
()
==
DeviceStatusEnum
.
未激活
.
getValue
())
{
throw
new
AppException
(
DEVICE_UNACTIVE
,
DEVICE_UNACTIVE_CONTENT
);
throw
new
AppException
(
DEVICE_UNACTIVE
,
DEVICE_UNACTIVE_CONTENT
);
}
}
...
@@ -659,6 +659,18 @@ public class DeviceApiController {
...
@@ -659,6 +659,18 @@ public class DeviceApiController {
}
}
private
DeviceEntity
checkDeviceExist
(
DeviceReq
req
)
{
private
DeviceEntity
checkDeviceExist
(
DeviceReq
req
)
{
if
(
ObjectUtils
.
isEmpty
(
req
.
getDeviceCode
()))
{
throw
new
AppException
(
DEVICE_CODE_IS_EMPTY
,
DEVICE_CODE_IS_EMPTY_CONTENT
);
}
DeviceEntity
deviceEntity
=
deviceService
.
getExtCache
(
req
.
getDeviceCode
());
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
throw
new
AppException
(
DEVICE_NOT_EXIST
,
DEVICE_NOT_EXIST_CONTENT
);
}
return
deviceEntity
;
}
private
DeviceEntity
checkDeviceExistAndCreate
(
DeviceReq
req
)
{
if
(
ObjectUtils
.
isEmpty
(
req
.
getDeviceCode
()))
{
if
(
ObjectUtils
.
isEmpty
(
req
.
getDeviceCode
()))
{
throw
new
AppException
(
DEVICE_CODE_IS_EMPTY
,
DEVICE_CODE_IS_EMPTY_CONTENT
);
throw
new
AppException
(
DEVICE_CODE_IS_EMPTY
,
DEVICE_CODE_IS_EMPTY_CONTENT
);
}
}
...
@@ -678,4 +690,5 @@ public class DeviceApiController {
...
@@ -678,4 +690,5 @@ public class DeviceApiController {
}
}
return
deviceEntity
;
return
deviceEntity
;
}
}
}
}
device-manager/src/main/java/com/mortals/xhx/common/key/ErrorCode.java
View file @
a083a7a5
...
@@ -105,4 +105,7 @@ public interface ErrorCode {
...
@@ -105,4 +105,7 @@ public interface ErrorCode {
public
static
final
int
DEVICE_CONFIG_IS_EMPTY
=
1008
;
public
static
final
int
DEVICE_CONFIG_IS_EMPTY
=
1008
;
public
static
final
String
DEVICE_CONFIG_IS_EMPTY_CONTENT
=
"设备创建,请完善设备配置信息!"
;
public
static
final
String
DEVICE_CONFIG_IS_EMPTY_CONTENT
=
"设备创建,请完善设备配置信息!"
;
public
static
final
int
DEVICE_NOT_EXIST
=
1009
;
public
static
final
String
DEVICE_NOT_EXIST_CONTENT
=
"当前设备不存在!"
;
}
}
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
View file @
a083a7a5
...
@@ -136,7 +136,7 @@ Content-Type: application/json
...
@@ -136,7 +136,7 @@ Content-Type: application/json
Authorization: {{authToken}}
Authorization: {{authToken}}
{
{
"deviceCode": "B0
2
",
"deviceCode": "B0
3
",
"action": "upload"
"action": "upload"
}
}
...
...
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