|
@@ -9,17 +9,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.common.constant.SceneConstant;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
-import com.fdkankan.manage.common.OssPath;
|
|
|
-import com.fdkankan.manage.common.ResultCode;
|
|
|
+import com.fdkankan.manage.common.*;
|
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
|
-import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.common.util.*;
|
|
|
import com.fdkankan.manage.httpClient.client.FdKKClient;
|
|
|
import com.fdkankan.manage.httpClient.service.LaserService;
|
|
|
-import com.fdkankan.manage.common.CameraConstant;
|
|
|
import com.fdkankan.manage.entity.*;
|
|
|
import com.fdkankan.manage.mapper.ISceneProMapper;
|
|
|
import com.fdkankan.manage.service.*;
|
|
|
+import com.fdkankan.manage.util.Dateutils;
|
|
|
import com.fdkankan.manage.util.SceneStatusUtil;
|
|
|
import com.fdkankan.manage.vo.request.SceneParam;
|
|
|
import com.fdkankan.manage.vo.response.CameraDataVo;
|
|
@@ -80,6 +78,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
FdKKClient fdKKClient;
|
|
|
@Autowired
|
|
|
IFolderSceneService folderSceneService;
|
|
|
+ @Autowired
|
|
|
+ ISceneBuildProcessLogService sceneBuildProcessLogService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -281,6 +281,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
* 从oss中获取文件,并重写,上传替换
|
|
|
*/
|
|
|
private void updateOssStatus(String path,Integer payStatus) {
|
|
|
+ String localPath = String.format(OssPath.localStatusPath, path);
|
|
|
try {
|
|
|
if(!fYunFileServiceInterface.fileExist(path)){
|
|
|
return;
|
|
@@ -292,13 +293,13 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
jsonObject.put("payStatus",payStatus);
|
|
|
String json = JSONUtil.toJsonStr(jsonObject);
|
|
|
- FileUtils.writeFile(OssPath.localStatusPath ,json);
|
|
|
- log.info("updateOssStatus--localPath:{},ossPath:{}",OssPath.localStatusPath,path);
|
|
|
- fYunFileServiceInterface.uploadFile(OssPath.localStatusPath,path);
|
|
|
+ FileUtils.writeFile(localPath,json);
|
|
|
+ log.info("updateOssStatus--localPath:{},ossPath:{}",localPath,path);
|
|
|
+ fYunFileServiceInterface.uploadFile(localPath,path);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}finally {
|
|
|
- FileUtil.del(OssPath.localStatusPath);
|
|
|
+ FileUtil.del(localPath);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -327,6 +328,13 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
record.setIsCopy(true);
|
|
|
}
|
|
|
}
|
|
|
+ if(record.getStatus() == -1){ //计算失败
|
|
|
+ SceneBuildProcessLog sceneBuildProcessLog = sceneBuildProcessLogService.getByNum(record.getNum());
|
|
|
+ if(sceneBuildProcessLog != null){
|
|
|
+ record.setSceneBuildProcessLog(sceneBuildProcessLog);
|
|
|
+ record.setBuildErrorReason(SceneBuildProcessLogEnum.getReason(sceneBuildProcessLog.getProcess()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return PageInfo.PageInfo(page);
|
|
|
}
|
|
@@ -353,9 +361,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
Long sceneCameraId = scenePro == null ? scenePlus.getCameraId() : scenePro.getCameraId();
|
|
|
Long space = scenePro == null ? 0 :scenePro.getSpace();
|
|
|
+ String dataSource = scenePro == null ? null :scenePro.getDataSource();
|
|
|
if(scenePlus !=null){
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
space = scenePlusExt.getSpace();
|
|
|
+ dataSource = scenePlusExt.getDataSource();
|
|
|
}
|
|
|
space = space == null ? 0 :space;
|
|
|
Long newUseSpace = space + cameraDetail.getUsedSpace();
|
|
@@ -431,7 +441,70 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
if(cameraDetail.getType() == 10){ //深时场景
|
|
|
laserService.move(param.getNum(),oldCamera.getSnCode(),camera.getSnCode(),cameraDetail.getUserId());
|
|
|
}
|
|
|
+ updateFdage(oldCamera.getSnCode(),param.getSnCode(),dataSource);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateFdage(String oldSnCode,String newSnCode,String dataSource) {
|
|
|
+ String localPath = String.format(OssPath.localFdagePath,dataSource)+"/data.fdage";
|
|
|
+ try {
|
|
|
+ String fdagePaht = dataSource.replace("/mnt/data","home") +"/data.fdage";
|
|
|
+ String fileContent = fYunFileServiceInterface.getFileContent(fdagePaht);
|
|
|
+ String newJson = fileContent.replaceAll("(?i)"+oldSnCode,newSnCode.toLowerCase());
|
|
|
+ FileUtils.writeFile(localPath ,newJson);
|
|
|
+ log.info("updateFdage--localPath:{},ossPath:{}",localPath,fdagePaht);
|
|
|
+ String localPathBack = localPath+"_"+oldSnCode+"-"+newSnCode+"_"+Dateutils.getDateN(new Date())+".back";
|
|
|
+ String fdagePathBack = fdagePaht+"_"+oldSnCode+"-"+newSnCode+"_"+Dateutils.getDateN(new Date())+".back";
|
|
|
+
|
|
|
+ fYunFileServiceInterface.downloadFile(fdagePaht,localPathBack);
|
|
|
+ fYunFileServiceInterface.uploadFile(localPathBack,fdagePathBack);
|
|
|
+ fYunFileServiceInterface.uploadFile(localPath,fdagePaht);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("updateFdage-error:oldSnCode:{},newSnCode:{},dataSource:{}",oldSnCode,newSnCode,dataSource);
|
|
|
+ log.error("updateFdage-error:",e);
|
|
|
+ }finally {
|
|
|
+ FileUtil.del(localPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void updateFdageNewDataSource(String oldSnCode,String newSnCode,String dataSource) {
|
|
|
+ String localPath = String.format(OssPath.localFdagePath,dataSource);
|
|
|
+ try {
|
|
|
+ String localPathFdage = String.format(OssPath.localFdagePath,dataSource)+"/data.fdage";
|
|
|
+
|
|
|
+ String homeData = dataSource.replace("/mnt/data","home");
|
|
|
+ ShellUtil.yunDownload(homeData,localPath);
|
|
|
+
|
|
|
+ String fileContent = FileUtils.readFile(localPathFdage);
|
|
|
+ String newJson = fileContent.replaceAll("(?i)"+oldSnCode,newSnCode.toLowerCase());
|
|
|
+ FileUtils.writeFile(localPathFdage ,newJson);
|
|
|
+
|
|
|
+ String oldFdagePaht = dataSource.replace("/mnt/data","home") ;
|
|
|
+ String newFdagePaht = oldFdagePaht.replaceAll("(?i)"+oldSnCode,newSnCode.toLowerCase()) ;
|
|
|
+ ShellUtil.yunUpload(localPath,newFdagePaht);
|
|
|
+
|
|
|
+ log.info("updateFdage--localPath:{},ossPath:{}",localPath,newFdagePaht);
|
|
|
+ String newDataSource = dataSource.replaceAll("(?i)"+oldSnCode,newSnCode.toLowerCase()) ;
|
|
|
+ this.updateDataSource(dataSource,newDataSource);
|
|
|
+ fYunFileServiceInterface.deleteFolder(oldFdagePaht);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("updateFdage-error:oldSnCode:{},newSnCode:{},dataSource:{}",oldSnCode,newSnCode,dataSource);
|
|
|
+ log.error("updateFdage-error:",e);
|
|
|
+ }finally {
|
|
|
+ FileUtil.del(localPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateDataSource(String dataSource, String newDataSource) {
|
|
|
+ LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(ScenePro::getDataSource,dataSource);
|
|
|
+ wrapper.set(ScenePro::getDataSource,newDataSource);
|
|
|
+ this.update(wrapper);
|
|
|
|
|
|
+ LambdaUpdateWrapper<ScenePlusExt> wrapperPlus = new LambdaUpdateWrapper<>();
|
|
|
+ wrapperPlus.eq(ScenePlusExt::getDataSource,dataSource);
|
|
|
+ wrapperPlus.set(ScenePlusExt::getDataSource,newDataSource);
|
|
|
+ scenePlusExtService.update(wrapperPlus);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -462,8 +535,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
@Override
|
|
|
public void deleteByNum(String num) {
|
|
|
+ Integer sceneSource = null;
|
|
|
ScenePro scenePro = this.getByNum(num);
|
|
|
if(scenePro!=null){
|
|
|
+ sceneSource = scenePro.getSceneSource();
|
|
|
this.removeById(scenePro.getId());
|
|
|
}
|
|
|
Scene scene = sceneService.getByNum(num);
|
|
@@ -472,10 +547,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
if(scenePlus!=null){
|
|
|
+ sceneSource = scenePlus.getSceneSource();
|
|
|
scenePlusService.removeById(scenePlus.getId());
|
|
|
scenePlusExtService.delByPlus(scenePlus.getId());
|
|
|
}
|
|
|
- if(num.contains("SS")){
|
|
|
+ if(sceneSource != null && sceneSource == 4){
|
|
|
laserService.delete(num);
|
|
|
}
|
|
|
}
|