浏览代码

素材库全景图只显示计算成功的数据
添加上传图片校验底层数据格式

wuweihao 4 年之前
父节点
当前提交
60f764c804

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

@@ -27,7 +27,7 @@ public class FodderProvider {
         if(!StringUtils.isAllBlank(type)){
             sql.append(" and ( type = '").append(type).append("' )");
             if ("pano".equals(type)) {
-                sql.append(" and status >= ").append(2);
+                sql.append(" and status >= ").append(3);
             }
         }
 

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

@@ -126,9 +126,6 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
                 log.info("pano serverPath: " + savePath);
                 log.info("全景图片写入完成");
 
-                // 压缩图片并上传oss, 以后内存不够,或者内存溢出改用算法提供的切图
-//                iconPath = fileUtils.compressImgAndUploadOss2(
-//                        savePath, configConstant.ossBasePath + sceneCode , configConstant.ossDomain, 600, 300, "/thumb_"+sceneCode+".jpg");
 
                 // 全景图的预览图
                 ossPreviewIcon = convertAndUploadOss(
@@ -149,14 +146,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
 
                 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);
-//                        // 使用oss做缩略图
-//                        iconPath = ossUrl  ;
-//                    } else {
-//                    }
+
                     iconPath = ossUrl;
 
 
@@ -223,8 +213,6 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         String saveCompressImgPath = serverBasePath + imgName;
         String ossUrl = null;
 
-//        Img.from(new File(inputFilePath)).scale(width, height).write(new File(saveCompressImgPath));
-//        log.info("图片压缩成功: " + saveCompressImgPath);
         // 使用convert压缩图片
         String cmd = CmdConstant.CONVERT;
         String size = width + "x" + height;
@@ -383,130 +371,6 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
 
 
 
-//    @Override
-//    public Result upload(MultipartFile file, String type, String tempId)  {
-//
-//        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;
-//
-//
-//
-//            FileUtil.writeFromStream(file.getInputStream(), savePath);
-//
-//            log.info("pano serverPath: " + savePath);
-//                log.info("全景图片写入完成");
-//
-//                // 压缩图片并上传oss, 以后内存不够,或者内存溢出改用算法提供的切图
-//                iconPath = fileUtils.compressImgAndUploadOss2(
-//                        savePath, configConstant.ossBasePath + sceneCode , configConstant.ossDomain, 600, 300, "/thumb_"+sceneCode+".jpg");
-//
-//                // 全景图的预览图
-//                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(getUserNameForToken());
-//            entity.setFileSize(size+"");
-//            entity.setDpi(dpi);
-//            entity.setPreviewIcon(ossPreviewIcon);
-//            entity.setTempId(tempId);
-//
-//            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);
-//    }
-
-
-
     @Override
     public Result search(FodderPageDto param) {
         startPage(param);
@@ -551,7 +415,6 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
 
     @Override
     public Result checkStatus(String ids) {
-//        ids = "(" + ids + ")";
         List<FodderEntity> list = entityMapper.checkStatus(ids, getUserNameForToken());
         return Result.success(list);
     }

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

@@ -57,6 +57,12 @@ public class FodderController extends BaseController {
         return fodderService.upload(file, type, tempId);
     }
 
+    /**
+     *  2021-04-30
+     *  目前只返回计算成功的数据
+     * @param param
+     * @return
+     */
     @ApiOperation(value = "列表", position = 1)
     @PostMapping("list")
     public Result<FodderEntity> list(@RequestBody FodderPageDto param) {