Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
6e69cf7c
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看板
提交
6e69cf7c
编写于
10月 27, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:添加新的调整
上级
339ee66f
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
145 addition
and
198 deletion
+145
-198
src/main/java/com/kwan/springbootkwan/controller/CsdnController.java
...va/com/kwan/springbootkwan/controller/CsdnController.java
+25
-10
src/main/java/com/kwan/springbootkwan/controller/CsdnTripletDayInfoController.java
...ringbootkwan/controller/CsdnTripletDayInfoController.java
+5
-11
src/main/java/com/kwan/springbootkwan/controller/CsdnUserController.java
...om/kwan/springbootkwan/controller/CsdnUserController.java
+8
-22
src/main/java/com/kwan/springbootkwan/entity/CsdnTripletDayInfo.java
...va/com/kwan/springbootkwan/entity/CsdnTripletDayInfo.java
+11
-14
src/main/java/com/kwan/springbootkwan/entity/CsdnUserInfo.java
...ain/java/com/kwan/springbootkwan/entity/CsdnUserInfo.java
+16
-34
src/main/java/com/kwan/springbootkwan/entity/dto/CsdnTripletDayInfoDTO.java
...kwan/springbootkwan/entity/dto/CsdnTripletDayInfoDTO.java
+11
-9
src/main/java/com/kwan/springbootkwan/entity/dto/CsdnUserInfoDTO.java
...a/com/kwan/springbootkwan/entity/dto/CsdnUserInfoDTO.java
+15
-34
src/main/java/com/kwan/springbootkwan/entity/query/CsdnTripletDayInfoQuery.java
.../springbootkwan/entity/query/CsdnTripletDayInfoQuery.java
+7
-4
src/main/java/com/kwan/springbootkwan/entity/query/CsdnUserInfoQuery.java
...m/kwan/springbootkwan/entity/query/CsdnUserInfoQuery.java
+13
-28
src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java
...n/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java
+2
-2
src/main/java/com/kwan/springbootkwan/service/CsdnUserInfoService.java
.../com/kwan/springbootkwan/service/CsdnUserInfoService.java
+7
-1
src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java
...n/springbootkwan/service/impl/CsdnCollectServiceImpl.java
+0
-4
src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java
...n/springbootkwan/service/impl/CsdnCommentServiceImpl.java
+0
-5
src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java
.../springbootkwan/service/impl/CsdnUserInfoServiceImpl.java
+25
-20
未找到文件。
src/main/java/com/kwan/springbootkwan/controller/CsdnController.java
浏览文件 @
6e69cf7c
...
...
@@ -6,6 +6,8 @@ import com.kwan.springbootkwan.entity.Result;
import
com.kwan.springbootkwan.service.CsdnAutoReplyService
;
import
com.kwan.springbootkwan.service.CsdnService
;
import
com.kwan.springbootkwan.service.CsdnUserInfoService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -17,6 +19,7 @@ import java.util.Objects;
@Slf4j
@RestController
@Api
(
tags
=
"csdn三连用户管理"
)
@RequestMapping
(
"/csdn"
)
public
class
CsdnController
{
...
...
@@ -27,6 +30,7 @@ public class CsdnController {
@Autowired
private
CsdnUserInfoService
csdnUserInfoService
;
@ApiOperation
(
value
=
"单人三连"
,
nickname
=
"单人三连"
)
@GetMapping
(
"/singleTriplet"
)
public
Result
singleTriplet
(
@Param
(
"username"
)
String
username
)
{
QueryWrapper
<
CsdnUserInfo
>
wrapper
=
new
QueryWrapper
<>();
...
...
@@ -39,33 +43,44 @@ public class CsdnController {
return
Result
.
ok
(
"单人三连完成"
);
}
@ApiOperation
(
value
=
"多人三连"
,
nickname
=
"多人三连"
)
@GetMapping
(
"/multiTriplet"
)
public
Result
multiTriplet
()
{
csdnService
.
multiTriplet
();
return
Result
.
ok
(
"多人三连完成"
);
}
@ApiOperation
(
value
=
"自动回复"
,
nickname
=
"自动回复"
)
@GetMapping
(
"/autoReply"
)
public
Result
autoReply
()
{
csdnAutoReplyService
.
commentSelf
();
return
Result
.
ok
(
"自动回复完成"
);
}
@GetMapping
(
"/resetCurrentStatus"
)
public
Result
resetCurrentStatus
()
{
csdnUserInfoService
.
resetCurrentStatus
();
return
Result
.
ok
(
"重置新博客状态完成"
);
@ApiOperation
(
value
=
"重置全员新博客状态"
,
nickname
=
"重置全员新博客状态"
)
@GetMapping
(
"/resetAllCurrentStatus"
)
public
Result
resetAllCurrentStatus
()
{
csdnUserInfoService
.
resetAllCurrentStatus
();
return
Result
.
ok
(
"重置全员新博客状态完成"
);
}
@ApiOperation
(
value
=
"重置指定人员新博客状态"
,
nickname
=
"重置指定人员新博客状态"
)
@GetMapping
(
"/resetCsdnUserInfo"
)
public
Result
resetCsdnUserInfo
(
@Param
(
"username"
)
String
username
)
{
QueryWrapper
<
CsdnUserInfo
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"is_delete"
,
0
);
wrapper
.
eq
(
"user_name"
,
username
).
last
(
"limit 1"
);
final
CsdnUserInfo
csdnUserInfo
=
csdnUserInfoService
.
getOne
(
wrapper
);
if
(
Objects
.
nonNull
(
csdnUserInfo
))
{
csdnUserInfoService
.
resetCsdnUserInfo
(
csdnUserInfo
);
}
return
Result
.
ok
(
"重置指定人员新博客状态完成"
);
}
@ApiOperation
(
value
=
"重置新一天用户状态"
,
nickname
=
"重置新一天用户状态"
)
@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/controller/CsdnTripletDayInfoController.java
浏览文件 @
6e69cf7c
...
...
@@ -8,6 +8,8 @@ import com.kwan.springbootkwan.entity.Result;
import
com.kwan.springbootkwan.entity.dto.CsdnTripletDayInfoDTO
;
import
com.kwan.springbootkwan.entity.query.CsdnTripletDayInfoQuery
;
import
com.kwan.springbootkwan.service.CsdnTripletDayInfoService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -19,12 +21,8 @@ import java.text.SimpleDateFormat;
import
java.util.Date
;
import
java.util.Objects
;
/**
* 每日三连监控(CsdnTripletDayInfo)表控制层
*
* @author makejava
* @since 2023-10-26 20:55:30
*/
@Api
(
tags
=
"csdn每日三连监控"
)
@RestController
@RequestMapping
(
"/dayInfo"
)
public
class
CsdnTripletDayInfoController
{
...
...
@@ -36,11 +34,7 @@ public class CsdnTripletDayInfoController {
return
Result
.
ok
(
csdnTripletDayInfoService
.
todayInfo
());
}
/**
* 分页查询所有数据
*
* @return 所有数据
*/
@ApiOperation
(
value
=
"分页查询所有数据"
,
nickname
=
"分页查询所有数据"
)
@PostMapping
(
"/page"
)
public
Result
selectAll
(
@RequestBody
CsdnTripletDayInfoQuery
query
)
{
final
Date
startDate
=
query
.
getStartDate
();
...
...
src/main/java/com/kwan/springbootkwan/controller/CsdnUserController.java
浏览文件 @
6e69cf7c
...
...
@@ -7,6 +7,8 @@ import com.kwan.springbootkwan.entity.Result;
import
com.kwan.springbootkwan.entity.dto.CsdnUserInfoDTO
;
import
com.kwan.springbootkwan.entity.query.CsdnUserInfoQuery
;
import
com.kwan.springbootkwan.service.CsdnUserInfoService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -21,17 +23,15 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.Objects
;
@Slf4j
@Api
(
tags
=
"csdn每日三连监控"
)
@RestController
@RequestMapping
(
"/csdn/user"
)
public
class
CsdnUserController
{
@Autowired
private
CsdnUserInfoService
csdnUserInfoService
;
/**
* 分页查询所有数据
*
* @return 所有数据
*/
@ApiOperation
(
value
=
"分页查询所有数据"
,
nickname
=
"分页查询所有数据"
)
@PostMapping
(
"/page"
)
public
Result
selectAll
(
@RequestBody
CsdnUserInfoQuery
query
)
{
final
Integer
userWeight
=
query
.
getUserWeight
();
...
...
@@ -71,11 +71,7 @@ public class CsdnUserController {
return
Result
.
ok
(
CsdnUserInfoDTO
.
Converter
.
INSTANCE
.
from
(
this
.
csdnUserInfoService
.
page
(
pageParm
,
wrapper
)));
}
/**
* 新增用户
*
* @return 所有数据
*/
@ApiOperation
(
value
=
"新增用户"
,
nickname
=
"新增用户"
)
@PostMapping
(
"/add"
)
public
Result
add
(
@RequestBody
CsdnUserInfoQuery
addInfo
)
{
final
String
userName
=
addInfo
.
getUserName
();
...
...
@@ -119,12 +115,7 @@ public class CsdnUserController {
return
Result
.
ok
();
}
/**
* 更新用户
*
* @param query
* @return
*/
@ApiOperation
(
value
=
"更新用户"
,
nickname
=
"更新用户"
)
@PostMapping
(
"/update"
)
public
Result
update
(
@RequestBody
CsdnUserInfoQuery
query
)
{
CsdnUserInfo
csdnUserInfo
=
new
CsdnUserInfo
();
...
...
@@ -135,12 +126,7 @@ public class CsdnUserController {
return
Result
.
ok
(
this
.
csdnUserInfoService
.
updateById
(
csdnUserInfo
));
}
/**
* 删除用户
*
* @param id
* @return
*/
@ApiOperation
(
value
=
"删除用户"
,
nickname
=
"删除用户"
)
@GetMapping
(
"/delete"
)
public
Result
delete
(
@RequestParam
(
"id"
)
Integer
id
)
{
CsdnUserInfo
csdnUserInfo
=
new
CsdnUserInfo
();
...
...
src/main/java/com/kwan/springbootkwan/entity/CsdnTripletDayInfo.java
浏览文件 @
6e69cf7c
...
...
@@ -3,34 +3,31 @@ package com.kwan.springbootkwan.entity;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 每日三连监控(CsdnTripletDayInfo)表实体类
*
* @author makejava
* @since 2023-10-26 20:55:31
*/
@Data
@ApiModel
(
"csdn每日三连监控类"
)
@TableName
(
"csdn_triplet_day_info"
)
public
class
CsdnTripletDayInfo
extends
Model
<
CsdnTripletDayInfo
>
{
//主键id
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
//三连日期
@ApiModelProperty
(
"三连日期"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
tripletDate
;
//点赞数量
@ApiModelProperty
(
"点赞数量"
)
private
Integer
likeNum
;
//收藏数量
@ApiModelProperty
(
"收藏数量"
)
private
Integer
collectNum
;
//评论数量
@ApiModelProperty
(
"评论数量"
)
private
Integer
commentNum
;
//创建时间
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
//更新时间
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
//逻辑删除,0未删除,1已删除
@ApiModelProperty
(
"逻辑删除,0未删除,1已删除"
)
private
Integer
isDelete
;
}
\ No newline at end of file
src/main/java/com/kwan/springbootkwan/entity/CsdnUserInfo.java
浏览文件 @
6e69cf7c
...
...
@@ -2,55 +2,37 @@ package com.kwan.springbootkwan.entity;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
@ApiModel
(
"csdn用户类"
)
@TableName
(
"csdn_user_info"
)
public
class
CsdnUserInfo
extends
Model
<
CsdnUserInfo
>
{
/**
* 主键id
*/
public
class
CsdnUserInfo
extends
Model
<
CsdnUserInfo
>
implements
Serializable
{
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
/**
* 用户code
*/
@ApiModelProperty
(
"用户code"
)
private
String
userName
;
/**
* CSDN用户名称
*/
@ApiModelProperty
(
"CSDN用户名称"
)
private
String
nickName
;
/**
* 点赞状态
*/
@ApiModelProperty
(
"点赞状态"
)
private
Integer
likeStatus
;
/**
* 收藏状态
*/
@ApiModelProperty
(
"收藏状态"
)
private
Integer
collectStatus
;
/**
* 评论状态
*/
@ApiModelProperty
(
"评论状态"
)
private
Integer
commentStatus
;
/**
* 用户权重
*/
@ApiModelProperty
(
"用户权重"
)
private
Integer
userWeight
;
/**
* 文章类型
*/
@ApiModelProperty
(
"文章类型"
)
private
String
articleType
;
/**
* 创建时间
*/
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
/**
* 更新时间
*/
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
/**
* 逻辑删除,0未删除,1已删除
*/
@ApiModelProperty
(
"逻辑删除,0未删除,1已删除"
)
private
Integer
isDelete
;
}
\ No newline at end of file
src/main/java/com/kwan/springbootkwan/entity/dto/CsdnTripletDayInfoDTO.java
浏览文件 @
6e69cf7c
...
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.kwan.springbootkwan.entity.CsdnTripletDayInfo
;
import
com.kwan.springbootkwan.mapstruct.FromConverter
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
...
...
@@ -11,25 +13,25 @@ import org.mapstruct.factory.Mappers;
import
java.util.Date
;
@Data
@ApiModel
(
"csdn三连监控DTO"
)
public
class
CsdnTripletDayInfoDTO
extends
Model
<
CsdnTripletDayInfoDTO
>
{
//主键id
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
//三连日期
@ApiModelProperty
(
"三连日期"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
tripletDate
;
//点赞数量
@ApiModelProperty
(
"点赞数量"
)
private
Integer
likeNum
;
//收藏数量
@ApiModelProperty
(
"收藏数量"
)
private
Integer
collectNum
;
//评论数量
@ApiModelProperty
(
"评论数量"
)
private
Integer
commentNum
;
//创建时间
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
//更新时间
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
//逻辑删除,0未删除,1已删除
@ApiModelProperty
(
"逻辑删除,0未删除,1已删除"
)
private
Integer
isDelete
;
@Mapper
(
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
...
...
src/main/java/com/kwan/springbootkwan/entity/dto/CsdnUserInfoDTO.java
浏览文件 @
6e69cf7c
...
...
@@ -3,6 +3,8 @@ package com.kwan.springbootkwan.entity.dto;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.kwan.springbootkwan.entity.CsdnUserInfo
;
import
com.kwan.springbootkwan.mapstruct.FromConverter
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
...
...
@@ -10,52 +12,31 @@ import org.mapstruct.factory.Mappers;
import
java.util.Date
;
@Data
@ApiModel
(
"csdn三连用户DTO"
)
public
class
CsdnUserInfoDTO
extends
Model
<
CsdnUserInfoDTO
>
{
/**
* 主键id
*/
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
/**
* 用户code
*/
@ApiModelProperty
(
"用户code"
)
private
String
userName
;
/**
* CSDN用户名称
*/
@ApiModelProperty
(
"CSDN用户名称"
)
private
String
nickName
;
/**
* 点赞状态
*/
@ApiModelProperty
(
"点赞状态"
)
private
Integer
likeStatus
;
/**
* 收藏状态
*/
@ApiModelProperty
(
"收藏状态"
)
private
Integer
collectStatus
;
/**
* 评论状态
*/
@ApiModelProperty
(
"评论状态"
)
private
Integer
commentStatus
;
/**
* 用户权重
*/
@ApiModelProperty
(
"用户权重"
)
private
Integer
userWeight
;
/**
* 文章类型
*/
@ApiModelProperty
(
"文章类型"
)
private
String
articleType
;
/**
* 创建时间
*/
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
/**
* 更新时间
*/
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
/**
* 逻辑删除,0未删除,1已删除
*/
@ApiModelProperty
(
"逻辑删除,0未删除,1已删除"
)
private
Integer
isDelete
;
@Mapper
(
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
...
...
src/main/java/com/kwan/springbootkwan/entity/query/CsdnTripletDayInfoQuery.java
浏览文件 @
6e69cf7c
...
...
@@ -2,18 +2,21 @@ package com.kwan.springbootkwan.entity.query;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.kwan.springbootkwan.entity.BasePage
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
@Data
@ApiModel
(
"csdn三连监控查询参数类"
)
public
class
CsdnTripletDayInfoQuery
extends
BasePage
{
//主键id
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
//开始日期
@ApiModelProperty
(
"开始日期"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
startDate
;
//结束日期
@ApiModelProperty
(
"结束日期"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
endDate
;
}
}
\ No newline at end of file
src/main/java/com/kwan/springbootkwan/entity/query/CsdnUserInfoQuery.java
浏览文件 @
6e69cf7c
package
com.kwan.springbootkwan.entity.query
;
import
com.kwan.springbootkwan.entity.BasePage
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"csdn三连用户查询参数类"
)
public
class
CsdnUserInfoQuery
extends
BasePage
{
/**
* 主键id
*/
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
/**
* 用户code
*/
@ApiModelProperty
(
"用户code"
)
private
String
userName
;
/**
* CSDN用户名称
*/
@ApiModelProperty
(
"CSDN用户名称"
)
private
String
nickName
;
/**
* 点赞状态
*/
@ApiModelProperty
(
"点赞状态"
)
private
Integer
likeStatus
=
0
;
/**
* 收藏状态
*/
@ApiModelProperty
(
"收藏状态"
)
private
Integer
collectStatus
=
0
;
/**
* 评论状态
*/
@ApiModelProperty
(
"评论状态"
)
private
Integer
commentStatus
=
0
;
/**
* 用户权重
*/
@ApiModelProperty
(
"用户权重"
)
private
Integer
userWeight
;
/**
* 文章类型
*/
@ApiModelProperty
(
"文章类型"
)
private
String
articleType
;
/**
* 添加类型
*/
@ApiModelProperty
(
"添加类型"
)
private
Integer
addType
;
}
}
\ No newline at end of file
src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java
浏览文件 @
6e69cf7c
...
...
@@ -37,9 +37,9 @@ public class CsdnSchedule {
}
@Scheduled
(
cron
=
"0 0/30 * * * ?"
)
public
void
resetCurrentStatus
()
{
public
void
reset
All
CurrentStatus
()
{
log
.
info
(
"executeInit task is running ... ..."
);
csdnUserInfoService
.
resetCurrentStatus
();
csdnUserInfoService
.
reset
All
CurrentStatus
();
log
.
info
(
"executeInit task is finish ... ..."
);
}
...
...
src/main/java/com/kwan/springbootkwan/service/CsdnUserInfoService.java
浏览文件 @
6e69cf7c
...
...
@@ -13,12 +13,18 @@ public interface CsdnUserInfoService extends IService<CsdnUserInfo> {
/**
* 重置新文章的状态
*/
void
resetCurrentStatus
();
void
reset
All
CurrentStatus
();
/**
* 重置新一天的状态
*/
void
resetUserDayStatus
();
/**
* 重置某个人某一天的状态
*
* @param csdnUserInfo
*/
void
resetCsdnUserInfo
(
CsdnUserInfo
csdnUserInfo
);
}
src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java
浏览文件 @
6e69cf7c
...
...
@@ -36,10 +36,6 @@ public class CsdnCollectServiceImpl implements CsdnCollectService {
@Override
public
Boolean
isCollect
(
String
articleId
,
CsdnUserInfo
csdnUserInfo
)
{
final
Integer
collectStatus
=
csdnUserInfo
.
getCollectStatus
();
if
(
CollectStatus
.
HAVE_ALREADY_COLLECT
.
getCode
().
equals
(
collectStatus
)
||
CollectStatus
.
COLLECT_IS_FULL
.
getCode
().
equals
(
collectStatus
))
{
return
true
;
}
HttpResponse
response
=
HttpUtil
.
createGet
(
isCollectUrl
)
.
header
(
"Cookie"
,
csdnCookie
)
.
form
(
"articleId"
,
articleId
)
...
...
src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java
浏览文件 @
6e69cf7c
...
...
@@ -104,11 +104,6 @@ public class CsdnCommentServiceImpl implements CsdnCommentService {
}
else
if
(
code
==
400
&&
StringUtils
.
equals
(
message
,
"您评论太快了,请休息一下!"
))
{
log
.
info
(
"您评论太快了,请休息一下!"
);
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
COMMENT_TOO_FAST
.
getCode
());
try
{
Thread
.
sleep
(
20000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
else
{
log
.
info
(
"其他错误"
);
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
OTHER_ERRORS
.
getCode
());
...
...
src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java
浏览文件 @
6e69cf7c
...
...
@@ -34,31 +34,36 @@ public class CsdnUserInfoServiceImpl extends ServiceImpl<CsdnUserInfoMapper, Csd
private
CsdnArticleService
csdnArticleService
;
@Override
public
void
resetCurrentStatus
()
{
public
void
reset
All
CurrentStatus
()
{
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
Integer
commentStatus
=
csdnUserInfo
.
getCommentStatus
();
final
String
articleType
=
csdnUserInfo
.
getArticleType
();
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
String
urlInfo
=
article
.
getUrl
();
String
articleId
=
urlInfo
.
substring
(
urlInfo
.
lastIndexOf
(
"/"
)
+
1
);
final
Boolean
collect
=
csdnCollectService
.
isCollect
(
articleId
,
csdnUserInfo
);
if
(!
collect
||
CommentStatus
.
COMMENT_TOO_FAST
.
getCode
().
equals
(
commentStatus
)
||
!
StringUtils
.
equals
(
articleType
,
type
))
{
csdnUserInfo
.
setLikeStatus
(
LikeStatus
.
UN_PROCESSED
.
getCode
());
csdnUserInfo
.
setCollectStatus
(
CollectStatus
.
UN_PROCESSED
.
getCode
());
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
UN_PROCESSED
.
getCode
());
csdnUserInfo
.
setArticleType
(
type
);
this
.
updateById
(
csdnUserInfo
);
}
}
this
.
resetCsdnUserInfo
(
csdnUserInfo
);
}
}
}
@Override
public
void
resetCsdnUserInfo
(
CsdnUserInfo
csdnUserInfo
)
{
final
String
userName
=
csdnUserInfo
.
getUserName
();
final
Integer
commentStatus
=
csdnUserInfo
.
getCommentStatus
();
final
String
articleType
=
csdnUserInfo
.
getArticleType
();
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
String
urlInfo
=
article
.
getUrl
();
String
articleId
=
urlInfo
.
substring
(
urlInfo
.
lastIndexOf
(
"/"
)
+
1
);
final
Boolean
collect
=
csdnCollectService
.
isCollect
(
articleId
,
csdnUserInfo
);
if
(!
collect
||
CommentStatus
.
COMMENT_TOO_FAST
.
getCode
().
equals
(
commentStatus
)
||
!
StringUtils
.
equals
(
articleType
,
type
))
{
csdnUserInfo
.
setLikeStatus
(
LikeStatus
.
UN_PROCESSED
.
getCode
());
csdnUserInfo
.
setCollectStatus
(
CollectStatus
.
UN_PROCESSED
.
getCode
());
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
UN_PROCESSED
.
getCode
());
csdnUserInfo
.
setArticleType
(
type
);
this
.
updateById
(
csdnUserInfo
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录