|
@@ -218,30 +218,32 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
BeanUtils.copyProperties(mapContent, mapContentVo);
|
|
|
if (mapContent.getKnowledgeId() != null) {
|
|
|
Knowledge knowledge = knowledgeService.get(mapContent.getKnowledgeId());
|
|
|
- String photo = (String) userService.querySexAndPhoto(knowledge.getCreateBy()).get("photo");
|
|
|
- mapContentVo.setAuthorHead(photo);
|
|
|
- mapContentVo.setTitles(knowledge.getTitles());
|
|
|
- mapContentVo.setSummary(knowledge.getSummary());
|
|
|
- mapContentVo.setAuthor(knowledge.getAuthor());
|
|
|
- mapContentVo.setCreateTime(knowledge.getCreateTime());
|
|
|
- mapContentVo.setViews(knowledge.getViews());
|
|
|
- // 有文件,截取文件名后缀
|
|
|
- String attachmentName = knowledge.getAttachmentName();
|
|
|
- if (attachmentName != null){
|
|
|
- String[] strArray = attachmentName.split("\\.");
|
|
|
- int suffixIndex = strArray.length - 1;
|
|
|
- mapContentVo.setAttachmentType(strArray[suffixIndex]);
|
|
|
- }
|
|
|
- //添加分类信息
|
|
|
- KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(knowledge.getCategoryId());
|
|
|
- String name3 = knowledgeCategoryAdminVo.getName();
|
|
|
- mapContentVo.setCategory(name3);
|
|
|
- if (knowledgeCategoryAdminVo.getParents() != null){
|
|
|
- String name2 = knowledgeCategoryAdminVo.getParents().getName();
|
|
|
- mapContentVo.setCategory(name2 + " " + name3);
|
|
|
- if (knowledgeCategoryAdminVo.getParents().getParents() != null){
|
|
|
- String name1 = knowledgeCategoryAdminVo.getParents().getParents().getName();
|
|
|
- mapContentVo.setCategory(name1 + " " +name2 + " " + name3);
|
|
|
+ if (knowledge != null) {
|
|
|
+ String photo = (String) userService.querySexAndPhoto(knowledge.getCreateBy()).get("photo");
|
|
|
+ mapContentVo.setAuthorHead(photo);
|
|
|
+ mapContentVo.setTitles(knowledge.getTitles());
|
|
|
+ mapContentVo.setSummary(knowledge.getSummary());
|
|
|
+ mapContentVo.setAuthor(knowledge.getAuthor());
|
|
|
+ mapContentVo.setCreateTime(knowledge.getCreateTime());
|
|
|
+ mapContentVo.setViews(knowledge.getViews());
|
|
|
+ // 有文件,截取文件名后缀
|
|
|
+ String attachmentName = knowledge.getAttachmentName();
|
|
|
+ if (attachmentName != null){
|
|
|
+ String[] strArray = attachmentName.split("\\.");
|
|
|
+ int suffixIndex = strArray.length - 1;
|
|
|
+ mapContentVo.setAttachmentType(strArray[suffixIndex]);
|
|
|
+ }
|
|
|
+ //添加分类信息
|
|
|
+ KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(knowledge.getCategoryId());
|
|
|
+ String name3 = knowledgeCategoryAdminVo.getName();
|
|
|
+ mapContentVo.setCategory(name3);
|
|
|
+ if (knowledgeCategoryAdminVo.getParents() != null){
|
|
|
+ String name2 = knowledgeCategoryAdminVo.getParents().getName();
|
|
|
+ mapContentVo.setCategory(name2 + " " + name3);
|
|
|
+ if (knowledgeCategoryAdminVo.getParents().getParents() != null){
|
|
|
+ String name1 = knowledgeCategoryAdminVo.getParents().getParents().getName();
|
|
|
+ mapContentVo.setCategory(name1 + " " +name2 + " " + name3);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -372,30 +374,32 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
//查看知识
|
|
|
if (content.getKnowledgeId() != null) {
|
|
|
Knowledge knowledge = knowledgeService.get(content.getKnowledgeId());
|
|
|
- String photo = (String) userService.querySexAndPhoto(knowledge.getCreateBy()).get("photo");
|
|
|
- content.setAuthorHead(photo);
|
|
|
- content.setTitles(knowledge.getTitles());
|
|
|
- content.setSummary(knowledge.getSummary());
|
|
|
- content.setAuthor(knowledge.getAuthor());
|
|
|
- content.setCreateTime(knowledge.getCreateTime());
|
|
|
- content.setViews(knowledge.getViews());
|
|
|
- // 有文件,截取文件名后缀
|
|
|
- String attachmentName = knowledge.getAttachmentName();
|
|
|
- if (attachmentName != null){
|
|
|
- String[] strArray = attachmentName.split("\\.");
|
|
|
- int suffixIndex = strArray.length - 1;
|
|
|
- content.setAttachmentType(strArray[suffixIndex]);
|
|
|
- }
|
|
|
- //添加分类信息
|
|
|
- KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(knowledge.getCategoryId());
|
|
|
- String name3 = knowledgeCategoryAdminVo.getName();
|
|
|
- content.setCategory(name3);
|
|
|
- if (knowledgeCategoryAdminVo.getParents() != null){
|
|
|
- String name2 = knowledgeCategoryAdminVo.getParents().getName();
|
|
|
- content.setCategory(name2 + " " + name3);
|
|
|
- if (knowledgeCategoryAdminVo.getParents().getParents() != null){
|
|
|
- String name1 = knowledgeCategoryAdminVo.getParents().getParents().getName();
|
|
|
- content.setCategory(name1 + " " +name2 + " " + name3);
|
|
|
+ if (knowledge != null) {
|
|
|
+ String photo = (String) userService.querySexAndPhoto(knowledge.getCreateBy()).get("photo");
|
|
|
+ content.setAuthorHead(photo);
|
|
|
+ content.setTitles(knowledge.getTitles());
|
|
|
+ content.setSummary(knowledge.getSummary());
|
|
|
+ content.setAuthor(knowledge.getAuthor());
|
|
|
+ content.setCreateTime(knowledge.getCreateTime());
|
|
|
+ content.setViews(knowledge.getViews());
|
|
|
+ // 有文件,截取文件名后缀
|
|
|
+ String attachmentName = knowledge.getAttachmentName();
|
|
|
+ if (attachmentName != null){
|
|
|
+ String[] strArray = attachmentName.split("\\.");
|
|
|
+ int suffixIndex = strArray.length - 1;
|
|
|
+ content.setAttachmentType(strArray[suffixIndex]);
|
|
|
+ }
|
|
|
+ //添加分类信息
|
|
|
+ KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(knowledge.getCategoryId());
|
|
|
+ String name3 = knowledgeCategoryAdminVo.getName();
|
|
|
+ content.setCategory(name3);
|
|
|
+ if (knowledgeCategoryAdminVo.getParents() != null){
|
|
|
+ String name2 = knowledgeCategoryAdminVo.getParents().getName();
|
|
|
+ content.setCategory(name2 + " " + name3);
|
|
|
+ if (knowledgeCategoryAdminVo.getParents().getParents() != null){
|
|
|
+ String name1 = knowledgeCategoryAdminVo.getParents().getParents().getName();
|
|
|
+ content.setCategory(name1 + " " +name2 + " " + name3);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|