|
|
@@ -2,6 +2,7 @@ package com.fdkankan.ucenter.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.JwtUtil;
|
|
|
@@ -14,6 +15,8 @@ import com.fdkankan.ucenter.common.constants.ResultCode;
|
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
|
import com.fdkankan.ucenter.entity.*;
|
|
|
import com.fdkankan.ucenter.service.*;
|
|
|
+import com.fdkankan.ucenter.vo.RelicsSceneInitQueueDTO;
|
|
|
+import com.fdkankan.ucenter.vo.request.SceneParam;
|
|
|
import com.fdkankan.ucenter.vo.response.LaserSceneInfoVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
@@ -21,7 +24,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.File;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -214,4 +221,68 @@ public class InnerServiceImpl implements IInnerService {
|
|
|
}
|
|
|
return cameraDetailService.getByCameraId(camera.getId());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object getSceneBySnCode(SceneParam param) {
|
|
|
+ Camera camera = cameraService.getBySnCode(param.getSnCode());
|
|
|
+ if(camera == null ){
|
|
|
+ throw new BusinessException(ResultCode.FAILURE_CODE_400017,ResultCode.FAILURE_MSG_400017);
|
|
|
+ }
|
|
|
+ CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
|
|
|
+ if(cameraDetail == null ){
|
|
|
+ throw new BusinessException(ResultCode.FAILURE_CODE_400017,ResultCode.FAILURE_MSG_400017);
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(ScenePlus::getCameraId,camera.getId());
|
|
|
+ if(param.getSceneSource() != null){
|
|
|
+ wrapper.eq(ScenePlus::getSceneSource,param.getSceneSource());
|
|
|
+ }
|
|
|
+ List<ScenePlus> list = scenePlusService.list(wrapper);
|
|
|
+ if(list.isEmpty()){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ List<Long> plusIds = list.stream().map(ScenePlus::getId).collect(Collectors.toList());
|
|
|
+ List<Long> userIds = list.stream().map(ScenePlus::getUserId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ LambdaQueryWrapper<ScenePlusExt> wrapper1 = new LambdaQueryWrapper<>();
|
|
|
+ wrapper1.in(ScenePlusExt::getPlusId,plusIds);
|
|
|
+ if(param.getLocation() != null){
|
|
|
+ wrapper1.eq(ScenePlusExt::getLocation,param.getLocation());
|
|
|
+ }
|
|
|
+ HashMap<Long,ScenePlus> map = new HashMap<>();
|
|
|
+ HashMap<Long, User> userMap = userService.getByIds(userIds);
|
|
|
+
|
|
|
+ list.forEach(e ->map.put(e.getId(),e) );
|
|
|
+ List<ScenePlusExt> extList = scenePlusExtService.list(wrapper1);
|
|
|
+
|
|
|
+ List<RelicsSceneInitQueueDTO> voList = new ArrayList<>(extList.size());
|
|
|
+ for (ScenePlusExt scenePlusExt : extList) {
|
|
|
+ ScenePlus scenePlus = map.get(scenePlusExt.getPlusId());
|
|
|
+ if(scenePlus == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ User user = userMap.get(scenePlus.getUserId());
|
|
|
+ RelicsSceneInitQueueDTO dto = getRelicsSceneInitQueueDTO(param, scenePlusExt, scenePlus,user);
|
|
|
+ voList.add(dto);
|
|
|
+ }
|
|
|
+ return voList;
|
|
|
+ }
|
|
|
+
|
|
|
+ private RelicsSceneInitQueueDTO getRelicsSceneInitQueueDTO(SceneParam param, ScenePlusExt scenePlusExt, ScenePlus scenePlus,User user) {
|
|
|
+ RelicsSceneInitQueueDTO dto = new RelicsSceneInitQueueDTO();
|
|
|
+ dto.setSceneCode(scenePlus.getNum());
|
|
|
+ dto.setLocation(scenePlusExt.getLocation());
|
|
|
+ dto.setSceneSource(scenePlus.getSceneSource());
|
|
|
+ dto.setAlgorithmTime(scenePlusExt.getAlgorithmTime());
|
|
|
+ dto.setCreateTime(scenePlus.getCreateTime());
|
|
|
+ if(user!=null){
|
|
|
+ dto.setPhoneNum(user.getUserName());
|
|
|
+ }
|
|
|
+ dto.setUserId(scenePlus.getUserId());
|
|
|
+ dto.setSnCode(param.getSnCode());
|
|
|
+ dto.setStatus(scenePlus.getSceneStatus());
|
|
|
+ dto.setSceneName(scenePlus.getTitle());
|
|
|
+ dto.setShootCount(scenePlusExt.getShootCount());
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
}
|