Browse Source

1.修复获取个人二维码信息失效问题

fangzhen 2 ngày trước cách đây
mục cha
commit
3a5d0244e2
28 tập tin đã thay đổi với 4 bổ sung3757 xóa
  1. 4 5
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
  2. 0 199
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityAccompanyImpl.java
  3. 0 13
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleAtServiceImpl.java
  4. 0 10
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleClassImpl.java
  5. 0 11
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleCollectServiceImpl.java
  6. 0 33
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleCommentServiceImpl.java
  7. 0 11
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleRecommendServiceImpl.java
  8. 0 1773
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleServiceImpl.java
  9. 0 10
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleTagImpl.java
  10. 0 16
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionArticleImpl.java
  11. 0 308
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionServiceImpl.java
  12. 0 69
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionUserImpl.java
  13. 0 11
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCommentLikeServiceImpl.java
  14. 0 11
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCommentReplyServiceImpl.java
  15. 0 116
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityFeedbackUserServiceImpl.java
  16. 0 13
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityLikeServiceImpl.java
  17. 0 118
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityNotificationServiceImpl.java
  18. 0 153
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityPrivacyServiceImpl.java
  19. 0 11
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityReportDataServiceImpl.java
  20. 0 11
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityReportServiceImpl.java
  21. 0 83
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityReportUserServiceImpl.java
  22. 0 48
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityReturnRecordServiceImpl.java
  23. 0 51
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityTagServiceImpl.java
  24. 0 51
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityUserBlockServiceImpl.java
  25. 0 11
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityUserLikeServiceImpl.java
  26. 0 12
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityUserProtocolServiceImpl.java
  27. 0 68
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java
  28. 0 531
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java

+ 4 - 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java

@@ -453,12 +453,11 @@ public class CommonController {
             MultipartFile multipartFile = FileUtils.convertFileToMultipartFile(file);
 
             // 3. 使用 RuoYi 的文件上传工具进行上传
-            String uploadPath = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), multipartFile);
-
+//            String uploadPath = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), multipartFile);
+            String uploadPath = OssUtils.uploadMultipartFile(multipartFile);
             // 4. 拼接访问 URL 并返回给前端
-            String fileUrl = serverConfig.getUrl() + uploadPath;
-            return AjaxResult.success("二维码生成成功", fileUrl);
-
+            String result = uploadPath.replace("https://cysd.oss-cn-shanghai.aliyuncs.com", fileUrl);
+            return AjaxResult.success("二维码生成成功", result);
         } catch (Exception e) {
             e.printStackTrace();
             return AjaxResult.error("二维码生成或上传失败");

+ 0 - 199
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityAccompanyImpl.java

@@ -1,199 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.ruoyi.common.core.domain.entity.SysUser;
-import com.ruoyi.generator.domain.Community.*;
-import com.ruoyi.generator.mapper.community.CommunityArticleCommentMapper;
-import com.ruoyi.generator.mapper.community.CommunityArticleMapper;
-import com.ruoyi.generator.mapper.community.CommunityCommentReplyMapper;
-import com.ruoyi.generator.mapper.community.CommunityUserLikeMapper;
-import com.ruoyi.generator.vo.CommunityUserLikeVo;
-import com.ruoyi.system.mapper.SysUserMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.text.DecimalFormat;
-import java.time.LocalDate;
-import java.time.ZoneId;
-import java.time.temporal.ChronoUnit;
-import java.time.temporal.Temporal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- * @author fangqing
- * @date 2024/12/30 15:26
- */
-@Service
-public class CommunityAccompanyImpl implements ICommunityAccompanyService {
-
-
-    @Autowired
-    private SysUserMapper userMapper;
-
-    @Autowired
-    private CommunityArticleMapper communityArticleMapper;
-
-    @Autowired
-    private CommunityUserLikeMapper communityUserLikeMapper;
-
-    @Autowired
-    private CommunityArticleCommentMapper communityArticleCommentMapper;
-
-    @Autowired
-    private CommunityCommentReplyMapper communityCommentReplyMapper;
-
-    @Override
-    public CommunityAccompany selectCommunityAccompanyById(Long userId) {
-        DecimalFormat df = new DecimalFormat("#.00");
-        CommunityAccompany communityAccompany = new CommunityAccompany();
-
-        //获取当前用户信息 天数
-        SysUser sysUsers = userMapper.selectOne( new QueryWrapper<SysUser>().select("create_time").eq("user_id", userId).and((wrapper) -> {wrapper.ne("status", true).or().isNull("status");}));
-
-        if (sysUsers == null){
-            return  communityAccompany;
-        }
-        Date createTime = sysUsers.getCreateTime();
-        // 将 Date 对象转换为 LocalDate 对象
-        LocalDate localCreateTime = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
-        // 获取当前日期
-        LocalDate today = LocalDate.now();
-        // 计算两个日期之间的天数差
-        long daysDifference = ChronoUnit.DAYS.between(localCreateTime, today);
-        communityAccompany.setAccompanyDays(daysDifference);
-
-        //查询当前用户下文章的数量
-        List<CommunityArticle> communityArticles = communityArticleMapper.selectList(new QueryWrapper<CommunityArticle>()
-                .eq("create_by", userId)
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true).or().isNull("is_delete");
-                }));
-        //如果用户文章数量不为空则执行以下的操作
-        if (communityArticles != null){
-
-            //设置用户创作数
-            communityAccompany.setCreationCount((long) communityArticles.size());
-
-            //计算小于自己粉丝的有多少人
-            List<CommunityArticle> communityArticlesLess = new ArrayList<>(communityArticleMapper.selectList(new QueryWrapper<CommunityArticle>()
-                    .select("user_id", "COUNT(1) as count")
-                    .and((wrapper) -> {
-                        wrapper.ne("is_delete", true).or().isNull("is_delete");
-                    })
-                    .groupBy("user_id")
-                    .having("COUNT(*) <= {0}", (long) communityArticles.size())
-                    .orderByDesc("count"))) ;
-
-            //计算所有文章的数量
-            List<CommunityArticle> communityArticlesTotal = new ArrayList<>(communityArticleMapper.selectList(new QueryWrapper<CommunityArticle>()
-                    .select("user_id", "COUNT(1) as count")
-                    .and((wrapper) -> {
-                        wrapper.ne("is_delete", true).or().isNull("is_delete");
-                    })
-                    .groupBy("user_id")
-                    .orderByDesc("count")));
-
-            //计算创作数的百分比 计算百分比
-            Double CreationCountPercent = Double.valueOf(df.format((double) communityArticlesLess.size() / communityArticlesTotal.size() * 100));
-            communityAccompany.setCreationCountPercent(CreationCountPercent);
-
-
-            //计算用户阅览量
-            long read = communityArticles.stream()
-                    .mapToLong(article -> article.getPageViews()).sum();
-            communityAccompany.setRead(read);
-
-
-            //计算阅览量百分比
-            List<CommunityArticle> communityArticlesReadSumLess = new ArrayList<>(communityArticleMapper.selectList(new QueryWrapper<CommunityArticle>()
-                    .select("user_id","sum(page_views) page_views","COUNT(1) as count")
-                    .and((wrapper) -> {
-                        wrapper.ne("is_delete", true).or().isNull("is_delete");
-                    })
-                    .groupBy("user_id")
-                    .having("page_views <= {0}", read )
-                    .orderByDesc("count"))) ;
-
-            Double ReadPercent = Double.valueOf(df.format((double)  communityArticlesReadSumLess.size() / communityArticlesTotal.size() * 100));
-            communityAccompany.setReadPercent(ReadPercent);
-
-        }
-
-
-        //粉丝数
-        Long fans = communityUserLikeMapper.selectCount(new QueryWrapper<CommunityUserLike>()
-                .eq("like_user_id", userId));
-
-
-        communityAccompany.setFan(fans);
-        //计算小于自己粉丝的有多少人
-        List<CommunityUserLike> userLikeFan = new ArrayList<>(communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>()
-                .select("like_user_id", "COUNT(1) as count")
-                .groupBy("like_user_id")
-                .having("COUNT(*) <= {0}", fans)
-                .orderByDesc("count"))) ;
-
-        //计算总人数
-        List<CommunityUserLike> userLikeFans = new ArrayList<>(communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>()
-                .select("like_user_id", "COUNT(1) as count")
-                .groupBy("like_user_id")));
-        //粉丝数占比
-        Double  ReadPercent = Double.valueOf(df.format((double) userLikeFan.size() / userLikeFans.size() * 100));
-        communityAccompany.setFanPercent(ReadPercent);
-
-
-        //查询评论数
-        /*//一级评论
-        Long comment = communityArticleCommentMapper.selectCount(new QueryWrapper<CommunityArticleComment>()
-                .eq("user_id", userId)
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true).or().isNull("is_delete");
-                })
-        );
-        //二级评论
-        Long commentReply = communityCommentReplyMapper.selectCount(new QueryWrapper<CommunityCommentReply>()
-                .eq("user_id", userId)
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true).or().isNull("is_delete");
-                })
-        );*/
-        //查询哪几篇文章是我发布的
-        List<Long> articleIds = communityArticles.stream().map(item -> item.getId()).collect(Collectors.toList());
-        System.out.println(articleIds);
-        Integer commentSum = 0;
-        //查询评论数 别人评论我的数量 首先自己得有文章才能有评论
-        if (articleIds.size() > 0 ) {
-            commentSum = communityArticleCommentMapper.queryCommentReplyCount(articleIds);
-        }
-        communityAccompany.setComment(Long.valueOf(commentSum));
-
-        //评论数占比
-        if (commentSum > 0 ){
-            Integer commentless = communityArticleCommentMapper.queryCommentReplyCountPerson(commentSum);
-            Integer commentCount = communityArticleCommentMapper.queryCommentReplyCountPerson(0);
-            Double  commentPercent = Double.valueOf(df.format((double) commentless / commentCount * 100));
-            communityAccompany.setCommentPercent(commentPercent);
-        }
-
-        //用户文章 和 评论收货多少点赞
-        Integer likeCount = Optional.ofNullable(communityArticleCommentMapper.queryCommentReplyLikeCount(userId))
-                .orElse(0);
-        communityAccompany.setLike(Long.valueOf(likeCount));
-
-        if (likeCount >0 ){
-            Integer likeless = communityArticleCommentMapper.queryCommentReplyLikeCountPerson(likeCount);
-            Integer likesCount = communityArticleCommentMapper.queryCommentReplyLikeCountPerson(0);
-            Double likePercent = Double.valueOf(df.format((double) likeless / likesCount * 100));
-            communityAccompany.setLikePercent(likePercent);
-        }
-        //
-
-        return communityAccompany;
-    }
-
-
-}

+ 0 - 13
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleAtServiceImpl.java

@@ -1,13 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityArticleAt;
-import com.ruoyi.generator.domain.Community.CommunityUserLike;
-import com.ruoyi.generator.mapper.community.CommunityArticleAtMapper;
-import com.ruoyi.generator.mapper.community.CommunityUserLikeMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityArticleAtServiceImpl extends ServiceImpl<CommunityArticleAtMapper, CommunityArticleAt> implements ICommunityArticleAtService {
-
-}

+ 0 - 10
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleClassImpl.java

@@ -1,10 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityArticleClass;
-import com.ruoyi.generator.mapper.community.CommunityArticleCircleMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityArticleClassImpl extends ServiceImpl<CommunityArticleCircleMapper, CommunityArticleClass> implements ICommunityArticleClassService {
-}

+ 0 - 11
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleCollectServiceImpl.java

@@ -1,11 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityArticleCollect;
-import com.ruoyi.generator.mapper.community.CommunityArticleCollectMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityArticleCollectServiceImpl extends ServiceImpl<CommunityArticleCollectMapper, CommunityArticleCollect> implements ICommunityArticleCollectService {
-
-}

+ 0 - 33
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleCommentServiceImpl.java

@@ -1,33 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityArticleComment;
-import com.ruoyi.generator.mapper.community.CommunityArticleCommentMapper;
-import com.ruoyi.generator.vo.CommentVo;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-@Service
-public class CommunityArticleCommentServiceImpl extends ServiceImpl<CommunityArticleCommentMapper, CommunityArticleComment> implements ICommunityArticleCommentService {
-
-    @Resource
-    private CommunityArticleCommentMapper communityArticleCommentMapper;
-
-    /**
-     * 获取当前用户文章的所有评论信息
-     *
-     * @param userId 当前用户id
-     * @return 该用户的文章信息
-     */
-    @Override
-    public List<CommentVo> getCommentInfoByUserId(long userId, int offset, int limit, int searchType) {
-        return communityArticleCommentMapper.getCommentListByUserId(userId,offset,limit,searchType);
-    }
-
-    @Override
-    public List<CommentVo> getCommentInfoByUserId2(long userId, int searchType) {
-        return communityArticleCommentMapper.getCommentListByUserId2(userId,searchType);
-    }
-}

+ 0 - 11
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleRecommendServiceImpl.java

@@ -1,11 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityArticleRecommend;
-import com.ruoyi.generator.mapper.community.CommunityArticleRecommendMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityArticleRecommendServiceImpl extends ServiceImpl<CommunityArticleRecommendMapper, CommunityArticleRecommend> implements ICommunityArticleRecommendService {
-
-}

+ 0 - 1773
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleServiceImpl.java

@@ -1,1773 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.alibaba.fastjson2.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.constant.CacheConstants;
-import com.ruoyi.common.core.domain.entity.SysUser;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.core.redis.RedisCache;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.common.utils.ip.AddressUtils;
-import com.ruoyi.generator.domain.Community.*;
-import com.ruoyi.generator.mapper.community.*;
-import com.ruoyi.generator.vo.*;
-import com.ruoyi.system.mapper.SysUserMapper;
-import org.apache.ibatis.annotations.Param;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Service;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.text.ParseException;
-import java.time.LocalDate;
-import java.time.ZoneId;
-import java.time.temporal.ChronoUnit;
-import java.util.*;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
-/**
- * 业务 服务层实现
- *
- * @author ruoyi
- */
-@Service
-public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMapper, CommunityArticle> implements ICommunityArticleService {
-    private static final Logger log = LoggerFactory.getLogger(CommunityArticleServiceImpl.class);
-
-    @Autowired
-    private CommunityArticleMapper communityArticleMapper;
-
-    @Autowired
-    private SysUserMapper sysUserMapper;
-
-    @Autowired
-    private CommunityLikeMapper communityLikeMapper;
-
-    @Autowired
-    private CommunityCollectMapper communityCollectMapper;
-
-    @Autowired
-    private CommunityArticleCommentMapper communityArticleCommentMapper;
-
-    @Autowired
-    private CommunityCommentLikeMapper communityCommentLikeMapper;
-
-    @Autowired
-    private CommunityArticleTagMapper articleTagMapper;
-
-    @Autowired
-    private CommunityArticleTagMapper communityArticleTagMapper;
-
-    @Autowired
-    private CommunityTagMapper communityTagMapper;
-
-    @Autowired
-    private CommunityArticleImagesMapper communityArticleImagesMapper;
-
-    @Autowired
-    private CommunityClassCircleMapper communityClassCircleMapper;
-
-    @Autowired
-    private CommunityCircleMapper communityCircleMapper;
-
-    @Autowired
-    private CommunityUserCircleMapper communityUserCircleMapper;
-
-    @Autowired
-    private CommunityUserLikeMapper communityUserLikeMapper;
-
-    @Autowired
-    private CommunityUserInfoMapper communityUserInfoMapper;
-
-    @Autowired
-    private ICommunityArticleClassService communityArticleClassService;
-
-    @Autowired
-    private CommunityCollectionArticleMapper communityCollectionArticleMapper;
-
-    @Autowired
-    private ICommunityCollectionArticleService collectionArticleService;
-
-    @Autowired
-    private CommunityTagBlockMapper communityTagBlockMapper;
-
-    @Autowired
-    private CommunityArticleRecommendMapper recommendMapper;
-
-    @Autowired
-    private ICommunityArticleService communityArticleService;
-
-    @Autowired
-    private ICommunityPrivacyService communityPrivacyService;
-    @Autowired
-    private CommunityCollectionMapper communityCollectionMapper;
-
-    @Autowired
-    private CommunityUserBlockMapper communityUserBlockMapper;
-
-    @Autowired
-    private CommunityUserPromptMapper communityUserPromptMapper;
-
-    @Autowired
-    private CommunityArticleCollectMapper communityArticleCollectMapper;
-
-    @Autowired
-    private CommunityCommentRaffleMapper communityCommentRaffleMapper;
-
-    @Autowired
-    private CommunityArticleCircleMapper communityArticleCircleMapper;
-    @Autowired
-    private RedisCache redisCache;
-    @Autowired
-    private RedisTemplate<Object, Object> redisTemplate;
-
-    @Autowired
-    private ICommunityArticleAtService communityArticleAtService;
-
-    /**
-     * 查询文章列表
-     *
-     * @param communityArticle 文章信息
-     * @return 文章信息集合
-     */
-    @Override
-    public List<CommunityArticleVo> selectCommunityArticleList(Long userId, TableDataInfo rspData, CommunityArticle communityArticle, int pageNum, int pageSize, int searchType) {
-
-        List<CommunityArticleVo> communityArticleVos = null;
-        //找出板块下的分类
-        List<Long> classIds = communityArticle.getClassIds();
-        System.out.println("classIds: " + classIds);
-        if (classIds != null && classIds.contains(19L)) { // Check for null and then use contains()
-            classIds = null;
-            searchType = 3;
-        }
-
-        Long id = communityArticle.getId();
-        List<Long> articleIds = communityArticle.getArticleIds();
-        Integer pageTagType = communityArticle.getPageTagType();
-        Integer noCollection = communityArticle.getNoCollection();
-        if (pageTagType != null && pageTagType == 1) {
-            List<CommunityUserLikeVo> communityUserLikeVos = selectCommunityUserLikeList(SecurityUtils.getUserId(), null, 1, 999999, 1);
-            if (communityUserLikeVos.isEmpty()) {
-                return null;
-            }
-            List<Long> likeUserIds = communityUserLikeVos.stream().map(CommunityUserLikeVo::getLikeUserId).collect(Collectors.toList());
-            communityArticle.setUserIds(likeUserIds);
-        }
-
-        if (Objects.nonNull(id)) {
-            //获取指定文章详细内容,文章浏览量+1
-            CommunityArticle article = communityArticleMapper.selectById(id);
-            article.setPageViews(article.getPageViews() + 1);
-            communityArticleMapper.updateById(article);
-        }
-
-        if (articleIds != null && !articleIds.isEmpty()) {
-            for (Long articleId : articleIds) {
-                //获取指定文章详细内容,文章浏览量+1
-                CommunityArticle article = communityArticleMapper.selectById(articleId);
-                article.setPageViews(article.getPageViews() + 1);
-                communityArticleMapper.updateById(article);
-            }
-        }
-
-        Boolean isDraft = communityArticle.getIsDraft();
-        //判断草稿箱是否为空 为空则为false
-        if (isDraft == null) {
-            communityArticle.setIsDraft(false);
-        }
-
-        //根据分类查找文章
-        int offset = (pageNum - 1) * pageSize;
-        communityArticleVos = communityArticleMapper.selectCommunityArticleList(communityArticle, classIds, offset, pageSize, searchType, userId);
-
-        List<CommunityArticleVo> articleVos_copy = new ArrayList<>(communityArticleVos);
-        if (noCollection != null) {
-            if (noCollection == 1) {
-                //剔除是否有合集文章
-                List<Long> ids = communityArticleVos.stream().map(CommunityArticleVo::getId).collect(Collectors.toList());
-                if (!ids.isEmpty()) {
-                    List<CommunityCollectionArticle> collections = communityCollectionArticleMapper.selectList(new QueryWrapper<CommunityCollectionArticle>()
-                            .in("article_id", ids)
-                            .and((wrapper) -> {
-                                wrapper.ne("is_delete", true).or().isNull("is_delete");
-                            }));
-
-                    for (CommunityArticleVo communityArticleVo : articleVos_copy) {
-                        for (CommunityCollectionArticle collection : collections) {
-                            if (collection.getArticleId().equals(communityArticleVo.getId())) {
-                                communityArticleVos.remove(communityArticleVo);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        rspData.setTotal(communityArticleVos.size());
-        List<CommunityArticleVo> communityArticleVos_copy = new ArrayList<>(communityArticleVos);
-        for (CommunityArticleVo articleVo : communityArticleVos_copy) {
-            //判断当前文章是否被用户拉黑
-            List<CommunityUserBlock> communityUserBlocks = communityUserBlockMapper.selectList(new QueryWrapper<CommunityUserBlock>()
-                    .eq("user_id", userId)
-                    .eq("peer_id", articleVo.getUserId()));
-
-            for (CommunityUserBlock userBlock : communityUserBlocks) {
-                if (userBlock.isBlock()) {
-                    articleVo.setBlock(userBlock.isBlock());
-                    break;
-                }
-            }
-
-            //获取文章是否被关注
-            List<CommunityUserLike> communityUserLikes = communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>()
-                    .eq("user_id", userId)
-                    .eq("like_user_id", articleVo.getUserId())
-            );
-
-            for (CommunityUserLike communityUserLike : communityUserLikes) {
-                articleVo.setCare(communityUserLike.getUserId() != null);
-            }
-
-        /*    communityArticleMapper.selectList();
-            articleVo.setCare();*/
-
-            List<Map<String, Object>> imageList = articleVo.getImageList();
-
-            //设置文章的板块
-            List<CommunityArticleClass> articleId = communityArticleCircleMapper.selectList(
-                    new QueryWrapper<CommunityArticleClass>()
-                            .eq("article_id", articleVo.getId())
-                            .and((wrapper) -> {
-                                wrapper.ne("is_delete", true).or().isNull("is_delete");
-                            })
-            );
-            // 使用 Java Streams API 提取 classId,并转换成 List<Long>
-            List<Long> classIdss = articleId.stream()
-                    .map(CommunityArticleClass::getClassId)
-                    .collect(Collectors.toList());
-            articleVo.setClassIds(classIdss);
-
-
-            List<CommunityArticleImages> videoList = new ArrayList<>();
-            CommunityArticleImages videos = null;
-            List<Map<String, Object>> imageList_copy = new ArrayList<>(imageList);
-            for (Map<String, Object> image : imageList_copy) {
-                String imageUrl = image.get("imageUrl").toString();
-                //判断是否是视频
-                boolean isVideo = isVideoFile(imageUrl);
-                if (isVideo) {
-                    imageList.remove(image);
-                    videos = JSONObject.parseObject(JSONObject.toJSONString(image), CommunityArticleImages.class);
-                    //BeanUtils.copyProperties(image, videos);
-                    videoList.add(videos);
-                }
-            }
-            articleVo.setVideoList(videoList);
-
-            //设置评论回复数量
-            articleVo.setCommentCount(communityArticleCommentMapper.queryCommentCount(articleVo.getId()));
-            //设置文章的点赞数量
-            articleVo.setLikeCount(communityLikeMapper.selectList(new QueryWrapper<CommunityLike>().eq("article_id", articleVo.getId())).size());
-            //设置文章的收藏数量
-            articleVo.setCollectCount(communityCollectMapper.selectList(new QueryWrapper<CommunityArticleCollect>().eq("article_id", articleVo.getId())).size());
-            //设置文章推荐数量
-            articleVo.setRecommendCount(recommendMapper.selectList(new QueryWrapper<CommunityArticleRecommend>()
-                    .eq("article_id", articleVo.getId())
-                    .and((wrapper) -> {
-                        wrapper.ne("is_delete", true).or().isNull("is_delete");
-                    })).size());
-            //设置文章所属合集
-            articleVo.setCollectionVo(communityCollectionMapper.selectCollectById(userId, articleVo.getId()));
-
-
-            //设置中奖信息
-            CommunityCommentRaffleVo communityCommentRaffleVo = new CommunityCommentRaffleVo();
-            CommunityCommentRaffle communityCommentRaffle = communityCommentRaffleMapper.selectOne(
-                    new QueryWrapper<CommunityCommentRaffle>()
-                            .eq("article_id", articleVo.getId())
-                            .and((wrapper) -> {
-                                wrapper.ne("is_delete", true).or().isNull("is_delete");
-                            }));
-            if (communityCommentRaffle != null) {
-                BeanUtils.copyProperties(communityCommentRaffle, communityCommentRaffleVo);
-                CommunityUserInfoVo communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(communityCommentRaffle.getUserId(), false);
-                communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
-                communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
-                articleVo.setCommentRaffleVo(communityCommentRaffleVo);
-            }
-            //文章下的评论
-//            List<Map<String, Object>> comments = articleVo.getComments();
-//            for (Map<String, Object> communityArticleCommentVo : comments) {
-//                String commentUserId = communityArticleCommentVo.get("userId").toString();
-//                if (Objects.isNull(commentUserId)) {
-//                    break;
-//                }
-//                //获取评论的用户信息
-//                SysUser sysUser = sysUserMapper.selectUserById(Long.parseLong(commentUserId));
-//                communityArticleCommentVo.put("username", sysUser.getUserName());
-//                communityArticleCommentVo.put("avatar", sysUser.getAvatar());
-//                //当前登录用户是否已点赞
-//                List<CommunityCommentLike> commentLikes = communityCommentLikeMapper.selectList(new QueryWrapper<CommunityCommentLike>().eq("comment_id", communityArticleCommentVo.get("id")).eq("user_id", userId));
-//                communityArticleCommentVo.put("commentLike", !commentLikes.isEmpty());
-//
-//                //该评论的点赞数量
-//                communityArticleCommentVo.put("commentLikeCount", communityCommentLikeMapper.selectList(new QueryWrapper<CommunityCommentLike>().eq("comment_id", communityArticleCommentVo.get("id"))).size());
-//            }
-
-            //判断是否已收藏
-            CommunityArticleCollect collect = communityCollectMapper.selectOne(new QueryWrapper<CommunityArticleCollect>().eq("user_id", userId).eq("article_id", articleVo.getId()));
-            articleVo.setCollect(!Objects.isNull(collect));
-
-            //判断是否已点赞
-            CommunityLike like = communityLikeMapper.selectOne(new QueryWrapper<CommunityLike>().eq("user_id", userId).eq("article_id", articleVo.getId()));
-            articleVo.setLike(!Objects.isNull(like));
-
-            //判断是否已推荐
-            CommunityArticleRecommend recommend = recommendMapper.selectOne(new QueryWrapper<CommunityArticleRecommend>()
-                    .eq("user_id", userId)
-                    .eq("article_id", articleVo.getId()).and((wrapper) -> {
-                        wrapper.ne("is_delete", true).or().isNull("is_delete");
-                    }));
-            articleVo.setRecommend(!Objects.isNull(recommend));
-
-            //获取文章标签
-            List<CommunityArticleTag> articleTags = communityArticleTagMapper.selectList(new QueryWrapper<CommunityArticleTag>()
-                    .eq("article_id", articleVo.getId())
-                    .and((wrapper) -> {
-                        wrapper.ne("is_delete", true).or().isNull("is_delete");
-                    }));
-            List<Long> tagList = articleTags.stream().map(CommunityArticleTag::getTagId).collect(Collectors.toList());
-            List<Long> tagIds = new ArrayList<>();
-
-            if (!tagList.isEmpty()) {
-                //判断当前标签是否被当前登录用户拉黑
-                List<CommunityTagBlock> communityTagBlocks = communityTagBlockMapper.selectList(new QueryWrapper<CommunityTagBlock>()
-                        .in("tag_id", tagList)
-                        .eq("user_id", userId)
-                        .eq("is_block", 1));
-
-                for (CommunityTagBlock tagBlock : communityTagBlocks) {
-                    if (tagBlock.isBlock()) {
-                        communityArticleVos.remove(articleVo);
-                        break;
-                    }
-                    tagIds.add(tagBlock.getTagId());
-                }
-
-                if (communityTagBlocks.isEmpty()) {
-                    tagIds.addAll(tagList);
-                }
-
-                if (!tagIds.isEmpty()) {
-                    List<CommunityTag> communityTags = communityTagMapper.selectBatchIds(tagIds);
-                    articleVo.setTags(communityTags);
-                }
-            }
-        }
-        return communityArticleVos;
-    }
-
-    /**
-     * 查询文章列表
-     *
-     * @param communityArticle 文章信息
-     * @return 文章信息集合
-     */
-    @Override
-    public List<CommunityArticleVo> selectCommunityArticleList1(Long userId, TableDataInfo rspData, CommunityArticle communityArticle, int pageNum, int pageSize, int searchType) {
-
-        List<CommunityArticleVo> communityArticleVos = null;
-        //找出板块下的分类
-        List<Long> classIds = communityArticle.getClassIds();
-        Long id = communityArticle.getId();
-        List<Long> articleIds = communityArticle.getArticleIds();
-        Integer pageTagType = communityArticle.getPageTagType();
-        Integer noCollection = communityArticle.getNoCollection();
-        if (pageTagType != null && pageTagType == 1) {
-            List<CommunityUserLikeVo> communityUserLikeVos = selectCommunityUserLikeList(SecurityUtils.getUserId(), null, 1, 999999, 1);
-            if (communityUserLikeVos.isEmpty()) {
-                return null;
-            }
-            List<Long> likeUserIds = communityUserLikeVos.stream().map(CommunityUserLikeVo::getLikeUserId).collect(Collectors.toList());
-            communityArticle.setUserIds(likeUserIds);
-        }
-
-        if (Objects.nonNull(id)) {
-            //获取指定文章详细内容,文章浏览量+1
-            CommunityArticle article = communityArticleMapper.selectById(id);
-            article.setPageViews(article.getPageViews() + 1);
-            communityArticleMapper.updateById(article);
-        }
-
-        if (articleIds != null && !articleIds.isEmpty()) {
-            for (Long articleId : articleIds) {
-                //获取指定文章详细内容,文章浏览量+1
-                CommunityArticle article = communityArticleMapper.selectById(articleId);
-                article.setPageViews(article.getPageViews() + 1);
-                communityArticleMapper.updateById(article);
-            }
-        }
-
-        //根据分类查找文章
-        int offset = (pageNum - 1) * pageSize;
-        communityArticleVos = communityArticleMapper.selectCommunityArticleList(communityArticle, classIds, offset, pageSize, searchType, userId);
-
-        List<CommunityArticleVo> articleVos_copy = new ArrayList<>(communityArticleVos);
-        if (noCollection != null) {
-            if (noCollection == 1) {
-                //剔除是否有合集文章
-                List<Long> ids = communityArticleVos.stream().map(CommunityArticleVo::getId).collect(Collectors.toList());
-                if (!ids.isEmpty()) {
-                    List<CommunityCollectionArticle> collections = communityCollectionArticleMapper.selectList(new QueryWrapper<CommunityCollectionArticle>()
-                            .in("article_id", ids)
-                            .and((wrapper) -> {
-                                wrapper.ne("is_delete", true).or().isNull("is_delete");
-                            }));
-
-                    for (CommunityArticleVo communityArticleVo : articleVos_copy) {
-                        for (CommunityCollectionArticle collection : collections) {
-                            if (collection.getArticleId().equals(communityArticleVo.getId())) {
-                                communityArticleVos.remove(communityArticleVo);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        //数据拉取区域
-        //判断当前文章是否被用户拉黑
-        //用户拉黑数据
-        List<CommunityUserBlock> communityUserBlocks = redisCache.getCacheList(CacheConstants.COMMUNITY_USER_BLOCK);
-        if (communityUserBlocks.isEmpty()) {
-            communityUserBlocks = communityUserBlockMapper.selectList(new QueryWrapper<CommunityUserBlock>());
-            redisCache.setCacheList(CacheConstants.COMMUNITY_USER_BLOCK, communityUserBlocks);
-            redisCache.expire(CacheConstants.COMMUNITY_USER_BLOCK, 24, TimeUnit.HOURS);
-        }
-
-        //关注数据
-        List<CommunityUserLike> communityUserLikes = redisCache.getCacheList(CacheConstants.COMMUNITY_USER_LIKE);
-        if (communityUserLikes.isEmpty()) {
-            communityUserLikes = communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>());
-            redisCache.setCacheList(CacheConstants.COMMUNITY_USER_LIKE, communityUserLikes);
-            redisCache.expire(CacheConstants.COMMUNITY_USER_LIKE, 24, TimeUnit.HOURS);
-        }
-
-        //文章板块数据
-        List<CommunityArticleClass> communityArticleClasses = redisCache.getCacheList(CacheConstants.COMMUNITY_ARTICLE_CLASS);
-        if (communityArticleClasses.isEmpty()) {
-            communityArticleClasses = communityArticleCircleMapper.selectList(new QueryWrapper<CommunityArticleClass>().eq("is_delete", false));
-            redisCache.setCacheList(CacheConstants.COMMUNITY_ARTICLE_CLASS, communityArticleClasses);
-            redisCache.expire(CacheConstants.COMMUNITY_ARTICLE_CLASS, 24, TimeUnit.HOURS);
-        }
-
-        //文章点赞数据
-        List<CommunityLike> communityLikes = redisCache.getCacheList(CacheConstants.COMMUNITY_LIKE);
-        if (communityLikes.isEmpty()) {
-            communityLikes = communityLikeMapper.selectList(new QueryWrapper<CommunityLike>());
-            redisCache.setCacheList(CacheConstants.COMMUNITY_LIKE, communityLikes);
-            redisCache.expire(CacheConstants.COMMUNITY_LIKE, 24, TimeUnit.HOURS);
-        }
-
-        //文章收藏数据
-        List<CommunityArticleCollect> communityArticleCollects = redisCache.getCacheList(CacheConstants.COMMUNITY_COLLECT);
-        if (communityArticleCollects.isEmpty()) {
-            communityArticleCollects = communityCollectMapper.selectList(new QueryWrapper<CommunityArticleCollect>());
-            redisCache.setCacheList(CacheConstants.COMMUNITY_COLLECT, communityArticleCollects);
-            redisCache.expire(CacheConstants.COMMUNITY_COLLECT, 24, TimeUnit.HOURS);
-        }
-
-        //文章推荐数据
-        List<CommunityArticleRecommend> communityArticleRecommends = redisCache.getCacheList(CacheConstants.COMMUNITY_ARTICLE_RECOMMEND);
-        if (communityArticleRecommends.isEmpty()) {
-            communityArticleRecommends = recommendMapper.selectList(new QueryWrapper<CommunityArticleRecommend>().eq("is_delete", false));
-            redisCache.setCacheList(CacheConstants.COMMUNITY_ARTICLE_RECOMMEND, communityArticleRecommends);
-            redisCache.expire(CacheConstants.COMMUNITY_ARTICLE_RECOMMEND, 24, TimeUnit.HOURS);
-        }
-
-        //中奖信息数据
-        List<CommunityCommentRaffle> communityCommentRaffles = redisCache.getCacheList(CacheConstants.COMMUNITY_COMMENT_RAFFLE);
-        if (communityCommentRaffles.isEmpty()) {
-            communityCommentRaffles = communityCommentRaffleMapper.selectList(new QueryWrapper<CommunityCommentRaffle>().eq("is_delete", false));
-            redisCache.setCacheList(CacheConstants.COMMUNITY_COMMENT_RAFFLE, communityCommentRaffles);
-            redisCache.expire(CacheConstants.COMMUNITY_COMMENT_RAFFLE, 24, TimeUnit.HOURS);
-        }
-
-        //文章标签数据
-        List<CommunityArticleTag> communityArticleTags = redisCache.getCacheList(CacheConstants.COMMUNITY_ARTICLE_TAG);
-        if (communityArticleTags.isEmpty()) {
-            communityArticleTags = communityArticleTagMapper.selectList(new QueryWrapper<CommunityArticleTag>().eq("is_delete", false));
-            redisCache.setCacheList(CacheConstants.COMMUNITY_ARTICLE_TAG, communityArticleTags);
-            redisCache.expire(CacheConstants.COMMUNITY_ARTICLE_TAG, 24, TimeUnit.HOURS);
-        }
-
-        //文章标签拉黑数据
-        List<CommunityTagBlock> communityTagBlocks = redisCache.getCacheList(CacheConstants.COMMUNITY_TAG_BLOCK);
-        if (communityTagBlocks.isEmpty()) {
-            communityTagBlocks = communityTagBlockMapper.selectList(new QueryWrapper<CommunityTagBlock>().eq("is_block", 1));
-            redisCache.setCacheList(CacheConstants.COMMUNITY_TAG_BLOCK, communityTagBlocks);
-            redisCache.expire(CacheConstants.COMMUNITY_TAG_BLOCK, 24, TimeUnit.HOURS);
-        }
-
-        //文章标签
-        List<CommunityTag> communityTags = redisCache.getCacheList(CacheConstants.COMMUNITY_TAG);
-        if (communityTags.isEmpty()) {
-            communityTags = communityTagMapper.selectList(new QueryWrapper<CommunityTag>().eq("is_delete", false));
-            redisCache.setCacheList(CacheConstants.COMMUNITY_TAG, communityTags);
-            redisCache.expire(CacheConstants.COMMUNITY_TAG, 24, TimeUnit.HOURS);
-        }
-
-        rspData.setTotal(communityArticleVos.size());
-        List<CommunityArticleVo> communityArticleVos_copy = new ArrayList<>(communityArticleVos);
-        List<CommunityArticleImages> videoList = new ArrayList<>();
-        for (CommunityArticleVo articleVo : communityArticleVos_copy) {
-            //判断当前文章是否被用户拉黑
-            communityUserBlocks
-                    .stream()
-                    .filter(item -> item.getUserId().equals(userId) && item.getPeerId().equals(articleVo.getUserId()))
-                    .findFirst()
-                    .ifPresent(communityUserBlock -> articleVo.setBlock(communityUserBlock.isBlock()));
-
-            //获取文章是否被关注
-            communityUserLikes
-                    .stream()
-                    .filter(item -> item.getUserId().equals(userId) && item.getLikeUserId().equals(articleVo.getUserId()))
-                    .findFirst()
-                    .ifPresent(communityUserLike -> articleVo.setCare(communityUserLike.getUserId() != null));
-
-            //设置文章的板块 提取 classId,并转换成 List<Long>
-            List<CommunityArticleClass> communityArticleClassList = communityArticleClasses
-                    .stream()
-                    .filter(item ->
-                            item.getArticleId().equals(articleVo.getId()) && !item.getIsDelete()).collect(Collectors.toList());
-            classIds = communityArticleClassList
-                    .stream()
-                    .map(CommunityArticleClass::getClassId)
-                    .collect(Collectors.toList());
-            articleVo.setClassIds(classIds);
-
-            List<Map<String, Object>> imageList = articleVo.getImageList();
-            List<Map<String, Object>> imageList_copy = new ArrayList<>(imageList);
-            CommunityArticleImages videos = null;
-            for (Map<String, Object> image : imageList_copy) {
-                String imageUrl = image.get("imageUrl").toString();
-                //判断是否是视频
-                boolean isVideo = isVideoFile(imageUrl);
-                if (isVideo) {
-                    imageList.remove(image);
-                    videos = JSONObject.parseObject(JSONObject.toJSONString(image), CommunityArticleImages.class);
-                    //BeanUtils.copyProperties(image, videos);
-                    videoList.add(videos);
-                }
-            }
-            articleVo.setVideoList(videoList);
-
-            //设置评论回复数量
-            articleVo.setCommentCount(communityArticleCommentMapper.queryCommentCount(articleVo.getId()));
-            //设置文章的点赞数量
-            articleVo.setLikeCount((int) communityLikes.stream().filter(item -> item.getArticleId().equals(articleVo.getId())).count());
-            //设置文章的收藏数量
-            articleVo.setCollectCount((int) communityArticleCollects.stream().filter(item -> item.getArticleId().equals(articleVo.getId())).count());
-            //设置文章推荐数量
-            articleVo.setRecommendCount((int) communityArticleRecommends.stream().filter(item -> item.getArticleId().equals(articleVo.getId()) && !item.isDelete()).count());
-            //设置文章所属合集
-            articleVo.setCollectionVo(communityCollectionMapper.selectCollectById(userId, articleVo.getId()));
-
-            //设置中奖信息
-            CommunityCommentRaffleVo communityCommentRaffleVo = new CommunityCommentRaffleVo();
-            communityCommentRaffles
-                    .stream()
-                    .filter(item -> item.getArticleId().equals(articleVo.getId()) && !item.isDelete())
-                    .findFirst()
-                    .ifPresent(communityCommentRaffle -> {
-                        BeanUtils.copyProperties(communityCommentRaffle, communityCommentRaffleVo);
-                        CommunityUserInfoVo communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(communityCommentRaffle.getUserId(), true);
-                        communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
-                        communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
-                        articleVo.setCommentRaffleVo(communityCommentRaffleVo);
-                    });
-
-            //判断是否已收藏
-            List<CommunityArticleCollect> collects = communityArticleCollects.stream().filter(item -> item.getUserId().equals(userId) && item.getArticleId().equals(articleVo.getId())).collect(Collectors.toList());
-            articleVo.setCollect(!collects.isEmpty());
-
-            //判断是否已点赞
-            List<CommunityLike> likes = communityLikes.stream().filter(item -> item.getUserId().equals(userId) && item.getArticleId().equals(articleVo.getId())).collect(Collectors.toList());
-            articleVo.setLike(!likes.isEmpty());
-
-            //判断是否已推荐
-            List<CommunityArticleRecommend> recommends = communityArticleRecommends.stream().filter(item -> item.getUserId().equals(userId) && item.getArticleId().equals(articleVo.getId()) && !item.isDelete()).collect(Collectors.toList());
-            articleVo.setRecommend(!recommends.isEmpty());
-
-            //获取文章标签
-            List<CommunityArticleTag> articleTags = communityArticleTags.stream().filter(item -> item.getArticleId().equals(articleVo.getId()) && !item.getIsDelete()).collect(Collectors.toList());
-            List<Long> tagList = articleTags.stream().map(CommunityArticleTag::getTagId).collect(Collectors.toList());
-            List<Long> tagIds = new ArrayList<>();
-
-            if (!tagList.isEmpty()) {
-                //判断当前标签是否被当前登录用户拉黑
-                List<CommunityTagBlock> communityTagBlockList = communityTagBlocks
-                        .stream()
-                        .filter(item -> tagList.contains(item.getTagId()) && item.getUserId().equals(userId))
-                        .collect(Collectors.toList());
-                for (CommunityTagBlock tagBlock : communityTagBlockList) {
-                    if (tagBlock.isBlock()) {
-                        communityArticleVos.remove(articleVo);
-                        break;
-                    }
-                    tagIds.add(tagBlock.getTagId());
-                }
-
-                if (communityTagBlockList.isEmpty()) {
-                    tagIds.addAll(tagList);
-                }
-
-                if (!tagIds.isEmpty()) {
-                    List<CommunityTag> communityTagList = communityTags
-                            .stream()
-                            .filter(item -> tagIds.contains(item.getId()))
-                            .collect(Collectors.toList());
-                    articleVo.setTags(communityTagList);
-                }
-            }
-        }
-        return communityArticleVos;
-    }
-
-    /**
-     * 发布文章
-     *
-     * @param communityArticle 文章信息
-     */
-    @Override
-    public void insertCommunityArticle(CommunityArticle communityArticle) {
-
-        //判断是否传ID 如果有ID贼删除原来的文章 重新插入一条新文章
-        if (communityArticle.getId() != null) {
-            //增加字段 文章编辑字段
-            communityArticle.setIsDelete(true);
-
-            UpdateWrapper<CommunityArticle> updateWrapper = new UpdateWrapper<>();
-            updateWrapper.eq("id", communityArticle.getId());
-
-            // 创建一个新的 CommunityArticle 对象,只设置 isDelete 字段
-            CommunityArticle updateArticle = new CommunityArticle();
-            updateArticle.setIsDelete(communityArticle.getIsDelete());
-
-            communityArticleService.update(updateArticle, updateWrapper);
-
-            communityArticle.setParentId(communityArticle.getId());
-            communityArticle.setId(null);
-        }
-
-
-        Long userId = SecurityUtils.getLoginUser().getUserId();
-        //插入文章信息
-        communityArticle.setUserId(userId);
-        communityArticle.setCreateBy(userId);
-        communityArticle.setUpdateBy(userId);
-        communityArticle.setIsDelete(false);
-/*      communityArticle.setComment(false);
-        communityArticle.setDownload(false);
-        communityArticle.setRaffle(false);*/
-        communityArticle.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityArticle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-
-        String address = null;
-        try {
-            address = AddressUtils.getAddress(null);
-        } catch (ExecutionException e) {
-            throw new RuntimeException(e);
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        }
-        communityArticle.setAddress(address);
-
-        communityArticleMapper.insert(communityArticle);
-        //插入标签日志
-        List<String> tags = communityArticle.getTags();
-        if (tags != null && !tags.isEmpty()) {
-            CommunityArticleTag tagLog = null;
-            for (String tag : tags) {
-                tagLog = new CommunityArticleTag();
-                tagLog.setArticleId(communityArticle.getId());
-                tagLog.setTagId(Long.parseLong(tag));
-                tagLog.setUpdateBy(userId);
-                tagLog.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-                tagLog.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                tagLog.setCreateBy(userId);
-                articleTagMapper.insert(tagLog);
-
-                //标签热度自增
-                CommunityTag communityTag = communityTagMapper.selectById(Long.parseLong(tag));
-                communityTag.setTagHot(Objects.isNull(communityTag.getTagHot()) ? 1 : communityTag.getTagHot() + 1);
-                communityTag.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-                communityTag.setUpdateBy(userId);
-                communityTagMapper.updateById(communityTag);
-            }
-        }
-
-        //插入图片日志
-        List<CommunityImagesVo> images = communityArticle.getImages();
-        if (images != null && !images.isEmpty()) {
-            CommunityArticleImages articleImages = null;
-            for (CommunityImagesVo image : images) {
-                articleImages = new CommunityArticleImages();
-                articleImages.setArticleId(communityArticle.getId());
-                articleImages.setImageUrl(image.getImages());
-                articleImages.setCompressUrl(image.getCompressedImages());
-                articleImages.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                articleImages.setCreateBy(userId);
-                communityArticleImagesMapper.insert(articleImages);
-            }
-        }
-
-        //插入板块
-        List<Long> classIds = communityArticle.getClassIds();
-        if (classIds != null && !classIds.isEmpty()) {
-            List<CommunityArticleClass> articleClasses = new ArrayList<>();
-            CommunityArticleClass articleClass = null;
-            for (Long classId : classIds) {
-                articleClass = new CommunityArticleClass();
-                articleClass.setClassId(classId);
-                articleClass.setArticleId(communityArticle.getId());
-                articleClass.setCreateBy(userId);
-                articleClass.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                articleClasses.add(articleClass);
-            }
-            communityArticleClassService.saveBatch(articleClasses);
-        }
-
-        //插入合集
-        List<String> collectionIds = communityArticle.getCollectionIds();
-        if (collectionIds != null && !collectionIds.isEmpty()) {
-            List<CommunityCollectionArticle> collectionArticles = new ArrayList<>();
-            CommunityCollectionArticle collectionArticle = null;
-            for (String collectionId : collectionIds) {
-                collectionArticle = new CommunityCollectionArticle();
-                collectionArticle.setCollectionId(Long.parseLong(collectionId));
-                collectionArticle.setArticleId(communityArticle.getId());
-                collectionArticle.setCreateBy(userId);
-                collectionArticle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                collectionArticles.add(collectionArticle);
-            }
-            collectionArticleService.saveBatch(collectionArticles);
-        }
-
-
-        // at 人插入at通知表 判断是不是草稿箱 草稿箱不需要通知
-        if (communityArticle.getIsDraft() != null && !communityArticle.getIsDraft()) {
-            //拿到需要At人的ID
-            List<Long> atUserIds = communityArticle.getAtUserIds();
-            if (atUserIds != null && !atUserIds.isEmpty()) {
-                List<CommunityArticleAt> communityArticleAts = new ArrayList<>();
-                CommunityArticleAt communityArticleAt = null;
-                for (Long atUserId : atUserIds) {
-                    communityArticleAt = new CommunityArticleAt();
-                    communityArticleAt.setType(0L);
-                    communityArticleAt.setArticleId(communityArticle.getId());
-                    communityArticleAt.setUserId(userId);
-                    communityArticleAt.setPeerId(atUserId);
-                    communityArticleAt.setCreateBy(userId);
-                    communityArticleAt.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                    communityArticleAts.add(communityArticleAt);
-                }
-                communityArticleAtService.saveBatch(communityArticleAts);
-            }
-        }
-
-    }
-
-
-    /**
-     * 编辑文章
-     *
-     * @param communityArticle 文章信息
-     */
-    @Override
-    public void editCommunityArticle(CommunityArticle communityArticle) {
-
-        Long userId = SecurityUtils.getLoginUser().getUserId();
-        //编辑文章信息
-        communityArticle.setUpdateBy(userId);
-        communityArticle.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-
-
-        CommunityArticle article = communityArticleMapper.selectOne((new QueryWrapper<CommunityArticle>()
-                .eq("id", communityArticle.getId())
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true).or().isNull("is_delete");
-                })));
-
-        if (article != null) {
-            Integer pageViews = Math.toIntExact(article.getPageViews());
-            if (pageViews != null) {
-                communityArticle.setPageViews(pageViews);
-            } else {
-                // 处理 pageViews 为 null 的情况,比如设置为 0 或记录日志
-                communityArticle.setPageViews(0);
-            }
-        }
-
-        String address = null;
-        try {
-            address = AddressUtils.getAddress(null);
-        } catch (ExecutionException e) {
-            throw new RuntimeException(e);
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        }
-        communityArticle.setAddress(address);
-
-        communityArticleMapper.updateById(communityArticle);
-
-
-        //插入标签日志
-        List<String> tags = communityArticle.getTags();
-        if (tags != null && !tags.isEmpty()) {
-            //不在本次更新的标签都传失效
-            communityArticleTagMapper.update(
-                    null,
-                    new UpdateWrapper<CommunityArticleTag>()
-                            .eq("article_id", communityArticle.getId())
-                            .notIn("tag_id", tags)
-                            .set("is_delete", true)
-                            .and((wrapper) -> {
-                                wrapper.ne("is_delete", 1).or().isNull("is_delete");
-                            })
-            );
-
-            CommunityArticleTag tagLog = null;
-            for (String tag : tags) {
-
-                //查询该标签是否在数据库中存在
-                CommunityArticleTag communityArticleTag = communityArticleTagMapper.selectOne((new QueryWrapper<CommunityArticleTag>()
-                        .eq("article_id", communityArticle.getId())
-                        .eq("tag_id", tag)
-                        .and((wrapper) -> {
-                            wrapper.ne("is_delete", true).or().isNull("is_delete");
-                        })));
-                //不为空就不操作
-                if (communityArticleTag == null) {
-                    tagLog = new CommunityArticleTag();
-                    tagLog.setArticleId(communityArticle.getId());
-                    tagLog.setTagId(Long.parseLong(tag));
-                    tagLog.setUpdateBy(userId);
-                    tagLog.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-                    tagLog.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                    tagLog.setCreateBy(userId);
-                    articleTagMapper.insert(tagLog);
-
-                    //标签热度自增
-                    CommunityTag communityTag = communityTagMapper.selectById(Long.parseLong(tag));
-                    communityTag.setTagHot(Objects.isNull(communityTag.getTagHot()) ? 1 : communityTag.getTagHot() + 1);
-                    communityTag.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-                    communityTag.setUpdateBy(userId);
-                    communityTagMapper.updateById(communityTag);
-                }
-            }
-        }
-
-        //插入图片日志
-        List<CommunityImagesVo> images = communityArticle.getImages();
-
-        //插入图片日志 都失效
-        communityArticleImagesMapper.update(
-                null,
-                new UpdateWrapper<CommunityArticleImages>()
-                        .eq("article_id", communityArticle.getId())
-                        .set("is_delete", true)
-                        .and((wrapper) -> {
-                            wrapper.ne("is_delete", 1).or().isNull("is_delete");
-                        })
-        );
-
-        if (images != null && !images.isEmpty()) {
-            CommunityArticleImages articleImages = null;
-            for (CommunityImagesVo image : images) {
-                articleImages = new CommunityArticleImages();
-                articleImages.setArticleId(communityArticle.getId());
-                articleImages.setImageUrl(image.getImages());
-                articleImages.setCompressUrl(image.getCompressedImages());
-                articleImages.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                articleImages.setCreateBy(userId);
-                communityArticleImagesMapper.insert(articleImages);
-            }
-        }
-
-        //插入板块
-        List<Long> classIds = communityArticle.getClassIds();
-
-        //插入板块 都失效
-        communityArticleClassService.update(
-                null,
-                new UpdateWrapper<CommunityArticleClass>()
-                        .eq("article_id", communityArticle.getId())
-                        .set("is_delete", true)
-                        .and((wrapper) -> {
-                            wrapper.ne("is_delete", 1).or().isNull("is_delete");
-                        })
-        );
-
-        if (classIds != null && !classIds.isEmpty()) {
-            List<CommunityArticleClass> articleClasses = new ArrayList<>();
-            CommunityArticleClass articleClass = null;
-            for (Long classId : classIds) {
-                articleClass = new CommunityArticleClass();
-                articleClass.setClassId(classId);
-                articleClass.setArticleId(communityArticle.getId());
-                articleClass.setCreateBy(userId);
-                articleClass.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                articleClasses.add(articleClass);
-            }
-            communityArticleClassService.saveBatch(articleClasses);
-        }
-
-        //插入合集
-        List<String> collectionIds = communityArticle.getCollectionIds();
-
-        if (collectionIds != null && !collectionIds.isEmpty()) {
-            //插入合集 都失效
-            collectionArticleService.update(
-                    null,
-                    new UpdateWrapper<CommunityCollectionArticle>()
-                            .eq("article_id", communityArticle.getId())
-                            .eq("create_by", userId)
-                            .set("is_delete", true)
-                            .and((wrapper) -> {
-                                wrapper.ne("is_delete", 1).or().isNull("is_delete");
-                            })
-            );
-
-            List<CommunityCollectionArticle> collectionArticles = new ArrayList<>();
-            CommunityCollectionArticle collectionArticle = null;
-            for (String collectionId : collectionIds) {
-                collectionArticle = new CommunityCollectionArticle();
-                collectionArticle.setCollectionId(Long.parseLong(collectionId));
-                collectionArticle.setArticleId(communityArticle.getId());
-                collectionArticle.setCreateBy(userId);
-                collectionArticle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                collectionArticles.add(collectionArticle);
-            }
-            collectionArticleService.saveBatch(collectionArticles);
-        }
-
-
-        // at 人插入at通知表 判断是不是草稿箱 草稿箱不需要通知
-        if (communityArticle.getIsDraft() != null && !communityArticle.getIsDraft()) {
-            //拿到需要At人的ID
-            List<Long> atUserIds = communityArticle.getAtUserIds();
-
-            if (atUserIds != null && !atUserIds.isEmpty()) {
-                List<CommunityArticleAt> communityArticleAts = new ArrayList<>();
-                CommunityArticleAt communityArticleAt = null;
-                for (Long atUserId : atUserIds) {
-                    communityArticleAt = new CommunityArticleAt();
-                    communityArticleAt.setType(0L);
-                    communityArticleAt.setArticleId(communityArticle.getId());
-                    communityArticleAt.setUserId(userId);
-                    communityArticleAt.setPeerId(atUserId);
-                    communityArticleAt.setCreateBy(userId);
-                    communityArticleAt.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                    communityArticleAts.add(communityArticleAt);
-                }
-                communityArticleAtService.saveBatch(communityArticleAts);
-            }
-        }
-
-    }
-
-    /**
-     * 发送评论
-     *
-     * @param communityArticleComment 评论信息
-     */
-    @Override
-    public void sendComment(CommunityArticleComment communityArticleComment) throws ParseException {
-        communityArticleComment.setId(null);
-        communityArticleComment.setCreateBy(SecurityUtils.getLoginUser().getUserId());
-        communityArticleComment.setUpdateBy(SecurityUtils.getLoginUser().getUserId());
-        communityArticleComment.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityArticleComment.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityArticleComment.setDelete(false);
-        String address = null;
-        try {
-            address = AddressUtils.getAddress(null);
-        } catch (ExecutionException e) {
-            throw new RuntimeException(e);
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        }
-
-        communityArticleComment.setAddress(address);
-        communityArticleCommentMapper.insert(communityArticleComment);
-
-        //拿到需要At人的ID
-        List<Long> atUserIds = communityArticleComment.getAtUserIds();
-        if (atUserIds != null && !atUserIds.isEmpty()) {
-            List<CommunityArticleAt> communityArticleAts = new ArrayList<>();
-            CommunityArticleAt communityArticleAt = null;
-            for (Long atUserId : atUserIds) {
-                communityArticleAt = new CommunityArticleAt();
-                communityArticleAt.setType(1L);
-                communityArticleAt.setArticleId(communityArticleComment.getArticleId());
-                communityArticleAt.setCommentId(communityArticleComment.getId());
-                communityArticleAt.setUserId(SecurityUtils.getLoginUser().getUserId());
-                communityArticleAt.setPeerId(atUserId);
-                communityArticleAt.setCreateBy(SecurityUtils.getLoginUser().getUserId());
-                communityArticleAt.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                communityArticleAts.add(communityArticleAt);
-            }
-            communityArticleAtService.saveBatch(communityArticleAts);
-        }
-    }
-
-    /**
-     * 删除评论
-     *
-     * @param communityArticleComment 评论信息
-     */
-    @Override
-    public void deleteComment(CommunityArticleComment communityArticleComment) {
-        communityArticleComment.setDelete(true);
-        communityArticleComment.setUpdateBy(SecurityUtils.getUserId());
-        communityArticleComment.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityArticleCommentMapper.updateById(communityArticleComment);
-    }
-
-
-    /**
-     * 查询该文章对应的用户是否已经点赞
-     *
-     * @param communityLike 点赞信息
-     * @return 点赞信息
-     */
-    @Override
-    public CommunityLike selectCommunityLikeById(CommunityLike communityLike) {
-        QueryWrapper<CommunityLike> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("article_id", communityLike.getArticleId()).eq("user_id", communityLike.getUserId());
-        return communityLikeMapper.selectOne(queryWrapper);
-    }
-
-
-    /**
-     * 新增点赞
-     *
-     * @param communityLike 点赞信息
-     * @return 点赞是否成功
-     */
-    @Override
-    public boolean insertCommunityLikeById(CommunityLike communityLike) {
-        return communityLikeMapper.insert(communityLike) > 0;
-    }
-
-
-    /**
-     * 删除点赞
-     *
-     * @param communityLike 点赞信息
-     * @return 删除是否成功
-     */
-    @Override
-    public boolean deleteCommunityLikeById(CommunityLike communityLike) {
-        return communityLikeMapper.deleteById(communityLike.getId()) > 0;
-    }
-
-
-    /**
-     * 查询该文章对应的用户是否已经收藏
-     *
-     * @param collect 收藏信息
-     * @return 收藏信息
-     */
-    @Override
-    public CommunityArticleCollect selectCommunityCollectById(CommunityArticleCollect collect) {
-        return communityCollectMapper.selectOne(new QueryWrapper<CommunityArticleCollect>().eq("article_id", collect.getArticleId()).eq("user_id", SecurityUtils.getUserId()));
-    }
-
-    /**
-     * 新增收藏
-     *
-     * @param collect 收藏信息
-     * @return 收藏是否成功
-     */
-    @Override
-    public boolean insertCommunityCollectById(CommunityArticleCollect collect) {
-        return communityCollectMapper.insert(collect) > 0;
-    }
-
-    /**
-     * 删除收藏
-     *
-     * @param collect 收藏信息
-     * @return 删除是否成功
-     */
-    @Override
-    public boolean deleteCommunityCollectById(CommunityArticleCollect collect) {
-        return communityCollectMapper.deleteById(collect) > 0;
-    }
-
-
-    /**
-     * 根据板块获取圈子列表
-     *
-     * @param classId 板块id
-     * @return 圈子列表信息
-     */
-    @Override
-    public List<CommunityCircleVo> selectCommunityCircleList(String classId) {
-        List<CommunityClassCircle> classes = communityClassCircleMapper.selectList(new QueryWrapper<CommunityClassCircle>().eq("class_id", classId));
-        List<Long> circleIds = new ArrayList<>();
-        for (CommunityClassCircle aClass : classes) {
-            circleIds.add(aClass.getCircleId());
-        }
-
-        List<CommunityCircleVo> communityCircleVos = null;
-        if (!circleIds.isEmpty()) {
-            List<CommunityCircle> communityCircles = communityCircleMapper.selectBatchIds(circleIds);
-            //复制到Vo对象中
-            communityCircleVos = new ArrayList<>();
-            CommunityCircleVo communityCircleVo = null;
-            for (CommunityCircle communityCircle : communityCircles) {
-                communityCircleVo = new CommunityCircleVo();
-                BeanUtils.copyProperties(communityCircle, communityCircleVo);
-
-                //获取当前用户是否有关注这些圈子
-                CommunityUserCircle communityUserCircles = communityUserCircleMapper.selectOne(new QueryWrapper<CommunityUserCircle>().eq("circle_id", communityCircle.getId()).eq("user_id", SecurityUtils.getLoginUser().getUserId()).eq("is_delete", 0));
-                if (Objects.isNull(communityUserCircles) || Objects.isNull(communityUserCircles.getId())) {
-                    //没找到关注数据,则设为false,反之则true
-                    communityCircleVo.setLike(false);
-                } else {
-                    communityCircleVo.setLike(true);
-                }
-                communityCircleVos.add(communityCircleVo);
-            }
-        }
-        return communityCircleVos;
-    }
-
-    /**
-     * 关注或取消关注用户粉丝/关注
-     *
-     * @param likeUserId 被关注人id
-     * @return 登录用户关注信息
-     */
-    @Override
-    public CommunityUserLike addOrDeleteUserLike(Long likeUserId) {
-        Long userId = SecurityUtils.getLoginUser().getUserId();  // 当前登录用户id
-        //1.检查是否已被当前用户关注
-        CommunityUserLike communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>().eq("user_id", userId).eq("like_user_id", likeUserId));
-        //2.1 没有则进行关注,返回关注列表信息
-        if (Objects.isNull(communityUserLike) || Objects.isNull(communityUserLike.getId())) {
-            communityUserLike = new CommunityUserLike();
-            communityUserLike.setUserId(userId);
-            communityUserLike.setLikeUserId(likeUserId);
-            communityUserLike.setRead(false);
-            communityUserLike.setCreateBy(userId);
-            communityUserLike.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-            communityUserLikeMapper.insert(communityUserLike);
-
-            communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>().eq("user_id", userId).eq("like_user_id", likeUserId));
-            return communityUserLike;
-        }
-
-        //2.2 已关注则取消关注
-        communityUserLikeMapper.deleteById(communityUserLike);
-        return null;
-    }
-
-    /**
-     * 获取当前登录用户信息
-     *
-     * @param userId 用户id
-     * @return 用户信息
-     */
-    @Override
-    public CommunityUserInfoVo selectCommunityUserInfoById(Long userId, boolean isToken) {
-        SysUser sysUser = sysUserMapper.selectUserById(userId);
-
-        System.out.println(sysUser);
-        CommunityUserInfo communityUserInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", userId));
-        CommunityUserInfoVo communityUserInfoVo = new CommunityUserInfoVo();
-        BeanUtils.copyProperties(communityUserInfo, communityUserInfoVo);
-        communityUserInfoVo.setAvatar(sysUser.getAvatar());
-        communityUserInfoVo.setNickName(sysUser.getNickName());
-        communityUserInfoVo.setSex(sysUser.getSex());
-        communityUserInfoVo.setUserId(userId);
-        communityUserInfoVo.setUserState(sysUser.getUserState());
-        communityUserInfoVo.setReportTime(sysUser.getReportTime());
-
-        //设置关注,粉丝,陪伴天数 文章数量
-        communityUserInfoVo.setLikeCount(communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>().eq("user_id", userId)).size());
-        communityUserInfoVo.setFansCount(communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>().eq("like_user_id", userId)).size());
-
-        Date createTime = sysUser.getCreateTime();
-        // 将 Date 对象转换为 LocalDate 对象
-        LocalDate localCreateTime = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
-        // 获取当前日期
-        LocalDate today = LocalDate.now();
-        // 计算两个日期之间的天数差
-        long daysDifference = ChronoUnit.DAYS.between(localCreateTime, today);
-        communityUserInfoVo.setCompanionCount((int) daysDifference);
-
-        communityUserInfoVo.setArticleCount(communityArticleMapper.selectList(new QueryWrapper<CommunityArticle>()
-                .eq("user_id", userId)
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true).or().isNull("is_delete");
-                })).size());
-
-
-        String address = null;
-        try {
-            address = AddressUtils.getAddress(sysUser.getLoginIp());
-        } catch (ExecutionException e) {
-            throw new RuntimeException(e);
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        }
-        communityUserInfoVo.setAddress(address);
-        //设置是否被当前登录的用户关注
-        communityUserInfoVo.setLike(false);
-        if (isToken) {
-            Long loginUserId = SecurityUtils.getLoginUser().getUserId();
-            if (!Objects.equals(userId, loginUserId)) {
-                CommunityUserLike communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>().eq("user_id", loginUserId).eq("like_user_id", userId));
-                if (!Objects.isNull(communityUserLike) && !Objects.isNull(communityUserLike.getId())) {
-                    communityUserInfoVo.setLike(true);
-                }
-            }
-        }
-        return communityUserInfoVo;
-    }
-
-    /**
-     * 根据条件搜索用户列表信息(无权限卡控)
-     *
-     * @param searchValue 搜索值
-     * @return 用户
-     */
-    @Override
-    public List<CommunityUserInfoVo> selectUserBySearchValue(@Param("searchValue") String searchValue,
-                                                             @Param("offset") int offset,
-                                                             @Param("limit") int limit) {
-        return communityUserInfoMapper.selectUserBySearchValue(searchValue, offset, limit);
-    }
-
-    @Override
-    public List<CommunityUserInfoVo> selectBlockUserBySearchValue(@Param("searchValue") String searchValue,
-                                                                  @Param("userId") Long userId,
-                                                                  @Param("offset") int offset,
-                                                                  @Param("limit") int limit) {
-        return communityUserInfoMapper.selectBlockUserBySearchValue(searchValue, userId, offset, limit);
-    }
-
-    /**
-     * 根据条件搜索用户列表信息(有权限卡控)
-     *
-     * @param searchValue 搜索值
-     * @return 用户
-     */
-    @Override
-    public List<CommunityUserInfoVo> selectUsersByAccountOrName(@Param("searchValue") String searchValue,
-                                                                @Param("offset") int offset,
-                                                                @Param("limit") int limit) {
-        List<CommunityUserInfoVo> communityUserInfoVos = communityUserInfoMapper.selectUsersByAccountOrName(searchValue, offset, limit);
-        communityUserInfoVos.forEach(item -> {
-            CommunityUserLike communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>()
-                    .eq("user_id", SecurityUtils.getUserId())
-                    .eq("like_user_id", item.getUserId()));
-
-            if (Objects.nonNull(communityUserLike)) {
-                item.setLike(true);
-            }
-        });
-        return communityUserInfoVos;
-    }
-
-
-    /**
-     * 获取关注列表
-     *
-     * @param userId 登录用户id
-     * @return 当前用户关注列表
-     */
-    @Override
-    public List<CommunityUserLikeVo> selectCommunityUserLikeList(Long userId, String userName, int pageNum, int pageSize, int searchType) {
-        int offset = (pageNum - 1) * pageSize;
-//        Page<CommunityUserLike> page = new Page<>(pageNum, pageSize);
-//        QueryWrapper<CommunityUserLike> queryWrapper = new QueryWrapper<CommunityUserLike>()
-//                .eq("user_id", userId);
-//        if (searchType == 1) {
-//            queryWrapper.orderByDesc("create_time");
-//        } else {
-//            queryWrapper.orderByAsc("create_time");
-//        }
-//
-//        List<CommunityUserLike> communityUserLikes = communityUserLikeMapper.selectPage(page, queryWrapper).getRecords();
-
-        List<CommunityUserLike> communityUserLikes = communityUserLikeMapper.selectUserLikeList(userId, offset, pageSize, userName, searchType);
-
-        List<CommunityUserLikeVo> communityUserLikeVos = new ArrayList<>();
-        CommunityUserLikeVo communityUserLikeVo = null;
-        Boolean isCare = false;
-
-        for (CommunityUserLike communityUserLike : communityUserLikes) {
-            communityUserLikeVo = new CommunityUserLikeVo();
-            //用户信息
-            SysUser sysUserLike = sysUserMapper.selectUserById(communityUserLike.getLikeUserId());
-            SysUser sysUser = sysUserMapper.selectUserById(communityUserLike.getUserId());
-            //用户自我介绍
-            CommunityUserInfo userInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", communityUserLike.getUserId()));
-            CommunityUserInfo likeUserInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", communityUserLike.getLikeUserId()));
-            BeanUtils.copyProperties(communityUserLike, communityUserLikeVo);
-
-            //关注的用户是否已经关注当前用户
-            CommunityUserLike communityUserLikeFans = communityUserLikeMapper.selectOne(
-                    new QueryWrapper<CommunityUserLike>()
-                            .eq("like_user_id", userId)
-                            .eq("user_id", communityUserLike.getLikeUserId()));
-
-            if (communityUserLikeFans != null) {
-                isCare = true;
-            }
-            communityUserLikeVo.setIsCare(isCare);
-
-            if (Objects.nonNull(userInfo)) {
-                communityUserLikeVo.setProfile(userInfo.getProfile());
-            }
-
-            if (Objects.nonNull(likeUserInfo)) {
-                communityUserLikeVo.setLikeProfile(likeUserInfo.getProfile());
-            }
-
-            if (Objects.nonNull(sysUser)) {
-                communityUserLikeVo.setAvatar(sysUser.getAvatar());
-                communityUserLikeVo.setUsername(sysUser.getNickName());
-            }
-
-            if (Objects.nonNull(sysUserLike)) {
-                communityUserLikeVo.setLikeUsername(sysUserLike.getNickName());
-                communityUserLikeVo.setLikeAvatar(sysUserLike.getAvatar());
-            }
-
-            //如果不需要搜索名字直接添加
-//            if (userName != null && communityUserLikeVo.getLikeUsername().matches("(?i).*" + Pattern.quote(userName) + ".*")) {
-//                communityUserLikeVos.add(communityUserLikeVo);
-//            } else if (userName == null) {
-//                communityUserLikeVos.add(communityUserLikeVo);
-//            }
-            communityUserLikeVos.add(communityUserLikeVo);
-        }
-        return communityUserLikeVos;
-    }
-
-
-    /**
-     * 获取粉丝列表
-     *
-     * @param userId 登录用户id
-     * @return 当前用户粉丝列表
-     */
-    @Override
-    public List<CommunityUserLikeVo> selectUserFansList(Long userId, String userName, int pageNum, int pageSize, int searchType) {
-        //int offset = (pageNum - 1) * pageSize;
-        Page<CommunityUserLike> page = new Page<>(pageNum, pageSize);
-        QueryWrapper<CommunityUserLike> queryWrapper = new QueryWrapper<CommunityUserLike>()
-                .eq("like_user_id", userId);
-        if (searchType == 1) {
-            queryWrapper.orderByDesc("create_time");
-        } else {
-            queryWrapper.orderByAsc("create_time");
-        }
-
-        List<CommunityUserLike> communityUserLikes = communityUserLikeMapper.selectPage(page, queryWrapper).getRecords();
-
-        List<CommunityUserLikeVo> communityUserLikeVos = new ArrayList<>();
-        CommunityUserLikeVo communityUserLikeVo = null;
-
-        for (CommunityUserLike communityUserLike : communityUserLikes) {
-            Boolean isCare = false;
-            // System.out.println(communityUserLike.getUserId()  + "---" + userId);
-            //用户信息
-            SysUser sysUserLike = sysUserMapper.selectUserById(communityUserLike.getLikeUserId());
-            //用户自我介绍
-            CommunityUserInfo userInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", communityUserLike.getUserId()));
-            CommunityUserInfo likeUserInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", communityUserLike.getLikeUserId()));
-
-
-            //用户是否关注当前用户
-            CommunityUserLike communityUserLikeFans = communityUserLikeMapper.selectOne(
-                    new QueryWrapper<CommunityUserLike>()
-                            .eq("like_user_id", communityUserLike.getUserId())
-                            .eq("user_id", userId));
-
-            if (communityUserLikeFans != null) {
-                isCare = true;
-            }
-            communityUserLikeVo = new CommunityUserLikeVo();
-            BeanUtils.copyProperties(communityUserLike, communityUserLikeVo);
-            SysUser sysUser = sysUserMapper.selectUserById(communityUserLike.getUserId());
-
-            communityUserLikeVo.setIsCare(isCare);
-
-
-            if (Objects.nonNull(sysUser)) {
-                communityUserLikeVo.setAvatar(sysUser.getAvatar());
-                communityUserLikeVo.setUsername(sysUser.getNickName());
-            }
-
-            if (Objects.nonNull(userInfo)) {
-                communityUserLikeVo.setProfile(userInfo.getProfile());
-            }
-
-            if (Objects.nonNull(sysUserLike)) {
-                communityUserLikeVo.setLikeUsername(sysUserLike.getNickName());
-                communityUserLikeVo.setLikeAvatar(sysUserLike.getAvatar());
-            }
-
-            if (Objects.nonNull(likeUserInfo)) {
-                communityUserLikeVo.setLikeProfile(likeUserInfo.getProfile());
-            }
-            //如果不需要搜索名字直接添加
-            if (userName != null && communityUserLikeVo.getUsername().matches("(?i).*" + Pattern.quote(userName) + ".*")) {
-                communityUserLikeVos.add(communityUserLikeVo);
-            } else if (userName == null) {
-                communityUserLikeVos.add(communityUserLikeVo);
-            }
-
-        }
-        return communityUserLikeVos;
-    }
-
-    /**
-     * 获取互相关注列表
-     *
-     * @param userId 登录用户id
-     * @return 获取互相关注列表
-     */
-    @Override
-    public List<CommunityUserLikeVo> selectMutualAttention(Long userId, String userName, int pageNum, int pageSize, int searchType) {
-
-        //先查询自己关注的人
-        List<CommunityUserLikeVo> communityUserLikeVos = selectCommunityUserLikeList(userId, null, 1, 10000000, 0);
-        //再查询被关注的人是否关注自己
-        List<Long> likeUserIds = new ArrayList<>();
-        for (CommunityUserLikeVo communityUserLikeVo : communityUserLikeVos) {
-            likeUserIds.add(communityUserLikeVo.getLikeUserId());
-        }
-
-        if (!likeUserIds.isEmpty()) {
-            QueryWrapper<CommunityUserLike> queryWrapper = new QueryWrapper<CommunityUserLike>()
-                    .in("user_id", likeUserIds).eq("like_user_id", userId);
-            if (searchType == 1) {
-                queryWrapper.orderByDesc("create_time");
-            } else {
-                queryWrapper.orderByAsc("create_time");
-            }
-            //分页查询数据
-            //int offset = (pageNum - 1) * pageSize;
-            Page<CommunityUserLike> page = new Page<>(pageNum, pageSize);
-
-            List<CommunityUserLike> communityUserLikes = communityUserLikeMapper.selectPage(page, queryWrapper).getRecords();
-
-            System.out.println("communityUserLikes: " + communityUserLikes);
-            CommunityUserLikeVo communityUserLikeVo = null;
-            communityUserLikeVos = new ArrayList<>();
-            for (CommunityUserLike communityUserLike : communityUserLikes) {
-                //用户信息
-                SysUser sysUserLike = sysUserMapper.selectUserById(communityUserLike.getLikeUserId());
-                //用户自我介绍
-                CommunityUserInfo userInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", communityUserLike.getUserId()));
-                CommunityUserInfo likeUserInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", communityUserLike.getLikeUserId()));
-
-                communityUserLikeVo = new CommunityUserLikeVo();
-                BeanUtils.copyProperties(communityUserLike, communityUserLikeVo);
-                SysUser sysUser = sysUserMapper.selectUserById(communityUserLike.getUserId());
-                communityUserLikeVo.setProfile(userInfo.getProfile());
-                communityUserLikeVo.setAvatar(sysUser.getAvatar());
-                communityUserLikeVo.setUsername(sysUser.getNickName());
-                communityUserLikeVo.setLikeUsername(sysUserLike.getNickName());
-                communityUserLikeVo.setLikeAvatar(sysUserLike.getAvatar());
-                communityUserLikeVo.setLikeProfile(likeUserInfo.getProfile());
-                communityUserLikeVo.setIsCare(true);
-
-
-                //如果不需要搜索名字直接添加
-                if (userName != null && communityUserLikeVo.getUsername().matches("(?i).*" + Pattern.quote(userName) + ".*")) {
-                    communityUserLikeVos.add(communityUserLikeVo);
-                } else if (userName == null) {
-                    communityUserLikeVos.add(communityUserLikeVo);
-                }
-
-
-            }
-        }
-        return communityUserLikeVos;
-    }
-
-    /**
-     * 判断评论的人 是否在文章作者的关注列表中
-     *
-     * @param userId    必填
-     * @param commentId 可选  评论的评论接口
-     * @param articleId 可选  文章评论接口
-     * @return true or false
-     * @throws ParseException
-     */
-    @Override
-    public Boolean checkCommentPermission(Long userId, Long commentId, Long articleId) throws ParseException {
-        /**
-         * 1.传commentId 说明是 评论的评论接口
-         * 2.传articleId 说明是文章评论接口
-         * 3.询隐私设置表 communityPrivacyService.selectUserPrivacy 权限有没有开启
-         * 4.没有开启 直接结束
-         * 5.开启 查询作者关注列表
-         * 6。是否是关注的人评论我 有则评论成功,没有则返回失败
-         */
-        //假设传的评论ID 根据 评论ID要找到文章ID
-        if (articleId == null) {
-            List<CommunityArticleComment> communityArticleComments
-                    = communityArticleCommentMapper
-                    .selectList(new QueryWrapper<CommunityArticleComment>().eq("id", commentId));
-            CommunityArticleComment communityArticleComment = communityArticleComments.get(0);
-            articleId = communityArticleComment.getArticleId();
-        }
-        ;
-
-        //获取文章信息 找到文章创建人
-        List<CommunityArticle> communityArticles
-                = communityArticleMapper
-                .selectList(new QueryWrapper<CommunityArticle>().eq("id", articleId));
-
-        // 提取用户ID
-        Long articleUserId = null; // 初始化用户ID
-
-        if (!communityArticles.isEmpty()) { // 检查列表是否为空
-            CommunityArticle article = communityArticles.get(0); // 获取第一个文章
-            articleUserId = article.getUserId(); // 假设CommunityArticle有getUserId()方法
-        } else {
-            // 处理未找到文章的情况
-            // 例如,可以抛出异常或记录日志
-            return false;
-        }
-
-        // 直接允许作者评论
-        if (articleUserId.equals(userId)) {
-           /* // 如果评论者是文章作者,直接进行评论
-            communityArticleService.sendComment(communityArticleComment);*/
-            return true;
-        }
-
-        // 查询隐私设置
-        List<CommunityUserPrivacyVo> communityUserPrivacyVos = communityPrivacyService.selectUserPrivacy(articleUserId);
-        // 检查隐私设置 只允许我关注的人评论我
-        boolean IsComment = false;
-        for (CommunityUserPrivacyVo privacyVo : communityUserPrivacyVos) {
-            if (privacyVo.getIsComment() != null && privacyVo.getIsComment()) {
-                IsComment = true; // 只允许特定用户评论
-                break;
-            }
-        }
-        // 如果评论受限,则查询用户关注列表
-        if (IsComment) {
-            List<CommunityUserLikeVo> communityUserLikeVos = communityArticleService.selectCommunityUserLikeList(articleUserId, null, 1, 100000, 0);
-            // 3. 检查评论者是否在关注列表中
-            boolean isFollower = communityUserLikeVos.stream()
-                    .anyMatch(like -> like.getLikeUserId().equals(userId));
-            System.out.println(userId);
-            // 如果不是关注者,返回失败
-            if (!isFollower) {
-                //return AjaxResult.error("您没有权限评论此文章,因为只允许关注的人评论您!");
-                return false;
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public List<TrendingTop> selectTrendingTopByContent(String content) {
-        return communityArticleMapper.selectTrendingTopByContent(content);
-    }
-
-
-    /**
-     * 个人中心简介信息
-     *
-     * @param userId
-     * @return
-     */
-    @Override
-    public List<CommunityUserPromptVo> selectCommunityUserPrompt(Long userId) {
-        if (Objects.isNull(userId)) {
-            userId = SecurityUtils.getLoginUser().getUserId();
-        }
-        // 查询自己的通知列表
-        List<CommunityUserPrompt> communityUserPrompts
-                = communityUserPromptMapper
-                .selectList(new QueryWrapper<CommunityUserPrompt>().eq("user_id", userId));
-
-
-        // 创建一个用于存放VO的列表
-        List<CommunityUserPromptVo> communityUserPromptVos = new ArrayList<>();
-        // 遍历查询结果,复制属性到 VO 对象
-        for (CommunityUserPrompt communityUserPrompt : communityUserPrompts) {
-            CommunityUserPromptVo communityUserPromptVo = new CommunityUserPromptVo();
-            BeanUtils.copyProperties(communityUserPrompt, communityUserPromptVo);
-            communityUserPromptVos.add(communityUserPromptVo);
-        }
-        // 判断隐私权限是否为空
-        if (communityUserPromptVos.isEmpty()) {
-            // 如果没有隐私权限,插入一条关于 userId 的数据
-            CommunityUserPrompt newPrompt = new CommunityUserPrompt();
-            newPrompt.setUserId(userId);
-            newPrompt.setLikeUser(false);
-            newPrompt.setCommentCircle(false);
-            newPrompt.setLikeCollect(false);
-            // 设置其他必要的默认值,例如:
-            // 使用 MyBatis-Plus 执行插入操作
-            communityUserPromptMapper.insert(newPrompt);
-            // 将新插入的记录转换为 VO 并返回
-            CommunityUserPromptVo newPromptVo = new CommunityUserPromptVo();
-            BeanUtils.copyProperties(newPrompt, newPromptVo);
-            communityUserPromptVos.add(newPromptVo);
-        }
-        return communityUserPromptVos;
-    }
-
-    // 修改service实现
-    @Override
-    public List<CommunityArticleVo> selectUserNoCo(Long userId, int pageNum, int pageSize, int searchType) {
-        //PageHelper.startPage(pageNum, pageSize);
-        return communityArticleMapper.selectUserNoCoArticles(userId);
-    }
-
-    @Override
-    public List<CommunityArticleVo> selectUserLike(Long userId, int pageNum, int pageSize, int searchType) {
-        // 查询的喜欢列表
-        List<CommunityLike> communityUserLike
-                = communityLikeMapper
-                .selectList(new QueryWrapper<CommunityLike>().eq("user_id", userId));
-        List<Long> articleIds = communityUserLike.stream().map(item -> item.getArticleId()).collect(Collectors.toList());
-        TableDataInfo rspData = null;
-        CommunityArticle communityArticle = null;
-        List<CommunityArticleVo> communityArticleVos = null;
-        if (!articleIds.isEmpty()) {
-            rspData = new TableDataInfo();
-            communityArticle = new CommunityArticle();
-            communityArticle.setArticleIds(articleIds);
-            communityArticleVos = communityArticleService.selectCommunityArticleList(userId, rspData, communityArticle, pageNum, pageSize, searchType);
-        }
-        return communityArticleVos;
-    }
-
-    @Override
-    public List<CommunityArticleVo> selectUserCollect(Long userId, int pageNum, int pageSize, int searchType) {
-        // 查询收藏的列表
-        List<CommunityArticleCollect> communityArticleCollects
-                = communityArticleCollectMapper
-                .selectList(new QueryWrapper<CommunityArticleCollect>().eq("user_id", userId));
-
-
-        List<Long> articleIds = communityArticleCollects.stream().map(item -> item.getArticleId()).collect(Collectors.toList());
-        TableDataInfo rspData = null;
-        CommunityArticle communityArticle = null;
-        List<CommunityArticleVo> communityArticleVos = null;
-        if (!articleIds.isEmpty()) {
-            rspData = new TableDataInfo();
-            communityArticle = new CommunityArticle();
-            communityArticle.setArticleIds(articleIds);
-            communityArticleVos = communityArticleService.selectCommunityArticleList(userId, rspData, communityArticle, pageNum, pageSize, searchType);
-        }
-        return communityArticleVos;
-    }
-
-    /**
-     * 开启抽奖
-     *
-     * @param articleId
-     * @return
-     */
-    @Override
-    public CommunityCommentRaffleVo selectCommentRaffle(Long articleId) {
-        CommunityCommentRaffle communityCommentRaffle = communityCommentRaffleMapper.selectOne(
-                new QueryWrapper<CommunityCommentRaffle>()
-                        .eq("article_id", articleId)
-                        .and((wrapper) -> {
-                            wrapper.ne("is_delete", true).or().isNull("is_delete");
-                        }));
-
-        CommunityCommentRaffleVo communityCommentRaffleVo = new CommunityCommentRaffleVo();
-        CommunityUserInfoVo communityUserInfoVo = null;
-        //如果抽奖表为空则需要插入一条数据
-        if (communityCommentRaffle == null) {
-            List<CommunityArticleComment> communityArticleComments = communityArticleCommentMapper.selectList(new QueryWrapper<CommunityArticleComment>()
-                    .eq("article_id", articleId)
-                    .and((wrapper) -> {
-                        wrapper.ne("is_delete", true).or().isNull("is_delete");
-                    })
-            );
-            if (communityArticleComments.size() == 0) {
-                return communityCommentRaffleVo;
-            }
-            // 使用 Random 类生成一个随机索引
-            Random random = new Random();
-            int randomIndex = random.nextInt(communityArticleComments.size());
-            CommunityArticleComment communityArticleComment = communityArticleComments.get(randomIndex);
-            CommunityCommentRaffle commentRaffle = new CommunityCommentRaffle();
-            commentRaffle.setArticleId(communityArticleComment.getArticleId());
-            commentRaffle.setCommentId(communityArticleComment.getId());
-            commentRaffle.setUserId(communityArticleComment.getUserId());
-            commentRaffle.setCreateBy(SecurityUtils.getUserId());
-            commentRaffle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-            communityCommentRaffleMapper.insert(commentRaffle);
-            BeanUtils.copyProperties(commentRaffle, communityCommentRaffleVo);
-            communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(commentRaffle.getUserId(), true);
-            communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
-            communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
-            return communityCommentRaffleVo;
-        }
-
-        BeanUtils.copyProperties(communityCommentRaffle, communityCommentRaffleVo);
-        communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(communityCommentRaffle.getUserId(), true);
-        communityCommentRaffleVo.setUserName(communityUserInfoVo.getNickName());
-        communityCommentRaffleVo.setUserAvatar(communityUserInfoVo.getAvatar());
-        return communityCommentRaffleVo;
-    }
-
-
-    /**
-     * 判断是否是视频文件
-     *
-     * @param fileUrl 文件地址
-     * @return 结果
-     */
-    public static boolean isVideoFile(String fileUrl) {
-        try {
-            // 打开 HTTP 连接
-            URL url = new URL(fileUrl);
-            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-            connection.setRequestMethod("GET");
-
-            // 获取文件类型
-            String mimeType = connection.getContentType();
-
-            // 判断是否为视频类型
-            return mimeType != null && mimeType.startsWith("video");
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-}

+ 0 - 10
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleTagImpl.java

@@ -1,10 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityArticleTag;
-import com.ruoyi.generator.mapper.community.CommunityArticleTagMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityArticleTagImpl extends ServiceImpl<CommunityArticleTagMapper, CommunityArticleTag> implements ICommunityArticleTagService {
-}

+ 0 - 16
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionArticleImpl.java

@@ -1,16 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityCollectionArticle;
-import com.ruoyi.generator.mapper.community.CommunityArticleTagMapper;
-import com.ruoyi.generator.mapper.community.CommunityCollectionArticleMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class CommunityCollectionArticleImpl extends ServiceImpl<CommunityCollectionArticleMapper, CommunityCollectionArticle> implements ICommunityCollectionArticleService {
-
-
-}

+ 0 - 308
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionServiceImpl.java

@@ -1,308 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.alibaba.fastjson2.JSONArray;
-import com.alibaba.fastjson2.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.generator.domain.Community.*;
-import com.ruoyi.generator.mapper.community.*;
-import com.ruoyi.generator.vo.CommunityCollectionArticleVo;
-import com.ruoyi.generator.vo.CommunityCollectionVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.stream.Collectors;
-
-@Service
-public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollectionMapper, CommunityCollection> implements ICommunityCollectionService {
-
-    @Autowired
-    private CommunityCollectionArticleMapper collectionArticleMapper;
-
-    @Autowired
-    private CommunityArticleMapper communityArticleMapper;
-
-    @Autowired
-    private CommunityLikeMapper communityLikeMapper;
-
-    @Autowired
-    private CommunityArticleCommentMapper communityArticleCommentMapper;
-
-    @Autowired
-    private CommunityArticleImagesMapper communityArticleImagesMapper;
-
-    @Autowired
-    private CommunityCollectionMapper communityCollectionMapper;
-
-    @Autowired
-    private CommunityCollectionArticleMapper communityCollectionArticleMapper;
-    @Autowired
-    private CommunityCollectionUserMapper communityCollectionUserMapper;
-
-    /**
-     * 添加文章到用户合集中
-     *
-     * @param collectionArticle 合集列表
-     */
-    @Override
-    public void addArticleToCollection(CommunityCollectionArticle collectionArticle) {
-        collectionArticleMapper.insert(collectionArticle);
-    }
-
-    /**
-     * 删除合集中的某个文章
-     *
-     * @param collectionId 合集id
-     * @param articleId    文章id
-     */
-    @Override
-    public void deleteArticleToCollection(Long collectionId, Long articleId) {
-        //删除合集中的文章
-        CommunityCollectionArticle collectionArticle = new CommunityCollectionArticle();
-        collectionArticle.setDelete(true);
-        collectionArticle.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-        collectionArticle.setUpdateBy(SecurityUtils.getUserId());
-        communityCollectionArticleMapper.update(collectionArticle, new UpdateWrapper<CommunityCollectionArticle>()
-                .eq("collection_id", collectionId)
-                .eq("article_id", articleId).and((wrapper) -> {
-                    wrapper.ne("is_delete", true)
-                            .or()
-                            .isNull("is_delete");
-                }));
-    }
-
-    /**
-     * 根据合集id,查询合集下所有文章信息
-     *
-     * @param collectionId 合集id
-     * @return 文章信息
-     */
-    @Override
-    public JSONArray selectArticleInfoInCollection(Long userId,Long collectionId, Long searchType) {
-        if (searchType == null) {
-            searchType = 1L;
-        }
-        JSONArray jsonArray = new JSONArray();
-        List<CommunityCollectionArticleVo> collectionArticleVos = new ArrayList<>();
-        //查询合集表
-        CommunityCollection communityCollection = communityCollectionMapper.selectOne(new QueryWrapper<CommunityCollection>()
-                .eq("id", collectionId)
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true)
-                            .or()
-                            .isNull("is_delete");
-                }));
-
-        if (communityCollection == null) {
-            return null;
-        }
-        //没调用这一个接口 热度 + 1
-        UpdateWrapper<CommunityCollection> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("id", collectionId)
-                .and(w -> w.ne("is_delete", true).or().isNull("is_delete"));
-        updateWrapper.setSql("heat = IFNULL(heat, 0) + 1");
-        communityCollectionMapper.update(null, updateWrapper);
-
-        //一级层级
-        JSONObject collectionObject = new JSONObject();
-        collectionObject.put("CollectionName", communityCollection.getCollectionName());
-        Date updateTime = communityCollection.getUpdateTime();
-        if (updateTime == null) {
-            updateTime = communityCollection.getCreateTime();
-        }
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String formattedUpdateTime = sdf.format(updateTime);
-        collectionObject.put("collectioncreateby", communityCollection.getCreateBy());
-        collectionObject.put("collectionProfile", communityCollection.getCollectionProfile());
-        collectionObject.put("updateTime", formattedUpdateTime);
-        collectionObject.put("collectionImageUrl",communityCollection.getImages());
-        collectionObject.put("collectionTag",communityCollection.getCollectionTag());
-        collectionObject.put("followNumber", communityCollectionUserMapper.selectList(new QueryWrapper<CommunityCollectionUser>().eq("collection_id", collectionId).and((wrapper) -> {
-            wrapper.ne("is_delete", true)
-                    .or()
-                    .isNull("is_delete");
-        })).size());
-        collectionObject.put("heat", communityCollection.getHeat());
-        //浏览量设置默认值
-        collectionObject.put("articlePageViews",0);
-        collectionObject.put("articleNumber", 0);
-        collectionObject.put("articleNumber", 0);
-
-
-        //查询当前用户是否订阅
-        CommunityCollectionUser communityCollectionUser = communityCollectionUserMapper.selectOne(new QueryWrapper<CommunityCollectionUser>()
-                .eq("collection_id", collectionId)
-                .eq("user_id", userId)
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true)
-                            .or()
-                            .isNull("is_delete");
-                }));
-        boolean follow = false;
-        if (communityCollectionUser != null) {
-            follow = true;
-        }
-        collectionObject.put("follow", follow);
-        collectionObject.put("Article", collectionArticleVos);
-        //查询合集关联文章表
-        List<Object> articleIdsObj = collectionArticleMapper
-                .selectObjs(new QueryWrapper<CommunityCollectionArticle>()
-                        .select("article_id")
-                        .eq("collection_id", collectionId)
-                        .and((wrapper) -> {
-                            wrapper.ne("is_delete", true)
-                                    .or()
-                                    .isNull("is_delete");
-                        }));
-
-        if (articleIdsObj.isEmpty()) {
-            return JSONArray.of(collectionObject);
-        }
-
-        //转换object为long
-        List<Long> articleIds = articleIdsObj.stream()
-                .filter(item -> item instanceof Long)
-                .map(item -> (Long) item)
-                .collect(Collectors.toList());
-
-
-        List<CommunityArticle> communityArticles;
-
-        if (searchType == 1) {
-            // 查询最新的文章
-            communityArticles = communityArticleMapper.selectList(
-                    new QueryWrapper<CommunityArticle>().in("id", articleIds)
-                            .and((wrapper) -> {wrapper.ne("is_delete", true)
-                                .or()
-                                .isNull("is_delete");
-                    }).and((wrapper) -> {
-                                wrapper.ne("is_draft", true)
-                                        .or()
-                                        .isNull("is_draft");
-                            })
-                            .orderByDesc("create_time"));
-        } else {
-            // 查询最早的文章
-            communityArticles = communityArticleMapper.selectList(
-                    new QueryWrapper<CommunityArticle>().in("id", articleIds).and((wrapper) -> {
-                        wrapper.ne("is_delete", true)
-                                .or()
-                                .isNull("is_delete");
-                    }).and((wrapper) -> {
-                                wrapper.ne("is_draft", true)
-                                        .or()
-                                        .isNull("is_draft");
-                            })
-                            .orderByAsc("create_time"));
-        }
-        collectionObject.put("articleNumber", communityArticles.size());
-
-        //获取浏览量总数
-        collectionObject.put("articlePageViews",communityArticles.stream()
-                .mapToLong(CommunityArticle::getPageViews)
-                .sum());
-
-
-        CommunityCollectionArticleVo collectionArticleVo = null;
-        for (CommunityArticle communityArticle : communityArticles) {
-            collectionArticleVo = new CommunityCollectionArticleVo();
-            collectionArticleVo.setArticleId(communityArticle.getId());
-            collectionArticleVo.setCollectionId(collectionId);
-            collectionArticleVo.setTitle(communityArticle.getTitle());
-            collectionArticleVo.setArticleCreateTime(communityArticle.getCreateTime());
-            collectionArticleVo.setContent(communityArticle.getContent());
-
-            collectionArticleVo.setPageViews(communityArticle.getPageViews());
-            //设置用户点赞数
-            int likeCount = communityLikeMapper.selectCount(new QueryWrapper<CommunityLike>().eq("article_id", communityArticle.getId())).intValue();
-            collectionArticleVo.setLikeCount(likeCount);
-            //设置用户评论数
-            int commentCount = communityArticleCommentMapper.selectCount(new QueryWrapper<CommunityArticleComment>().eq("article_id", communityArticle.getId()).and((wrapper) -> {
-                wrapper.ne("is_delete", true)
-                        .or()
-                        .isNull("is_delete");
-            })).intValue();
-            collectionArticleVo.setCommentCount(commentCount);
-            //设置文章封面
-            List<CommunityArticleImages> articleImages = communityArticleImagesMapper.selectList(new QueryWrapper<CommunityArticleImages>()
-                    .select("image_url")
-                    .eq("article_id", communityArticle.getId()));
-            if (!articleImages.isEmpty()) {
-                if ( articleImages.get(0) != null ) {
-                    String imageUrl = articleImages.get(0).getImageUrl();
-                    collectionArticleVo.setImageUrl(imageUrl);
-                }
-            }
-
-            collectionArticleVos.add(collectionArticleVo);
-        }
-
-
-        collectionObject.put("Article", collectionArticleVos);
-        jsonArray.add(collectionObject);
-
-        return jsonArray;
-    }
-
-    /**
-     * 删除合集
-     *
-     * @param collectionId 合集id
-     */
-    @Override
-    public void deleteCollectionById(Long collectionId) {
-        //1.更新合集状态
-        CommunityCollection collection = communityCollectionMapper.selectOne(new QueryWrapper<CommunityCollection>()
-                .eq("id", collectionId)
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true)
-                            .or()
-                            .isNull("is_delete");
-                }));
-        collection.setDelete(true);
-        collection.setUpdateBy(SecurityUtils.getLoginUser().getUserId());
-        collection.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityCollectionMapper.updateById(collection);
-        //2.更新合集关联的文章状态
-        List<Long> ids = communityCollectionArticleMapper.selectList(new QueryWrapper<CommunityCollectionArticle>()
-                .eq("collection_id", collectionId)
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true)
-                            .or()
-                            .isNull("is_delete");
-                })).stream().map(item -> item.getId()).collect(Collectors.toList());
-        if (!ids.isEmpty()) {
-            CommunityCollectionArticle collectionArticle = new CommunityCollectionArticle();
-            collectionArticle.setDelete(true);
-            collectionArticle.setUpdateBy(SecurityUtils.getLoginUser().getUserId());
-            collectionArticle.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-            communityCollectionArticleMapper.update(collectionArticle, new UpdateWrapper<CommunityCollectionArticle>().in("id", ids));
-        }
-    }
-
-    @Override
-    public List<CommunityCollectionVo> selectUserCollection(Long userId, Long articleId, int pageNum, int pageSize, int searchType) {
-        int offset = (pageNum - 1) * pageSize;
-        List<CommunityCollectionVo> communityCollectionVos = communityCollectionMapper.selectUserCollection(userId, articleId, offset, pageSize, searchType);
-        /*for (CommunityCollectionVo communityCollectionVo : communityCollectionVos) {
-            Long aLong = communityCollectionArticleMapper.selectCount(new QueryWrapper<CommunityCollectionArticle>()
-                    .eq("collection_id", communityCollectionVo.getId())
-                    .and((wrapper) -> {
-                        wrapper.ne("is_delete", true)
-                                .or()
-                                .isNull("is_delete");
-                    }));
-            communityCollectionVo.setArticleCount(aLong);
-        }*/
-        return communityCollectionVos;
-    }
-
-
-}

+ 0 - 69
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionUserImpl.java

@@ -1,69 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.generator.domain.Community.CommunityCollection;
-import com.ruoyi.generator.domain.Community.CommunityCollectionUser;
-import com.ruoyi.generator.domain.Community.CommunityTagBlock;
-import com.ruoyi.generator.mapper.community.CommunityCollectionMapper;
-import com.ruoyi.generator.mapper.community.CommunityCollectionUserMapper;
-import com.ruoyi.generator.mapper.community.CommunityTagBlockMapper;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityCollectionUserImpl extends ServiceImpl<CommunityCollectionUserMapper, CommunityCollectionUser> implements ICommunityCollectionUserService {
-
-    @Autowired
-    private CommunityCollectionUserMapper communityCollectionUserMapper;
-
-    @Autowired
-    private CommunityCollectionMapper communityCollectionMapper;
-
-    @Override
-    public CommunityCollectionUser subscribeCollection(CommunityCollectionUser communityCollectionUser) {
-
-        //不能关注自己创建的合集
-        CommunityCollection communityCollection = communityCollectionMapper.selectOne(new QueryWrapper<CommunityCollection>()
-                .eq("id", communityCollectionUser.getCollectionId())
-                .eq("create_by", communityCollectionUser.getUserId())
-                .and((wrapper) -> {
-                    wrapper.ne("is_delete", true)
-                            .or()
-                            .isNull("is_delete");
-                }));
-
-        if (communityCollection != null){
-            return  null;
-        }
-
-
-        CommunityCollectionUser collectionUser = communityCollectionUserMapper.selectOne(new QueryWrapper<CommunityCollectionUser>()
-                .eq("user_id", communityCollectionUser.getUserId())
-                .eq("collection_id", communityCollectionUser.getCollectionId()));
-
-        if (collectionUser != null) {
-            Boolean isdelete = false;
-            //是否取关
-            if (!collectionUser.isDelete()) {
-               isdelete = true;
-            }
-            collectionUser.setDelete(isdelete);
-            collectionUser.setUpdateBy(communityCollectionUser.getUserId());
-            collectionUser.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-            communityCollectionUserMapper.updateById(collectionUser);
-            return collectionUser;
-        }
-
-        //新增记录
-        collectionUser = new CommunityCollectionUser();
-        BeanUtils.copyProperties(communityCollectionUser, collectionUser);
-        collectionUser.setCreateBy(communityCollectionUser.getUserId());
-        collectionUser.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityCollectionUserMapper.insert(collectionUser);
-        return collectionUser;
-
-    }
-}

+ 0 - 11
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCommentLikeServiceImpl.java

@@ -1,11 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityCommentLike;
-import com.ruoyi.generator.mapper.community.CommunityCommentLikeMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityCommentLikeServiceImpl extends ServiceImpl<CommunityCommentLikeMapper, CommunityCommentLike> implements ICommunityCommentLikeService {
-
-}

+ 0 - 11
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCommentReplyServiceImpl.java

@@ -1,11 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityCommentReply;
-import com.ruoyi.generator.mapper.community.CommunityCommentReplyMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityCommentReplyServiceImpl extends ServiceImpl<CommunityCommentReplyMapper, CommunityCommentReply> implements ICommunityCommentReplyService {
-
-}

+ 0 - 116
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityFeedbackUserServiceImpl.java

@@ -1,116 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.generator.domain.Community.CommunityArticleImages;
-import com.ruoyi.generator.domain.Community.CommunityFeedbackImages;
-import com.ruoyi.generator.domain.Community.CommunityFeedbackUser;
-import com.ruoyi.generator.domain.Community.CommunityReportImages;
-import com.ruoyi.generator.mapper.community.CommunityFeedbackImagesMapper;
-import com.ruoyi.generator.mapper.community.CommunityFeedbackUserMapper;
-import com.ruoyi.generator.vo.CommunityImagesVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * @author fangqing
- * @date 2025/6/13 10:49
- */
-@Service
-public class CommunityFeedbackUserServiceImpl extends ServiceImpl<CommunityFeedbackUserMapper, CommunityFeedbackUser> implements ICommunityFeedbackUserService {
-
-    @Autowired
-    private CommunityFeedbackUserMapper communityFeedbackUserMapper;
-
-    @Autowired
-    private CommunityFeedbackImagesMapper communityFeedbackImagesMapper;
-
-
-    /**
-     * 用户反馈
-     * @param communityFeedbackUser
-     * @return
-     */
-    @Override
-    public CommunityFeedbackUser insertCommunityFeedbacktUser(CommunityFeedbackUser communityFeedbackUser) {
-        //创建一个新的对象匹配
-        CommunityFeedbackUser feedbackUser = new CommunityFeedbackUser();
-
-        Long userId = communityFeedbackUser.getUserId();
-        if (userId == null){
-            userId = SecurityUtils.getUserId();
-        }
-
-        feedbackUser.setType(communityFeedbackUser.getType());
-        feedbackUser.setIsChoice(communityFeedbackUser.getIsChoice());
-        feedbackUser.setUserId(userId);
-        feedbackUser.setUserFeedback(communityFeedbackUser.getUserFeedback());
-        feedbackUser.setCreateBy(userId);
-        feedbackUser.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-
-        communityFeedbackUserMapper.insert(feedbackUser);
-        System.out.println(communityFeedbackUser);
-        //插入图片日志
-        List<CommunityImagesVo> images = communityFeedbackUser.getUserImages();
-        if (images != null && !images.isEmpty()) {
-            CommunityFeedbackImages feedbackImages = null;
-            for (CommunityImagesVo image : images) {
-                feedbackImages = new CommunityFeedbackImages();
-                feedbackImages.setFeedbackId(feedbackUser.getId());
-                feedbackImages.setUserId(userId);
-                feedbackImages.setImageUrl(image.getImages());
-                feedbackImages.setCompressUrl(image.getCompressedImages());
-                feedbackImages.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                feedbackImages.setCreateBy(userId);
-                communityFeedbackImagesMapper.insert(feedbackImages);
-            }
-        }
-
-        return feedbackUser;
-    }
-
-    /**
-     * 管理员反馈
-     * @param communityFeedbackUser
-     * @return
-     */
-    @Override
-    public CommunityFeedbackUser updateCommunityFeedbacktUser(CommunityFeedbackUser communityFeedbackUser) {
-        //创建一个新的对象匹配
-        CommunityFeedbackUser feedbackUser = new CommunityFeedbackUser();
-
-        Long punishId = communityFeedbackUser.getPunishId();
-        if (punishId == null){
-            punishId = SecurityUtils.getUserId();
-        }
-
-        feedbackUser.setId(communityFeedbackUser.getId());
-        feedbackUser.setIsChoice(communityFeedbackUser.getIsChoice());
-        feedbackUser.setPunishId(punishId);
-        feedbackUser.setPunishFeedback(communityFeedbackUser.getPunishFeedback());
-        feedbackUser.setUpdateBy(punishId);
-        feedbackUser.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityFeedbackUserMapper.updateById(feedbackUser);
-
-        //插入管理员图片日志
-        List<CommunityImagesVo> images = communityFeedbackUser.getPunishImages();
-        if (images != null && !images.isEmpty()) {
-            CommunityFeedbackImages feedbackImages = null;
-            for (CommunityImagesVo image : images) {
-                feedbackImages = new CommunityFeedbackImages();
-                feedbackImages.setFeedbackId(feedbackUser.getId());
-                feedbackImages.setPunishId(punishId);
-                feedbackImages.setImageUrl(image.getImages());
-                feedbackImages.setCompressUrl(image.getCompressedImages());
-                feedbackImages.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                feedbackImages.setCreateBy(punishId);
-                communityFeedbackImagesMapper.insert(feedbackImages);
-            }
-        }
-
-        return feedbackUser;
-    }
-}

+ 0 - 13
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityLikeServiceImpl.java

@@ -1,13 +0,0 @@
-package com.ruoyi.generator.service;
-
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityLike;
-
-import com.ruoyi.generator.mapper.community.CommunityLikeMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityLikeServiceImpl extends ServiceImpl<CommunityLikeMapper, CommunityLike> implements ICommunityLikeService  {
-
-}

+ 0 - 118
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityNotificationServiceImpl.java

@@ -1,118 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.generator.domain.Community.CommunityUserNotification;
-import com.ruoyi.generator.mapper.community.CommunityUserNotificationMapper;
-import com.ruoyi.generator.vo.CommunityUserNotificationVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * 业务 服务层实现
- *
- * @author ruoyi
- */
-@Service
-public class CommunityNotificationServiceImpl extends ServiceImpl<CommunityUserNotificationMapper, CommunityUserNotification> implements ICommunityNotificationService  {
-
-    @Autowired
-    private CommunityUserNotificationMapper communityUserNotificationMapper;
-
-    /**
-     * 获取通知权限
-     * @param userId
-     * @return 获取通知权限
-     */
-    @Override
-    public List<CommunityUserNotificationVo> selectUserNotification(Long userId) {
-        if (Objects.isNull(userId)) {
-            userId = SecurityUtils.getLoginUser().getUserId();
-        }
-        // 查询自己的通知权限
-        List<CommunityUserNotification> communityUserNotifications
-                = communityUserNotificationMapper
-                .selectList(new QueryWrapper<CommunityUserNotification>().eq("user_id", userId));
-        // 创建一个用于存放VO的列表
-        List<CommunityUserNotificationVo> communityUserNotificationVos = new ArrayList<>();
-
-        // 遍历查询结果,复制属性到 VO 对象
-        for (CommunityUserNotification communityUserNotification : communityUserNotifications) {
-            CommunityUserNotificationVo communityUserNotificationVo = new CommunityUserNotificationVo();
-            BeanUtils.copyProperties(communityUserNotification, communityUserNotificationVo);
-            communityUserNotificationVos.add(communityUserNotificationVo);
-        }
-
-        // 判断通知权限是否为空
-        if (communityUserNotificationVos.isEmpty()) {
-            // 如果没有通知权限,插入一条关于 userId 的数据
-            CommunityUserNotification newNotification = new CommunityUserNotification();
-            newNotification.setUserId(userId);
-            newNotification.setIsCircle(false);
-            newNotification.setIsLetter(false);
-            newNotification.setIsComment(false);
-            newNotification.setIsAddAttention(false);
-            newNotification.setIsPraiseCollection(false);
-            // 设置其他必要的默认值,例如:
-            // 使用 MyBatis-Plus 执行插入操作
-            communityUserNotificationMapper.insert(newNotification);
-            // 将新插入的记录转换为 VO 并返回
-            CommunityUserNotificationVo newNotificationVo = new CommunityUserNotificationVo();
-            BeanUtils.copyProperties(newNotification, newNotificationVo);
-            communityUserNotificationVos.add(newNotificationVo);
-        }
-
-        return communityUserNotificationVos;
-    }
-
-
-    /**
-     * 更新通知权限
-     * @param communityUserNotification
-     * @return 返回修改成功的对象
-     */
-    public List<CommunityUserNotificationVo> modifyUserNotification(CommunityUserNotification communityUserNotification) {
-        //获取userId
-        Long userId = SecurityUtils.getUserId();
-        // 创建更新包装器
-        UpdateWrapper<CommunityUserNotification> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("user_id", userId);  // 根据 userId 条件
-        // 更新字段
-        if (communityUserNotification.getIsPraiseCollection() != null) {
-            updateWrapper.set("is_praise_collection", communityUserNotification.getIsPraiseCollection());
-        }
-        if (communityUserNotification.getIsAddAttention() != null) {
-            updateWrapper.set("is_add_attention", communityUserNotification.getIsAddAttention());
-        }
-        if (communityUserNotification.getIsComment() != null) {
-            updateWrapper.set("is_comment", communityUserNotification.getIsComment());
-        }
-        if (communityUserNotification.getIsCircle() != null) {
-            updateWrapper.set("is_circle", communityUserNotification.getIsCircle());
-        }
-        if (communityUserNotification.getIsLetter() != null) {
-            updateWrapper.set("is_letter", communityUserNotification.getIsLetter());
-        }
-        // 执行更新操作
-        boolean updated = this.update(updateWrapper);
-        if (!updated){
-            System.out.println("更新失败");
-        }
-        // 创建一个用于存放VO的列表
-        List<CommunityUserNotificationVo> communityUserNotificationVos = new ArrayList<>();
-        CommunityUserNotification updatedUserNotification = this.getOne(new UpdateWrapper<CommunityUserNotification>().eq("user_id", userId));
-        // 将新插入的记录转换为 VO 并返回
-        CommunityUserNotificationVo newNotificationVo = new CommunityUserNotificationVo();
-        BeanUtils.copyProperties(updatedUserNotification, newNotificationVo);
-        communityUserNotificationVos.add(newNotificationVo);
-
-        return communityUserNotificationVos;
-    }
-}

+ 0 - 153
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityPrivacyServiceImpl.java

@@ -1,153 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.generator.domain.Community.CommunityUserNotification;
-import com.ruoyi.generator.domain.Community.CommunityUserPrivacy;
-import com.ruoyi.generator.mapper.community.CommunityUserNotificationMapper;
-import com.ruoyi.generator.mapper.community.CommunityUserPrivacyMapper;
-import com.ruoyi.generator.vo.CommunityUserNotificationVo;
-import com.ruoyi.generator.vo.CommunityUserPrivacyVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * 业务 服务层实现
- *
- * @author ruoyi
- */
-@Service
-public class CommunityPrivacyServiceImpl extends ServiceImpl<CommunityUserPrivacyMapper, CommunityUserPrivacy> implements ICommunityPrivacyService  {
-
-
-    @Autowired
-    private CommunityUserPrivacyMapper communityUserPrivacyMapper;
-
-    /**
-     * 获取隐私权限
-     * @param userId
-     * @return 获取隐私权限
-     */
-    @Override
-    public List<CommunityUserPrivacyVo> selectUserPrivacy(Long userId) {
-        if (Objects.isNull(userId)) {
-            userId = SecurityUtils.getLoginUser().getUserId();
-        }
-        // 查询自己的隐私权限
-        List<CommunityUserPrivacy> communityUserPrivacies
-                = communityUserPrivacyMapper
-                .selectList(new QueryWrapper<CommunityUserPrivacy>().eq("user_id", userId));
-        // 创建一个用于存放VO的列表
-        List<CommunityUserPrivacyVo> communityUserPrivacyVos = new ArrayList<>();
-
-        // 遍历查询结果,复制属性到 VO 对象
-        for (CommunityUserPrivacy communityUserPrivacy : communityUserPrivacies) {
-            CommunityUserPrivacyVo communityUserPrivacyVo = new CommunityUserPrivacyVo();
-            BeanUtils.copyProperties(communityUserPrivacy, communityUserPrivacyVo);
-            communityUserPrivacyVos.add(communityUserPrivacyVo);
-        }
-
-        // 判断隐私权限是否为空
-        if (communityUserPrivacyVos.isEmpty()) {
-            // 如果没有隐私权限,插入一条关于 userId 的数据
-            CommunityUserPrivacy newPrivacy = new CommunityUserPrivacy();
-            newPrivacy.setUserId(userId);
-            newPrivacy.setIsComment(false);
-            newPrivacy.setIsCircle(false);
-            newPrivacy.setIsWorks(false);
-            newPrivacy.setIsCollection(false);
-            newPrivacy.setIsLike(false);
-            newPrivacy.setIsCompilation(false);
-            newPrivacy.setIsAccounts(false);
-            newPrivacy.setIsNames(false);
-            newPrivacy.setIsFollow(false);
-            newPrivacy.setIsFans(false);
-            newPrivacy.setIsAccompany(false);
-            // 设置其他必要的默认值,例如:
-            // 使用 MyBatis-Plus 执行插入操作
-            communityUserPrivacyMapper.insert(newPrivacy);
-            // 将新插入的记录转换为 VO 并返回
-            CommunityUserPrivacyVo newPrivacyVo = new CommunityUserPrivacyVo();
-            BeanUtils.copyProperties(newPrivacy, newPrivacyVo);
-            communityUserPrivacyVos.add(newPrivacyVo);
-        }
-
-        return communityUserPrivacyVos;
-    }
-
-    /**
-     * 更新隐私权限
-     * @param communityUserPrivacy
-     * @return 返回修改成功的对象
-     */
-    @Override
-    public List<CommunityUserPrivacyVo> modifyUserPrivacy(CommunityUserPrivacy communityUserPrivacy) {
-        // 获取 userId
-        Long userId = SecurityUtils.getUserId();
-
-        // 创建更新包装器
-        UpdateWrapper<CommunityUserPrivacy> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("user_id", userId); // 根据 userId 条件
-
-        // 更新字段
-        if (communityUserPrivacy.getIsComment() != null) {
-            updateWrapper.set("is_comment", communityUserPrivacy.getIsComment());
-        }
-        if (communityUserPrivacy.getIsCircle() != null) {
-            updateWrapper.set("is_circle", communityUserPrivacy.getIsCircle());
-        }
-        if (communityUserPrivacy.getIsWorks() != null) {
-            updateWrapper.set("is_works", communityUserPrivacy.getIsWorks());
-        }
-        if (communityUserPrivacy.getIsCollection() != null) {
-            updateWrapper.set("is_collection", communityUserPrivacy.getIsCollection());
-        }
-        if (communityUserPrivacy.getIsLike() != null) {
-            updateWrapper.set("is_like", communityUserPrivacy.getIsLike());
-        }
-        if (communityUserPrivacy.getIsCompilation() != null) {
-            updateWrapper.set("is_compilation", communityUserPrivacy.getIsCompilation());
-        }
-        if (communityUserPrivacy.getIsAccounts() != null) {
-            updateWrapper.set("is_accounts", communityUserPrivacy.getIsAccounts());
-        }
-        if (communityUserPrivacy.getIsNames() != null) {
-            updateWrapper.set("is_names", communityUserPrivacy.getIsNames());
-        }
-        if (communityUserPrivacy.getIsFollow() != null) {
-            updateWrapper.set("is_follow", communityUserPrivacy.getIsFollow());
-        }
-
-        if (communityUserPrivacy.getIsFans() != null) {
-            updateWrapper.set("is_fans", communityUserPrivacy.getIsFans());
-        }
-
-        if (communityUserPrivacy.getIsAccompany() != null) {
-            updateWrapper.set("is_accompany", communityUserPrivacy.getIsAccompany());
-        }
-
-        // 执行更新操作
-        boolean updated = this.update(updateWrapper);
-        if (!updated) {
-            System.out.println("更新失败");
-        }
-
-        // 创建一个用于存放VO的列表
-        List<CommunityUserPrivacyVo> communityUserPrivacyVos = new ArrayList<>();
-        CommunityUserPrivacy updatedUserPrivacy = this.getOne(new UpdateWrapper<CommunityUserPrivacy>().eq("user_id", userId));
-
-        // 将新插入的记录转换为 VO 并返回
-        CommunityUserPrivacyVo newPrivacyVo = new CommunityUserPrivacyVo();
-        BeanUtils.copyProperties(updatedUserPrivacy, newPrivacyVo);
-        communityUserPrivacyVos.add(newPrivacyVo);
-
-        return communityUserPrivacyVos;
-    }
-}

+ 0 - 11
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityReportDataServiceImpl.java

@@ -1,11 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityReportData;
-import com.ruoyi.generator.mapper.community.CommunityReportDataMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityReportDataServiceImpl extends ServiceImpl<CommunityReportDataMapper, CommunityReportData> implements ICommunityReportDataService {
-
-}

+ 0 - 11
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityReportServiceImpl.java

@@ -1,11 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityReport;
-import com.ruoyi.generator.mapper.community.CommunityReportMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityReportServiceImpl extends ServiceImpl<CommunityReportMapper, CommunityReport> implements ICommunityReportService {
-
-}

+ 0 - 83
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityReportUserServiceImpl.java

@@ -1,83 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.domain.entity.SysUser;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.generator.domain.Community.CommunityArticleImages;
-import com.ruoyi.generator.domain.Community.CommunityReportImages;
-import com.ruoyi.generator.domain.Community.CommunityReportUser;
-import com.ruoyi.generator.mapper.community.CommunityReportImagesMapper;
-import com.ruoyi.generator.mapper.community.CommunityReportUserMapper;
-import com.ruoyi.generator.mapper.community.CommunityTagBlockMapper;
-import com.ruoyi.system.mapper.SysUserMapper;
-import com.ruoyi.system.service.ISysUserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class CommunityReportUserServiceImpl extends ServiceImpl<CommunityReportUserMapper, CommunityReportUser> implements ICommunityReportUserService {
-
-
-    @Autowired
-    private CommunityReportUserMapper communityReportUserMapper;
-
-    @Autowired
-    private SysUserMapper sysUserMapper;
-
-    @Autowired
-    private ISysUserService userService;
-
-    @Autowired
-    private CommunityReportImagesMapper communityReportImagesMapper;
-
-    @Override
-    public CommunityReportUser insertCommunityReportUser(CommunityReportUser communityReportUser) {
-        /*SysUser user = new SysUser();
-        user.setUserId(communityReportUser.getUserId());
-        user.setUserState(communityReportUser.getUserState());
-        userService.updateUserProfile(user);*/
-
-        //创建一个新的对象匹配
-        CommunityReportUser reportUser = new CommunityReportUser();
-
-        reportUser.setUserId(communityReportUser.getUserId());
-        reportUser.setType(communityReportUser.getType());
-        reportUser.setContent(communityReportUser.getContent());
-        reportUser.setTypeId(communityReportUser.getTypeId());
-        reportUser.setReportContent(communityReportUser.getReportContent());
-        reportUser.setArticleId(communityReportUser.getArticleId());
-        reportUser.setCommentId(communityReportUser.getCommentId());
-        reportUser.setReplyId(communityReportUser.getReplyId());
-
-        //根据用户信息查询用户头像名称
-        SysUser sysUser = sysUserMapper.selectUserById(reportUser.getUserId());
-        reportUser.setUserName(sysUser.getUserName());
-        reportUser.setAvatar(sysUser.getAvatar());
-        reportUser.setUserState(sysUser.getUserState());
-        reportUser.setCreateBy(SecurityUtils.getUserId());
-        reportUser.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityReportUserMapper.insert(reportUser);
-
-        Long id = reportUser.getId();
-        System.out.println(id);
-        //插入图片日志
-        List<String> images = communityReportUser.getImages();
-        if (images != null && !images.isEmpty()) {
-            CommunityReportImages reportImages = null;
-            for (String image : images) {
-                reportImages = new CommunityReportImages();
-                reportImages.setReportId(reportUser.getId());
-                reportImages.setImageUrl(image);
-                reportImages.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-                reportImages.setCreateBy(SecurityUtils.getUserId());
-                communityReportImagesMapper.insert(reportImages);
-            }
-        }
-
-        return reportUser;
-    }
-}

+ 0 - 48
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityReturnRecordServiceImpl.java

@@ -1,48 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityReturnRecord;
-import com.ruoyi.generator.mapper.community.CommunityReturnRecordMapper;
-import com.ruoyi.system.domain.vo.SysUserVo;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-@Service
-public class CommunityReturnRecordServiceImpl extends ServiceImpl<CommunityReturnRecordMapper, CommunityReturnRecord> implements ICommunityReturnRecordService {
-
-    @Resource
-    private CommunityReturnRecordMapper returnRecordMapper;
-
-    @Override
-    public List<CommunityReturnRecord> getReturnRecord(Long userId, String status) {
-        List<CommunityReturnRecord> returnRecords = null;
-        List<SysUserVo> sysUserChatVos = null;
-        switch (status) {
-            case "0": //待完成
-                returnRecords = returnRecordMapper.selectList(new QueryWrapper<CommunityReturnRecord>()
-                        .eq("return_create_user_id", userId)
-                        .eq("status", false)
-                        .eq("is_delete", false));
-                break;
-            case "1": //待返图
-                returnRecords = returnRecordMapper.selectList(new QueryWrapper<CommunityReturnRecord>()
-                        .eq("return_receive_user_id", userId)
-                        .eq("status", false)
-                        .eq("is_delete", false));
-                break;
-            case "2": //已完成
-                returnRecords = returnRecordMapper.selectList(new QueryWrapper<CommunityReturnRecord>()
-                        .and(wrapper ->
-                                wrapper.eq("return_receive_user_id", userId)
-                                        .or()
-                                        .eq("return_create_user_id", userId))
-                        .eq("status", true)
-                        .eq("is_delete", false));
-                break;
-        }
-        return returnRecords;
-    }
-}

+ 0 - 51
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityTagServiceImpl.java

@@ -1,51 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.generator.domain.Community.CommunityTag;
-import com.ruoyi.generator.domain.Community.CommunityTagBlock;
-import com.ruoyi.generator.mapper.community.CommunityTagBlockMapper;
-import com.ruoyi.generator.mapper.community.CommunityTagMapper;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityTagServiceImpl extends ServiceImpl<CommunityTagMapper, CommunityTag> implements ICommunityTagService {
-
-    @Autowired
-    private CommunityTagBlockMapper communityTagBlockMapper;
-
-    /**
-     * 拉黑标签
-     *
-     * @param communityTagBlock 拉黑标签记录
-     */
-    @Override
-    public CommunityTagBlock blockTag(CommunityTagBlock communityTagBlock) {
-        CommunityTagBlock tagBlock = communityTagBlockMapper.selectOne(new QueryWrapper<CommunityTagBlock>()
-                .eq("user_id", communityTagBlock.getUserId())
-                .eq("tag_id", communityTagBlock.getTagId()));
-
-        if (tagBlock != null) {
-            //是否拉黑
-            if (communityTagBlock.isBlock() == tagBlock.isBlock()) {
-                return tagBlock;
-            }
-            tagBlock.setBlock(communityTagBlock.isBlock());
-            tagBlock.setUpdateBy(communityTagBlock.getUserId());
-            tagBlock.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-            communityTagBlockMapper.updateById(tagBlock);
-            return tagBlock;
-        }
-
-        //新增记录
-        tagBlock = new CommunityTagBlock();
-        BeanUtils.copyProperties(communityTagBlock, tagBlock);
-        tagBlock.setCreateBy(communityTagBlock.getUserId());
-        tagBlock.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityTagBlockMapper.insert(tagBlock);
-        return tagBlock;
-    }
-}

+ 0 - 51
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityUserBlockServiceImpl.java

@@ -1,51 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.generator.domain.Community.CommunityUserBlock;
-import com.ruoyi.generator.mapper.community.CommunityUserBlockMapper;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityUserBlockServiceImpl extends ServiceImpl<CommunityUserBlockMapper, CommunityUserBlock> implements ICommunityUserBlockService {
-
-    @Autowired
-    private CommunityUserBlockMapper communityUserBlockMapper;
-
-
-
-    /**
-     * 拉黑用户
-     *
-     * @param communityUserBlock 拉黑用户记录
-     */
-    @Override
-    public CommunityUserBlock blockUser(CommunityUserBlock communityUserBlock) {
-        CommunityUserBlock userBlock = communityUserBlockMapper.selectOne(new QueryWrapper<CommunityUserBlock>()
-                .eq("user_id", communityUserBlock.getUserId())
-                .eq("peer_id", communityUserBlock.getPeerId()));
-
-        if (userBlock != null) {
-            //是否拉黑
-            if (communityUserBlock.isBlock() == userBlock.isBlock()) {
-                return communityUserBlock;
-            }
-            userBlock.setBlock(communityUserBlock.isBlock());
-            userBlock.setUpdateBy(communityUserBlock.getUserId());
-            userBlock.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
-            communityUserBlockMapper.updateById(userBlock);
-            return userBlock;
-        }
-
-        //新增记录
-        userBlock = new CommunityUserBlock();
-        BeanUtils.copyProperties(communityUserBlock, userBlock);
-        userBlock.setCreateBy(communityUserBlock.getUserId());
-        userBlock.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
-        communityUserBlockMapper.insert(userBlock);
-        return userBlock;
-    }
-}

+ 0 - 11
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityUserLikeServiceImpl.java

@@ -1,11 +0,0 @@
-package com.ruoyi.generator.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityUserLike;
-import com.ruoyi.generator.mapper.community.CommunityUserLikeMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityUserLikeServiceImpl extends ServiceImpl<CommunityUserLikeMapper, CommunityUserLike> implements ICommunityUserLikeService {
-
-}

+ 0 - 12
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityUserProtocolServiceImpl.java

@@ -1,12 +0,0 @@
-package com.ruoyi.generator.service;
-
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.generator.domain.Community.CommunityUserProtocol;
-import com.ruoyi.generator.mapper.community.CommunityUserProtocolMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CommunityUserProtocolServiceImpl extends ServiceImpl<CommunityUserProtocolMapper, CommunityUserProtocol> implements ICommunityUserProtocolService {
-
-}

+ 0 - 68
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java

@@ -1,68 +0,0 @@
-package com.ruoyi.generator.service;
-
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.common.core.text.Convert;
-import com.ruoyi.generator.domain.GenTableColumn;
-import com.ruoyi.generator.mapper.GenTableColumnMapper;
-
-/**
- * 业务字段 服务层实现
- * 
- * @author ruoyi
- */
-@Service
-public class GenTableColumnServiceImpl implements IGenTableColumnService 
-{
-	@Autowired
-	private GenTableColumnMapper genTableColumnMapper;
-
-	/**
-     * 查询业务字段列表
-     * 
-     * @param tableId 业务字段编号
-     * @return 业务字段集合
-     */
-	@Override
-	public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId)
-	{
-	    return genTableColumnMapper.selectGenTableColumnListByTableId(tableId);
-	}
-	
-    /**
-     * 新增业务字段
-     * 
-     * @param genTableColumn 业务字段信息
-     * @return 结果
-     */
-	@Override
-	public int insertGenTableColumn(GenTableColumn genTableColumn)
-	{
-	    return genTableColumnMapper.insertGenTableColumn(genTableColumn);
-	}
-	
-	/**
-     * 修改业务字段
-     * 
-     * @param genTableColumn 业务字段信息
-     * @return 结果
-     */
-	@Override
-	public int updateGenTableColumn(GenTableColumn genTableColumn)
-	{
-	    return genTableColumnMapper.updateGenTableColumn(genTableColumn);
-	}
-
-	/**
-     * 删除业务字段对象
-     * 
-     * @param ids 需要删除的数据ID
-     * @return 结果
-     */
-	@Override
-	public int deleteGenTableColumnByIds(String ids)
-	{
-		return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
-	}
-}

+ 0 - 531
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java

@@ -1,531 +0,0 @@
-package com.ruoyi.generator.service;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONObject;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.constant.GenConstants;
-import com.ruoyi.common.core.text.CharsetKit;
-import com.ruoyi.common.exception.ServiceException;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.generator.domain.GenTable;
-import com.ruoyi.generator.domain.GenTableColumn;
-import com.ruoyi.generator.mapper.GenTableColumnMapper;
-import com.ruoyi.generator.mapper.GenTableMapper;
-import com.ruoyi.generator.util.GenUtils;
-import com.ruoyi.generator.util.VelocityInitializer;
-import com.ruoyi.generator.util.VelocityUtils;
-
-/**
- * 业务 服务层实现
- * 
- * @author ruoyi
- */
-@Service
-public class GenTableServiceImpl implements IGenTableService
-{
-    private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
-
-    @Autowired
-    private GenTableMapper genTableMapper;
-
-    @Autowired
-    private GenTableColumnMapper genTableColumnMapper;
-
-    /**
-     * 查询业务信息
-     * 
-     * @param id 业务ID
-     * @return 业务信息
-     */
-    @Override
-    public GenTable selectGenTableById(Long id)
-    {
-        GenTable genTable = genTableMapper.selectGenTableById(id);
-        setTableFromOptions(genTable);
-        return genTable;
-    }
-
-    /**
-     * 查询业务列表
-     * 
-     * @param genTable 业务信息
-     * @return 业务集合
-     */
-    @Override
-    public List<GenTable> selectGenTableList(GenTable genTable)
-    {
-        return genTableMapper.selectGenTableList(genTable);
-    }
-
-    /**
-     * 查询据库列表
-     * 
-     * @param genTable 业务信息
-     * @return 数据库表集合
-     */
-    @Override
-    public List<GenTable> selectDbTableList(GenTable genTable)
-    {
-        return genTableMapper.selectDbTableList(genTable);
-    }
-
-    /**
-     * 查询据库列表
-     * 
-     * @param tableNames 表名称组
-     * @return 数据库表集合
-     */
-    @Override
-    public List<GenTable> selectDbTableListByNames(String[] tableNames)
-    {
-        return genTableMapper.selectDbTableListByNames(tableNames);
-    }
-
-    /**
-     * 查询所有表信息
-     * 
-     * @return 表信息集合
-     */
-    @Override
-    public List<GenTable> selectGenTableAll()
-    {
-        return genTableMapper.selectGenTableAll();
-    }
-
-    /**
-     * 修改业务
-     * 
-     * @param genTable 业务信息
-     * @return 结果
-     */
-    @Override
-    @Transactional
-    public void updateGenTable(GenTable genTable)
-    {
-        String options = JSON.toJSONString(genTable.getParams());
-        genTable.setOptions(options);
-        int row = genTableMapper.updateGenTable(genTable);
-        if (row > 0)
-        {
-            for (GenTableColumn cenTableColumn : genTable.getColumns())
-            {
-                genTableColumnMapper.updateGenTableColumn(cenTableColumn);
-            }
-        }
-    }
-
-    /**
-     * 删除业务对象
-     * 
-     * @param tableIds 需要删除的数据ID
-     * @return 结果
-     */
-    @Override
-    @Transactional
-    public void deleteGenTableByIds(Long[] tableIds)
-    {
-        genTableMapper.deleteGenTableByIds(tableIds);
-        genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
-    }
-
-    /**
-     * 创建表
-     *
-     * @param sql 创建表语句
-     * @return 结果
-     */
-    @Override
-    public boolean createTable(String sql)
-    {
-        return genTableMapper.createTable(sql) == 0;
-    }
-
-    /**
-     * 导入表结构
-     * 
-     * @param tableList 导入表列表
-     */
-    @Override
-    @Transactional
-    public void importGenTable(List<GenTable> tableList, String operName)
-    {
-        try
-        {
-            for (GenTable table : tableList)
-            {
-                String tableName = table.getTableName();
-                GenUtils.initTable(table, operName);
-                int row = genTableMapper.insertGenTable(table);
-                if (row > 0)
-                {
-                    // 保存列信息
-                    List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
-                    for (GenTableColumn column : genTableColumns)
-                    {
-                        GenUtils.initColumnField(column, table);
-                        genTableColumnMapper.insertGenTableColumn(column);
-                    }
-                }
-            }
-        }
-        catch (Exception e)
-        {
-            throw new ServiceException("导入失败:" + e.getMessage());
-        }
-    }
-
-    /**
-     * 预览代码
-     * 
-     * @param tableId 表编号
-     * @return 预览数据列表
-     */
-    @Override
-    public Map<String, String> previewCode(Long tableId)
-    {
-        Map<String, String> dataMap = new LinkedHashMap<>();
-        // 查询表信息
-        GenTable table = genTableMapper.selectGenTableById(tableId);
-        // 设置主子表信息
-        setSubTable(table);
-        // 设置主键列信息
-        setPkColumn(table);
-        VelocityInitializer.initVelocity();
-
-        VelocityContext context = VelocityUtils.prepareContext(table);
-
-        // 获取模板列表
-        List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
-        for (String template : templates)
-        {
-            // 渲染模板
-            StringWriter sw = new StringWriter();
-            Template tpl = Velocity.getTemplate(template, Constants.UTF8);
-            tpl.merge(context, sw);
-            dataMap.put(template, sw.toString());
-        }
-        return dataMap;
-    }
-
-    /**
-     * 生成代码(下载方式)
-     * 
-     * @param tableName 表名称
-     * @return 数据
-     */
-    @Override
-    public byte[] downloadCode(String tableName)
-    {
-        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-        ZipOutputStream zip = new ZipOutputStream(outputStream);
-        generatorCode(tableName, zip);
-        IOUtils.closeQuietly(zip);
-        return outputStream.toByteArray();
-    }
-
-    /**
-     * 生成代码(自定义路径)
-     * 
-     * @param tableName 表名称
-     */
-    @Override
-    public void generatorCode(String tableName)
-    {
-        // 查询表信息
-        GenTable table = genTableMapper.selectGenTableByName(tableName);
-        // 设置主子表信息
-        setSubTable(table);
-        // 设置主键列信息
-        setPkColumn(table);
-
-        VelocityInitializer.initVelocity();
-
-        VelocityContext context = VelocityUtils.prepareContext(table);
-
-        // 获取模板列表
-        List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
-        for (String template : templates)
-        {
-            if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm"))
-            {
-                // 渲染模板
-                StringWriter sw = new StringWriter();
-                Template tpl = Velocity.getTemplate(template, Constants.UTF8);
-                tpl.merge(context, sw);
-                try
-                {
-                    String path = getGenPath(table, template);
-                    FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8);
-                }
-                catch (IOException e)
-                {
-                    throw new ServiceException("渲染模板失败,表名:" + table.getTableName());
-                }
-            }
-        }
-    }
-
-    /**
-     * 同步数据库
-     * 
-     * @param tableName 表名称
-     */
-    @Override
-    @Transactional
-    public void synchDb(String tableName)
-    {
-        GenTable table = genTableMapper.selectGenTableByName(tableName);
-        List<GenTableColumn> tableColumns = table.getColumns();
-        Map<String, GenTableColumn> tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity()));
-
-        List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
-        if (StringUtils.isEmpty(dbTableColumns))
-        {
-            throw new ServiceException("同步数据失败,原表结构不存在");
-        }
-        List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
-
-        dbTableColumns.forEach(column -> {
-            GenUtils.initColumnField(column, table);
-            if (tableColumnMap.containsKey(column.getColumnName()))
-            {
-                GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName());
-                column.setColumnId(prevColumn.getColumnId());
-                if (column.isList())
-                {
-                    // 如果是列表,继续保留查询方式/字典类型选项
-                    column.setDictType(prevColumn.getDictType());
-                    column.setQueryType(prevColumn.getQueryType());
-                }
-                if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk()
-                        && (column.isInsert() || column.isEdit())
-                        && ((column.isUsableColumn()) || (!column.isSuperColumn())))
-                {
-                    // 如果是(新增/修改&非主键/非忽略及父属性),继续保留必填/显示类型选项
-                    column.setIsRequired(prevColumn.getIsRequired());
-                    column.setHtmlType(prevColumn.getHtmlType());
-                }
-                genTableColumnMapper.updateGenTableColumn(column);
-            }
-            else
-            {
-                genTableColumnMapper.insertGenTableColumn(column);
-            }
-        });
-
-        List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
-        if (StringUtils.isNotEmpty(delColumns))
-        {
-            genTableColumnMapper.deleteGenTableColumns(delColumns);
-        }
-    }
-
-    /**
-     * 批量生成代码(下载方式)
-     * 
-     * @param tableNames 表数组
-     * @return 数据
-     */
-    @Override
-    public byte[] downloadCode(String[] tableNames)
-    {
-        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-        ZipOutputStream zip = new ZipOutputStream(outputStream);
-        for (String tableName : tableNames)
-        {
-            generatorCode(tableName, zip);
-        }
-        IOUtils.closeQuietly(zip);
-        return outputStream.toByteArray();
-    }
-
-    /**
-     * 查询表信息并生成代码
-     */
-    private void generatorCode(String tableName, ZipOutputStream zip)
-    {
-        // 查询表信息
-        GenTable table = genTableMapper.selectGenTableByName(tableName);
-        // 设置主子表信息
-        setSubTable(table);
-        // 设置主键列信息
-        setPkColumn(table);
-
-        VelocityInitializer.initVelocity();
-
-        VelocityContext context = VelocityUtils.prepareContext(table);
-
-        // 获取模板列表
-        List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
-        for (String template : templates)
-        {
-            // 渲染模板
-            StringWriter sw = new StringWriter();
-            Template tpl = Velocity.getTemplate(template, Constants.UTF8);
-            tpl.merge(context, sw);
-            try
-            {
-                // 添加到zip
-                zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
-                IOUtils.write(sw.toString(), zip, Constants.UTF8);
-                IOUtils.closeQuietly(sw);
-                zip.flush();
-                zip.closeEntry();
-            }
-            catch (IOException e)
-            {
-                log.error("渲染模板失败,表名:" + table.getTableName(), e);
-            }
-        }
-    }
-
-    /**
-     * 修改保存参数校验
-     * 
-     * @param genTable 业务信息
-     */
-    @Override
-    public void validateEdit(GenTable genTable)
-    {
-        if (GenConstants.TPL_TREE.equals(genTable.getTplCategory()))
-        {
-            String options = JSON.toJSONString(genTable.getParams());
-            JSONObject paramsObj = JSON.parseObject(options);
-            if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE)))
-            {
-                throw new ServiceException("树编码字段不能为空");
-            }
-            else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE)))
-            {
-                throw new ServiceException("树父编码字段不能为空");
-            }
-            else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME)))
-            {
-                throw new ServiceException("树名称字段不能为空");
-            }
-            else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory()))
-            {
-                if (StringUtils.isEmpty(genTable.getSubTableName()))
-                {
-                    throw new ServiceException("关联子表的表名不能为空");
-                }
-                else if (StringUtils.isEmpty(genTable.getSubTableFkName()))
-                {
-                    throw new ServiceException("子表关联的外键名不能为空");
-                }
-            }
-        }
-    }
-
-    /**
-     * 设置主键列信息
-     * 
-     * @param table 业务表信息
-     */
-    public void setPkColumn(GenTable table)
-    {
-        for (GenTableColumn column : table.getColumns())
-        {
-            if (column.isPk())
-            {
-                table.setPkColumn(column);
-                break;
-            }
-        }
-        if (StringUtils.isNull(table.getPkColumn()))
-        {
-            table.setPkColumn(table.getColumns().get(0));
-        }
-        if (GenConstants.TPL_SUB.equals(table.getTplCategory()))
-        {
-            for (GenTableColumn column : table.getSubTable().getColumns())
-            {
-                if (column.isPk())
-                {
-                    table.getSubTable().setPkColumn(column);
-                    break;
-                }
-            }
-            if (StringUtils.isNull(table.getSubTable().getPkColumn()))
-            {
-                table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0));
-            }
-        }
-    }
-
-    /**
-     * 设置主子表信息
-     * 
-     * @param table 业务表信息
-     */
-    public void setSubTable(GenTable table)
-    {
-        String subTableName = table.getSubTableName();
-        if (StringUtils.isNotEmpty(subTableName))
-        {
-            table.setSubTable(genTableMapper.selectGenTableByName(subTableName));
-        }
-    }
-
-    /**
-     * 设置代码生成其他选项值
-     * 
-     * @param genTable 设置后的生成对象
-     */
-    public void setTableFromOptions(GenTable genTable)
-    {
-        JSONObject paramsObj = JSON.parseObject(genTable.getOptions());
-        if (StringUtils.isNotNull(paramsObj))
-        {
-            String treeCode = paramsObj.getString(GenConstants.TREE_CODE);
-            String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE);
-            String treeName = paramsObj.getString(GenConstants.TREE_NAME);
-            String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID);
-            String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
-
-            genTable.setTreeCode(treeCode);
-            genTable.setTreeParentCode(treeParentCode);
-            genTable.setTreeName(treeName);
-            genTable.setParentMenuId(parentMenuId);
-            genTable.setParentMenuName(parentMenuName);
-        }
-    }
-
-    /**
-     * 获取代码生成地址
-     * 
-     * @param table 业务表信息
-     * @param template 模板文件路径
-     * @return 生成地址
-     */
-    public static String getGenPath(GenTable table, String template)
-    {
-        String genPath = table.getGenPath();
-        if (StringUtils.equals(genPath, "/"))
-        {
-            return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table);
-        }
-        return genPath + File.separator + VelocityUtils.getFileName(template, table);
-    }
-}