|
@@ -2,6 +2,7 @@ package com.gis.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.gis.common.exception.BaseRuntimeException;
|
|
|
import com.gis.common.util.Result;
|
|
|
import com.gis.domain.dto.EditHouseDto;
|
|
|
import com.gis.domain.dto.HouseDto;
|
|
@@ -14,7 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -40,7 +43,7 @@ public class HouseServiceImpl implements HouseService {
|
|
|
if (entityList.size() > 0) {
|
|
|
flag = true;
|
|
|
}
|
|
|
- log.info("是否有计算中的场景: " + flag);
|
|
|
+ log.info("提审是否有计算中的场景: " + flag);
|
|
|
return Result.success(flag);
|
|
|
}
|
|
|
|
|
@@ -54,7 +57,7 @@ public class HouseServiceImpl implements HouseService {
|
|
|
|
|
|
// 检查VR项目状态
|
|
|
String houseId = param.getHouseId();
|
|
|
- Result resStatus = getHouseStatus(houseId);
|
|
|
+ Result resStatus = canEdit(houseId);
|
|
|
if (resStatus != null) {
|
|
|
return resStatus;
|
|
|
}
|
|
@@ -88,43 +91,103 @@ public class HouseServiceImpl implements HouseService {
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result statistics(String houseId) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+
|
|
|
+ // 航拍数量:building, 观景图数量:garden, 售楼处数量:sales, 样本间数量:house
|
|
|
+
|
|
|
+ Integer buildingCount = entityMapper.countByType(houseId, "building");
|
|
|
+ Integer gardenCount = entityMapper.countByType(houseId, "garden");
|
|
|
+ Integer salesCount = entityMapper.countByType(houseId, "sales");
|
|
|
+ Integer houseCount = entityMapper.countByType(houseId, "house");
|
|
|
+
|
|
|
+
|
|
|
+ // 航拍数量(building)
|
|
|
+ result.put("building", buildingCount);
|
|
|
+ // 观景图数量
|
|
|
+ result.put("garden", gardenCount);
|
|
|
+ // 售楼处数量
|
|
|
+ result.put("sales", salesCount);
|
|
|
+ // 样本间数量
|
|
|
+ result.put("house", houseCount);
|
|
|
+
|
|
|
+ log.info("统计数量返回值: {}", result);
|
|
|
+ return Result.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询VR项目状态
|
|
|
* @param houseId
|
|
|
* @return
|
|
|
*/
|
|
|
- private Result getHouseStatus(String houseId){
|
|
|
+// private Result getHouseStatus(String houseId){
|
|
|
+// Result result = null;
|
|
|
+// try {
|
|
|
+// result = houseFeign.findByHouseId(houseId);
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// String status = null;
|
|
|
+// if (result.getCode() == 0) {
|
|
|
+// Object data = result.getData();
|
|
|
+// JSONObject jsonObject = JSON.parseObject(data.toString());
|
|
|
+// status = jsonObject.getString("status");
|
|
|
+// log.info("house status: " + status);
|
|
|
+// log.warn("可以正常编辑");
|
|
|
+// if (status.equals("1")) {
|
|
|
+// log.warn("审核中不能编辑");
|
|
|
+// return Result.failure(7005, "审核中不能编辑");
|
|
|
+// }
|
|
|
+// if (status.equals("2")) {
|
|
|
+// log.warn("已审核中不能编辑");
|
|
|
+// return Result.failure(7006, "已审核中不能编辑");
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (result.getCode() == -1){
|
|
|
+// log.error("VR项目接口查询失败:" + result.getMsg() );
|
|
|
+// return Result.failure(7007, "VR项目接口查询失败");
|
|
|
+// }
|
|
|
+//
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询VR项目是否可编辑
|
|
|
+ * true: 可编辑
|
|
|
+ * false: 不可编辑
|
|
|
+ * @param houseId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Result canEdit(String houseId){
|
|
|
Result result = null;
|
|
|
try {
|
|
|
result = houseFeign.findByHouseId(houseId);
|
|
|
+ log.info("房车宝返回数据:{}", result);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ log.error("调用房车宝接口失败");
|
|
|
+ throw new BaseRuntimeException("调用房车宝接口失败");
|
|
|
}
|
|
|
- String status = null;
|
|
|
if (result.getCode() == 0) {
|
|
|
- Object data = result.getData();
|
|
|
- JSONObject jsonObject = JSON.parseObject(data.toString());
|
|
|
- status = jsonObject.getString("status");
|
|
|
- log.info("house status: " + status);
|
|
|
- log.warn("可以正常编辑");
|
|
|
- if (status.equals("1")) {
|
|
|
- log.warn("审核中不能编辑");
|
|
|
- return Result.failure(7005, "审核中不能编辑");
|
|
|
- }
|
|
|
- if (status.equals("2")) {
|
|
|
- log.warn("已审核中不能编辑");
|
|
|
- return Result.failure(7006, "已审核中不能编辑");
|
|
|
+ boolean data = (boolean) result.getData();
|
|
|
+ if (data) {
|
|
|
+ log.info("vr项目可编辑");
|
|
|
+ return Result.success();
|
|
|
+ } else {
|
|
|
+ log.info("vr项目不可编辑");
|
|
|
+ return Result.failure(7005, "VR项目不可编辑");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (result.getCode() == -1){
|
|
|
+ } else {
|
|
|
log.error("VR项目接口查询失败:" + result.getMsg() );
|
|
|
return Result.failure(7007, "VR项目接口查询失败");
|
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
}
|
|
|
|
|
|
}
|