Commit 6aaedfd4 authored by 刘基明's avatar 刘基明

文件上传 图片宽高

parent 618b0d9d
package com.tanpu.community.api; package com.tanpu.community.api;
import org.springframework.beans.factory.annotation.Value;
/** /**
* monitor系统常量 * monitor系统常量
*/ */
...@@ -8,7 +10,14 @@ public final class CommunityConstant { ...@@ -8,7 +10,14 @@ public final class CommunityConstant {
public static final String PACKAGE_BASE = "com.tanpu.community"; public static final String PACKAGE_BASE = "com.tanpu.community";
public static final String OSS_PREFIX_URL ="https://tamp-sit.oss-cn-shanghai.aliyuncs.com"; public static final String OSS_PREFIX_URL ="https://tamp-sit.oss-cn-shanghai.aliyuncs.com/";
@Value("${aliyun.oss.bucketName}")
public String OSS_BUCKET_NAME;
@Value("${aliyun.oss.endpoint}")
public String OSS_END_POINT;
public static final String OSS_PREFIX_FOLDER ="community/"; public static final String OSS_PREFIX_FOLDER ="community/";
} }
package com.tanpu.community.service; package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.constant.BizStatus; import com.tanpu.common.constant.BizStatus;
import com.tanpu.common.exception.BizException; import com.tanpu.common.exception.BizException;
import com.tanpu.common.util.AliyunOSSHelper; import com.tanpu.common.util.AliyunOSSHelper;
...@@ -119,6 +120,7 @@ public class OSSFileService { ...@@ -119,6 +120,7 @@ public class OSSFileService {
} }
public List<FileRecordEntity> queryByIds(List<String> fileIds) { public List<FileRecordEntity> queryByIds(List<String> fileIds) {
return fileRecordMapper.selectBatchIds(fileIds); return fileRecordMapper.selectList(new LambdaQueryWrapper<FileRecordEntity>()
.in(FileRecordEntity::getFileId,fileIds));
} }
} }
...@@ -384,12 +384,13 @@ public class ProductService { ...@@ -384,12 +384,13 @@ public class ProductService {
} else if (themeContent.getType().equals(RelTypeEnum.SINGLE_IMG.type)) { } else if (themeContent.getType().equals(RelTypeEnum.SINGLE_IMG.type)) {
if (imgUrlMap.containsKey(themeContent.getValue())) { if (imgUrlMap.containsKey(themeContent.getValue())) {
FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue()); FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue());
themeContent.setValue(imgEntity.getUrl());
String extInfo = imgEntity.getExtInfo(); String extInfo = imgEntity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)){ if (!StringUtils.isEmpty(extInfo)){
Map<String, Object> extMap = JsonUtil.toMap(extInfo); Map<String, Object> extMap = JsonUtil.toMap(extInfo);
ImagesDTO imagesDTO = ImagesDTO.builder().imgHeight((Integer) extMap.get("height")) ImagesDTO imagesDTO = ImagesDTO.builder().imgHeight((Integer) extMap.get("height"))
.imgWidth((Integer) extMap.get("width")) .imgWidth((Integer) extMap.get("width"))
.remark(imgEntity.getUrl())
.relId(imgEntity.getFileId())
.build(); .build();
themeContent.setImgList(Collections.singletonList(imagesDTO)); themeContent.setImgList(Collections.singletonList(imagesDTO));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment