|
@@ -90,7 +90,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
// 文件名不能为空
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
- originalFilename = StringUtils.substringBeforeLast(originalFilename,".");
|
|
|
+ originalFilename = StringUtils.substringBeforeLast(originalFilename, ".");
|
|
|
if (StringUtils.isAllBlank(originalFilename)) {
|
|
|
return Result.failure("文件名不能为空");
|
|
|
}
|
|
@@ -163,7 +163,7 @@ 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");
|
|
|
+ panoPath, configConstant.filePath, configConstant.ossBasePath, configConstant.ossDomain, 600, 300, "image/thumb_" + sceneCode + ".jpg");
|
|
|
log.info("iconPath:" + iconPath);
|
|
|
entity.setIcon(iconPath);
|
|
|
entity.setStatus(1);
|
|
@@ -177,7 +177,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
entity.setSceneTitle(entity.getFileName());
|
|
|
|
|
|
// /hengda.html?m=场景码&prodId=房车宝楼盘ID&houseId=自己维护的楼盘ID
|
|
|
- String webSite = "/hengda.html?m="+ sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
|
|
|
+ String webSite = "/hengda.html?m=" + sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
|
|
|
log.info("webSite: " + webSite);
|
|
|
entity.setWebSite(webSite);
|
|
|
|
|
@@ -187,7 +187,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
rabbitTemplate.convertAndSend(RabbitConfig.PANO_EXCHANGE, RabbitConfig.PANO_QUEUE_ROUTING, entity.getId());
|
|
|
log.info("全景图入队成功: 场景码:{},场景id:{} ", sceneCode, entity.getId());
|
|
|
|
|
|
- } catch (Exception e) {
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
log.info("全景图上传完成:{}", sceneCode);
|
|
@@ -198,13 +198,14 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
/**
|
|
|
* 2021-04-27
|
|
|
* 使用convert 生成缩略图
|
|
|
+ *
|
|
|
* @param inputFilePath
|
|
|
* @param ossBasePath
|
|
|
* @param ossDomain
|
|
|
* @return
|
|
|
*/
|
|
|
- public String convertAndUploadOss(
|
|
|
- String inputFilePath, String serverBasePath, String ossBasePath, String ossDomain, Integer width, Integer height, String fileName){
|
|
|
+ public String convertAndUploadOss(
|
|
|
+ String inputFilePath, String serverBasePath, String ossBasePath, String ossDomain, Integer width, Integer height, String fileName) {
|
|
|
|
|
|
// 保存图片位置
|
|
|
String saveCompressImgPath = serverBasePath + fileName;
|
|
@@ -222,7 +223,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
if (FileUtil.isFile(saveCompressImgPath)) {
|
|
|
// 上传oss
|
|
|
- String ossPath = ossBasePath + fileName;
|
|
|
+ String ossPath = ossBasePath + fileName;
|
|
|
log.info("ossPath: " + ossPath);
|
|
|
asyncTask.uploadOss(saveCompressImgPath, ossPath);
|
|
|
ossUrl = ossDomain + ossPath;
|
|
@@ -239,15 +240,15 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 查询VR项目是否可编辑
|
|
|
* true: 可编辑
|
|
|
* false: 不可编辑
|
|
|
+ *
|
|
|
* @param houseId
|
|
|
* @return
|
|
|
*/
|
|
|
- private boolean canEdit(String houseId){
|
|
|
+ private boolean canEdit(String houseId) {
|
|
|
Result result = null;
|
|
|
try {
|
|
|
result = houseFeign.canEdit(houseId);
|
|
@@ -259,14 +260,12 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
return true;
|
|
|
} else {
|
|
|
log.info("vr项目不可编辑");
|
|
|
-// throw new BaseRuntimeException(7005, "VR项目不可编辑");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- log.error("VR项目接口查询失败:" + result.getMsg() );
|
|
|
+ log.error("VR项目接口查询失败:" + result.getMsg());
|
|
|
throw new BaseRuntimeException(7007, "VR项目接口查询失败");
|
|
|
-// return Result.failure(7007, "VR项目接口查询失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -310,15 +309,13 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
// }
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public Result search(ScenePageDto param) {
|
|
|
startPage(param);
|
|
|
List<SceneEntity> search = null;
|
|
|
|
|
|
- // TODO: 2021/1/8 0008 调用720云数据
|
|
|
- search = entityMapper.search(param);
|
|
|
+ // TODO: 2021/1/8 0008 调用720云数据
|
|
|
+ search = entityMapper.search(param);
|
|
|
PageInfo<SceneEntity> page = new PageInfo<>(search);
|
|
|
log.info("page size: " + page.getSize());
|
|
|
log.info("page total: " + page.getTotal());
|
|
@@ -364,7 +361,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
// 使用foreach遍历,for循环容易导致数据有误
|
|
|
if (!list.isEmpty()) {
|
|
|
- for (SceneEntity sceneEntity: list) {
|
|
|
+ for (SceneEntity sceneEntity : list) {
|
|
|
String byType = sceneEntity.getByType();
|
|
|
String sceneCode = sceneEntity.getSceneCode();
|
|
|
String houseId = sceneEntity.getHouseId();
|
|
@@ -394,27 +391,22 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Result saveGardenVrModel(GardenVrModelDto param) {
|
|
|
String id = param.getId();
|
|
|
- log.info("id: "+ id);
|
|
|
+ log.info("id: " + id);
|
|
|
|
|
|
// 检查VR项目状态
|
|
|
String houseId = param.getHouseId();
|
|
|
-// 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) {
|
|
|
+ if (id == null) {
|
|
|
entity = entityMapper.findByVrModelIdAndHouseId(param.getVrModelId(), param.getHouseId());
|
|
|
- if (entity != null){
|
|
|
+ if (entity != null) {
|
|
|
log.error("VrModelId已存在");
|
|
|
return Result.failure(3001, "场景码已存在, 不能重复添加");
|
|
|
}
|
|
@@ -423,7 +415,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
@NotBlank(message = "场景码不能为空") String sceneCode = param.getSceneCode();
|
|
|
@NotBlank(message = "恒大id不能为空") String hengdaId = param.getHengdaId();
|
|
|
- String webSite = "/hengda.html?m="+ sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
|
|
|
+ String webSite = "/hengda.html?m=" + sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(param, entity);
|
|
@@ -465,12 +457,52 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
if (entity == null) {
|
|
|
return Result.failure("场景不存在:" + id);
|
|
|
}
|
|
|
+
|
|
|
+ // 检查VR项目状态
|
|
|
+ String houseId = entity.getHouseId();
|
|
|
+ if (!canEdit(houseId)) {
|
|
|
+ log.error("VR项目不可编辑");
|
|
|
+ return Result.failure(7005, "VR项目不可编辑");
|
|
|
+ }
|
|
|
+
|
|
|
entity.setAgentId(param.getAgentId());
|
|
|
entity.setUpdateTime(new Date());
|
|
|
this.update(entity);
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result remove(String id) {
|
|
|
+ SceneEntity entity = this.findById(id);
|
|
|
+ if (entity.getStatus() == 1) {
|
|
|
+ return Result.failure(7004, "执行中的任务不能删除");
|
|
|
+
|
|
|
+ }
|
|
|
+ String sceneCode = entity.getSceneCode();
|
|
|
+ String houseId = entity.getHouseId();
|
|
|
+
|
|
|
+ // 检查VR项目状态
|
|
|
+ if (!canEdit(houseId)) {
|
|
|
+ log.error("VR项目不可编辑");
|
|
|
+ return Result.failure(7005, "VR项目不可编辑");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询热点关联场景
|
|
|
+ List<SceneEntity> list = this.searchUseHots(houseId, sceneCode);
|
|
|
+ log.info("关联热点场景数量: " + list.size());
|
|
|
+ if (list.size() > 0) {
|
|
|
+ return Result.failure(7008, "有关联热点场景使用此场景,不能删除");
|
|
|
+ }
|
|
|
+
|
|
|
+ entity.setIsDelete(1);
|
|
|
+ entity.setUpdateTime(new Date());
|
|
|
+ this.update(entity);
|
|
|
+ // 处理初始场景
|
|
|
+ sceneInitService.removeByHouseIdAndSceneId(houseId, id);
|
|
|
+
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Result saveUseHots(UseHotsDto param) {
|
|
@@ -486,20 +518,19 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
entity.setUseHots(jsonObject.toJSONString());
|
|
|
entity.setUpdateTime(new Date());
|
|
|
this.update(entity);
|
|
|
- return Result.success() ;
|
|
|
+ return Result.success();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<SceneEntity> searchUseHots(String houseId, String sceneCode) {
|
|
|
- sceneCode = "%"+sceneCode+"%";
|
|
|
+ sceneCode = "%" + sceneCode + "%";
|
|
|
return entityMapper.searchUseHots(houseId, sceneCode);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 检查是否有计算中的场景
|
|
|
+ *
|
|
|
* @param houseId
|
|
|
* @param status
|
|
|
* @return true: 有, false:没有
|
|
@@ -514,7 +545,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Result findByHouseId(String houseId) {
|
|
|
return Result.success(entityMapper.findByHouseId(houseId));
|
|
@@ -539,7 +569,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
log.info("id: " + id);
|
|
|
log.info("sort: " + sort);
|
|
|
entityMapper.setSortById(id, sort);
|
|
|
- n ++;
|
|
|
+ n++;
|
|
|
}
|
|
|
|
|
|
return Result.success();
|
|
@@ -549,7 +579,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
public Result getVrSceneCode(String houseId, String status, String type) {
|
|
|
// 需要把状态 3:审查中, 4:审核通过的数据都返回
|
|
|
List<String> vrSceneCode = entityMapper.getVrSceneCode(houseId, status, type);
|
|
|
- log.info("返回给恒大管理后台数据: " + vrSceneCode);
|
|
|
+ log.info("返回给恒大管理后台数据: " + vrSceneCode);
|
|
|
|
|
|
return Result.success(vrSceneCode);
|
|
|
}
|
|
@@ -604,11 +634,9 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 添加VR模型
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -618,7 +646,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
// 只获取计算成功的, 0:计算成功
|
|
|
param.setStatus("0");
|
|
|
String searchKey = param.getSearchKey();
|
|
|
- if (StringUtils.isNotBlank(searchKey)){
|
|
|
+ if (StringUtils.isNotBlank(searchKey)) {
|
|
|
param.setSceneName(searchKey);
|
|
|
}
|
|
|
|
|
@@ -668,11 +696,10 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Result saveVrModel(VrModelDto param) {
|
|
|
String id = param.getId();
|
|
|
- log.info("id: "+ id);
|
|
|
+ log.info("id: " + id);
|
|
|
|
|
|
// 检查VR项目状态
|
|
|
String houseId = param.getHouseId();
|
|
@@ -686,21 +713,20 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
SceneEntity entity = null;
|
|
|
@NotBlank(message = "场景码不能为空") String sceneCode = param.getSceneCode();
|
|
|
@NotBlank(message = "恒大id不能为空") String hengdaId = param.getHengdaId();
|
|
|
- String webSite = "/hengda.html?m="+ sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
|
|
|
-
|
|
|
+ String webSite = "/hengda.html?m=" + sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
|
|
|
|
|
|
|
|
|
- if ( id == null) {
|
|
|
+ if (id == null) {
|
|
|
|
|
|
// 一个VR项目不能有相同的户型
|
|
|
List<SceneEntity> sceneEntities = entityMapper.findByHouseIdAndRoomId(houseId, roomId);
|
|
|
if (sceneEntities.size() > 0) {
|
|
|
- return Result.failure(MsgCode.e3002,"户型已存在,不能重复添加");
|
|
|
+ return Result.failure(MsgCode.e3002, "户型已存在,不能重复添加");
|
|
|
}
|
|
|
|
|
|
// 一个VR项目不能有相同的模型
|
|
|
- entity = entityMapper.findByVrModelIdAndHouseId(param.getVrModelId(), houseId);
|
|
|
- if (entity != null){
|
|
|
+ entity = entityMapper.findByVrModelIdAndHouseId(param.getVrModelId(), houseId);
|
|
|
+ if (entity != null) {
|
|
|
log.error("VrModelId已存在");
|
|
|
return Result.failure(MsgCode.e3001, "场景码已存在, 不能重复添加");
|
|
|
}
|
|
@@ -733,9 +759,9 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
|
|
|
|
|
|
// 该VR项目下如果没有设置任何初始场景,把户型设置为默认初始场景
|
|
|
- private void checkSceneInit(String houseId, String id){
|
|
|
+ private void checkSceneInit(String houseId, String id) {
|
|
|
List<SceneInitEntity> list = sceneInitService.findByHouseId(houseId);
|
|
|
- if (list.size() == 0){
|
|
|
+ if (list.size() == 0) {
|
|
|
SceneInitEntity entity = new SceneInitEntity();
|
|
|
entity.setId(RandomUtils.getUuid("init"));
|
|
|
entity.setHouseId(houseId);
|
|
@@ -745,7 +771,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Result upload(MultipartFile file) {
|
|
|
|
|
@@ -788,7 +813,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public SceneEntity findBySceneCode(String sceneCode) {
|
|
|
return entityMapper.findBySceneCode(sceneCode);
|