|
@@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -580,12 +581,14 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- ResultData ok = callV3(preParams, fdageJson,"api/scene/file/uploadSuccessBuild");
|
|
|
- if (ok != null) return ok;
|
|
|
-
|
|
|
// 判断是否是V3的场景
|
|
|
ScenePro scenePro = sceneProService.getOne(
|
|
|
- new LambdaQueryWrapper<ScenePro>().like(ScenePro::getDataSource, fileId));
|
|
|
+ new LambdaQueryWrapper<ScenePro>().like(ScenePro::getDataSource, fileId));
|
|
|
+
|
|
|
+ boolean callV3 = callV3(scenePro, preParams, fdageJson, "api/scene/file/uploadSuccessBuild");
|
|
|
+ if(callV3) return ResultData.ok();
|
|
|
+
|
|
|
+
|
|
|
if (ObjectUtils.isEmpty(scenePro) || (!ObjectUtils.isEmpty(scenePro.getIsUpgrade()) && scenePro.getIsUpgrade() == 1)) {
|
|
|
buildScene(fileId, prefixBuffer.toString(),fdageJson,buildType,cameraType);
|
|
|
}else{
|
|
@@ -594,7 +597,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
- private ResultData callV3(String preParams, JSONObject fdageJson,String api) {
|
|
|
+ private boolean callV3(ScenePro scenePro, String preParams, JSONObject fdageJson,String api) throws Exception {
|
|
|
String cameraName = fdageJson.getJSONObject("cam").getString("uuid");
|
|
|
|
|
|
Camera camera = cameraService.getByChildName(cameraName);
|
|
@@ -608,7 +611,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
log.error("该相机详情不存在:" + cameraName);
|
|
|
throw new BusinessException(CameraConstant.FAILURE_6003);
|
|
|
}
|
|
|
- // 判断是否是正顺的场景,如果是正顺的场景,则发送到原来的系统进行计算
|
|
|
+ // 判断是否是正顺|火调|普通v3的场景,如果是正顺|火调|普通v3的场景,则发送到原来的系统进行计算
|
|
|
if (!ObjectUtils.isEmpty(cameraDetail.getCompanyId())) {
|
|
|
Company company = companyService.getById(cameraDetail.getCompanyId());
|
|
|
if(ObjectUtils.isEmpty(company)){
|
|
@@ -616,18 +619,23 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
throw new BusinessException(CameraConstant.FAILURE_6003);
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(company.getSceneVersion()) && company.getSceneVersion().equals("V3")) {
|
|
|
- callV3Service(preParams,api);
|
|
|
- return ResultData.ok();
|
|
|
+ callV3Service(preParams, api);
|
|
|
+ return Boolean.TRUE;
|
|
|
}
|
|
|
+ }else if (Objects.nonNull(scenePro) &&
|
|
|
+ scenePro.getSceneSource() != SceneSource.JG.code() &&
|
|
|
+ scenePro.getIsUpgrade() == CommonStatus.NO.code().intValue()){
|
|
|
+ callV3Service(preParams,api);
|
|
|
+ return Boolean.TRUE;
|
|
|
}
|
|
|
- return null;
|
|
|
+ return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
|
- public void callV3Service(String params,String api){
|
|
|
+ public void callV3Service(String params,String api) throws Exception {
|
|
|
log.info("params:{}", params);
|
|
|
if(ObjectUtils.isEmpty(v3controlUrl)){
|
|
|
log.error("未配置V3服务器!");
|
|
|
- return;
|
|
|
+ throw new Exception("未配置V3服务器!");
|
|
|
}
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
|
@@ -636,8 +644,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
HttpEntity<Object> formEntity = new HttpEntity<>(paramMap,headers);
|
|
|
ResponseEntity<Result> responseEntity = restTemplate.postForEntity(v3controlUrl+api, formEntity, Result.class);
|
|
|
if (responseEntity.getStatusCode() != HttpStatus.OK || responseEntity.getBody().getCode() != HttpStatus.OK.value()) {
|
|
|
- log.error("正顺场景请求V3服务器失败!");
|
|
|
- return;
|
|
|
+ log.error("正顺场景请求V3服务器失败, params:{}, result:{}",params, JSON.toJSONString(responseEntity));
|
|
|
+ throw new BusinessException(ErrorCode.SYSTEM_BUSY);
|
|
|
}
|
|
|
log.info("正顺场景请求V3服务器成功!");
|
|
|
}
|
|
@@ -698,15 +706,16 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
cameraType = 14L;
|
|
|
}
|
|
|
|
|
|
- ResultData ok = callV3(preParams, fdageJson,"api/scene/file/turntableUploadSuccess");
|
|
|
- if (ok != null) return ok;
|
|
|
+ // 判断是否是V3的场景
|
|
|
+ ScenePro scenePro = sceneProService.getOne(
|
|
|
+ new LambdaQueryWrapper<ScenePro>().like(ScenePro::getDataSource, fileId));
|
|
|
+
|
|
|
+ boolean callV3 = callV3(scenePro, preParams, fdageJson, "api/scene/file/turntableUploadSuccess");
|
|
|
+ if (callV3) return ResultData.ok();
|
|
|
|
|
|
|
|
|
ScenePlusVO scenePlusVO = null;
|
|
|
|
|
|
- // 判断是否是V3的场景
|
|
|
- ScenePro scenePro = sceneProService.getOne(
|
|
|
- new LambdaQueryWrapper<ScenePro>().like(ScenePro::getDataSource, fileId));
|
|
|
if (ObjectUtils.isEmpty(scenePro) || (!ObjectUtils.isEmpty(scenePro.getIsUpgrade()) && scenePro.getIsUpgrade() == 1)) {
|
|
|
scenePlusVO = buildScene(fileId, prefixBuffer.toString(), fdageJson, buildType, cameraType);
|
|
|
} else {
|
|
@@ -1071,7 +1080,11 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
//如果是v3场景,不允许重算,需要升级v4后再调此接口进行重算
|
|
|
if(Objects.nonNull(scenePro) && (Objects.isNull(scenePro.getIsUpgrade())
|
|
|
|| scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
|
|
|
- return rebuildV3Scene(scenePro,num,force);
|
|
|
+ if(scenePro.getSceneSource() == SceneSource.JG.code().intValue()){
|
|
|
+ return rebuildV3Scene(scenePro,num,force);
|
|
|
+ }else{
|
|
|
+ return rebuildV3SceneToMini(scenePro);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
@@ -1564,4 +1577,13 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
return scene;
|
|
|
}
|
|
|
|
|
|
+ private ResultData rebuildV3SceneToMini(ScenePro scenePro){
|
|
|
+ ResponseEntity<Result> responseEntity = restTemplate.getForEntity(v3controlUrl+"api/scene/rebuildScene?num=" + scenePro.getNum(), Result.class);
|
|
|
+ if (responseEntity.getStatusCode() != HttpStatus.OK || responseEntity.getBody().getCode() != HttpStatus.OK.value()) {
|
|
|
+ log.error("请求V3服务器重算场景失败, num:{}, result:{}",scenePro.getNum(), JSON.toJSONString(responseEntity));
|
|
|
+ throw new BusinessException(ErrorCode.SYSTEM_BUSY);
|
|
|
+ }
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
}
|