|
@@ -1,7 +1,9 @@
|
|
package com.fdkankan.ucenter.service.impl;
|
|
package com.fdkankan.ucenter.service.impl;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.fdkankan.common.constant.AppConstant;
|
|
import com.fdkankan.common.constant.AppConstant;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
|
+import com.fdkankan.common.util.DateUtil;
|
|
import com.fdkankan.common.util.FileSizeUtil;
|
|
import com.fdkankan.common.util.FileSizeUtil;
|
|
import com.fdkankan.ucenter.constant.CameraConstant;
|
|
import com.fdkankan.ucenter.constant.CameraConstant;
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
@@ -19,10 +21,7 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.math.BigInteger;
|
|
import java.math.BigInteger;
|
|
-import java.util.Collections;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Set;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -77,17 +76,22 @@ public class AppCameraService {
|
|
if(cameraDetail == null){
|
|
if(cameraDetail == null){
|
|
throw new BusinessException(AppConstant.FAILURE_CODE_4010, AppConstant.FAILURE_MSG_4010);
|
|
throw new BusinessException(AppConstant.FAILURE_CODE_4010, AppConstant.FAILURE_MSG_4010);
|
|
}
|
|
}
|
|
- Set<Long> roleIds = userRoleService.getByUser(user);
|
|
|
|
|
|
+// Set<Long> roleIds = userRoleService.getByUser(user);
|
|
// if(!roleIds.contains(5L) && !roleIds.contains(6L) && !roleIds.contains(1L)){
|
|
// if(!roleIds.contains(5L) && !roleIds.contains(6L) && !roleIds.contains(1L)){
|
|
// throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
|
|
// throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
|
|
// }
|
|
// }
|
|
- if(!user.getCompanyId().equals(cameraDetail.getCompanyId())){
|
|
|
|
|
|
+ if(cameraDetail.getCompanyId()!=null){
|
|
throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
|
|
throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
|
|
}
|
|
}
|
|
List<Long> cameraIds = Collections.singletonList(camera.getId());
|
|
List<Long> cameraIds = Collections.singletonList(camera.getId());
|
|
|
|
|
|
|
|
+ LambdaUpdateWrapper<Camera> wrapper = new LambdaUpdateWrapper<>();
|
|
|
|
+ wrapper.eq(Camera::getId,camera.getId());
|
|
|
|
+ wrapper.set(Camera::getActivatedTime, DateUtil.date2String(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ cameraService.update(wrapper);
|
|
|
|
+
|
|
cameraDetail.setUserId(user.getId());
|
|
cameraDetail.setUserId(user.getId());
|
|
- cameraDetailService.bindCamera(cameraIds,user.getId());
|
|
|
|
|
|
+ cameraDetailService.bindCamera(cameraIds,user.getId(),user.getCompanyId());
|
|
sceneProService.bindOrUnCamera(cameraIds,user.getId());
|
|
sceneProService.bindOrUnCamera(cameraIds,user.getId());
|
|
scenePlusService.bindOrUnCamera(cameraIds,user.getId());
|
|
scenePlusService.bindOrUnCamera(cameraIds,user.getId());
|
|
CameraAppVo responseCamera = new CameraAppVo();
|
|
CameraAppVo responseCamera = new CameraAppVo();
|
|
@@ -114,7 +118,7 @@ public class AppCameraService {
|
|
throw new BusinessException(AppConstant.FAILURE_CODE_4010, AppConstant.FAILURE_MSG_4010);
|
|
throw new BusinessException(AppConstant.FAILURE_CODE_4010, AppConstant.FAILURE_MSG_4010);
|
|
}
|
|
}
|
|
|
|
|
|
- Set<Long> roleIds = userRoleService.getByUser(user);
|
|
|
|
|
|
+ // Set<Long> roleIds = userRoleService.getByUser(user);
|
|
// if(!roleIds.contains(5L) && !roleIds.contains(6L) && !roleIds.contains(1L)){
|
|
// if(!roleIds.contains(5L) && !roleIds.contains(6L) && !roleIds.contains(1L)){
|
|
// throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
|
|
// throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
|
|
// }
|
|
// }
|