|
@@ -17,6 +17,7 @@ import com.zbkj.common.constants.Constants;
|
|
|
import com.zbkj.common.constants.UserConstants;
|
|
|
import com.zbkj.common.dto.CommunityNotePageDateDto;
|
|
|
import com.zbkj.common.exception.CrmebException;
|
|
|
+import com.zbkj.common.model.community.CommunityCategory;
|
|
|
import com.zbkj.common.model.community.CommunityNotes;
|
|
|
import com.zbkj.common.model.community.CommunityNotesProduct;
|
|
|
import com.zbkj.common.model.user.User;
|
|
@@ -329,7 +330,7 @@ public class CommunityNotesServiceImpl extends ServiceImpl<CommunityNotesDao, Co
|
|
|
Page<CommunityNotes> page = PageHelper.startPage(request.getPage(), request.getLimit());
|
|
|
LambdaQueryWrapper<CommunityNotes> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.select(CommunityNotes::getId, CommunityNotes::getTitle, CommunityNotes::getCover, CommunityNotes::getUid,
|
|
|
- CommunityNotes::getType, CommunityNotes::getLikeNum, CommunityNotes::getAuditStatus);
|
|
|
+ CommunityNotes::getType, CommunityNotes::getLikeNum, CommunityNotes::getAuditStatus,CommunityNotes::getCategoryId,CommunityNotes::getContent,CommunityNotes::getCreateTime);
|
|
|
if (ObjectUtil.isNotNull(request.getCategoryId())) {
|
|
|
lqw.eq(CommunityNotes::getCategoryId, request.getCategoryId());
|
|
|
}
|
|
@@ -346,6 +347,17 @@ public class CommunityNotesServiceImpl extends ServiceImpl<CommunityNotesDao, Co
|
|
|
if (ObjectUtil.isNotNull(request.getTopicId())) {
|
|
|
lqw.apply("FIND_IN_SET({0}, topic_ids)", request.getTopicId());
|
|
|
}
|
|
|
+ if (ObjectUtil.isNotNull(request.getSecondType())) {
|
|
|
+ if(request.getSecondType()==1){// 有评论
|
|
|
+ lqw.lt(CommunityNotes::getReplyNum,0);
|
|
|
+ }
|
|
|
+ if(request.getSecondType()==2){// 有点赞
|
|
|
+ lqw.lt(CommunityNotes::getLikeNum,0);
|
|
|
+ }
|
|
|
+ if(request.getSecondType()==3){// 有图
|
|
|
+ lqw.isNotNull(CommunityNotes::getImage).or().isNotNull(CommunityNotes::getVideo);
|
|
|
+ }
|
|
|
+ }
|
|
|
switch (request.getCollation()) {
|
|
|
case "star":
|
|
|
lqw.orderByDesc(CommunityNotes::getStar, CommunityNotes::getId);
|
|
@@ -356,8 +368,13 @@ public class CommunityNotesServiceImpl extends ServiceImpl<CommunityNotesDao, Co
|
|
|
default:
|
|
|
lqw.orderByDesc(CommunityNotes::getId);
|
|
|
}
|
|
|
-
|
|
|
List<CommunityNotes> list = dao.selectList(lqw);
|
|
|
+ list.stream().forEach(communityNote->{
|
|
|
+ CommunityCategory communityCategory= categoryService.getById(communityNote.getCategoryId());
|
|
|
+ if(ObjectUtil.isNotNull(communityCategory)) {
|
|
|
+ communityNote.setIcon(communityCategory.getIcon());
|
|
|
+ }
|
|
|
+ });
|
|
|
return CommonPage.copyPageInfo(page, list);
|
|
|
}
|
|
|
|
|
@@ -369,12 +386,15 @@ public class CommunityNotesServiceImpl extends ServiceImpl<CommunityNotesDao, Co
|
|
|
@Override
|
|
|
public PageInfo<CommunityNotes> findDiscoverNoteList(CommunityNoteFrontDiscoverRequest request) {
|
|
|
CommunityNoteFrontSearchRequest searchRequest = new CommunityNoteFrontSearchRequest();
|
|
|
- if (ObjectUtil.isNotNull(request.getCategoryId())) {
|
|
|
+ if (ObjectUtil.isNotNull(request.getCategoryId())&& request.getCategoryId()>0) {
|
|
|
searchRequest.setCategoryId(request.getCategoryId());
|
|
|
}
|
|
|
if (StrUtil.isNotBlank(request.getTitle())) {
|
|
|
searchRequest.setTitle(URLUtil.decode(request.getTitle()));
|
|
|
}
|
|
|
+ if(ObjectUtil.isNotNull(request.getSecondType())){
|
|
|
+ searchRequest.setSecondType(request.getSecondType());
|
|
|
+ }
|
|
|
searchRequest.setAuditStatus(CommunityConstants.COMMUNITY_NOTE_AUDIT_SUCCESS);
|
|
|
searchRequest.setCollation("star");
|
|
|
searchRequest.setPage(request.getPage());
|
|
@@ -725,11 +745,15 @@ public class CommunityNotesServiceImpl extends ServiceImpl<CommunityNotesDao, Co
|
|
|
public Map<Integer, CommunityNotes> getMapByIdList(List<Integer> noteIdList) {
|
|
|
LambdaQueryWrapper<CommunityNotes> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.select(CommunityNotes::getId, CommunityNotes::getTitle, CommunityNotes::getCover, CommunityNotes::getUid,
|
|
|
- CommunityNotes::getType, CommunityNotes::getLikeNum);
|
|
|
+ CommunityNotes::getType, CommunityNotes::getLikeNum, CommunityNotes::getContent, CommunityNotes::getCreateTime, CommunityNotes::getCategoryId);
|
|
|
lqw.in(CommunityNotes::getId, noteIdList);
|
|
|
List<CommunityNotes> list = dao.selectList(lqw);
|
|
|
Map<Integer, CommunityNotes> map = new HashMap<>();
|
|
|
list.forEach(e -> {
|
|
|
+ CommunityCategory communityCategory= categoryService.getById(e.getCategoryId());
|
|
|
+ if(ObjectUtil.isNotNull(communityCategory)) {
|
|
|
+ e.setIcon(communityCategory.getIcon());
|
|
|
+ }
|
|
|
map.put(e.getId(), e);
|
|
|
});
|
|
|
return map;
|