|
@@ -117,124 +117,10 @@ public class SceneEditServiceImpl implements ISceneEditService {
|
|
|
if(Objects.isNull(scenePlus)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
|
|
|
SceneAuthVO sceneAuthVO = new SceneAuthVO();
|
|
|
-
|
|
|
- List<SceneResource> exclude = new ArrayList<>();
|
|
|
- SceneResource excludeEntity = new SceneResource();
|
|
|
- excludeEntity.setKeyWord("data");
|
|
|
- exclude.add(excludeEntity);
|
|
|
-
|
|
|
- Camera camera = cameraService.findByChildName(username);
|
|
|
- sceneAuthVO.setExclude(exclude);
|
|
|
- sceneAuthVO.setInclude(new ArrayList<>());
|
|
|
- sceneAuthVO.setCompany(null);
|
|
|
-
|
|
|
- //判断data.json是否存在,如果存在,则证明计算在未被定时任务删除前上传过oss
|
|
|
-// boolean exist = fYunFileService.fileExist(String.format(UploadFilePath.scene_result_data_path, num).concat("data.json"));
|
|
|
-// if(!exist){
|
|
|
-// sceneAuthVO.setSourceExpired(true);
|
|
|
-// }
|
|
|
-
|
|
|
- //判断该场景是否属于增值权益
|
|
|
- boolean isVip = false;
|
|
|
- //获取该相机是否有权益
|
|
|
- boolean isExpired = false;
|
|
|
- Camera sceneCamera = cameraService.getById(scenePlus.getCameraId());
|
|
|
- if(sceneCamera != null){
|
|
|
- UserIncrement userIncrementEntity = userIncrementService.findByCameraId(sceneCamera.getId());
|
|
|
-
|
|
|
- if(userIncrementEntity != null){
|
|
|
- if( userIncrementEntity.getIsExpired().intValue() == 0){
|
|
|
- isVip = true;
|
|
|
- }
|
|
|
- if(userIncrementEntity.getIsExpired().intValue() == 1){
|
|
|
- isExpired = true;
|
|
|
- }
|
|
|
- }else{
|
|
|
- try {
|
|
|
- Date date = DateUtil.parse("2021-09-09 00:00:00", DateExtUtil.dateStyle);
|
|
|
-
|
|
|
- //非07批次的放开
|
|
|
- String pc = sceneCamera.getSnCode().substring(0,2);
|
|
|
- if(!pc.equals("07") ){
|
|
|
- if(sceneCamera.getCreateTime()!=null && date.after(sceneCamera.getCreateTime())){
|
|
|
- isVip = true;
|
|
|
- isExpired = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- sceneAuthVO.setIsExpired(isExpired);
|
|
|
- sceneAuthVO.setIsVip(isVip);
|
|
|
-
|
|
|
- //判断过期时间
|
|
|
- Date date = DateUtil.parse(expectedTime, DateExtUtil.dateStyle);
|
|
|
-
|
|
|
- if(camera != null){
|
|
|
- if(!scenePlus.getCameraId().equals(camera.getId())){
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
- }
|
|
|
-
|
|
|
- CameraDetail cameraDetailEntity = cameraDetailService.findByCameraId(camera.getId());
|
|
|
- if(cameraDetailEntity.getCompanyId() != null){
|
|
|
- if(cameraDetailEntity.getCompanyId().longValue() == 1 || cameraDetailEntity.getCompanyId().longValue() == 14){
|
|
|
- sceneAuthVO.setExclude(new ArrayList<>());
|
|
|
- sceneAuthVO.setCompany(cameraDetailEntity.getCompanyId());
|
|
|
- }
|
|
|
- }
|
|
|
- return sceneAuthVO;
|
|
|
- }
|
|
|
-
|
|
|
- User user = userService.findByUserName(username);
|
|
|
- if("18750226207".equals(username)){
|
|
|
- log.info("18750226207该账号默认超级管理员,可以操作所有场景");
|
|
|
- }
|
|
|
- else if(user == null || scenePlus.getUserId() == null || user.getId().longValue() != scenePlus.getUserId().longValue()){
|
|
|
- log.info("user:" + user.getId() + ",scene:" + scenePlus.getUserId());
|
|
|
-
|
|
|
- List<SceneCooperation> list =
|
|
|
- sceneCooperationService.list(
|
|
|
- new LambdaQueryWrapper<SceneCooperation>()
|
|
|
- .eq(SceneCooperation::getSceneNum, num));
|
|
|
- if(list != null && list.size() > 0){
|
|
|
- if(list.get(0).getUserId().longValue() != user.getId().longValue()){
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
- }
|
|
|
- }else {
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(scenePlus.getCameraId() != null){
|
|
|
- camera = cameraService.getById(scenePlus.getCameraId());
|
|
|
- if(camera != null){
|
|
|
- CameraDetail cameraDetail = cameraDetailService.findByCameraId(camera.getId());
|
|
|
- if(cameraDetail.getCompanyId() != null){
|
|
|
- if(cameraDetail.getCompanyId().longValue() == 1 || cameraDetail.getCompanyId().longValue() == 14){
|
|
|
- sceneAuthVO.setExclude(new ArrayList<>());
|
|
|
- sceneAuthVO.setCompany(cameraDetail.getCompanyId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //权限控制完后判断若是协作账号,获取协作权限
|
|
|
- if(scenePlus.getUserId().equals(ssoUser.getId())){
|
|
|
- return sceneAuthVO;
|
|
|
- }
|
|
|
- SceneCooperation sceneCooperation = sceneCooperationService.getByNum(num);
|
|
|
- if(Objects.nonNull(sceneCooperation)){
|
|
|
- sceneAuthVO.setInclude(sceneResourceService.findByCooperationId(sceneCooperation.getId()));
|
|
|
- }
|
|
|
-
|
|
|
- sceneAuthVO.setIsVip(true);
|
|
|
sceneAuthVO.setIsExpired(false);
|
|
|
+ sceneAuthVO.setIsVip(true);
|
|
|
|
|
|
return sceneAuthVO;
|
|
|
}
|