|
@@ -15,6 +15,7 @@ import com.fdkankan.platform.api.feign.PlatformUserClient;
|
|
|
import com.fdkankan.platform.api.vo.Camera;
|
|
|
import com.fdkankan.platform.api.vo.User;
|
|
|
import com.fdkankan.scene.api.vo.SceneCnt;
|
|
|
+import com.fdkankan.scene.entity.Folder;
|
|
|
import com.fdkankan.scene.entity.Scene;
|
|
|
import com.fdkankan.scene.entity.SceneCooperation;
|
|
|
import com.fdkankan.scene.entity.ScenePro;
|
|
@@ -27,6 +28,8 @@ import com.fdkankan.scene.service.ISceneService;
|
|
|
import com.fdkankan.scene.service.IUserSceneService;
|
|
|
import com.fdkankan.scene.vo.SceneParamVO;
|
|
|
import com.fdkankan.scene.vo.SceneVO;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
@@ -39,6 +42,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
@Service
|
|
@@ -183,4 +187,265 @@ public class UserSceneServiceImpl implements IUserSceneService {
|
|
|
|
|
|
return ResultData.ok(map);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultData getNewScenes(SceneParamVO param) throws Exception {
|
|
|
+
|
|
|
+ Long userId = param.getUserId();
|
|
|
+ if(param.getKeywordType().equals("userName") && StringUtils.isNotEmpty(param.getSearchKey())){
|
|
|
+
|
|
|
+ ResultData<List<User>> userLikeUserName = platformUserClient
|
|
|
+ .getUserLikeUserName("%" + param.getSearchKey() + "%");
|
|
|
+ if(!userLikeUserName.getSuccess()){
|
|
|
+ throw new Exception(ServerCode.FEIGN_REQUEST_FAILD.message());
|
|
|
+ }
|
|
|
+ List<User> userList = userLikeUserName.getData();
|
|
|
+ List<Long> userIds = userList.parallelStream().map(User::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<SceneCooperation> sceneCooperationList = sceneCooperationService.list(
|
|
|
+ new LambdaQueryWrapper<SceneCooperation>()
|
|
|
+ .select(SceneCooperation::getNum)
|
|
|
+ .in(SceneCooperation::getUserId, userIds));
|
|
|
+
|
|
|
+ //获取所有协作场景的场景码集合
|
|
|
+ param.setNumList(sceneCooperationList.parallelStream().map(SceneCooperation::getNum).collect(Collectors.toList()));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// Map<String, Object> map = sceneService.getNewScenesPagerByUserId(userId, param);
|
|
|
+// PageInfo<Object> pageInfo = (PageInfo<Object>) map.get("pageInfo");
|
|
|
+// List<Object> list = pageInfo.getList();
|
|
|
+// PageHelper.clearPage();
|
|
|
+// list.parallelStream().filter(object -> object instanceof ResponseScene).forEach(object -> {
|
|
|
+//
|
|
|
+// ResponseScene responseScene = (ResponseScene) object;
|
|
|
+// // 当计算时,返回给前端的状态为计算中
|
|
|
+// if (responseScene.getStatus() == -1) {
|
|
|
+// responseScene.setStatus(0);
|
|
|
+// } else if (responseScene.getStatus() == 500) {
|
|
|
+// responseScene.setStatus(-1);
|
|
|
+// }
|
|
|
+// // 获取VrThumb
|
|
|
+// SceneProEditEntity editEntity = sceneProEditService.findByProId(responseScene.getId());
|
|
|
+// if (!ObjectUtils.isEmpty(editEntity)) {
|
|
|
+// responseScene.setVrNum(editEntity.getVrNum());
|
|
|
+// }
|
|
|
+// if (responseScene.getCameraId() != null) {
|
|
|
+// CameraEntity cameraEntity = goodsService.findCameraById(responseScene.getCameraId());
|
|
|
+// if (cameraEntity != null) {
|
|
|
+// responseScene.setChildName(cameraEntity.getChildName());
|
|
|
+// responseScene.setSnCode(cameraEntity.getSnCode());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// SceneCooperationEntity sceneCooperationEntity = sceneCooperationService.findBySceneNum(responseScene.getNum());
|
|
|
+// if (sceneCooperationEntity != null) {
|
|
|
+// responseScene.setCooperationUserId(String.valueOf(sceneCooperationEntity.getUserId()));
|
|
|
+// responseScene.setCooperationUserName(sceneCooperationService.findUserName(responseScene.getNum()));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// );
|
|
|
+// return Result.success(map);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Object> getNewScenesPagerByUserId(Long userId, SceneParamVO param) throws Exception {
|
|
|
+
|
|
|
+ List<ScenePro> sceneEntityList = new ArrayList<>();
|
|
|
+ List<Folder> folderEntityList = new ArrayList<>();
|
|
|
+
|
|
|
+ boolean searchCamera = false;
|
|
|
+ List<Camera> cameraList = new ArrayList<>();
|
|
|
+
|
|
|
+ String sceneName = "";
|
|
|
+ if (StringUtils.isNotEmpty(param.getKeywordType())) {
|
|
|
+ if (param.getKeywordType().equals("sceneName")) {
|
|
|
+ sceneName = param.getSearchKey();
|
|
|
+ } else if (param.getKeywordType().equals("snCode") && Objects
|
|
|
+ .nonNull(param.getSearchKey())) {
|
|
|
+ ResultData<List<Camera>> cameraResult = platformGoodsClient
|
|
|
+ .getCameraLikeSnCode(param.getSearchKey());
|
|
|
+ if (!cameraResult.getSuccess())
|
|
|
+ throw new Exception(ServerCode.FEIGN_REQUEST_FAILD.message());
|
|
|
+ cameraList = cameraResult.getData();
|
|
|
+ searchCamera = true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //根目录时,需要排除已经归类的场景
|
|
|
+// if(param.getFolderId() == null){
|
|
|
+// //查出所有已经归类的场景id
|
|
|
+// Condition condition = new Condition(FolderEntity.class);
|
|
|
+// condition.and().andEqualTo("userId", userId).andEqualTo("type", param.getFolderType());
|
|
|
+// List<FolderEntity> folderList = folderService.findAll(condition, "create_time desc");
|
|
|
+//
|
|
|
+// folderEntityList = folderList.parallelStream().filter(folder->ObjectUtils.isEmpty(folder.getParentId())).collect(Collectors.toList());
|
|
|
+// // 查找所有的文件夹
|
|
|
+// List<Long> folderIds = folderList.parallelStream().map(FolderEntity::getId).collect(Collectors.toList());
|
|
|
+// List<Long> sceneIdList = new ArrayList<>();
|
|
|
+// if(!ObjectUtils.isEmpty(folderIds)){
|
|
|
+// Condition folderSceneCondition = new Condition(FolderSceneEntity.class);
|
|
|
+// folderSceneCondition.and().andIn("folderId",folderIds);
|
|
|
+// List<FolderSceneEntity> folderSceneEntities = folderSceneService.findAll(folderSceneCondition);
|
|
|
+// sceneIdList = folderSceneEntities.parallelStream().map(FolderSceneEntity::getSceneId).collect(Collectors.toList());
|
|
|
+// }
|
|
|
+//
|
|
|
+// Condition sceneCondition = new Condition(SceneProEntity.class);
|
|
|
+// sceneCondition.and().andEqualTo("userId", userId).andNotEqualTo("sceneSource", "11");
|
|
|
+// if(sceneIdList.size() > 0){
|
|
|
+// sceneCondition.and().andNotIn("id", sceneIdList);
|
|
|
+// }
|
|
|
+//
|
|
|
+// //协作者 检索
|
|
|
+// if(param.getKeywordType().equals("userName") && StringUtils.isNotEmpty(param.getSearchKey()) ){
|
|
|
+// if( param.getSceneNumList()!=null && param.getSceneNumList().size()>0) {
|
|
|
+// sceneCondition.and().andIn("num", param.getSceneNumList());
|
|
|
+// }else{
|
|
|
+// sceneCondition.and().andEqualTo("num","");
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(!ObjectUtils.isEmpty(param.getSceneSource())){
|
|
|
+// if(param.getSceneSource().contains(",")){
|
|
|
+// sceneCondition.and().andIn("sceneSource", Arrays.asList(param.getSceneSource().split(",")));
|
|
|
+// }else{
|
|
|
+// sceneCondition.and().andEqualTo("sceneSource", param.getSceneSource());
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// if(StringUtil.isNotEmpty(param.getSceneType())){
|
|
|
+// sceneCondition.and().andEqualTo("sceneType", param.getSceneType());
|
|
|
+// }
|
|
|
+// if(StringUtils.isNotEmpty(sceneName)){
|
|
|
+// sceneCondition.and().andLike("sceneName", "%" + sceneName + "%");
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(param.getStartTime() != null){
|
|
|
+// sceneCondition.and().andGreaterThanOrEqualTo("createTime", param.getStartTime());
|
|
|
+// }
|
|
|
+// if(param.getEndTime() != null){
|
|
|
+// sceneCondition.and().andLessThanOrEqualTo("createTime", param.getEndTime());
|
|
|
+// }
|
|
|
+// if(searchCamera){
|
|
|
+// if(ObjectUtils.isEmpty(cameraEntities)){
|
|
|
+// sceneEntityList = new ArrayList<>();
|
|
|
+// }else{
|
|
|
+// sceneCondition.and().andIn("cameraId", cameraEntities.stream().map(CameraEntity::getId).collect(Collectors.toList()));
|
|
|
+// sceneEntityList = sceneProService.findAll(sceneCondition, "create_time desc");
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// sceneEntityList = sceneProService.findAll(sceneCondition, "create_time desc");
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// //进入目录层级后,根据目录获取当前目录的所有场景
|
|
|
+// Condition folderSceneCondition = new Condition(FolderSceneEntity.class);
|
|
|
+// folderSceneCondition.and().andEqualTo("folderId", param.getFolderId());
|
|
|
+//
|
|
|
+// List<FolderSceneEntity> folderSceneList = folderSceneService.findAll(folderSceneCondition, "create_time desc");
|
|
|
+// List<Long> sceneIdList = folderSceneList.parallelStream().map(FolderSceneEntity::getSceneId).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// if(sceneIdList.size() > 0){
|
|
|
+// Condition sceneCondition = new Condition(SceneProEntity.class);
|
|
|
+// sceneCondition.and().andEqualTo("userId", userId).andNotEqualTo("sceneSource", "11").andIn("id", sceneIdList);
|
|
|
+//
|
|
|
+// if(!ObjectUtils.isEmpty(param.getSceneSource())){
|
|
|
+// if(param.getSceneSource().contains(",")){
|
|
|
+// sceneCondition.and().andIn("sceneSource", Arrays.asList(param.getSceneSource().split(",")));
|
|
|
+// }else{
|
|
|
+// sceneCondition.and().andEqualTo("sceneSource", param.getSceneSource());
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //协作者 检索
|
|
|
+// if(param.getKeywordType().equals("userName") && StringUtils.isNotEmpty(param.getSearchKey()) ){
|
|
|
+// if( param.getSceneNumList()!=null && param.getSceneNumList().size()>0) {
|
|
|
+// sceneCondition.and().andIn("num", param.getSceneNumList());
|
|
|
+// }else{
|
|
|
+// sceneCondition.and().andEqualTo("num","");
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(StringUtil.isNotEmpty(param.getSceneType())){
|
|
|
+// sceneCondition.and().andEqualTo("sceneType", param.getSceneType());
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// if(StringUtils.isNotEmpty(sceneName)){
|
|
|
+// sceneCondition.and().andLike("sceneName", "%" + sceneName + "%");
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(param.getStartTime() != null){
|
|
|
+// sceneCondition.and().andGreaterThanOrEqualTo("createTime", param.getStartTime());
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(param.getEndTime() != null){
|
|
|
+// sceneCondition.and().andLessThanOrEqualTo("createTime", param.getEndTime());
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(searchCamera){
|
|
|
+// if(ObjectUtils.isEmpty(cameraEntities)){
|
|
|
+// sceneEntityList = new ArrayList<>();
|
|
|
+// }else{
|
|
|
+// sceneCondition.and().andIn("cameraId", cameraEntities.stream().map(CameraEntity::getId).collect(Collectors.toList()));
|
|
|
+// sceneEntityList = sceneProService.findAll(sceneCondition, "create_time desc");
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// sceneEntityList = sceneProService.findAll(sceneCondition, "create_time desc");
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //获取文件夹数量
|
|
|
+// Condition condition = new Condition(FolderEntity.class);
|
|
|
+// condition.and().andEqualTo("userId", userId).andEqualTo("parentId", param.getFolderId());
|
|
|
+// folderEntityList = folderService.findAll(condition, "create_time desc");
|
|
|
+// }
|
|
|
+// List<ResponseScene> responseScenes = sceneService.convertPro(sceneEntityList);
|
|
|
+//
|
|
|
+// //当前文件夹所包含的所有场景数量
|
|
|
+// Long sceneNum = 0L;
|
|
|
+// List<ResponseFolder> responseFolderList = new ArrayList<>();
|
|
|
+// List<SceneEntity> sceneList = new ArrayList<>();
|
|
|
+//
|
|
|
+// List<Object> result = new ArrayList<>();
|
|
|
+// if(!ObjectUtils.isEmpty(param.getSceneSource()) && StringUtil.isEmpty(param.getSceneType()) &&
|
|
|
+// param.getStartTime() == null && param.getEndTime() == null){
|
|
|
+//
|
|
|
+// responseFolderList = folderService.convert(folderEntityList);
|
|
|
+// result.addAll(responseFolderList);
|
|
|
+//
|
|
|
+// //根目录判断是否有双目文件夹
|
|
|
+// if(param.getFolderId() == null && param.getSceneSource().contains("1")){
|
|
|
+// //判断是否有双目场景,有则增加双目的文件夹
|
|
|
+// Condition sceneCondition = new Condition(SceneEntity.class);
|
|
|
+// sceneCondition.and().andEqualTo("userId", userId);
|
|
|
+// sceneList = sceneService.findAll(sceneCondition, "create_time desc");
|
|
|
+//
|
|
|
+// if(sceneList != null && sceneList.size() > 0){
|
|
|
+// ResponseFolder sceneFolder = new ResponseFolder();
|
|
|
+// sceneFolder.setName("双目文件夹");
|
|
|
+// //type为3,表示旧版双目相机场景
|
|
|
+// sceneFolder.setType(3);
|
|
|
+// sceneFolder.setIsFolder(1);
|
|
|
+// sceneFolder.setSceneNum(sceneList.size());
|
|
|
+// result.add(sceneFolder);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //统计当前目录所有场景数量
|
|
|
+// sceneNum += responseFolderList.parallelStream().mapToLong(ResponseFolder::getSceneNum).sum();
|
|
|
+// sceneNum += sceneList.size();
|
|
|
+// sceneNum += responseScenes.size();
|
|
|
+// result.addAll(responseScenes);
|
|
|
+//
|
|
|
+// PageInfo<Object> data = PageInfoUtils.list2PageInfo(result, param.getPageNum(), param.getPageSize());
|
|
|
+//
|
|
|
+// Map<String, Object> map = new HashMap<>();
|
|
|
+// map.put("sceneNum", sceneNum);
|
|
|
+// map.put("pageInfo", data);
|
|
|
+// return map;
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|