|
@@ -7,22 +7,28 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.common.constant.*;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
+import com.fdkankan.common.util.DateUtil;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
+import com.fdkankan.fyun.config.FYunFileConfig;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.model.utils.ComputerUtil;
|
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
import com.fdkankan.openApi.bean.www.SceneJsonBean;
|
|
|
+import com.fdkankan.openApi.common.PageInfo;
|
|
|
import com.fdkankan.openApi.entity.www.*;
|
|
|
import com.fdkankan.openApi.mapper.www.IScenePlusMapper;
|
|
|
import com.fdkankan.openApi.service.www.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.openApi.vo.www.CreateFicTitiousSceneParamVO;
|
|
|
import com.fdkankan.openApi.vo.www.SceneEditControlsVO;
|
|
|
+import com.fdkankan.openApi.vo.www.SceneVO;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
@@ -31,9 +37,8 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.File;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -65,6 +70,12 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
@Autowired
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICameraService cameraService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FYunFileConfig fYunFileConfig;
|
|
|
+
|
|
|
@Override
|
|
|
public ScenePlus getByNum(String num) {
|
|
|
return this.getOne(new LambdaQueryWrapper<ScenePlus>().eq(ScenePlus::getNum, num));
|
|
@@ -278,7 +289,48 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
return scenePlusExt.getWebSite();
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- FileUtil.del("D:\\test4\\");
|
|
|
+ @Override
|
|
|
+ public PageInfo<SceneVO> getScenesByUserId(Integer userId,Integer pageNum,Integer pageSize) {
|
|
|
+ LambdaQueryWrapper<ScenePlus> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(ScenePlus::getUserId,userId);
|
|
|
+ Map<Long, String> cameraMap = cameraService.list().stream().collect(Collectors.toMap(Camera::getId, Camera::getSnCode));
|
|
|
+ Page<ScenePlus> scenePage = this.page(new Page<>(pageNum, pageSize), queryWrapper);
|
|
|
+ List<SceneVO> sceneVos = scenePage.getRecords().stream().map(scenePlus -> {
|
|
|
+ SceneVO vo = new SceneVO();
|
|
|
+ vo.setSceneCode(scenePlus.getNum());
|
|
|
+ vo.setSceneName(scenePlus.getTitle());
|
|
|
+ vo.setCreateTime(DateUtil.date2String(scenePlus.getCreateTime(), null));
|
|
|
+ ScenePlusExt plusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
+ vo.setShootCount(plusExt.getShootCount());
|
|
|
+ vo.setSnCode(cameraMap.get(scenePlus.getCameraId()));
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return PageInfo.PageInfo(scenePage.getCurrent(),scenePage.getSize(),scenePage.getTotal(),sceneVos);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object getPointInfo(String sceneCode) {
|
|
|
+ // 获取vision.txt 文件内容返回
|
|
|
+ String content = fYunFileService.getFileContent(String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode));
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
+ return jsonObject.get("sweepLocations");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<String> getSceneObjFilePaths(String sceneCode) {
|
|
|
+ List<String> objFiles = fYunFileService.listRemoteFiles(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode).concat("mesh"))
|
|
|
+ .stream().map(file -> fYunFileConfig.getHost() + file).collect(Collectors.toList());
|
|
|
+ return objFiles;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<String> getScenePanoramicImageFiles(String sceneCode) {
|
|
|
+ // 根据vision.txt 获取全景图文件
|
|
|
+ String content = fYunFileService.getFileContent(String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode));
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
+ return jsonObject.getJSONArray("sweepLocations").stream()
|
|
|
+ .map(json -> String.format(fYunFileConfig.getHost()
|
|
|
+ + UploadFilePath.scene_result_data_path, sceneCode).concat("caches/images/")
|
|
|
+ + ((JSONObject) json).getString("uuid").concat(".jpg")).collect(Collectors.toList());
|
|
|
}
|
|
|
}
|