|
@@ -4,14 +4,16 @@ import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.fdkankan.common.constant.SceneVersionType;
|
|
import com.fdkankan.common.constant.SceneVersionType;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.SnowflakeIdGenerator;
|
|
import com.fdkankan.common.util.SnowflakeIdGenerator;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
|
+import com.fdkankan.ucenter.common.RedisKeyUtil;
|
|
import com.fdkankan.ucenter.common.constants.ResultCode;
|
|
import com.fdkankan.ucenter.common.constants.ResultCode;
|
|
-import com.fdkankan.ucenter.entity.SceneResource;
|
|
|
|
-import com.fdkankan.ucenter.service.IScene3dNumService;
|
|
|
|
|
|
+import com.fdkankan.ucenter.entity.*;
|
|
|
|
+import com.fdkankan.ucenter.service.*;
|
|
import com.fdkankan.ucenter.util.SceneResourcePath;
|
|
import com.fdkankan.ucenter.util.SceneResourcePath;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
@@ -20,6 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.function.ObjDoubleConsumer;
|
|
import java.util.function.ObjDoubleConsumer;
|
|
@@ -152,6 +156,7 @@ public class SceneCommonService {
|
|
if("v4".equals(sceneVersion)){
|
|
if("v4".equals(sceneVersion)){
|
|
JSONObject jsonObject = JSONObject.parseObject(newJson);
|
|
JSONObject jsonObject = JSONObject.parseObject(newJson);
|
|
jsonObject.put("title",newSceneName);
|
|
jsonObject.put("title",newSceneName);
|
|
|
|
+ jsonObject.put("dynamicPanel",0);
|
|
FileUtils.writeFile(localPath, jsonObject.toJSONString());
|
|
FileUtils.writeFile(localPath, jsonObject.toJSONString());
|
|
|
|
|
|
String sceneJsonPath = String.format(SceneResourcePath.DATA_VIEW_PATH+"/" + fileName, newNum);
|
|
String sceneJsonPath = String.format(SceneResourcePath.DATA_VIEW_PATH+"/" + fileName, newNum);
|
|
@@ -168,6 +173,15 @@ public class SceneCommonService {
|
|
fYunFileServiceInterface.deleteFile(oldName);
|
|
fYunFileServiceInterface.deleteFile(oldName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ String dynamicViewPath = String.format(SceneResourcePath.DYNAMIC_VIEW_PATH, newNum);
|
|
|
|
+ String dynamicEditPath = String.format(SceneResourcePath.DYNAMIC_EDIT_PATH, newNum);
|
|
|
|
+ if(fYunFileServiceInterface.fileExist(dynamicViewPath)){
|
|
|
|
+ fYunFileServiceInterface.deleteFile(dynamicViewPath);
|
|
|
|
+ }
|
|
|
|
+ if(fYunFileServiceInterface.fileExist(dynamicEditPath)){
|
|
|
|
+ fYunFileServiceInterface.deleteFile(dynamicEditPath);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
log.error("writeFile-error:{}",e);
|
|
log.error("writeFile-error:{}",e);
|
|
@@ -235,4 +249,66 @@ public class SceneCommonService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ ISceneProService sceneProService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ICameraDetailService cameraDetailService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ICameraTypeService cameraTypeService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IScenePlusService scenePlusService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IScenePlusExtService scenePlusExtService;
|
|
|
|
+
|
|
|
|
+ public void copyResult(String newNum) {
|
|
|
|
+ ScenePro scenePro = sceneProService.getByNum(newNum);
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(newNum);
|
|
|
|
+ if(scenePro == null && scenePlus == null){
|
|
|
|
+ log.info("复制失败:{}",newNum);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ Long cameraId = scenePro == null ? scenePlus.getCameraId() : scenePro.getCameraId();
|
|
|
|
+ Integer location = null;
|
|
|
|
+ Long space = 0L;
|
|
|
|
+ if(scenePlus != null){
|
|
|
|
+ ScenePlusExt plusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
|
+ if(plusExt == null){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ location = plusExt.getLocation();
|
|
|
|
+ space = plusExt.getSpace();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if(scenePro != null){
|
|
|
|
+ space = scenePro.getSpace();
|
|
|
|
+ }
|
|
|
|
+ CameraDetail cameraDetail = cameraDetailService.getByCameraId(cameraId);
|
|
|
|
+ CameraType cameraType = cameraTypeService.getByCameraType(cameraDetail.getType());
|
|
|
|
+
|
|
|
|
+ Boolean checkSpace = cameraDetailService.checkSpace(cameraDetail,cameraType);
|
|
|
|
+ if(!checkSpace){
|
|
|
|
+ List<String> panoNumList = new ArrayList<>();
|
|
|
|
+ if(location != null && location == 7){
|
|
|
|
+ panoNumList.add(scenePlus.getNum());
|
|
|
|
+ }
|
|
|
|
+ sceneProService.lockOrUnLockScenes(new ArrayList<>(), Arrays.asList(newNum),-2,cameraType.getIsLaser(),panoNumList);
|
|
|
|
+ }
|
|
|
|
+ cameraDetailService.addUsedSpace(cameraDetail,space);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(cameraType.getIsLaser() == 1 && scenePlus != null){
|
|
|
|
+ LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
|
|
|
|
+ wrapper.eq(ScenePlus::getId,scenePlus.getId());
|
|
|
|
+ wrapper.set(ScenePlus::getSceneStatus,-2);
|
|
|
|
+ scenePlusService.update(wrapper);
|
|
|
|
+ }
|
|
|
|
+ if(cameraType.getIsLaser() == 1 && scenePro != null){
|
|
|
|
+ LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
|
|
|
|
+ wrapper.eq(ScenePro::getId,scenePro.getId());
|
|
|
|
+ wrapper.set(ScenePro::getStatus,-2);
|
|
|
|
+ sceneProService.update(wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|