|
@@ -1,9 +1,11 @@
|
|
|
package com.zy.bms.controller;
|
|
|
|
|
|
import com.zy.bms.common.ServerResponse;
|
|
|
+import com.zy.bms.common.controller.BaseController;
|
|
|
import com.zy.bms.common.io.CallRecordsIO;
|
|
|
import com.zy.bms.common.io.NewsIO;
|
|
|
import com.zy.bms.service.CallRecordsService;
|
|
|
+import com.zy.bms.service.RelationService;
|
|
|
import com.zy.bms.service.SetBaseService;
|
|
|
import com.zy.bms.service.SetNewsService;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -20,7 +22,7 @@ import javax.annotation.Resource;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("zy4g/api/setInfo")
|
|
|
-public class SetInfoController {
|
|
|
+public class SetInfoController extends BaseController {
|
|
|
|
|
|
@Resource
|
|
|
private SetBaseService setBaseService;
|
|
@@ -28,6 +30,8 @@ public class SetInfoController {
|
|
|
private CallRecordsService callRecordsService;
|
|
|
@Resource
|
|
|
private SetNewsService setNewsService;
|
|
|
+ @Resource
|
|
|
+ private RelationService relationService;
|
|
|
|
|
|
/**
|
|
|
* 查询设备的音量设置
|
|
@@ -37,6 +41,9 @@ public class SetInfoController {
|
|
|
*/
|
|
|
@GetMapping("volume.do")
|
|
|
public ServerResponse volume(String deviceId) {
|
|
|
+ if (!relationService.checkDeviceIsBelongByDeviceId(getUserId(), deviceId)) {
|
|
|
+ return ServerResponse.createByIllegal();
|
|
|
+ }
|
|
|
return ServerResponse.createBySuccess(setBaseService.getVolumeSet(deviceId));
|
|
|
}
|
|
|
|
|
@@ -48,6 +55,9 @@ public class SetInfoController {
|
|
|
*/
|
|
|
@GetMapping("other.do")
|
|
|
public ServerResponse other(String deviceId) {
|
|
|
+ if (!relationService.checkDeviceIsBelongByDeviceId(getUserId(), deviceId)) {
|
|
|
+ return ServerResponse.createByIllegal();
|
|
|
+ }
|
|
|
return ServerResponse.createBySuccess(setBaseService.getOtherSet(deviceId));
|
|
|
}
|
|
|
|
|
@@ -58,6 +68,9 @@ public class SetInfoController {
|
|
|
*/
|
|
|
@GetMapping("sos.do")
|
|
|
public ServerResponse sos(String deviceId) {
|
|
|
+ if (!relationService.checkDeviceIsBelongByDeviceId(getUserId(), deviceId)) {
|
|
|
+ return ServerResponse.createByIllegal();
|
|
|
+ }
|
|
|
return ServerResponse.createBySuccess(setBaseService.getSosSet(deviceId));
|
|
|
}
|
|
|
|
|
@@ -66,6 +79,9 @@ public class SetInfoController {
|
|
|
*/
|
|
|
@GetMapping("callRecords.do")
|
|
|
public ServerResponse callRecords(CallRecordsIO io) {
|
|
|
+ if (!relationService.checkDeviceIsBelongByDeviceId(getUserId(), io.getDeviceId())) {
|
|
|
+ return ServerResponse.createByIllegal();
|
|
|
+ }
|
|
|
return ServerResponse.createBySuccess(callRecordsService.getListPage(io));
|
|
|
}
|
|
|
|
|
@@ -74,6 +90,9 @@ public class SetInfoController {
|
|
|
*/
|
|
|
@GetMapping("news.do")
|
|
|
public ServerResponse news(NewsIO io) {
|
|
|
+ if (!relationService.checkDeviceIsBelongByDeviceId(getUserId(), io.getDeviceId())) {
|
|
|
+ return ServerResponse.createByIllegal();
|
|
|
+ }
|
|
|
return ServerResponse.createBySuccess(setNewsService.getListPage(io));
|
|
|
}
|
|
|
}
|