Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
f63f2cd9
S
SpringBoot-kwan
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringBoot-kwan
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBoot-kwan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f63f2cd9
编写于
10月 27, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:定时任务调整
上级
524e7c46
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
68 addition
and
8 deletion
+68
-8
src/main/java/com/kwan/springbootkwan/controller/CsdnController.java
...va/com/kwan/springbootkwan/controller/CsdnController.java
+13
-1
src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java
...n/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java
+8
-4
src/main/java/com/kwan/springbootkwan/service/CsdnUserInfoService.java
.../com/kwan/springbootkwan/service/CsdnUserInfoService.java
+8
-2
src/main/java/com/kwan/springbootkwan/service/impl/CsdnTripletDayInfoServiceImpl.java
...gbootkwan/service/impl/CsdnTripletDayInfoServiceImpl.java
+5
-1
src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java
.../springbootkwan/service/impl/CsdnUserInfoServiceImpl.java
+34
-0
未找到文件。
src/main/java/com/kwan/springbootkwan/controller/CsdnController.java
浏览文件 @
f63f2cd9
...
@@ -54,6 +54,18 @@ public class CsdnController {
...
@@ -54,6 +54,18 @@ public class CsdnController {
@GetMapping
(
"/resetCurrentStatus"
)
@GetMapping
(
"/resetCurrentStatus"
)
public
Result
resetCurrentStatus
()
{
public
Result
resetCurrentStatus
()
{
csdnUserInfoService
.
resetCurrentStatus
();
csdnUserInfoService
.
resetCurrentStatus
();
return
Result
.
ok
(
"重置当天状态完成"
);
return
Result
.
ok
(
"重置新博客状态完成"
);
}
@GetMapping
(
"/resetUserDayStatus"
)
public
Result
resetUserDayStatus
()
{
csdnUserInfoService
.
resetUserDayStatus
();
return
Result
.
ok
(
"重置新一天用户状态完成"
);
}
@GetMapping
(
"/resetDayStatus"
)
public
Result
resetDayStatus
()
{
csdnUserInfoService
.
resetUserDayStatus
();
return
Result
.
ok
(
"重置新一天状态完成"
);
}
}
}
}
src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java
浏览文件 @
f63f2cd9
package
com.kwan.springbootkwan.schedule
;
package
com.kwan.springbootkwan.schedule
;
import
com.kwan.springbootkwan.service.CsdnAutoReplyService
;
import
com.kwan.springbootkwan.service.CsdnAutoReplyService
;
import
com.kwan.springbootkwan.service.CsdnCommentService
;
import
com.kwan.springbootkwan.service.CsdnService
;
import
com.kwan.springbootkwan.service.CsdnService
;
import
com.kwan.springbootkwan.service.CsdnTripletDayInfoService
;
import
com.kwan.springbootkwan.service.CsdnTripletDayInfoService
;
import
com.kwan.springbootkwan.service.CsdnUserInfoService
;
import
com.kwan.springbootkwan.service.CsdnUserInfoService
;
...
@@ -17,8 +16,6 @@ public class CsdnSchedule {
...
@@ -17,8 +16,6 @@ public class CsdnSchedule {
@Autowired
@Autowired
private
CsdnService
csdnService
;
private
CsdnService
csdnService
;
@Autowired
@Autowired
private
CsdnCommentService
csdnCommentService
;
@Autowired
private
CsdnUserInfoService
csdnUserInfoService
;
private
CsdnUserInfoService
csdnUserInfoService
;
@Autowired
@Autowired
private
CsdnAutoReplyService
csdnAutoReplyService
;
private
CsdnAutoReplyService
csdnAutoReplyService
;
...
@@ -40,12 +37,19 @@ public class CsdnSchedule {
...
@@ -40,12 +37,19 @@ public class CsdnSchedule {
}
}
@Scheduled
(
cron
=
"0 0/30 * * * ?"
)
@Scheduled
(
cron
=
"0 0/30 * * * ?"
)
public
void
executeInit
()
{
public
void
resetCurrentStatus
()
{
log
.
info
(
"executeInit task is running ... ..."
);
log
.
info
(
"executeInit task is running ... ..."
);
csdnUserInfoService
.
resetCurrentStatus
();
csdnUserInfoService
.
resetCurrentStatus
();
log
.
info
(
"executeInit task is finish ... ..."
);
log
.
info
(
"executeInit task is finish ... ..."
);
}
}
@Scheduled
(
cron
=
"0 0 2 * * ?"
)
public
void
resetUserDayStatus
()
{
log
.
info
(
"executeInit task is running ... ..."
);
csdnUserInfoService
.
resetUserDayStatus
();
log
.
info
(
"executeInit task is finish ... ..."
);
}
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
public
void
resetTripletDayInfo
()
{
public
void
resetTripletDayInfo
()
{
log
.
info
(
"resetTripletDayInfo task is running ... ..."
);
log
.
info
(
"resetTripletDayInfo task is running ... ..."
);
...
...
src/main/java/com/kwan/springbootkwan/service/CsdnUserInfoService.java
浏览文件 @
f63f2cd9
...
@@ -10,9 +10,15 @@ import com.kwan.springbootkwan.entity.CsdnUserInfo;
...
@@ -10,9 +10,15 @@ import com.kwan.springbootkwan.entity.CsdnUserInfo;
* @since 2023-10-23 16:03:14
* @since 2023-10-23 16:03:14
*/
*/
public
interface
CsdnUserInfoService
extends
IService
<
CsdnUserInfo
>
{
public
interface
CsdnUserInfoService
extends
IService
<
CsdnUserInfo
>
{
/**
* 重置新文章的状态
*/
void
resetCurrentStatus
();
void
resetCurrentStatus
();
/**
* 重置新一天的状态
*/
void
resetUserDayStatus
();
}
}
src/main/java/com/kwan/springbootkwan/service/impl/CsdnTripletDayInfoServiceImpl.java
浏览文件 @
f63f2cd9
...
@@ -5,10 +5,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -5,10 +5,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.kwan.springbootkwan.entity.CsdnTripletDayInfo
;
import
com.kwan.springbootkwan.entity.CsdnTripletDayInfo
;
import
com.kwan.springbootkwan.mapper.CsdnTripletDayInfoMapper
;
import
com.kwan.springbootkwan.mapper.CsdnTripletDayInfoMapper
;
import
com.kwan.springbootkwan.service.CsdnTripletDayInfoService
;
import
com.kwan.springbootkwan.service.CsdnTripletDayInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Locale
;
import
java.util.Objects
;
import
java.util.Objects
;
/**
/**
...
@@ -17,13 +19,15 @@ import java.util.Objects;
...
@@ -17,13 +19,15 @@ import java.util.Objects;
* @author makejava
* @author makejava
* @since 2023-10-26 20:55:31
* @since 2023-10-26 20:55:31
*/
*/
@Slf4j
@Service
(
"csdnTripletDayInfoService"
)
@Service
(
"csdnTripletDayInfoService"
)
public
class
CsdnTripletDayInfoServiceImpl
extends
ServiceImpl
<
CsdnTripletDayInfoMapper
,
CsdnTripletDayInfo
>
implements
CsdnTripletDayInfoService
{
public
class
CsdnTripletDayInfoServiceImpl
extends
ServiceImpl
<
CsdnTripletDayInfoMapper
,
CsdnTripletDayInfo
>
implements
CsdnTripletDayInfoService
{
@Override
@Override
public
CsdnTripletDayInfo
todayInfo
()
{
public
CsdnTripletDayInfo
todayInfo
()
{
Date
currentDate
=
new
Date
();
Date
currentDate
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
,
Locale
.
CHINA
);
String
formattedDate
=
sdf
.
format
(
currentDate
);
String
formattedDate
=
sdf
.
format
(
currentDate
);
log
.
info
(
"当前日期是:{}"
,
formattedDate
);
QueryWrapper
<
CsdnTripletDayInfo
>
wrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
CsdnTripletDayInfo
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"is_delete"
,
0
);
wrapper
.
eq
(
"is_delete"
,
0
);
wrapper
.
eq
(
"triplet_date"
,
formattedDate
);
wrapper
.
eq
(
"triplet_date"
,
formattedDate
);
...
...
src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java
浏览文件 @
f63f2cd9
...
@@ -60,5 +60,39 @@ public class CsdnUserInfoServiceImpl extends ServiceImpl<CsdnUserInfoMapper, Csd
...
@@ -60,5 +60,39 @@ public class CsdnUserInfoServiceImpl extends ServiceImpl<CsdnUserInfoMapper, Csd
}
}
}
}
}
}
@Override
public
void
resetUserDayStatus
()
{
QueryWrapper
<
CsdnUserInfo
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"is_delete"
,
0
);
final
List
<
CsdnUserInfo
>
list
=
this
.
list
(
wrapper
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
for
(
CsdnUserInfo
csdnUserInfo
:
list
)
{
final
String
userName
=
csdnUserInfo
.
getUserName
();
final
List
<
BusinessInfoResponse
.
ArticleData
.
Article
>
articles
=
csdnArticleService
.
getArticles
(
userName
);
if
(
CollectionUtil
.
isNotEmpty
(
articles
))
{
final
BusinessInfoResponse
.
ArticleData
.
Article
article
=
articles
.
get
(
0
);
final
String
type
=
article
.
getType
();
if
(
StringUtils
.
equals
(
type
,
"blog"
))
{
//看看之前的状态
final
Integer
likeStatus
=
csdnUserInfo
.
getLikeStatus
();
if
(!
LikeStatus
.
HAVE_ALREADY_LIKED
.
getCode
().
equals
(
likeStatus
)
&&
!
LikeStatus
.
LIKE_SUCCESSFUL
.
getCode
().
equals
(
likeStatus
))
{
csdnUserInfo
.
setLikeStatus
(
LikeStatus
.
UN_PROCESSED
.
getCode
());
}
final
Integer
collectStatus
=
csdnUserInfo
.
getCollectStatus
();
if
(!
CollectStatus
.
COLLECT_SUCCESSFUL
.
getCode
().
equals
(
collectStatus
)
&&
!
CollectStatus
.
HAVE_ALREADY_COLLECT
.
getCode
().
equals
(
collectStatus
))
{
csdnUserInfo
.
setCollectStatus
(
CollectStatus
.
UN_PROCESSED
.
getCode
());
}
final
Integer
commentStatus
=
csdnUserInfo
.
getCommentStatus
();
if
(!
CommentStatus
.
COMMENT_SUCCESSFUL
.
getCode
().
equals
(
commentStatus
)
&&
!
CommentStatus
.
HAVE_ALREADY_COMMENT
.
getCode
().
equals
(
commentStatus
))
{
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
UN_PROCESSED
.
getCode
());
}
this
.
updateById
(
csdnUserInfo
);
}
}
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录