lyhzzz 1 mēnesi atpakaļ
vecāks
revīzija
51f216d14f

+ 6 - 0
README.md

@@ -40,4 +40,10 @@
 1.批量协作
 2.协作商品详情
 http://120.25.146.52:3090/project/228/interface/api/cat_2077
+~~~~
+
+
+~~~~
+1,/ucenter/user/scene/newList  个人中心场景列表接口
+    通过token获取用户数据,无法越过token获取其他数据,用户Id强校验
 ~~~~

+ 5 - 0
src/main/java/com/fdkankan/ucenter/controller/DeviceSceneController.java

@@ -3,6 +3,8 @@ package com.fdkankan.ucenter.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.ucenter.common.BaseController;
 import com.fdkankan.ucenter.common.Result;
+import com.fdkankan.ucenter.common.constants.ResultCode;
+import com.fdkankan.ucenter.exception.BusinessException;
 import com.fdkankan.ucenter.service.IScenePlusService;
 import com.fdkankan.ucenter.service.ISceneProService;
 import com.fdkankan.ucenter.service.impl.AppSceneService;
@@ -41,6 +43,9 @@ public class DeviceSceneController extends BaseController {
         if(StringUtils.isNotBlank(param.getSearchKey())){
             param.setSceneName(param.getSearchKey());
         }
+        if(param.getCameraId() == null){
+            throw new BusinessException(ResultCode.PARAM_MISS);
+        }
         JSONObject data = sceneProService.newList(param, null);
         JSONObject pageInfo = data.getJSONObject("pageInfo");
         pageInfo.put("sceneNum",pageInfo.getInteger("total"));

+ 72 - 70
src/main/java/com/fdkankan/ucenter/controller/SceneController.java

@@ -45,7 +45,7 @@ import java.util.UUID;
  * 场景表 前端控制器
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-07-04
  */
 @RestController
@@ -71,16 +71,17 @@ public class SceneController extends BaseController {
     TakeLookService takeLookService;
 
     @PostMapping("/findSceneNumber")
-    public Result findSceneNumber(){
+    public Result findSceneNumber() {
         return Result.success(sceneProService.findSceneNumber(getToken()));
     }
 
     @PostMapping("/getOldSceneList")
-    public Result getOldSceneList(@RequestBody SceneParam param){
+    public Result getOldSceneList(@RequestBody SceneParam param) {
         User user = userService.getByToken(getToken());
         param.setUserId(user.getId());
         return Result.success(sceneService.pageList(param));
     }
+
     @PostMapping(value = "/list")
     public Result getScenes(@RequestBody RequestScene param) throws Exception {
         String username = JwtUtil.getUsername(getToken());
@@ -89,24 +90,24 @@ public class SceneController extends BaseController {
     }
 
     @PostMapping("/newList")
-    public Result newList(@RequestBody SceneParam param){
+    public Result newList(@RequestBody SceneParam param) {
         String username = JwtUtil.getUsername(getToken());
-        return Result.success(sceneProService.newList(param,username));
+        return Result.success(sceneProService.newList(param, username));
     }
 
     @PostMapping("/getOnlySceneList")
-    public Result getOnlySceneList(@RequestBody SceneParam param){
+    public Result getOnlySceneList(@RequestBody SceneParam param) {
         String username = JwtUtil.getUsername(getToken());
         param.setHasFolder(0);
         JSONObject jsonObject = sceneProService.newList(param, username);
         JSONObject pageInfo = jsonObject.getJSONObject("pageInfo");
-        pageInfo.put("endRow",0);
-        pageInfo.put("firstPage",param.getPageNum());
-        pageInfo.put("hasNextPage",false);
-        pageInfo.put("isLastPage",0);
-        pageInfo.put("size",pageInfo.get("total"));
+        pageInfo.put("endRow", 0);
+        pageInfo.put("firstPage", param.getPageNum());
+        pageInfo.put("hasNextPage", false);
+        pageInfo.put("isLastPage", 0);
+        pageInfo.put("size", pageInfo.get("total"));
         Integer pages = pageInfo.getInteger("total") / param.getPageSize();
-        pageInfo.put("pages",pageInfo.getInteger("total") % param.getPageSize() == 0 ? pages : pages + 1);
+        pageInfo.put("pages", pageInfo.getInteger("total") % param.getPageSize() == 0 ? pages : pages + 1);
         return Result.success(pageInfo);
     }
 
@@ -121,12 +122,13 @@ public class SceneController extends BaseController {
     @PostMapping("/copyScene")
     public Result copyScene(@RequestBody SceneParam param) throws Exception {
         String username = JwtUtil.getUsername(getToken());
-        sceneProService.copyScene(param.getSceneNum(),username);
+        sceneProService.copyScene(param.getSceneNum(), username);
         return Result.success();
     }
+
     @PostMapping("/delete")
     public Result delete(@RequestBody SceneParam param) throws Exception {
-        sceneProService.delete(param.getSceneNum(),getUserId(),param.getPlatform());
+        sceneProService.delete(param.getSceneNum(), getUserId(), param.getPlatform());
         return Result.success();
     }
 
@@ -135,29 +137,32 @@ public class SceneController extends BaseController {
      */
     @PostMapping("/checkDownload")
     public Result checkDownload(@RequestBody SceneParam param) throws Exception {
-        return Result.success( downService.checkDownLoad(param.getSceneNum(),param.getIsObj()) );
+        return Result.success(downService.checkDownLoad(param.getSceneNum(), param.getIsObj()));
     }
+
     /**
      * 校验该场景有无下载资格
+     *
      * @param param
      * @return
      */
     @PostMapping("/downloadScene")
-    public Result downloadScene(@RequestBody SceneParam param) throws Exception{
+    public Result downloadScene(@RequestBody SceneParam param) throws Exception {
         String username = JwtUtil.getUsername(getToken());
-        return Result.success(downService.down(param.getSceneNum(),username,param.getIsObj()));
+        return Result.success(downService.down(param.getSceneNum(), username, param.getIsObj()));
     }
 
     /**
      * 获取下载进度
+     *
      * @param param
      * @return
      */
     @PostMapping("/downloadProcess")
-    public Result downloadProcess(@RequestBody SceneParam param) throws Exception{
+    public Result downloadProcess(@RequestBody SceneParam param) throws Exception {
         User user = userService.getByUserName(JwtUtil.getUsername(this.getToken()));
-        DownloadProcessVo downloadProcessVo = downService.downloadProcess(user.getId(), param.getSceneNum(),param.getIsObj());
-        if(downloadProcessVo.getStatus() == DownloadStatusEnum.DOWNLOAD_FAILED_CODE){
+        DownloadProcessVo downloadProcessVo = downService.downloadProcess(user.getId(), param.getSceneNum(), param.getIsObj());
+        if (downloadProcessVo.getStatus() == DownloadStatusEnum.DOWNLOAD_FAILED_CODE) {
             return Result.failure("下载失败!");
         }
         return Result.success(downloadProcessVo);
@@ -169,9 +174,9 @@ public class SceneController extends BaseController {
      * num      场景码
      */
     @GetMapping("/checkDownLoadE57")
-    public Result checkDownLoadE57(@RequestParam(required = false) String num){
+    public Result checkDownLoadE57(@RequestParam(required = false) String num) {
         String username = JwtUtil.getUsername(getToken());
-        return Result.success(downService.checkDownLoadE57(num,username));
+        return Result.success(downService.checkDownLoadE57(num, username));
     }
 
     /**
@@ -179,9 +184,9 @@ public class SceneController extends BaseController {
      * num      场景码
      */
     @GetMapping("/downSceneE57")
-    public Result downSceneE57(@RequestParam(required = false) String num){
+    public Result downSceneE57(@RequestParam(required = false) String num) {
         String username = JwtUtil.getUsername(getToken());
-        return Result.success(downService.downE57(num,username));
+        return Result.success(downService.downE57(num, username));
     }
 
     /**
@@ -189,46 +194,42 @@ public class SceneController extends BaseController {
      * num      场景码
      */
     @GetMapping("/downloadProcessE57")
-    public Result downloadProcessE57(@RequestParam(required = false) String num){
+    public Result downloadProcessE57(@RequestParam(required = false) String num) {
         String username = JwtUtil.getUsername(getToken());
-        return Result.success(downService.downloadProcessE57(num,username));
+        return Result.success(downService.downloadProcessE57(num, username));
     }
 
 
     /**
-     *
      * 场景升级V4接口
      */
     @GetMapping("/upgradeToV4")
-    public Result upgradeToV4(String num) throws Exception{
+    public Result upgradeToV4(String num) throws Exception {
         return sceneUpgradeToV4Service.upgrade(num);
     }
 
 
     /**
-     *
      * 场景升级进度查询接口
      */
     @GetMapping("/getUpgradeToV4Progress")
-    public Result getUpgradeToV4Progress(String num) throws Exception{
+    public Result getUpgradeToV4Progress(String num) throws Exception {
         return sceneUpgradeToV4Service.getUpgradeToV4Progress(num);
     }
 
     /**
-     *
      * 分页查询存在houseType文件的场景
      */
     @PostMapping("/pageSceneWithHouseType")
-    public Result pageSceneWithHouseType(@RequestBody RequestScene param){
-        return scenePlusService.pageSceneWithHouseType(param,this.getToken());
+    public Result pageSceneWithHouseType(@RequestBody RequestScene param) {
+        return scenePlusService.pageSceneWithHouseType(param, this.getToken());
     }
 
     /**
-     *
      * 根据场景码返回ar路径
      */
     @GetMapping("/getArPathByNum")
-    public Result getArPathByNum(@RequestParam(value = "num") String num){
+    public Result getArPathByNum(@RequestParam(value = "num") String num) {
         return scenePlusService.getArPathByNum(num);
     }
 
@@ -237,21 +238,21 @@ public class SceneController extends BaseController {
      * 发起带看获取带看房间号
      */
     @GetMapping("/getTakeLookRoomId")
-    public Result getTakeLookRoomId(@RequestParam(value = "num") String num){
+    public Result getTakeLookRoomId(@RequestParam(value = "num") String num) {
         ScenePlus scenePlus = scenePlusService.getByNum(num);
-        if(scenePlus  == null){
+        if (scenePlus == null) {
             throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400002, ResultCodeMsg.FAILURE_MSG_400002);
         }
-        if(scenePlus.getSceneStatus() != -2){
+        if (scenePlus.getSceneStatus() != -2) {
             throw new BusinessException(ResultCodeMsg.FAILURE_CODE_400009, ResultCodeMsg.FAILURE_MSG_400009);
         }
         FdRoomVo fdRoomVo = takeLookService.getRoomIdByNum(num, scenePlus.getTitle(), getToken());
-        takeLookService.openRoom(fdRoomVo.getRoomId(),getToken());
+        takeLookService.openRoom(fdRoomVo.getRoomId(), getToken());
         return Result.success(fdRoomVo);
     }
 
     @GetMapping("/removePortrait")
-    public Result removePortrait(@RequestParam(value = "num") String num){
+    public Result removePortrait(@RequestParam(value = "num") String num) {
         sceneProService.removePortrait(num);
         return Result.success();
     }
@@ -260,49 +261,50 @@ public class SceneController extends BaseController {
     FYunFileServiceInterface fYunFileServiceInterface;
     @Autowired
     FdKKClient fdKKClient;
+
     @PostMapping("/uploadE57")
     public Result uploadE57(@RequestParam("file") MultipartFile file,
-                            @RequestParam(value = "isObj",required = false)Integer isObj,
-                            @RequestParam(value = "title",required = false)String title) {
+                            @RequestParam(value = "isObj", required = false) Integer isObj,
+                            @RequestParam(value = "title", required = false) String title) {
         String originalFilename = file.getOriginalFilename();
         String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
-        if(!suffix.equals(".e57")){
+        if (!suffix.equals(".e57")) {
             throw new BusinessException(ResultCode.UPLOAD_ERROR2);
         }
         File targetFile = null;
         try {
-            String newFileName = UUID.randomUUID().toString().replace("-","");
-            String filePath = ConstantFilePath.MANAGE_PATH + "e57" + File.separator + newFileName +suffix;
+            String newFileName = UUID.randomUUID().toString().replace("-", "");
+            String filePath = ConstantFilePath.MANAGE_PATH + "e57" + File.separator + newFileName + suffix;
             targetFile = new File(filePath);
-            if(!targetFile.getParentFile().exists()){
+            if (!targetFile.getParentFile().exists()) {
                 targetFile.getParentFile().mkdirs();
             }
             file.transferTo(targetFile);
 
-            fYunFileServiceInterface.uploadFile(filePath,filePath.replace(ConstantFilePath.MANAGE_PATH,"ucenter/"));
+            fYunFileServiceInterface.uploadFile(filePath, filePath.replace(ConstantFilePath.MANAGE_PATH, "ucenter/"));
 
             UploadEditSceneParam editSceneParam = new UploadEditSceneParam();
             editSceneParam.setTitle(title);
             editSceneParam.setUserId(getUser().getId());
-            editSceneParam.setPath(filePath.replace(ConstantFilePath.MANAGE_PATH,"ucenter/"));
+            editSceneParam.setPath(filePath.replace(ConstantFilePath.MANAGE_PATH, "ucenter/"));
             editSceneParam.setIsObj(isObj);
             editSceneParam.setOtherType("E57_V4");
 
             JSONObject jsonObject = fdKKClient.reverseScene(editSceneParam);
             Integer code = jsonObject.getInteger("code");
-            if(code != 0){
-                log.info("调用失败-toFdCreateScene:{}",jsonObject);
+            if (code != 0) {
+                log.info("调用失败-toFdCreateScene:{}", jsonObject);
                 throw new BusinessException(ResultCode.UPLOAD_ERROR);
             }
-        }catch (Exception e){
-            log.info("调用失败-toFdCreateScene:",e);
+        } catch (Exception e) {
+            log.info("调用失败-toFdCreateScene:", e);
             throw new BusinessException(ResultCode.UPLOAD_ERROR);
-        }finally {
-            if(targetFile != null){
+        } finally {
+            if (targetFile != null) {
                 try {
                     FileUtil.del(targetFile);
-                }catch (Exception e){
-                    log.info("删除文件失败:{}",targetFile.getPath());
+                } catch (Exception e) {
+                    log.info("删除文件失败:{}", targetFile.getPath());
                 }
             }
         }
@@ -315,41 +317,41 @@ public class SceneController extends BaseController {
     FyunConfig fyunConfig;
 
     @PostMapping("/getUploadUrl")
-    public Result getUploadUrl( @RequestParam(value = "fileName",required = false)String fileName) {
-        String newFileName = UUID.randomUUID().toString().replace("-","");
+    public Result getUploadUrl(@RequestParam(value = "fileName", required = false) String fileName) {
+        String newFileName = UUID.randomUUID().toString().replace("-", "");
         String suffix = fileName.substring(fileName.lastIndexOf("."));
-        URL presignedUrl =  fyunConfig.getPresignedUrl("ucenter/e57/" + newFileName + suffix);
+        URL presignedUrl = fyunConfig.getPresignedUrl("ucenter/e57/" + newFileName + suffix);
         HashMap<String, Object> map = new HashMap<>();
-        map.put("newFileName",newFileName + suffix);
-        map.put("url",presignedUrl.toString());
+        map.put("newFileName", newFileName + suffix);
+        map.put("url", presignedUrl.toString());
         return Result.success(map);
     }
 
     @PostMapping("/relevanceE57")
-    public Result relevanceE57( @RequestParam(value = "isObj",required = false)Integer isObj,
-                                @RequestParam(value = "title",required = false)String title,
-                                @RequestParam(value = "newFileName",required = false)String newFileName ){
+    public Result relevanceE57(@RequestParam(value = "isObj", required = false) Integer isObj,
+                               @RequestParam(value = "title", required = false) String title,
+                               @RequestParam(value = "newFileName", required = false) String newFileName) {
 
 
-        if(StringUtils.isBlank(newFileName)){
+        if (StringUtils.isBlank(newFileName)) {
             throw new BusinessException(ResultCode.PARAM_MISS);
         }
-        String ossPath = "ucenter/e57/"+newFileName;
-        if(!fYunFileServiceInterface.fileExist(ossPath)){
+        String ossPath = "ucenter/e57/" + newFileName;
+        if (!fYunFileServiceInterface.fileExist(ossPath)) {
             throw new BusinessException(ResultCode.UPLOAD_ERROR3);
         }
 
         UploadEditSceneParam editSceneParam = new UploadEditSceneParam();
         editSceneParam.setTitle(title);
         editSceneParam.setUserId(getUser().getId());
-        editSceneParam.setPath("ucenter/e57/"+newFileName);
+        editSceneParam.setPath("ucenter/e57/" + newFileName);
         editSceneParam.setIsObj(isObj);
         editSceneParam.setOtherType("E57_V4");
 
         JSONObject jsonObject = fdKKClient.reverseScene(editSceneParam);
         Integer code = jsonObject.getInteger("code");
-        if(code != 0){
-            log.info("调用失败-toFdCreateScene:{}",jsonObject);
+        if (code != 0) {
+            log.info("调用失败-toFdCreateScene:{}", jsonObject);
             throw new BusinessException(ResultCode.UPLOAD_ERROR);
         }
         return Result.success();

+ 3 - 3
src/main/java/com/fdkankan/ucenter/service/impl/AppSceneService.java

@@ -75,11 +75,11 @@ public class AppSceneService {
     private String ossHost;
 
     public PageInfo pageList(AppSceneParam param) {
-        if((StringUtils.isEmpty(param.getAppUserName()) || StringUtils.isEmpty(param.getAppPassword())) && StringUtils.isEmpty(param.getPhoneNum()) && param.getCameraId() == null){
+        if((StringUtils.isEmpty(param.getAppUserName())) && StringUtils.isEmpty(param.getPhoneNum()) && param.getCameraId() == null){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
         }
-        if(!StringUtils.isEmpty(param.getAppUserName()) && !StringUtils.isEmpty(param.getAppPassword())){
-            Camera camera = cameraService.getBySnCodeAndPassword(param.getAppUserName(), param.getAppPassword());
+        if(!StringUtils.isEmpty(param.getAppUserName())){
+            Camera camera = cameraService.getByChildName(param.getAppUserName());
             if(camera == null){
                 throw new BusinessException(LoginConstant.FAILURE_CODE_3014, LoginConstant.FAILURE_MSG_3014);
             }

+ 18 - 0
src/main/java/com/fdkankan/ucenter/service/impl/DownService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.SceneConstant;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.SecurityUtil;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisLockUtil;
@@ -460,4 +461,21 @@ public class DownService implements IDownService {
         return downVo;
     }
 
+    public static void main(String[] args) {
+        /**
+         4dkankan@3dsixty.ch                          c1QRwa..11
+         4dkankan@widdim.com                          NbXL5dxQ@j~T
+         frederic.alcaraz@af3d.fr                     673KKrZN2uGWu
+         julien.cousin@nextiim.com                    a23B45C67
+         mzdjaffardjee@hotmail.fr                     Moufadal2004@
+
+         */
+        System.out.println(SecurityUtil.MD5("\u0017E%&\u0003\u0015ZZEE"));
+        System.out.println(SecurityUtil.MD5(":\u0016,8A\u0010\f%4\u001E\n" +
+                " "));
+        System.out.println(SecurityUtil.MD5("BCG??\u0006.:F\u00013#\u0001"));
+        System.out.println(SecurityUtil.MD5("\u0015FG6@A7BC"));
+        System.out.println(SecurityUtil.MD5("9\u001B\u0001\u0012\u0015\u0010\u0015\u0018FDD@4"));
+        System.out.println(SecurityUtil.MD5("@0?\u0015\u001A?\u0015\u001AEFG"));
+    }
 }