|
@@ -1,7 +1,10 @@
|
|
|
package com.fdkankan.contro.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
@@ -31,9 +34,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
@@ -139,44 +141,60 @@ public class UploadShootingServiceImpl implements UploadShootingService {
|
|
|
condition.setUuid(detail.getUuid());
|
|
|
condition.setStatus(0);
|
|
|
condition.setPtIndex(detail.getIndex());
|
|
|
- condition.setCallType(2);
|
|
|
- OrigFileUploadBatch origFileUploadBatch = origFileUploadBatchService.getByCondition(condition);
|
|
|
-
|
|
|
- OrigFileUpload origFileUpload = origFileUploadService.getByBatchIdAndFileName(origFileUploadBatch.getBatchId(), "config.json");
|
|
|
- String localPath = ConstantFilePath.BUILD_MODEL_PATH + "upload_while_shooting/" + detail.getUuid() + "/" + detail.getIndex() + "/" + detail.getFileName();
|
|
|
- HttpUtilExt.downloadFileAndCheck(origFileUpload.getFileUrl(), localPath, 300000);
|
|
|
-
|
|
|
- //入库相机
|
|
|
+ List<OrigFileUploadBatch> batches = origFileUploadBatchService.listPreviewByCondition(condition);
|
|
|
+ if(CollUtil.isEmpty(batches)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
String[] uuidArr = detail.getUuid().split("_");
|
|
|
String snCode = uuidArr[0];
|
|
|
- JSONObject configJson = JSONObject.parseObject(FileUtils.readUtf8String(localPath));
|
|
|
- int camType = configJson.getInteger("cameraType");
|
|
|
- String cameraInStoreUrl = fdServiceUrl + ApiConstant.URL_CAMERA_INSTORE;
|
|
|
- Map<String, Object> cameraInStoreParams = new HashMap<>();
|
|
|
- cameraInStoreParams.put("cameraType", camType);
|
|
|
- cameraInStoreParams.put("snCode", snCode);
|
|
|
- ResultData post = myClient.post(cameraInStoreUrl, cameraInStoreParams);
|
|
|
- log.info("---------cameraInStore result:{}-----------", post);
|
|
|
+ Integer camType = null;
|
|
|
+ User user = null;
|
|
|
|
|
|
- //注册用户
|
|
|
- String folderName = configJson.getString("id");
|
|
|
- String customUserId = configJson.getString("customUserId");
|
|
|
- String customUserName = configJson.getString("customUserName");
|
|
|
- String customUserPwd = configJson.getString("customUserPwd");
|
|
|
- if (StrUtil.isBlank(folderName) || StrUtil.isBlank(snCode)) {
|
|
|
- throw new RuntimeException("config.json 文件有误!");
|
|
|
- }
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("ryId", customUserId);
|
|
|
- params.put("ryNo", customUserName);
|
|
|
+ OrigFileUpload dataFdageFileUpload = origFileUploadService.getLastByFileName("data.fdage");
|
|
|
+ String dataFdageLocalPath = ConstantFilePath.BUILD_MODEL_PATH + "upload_while_shooting/" + detail.getUuid() + "/data.fdage";
|
|
|
+ HttpUtilExt.downloadFileAndCheck(dataFdageFileUpload.getFileUrl(), dataFdageLocalPath, 300000);
|
|
|
+ JSONObject dataFdage = JSON.parseObject(FileUtil.readUtf8String(dataFdageLocalPath));
|
|
|
+ String title = dataFdage.getString("name");
|
|
|
+
|
|
|
+ OrigFileUploadBatch origFileUploadBatch = batches.get(0);
|
|
|
+ if(detail.getIndex() == null || detail.getIndex() != -1){//没有新增点位
|
|
|
+
|
|
|
+ }else{//有新增点位
|
|
|
+
|
|
|
+ OrigFileUpload origFileUpload = origFileUploadService.getByBatchIdAndFileName(origFileUploadBatch.getBatchId(), "config.json");
|
|
|
+ String localPath = ConstantFilePath.BUILD_MODEL_PATH + "upload_while_shooting/" + detail.getUuid() + "/" + detail.getIndex() + "/" + detail.getFileName();
|
|
|
+ HttpUtilExt.downloadFileAndCheck(origFileUpload.getFileUrl(), localPath, 300000);
|
|
|
+
|
|
|
+ //入库相机
|
|
|
+ JSONObject configJson = JSONObject.parseObject(FileUtils.readUtf8String(localPath));
|
|
|
+ camType = configJson.getInteger("cameraType");
|
|
|
+ String cameraInStoreUrl = fdServiceUrl + ApiConstant.URL_CAMERA_INSTORE;
|
|
|
+ Map<String, Object> cameraInStoreParams = new HashMap<>();
|
|
|
+ cameraInStoreParams.put("cameraType", camType);
|
|
|
+ cameraInStoreParams.put("snCode", snCode);
|
|
|
+ ResultData post = myClient.post(cameraInStoreUrl, cameraInStoreParams);
|
|
|
+ log.info("---------cameraInStore result:{}-----------", post);
|
|
|
+
|
|
|
+ //注册用户
|
|
|
+ String folderName = configJson.getString("id");
|
|
|
+ String customUserId = configJson.getString("customUserId");
|
|
|
+ String customUserName = configJson.getString("customUserName");
|
|
|
+ String customUserPwd = configJson.getString("customUserPwd");
|
|
|
+ if (StrUtil.isBlank(folderName) || StrUtil.isBlank(snCode)) {
|
|
|
+ throw new RuntimeException("config.json 文件有误!");
|
|
|
+ }
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("ryId", customUserId);
|
|
|
+ params.put("ryNo", customUserName);
|
|
|
// params.put("nickName", customUserName);//去掉昵称,又燕海的接口进行判断
|
|
|
- params.put("password", AesUtil.encryptCBC(customUserPwd, userPasswordKey, userPasswordIv, AesUtil.ALMODE_CBC_NOPADDING));
|
|
|
- String url = fdServiceUrl.concat(ApiConstant.URL_ADD_UCENTER_USER);
|
|
|
- myClient.post(url, params);
|
|
|
- JyUser jyUser = jyUserService.getByRyId(customUserId);
|
|
|
- User user = userService.getById(jyUser.getUserId());
|
|
|
- if (Objects.isNull(jyUser)) {
|
|
|
- throw new RuntimeException("注册用户失败");
|
|
|
+ params.put("password", AesUtil.encryptCBC(customUserPwd, userPasswordKey, userPasswordIv, AesUtil.ALMODE_CBC_NOPADDING));
|
|
|
+ String url = fdServiceUrl.concat(ApiConstant.URL_ADD_UCENTER_USER);
|
|
|
+ myClient.post(url, params);
|
|
|
+ JyUser jyUser = jyUserService.getByRyId(customUserId);
|
|
|
+ user = userService.getById(jyUser.getUserId());
|
|
|
+ if (Objects.isNull(jyUser)) {
|
|
|
+ throw new RuntimeException("注册用户失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//生成场景表
|
|
@@ -203,6 +221,7 @@ public class UploadShootingServiceImpl implements UploadShootingService {
|
|
|
scenePlusExt.setDataSource(dataSource);
|
|
|
scenePlus.setNum(sceneNum);
|
|
|
scenePlus.setSceneSource(SceneSource.BM.code());
|
|
|
+ scenePlus.setPreview(CommonStatus.YES.code());
|
|
|
if (camType == CameraTypeEnum.DOUBLE_EYE_TURN.getType()) {
|
|
|
scenePlus.setSceneSource(SceneSource.ZT.code());
|
|
|
}
|
|
@@ -222,10 +241,10 @@ public class UploadShootingServiceImpl implements UploadShootingService {
|
|
|
sceneEditInfoExt = new SceneEditInfoExt();
|
|
|
sceneEditControls = new SceneEditControls();
|
|
|
}
|
|
|
- String title = configJson.getString("title");
|
|
|
- scenePlus.setUserId(user.getId());
|
|
|
+ if(Objects.nonNull(user)){
|
|
|
+ scenePlus.setUserId(user.getId());
|
|
|
+ }
|
|
|
scenePlus.setTitle(title);
|
|
|
- scenePlus.setPreview(CommonStatus.YES.code());
|
|
|
scenePlusService.saveOrUpdate(scenePlus);
|
|
|
|
|
|
scenePlusExt.setPlusId(scenePlus.getId());
|
|
@@ -244,15 +263,18 @@ public class UploadShootingServiceImpl implements UploadShootingService {
|
|
|
sceneEditControlsService.saveOrUpdate(sceneEditControls);
|
|
|
|
|
|
JSONObject preParams = new JSONObject();
|
|
|
- preParams.put("batchId", origFileUploadBatch.getBatchId());
|
|
|
preParams.put("sceneCode", sceneNum);
|
|
|
preParams.put("index", detail.getIndex());
|
|
|
preParams.put("uuid", detail.getUuid());
|
|
|
mqProducer.sendByWorkQueue("preview-scene-pre", preParams);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public boolean checkLackFille(Integer index, List<OrigFileUpload> fileUploadList) {
|
|
|
+ Set<String> fileNameList = fileUploadList.stream().map(v -> v.getFileName()).collect(Collectors.toSet());
|
|
|
+ if(!fileNameList.contains(index + ".jpg") || !fileNameList.contains(index + ".json") || !fileNameList.contains(index + "_3d.ply")){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|