|
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.IORuntimeException;
|
|
|
import cn.hutool.core.util.CharsetUtil;
|
|
|
+import cn.hutool.core.util.CharsetUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -17,7 +18,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.common.constant.*;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.FileSizeUtil;
|
|
|
+import com.fdkankan.common.util.FileMd5Util;
|
|
|
+import com.fdkankan.common.util.FileSizeUtil;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
+import com.fdkankan.dxf.parse.utils.FdJsonToDxfUtil;
|
|
|
+import com.fdkankan.fyun.config.FYunFileConfig;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.fyun.util.OssFileUtil;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.model.utils.ComputerUtil;
|
|
@@ -32,6 +39,8 @@ import com.fdkankan.scene.bean.*;
|
|
|
import com.fdkankan.scene.config.FdkkLaserConfig;
|
|
|
import com.fdkankan.scene.constant.ConstantFileLocPath;
|
|
|
import com.fdkankan.scene.entity.*;
|
|
|
+import com.fdkankan.scene.bean.*;
|
|
|
+import com.fdkankan.scene.entity.*;
|
|
|
import com.fdkankan.scene.mapper.ISceneEditInfoMapper;
|
|
|
import com.fdkankan.scene.oss.OssUtil;
|
|
|
import com.fdkankan.scene.service.*;
|
|
@@ -39,6 +48,8 @@ import com.fdkankan.scene.util.CmdBuildUtil;
|
|
|
import com.fdkankan.scene.util.MergeVideoUtil;
|
|
|
import com.fdkankan.scene.util.VisionUtil;
|
|
|
import com.fdkankan.scene.vo.*;
|
|
|
+import com.fdkankan.scene.service.*;
|
|
|
+import com.fdkankan.scene.vo.*;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.errorprone.annotations.Var;
|
|
@@ -49,11 +60,21 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.nio.file.FileSystemException;
|
|
|
import java.util.*;
|
|
|
+import java.util.*;
|
|
|
import java.util.Map.Entry;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
@@ -105,6 +126,18 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
private ISceneAsynOperLogService sceneAsynOperLogService;
|
|
|
@Autowired
|
|
|
private ISceneService sceneService;
|
|
|
+ @Autowired
|
|
|
+ private ICutModelService cutModelService;
|
|
|
+ @Autowired
|
|
|
+ private ICommonService commonService;
|
|
|
+ @Autowired
|
|
|
+ private FYunFileConfig fYunFileConfig;
|
|
|
+ @Autowired
|
|
|
+ private ISceneDrawService sceneDrawService;
|
|
|
+ @Autowired
|
|
|
+ private ISceneDynamicPanelService sceneDynamicPanelService;
|
|
|
+ @Autowired
|
|
|
+ private IWbService wbService;
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
@@ -136,6 +169,13 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
if(Objects.nonNull(param.getSns())){
|
|
|
sceneEditInfoExt.setSnsInfo(JSON.toJSONString(param.getSns()));
|
|
|
}
|
|
|
+ if(Objects.nonNull(param.getStarted())){
|
|
|
+ sceneEditInfoExt.setStarted(JSON.toJSONString(param.getStarted()));
|
|
|
+ }
|
|
|
+ sceneEditInfoExt.setFloorLogoType(param.getFloorLogoType());
|
|
|
+// else{
|
|
|
+// sceneEditInfoExt.setStarted("");
|
|
|
+// }
|
|
|
sceneEditInfoExtService.updateById(sceneEditInfoExt);
|
|
|
|
|
|
if(Objects.nonNull(param.getControls())){
|
|
@@ -212,7 +252,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
//生成sceneJson
|
|
|
SceneJsonBean sceneJson = new SceneJsonBean();
|
|
|
- BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
|
|
|
+ BeanUtil.copyProperties(sceneEditInfoExt, sceneJson, "started");
|
|
|
BeanUtil.copyProperties(sceneEditInfo, sceneJson);
|
|
|
sceneJson.setFloorPlanUpload(JSON.parseArray(sceneEditInfo.getFloorPlanUpload()));
|
|
|
SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
|
|
@@ -224,6 +264,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
|
sceneJson.setSceneKind(scenePlusExt.getSceneKind());
|
|
|
sceneJson.setModelKind(scenePlusExt.getModelKind());
|
|
|
+ sceneJson.setOrientation(scenePlusExt.getOrientation());
|
|
|
if(StrUtil.isNotEmpty(scenePlusExt.getVideos())){
|
|
|
sceneJson.setVideos(scenePlusExt.getVideos());
|
|
|
}
|
|
@@ -234,6 +275,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
//发布分享配置
|
|
|
sceneJson.setSns(JSON.parseObject(sceneEditInfoExt.getSnsInfo()));
|
|
|
|
|
|
+ //发布启动页配置
|
|
|
+ sceneJson.setStarted(JSON.parseObject(sceneEditInfoExt.getStarted()));
|
|
|
+
|
|
|
//处理热点数据,生成hot.json
|
|
|
this.publicHotData(num, bucket);
|
|
|
|
|
@@ -249,6 +293,14 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
//发布指示牌数据
|
|
|
this.publicBillboardData(num, bucket);
|
|
|
|
|
|
+ //发布模型裁剪
|
|
|
+ cutModelService.publicCutModel(num, bucket);
|
|
|
+
|
|
|
+ //发布场景绘制
|
|
|
+ sceneDrawService.publicSceneDraw(num, bucket);
|
|
|
+
|
|
|
+ sceneJson.setDynamicPanel(sceneDynamicPanelService.checkDynamicPanel(num));
|
|
|
+
|
|
|
//本地写sceneJson文件
|
|
|
String localSceneJsonPath = String.format(scenePlusExt.getDataSource()+ ConstantFileLocPath.SCENE_DATA_PATH_V4, num) + "scene.json";
|
|
|
FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
|
|
@@ -290,6 +342,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
// scenePlus.setHouseType(this.existsHouseType(bucket, num));
|
|
|
scenePlusService.updateById(scenePlus);
|
|
|
|
|
|
+ //推送文保系统
|
|
|
+ wbService.sendMq(num);
|
|
|
+
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
@@ -334,10 +389,26 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
if(CollUtil.isEmpty(linkPanMap)){
|
|
|
return;
|
|
|
}
|
|
|
- JSONArray linkPanArr = new JSONArray();
|
|
|
- linkPanMap.values().stream().forEach(linkPan->{
|
|
|
- linkPanArr.add(JSON.parseObject(linkPan));
|
|
|
- });
|
|
|
+ List<JSONObject> tags = Lists.newArrayList();
|
|
|
+ List<TagBean> tagBeanList = new ArrayList<>();
|
|
|
+ if(CollUtil.isNotEmpty(linkPanMap)){
|
|
|
+ linkPanMap.entrySet().stream().forEach(entry -> {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(entry.getValue());
|
|
|
+ tagBeanList.add(
|
|
|
+ TagBean.builder()
|
|
|
+ .createTime(jsonObject.getLong("createTime"))
|
|
|
+ .tag(jsonObject).build());
|
|
|
+ });
|
|
|
+ //按创建时间倒叙排序
|
|
|
+ tagBeanList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
|
|
|
+
|
|
|
+ //移除createTime字段
|
|
|
+ tags = tagBeanList.stream().map(tagBean -> {
|
|
|
+ JSONObject tag = tagBean.getTag();
|
|
|
+ tag.remove("createTime");
|
|
|
+ return tag;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
String linkScenePath = userEditPath + "links.json";
|
|
|
ossUtil.uploadFileBytes(bucket, linkScenePath, linkPanArr.toString().getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
@@ -426,7 +497,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
SceneInfoVO sceneInfoVO = new SceneInfoVO();
|
|
|
- BeanUtil.copyProperties(sceneEditInfoExt, sceneInfoVO);
|
|
|
+ BeanUtil.copyProperties(sceneEditInfoExt, sceneInfoVO, "started");
|
|
|
BeanUtil.copyProperties(sceneEditInfo, sceneInfoVO);
|
|
|
sceneInfoVO.setFloorPlanUpload(JSON.parseArray(sceneEditInfo.getFloorPlanUpload()));
|
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
@@ -449,18 +520,24 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
sceneInfoVO.setSpace(FileSizeUtil.convert(scenePlusExt.getSpace(), FileSizeUnitType.MB.code()));
|
|
|
sceneInfoVO.setSns(JSON.parseObject(sceneEditInfoExt.getSnsInfo()));
|
|
|
+ sceneInfoVO.setStarted(JSON.parseObject(sceneEditInfoExt.getStarted()));
|
|
|
+ sceneInfoVO.setOrientation(scenePlusExt.getOrientation());
|
|
|
|
|
|
sceneInfoVO.setBucket(mappping);
|
|
|
|
|
|
this.SortBoxVideos(sceneInfoVO);
|
|
|
|
|
|
+ this.setExtData(sceneInfoVO, scenePlus.getCameraId());
|
|
|
+
|
|
|
+ sceneInfoVO.setDynamicPanel(sceneDynamicPanelService.checkDynamicPanel(num));
|
|
|
+
|
|
|
return sceneInfoVO;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
-// String test = "";
|
|
|
-// JSONObject jsonObject = JSON.parseObject(test);
|
|
|
- FileUtil.copyContent(new File("D:\\4DMega\\4DKK_PROGRAM_DATA\\dvt600001_202206291618176080\\caches\\images"), new File("/mnt/4Dkankan/scene/1680825957743071232/caches/"), true);
|
|
|
+ String test = "";
|
|
|
+ JSONObject jsonObject = JSON.parseObject(test);
|
|
|
+ System.out.println(jsonObject);
|
|
|
}
|
|
|
|
|
|
private void SortBoxVideos(SceneInfoVO sceneInfoVO){
|
|
@@ -555,6 +632,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
|
|
|
sceneInfoVO.setFloorPlanCompass(0f);
|
|
|
}
|
|
|
+ if(Objects.isNull(sceneInfoVO.getFloorLogoType())){
|
|
|
+ sceneInfoVO.setFloorLogoType(1);
|
|
|
+ }
|
|
|
SceneEditControlsVO controls = sceneInfoVO.getControls();
|
|
|
if(Objects.isNull(controls.getShowShare())){
|
|
|
controls.setShowShare(CommonStatus.YES.code().intValue());
|
|
@@ -565,6 +645,14 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
if(Objects.isNull(controls.getShowBillboardTitle())){
|
|
|
controls.setShowBillboardTitle(CommonStatus.YES.code().intValue());
|
|
|
}
|
|
|
+ if(Objects.isNull(controls.getShowDrawTitle())){
|
|
|
+ controls.setShowDrawTitle(CommonStatus.YES.code().intValue());
|
|
|
+ }
|
|
|
+ if(Objects.isNull(controls.getShowSurveilScope())){
|
|
|
+ controls.setShowSurveilScope(CommonStatus.YES.code().intValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ sceneInfoVO.setPayStatus(scenePlus.getPayStatus());
|
|
|
|
|
|
return sceneInfoVO;
|
|
|
}
|
|
@@ -643,6 +731,91 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public ResultData uploadDxf(MultipartFile file, String num, Integer subgroup) throws Exception {
|
|
|
+
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
+
|
|
|
+ String extName = FileUtil.extName(file.getOriginalFilename());
|
|
|
+ if(!"dxf".equals(extName)){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_7007.code(), ErrorCode.FAILURE_CODE_7007.formatMessage("dxf"));
|
|
|
+ }
|
|
|
+ String dfxPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + "." + extName;
|
|
|
+ String floorplanUserPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + ".json";
|
|
|
+ file.transferTo(new File(dfxPath));
|
|
|
+ try {
|
|
|
+ String editUserPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
|
+ FdJsonToDxfUtil.dxfToFdJson(dfxPath, floorplanUserPath);
|
|
|
+
|
|
|
+ String floorplanUserStr = FileUtil.readUtf8String(floorplanUserPath);
|
|
|
+ JSONObject floorplanUserObj = JSON.parseObject(floorplanUserStr);
|
|
|
+ JSONArray floors = floorplanUserObj.getJSONArray("floors");
|
|
|
+ JSONObject floor = floors.getJSONObject(0);
|
|
|
+
|
|
|
+ String ossFloorplanUserStr = fYunFileService.getFileContent(editUserPath + "floorplan.json");
|
|
|
+ JSONObject ossFloorplanUserObj = JSON.parseObject(ossFloorplanUserStr);
|
|
|
+ JSONArray ossFloors = ossFloorplanUserObj.getJSONArray("floors");
|
|
|
+ for(int i = 0; i < ossFloors.size(); i++){
|
|
|
+ JSONObject item = (JSONObject) ossFloors.get(i);
|
|
|
+ Integer itemSubgroup = item.getInteger("subgroup");
|
|
|
+ if(itemSubgroup == subgroup){
|
|
|
+ ossFloors.set(i, floor);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ FileUtil.writeUtf8String(ossFloorplanUserObj.toJSONString(), floorplanUserPath);
|
|
|
+
|
|
|
+ fYunFileService.uploadFile(scenePlusExt.getYunFileBucket(), floorplanUserPath, editUserPath + "floorplan.json");
|
|
|
+ JSONObject houseTypeJson = CreateHouseJsonUtil
|
|
|
+ .createHouseTypeJsonByUser(floorplanUserPath);
|
|
|
+ if(Objects.nonNull(houseTypeJson)) {
|
|
|
+ fYunFileService.uploadFile(scenePlusExt.getYunFileBucket(), houseTypeJson.toJSONString().getBytes(), editUserPath + "houseType.json");
|
|
|
+ }
|
|
|
+
|
|
|
+ SceneEditInfo sceneEditInfoDb = this.getByScenePlusId(scenePlus.getId());
|
|
|
+ this.update(new LambdaUpdateWrapper<SceneEditInfo>()
|
|
|
+ .setSql("version=version+" + 1)
|
|
|
+ .set(SceneEditInfo::getFloorPlanUser, 1)
|
|
|
+ .eq(SceneEditInfo::getId, sceneEditInfoDb.getId()));
|
|
|
+
|
|
|
+ SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfoDb.getId());
|
|
|
+ sceneEditInfoExt.setFloorPlanAngle(0f);
|
|
|
+ sceneEditInfoExt.setFloorPlanCompass(0f);
|
|
|
+ sceneEditInfoExtService.saveOrUpdate(sceneEditInfoExt);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("cad文件转换失败");
|
|
|
+ ResultData.error(ErrorCode.FAILURE_CODE_7013);
|
|
|
+ }finally {
|
|
|
+ FileUtil.del(dfxPath);
|
|
|
+ FileUtil.del(floorplanUserPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultData downloadDxf(String num, Integer subgroup) throws Exception {
|
|
|
+
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
+ SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
|
+ String ossFloorplanPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "floorplan.json";
|
|
|
+ if(Objects.nonNull(sceneEditInfo.getFloorPlanUser()) && sceneEditInfo.getFloorPlanUser() == CommonStatus.YES.code().intValue()){
|
|
|
+ ossFloorplanPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "floorplan.json";
|
|
|
+ }
|
|
|
+
|
|
|
+ String localFloorplan = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + ".json";
|
|
|
+ fYunFileService.downloadFile(scenePlusExt.getYunFileBucket(), ossFloorplanPath, localFloorplan);
|
|
|
+ String localDxf = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + ".dxf";
|
|
|
+ FdJsonToDxfUtil.fdJsonToDxf(localFloorplan, localDxf, subgroup);
|
|
|
+ String key = OssFileUtil.getUploadTempFileKey(null, "dxf");
|
|
|
+ fYunFileService.uploadFile(scenePlusExt.getYunFileBucket(), localDxf, key);
|
|
|
+ String url = fYunFileConfig.getHost() + key;
|
|
|
+
|
|
|
+ return ResultData.ok(url);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public ResultData resetCad(String num) throws IOException {
|
|
|
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
@@ -917,15 +1090,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
//查询是否存在等待中的异步操作记录,如果存在,抛出业务异常,终止操作
|
|
|
- this.checkSceneAsynOper(num, null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.PANORAMIC_IMAGE.code());
|
|
|
+ sceneAsynOperLogService.checkSceneAsynOper(num, null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.PANORAMIC_IMAGE.code());
|
|
|
|
|
|
//清除全景图异步操作记录,防止再次下载的时候请求到旧的压缩包
|
|
|
- sceneAsynOperLogService.remove(
|
|
|
- new LambdaQueryWrapper<SceneAsynOperLog>()
|
|
|
- .eq(SceneAsynOperLog::getNum, num)
|
|
|
- .eq(SceneAsynOperLog::getModule, SceneAsynModuleType.UPLOAD_DOWNLOAD.code())
|
|
|
- .eq(SceneAsynOperLog::getFunc, SceneAsynFuncType.PANORAMIC_IMAGE.code())
|
|
|
- );
|
|
|
+ sceneAsynOperLogService.cleanLog(num, SceneAsynModuleType.UPLOAD_DOWNLOAD.code(), SceneAsynFuncType.PANORAMIC_IMAGE.code());
|
|
|
|
|
|
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
@@ -1115,26 +1283,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
return ResultData.ok(uploadPanoramaVO);
|
|
|
}
|
|
|
|
|
|
- private void checkSceneAsynOper(String num, String operType, String module, String function){
|
|
|
- LambdaQueryWrapper<SceneAsynOperLog> queryWrapper =
|
|
|
- new LambdaQueryWrapper<SceneAsynOperLog>()
|
|
|
- .eq(SceneAsynOperLog::getNum,num)
|
|
|
- .eq(SceneAsynOperLog::getState, CommonOperStatus.WAITING.code());
|
|
|
- if(StrUtil.isNotEmpty(operType)){
|
|
|
- queryWrapper.eq(SceneAsynOperLog::getOperType, operType);
|
|
|
- }
|
|
|
- if(StrUtil.isNotEmpty(module)){
|
|
|
- queryWrapper.eq(SceneAsynOperLog::getModule, module);
|
|
|
- }
|
|
|
- if(StrUtil.isNotEmpty(function)){
|
|
|
- queryWrapper.eq(SceneAsynOperLog::getFunc, function);
|
|
|
- }
|
|
|
- List<SceneAsynOperLog> waittingLogList = sceneAsynOperLogService.list(queryWrapper);
|
|
|
- if(CollUtil.isNotEmpty(waittingLogList)){
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5066);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public void uploadPanoramaHandler(String num, String bucket, String target, String imgViewPath, List<String> uploadFileList, String targetImagesPath) throws Exception {
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
@@ -1228,7 +1376,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
//查询是否存在等待中的异步操作记录,如果存在,抛出业务异常,终止操作
|
|
|
- this.checkSceneAsynOper(num,null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.PANORAMIC_IMAGE.code());
|
|
|
+ sceneAsynOperLogService.checkSceneAsynOper(num,null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.PANORAMIC_IMAGE.code());
|
|
|
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
String bucket = scenePlusExt.getYunFileBucket();
|
|
@@ -1278,12 +1426,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
return ResultData.ok(map);
|
|
|
}else{
|
|
|
//清除旧的下载记录
|
|
|
- sceneAsynOperLogService.remove(
|
|
|
- new LambdaQueryWrapper<SceneAsynOperLog>()
|
|
|
- .eq(SceneAsynOperLog::getNum, num)
|
|
|
- .eq(SceneAsynOperLog::getOperType, SceneAsynOperType.DOWNLOAD.code())
|
|
|
- .eq(SceneAsynOperLog::getModule, SceneAsynModuleType.UPLOAD_DOWNLOAD.code())
|
|
|
- .eq(SceneAsynOperLog::getFunc, SceneAsynFuncType.PANORAMIC_IMAGE.code()));
|
|
|
+ sceneAsynOperLogService.cleanLog(num, SceneAsynModuleType.UPLOAD_DOWNLOAD.code(), SceneAsynFuncType.PANORAMIC_IMAGE.code(), SceneAsynOperType.DOWNLOAD.code());
|
|
|
|
|
|
//开始异步执行下载全景图压缩包操作
|
|
|
CompletableFuture.runAsync(() -> {
|
|
@@ -1398,7 +1541,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
|
|
|
|
//转换视频格式
|
|
|
- this.transferToFlv(param.getNum(), param.getFileName(), bucket);
|
|
|
+ commonService.transferToFlv(param.getNum(), param.getFileName(), bucket);
|
|
|
|
|
|
//生成boxVideos数据
|
|
|
String boxVideos = this.createBoxVideos(param.getNum(), sid, boxVideo, sceneEditInfo, OperationType.ADDORUPDATE.code());
|
|
@@ -2616,38 +2759,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private void transferToFlv(String num, String fileName, String bucket) throws Exception {
|
|
|
- ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
-
|
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
-
|
|
|
- String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
|
- String localImagesPath = String.format(scenePlusExt.getDataSource()+ConstantFileLocPath.SCENE_DATA_PATH_V4, num);
|
|
|
- String localFilePath = localImagesPath + fileName;
|
|
|
-
|
|
|
- File targetFile = new File(localImagesPath);
|
|
|
- if (!targetFile.exists()){
|
|
|
- targetFile.mkdirs();
|
|
|
- }
|
|
|
-
|
|
|
- targetFile = new File(localFilePath);
|
|
|
- if (targetFile.exists()){
|
|
|
- FileUtils.deleteFile(localFilePath);
|
|
|
- }
|
|
|
-
|
|
|
- //从用户编辑目录中下载视频到本地
|
|
|
- String filePath = userEditPath + fileName;
|
|
|
- ossUtil.downloadFile(bucket, filePath, localImagesPath + fileName);
|
|
|
-
|
|
|
- //视频格式转换
|
|
|
- MergeVideoUtil.ffmpegFormatFlv(localFilePath, localFilePath.replace("mp4", "flv"));
|
|
|
-
|
|
|
- //上传
|
|
|
- String flvFileName = fileName.replace("mp4", "flv");
|
|
|
- ossUtil.uploadFile(bucket,userEditPath+flvFileName, localFilePath.replace("mp4", "flv"), false);
|
|
|
- FileUtil.del(localFilePath);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public ResultData deleteMosaics(DeleteMosaicParamVO param) throws Exception {
|
|
|
|
|
@@ -2733,23 +2844,24 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
String key = String.format(RedisKey.SCENE_filter_DATA, param.getNum());
|
|
|
+ redisUtil.del(key);//前端将全量数据传过来,所以这里先清空历史数据,然后保存前端数据即可
|
|
|
JSONArray filterArr = JSON.parseArray(param.getData());
|
|
|
int filters = CommonStatus.YES.code();
|
|
|
- if(CollUtil.isEmpty(filterArr)){
|
|
|
+ //如果页面选择恢复默认,filters字段值为否
|
|
|
+ if(Objects.nonNull(param.getReset()) && param.getReset() == CommonStatus.YES.code().intValue()){
|
|
|
filters = CommonStatus.NO.code();
|
|
|
- redisUtil.del(key);
|
|
|
}else{
|
|
|
- List<String> filterList = filterArr.stream().map(item->JSON.toJSONString(item)).collect(Collectors.toList());
|
|
|
- redisUtil.lRightPushAll(key, filterList);
|
|
|
+ if(CollUtil.isNotEmpty(filterArr)){
|
|
|
+ List<String> filterList = filterArr.stream().map(item->JSON.toJSONString(item)).collect(Collectors.toList());
|
|
|
+ redisUtil.lRightPushAll(key, filterList);
|
|
|
+ }else{
|
|
|
+ filters = CommonStatus.NO.code();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//写本地文件,作为备份
|
|
|
this.writeFilter(param.getNum());
|
|
|
|
|
|
- //如果页面选择恢复默认,filters字段值为否
|
|
|
- if(Objects.nonNull(param.getReset()) && param.getReset() == CommonStatus.YES.code().intValue()){
|
|
|
- filters = CommonStatus.NO.code();
|
|
|
- }
|
|
|
|
|
|
//更新数据库
|
|
|
SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
|