refactor: metas variable. (#632)

* refactor: metas variable.

* refactor: metas variable.
pull/634/head
Ryan Wang 2020-03-11 13:49:37 +08:00 committed by GitHub
parent 378049ba21
commit a563c493e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 100 additions and 104 deletions

View File

@ -124,9 +124,6 @@ public class PostModel {
model.addAttribute("tags", tagService.convertTo(tags));
model.addAttribute("metas", postMetaService.convertToMap(metas));
// TODO,Will be deprecated
model.addAttribute("comments", Page.empty());
if (themeService.templateExists(
ThemeService.CUSTOM_POST_PREFIX + post.getTemplate() + HaloConst.SUFFIX_FTL)) {
return themeService.render(ThemeService.CUSTOM_POST_PREFIX + post.getTemplate());

View File

@ -1,21 +1,24 @@
package run.halo.app.controller.content.model;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
import run.halo.app.cache.StringCacheStore;
import run.halo.app.exception.ForbiddenException;
import run.halo.app.model.entity.Sheet;
import run.halo.app.model.entity.SheetMeta;
import run.halo.app.model.enums.PostEditorType;
import run.halo.app.model.enums.PostStatus;
import run.halo.app.model.support.HaloConst;
import run.halo.app.model.vo.SheetDetailVO;
import run.halo.app.service.OptionService;
import run.halo.app.service.SheetMetaService;
import run.halo.app.service.SheetService;
import run.halo.app.service.ThemeService;
import run.halo.app.utils.MarkdownUtils;
import java.util.List;
/**
* Sheet model.
*
@ -27,14 +30,21 @@ public class SheetModel {
private final SheetService sheetService;
private final SheetMetaService sheetMetaService;
private final StringCacheStore cacheStore;
private final ThemeService themeService;
private final OptionService optionService;
public SheetModel(SheetService sheetService, StringCacheStore cacheStore, ThemeService themeService, OptionService optionService) {
public SheetModel(SheetService sheetService,
SheetMetaService sheetMetaService,
StringCacheStore cacheStore,
ThemeService themeService,
OptionService optionService) {
this.sheetService = sheetService;
this.sheetMetaService = sheetMetaService;
this.cacheStore = cacheStore;
this.themeService = themeService;
this.optionService = optionService;
@ -70,6 +80,8 @@ public class SheetModel {
SheetDetailVO sheetDetailVO = sheetService.convertToDetailVo(sheet);
List<SheetMeta> metas = sheetMetaService.listBy(sheet.getId());
// Generate meta keywords.
if (StringUtils.isNotEmpty(sheet.getMetaKeywords())) {
model.addAttribute("meta_keywords", sheet.getMetaKeywords());
@ -88,9 +100,7 @@ public class SheetModel {
model.addAttribute("sheet", sheetDetailVO);
model.addAttribute("post", sheetDetailVO);
model.addAttribute("is_sheet", true);
// TODO,Will be deprecated
model.addAttribute("comments", Page.empty());
model.addAttribute("metas", sheetMetaService.convertToMap(metas));
if (themeService.templateExists(ThemeService.CUSTOM_SHEET_PREFIX + sheet.getTemplate() + HaloConst.SUFFIX_FTL)) {
return themeService.render(ThemeService.CUSTOM_SHEET_PREFIX + sheet.getTemplate());

View File

@ -47,8 +47,7 @@ public class PostTagDirective implements TemplateDirectiveModel {
switch (method) {
case "latest":
int top = Integer.parseInt(params.get("top").toString());
List<Post> posts = postService.listLatest(top);
env.setVariable("posts", builder.build().wrap(postService.convertToListVo(posts)));
env.setVariable("posts", builder.build().wrap(postService.convertToListVo(postService.listLatest(top))));
break;
case "count":
env.setVariable("count", builder.build().wrap(postService.countByStatus(PostStatus.PUBLISHED)));
@ -69,7 +68,8 @@ public class PostTagDirective implements TemplateDirectiveModel {
break;
case "listByCategorySlug":
String categorySlug = params.get("categorySlug").toString();
env.setVariable("posts", builder.build().wrap(postService.convertToListVo(postCategoryService.listPostBy(categorySlug, PostStatus.PUBLISHED))));
List<Post> posts = postCategoryService.listPostBy(categorySlug, PostStatus.PUBLISHED);
env.setVariable("posts", builder.build().wrap(postService.convertToListVo(posts)));
break;
case "listByTagId":
Integer tagId = Integer.parseInt(params.get("tagId").toString());

View File

@ -67,7 +67,7 @@ public class PostParam implements InputConverter<Post> {
private Set<Integer> categoryIds;
private Set<PostMetaParam> postMetas;
private Set<PostMetaParam> metas;
@Override
public Post convertTo() {
@ -101,11 +101,11 @@ public class PostParam implements InputConverter<Post> {
public Set<PostMeta> getPostMetas() {
Set<PostMeta> postMetaSet = new HashSet<>();
if (CollectionUtils.isEmpty(postMetas)) {
if (CollectionUtils.isEmpty(metas)) {
return postMetaSet;
}
for (PostMetaParam postMetaParam : postMetas) {
for (PostMetaParam postMetaParam : metas) {
PostMeta postMeta = postMetaParam.convertTo();
postMetaSet.add(postMeta);
}

View File

@ -62,7 +62,7 @@ public class SheetParam implements InputConverter<Sheet> {
private String metaDescription;
private Set<SheetMetaParam> sheetMetas;
private Set<SheetMetaParam> metas;
@Override
public Sheet convertTo() {
@ -96,11 +96,11 @@ public class SheetParam implements InputConverter<Sheet> {
public Set<SheetMeta> getSheetMetas() {
Set<SheetMeta> sheetMetasSet = new HashSet<>();
if (CollectionUtils.isEmpty(sheetMetas)) {
if (CollectionUtils.isEmpty(metas)) {
return sheetMetasSet;
}
for (SheetMetaParam sheetMetaParam : sheetMetas) {
for (SheetMetaParam sheetMetaParam : metas) {
SheetMeta sheetMeta = sheetMetaParam.convertTo();
sheetMetasSet.add(sheetMeta);
}

View File

@ -31,8 +31,8 @@ public class PostDetailVO extends BasePostDetailDTO {
private List<CategoryDTO> categories;
private Set<Long> postMetaIds;
private Set<Long> metaIds;
private List<BaseMetaDTO> postMetas;
private List<BaseMetaDTO> metas;
}

View File

@ -2,12 +2,12 @@ package run.halo.app.model.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import run.halo.app.model.dto.BaseMetaDTO;
import run.halo.app.model.dto.CategoryDTO;
import run.halo.app.model.dto.TagDTO;
import run.halo.app.model.dto.post.BasePostSimpleDTO;
import java.util.List;
import java.util.Map;
/**
* Post list vo.
@ -27,5 +27,5 @@ public class PostListVO extends BasePostSimpleDTO {
private List<CategoryDTO> categories;
private List<BaseMetaDTO> postMetas;
private Map<String, Object> metas;
}

View File

@ -20,7 +20,7 @@ import java.util.Set;
@EqualsAndHashCode(callSuper = true)
public class SheetDetailVO extends BasePostDetailDTO {
private Set<Long> sheetMetaIds;
private Set<Long> metaIds;
private List<BaseMetaDTO> sheetMetas;
private List<BaseMetaDTO> metas;
}

View File

@ -42,15 +42,10 @@ import static run.halo.app.model.support.HaloConst.ONE_TIME_TOKEN_QUERY_NAME;
public abstract class AbstractAuthenticationFilter extends OncePerRequestFilter {
protected final AntPathMatcher antPathMatcher;
private final UrlPathHelper urlPathHelper = new UrlPathHelper();
protected final HaloProperties haloProperties;
protected final OptionService optionService;
protected final StringCacheStore cacheStore;
private final UrlPathHelper urlPathHelper = new UrlPathHelper();
private OneTimeTokenService oneTimeTokenService;
private volatile AuthenticationFailureHandler failureHandler;
@ -128,15 +123,15 @@ public abstract class AbstractAuthenticationFilter extends OncePerRequestFilter
this.excludeUrlPatterns = new HashSet<>(excludeUrlPatterns);
}
public Collection<String> getUrlPatterns() {
return this.urlPatterns;
}
public void setUrlPatterns(Collection<String> urlPatterns) {
Assert.notNull(urlPatterns, "UrlPatterns must not be null");
this.urlPatterns = new LinkedHashSet<>(urlPatterns);
}
public Collection<String> getUrlPatterns() {
return this.urlPatterns;
}
public void addUrlPatterns(String... urlPatterns) {
Assert.notNull(urlPatterns, "UrlPatterns must not be null");
Collections.addAll(this.urlPatterns, urlPatterns);

View File

@ -52,12 +52,12 @@ public interface PostService extends BasePostService<Post> {
* @param post post must not be null
* @param tagIds tag id set
* @param categoryIds category id set
* @param postMetas post metas
* @param metas metas
* @param autoSave autoSave
* @return post created
*/
@NonNull
PostDetailVO createBy(@NonNull Post post, Set<Integer> tagIds, Set<Integer> categoryIds, Set<PostMeta> postMetas, boolean autoSave);
PostDetailVO createBy(@NonNull Post post, Set<Integer> tagIds, Set<Integer> categoryIds, Set<PostMeta> metas, boolean autoSave);
/**
* Creates post by post param.
@ -77,11 +77,12 @@ public interface PostService extends BasePostService<Post> {
* @param postToUpdate post to update must not be null
* @param tagIds tag id set
* @param categoryIds category id set
* @param metas metas
* @param autoSave autoSave
* @return updated post
*/
@NonNull
PostDetailVO updateBy(@NonNull Post postToUpdate, Set<Integer> tagIds, Set<Integer> categoryIds, Set<PostMeta> postMetas, boolean autoSave);
PostDetailVO updateBy(@NonNull Post postToUpdate, Set<Integer> tagIds, Set<Integer> categoryIds, Set<PostMeta> metas, boolean autoSave);
/**
* Gets post by post status and slug.

View File

@ -35,12 +35,12 @@ public interface SheetService extends BasePostService<Sheet> {
/**
* Creates a sheet.
*
* @param sheet sheet must not be null
* @param sheetMetas sheet metas
* @param autoSave autoSave
* @param sheet sheet must not be null
* @param metas sheet metas
* @param autoSave autoSave
* @return created sheet
*/
Sheet createBy(@NonNull Sheet sheet, Set<SheetMeta> sheetMetas, boolean autoSave);
Sheet createBy(@NonNull Sheet sheet, Set<SheetMeta> metas, boolean autoSave);
/**
* Updates a sheet.
@ -55,12 +55,12 @@ public interface SheetService extends BasePostService<Sheet> {
/**
* Updates a sheet.
*
* @param sheet sheet must not be null
* @param sheetMetas sheet metas
* @param autoSave autoSave
* @param sheet sheet must not be null
* @param metas sheet metas
* @param autoSave autoSave
* @return updated sheet
*/
Sheet updateBy(@NonNull Sheet sheet, Set<SheetMeta> sheetMetas, boolean autoSave);
Sheet updateBy(@NonNull Sheet sheet, Set<SheetMeta> metas, boolean autoSave);
/**
* Gets by url

View File

@ -21,11 +21,11 @@ public interface BaseMetaService<META extends BaseMeta> extends CrudService<META
/**
* Creates by post metas and post id.
*
* @param postId post id must not be null
* @param postMetas post metas must not be null
* @param postId post id must not be null
* @param metas metas must not be null
* @return a list of post meta
*/
List<META> createOrUpdateByPostId(@NonNull Integer postId, Set<META> postMetas);
List<META> createOrUpdateByPostId(@NonNull Integer postId, Set<META> metas);
/**
* Remove post metas by post id.

View File

@ -36,24 +36,24 @@ public abstract class BaseMetaServiceImpl<META extends BaseMeta> extends Abstrac
@Override
@Transactional
public List<META> createOrUpdateByPostId(Integer postId, Set<META> postMetas) {
public List<META> createOrUpdateByPostId(Integer postId, Set<META> metas) {
Assert.notNull(postId, "Post id must not be null");
// firstly remove post metas by post id
removeByPostId(postId);
if (CollectionUtils.isEmpty(postMetas)) {
if (CollectionUtils.isEmpty(metas)) {
return Collections.emptyList();
}
// Save post metas
postMetas.forEach(postMeta -> {
metas.forEach(postMeta -> {
if (StringUtils.isNotEmpty(postMeta.getValue()) && StringUtils.isNotEmpty(postMeta.getKey())) {
postMeta.setPostId(postId);
baseMetaRepository.save(postMeta);
}
});
return new ArrayList<>(postMetas);
return new ArrayList<>(metas);
}
@Override
@ -69,18 +69,18 @@ public abstract class BaseMetaServiceImpl<META extends BaseMeta> extends Abstrac
return Collections.emptyMap();
}
// Find all post metas
List<META> postMetas = baseMetaRepository.findAllByPostIdIn(postIds);
// Find all metas
List<META> metas = baseMetaRepository.findAllByPostIdIn(postIds);
// Convert to post meta map
Map<Long, META> postMetaMap = ServiceUtils.convertToMap(postMetas, META::getId);
// Convert to meta map
Map<Long, META> postMetaMap = ServiceUtils.convertToMap(metas, META::getId);
// Create category list map
Map<Integer, List<META>> postMetaListMap = new HashMap<>();
// Foreach and collect
postMetas.forEach(postMeta -> postMetaListMap.computeIfAbsent(postMeta.getPostId(), postId -> new LinkedList<>())
.add(postMetaMap.get(postMeta.getId())));
metas.forEach(meta -> postMetaListMap.computeIfAbsent(meta.getPostId(), postId -> new LinkedList<>())
.add(postMetaMap.get(meta.getId())));
return postMetaListMap;
}

View File

@ -20,7 +20,6 @@ import org.springframework.util.CollectionUtils;
import run.halo.app.event.logger.LogEvent;
import run.halo.app.event.post.PostVisitEvent;
import run.halo.app.exception.NotFoundException;
import run.halo.app.model.dto.BaseMetaDTO;
import run.halo.app.model.dto.post.BasePostMinimalDTO;
import run.halo.app.model.dto.post.BasePostSimpleDTO;
import run.halo.app.model.entity.*;
@ -126,8 +125,8 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
@Override
@Transactional
public PostDetailVO createBy(Post postToCreate, Set<Integer> tagIds, Set<Integer> categoryIds,
Set<PostMeta> postMetas, boolean autoSave) {
PostDetailVO createdPost = createOrUpdate(postToCreate, tagIds, categoryIds, postMetas);
Set<PostMeta> metas, boolean autoSave) {
PostDetailVO createdPost = createOrUpdate(postToCreate, tagIds, categoryIds, metas);
if (!autoSave) {
// Log the creation
LogEvent logEvent = new LogEvent(this, createdPost.getId().toString(),
@ -153,10 +152,10 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
@Override
@Transactional
public PostDetailVO updateBy(Post postToUpdate, Set<Integer> tagIds, Set<Integer> categoryIds,
Set<PostMeta> postMetas, boolean autoSave) {
Set<PostMeta> metas, boolean autoSave) {
// Set edit time
postToUpdate.setEditTime(DateUtils.now());
PostDetailVO updatedPost = createOrUpdate(postToUpdate, tagIds, categoryIds, postMetas);
PostDetailVO updatedPost = createOrUpdate(postToUpdate, tagIds, categoryIds, metas);
if (!autoSave) {
// Log the creation
LogEvent logEvent = new LogEvent(this, updatedPost.getId().toString(),
@ -437,11 +436,11 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
}
}
List<PostMeta> postMetas = postMetaService.listBy(post.getId());
List<PostMeta> metas = postMetaService.listBy(post.getId());
if (postMetas.size() > 0) {
content.append("postMetas:").append("\n");
for (PostMeta postMeta : postMetas) {
if (metas.size() > 0) {
content.append("metas:").append("\n");
for (PostMeta postMeta : metas) {
content.append(" - ").append(postMeta.getKey()).append(" : ")
.append(postMeta.getValue()).append("\n");
}
@ -458,10 +457,10 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
List<Tag> tags = postTagService.listTagsBy(post.getId());
// List categories
List<Category> categories = postCategoryService.listCategoriesBy(post.getId());
// List postMetas
List<PostMeta> postMetas = postMetaService.listBy(post.getId());
// List metas
List<PostMeta> metas = postMetaService.listBy(post.getId());
// Convert to detail vo
return convertTo(post, tags, categories, postMetas);
return convertTo(post, tags, categories, metas);
}
@Override
@ -480,9 +479,9 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
log.debug("Removed post categories: [{}]", postCategories);
// Remove post metas
List<PostMeta> postMetas = postMetaService.removeByPostId(postId);
log.debug("Removed post metas: [{}]", postMetas);
// Remove metas
List<PostMeta> metas = postMetaService.removeByPostId(postId);
log.debug("Removed post metas: [{}]", metas);
// Remove post comments
List<PostComment> postComments = postCommentService.removeByPostId(postId);
@ -544,12 +543,9 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
.collect(Collectors.toList()));
// Set post metas
postListVO.setPostMetas(Optional.ofNullable(postMetaListMap.get(post.getId()))
.orElseGet(LinkedList::new)
.stream()
.filter(Objects::nonNull)
.map(postMeta -> (BaseMetaDTO) new BaseMetaDTO().convertFrom(postMeta))
.collect(Collectors.toList()));
List<PostMeta> metas = Optional.ofNullable(postMetaListMap.get(post.getId()))
.orElseGet(LinkedList::new);
postListVO.setMetas(postMetaService.convertToMap(metas));
// Set comment count
postListVO.setCommentCount(commentCountMap.getOrDefault(post.getId(), 0L));
@ -605,12 +601,9 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
.collect(Collectors.toList()));
// Set post metas
postListVO.setPostMetas(Optional.ofNullable(postMetaListMap.get(post.getId()))
.orElseGet(LinkedList::new)
.stream()
.filter(Objects::nonNull)
.map(postMeta -> (BaseMetaDTO) new BaseMetaDTO().convertFrom(postMeta))
.collect(Collectors.toList()));
List<PostMeta> metas = Optional.ofNullable(postMetaListMap.get(post.getId()))
.orElseGet(LinkedList::new);
postListVO.setMetas(postMetaService.convertToMap(metas));
// Set comment count
postListVO.setCommentCount(commentCountMap.getOrDefault(post.getId(), 0L));
@ -670,7 +663,7 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
* @param post post must not be null
* @param tags tags
* @param categories categories
* @param postMetaList postMetas
* @param postMetaList postMetaList
* @return post detail vo
*/
@NonNull
@ -688,7 +681,7 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
// Extract ids
Set<Integer> tagIds = ServiceUtils.fetchProperty(tags, Tag::getId);
Set<Integer> categoryIds = ServiceUtils.fetchProperty(categories, Category::getId);
Set<Long> postMetaIds = ServiceUtils.fetchProperty(postMetaList, PostMeta::getId);
Set<Long> metaIds = ServiceUtils.fetchProperty(postMetaList, PostMeta::getId);
// Get post tag ids
postDetailVO.setTagIds(tagIds);
@ -699,8 +692,8 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
postDetailVO.setCategories(categoryService.convertTo(categories));
// Get post meta ids
postDetailVO.setPostMetaIds(postMetaIds);
postDetailVO.setPostMetas(postMetaService.convertTo(postMetaList));
postDetailVO.setMetaIds(metaIds);
postDetailVO.setMetas(postMetaService.convertTo(postMetaList));
postDetailVO.setCommentCount(postCommentService.countByPostId(post.getId()));
@ -755,7 +748,7 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
}
private PostDetailVO createOrUpdate(@NonNull Post post, Set<Integer> tagIds,
Set<Integer> categoryIds, Set<PostMeta> postMetas) {
Set<Integer> categoryIds, Set<PostMeta> metas) {
Assert.notNull(post, "Post param must not be null");
// Create or update post
@ -786,8 +779,8 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
// Create post meta data
List<PostMeta> postMetaList = postMetaService
.createOrUpdateByPostId(post.getId(), postMetas);
log.debug("Created post postMetas: [{}]", postMetaList);
.createOrUpdateByPostId(post.getId(), metas);
log.debug("Created post metas: [{}]", postMetaList);
// Convert to post detail vo
return convertTo(post, tags, categories, postMetaList);

View File

@ -82,11 +82,11 @@ public class SheetServiceImpl extends BasePostServiceImpl<Sheet> implements Shee
}
@Override
public Sheet createBy(Sheet sheet, Set<SheetMeta> sheetMetas, boolean autoSave) {
public Sheet createBy(Sheet sheet, Set<SheetMeta> metas, boolean autoSave) {
Sheet createdSheet = createOrUpdateBy(sheet);
// Create sheet meta data
List<SheetMeta> sheetMetaList = sheetMetaService.createOrUpdateByPostId(sheet.getId(), sheetMetas);
List<SheetMeta> sheetMetaList = sheetMetaService.createOrUpdateByPostId(sheet.getId(), metas);
log.debug("Created sheet metas: [{}]", sheetMetaList);
if (!autoSave) {
@ -109,11 +109,11 @@ public class SheetServiceImpl extends BasePostServiceImpl<Sheet> implements Shee
}
@Override
public Sheet updateBy(Sheet sheet, Set<SheetMeta> sheetMetas, boolean autoSave) {
public Sheet updateBy(Sheet sheet, Set<SheetMeta> metas, boolean autoSave) {
Sheet updatedSheet = createOrUpdateBy(sheet);
// Create sheet meta data
List<SheetMeta> sheetMetaList = sheetMetaService.createOrUpdateByPostId(updatedSheet.getId(), sheetMetas);
List<SheetMeta> sheetMetaList = sheetMetaService.createOrUpdateByPostId(updatedSheet.getId(), metas);
log.debug("Created sheet metas: [{}]", sheetMetaList);
if (!autoSave) {
@ -220,8 +220,8 @@ public class SheetServiceImpl extends BasePostServiceImpl<Sheet> implements Shee
public Sheet removeById(Integer id) {
// Remove sheet metas
List<SheetMeta> sheetMetas = sheetMetaService.removeByPostId(id);
log.debug("Removed sheet metas: [{}]", sheetMetas);
List<SheetMeta> metas = sheetMetaService.removeByPostId(id);
log.debug("Removed sheet metas: [{}]", metas);
// Remove sheet comments
List<SheetComment> sheetComments = sheetCommentService.removeByPostId(id);
@ -264,10 +264,10 @@ public class SheetServiceImpl extends BasePostServiceImpl<Sheet> implements Shee
@Override
public SheetDetailVO convertToDetailVo(Sheet sheet) {
// List sheetMetas
List<SheetMeta> sheetMetas = sheetMetaService.listBy(sheet.getId());
// List metas
List<SheetMeta> metas = sheetMetaService.listBy(sheet.getId());
// Convert to detail vo
return convertTo(sheet, sheetMetas);
return convertTo(sheet, metas);
}
@Override
@ -292,17 +292,17 @@ public class SheetServiceImpl extends BasePostServiceImpl<Sheet> implements Shee
}
@NonNull
private SheetDetailVO convertTo(@NonNull Sheet sheet, List<SheetMeta> sheetMetas) {
private SheetDetailVO convertTo(@NonNull Sheet sheet, List<SheetMeta> metas) {
Assert.notNull(sheet, "Sheet must not be null");
// Convert to base detail vo
SheetDetailVO sheetDetailVO = new SheetDetailVO().convertFrom(sheet);
Set<Long> sheetMetaIds = ServiceUtils.fetchProperty(sheetMetas, SheetMeta::getId);
Set<Long> metaIds = ServiceUtils.fetchProperty(metas, SheetMeta::getId);
// Get sheet meta ids
sheetDetailVO.setSheetMetaIds(sheetMetaIds);
sheetDetailVO.setSheetMetas(sheetMetaService.convertTo(sheetMetas));
sheetDetailVO.setMetaIds(metaIds);
sheetDetailVO.setMetas(sheetMetaService.convertTo(metas));
if (StringUtils.isBlank(sheetDetailVO.getSummary())) {
sheetDetailVO.setSummary(generateSummary(sheet.getFormatContent()));