package com.sandu.ximon.admin.controller;
|
|
import com.sandu.common.domain.ResponseVO;
|
import com.sandu.common.security.annotation.AnonymousAccess;
|
import com.sandu.common.util.ResponseUtil;
|
import com.sandu.ximon.admin.config.VnnoxConstant;
|
import com.sandu.ximon.admin.param.AsyncStatusParam;
|
import com.sandu.ximon.admin.param.VnnoxProgressParam;
|
import com.sandu.ximon.admin.param.VnnoxScreenShotParam;
|
import com.sandu.ximon.admin.utils.CountDownLatchUtil;
|
import com.sandu.ximon.admin.utils.RedisUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
//诺瓦回调
|
@RestController
|
@RequestMapping("/serv/vnnox")
|
public class ServVnnoxController {
|
|
@Autowired
|
private RedisUtils redisUtils;
|
@Autowired
|
private CountDownLatchUtil countDownLatchUtil;
|
|
|
@AnonymousAccess
|
@PostMapping("/screenshot")
|
public ResponseVO<Object> screenshot(@RequestBody VnnoxScreenShotParam vnnoxScreenShot) {
|
String url = vnnoxScreenShot.getScreenShotUrl().replace("&", "&");
|
System.out.println(vnnoxScreenShot);
|
redisUtils.set(VnnoxConstant.REDIS_SCREEN_SHOT + vnnoxScreenShot.getPlayerId(), url);
|
return ResponseUtil.success("ok");
|
}
|
|
|
@AnonymousAccess
|
@PostMapping("/progress")
|
public ResponseVO<Object> progress(@RequestBody VnnoxProgressParam vnnoxProgress) {
|
redisUtils.set(VnnoxConstant.REDIS_PROGRESS + vnnoxProgress.getPlayerId(), vnnoxProgress.getPrecess());
|
return ResponseUtil.success("ok");
|
}
|
|
|
@AnonymousAccess
|
@PostMapping("/asyncStatus")
|
public ResponseVO<Object> asyncStatus(@RequestBody AsyncStatusParam asyncStatusParam) {
|
System.out.println(asyncStatusParam.toString());
|
if ("brightnessValue".equals(asyncStatusParam.getCommand())) {
|
//亮度
|
String ratio = asyncStatusParam.getData().getRatio();
|
int i = Integer.parseInt(ratio);
|
redisUtils.set(VnnoxConstant.REDIS_BRIGHTNESS + asyncStatusParam.getPlayerId(), i + "", VnnoxConstant.STATUS_TIME);
|
} else if ("volumeValue".equals(asyncStatusParam.getCommand())) {
|
//音量
|
String ratio = asyncStatusParam.getData().getRatio();
|
int i = Integer.parseInt(ratio);
|
redisUtils.set(VnnoxConstant.REDIS_VOL + asyncStatusParam.getPlayerId(), i + "", VnnoxConstant.STATUS_TIME);
|
} else if ("videoSourceValue".equals(asyncStatusParam.getCommand())) {
|
//当前视频源
|
redisUtils.set(VnnoxConstant.VIDEO_SOURCE_VALUE + asyncStatusParam.getPlayerId(), asyncStatusParam.getData().getVideoSource(), VnnoxConstant.STATUS_TIME);
|
} else if ("timeValue".equals(asyncStatusParam.getCommand())) {
|
//当前时区和时间
|
redisUtils.set(VnnoxConstant.TIME_VALUE_TIME + asyncStatusParam.getPlayerId(), asyncStatusParam.getData().getCurrentTime(), VnnoxConstant.STATUS_TIME);
|
redisUtils.set(VnnoxConstant.TIME_VALUE_TIMEZONE + asyncStatusParam.getPlayerId(), asyncStatusParam.getData().getTimeZone(), VnnoxConstant.STATUS_TIME);
|
} else if ("screenPowerStatus".equals(asyncStatusParam.getCommand())) {
|
//屏幕状态
|
if ("OPEN".equals(asyncStatusParam.getData().getState())) {
|
redisUtils.set(VnnoxConstant.REDIS_SCREEN_STATUS + asyncStatusParam.getPlayerId(), "1", VnnoxConstant.STATUS_TIME);
|
} else {
|
redisUtils.set(VnnoxConstant.REDIS_SCREEN_STATUS + asyncStatusParam.getPlayerId(), "0", VnnoxConstant.STATUS_TIME);
|
}
|
;
|
} else if ("syncPlayStatus".equals(asyncStatusParam.getCommand())) {
|
//同步播放状态
|
redisUtils.set(VnnoxConstant.SYNC_PLAY_STATUS + asyncStatusParam.getPlayerId(), asyncStatusParam.getData().getEnable(), VnnoxConstant.STATUS_TIME);
|
}
|
countDownLatchUtil.countDown(asyncStatusParam.getLogid());
|
return ResponseUtil.success("ok");
|
}
|
|
}
|