Commit 2cc9d4c6 by 111-PC\111

[+]代码整改

1 parent 166b8095
......@@ -39,8 +39,8 @@ public class DeviceController {
@RequestMapping(value = "/{uid}/devices", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取用户下的设备列表")
public R getAllDevicesByUser(@PathVariable String uid){
List<DeviceInfo> list=deviceService.getAllDevicesByUser(uid);
public R getAllDevicesByUser(@PathVariable String uid) {
List<DeviceInfo> list = deviceService.getAllDevicesByUser(uid);
return R.ok(JSONObject.toJSONString(list));
}
......@@ -52,8 +52,8 @@ public class DeviceController {
@RequestMapping(value = "/devices/{device_id}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id获取设备")
public R getDevicesById(@PathVariable String device_id){
DeviceInfo deviceInfo=deviceService.getDevicesById(device_id);
public R getDevicesById(@PathVariable String device_id) {
DeviceInfo deviceInfo = deviceService.getDevicesById(device_id);
return R.ok(JSONObject.toJSONString(deviceInfo));
}
......@@ -66,8 +66,8 @@ public class DeviceController {
@RequestMapping(value = "/devices/{device_id}/functions", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id获取指令集")
public R getFunctionsById(@PathVariable String device_id){
Function function =deviceService.getFunctionsById(device_id);
public R getFunctionsById(@PathVariable String device_id) {
Function function = deviceService.getFunctionsById(device_id);
return R.ok(JSONObject.toJSONString(function));
}
......@@ -79,8 +79,8 @@ public class DeviceController {
@RequestMapping(value = "/functions/{category}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据品类获取指令集")
public R getFunctionsByCat(@PathVariable String category){
Function function =deviceService.getFunctionsByCat(category);
public R getFunctionsByCat(@PathVariable String category) {
Function function = deviceService.getFunctionsByCat(category);
return R.ok(JSONObject.toJSONString(function));
}
......@@ -92,8 +92,11 @@ public class DeviceController {
@RequestMapping(value = "/devices/{device_id}/commands", method = RequestMethod.POST)
@ResponseBody
@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);
return R.ok(JSONObject.toJSONString(message));
if (("下发成功").equals(message)) {
return R.ok(message);
}
return R.error(message);
}
}
......@@ -26,4 +26,6 @@ public class ResponseBody {
* 返回message
*/
private String message;
private String msg;
}
......@@ -97,7 +97,7 @@ public class DeviceService extends BaseDeviceService {
if (responseBody != null && responseBody.isSuccess()) {
message = "下发成功";
} else {
message = "下发失败";
message = responseBody.getMsg();
}
return message;
}
......
......@@ -43,7 +43,6 @@ public class UserService {
} else {
log.info("调用涂鸦失败");
}
return uid;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!