|
@@ -132,6 +132,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private RabbitMqProducer mqProducer;
|
|
private RabbitMqProducer mqProducer;
|
|
|
|
+ @Autowired
|
|
|
|
+ ICameraTypeService cameraTypeService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HashMap<String, SceneNumVo> findSceneNumber(String token) {
|
|
public HashMap<String, SceneNumVo> findSceneNumber(String token) {
|
|
@@ -236,9 +238,6 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
this.lockOrUnLockBySpace(cameraDetail,cameraId);
|
|
this.lockOrUnLockBySpace(cameraDetail,cameraId);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @param payStatus -2 封存,为 1 解封
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public void lockOrUnLockBySpace(CameraDetail cameraDetail, Long cameraId) {
|
|
public void lockOrUnLockBySpace(CameraDetail cameraDetail, Long cameraId) {
|
|
|
|
|
|
@@ -246,6 +245,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
if(voList .size() <=0){
|
|
if(voList .size() <=0){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ CameraType cameraType = cameraTypeService.getByCameraType(cameraDetail.getType());
|
|
|
|
+
|
|
Long totalSpace = cameraDetailService.getTotalSpaceByCameraId(cameraDetail);
|
|
Long totalSpace = cameraDetailService.getTotalSpaceByCameraId(cameraDetail);
|
|
Long usedSpace = 0L;
|
|
Long usedSpace = 0L;
|
|
|
|
|
|
@@ -267,14 +268,16 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
lockOrUnLockScenes(sceneIds,1);
|
|
lockOrUnLockScenes(sceneIds,1);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
//按计算完成时间由新到旧封存
|
|
//按计算完成时间由新到旧封存
|
|
//按计算完成时间由旧到新解封
|
|
//按计算完成时间由旧到新解封
|
|
- List<Long> lockedIds = new ArrayList<>();
|
|
|
|
|
|
+ //payStatus 1解封,-2封存
|
|
|
|
+ List<SimpleSceneVo> lockedIds = new ArrayList<>();
|
|
if(usedSpace > totalSpace){
|
|
if(usedSpace > totalSpace){
|
|
sceneVos = sceneVos.stream().filter(entity -> entity.getPayStatus() ==1).collect(Collectors.toList());
|
|
sceneVos = sceneVos.stream().filter(entity -> entity.getPayStatus() ==1).collect(Collectors.toList());
|
|
Long space = getSceneLockedIds(lockedIds, sceneVos, usedSpace - totalSpace,cameraDetail.getUnit());
|
|
Long space = getSceneLockedIds(lockedIds, sceneVos, usedSpace - totalSpace,cameraDetail.getUnit());
|
|
log.info("lockOrUnLockBySpace---cameraId:{},totalSpace:{},useSpace{},space:{},payStatus:{}", cameraId,totalSpace,usedSpace,space,-2);
|
|
log.info("lockOrUnLockBySpace---cameraId:{},totalSpace:{},useSpace{},space:{},payStatus:{}", cameraId,totalSpace,usedSpace,space,-2);
|
|
- lockOrUnLockScenes(lockedIds,-2);
|
|
|
|
|
|
+ lockOrUnLockScenes(lockedIds,-2,cameraType.getIsLaser());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -283,11 +286,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
CollectionUtil.reverse(sceneVos);
|
|
CollectionUtil.reverse(sceneVos);
|
|
Long space = getSceneUnLockedIds(lockedIds, sceneVos, totalSpace - usedSpace,cameraDetail.getUnit());
|
|
Long space = getSceneUnLockedIds(lockedIds, sceneVos, totalSpace - usedSpace,cameraDetail.getUnit());
|
|
log.info("lockOrUnLockBySpace---cameraId:{},totalSpace:{},useSpace{},space:{},payStatus:{}", cameraId,totalSpace,usedSpace,space,1);
|
|
log.info("lockOrUnLockBySpace---cameraId:{},totalSpace:{},useSpace{},space:{},payStatus:{}", cameraId,totalSpace,usedSpace,space,1);
|
|
- lockOrUnLockScenes(lockedIds,1);
|
|
|
|
|
|
+ lockOrUnLockScenes(lockedIds,1,cameraType.getIsLaser());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private Long getSceneUnLockedIds(List<Long> lockedIds ,List<SimpleSceneVo> list,Long beyondSpace,String unit){
|
|
|
|
|
|
+ private Long getSceneUnLockedIds(List<SimpleSceneVo> lockedIds ,List<SimpleSceneVo> list,Long beyondSpace,String unit){
|
|
Long space = 0L;
|
|
Long space = 0L;
|
|
if (list != null && list.size() > 0){
|
|
if (list != null && list.size() > 0){
|
|
for (SimpleSceneVo scenePro : list){
|
|
for (SimpleSceneVo scenePro : list){
|
|
@@ -299,13 +302,13 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
space += sceneSpace;
|
|
space += sceneSpace;
|
|
- lockedIds.add(scenePro.getId());
|
|
|
|
|
|
+ lockedIds.add(scenePro);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return space;
|
|
return space;
|
|
}
|
|
}
|
|
|
|
|
|
- private Long getSceneLockedIds(List<Long> lockedIds ,List<SimpleSceneVo> list,Long beyondSpace,String unit){
|
|
|
|
|
|
+ private Long getSceneLockedIds(List<SimpleSceneVo> lockedIds ,List<SimpleSceneVo> list,Long beyondSpace,String unit){
|
|
Long space = 0L;
|
|
Long space = 0L;
|
|
if (list != null && list.size() > 0){
|
|
if (list != null && list.size() > 0){
|
|
for (SimpleSceneVo scenePro : list){
|
|
for (SimpleSceneVo scenePro : list){
|
|
@@ -314,7 +317,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
sceneSpace = 1L;
|
|
sceneSpace = 1L;
|
|
}
|
|
}
|
|
space += sceneSpace;
|
|
space += sceneSpace;
|
|
- lockedIds.add(scenePro.getId());
|
|
|
|
|
|
+ lockedIds.add(scenePro);
|
|
if (space >= beyondSpace){
|
|
if (space >= beyondSpace){
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -325,43 +328,46 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
|
|
|
|
// payStatus 为 -2 封存,为 1 解封
|
|
// payStatus 为 -2 封存,为 1 解封
|
|
- public void lockOrUnLockScenes(List<Long> lockedIds,Integer payStatus) {
|
|
|
|
|
|
+ public void lockOrUnLockScenes(List<SimpleSceneVo> lockedIds,Integer payStatus,Integer isLaser) {
|
|
if (lockedIds == null || lockedIds.size() == 0){
|
|
if (lockedIds == null || lockedIds.size() == 0){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
- updateWrapper.set(ScenePro::getPayStatus,payStatus)
|
|
|
|
- .eq(ScenePro::getIsUpgrade,0)
|
|
|
|
- .in(ScenePro::getId,lockedIds);
|
|
|
|
- this.update(updateWrapper);
|
|
|
|
|
|
+ List<String> v3NumList = lockedIds.stream().filter(e ->"v3".equals(e.getVersion())).map(SimpleSceneVo::getNum).collect(Collectors.toList());
|
|
|
|
+ List<String> v4NumList = lockedIds.stream().filter(e ->"v4".equals(e.getVersion())).map(SimpleSceneVo::getNum).collect(Collectors.toList());
|
|
|
|
+ if(!v3NumList.isEmpty()){
|
|
|
|
+ LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
+ updateWrapper.set(ScenePro::getPayStatus,payStatus)
|
|
|
|
+ .eq(ScenePro::getIsUpgrade,0)
|
|
|
|
+ .in(ScenePro::getNum,lockedIds);
|
|
|
|
+ this.update(updateWrapper);
|
|
|
|
+ }
|
|
|
|
+ if(!v4NumList.isEmpty()){
|
|
|
|
+ LambdaUpdateWrapper<ScenePlus> updatePlusWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
+ updatePlusWrapper.set(ScenePlus::getPayStatus,payStatus)
|
|
|
|
+ .in(ScenePlus::getNum,lockedIds);
|
|
|
|
+ scenePlusService.update(updatePlusWrapper);
|
|
|
|
+ }
|
|
|
|
|
|
- LambdaUpdateWrapper<ScenePlus> updatePlusWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
- updatePlusWrapper.set(ScenePlus::getPayStatus,payStatus)
|
|
|
|
- .in(ScenePlus::getId,lockedIds);
|
|
|
|
- scenePlusService.update(updatePlusWrapper);
|
|
|
|
|
|
+ this.updateOssStatus(v3NumList,v4NumList,payStatus);
|
|
|
|
|
|
- this.updateOssStatus(lockedIds,payStatus);
|
|
|
|
|
|
+ if(isLaser == 1){
|
|
|
|
+ //激光系统相机
|
|
|
|
+ //1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4重算中
|
|
|
|
+ v3NumList.addAll(v4NumList);
|
|
|
|
+ laserService.updateStatus(v3NumList,payStatus== 1 ?2:3);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 修改oss status.json中 payStatus
|
|
* 修改oss status.json中 payStatus
|
|
*/
|
|
*/
|
|
- private void updateOssStatus(List<Long> lockedIds, Integer payStatus) {
|
|
|
|
- LambdaQueryWrapper<ScenePro> proWr = new LambdaQueryWrapper<>();
|
|
|
|
- proWr.eq(ScenePro::getIsUpgrade,0);
|
|
|
|
- proWr.in(ScenePro::getId,lockedIds);
|
|
|
|
- List<ScenePro> proList = this.list(proWr);
|
|
|
|
-
|
|
|
|
- LambdaQueryWrapper<ScenePlus> pluWr = new LambdaQueryWrapper<>();
|
|
|
|
- pluWr.in(ScenePlus::getId,lockedIds);
|
|
|
|
- List<ScenePlus> plusList = scenePlusService.list(pluWr);
|
|
|
|
- for (ScenePro scenePro : proList) {
|
|
|
|
- this.updateOssStatus(String.format(OssPath.v3_statusPath,scenePro.getNum()),payStatus);
|
|
|
|
|
|
+ private void updateOssStatus(List<String> v3NumList ,List<String> v4NumList , Integer payStatus) {
|
|
|
|
+ if(!v3NumList.isEmpty()){
|
|
|
|
+ v3NumList.forEach(e ->this.updateOssStatus(String.format(OssPath.v3_statusPath,e),payStatus));
|
|
}
|
|
}
|
|
- for (ScenePlus scenePlus : plusList) {
|
|
|
|
- this.updateOssStatus(String.format(OssPath.v4_statusPath,scenePlus.getNum()),payStatus);
|
|
|
|
|
|
+ if(!v4NumList.isEmpty()){
|
|
|
|
+ v4NumList.forEach(e ->this.updateOssStatus(String.format(OssPath.v4_statusPath,e),payStatus));
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -671,8 +677,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
ScenePlusExt ext = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
ScenePlusExt ext = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
space = ext.getSpace();
|
|
space = ext.getSpace();
|
|
}
|
|
}
|
|
|
|
+ CameraType cameraType = cameraTypeService.getByCameraType(detailEntity.getType());
|
|
|
|
|
|
- Boolean canSpace = cameraDetailService.checkSpace(detailEntity,incrementType,space);
|
|
|
|
|
|
+ Boolean canSpace = cameraDetailService.checkSpace(detailEntity,incrementType,space,cameraType);
|
|
|
|
|
|
if(!canSpace){
|
|
if(!canSpace){
|
|
throw new BusinessException(CameraConstant.FAILURE_CODE_6008, CameraConstant.FAILURE_MSG_6008);
|
|
throw new BusinessException(CameraConstant.FAILURE_CODE_6008, CameraConstant.FAILURE_MSG_6008);
|
|
@@ -1072,6 +1079,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
sceneVo.setPayStatus(scenePro.getPayStatus());
|
|
sceneVo.setPayStatus(scenePro.getPayStatus());
|
|
sceneVo.setCreateTime(DateUserUtil.getDate(scenePro.getCreateTime()).getTime());
|
|
sceneVo.setCreateTime(DateUserUtil.getDate(scenePro.getCreateTime()).getTime());
|
|
sceneVo.setSpace(scenePro.getSpace());
|
|
sceneVo.setSpace(scenePro.getSpace());
|
|
|
|
+ sceneVo.setVersion("v3");
|
|
voList.add(sceneVo);
|
|
voList.add(sceneVo);
|
|
}
|
|
}
|
|
List<ScenePlus> plusList = scenePlusService.getListByCameraId(cameraId);
|
|
List<ScenePlus> plusList = scenePlusService.getListByCameraId(cameraId);
|
|
@@ -1093,6 +1101,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
}
|
|
}
|
|
sceneVo.setCreateTime(DateUserUtil.getDate(time).getTime());
|
|
sceneVo.setCreateTime(DateUserUtil.getDate(time).getTime());
|
|
sceneVo.setSpace(ext.getSpace());
|
|
sceneVo.setSpace(ext.getSpace());
|
|
|
|
+ sceneVo.setVersion("v4");
|
|
voList.add(sceneVo);
|
|
voList.add(sceneVo);
|
|
}
|
|
}
|
|
return voList;
|
|
return voList;
|