|
@@ -196,13 +196,14 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
|
|
//写入数据库
|
|
//写入数据库
|
|
ScenePro scenePro = this.updateDbPlus(sceneCode, space, videosJson.toJSONString(), computeTime,fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1);
|
|
ScenePro scenePro = this.updateDbPlus(sceneCode, space, videosJson.toJSONString(), computeTime,fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1);
|
|
|
|
|
|
- //变更容量,arrearCap为true时,代表容量不足
|
|
|
|
- boolean arrearCap = this.updateSpace(scenePro.getCameraId(), space);
|
|
|
|
-
|
|
|
|
|
|
+ scenePro.setPayStatus(PayStatus.PAY.code());
|
|
//如果相机容量不足,需要把场景的paystatus改为容量不足状态
|
|
//如果相机容量不足,需要把场景的paystatus改为容量不足状态
|
|
- if (arrearCap && cameraType != 14) {
|
|
|
|
- scenePro.setPayStatus(PayStatus.NO_CAPACITY.code());
|
|
|
|
- this.sealScene(arrearCap, scenePro.getId(), scenePro.getId());
|
|
|
|
|
|
+ if (cameraType != 14) {
|
|
|
|
+ scenePro.setPayStatus(this.getPayStatus(scenePro.getCameraId(), space));
|
|
|
|
+ sceneProService.update(
|
|
|
|
+ new LambdaUpdateWrapper<ScenePro>()
|
|
|
|
+ .set(ScenePro::getPayStatus, PayStatus.NO_CAPACITY.code())
|
|
|
|
+ .eq(ScenePro::getId, scenePro.getId()));
|
|
}
|
|
}
|
|
|
|
|
|
//上传文件
|
|
//上传文件
|
|
@@ -231,7 +232,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
//写scene.json
|
|
//写scene.json
|
|
log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
|
|
log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
|
|
- this.writeSceneJson(sceneCode, videosJson,scenePro, arrearCap);
|
|
|
|
|
|
+ this.writeSceneJson(sceneCode, videosJson,scenePro);
|
|
|
|
|
|
//计算成功,通知APP
|
|
//计算成功,通知APP
|
|
Integer pushChannel = fdageData.getInteger("pushChannel");
|
|
Integer pushChannel = fdageData.getInteger("pushChannel");
|
|
@@ -371,24 +372,18 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
|
|
return dataJson;
|
|
return dataJson;
|
|
}
|
|
}
|
|
|
|
|
|
- private void writeSceneJson(String num, JSONObject videosJson, ScenePro scenePro,boolean arrearCap) throws Exception{
|
|
|
|
|
|
+ private void writeSceneJson(String num, JSONObject videosJson, ScenePro scenePro) throws Exception{
|
|
String dataViewPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, num);
|
|
String dataViewPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, num);
|
|
-
|
|
|
|
- String sceneJsonKey = dataViewPath + "scene.json";
|
|
|
|
- boolean exist = fYunFileService.fileExist(sceneJsonKey);
|
|
|
|
//如果云端没有scene.json文件,生成一份
|
|
//如果云端没有scene.json文件,生成一份
|
|
- if(!exist){
|
|
|
|
- JSONObject sceneJson = JSONObject.parseObject(JSONObject.toJSONString(scenePro));
|
|
|
|
- sceneJson.put("videos",videosJson);
|
|
|
|
- if(arrearCap) {
|
|
|
|
- sceneJson.put("payStatus",PayStatus.NO_CAPACITY.code());
|
|
|
|
- }
|
|
|
|
- String sceneJsonStr = JSON.toJSONString(sceneJson);
|
|
|
|
- //上传sceneJson文件
|
|
|
|
- fYunFileService.uploadFile(sceneJsonStr.getBytes(), sceneJsonKey);
|
|
|
|
- }
|
|
|
|
- // 上传status JSON.
|
|
|
|
|
|
|
|
|
|
+ JSONObject sceneJson = JSONObject.parseObject(JSONObject.toJSONString(scenePro));
|
|
|
|
+ sceneJson.put("videos",videosJson);
|
|
|
|
+ sceneJson.put("payStatus",scenePro.getPayStatus());
|
|
|
|
+ String sceneJsonStr = JSON.toJSONString(sceneJson);
|
|
|
|
+ //上传sceneJson文件
|
|
|
|
+ fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
|
|
|
|
+
|
|
|
|
+ // 上传status JSON.
|
|
JSONObject statusJson = new JSONObject();
|
|
JSONObject statusJson = new JSONObject();
|
|
//临时将-2改成1,app还没完全更新
|
|
//临时将-2改成1,app还没完全更新
|
|
statusJson.put("status", 1);
|
|
statusJson.put("status", 1);
|
|
@@ -553,10 +548,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
|
|
}
|
|
}
|
|
|
|
|
|
private void sealScene(boolean arrearCap, Long scenePlusId, Long sceneProId){
|
|
private void sealScene(boolean arrearCap, Long scenePlusId, Long sceneProId){
|
|
- sceneProService.update(
|
|
|
|
- new LambdaUpdateWrapper<ScenePro>()
|
|
|
|
- .set(ScenePro::getPayStatus, PayStatus.NO_CAPACITY.code())
|
|
|
|
- .eq(ScenePro::getId, scenePlusId));
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -606,19 +598,22 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
|
|
return scenePro;
|
|
return scenePro;
|
|
}
|
|
}
|
|
|
|
|
|
- private boolean updateSpace(Long cameraId, Long space) throws Exception{
|
|
|
|
|
|
+ private int getPayStatus(Long cameraId, Long space) throws Exception{
|
|
//更新相机使用用量
|
|
//更新相机使用用量
|
|
CameraDetail cameraDetail = cameraDetailService.updateCameraDetailByCameraIdAndSpace(cameraId, space);
|
|
CameraDetail cameraDetail = cameraDetailService.updateCameraDetailByCameraIdAndSpace(cameraId, space);
|
|
- UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
|
|
|
|
|
|
+ Long totalSpace = cameraDetail.getTotalSpace();
|
|
|
|
|
|
- if(!ObjectUtils.isEmpty(userIncrement)){
|
|
|
|
|
|
+ UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
|
|
|
|
+ if(!ObjectUtils.isEmpty(userIncrement) && userIncrement.getIsExpired().equals(ExpiredStatus.NOT_EXPIRED.code())){
|
|
IncrementType type = incrementTypeService.getById(userIncrement.getIncrementTypeId());
|
|
IncrementType type = incrementTypeService.getById(userIncrement.getIncrementTypeId());
|
|
- if(type.getType().equals("cn") && userIncrement.getIsExpired().equals(ExpiredStatus.NOT_EXPIRED.code())){
|
|
|
|
- return false;
|
|
|
|
|
|
+ if (ObjectUtils.isEmpty(type) || type.getType().equals("cn")) {
|
|
|
|
+ return PayStatus.PAY.code();
|
|
|
|
+ } else if (type.getType().equals("eur")) {
|
|
|
|
+ totalSpace = type.getCameraCapacity() * 1024 * 1024L;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- return cameraDetail.getTotalSpace().compareTo(cameraDetail.getUsedSpace()) == -1;
|
|
|
|
|
|
+ return totalSpace.compareTo(cameraDetail.getUsedSpace()) == -1 ? PayStatus.NO_CAPACITY.code() : PayStatus.PAY.code();
|
|
}
|
|
}
|
|
|
|
|
|
public void uploadHouseTypeJson(String num, String floorPlanCardFilePath) {
|
|
public void uploadHouseTypeJson(String num, String floorPlanCardFilePath) {
|