|
|
@@ -86,111 +86,28 @@ public class SceneService implements ISceneService {
|
|
|
|
|
|
@Override
|
|
|
public PageInfo pageList(ScenePram param) {
|
|
|
- if(param.getType() == null){
|
|
|
- throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
- }
|
|
|
- List<TmCamera> tmCameraList = null;
|
|
|
- String tokenValue = null;
|
|
|
- try {
|
|
|
- tokenValue = StpUtil.getTokenValue();
|
|
|
- }catch (Exception e){
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
- if(StringUtils.isNotBlank(tokenValue) && StringUtils.isBlank(param.getShare()) ){
|
|
|
- tmCameraList = tmCameraService.getByDeptIds();
|
|
|
- List<String> snCodes = tmCameraList.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
- if(CollectionUtil.isNotEmpty(snCodes)){
|
|
|
- param.setSnCodes(snCodes);
|
|
|
- }
|
|
|
- }
|
|
|
- if(StringUtils.isNotBlank(param.getDeptId())){
|
|
|
+ if(param.getSearchType() == 0){ //当前组织下场景
|
|
|
+ String deptId = tmDepartmentService.getDeptId();
|
|
|
List<String> deptIds = new ArrayList<>();
|
|
|
- if(param.getSearchType() == 0){
|
|
|
- List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(param.getDeptId());
|
|
|
- deptIds = sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList());
|
|
|
- }
|
|
|
- deptIds.add(param.getDeptId());
|
|
|
- List<TmCamera> tmCameras = tmCameraService.getByDeptIds(deptIds);
|
|
|
- Set<String> snCodeSet = tmCameras.parallelStream().map(TmCamera::getCameraSn).collect(Collectors.toSet());
|
|
|
- List<String> snCodes = param.getSnCodes();
|
|
|
- if(snCodes == null){
|
|
|
- snCodes = new ArrayList<>(snCodeSet);
|
|
|
- }else {
|
|
|
- snCodes = snCodes.stream().filter(snCodeSet::contains).collect(Collectors.toList());
|
|
|
+ deptIds.add(deptId);
|
|
|
+ if(StpUtil.hasRole("admin-super")){
|
|
|
+ List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(deptId);
|
|
|
+ deptIds.addAll(sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList()));
|
|
|
}
|
|
|
- param.setSnCodes(snCodes);
|
|
|
+ List<TmCamera> tmCameraList = tmCameraService.getByDeptIds(deptIds);
|
|
|
+ List<String> collect = tmCameraList.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
+ param.setSnCodes(collect);
|
|
|
}
|
|
|
- if(param.getCaseId() !=null){
|
|
|
- String deptId = caseService.getDeptId(param.getCaseId());
|
|
|
- List<TmCamera> tmCameras = tmCameraService.getByDeptIds(Arrays.asList(deptId));
|
|
|
- List<String> snCodes = param.getSnCodes();
|
|
|
- List<String> snCodes1 = tmCameras.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
- snCodes1.add(param.getSnCode());
|
|
|
- if(snCodes == null){
|
|
|
- snCodes = snCodes1;
|
|
|
- }else {
|
|
|
- snCodes = snCodes.stream().filter(snCodes1::contains).collect(Collectors.toList());
|
|
|
- }
|
|
|
- param.setSnCodes(snCodes);
|
|
|
- }
|
|
|
- if(CollectionUtil.isEmpty(param.getSnCodes()) && CollectionUtil.isEmpty(param.getNumList())){
|
|
|
- return PageInfo.PageInfoEmpty();
|
|
|
+ if(param.getSearchType() == 1){ //下级共享给上级场景
|
|
|
+
|
|
|
}
|
|
|
+ if(param.getSearchType() == 2){ //下级组织共享的场景数据
|
|
|
|
|
|
+ }
|
|
|
Page<SceneVo> sceneVoPage = scenePlusService.sceneList(param);
|
|
|
|
|
|
- List<SceneVo> sceneVoList = new ArrayList<>();
|
|
|
- long total = 0;
|
|
|
- if(param.getType() == 0 || param.getType() == 1 || param.getType() == 4 || param.getType() == 6){ //看看,看见 ,深时obj
|
|
|
- //获取四维(看看,看见)场景数据
|
|
|
- FdkkResponse fdkkResponse = fdKKClient.sceneList(param);
|
|
|
- if(fdkkResponse.getCode() !=0){
|
|
|
- throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
|
|
|
- }
|
|
|
- PageInfo pageInfo = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()), PageInfo.class);
|
|
|
- total = pageInfo.getTotal();
|
|
|
- JSONArray list = JSONArray.parseArray(JSONObject.toJSONString( pageInfo.getList()));
|
|
|
- sceneVoList = overSceneVo(list,param.getType());
|
|
|
-
|
|
|
- }
|
|
|
- if(param.getType() == 2 || param.getType() == 5){ //深时
|
|
|
- //获取激光(深时)场景数据
|
|
|
- LaserSceneParam laserSceneParam = new LaserSceneParam();
|
|
|
- laserSceneParam.setPageNum(param.getPageNum());
|
|
|
- laserSceneParam.setPageSize(param.getPageSize());
|
|
|
- laserSceneParam.setStatus(param.getStatus());
|
|
|
- laserSceneParam.setSnCode(param.getSnCode());
|
|
|
- laserSceneParam.setSnCodes(param.getSnCodes());
|
|
|
- if(param.getType() == 5){
|
|
|
- laserSceneParam.setSceneSource(5);
|
|
|
- }
|
|
|
- if(StringUtils.isNotBlank(param.getSceneName())){
|
|
|
- laserSceneParam.setTitle(param.getSceneName());
|
|
|
- }
|
|
|
- if(param.getNumList() != null && param.getNumList().size() >0){
|
|
|
- laserSceneParam.setSceneCodes(param.getNumList());
|
|
|
- }
|
|
|
- FdkkResponse fdkkResponse = laserClient.sceneList(laserSceneParam);
|
|
|
- if(fdkkResponse.getCode() !=200){
|
|
|
- throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
|
|
|
- }
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()));
|
|
|
- JSONArray list = jsonObject.getJSONArray("list");
|
|
|
- total =jsonObject.getLong("total");
|
|
|
- for (Object o : list) {
|
|
|
- String res = JSONObject.toJSONString(o);
|
|
|
- SceneVo vo = JSONObject.parseObject(res,SceneVo.class);
|
|
|
- if( StringUtils.isEmpty(vo.getPhone())){
|
|
|
- vo.setBind(false);
|
|
|
- }
|
|
|
- if(vo.getStatus() == 4){ //4生成OBJ中设置为计算中
|
|
|
- vo.setStatus(0);
|
|
|
- }
|
|
|
- vo.setType(param.getType());
|
|
|
- sceneVoList.add(vo);
|
|
|
- }
|
|
|
- }
|
|
|
+ List<SceneVo> sceneVoList = sceneVoPage.getRecords();
|
|
|
Set<String> snCodes = sceneVoList.stream().map(SceneVo::getSnCode).collect(Collectors.toSet());
|
|
|
List<SceneVo> modelingScene = sceneVoList.stream().filter(e -> e.getStatus() == 0).collect(Collectors.toList());
|
|
|
List<String> numList = modelingScene.stream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
@@ -207,10 +124,7 @@ public class SceneService implements ISceneService {
|
|
|
sceneVo.setStatus(5);
|
|
|
}
|
|
|
}
|
|
|
- Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
- voPage.setRecords(sceneVoList);
|
|
|
- voPage.setTotal(total);
|
|
|
- return PageInfo.PageInfo(voPage);
|
|
|
+ return PageInfo.PageInfo(sceneVoPage);
|
|
|
}
|
|
|
|
|
|
/**
|