|
@@ -1,5 +1,6 @@
|
|
|
package com.fdkk.sxz.webApi.controller;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -12,6 +13,7 @@ import com.fdkk.sxz.annotation.log.AroundLog;
|
|
|
import com.fdkk.sxz.base.BaseController;
|
|
|
import com.fdkk.sxz.base.Result;
|
|
|
import com.fdkk.sxz.constant.CodeConstant;
|
|
|
+import com.fdkk.sxz.entity.SceneEntity;
|
|
|
import com.fdkk.sxz.entity.SceneLightEntity;
|
|
|
import com.fdkk.sxz.entity.SceneStyleEntity;
|
|
|
import com.fdkk.sxz.other.mq.TopicRabbitConfig;
|
|
@@ -59,7 +61,8 @@ public class ImportDataController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private ISceneStyleService sceneStyleService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ISceneService sceneService;
|
|
|
@Autowired
|
|
|
private ISceneLightService sceneLightService;
|
|
|
|
|
@@ -133,8 +136,11 @@ public class ImportDataController extends BaseController {
|
|
|
} else {
|
|
|
ImportDataController.log.info("roamingPoint,不存在");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ SceneEntity sceneEntity = sceneService.findBySceneNum(sceneNum);
|
|
|
+ if (ObjectUtil.isNotNull(sceneEntity) && StrUtil.isNotEmpty(roamingPointUrl)) {
|
|
|
+ sceneEntity.setRoamingPointUrl(roamingPointUrl);
|
|
|
+ sceneService.updateById(sceneEntity);
|
|
|
+ }
|
|
|
if (StringUtils.isEmpty(styleNum)) {
|
|
|
Integer num = sceneStyleService.findLastNum(sceneNum);
|
|
|
if (num == null) {
|
|
@@ -149,7 +155,6 @@ public class ImportDataController extends BaseController {
|
|
|
sceneStyleEntity.setSceneNum(sceneNum);
|
|
|
sceneStyleEntity.setStyleName(styleName);
|
|
|
sceneStyleEntity.setStyleNum(vrNum);
|
|
|
- sceneStyleEntity.setRoamingPointUrl(roamingPointUrl);
|
|
|
//新生成的换装风格,未渲染
|
|
|
sceneStyleEntity.setStatus(2);
|
|
|
sceneStyleService.save(sceneStyleEntity);
|
|
@@ -161,7 +166,6 @@ public class ImportDataController extends BaseController {
|
|
|
if (list != null && list.size() > 0) {
|
|
|
SceneStyleEntity sceneStyleEntity = list.get(0);
|
|
|
sceneStyleEntity.setStyleName(styleName);
|
|
|
- sceneStyleEntity.setRoamingPointUrl(roamingPointUrl);
|
|
|
sceneStyleService.updateById(sceneStyleEntity);
|
|
|
}
|
|
|
}
|
|
@@ -469,10 +473,6 @@ public class ImportDataController extends BaseController {
|
|
|
@NoAuthentication
|
|
|
@AroundLog(name = "测试运行命令")
|
|
|
public String fbxToObj(String fbxPath, String objPath) throws Exception {
|
|
|
-// String command = "D:/OneKeyDecorate/StartDecorate.exe -s " + vrNum;
|
|
|
-// log.info("开始建模:" + command);
|
|
|
-// RunCmdUtil.callshell(command);
|
|
|
-// log.info("计算完毕:" + command);
|
|
|
String filePth = fbxPath.substring(0, fbxPath.lastIndexOf(File.pathSeparator) + 1);
|
|
|
String fbxName = fbxPath.substring(fbxPath.lastIndexOf(File.pathSeparator) + 1);
|
|
|
CreateObjUtil.fbxToObj(filePth, fbxName, objPath);
|
|
@@ -480,6 +480,22 @@ public class ImportDataController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 根据场景编码获取处理后的漫游点数据
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("根据场景编码获取处理后的漫游点数据")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")})
|
|
|
+ @RequestMapping(value = "/getRoamingPointByNum", method = RequestMethod.POST)
|
|
|
+ @NoAuthentication
|
|
|
+ @AroundLog(name = "根据场景编码获取处理后的漫游点数据")
|
|
|
+ public Result getRoamingPointByNum(String num) {
|
|
|
+ SceneEntity sceneEntity = sceneService.findBySceneNum(num);
|
|
|
+ return Result.success(sceneEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 生成房型数据
|
|
|
*
|
|
|
* @param num
|
|
@@ -534,24 +550,37 @@ public class ImportDataController extends BaseController {
|
|
|
if (sweepArray != null && sweepArray.size() > 0) {
|
|
|
entryJson.put("noSetting", sweepArray.getJSONObject(0));
|
|
|
//处理漫游点供前端使用
|
|
|
- List<JSONObject> roamingPoint = new ArrayList();
|
|
|
- for (int i = 0; i < sweepArray.size(); i++) {
|
|
|
- JSONObject objectJson = sweepArray.getJSONObject(i);
|
|
|
- JSONObject newJson = new JSONObject();
|
|
|
- newJson.put("uuid", objectJson.getString("uuid"));
|
|
|
- JSONObject puck = objectJson.getJSONObject("puck");
|
|
|
- puck.put("y", puck.getDoubleValue("y") * -1);
|
|
|
- puck.remove("z");
|
|
|
- newJson.put("puck", puck);
|
|
|
- newJson.put("subgroup", objectJson.getInteger("subgroup"));
|
|
|
- roamingPoint.add(newJson);
|
|
|
+ SceneEntity sceneEntity = sceneService.findBySceneNum(num);
|
|
|
+ if (ObjectUtil.isNotNull(sceneEntity)) {
|
|
|
+ List<JSONObject> roamingPoint = new ArrayList();
|
|
|
+ for (int i = 0; i < sweepArray.size(); i++) {
|
|
|
+ JSONObject objectJson = sweepArray.getJSONObject(i);
|
|
|
+ JSONObject newJson = new JSONObject();
|
|
|
+ newJson.put("uuid", objectJson.getString("uuid"));
|
|
|
+ JSONObject puck = objectJson.getJSONObject("puck");
|
|
|
+ puck.put("y", puck.getDoubleValue("y") * -1);
|
|
|
+ puck.remove("z");
|
|
|
+ newJson.put("puck", puck);
|
|
|
+ newJson.put("subgroup", objectJson.getInteger("subgroup"));
|
|
|
+ roamingPoint.add(newJson);
|
|
|
+ }
|
|
|
+ Map<Integer, List<JSONObject>> subgroup = roamingPoint.stream().collect(
|
|
|
+ Collectors.groupingBy(x -> x.getInteger("subgroup")));
|
|
|
+ FileUtils.writeFile(basePath + File.separator + "roamingPoint.json", JSON.toJSONString(subgroup));
|
|
|
+ //数据上传oss,让计算服务器下载资源
|
|
|
+ uploadToOssUtil.upload(basePath + File.separator + "roamingPoint.json",
|
|
|
+ "data/data" + num + "/roamingPoint.json");
|
|
|
+ sceneEntity.setSceneNum(num);
|
|
|
+ String roamingPointUrl = "";
|
|
|
+ Boolean existRoamingPoint = uploadToOssUtil.existFileToOSS("data/data" + num + "/roamingPoint.json", "4dkankan");
|
|
|
+ if (existRoamingPoint) {
|
|
|
+ roamingPointUrl = "https://4dkk.4dage.com/data/data" + num + "/roamingPoint.json";
|
|
|
+ } else {
|
|
|
+ ImportDataController.log.info("roamingPoint,不存在");
|
|
|
+ }
|
|
|
+ sceneEntity.setRoamingPointUrl(roamingPointUrl);
|
|
|
+ sceneService.save(sceneEntity);
|
|
|
}
|
|
|
- Map<Integer, List<JSONObject>> subgroup = roamingPoint.stream().collect(
|
|
|
- Collectors.groupingBy(x -> x.getInteger("subgroup")));
|
|
|
- FileUtils.writeFile(basePath + File.separator + "roamingPoint.json", JSON.toJSONString(subgroup));
|
|
|
- //数据上传oss,让计算服务器下载资源
|
|
|
- uploadToOssUtil.upload(basePath + File.separator + "roamingPoint.json",
|
|
|
- "data/data" + num + "/roamingPoint.json");
|
|
|
}
|
|
|
}
|
|
|
} else {
|