|
@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
import com.ruoyi.common.constant.HttpStatus; |
|
|
import com.ruoyi.common.core.controller.BaseController; |
|
|
import com.ruoyi.common.core.controller.BaseController; |
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
|
|
|
import com.ruoyi.system.service.ISysConfigService; |
|
|
import com.zc.business.constant.DeviceTypeConstants; |
|
|
import com.zc.business.constant.DeviceTypeConstants; |
|
|
import com.zc.business.domain.DcDevice; |
|
|
import com.zc.business.domain.DcDevice; |
|
|
import com.zc.business.enums.CameraDirectionEnum; |
|
|
import com.zc.business.enums.CameraDirectionEnum; |
|
@ -20,6 +22,7 @@ import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
import io.swagger.annotations.ApiParam; |
|
|
import io.swagger.annotations.ApiParam; |
|
|
import okhttp3.Response; |
|
|
import okhttp3.Response; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
import org.springframework.web.bind.annotation.PatchMapping; |
|
|
import org.springframework.web.bind.annotation.PatchMapping; |
|
@ -33,6 +36,7 @@ import java.util.concurrent.TimeUnit; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
import static com.ruoyi.common.constant.Constants.HTTP; |
|
|
import static com.ruoyi.common.constant.Constants.HTTP; |
|
|
|
|
|
import static com.ruoyi.common.constant.Constants.HTTPS; |
|
|
import static java.util.Comparator.comparing; |
|
|
import static java.util.Comparator.comparing; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -68,6 +72,8 @@ public class VideoController extends BaseController { |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private IMiddleDatabaseService middleDatabaseService; |
|
|
private IMiddleDatabaseService middleDatabaseService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ISysConfigService configService; |
|
|
|
|
|
|
|
|
// 组织机构id
|
|
|
// 组织机构id
|
|
|
private final static String CAM_DEPT_ID = "1301730"; |
|
|
private final static String CAM_DEPT_ID = "1301730"; |
|
@ -483,11 +489,26 @@ public class VideoController extends BaseController { |
|
|
if (response.body() != null) { |
|
|
if (response.body() != null) { |
|
|
jsonResult = JSONObject.parseObject(response.body().string()); |
|
|
jsonResult = JSONObject.parseObject(response.body().string()); |
|
|
|
|
|
|
|
|
if (jsonResult.containsKey("code") && UNAUTHORIZED.equals(jsonResult.getInteger("code"))) { |
|
|
if (jsonResult.containsKey("code")) { |
|
|
getToken(); |
|
|
if (HttpStatus.SUCCESS == jsonResult.getInteger("code")) { |
|
|
okHttp.post(); |
|
|
Map<String,Object> data = jsonResult.getJSONObject("data"); |
|
|
if (response.body() != null) { |
|
|
String liveUrl = data.get("liveUrl").toString(); |
|
|
jsonResult = JSONObject.parseObject(response.body().string()); |
|
|
liveUrl = configService.selectConfigByKey("dc.cameraUrl") + liveUrl.substring(7); |
|
|
|
|
|
data.put("liveUrl",liveUrl); |
|
|
|
|
|
jsonResult.put("data",data); |
|
|
|
|
|
} else if (UNAUTHORIZED.equals(jsonResult.getInteger("code"))) { |
|
|
|
|
|
getToken(); |
|
|
|
|
|
okHttp.post(); |
|
|
|
|
|
if (response.body() != null) { |
|
|
|
|
|
jsonResult = JSONObject.parseObject(response.body().string()); |
|
|
|
|
|
if (HttpStatus.SUCCESS == jsonResult.getInteger("code")) { |
|
|
|
|
|
Map<String,Object> data = jsonResult.getJSONObject("data"); |
|
|
|
|
|
String liveUrl = data.get("liveUrl").toString(); |
|
|
|
|
|
liveUrl = configService.selectConfigByKey("cameraUrl") + liveUrl.substring(7); |
|
|
|
|
|
data.put("liveUrl",liveUrl); |
|
|
|
|
|
jsonResult.put("data",data); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|