增加下载数,页面跳转、展示优化
This commit is contained in:
@@ -13,6 +13,7 @@ import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageFile;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiSpace;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageFileMapper;
|
||||
import com.zyplayer.doc.data.service.manage.UserInfoService;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageFileService;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageService;
|
||||
@@ -59,6 +60,8 @@ public class WikiCommonController {
|
||||
WikiSpaceService wikiSpaceService;
|
||||
@Resource
|
||||
UserInfoService userInfoService;
|
||||
@Resource
|
||||
WikiPageFileMapper wikiPageFileMapper;
|
||||
|
||||
@PostMapping("/user/base")
|
||||
public ResponseJson<Object> userBaseInfo(String search) {
|
||||
@@ -153,6 +156,8 @@ public class WikiCommonController {
|
||||
return DocResponseJson.warn("登陆后才可访问此文件");
|
||||
}
|
||||
}
|
||||
// 增加下载次数
|
||||
wikiPageFileMapper.addDownloadNum(pageFile.getId());
|
||||
try {
|
||||
String fileName = Optional.ofNullable(pageFile.getFileName()).orElse("");
|
||||
File file = new File(pageFile.getFileUrl());
|
||||
|
||||
@@ -79,8 +79,10 @@ public class WikiOpenApiController {
|
||||
}
|
||||
Map<Long, List<WikiPageVo>> listMap = wikiPageList.stream().map(val -> mapper.map(val, WikiPageVo.class)).collect(Collectors.groupingBy(WikiPageVo::getParentId));
|
||||
List<WikiPageVo> nodePageList = listMap.get(0L);
|
||||
nodePageList = nodePageList.stream().sorted(Comparator.comparingInt(WikiPage::getSeqNo)).collect(Collectors.toList());
|
||||
this.setChildren(listMap, nodePageList);
|
||||
if (CollectionUtils.isNotEmpty(nodePageList)) {
|
||||
nodePageList = nodePageList.stream().sorted(Comparator.comparingInt(WikiPage::getSeqNo)).collect(Collectors.toList());
|
||||
this.setChildren(listMap, nodePageList);
|
||||
}
|
||||
return DocResponseJson.ok(nodePageList);
|
||||
}
|
||||
|
||||
@@ -129,7 +131,7 @@ public class WikiOpenApiController {
|
||||
}
|
||||
for (WikiPageVo page : nodePageList) {
|
||||
List<WikiPageVo> wikiPageVos = listMap.get(page.getId());
|
||||
if (wikiPageVos != null && wikiPageVos.size() > 0) {
|
||||
if (CollectionUtils.isNotEmpty(wikiPageVos)) {
|
||||
wikiPageVos = wikiPageVos.stream().sorted(Comparator.comparingInt(WikiPage::getSeqNo)).collect(Collectors.toList());
|
||||
page.setChildren(wikiPageVos);
|
||||
this.setChildren(listMap, wikiPageVos);
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.zyplayer.doc.wiki.controller.vo.WikiPageContentVo;
|
||||
import com.zyplayer.doc.wiki.controller.vo.WikiPageVo;
|
||||
import com.zyplayer.doc.wiki.framework.consts.SpaceType;
|
||||
import com.zyplayer.doc.wiki.framework.consts.WikiAuthType;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dozer.Mapper;
|
||||
import org.slf4j.Logger;
|
||||
@@ -74,11 +75,15 @@ public class WikiPageController {
|
||||
List<WikiPageVo> nodePageList;
|
||||
if (wikiPage.getParentId() == null) {
|
||||
nodePageList = listMap.get(0L);
|
||||
nodePageList = nodePageList.stream().sorted(Comparator.comparingInt(WikiPage::getSeqNo)).collect(Collectors.toList());
|
||||
this.setChildren(listMap, nodePageList, "");
|
||||
if (CollectionUtils.isNotEmpty(nodePageList)) {
|
||||
nodePageList = nodePageList.stream().sorted(Comparator.comparingInt(WikiPage::getSeqNo)).collect(Collectors.toList());
|
||||
this.setChildren(listMap, nodePageList, "");
|
||||
}
|
||||
} else {
|
||||
nodePageList = listMap.get(wikiPage.getParentId());
|
||||
nodePageList = nodePageList.stream().sorted(Comparator.comparingInt(WikiPage::getSeqNo)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(nodePageList)) {
|
||||
nodePageList = nodePageList.stream().sorted(Comparator.comparingInt(WikiPage::getSeqNo)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return DocResponseJson.ok(nodePageList);
|
||||
}
|
||||
@@ -234,6 +239,7 @@ public class WikiPageController {
|
||||
lastSeq = Optional.ofNullable(lastSeq).orElse(0);
|
||||
wikiPage.setSeqNo(lastSeq + 1);
|
||||
wikiPage.setCreateTime(new Date());
|
||||
wikiPage.setUpdateTime(new Date());
|
||||
wikiPage.setCreateUserId(currentUser.getUserId());
|
||||
wikiPage.setCreateUserName(currentUser.getUsername());
|
||||
wikiPageService.save(wikiPage);
|
||||
@@ -305,7 +311,7 @@ public class WikiPageController {
|
||||
String nowPath = path + "/" + page.getName();
|
||||
page.setPath(nowPath);
|
||||
List<WikiPageVo> wikiPageVos = listMap.get(page.getId());
|
||||
if (wikiPageVos != null && wikiPageVos.size() > 0) {
|
||||
if (CollectionUtils.isNotEmpty(wikiPageVos)) {
|
||||
wikiPageVos = wikiPageVos.stream().sorted(Comparator.comparingInt(WikiPage::getSeqNo)).collect(Collectors.toList());
|
||||
page.setChildren(wikiPageVos);
|
||||
this.setChildren(listMap, wikiPageVos, nowPath);
|
||||
|
||||
Reference in New Issue
Block a user