소스 검색

v1.2.0 统计用户空间3G

wuweihao 3 년 전
부모
커밋
538a6e0d1f
20개의 변경된 파일90개의 추가작업 그리고 581개의 파일을 삭제
  1. 2 1
      720yun_fd_consumer/src/main/java/com/gis/util/FileUtils.java
  2. 1 1
      720yun_fd_manage/gis_application/src/main/resources/application-loc.properties
  3. 59 1
      720yun_fd_manage/gis_common/src/main/java/com/gis/common/exception/BaseRuntimeException.java
  4. 3 0
      720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/FodderMapper.java
  5. 0 1
      720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/IconMapper.java
  6. 1 2
      720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/WorkMapper.java
  7. 0 76
      720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/provider/SceneProvider.java
  8. 0 17
      720yun_fd_manage/gis_mapper/src/main/resources/mapper/WorkMapper.xml
  9. 0 40
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/CatalogService.java
  10. 0 1
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/FodderService.java
  11. 0 14
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/IconService.java
  12. 0 2
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/SysUserService.java
  13. 0 2
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/WorkService.java
  14. 0 193
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/CatalogServiceImpl.java
  15. 19 138
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/FodderServiceImpl.java
  16. 0 61
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java
  17. 0 2
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/FodderController.java
  18. 3 1
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/IconController.java
  19. 1 17
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WebController.java
  20. 1 11
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WorkController.java

+ 2 - 1
720yun_fd_consumer/src/main/java/com/gis/util/FileUtils.java

@@ -2,6 +2,7 @@ package com.gis.util;
 
 import cn.hutool.core.io.FileUtil;
 import lombok.extern.log4j.Log4j2;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.junit.Test;
 import org.springframework.stereotype.Component;
@@ -13,7 +14,7 @@ import java.util.*;
 /**
  * Created by owen on 2020/5/12 0012 17:21
  */
-@Log4j2
+@Slf4j
 @Component
 public class FileUtils {
 

+ 1 - 1
720yun_fd_manage/gis_application/src/main/resources/application-loc.properties

@@ -67,7 +67,7 @@ spring.redis.jedis.pool.max-wait=-1ms
 #spring.rabbitmq.password=guest
 
 # rabbitmq \u96C6\u7FA4\u6A21\u5F0F
-spring.rabbitmq.address=localhost:5672
+spring.rabbitmq.address=120.25.146.52:5672
 spring.rabbitmq.username=guest
 spring.rabbitmq.password=guest
 spring.rabbitmq.virtual-host=/

+ 59 - 1
720yun_fd_manage/gis_common/src/main/java/com/gis/common/exception/BaseRuntimeException.java

@@ -1,5 +1,10 @@
 package com.gis.common.exception;
 
+import cn.hutool.core.util.StrUtil;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
 public class BaseRuntimeException extends RuntimeException{
 
     private static final long serialVersionUID = -1518945670203783450L;
@@ -8,15 +13,22 @@ public class BaseRuntimeException extends RuntimeException{
 
     public BaseRuntimeException(String msg){
         super(msg);
+        this.code = -1;
         this.msg = msg;
     }
 
+    /**
+     *
+     * @param code 允许为null
+     * @param msg
+     */
     public BaseRuntimeException(Integer code, String msg){
         super(msg);
-        this.code = code;
+        this.code = code == null? -1 : code;
         this.msg = msg;
     }
 
+
     public Integer getCode() {
         return code;
     }
@@ -32,4 +44,50 @@ public class BaseRuntimeException extends RuntimeException{
     public void setMsg(String msg) {
         this.msg = msg;
     }
+
+
+    public static void isNull(Object obj, Integer code, String msg){
+        if (obj == null){
+            getExc(code, msg);
+        }
+    }
+
+    public static void isBlank(Object obj, Integer code, String msg){
+        if (obj == null){
+            getExc(code, msg);
+        }
+
+        if (obj instanceof String && StrUtil.isBlank(obj.toString())){
+            getExc(code, msg);
+        }
+
+    }
+
+
+
+
+    /**
+     *
+     * @param obj 存在抛异常
+     * @param code 允许为null
+     * @param msg
+     */
+    public static void isTrue(boolean obj, Integer code, String msg){
+        if (obj){
+            getExc(code, msg);
+        }
+    }
+
+    public static void  getExc(Integer code, String msg){
+        throw new BaseRuntimeException(code, msg);
+    }
+
+
+
+    public static void isEmpty(List obj, Integer code, String msg){
+        if (CollectionUtils.isEmpty(obj)){
+            getExc(code, msg);
+        }
+    }
+
 }

+ 3 - 0
720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/FodderMapper.java

@@ -27,4 +27,7 @@ public interface FodderMapper extends IBaseMapper<FodderEntity, Long> {
 
     @SelectProvider(type = FodderProvider.class, method = "checkStatus")
     List<FodderEntity> checkStatus(String ids, String userId);
+
+    @Select("select sum(file_size) from tb_fodder where is_delete=0 and user_id=#{phone} ")
+    Integer countSize(String phone);
 }

+ 0 - 1
720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/IconMapper.java

@@ -1,7 +1,6 @@
 package com.gis.mapper;
 
 
-import com.gis.domain.entity.FodderEntity;
 import com.gis.domain.entity.IconEntity;
 import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Component;

+ 1 - 2
720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/WorkMapper.java

@@ -44,6 +44,5 @@ public interface WorkMapper extends IBaseStrMapper<WorkEntity, String> {
     @Delete("delete from tb_work where is_delete=0 and status=0 and DATE_FORMAT( create_time, '%Y%m' ) <= DATE_FORMAT(#{now} , '%Y%m' )")
     void delByTime(String now);
 
-//    void insertWork(@Param("work") WorkEntity param);
-    void insertWork(WorkEntity param);
+
 }

+ 0 - 76
720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/provider/SceneProvider.java

@@ -1,76 +0,0 @@
-//package com.gis.mapper.provider;
-//
-//import com.gis.domain.dto.ScenePageDto;
-//import lombok.extern.log4j.Log4j2;
-//import org.apache.commons.lang3.StringUtils;
-//
-///**
-// * Created by owen on 2021/1/8 0008 16:50
-// */
-//@Log4j2
-//public class SceneProvider {
-//
-//    public String search(ScenePageDto param){
-//        StringBuffer sql = new StringBuffer("select * from tb_scene where is_delete = 0");
-//
-//        String houseId = param.getHouseId();
-//        if(!StringUtils.isAllBlank(houseId)){
-//            sql.append(" and ( house_id = '").append(houseId).append("' )");
-//        }
-//
-//        String searchKey = param.getSearchKey();
-//        if(!StringUtils.isAllBlank(searchKey)){
-//            sql.append(" and ( scene_title like '%").append(searchKey).append("%' )");
-//        }
-//
-//        String type = param.getType();
-//        if(!StringUtils.isAllBlank(type)){
-//            sql.append(" and ( type = '").append(type).append("' )");
-//        }
-//
-//        String status = param.getStatus();
-//        // 传3 过来,会把审核:4、未审核:3的都传给前端
-//        if(StringUtils.isNotBlank(status)){
-//            sql.append(" and ( status >= '").append(status).append("' )");
-//        }
-//
-//        sql.append(" order by sort asc, create_time asc");
-//
-//        log.info("sql: {}", sql.toString());
-//        return sql.toString();
-//    }
-//
-//
-//    public String searchByUserName(ScenePageDto param, String userName, String isShow){
-//        StringBuffer sql = new StringBuffer("select * from tb_scene where is_delete = 0");
-//
-//        sql.append(" and ( create_user_id = '").append(userName).append("' )");
-//
-//
-//        String searchKey = param.getSearchKey();
-//        if(!StringUtils.isAllBlank(searchKey)){
-//            sql.append(" and ( scene_title like '%").append(searchKey).append("%' )");
-//        }
-//
-//        String type = param.getType();
-//        if(!StringUtils.isAllBlank(type)){
-//            sql.append(" and ( type = '").append(type).append("' )");
-//        }
-//
-//        String status = param.getStatus();
-//        // 传3 过来,会把审核:4、未审核:3的都传给前端
-//        if(StringUtils.isNotBlank(status)){
-//            sql.append(" and ( status >= '").append(status).append("' )");
-//        }
-//
-//
-//        if(StringUtils.isNotBlank(isShow)){
-//            sql.append(" and ( is_show = '").append(isShow).append("' )");
-//        }
-//
-//        sql.append(" order by sort asc, create_time asc");
-//
-//        log.info("sql: {}", sql.toString());
-//        return sql.toString();
-//    }
-//}

+ 0 - 17
720yun_fd_manage/gis_mapper/src/main/resources/mapper/WorkMapper.xml

@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.gis.mapper.WorkMapper">
-
-
-    <insert id="insertWork" parameterType="com.gis.domain.entity.WorkEntity">
-
-      insert into tb_work (id, create_time, update_time, user_id, status)
-        values
-        (#{id}, #{createTime}, #{updateTime}, #{userId}, #{status})
-
-        <selectKey resultType="java.lang.Long"   order="AFTER"  keyProperty="id">
-            SELECT LAST_INSERT_ID()
-        </selectKey>
-
-    </insert>
-</mapper>

+ 0 - 40
720yun_fd_manage/gis_service/src/main/java/com/gis/service/CatalogService.java

@@ -1,40 +0,0 @@
-//package com.gis.service;
-//
-//
-//import com.gis.common.util.Result;
-//import com.gis.domain.dto.BaseDto;
-//import com.gis.domain.dto.CatalogDto;
-//import com.gis.domain.entity.CatalogEntity;
-//import com.gis.domain.entity.FodderEntity;
-//import com.gis.domain.vo.CatalogVo;
-//import org.springframework.web.multipart.MultipartFile;
-//
-//import java.util.List;
-//
-//
-///**
-// * Created by owen on 2020/3/11 0011 16:14
-// */
-//public interface CatalogService extends IBaseService<CatalogEntity, Long> {
-//
-//
-//    Result saveEntity(CatalogDto param);
-//
-//    Result listTree(String workId);
-//
-//    Result webListTree(String workId);
-//
-//    Result remove(Long id);
-//
-//    Result getCatalog(String workId);
-//
-//    Result getScene(Long catalogId);
-//
-//    CatalogVo voFindById(Long catalogId);
-//
-//    List<CatalogEntity> findByParentId(Long parentId);
-//
-//    Result editEntity(BaseDto param);
-//
-//    List<CatalogEntity> findByWorkId(Long id);
-//}

+ 0 - 1
720yun_fd_manage/gis_service/src/main/java/com/gis/service/FodderService.java

@@ -15,7 +15,6 @@ public interface FodderService extends IBaseService<FodderEntity, Long> {
 
 
 
-    Result upload2(MultipartFile file, String type) ;
 
     Result upload(MultipartFile file, String type, String tempId) ;
 

+ 0 - 14
720yun_fd_manage/gis_service/src/main/java/com/gis/service/IconService.java

@@ -15,18 +15,4 @@ import org.springframework.web.multipart.MultipartFile;
 public interface IconService extends IBaseService<IconEntity, Long> {
     Result upload(MultipartFile file);
 
-
-//    Result upload2(MultipartFile file, String type) ;
-//
-//    Result upload(MultipartFile file, String type, String tempId) ;
-//
-//    Result search(FodderPageDto param);
-//
-//    Result selectFodderPano(PageDto param, Long workId);
-//
-//
-//
-//    Result checkStatus(String ids);
-
-
 }

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

@@ -11,11 +11,9 @@ import java.util.List;
  */
 public interface SysUserService extends IBaseService<SysUserEntity, Long> {
 
-//    List<UserResponse> findAllBySearchKey(PageDto param);
 
     SysUserEntity findByUserName(String userName);
 
     SysUserEntity findByPhone(String phone);
 
-//    List<UserEntity> findBySearchKey(PageRequest param);
 }

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

@@ -29,8 +29,6 @@ public interface WorkService extends IBaseService<WorkEntity, String> {
 
     void addVisit(String id);
 
-//    Result<WorkInfoVo> getDetail(String id);
-
     Result edit(SomeDataDto param);
 
     Result select4dkk(PageDto param, String workId);

+ 0 - 193
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/CatalogServiceImpl.java

@@ -1,193 +0,0 @@
-//package com.gis.service.impl;
-//
-//import com.gis.common.constant.MsgCode;
-//import com.gis.common.util.Result;
-//import com.gis.domain.dto.BaseDto;
-//import com.gis.domain.dto.CatalogDto;
-//import com.gis.domain.entity.CatalogEntity;
-//import com.gis.domain.entity.SceneEntity;
-//import com.gis.domain.tree.CatalogTree;
-//import com.gis.domain.vo.CatalogSceneTree;
-//import com.gis.domain.vo.CatalogVo;
-//import com.gis.mapper.CatalogMapper;
-//import com.gis.mapper.IBaseMapper;
-//import com.gis.mapper.SceneMapper;
-//import com.gis.service.CatalogService;
-//import com.gis.service.SceneService;
-//import com.gis.tree.CatalogTreeUtil;
-//import com.gis.tree.SceneTreeUtil;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.BeanUtils;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.stereotype.Service;
-//
-//import javax.transaction.Transactional;
-//import java.util.Date;
-//import java.util.List;
-//
-//
-///**
-// * Created by owen on 2020/3/11 0011 16:16
-// */
-//@Slf4j
-//@Service
-//@Transactional
-//public class CatalogServiceImpl extends IBaseServiceImpl<CatalogEntity, Long> implements CatalogService {
-//
-//    @Autowired
-//    private CatalogMapper entityMapper;
-//
-//    @Autowired
-//    private SceneMapper sceneMapper;
-//
-//    @Autowired
-//    SceneService sceneService;
-//
-//
-//
-//
-//
-//    @Override
-//    public IBaseMapper<CatalogEntity, Long> getBaseMapper() {
-//        return this.entityMapper;
-//    }
-//
-//
-//    @Override
-//    public Result saveEntity(CatalogDto param) {
-//        Long id = param.getId();
-//        CatalogEntity entity = null;
-//        if (id == null) {
-//            entity = new CatalogEntity();
-//            BeanUtils.copyProperties(param, entity);
-//            save(entity);
-//
-//            // 若场景二级分组,把父分组场景移动到二级分组
-//            Long oldCatalogId = entity.getParentId();
-//            if (oldCatalogId != null) {
-//                sceneMapper.setCatalogByCatalogId(entity.getId(), oldCatalogId);
-//            }
-//
-//
-//        } else {
-//            entity = findById(id);
-//            if (entity == null) {
-//                log.error("对象不存在: " + id);
-//                Result.failure("对象不存在");
-//            }
-//
-//            BeanUtils.copyProperties(param, entity);
-//            entity.setUpdateTime(new Date());
-//            update(entity);
-//
-//        }
-//        return Result.success();
-//    }
-//
-//
-//    @Override
-//    public Result getCatalog(String workId) {
-//        List<CatalogEntity> list = entityMapper.findByWorkId(workId);
-//        CatalogTreeUtil treeUtil = new CatalogTreeUtil(list);
-//        List<CatalogTree> catalogTrees = treeUtil.buildTree();
-//        return Result.success(treeUtil.buildTree());
-//    }
-//
-//    @Override
-//    public Result getScene(Long catalogId) {
-//        return Result.success(sceneService.findByCatalogId(catalogId));
-//    }
-//
-//    @Override
-//    public CatalogVo voFindById(Long catalogId) {
-//        return entityMapper.voFindById(catalogId);
-//    }
-//
-//    @Override
-//    public List<CatalogEntity> findByParentId(Long parentId) {
-//        return entityMapper.findByParentId(parentId);
-//    }
-//
-//    @Override
-//    public Result editEntity(BaseDto param) {
-//         Long id = param.getId();
-//        CatalogEntity entity = findById(id);
-//        if (entity == null) {
-//            log.error("对象不存在: " + id);
-//            Result.failure("对象不存在");
-//        }
-//
-//        BeanUtils.copyProperties(param, entity);
-//        entity.setUpdateTime(new Date());
-//        update(entity);
-//        return Result.success();
-//    }
-//
-//    @Override
-//    public List<CatalogEntity> findByWorkId(String id) {
-//
-//        return entityMapper.findByWorkId(id);
-//    }
-//
-//    @Override
-//    public Result listTree(String workId) {
-//        List<CatalogEntity> list = entityMapper.findByWorkId(workId);
-//        CatalogTreeUtil treeUtil = new CatalogTreeUtil(list, sceneMapper);
-//        return Result.success(treeUtil.buildTree());
-//    }
-//
-//    @Override
-//    public Result webListTree(String workId) {
-//        List<CatalogSceneTree> list = entityMapper.afindByWorkId(workId);
-//
-//        SceneTreeUtil sceneTreeUtil = new SceneTreeUtil(list);
-//        return Result.success(sceneTreeUtil.buildTree());
-//    }
-//
-//    @Override
-//    public Result remove(Long id) {
-//
-//        CatalogEntity entity = this.findById(id);
-//        if (entity == null) {
-//            return Result.success();
-//        }
-//
-//        List<SceneEntity> workScenes = sceneService.findByWorkId(entity.getWorkId());
-//        List<SceneEntity> catalogScenes = sceneService.findByCatalogId(id);
-//        if ((workScenes.size()-catalogScenes.size()) <= 0) {
-//            return Result.failure(MsgCode.e3002,"请至少保留一个场景");
-//        }
-//
-//        // 递归删除
-//        this.delete(id);
-//
-//        return Result.success();
-//    }
-//
-//
-//
-//    private void delete(Long id){
-//        CatalogEntity entity = this.findById(id);
-//        if (entity == null) {
-//            return;
-//        }
-//
-//        entity.setIsDelete(1);
-//        entity.setUpdateTime(new Date());
-//        this.update(entity);
-//
-//        // 删除分组,需要把对应的场景删除
-//        sceneMapper.setDeleteByCatalogId(id);
-//
-//        List<CatalogEntity> parentList = entityMapper.findByParentId(id);
-//        if (parentList.size() > 0) {
-//            for (CatalogEntity catalogEntity : parentList) {
-//                // 递归删除
-//                delete(catalogEntity.getId());
-//            }
-//        }
-//    }
-//
-//
-//
-//}

+ 19 - 138
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/FodderServiceImpl.java

@@ -61,6 +61,9 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
     @Autowired
     AliyunOssUtil aliyunOssUtil;
 
+    // 用户最大空间3G
+    static int MAX_SIZE = 1024 * 1024 * 3;
+
 
     @Override
     public IBaseMapper<FodderEntity, Long> getBaseMapper() {
@@ -72,6 +75,10 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
     public Result upload(MultipartFile file, String type, String tempId)  {
 
         long start = System.currentTimeMillis();
+        String phone = getUserNameForToken();
+
+        // 检查用户空间
+        checkUserSize(phone);
         // 检查非法文件上传
         boolean checkFile = FileUtils.checkFile(file);
         if (!checkFile) {
@@ -107,7 +114,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
                     return Result.failure(MsgCode.e3004, "全景图文件不能超过120MB");
                 }
 
-                // 方法可以读取到图片内部结构, 可以检验非全景图
+                // 方法可以读取到图片内部结构, 可以检验非全景图
                 String imgType = FileTypeUtil.getType(file.getInputStream());
                 // 全景图只支持jpg图片格式
                 if (!imgType.equalsIgnoreCase("jpg")) {
@@ -168,7 +175,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
 
             entity.setOssPath(ossUrl);
             entity.setIcon(iconPath);
-            entity.setUserId(getUserNameForToken());
+            entity.setUserId(phone);
             entity.setFileSize(size+"");
             entity.setDpi(dpi);
             entity.setPreviewIcon(ossPreviewIcon);
@@ -240,135 +247,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
     }
 
 
-    @Override
-    public Result upload2(MultipartFile file, String type)  {
-        log.info("now time: " + new Date());
 
-        long start = System.currentTimeMillis();
-        // 检查非法文件上传
-        boolean checkFile = FileUtils.checkFile(file);
-        if (!checkFile) {
-            return Result.failure("上传文件格式有误, 请重新上传");
-        }
-
-        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS");
-        String fileName = file.getOriginalFilename();
-        // 文件名校验长度
-        String prefix = StringUtils.substringBeforeLast(fileName, ".");
-        if (prefix.length() > 50) {
-            return Result.failure(3003, "文件名称不允许超过50个字节");
-        }
-        String suffix = StringUtils.substringAfterLast(fileName, ".");
-        String newName = time  + "."  +suffix;
-        String dirType = "fodder/";
-        long size = file.getSize();
-        size = size/1024;
-        log.info("fileSize: " + size);
-
-        String ossUrl = null;
-        String iconPath = "0";
-        String dpi = "0";
-        String ossPath = configConstant.ossBasePath+dirType+newName;
-        String savePath = configConstant.serverBasePath;
-        String ossPreviewIcon = null;
-
-        FodderEntity entity = new FodderEntity();
-        try {
-            if (type.equals("pano")) {
-
-                if ((size/1024) >= 120) {
-                    return Result.failure(MsgCode.e3004, "全景图文件不能超过120MB");
-                }
-
-                String sceneCode = RandomUtils.getSceneCode("fd720_");
-                newName = sceneCode+"." + suffix;
-                savePath =savePath + sceneCode + "/" + newName;
-
-
-                log.info("准备写入全景图: " +  new Date());
-                Thread.sleep(10000);
-
-                FileUtil.writeFromStream(file.getInputStream(), savePath);
-
-                log.info("pano serverPath: " + savePath);
-                log.info("全景图片写入完成");
-
-                log.info("睡眠10s: " +  new Date());
-                Thread.sleep(10000);
-
-                log.info("准备执行压缩图片: " +  new Date());
-                // 压缩图片并上传oss
-                iconPath = fileUtils.compressImgAndUploadOss2(
-                        savePath, configConstant.ossBasePath + sceneCode , configConstant.ossDomain, 600, 300, "/thumb_"+sceneCode+".jpg");
-
-
-                log.info("压缩图片2: " +  new Date());
-                // 全景图的预览图
-                ossPreviewIcon = fileUtils.compressImgAndUploadOss2(
-                        savePath, configConstant.ossBasePath + sceneCode , configConstant.ossDomain, 1920, 960, "/preview.jpg");
-
-
-                ossUrl = configConstant.ossDomain+configConstant.ossBasePath + sceneCode;
-
-
-
-                entity.setSceneCode(sceneCode);
-                entity.setFilePath(savePath);
-                entity.setStatus(1);
-
-            } else {
-                ossUrl = configConstant.ossDomain+ossPath;
-
-                if (type.equals("image")) {
-                    // 图片大于1MB生成缩略图, 小于1MB使用原图作为缩略图
-                    if (size > 1024) {
-                        savePath = savePath + dirType + newName;
-                        FileUtil.writeFromStream(file.getInputStream(), savePath);
-                        iconPath = fileUtils.scaleImgAndUploadOss(savePath, configConstant.ossBasePath + dirType , configConstant.ossDomain);
-                    } else {
-                        iconPath = ossUrl;
-                    }
-
-                    dpi = ImageUtil.dpi(file);
-
-                }
-                // 普通素材直接上传oss, 服务器不保留文件
-                aliyunOssUtil.upload(file.getBytes(), ossPath);
-
-
-            }
-            entity.setType(type);
-            // 用前缀做名称
-            entity.setName(prefix);
-            entity.setFileName(newName);
-            log.info("ossUrl: " + ossUrl);
-            log.info("iconPath:" + iconPath);
-
-            entity.setOssPath(ossUrl);
-            entity.setIcon(iconPath);
-            entity.setUserId("15015980188");
-            entity.setFileSize(size+"");
-            entity.setDpi(dpi);
-            entity.setPreviewIcon(ossPreviewIcon);
-
-//            save(entity);
-
-//            if (type.equals("pano")) {
-//                //发消息到mq
-//                rabbitTemplate.convertAndSend(RabbitConfig.PANO_EXCHANGE, RabbitConfig.PANO_QUEUE_ROUTING, entity.getId());
-//                log.info("发送消息到队列完成: " + entity.getId());
-//            }
-            long end = System.currentTimeMillis();
-            log.info("上传完成,耗时: {} s" , (end-start)/1000);
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(e.getMessage());
-            throw new BaseRuntimeException(MsgCode.e5003, "不支持此图片");
-        }
-
-
-        return Result.success(entity);
-    }
 
 
 
@@ -380,12 +259,6 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
     }
 
 
-    @Test
-    public void test(){
-        BufferedImage read = ImgUtil.read("E:\\cache\\aa.jpg");
-        System.out.println(read.getWidth());
-        System.out.println(read.getHeight());
-    }
 
 
     @Override
@@ -421,8 +294,16 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
     }
 
 
-
-
+    /**
+     * 2022-05-31 by owen
+     * 检查用户空间, 最大3G
+     * @param phone
+     */
+    private void checkUserSize(String phone){
+        Integer size = entityMapper.countSize(phone);
+        log.info("当前用户空间: {} M", (size / 1024));
+        BaseRuntimeException.isTrue(size >= MAX_SIZE, null, "该用户空间已满");
+    }
 
 
 

+ 0 - 61
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java

@@ -27,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.transaction.Transactional;
 import java.io.IOException;
 import java.time.LocalDate;
 import java.util.ArrayList;
@@ -35,8 +34,6 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 
 /**
@@ -44,7 +41,6 @@ import java.util.stream.Stream;
  */
 @Slf4j
 @Service
-//@Transactional
 public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> implements WorkService {
 
     @Autowired
@@ -60,9 +56,6 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     @Autowired
     private CatalogMapper catalogMapper;
 
-//    @Autowired
-//    CatalogService catalogService;
-
     @Autowired
     SceneMapper sceneMapper;
 
@@ -101,8 +94,6 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     @Override
     public Result<WorkEntity> entitySave(WorkDto param) {
         String id = param.getId();
-//        WorkEntity entity = this.findById(id);
-
         WorkEntity entity = entityMapper.selectByPrimaryKey(id);
 
         if (entity == null) {
@@ -129,14 +120,12 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         entity.setCreateTime(date);
         entity.setUpdateTime(date);
 
-//        entityMapper.insertWork(entity);
         this.save(entity);
 
         String id = entity.getId();
         log.info("创建对象完成: {}", id);
 
 
-//        // 创建someData
         // 如基someData作出修改,记得把代码里的someData 跟服务器里的someData都修改
         String baseSomeDataPath = configConstant.serverBasePath + "baseData/someData.json";
         log.info("服务器base someData.json path: {}", baseSomeDataPath);
@@ -227,55 +216,6 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         entityMapper.addVisit(id);
     }
 
-//    @Override
-//    public Result<WorkInfoVo> getDetail(String id) {
-//        WorkEntity entity = this.findById(id);
-//        if (entity == null) {
-//            return Result.failure("对象不存在");
-//        }
-//        WorkInfoVo workInfoVo = new WorkInfoVo();
-//        BeanUtils.copyProperties(entity, workInfoVo);
-//
-//        // 获取分组信息
-//        List<CatalogEntity> list = catalogService.findByWorkId(id);
-//
-//        // 处理第二级
-//        Stream<CatalogEntity> stream2 = list.stream();
-//        Stream<CatalogEntity> sub = stream2.filter(s -> s.getParentId() != null);
-//        List<CatalogEntity> catalogs = sub.collect(Collectors.toList());
-//        workInfoVo.setCatalogs(catalogs);
-//
-//
-//        // 处理第一级
-//        CatalogTreeUtil treeUtil = new CatalogTreeUtil(list);
-//        List<CatalogTree> trees = treeUtil.buildTree();
-//
-//        List<CatalogEntity> c1 = new ArrayList<>();
-//        for (CatalogTree tree : trees) {
-//            CatalogEntity catalogEntity = new CatalogEntity();
-//            BeanUtils.copyProperties(tree, catalogEntity);
-//            // 有子结节
-//            List<CatalogTree> children = tree.getChildren();
-//
-//            // 子节点
-//            List<Long> child = new ArrayList<>();
-//            if (children.size() > 0) {
-//                for (CatalogTree son : children) {
-//                    child.add(son.getId());
-//                }
-//            }
-//            catalogEntity.setChildren(child);
-//            c1.add(catalogEntity);
-//        }
-//        workInfoVo.setCatalogRoot(c1);
-//
-//        // 处理场景
-//        List<SceneEntity> scenes = sceneService.findByWorkId(id);
-//        workInfoVo.setScenes(scenes);
-//
-//        return Result.success(workInfoVo);
-//    }
-
     @Override
     public WorkEntity findByIdForUpdate(String id) {
         // 查询数据之前先清理分页缓存
@@ -343,7 +283,6 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         entity.setQrCode(sd.getString("qrCode"));
         entity.setStatus(sd.getInteger("status"));
         entity.setPassword(sd.getString("password"));
-//        entity.setSceneCodes(sd.getString("scenes"));
         String scenes = sd.getString("scenes");
         entity.setSceneCodes(getSceneCodes(scenes));
         // 更新logoQrCode

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

@@ -40,8 +40,6 @@ public class FodderController extends BaseController {
     @Autowired
     private FodderService fodderService;
 
-//    @Autowired
-//    SceneService sceneService;
 
     @Autowired
     WorkService workService;

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

@@ -20,6 +20,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+import springfox.documentation.annotations.ApiIgnore;
 
 import java.util.Date;
 import java.util.List;
@@ -28,10 +29,11 @@ import java.util.List;
 /**
  * Created by owen on 2021/11/08 0018 12:17
  */
+@ApiIgnore
 @Slf4j
 @Api(tags = "图标管理")
 @RestController
-@RequestMapping("manage/icon")
+@RequestMapping("/manage/icon")
 public class IconController extends BaseController {
 
     @Autowired

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

@@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
 @Log4j2
 @Api(tags = "展示页")
 @RestController
-@RequestMapping("web/common")
+@RequestMapping("/web/common")
 public class WebController extends BaseController {
 
 
@@ -89,22 +89,6 @@ public class WebController extends BaseController {
 
 
 
-//    @ApiOperation("检验密码")
-//    @PostMapping("checkPwd")
-//    public Result checkPwd(String workId, String password) {
-//        WorkEntity entity = workService.findById(workId);
-//        if (entity == null) {
-//            log.error("对象不存在, 场景码:{}", workId);
-//            return Result.failure("对象不存在");
-//        }
-//
-//        String dbPassword = entity.getPassword();
-//        if (!dbPassword.equals(password)) {
-//            return Result.failure(MsgCode.e5004,"密码有误");
-//        }
-//        return Result.success(entity);
-//    }
-
     @ApiOperation("检验密码")
     @PostMapping("checkPwd")
     public Result checkPwd(@Valid @RequestBody WorkPwdDto param) {

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

@@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit;
 @Log4j2
 @Api(tags = "我的作品")
 @RestController
-@RequestMapping("manage/work")
+@RequestMapping("/manage/work")
 public class WorkController extends BaseController {
 
     @Autowired
@@ -67,16 +67,6 @@ public class WorkController extends BaseController {
     }
 
 
-    /**
-     * 2021-04-20
-     * 这个接口好像没用
-     * @return
-     */
-//    @ApiOperation(value = "详情", position = 1)
-//    @GetMapping("detail/{id}")
-//    public Result<WorkInfoVo> detail(@PathVariable Long id) {
-//        return workService.getDetail(id);
-//    }
 
     @ApiOperation(value = "修改实体", position = 1)
     @PostMapping("save")