|
@@ -106,9 +106,10 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
return Result.failure("houseId不能为空");
|
|
|
}
|
|
|
|
|
|
- Result resStatus = canEdit(houseId);
|
|
|
- if (resStatus != null) {
|
|
|
- return resStatus;
|
|
|
+// Result resStatus = canEdit(houseId);
|
|
|
+ if (!canEdit(houseId)) {
|
|
|
+ log.error("VR项目不可编辑");
|
|
|
+ return Result.failure(7005, "VR项目不可编辑");
|
|
|
}
|
|
|
|
|
|
// 判断图片类型
|
|
@@ -163,7 +164,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
// 压缩图片并上传oss
|
|
|
// 全景图缩略图统一命名规则: http:// oss/cms_pano_fcb/image/thumb_sceneCode.jpg
|
|
|
-
|
|
|
String iconPath = convertAndUploadOss(
|
|
|
panoPath, configConstant.filePath, configConstant.ossBasePath, configConstant.ossDomain, 600, 300, "image/thumb_"+sceneCode+".jpg");
|
|
|
log.info("iconPath:" + iconPath);
|
|
@@ -248,24 +248,26 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
* @param houseId
|
|
|
* @return
|
|
|
*/
|
|
|
- private Result canEdit(String houseId){
|
|
|
+ private boolean canEdit(String houseId){
|
|
|
Result result = null;
|
|
|
try {
|
|
|
- result = houseFeign.findByHouseId(houseId);
|
|
|
+ result = houseFeign.canEdit(houseId);
|
|
|
log.info("房车宝返回数据:{}", result);
|
|
|
if (result.getCode() == 0) {
|
|
|
boolean data = (boolean) result.getData();
|
|
|
if (data) {
|
|
|
log.info("vr项目可编辑");
|
|
|
- return Result.success();
|
|
|
+ return true;
|
|
|
} else {
|
|
|
log.info("vr项目不可编辑");
|
|
|
- return Result.failure(7005, "VR项目不可编辑");
|
|
|
+// throw new BaseRuntimeException(7005, "VR项目不可编辑");
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
log.error("VR项目接口查询失败:" + result.getMsg() );
|
|
|
- return Result.failure(7007, "VR项目接口查询失败");
|
|
|
+ throw new BaseRuntimeException(7007, "VR项目接口查询失败");
|
|
|
+// return Result.failure(7007, "VR项目接口查询失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -401,11 +403,14 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
// 检查VR项目状态
|
|
|
String houseId = param.getHouseId();
|
|
|
- Result resStatus = canEdit(houseId);
|
|
|
- if (resStatus != null) {
|
|
|
- return resStatus;
|
|
|
+// Result resStatus = canEdit(houseId);
|
|
|
+// if (resStatus != null) {
|
|
|
+// return resStatus;
|
|
|
+// }
|
|
|
+ if (!canEdit(houseId)) {
|
|
|
+ log.error("VR项目不可编辑");
|
|
|
+ return Result.failure(7005, "VR项目不可编辑");
|
|
|
}
|
|
|
-
|
|
|
SceneEntity entity = null;
|
|
|
|
|
|
if ( id == null) {
|
|
@@ -525,9 +530,9 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
if (n == 1) {
|
|
|
SceneEntity entity = this.findById(id);
|
|
|
String houseId = entity.getHouseId();
|
|
|
- Result resStatus = canEdit(houseId);
|
|
|
- if (resStatus != null) {
|
|
|
- return resStatus;
|
|
|
+ if (!canEdit(houseId)) {
|
|
|
+ log.error("VR项目不可编辑");
|
|
|
+ return Result.failure(7005, "VR项目不可编辑");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -673,11 +678,11 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
// 检查VR项目状态
|
|
|
String houseId = param.getHouseId();
|
|
|
String roomId = param.getRoomId();
|
|
|
- Result resStatus = canEdit(houseId);
|
|
|
- if (resStatus != null) {
|
|
|
- return resStatus;
|
|
|
- }
|
|
|
|
|
|
+ if (!canEdit(houseId)) {
|
|
|
+ log.error("VR项目不可编辑");
|
|
|
+ return Result.failure(7005, "VR项目不可编辑");
|
|
|
+ }
|
|
|
|
|
|
SceneEntity entity = null;
|
|
|
@NotBlank(message = "场景码不能为空") String sceneCode = param.getSceneCode();
|
|
@@ -709,8 +714,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
this.save(entity);
|
|
|
|
|
|
// 该VR项目下如果没有设置任何初始场景,把户型设置为默认初始场景
|
|
|
-// checkSceneInit(houseId, sceneCode);
|
|
|
- checkSceneInit(houseId, id);
|
|
|
+ checkSceneInit(houseId, entity.getId());
|
|
|
|
|
|
log.info("保存VR模型完成");
|
|
|
} else {
|
|
@@ -733,26 +737,11 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
SceneInitEntity entity = new SceneInitEntity();
|
|
|
entity.setId(RandomUtils.getUuid("init"));
|
|
|
entity.setHouseId(houseId);
|
|
|
-// entity.setSceneCode(sceneCode);
|
|
|
entity.setSceneId(id);
|
|
|
sceneInitService.save(entity);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 该VR项目下如果没有设置任何初始场景,把户型设置为默认初始场景
|
|
|
-// private void checkSceneInit(String houseId, String sceneCode){
|
|
|
-// List<SceneInitEntity> list = sceneInitService.findByHouseId(houseId);
|
|
|
-// if (list.size() == 0){
|
|
|
-// SceneInitEntity entity = new SceneInitEntity();
|
|
|
-// entity.setId(RandomUtils.getUuid("init"));
|
|
|
-// entity.setHouseId(houseId);
|
|
|
-// entity.setSceneCode(sceneCode);
|
|
|
-// sceneInitService.save(entity);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -769,9 +758,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);
|
|
|
SceneEntity entity = entityMapper.findByIdForUpdate(id);
|
|
|
if (entity == null) {
|
|
|
log.error("对象不存在,id : " + id);
|
|
@@ -781,37 +768,12 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
// 检查VR项目状态
|
|
|
String houseId = entity.getHouseId();
|
|
|
- Result resStatus = canEdit(houseId);
|
|
|
- if (resStatus != null) {
|
|
|
- return resStatus;
|
|
|
+ if (!canEdit(houseId)) {
|
|
|
+ log.error("VR项目不可编辑");
|
|
|
+ return Result.failure(7005, "VR项目不可编辑");
|
|
|
}
|
|
|
|
|
|
|
|
|
- // 注意网络下载会有缓存,必须加时间戳
|
|
|
- // http://ossxiaoan.4dage.com/cms_pano_fcb/p19/fcb_px2rJW96F/vtour/tour.xml
|
|
|
-// String tourOssUrl = entity.getOssPath() + "/vtour/tour.xml?m=" + System.currentTimeMillis();
|
|
|
-// log.info("网络下载文件地址: {}", tourOssUrl);
|
|
|
-// String fileName = "tour2.xml";
|
|
|
-// String filePath = entity.getPath();
|
|
|
-// String localBasePath = StringUtils.substringBeforeLast(filePath, "/");
|
|
|
-// FileUtils.downLoadFromUrl(tourOssUrl, fileName, localBasePath);
|
|
|
-// log.info("网络下载成功: {}", localBasePath+ "/tour2.xml");
|
|
|
-
|
|
|
- // 编辑xml, 修改初始角度
|
|
|
-// String inPath = localBasePath + "/tour2.xml";
|
|
|
-// String outPath = localBasePath + "/tour.xml";
|
|
|
-// 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);
|
|
|
-// 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", param.getHlookat());
|
|
@@ -847,11 +809,10 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
// 检查VR项目状态
|
|
|
String houseId = entity.getHouseId();
|
|
|
- Result resStatus = canEdit(houseId);
|
|
|
- if (resStatus != null) {
|
|
|
- return resStatus;
|
|
|
+ if (!canEdit(houseId)) {
|
|
|
+ log.error("VR项目不可编辑");
|
|
|
+ return Result.failure(7005, "VR项目不可编辑");
|
|
|
}
|
|
|
-
|
|
|
if (entity == null) {
|
|
|
log.error("场景不存在, id: " + id);
|
|
|
return Result.failure("场景不存在");
|