Procházet zdrojové kódy

场景中心业务代码迁移

by su před 3 roky
rodič
revize
901d54ead4
20 změnil soubory, kde provedl 680 přidání a 733 odebrání
  1. 16 1
      4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/PlatformGoodsClient.java
  2. 1 1
      4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/PlatformOrderClient.java
  3. 1 1
      4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/PlatformUserClient.java
  4. 27 0
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/feign/GoodsFeign.java
  5. 2 0
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/goods/service/ICameraService.java
  6. 11 4
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/goods/service/impl/CameraServiceImpl.java
  7. 405 575
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/controller/SceneAppController.java
  8. 27 6
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/controller/TestController.java
  9. 3 3
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/ScenePro.java
  10. 6 6
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneProExt.java
  11. 4 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/listener/BuildSceneResultMQListener.java
  12. 4 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProAppService.java
  13. 2 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProService.java
  14. 7 6
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneFileBuildServiceImpl.java
  15. 110 76
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProAppServiceImpl.java
  16. 28 38
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
  17. 9 4
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java
  18. 2 0
      4dkankan-center-scene/src/main/resources/bootstrap.yml
  19. 10 10
      4dkankan-center-scene/src/main/resources/mapper/scene/SceneProMapper.xml
  20. 5 0
      4dkankan-common/src/main/java/com/fdkankan/common/response/BaseResponseAdvice.java

+ 16 - 1
4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/PlatformGoodsClient.java

@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 
 
-@FeignClient(value = "4dkankan-center-platform")
+@FeignClient(value = "4dkankan-center-platform", contextId = "platformGoodsClient")
 @RequestMapping("/platform/feign/goods")
 @RequestMapping("/platform/feign/goods")
 public interface PlatformGoodsClient {
 public interface PlatformGoodsClient {
 
 
@@ -39,4 +39,19 @@ public interface PlatformGoodsClient {
      */
      */
     @PostMapping("/getCameraBySnCode")
     @PostMapping("/getCameraBySnCode")
     ResultData<Camera> getCameraBySnCode(@RequestParam(value = "snCode", required = false) String snCode);
     ResultData<Camera> getCameraBySnCode(@RequestParam(value = "snCode", required = false) String snCode);
+
+    /**
+     *
+     * @return Camera
+     */
+    @PostMapping("/getByChildNameAndChildPassword")
+    ResultData<Camera> getByChildNameAndChildPassword(@RequestParam(value = "appUserName") String appUserName,
+                                                       @RequestParam(value = "appPassword") String appPassword);
+
+    /**
+     *
+     * @return Camera
+     */
+    @PostMapping("/getCameraById")
+    ResultData<Camera> getCameraById(@RequestParam(value = "cameraId") Long cameraId);
 }
 }

+ 1 - 1
4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/PlatformOrderClient.java

@@ -3,7 +3,7 @@ package com.fdkankan.platform.api.feign;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 
-@FeignClient(value = "4dkankan-center-platform")
+@FeignClient(value = "4dkankan-center-platform", contextId = "platformOrderClient")
 @RequestMapping("/platform/feign/order")
 @RequestMapping("/platform/feign/order")
 public interface PlatformOrderClient {
 public interface PlatformOrderClient {
 }
 }

+ 1 - 1
4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/PlatformUserClient.java

@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 
 
-@FeignClient(value = "4dkankan-center-platform")
+@FeignClient(value = "4dkankan-center-platform", contextId = "platformUserClient")
 @RequestMapping("/platform/feign/user")
 @RequestMapping("/platform/feign/user")
 public interface PlatformUserClient {
 public interface PlatformUserClient {
     /**
     /**

+ 27 - 0
4dkankan-center-platform/src/main/java/com/fdkankan/platform/feign/GoodsFeign.java

@@ -1,5 +1,6 @@
 package com.fdkankan.platform.feign;
 package com.fdkankan.platform.feign;
 
 
+import com.fdkankan.common.response.ResultData;
 import com.fdkankan.platform.goods.entity.Camera;
 import com.fdkankan.platform.goods.entity.Camera;
 import com.fdkankan.platform.goods.entity.CameraDetail;
 import com.fdkankan.platform.goods.entity.CameraDetail;
 import com.fdkankan.platform.goods.service.ICameraDetailService;
 import com.fdkankan.platform.goods.service.ICameraDetailService;
@@ -59,5 +60,31 @@ public class GoodsFeign {
         return detail;
         return detail;
     }
     }
 
 
+    @PostMapping("/getByChildNameAndChildPassword")
+    public Camera getByChildNameAndChildPassword(@RequestParam(value = "appUserName") String appUserName,
+                                                  @RequestParam(value = "appPassword") String appPassword) {
+        log.info("scene服务调用:getCameraBySnCode,参数:appUserName:{},appPassword:{}" ,appUserName, appPassword);
+        Camera camera = cameraService.getByChildNameAndChildPassword(appUserName, appPassword);
+        log.info("scene服务调用:findByChildNameAndChildPassword,返回:{}",camera);
+        return camera;
+    }
+
+    @PostMapping("/findByChildNameAndChildPassword")
+    public Camera findByChildNameAndChildPassword(@RequestParam(value = "appUserName") String appUserName,
+                                                  @RequestParam(value = "appPassword") String appPassword) {
+        log.info("scene服务调用:findByChildNameAndChildPassword,参数:appUserName:{},appPassword:{}" ,appUserName, appPassword);
+        Camera camera = cameraService.getByChildNameAndChildPassword(appUserName, appPassword);
+        log.info("scene服务调用:findByChildNameAndChildPassword,返回:{}",camera);
+        return camera;
+    }
+
+    @PostMapping("/getCameraById")
+    public Camera getCameraById(@RequestParam(value = "cameraId") Long cameraId) {
+        log.info("scene服务调用:getCameraById,参数:cameraId:{}" ,cameraId);
+        Camera camera = cameraService.getAvailableById(cameraId);
+        log.info("scene服务调用:getCameraById,返回:{}",camera);
+        return camera;
+    }
+
 }
 }
 
 

+ 2 - 0
4dkankan-center-platform/src/main/java/com/fdkankan/platform/goods/service/ICameraService.java

@@ -42,4 +42,6 @@ public interface ICameraService extends IService<Camera> {
     Camera getBySnCode(String snCode);
     Camera getBySnCode(String snCode);
 
 
     Camera getByChildNameAndChildPassword(String appUserName, String appPassword);
     Camera getByChildNameAndChildPassword(String appUserName, String appPassword);
+
+    Camera getAvailableById(Long id);
 }
 }

+ 11 - 4
4dkankan-center-platform/src/main/java/com/fdkankan/platform/goods/service/impl/CameraServiceImpl.java

@@ -1,10 +1,11 @@
 package com.fdkankan.platform.goods.service.impl;
 package com.fdkankan.platform.goods.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.constant.*;
 import com.fdkankan.platform.agent.constant.AgentConstant;
 import com.fdkankan.platform.agent.constant.AgentConstant;
-import com.fdkankan.common.constant.AppConstant;
 import com.fdkankan.common.user.SSOUser;
 import com.fdkankan.common.user.SSOUser;
 import com.fdkankan.common.util.DateUtil;
 import com.fdkankan.common.util.DateUtil;
 import com.fdkankan.common.util.FileSizeUtil;
 import com.fdkankan.common.util.FileSizeUtil;
@@ -23,9 +24,6 @@ import com.fdkankan.platform.user.service.IUserIncrementService;
 import com.fdkankan.platform.user.service.IUserService;
 import com.fdkankan.platform.user.service.IUserService;
 import com.fdkankan.platform.user.vo.ResponseCamera;
 import com.fdkankan.platform.user.vo.ResponseCamera;
 import com.fdkankan.platform.user.vo.ResponseCameraSpace;
 import com.fdkankan.platform.user.vo.ResponseCameraSpace;
-import com.fdkankan.common.constant.CameraConstant;
-import com.fdkankan.common.constant.ErrorCode;
-import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.exception.BusinessException;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFRow;
@@ -305,6 +303,15 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         return this.getEntityByQuery(queryWrapper);
         return this.getEntityByQuery(queryWrapper);
     }
     }
 
 
+    @Override
+    public Camera getAvailableById(Long id) {
+        Camera camera = this.getOne(new LambdaQueryWrapper<Camera>()
+                .eq(Camera::getTbStatus, TbStatus.VALID.code())
+                .eq(Camera::getRecStatus, RecStatus.VALID.code())
+                .eq(Camera::getId, id));
+        return camera;
+    }
+
     private Camera getEntityByQuery(QueryWrapper<Camera> queryWrapper ){
     private Camera getEntityByQuery(QueryWrapper<Camera> queryWrapper ){
         List<Camera> list = this.list(queryWrapper);
         List<Camera> list = this.list(queryWrapper);
         if(list == null || list.size() <= 0){
         if(list == null || list.size() <= 0){

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 405 - 575
4dkankan-center-scene/src/main/java/com/fdkankan/scene/controller/SceneAppController.java


+ 27 - 6
4dkankan-center-scene/src/main/java/com/fdkankan/scene/controller/TestController.java

@@ -4,9 +4,14 @@ import com.alibaba.druid.pool.DruidDataSource;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.constant.ConstantFilePath;
 import com.fdkankan.common.constant.ConstantFilePath;
+import com.fdkankan.common.response.ResultData;
 import com.fdkankan.common.util.MatrixToImageWriterUtil;
 import com.fdkankan.common.util.MatrixToImageWriterUtil;
 import com.fdkankan.mq.message.BuildSceneMqMessage;
 import com.fdkankan.mq.message.BuildSceneMqMessage;
 import com.fdkankan.mq.util.RocketMQProducer;
 import com.fdkankan.mq.util.RocketMQProducer;
+import com.fdkankan.platform.api.feign.PlatformGoodsClient;
+import com.fdkankan.platform.api.feign.PlatformUserClient;
+import com.fdkankan.platform.api.vo.Camera;
+import com.fdkankan.platform.api.vo.Company;
 import com.fdkankan.platform.api.vo.User;
 import com.fdkankan.platform.api.vo.User;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.scene.service.IFolderService;
 import com.fdkankan.scene.service.IFolderService;
@@ -47,6 +52,12 @@ public class TestController {
         return folderService.list();
         return folderService.list();
     }
     }
 
 
+    @Autowired
+    private PlatformUserClient platformUserClient;
+
+    @Autowired
+    private PlatformGoodsClient platformGoodsClient;
+
 
 
     @GetMapping("/test")
     @GetMapping("/test")
     public String test() throws Exception {
     public String test() throws Exception {
@@ -88,14 +99,24 @@ public class TestController {
 
 
     @GetMapping("/testSetObject")
     @GetMapping("/testSetObject")
     public boolean testSetObject() throws Exception {
     public boolean testSetObject() throws Exception {
-        User user = new User();
-        user.setCity("珠海");
-        user.setId(123l);
+//        User user = new User();
+//        user.setCity("珠海");
+//        user.setId(123l);
+//
+//        String jsons = JSON.toJSONString(user);
+//
+//        redisTemplate.opsForValue().set("test:66", jsons);
+//        redisTemplate.opsForValue().set("test:67", jsons);
+
+        ResultData<Camera>  cameraById = platformGoodsClient.getCameraById(111L);
+
+        Camera data = cameraById.getData();
+
+        ResultData<Company> companyById = platformUserClient.getCompanyById(111L);
+
+
 
 
-        String jsons = JSON.toJSONString(user);
 
 
-        redisTemplate.opsForValue().set("test:66", jsons);
-        redisTemplate.opsForValue().set("test:67", jsons);
 
 
 
 
         return true;
         return true;

+ 3 - 3
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/ScenePro.java

@@ -82,10 +82,10 @@ public class ScenePro implements Serializable {
     private Integer sceneType;
     private Integer sceneType;
 
 
     /**
     /**
-     * 浏览次数
+     * 0表示未建好,1表示建好,-1表示出错,-2表示不要在官网上显示
      */
      */
-    @TableField("view_count")
-    private Integer viewCount;
+    @TableField("scene_status")
+    private Integer sceneStatus;
 
 
     /**
     /**
      * 拍摄数量
      * 拍摄数量

+ 6 - 6
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneProExt.java

@@ -34,12 +34,6 @@ public class SceneProExt implements Serializable {
     private Long sceneProId;
     private Long sceneProId;
 
 
     /**
     /**
-     * 0表示未建好,1表示建好,-1表示出错,-2表示不要在官网上显示
-     */
-    @TableField("scene_status")
-    private Integer sceneStatus;
-
-    /**
      * 原始的大场景数据(七牛)
      * 原始的大场景数据(七牛)
      */
      */
     @TableField("data_source")
     @TableField("data_source")
@@ -115,6 +109,12 @@ public class SceneProExt implements Serializable {
     private String unicode;
     private String unicode;
 
 
     /**
     /**
+     * 浏览次数
+     */
+    @TableField("view_count")
+    private Integer viewCount;
+
+    /**
      * 相机类型
      * 相机类型
      */
      */
     @TableField("camera_type")
     @TableField("camera_type")

+ 4 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/listener/BuildSceneResultMQListener.java

@@ -5,6 +5,7 @@ import com.fdkankan.common.constant.BuildStatus;
 import com.fdkankan.common.response.ResultData;
 import com.fdkankan.common.response.ResultData;
 import com.fdkankan.mq.message.BuildSceneResultMqMessage;
 import com.fdkankan.mq.message.BuildSceneResultMqMessage;
 import com.fdkankan.platform.api.feign.PlatformGoodsClient;
 import com.fdkankan.platform.api.feign.PlatformGoodsClient;
+import com.fdkankan.platform.api.feign.PlatformUserClient;
 import com.fdkankan.platform.api.vo.CameraDetail;
 import com.fdkankan.platform.api.vo.CameraDetail;
 import com.fdkankan.platform.api.vo.UserIncrement;
 import com.fdkankan.platform.api.vo.UserIncrement;
 import com.fdkankan.scene.entity.SceneFileBuild;
 import com.fdkankan.scene.entity.SceneFileBuild;
@@ -51,6 +52,8 @@ public class BuildSceneResultMQListener implements RocketMQListener<String> {
     ISceneProExtService sceneProExtService;
     ISceneProExtService sceneProExtService;
     @Autowired
     @Autowired
     PlatformGoodsClient platformGoodsClient;
     PlatformGoodsClient platformGoodsClient;
+    @Autowired
+    PlatformUserClient platformUserClient;
 
 
 
 
     @Override
     @Override
@@ -103,7 +106,7 @@ public class BuildSceneResultMQListener implements RocketMQListener<String> {
                     }
                     }
                     CameraDetail cameraDetail = JSONObject.parseObject(JSONObject.toJSONString(resultData.getData()), CameraDetail.class);
                     CameraDetail cameraDetail = JSONObject.parseObject(JSONObject.toJSONString(resultData.getData()), CameraDetail.class);
 
 
-                    ResultData<UserIncrement> resultData1 = platformGoodsClient.getUserIncrementByCameraId(scenePro.getCameraId());
+                    ResultData<UserIncrement> resultData1 = platformUserClient.getUserIncrementByCameraId(scenePro.getCameraId());
                     if(resultData1.getCode() != 200){
                     if(resultData1.getCode() != 200){
                         log.error("调用platform服务getUserIncrementByCameraId失败,参数{}" ,scenePro.getCameraId());
                         log.error("调用platform服务getUserIncrementByCameraId失败,参数{}" ,scenePro.getCameraId());
                         return;
                         return;

+ 4 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProAppService.java

@@ -10,6 +10,8 @@ import com.fdkankan.scene.vo.UserParamVO;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * pro场景表 服务类
  * pro场景表 服务类
@@ -66,4 +68,6 @@ public interface ISceneProAppService extends IService<ScenePro> {
 
 
     Page<SceneVO> getAllSceneByPage(UserParamVO param);
     Page<SceneVO> getAllSceneByPage(UserParamVO param);
 
 
+    List<SceneVO> getAllForCameraName(UserParamVO user);
+
 }
 }

+ 2 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProService.java

@@ -1,6 +1,7 @@
 package com.fdkankan.scene.service;
 package com.fdkankan.scene.service;
 
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.common.response.ResultData;
 import com.fdkankan.common.response.ResultData;
 import com.fdkankan.scene.entity.ScenePro;
 import com.fdkankan.scene.entity.ScenePro;
@@ -148,7 +149,7 @@ public interface ISceneProService extends IService<ScenePro> {
 
 
     ResultData updateFloorJson(FileParamVO param) throws Exception;
     ResultData updateFloorJson(FileParamVO param) throws Exception;
 
 
-    IPage<SceneVO> getAppAllSceneByPage(Long cameraId, Long userId, int cameraType, int pageNum, Integer pageSize, String orderBy, Integer sceneType, List<String> sceneCodeList, String sceneName);
+    Page<SceneVO> getAppAllSceneByPage(Long cameraId, Long userId, int cameraType, int pageNum, Integer pageSize, String orderBy, Integer sceneType, List<String> sceneCodeList, String sceneName);
 
 
     Long findSceneNumByCameraId(Long cameraId);
     Long findSceneNumByCameraId(Long cameraId);
 
 

+ 7 - 6
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneFileBuildServiceImpl.java

@@ -1455,9 +1455,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         SceneProEdit sceneProEdit = new SceneProEdit();
         SceneProEdit sceneProEdit = new SceneProEdit();
         SceneProEditExt sceneProEditExt = new SceneProEditExt();
         SceneProEditExt sceneProEditExt = new SceneProEditExt();
         if(type == 0){
         if(type == 0){
+            scenePro.setSceneStatus(SceneStatus.wait.code());
             sceneProService.save(scenePro);
             sceneProService.save(scenePro);
             sceneProExt.setSceneProId(scenePro.getId());
             sceneProExt.setSceneProId(scenePro.getId());
-            sceneProExt.setSceneStatus(SceneStatus.wait.code());
             sceneProExtService.save(sceneProExt);
             sceneProExtService.save(sceneProExt);
 
 
             sceneProEdit.setNeedKey(0);
             sceneProEdit.setNeedKey(0);
@@ -1513,15 +1513,16 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             }
             }
         }else {
         }else {
             ScenePro oldScene = sceneProService.findBySceneNum(projectNum);
             ScenePro oldScene = sceneProService.findBySceneNum(projectNum);
-            SceneProExt oldSceneProExt = sceneProExtService.findBySceneProId(oldScene.getId());
             scenePro.setId(oldScene.getId());
             scenePro.setId(oldScene.getId());
-            sceneProExt.setSceneStatus(0);
-            sceneProExt.setPayStatus(0);
+            scenePro.setSceneStatus(0);
             scenePro.setRecStatus("A");
             scenePro.setRecStatus("A");
             scenePro.setCreateTime(new Date());
             scenePro.setCreateTime(new Date());
+
+            SceneProExt oldSceneProExt = sceneProExtService.findBySceneProId(oldScene.getId());
+            sceneProExt.setPayStatus(0);
             sceneProExt.setSpace(oldSceneProExt.getSpace());
             sceneProExt.setSpace(oldSceneProExt.getSpace());
             sceneProExt.setEcs(oldSceneProExt.getEcs());
             sceneProExt.setEcs(oldSceneProExt.getEcs());
-            scenePro.setViewCount(oldScene.getViewCount());
+            sceneProExt.setViewCount(oldSceneProExt.getViewCount());
             if(sceneName!=null) {
             if(sceneName!=null) {
                 scenePro.setSceneName(sceneName);
                 scenePro.setSceneName(sceneName);
             }
             }
@@ -1579,7 +1580,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 projectNum, cameraName, unicode, cameraType, fileId, prefix, imgsName, isModel,
                 projectNum, cameraName, unicode, cameraType, fileId, prefix, imgsName, isModel,
                 userName, algorithm, resolution, buildType, path, scenePro.getId(), scenePro.getSceneName(),
                 userName, algorithm, resolution, buildType, path, scenePro.getId(), scenePro.getSceneName(),
                 scenePro.getWebSite(), scenePro.getCreateTime(), scenePro.getUserId(),
                 scenePro.getWebSite(), scenePro.getCreateTime(), scenePro.getUserId(),
-                sceneProExt.getDataSource(), sceneProExt.getSceneStatus(), sceneProExt.getPayStatus(), scenePro.getThumb());
+                sceneProExt.getDataSource(), scenePro.getSceneStatus(), sceneProExt.getPayStatus(), scenePro.getThumb());
 
 
         sceneProPO.setMqMsg(buildSceneMqMessage);
         sceneProPO.setMqMsg(buildSceneMqMessage);
         BeanUtil.copyProperties(sceneProExt, sceneProPO);
         BeanUtil.copyProperties(sceneProExt, sceneProPO);

+ 110 - 76
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProAppServiceImpl.java

@@ -1,8 +1,11 @@
 package com.fdkankan.scene.service.impl;
 package com.fdkankan.scene.service.impl;
 
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpStatus;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,8 +13,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.*;
 import com.fdkankan.common.constant.*;
 import com.fdkankan.common.response.PageInfo;
 import com.fdkankan.common.response.PageInfo;
 import com.fdkankan.common.util.*;
 import com.fdkankan.common.util.*;
+import com.fdkankan.platform.api.feign.PlatformGoodsClient;
+import com.fdkankan.platform.api.feign.PlatformUserClient;
 import com.fdkankan.platform.api.vo.Camera;
 import com.fdkankan.platform.api.vo.Camera;
 import com.fdkankan.platform.api.vo.CameraDetail;
 import com.fdkankan.platform.api.vo.CameraDetail;
+import com.fdkankan.platform.api.vo.User;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.constant.RedisLockKey;
 import com.fdkankan.redis.constant.RedisLockKey;
 import com.fdkankan.redis.util.RedisLockUtil;
 import com.fdkankan.redis.util.RedisLockUtil;
@@ -20,10 +26,7 @@ import com.fdkankan.scene.entity.ScenePro;
 import com.fdkankan.scene.entity.SceneProEdit;
 import com.fdkankan.scene.entity.SceneProEdit;
 import com.fdkankan.scene.entity.SceneProEditExt;
 import com.fdkankan.scene.entity.SceneProEditExt;
 import com.fdkankan.scene.mapper.ISceneProMapper;
 import com.fdkankan.scene.mapper.ISceneProMapper;
-import com.fdkankan.scene.service.ISceneProAppService;
-import com.fdkankan.scene.service.ISceneProEditExtService;
-import com.fdkankan.scene.service.ISceneProEditService;
-import com.fdkankan.scene.service.ISceneProService;
+import com.fdkankan.scene.service.*;
 import com.fdkankan.scene.vo.SceneEditVO;
 import com.fdkankan.scene.vo.SceneEditVO;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.exception.BusinessException;
@@ -50,6 +53,7 @@ import java.io.StringWriter;
 import java.net.HttpURLConnection;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URL;
 import java.util.*;
 import java.util.*;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -86,6 +90,12 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
     RedisLockUtil redisLockUtil;
     RedisLockUtil redisLockUtil;
     @Autowired
     @Autowired
     ISceneProEditExtService sceneProEditExtService;
     ISceneProEditExtService sceneProEditExtService;
+    @Autowired
+    private PlatformGoodsClient platformGoodsClient;
+    @Autowired
+    private PlatformUserClient platformUserClient;
+    @Autowired
+    private ISceneCooperationService sceneCooperationService;
 
 
     @Override
     @Override
     public ResultData saveInitialPage(SceneEditVO base) throws Exception {
     public ResultData saveInitialPage(SceneEditVO base) throws Exception {
@@ -1933,6 +1943,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
         return sid;
         return sid;
     }
     }
 
 
+    @Override
     public Page<SceneVO> getAllSceneByPage(@RequestBody UserParamVO param) {
     public Page<SceneVO> getAllSceneByPage(@RequestBody UserParamVO param) {
         if(StrUtil.isEmpty(param.getAppUserName()) && StrUtil.isEmpty(param.getPhoneNum()) ){
         if(StrUtil.isEmpty(param.getAppUserName()) && StrUtil.isEmpty(param.getPhoneNum()) ){
             throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
             throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
@@ -1941,47 +1952,38 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
         Long cameraId = null;
         Long cameraId = null;
         Long userId = null;
         Long userId = null;
         Integer cameraType = null;
         Integer cameraType = null;
+
         //获取相机id
         //获取相机id
         if(!StrUtil.isEmpty(param.getAppUserName()) && !StrUtil.isEmpty(param.getAppPassword())){
         if(!StrUtil.isEmpty(param.getAppUserName()) && !StrUtil.isEmpty(param.getAppPassword())){
-            Result result = goodsService.findByChildNameAndChildPassword(param.getAppUserName(), param.getAppPassword());
-            if (result.getCode() == Result.CODE_FAILURE){
-                return result;
-            }
-            CameraEntity cameraEntity = mapper.convertValue(result.getData(), CameraEntity.class);
-            if(cameraEntity == null){
+            ResultData<Camera> cameraResult = platformGoodsClient.getByChildNameAndChildPassword(param.getAppUserName(), param.getAppPassword());
+            Camera camera = cameraResult.getData();
+            if (camera == null) {
                 throw new BusinessException(ErrorCode.FAILURE_CODE_3014);
                 throw new BusinessException(ErrorCode.FAILURE_CODE_3014);
             }
             }
-
-            cameraId = cameraEntity.getId();
+            cameraId = camera.getId();
         }
         }
 
 
         //获取该用户id协作者的场景码集合
         //获取该用户id协作者的场景码集合
         List<String> sceneCodeList = null;
         List<String> sceneCodeList = null;
         if (StrUtil.isNotEmpty(param.getPhoneNum())) {
         if (StrUtil.isNotEmpty(param.getPhoneNum())) {
-            paramEntity paramEntity = paramService.findparamByparamName(param.getPhoneNum());
-
-            if (paramEntity == null) {
+            ResultData<User> userResult = platformUserClient.getUserByName(param.getPhoneNum());
+            User user = userResult.getData();
+            if (user == null) {
                 throw new BusinessException(ErrorCode.FAILURE_CODE_3015);
                 throw new BusinessException(ErrorCode.FAILURE_CODE_3015);
             }
             }
-            userId = paramEntity.getId();
-
-            Condition condition = new Condition(SceneCooperationEntity.class);
-            condition.and().andEqualTo("userId", userId);
-            condition.orderBy("id").desc();
-            List<SceneCooperationEntity> list = sceneCooperationService.findAll(condition);
-
-            if(list == null || list.size() > 0){
-                sceneCodeList = Lists.newArrayList();
-                SceneCooperation cooperation = null;
-                list.parallelStream().map()
-                for(int i = 0, len = list.size(); i < len; i++){
-                    cooperation = list.get(i);
-                    if(i != len - 1){
-                        sceneCodeList.add(cooperation.getSceneCode())
-                    }else {
-                        nums.append("'").append(cooperation.getSceneCode()).append("'");
-                    }
-                }
+            userId = user.getId();
+
+            List<SceneCooperation> list = sceneCooperationService.list(
+                    new LambdaQueryWrapper<SceneCooperation>()
+                            .eq(SceneCooperation::getTbStatus, TbStatus.VALID.code())
+                            .eq(SceneCooperation::getRecStatus, RecStatus.VALID.code())
+                            .eq(SceneCooperation::getUserId, userId)
+                            .orderByDesc(SceneCooperation::getId));
+
+            if(CollUtil.isNotEmpty(list)){
+                sceneCodeList = list.parallelStream().map(co -> {
+                    return co.getSceneCode();
+                }).collect(Collectors.toList());
             }
             }
         }
         }
 
 
@@ -1990,63 +1992,95 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
         }
         }
 
 
         Camera camera = null;
         Camera camera = null;
-        CameraDetail cameraDetailEntity = null;
-        Page<SceneVO> sceneVOIPage = sceneProService.getAppAllSceneByPage(cameraId, userId, cameraType, param.getPageNum(), param.getPageSize(), param.getOrderBy(), param.getSceneType(), nums.toString(), param.getSceneName());
-        if(sceneVOIPage.getCurrent() == 0){
-            return sceneVOIPage;
-        }
-        for(ResponseScene responseScene : sceneVOIPage.getList()){
+        CameraDetail cameraDetail = null;
+        Page<SceneVO> sceneVOPage =
+                sceneProService.getAppAllSceneByPage(cameraId, userId, cameraType,
+                        param.getPageNum(), param.getPageSize(), param.getOrderBy(),
+                        param.getSceneType(), sceneCodeList, param.getSceneName());
+        if(sceneVOPage.getCurrent() == 0){
+            return sceneVOPage;
+        }
+        for(SceneVO sceneVO : sceneVOPage.getRecords()){
             // 当计算时,返回给前端的状态为计算中
             // 当计算时,返回给前端的状态为计算中
-            if (!ObjectUtils.isEmpty(responseScene)) {
-                if (responseScene.getStatus() == -1) {
-                    responseScene.setStatus(0);
-                } else if (responseScene.getStatus() == 500) {
-                    responseScene.setStatus(-1);
+            if (!ObjectUtils.isEmpty(sceneVO)) {
+                if (sceneVO.getStatus() == -1) {
+                    sceneVO.setStatus(0);
+                } else if (sceneVO.getStatus() == 500) {
+                    sceneVO.setStatus(-1);
                 }
                 }
             }
             }
             //相机id为空是123看房的场景
             //相机id为空是123看房的场景
-            if(responseScene.getCameraId() == null){
+            if(sceneVO.getCameraId() == null){
                 //当场景用户id等于该用户id,为用户场景,其余未协作场景
                 //当场景用户id等于该用户id,为用户场景,其余未协作场景
-                if(responseScene.getUserId().longValue() == userId.longValue()){
-                    responseScene.setSceneSourceType(1);
+                if(sceneVO.getUserId().longValue() == userId.longValue()){
+                    sceneVO.setSceneSourceType(1);
                 }else {
                 }else {
-                    responseScene.setSceneSourceType(2);
+                    sceneVO.setSceneSourceType(2);
                 }
                 }
             }else {
             }else {
-                camera = goodsService.findCameraById(responseScene.getCameraId());
-                if(camera != null){
-                    responseScene.setChildName(camera.getChildName());
-                    responseScene.setSnCode(camera.getSnCode());
-
-                    cameraDetailEntity = goodsService.findCameraDetailByCameraId(camera.getId());
-                    if(cameraDetailEntity != null){
-                        //相机的userId为空,表示相机的场景
-                        if(cameraDetailEntity.getUserId() == null || userId == null){
-                            responseScene.setSceneSourceType(0);
-                        }else if(userId != null && cameraDetailEntity.getUserId().longValue() == userId.longValue()){
-                            //相机用户id等于该用户id,既为用户的场景
-                            responseScene.setSceneSourceType(1);
-                        }else if(cameraId != null && cameraDetailEntity.getCameraId() != null && cameraDetailEntity.getCameraId().longValue() == cameraId.longValue()
-                                && cameraDetailEntity.getCooperationparam() == null){
-                            //场景相机id等于该相机id
-                            responseScene.setSceneSourceType(0);
-                        }else if(cameraId != null && cameraDetailEntity.getCameraId().longValue() == cameraId.longValue()
-                                && cameraDetailEntity.getCooperationparam() != null){
-                            if(userId != null && cameraDetailEntity.getCooperationparam().longValue() == userId.longValue()){
-                                responseScene.setSceneSourceType(2);
-                            }else {
-                                responseScene.setSceneSourceType(0);
-                            }
+                ResultData<Camera> cameraResult = platformGoodsClient.getCameraById(sceneVO.getCameraId());
+                camera = cameraResult.getData();
+                if(Objects.isNull(camera)){
+                    continue;
+                }
+                    sceneVO.setChildName(camera.getChildName());
+                    sceneVO.setSnCode(camera.getSnCode());
+
+                ResultData<CameraDetail> cameraDetailResult = platformGoodsClient.getCameraDetailByCameraId(camera.getId());
+                cameraDetail = cameraDetailResult.getData();
+                if(cameraDetail != null){
+                    //相机的userId为空,表示相机的场景
+                    if(cameraDetail.getUserId() == null || userId == null){
+                        sceneVO.setSceneSourceType(0);
+                    }else if(userId != null && cameraDetail.getUserId().longValue() == userId.longValue()){
+                        //相机用户id等于该用户id,既为用户的场景
+                        sceneVO.setSceneSourceType(1);
+                    }else if(cameraId != null && cameraDetail.getCameraId() != null && cameraDetail.getCameraId().longValue() == cameraId.longValue()
+                            && cameraDetail.getCooperationUser() == null){
+                        //场景相机id等于该相机id
+                        sceneVO.setSceneSourceType(0);
+                    }else if(cameraId != null && cameraDetail.getCameraId().longValue() == cameraId.longValue()
+                            && cameraDetail.getCooperationUser() != null){
+                        if(userId != null && cameraDetail.getCooperationUser().longValue() == userId.longValue()){
+                            sceneVO.setSceneSourceType(2);
                         }else {
                         }else {
-                            //最后不等于则为协作者场景
-                            responseScene.setSceneSourceType(2);
+                            sceneVO.setSceneSourceType(0);
                         }
                         }
+                    }else {
+                        //最后不等于则为协作者场景
+                        sceneVO.setSceneSourceType(2);
                     }
                     }
                 }
                 }
             }
             }
         }
         }
 
 
-        return ResultData.ok(pageInfo);
+        return sceneVOPage;
+    }
+
+    @Override
+    public List<SceneVO> getAllForCameraName(@RequestBody UserParamVO user){
+        if(StrUtil.isEmpty(user.getAppUserName()) || StrUtil.isEmpty(user.getAppPassword())){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+        }
+        ResultData<Camera> cameraResult = platformGoodsClient.getByChildNameAndChildPassword(user.getAppUserName(), user.getAppPassword());
+        Camera camera = cameraResult.getData();
+        if (camera == null) {
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3014);
+        }
+
+        List<ScenePro> list = sceneProService.list(
+                new LambdaQueryWrapper<ScenePro>()
+                        .eq(ScenePro::getTbStatus, TbStatus.VALID.code())
+                        .eq(ScenePro::getRecStatus, RecStatus.VALID.code())
+                        .eq(ScenePro::getCameraId, camera.getId())
+                        .ne(ScenePro::getSceneType, SceneType.YJHZXNFY.code())
+                        .in(ScenePro::getSceneStatus, SceneStatus.SUCCESS, SceneStatus.NO_DISPLAY).orderByDesc(ScenePro::getId));
+
+        List<SceneVO> sceneList = sceneProService.convert(list);
+        for(SceneVO sceneVO : sceneList){
+            sceneVO.setChildName(user.getAppUserName());
+        }
+        return sceneList;
     }
     }
 
 
 
 

+ 28 - 38
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -9,7 +9,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.*;
 import com.fdkankan.common.constant.*;
@@ -24,14 +23,10 @@ import com.fdkankan.redis.util.RedisLockUtil;
 import com.fdkankan.scene.entity.*;
 import com.fdkankan.scene.entity.*;
 import com.fdkankan.scene.mapper.ISceneProMapper;
 import com.fdkankan.scene.mapper.ISceneProMapper;
 import com.fdkankan.scene.service.*;
 import com.fdkankan.scene.service.*;
+import com.fdkankan.scene.vo.FileParamVO;
 import com.fdkankan.scene.vo.SceneEditVO;
 import com.fdkankan.scene.vo.SceneEditVO;
 import com.fdkankan.scene.vo.SceneProVO;
 import com.fdkankan.scene.vo.SceneProVO;
 import com.fdkankan.scene.vo.SceneVO;
 import com.fdkankan.scene.vo.SceneVO;
-import com.fdkankan.common.constant.ErrorCode;
-import com.fdkankan.common.exception.BusinessException;
-import com.fdkankan.fyun.oss.UploadToOssUtil;
-import com.fdkankan.scene.vo.FileParamVO;
-import com.fdkankan.scene.vo.UploadFileParamVO;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import net.coobird.thumbnailator.Thumbnails;
 import net.coobird.thumbnailator.Thumbnails;
 import org.joda.time.DateTime;
 import org.joda.time.DateTime;
@@ -41,7 +36,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.ObjectUtils;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import java.io.BufferedReader;
 import java.io.BufferedReader;
@@ -111,10 +105,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     public List<SceneVO> convert(List<ScenePro> list){
     public List<SceneVO> convert(List<ScenePro> list){
         List<SceneVO> sceneVOS = list.parallelStream().map(scenePro -> {
         List<SceneVO> sceneVOS = list.parallelStream().map(scenePro -> {
             SceneVO sceneVo = new SceneVO();
             SceneVO sceneVo = new SceneVO();
+            SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
             SceneProEdit sceneProEdit = sceneProEditService.findByProId(scenePro.getId());
             SceneProEdit sceneProEdit = sceneProEditService.findByProId(scenePro.getId());
-            SceneProEditExt sceneProEditExt = sceneProEditExtService.getByProEditId(sceneProEdit.getProId());
+            SceneProEditExt sceneProEditExt = sceneProEditExtService.getByProEditId(sceneProEdit.getId());
             BeanUtils.copyProperties(sceneProEditExt, sceneVo);
             BeanUtils.copyProperties(sceneProEditExt, sceneVo);
             BeanUtils.copyProperties(sceneProEdit, sceneVo);
             BeanUtils.copyProperties(sceneProEdit, sceneVo);
+            BeanUtils.copyProperties(sceneProExt, sceneVo);
             BeanUtils.copyProperties(scenePro, sceneVo);
             BeanUtils.copyProperties(scenePro, sceneVo);
 
 
             sceneVo.setCreateTime(DateUtil.format(scenePro.getCreateTime(), DateExtUtil.dateStyle4));
             sceneVo.setCreateTime(DateUtil.format(scenePro.getCreateTime(), DateExtUtil.dateStyle4));
@@ -184,17 +180,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 
 
     @Override
     @Override
     public void updateStatus(String sceneNum, int sceneStatus) {
     public void updateStatus(String sceneNum, int sceneStatus) {
-        List<ScenePro> sceneProList = this.list(new QueryWrapper<ScenePro>().eq("scene_code", sceneNum));
-        if(CollUtil.isEmpty(sceneProList)){
-            return ;
-        }
-        List<Long> proIds = sceneProList.stream().map(pro -> {
-            return pro.getId();
-        }).collect(Collectors.toList());
-
-        sceneProExtService.update(new LambdaUpdateWrapper<SceneProExt>()
-                .in(SceneProExt::getSceneProId, proIds)
-                .set(SceneProExt::getSceneStatus, sceneStatus));
+        this.update(new LambdaUpdateWrapper<ScenePro>()
+                .eq(ScenePro::getSceneCode, sceneNum)
+                .set(ScenePro::getSceneStatus, sceneStatus));
     }
     }
 
 
     @Override
     @Override
@@ -2998,19 +2986,20 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if(CollUtil.isEmpty(list))
         if(CollUtil.isEmpty(list))
             return;
             return;
 
 
+        //修改场景状态 空间 支付状态 计算时间
+        List<Long> sceneProIds = list.stream().map(scenePro -> {
+            return scenePro.getId();
+        }).collect(Collectors.toList());
+
         this.update(new LambdaUpdateWrapper<ScenePro>()
         this.update(new LambdaUpdateWrapper<ScenePro>()
-                .eq(ScenePro::getSceneCode, sceneNum)
+                .in(ScenePro::getId, sceneProIds)
+                .set(ScenePro::getSceneStatus, SceneStatus.NO_DISPLAY.code())
                 .set(ScenePro::getCreateTime, Calendar.getInstance().getTime())
                 .set(ScenePro::getCreateTime, Calendar.getInstance().getTime())
                 .set(ScenePro::getUpdateTime, Calendar.getInstance().getTime())
                 .set(ScenePro::getUpdateTime, Calendar.getInstance().getTime())
                 .set(ScenePro::getVideos, videos));
                 .set(ScenePro::getVideos, videos));
 
 
-        //修改场景状态 空间 支付状态 计算时间
-        List<Long> sceneProIds = list.stream().map(scenePro -> {
-            return scenePro.getId();
-        }).collect(Collectors.toList());
         sceneProExtService.update(new LambdaUpdateWrapper<SceneProExt>()
         sceneProExtService.update(new LambdaUpdateWrapper<SceneProExt>()
                 .in(SceneProExt::getSceneProId, sceneProIds)
                 .in(SceneProExt::getSceneProId, sceneProIds)
-                .set(SceneProExt::getSceneStatus, SceneStatus.NO_DISPLAY.code())
                 .set(SceneProExt::getSpace, space)
                 .set(SceneProExt::getSpace, space)
                 .set(SceneProExt::getPayStatus, payStatus)
                 .set(SceneProExt::getPayStatus, payStatus)
                 .set(SceneProExt::getComputeTime, computeTime));
                 .set(SceneProExt::getComputeTime, computeTime));
@@ -3022,19 +3011,20 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if(CollUtil.isEmpty(list))
         if(CollUtil.isEmpty(list))
             return;
             return;
 
 
+        //修改场景状态 空间 支付状态 计算时间
+        List<Long> sceneProIds = list.stream().map(scenePro -> {
+            return scenePro.getId();
+        }).collect(Collectors.toList());
+
         this.update(new LambdaUpdateWrapper<ScenePro>()
         this.update(new LambdaUpdateWrapper<ScenePro>()
-                .eq(ScenePro::getSceneCode, sceneNum)
+                .in(ScenePro::getId, sceneProIds)
+                .set(ScenePro::getSceneStatus, SceneStatus.NO_DISPLAY.code())
                 .set(ScenePro::getCreateTime, Calendar.getInstance().getTime())
                 .set(ScenePro::getCreateTime, Calendar.getInstance().getTime())
                 .set(ScenePro::getUpdateTime, Calendar.getInstance().getTime())
                 .set(ScenePro::getUpdateTime, Calendar.getInstance().getTime())
                 .set(ScenePro::getVideos, videos));
                 .set(ScenePro::getVideos, videos));
 
 
-        //修改场景状态 空间 支付状态 计算时间
-        List<Long> sceneProIds = list.stream().map(scenePro -> {
-            return scenePro.getId();
-        }).collect(Collectors.toList());
         sceneProExtService.update(new LambdaUpdateWrapper<SceneProExt>()
         sceneProExtService.update(new LambdaUpdateWrapper<SceneProExt>()
-                .eq(SceneProExt::getSceneProId, sceneProIds)
-                .set(SceneProExt::getSceneStatus, SceneStatus.NO_DISPLAY.code())
+                .in(SceneProExt::getSceneProId, sceneProIds)
                 .set(SceneProExt::getComputeTime, computeTime));
                 .set(SceneProExt::getComputeTime, computeTime));
     }
     }
 
 
@@ -4166,7 +4156,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     }
     }
 
 
     @Override
     @Override
-    public IPage<SceneVO> getAppAllSceneByPage(Long cameraId, Long userId, int cameraType, int pageNum, Integer pageSize, String orderBy, Integer sceneType, List<String> sceneCodeList, String sceneName) {
+    public Page<SceneVO> getAppAllSceneByPage(Long cameraId, Long userId, int cameraType, int pageNum, Integer pageSize, String orderBy, Integer sceneType, List<String> sceneCodeList, String sceneName) {
 
 
         Page<SceneVO> page = new Page<>(pageNum, pageSize);
         Page<SceneVO> page = new Page<>(pageNum, pageSize);
 
 
@@ -4193,7 +4183,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 .select(ScenePro::getId)
                 .select(ScenePro::getId)
                 .eq(ScenePro::getTbStatus, TbStatus.VALID.code())
                 .eq(ScenePro::getTbStatus, TbStatus.VALID.code())
                 .eq(ScenePro::getRecStatus, RecStatus.VALID.code())
                 .eq(ScenePro::getRecStatus, RecStatus.VALID.code())
-                .eq(ScenePro::getCameraId, cameraId));
+                .eq(ScenePro::getCameraId, cameraId)
+                .in(ScenePro::getSceneStatus, SceneStatus.SUCCESS.code(), SceneStatus.NO_DISPLAY.code()));
         if(CollUtil.isEmpty(list)){
         if(CollUtil.isEmpty(list)){
             return 0l;
             return 0l;
         }
         }
@@ -4204,8 +4195,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 
 
         return sceneProExtService.count(new LambdaQueryWrapper<SceneProExt>()
         return sceneProExtService.count(new LambdaQueryWrapper<SceneProExt>()
                 .in(SceneProExt::getSceneProId, sceneProIds)
                 .in(SceneProExt::getSceneProId, sceneProIds)
-                .eq(SceneProExt::getPayStatus, PayStatus.PAY.code())
-                .in(SceneProExt::getSceneStatus, SceneStatus.SUCCESS.code(), SceneStatus.NO_DISPLAY.code()));
+                .eq(SceneProExt::getPayStatus, PayStatus.PAY.code()));
 
 
     }
     }
 
 
@@ -4358,8 +4348,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         SceneProExt sceneProExt = sceneProExtService.list(new QueryWrapper<SceneProExt>()
         SceneProExt sceneProExt = sceneProExtService.list(new QueryWrapper<SceneProExt>()
                 .eq("scene_pro_id", scenePro.getId())).get(0);
                 .eq("scene_pro_id", scenePro.getId())).get(0);
 
 
-        if(!SceneStatus.SUCCESS.code().equals(sceneProExt.getSceneStatus())
-                && !SceneStatus.NO_DISPLAY.code().equals(sceneProExt.getSceneStatus())){
+        if(!SceneStatus.SUCCESS.code().equals(scenePro.getSceneStatus())
+                && !SceneStatus.NO_DISPLAY.code().equals(scenePro.getSceneStatus())){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5033);
             throw new BusinessException(ErrorCode.FAILURE_CODE_5033);
         }
         }
         if(sceneProExt.getPayStatus() != 1){
         if(sceneProExt.getPayStatus() != 1){

+ 9 - 4
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java

@@ -26,6 +26,7 @@ import com.fdkankan.scene.entity.*;
 import com.fdkankan.scene.mapper.ISceneMapper;
 import com.fdkankan.scene.mapper.ISceneMapper;
 import com.fdkankan.scene.mapper.ISceneProMapper;
 import com.fdkankan.scene.mapper.ISceneProMapper;
 import com.fdkankan.scene.service.ISceneExtService;
 import com.fdkankan.scene.service.ISceneExtService;
+import com.fdkankan.scene.service.ISceneProExtService;
 import com.fdkankan.scene.service.ISceneProService;
 import com.fdkankan.scene.service.ISceneProService;
 import com.fdkankan.scene.service.ISceneService;
 import com.fdkankan.scene.service.ISceneService;
 import com.fdkankan.scene.vo.SceneEditVO;
 import com.fdkankan.scene.vo.SceneEditVO;
@@ -77,6 +78,8 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
     RedisUtil redisUtil;
     RedisUtil redisUtil;
     @Autowired
     @Autowired
     RedisLockUtil redisLockUtil;
     RedisLockUtil redisLockUtil;
+    @Autowired
+    ISceneProExtService sceneProExtService;
 
 
     @Override
     @Override
     public void updateUserIdByCameraId(Long userId, Long cameraId) {
     public void updateUserIdByCameraId(Long userId, Long cameraId) {
@@ -1036,7 +1039,8 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
                     if(scene == null){
                     if(scene == null){
                         ScenePro scenePro = sceneProMapper.findByNum(sceneNum);
                         ScenePro scenePro = sceneProMapper.findByNum(sceneNum);
                         if(scenePro != null){
                         if(scenePro != null){
-                            count = scenePro.getViewCount();
+                            SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
+                            count = sceneProExt.getViewCount();
                         }
                         }
                     }else {
                     }else {
                         count = scene.getViewCount();
                         count = scene.getViewCount();
@@ -1077,9 +1081,10 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
 
 
                 ScenePro scenePro = sceneProMapper.findByNum(entry.getKey());
                 ScenePro scenePro = sceneProMapper.findByNum(entry.getKey());
                 if(scenePro != null){
                 if(scenePro != null){
-                    scenePro.setViewCount(entry.getValue());
-                    scenePro.setUpdateTime(Calendar.getInstance().getTime());
-                    sceneProService.updateById(scenePro);
+                    SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
+                    sceneProExt.setViewCount(entry.getValue());
+                    sceneProExt.setUpdateTime(Calendar.getInstance().getTime());
+                    sceneProExtService.updateById(sceneProExt);
                 }
                 }
             }
             }
         }finally {
         }finally {

+ 2 - 0
4dkankan-center-scene/src/main/resources/bootstrap.yml

@@ -1,6 +1,8 @@
 spring:
 spring:
   application:
   application:
     name: 4dkankan-center-scene
     name: 4dkankan-center-scene
+#  main:
+#    allow-bean-definition-overriding: true
   cloud:
   cloud:
     nacos:
     nacos:
       config:
       config:

+ 10 - 10
4dkankan-center-scene/src/main/resources/mapper/scene/SceneProMapper.xml

@@ -13,7 +13,7 @@
         <result column="scene_logo" property="sceneLogo" jdbcType="VARCHAR" />
         <result column="scene_logo" property="sceneLogo" jdbcType="VARCHAR" />
         <result column="scene_code" property="sceneCode" jdbcType="VARCHAR" />
         <result column="scene_code" property="sceneCode" jdbcType="VARCHAR" />
         <result column="scene_type" property="sceneType" jdbcType="TINYINT" />
         <result column="scene_type" property="sceneType" jdbcType="TINYINT" />
-        <result column="view_count" property="viewCount" jdbcType="INTEGER" />
+        <result column="scene_status" property="sceneStatus" jdbcType="INTEGER" />
         <result column="shoot_count" property="shootCount" jdbcType="INTEGER" />
         <result column="shoot_count" property="shootCount" jdbcType="INTEGER" />
         <result column="videos" property="videos" jdbcType="VARCHAR" />
         <result column="videos" property="videos" jdbcType="VARCHAR" />
         <result column="gps" property="gps" jdbcType="VARCHAR" />
         <result column="gps" property="gps" jdbcType="VARCHAR" />
@@ -27,14 +27,13 @@
 
 
     <sql id="ScenePro_column">
     <sql id="ScenePro_column">
         t.id, t.scene_name, t.scene_dec, t.web_site, t.thumb, t.user_id,
         t.id, t.scene_name, t.scene_dec, t.web_site, t.thumb, t.user_id,
-        t.camera_id, t.scene_logo, t.scene_code, t.scene_type, t.view_count,
+        t.camera_id, t.scene_logo, t.scene_code, t.scene_type, t.scene_status,
         t.shoot_count, t.videos, t.gps, t.scene_scheme, t.rec_status, t.build_type,
         t.shoot_count, t.videos, t.gps, t.scene_scheme, t.rec_status, t.build_type,
         t.create_time, t.update_time, t.tb_status
         t.create_time, t.update_time, t.tb_status
     </sql>
     </sql>
 
 
     <resultMap id="SceneProExtResultMap" type="com.fdkankan.scene.entity.SceneProExt" >
     <resultMap id="SceneProExtResultMap" type="com.fdkankan.scene.entity.SceneProExt" >
         <result column="scene_pro_id" property="sceneProId" jdbcType="BIGINT" />
         <result column="scene_pro_id" property="sceneProId" jdbcType="BIGINT" />
-        <result column="scene_status" property="sceneStatus" jdbcType="INTEGER" />
         <result column="data_source" property="dataSource" jdbcType="VARCHAR" />
         <result column="data_source" property="dataSource" jdbcType="VARCHAR" />
         <result column="pay_status" property="payStatus" jdbcType="TINYINT" />
         <result column="pay_status" property="payStatus" jdbcType="TINYINT" />
         <result column="phone_id" property="phoneId" jdbcType="VARCHAR" />
         <result column="phone_id" property="phoneId" jdbcType="VARCHAR" />
@@ -48,10 +47,11 @@
         <result column="scene_source" property="sceneSource" jdbcType="INTEGER" />
         <result column="scene_source" property="sceneSource" jdbcType="INTEGER" />
         <result column="vrnum" property="vrnum" jdbcType="VARCHAR" />
         <result column="vrnum" property="vrnum" jdbcType="VARCHAR" />
         <result column="unicode" property="unicode" jdbcType="VARCHAR" />
         <result column="unicode" property="unicode" jdbcType="VARCHAR" />
+        <result column="view_count" property="viewCount" jdbcType="INTEGER" />
     </resultMap>
     </resultMap>
 
 
     <sql id="SceneProExt_column" >
     <sql id="SceneProExt_column" >
-        ext.scene_pro_id, ext.scene_status, ext.data_source, ext.pay_status,
+        ext.scene_pro_id, ext.data_source, ext.pay_status,t.,
         ext.phone_id, ext.recommend, ext.files_name, ext.algorithm, ext.ecs, ext.space,
         ext.phone_id, ext.recommend, ext.files_name, ext.algorithm, ext.ecs, ext.space,
         ext.firmware_version, ext.compute_time, ext.scene_source, ext.vrnum, ext.unicode
         ext.firmware_version, ext.compute_time, ext.scene_source, ext.vrnum, ext.unicode
     </sql>
     </sql>
@@ -95,7 +95,7 @@
         WHERE t.user_id = #{userId}
         WHERE t.user_id = #{userId}
         AND ext.camera_type = #{cameraType}
         AND ext.camera_type = #{cameraType}
         AND t.rec_status = 'A'
         AND t.rec_status = 'A'
-        AND ext.scene_status IN (1,-2)
+        AND t.scene_status IN (1,-2)
         AND t.scene_type != 99
         AND t.scene_type != 99
         ORDER BY t.create_time DESC
         ORDER BY t.create_time DESC
     </select>
     </select>
@@ -108,7 +108,7 @@
         LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
         LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
         WHERE t.user_id = #{userId}
         WHERE t.user_id = #{userId}
         AND t.rec_status = 'A'
         AND t.rec_status = 'A'
-        AND ext.scene_status in (1, -2)
+        AND t.scene_status in (1, -2)
         AND t.scene_type != 99
         AND t.scene_type != 99
         AND ext.scene_source = 1
         AND ext.scene_source = 1
         <if test= 'excludeNums != null and excludeNums.size > 0'>
         <if test= 'excludeNums != null and excludeNums.size > 0'>
@@ -128,7 +128,7 @@
         LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
         LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
         WHERE ext.camera_type = #{cameraType}
         WHERE ext.camera_type = #{cameraType}
         AND t.rec_status = 'A'
         AND t.rec_status = 'A'
-        AND ext.scene_status IN (1,-2)
+        AND t.scene_status IN (1,-2)
         AND t.scene_type != 99
         AND t.scene_type != 99
         <if test= 'sceneCodeList != null and sceneCodeList.size > 0'>
         <if test= 'sceneCodeList != null and sceneCodeList.size > 0'>
             and t.scene_code in
             and t.scene_code in
@@ -193,7 +193,7 @@
             FROM t_scene_pro t
             FROM t_scene_pro t
             LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
             LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
             WHERE t.user_id = #{userId} AND ext.camera_type = #{cameraType}
             WHERE t.user_id = #{userId} AND ext.camera_type = #{cameraType}
-            AND t.rec_status = 'A' AND ext.scene_status in (1, -2) AND t.scene_type != 99
+            AND t.rec_status = 'A' AND t.scene_status in (1, -2) AND t.scene_type != 99
         </if>
         </if>
         <if test= 'userId != null and cameraId != null'>
         <if test= 'userId != null and cameraId != null'>
             UNION
             UNION
@@ -203,7 +203,7 @@
             FROM t_scene_pro t
             FROM t_scene_pro t
             LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
             LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
             WHERE t.camera_id = #{cameraId}
             WHERE t.camera_id = #{cameraId}
-            AND ext.scene_status in (1, -2) AND t.scene_type != 99 AND t.rec_status = 'A'
+            AND t.scene_status in (1, -2) AND t.scene_type != 99 AND t.rec_status = 'A'
         </if>
         </if>
         <if test= 'sceneCodeList != null and sceneCodeList.size() > 0'>
         <if test= 'sceneCodeList != null and sceneCodeList.size() > 0'>
             UNION
             UNION
@@ -212,7 +212,7 @@
             <include refid="SceneProExt_column"/>
             <include refid="SceneProExt_column"/>
             FROM t_scene_pro t
             FROM t_scene_pro t
             LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
             LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
-            WHERE ext.scene_status in (1, -2)
+            WHERE t.scene_status in (1, -2)
             AND  t.scene_code IN
             AND  t.scene_code IN
             <foreach collection="sceneCodeList" item="sceneCode" open="(" close=")" separator=",">
             <foreach collection="sceneCodeList" item="sceneCode" open="(" close=")" separator=",">
                 #{sceneCode}
                 #{sceneCode}

+ 5 - 0
4dkankan-common/src/main/java/com/fdkankan/common/response/BaseResponseAdvice.java

@@ -11,6 +11,8 @@ import org.springframework.http.server.ServerHttpResponse;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
 import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
 
 
+import java.util.Objects;
+
 @RestControllerAdvice
 @RestControllerAdvice
 public class BaseResponseAdvice implements ResponseBodyAdvice<Object> {
 public class BaseResponseAdvice implements ResponseBodyAdvice<Object> {
     @Override
     @Override
@@ -24,6 +26,9 @@ public class BaseResponseAdvice implements ResponseBodyAdvice<Object> {
 //            return body;
 //            return body;
 //        }
 //        }
         System.out.println("响应拦截成功");
         System.out.println("响应拦截成功");
+//        if(Objects.isNull(body)){
+//            return ResultData.ok();
+//        }
         if(body instanceof String){
         if(body instanceof String){
             return JSONObject.toJSONString(ResultData.ok(body));
             return JSONObject.toJSONString(ResultData.ok(body));
         }
         }