|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.csp.sentinel.util.StringUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -15,15 +16,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.common.constant.*;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.response.ResultData;
|
|
|
+import com.fdkankan.common.user.SSOLoginHelper;
|
|
|
+import com.fdkankan.common.user.SSOUser;
|
|
|
import com.fdkankan.common.util.*;
|
|
|
import com.fdkankan.fyun.constant.StorageType;
|
|
|
import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
|
+import com.fdkankan.platform.api.dto.Camera;
|
|
|
+import com.fdkankan.platform.api.dto.CameraDetail;
|
|
|
import com.fdkankan.platform.api.feign.PlatformGoodsClient;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.constant.RedisLockKey;
|
|
|
import com.fdkankan.redis.util.RedisLockUtil;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
-import com.fdkankan.scene.api.dto.SceneProDTO;
|
|
|
import com.fdkankan.scene.bean.IconBean;
|
|
|
import com.fdkankan.scene.bean.TagBean;
|
|
|
import com.fdkankan.scene.entity.*;
|
|
@@ -44,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.io.BufferedReader;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
@@ -130,6 +135,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
IScenePlusExtService scenePlusExtService;
|
|
|
@Autowired
|
|
|
ISceneDownloadLogService sceneDownloadLogService;
|
|
|
+ @Autowired
|
|
|
+ SSOLoginHelper ssoLoginHelper;
|
|
|
+ @Autowired
|
|
|
+ IFdkkLaserService fdkkLaserService;
|
|
|
+ @Resource
|
|
|
+ ISceneProMapper sceneProMapper;
|
|
|
|
|
|
@Override
|
|
|
public List<SceneVO> convert(List<ScenePro> list){
|
|
@@ -5272,4 +5283,37 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
public List<SceneProPO> findByCameraIds(String cameraIds, String startTime, String endTime) {
|
|
|
return this.baseMapper.findByCameraIds(cameraIds, startTime, endTime);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultData getScenesBySnCode(String snCode, String token) {
|
|
|
+ if(StringUtils.isEmpty(token)){
|
|
|
+ throw new BusinessException(3004, "无token参数");
|
|
|
+ }
|
|
|
+
|
|
|
+ SSOUser ssoUser = ssoLoginHelper.loginCheck(token);
|
|
|
+ if(ssoUser == null){
|
|
|
+ throw new BusinessException(3004, "token参数不正确");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtil.isEmpty(snCode)){
|
|
|
+ throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ Camera cameraEntity = platformGoodsClient.getCameraBySnCode(snCode).getData();
|
|
|
+ if(cameraEntity == null ){
|
|
|
+ throw new BusinessException(CameraConstant.FAILURE_6018);
|
|
|
+ }
|
|
|
+ CameraDetail cameraDetailEntity = platformGoodsClient.getCameraDetailByCameraId(cameraEntity.getId()).getData();
|
|
|
+ if(cameraDetailEntity == null ){
|
|
|
+ throw new BusinessException(CameraConstant.FAILURE_6018);
|
|
|
+ }
|
|
|
+ if(!cameraDetailEntity.getUserId().equals(ssoUser.getId())){
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+ if(cameraDetailEntity.getCameraType() == 10 ){ //激光场景
|
|
|
+ List<SceneBySnCodeVo> scenesBySnCode = fdkkLaserService.getScenesBySnCode(snCode, token);
|
|
|
+ return ResultData.ok(scenesBySnCode);
|
|
|
+ }
|
|
|
+ List<SceneBySnCodeVo> sceneVo = sceneProMapper.getNumAndNameByCameraId(cameraEntity.getId(), ssoUser.getId());
|
|
|
+ return ResultData.ok(sceneVo);
|
|
|
+ }
|
|
|
}
|