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 2cc9d4c6
authored
Mar 18, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]代码整改
1 parent
166b8095
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
12 deletions
src/main/java/cn/com/glsx/modules/controller/DeviceController.java
src/main/java/cn/com/glsx/modules/model/param/ResponseBody.java
src/main/java/cn/com/glsx/modules/service/DeviceService.java
src/main/java/cn/com/glsx/modules/service/UserService.java
src/main/java/cn/com/glsx/modules/controller/DeviceController.java
View file @
2cc9d4c
...
@@ -39,8 +39,8 @@ public class DeviceController {
...
@@ -39,8 +39,8 @@ public class DeviceController {
@RequestMapping
(
value
=
"/{uid}/devices"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{uid}/devices"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
@ApiOperation
(
value
=
"获取用户下的设备列表"
)
@ApiOperation
(
value
=
"获取用户下的设备列表"
)
public
R
getAllDevicesByUser
(
@PathVariable
String
uid
){
public
R
getAllDevicesByUser
(
@PathVariable
String
uid
)
{
List
<
DeviceInfo
>
list
=
deviceService
.
getAllDevicesByUser
(
uid
);
List
<
DeviceInfo
>
list
=
deviceService
.
getAllDevicesByUser
(
uid
);
return
R
.
ok
(
JSONObject
.
toJSONString
(
list
));
return
R
.
ok
(
JSONObject
.
toJSONString
(
list
));
}
}
...
@@ -52,8 +52,8 @@ public class DeviceController {
...
@@ -52,8 +52,8 @@ public class DeviceController {
@RequestMapping
(
value
=
"/devices/{device_id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/devices/{device_id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
@ApiOperation
(
value
=
"根据id获取设备"
)
@ApiOperation
(
value
=
"根据id获取设备"
)
public
R
getDevicesById
(
@PathVariable
String
device_id
){
public
R
getDevicesById
(
@PathVariable
String
device_id
)
{
DeviceInfo
deviceInfo
=
deviceService
.
getDevicesById
(
device_id
);
DeviceInfo
deviceInfo
=
deviceService
.
getDevicesById
(
device_id
);
return
R
.
ok
(
JSONObject
.
toJSONString
(
deviceInfo
));
return
R
.
ok
(
JSONObject
.
toJSONString
(
deviceInfo
));
}
}
...
@@ -66,8 +66,8 @@ public class DeviceController {
...
@@ -66,8 +66,8 @@ public class DeviceController {
@RequestMapping
(
value
=
"/devices/{device_id}/functions"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/devices/{device_id}/functions"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
@ApiOperation
(
value
=
"根据id获取指令集"
)
@ApiOperation
(
value
=
"根据id获取指令集"
)
public
R
getFunctionsById
(
@PathVariable
String
device_id
){
public
R
getFunctionsById
(
@PathVariable
String
device_id
)
{
Function
function
=
deviceService
.
getFunctionsById
(
device_id
);
Function
function
=
deviceService
.
getFunctionsById
(
device_id
);
return
R
.
ok
(
JSONObject
.
toJSONString
(
function
));
return
R
.
ok
(
JSONObject
.
toJSONString
(
function
));
}
}
...
@@ -79,8 +79,8 @@ public class DeviceController {
...
@@ -79,8 +79,8 @@ public class DeviceController {
@RequestMapping
(
value
=
"/functions/{category}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/functions/{category}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
@ApiOperation
(
value
=
"根据品类获取指令集"
)
@ApiOperation
(
value
=
"根据品类获取指令集"
)
public
R
getFunctionsByCat
(
@PathVariable
String
category
){
public
R
getFunctionsByCat
(
@PathVariable
String
category
)
{
Function
function
=
deviceService
.
getFunctionsByCat
(
category
);
Function
function
=
deviceService
.
getFunctionsByCat
(
category
);
return
R
.
ok
(
JSONObject
.
toJSONString
(
function
));
return
R
.
ok
(
JSONObject
.
toJSONString
(
function
));
}
}
...
@@ -92,8 +92,11 @@ public class DeviceController {
...
@@ -92,8 +92,11 @@ public class DeviceController {
@RequestMapping
(
value
=
"/devices/{device_id}/commands"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/devices/{device_id}/commands"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
@ApiOperation
(
value
=
"根据设备下发指令"
)
@ApiOperation
(
value
=
"根据设备下发指令"
)
public
R
instructionIssue
(
@PathVariable
String
device_id
,
@RequestBody
String
insjson
)
{
public
R
instructionIssue
(
@PathVariable
String
device_id
,
@RequestBody
String
insjson
)
{
String
message
=
deviceService
.
instructionIssue
(
device_id
,
insjson
);
String
message
=
deviceService
.
instructionIssue
(
device_id
,
insjson
);
return
R
.
ok
(
JSONObject
.
toJSONString
(
message
));
if
((
"下发成功"
).
equals
(
message
))
{
return
R
.
ok
(
message
);
}
return
R
.
error
(
message
);
}
}
}
}
src/main/java/cn/com/glsx/modules/model/param/ResponseBody.java
View file @
2cc9d4c
...
@@ -26,4 +26,6 @@ public class ResponseBody {
...
@@ -26,4 +26,6 @@ public class ResponseBody {
* 返回message
* 返回message
*/
*/
private
String
message
;
private
String
message
;
private
String
msg
;
}
}
src/main/java/cn/com/glsx/modules/service/DeviceService.java
View file @
2cc9d4c
...
@@ -97,7 +97,7 @@ public class DeviceService extends BaseDeviceService {
...
@@ -97,7 +97,7 @@ public class DeviceService extends BaseDeviceService {
if
(
responseBody
!=
null
&&
responseBody
.
isSuccess
())
{
if
(
responseBody
!=
null
&&
responseBody
.
isSuccess
())
{
message
=
"下发成功"
;
message
=
"下发成功"
;
}
else
{
}
else
{
message
=
"下发失败"
;
message
=
responseBody
.
getMsg
()
;
}
}
return
message
;
return
message
;
}
}
...
...
src/main/java/cn/com/glsx/modules/service/UserService.java
View file @
2cc9d4c
...
@@ -43,7 +43,6 @@ public class UserService {
...
@@ -43,7 +43,6 @@ public class UserService {
}
else
{
}
else
{
log
.
info
(
"调用涂鸦失败"
);
log
.
info
(
"调用涂鸦失败"
);
}
}
return
uid
;
return
uid
;
}
}
...
...
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