|
@@ -42,6 +42,8 @@ public class AppCameraService {
|
|
|
@Autowired
|
|
|
IUserIncrementService userIncrementService;
|
|
|
@Autowired
|
|
|
+ IIncrementTypeService incrementTypeService;
|
|
|
+ @Autowired
|
|
|
ICameraIncrementLogService cameraIncrementLogService;
|
|
|
|
|
|
|
|
@@ -54,14 +56,33 @@ public class AppCameraService {
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
|
|
|
}
|
|
|
List<CameraAppVo> cameraAppVoList = cameraDetailService.getListByUserAndType(user.getId(), cameraType);
|
|
|
+ setIncrementInfo(cameraAppVoList,null);
|
|
|
+ return cameraAppVoList;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setIncrementInfo(List<CameraAppVo> cameraAppVoList, HashMap<Long, GroupByCount> sceneNumMap){
|
|
|
for (CameraAppVo cameraApp : cameraAppVoList) {
|
|
|
+ if(sceneNumMap != null){
|
|
|
+ Long sceneCount = sceneNumMap.get(cameraApp.getId()) == null ? 0L : sceneNumMap.get(cameraApp.getId()).getCount();
|
|
|
+ cameraApp.setSceneCount(Math.toIntExact(sceneCount));
|
|
|
+ }
|
|
|
UserIncrement userIncrementEntity = userIncrementService.getByCameraId(cameraApp.getId());
|
|
|
if(userIncrementEntity != null){
|
|
|
+ cameraApp.setMemberLevels(userIncrementEntity.getMemberLevels());
|
|
|
cameraApp.setUserIncrementId(userIncrementEntity.getId());
|
|
|
cameraApp.setIsExpire(userIncrementEntity.getIsExpired());
|
|
|
+ IncrementType incrementType = incrementTypeService.getById(userIncrementEntity.getIncrementTypeId());
|
|
|
+ if(incrementType == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if("GB".equals(cameraApp.getUnit())){
|
|
|
+ cameraApp.setTotalSpace( BigInteger.valueOf(incrementType.getCameraCapacity() * 1024L *1024L*1024L));
|
|
|
+ }
|
|
|
+ if("SP".equals(cameraApp.getUnit())){
|
|
|
+ cameraApp.setTotalSpace(BigInteger.valueOf(incrementType.getCameraSpace()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- return cameraAppVoList;
|
|
|
}
|
|
|
|
|
|
public CameraAppVo bindCamera(String userName, String snCode) {
|
|
@@ -150,16 +171,8 @@ public class AppCameraService {
|
|
|
List<Long> cameraIdList = cameraAppVos.parallelStream().map(CameraAppVo::getId).collect(Collectors.toList());
|
|
|
//场景数量,最后拍摄时间
|
|
|
HashMap<Long, GroupByCount> sceneNumMap = sceneProService.findSceneNumByCameraIds(cameraIdList);
|
|
|
- for (CameraAppVo vo : cameraAppVos) {
|
|
|
- Long sceneCount = sceneNumMap.get(vo.getId()) == null ? 0L : sceneNumMap.get(vo.getId()).getCount();
|
|
|
- vo.setSceneCount(Math.toIntExact(sceneCount));
|
|
|
|
|
|
- UserIncrement userIncrementEntity = userIncrementService.getByCameraId(vo.getId());
|
|
|
- if(userIncrementEntity != null){
|
|
|
- vo.setUserIncrementId(userIncrementEntity.getId());
|
|
|
- vo.setIsExpire(userIncrementEntity.getIsExpired());
|
|
|
- }
|
|
|
- }
|
|
|
+ setIncrementInfo(cameraAppVos,sceneNumMap);
|
|
|
return cameraAppVos.get(0);
|
|
|
}
|
|
|
|