|
@@ -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;
|
|
@@ -85,6 +86,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
@Value("${v3.controlUrl:#{null}}")
|
|
|
private String v3controlUrl;
|
|
|
|
|
|
+ @Value("${model.modelKind:3dtiles}")
|
|
|
+ private String modelKind;
|
|
|
+
|
|
|
@Value("${build.notSupport.beforeTime:202203}")
|
|
|
private String jgNotSupportBuildTime;
|
|
|
|
|
@@ -92,6 +96,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
|
private IScenePlusExtService scenePlusExtService;
|
|
|
|
|
@@ -513,6 +518,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
|
|
|
String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
|
|
|
QrConfig qrConfig = QrConfig.create();
|
|
|
+ qrConfig.setWidth(512);
|
|
|
+ qrConfig.setHeight(512);
|
|
|
if(!org.apache.commons.lang3.ObjectUtils.isEmpty(localLogoPath)){
|
|
|
qrConfig.setImg(localLogoPath);
|
|
|
}
|
|
@@ -581,12 +588,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{
|
|
@@ -595,7 +604,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);
|
|
@@ -609,7 +618,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)){
|
|
@@ -617,18 +626,25 @@ 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;
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+ // TODO: 2023/1/12 3dtiles临时上激光场景
|
|
|
+// else if (Objects.nonNull(scenePro) &&
|
|
|
+// scenePro.getSceneSource() != SceneSource.JG.code() &&
|
|
|
+// scenePro.getIsUpgrade() == CommonStatus.NO.code().intValue()){
|
|
|
+// callV3Service(preParams,api);
|
|
|
+// return Boolean.TRUE;
|
|
|
+// }
|
|
|
+ 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,9 +652,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
paramMap.add("params",params);
|
|
|
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;
|
|
|
+ if (responseEntity.getStatusCode().value() != HttpStatus.OK.value() || responseEntity.getBody().getCode() != ServerCode.SUCCESS.code()) {
|
|
|
+ log.error("正顺场景请求V3服务器失败, params:{}, result:{}",params, JSON.toJSONString(responseEntity));
|
|
|
+ throw new BusinessException(ErrorCode.SYSTEM_BUSY);
|
|
|
}
|
|
|
log.info("正顺场景请求V3服务器成功!");
|
|
|
}
|
|
@@ -699,19 +715,18 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
cameraType = 14L;
|
|
|
}
|
|
|
|
|
|
- ResultData ok = callV3(preParams, fdageJson,"api/scene/file/turntableUploadSuccess");
|
|
|
- if (ok != null) return ok;
|
|
|
-
|
|
|
-
|
|
|
- ScenePlusVO scenePlusVO = null;
|
|
|
-
|
|
|
// 判断是否是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/turntableUploadSuccess");
|
|
|
+ if (callV3) return ResultData.ok();
|
|
|
|
|
|
//激光场景校验是否能够计算
|
|
|
this.checkJgCanBuild(scenePro);
|
|
|
|
|
|
+ ScenePlusVO scenePlusVO = null;
|
|
|
+
|
|
|
if (ObjectUtils.isEmpty(scenePro) || (!ObjectUtils.isEmpty(scenePro.getIsUpgrade()) && scenePro.getIsUpgrade() == 1)) {
|
|
|
scenePlusVO = buildScene(fileId, prefixBuffer.toString(), fdageJson, buildType, cameraType);
|
|
|
} else {
|
|
@@ -774,6 +789,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
if(cameraType.longValue() == 14 ){
|
|
|
scenePlus.setSceneSource(4);
|
|
|
scenePlusExt.setSceneScheme(10);
|
|
|
+ scenePlusExt.setModelKind(modelKind);
|
|
|
}
|
|
|
|
|
|
if (pic != null && pic.length() > 5) {
|
|
@@ -1066,12 +1082,23 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
|
|
|
ScenePro scenePro = sceneProService.getByNum(num);
|
|
|
|
|
|
+ // TODO: 2023/1/12 3dtiles临时上激光场景
|
|
|
+// if(Objects.nonNull(scenePro) && (Objects.isNull(scenePro.getIsUpgrade())
|
|
|
+// || scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
|
|
|
+// if(scenePro.getSceneSource() == SceneSource.JG.code().intValue()){
|
|
|
+// return rebuildV3Scene(scenePro,num,force);
|
|
|
+// }else{
|
|
|
+// return rebuildV3SceneToMini(scenePro);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
//激光场景校验是否能够计算
|
|
|
this.checkJgCanBuild(scenePro);
|
|
|
|
|
|
//如果是v3场景,不允许重算,需要升级v4后再调此接口进行重算
|
|
|
if(Objects.nonNull(scenePro) && (Objects.isNull(scenePro.getIsUpgrade())
|
|
|
- || scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
|
|
|
+ || scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
|
|
|
return rebuildV3Scene(scenePro,num,force);
|
|
|
}
|
|
|
|
|
@@ -1139,11 +1166,19 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
if(deleteExtras){
|
|
|
message.getExt().put("deleteExtras",deleteExtras);
|
|
|
}
|
|
|
+ if (force) {
|
|
|
+ message.setRebuild("1");
|
|
|
+ }
|
|
|
rabbitMqProducer.sendByWorkQueue(queueModelingPre, message);
|
|
|
scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
|
.set(ScenePlus::getSceneStatus, SceneStatus.wait.code())
|
|
|
.eq(ScenePlus::getNum, num));
|
|
|
|
|
|
+ if(cameraType == 14){
|
|
|
+ scenePlusExt.setModelKind(this.modelKind);
|
|
|
+ }
|
|
|
+ scenePlusExtService.updateById(scenePlusExt);
|
|
|
+
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
@@ -1191,9 +1226,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
String buildType = scenePro.getBuildType();
|
|
|
Integer sceneScheme = scenePro.getSceneScheme();
|
|
|
|
|
|
- //重新计算时需要删除文件夹,否知使用缓存
|
|
|
- FileUtils.delAllFile(path + File.separator + "results");
|
|
|
-
|
|
|
String dataFdageOssPath = ConstantFilePath.OSS_PREFIX+ path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
|
.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage";
|
|
|
|
|
@@ -1606,4 +1638,15 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
return scene;
|
|
|
}
|
|
|
|
|
|
+ private ResultData rebuildV3SceneToMini(ScenePro scenePro){
|
|
|
+ log.info("v3场景重算,请求v3服务器,url:{}",v3controlUrl+"api/scene/rebuildScene?num=" + scenePro.getNum());
|
|
|
+ ResponseEntity<Result> responseEntity = restTemplate.getForEntity(v3controlUrl+"api/scene/rebuildScene?num=" + scenePro.getNum(), Result.class);
|
|
|
+ if (responseEntity.getStatusCode().value() != HttpStatus.OK.value() || responseEntity.getBody().getCode() != ServerCode.SUCCESS.code()) {
|
|
|
+ log.error("请求V3服务器重算场景失败, num:{}, result:{}",scenePro.getNum(), JSON.toJSONString(responseEntity));
|
|
|
+ throw new BusinessException(ErrorCode.SYSTEM_BUSY);
|
|
|
+ }
|
|
|
+ log.info("v3场景重算,请求v3服务器,url:{}, result",v3controlUrl+"api/scene/rebuildScene?num=" + scenePro.getNum(), JSON.toJSONString(responseEntity));
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
}
|