|
@@ -69,21 +69,94 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
ISceneService sceneService;
|
|
|
@Autowired
|
|
|
ISceneCopyLogService sceneCopyLogService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ IUserService userService;
|
|
|
|
|
|
@Override
|
|
|
public Object pageList(SceneParam param) {
|
|
|
- if(param.getType() == 2 || param.getType() == 6){ //深时
|
|
|
- return laserService.pageList(param);
|
|
|
+ if(param.getType() == 3){ //双目lite
|
|
|
+ return sceneService.pageList(param);
|
|
|
+ }
|
|
|
+ //优化查询,去掉left join
|
|
|
+ //snCode 查询,userName 查询,companyId查询
|
|
|
+ //snCode回显,userName回显
|
|
|
+ if(StringUtils.isNotBlank(param.getSnCode())){
|
|
|
+ List<Camera> cameraList = cameraService.getLikeBySnCode(param.getSnCode());
|
|
|
+ List<Long> cameraIds = cameraList.stream().map(Camera::getId).collect(Collectors.toList());
|
|
|
+ param.setCameraIds(cameraIds);
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(param.getUserName())){
|
|
|
+ List<User> userList = userService.getLikeByUserName(param.getUserName());
|
|
|
+ List<Long> userIds = userList.stream().map(User::getId).collect(Collectors.toList());
|
|
|
+ param.setUserIds(userIds);
|
|
|
+ }
|
|
|
+ if(param.getAgentId() == null){
|
|
|
+ throw new BusinessException(ResultCode.PARAM_MISS);
|
|
|
+ }
|
|
|
+ List<CameraDetail> details = cameraDetailService.getListByAgentId(param.getAgentId());
|
|
|
+ List<Long> cameraIds = details.stream().map(CameraDetail::getCameraId).collect(Collectors.toList());
|
|
|
+ if(param.getCameraIds() == null || param.getCameraIds().isEmpty()){
|
|
|
+ param.setCameraIds(cameraIds);
|
|
|
+ }else {
|
|
|
+ List<Long> intersection = cameraIds.stream().filter(param.getCameraIds()::contains).collect(Collectors.toList());
|
|
|
+ param.setCameraIds(intersection);
|
|
|
}
|
|
|
+ if((param.getCameraIds() != null && param.getCameraIds().size()<=0) || (param.getUserIds() != null && param.getUserIds().size()<=0)){
|
|
|
+ return PageInfo.PageInfo(new Page(param.getPageNum(),param.getPageSize()));
|
|
|
+ }
|
|
|
+
|
|
|
Page<SceneVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
|
|
|
+ List<SceneVo> records = page.getRecords();
|
|
|
HashMap<String,SceneCopyLog> map = null;
|
|
|
- if(page.getRecords().size() >0){
|
|
|
- List<String> numList = page.getRecords().parallelStream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
- map = sceneCopyLogService.getByNewNumList(numList);
|
|
|
+ HashMap<Long, User> userMap = null;
|
|
|
+ HashMap<Long, Camera> cameraMap = null;
|
|
|
+ HashMap<String,JSONObject> ssSceneMap = null;
|
|
|
+
|
|
|
+ List<String> sceneNumList = page.getRecords().stream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
+ if(!records.isEmpty()){
|
|
|
+ map = sceneCopyLogService.getByNewNumList(sceneNumList);
|
|
|
+ List<Long> userIds = records.parallelStream().map(SceneVo::getUserId).collect(Collectors.toList());
|
|
|
+ userMap = userService.getByIds(userIds);
|
|
|
+ List<Long> cameraIds2 = records.parallelStream().map(SceneVo::getCameraId).collect(Collectors.toList());
|
|
|
+ cameraMap = cameraService.getByIds(cameraIds2);
|
|
|
+
|
|
|
+ if(param.getType() == 2 ){
|
|
|
+ ssSceneMap = laserService.list(sceneNumList,4);
|
|
|
+ }
|
|
|
+ if(param.getType() == 6){
|
|
|
+ ssSceneMap = laserService.list(sceneNumList,5);
|
|
|
+ }
|
|
|
}
|
|
|
for (SceneVo record : page.getRecords()) {
|
|
|
+ if(param.getType() == 2 || param.getType() == 6){
|
|
|
+ JSONObject ssObj = ssSceneMap.get(record.getNum());
|
|
|
+ if(ssObj!=null){
|
|
|
+ record.setSceneName(ssObj.getString("title"));
|
|
|
+ record.setThumb(ssObj.getString("thumb"));
|
|
|
+ record.setWebSite(ssObj.getString("webSite"));
|
|
|
+ record.setIsObj(ssObj.getInteger("buildObjStatus"));
|
|
|
+ record.setViewCount(ssObj.getInteger("viewCount"));
|
|
|
+ record.setStatus(toFdStatus(ssObj.getInteger("status")));
|
|
|
+ record.setAlgorithmTime(ssObj.getString("algorithmTime"));
|
|
|
+ }else{
|
|
|
+ record.setStatus(0);
|
|
|
+ record.setWebSite(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
record.setStatusString(SceneStatusUtil.getStatusString(record));
|
|
|
+ if(userMap != null){
|
|
|
+ User user = userMap.get(record.getUserId());
|
|
|
+ if(user != null){
|
|
|
+ record.setUserName(user.getUserName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(cameraMap != null){
|
|
|
+ Camera camera = cameraMap.get(record.getCameraId());
|
|
|
+ if(camera != null){
|
|
|
+ record.setSnCode(camera.getSnCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
if(map !=null ){
|
|
|
SceneCopyLog sceneCopyLog = map.get(record.getNum());
|
|
|
if(sceneCopyLog != null){
|
|
@@ -159,4 +232,20 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
wrapper.in(ScenePro::getStatus,0,-2);
|
|
|
return this.count(wrapper);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private Integer toFdStatus(Integer status) {
|
|
|
+ //深时状态,-1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4生成OBJ中
|
|
|
+ switch (status) {
|
|
|
+ case 0:
|
|
|
+ case 4:
|
|
|
+ return 0;
|
|
|
+ case 2:
|
|
|
+ return -2;
|
|
|
+ case 3:
|
|
|
+ return -3;
|
|
|
+ default:
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|