Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
smartDevices-platform-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3d464a17
authored
Mar 27, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]红外设备代码提交
1 parent
80670f48
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
1 deletions
src/main/java/cn/com/glsx/common/DeviceErrorEnum.java
src/main/java/cn/com/glsx/modules/service/DeviceService.java
src/main/java/cn/com/glsx/common/DeviceErrorEnum.java
0 → 100644
View file @
3d464a1
package
cn
.
com
.
glsx
.
common
;
/**
* @author zhouhaibao
* @date 2021/3/20 13:48
*/
public
enum
DeviceErrorEnum
{
NOT_LOGIN_ERROR
(
"1000"
,
"数据不存在"
),
SECRET_INVALID_ERROR
(
"1001"
,
"非法密钥"
),
PERMISSION_DENY_ERROR
(
"1106"
,
"权限受限"
),
DEVICE_IS_OFFLINE_ERROR
(
"2003"
,
"不支持的指令"
),
COMMAND_SUPPORT_ERROR
(
"2008"
,
"不支持的指令或值"
),
DEVICE_NOT_EXIST_ERROR
(
"2010"
,
"设备不存在"
),
COMMANDS_ISSUE_ERROR
(
"1103"
,
"指令下发失败"
),
TYPE_IS_ERROR
(
"1104"
,
"类型错误"
);
private
String
value
;
private
String
displayName
;
DeviceErrorEnum
(
String
value
,
String
displayName
)
{
this
.
value
=
value
;
this
.
displayName
=
displayName
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
String
getDisplayName
()
{
return
displayName
;
}
public
void
setDisplayName
(
String
displayName
)
{
this
.
displayName
=
displayName
;
}
public
static
String
searchValue
(
String
key
)
{
for
(
DeviceErrorEnum
m
:
DeviceErrorEnum
.
values
())
{
if
(
m
.
getValue
()
==
key
)
{
return
m
.
getDisplayName
();
}
}
return
null
;
}
}
src/main/java/cn/com/glsx/modules/service/DeviceService.java
View file @
3d464a1
package
cn
.
com
.
glsx
.
modules
.
service
;
package
cn
.
com
.
glsx
.
modules
.
service
;
import
cn.com.glsx.common.DeviceErrorEnum
;
import
cn.com.glsx.modules.model.param.ResponseBody
;
import
cn.com.glsx.modules.model.param.ResponseBody
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -84,8 +85,8 @@ public class DeviceService {
...
@@ -84,8 +85,8 @@ public class DeviceService {
if
(
responseBody
!=
null
&&
responseBody
.
isSuccess
())
{
if
(
responseBody
!=
null
&&
responseBody
.
isSuccess
())
{
return
R
.
ok
();
return
R
.
ok
();
}
}
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getMsg
();
Integer
code
=
responseBody
==
null
?
500
:
responseBody
.
getCode
();
Integer
code
=
responseBody
==
null
?
500
:
responseBody
.
getCode
();
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
DeviceErrorEnum
.
searchValue
(
code
+
""
);
return
R
.
error
(
code
,
errorMessage
);
return
R
.
error
(
code
,
errorMessage
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment