|
@@ -39,6 +39,8 @@ public class AgentNewCameraServiceImpl extends ServiceImpl<IAgentNewCameraMapper
|
|
|
ICameraService cameraService;
|
|
|
@Autowired
|
|
|
ICameraDetailService cameraDetailService;
|
|
|
+ @Autowired
|
|
|
+ IAgentNewCameraService agentNewCameraService;
|
|
|
@Override
|
|
|
public void giveCamera(CameraParam param) {
|
|
|
Camera camera = cameraService.getById(param.getId());
|
|
@@ -46,12 +48,15 @@ public class AgentNewCameraServiceImpl extends ServiceImpl<IAgentNewCameraMapper
|
|
|
throw new BusinessException(ResultCode.CAMERA_EMPTY);
|
|
|
}
|
|
|
CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
|
|
|
- if(cameraDetail == null){
|
|
|
+ if(cameraDetail == null || cameraDetail.getAgentId() == null){
|
|
|
throw new BusinessException(ResultCode.CAMERA_EMPTY);
|
|
|
}
|
|
|
-// if(!cameraDetail.getAgentId().equals(param.getAgentId())){
|
|
|
-// throw new BusinessException(ResultCode.CAMERA_EMPTY);
|
|
|
-// }
|
|
|
+ if(!cameraDetail.getAgentId().equals(param.getAgentId())){
|
|
|
+ List<AgentNewCamera> bySubAgent = agentNewCameraService.getBySubAgent(camera.getId(), param.getAgentId());
|
|
|
+ if(bySubAgent.isEmpty()){
|
|
|
+ throw new BusinessException(ResultCode.AUTH_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
giveCamera(param.getId(),param.getAgentId(),param.getSubAgentId());
|
|
|
}
|
|
|
public void giveCamera(Long cameraId,Integer agentId,Integer subAgentId) {
|