|
@@ -32,6 +32,7 @@ import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -107,8 +108,8 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
log.info("equalsIgnoreCase1:" + type.equalsIgnoreCase("jpg"));
|
|
|
log.info("equalsIgnoreCase2:" + type.equalsIgnoreCase("jpeg"));
|
|
|
|
|
|
- // png 需要转 jpg
|
|
|
- if (type.equalsIgnoreCase("png")) {
|
|
|
+ // 全景图只支持jpg图片格式
|
|
|
+ if (!type.equalsIgnoreCase("jpg")) {
|
|
|
log.error("图片格式错误,只支持jpg图片类型, type: " + type);
|
|
|
return Result.failure(7002, "只支持jpg图片类型");
|
|
|
}
|
|
@@ -133,15 +134,18 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
// 缩略图,使用切图那个thumb.jpg
|
|
|
// 压缩图片并上传oss
|
|
|
-// String iconPath = fileUtils.compressImgAndUploadOss2(panoPath, configConstant.ossBasePath, configConstant.ossDomain);
|
|
|
- String iconPath = fileUtils.compressImgAndUploadOss(panoPath, configConstant.ossBasePath, configConstant.ossDomain);
|
|
|
+ String iconPath = fileUtils.compressImgAndUploadOss2(panoPath, configConstant.ossBasePath, configConstant.ossDomain);
|
|
|
+// String iconPath = fileUtils.compressImgAndUploadOss(panoPath, configConstant.ossBasePath, configConstant.ossDomain);
|
|
|
|
|
|
entity.setIcon(iconPath);
|
|
|
entity.setStatus(1);
|
|
|
entity.setHouseId(houseId);
|
|
|
entity.setType(sceneType);
|
|
|
entity.setHengdaId(hengdaId);
|
|
|
- entity.setFileName(file.getOriginalFilename());
|
|
|
+ // 出来文件名不要后缀
|
|
|
+ String originalFilename = file.getOriginalFilename();
|
|
|
+ originalFilename = StringUtils.substringBeforeLast(originalFilename,".");
|
|
|
+ entity.setFileName(originalFilename);
|
|
|
entity.setSceneTitle(entity.getFileName());
|
|
|
|
|
|
// /hengda.html?m=场景码&prodId=房车宝楼盘ID&houseId=自己维护的楼盘ID
|
|
@@ -150,8 +154,9 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
entity.setWebSite(webSite);
|
|
|
|
|
|
// 设置初始场景
|
|
|
- SceneEntity index = entityMapper.getIndex(houseId);
|
|
|
- if (index == null) {
|
|
|
+// SceneEntity index = entityMapper.getIndex(houseId);
|
|
|
+ List<SceneEntity> index = entityMapper.getIndex(houseId);
|
|
|
+ if (index.size() == 0) {
|
|
|
log.info("需要设置更新场景码到VR项目");
|
|
|
entity.setIsIndex(1);
|
|
|
|
|
@@ -181,40 +186,19 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
return Result.success(entity);
|
|
|
}
|
|
|
|
|
|
|
|
|
- public String compressImgAndUploadOss(String cmd) throws IOException, InterruptedException {
|
|
|
- // openCV生成缩略图
|
|
|
- CmdUtils.cmdThumb(cmd);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
@Test
|
|
|
public void test2(){
|
|
|
- String type = "jpg";
|
|
|
- System.out.println(type.equalsIgnoreCase("jpg"));
|
|
|
+ String type = "aa.jpg";
|
|
|
+ System.out.println(StringUtils.substringBeforeLast(type, "."));
|
|
|
System.out.println(type.equalsIgnoreCase("jpeg"));
|
|
|
|
|
|
- if (!type.equalsIgnoreCase("jpg")) {
|
|
|
- log.info("111111111");
|
|
|
- }
|
|
|
|
|
|
- if (!type.equalsIgnoreCase("jpeg")) {
|
|
|
- log.info("2222222");
|
|
|
- }
|
|
|
-
|
|
|
- if (!type.equalsIgnoreCase("jpeg") || !type.equalsIgnoreCase("jpg")) {
|
|
|
- log.info("33333");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -302,7 +286,11 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
@Override
|
|
|
public Result getIndex(String houseId) {
|
|
|
- return Result.success(entityMapper.getIndex(houseId));
|
|
|
+ List<SceneEntity> index = entityMapper.getIndex(houseId);
|
|
|
+ if (index.size() == 0) {
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+ return Result.success(index.get(0));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -310,6 +298,25 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
return Result.success(entityMapper.findByHouseId(houseId));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result setSort(Map<String, String> param) {
|
|
|
+ log.info("sort size: " + param.size());
|
|
|
+ for (Map.Entry<String, String> m : param.entrySet()) {
|
|
|
+ String id = m.getKey();
|
|
|
+ String sort = m.getValue();
|
|
|
+ log.info("id: " + id);
|
|
|
+ log.info("sort: " + sort);
|
|
|
+ entityMapper.setSortById(id, sort);
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getVrSceneCode(String houseId, String status, String type) {
|
|
|
+ return Result.success(entityMapper.getVrSceneCode(houseId, status, type));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 添加VR模型
|
|
|
* @return
|
|
@@ -318,6 +325,8 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
public Result findVrModel(SceneRroPageDto param) {
|
|
|
// TODO: 2021/1/8 0008 查找4dkk场景数据,当前区域公司下的模型
|
|
|
@NotBlank(message = "token不能为空") String token = param.getToken();
|
|
|
+ // 只获取计算成功的, 0:计算成功
|
|
|
+ param.setStatus("0");
|
|
|
Result result = sceneProFeign.findByList(param, token);
|
|
|
|
|
|
// 过滤已添加的数据
|
|
@@ -334,10 +343,10 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
for (Object o : list) {
|
|
|
JSONObject scenePro = JSON.parseObject(o.toString());
|
|
|
String sceneProId = scenePro.getString("id");
|
|
|
-// SceneEntity vrModelId = entityMapper.findByVrModelId(sceneProId);
|
|
|
- SceneEntity vrModelId = entityMapper.findByVrModelIdAndHouseId(sceneProId, param.getHouseId());
|
|
|
+ List<SceneEntity> vrModelId = entityMapper.findByVrModelId2(sceneProId);
|
|
|
+// SceneEntity vrModelId = entityMapper.findByVrModelIdAndHouseId(sceneProId, param.getHouseId());
|
|
|
String use = "0";
|
|
|
- if (vrModelId != null) {
|
|
|
+ if (vrModelId.size() > 0) {
|
|
|
use = "1";
|
|
|
}
|
|
|
|
|
@@ -364,16 +373,21 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
String id = param.getId();
|
|
|
log.info("id: "+ id);
|
|
|
SceneEntity entity = null;
|
|
|
+
|
|
|
+ List<SceneEntity> index = entityMapper.getIndex(param.getHouseId());
|
|
|
+
|
|
|
if ( id == null) {
|
|
|
entity = entityMapper.findByVrModelIdAndHouseId(param.getVrModelId(), param.getHouseId());
|
|
|
if (entity != null){
|
|
|
log.error("VrModelId已存在");
|
|
|
return Result.failure(3001, "场景码已存在, 不能重复添加");
|
|
|
-
|
|
|
}
|
|
|
|
|
|
entity = new SceneEntity();
|
|
|
BeanUtils.copyProperties(param, entity);
|
|
|
+ if (index.size() == 0) {
|
|
|
+ entity.setIsIndex(1);
|
|
|
+ }
|
|
|
entity.setId(RandomUtils.getUuid());
|
|
|
entity.setType("house");
|
|
|
entity.setStatus(3);
|
|
@@ -382,6 +396,9 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
} else {
|
|
|
entity = this.findById(id);
|
|
|
BeanUtils.copyProperties(param, entity);
|
|
|
+ if (index.size() == 0) {
|
|
|
+ entity.setIsIndex(1);
|
|
|
+ }
|
|
|
entity.setUpdateTime(new Date());
|
|
|
this.update(entity);
|
|
|
log.info("更新VR模型完成");
|
|
@@ -440,6 +457,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
@Override
|
|
|
public Result editXml(XmlDataDto param) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
String id = param.getId();
|
|
|
SceneEntity entity = findById(id);
|
|
|
if (entity == null) {
|
|
@@ -459,13 +477,25 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
// 编辑xml, 修改初始角度
|
|
|
String inPath = localBasePath + "/tour2.xml";
|
|
|
String outPath = localBasePath + "/tour.xml";
|
|
|
- streamEditFile(inPath, outPath, param.getHlookat(), param.getVlookat());
|
|
|
+ String hlookat = param.getHlookat();
|
|
|
+ String vlookat = param.getVlookat();
|
|
|
+ streamEditFile(inPath, outPath, hlookat, vlookat);
|
|
|
log.info("编辑xml, 修改初始角度完毕");
|
|
|
|
|
|
String tourOssSavePath = configConstant.ossBasePath + entity.getHouseId() + "/" + entity.getSceneCode() + "/vtour/tour.xml";
|
|
|
log.info("osspath: " + tourOssSavePath);
|
|
|
- asyncTask.uploadOss(outPath, tourOssSavePath);
|
|
|
- log.info("tour.xml 上传oss完成");
|
|
|
+ aliyunOssUtil.upload(outPath, tourOssSavePath);
|
|
|
+// asyncTask.uploadOss(outPath, tourOssSavePath);
|
|
|
+ long end = System.currentTimeMillis();
|
|
|
+ log.info("tour.xml 上传oss完成, 共耗时: " + (end-start)/1000 + " s");
|
|
|
+
|
|
|
+ // 保存初始视觉
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("hlookat", hlookat);
|
|
|
+ jsonObject.put("vlookat", vlookat);
|
|
|
+ entity.setInitVisual(jsonObject.toJSONString());
|
|
|
+ this.update(entity);
|
|
|
+
|
|
|
|
|
|
|
|
|
return Result.success(entity.getOssPath());
|