|
@@ -82,135 +82,59 @@ public class SceneService implements ISceneService {
|
|
|
return listAll;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ IScenePlusService scenePlusService;
|
|
|
@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){
|
|
|
|
|
|
+ Page<SceneVo> page ;
|
|
|
+ if(param.getIsObj() != null){
|
|
|
+ if(param.getIsObj() == 0){
|
|
|
+ page = scenePlusService.selectLaser(new Page<>(param.getPageNum(),param.getPageSize()),param);
|
|
|
+ }else {
|
|
|
+ page = scenePlusService.selectMesh(new Page<>(param.getPageNum(),param.getPageSize()),param);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ page = scenePlusService.pageList2(new Page<>(param.getPageNum(), param.getPageSize()), param);
|
|
|
}
|
|
|
|
|
|
- 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);
|
|
|
- }
|
|
|
+ Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
+ for (SceneVo record : voPage.getRecords()) {
|
|
|
+ record.setType(toFusionType(setSceneType(record.getSceneSource(),record.getSceneType())));
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(param.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());
|
|
|
- }
|
|
|
- param.setSnCodes(snCodes);
|
|
|
+ voPage.setRecords(page.getRecords());
|
|
|
+ voPage.setTotal(page.getTotal());
|
|
|
+ return PageInfo.PageInfo(voPage);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private Integer setSceneType(Integer sceneSource,String sceneType) {
|
|
|
+ if(sceneSource == 3 ){
|
|
|
+ return 1;
|
|
|
}
|
|
|
-// if(StringUtils.isNotBlank(param.getSnCode())){
|
|
|
-// List<String> snCodes = param.getSnCodes();
|
|
|
-// List<String> snCodes1 = new ArrayList<>();
|
|
|
-// snCodes1.add(param.getSnCode());
|
|
|
-// if(snCodes == null){
|
|
|
-// snCodes = snCodes1;
|
|
|
-// }else {
|
|
|
-// snCodes = snCodes.stream().filter(snCodes1::contains).collect(Collectors.toList());
|
|
|
-// }
|
|
|
-// param.setSnCodes(snCodes);
|
|
|
-// }
|
|
|
- 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(sceneSource == 4 && sceneType.equals("laser")){
|
|
|
+ return 2;
|
|
|
}
|
|
|
- if(CollectionUtil.isEmpty(param.getSnCodes()) && CollectionUtil.isEmpty(param.getNumList())){
|
|
|
- return PageInfo.PageInfoEmpty();
|
|
|
+ if(sceneSource == 4 && sceneType.equals("4dkankan")){
|
|
|
+ return 5;
|
|
|
}
|
|
|
- List<SceneVo> sceneVoList = new ArrayList<>();
|
|
|
- long total = 0;
|
|
|
- if(param.getType() == 0 || param.getType() == 1 || param.getType() == 4 || param.getType() == 6 || param.getType() == 7){ //看看,看见 ,深时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(sceneSource == 5 && sceneType.equals("laser")){
|
|
|
+ return 6;
|
|
|
}
|
|
|
- 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);
|
|
|
- }
|
|
|
+ if(sceneSource == 5 && sceneType.equals("4dkankan")){
|
|
|
+ return 7;
|
|
|
}
|
|
|
- Set<String> snCodes = sceneVoList.stream().map(SceneVo::getSnCode).collect(Collectors.toSet());
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- HashMap<String, TmDepartment> map = tmCameraService.getMapBySnCodes(snCodes);
|
|
|
- for (SceneVo sceneVo : sceneVoList) {
|
|
|
- TmDepartment tmDepartment = map.get(sceneVo.getSnCode().toUpperCase());
|
|
|
- if(tmDepartment != null){
|
|
|
- sceneVo.setDeptId(tmDepartment.getId());
|
|
|
- sceneVo.setDeptName(tmDepartment.getName());
|
|
|
- }
|
|
|
+ private Integer toFusionType(Integer type) {
|
|
|
+ switch (type){
|
|
|
+ case 5 :return 4;
|
|
|
+ case 6 :return 5;
|
|
|
+ case 7 :return 6;
|
|
|
+ case 8 :return 7;
|
|
|
+ default: return type;
|
|
|
}
|
|
|
- Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
- voPage.setRecords(sceneVoList);
|
|
|
- voPage.setTotal(total);
|
|
|
- return PageInfo.PageInfo(voPage);
|
|
|
}
|
|
|
|
|
|
/**
|