| | |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleAuditDTO; |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleDTO; |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleQuery; |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleUpdDTO; |
| | | import com.ruoyi.article.controller.management.vo.MgtArticleVO; |
| | | import com.ruoyi.article.domain.Article; |
| | | import com.ruoyi.article.domain.ArticleComments; |
| | |
| | | import com.ruoyi.common.core.enums.ArticleTypeEnum; |
| | | import com.ruoyi.common.core.enums.AuditStatusEnum; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.enums.ListingStatusEnum; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | |
| | | // 构建查询条件 |
| | | Set<Long> sysUserIdSet = null; |
| | | Set<Long> memberIdSet = null; |
| | | Page<Article> page = new Page<>(query.getPageCurr(), query.getPageSize()); |
| | | if (StringUtils.isNotBlank(query.getCreateBy()) || StringUtils.isNotBlank( |
| | | query.getPhone())) { |
| | | SysUser user = new SysUser(); |
| | |
| | | SecurityConstants.INNER).getData(); |
| | | memberIdSet = memberlist.stream().map(Member::getId) |
| | | .collect(Collectors.toSet()); |
| | | if (StringUtils.isEmpty(sysUserIdSet) && StringUtils.isEmpty(memberIdSet)) { |
| | | return PageDTO.empty(page); |
| | | } |
| | | } |
| | | // 分页查询 |
| | | Page<Article> page = this.lambdaQuery() |
| | | page = this.lambdaQuery() |
| | | .in(StringUtils.isNotEmpty(sysUserIdSet), Article::getCreateBy, |
| | | sysUserIdSet) |
| | | .in(StringUtils.isNotEmpty(memberIdSet), Article::getMemberId, memberIdSet) |
| | | .eq(StringUtils.isNotNull(query.getListingStatus()), Article::getListingStatus, |
| | | query.getListingStatus()) |
| | | .like(StringUtils.isNotBlank(query.getTitle()), Article::getTitle, query.getTitle()) |
| | | .orderByDesc(Article::getStatus) |
| | | .orderByDesc(Article::getReported) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | |
| | | // 若为空直接返回 |
| | | if (StringUtils.isNotEmpty(page.getRecords())) { |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page); |
| | | } |
| | | /*根据资讯的发布类型分别从系统用户表和会员表中查询发布人信息并封装VO*/ |
| | |
| | | Collectors.toSet()); |
| | | if (StringUtils.isNotEmpty(memIds)) { |
| | | List<Member> memberList = memberClient.getMemberListByIds(memIds, |
| | | SecurityConstants.INNER) |
| | | .getData(); |
| | | SecurityConstants.INNER).getData(); |
| | | memberMap = memberList.stream().collect( |
| | | Collectors.toMap(Member::getId, Function.identity())); |
| | | } else { |
| | |
| | | Article article = BeanUtils.copyBean(dto, Article.class); |
| | | if (StringUtils.isNull(article.getId())) { |
| | | article.setStatus(AuditStatusEnum.PASSED); |
| | | article.setArticleType(ArticleTypeEnum.PLATFORM_RELEASE); |
| | | this.save(article); |
| | | } else { |
| | | Article articleById = this.getById(article.getId()); |
| | |
| | | throw new ServiceException("资讯不存在"); |
| | | } |
| | | article.setStatus(dto.getStatus()); |
| | | if (AuditStatusEnum.REJECTED.equals(dto.getStatus())) { |
| | | article.setRefuseComment(dto.getRefuseComment()); |
| | | } |
| | | this.updateById(article); |
| | | } |
| | | |
| | | /** |
| | | * 上架/下架 |
| | | * |
| | | * @param dto 资讯上下架数据传输对象 |
| | | */ |
| | | @Override |
| | | public void updStatus(MgtArticleUpdDTO dto) { |
| | | this.lambdaUpdate().set(Article::getListingStatus, dto.getListingStatus()) |
| | | .eq(Article::getId, dto.getId()).update(); |
| | | } |
| | | } |