|
@@ -2,16 +2,14 @@ package com.fdkankan.ucenter.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.constant.SceneConstant;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.fdkankan.ucenter.common.DownloadStatusEnum;
|
|
|
-import com.fdkankan.ucenter.common.constants.NacosProperty;
|
|
|
import com.fdkankan.ucenter.common.RedisKeyUtil;
|
|
|
-import com.fdkankan.ucenter.common.constants.ResultCode;
|
|
|
+import com.fdkankan.ucenter.common.constants.ResultCodeMsg;
|
|
|
import com.fdkankan.ucenter.constant.CameraConstant;
|
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
|
import com.fdkankan.ucenter.entity.*;
|
|
@@ -23,7 +21,6 @@ import com.fdkankan.ucenter.vo.response.DownVo;
|
|
|
import com.fdkankan.ucenter.vo.response.DownloadProcessVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.ibatis.annotations.Case;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -67,12 +64,9 @@ public class DownService implements IDownService {
|
|
|
if(scenePro == null && plus == null){
|
|
|
throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
}
|
|
|
- Long cameraId = scenePro !=null ? scenePro.getCameraId() : plus.getCameraId();
|
|
|
- CameraType cameraType = cameraTypeService.getByCameraId(cameraId);
|
|
|
isObj = isObj == null ?0 :isObj;
|
|
|
-
|
|
|
- log.info("checkDownLoad--cameraType:{},isObj:{}",cameraType,isObj);
|
|
|
- if(cameraType != null && cameraType.getIsLaser() == 1 && isObj !=1){ //深时场景
|
|
|
+ log.info("checkDownLoad--,isObj:{}",isObj);
|
|
|
+ if(isObj !=1){ //深时场景
|
|
|
return SSCheckDownload(sceneNum);
|
|
|
}
|
|
|
SceneDownloadLog sceneDownloadLog;
|
|
@@ -145,10 +139,8 @@ public class DownService implements IDownService {
|
|
|
if(scenePro == null && plus == null){
|
|
|
throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
}
|
|
|
- Long cameraId = scenePro !=null ? scenePro.getCameraId() : plus.getCameraId();
|
|
|
- CameraType cameraType = cameraTypeService.getByCameraId(cameraId);
|
|
|
- isObj = isObj == null ?0 :isObj;
|
|
|
|
|
|
+ isObj = isObj == null ?0 :isObj;
|
|
|
DownVo downVo = new DownVo();
|
|
|
User user = userService.getByUserName(userName);
|
|
|
if(user == null){
|
|
@@ -157,21 +149,14 @@ public class DownService implements IDownService {
|
|
|
}
|
|
|
Integer downLoadTotal = 0;
|
|
|
Integer downLoadNum = 0;
|
|
|
- if(!"aws".equals(NacosProperty.uploadType) && cameraType != null && cameraType.getIsLaser() == 1){
|
|
|
- downLoadTotal = user.getSsDownloadNumTotal();
|
|
|
- downLoadNum = user.getSsDownloadNum();
|
|
|
-
|
|
|
- }else {
|
|
|
- downLoadTotal = user.getDownloadNumTotal();
|
|
|
- downLoadNum = user.getDownloadNum();
|
|
|
- }
|
|
|
+ downLoadTotal = user.getDownloadNumTotal();
|
|
|
+ downLoadNum = user.getDownloadNum();
|
|
|
if(downLoadTotal <= downLoadNum ){
|
|
|
downVo.setDownloadStatus(-1);
|
|
|
return downVo;
|
|
|
}
|
|
|
-
|
|
|
- log.info("down--cameraType:{},isObj:{}",cameraType,isObj);
|
|
|
- if(cameraType != null && cameraType.getIsLaser() == 1 && isObj !=1){ //深时场景
|
|
|
+ log.info("down-:isObj:{}",isObj);
|
|
|
+ if(isObj !=1){ //深时场景
|
|
|
return SSDownload(sceneNum,user);
|
|
|
}
|
|
|
|
|
@@ -197,11 +182,7 @@ public class DownService implements IDownService {
|
|
|
//修改用户的下载次数
|
|
|
LambdaUpdateWrapper<User> wrapper = new LambdaUpdateWrapper<>();
|
|
|
wrapper.eq(User::getId,user.getId());
|
|
|
- if(!"aws".equals(NacosProperty.uploadType) && cameraType != null && cameraType.getIsLaser() == 1 ){ //深时场景
|
|
|
- wrapper.setSql("ss_download_num = ss_download_num + " + 1);
|
|
|
- }else {
|
|
|
- wrapper.setSql("download_num = download_num + " + 1);
|
|
|
- }
|
|
|
+ wrapper.setSql("download_num = download_num + " + 1);
|
|
|
userService.update(wrapper);
|
|
|
SceneDownloadLog sceneDownloadLogEntity = new SceneDownloadLog();
|
|
|
sceneDownloadLogEntity.setUserId(user.getId());
|
|
@@ -225,13 +206,10 @@ public class DownService implements IDownService {
|
|
|
if(scenePro == null && plus == null){
|
|
|
throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
}
|
|
|
- Long cameraId = scenePro !=null ? scenePro.getCameraId() : plus.getCameraId();
|
|
|
- CameraType cameraType = cameraTypeService.getByCameraId(cameraId);
|
|
|
-
|
|
|
- isObj = isObj == null ?0 :isObj;
|
|
|
|
|
|
- log.info("downloadProcess--cameraType:{},isObj:{}",cameraType,isObj);
|
|
|
- if(cameraType != null && cameraType.getIsLaser() == 1 && isObj !=1){ //深时场景
|
|
|
+ isObj = isObj == null ? 0 :isObj;
|
|
|
+ log.info("downloadProcess--,isObj:{}",isObj);
|
|
|
+ if( isObj !=1){ //深时场景
|
|
|
return SSDownloadProcess(sceneNum);
|
|
|
}
|
|
|
String redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS;
|
|
@@ -263,11 +241,7 @@ public class DownService implements IDownService {
|
|
|
sceneDownloadLog.setStatus(-1);
|
|
|
LambdaUpdateWrapper<User> wrapper = new LambdaUpdateWrapper<>();
|
|
|
wrapper.eq(User::getId,userId);
|
|
|
- if(!"aws".equals(NacosProperty.uploadType) && cameraType != null && cameraType.getIsLaser() == 1 ){ //深时场景
|
|
|
- wrapper.setSql("ss_download_num = ss_download_num - " + 1);
|
|
|
- }else {
|
|
|
- wrapper.setSql("download_num = download_num - " + 1);
|
|
|
- }
|
|
|
+ wrapper.setSql("download_num = download_num - " + 1);
|
|
|
userService.update(wrapper);
|
|
|
break;
|
|
|
}
|
|
@@ -285,7 +259,7 @@ public class DownService implements IDownService {
|
|
|
DownVo downVo = new DownVo();
|
|
|
SSDownSceneVo vo = laserService.downOfflineSceneStatus(sceneNum);
|
|
|
if(vo == null){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400003,ResultCode.FAILURE_MSG_400003);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400003, ResultCodeMsg.FAILURE_MSG_400003);
|
|
|
}
|
|
|
downVo.setDownloadStatus(0);
|
|
|
if(vo.getStatus() == 1){
|
|
@@ -309,15 +283,11 @@ public class DownService implements IDownService {
|
|
|
//status :0:正在生成 1,初次生成 2,已经生成直接下载 3,重新生成
|
|
|
SSDownSceneVo vo = laserService.downOfflineScene(sceneNum);
|
|
|
if(vo == null){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400003,ResultCode.FAILURE_MSG_400003);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400003, ResultCodeMsg.FAILURE_MSG_400003);
|
|
|
}
|
|
|
LambdaUpdateWrapper<User> wrapper = new LambdaUpdateWrapper<>();
|
|
|
wrapper.eq(User::getId,user.getId());
|
|
|
- if(!"aws".equals(NacosProperty.uploadType) ){ //深时场景
|
|
|
- wrapper.setSql("ss_download_num = ss_download_num + " + 1);
|
|
|
- }else {
|
|
|
- wrapper.setSql("download_num = download_num + " + 1);
|
|
|
- }
|
|
|
+ wrapper.setSql("download_num = download_num + " + 1);
|
|
|
userService.update(wrapper);
|
|
|
|
|
|
SceneDownloadLog sceneDownloadLogEntity = new SceneDownloadLog();
|
|
@@ -337,7 +307,7 @@ public class DownService implements IDownService {
|
|
|
DownloadProcessVo downVo = new DownloadProcessVo();
|
|
|
SSDownSceneVo vo = laserService.downOfflineSceneStatus(sceneNum);
|
|
|
if(vo == null){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400003,ResultCode.FAILURE_MSG_400003);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400003, ResultCodeMsg.FAILURE_MSG_400003);
|
|
|
}
|
|
|
downVo.setStatus(1003);
|
|
|
|
|
@@ -380,7 +350,7 @@ public class DownService implements IDownService {
|
|
|
DownVo downVo = new DownVo();
|
|
|
SSDownSceneVo vo = laserService.downE57Status(num);
|
|
|
if(vo == null){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400003,ResultCode.FAILURE_MSG_400003);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400003, ResultCodeMsg.FAILURE_MSG_400003);
|
|
|
}
|
|
|
downVo.setDownloadStatus(0);
|
|
|
if(vo.getStatus() == 1){
|
|
@@ -394,7 +364,7 @@ public class DownService implements IDownService {
|
|
|
downVo.setDownloadStatus(1);
|
|
|
}
|
|
|
if(vo.getStatus() == -1){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400016,ResultCode.FAILURE_MSG_400016);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400016, ResultCodeMsg.FAILURE_MSG_400016);
|
|
|
}
|
|
|
return downVo;
|
|
|
}
|
|
@@ -406,39 +376,39 @@ public class DownService implements IDownService {
|
|
|
}
|
|
|
ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
if(scenePlus == null ){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400002,ResultCode.FAILURE_MSG_400002);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400002, ResultCodeMsg.FAILURE_MSG_400002);
|
|
|
}
|
|
|
if(scenePlus.getSceneSource() != 4 && scenePlus.getSceneSource() != 5){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400011,ResultCode.FAILURE_MSG_400011);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400011, ResultCodeMsg.FAILURE_MSG_400011);
|
|
|
}
|
|
|
if(scenePlus.getUserId()!= null && !scenePlus.getUserId().equals(user.getId())){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400012,ResultCode.FAILURE_MSG_400012);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400012, ResultCodeMsg.FAILURE_MSG_400012);
|
|
|
}
|
|
|
if(scenePlus.getCameraId() == null){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400010,ResultCode.FAILURE_MSG_400010);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400010, ResultCodeMsg.FAILURE_MSG_400010);
|
|
|
}
|
|
|
CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
|
if(cameraDetail == null){
|
|
|
throw new BusinessException(CameraConstant.FAILURE_CODE_6029,CameraConstant.FAILURE_MSG_6029);
|
|
|
}
|
|
|
if(!cameraDetail.getUserId().equals(user.getId())){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400012,ResultCode.FAILURE_MSG_400012);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400012, ResultCodeMsg.FAILURE_MSG_400012);
|
|
|
}
|
|
|
SceneColdStorage sceneColdStorage = sceneColdStorageService.getByNum(num);
|
|
|
if(sceneColdStorage != null && sceneColdStorage.getState() == 1){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400013,ResultCode.FAILURE_MSG_400013);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400013, ResultCodeMsg.FAILURE_MSG_400013);
|
|
|
}
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
String dataSource = scenePlusExt.getDataSource();
|
|
|
if(!fYunFileServiceInterface.fileExist(dataSource.replace("/mnt/data","home")+"/data.fdage")){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400014,ResultCode.FAILURE_MSG_400014);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400014, ResultCodeMsg.FAILURE_MSG_400014);
|
|
|
}
|
|
|
SceneStatusInfoDTO dto = laserService.laserSceneInfo(num);
|
|
|
if(dto == null){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400003,ResultCode.FAILURE_MSG_400003);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400003, ResultCodeMsg.FAILURE_MSG_400003);
|
|
|
}
|
|
|
if(dto.getStatus()!=2 ){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400015,ResultCode.FAILURE_MSG_400015);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400015, ResultCodeMsg.FAILURE_MSG_400015);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -451,7 +421,7 @@ public class DownService implements IDownService {
|
|
|
//status :0:正在生成 1,初次生成 2,已经生成直接下载 3,重新生成
|
|
|
SSDownSceneVo vo = laserService.downE57(num);
|
|
|
if(vo == null){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400003,ResultCode.FAILURE_MSG_400003);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400003, ResultCodeMsg.FAILURE_MSG_400003);
|
|
|
}
|
|
|
downVo.setDownloadStatus(1);
|
|
|
return downVo;
|
|
@@ -466,10 +436,10 @@ public class DownService implements IDownService {
|
|
|
DownloadProcessVo downVo = new DownloadProcessVo();
|
|
|
SSDownSceneVo vo = laserService.downE57Status(num);
|
|
|
if(vo == null){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400003,ResultCode.FAILURE_MSG_400003);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400003, ResultCodeMsg.FAILURE_MSG_400003);
|
|
|
}
|
|
|
if(vo.getStatus() ==-1){
|
|
|
- throw new BusinessException(ResultCode.FAILURE_CODE_400016,ResultCode.FAILURE_MSG_400016);
|
|
|
+ throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400016, ResultCodeMsg.FAILURE_MSG_400016);
|
|
|
}
|
|
|
downVo.setStatus(1003);
|
|
|
if(vo.getStatus() == 0 || vo.getStatus() == 2 || vo.getStatus() == 3){ //下载中
|