|
@@ -8,10 +8,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.constant.SceneConstant;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
-import com.fdkankan.common.util.DateExtUtil;
|
|
|
-import com.fdkankan.common.util.DateUtil;
|
|
|
-import com.fdkankan.common.util.FileUtils;
|
|
|
-import com.fdkankan.common.util.SecurityUtil;
|
|
|
+import com.fdkankan.common.util.*;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.constant.RedisLockKey;
|
|
@@ -20,16 +17,13 @@ import com.fdkankan.ucenter.annotation.CheckInnerApiPermit;
|
|
|
import com.fdkankan.ucenter.common.BaseController;
|
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
import com.fdkankan.ucenter.common.constants.ConstantFilePath;
|
|
|
+import com.fdkankan.ucenter.constant.CameraConstant;
|
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
|
-import com.fdkankan.ucenter.entity.Camera;
|
|
|
-import com.fdkankan.ucenter.entity.CameraDetail;
|
|
|
-import com.fdkankan.ucenter.entity.ScenePlus;
|
|
|
-import com.fdkankan.ucenter.entity.ScenePro;
|
|
|
-import com.fdkankan.ucenter.entity.SceneProEdit;
|
|
|
-import com.fdkankan.ucenter.entity.User;
|
|
|
+import com.fdkankan.ucenter.entity.*;
|
|
|
import com.fdkankan.ucenter.service.*;
|
|
|
import com.fdkankan.ucenter.service.impl.LoginService;
|
|
|
import com.fdkankan.ucenter.service.impl.SceneApiService;
|
|
|
+import com.fdkankan.ucenter.util.DateUserUtil;
|
|
|
import com.fdkankan.ucenter.vo.request.LoginParam;
|
|
|
import com.fdkankan.ucenter.vo.request.RequestSceneStatistics;
|
|
|
import com.fdkankan.ucenter.vo.response.LoginVo;
|
|
@@ -46,6 +40,7 @@ import org.joda.time.DateTime;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@Slf4j
|
|
@@ -432,4 +427,73 @@ public class SceneApiController extends BaseController {
|
|
|
return innerService.querySceneDataSource(num);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 获取场景描述等信息
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getSceneDetail", method = RequestMethod.GET)
|
|
|
+ public Result getSceneDetail(String sceneNum) throws Exception{
|
|
|
+ String token = getToken();
|
|
|
+ if(StringUtils.isEmpty(token)){
|
|
|
+ throw new BusinessException(3004, "无token参数");
|
|
|
+ }
|
|
|
+ User user = userService.getByToken(token);
|
|
|
+ if(user == null){
|
|
|
+ throw new BusinessException(3004, "token参数不正确");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(sceneNum)){
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
+ }
|
|
|
+
|
|
|
+ ScenePro pro = sceneProService.getByNum(sceneNum);
|
|
|
+ ScenePlus plus = scenePlusService.getByNum(sceneNum);
|
|
|
+ if(pro == null && plus == null){
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
+ }
|
|
|
+ Long cameraId = pro == null ? plus.getCameraId() : pro.getCameraId();
|
|
|
+ String snCode = null;
|
|
|
+ if(!ObjectUtils.isEmpty(cameraId)){
|
|
|
+ Camera cameraEntity = cameraService.getById(cameraId);
|
|
|
+ if(ObjectUtils.isEmpty(cameraEntity)){
|
|
|
+ throw new BusinessException(CameraConstant.FAILURE_CODE_6029, CameraConstant.FAILURE_MSG_6029);
|
|
|
+ }
|
|
|
+ snCode = cameraEntity.getSnCode();
|
|
|
+ }
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ String webSite = null;
|
|
|
+ String thumb = null;
|
|
|
+ String sceneName = null;
|
|
|
+ String sceneDec = null;
|
|
|
+ String createDate = null;
|
|
|
+
|
|
|
+ if(pro != null){
|
|
|
+ webSite = pro.getWebSite();
|
|
|
+ thumb = pro.getThumb();
|
|
|
+ sceneName = pro.getSceneName();
|
|
|
+ sceneDec = pro.getSceneDec();
|
|
|
+ createDate = pro.getCreateTime();
|
|
|
+ }
|
|
|
+ if(plus != null){
|
|
|
+ sceneName = plus.getTitle();
|
|
|
+ createDate = plus.getCreateTime();
|
|
|
+ sceneDec = plus.getDescription();
|
|
|
+ ScenePlusExt plusExt = scenePlusExtService.getByPlusId(plus.getId());
|
|
|
+ if(plusExt != null){
|
|
|
+ webSite = plusExt.getWebSite();
|
|
|
+ thumb = plusExt.getThumb();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("webSite", webSite);
|
|
|
+ map.put("thumb", thumb);
|
|
|
+ map.put("num", sceneNum);
|
|
|
+ map.put("sceneName", sceneName);
|
|
|
+ map.put("sceneDec", sceneDec);
|
|
|
+ map.put("snCode", snCode);
|
|
|
+ map.put("createDate", DateUserUtil.getDate(createDate).getTime());
|
|
|
+ map.put("createTime", createDate);
|
|
|
+ return Result.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
}
|