Commit 464aaf3f5947d68d537154070e81432476f778f9

Authored by baishou
1 parent fedea835
Exists in master

萤石设备配置接口对接完成

springboot/src/main/java/com/sincre/springboot/controller/Yinshi/DeviceConfigController.java 0 → 100644
... ... @@ -0,0 +1,291 @@
  1 +package com.sincre.springboot.controller.Yinshi;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.sincre.springboot.ApiModel.YinShiResResult;
  5 +import com.sincre.springboot.ApiPlatform.YinShiServiceConfig;
  6 +import com.sincre.springboot.common.ServerResponse;
  7 +import com.sincre.springboot.utils.ApiHelper;
  8 +import com.sincre.springboot.utils.ResultUtils;
  9 +import io.swagger.annotations.Api;
  10 +import io.swagger.annotations.ApiImplicitParam;
  11 +import io.swagger.annotations.ApiImplicitParams;
  12 +import io.swagger.annotations.ApiOperation;
  13 +import org.springframework.web.bind.annotation.GetMapping;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RequestParam;
  16 +import org.springframework.web.bind.annotation.RestController;
  17 +
  18 +import java.util.HashMap;
  19 +import java.util.Map;
  20 +
  21 +@RestController
  22 +@RequestMapping("/YinShiDevice/Config/")
  23 +@Api(tags = "设备的配置管理")
  24 +public class DeviceConfigController {
  25 +
  26 + @ApiOperation(value = "对设备布撤防状态进行修改(活动检测开关),实现布防和撤防功能")
  27 + @ApiImplicitParams({
  28 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
  29 + @ApiImplicitParam(name = "isDefence",value = "具有防护能力设备布撤防状态:0-睡眠,8-在家,16-外出,普通IPC设备布撤防状态:`0-撤防,1-布防",required = true)
  30 + })
  31 + @GetMapping("setDefenceStatus")
  32 + public ServerResponse setDefenceStatus(@RequestParam String deviceSerial, @RequestParam Integer isDefence) {
  33 +
  34 + String url = YinShiServiceConfig.HostUrl + "lapp/device/defence/set";
  35 + Map<String, Object> map = new HashMap<>();
  36 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  37 + map.put("deviceSerial", deviceSerial);
  38 + map.put("isDefence",isDefence);
  39 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  40 +
  41 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  42 +
  43 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  44 + }
  45 +
  46 + @ApiOperation(value = "根据设备验证码关闭设备视频加密开关")
  47 + @ApiImplicitParams({
  48 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
  49 + @ApiImplicitParam(name = "validateCode",value = "设备验证码,设备机身上的六位大写字母OLZKQU",required = true)
  50 + })
  51 + @GetMapping("deviceVideoEncryptOff")
  52 + public ServerResponse deviceVideoEncryptOff(@RequestParam String deviceSerial,@RequestParam String validateCode) {
  53 +
  54 + String url = YinShiServiceConfig.HostUrl + "lapp/device/encrypt/off";
  55 + Map<String, Object> map = new HashMap<>();
  56 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  57 + map.put("deviceSerial", deviceSerial);
  58 + map.put("validateCode",validateCode);
  59 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  60 +
  61 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  62 +
  63 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  64 + }
  65 +
  66 + @ApiOperation(value = "开启设备视频加密")
  67 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true)
  68 + @GetMapping("deviceVideoEncryptOn")
  69 + public ServerResponse deviceVideoEncryptOn(@RequestParam String deviceSerial) {
  70 +
  71 + String url = YinShiServiceConfig.HostUrl + "lapp/device/encrypt/on";
  72 + Map<String, Object> map = new HashMap<>();
  73 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  74 + map.put("deviceSerial", deviceSerial);
  75 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  76 +
  77 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  78 +
  79 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  80 + }
  81 +
  82 + @ApiOperation(value = "获取wifi配置提示音开关状态")
  83 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true)
  84 + @GetMapping("getWifiSoundStatus")
  85 + public ServerResponse getWifiSoundStatus(@RequestParam String deviceSerial) {
  86 +
  87 + String url = YinShiServiceConfig.HostUrl + "lapp/device/sound/switch/status";
  88 + Map<String, Object> map = new HashMap<>();
  89 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  90 + map.put("deviceSerial", deviceSerial);
  91 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  92 +
  93 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  94 +
  95 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  96 + }
  97 +
  98 +
  99 + @ApiOperation(value = "设置wifi配置提示音开关")
  100 + @ApiImplicitParams({
  101 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
  102 + @ApiImplicitParam(name = "enable",value = "状态:0-关闭,1-开启",required = true),
  103 + @ApiImplicitParam(name = "channelNo", value = "通道号,不传表示设备本身")
  104 + })
  105 + @GetMapping("setWifiSoundStatus")
  106 + public ServerResponse setWifiSoundStatus(@RequestParam String deviceSerial,@RequestParam Integer enable,@RequestParam(required = false) Integer channelNo) {
  107 +
  108 + String url = YinShiServiceConfig.HostUrl + "lapp/device/sound/switch/set";
  109 + Map<String, Object> map = new HashMap<>();
  110 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  111 + map.put("deviceSerial", deviceSerial);
  112 + map.put("enable",enable);
  113 +
  114 + if(channelNo != null){
  115 + map.put("channelNo",channelNo);
  116 + }
  117 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  118 +
  119 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  120 +
  121 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  122 + }
  123 +
  124 + @ApiOperation(value = "获取镜头遮蔽开关状态 ps:我们的设备暂时不支持这个功能。")
  125 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true)
  126 + @GetMapping("getSceneStatus")
  127 + public ServerResponse getSceneStatus(@RequestParam String deviceSerial) {
  128 +
  129 + String url = YinShiServiceConfig.HostUrl + "lapp/device/scene/switch/status";
  130 + Map<String, Object> map = new HashMap<>();
  131 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  132 + map.put("deviceSerial", deviceSerial);
  133 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  134 +
  135 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  136 +
  137 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  138 + }
  139 +
  140 +
  141 + @ApiOperation(value = "获取移动侦测灵敏度配置(目前只支持移动侦测灵敏度配置)")
  142 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true)
  143 + @GetMapping("getAlgorithm")
  144 + public ServerResponse getAlgorithm(@RequestParam String deviceSerial) {
  145 +
  146 + String url = YinShiServiceConfig.HostUrl + "lapp/device/algorithm/config/get";
  147 + Map<String, Object> map = new HashMap<>();
  148 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  149 + map.put("deviceSerial", deviceSerial);
  150 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  151 +
  152 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  153 +
  154 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  155 + }
  156 +
  157 +
  158 + @ApiOperation(value = "该接口用于设置智能算法模式(目前只支持移动侦测灵敏度配置)")
  159 + @ApiImplicitParams({
  160 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
  161 + @ApiImplicitParam(name = "channelNo", value = "通道号,不传表示设备本身"),
  162 + @ApiImplicitParam(name = "type", value = "智能算法模式:0-移动侦测灵敏度。非必选,默认为0",defaultValue = "0"),
  163 + @ApiImplicitParam(name = "value",value = "type为0时,该值为0~6,0表示灵敏度最低",required = true)
  164 + })
  165 + @GetMapping("setAlgorithm")
  166 + public ServerResponse setAlgorithm(@RequestParam String deviceSerial,@RequestParam Integer value,@RequestParam(required = false) Integer channelNo,@RequestParam(defaultValue = "0") Integer type) {
  167 +
  168 + String url = YinShiServiceConfig.HostUrl + "lapp/device/algorithm/config/set";
  169 + Map<String, Object> map = new HashMap<>();
  170 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  171 + map.put("deviceSerial", deviceSerial);
  172 + map.put("value",value);
  173 + map.put("type",type);
  174 + if(channelNo != null){
  175 + map.put("channelNo",channelNo);
  176 + }
  177 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  178 +
  179 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  180 +
  181 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  182 + }
  183 +
  184 +
  185 +
  186 + @ApiOperation(value = "设置告警声音模式")
  187 + @ApiImplicitParams({
  188 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
  189 + @ApiImplicitParam(name = "type", value = "声音类型:0-短叫,1-长叫,2-静音",defaultValue = "0")
  190 + })
  191 + @GetMapping("setAlarmSound")
  192 + public ServerResponse setAlarmSound(@RequestParam String deviceSerial,@RequestParam(defaultValue = "0") Integer type) {
  193 +
  194 + String url = YinShiServiceConfig.HostUrl + "lapp/device/alarm/sound/set";
  195 + Map<String, Object> map = new HashMap<>();
  196 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  197 + map.put("deviceSerial", deviceSerial);
  198 + map.put("type",type);
  199 +
  200 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  201 +
  202 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  203 +
  204 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  205 + }
  206 +
  207 + @ApiOperation(value = "开启或关闭设备下线通知")
  208 + @ApiImplicitParams({
  209 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
  210 + @ApiImplicitParam(name = "enable", value = "状态:0-关闭,1-开启",defaultValue = "0")
  211 + })
  212 + @GetMapping("notifySwitch")
  213 + public ServerResponse notifySwitch(@RequestParam String deviceSerial,@RequestParam(defaultValue = "0") Integer enable) {
  214 +
  215 + String url = YinShiServiceConfig.HostUrl + "lapp/device/notify/switch";
  216 + Map<String, Object> map = new HashMap<>();
  217 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  218 + map.put("deviceSerial", deviceSerial);
  219 + map.put("enable",enable);
  220 +
  221 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  222 +
  223 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  224 +
  225 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  226 + }
  227 +
  228 +
  229 + @ApiOperation(value = "获取设备麦克风开关状态")
  230 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true)
  231 + @GetMapping("getMicrophoneStatus")
  232 + public ServerResponse getMicrophoneStatus(@RequestParam String deviceSerial) {
  233 +
  234 + String url = YinShiServiceConfig.HostUrl + "lapp/camera/video/sound/status";
  235 + Map<String, Object> map = new HashMap<>();
  236 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  237 + map.put("deviceSerial", deviceSerial);
  238 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  239 +
  240 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  241 +
  242 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  243 + }
  244 +
  245 + @ApiOperation(value = "设置设备麦克风开关状态")
  246 + @ApiImplicitParams({
  247 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
  248 + @ApiImplicitParam(name = "enable",value = "状态:0-关闭,1-开启",required = true),
  249 + })
  250 + @GetMapping("setMicrophoneStatus")
  251 + public ServerResponse setMicrophoneStatus(@RequestParam String deviceSerial,@RequestParam Integer enable) {
  252 +
  253 + String url = YinShiServiceConfig.HostUrl + "lapp/camera/video/sound/set";
  254 + Map<String, Object> map = new HashMap<>();
  255 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  256 + map.put("deviceSerial", deviceSerial);
  257 + map.put("enable",enable);
  258 +
  259 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  260 +
  261 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  262 +
  263 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  264 + }
  265 +
  266 +
  267 + @ApiOperation(value = "设置设备移动跟踪开关(萤石摄像头不支持该指令接口)")
  268 + @ApiImplicitParams({
  269 + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
  270 + @ApiImplicitParam(name = "enable",value = "状态:0-关闭,1-开启",required = true),
  271 + @ApiImplicitParam(name = "channelNo", value = "通道号,不传表示设备本身")
  272 + })
  273 + @GetMapping("setMoveStatus")
  274 + public ServerResponse setMoveStatus(@RequestParam String deviceSerial,@RequestParam Integer enable,@RequestParam(required = false) Integer channelNo) {
  275 +
  276 + String url = YinShiServiceConfig.HostUrl + "lapp/device/mobile/status/set";
  277 + Map<String, Object> map = new HashMap<>();
  278 + map.put("accessToken", YinShiServiceConfig.AccessToken);
  279 + map.put("deviceSerial", deviceSerial);
  280 + map.put("enable",enable);
  281 +
  282 + if(channelNo != null){
  283 + map.put("channelNo",channelNo);
  284 + }
  285 + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
  286 +
  287 + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
  288 +
  289 + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
  290 + }
  291 +}
... ...
springboot/src/main/java/com/sincre/springboot/controller/Yinshi/DeviceControl.java
... ... @@ -20,7 +20,7 @@ import java.util.Map;
20 20  
21 21 @RestController
22 22 @RequestMapping("/YinShiDevice")
23   -@Api(tags = "设备管理部分接口—楼宇设备和客流统计")
  23 +@Api(tags = "设备管理部分接口—楼宇设备和客流统计及设备升级")
24 24 public class DeviceControl {
25 25  
26 26  
... ... @@ -184,43 +184,5 @@ public class DeviceControl {
184 184 }
185 185  
186 186  
187   - @ApiOperation(value = "对设备布撤防状态进行修改(活动检测开关),实现布防和撤防功能")
188   - @ApiImplicitParams({
189   - @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
190   - @ApiImplicitParam(name = "isDefence",value = "具有防护能力设备布撤防状态:0-睡眠,8-在家,16-外出,普通IPC设备布撤防状态:`0-撤防,1-布防",required = true)
191   - })
192   - @GetMapping("setDefenceStatus")
193   - public ServerResponse setDefenceStatus(@RequestParam String deviceSerial,@RequestParam Integer isDefence) {
194   -
195   - String url = YinShiServiceConfig.HostUrl + "lapp/device/defence/set";
196   - Map<String, Object> map = new HashMap<>();
197   - map.put("accessToken", YinShiServiceConfig.AccessToken);
198   - map.put("deviceSerial", deviceSerial);
199   - map.put("isDefence",isDefence);
200   - String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
201   -
202   - YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
203   -
204   - return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
205   - }
206 187  
207   - @ApiOperation(value = "根据设备验证码关闭设备视频加密开关")
208   - @ApiImplicitParams({
209   - @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true),
210   - @ApiImplicitParam(name = "validateCode",value = "设备验证码,设备机身上的六位大写字母OLZKQU",required = true)
211   - })
212   - @GetMapping("deviceVideoEncryptOff")
213   - public ServerResponse deviceVideoEncryptOff(@RequestParam String deviceSerial,@RequestParam String validateCode) {
214   -
215   - String url = YinShiServiceConfig.HostUrl + "lapp/device/encrypt/off";
216   - Map<String, Object> map = new HashMap<>();
217   - map.put("accessToken", YinShiServiceConfig.AccessToken);
218   - map.put("deviceSerial", deviceSerial);
219   - map.put("validateCode",validateCode);
220   - String result = ApiHelper.doPost(url, new HashMap<String, String>(), map);
221   -
222   - YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class);
223   -
224   - return ResultUtils.getInstance().returnResultYingshi(yinShiResResult);
225   - }
226 188 }
... ...