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 d2638498
authored
Mar 23, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]红外设备代码提交
1 parent
4fa64bb9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
8 deletions
src/main/java/cn/com/glsx/modules/controller/DeviceController.java
src/main/java/cn/com/glsx/modules/controller/UserController.java
src/main/java/cn/com/glsx/modules/service/DeviceService.java
src/main/java/cn/com/glsx/modules/service/UserService.java
src/main/resources/bootstrap.properties
src/main/java/cn/com/glsx/modules/controller/DeviceController.java
View file @
d263849
...
@@ -85,4 +85,28 @@ public class DeviceController {
...
@@ -85,4 +85,28 @@ public class DeviceController {
public
R
instructionIssue
(
@PathVariable
String
device_id
,
@RequestBody
String
insjson
)
{
public
R
instructionIssue
(
@PathVariable
String
device_id
,
@RequestBody
String
insjson
)
{
return
deviceService
.
instructionIssue
(
device_id
,
insjson
);
return
deviceService
.
instructionIssue
(
device_id
,
insjson
);
}
}
/**
* 获取红外设备下的设备列表
*
* @return
*/
@RequestMapping
(
value
=
"/infrareds/{infrared_id}/remotes"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ApiOperation
(
value
=
"获取红外设备下面绑定的遥控器列表"
)
public
R
findRemotes
(
@PathVariable
String
infrared_id
)
{
return
deviceService
.
findRemotes
(
infrared_id
);
}
/**
* 下发红外指令
*
* @return
*/
@RequestMapping
(
value
=
"/infrareds/{infrared_id}/{remote_id}/scenes/command"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ApiOperation
(
value
=
"下发红外指令"
)
public
R
instructionInfIssue
(
@PathVariable
String
infrared_id
,
@PathVariable
String
remote_id
,
@RequestBody
String
insjson
)
{
return
deviceService
.
instructionInfIssue
(
infrared_id
,
remote_id
,
insjson
);
}
}
}
src/main/java/cn/com/glsx/modules/controller/UserController.java
View file @
d263849
...
@@ -49,4 +49,16 @@ public class UserController {
...
@@ -49,4 +49,16 @@ public class UserController {
public
R
getUserInfo
(
@PathVariable
String
id
)
{
public
R
getUserInfo
(
@PathVariable
String
id
)
{
return
userService
.
getUserInfo
(
id
);
return
userService
.
getUserInfo
(
id
);
}
}
/**
* 查询所有用户信息
*
* @return 用户信息
*/
@RequestMapping
(
value
=
"/users"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ApiOperation
(
value
=
"获取用户列表"
)
public
R
getAllUser
()
{
return
userService
.
getAllUser
();
}
}
}
src/main/java/cn/com/glsx/modules/service/DeviceService.java
View file @
d263849
...
@@ -30,6 +30,12 @@ public class DeviceService {
...
@@ -30,6 +30,12 @@ public class DeviceService {
@Value
(
"${tuya.instructionIssue}"
)
@Value
(
"${tuya.instructionIssue}"
)
private
String
instructionIssue
;
private
String
instructionIssue
;
@Value
(
"${tuya.findRemotes}"
)
private
String
findRemotes
;
@Value
(
"${tuya.instructionInfIssue}"
)
private
String
instructionInfIssue
;
@Autowired
@Autowired
private
SendRequestService
sendRequestService
;
private
SendRequestService
sendRequestService
;
...
@@ -39,7 +45,7 @@ public class DeviceService {
...
@@ -39,7 +45,7 @@ public class DeviceService {
String
result
=
responseBody
.
getResult
();
String
result
=
responseBody
.
getResult
();
return
R
.
ok
(
result
);
return
R
.
ok
(
result
);
}
}
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getM
essage
();
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getM
sg
();
return
R
.
error
(
errorMessage
);
return
R
.
error
(
errorMessage
);
}
}
...
@@ -49,7 +55,7 @@ public class DeviceService {
...
@@ -49,7 +55,7 @@ public class DeviceService {
String
result
=
responseBody
.
getResult
();
String
result
=
responseBody
.
getResult
();
return
R
.
ok
(
result
);
return
R
.
ok
(
result
);
}
}
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getM
essage
();
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getM
sg
();
return
R
.
error
(
errorMessage
);
return
R
.
error
(
errorMessage
);
}
}
...
@@ -59,7 +65,7 @@ public class DeviceService {
...
@@ -59,7 +65,7 @@ public class DeviceService {
String
result
=
responseBody
.
getResult
();
String
result
=
responseBody
.
getResult
();
return
R
.
ok
(
result
);
return
R
.
ok
(
result
);
}
}
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getM
essage
();
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getM
sg
();
return
R
.
error
(
errorMessage
);
return
R
.
error
(
errorMessage
);
}
}
...
@@ -69,7 +75,7 @@ public class DeviceService {
...
@@ -69,7 +75,7 @@ public class DeviceService {
String
result
=
responseBody
.
getResult
();
String
result
=
responseBody
.
getResult
();
return
R
.
ok
(
result
);
return
R
.
ok
(
result
);
}
}
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getM
essage
();
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getM
sg
();
return
R
.
error
(
errorMessage
);
return
R
.
error
(
errorMessage
);
}
}
...
@@ -78,8 +84,26 @@ public class DeviceService {
...
@@ -78,8 +84,26 @@ public class DeviceService {
if
(
responseBody
!=
null
&&
responseBody
.
isSuccess
())
{
if
(
responseBody
!=
null
&&
responseBody
.
isSuccess
())
{
return
R
.
ok
();
return
R
.
ok
();
}
}
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getMessage
();
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getMsg
();
return
R
.
error
(
errorMessage
);
}
public
R
findRemotes
(
String
infrared_id
)
{
ResponseBody
responseBody
=
sendRequestService
.
sendRequestGet
(
findRemotes
.
replace
(
"{infrared_id}"
,
infrared_id
));
if
(
responseBody
!=
null
&&
responseBody
.
isSuccess
())
{
String
result
=
responseBody
.
getResult
();
return
R
.
ok
(
result
);
}
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getMsg
();
return
R
.
error
(
errorMessage
);
return
R
.
error
(
errorMessage
);
}
}
public
R
instructionInfIssue
(
String
infrared_id
,
String
remote_id
,
String
insjson
)
{
ResponseBody
responseBody
=
sendRequestService
.
sendRequestPost
(
instructionInfIssue
.
replace
(
"{remote_id}"
,
remote_id
).
replace
(
"{infrared_id}"
,
infrared_id
),
insjson
);
if
(
responseBody
!=
null
&&
responseBody
.
isSuccess
())
{
return
R
.
ok
();
}
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getMsg
();
return
R
.
error
(
errorMessage
);
}
}
}
src/main/java/cn/com/glsx/modules/service/UserService.java
View file @
d263849
...
@@ -2,11 +2,9 @@ package cn.com.glsx.modules.service;
...
@@ -2,11 +2,9 @@ package cn.com.glsx.modules.service;
import
cn.com.glsx.modules.model.param.ResponseBody
;
import
cn.com.glsx.modules.model.param.ResponseBody
;
import
cn.com.glsx.modules.model.param.UserBo
;
import
cn.com.glsx.modules.model.param.UserBo
;
import
cn.com.glsx.modules.model.param.UserInfo
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -26,6 +24,9 @@ public class UserService {
...
@@ -26,6 +24,9 @@ public class UserService {
@Value
(
"${tuya.getUserInfoUrl}"
)
@Value
(
"${tuya.getUserInfoUrl}"
)
private
String
getUserInfoUrl
;
private
String
getUserInfoUrl
;
@Value
(
"${tuya.getAllUserUrl}"
)
private
String
getAllUserUrl
;
@Autowired
@Autowired
private
SendRequestService
sendRequestService
;
private
SendRequestService
sendRequestService
;
...
@@ -60,4 +61,18 @@ public class UserService {
...
@@ -60,4 +61,18 @@ public class UserService {
return
R
.
error
(
errorMessage
);
return
R
.
error
(
errorMessage
);
}
}
/**
* 获取所有用户信息
*
*/
public
R
getAllUser
()
{
ResponseBody
responseBody
=
sendRequestService
.
sendRequestGet
(
getAllUserUrl
);
if
(
responseBody
!=
null
&&
responseBody
.
isSuccess
())
{
String
result
=
responseBody
.
getResult
()
+
""
;
return
R
.
ok
(
result
);
}
String
errorMessage
=
responseBody
==
null
?
"调用涂鸦失败"
:
responseBody
.
getMessage
();
return
R
.
error
(
errorMessage
);
}
}
}
src/main/resources/bootstrap.properties
View file @
d263849
...
@@ -9,7 +9,7 @@ spring.cloud.nacos.config.server-addr=192.168.0.63:8848
...
@@ -9,7 +9,7 @@ spring.cloud.nacos.config.server-addr=192.168.0.63:8848
#nacos配置id,完整dataId=${spring.cloud.nacos.config.prefix}-${spring.profiles.active}.${file-extension(由新增配置时选的文件类型决定)}
#nacos配置id,完整dataId=${spring.cloud.nacos.config.prefix}-${spring.profiles.active}.${file-extension(由新增配置时选的文件类型决定)}
#示例:http://192.168.0.63:8848/nacos/v1/cs/configs?dataId=glsx-rest-admin.properties&group=DEV_GROUP
#示例:http://192.168.0.63:8848/nacos/v1/cs/configs?dataId=glsx-rest-admin.properties&group=DEV_GROUP
spring.cloud.nacos.config.group
=
NESHIELD_
DEV_GROUP
spring.cloud.nacos.config.group
=
DEV_GROUP
#配置prefix,默认值同${spring.application.name}
#配置prefix,默认值同${spring.application.name}
spring.cloud.nacos.config.prefix
=
${spring.application.name}
spring.cloud.nacos.config.prefix
=
${spring.application.name}
#配置开发环境
#配置开发环境
...
...
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