Bladeren bron

添加缩略图

wuweihao 3 jaren geleden
bovenliggende
commit
f7587fb6a9

+ 2 - 2
720yun_local_manage/gis_pano/src/main/java/com/gis/cms/entity/po/FodderEntity.java

@@ -30,8 +30,8 @@ public class FodderEntity extends BaseEntity implements Serializable {
 //    @ApiModelProperty(value = "创建人")
 //    private String userId;
 
-//    @ApiModelProperty(value = "封面图")
-//    private String icon;
+    @ApiModelProperty(value = "封面图")
+    private String icon;
 
     @ApiModelProperty(value = "预览图(全景图使用)")
     private String previewIcon;

+ 8 - 0
720yun_local_manage/gis_pano_producer/src/main/java/com/gis/cms/controller/ProducerController.java

@@ -32,6 +32,14 @@ public class ProducerController {
     }
 
 
+    @ApiOperation(value = "检查上传全景图状态", notes = "ids , 多个id用',' 隔开")
+    @GetMapping("checkStatus/{ids}")
+    public Result checkStatus(@PathVariable String ids) {
+        return entityService.checkStatus(ids);
+    }
+
+
+
 
 
 

+ 2 - 2
720yun_local_manage/gis_pano_producer/src/main/java/com/gis/cms/entity/po/FodderEntity.java

@@ -33,8 +33,8 @@ public class FodderEntity extends BaseEntity implements Serializable {
 //    @ApiModelProperty(value = "创建人")
 //    private String userId;
 
-//    @ApiModelProperty(value = "封面图")
-//    private String icon;
+    @ApiModelProperty(value = "封面图")
+    private String icon;
 
     @ApiModelProperty(value = "预览图(全景图使用)")
     private String previewIcon;

+ 2 - 0
720yun_local_manage/gis_pano_producer/src/main/java/com/gis/cms/service/ProducerService.java

@@ -10,4 +10,6 @@ import java.io.IOException;
  */
 public interface ProducerService {
     Result upload(MultipartFile file, String tempId) throws IOException;
+
+    Result checkStatus(String ids);
 }

+ 16 - 0
720yun_local_manage/gis_pano_producer/src/main/java/com/gis/cms/service/impl/ProduceServiceImpl.java

@@ -3,6 +3,7 @@ package com.gis.cms.service.impl;
 
 import cn.hutool.core.io.FileTypeUtil;
 import cn.hutool.core.io.FileUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.gis.cms.config.RabbitConfig;
 import com.gis.cms.entity.po.FodderEntity;
 import com.gis.cms.mapper.FodderMapper;
@@ -19,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.IOException;
+import java.util.List;
 
 /**
  * Created by owen on 2022/3/23 0023 16:45
@@ -61,6 +63,8 @@ public class ProduceServiceImpl implements ProducerService {
 
         //生成预览图、固定命名
         ImgUtil.compressImg(savePath, "/preview.jpg", 1920, 960);
+        //生成缩略图
+        ImgUtil.compressImg(savePath, "/thumb.jpg", 100, 100);
 
         FodderEntity entity = new FodderEntity();
         entity.setFileName(file.getOriginalFilename());
@@ -71,6 +75,7 @@ public class ProduceServiceImpl implements ProducerService {
         entity.setCreatorId(userId);
         entity.setFilePath(basePath);
         entity.setTempId(tempId);
+        entity.setIcon("/thumb.jpg");
 
 
         fodderMapper.insert(entity);
@@ -86,6 +91,17 @@ public class ProduceServiceImpl implements ProducerService {
         return Result.success(entity);
     }
 
+    @Override
+    public Result checkStatus(String ids) {
+        Long userId = JwtUtil.getUserId(request.getHeader("token"));
+
+        LambdaQueryWrapper<FodderEntity> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(FodderEntity::getCreatorId, userId);
+        wrapper.in(FodderEntity::getId, ids);
+
+        return Result.success(fodderMapper.selectList(wrapper));
+    }
+
     private void checkImgType(MultipartFile file){
         // 次方法可以读取到图片内部结构, 可以检验非全景图
         try {