Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李伟
cust-api
Commits
e6b32a19
Commit
e6b32a19
authored
Feb 08, 2025
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查看他人动态,未关注的只能查看5条,已关注的查看近一个月的,数据字典控制
parent
29dc04b9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
163 additions
and
9 deletions
+163
-9
AppOpmArticleController.java
...ft/app/appArticle/controller/AppOpmArticleController.java
+12
-0
MemInfoServiceImpl.java
...oft/business/memInfo/service/impl/MemInfoServiceImpl.java
+0
-1
OpmArticleRepository.java
...rcisoft/business/opmArticle/dao/OpmArticleRepository.java
+3
-0
OpmArticle.java
...va/org/rcisoft/business/opmArticle/entity/OpmArticle.java
+7
-0
OpmArticleService.java
...cisoft/business/opmArticle/service/OpmArticleService.java
+6
-0
OpmArticleServiceImpl.java
...siness/opmArticle/service/impl/OpmArticleServiceImpl.java
+72
-4
MemInfoMapper.xml
...esources/mapper/business/memInfo/mapper/MemInfoMapper.xml
+2
-4
OpmArticleMapper.xml
...es/mapper/business/opmArticle/mapper/OpmArticleMapper.xml
+61
-0
No files found.
src/main/java/org/rcisoft/app/appArticle/controller/AppOpmArticleController.java
View file @
e6b32a19
...
@@ -62,6 +62,18 @@ public class AppOpmArticleController extends CyPaginationController<OpmArticle>
...
@@ -62,6 +62,18 @@ public class AppOpmArticleController extends CyPaginationController<OpmArticle>
return
getGridModelResponse
();
return
getGridModelResponse
();
}
}
/**
* 查询某个人的动态列表
*/
@CyOpeLogAnno
(
title
=
"system-动态管理-查询某人的动态列表"
,
businessType
=
CyLogTypeEnum
.
QUERY
)
@Operation
(
summary
=
"分页查询某人的动态列表集合"
,
description
=
"分页查询某人的动态列表集合"
)
@GetMapping
(
value
=
"/open/opmArticle/queryUserArticleByPagination"
)
public
CyGridModel
userArticleListByPagination
(
OpmArticle
opmArticle
)
{
opmArticleServiceImpl
.
findUserArticleByPagination
(
getPaginationUtility
(),
opmArticle
);
return
getGridModelResponse
();
}
/**
/**
* 动态-点赞
* 动态-点赞
*/
*/
...
...
src/main/java/org/rcisoft/business/memInfo/service/impl/MemInfoServiceImpl.java
View file @
e6b32a19
...
@@ -713,7 +713,6 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
...
@@ -713,7 +713,6 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
*/
*/
@Override
@Override
public
CyPersistModel
leaveMessage
(
UserLeaveMessageDTO
dto
)
{
public
CyPersistModel
leaveMessage
(
UserLeaveMessageDTO
dto
)
{
dto
.
setDelStatus
(
"0"
);
dto
.
setUserId
(
Integer
.
valueOf
(
CyUserUtil
.
getAuthenBusinessId
()));
dto
.
setUserId
(
Integer
.
valueOf
(
CyUserUtil
.
getAuthenBusinessId
()));
int
line
=
memInfoRepository
.
leaveMessage
(
dto
);
int
line
=
memInfoRepository
.
leaveMessage
(
dto
);
return
new
CyPersistModel
(
line
);
return
new
CyPersistModel
(
line
);
...
...
src/main/java/org/rcisoft/business/opmArticle/dao/OpmArticleRepository.java
View file @
e6b32a19
...
@@ -67,5 +67,8 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
...
@@ -67,5 +67,8 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
//添加动态评论
//添加动态评论
int
addComment
(
@Param
(
"entity"
)
ArticleCommentDTO
dto
);
int
addComment
(
@Param
(
"entity"
)
ArticleCommentDTO
dto
);
//查询某个人的动态列表
IPage
<
OpmArticle
>
queryUserArticlePaged
(
CyPageInfo
cyPageInfo
,
@Param
(
"entity"
)
OpmArticle
opmArticle
);
}
}
src/main/java/org/rcisoft/business/opmArticle/entity/OpmArticle.java
View file @
e6b32a19
...
@@ -211,6 +211,13 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
...
@@ -211,6 +211,13 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
/**
/**
* 关注的数组
* 关注的数组
*/
*/
@TableField
(
exist
=
false
)
private
List
<
Integer
>
followList
;
private
List
<
Integer
>
followList
;
/**
* 是否关注 isFollow 1:关注 0:未关注
*/
@TableField
(
exist
=
false
)
private
String
isFollowed
;
}
}
src/main/java/org/rcisoft/business/opmArticle/service/OpmArticleService.java
View file @
e6b32a19
...
@@ -101,4 +101,10 @@ public interface OpmArticleService {
...
@@ -101,4 +101,10 @@ public interface OpmArticleService {
*/
*/
CyPersistModel
addComment
(
ArticleCommentDTO
dto
);
CyPersistModel
addComment
(
ArticleCommentDTO
dto
);
/**
* 分页查询某个人的动态列表
* @param opmArticle
* @return
*/
IPage
<
OpmArticle
>
findUserArticleByPagination
(
CyPageInfo
<
OpmArticle
>
paginationUtility
,
OpmArticle
opmArticle
);
}
}
src/main/java/org/rcisoft/business/opmArticle/service/impl/OpmArticleServiceImpl.java
View file @
e6b32a19
...
@@ -184,10 +184,7 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
...
@@ -184,10 +184,7 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
result
=
baseMapper
.
queryOpmArticlePaged
(
paginationUtility
,
opmArticle
);
result
=
baseMapper
.
queryOpmArticlePaged
(
paginationUtility
,
opmArticle
);
}
}
}
else
{
}
else
{
if
(
StringUtils
.
isNotEmpty
(
opmArticle
.
getUserId
())){
//话题 最近
//设置查询用户 查询某个人的动态列表
opmArticle
.
setUserId
(
opmArticle
.
getUserId
());
}
if
(
StringUtils
.
isNotEmpty
(
CyUserUtil
.
getAuthenBusinessId
())){
if
(
StringUtils
.
isNotEmpty
(
CyUserUtil
.
getAuthenBusinessId
())){
//设置当前登录人id 用来查询该用户对文章是否已点赞
//设置当前登录人id 用来查询该用户对文章是否已点赞
opmArticle
.
setLoginUserId
(
CyUserUtil
.
getAuthenBusinessId
());
opmArticle
.
setLoginUserId
(
CyUserUtil
.
getAuthenBusinessId
());
...
@@ -195,7 +192,78 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
...
@@ -195,7 +192,78 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
result
=
baseMapper
.
queryOpmArticlePaged
(
paginationUtility
,
opmArticle
);
result
=
baseMapper
.
queryOpmArticlePaged
(
paginationUtility
,
opmArticle
);
}
}
return
result
;
return
result
;
}
/**
* 分页查询某个人的动态列表
* @param paginationUtility
* @param opmArticle
* @return
*/
@Override
public
IPage
<
OpmArticle
>
findUserArticleByPagination
(
CyPageInfo
<
OpmArticle
>
paginationUtility
,
OpmArticle
opmArticle
)
{
//校验 未关注的只能查5条 已关注的只能查近一个月的
String
isFollowed
=
opmArticle
.
getIsFollowed
();
if
(
StringUtils
.
isNotEmpty
(
isFollowed
)
&&
isFollowed
.
equals
(
"0"
)){
//1.未关注
List
<
DictData
>
articleConfig
=
dictionaryService
.
selectByTypes
(
"article_config"
);
DictData
dictData
=
articleConfig
.
stream
().
filter
(
item
->
item
.
getDictLabel
().
equals
(
"no_follow_article_limit"
)).
findFirst
().
orElse
(
null
);
Integer
noFollowArticleLimit
=
Integer
.
valueOf
(
dictData
.
getDictValue
());
String
loginUserId
=
CyUserUtil
.
getAuthenBusinessId
();
if
(
StringUtils
.
isNotEmpty
(
opmArticle
.
getUserId
())){
//设置查询用户 查询某个人的动态列表
opmArticle
.
setUserId
(
opmArticle
.
getUserId
());
}
if
(
StringUtils
.
isNotEmpty
(
loginUserId
)){
//设置当前登录人id 用来查询该用户对文章是否已点赞
opmArticle
.
setLoginUserId
(
loginUserId
);
}
//设置分页参数 防止前端下滑再次调分页 前端根据total 判断是否还有数据
paginationUtility
.
setPages
(
1
);
paginationUtility
.
setSize
(
noFollowArticleLimit
);
IPage
<
OpmArticle
>
opmArticleIPage
=
baseMapper
.
queryUserArticlePaged
(
paginationUtility
,
opmArticle
);
opmArticleIPage
.
setTotal
(
noFollowArticleLimit
);
return
opmArticleIPage
;
}
else
if
(
StringUtils
.
isNotEmpty
(
isFollowed
)
&&
isFollowed
.
equals
(
"1"
)){
//2.已关注
List
<
DictData
>
articleConfig
=
dictionaryService
.
selectByTypes
(
"article_config"
);
DictData
dictData
=
articleConfig
.
stream
().
filter
(
item
->
item
.
getDictLabel
().
equals
(
"follow_article_limit"
)).
findFirst
().
orElse
(
null
);
Integer
followArticleLimit
=
Integer
.
valueOf
(
dictData
.
getDictValue
());
//获取当前日期时间
LocalDateTime
currentDate
=
LocalDateTime
.
now
();
// 获取30天前的日期
LocalDateTime
dateBeforeDays
=
currentDate
.
minusDays
(
followArticleLimit
);
// 如果需要特定格式的日期字符串,可以使用DateTimeFormatter
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
String
endTime
=
currentDate
.
format
(
formatter
);
String
beginTime
=
dateBeforeDays
.
format
(
formatter
);
opmArticle
.
setBeginTime
(
beginTime
);
opmArticle
.
setEndTime
(
endTime
);
String
loginUserId
=
CyUserUtil
.
getAuthenBusinessId
();
if
(
StringUtils
.
isNotEmpty
(
opmArticle
.
getUserId
())){
//设置查询用户 查询某个人的动态列表
opmArticle
.
setUserId
(
opmArticle
.
getUserId
());
}
if
(
StringUtils
.
isNotEmpty
(
loginUserId
)){
//设置当前登录人id 用来查询该用户对文章是否已点赞
opmArticle
.
setLoginUserId
(
loginUserId
);
}
return
baseMapper
.
queryUserArticlePaged
(
paginationUtility
,
opmArticle
);
}
//3.当前登录人的动态
//如果登录人id和userId相同,证明查看的是自己的动态列表
String
loginUserId
=
CyUserUtil
.
getAuthenBusinessId
();
if
(
StringUtils
.
isNotEmpty
(
loginUserId
)){
//查询当前登录人的动态
opmArticle
.
setUserId
(
loginUserId
);
}
if
(
StringUtils
.
isNotEmpty
(
loginUserId
)){
//设置当前登录人id 用来查询该用户对文章是否已点赞
opmArticle
.
setLoginUserId
(
loginUserId
);
}
return
baseMapper
.
queryUserArticlePaged
(
paginationUtility
,
opmArticle
);
}
}
/**
/**
...
...
src/main/resources/mapper/business/memInfo/mapper/MemInfoMapper.xml
View file @
e6b32a19
...
@@ -612,14 +612,13 @@
...
@@ -612,14 +612,13 @@
and user_id = #{entity.targetId}
and user_id = #{entity.targetId}
</insert>
</insert>
<insert
id=
"leaveMessage"
>
<insert
id=
"leaveMessage"
>
insert into mem_user_leave_message (target_id,create_by,create_date,update_by,update_date,content
,del_status
)
insert into mem_user_leave_message (target_id,create_by,create_date,update_by,update_date,content)
values(#{targetId},#{userId},NOW(),#{userId},NOW(),#{content}
,#{delStatus}
)
values(#{targetId},#{userId},NOW(),#{userId},NOW(),#{content})
</insert>
</insert>
<select
id=
"leaveMessageByPagination"
resultType=
"org.rcisoft.business.memInfo.entity.MemInfo"
>
<select
id=
"leaveMessageByPagination"
resultType=
"org.rcisoft.business.memInfo.entity.MemInfo"
>
SELECT
SELECT
oulm.business_id,
oulm.business_id,
oulm.content as leaveMessageContent,
oulm.content as leaveMessageContent,
oulm.del_status,
oulm.create_date,
oulm.create_date,
oulm.create_by as userId,
oulm.create_by as userId,
oulm.target_id,
oulm.target_id,
...
@@ -640,7 +639,6 @@
...
@@ -640,7 +639,6 @@
select
select
oulm.business_id,
oulm.business_id,
oulm.content as leaveMessageContent,
oulm.content as leaveMessageContent,
oulm.del_status,
oulm.create_date,
oulm.create_date,
oulm.create_by as userId,
oulm.create_by as userId,
oulm.target_id,
oulm.target_id,
...
...
src/main/resources/mapper/business/opmArticle/mapper/OpmArticleMapper.xml
View file @
e6b32a19
...
@@ -195,6 +195,67 @@
...
@@ -195,6 +195,67 @@
ORDER BY
ORDER BY
opa.create_date DESC
opa.create_date DESC
</select>
</select>
<select
id=
"queryUserArticlePaged"
resultType=
"org.rcisoft.business.opmArticle.entity.OpmArticle"
>
SELECT
opa.business_id,
opa.flag,
opa.del_flag,
opa.comment_count,
opa.like_count,
opa.exam_status,
opa.is_article,
opa.create_date,
opa.content,
opa.create_by AS userId,
opa.picture_id,
opt.topic_name AS topic,
mi.mem_code,
mi.mem_nick_name,
mi.mem_sex,
mi.mem_birthday,
mi.mem_residence_province,
mi.mem_residence_city,
mi.mem_max_education,
mi.mem_career,
mi.business_id AS memberId,
mi.avatar AS avatarId,
CASE
WHEN oal.business_id IS NOT NULL THEN 1 ELSE 0
END AS isLike,
oi.url AS memAvatar,
GROUP_CONCAT(DISTINCT pic_urls.url ORDER BY pic_urls.url SEPARATOR ',') AS url
FROM
opm_article opa
LEFT JOIN opm_topic opt ON opa.topic_id = opt.business_id
LEFT JOIN mem_info mi ON opa.create_by = mi.user_id
LEFT JOIN oss_info oi ON mi.avatar = oi.business_id
LEFT JOIN opm_article_like oal on oal.article_id = opa.business_id and oal.user_id = #{entity.loginUserId}
LEFT JOIN (
SELECT
opm_article.business_id,
CAST(JSON_UNQUOTE(JSON_EXTRACT(picture_id, CONCAT('$.id[', jt_ids.idx - 1, ']'))) AS UNSIGNED) AS picture_id
FROM
opm_article,
JSON_TABLE(JSON_EXTRACT(opm_article.picture_id, '$.id'), '$[*]' COLUMNS (idx FOR ORDINALITY)) AS jt_ids
WHERE
opm_article.del_flag = '0'
) AS pic_ids ON opa.business_id = pic_ids.business_id
LEFT JOIN oss_info pic_urls ON pic_ids.picture_id = pic_urls.business_id
WHERE 1=1
and opa.del_flag = '0'
and opa.flag = '1'
and opa.create_by = #{entity.userId}
<if
test=
"entity.beginTime !=null and entity.beginTime != '' "
>
and opa.create_date
>
= #{entity.beginTime}
</if>
<if
test=
"entity.endTime !=null and entity.endTime != '' "
>
and opa.create_date
<
= #{entity.endTime}
</if>
GROUP BY
opa.business_id
ORDER BY
opa.create_date DESC
</select>
<select
id=
"selectArticleDetail"
resultType=
"org.rcisoft.business.opmArticle.entity.OpmArticle"
>
<select
id=
"selectArticleDetail"
resultType=
"org.rcisoft.business.opmArticle.entity.OpmArticle"
>
SELECT
SELECT
opa.*,
opa.*,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment