|
@@ -60,6 +60,10 @@ public class SceneService implements ISceneService {
|
|
|
ICaseNumService caseNumService;
|
|
|
@Autowired
|
|
|
IMqSendLogService mqSendLogService;
|
|
|
+ @Autowired
|
|
|
+ IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ ITmUserService tmUserService;
|
|
|
|
|
|
@Override
|
|
|
public List<SceneVo> getSceneListAndModel(ScenePram param) {
|
|
@@ -84,137 +88,113 @@ public class SceneService implements ISceneService {
|
|
|
|
|
|
@Override
|
|
|
public PageInfo pageList(ScenePram param) {
|
|
|
- if(param.getType() == null){
|
|
|
- throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ if (param.getType() == null) {
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
- List<TmCamera> tmCameraList = null;
|
|
|
-
|
|
|
- if(StringUtils.isBlank(param.getShare() ) && StringUtils.isNotBlank(StpUtil.getTokenValue()) ){
|
|
|
- tmCameraList = tmCameraService.getByDeptIds();
|
|
|
- List<String> snCodes = tmCameraList.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
- if(CollectionUtil.isNotEmpty(snCodes)){
|
|
|
- param.setSnCodes(snCodes);
|
|
|
- }
|
|
|
+ if (StringUtils.isBlank(param.getShare()) && StringUtils.isNotBlank(StpUtil.getTokenValue())) {
|
|
|
+ param.setDeptId(tmUserService.getLoginUser().getDeptId());
|
|
|
+ }
|
|
|
+ if (param.getCaseId() != null) {
|
|
|
+ String deptId = caseService.getDeptId(param.getCaseId());
|
|
|
+ param.setDeptId(deptId);
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(param.getDeptId())){
|
|
|
+ if (StringUtils.isNotBlank(param.getDeptId())) {
|
|
|
List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(param.getDeptId());
|
|
|
List<String> 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);
|
|
|
- }
|
|
|
- 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);
|
|
|
+ List<TmUser> byDeptIds = tmUserService.getByDeptIds(deptIds);
|
|
|
+ List<String> userNames = byDeptIds.stream().map(TmUser::getUserName).collect(Collectors.toList());
|
|
|
+ param.setUserNames(userNames);
|
|
|
}
|
|
|
|
|
|
- if(CollectionUtil.isEmpty(param.getSnCodes()) && CollectionUtil.isEmpty(param.getNumList())){
|
|
|
- if(StpUtil.hasRole("admin-super") && StringUtils.isBlank(param.getSnCode()) && StringUtils.isBlank(param.getDeptId())){
|
|
|
- List<TmCamera> tmCameras = tmCameraService.list();
|
|
|
- Set<String> snCodeSet = tmCameras.parallelStream().map(TmCamera::getCameraSn).collect(Collectors.toSet());
|
|
|
- param.setSnCodes(new ArrayList<>(snCodeSet));
|
|
|
- }else {
|
|
|
- return PageInfo.PageInfoEmpty();
|
|
|
- }
|
|
|
- }
|
|
|
- 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());
|
|
|
+ Page<SceneVo> sceneVoPage = scenePlusService.pageList(new Page<>(param.getPageNum(), param.getPageSize()), param);
|
|
|
|
|
|
- }
|
|
|
- if(param.getType() == 2 || param.getType() == 5){ //深时
|
|
|
- //获取激光(深时)场景数据
|
|
|
- LaserSceneParam laserSceneParam = new LaserSceneParam();
|
|
|
- laserSceneParam.setPageNum(param.getPageNum());
|
|
|
- laserSceneParam.setPageSize(param.getPageSize());
|
|
|
- laserSceneParam.setStatus(param.getStatus());
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- 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());
|
|
|
- HashMap<String,Boolean> modelingMap = mqSendLogService.getMapByNumList(numList);
|
|
|
+// List<String> laserNumList = sceneVoPage.getRecords().stream().filter(e-> e.getType() == 2 || e.getType() == 4)
|
|
|
+// .map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<String> modelingScene = sceneVoPage.getRecords().stream().filter(e -> e.getStatus() == 0).map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
+ HashMap<String,Boolean> modelingMap = mqSendLogService.getMapByNumList(modelingScene);
|
|
|
|
|
|
- HashMap<String, TmDepartment> map = tmCameraService.getMapBySnCodes(snCodes);
|
|
|
- for (SceneVo sceneVo : sceneVoList) {
|
|
|
- TmDepartment tmDepartment = map.get(sceneVo.getSnCode().toUpperCase());
|
|
|
- if(tmDepartment != null){
|
|
|
+ List<String> userNameList = sceneVoPage.getRecords().stream().map(Model::getUserName).collect(Collectors.toList());
|
|
|
+ HashMap<String, TmDepartment> map = tmUserService.getMapByUserNames(userNameList);
|
|
|
+ for (SceneVo sceneVo : sceneVoPage.getRecords()) {
|
|
|
+ TmDepartment tmDepartment = map.get(sceneVo.getUserName());
|
|
|
+ if (tmDepartment != null) {
|
|
|
sceneVo.setDeptId(tmDepartment.getId());
|
|
|
sceneVo.setDeptName(tmDepartment.getName());
|
|
|
}
|
|
|
if(modelingMap.get(sceneVo.getNum()) != null && !modelingMap.get(sceneVo.getNum())){
|
|
|
sceneVo.setStatus(5);
|
|
|
}
|
|
|
+ sceneVo.setPayStatus(1);
|
|
|
+ sceneVo.setSceneName(sceneVo.getTitle());
|
|
|
+ sceneVo.setName(sceneVo.getTitle());
|
|
|
+ sceneVo.setStatus(setLaserStatus(sceneVo.getStatus(),sceneVo.getPayStatus()));
|
|
|
+
|
|
|
}
|
|
|
- Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
- voPage.setRecords(sceneVoList);
|
|
|
- voPage.setTotal(total);
|
|
|
- return PageInfo.PageInfo(voPage);
|
|
|
+
|
|
|
+ return PageInfo.PageInfo(sceneVoPage);
|
|
|
}
|
|
|
+// 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.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);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// Set<String> snCodes = sceneVoList.stream().map(SceneVo::getSnCode).collect(Collectors.toSet());
|
|
|
+
|
|
|
+//
|
|
|
+
|
|
|
+// }
|
|
|
+// Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
+// voPage.setRecords(sceneVoList);
|
|
|
+// voPage.setTotal(total);
|
|
|
+// return PageInfo.PageInfo(voPage);
|
|
|
+ // }
|
|
|
|
|
|
/**
|
|
|
* 四维看看返回数据格式转换
|