wuweihao пре 4 година
родитељ
комит
7b14b54d96
19 измењених фајлова са 305 додато и 138 уклоњено
  1. 5 0
      720yun_fd_consumer/src/main/java/com/gis/listener/Fd720Listener.java
  2. 8 46
      720yun_fd_consumer/src/main/java/com/gis/util/CmdUtils.java
  3. 3 1
      720yun_fd_manage/gis_application/src/main/resources/data/someData.json
  4. 2 1
      720yun_fd_manage/gis_common/src/main/java/com/gis/common/constant/MsgCode.java
  5. 50 8
      720yun_fd_manage/gis_common/src/main/java/com/gis/common/util/QrCodeUtils.java
  6. 3 0
      720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/SomeDataDto.java
  7. 11 7
      720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/FodderMapper.java
  8. 17 0
      720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/provider/FodderProvider.java
  9. 2 4
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/FodderService.java
  10. 2 0
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/WorkService.java
  11. 15 28
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/FodderServiceImpl.java
  12. 126 2
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java
  13. 9 1
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/BaseController.java
  14. 1 1
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/CatalogController.java
  15. 16 2
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/FodderController.java
  16. 1 1
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/SceneController.java
  17. 27 35
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WebController.java
  18. 6 0
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WorkController.java
  19. 1 1
      720yun_fd_manage/remark-m.md

+ 5 - 0
720yun_fd_consumer/src/main/java/com/gis/listener/Fd720Listener.java

@@ -33,6 +33,11 @@ public class Fd720Listener {
 
     @RabbitHandler
     public void getMessage(Long param)  {
+        try {
+            Thread.sleep(300);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
         log.warn("run Fd720Listener: " + param);
         cmdPano(param);
         log.warn("end Fd720Listener: "+ param);

+ 8 - 46
720yun_fd_consumer/src/main/java/com/gis/util/CmdUtils.java

@@ -2,7 +2,6 @@ package com.gis.util;
 
 import cn.hutool.core.util.RuntimeUtil;
 import lombok.extern.log4j.Log4j2;
-import org.apache.commons.lang3.StringUtils;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -21,7 +20,8 @@ public class CmdUtils {
      */
     public static void callshell(String command){
         try {
-            Process process = Runtime.getRuntime().exec(command);
+            String[] cmd = new String[]{"/bin/sh", "-c", command};
+            Process process = Runtime.getRuntime().exec(cmd);
             StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR");
             errorGobbler.start();
             StreamGobbler outGobbler = new StreamGobbler(process.getInputStream(), "STDOUT");
@@ -32,59 +32,21 @@ public class CmdUtils {
         }
     }
 
-    public static int cmdOss(String cmd) throws IOException, InterruptedException {
-        Process exec = RuntimeUtil.exec(cmd);
-        log.info("run cmdOss");
-
-        BufferedReader br = new BufferedReader(new InputStreamReader(exec.getInputStream()));
-        BufferedReader errorBuf = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
-
-        String errorLine;
-        while ((errorLine = errorBuf.readLine()) != null) {
-            log.error("errorLine: {}", errorLine);
-        }
-
-        // success ,没有获取到信息
-        String line;
-        int i = 1;
-        while ((line = br.readLine()) != null) {
-            log.info("line: {}", line);
-
-            // 查看执行日志
-//            if (i % 100 == 0) {
-//                log.info("line, i=" + i +", " +line);
-//            }
-
-//            if (line.contains("done.")) {
-//                log.info("line: {}", line);
-//                log.info("cmdThumb完成 ");
-//            }
-            i++;
-        }
-        log.info("执行总行数:" +i);
-
-        // 结束命令行
-        int isCmd = exec.waitFor();
-
-        // 关闭流
-        br.close();
-        errorBuf.close();
-
-        return isCmd;
-
-    }
 
 
     /**
      * 命令运行结果 1:失败, 0:成功
-     * @param cmd
      * @return
      * @throws IOException
      * @throws InterruptedException
      */
-    public static int cmdPano(String cmd) throws IOException, InterruptedException {
-        Process exec = RuntimeUtil.exec(cmd);
+    public static int cmdPano(String command) throws IOException, InterruptedException {
         log.info("run cmdPano");
+//        String[] cmd = new String[]{"/bin/sh", "-c", command};
+//        Process exec = Runtime.getRuntime().exec(cmd);
+
+        // 使用 bin/sh 这个方法会报错
+        Process exec = RuntimeUtil.exec(command);
 
         BufferedReader br = new BufferedReader(new InputStreamReader(exec.getInputStream()));
         BufferedReader errorBuf = new BufferedReader(new InputStreamReader(exec.getErrorStream()));

+ 3 - 1
720yun_fd_manage/gis_application/src/main/resources/data/someData.json

@@ -1,5 +1,6 @@
 {
   "isPassword": 0,
+  "password": "",
   "ossSomeData": "",
   "icon": "",
   "description": "",
@@ -32,7 +33,8 @@
   "scenes": [],
   "isAuto": 1,
   "logo": "",
+  "logoChange": false,
   "share": "",
   "id": "",
   "status": 0
-}
+}

+ 2 - 1
720yun_fd_manage/gis_common/src/main/java/com/gis/common/constant/MsgCode.java

@@ -16,7 +16,8 @@ public class MsgCode {
     /** 文件过大 */
     public final static Integer e3004 = 3004;
 
-
+    /** 不是该用户作品 */
+    public final static Integer e3005 = 3005;
 
     public final static Integer e5003 = 5003;
     public final static String m5003 = "不支持此图片";

+ 50 - 8
720yun_fd_manage/gis_common/src/main/java/com/gis/common/util/QrCodeUtils.java

@@ -55,11 +55,11 @@ public class QrCodeUtils {
     /**
      * 附带logo小图标二维码
      */
-    public String generateLogoQrCode(String url, String serverBasePath, String ossBasePath, String ossDomain){
+    public String generateLogoQrCode(String url, String serverBasePath, String ossBasePath, String ossDomain, Long id){
         // 保存地址
-        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS") + ".jpg";
-        String dirType = "qrCode/";
-        String savePath = serverBasePath + dirType;
+//        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS") + ".jpg";
+//        String dirType = "qrCode/";
+        String savePath = serverBasePath + id;
 
         String logoPath = serverBasePath + "img/kankan_icon.png";
         if (!FileUtil.isFile(logoPath)) {
@@ -73,19 +73,61 @@ public class QrCodeUtils {
         if (!FileUtil.isDirectory(savePath)) {
             FileUtil.mkdir(savePath);
         }
-        savePath = savePath + time;
-        log.info("savePath: {}", savePath);
+        savePath = savePath + "/qrCode.jpg";
+//        log.info("savePath: {}", savePath);
         // 创建二维码tpt
         QrCodeUtil.generate(url, QrConfig.create().setImg(logoPath).setWidth(300), FileUtil.file(savePath));
 
         // 二维码上传oss
-        String ossPath = ossBasePath + dirType + time;
+        String ossPath = ossBasePath + id + "/qrCode.jpg";
         aliyunOssUtil.upload(savePath, ossPath);
         String ossUrl = ossDomain + ossPath;
         log.info("ossUrl: {}", ossUrl);
 
         // 删除服务器临时文件
-        FileUtil.del(savePath);
+//        FileUtil.del(savePath);
+
+        return ossUrl;
+    }
+
+
+
+    /**
+     * 自定义logo小图标二维码
+     * @param url 二维码内容url
+     * @param serverBasePath
+     * @param ossBasePath
+     * @param ossDomain
+     * @param id 目录
+     * @param logoPath 小logo图片地址
+     * @return
+     */
+    public String diyLogoQrCode(String url, String serverBasePath, String ossBasePath, String ossDomain, Long id, String logoPath){
+
+        String savePath = serverBasePath + id;
+
+//        String logoPath = serverBasePath + "img/kankan_icon.png";
+//        if (!FileUtil.isFile(logoPath)) {
+//            InputStream resource = FileUtils.getResource("img/kankan_icon.png");
+//            FileUtil.writeFromStream(resource, logoPath);
+//            log.info("logo写入完成");
+//        }
+//        log.info("logoPath: {}", logoPath);
+
+        // 创建目录
+        if (!FileUtil.isDirectory(savePath)) {
+            FileUtil.mkdir(savePath);
+        }
+        savePath = savePath + "/qrCode.jpg";
+//        log.info("savePath: {}", savePath);
+        // 创建二维码tpt
+        QrCodeUtil.generate(url, QrConfig.create().setImg(logoPath).setWidth(300), FileUtil.file(savePath));
+
+        // 二维码上传oss
+        String ossPath = ossBasePath + id + "/qrCode.jpg";
+        aliyunOssUtil.upload(savePath, ossPath);
+        String ossUrl = ossDomain + ossPath;
+        log.info("ossUrl: {}", ossUrl);
 
         return ossUrl;
     }

+ 3 - 0
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/SomeDataDto.java

@@ -19,6 +19,9 @@ public class SomeDataDto {
     @ApiModelProperty(value = "静态文件信息", required = true)
     private String someData;
 
+//    @ApiModelProperty(value = "场景密码")
+//    private String password;
+
 
 
 }

+ 11 - 7
720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/FodderMapper.java

@@ -17,18 +17,22 @@ import java.util.List;
 @Mapper
 public interface FodderMapper extends IBaseMapper<FodderEntity, Long> {
 
-    @Select("select * from tb_fodder where is_delete = 0 and user_id = #{userId} AND status = #{status} AND type = #{type}")
-    List<FodderEntity> findByStatusAndTypeAndUserId(int status, String type, String userId);
-
-    @Select("select * from tb_fodder where is_delete = 0 and user_id = #{userId} AND type = #{type}")
-    List<FodderEntity> findByType(String userId, String type);
+//    @Select("select * from tb_fodder where is_delete = 0 and user_id = #{userId} AND status = #{status} AND type = #{type}")
+//    List<FodderEntity> findByStatusAndTypeAndUserId(int status, String type, String userId);
+//
+//    @Select("select * from tb_fodder where is_delete = 0 and user_id = #{userId} AND type = #{type}")
+//    List<FodderEntity> findByType(String userId, String type);
 
     @SelectProvider(type = FodderProvider.class, method = "search")
     List<FodderEntity> search(FodderPageDto param, String userId);
 
-    @Select("select * from tb_fodder where is_delete = 0 and scene_code = #{sceneCode} ")
-    FodderEntity findBySceneCode(String sceneCode);
+//    @Select("select * from tb_fodder where is_delete = 0 and scene_code = #{sceneCode} ")
+//    FodderEntity findBySceneCode(String sceneCode);
 
     @SelectProvider(type = FodderProvider.class, method = "searchPano")
     List<FodderEntity> searchPano(PageDto param, String userId);
+
+    @SelectProvider(type = FodderProvider.class, method = "checkStatus")
+//    @Select("select * from tb_fodder where is_delete = 0 and user_id = #{userId} AND id in #{ids}")
+    List<FodderEntity> checkStatus(String ids, String userId);
 }

+ 17 - 0
720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/provider/FodderProvider.java

@@ -61,5 +61,22 @@ public class FodderProvider {
     }
 
 
+    public String checkStatus(String ids, String userId){
+        StringBuffer sql = new StringBuffer("select * from tb_fodder where is_delete = 0");
+
+        if(!StringUtils.isAllBlank(userId)){
+            sql.append(" and user_id = '").append(userId).append("'");
+        }
+
+
+        if(!StringUtils.isAllBlank(ids)){
+            sql.append(" and id in (").append(ids).append(")");
+        }
+
+        sql.append(" order by create_time desc");
+
+        log.info("sql: {}", sql.toString());
+        return sql.toString();
+    }
 
 }

+ 2 - 4
720yun_fd_manage/gis_service/src/main/java/com/gis/service/FodderService.java

@@ -20,15 +20,13 @@ public interface FodderService extends IBaseService<FodderEntity, Long> {
 
     Result upload(MultipartFile file, String type) ;
 
-    List<FodderEntity> findByType(String userId, String type);
 
-    List<FodderEntity> findByStatusAndTypeAndUserId(int status, String type, String userId);
 
     Result search(FodderPageDto param);
 
     Result selectFodderPano(PageDto param, Long workId);
 
-    Result selectFodderType(PageDto param, String type);
 
-    FodderEntity findBySceneCode(String sceneCode);
+
+    Result checkStatus(String ids);
 }

+ 2 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/WorkService.java

@@ -28,4 +28,6 @@ public interface WorkService extends IBaseService<WorkEntity, Long> {
     Result<WorkInfoVo> getDetail(Long id);
 
     Result edit(SomeDataDto param);
+
+    Result select4dkk(PageDto param, Long workId);
 }

+ 15 - 28
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/FodderServiceImpl.java

@@ -183,15 +183,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         return Result.success(entity);
     }
 
-    @Override
-    public List<FodderEntity> findByType(String userId, String type) {
-        return entityMapper.findByType(userId, type);
-    }
 
-    @Override
-    public List<FodderEntity> findByStatusAndTypeAndUserId(int status, String type, String userId) {
-        return entityMapper.findByStatusAndTypeAndUserId(status, type, userId);
-    }
 
     @Override
     public Result search(FodderPageDto param) {
@@ -214,43 +206,38 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         startPage(param);
 
         List<FodderEntity> list = entityMapper.searchPano(param, getUserNameForToken());
+        PageInfo<FodderEntity> pageInfo = new PageInfo<>(list);
+
 
         // 作品场景查重
         List<String> useScenes = sceneService.strFindByWorkId(workId, "pano");
-
+        // 存更新后的数据
         List<FodderEntity> result = new ArrayList<>();
-        for (FodderEntity entity : list) {
+
+        List<FodderEntity> fodderList = pageInfo.getList();
+        for (FodderEntity entity : fodderList) {
             String sceneCode = entity.getSceneCode();
             if (useScenes.contains(sceneCode)){
                 entity.setIsUse(1);
             }
             result.add(entity);
         }
+        pageInfo.setList(result);
 
-        return Result.success(new PageInfo<>(result));
+        return Result.success(pageInfo);
     }
 
     @Override
-    public Result selectFodderType(PageDto param, String type) {
-        startPage(param);
-        List<FodderEntity> list = entityMapper.findByType(getUserNameForToken(), type);
-        return Result.success(new PageInfo<>(list));
+    public Result checkStatus(String ids) {
+//        ids = "(" + ids + ")";
+        List<FodderEntity> list = entityMapper.checkStatus(ids, getUserNameForToken());
+        return Result.success(list);
     }
 
-    @Override
-    public FodderEntity findBySceneCode(String sceneCode) {
-        return entityMapper.findBySceneCode(sceneCode);
-    }
 
 
-    @Test
-    public void test1(){
-        String fileName = "15un_fd_manage_data/fd720_0ARhvh11b/fd720_0ARhvh11b.jpg";
-        String suffix = StringUtils.substringBeforeLast(fileName, ".");
-        log.info("suffix: {}", suffix);
-        if (suffix.length() > 50) {
-            log.error("文件名称不允许超过50个字节");
-        }
-    }
+
+
+
 
 }

+ 126 - 2
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java

@@ -1,8 +1,11 @@
 package com.gis.service.impl;
 
 import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.gis.common.constant.ConfigConstant;
+import com.gis.common.constant.MsgCode;
+import com.gis.common.exception.BaseRuntimeException;
 import com.gis.common.util.*;
 import com.gis.domain.dto.PageDto;
 import com.gis.domain.dto.SomeDataDto;
@@ -11,6 +14,7 @@ import com.gis.domain.entity.CatalogEntity;
 import com.gis.domain.entity.SceneEntity;
 import com.gis.domain.entity.WorkEntity;
 import com.gis.domain.tree.CatalogTree;
+import com.gis.domain.vo.ProSceneVo;
 import com.gis.domain.vo.WorkInfoVo;
 import com.gis.mapper.CatalogMapper;
 import com.gis.mapper.SceneMapper;
@@ -22,6 +26,9 @@ import com.gis.service.WorkService;
 import com.gis.tree.CatalogTreeUtil;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -30,6 +37,7 @@ import javax.transaction.Transactional;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -124,7 +132,7 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
 
         // 创建二维码、二维码url
         String shareUrl = configConstant.domain4dKK + "/panorama/show.html?id=" + id;
-        String qrCode = qrCodeUtils.generateLogoQrCode(shareUrl, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain);
+        String qrCode = qrCodeUtils.generateLogoQrCode(shareUrl, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain, id);
         jsonObject.put("share", shareUrl);
         jsonObject.put("qrCode", qrCode);
 
@@ -246,11 +254,27 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
         String someData = param.getSomeData();
         JSONObject sd = JSONObject.parseObject(someData);
         entity.setName(sd.getString("name"));
-        entity.setDescription(sd.getString("description"));
+//        String description = sd.getString("description");
+//        if (description != null && description.length() >= 254 ) {
+//            throw new BaseRuntimeException(-1, "简介超出长度");
+//        }
+//        entity.setDescription(description);
         entity.setIcon(sd.getString("icon"));
         entity.setShare(sd.getString("share"));
         entity.setQrCode(sd.getString("qrCode"));
         entity.setStatus(sd.getInteger("status"));
+        entity.setPassword(sd.getString("password"));
+        // 更新logoQrCode
+        Boolean logoChange = sd.getBoolean("logoChange");
+        String logoUrl = sd.getString("logo");
+        if (logoChange) {
+            Boolean isLogo = updateQrCode(id, logoUrl);
+            if (!isLogo) {
+                log.error("二维码创建失败");
+                return false;
+            }
+        }
+
 
         entity.setUpdateTime(new Date());
 
@@ -259,6 +283,25 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
 
     }
 
+    /** 更新二维码 */
+    private Boolean updateQrCode(Long id, String logoUrl){
+
+        // 网络下载logo图片
+        logoUrl = logoUrl + "?m=" + System.currentTimeMillis();
+        String localBasePath = configConstant.serverBasePath + id;
+        FileUtils.downLoadFromUrl(logoUrl, "logo.jpg", localBasePath);
+        String logoPath = localBasePath + "/logo.jpg";
+        if (!FileUtil.isFile(logoPath)) {
+            log.error("logo.jpg文件不存在");
+            return false;
+        }
+        log.info("网络下载logo完成");
+        String shareUrl = configConstant.domain4dKK + "/panorama/show.html?id=" + id;
+        qrCodeUtils.diyLogoQrCode(shareUrl, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain, id, logoPath);
+        log.info("二维码更新完成");
+        return true;
+    }
+
 
     /**
      * 更新someData.json
@@ -284,4 +327,85 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
 
     }
 
+    @Override
+    public Result select4dkk(PageDto param, Long workId) {
+        startPage(param);
+
+//        String url = "https://test.4dkankan.com/api/user/scene/list";
+        String url = configConstant.domain4dKK + "/api/user/scene/list";
+        JSONObject reqParam = new JSONObject();
+        reqParam.put("pageNum", param.getPageNum().toString());
+        reqParam.put("pageSize", param.getPageSize().toString());
+        reqParam.put("searchKey", param.getSearchKey());
+        // type=11, 计算成功的场景
+        reqParam.put("type", "11");
+
+        HashMap<String, String> headers = new HashMap<>();
+        String token = getToken();
+        if (StringUtils.isBlank(token)) {
+            return Result.failure("token无空");
+        }
+        headers.put("token", token);
+        String restResult = null;
+        JSONObject reJson = null;
+        try {
+            HttpResponse httpResponse = HttpUtils.doPost(url, headers, reqParam);
+            restResult = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
+            log.debug("restResult: " + restResult);
+
+
+            reJson = JSONObject.parseObject(restResult);
+            int code = reJson.getInteger("code");
+            log.info("resultCode: {}", code);
+
+            if (code == 3004) {
+                String msg = reJson.getString("msg");
+                log.info("获取四维看看列表失败,{}", msg);
+                return Result.failure(5001, msg);
+            }
+
+            if (code != 0) {
+                String msg = reJson.getString("msg");
+                log.info("获取四维看看列表失败,{}", msg);
+                return Result.failure(msg);
+            }
+
+            JSONObject dataJson = reJson.getJSONObject("data");
+                    } catch (Exception e) {
+            e.printStackTrace();
+        }
+//            JSONArray list = dataJson.getJSONArray("list");
+//
+//
+//            // 作品场景查重
+//            List<String> useScenes = this.strFindByWorkId(workId, "4dkk");
+//
+//            List<ProSceneVo> result = new ArrayList<>();
+//            if (list.size() > 0) {
+//                for (Object entity : list) {
+//                    JSONObject proJson = JSONObject.parseObject(entity.toString());
+//                    ProSceneVo pro = new ProSceneVo();
+//                    pro.setNum(proJson.getString("num"));
+//                    pro.setSceneName(proJson.getString("sceneName"));
+//                    pro.setThumb(proJson.getString("thumb"));
+//                    pro.setStatus(proJson.getInteger("status"));
+//                    pro.setCreateTime(proJson.getString("createTime"));
+//
+//                    if (useScenes.contains(pro.getNum())) {
+//                        pro.setIsUse(1);
+//                    }
+//                    result.add(pro);
+//                }
+//            }
+//            dataJson.put("list", result);
+//
+//
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+        return Result.success(reJson);
+
+
+    }
+
 }

+ 9 - 1
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/BaseController.java

@@ -1,6 +1,7 @@
 package com.gis.web.controller;
 
 
+import com.gis.common.shiro.JwtUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 
@@ -29,7 +30,14 @@ public class BaseController {
     }
 
 
-
+    public String getUserNameForToken(){
+        /** 获取header token */
+        String token = request.getHeader("token");
+        if (org.apache.commons.lang3.StringUtils.isNotBlank(token)){
+            return JwtUtil.getUsername(token);
+        }
+        return null;
+    }
 
 
 

+ 1 - 1
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/CatalogController.java

@@ -26,7 +26,7 @@ import java.util.Date;
  */
 @Log4j2
 @Api(tags = "场景分组")
-@RestController
+//@RestController
 @RequestMapping("manage/catalog")
 public class CatalogController extends BaseController {
 

+ 16 - 2
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/FodderController.java

@@ -85,6 +85,10 @@ public class FodderController extends BaseController {
                 log.error("场景已使用,不能删除");
                 return Result.failure(MsgCode.e3001, MsgCode.m3001);
             }
+
+            if (entity.getStatus() == 1) {
+                return Result.failure("计算中的场景不能删除");
+            }
         }
 
         entity.setIsDelete(1);
@@ -95,7 +99,7 @@ public class FodderController extends BaseController {
 
     @ApiOperation(value = "详情", position = 1)
     @GetMapping("detail/{id}")
-    public Result<WorkEntity> detail(@PathVariable Long id) {
+    public Result<FodderEntity> detail(@PathVariable Long id) {
         FodderEntity entity = fodderService.findById(id);
         if (entity == null) {
             return Result.failure("对象不存在");
@@ -104,12 +108,22 @@ public class FodderController extends BaseController {
     }
 
 
-
+    /**
+     * 2021-04-13 可能不使用
+     * */
     @ApiOperation(value = "选择全景图", position = 1)
     @PostMapping("select/pano/{workId}")
     public Result selectFodderPano(@RequestBody PageDto param, @PathVariable Long workId) {
         return fodderService.selectFodderPano(param, workId);
     }
 
+    @ApiOperation(value = "检查状态", notes = "ids , 多个id用',' 隔开")
+    @GetMapping("checkStatus/{ids}")
+    public Result checkStatus(@PathVariable String ids) {
+
+        return fodderService.checkStatus(ids);
+    }
+
+
 
 }

+ 1 - 1
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/SceneController.java

@@ -35,7 +35,7 @@ import java.util.Map;
  */
 @Log4j2
 @Api(tags = "场景管理")
-@RestController
+//@RestController
 @RequestMapping("manage/scene")
 //@RequestMapping("aa/scene")
 public class SceneController extends BaseController {

+ 27 - 35
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WebController.java

@@ -26,8 +26,7 @@ import org.springframework.web.bind.annotation.*;
 @RequestMapping("web/common")
 public class WebController extends BaseController {
 
-    @Autowired
-    private CatalogService catalogService;
+
 
     @Autowired
     private RedisTemplate<String, String> redisTemplate;
@@ -41,37 +40,20 @@ public class WebController extends BaseController {
 
 
 
-    @ApiOperation(value = "获取场景", position = 1)
-    @GetMapping("getScene/{catalogId}")
-    public Result getScene(@PathVariable Long catalogId) {
-        return catalogService.getScene(catalogId);
-    }
-
-    @ApiOperation(value = "获取分组")
-    @GetMapping("getCatalog/{workId}")
-    public Result getCatalog(@PathVariable Long workId) {
-        return catalogService.getCatalog(workId);
-    }
 
 
-    @ApiOperation(value = "作品列表", position = 1)
-    @GetMapping("listTree/{workId}")
-    public Result listTree(@PathVariable Long workId) {
-        // 记录访问次数
-        workService.addVisit(workId);
-        return catalogService.listTree(workId);
-    }
-
-    @ApiOperation("作品详情")
-    @GetMapping("detail/{workId}")
-    public Result detail(@PathVariable Long workId) {
+    /** 每次浏览作品都需要调用次接口 */
+    @ApiOperation(value = "检查作品是否可用", notes = "true:可用, false:不可用")
+    @GetMapping("checkWork/{workId}")
+    public Result checkWork(@PathVariable Long workId) {
         WorkEntity entity = workService.findById(workId);
-        if (entity == null) {
-            log.error("对象不存在, 场景码:{}", workId);
-            return Result.failure("对象不存在");
+        Boolean flag = false;
+        if (entity != null) {
+            log.info("作品不存在");
+            flag = true;
+            workService.addVisit(workId);
         }
-
-        return Result.success(entity);
+        return Result.success(flag);
     }
 
 
@@ -103,8 +85,8 @@ public class WebController extends BaseController {
 
 
     @ApiOperation(value = "检查token是否有效" , position = 3)
-    @GetMapping("checkToken")
-    public Result checkToken() {
+    @GetMapping("checkToken/{workId}")
+    public Result checkToken(@PathVariable Long workId) {
         String token = getToken();
         if (token == null) {
             log.error("token is null");
@@ -113,12 +95,22 @@ public class WebController extends BaseController {
 
         String redisKey = "token#"+ token;
         String redisToken = redisTemplate.opsForValue().get(redisKey);
-        if (redisToken != null) {
-            return Result.success();
+        if (redisToken == null) {
+            log.error("redis token is null");
+            return Result.failure(5001, "Token无效");
+        }
+
+        String userId = getUserNameForToken();
+        WorkEntity entity = workService.findById(workId);
+        if (entity == null) {
+            return Result.failure("对象不存在: " + workId);
+        }
+
+        if (!userId.equals(entity.getUserId())) {
+            return Result.failure(MsgCode.e3005, "不是该用户作品");
         }
 
-        log.error("redis token is null");
-        return Result.failure(5001, "Token无效");
+        return Result.success();
 
     }
 

+ 6 - 0
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WorkController.java

@@ -81,6 +81,12 @@ public class WorkController extends BaseController {
         return workService.remove(id);
     }
 
+    @ApiOperation(value = "选择三维场景", position = 1)
+    @PostMapping("select/4dkk/{workId}")
+    public Result select4dkk(@RequestBody PageDto param, @PathVariable Long workId) {
+        return workService.select4dkk(param, workId);
+    }
+
 
 
 

+ 1 - 1
720yun_fd_manage/remark-m.md

@@ -33,7 +33,7 @@
 #dev    
  ## rabbit MQ
     rul: http://8.135.106.227:15672/
-    admin
+      admin
     admin123