Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
32bf0af5
Commit
32bf0af5
authored
Mar 06, 2022
by
王亚雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/v2.3.1'
parents
26e9ab3e
3c34fb02
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
29 deletions
+75
-29
TopicFollowRelEntity.java
.../community/dao/entity/community/TopicFollowRelEntity.java
+11
-0
CommentService.java
...main/java/com/tanpu/community/service/CommentService.java
+3
-0
TopicService.java
...c/main/java/com/tanpu/community/service/TopicService.java
+1
-0
VisitLogService.java
...ain/java/com/tanpu/community/service/VisitLogService.java
+3
-2
TopicReportService.java
...om/tanpu/community/service/quartz/TopicReportService.java
+2
-2
application-test.yml
community-service/src/main/resources/application-test.yml
+4
-2
TopicFollowRelEntityMapper.xml
...resources/mapper/community/TopicFollowRelEntityMapper.xml
+19
-23
TopicReportServiceTest.java
...anpu/community/service/quartz/TopicReportServiceTest.java
+32
-0
No files found.
community-service/src/main/java/com/tanpu/community/dao/entity/community/TopicFollowRelEntity.java
View file @
32bf0af5
...
...
@@ -41,6 +41,9 @@ public class TopicFollowRelEntity implements Serializable {
@ApiModelProperty
(
value
=
"取消关注时间"
)
private
LocalDateTime
unfollowTime
;
@ApiModelProperty
(
value
=
"是否为管理员 1是 0不是"
)
private
Integer
manager
;
private
LocalDateTime
createTime
;
private
LocalDateTime
updateTime
;
...
...
@@ -88,6 +91,14 @@ public class TopicFollowRelEntity implements Serializable {
this
.
unfollowTime
=
unfollowTime
;
}
public
Integer
getManager
()
{
return
manager
;
}
public
void
setManager
(
Integer
manager
)
{
this
.
manager
=
manager
;
}
public
LocalDateTime
getCreateTime
()
{
return
createTime
;
}
...
...
community-service/src/main/java/com/tanpu/community/service/CommentService.java
View file @
32bf0af5
...
...
@@ -74,6 +74,9 @@ public class CommentService {
}
public
Integer
getCommentCountByThemeIds
(
List
<
String
>
themeIds
)
{
if
(
CollectionUtils
.
isEmpty
(
themeIds
))
{
return
0
;
}
return
commentMapper
.
selectCount
((
new
LambdaQueryWrapper
<
CommentEntity
>()
.
in
(
CommentEntity:
:
getThemeId
,
themeIds
))
.
eq
(
CommentEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
));
...
...
community-service/src/main/java/com/tanpu/community/service/TopicService.java
View file @
32bf0af5
...
...
@@ -127,6 +127,7 @@ public class TopicService {
public
Integer
countTotalFollow
(
String
topicId
)
{
return
topicFollowRelMapper
.
selectCount
(
new
LambdaQueryWrapper
<
TopicFollowRelEntity
>()
.
eq
(
TopicFollowRelEntity:
:
getTopicId
,
topicId
)
.
eq
(
TopicFollowRelEntity:
:
getManager
,
0
)
.
eq
(
TopicFollowRelEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
()));
}
...
...
community-service/src/main/java/com/tanpu/community/service/VisitLogService.java
View file @
32bf0af5
package
com
.
tanpu
.
community
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.google.common.collect.Lists
;
import
com.tanpu.biz.common.enums.clue.PageEnum
;
import
com.tanpu.community.api.enums.DeleteTagEnum
;
import
com.tanpu.community.cache.RedisCache
;
...
...
@@ -22,7 +23,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
com
.
tanpu
.
biz
.
common
.
enums
.
clue
.
PageEnum
.
COMM_VISIT_TOPIC_DETAIL
;
import
static
com
.
tanpu
.
biz
.
common
.
enums
.
clue
.
PageEnum
.
*
;
@Slf4j
@Service
...
...
@@ -104,7 +105,7 @@ public class VisitLogService {
public
Integer
queryTopicDetailVisit
(
String
topicId
)
{
return
visitLogMapper
.
selectCount
(
new
LambdaQueryWrapper
<
VisitLogEntity
>()
.
eq
(
VisitLogEntity:
:
getRefId
,
topicId
)
.
eq
(
VisitLogEntity:
:
getRefType
,
COMM_VISIT_TOPIC_DETAIL
.
getId
(
)));
.
in
(
VisitLogEntity:
:
getRefType
,
Lists
.
newArrayList
(
COMM_VISIT_TOPIC_DETAIL_HOT
.
getId
(),
COMM_VISIT_TOPIC_DETAIL_NEW
.
getId
()
)));
}
// 查询主题 浏览量
...
...
community-service/src/main/java/com/tanpu/community/service/quartz/TopicReportService.java
View file @
32bf0af5
...
...
@@ -77,7 +77,7 @@ public class TopicReportService {
// 每个工作日早上09:30汇报
public
static
String
content_report_topic_weekday
=
"话题(%s) 当前总成员: %s, 当前总阅读: %s, 当前总讨论: %s, 昨日新增成员: %s, 昨日新增讨论"
;
public
static
String
content_report_topic_weekday
=
"话题(%s) 当前总成员: %s, 当前总阅读: %s, 当前总讨论: %s, 昨日新增成员: %s, 昨日新增讨论
: %s
"
;
public
void
reportTopicWeekday
()
{
// 跳过双休日
Date
now
=
new
Date
();
...
...
@@ -128,7 +128,7 @@ public class TopicReportService {
}
// 每周六早上09:00汇报
public
static
String
content_report_topic_saturday
=
"话题(%s) 当前总成员: %s, 当前总阅读: %s, 当前总讨论: %s, 截至本周五新增成员: %s, 昨日新增讨论"
;
public
static
String
content_report_topic_saturday
=
"话题(%s) 当前总成员: %s, 当前总阅读: %s, 当前总讨论: %s, 截至本周五新增成员: %s, 昨日新增讨论
: %s
"
;
public
void
reportTopicSaturday
()
{
List
<
TopicEntity
>
topics
=
topicService
.
queryTopicNeedReport
();
for
(
TopicEntity
topic
:
topics
)
{
...
...
community-service/src/main/resources/application-test.yml
View file @
32bf0af5
...
...
@@ -104,7 +104,7 @@ tmpfile:
wxcp
:
topicreport
:
agentId
:
1000025
corpId
:
IC6Hpbct4OrYzacDnzXqSRC17vrpNwDZ1HZvFef1QQc
corpId
:
ww08675a3a48c9e8a2
logging.level.com.tanpu
:
debug
...
...
@@ -131,6 +131,8 @@ tanpu:
svc
:
https://testtamper.tanpuyun.com
fundpublic
:
svc
:
https://testtamper.tanpuyun.com
wxcp
:
svc
:
https://testtamper.tanpuyun.com
#打印SQL语句
logging
:
...
...
community-service/src/main/resources/mapper/community/TopicFollowRelEntityMapper.xml
View file @
32bf0af5
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.tanpu.community.dao.mapper.community.TopicFollowRelMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.tanpu.community.dao.entity.community.TopicFollowRelEntity"
>
<!--@mbg.generated-->
<!--@Table topic_follow_rel-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"topic_id"
jdbcType=
"VARCHAR"
property=
"topicId"
/>
<result
column=
"user_id"
jdbcType=
"VARCHAR"
property=
"userId"
/>
<result
column=
"follow_time"
jdbcType=
"TIMESTAMP"
property=
"followTime"
/>
<result
column=
"unfollow_time"
jdbcType=
"TIMESTAMP"
property=
"unfollowTime"
/>
<result
column=
"manager"
jdbcType=
"INTEGER"
property=
"manager"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"delete_tag"
jdbcType=
"INTEGER"
property=
"deleteTag"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,
topic_id,
user_id,
follow_time,
unfollow_time,
create_time,
update_time,
<!--@mbg.generated-->
id, topic_id, user_id, follow_time, unfollow_time, manager, create_time, update_time,
delete_tag
</sql>
<resultMap
id=
"BaseResultMap"
type=
"com.tanpu.community.dao.entity.community.TopicFollowRelEntity"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"topic_id"
property=
"topicId"
/>
<result
column=
"user_id"
property=
"userId"
/>
<result
column=
"follow_time"
property=
"followTime"
/>
<result
column=
"unfollow_time"
property=
"unfollowTime"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"delete_tag"
property=
"deleteTag"
/>
</resultMap>
<!--auto generated by MybatisCodeHelper on 2022-02-17-->
<select
id=
"selectTopicIdByUserId"
resultType=
"java.lang.String"
>
...
...
@@ -35,7 +31,7 @@
<!--auto generated by MybatisCodeHelper on 2022-02-17-->
<select
id=
"queryOneByTopicIdAndUserId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from topic_follow_rel
where topic_id=#{topicId} and user_id=#{userId} and delete_tag = 0
</select>
...
...
community-service/src/test/java/com/tanpu/community/service/quartz/TopicReportServiceTest.java
0 → 100644
View file @
32bf0af5
package
com
.
tanpu
.
community
.
service
.
quartz
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
static
org
.
junit
.
Assert
.*;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
@ActiveProfiles
(
"test"
)
@Slf4j
public
class
TopicReportServiceTest
{
@Resource
private
TopicReportService
topicReportService
;
@Test
public
void
reportTopicWeekday
()
{
topicReportService
.
reportTopicWeekday
();
}
@Test
public
void
reportTopicSaturday
()
{
topicReportService
.
reportTopicSaturday
();
}
}
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