diff --git a/pom.xml b/pom.xml index 337c5d02fe2953a1e306a4f277502cfd223f2027..1ec6b608c296369626a1578bc6111a552c59d66b 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ 1.1.5 Greenwich.RELEASE 0.9.0.RELEASE + SaltIce.sc @@ -147,7 +148,10 @@ -Xdoclint:none - + + + + diff --git a/saltice-sc-admin/pom.xml b/saltice-sc-admin/pom.xml index 4b1b0bc0c44712460d636ceb6d41d3b527e0c863..8822c1cec8a3bf2c80483e48d7820a8b3f0a3955 100644 --- a/saltice-sc-admin/pom.xml +++ b/saltice-sc-admin/pom.xml @@ -112,6 +112,21 @@ false + + com.spotify + docker-maven-plugin + 1.0.0 + + src/main/docker + + + / + ${project.build.directory} + ${project.build.finalName}.jar + + + + diff --git a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/initFunc/InitFunc.java b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/initFunc/InitFunc.java index c73d4fadca7b1d3973cafa887ea4aefecd47e2c5..2255a688ac91e9504901b426674a2d8e9b84f9e3 100644 --- a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/initFunc/InitFunc.java +++ b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/initFunc/InitFunc.java @@ -2,8 +2,10 @@ package cn.ljobin.bibi.system.initFunc; import cn.ljobin.bibi.constant.RedisPrefix; import cn.ljobin.bibi.domain.sc.ArticleType; +import cn.ljobin.bibi.domain.sc.FocusOnT; import cn.ljobin.bibi.domain.wapper.LifeShareWapper; import cn.ljobin.bibi.mapper.ArticleTypeDao; +import cn.ljobin.bibi.mapper.FocusOnTDao; import cn.ljobin.bibi.mapper.LifeShareDao; import cn.stylefeng.roses.core.util.ToolUtil; import com.alibaba.fastjson.JSON; @@ -11,13 +13,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.dao.DataAccessException; -import org.springframework.data.redis.core.RedisOperations; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.SessionCallback; +import org.springframework.data.redis.core.*; import org.springframework.stereotype.Component; import javax.annotation.Resource; -import java.util.List; +import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; @@ -36,7 +36,8 @@ public class InitFunc implements ApplicationRunner { private RedisTemplate redisTemplate; @Resource private ArticleTypeDao articleTypeDao; - + @Resource + private FocusOnTDao focusOnTDao; /** * 初始化文章列表 */ @@ -46,6 +47,7 @@ public class InitFunc implements ApplicationRunner { for (ArticleType a: articleTypeList) { List list = lifeShareDao.queryAllByLimit(0L,100,a.getId()); if(ToolUtil.isEmpty(list)){ + redisTemplate.delete(RedisPrefix.PREFIX + a.getId()); continue; } //删除之前的 @@ -60,8 +62,34 @@ public class InitFunc implements ApplicationRunner { } } + /** + * 初始话关注列表 + */ + private void initFocusOn(){ + Set keys = redisTemplate.keys(RedisPrefix.FOCUS_ON_PREFIX + "*"); + if (keys != null) { + redisTemplate.delete(keys); + } + List focus = focusOnTDao.selectAll(); + Map> longListMap = new HashMap<>(); + for (FocusOnT f:focus) { + if(longListMap.containsKey(f.getNoticerId())){ + longListMap.get(f.getNoticerId()).add(f.getByFollowers()); + }else { + Set list = new HashSet<>(); + list.add(f.getByFollowers()); + longListMap.put(f.getNoticerId(),list); + } + } + longListMap.forEach((k,v)->{ + redisTemplate.delete(RedisPrefix.FOCUS_ON_PREFIX+k); + redisTemplate.opsForSet().add(RedisPrefix.FOCUS_ON_PREFIX+k,v.toArray(new Long[0])); + }); + log.info("init focus on data successful !"); + } @Override public void run(ApplicationArguments args) throws Exception { initArticle(); + initFocusOn(); } } diff --git a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/ScControProvider.java b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/ScControProvider.java index 696f6ed77505cca684b09797188a6a2c59918071..7b4b9e449189dba042dd0bd4277d7eaa61c32be0 100644 --- a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/ScControProvider.java +++ b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/ScControProvider.java @@ -43,7 +43,7 @@ import java.util.List; @Api("社交api") @RefreshScope /**下面参数校验对接口实现无效,只会抛出异常,推荐直接一个类,不要用实现某个接口**/ -//@Validated +/**@Validated*/ public class ScControProvider implements ScControllerApi { @Value("${spring.sc.articleListLimit}") private Integer limit; @@ -54,15 +54,11 @@ public class ScControProvider implements ScControllerApi { @Resource private RedisTemplate redisTemplate; @Autowired - private ArticleTypeService articleTypeService; - @Autowired - private MessagesTypeService messagesTypeService; - @Autowired private CollectionsService collectionsService; @Autowired - private CommentsService commentsService; - @Autowired private FootprintService footprintService; + @Autowired + private FocusOnTService focusOnTService; /** * 获取用户自己的文章列表 @@ -113,4 +109,86 @@ public class ScControProvider implements ScControllerApi { return SuccessResponseData.success(footprintService.queryAllByLimit(uid)); } + @Override + @ApiOperation("获得自己的关注与粉丝列表") + public ResponseData fenFollowers(HttpServletRequest request) { + Long uid = userUtils.getUid(request); + if(ToolUtil.isEmpty(uid)) + return SuccessResponseData.error(4500,"请检查是否登陆"); + return SuccessResponseData.success(focusOnTService.queryAllByUid(uid)); + } + + @Override + @ApiOperation("取消关注用户") + public ResponseData fenFollowersCancel(Long follwerId, HttpServletRequest request) { + if(ToolUtil.isEmpty(follwerId)) + return SuccessResponseData.error(450,"请求参数错误"); + Long uid = userUtils.getUid(request); + if(ToolUtil.isEmpty(uid)) + return SuccessResponseData.error(4500,"请检查是否登陆"); + if(focusOnTService.deleteById(uid,follwerId)){ + Long b = redisTemplate.opsForSet().remove(RedisPrefix.FOCUS_ON_PREFIX+uid,follwerId); + if(b==null){ + //删除redis失败则记录一下,方便后面补充到redis + log.error("insert redis focus on error==>>{},{}",uid,follwerId); + + } + return SuccessResponseData.success(); + } + return SuccessResponseData.error("取消关注失败"); + } + /** + * 单独查询用户自己的关注数据 + * + * @param request + * @return 对象列表 + */ + @Override + @ApiOperation("单独查询用户自己的关注数据") + public ResponseData selectFocusByUidAndLimit(int offset, HttpServletRequest request) { + Long uid = userUtils.getUid(request); + if(ToolUtil.isEmpty(uid)) + return SuccessResponseData.error(4500,"请检查是否登陆"); + return SuccessResponseData.success(focusOnTService.selectFocusByUidAndLimit(uid,offset)); + } + /** + * 单独查询用户自己的粉丝数据 + * + * @param request + * @return 对象列表 + */ + @Override + @ApiOperation("单独查询用户自己的粉丝数据") + public ResponseData selectFansByUidAndLimit(int offset, HttpServletRequest request) { + Long uid = userUtils.getUid(request); + if(ToolUtil.isEmpty(uid)) + return SuccessResponseData.error(4500,"请检查是否登陆"); + return SuccessResponseData.success(focusOnTService.selectFansByUidAndLimit(uid,offset)); + } + /** + * 关注用户 + * + * @param request + * @param follwerId 被关注用户id + * @return 实例对象 + */ + @Override + @ApiOperation("关注用户") + public ResponseData fenFollowersFocus(Long follwerId, HttpServletRequest request) { + if(ToolUtil.isEmpty(follwerId)) + return SuccessResponseData.error(450,"请求参数错误"); + Long uid = userUtils.getUid(request); + if(ToolUtil.isEmpty(uid)) + return SuccessResponseData.error(4500,"请检查是否登陆"); + if(focusOnTService.insertFocusOn(uid,follwerId)){ + Long b = redisTemplate.opsForSet().add(RedisPrefix.FOCUS_ON_PREFIX+uid,follwerId); + if(b==null){ + //插入redis失败则记录一下,方便后面补充到redis + log.error("insert redis focus on error==>>{},{}",uid,follwerId); + } + return SuccessResponseData.success(); + } + return SuccessResponseData.error("关注失败"); + } + } diff --git a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/ScDataProvider.java b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/ScDataProvider.java index 954f137c1bdb0fd10939f1024c8ef0f8dc56fe6e..de563b24a25d8d152b2d5766046a3cc2061df244 100644 --- a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/ScDataProvider.java +++ b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/ScDataProvider.java @@ -1,6 +1,9 @@ package cn.ljobin.bibi.system.provider; +import cn.hutool.core.collection.ConcurrentHashSet; import cn.ljobin.bibi.api.ScDataApi; +import cn.ljobin.bibi.cache.CommentsAgreeCache; +import cn.ljobin.bibi.constant.ArticleStatusEnum; import cn.ljobin.bibi.constant.RedisPrefix; import cn.ljobin.bibi.domain.sc.Collections; import cn.ljobin.bibi.domain.sc.Comments; @@ -28,10 +31,13 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import javax.tools.Tool; import javax.validation.Valid; import java.util.ArrayList; import java.util.Date; +import java.util.HashSet; import java.util.List; +import java.util.concurrent.ConcurrentHashMap; /** * @program: IoT-SC @@ -64,7 +70,12 @@ public class ScDataProvider implements ScDataApi { private CommentsService commentsService; @Autowired private FootprintService footprintService; - + /** + * 存放文章被删除,与文章是异常的文章id,在用户查询的时候,先看这个缓存,这个里面没有再去数据库获取 + */ + private static ConcurrentHashMap articleDisEnabled = new ConcurrentHashMap<>(); + /**空list填充用**/ + private List paddingList = new ArrayList<>(); @Override @ApiOperation("获取文章列表,传入当前的条数,一开始为0") public ResponseData getArticleList( Long tag, Integer mType) { @@ -76,22 +87,58 @@ public class ScDataProvider implements ScDataApi { @Override @ApiOperation("获取文章详情") public ResponseData getArticleById(Long id,HttpServletRequest request) { - if(ToolUtil.isEmpty(id)||id<0) - return SuccessResponseData.error(550,"参数不合法"); - RedisPrefix.READ_NUM_COVER.offerLast(id); - try { - Long uid = userUtils.getUid(request); - //保存到用户的浏览记录里面 - if(!ToolUtil.isEmpty(uid)) - footprintService.insert(new Footprint(uid,id)); - }catch (Exception e){ - //不需要保存浏览记录,但是可以添加阅读量 - log.info("===>>游客访问"); + ArticleStatusEnum statusEnum = articleDisEnabled.get(id); + if(!ToolUtil.isEmpty(statusEnum)){ + switch (statusEnum){ + case DISABLE: + return SuccessResponseData.success(201,"请求成功","文章已被作者删除"); + case EXCEPTION: + return SuccessResponseData.success(202,"请求成功","文章未通过审核"); + case NOHAVE: + return SuccessResponseData.success(205,"请求成功","文章不存在"); + default: + return SuccessResponseData.success(205,"请求成功","文章错误"); + } + }else { + if(ToolUtil.isEmpty(id)||id<0) + return SuccessResponseData.error(550,"参数不合法"); + Long uid = null; + //是否保存用户浏览记录的标志 + boolean saveUserFootTag = false; + try { + uid= userUtils.getUid(request); + saveUserFootTag = true; + }catch (Exception e){ + //不需要保存浏览记录,但是可以添加阅读量,在下面已经增加了 + log.info("===>>游客访问"); + } + LifeShareDetailWapper wapper = lifeShareService.queryById(id,uid); + if(ToolUtil.isEmpty(wapper.getEnable())){ + articleDisEnabled.put(id,ArticleStatusEnum.NOHAVE); + return SuccessResponseData.success(205,"请求成功","文章不存在"); + } + //增加文章阅读量 + RedisPrefix.READ_NUM_COVER.offerLast(id); + if(saveUserFootTag){ + //保存到用户的浏览记录里面 + if(!ToolUtil.isEmpty(uid)) + footprintService.insert(new Footprint(uid,id)); + } + if(wapper.getEnable().equals(ArticleStatusEnum.NORMAL.getStatus())){ + List comments = commentsService.queryByArticleId(id,uid); + wapper.setComments(comments); + return SuccessResponseData.success(wapper); + }else if(wapper.getEnable().equals(ArticleStatusEnum.DISABLE.getStatus())){ + articleDisEnabled.put(id,ArticleStatusEnum.DISABLE); + return SuccessResponseData.success(201,"请求成功","文章已被作者删除"); + }else if(wapper.getEnable().equals(ArticleStatusEnum.EXCEPTION.getStatus())){ + articleDisEnabled.put(id,ArticleStatusEnum.EXCEPTION); + return SuccessResponseData.success(202,"请求成功","文章未通过审核"); + }else { + wapper.setComments(paddingList); + return SuccessResponseData.success(wapper); + } } - LifeShareDetailWapper wapper = lifeShareService.queryById(id); - List comments = commentsService.queryByArticleId(id); - wapper.setComments(comments); - return SuccessResponseData.success(wapper); } @Override @@ -114,20 +161,60 @@ public class ScDataProvider implements ScDataApi { return SuccessResponseData.error(4500,"请检查是否登陆"); if(ToolUtil.isEmpty(articleId)||articleId<0) return SuccessResponseData.error(550,"参数不合法"); - RedisPrefix.AGREE_NUM_COVER.offerLast(articleId); + Long num = redisTemplate.opsForSet().add(RedisPrefix.AGREE_PREFIX+uid,articleId); + if(num!=null&&num>0){ + RedisPrefix.AGREE_NUM_COVER.offerLast(articleId); + } return SuccessResponseData.success(); } + @Override - @ApiOperation("评论点赞") - public ResponseData commentAgree(Long articleId,HttpServletRequest request) { + @ApiOperation("取消文章点赞") + public ResponseData articleCancelAgree(Long articleId, HttpServletRequest request) { Long uid = userUtils.getUid(request); if(ToolUtil.isEmpty(uid)) return SuccessResponseData.error(4500,"请检查是否登陆"); if(ToolUtil.isEmpty(articleId)||articleId<0) return SuccessResponseData.error(550,"参数不合法"); - RedisPrefix.COMMENT_AGREE_NUM_COVER.offerLast(articleId); + Long num = redisTemplate.opsForSet().remove(RedisPrefix.AGREE_PREFIX+uid,articleId); + if(num!=null&&num>0) + RedisPrefix.AGREE_NUM_COVER.offerLast(-1*articleId); return SuccessResponseData.success(); } + + @Override + @ApiOperation("评论点赞") + public ResponseData commentAgree(Long commentId,HttpServletRequest request) { + Long uid = userUtils.getUid(request); + if(ToolUtil.isEmpty(uid)) + return SuccessResponseData.error(4500,"请检查是否登陆"); + if(ToolUtil.isEmpty(commentId)||commentId<0) + return SuccessResponseData.error(550,"参数不合法"); + Long num = redisTemplate.opsForSet().add(RedisPrefix.COMMENT_Agree_PREFIX+uid,commentId); + if(num!=null&&num>0){ + RedisPrefix.COMMENT_AGREE_NUM_COVER.offerLast(commentId); + CommentsAgreeCache.cacheComets.get(uid).add(commentId); + } + + return SuccessResponseData.success(); + } + + @Override + @ApiOperation("取消评论点赞") + public ResponseData commentCancelAgree(Long commentId, HttpServletRequest request) { + Long uid = userUtils.getUid(request); + if(ToolUtil.isEmpty(uid)) + return SuccessResponseData.error(4500,"请检查是否登陆"); + if(ToolUtil.isEmpty(commentId)||commentId<0) + return SuccessResponseData.error(550,"参数不合法"); + Long num = redisTemplate.opsForSet().remove(RedisPrefix.COMMENT_Agree_PREFIX+uid,commentId); + if(num!=null&&num>0){ + RedisPrefix.COMMENT_AGREE_NUM_COVER.offerLast(-1*commentId); + CommentsAgreeCache.cacheComets.get(uid).remove(commentId); + } + return SuccessResponseData.success(); + } + @Override @ApiOperation("收藏") public ResponseData collection(Long articleId,HttpServletRequest request) { @@ -140,14 +227,33 @@ public class ScDataProvider implements ScDataApi { Collections collections = new Collections(); collections.setArticleId(articleId); collections.setUserId(uid); - collections.setCollectionsStatus("正常"); + collections.setCollectionsStatus("1"); if(collectionsService.insert(collections)>0){ + //TODO 最好放到redis中存一份,或者本地内存中缓存一份 + // RedisPrefix.COLLECT_NUM_COVER.offerLast(articleId); return SuccessResponseData.success(); } return SuccessResponseData.error("收藏失败"); } + @Override + @ApiOperation("取消收藏") + public ResponseData cancelCollection(Long articleId, HttpServletRequest request) { + Long uid = userUtils.getUid(request); + if(ToolUtil.isEmpty(uid)) + return SuccessResponseData.error(4500,"请检查是否登陆"); + if(ToolUtil.isEmpty(articleId)||articleId<0) + return SuccessResponseData.error(550,"参数不合法"); + + if(collectionsService.deleteById(uid,articleId)){ + //TODO 如果在redis中也存了一份,或者本地内存中缓存有一份,也要删除 + RedisPrefix.COLLECT_NUM_COVER.offerLast(-1*articleId); + return SuccessResponseData.success(); + } + return SuccessResponseData.error("取消收藏失败"); + } + @Override @ApiOperation("评论") @@ -187,12 +293,26 @@ public class ScDataProvider implements ScDataApi { model.andPic(pics.toArray(new String[0])); Long id = lifeShareService.insertArticle(model); if(id>0){ - LifeShareDetailWapper o = lifeShareService.queryById(id); + LifeShareDetailWapper o = lifeShareService.queryById(id,null); + //这里如果发送失败无所谓,定时任务还是会更新的 redisTemplate.opsForList().leftPushAll(RedisPrefix.PREFIX + model.getMessagesType(),o); return SuccessResponseData.success(200,"发布成功",o); } return SuccessResponseData.error("发布失败"); } + @Override + @ApiOperation("删除已发布文章,查看内容时才会判断作者是否删除") + public ResponseData deleteArticle(Long articleId, HttpServletRequest request) { + Long uid = userUtils.getUid(request); + if(ToolUtil.isEmpty(uid)) + return SuccessResponseData.error(4500,"请检查是否登陆"); + //这里只是简单的删除,没有过多的判断 + if(lifeShareService.deleteById(articleId,uid)){ + return SuccessResponseData.success(); + } + return SuccessResponseData.error("删除失败"); + } + } diff --git a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/Test.java b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/Test.java index ba25f143775b47a454e72bb4c00e7483ce88a511..0f727813de951916882fe5c0c6d431a6c8f3fb82 100644 --- a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/Test.java +++ b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/provider/Test.java @@ -31,6 +31,6 @@ public class Test { public ResponseData getArticleById(@RequestParam(value = "id", required = false) @NotNull(message = "参数不合法") @Min(value = 0,message = "参数不合法") Long id) { RedisPrefix.READ_NUM_COVER.offerLast(id); - return SuccessResponseData.success(lifeShareService.queryById(id)); + return SuccessResponseData.success(lifeShareService.queryById(id,null)); } } diff --git a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/schedule/ScheduleArticle.java b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/schedule/ScheduleArticle.java index b77e1f146ae850a75cd7d6dd4792f120e931ef08..fc88ec630fc5fbdb98afa49ebc4760703bdbe4f2 100644 --- a/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/schedule/ScheduleArticle.java +++ b/saltice-sc-admin/src/main/java/cn/ljobin/bibi/system/schedule/ScheduleArticle.java @@ -52,8 +52,9 @@ public class ScheduleArticle { //获取文章类型表 List articleTypeList = articleTypeDao.queryAllByLimit(0,100); for (ArticleType a: articleTypeList) { - List list = lifeShareService.queryAllByLimit(0L,100,a.getId()); + List list = lifeShareDao.queryAllByLimit(0L,100,a.getId()); if(ToolUtil.isEmpty(list)){ + redisTemplate.delete(RedisPrefix.PREFIX + a.getId()); continue; } redisTemplate.delete(RedisPrefix.PREFIX + a.getId()); @@ -78,12 +79,23 @@ public class ScheduleArticle { do { Long elem = RedisPrefix.COMMENT_AGREE_NUM_COVER.pollFirst(); if(elem!=null){ - if(map.containsKey(elem)){ - Integer l = map.get(elem); - l++; - map.put(elem,l); + if(elem<0){ + elem *= -1; + if(map.containsKey(elem)){ + Integer l = map.get(elem); + l--; + map.put(elem,l); + }else { + map.put(elem,-1); + } }else { - map.put(elem,1); + if(map.containsKey(elem)){ + Integer l = map.get(elem); + l++; + map.put(elem,l); + }else { + map.put(elem,1); + } } i++; }else { @@ -91,7 +103,7 @@ public class ScheduleArticle { } }while (i<=100); if(map.size()>0){ - System.err.println(map.toString()); + //System.err.println(map.toString()); Integer num = commentsDao.updateBatch(map); log.info("update comments agree nums : {}",num); } @@ -123,12 +135,26 @@ public class ScheduleArticle { do { Long elem = RedisPrefix.AGREE_NUM_COVER.pollFirst(); if(elem!=null){ + boolean tag = false; + if(elem<0){ + elem = -1*elem; + tag=true; + } if(map.containsKey(elem)){ Content l = map.get(elem); - l.setAgree(l.getAgree()+1); + if(tag){ + l.setAgree(l.getAgree()-1); + }else { + l.setAgree(l.getAgree()+1); + } }else { Content o = new Content(); - o.setAgree(1); + if(tag){ + o.setAgree(-1); + }else { + o.setAgree(1); + } + map.put(elem,o); } j++; @@ -139,12 +165,25 @@ public class ScheduleArticle { do { Long elem = RedisPrefix.COLLECT_NUM_COVER.pollFirst(); if(elem!=null){ + boolean tag = false; + if(elem<0){ + elem *= -1; + tag=true; + } if(map.containsKey(elem)){ Content l = map.get(elem); - l.setCollect(l.getCollect()+1); + if(tag){ + l.setCollect(l.getCollect()-1); + }else { + l.setCollect(l.getCollect()+1); + } }else { Content o = new Content(); - o.setCollect(1); + if(tag){ + o.setCollect(-1); + }else { + o.setCollect(1); + } map.put(elem,o); } k1++; @@ -184,7 +223,7 @@ public class ScheduleArticle { break; } }while (s<=100); - if(i>0){ + if(map.size()>0){ log.info(map.toString()); //更新数据库数据 List lifeShares = new ArrayList<>(); @@ -198,6 +237,7 @@ public class ScheduleArticle { lifeShare.setMessagesTranspondnum(v.getTransport()); lifeShares.add(lifeShare); }); + //TODO 还要插入用户点赞文章数据到agree表中 int num = lifeShareDao.updateBatch(lifeShares); log.info("batch update read nums {}",num); //更新redis diff --git a/saltice-sc-admin/src/main/resources/application.ymll b/saltice-sc-admin/src/main/resources/application.ymll index 5022b8bd5f53f72d6d49f07eaec5afa55a6b91aa..7eca89c9d6f275b34b2b42a5a9ad0dfc4f6e1cfe 100644 --- a/saltice-sc-admin/src/main/resources/application.ymll +++ b/saltice-sc-admin/src/main/resources/application.ymll @@ -40,6 +40,7 @@ mybatis-plus: ## 特别是多模块的,一定要注意,使用classpath*: mapper-locations: classpath*:cn/ljobin/bibi/**/*.xml configuration: + ## 配置sql日志打印 log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #刷新mapper,调试神器 refresh: true @@ -48,9 +49,17 @@ spring: ##每次获取的文章列表数目 articleListLimit : 10 ##查看收藏接口中 获取文章内容部分提取的长度 - infoLimit : 40 + infoLimit : 35 ##每次获取的收藏列表数目 collectionLimit : 10 + ##查看浏览记录接口中 获取浏览记录的长度 + footPrintLimit: 30 + ##只能获取最近多少天内的足迹 + footPrintLimitByDays: 30 + ## 限制每次粉丝获取数,第一次获取会x2的 + fansListLimit: 10 + ## 限制每次关注获取数,第一次获取会x2的 + focusOnListLimit: 10 kafka: producer: bootstrap-servers: 10.112.26.129:9092 diff --git a/saltice-sc-admin/src/main/resources/docker/Dockerfile b/saltice-sc-admin/src/main/resources/docker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3a46db9810b4d759515e2d36f72489d0af1a4ab1 --- /dev/null +++ b/saltice-sc-admin/src/main/resources/docker/Dockerfile @@ -0,0 +1,5 @@ +FROM openjdk:8-jdk-alpine +ADD saltice-sc-admin-1.0-SNAPSHOT.jar saltice-sc-admin-1.0-SNAPSHOT.jar +MAINTAINER Liu yan bin +EXPOSE 5052 +ENTRYPOINT ["java","-Dfile.encoding=utf-8","-jar","/saltice-sc-admin-1.0-SNAPSHOT.jar"] diff --git a/saltice-sc-api/src/main/java/cn/ljobin/bibi/api/ScControllerApi.java b/saltice-sc-api/src/main/java/cn/ljobin/bibi/api/ScControllerApi.java index 3ac2ab2d96b5522143eda7181859285cf621c56c..e64e82e7e3c22a2def6416ab3d74ccf4eb6563d9 100644 --- a/saltice-sc-api/src/main/java/cn/ljobin/bibi/api/ScControllerApi.java +++ b/saltice-sc-api/src/main/java/cn/ljobin/bibi/api/ScControllerApi.java @@ -1,10 +1,12 @@ package cn.ljobin.bibi.api; +import cn.ljobin.bibi.domain.wapper.FanFollowWrapper; import cn.ljobin.bibi.domain.wapper.LifeSharePushModel; import cn.stylefeng.roses.core.reqres.response.ResponseData; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.util.List; /** * @program: IoT-Plat @@ -47,4 +49,46 @@ public interface ScControllerApi { */ @GetMapping("/footPrint") public ResponseData footPrint(HttpServletRequest request); + + /** + * 获得自己的关注与粉丝列表 + * @param request + * @return + */ + @GetMapping("/fenFollowers") + public ResponseData fenFollowers(HttpServletRequest request); + /** + * 关注用户 + * + * @param request + * @param follwerId 被关注用户id + * @return 实例对象 + */ + @GetMapping("/fenFollowersFocus/{follwerId}") + public ResponseData fenFollowersFocus(@PathVariable("follwerId") Long follwerId,HttpServletRequest request); + /** + * 取消关注用户 + * + * @param request + * @param follwerId 被关注用户id + * @return 实例对象 + */ + @GetMapping("/fenFollowersCancel/{follwerId}") + public ResponseData fenFollowersCancel(@PathVariable("follwerId") Long follwerId,HttpServletRequest request); + /** + * 单独查询用户自己的关注数据 + * + * @param request + * @return 对象列表 + */ + @GetMapping("/selectFocusByUidAndLimit/{offset}") + public ResponseData selectFocusByUidAndLimit(@PathVariable("offset") int offset,HttpServletRequest request); + /** + * 单独查询用户自己的粉丝数据 + * + * @param request + * @return 对象列表 + */ + @GetMapping("/selectFansByUidAndLimit/{offset}") + public ResponseData selectFansByUidAndLimit(@PathVariable("offset")int offset,HttpServletRequest request); } diff --git a/saltice-sc-api/src/main/java/cn/ljobin/bibi/api/ScDataApi.java b/saltice-sc-api/src/main/java/cn/ljobin/bibi/api/ScDataApi.java index c3b4f6ce12ddcbb099dfe2df70107d4a5d733346..6910b659ecef91a5b5e53495d4e219e2594318d6 100644 --- a/saltice-sc-api/src/main/java/cn/ljobin/bibi/api/ScDataApi.java +++ b/saltice-sc-api/src/main/java/cn/ljobin/bibi/api/ScDataApi.java @@ -49,29 +49,55 @@ public interface ScDataApi { */ @GetMapping("/articleAgree/{articleId}") public ResponseData articleAgree(@PathVariable(value = "articleId") Long articleId,HttpServletRequest request); + /** + * 取消文章点赞 + * @param articleId 文章id + * @param request + * @return + */ + @GetMapping("/articleCancelAgree/{articleId}") + public ResponseData articleCancelAgree(@PathVariable(value = "articleId") Long articleId,HttpServletRequest request); /** * 评论点赞 - * @param articleId 评论id + * @param commentId 评论id + * @param request + * @return + */ + @GetMapping("/commentAgree/{commentId}") + public ResponseData commentAgree(@PathVariable(value = "commentId") Long commentId,HttpServletRequest request); + /** + * 取消评论点赞 + * @param commentId 评论id * @param request * @return */ - @GetMapping("/commentId/{commentId}") - public ResponseData commentAgree(@PathVariable(value = "commentId") Long articleId,HttpServletRequest request); + @GetMapping("/commentCancelAgree/{commentId}") + public ResponseData commentCancelAgree(@PathVariable(value = "commentId") Long commentId,HttpServletRequest request); /** * 收藏 * 收藏的并发不会太高,直接存数据库了 * @param articleId 文章id + * @param request * @return */ @GetMapping("/collection/{articleId}") public ResponseData collection(@PathVariable(value = "articleId") Long articleId,HttpServletRequest request); - + /** + * 取消收藏 + * 收藏的并发不会太高,直接存数据库了 + * @param articleId 文章id + * @param request + * @return + */ + @GetMapping("/cancelCollection/{articleId}") + public ResponseData cancelCollection(@PathVariable(value = "articleId") Long articleId,HttpServletRequest request); /** * 评论 * @param articleId 文章id * @param commentId 文章中某个评论的id * @param info 评论内容 + * @param request * @return */ @PostMapping("/comment") @@ -88,5 +114,12 @@ public interface ScDataApi { */ @PostMapping("/pushArticle") public ResponseData pushArticle(@RequestBody LifeSharePushModel model, HttpServletRequest request ); - + /** + * 删除已发布文章 + * @param articleId 文章id + * @param request + * @return + */ + @PostMapping("/deleteArticle/{articleId}") + public ResponseData deleteArticle(@PathVariable("articleId") Long articleId, HttpServletRequest request ); } diff --git a/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/sc/FocusOnT.java b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/sc/FocusOnT.java new file mode 100644 index 0000000000000000000000000000000000000000..8c73202b05eb000389c4c2ebeb27a313094383e3 --- /dev/null +++ b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/sc/FocusOnT.java @@ -0,0 +1,74 @@ +package cn.ljobin.bibi.domain.sc; + +import java.util.Date; +import java.io.Serializable; + +/** + * 关注表(FocusOnT)实体类 + * + * @author liuyanbin + * @since 2020-07-23 08:57:40 + */ +public class FocusOnT implements Serializable { + private static final long serialVersionUID = 475194601101328916L; + + private Long id; + /** + * 关注者id + */ + private Long noticerId; + /** + * 被关注者id + */ + private Long byFollowers; + /** + * 关注时间 + */ + private Date focusDate; + /** + * 是否有效 1-有效,0-无效 + */ + private String enable; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getNoticerId() { + return noticerId; + } + + public void setNoticerId(Long noticerId) { + this.noticerId = noticerId; + } + + public Long getByFollowers() { + return byFollowers; + } + + public void setByFollowers(Long byFollowers) { + this.byFollowers = byFollowers; + } + + public Date getFocusDate() { + return focusDate; + } + + public void setFocusDate(Date focusDate) { + this.focusDate = focusDate; + } + + public String getEnable() { + return enable; + } + + public void setEnable(String enable) { + this.enable = enable; + } + +} \ No newline at end of file diff --git a/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/sc/LifeShareDetail.java b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/sc/LifeShareDetail.java index 4fce25e945493b15573ac2380e2ec26bd3c7669b..3f220542e3a76d4f22fc08629a4c709fb49c1847 100644 --- a/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/sc/LifeShareDetail.java +++ b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/sc/LifeShareDetail.java @@ -68,6 +68,52 @@ public class LifeShareDetail implements Serializable { * 用户头像 */ private String avatar; + /**是否点赞**/ + private Boolean agreed; + /** + * 是否收藏 + */ + private Boolean collected; + /** + * 文章状态 + */ + private String enable; + /** + * 作者id + */ + private Long uid; + + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + public String getEnable() { + return enable; + } + + public void setEnable(String enable) { + this.enable = enable; + } + + public Boolean getAgreed() { + return agreed; + } + + public void setAgreed(Boolean agreed) { + this.agreed = agreed; + } + + public Boolean getCollected() { + return collected; + } + + public void setCollected(Boolean collected) { + this.collected = collected; + } public String getAvatar() { return avatar; diff --git a/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/CommentsWapper.java b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/CommentsWapper.java index 6700c18fd39b06c36dd471d146d53531f7b0827d..f4dba2f1d7d9423358008e9aaa71eb571821535f 100644 --- a/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/CommentsWapper.java +++ b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/CommentsWapper.java @@ -52,6 +52,10 @@ public class CommentsWapper implements Serializable { * 当前评论的点赞数 */ private Integer agreeNum; + /** + * 是否点赞 + */ + private boolean agreed; /** * 当前评论的子评论 */ diff --git a/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/FanFollowWrapper.java b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/FanFollowWrapper.java new file mode 100644 index 0000000000000000000000000000000000000000..8dd9016cd50278a7fe31c619d63ca8332ab520fe --- /dev/null +++ b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/FanFollowWrapper.java @@ -0,0 +1,47 @@ +package cn.ljobin.bibi.domain.wapper; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @program: IoT-social-circle + * @description: 粉丝关注 包装 + * @author: Mr.Liu + * @create: 2020-07-23 08:55 + **/ +@Data +public class FanFollowWrapper implements Serializable { + private static final long serialVersionUID = 475194601101328916L; + + private Long id; + /** + * 被关注者id + */ + private String byFollowers; + /** + * 我的关注或者我的粉丝的头像 + */ + private String avatar; + /** + * 我的关注或者我的粉丝的名字 + */ + private String name; + /** + * 关注时间 + */ + private Date focusDate; + /** + * 是否是关注的,true为自己关注的,false为自己的粉丝 + */ + private boolean follower; + /** + * 如果这个是粉丝数据,这个标志表示是否也关注了他 + */ + private boolean fansFocus; + /** + * 关注的人与粉丝的简介 + */ + private String introduction; +} diff --git a/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/LifeShareDetailWapper.java b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/LifeShareDetailWapper.java index e97b09202e7f25400521f7e747a6268e11c11b75..2596d0995437ed0db2741bbe87426422fcf24bc0 100644 --- a/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/LifeShareDetailWapper.java +++ b/saltice-sc-api/src/main/java/cn/ljobin/bibi/domain/wapper/LifeShareDetailWapper.java @@ -62,11 +62,17 @@ public class LifeShareDetailWapper implements Serializable { * 用户名称 */ private String uname; + /** + * 作者id + */ + private Long uid; /** * 用户头像 */ private String avatar; - + /** + * 内容 + */ private List content; /** @@ -74,7 +80,19 @@ public class LifeShareDetailWapper implements Serializable { */ private List comments; + /** + * 是否点赞 + */ + private boolean agreed; + /** + * 是否收藏 + */ + private boolean collected; + /** + * 文章状态 + */ + private String enable; public LifeShareDetailWapper() { @@ -90,13 +108,13 @@ public class LifeShareDetailWapper implements Serializable { this.build(l.getMessagesId(),l.getMessagesType(),l.getMessagesTitle(), l.getMessagesTime(),l.getMessagesCollectnum(),l.getMessagesCommentnum(), l.getMessagesTranspondnum(),l.getMessagesAgreenum(),l.getMessagesReadnum(), - l.getUname(),l.getAvatar(),contents); + l.getUname(),l.getAvatar(),contents,l.getAgreed(),l.getCollected(),l.getEnable(),l.getUid()); } private void build(Long messagesId, String messagesType, String messagesTitle, Date messagesTime, Integer messagesCollectnum, Integer messagesCommentnum, Integer messagesTranspondnum, Integer messagesAgreenum, Integer messagesReadnum, - String uname,String avatar,List content) { + String uname,String avatar,List content,boolean agreed,boolean collected,String enable,Long uid) { this.messagesId = messagesId; this.messagesType = messagesType; this.messagesTitle = messagesTitle; @@ -109,6 +127,40 @@ public class LifeShareDetailWapper implements Serializable { this.uname = uname; this.avatar = avatar; this.content = content; + this.agreed = agreed; + this.collected = collected; + this.enable=enable; + this.uid = uid; + } + public String getEnable() { + return enable; + } + + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + public void setEnable(String enable) { + this.enable = enable; + } + public boolean isAgreed() { + return agreed; + } + + public void setAgreed(boolean agreed) { + this.agreed = agreed; + } + + public boolean isCollected() { + return collected; + } + + public void setCollected(boolean collected) { + this.collected = collected; } public List getComments() { diff --git a/saltice-sc-common/src/main/java/cn/ljobin/bibi/cache/CommentsAgreeCache.java b/saltice-sc-common/src/main/java/cn/ljobin/bibi/cache/CommentsAgreeCache.java new file mode 100644 index 0000000000000000000000000000000000000000..525fd47a75d69cfb6a4490b79a8aedee32f1d227 --- /dev/null +++ b/saltice-sc-common/src/main/java/cn/ljobin/bibi/cache/CommentsAgreeCache.java @@ -0,0 +1,17 @@ +package cn.ljobin.bibi.cache; + +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @program: IoT-social-circle + * @description: 评论点赞缓存 + * @author: Mr.Liu + * @create: 2020-07-19 18:11 + **/ +public class CommentsAgreeCache { + /** + * 缓存用户的评论点赞表 + */ + public static ConcurrentHashMap> cacheComets = new ConcurrentHashMap<>(); +} diff --git a/saltice-sc-common/src/main/java/cn/ljobin/bibi/constant/ArticleStatusEnum.java b/saltice-sc-common/src/main/java/cn/ljobin/bibi/constant/ArticleStatusEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..3c6a8c949762ac59ed2022183b90cf251f51f66e --- /dev/null +++ b/saltice-sc-common/src/main/java/cn/ljobin/bibi/constant/ArticleStatusEnum.java @@ -0,0 +1,29 @@ +package cn.ljobin.bibi.constant; + +/** + * @program: IoT-social-circle + * @description: 文章状态枚举 + * @author: Mr.Liu + * @create: 2020-07-19 09:38 + **/ +public enum ArticleStatusEnum { + NORMAL("1","正常"), + DISABLE("0","删除"), + NOHAVE("-1","不存在"), + EXCEPTION("2","异常"); + private String status; + private String type; + + ArticleStatusEnum(String status, String type) { + this.status = status; + this.type = type; + } + + public String getStatus() { + return status; + } + + public String getType() { + return type; + } +} diff --git a/saltice-sc-common/src/main/java/cn/ljobin/bibi/constant/RedisPrefix.java b/saltice-sc-common/src/main/java/cn/ljobin/bibi/constant/RedisPrefix.java index d5877180c083eb27500078f3dc361db27ad32c44..8af60e77164b8e5e3a1896b64efaadea9320fed4 100644 --- a/saltice-sc-common/src/main/java/cn/ljobin/bibi/constant/RedisPrefix.java +++ b/saltice-sc-common/src/main/java/cn/ljobin/bibi/constant/RedisPrefix.java @@ -13,6 +13,14 @@ import java.util.concurrent.atomic.AtomicLong; public class RedisPrefix { /**文章列表前缀**/ public static final String PREFIX = "articleType:"; + /**文章点赞前缀**/ + public static final String AGREE_PREFIX = "articleAgree:"; + /**文章评论点赞前缀**/ + public static final String COMMENT_Agree_PREFIX = "articleCommentAgree:"; + /**文章收藏前缀**/ + public static final String COLLECTION_PREFIX = "articleCollection:"; + /**关注列表前缀**/ + public static final String FOCUS_ON_PREFIX = "focusOn:"; /** * 记录文章阅读数 * 放值从左边 diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/controller/FootprintController.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/controller/FootprintController.java deleted file mode 100644 index 8b70ff764fc1c988290d4d6d80c65536e6c6b932..0000000000000000000000000000000000000000 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/controller/FootprintController.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.ljobin.bibi.controller; - -import cn.ljobin.bibi.domain.sc.Footprint; -import cn.ljobin.bibi.service.FootprintService; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; - -/** - * 用户足迹表(Footprint)表控制层 - * - * @author makejava - * @since 2020-07-02 20:57:30 - */ -@RestController -@RequestMapping("footprint") -public class FootprintController { - /** - * 服务对象 - */ - @Resource - private FootprintService footprintService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public Footprint selectOne(Integer id) { - return this.footprintService.queryById(id); - } - -} \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/CollectionsDao.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/CollectionsDao.java index b0118424357e721b88703a4f593ed9e5a207861b..75509897da7d7115eb71ec224197f679071ada1b 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/CollectionsDao.java +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/CollectionsDao.java @@ -58,11 +58,12 @@ public interface CollectionsDao { int update(Collections collections); /** - * 通过主键删除数据 + * 删除数据 * - * @param collectionsId 主键 + * @param uid 用户id + * @param article 文章id * @return 影响行数 */ - int deleteById(Long collectionsId); + int deleteById(@Param("uid") Long uid,@Param("article") Long article); } \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/FocusOnTDao.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/FocusOnTDao.java new file mode 100644 index 0000000000000000000000000000000000000000..5c1ec84c08061b8cd3ea006f4462d352c3e36ff2 --- /dev/null +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/FocusOnTDao.java @@ -0,0 +1,86 @@ +package cn.ljobin.bibi.mapper; + +import cn.ljobin.bibi.domain.sc.FocusOnT; +import cn.ljobin.bibi.domain.wapper.FanFollowWrapper; +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + * 关注表(FocusOnT)表数据库访问层 + * + * @author liuyanbin + * @since 2020-07-23 08:57:42 + */ +public interface FocusOnTDao { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + FocusOnT queryById(Long id); + + /** + * 查询所以行数据,用与热加载数据 + * + * @return 对象列表 + */ + List selectAll(); + /** + * 查询用户自己的关注与粉丝数据 + * + * @param uid 用户id + * @param enable 是否有效 + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + List queryAllByUid(@Param("uid") long uid, @Param("enable") String enable,@Param("offset") int offset, @Param("limit") int limit); + /** + * 单独查询用户自己的关注数据 + * + * @param uid 用户id + * @return 对象列表 + */ + List selectFocusByUidAndLimit(@Param("uid") long uid,@Param("offset") int offset,@Param("enable") String enable, @Param("limit") int limit); + /** + * 单独查询用户自己的粉丝数据 + * + * @param uid 用户id + * @return 对象列表 + */ + List selectFansByUidAndLimit(@Param("uid")long uid,@Param("offset") int offset,@Param("enable") String enable, @Param("limit") int limit); + /** + * 通过实体作为筛选条件查询 + * + * @param focusOnT 实例对象 + * @return 对象列表 + */ + List queryAll(FocusOnT focusOnT); + + /** + * 新增数据 关注用户 + * + * @param noticerId 操作者用户id + * @param follwerId 被关注用户id + * @return 影响行数 + */ + int insert(@Param("noticerId") long noticerId,@Param("follwerId")long follwerId); + + /** + * 修改数据 + * + * @param focusOnT 实例对象 + * @return 影响行数 + */ + int update(FocusOnT focusOnT); + + /** + * 通过主键删除数据 + * + * @return 影响行数 + */ + int deleteById(@Param("noticerId") long noticerId,@Param("follwerId")long follwerId); + +} \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/LifeShareDao.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/LifeShareDao.java index 916c3e1cdd1aa2ef706c614cfff89bec2aa84ca2..a15eb8b6aca9d694ba07c05a814ae75cc5b1a85f 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/LifeShareDao.java +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/LifeShareDao.java @@ -20,9 +20,10 @@ public interface LifeShareDao { * 通过ID查询单条数据 * * @param messagesId 主键 + * @param uid 用户id,可传空 * @return 实例对象 */ - List queryById(Long messagesId); + List queryById(@Param("messagesId") Long messagesId,@Param("uid") Long uid); /** * 查询指定行数据 @@ -72,12 +73,13 @@ public interface LifeShareDao { int updateBatch(List list); /** - * 通过主键删除数据 + * 通过文章id与发表用户删除数据 * - * @param messagesId 主键 + * @param articleId 主键 + * @param uid 主键 * @return 影响行数 */ - int deleteById(Long messagesId); + int deleteById(@Param("articleId") Long articleId,@Param("uid") Long uid); /** * 获取用户自己的文章列表 * @param offset 分页码 diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/CollectionsDao.xml b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/CollectionsDao.xml index 9ddf7b6851d410de0d00348aba71f9705283c807..3374be91d9ad5c110e5648825520a77821c35eb7 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/CollectionsDao.xml +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/CollectionsDao.xml @@ -94,7 +94,7 @@ - delete from collections where collections_id = #{collectionsId} + delete from collections where user_id = #{uid} and article_id = #{article} \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/CommentsDao.xml b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/CommentsDao.xml index f563a88e735af0205829f0026485827171c0e3d1..a982e5039d43fc450aa003bf4c90eff85c7dff74 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/CommentsDao.xml +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/CommentsDao.xml @@ -113,7 +113,14 @@ - when comments_id = #{key} then comments.agree_num+#{value} + when comments_id = #{key} and #{value} = 0 + then comments.agree_num + when comments_id = #{key} and #{value} < 0 and comments.agree_num + #{value} <= 0 + then 0 + when comments_id = #{key} and #{value} < 0 and comments.agree_num + #{value} > 0 + then comments.agree_num + #{value} + when comments_id = #{key} and #{value} > 0 + then comments.agree_num + #{value} diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/FocusOnTDao.xml b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/FocusOnTDao.xml new file mode 100644 index 0000000000000000000000000000000000000000..134b3c95fcafdec341baedd3a0748cbddaa08c71 --- /dev/null +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/FocusOnTDao.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into focus_on_t(noticer_id, by_followers) + values (#{noticerId}, #{follwerId}) + + + + + update focus_on_t + + + noticer_id = #{noticerId}, + + + by_followers = #{byFollowers}, + + + focus_date = #{focusDate}, + + + enable = #{enable}, + + + where id = #{id} + + + + + delete from focus_on_t where noticer_id = #{noticerId} and by_followers = #{follwerId} + + + \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/LifeShareDao.xml b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/LifeShareDao.xml index 3b069e2767fdb3654d271509482b4a22f175a5a7..ec888a08abceec4ae145a619b2121a21200c4524 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/LifeShareDao.xml +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/LifeShareDao.xml @@ -44,22 +44,33 @@ + + + + - + @@ -71,7 +82,7 @@ from life_share l left join article_type a on a. id = l.messages_type left join roses_system.sys_user su on su.USER_ID = l.uid - where l.messages_type = #{mtype} + where l.messages_type = #{mtype} and l.enable = '1' limit #{offset}, #{limit} @@ -127,7 +138,7 @@ from life_share l left join article_type a on a. id = l.messages_type left join roses_system.sys_user su on su.USER_ID = l.uid - where l.uid = #{uid} + where l.uid = #{uid} and l.enable = '1' and l.messages_type = #{mtype} @@ -209,7 +220,14 @@ - when messages_id = #{item.messagesId} then life_share.messages_agreenum+#{item.messagesAgreenum} + when messages_id = #{item.messagesId} and #{item.messagesAgreenum} = 0 + then life_share.messages_agreenum + when messages_id = #{item.messagesId} and #{item.messagesAgreenum} < 0 and life_share.messages_agreenum + #{item.messagesAgreenum} <= 0 + then 0 + when messages_id = #{item.messagesId} and #{item.messagesAgreenum} < 0 and life_share.messages_agreenum + #{item.messagesAgreenum} > 0 + then life_share.messages_agreenum+ #{item.messagesAgreenum} + when messages_id = #{item.messagesId} and #{item.messagesAgreenum} > 0 + then life_share.messages_agreenum+ #{item.messagesAgreenum} when messages_id = #{item.messagesId} then life_share.messages_agreenum @@ -239,7 +257,14 @@ - when messages_id = #{item.messagesId} then life_share.messages_collectnum+#{item.messagesCollectnum} + when messages_id = #{item.messagesId} and #{item.messagesCollectnum} = 0 + then life_share.messages_collectnum + when messages_id = #{item.messagesId} and #{item.messagesCollectnum} < 0 and life_share.messages_collectnum + #{item.messagesCollectnum} <= 0 + then 0 + when messages_id = #{item.messagesId} and #{item.messagesCollectnum} < 0 and life_share.messages_collectnum + #{item.messagesCollectnum} > 0 + then life_share.messages_collectnum+ #{item.messagesCollectnum} + when messages_id = #{item.messagesId} and #{item.messagesCollectnum} > 0 + then life_share.messages_collectnum+ #{item.messagesCollectnum} when messages_id = #{item.messagesId} then life_share.messages_collectnum @@ -254,8 +279,8 @@ - - delete from life_share where messages_id = #{messagesId} - + + update life_share set enable = '0' where messages_id = #{articleId} and uid = #{uid} + \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/CollectionsService.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/CollectionsService.java index 09d98e88140e1620b40db9396570782cca5a40b3..9d77192effa35bd71a8aadf3e5b628068781c70f 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/CollectionsService.java +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/CollectionsService.java @@ -48,9 +48,10 @@ public interface CollectionsService { /** * 通过主键删除数据 * - * @param collectionsId 主键 + * @param uid 用户id + * @param article 文章id * @return 是否成功 */ - boolean deleteById(Long collectionsId); + boolean deleteById(Long uid,Long article); } \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/CommentsService.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/CommentsService.java index 5baa26e3577320983bc91cb17986b9e79b52a416..291e9d1dcb0a0f1eb475366b1bbd32a444e22148 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/CommentsService.java +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/CommentsService.java @@ -24,9 +24,10 @@ public interface CommentsService { * 通过文章ID查询使用评论数据 * * @param articleId 主键 + * @param uid 用户主键,可以为空,空就是游客访问,不需要处理是否点赞 * @return 实例对象 */ - List queryByArticleId(Long articleId); + List queryByArticleId(Long articleId,Long uid); /** * 查询多条数据 * diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/FocusOnTService.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/FocusOnTService.java new file mode 100644 index 0000000000000000000000000000000000000000..700d53794246764f7f36d665a59804910f80ca92 --- /dev/null +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/FocusOnTService.java @@ -0,0 +1,73 @@ +package cn.ljobin.bibi.service; + +import cn.ljobin.bibi.domain.sc.FocusOnT; +import cn.ljobin.bibi.domain.wapper.FanFollowWrapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 关注表(FocusOnT)表服务接口 + * + * @author liuyanbin + * @since 2020-07-23 08:57:43 + */ +public interface FocusOnTService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + FocusOnT queryById(Long id); + + /** + * 查询用户自己的关注与粉丝数据 + * + * @param uid 用户id + * @return 对象列表 + */ + Map> queryAllByUid(long uid); + /** + * 单独查询用户自己的关注数据 + * + * @param uid 用户id + * @return 对象列表 + */ + List selectFocusByUidAndLimit(long uid,int offset); + /** + * 单独查询用户自己的粉丝数据 + * + * @param uid 用户id + * @return 对象列表 + */ + List selectFansByUidAndLimit(long uid,int offset); + /** + * 新增数据 关注用户 + * + * @param noticerId 操作者用户id + * @param follwerId 被关注用户id + * @return 实例对象 + */ + boolean insertFocusOn(long noticerId,long follwerId); + + /** + * 修改数据 + * + * @param focusOnT 实例对象 + * @return 实例对象 + */ + FocusOnT update(FocusOnT focusOnT); + + /** + * 通过用户id与被关注用户id删除数据 + * + * @param noticerId + * @param follwerId + * @return 是否成功 + */ + boolean deleteById(long noticerId,long follwerId); + +} \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/CollectionsServiceImpl.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/CollectionsServiceImpl.java index c92aae829e1d281dbbe694c7ec2de321e3b25ff7..e30857cce77cb85e703353c4e60dbe00c84528c7 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/CollectionsServiceImpl.java +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/CollectionsServiceImpl.java @@ -81,11 +81,12 @@ public class CollectionsServiceImpl implements CollectionsService { /** * 通过主键删除数据 * - * @param collectionsId 主键 + * @param uid 用户id + * @param article 文章id * @return 是否成功 */ @Override - public boolean deleteById(Long collectionsId) { - return this.collectionsDao.deleteById(collectionsId) > 0; + public boolean deleteById(Long uid,Long article) { + return this.collectionsDao.deleteById(uid,article) > 0; } } \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/CommentsServiceImpl.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/CommentsServiceImpl.java index f565c7bd4164e7b1dc523d5bf0ec551fcead4179..17e0d04d69694924da257ca659bf5fa6dc0f5a95 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/CommentsServiceImpl.java +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/CommentsServiceImpl.java @@ -1,13 +1,18 @@ package cn.ljobin.bibi.service.Impl; +import cn.ljobin.bibi.cache.CommentsAgreeCache; +import cn.ljobin.bibi.constant.RedisPrefix; import cn.ljobin.bibi.domain.sc.Comments; import cn.ljobin.bibi.domain.wapper.CommentsWapper; import cn.ljobin.bibi.mapper.CommentsDao; import cn.ljobin.bibi.service.CommentsService; +import cn.stylefeng.roses.core.util.ToolUtil; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; /** @@ -20,6 +25,8 @@ import java.util.stream.Collectors; public class CommentsServiceImpl implements CommentsService { @Resource private CommentsDao commentsDao; + @Resource + private RedisTemplate redisTemplate; /** * 通过ID查询单条数据 @@ -36,31 +43,50 @@ public class CommentsServiceImpl implements CommentsService { * TODO 有点浪费空间,可以选择保存下来,必要时更新一些数据 * * @param articleId 主键 + * @param uid 用户主键,可以为空,空就是游客访问,不需要处理是否点赞 * @return 实例对象 */ @Override - public List queryByArticleId(Long articleId) { + public List queryByArticleId(Long articleId,Long uid) { + boolean tag = false; + Set o1 = null; + if(uid!=null){ + o1 = CommentsAgreeCache.cacheComets.get(uid); + if(ToolUtil.isEmpty(o1)) + o1 = redisTemplate.opsForSet().members(RedisPrefix.COMMENT_Agree_PREFIX+uid); + if(!ToolUtil.isEmpty(o1)){ + CommentsAgreeCache.cacheComets.put(uid,o1); + tag = true; + } + } //获取数据库原始数据 List data = this.commentsDao.queryByArticleId(articleId); + int len = data.size(); //用来保存 k-v ==> 被评论的id : 评论信息集合,因为一个评论会有多个评论回复 - HashMap> o = new HashMap<>(); + HashMap> o = new HashMap<>(len); //用来保存 k-v ==> 当前评论的id:当前评论信息 - HashMap o2 = new HashMap<>(); - // o 的一个引用 - HashMap> finalO1 = o; + HashMap o2 = new HashMap<>(len); //遍历从数据库获取的原始数据 , v是单独一个数据的引用 + boolean finalTag = tag; + Set finalO = o1; data.forEach(v->{ + if(finalTag){ + if(!ToolUtil.isEmpty(finalO) && finalO.contains(v.getCommentsId())){ + //更新当前用户是否点赞该评论 + v.setAgreed(true); + } + } //每一个评论都会保存至o2,方便后面根据评论自己的id查询到评论自己的信息 o2.put(v.getCommentsId(),v); //如果o中有这个key(v的上级评论id,就是被v的评论的评论id),就加入到key对应的集合中去 - if(finalO1.containsKey(v.getArticleCommentId())){ - finalO1.get(v.getArticleCommentId()).add(v); + if(o.containsKey(v.getArticleCommentId())){ + o.get(v.getArticleCommentId()).add(v); }else{ //没有这个key,就创建一个新的集合,并把当前评论加入到里面去 List list = new ArrayList<>(); list.add(v); //把这个集合作为value,被评论的id作为key,put到HashMap o中去 - finalO1.put(v.getArticleCommentId(),list); + o.put(v.getArticleCommentId(),list); } }); //遍历o ,因为o是hashMap, 索引下面的k,v分别对应key,value diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/FocusOnTServiceImpl.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/FocusOnTServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1ce06a014eb502c0e025d9e9de0a07d4c3716e52 --- /dev/null +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/FocusOnTServiceImpl.java @@ -0,0 +1,146 @@ +package cn.ljobin.bibi.service.Impl; + +import cn.ljobin.bibi.constant.RedisPrefix; +import cn.ljobin.bibi.constant.Status; +import cn.ljobin.bibi.domain.sc.FocusOnT; +import cn.ljobin.bibi.domain.wapper.FanFollowWrapper; +import cn.ljobin.bibi.mapper.FocusOnTDao; +import cn.ljobin.bibi.service.FocusOnTService; +import cn.stylefeng.roses.core.util.ToolUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 关注表(FocusOnT)表服务实现类 + * + * @author liuyanbin + * @since 2020-07-23 08:57:43 + */ +@Service("focusOnTService") +@RefreshScope +public class FocusOnTServiceImpl implements FocusOnTService { + @Resource + private FocusOnTDao focusOnTDao; + /** + * 限制每次粉丝获取数,第一次获取会x2的 + */ + @Value("${spring.sc.fansListLimit}") + private int fansListLimit; + /** + * 限制每次关注获取数,第一次获取会x2的 + */ + @Value("${spring.sc.focusOnListLimit}") + private int focusOnListLimit; + @Resource + private RedisTemplate redisTemplate; + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public FocusOnT queryById(Long id) { + return this.focusOnTDao.queryById(id); + } + + /** + * 查询用户自己的关注与粉丝数据 + * + * @param uid 用户id + * @return 对象列表 + */ + @Override + public Map> queryAllByUid(long uid) { + Map> map = new HashMap<>(); + map.put("fans",new ArrayList<>()); + map.put("focusOn",new ArrayList<>()); + Set focus = redisTemplate.opsForSet().members(RedisPrefix.FOCUS_ON_PREFIX+uid); + List fanFollowWrappers = this.focusOnTDao.queryAllByUid(uid, Status.isEnable,0,(focusOnListLimit<10?10:focusOnListLimit)*2); + for (FanFollowWrapper f: fanFollowWrappers) { + if(f.isFollower()){ + map.get("focusOn").add(f); + }else { + if(focus != null ? focus.contains(Long.parseLong(f.getByFollowers())) : false){ + f.setFansFocus(true); + } + map.get("fans").add(f); + } + } + return map; + } + /** + * 单独查询用户自己的关注数据 + * + * @param uid 用户id + * @return 对象列表 + */ + @Override + public List selectFocusByUidAndLimit(long uid, int offset) { + return this.focusOnTDao.selectFocusByUidAndLimit(uid,offset,Status.isEnable,focusOnListLimit); + } + /** + * 单独查询用户自己的粉丝数据 + * + * @param uid 用户id + * @return 对象列表 + */ + @Override + public List selectFansByUidAndLimit(long uid, int offset) { + //Set sets = redisTemplate.opsForZSet().range(RedisPrefix.FOCUS_ON_PREFIX+uid,0,-1); + List fanFollowWrappers = this.focusOnTDao.selectFansByUidAndLimit(uid, offset,Status.isEnable,fansListLimit); + Set sets = redisTemplate.opsForSet().members(RedisPrefix.FOCUS_ON_PREFIX+uid); + System.err.println(sets); + if(ToolUtil.isEmpty(sets)){ + return fanFollowWrappers; + } + fanFollowWrappers.forEach(v->{ + long l = Long.parseLong(v.getByFollowers()); + if(sets.contains(l)){ + System.err.println(l+"sssss"); + v.setFansFocus(true); + }else + System.err.println("ssssss"); + }); + return fanFollowWrappers; + } + + /** + * 新增数据 关注用户 + * + * @param noticerId 操作者用户id + * @param follwerId 被关注用户id + * @return 实例对象 + */ + @Override + public boolean insertFocusOn(long noticerId,long follwerId) { + return this.focusOnTDao.insert(noticerId,follwerId)>0; + } + + /** + * 修改数据 + * + * @param focusOnT 实例对象 + * @return 实例对象 + */ + @Override + public FocusOnT update(FocusOnT focusOnT) { + this.focusOnTDao.update(focusOnT); + return this.queryById(focusOnT.getId()); + } + + /** + * 通过主键删除数据 + * @return 是否成功 + */ + @Override + public boolean deleteById(long noticerId,long follwerId) { + return this.focusOnTDao.deleteById(noticerId, follwerId) > 0; + } +} \ No newline at end of file diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/LifeShareServiceImpl.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/LifeShareServiceImpl.java index 6263a4c323034ca46111c7a436d734a1326802ab..53cfc429411ad8973bb11bb218767e0d5204dc6b 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/LifeShareServiceImpl.java +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/Impl/LifeShareServiceImpl.java @@ -27,7 +27,6 @@ import java.util.List; */ @Service("lifeShareService") public class LifeShareServiceImpl implements LifeShareService { - public static final String PRFIX = "articleType:"; @Resource private LifeShareDao lifeShareDao; @Autowired @@ -38,11 +37,20 @@ public class LifeShareServiceImpl implements LifeShareService { * 通过ID查询单条数据 * * @param messagesId 主键 + * @param uid 用户id,可传空 * @return 实例对象 */ @Override - public LifeShareDetailWapper queryById(Long messagesId) { - return new LifeShareDetailWapper(this.lifeShareDao.queryById(messagesId)); + public LifeShareDetailWapper queryById(Long messagesId,Long uid) { + LifeShareDetailWapper detailWapper = new LifeShareDetailWapper(this.lifeShareDao.queryById(messagesId,uid)); + if(uid==null){ + return detailWapper; + } + Boolean agree = redisTemplate.opsForSet().isMember(RedisPrefix.AGREE_PREFIX+uid,messagesId); + if(agree!=null){ + detailWapper.setAgreed(agree); + } + return detailWapper; } /** @@ -96,18 +104,19 @@ public class LifeShareServiceImpl implements LifeShareService { @Override public LifeShareDetailWapper update(LifeShare lifeShare) { this.lifeShareDao.update(lifeShare); - return this.queryById(lifeShare.getMessagesId()); + return this.queryById(lifeShare.getMessagesId(),null); } /** * 通过主键删除数据 * - * @param messagesId 主键 + * @param articleId 主键 + * @param uid 主键 * @return 是否成功 */ @Override - public boolean deleteById(Long messagesId) { - return this.lifeShareDao.deleteById(messagesId) > 0; + public boolean deleteById(Long articleId,Long uid) { + return this.lifeShareDao.deleteById(articleId, uid) > 0; } /** * 获取用户自己的文章列表 diff --git a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/LifeShareService.java b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/LifeShareService.java index 89989b07de4e03c7b721dafba30202943b471122..85008133b0a7a7b55606a0c5ceac38f1a150d5d6 100644 --- a/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/LifeShareService.java +++ b/saltice-sc-iot/src/main/java/cn/ljobin/bibi/service/LifeShareService.java @@ -22,7 +22,7 @@ public interface LifeShareService { * @param messagesId 主键 * @return 实例对象 */ - LifeShareDetailWapper queryById(Long messagesId); + LifeShareDetailWapper queryById(Long messagesId,Long uid); /** * 查询多条数据 @@ -57,10 +57,11 @@ public interface LifeShareService { /** * 通过主键删除数据 * - * @param messagesId 主键 + * @param articleId 主键 + * @param uid 主键 * @return 是否成功 */ - boolean deleteById(Long messagesId); + boolean deleteById(Long articleId,Long uid); /** * 获取用户自己的文章列表 * @param tag 分页码