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

文件上传 图片宽高

parent 618b0d9d
package com.tanpu.community.api;
import org.springframework.beans.factory.annotation.Value;
/**
* monitor系统常量
*/
......@@ -8,7 +10,14 @@ public final class CommunityConstant {
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/";
}
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.constant.BizStatus;
import com.tanpu.common.exception.BizException;
import com.tanpu.common.util.AliyunOSSHelper;
......@@ -119,6 +120,7 @@ public class OSSFileService {
}
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 {
} else if (themeContent.getType().equals(RelTypeEnum.SINGLE_IMG.type)) {
if (imgUrlMap.containsKey(themeContent.getValue())) {
FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue());
themeContent.setValue(imgEntity.getUrl());
String extInfo = imgEntity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)){
Map<String, Object> extMap = JsonUtil.toMap(extInfo);
ImagesDTO imagesDTO = ImagesDTO.builder().imgHeight((Integer) extMap.get("height"))
.imgWidth((Integer) extMap.get("width"))
.remark(imgEntity.getUrl())
.relId(imgEntity.getFileId())
.build();
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