fix:添加新的调整

上级 339ee66f
...@@ -6,6 +6,8 @@ import com.kwan.springbootkwan.entity.Result; ...@@ -6,6 +6,8 @@ import com.kwan.springbootkwan.entity.Result;
import com.kwan.springbootkwan.service.CsdnAutoReplyService; import com.kwan.springbootkwan.service.CsdnAutoReplyService;
import com.kwan.springbootkwan.service.CsdnService; import com.kwan.springbootkwan.service.CsdnService;
import com.kwan.springbootkwan.service.CsdnUserInfoService; import com.kwan.springbootkwan.service.CsdnUserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -17,6 +19,7 @@ import java.util.Objects; ...@@ -17,6 +19,7 @@ import java.util.Objects;
@Slf4j @Slf4j
@RestController @RestController
@Api(tags = "csdn三连用户管理")
@RequestMapping("/csdn") @RequestMapping("/csdn")
public class CsdnController { public class CsdnController {
...@@ -27,6 +30,7 @@ public class CsdnController { ...@@ -27,6 +30,7 @@ public class CsdnController {
@Autowired @Autowired
private CsdnUserInfoService csdnUserInfoService; private CsdnUserInfoService csdnUserInfoService;
@ApiOperation(value = "单人三连", nickname = "单人三连")
@GetMapping("/singleTriplet") @GetMapping("/singleTriplet")
public Result singleTriplet(@Param("username") String username) { public Result singleTriplet(@Param("username") String username) {
QueryWrapper<CsdnUserInfo> wrapper = new QueryWrapper<>(); QueryWrapper<CsdnUserInfo> wrapper = new QueryWrapper<>();
...@@ -39,33 +43,44 @@ public class CsdnController { ...@@ -39,33 +43,44 @@ public class CsdnController {
return Result.ok("单人三连完成"); return Result.ok("单人三连完成");
} }
@ApiOperation(value = "多人三连", nickname = "多人三连")
@GetMapping("/multiTriplet") @GetMapping("/multiTriplet")
public Result multiTriplet() { public Result multiTriplet() {
csdnService.multiTriplet(); csdnService.multiTriplet();
return Result.ok("多人三连完成"); return Result.ok("多人三连完成");
} }
@ApiOperation(value = "自动回复", nickname = "自动回复")
@GetMapping("/autoReply") @GetMapping("/autoReply")
public Result autoReply() { public Result autoReply() {
csdnAutoReplyService.commentSelf(); csdnAutoReplyService.commentSelf();
return Result.ok("自动回复完成"); return Result.ok("自动回复完成");
} }
@GetMapping("/resetCurrentStatus") @ApiOperation(value = "重置全员新博客状态", nickname = "重置全员新博客状态")
public Result resetCurrentStatus() { @GetMapping("/resetAllCurrentStatus")
csdnUserInfoService.resetCurrentStatus(); public Result resetAllCurrentStatus() {
return Result.ok("重置新博客状态完成"); 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") @GetMapping("/resetUserDayStatus")
public Result resetUserDayStatus() { public Result resetUserDayStatus() {
csdnUserInfoService.resetUserDayStatus(); csdnUserInfoService.resetUserDayStatus();
return Result.ok("重置新一天用户状态完成"); return Result.ok("重置新一天用户状态完成");
} }
@GetMapping("/resetDayStatus")
public Result resetDayStatus() {
csdnUserInfoService.resetUserDayStatus();
return Result.ok("重置新一天状态完成");
}
} }
...@@ -8,6 +8,8 @@ import com.kwan.springbootkwan.entity.Result; ...@@ -8,6 +8,8 @@ import com.kwan.springbootkwan.entity.Result;
import com.kwan.springbootkwan.entity.dto.CsdnTripletDayInfoDTO; import com.kwan.springbootkwan.entity.dto.CsdnTripletDayInfoDTO;
import com.kwan.springbootkwan.entity.query.CsdnTripletDayInfoQuery; import com.kwan.springbootkwan.entity.query.CsdnTripletDayInfoQuery;
import com.kwan.springbootkwan.service.CsdnTripletDayInfoService; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -19,12 +21,8 @@ import java.text.SimpleDateFormat; ...@@ -19,12 +21,8 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
/**
* 每日三连监控(CsdnTripletDayInfo)表控制层 @Api(tags = "csdn每日三连监控")
*
* @author makejava
* @since 2023-10-26 20:55:30
*/
@RestController @RestController
@RequestMapping("/dayInfo") @RequestMapping("/dayInfo")
public class CsdnTripletDayInfoController { public class CsdnTripletDayInfoController {
...@@ -36,11 +34,7 @@ public class CsdnTripletDayInfoController { ...@@ -36,11 +34,7 @@ public class CsdnTripletDayInfoController {
return Result.ok(csdnTripletDayInfoService.todayInfo()); return Result.ok(csdnTripletDayInfoService.todayInfo());
} }
/** @ApiOperation(value = "分页查询所有数据", nickname = "分页查询所有数据")
* 分页查询所有数据
*
* @return 所有数据
*/
@PostMapping("/page") @PostMapping("/page")
public Result selectAll(@RequestBody CsdnTripletDayInfoQuery query) { public Result selectAll(@RequestBody CsdnTripletDayInfoQuery query) {
final Date startDate = query.getStartDate(); final Date startDate = query.getStartDate();
......
...@@ -7,6 +7,8 @@ import com.kwan.springbootkwan.entity.Result; ...@@ -7,6 +7,8 @@ import com.kwan.springbootkwan.entity.Result;
import com.kwan.springbootkwan.entity.dto.CsdnUserInfoDTO; import com.kwan.springbootkwan.entity.dto.CsdnUserInfoDTO;
import com.kwan.springbootkwan.entity.query.CsdnUserInfoQuery; import com.kwan.springbootkwan.entity.query.CsdnUserInfoQuery;
import com.kwan.springbootkwan.service.CsdnUserInfoService; import com.kwan.springbootkwan.service.CsdnUserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -21,17 +23,15 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -21,17 +23,15 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Objects; import java.util.Objects;
@Slf4j @Slf4j
@Api(tags = "csdn每日三连监控")
@RestController @RestController
@RequestMapping("/csdn/user") @RequestMapping("/csdn/user")
public class CsdnUserController { public class CsdnUserController {
@Autowired @Autowired
private CsdnUserInfoService csdnUserInfoService; private CsdnUserInfoService csdnUserInfoService;
/** @ApiOperation(value = "分页查询所有数据", nickname = "分页查询所有数据")
* 分页查询所有数据
*
* @return 所有数据
*/
@PostMapping("/page") @PostMapping("/page")
public Result selectAll(@RequestBody CsdnUserInfoQuery query) { public Result selectAll(@RequestBody CsdnUserInfoQuery query) {
final Integer userWeight = query.getUserWeight(); final Integer userWeight = query.getUserWeight();
...@@ -71,11 +71,7 @@ public class CsdnUserController { ...@@ -71,11 +71,7 @@ public class CsdnUserController {
return Result.ok(CsdnUserInfoDTO.Converter.INSTANCE.from(this.csdnUserInfoService.page(pageParm, wrapper))); return Result.ok(CsdnUserInfoDTO.Converter.INSTANCE.from(this.csdnUserInfoService.page(pageParm, wrapper)));
} }
/** @ApiOperation(value = "新增用户", nickname = "新增用户")
* 新增用户
*
* @return 所有数据
*/
@PostMapping("/add") @PostMapping("/add")
public Result add(@RequestBody CsdnUserInfoQuery addInfo) { public Result add(@RequestBody CsdnUserInfoQuery addInfo) {
final String userName = addInfo.getUserName(); final String userName = addInfo.getUserName();
...@@ -119,12 +115,7 @@ public class CsdnUserController { ...@@ -119,12 +115,7 @@ public class CsdnUserController {
return Result.ok(); return Result.ok();
} }
/** @ApiOperation(value = "更新用户", nickname = "更新用户")
* 更新用户
*
* @param query
* @return
*/
@PostMapping("/update") @PostMapping("/update")
public Result update(@RequestBody CsdnUserInfoQuery query) { public Result update(@RequestBody CsdnUserInfoQuery query) {
CsdnUserInfo csdnUserInfo = new CsdnUserInfo(); CsdnUserInfo csdnUserInfo = new CsdnUserInfo();
...@@ -135,12 +126,7 @@ public class CsdnUserController { ...@@ -135,12 +126,7 @@ public class CsdnUserController {
return Result.ok(this.csdnUserInfoService.updateById(csdnUserInfo)); return Result.ok(this.csdnUserInfoService.updateById(csdnUserInfo));
} }
/** @ApiOperation(value = "删除用户", nickname = "删除用户")
* 删除用户
*
* @param id
* @return
*/
@GetMapping("/delete") @GetMapping("/delete")
public Result delete(@RequestParam("id") Integer id) { public Result delete(@RequestParam("id") Integer id) {
CsdnUserInfo csdnUserInfo = new CsdnUserInfo(); CsdnUserInfo csdnUserInfo = new CsdnUserInfo();
......
...@@ -3,34 +3,31 @@ package com.kwan.springbootkwan.entity; ...@@ -3,34 +3,31 @@ package com.kwan.springbootkwan.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
/**
* 每日三连监控(CsdnTripletDayInfo)表实体类
*
* @author makejava
* @since 2023-10-26 20:55:31
*/
@Data @Data
@ApiModel("csdn每日三连监控类")
@TableName("csdn_triplet_day_info") @TableName("csdn_triplet_day_info")
public class CsdnTripletDayInfo extends Model<CsdnTripletDayInfo> { public class CsdnTripletDayInfo extends Model<CsdnTripletDayInfo> {
//主键id @ApiModelProperty("主键id")
private Integer id; private Integer id;
//三连日期 @ApiModelProperty("三连日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date tripletDate; private Date tripletDate;
//点赞数量 @ApiModelProperty("点赞数量")
private Integer likeNum; private Integer likeNum;
//收藏数量 @ApiModelProperty("收藏数量")
private Integer collectNum; private Integer collectNum;
//评论数量 @ApiModelProperty("评论数量")
private Integer commentNum; private Integer commentNum;
//创建时间 @ApiModelProperty("创建时间")
private Date createTime; private Date createTime;
//更新时间 @ApiModelProperty("更新时间")
private Date updateTime; private Date updateTime;
//逻辑删除,0未删除,1已删除 @ApiModelProperty("逻辑删除,0未删除,1已删除")
private Integer isDelete; private Integer isDelete;
} }
\ No newline at end of file
...@@ -2,55 +2,37 @@ package com.kwan.springbootkwan.entity; ...@@ -2,55 +2,37 @@ package com.kwan.springbootkwan.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @Data
@ApiModel("csdn用户类")
@TableName("csdn_user_info") @TableName("csdn_user_info")
public class CsdnUserInfo extends Model<CsdnUserInfo> { public class CsdnUserInfo extends Model<CsdnUserInfo> implements Serializable {
/** @ApiModelProperty("主键id")
* 主键id
*/
private Integer id; private Integer id;
/** @ApiModelProperty("用户code")
* 用户code
*/
private String userName; private String userName;
/** @ApiModelProperty("CSDN用户名称")
* CSDN用户名称
*/
private String nickName; private String nickName;
/** @ApiModelProperty("点赞状态")
* 点赞状态
*/
private Integer likeStatus; private Integer likeStatus;
/** @ApiModelProperty("收藏状态")
* 收藏状态
*/
private Integer collectStatus; private Integer collectStatus;
/** @ApiModelProperty("评论状态")
* 评论状态
*/
private Integer commentStatus; private Integer commentStatus;
/** @ApiModelProperty("用户权重")
* 用户权重
*/
private Integer userWeight; private Integer userWeight;
/** @ApiModelProperty("文章类型")
* 文章类型
*/
private String articleType; private String articleType;
/** @ApiModelProperty("创建时间")
* 创建时间
*/
private Date createTime; private Date createTime;
/** @ApiModelProperty("更新时间")
* 更新时间
*/
private Date updateTime; private Date updateTime;
/** @ApiModelProperty("逻辑删除,0未删除,1已删除")
* 逻辑删除,0未删除,1已删除
*/
private Integer isDelete; private Integer isDelete;
} }
\ No newline at end of file
...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.activerecord.Model; ...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; import com.kwan.springbootkwan.entity.CsdnTripletDayInfo;
import com.kwan.springbootkwan.mapstruct.FromConverter; import com.kwan.springbootkwan.mapstruct.FromConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;
...@@ -11,25 +13,25 @@ import org.mapstruct.factory.Mappers; ...@@ -11,25 +13,25 @@ import org.mapstruct.factory.Mappers;
import java.util.Date; import java.util.Date;
@Data @Data
@ApiModel("csdn三连监控DTO")
public class CsdnTripletDayInfoDTO extends Model<CsdnTripletDayInfoDTO> { public class CsdnTripletDayInfoDTO extends Model<CsdnTripletDayInfoDTO> {
//主键id @ApiModelProperty("主键id")
private Integer id; private Integer id;
//三连日期 @ApiModelProperty("三连日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date tripletDate; private Date tripletDate;
//点赞数量 @ApiModelProperty("点赞数量")
private Integer likeNum; private Integer likeNum;
//收藏数量 @ApiModelProperty("收藏数量")
private Integer collectNum; private Integer collectNum;
//评论数量 @ApiModelProperty("评论数量")
private Integer commentNum; private Integer commentNum;
//创建时间 @ApiModelProperty("创建时间")
private Date createTime; private Date createTime;
//更新时间 @ApiModelProperty("更新时间")
private Date updateTime; private Date updateTime;
//逻辑删除,0未删除,1已删除 @ApiModelProperty("逻辑删除,0未删除,1已删除")
private Integer isDelete; private Integer isDelete;
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
......
...@@ -3,6 +3,8 @@ package com.kwan.springbootkwan.entity.dto; ...@@ -3,6 +3,8 @@ package com.kwan.springbootkwan.entity.dto;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.kwan.springbootkwan.entity.CsdnUserInfo; import com.kwan.springbootkwan.entity.CsdnUserInfo;
import com.kwan.springbootkwan.mapstruct.FromConverter; import com.kwan.springbootkwan.mapstruct.FromConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;
...@@ -10,52 +12,31 @@ import org.mapstruct.factory.Mappers; ...@@ -10,52 +12,31 @@ import org.mapstruct.factory.Mappers;
import java.util.Date; import java.util.Date;
@Data @Data
@ApiModel("csdn三连用户DTO")
public class CsdnUserInfoDTO extends Model<CsdnUserInfoDTO> { public class CsdnUserInfoDTO extends Model<CsdnUserInfoDTO> {
/**
* 主键id @ApiModelProperty("主键id")
*/
private Integer id; private Integer id;
/** @ApiModelProperty("用户code")
* 用户code
*/
private String userName; private String userName;
/** @ApiModelProperty("CSDN用户名称")
* CSDN用户名称
*/
private String nickName; private String nickName;
/** @ApiModelProperty("点赞状态")
* 点赞状态
*/
private Integer likeStatus; private Integer likeStatus;
/** @ApiModelProperty("收藏状态")
* 收藏状态
*/
private Integer collectStatus; private Integer collectStatus;
/** @ApiModelProperty("评论状态")
* 评论状态
*/
private Integer commentStatus; private Integer commentStatus;
/** @ApiModelProperty("用户权重")
* 用户权重
*/
private Integer userWeight; private Integer userWeight;
/** @ApiModelProperty("文章类型")
* 文章类型
*/
private String articleType; private String articleType;
/** @ApiModelProperty("创建时间")
* 创建时间
*/
private Date createTime; private Date createTime;
/** @ApiModelProperty("更新时间")
* 更新时间
*/
private Date updateTime; private Date updateTime;
/** @ApiModelProperty("逻辑删除,0未删除,1已删除")
* 逻辑删除,0未删除,1已删除
*/
private Integer isDelete; private Integer isDelete;
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
......
...@@ -2,18 +2,21 @@ package com.kwan.springbootkwan.entity.query; ...@@ -2,18 +2,21 @@ package com.kwan.springbootkwan.entity.query;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.kwan.springbootkwan.entity.BasePage; import com.kwan.springbootkwan.entity.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@Data @Data
@ApiModel("csdn三连监控查询参数类")
public class CsdnTripletDayInfoQuery extends BasePage { public class CsdnTripletDayInfoQuery extends BasePage {
//主键id @ApiModelProperty("主键id")
private Integer id; private Integer id;
//开始日期 @ApiModelProperty("开始日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startDate; private Date startDate;
//结束日期 @ApiModelProperty("结束日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endDate; private Date endDate;
} }
\ No newline at end of file
package com.kwan.springbootkwan.entity.query; package com.kwan.springbootkwan.entity.query;
import com.kwan.springbootkwan.entity.BasePage; import com.kwan.springbootkwan.entity.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
@ApiModel("csdn三连用户查询参数类")
public class CsdnUserInfoQuery extends BasePage { public class CsdnUserInfoQuery extends BasePage {
/** @ApiModelProperty("主键id")
* 主键id
*/
private Integer id; private Integer id;
/** @ApiModelProperty("用户code")
* 用户code
*/
private String userName; private String userName;
/** @ApiModelProperty("CSDN用户名称")
* CSDN用户名称
*/
private String nickName; private String nickName;
/** @ApiModelProperty("点赞状态")
* 点赞状态
*/
private Integer likeStatus = 0; private Integer likeStatus = 0;
/** @ApiModelProperty("收藏状态")
* 收藏状态
*/
private Integer collectStatus = 0; private Integer collectStatus = 0;
/** @ApiModelProperty("评论状态")
* 评论状态
*/
private Integer commentStatus = 0; private Integer commentStatus = 0;
/** @ApiModelProperty("用户权重")
* 用户权重
*/
private Integer userWeight; private Integer userWeight;
/** @ApiModelProperty("文章类型")
* 文章类型
*/
private String articleType; private String articleType;
/** @ApiModelProperty("添加类型")
* 添加类型
*/
private Integer addType; private Integer addType;
} }
\ No newline at end of file
...@@ -37,9 +37,9 @@ public class CsdnSchedule { ...@@ -37,9 +37,9 @@ public class CsdnSchedule {
} }
@Scheduled(cron = "0 0/30 * * * ?") @Scheduled(cron = "0 0/30 * * * ?")
public void resetCurrentStatus() { public void resetAllCurrentStatus() {
log.info("executeInit task is running ... ..."); log.info("executeInit task is running ... ...");
csdnUserInfoService.resetCurrentStatus(); csdnUserInfoService.resetAllCurrentStatus();
log.info("executeInit task is finish ... ..."); log.info("executeInit task is finish ... ...");
} }
......
...@@ -13,12 +13,18 @@ public interface CsdnUserInfoService extends IService<CsdnUserInfo> { ...@@ -13,12 +13,18 @@ public interface CsdnUserInfoService extends IService<CsdnUserInfo> {
/** /**
* 重置新文章的状态 * 重置新文章的状态
*/ */
void resetCurrentStatus(); void resetAllCurrentStatus();
/** /**
* 重置新一天的状态 * 重置新一天的状态
*/ */
void resetUserDayStatus(); void resetUserDayStatus();
/**
* 重置某个人某一天的状态
*
* @param csdnUserInfo
*/
void resetCsdnUserInfo(CsdnUserInfo csdnUserInfo);
} }
...@@ -36,10 +36,6 @@ public class CsdnCollectServiceImpl implements CsdnCollectService { ...@@ -36,10 +36,6 @@ public class CsdnCollectServiceImpl implements CsdnCollectService {
@Override @Override
public Boolean isCollect(String articleId, CsdnUserInfo csdnUserInfo) { 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) HttpResponse response = HttpUtil.createGet(isCollectUrl)
.header("Cookie", csdnCookie) .header("Cookie", csdnCookie)
.form("articleId", articleId) .form("articleId", articleId)
......
...@@ -104,11 +104,6 @@ public class CsdnCommentServiceImpl implements CsdnCommentService { ...@@ -104,11 +104,6 @@ public class CsdnCommentServiceImpl implements CsdnCommentService {
} else if (code == 400 && StringUtils.equals(message, "您评论太快了,请休息一下!")) { } else if (code == 400 && StringUtils.equals(message, "您评论太快了,请休息一下!")) {
log.info("您评论太快了,请休息一下!"); log.info("您评论太快了,请休息一下!");
csdnUserInfo.setCommentStatus(CommentStatus.COMMENT_TOO_FAST.getCode()); csdnUserInfo.setCommentStatus(CommentStatus.COMMENT_TOO_FAST.getCode());
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
} else { } else {
log.info("其他错误"); log.info("其他错误");
csdnUserInfo.setCommentStatus(CommentStatus.OTHER_ERRORS.getCode()); csdnUserInfo.setCommentStatus(CommentStatus.OTHER_ERRORS.getCode());
......
...@@ -34,12 +34,19 @@ public class CsdnUserInfoServiceImpl extends ServiceImpl<CsdnUserInfoMapper, Csd ...@@ -34,12 +34,19 @@ public class CsdnUserInfoServiceImpl extends ServiceImpl<CsdnUserInfoMapper, Csd
private CsdnArticleService csdnArticleService; private CsdnArticleService csdnArticleService;
@Override @Override
public void resetCurrentStatus() { public void resetAllCurrentStatus() {
QueryWrapper<CsdnUserInfo> wrapper = new QueryWrapper<>(); QueryWrapper<CsdnUserInfo> wrapper = new QueryWrapper<>();
wrapper.eq("is_delete", 0); wrapper.eq("is_delete", 0);
final List<CsdnUserInfo> list = this.list(wrapper); final List<CsdnUserInfo> list = this.list(wrapper);
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
for (CsdnUserInfo csdnUserInfo : list) { for (CsdnUserInfo csdnUserInfo : list) {
this.resetCsdnUserInfo(csdnUserInfo);
}
}
}
@Override
public void resetCsdnUserInfo(CsdnUserInfo csdnUserInfo) {
final String userName = csdnUserInfo.getUserName(); final String userName = csdnUserInfo.getUserName();
final Integer commentStatus = csdnUserInfo.getCommentStatus(); final Integer commentStatus = csdnUserInfo.getCommentStatus();
final String articleType = csdnUserInfo.getArticleType(); final String articleType = csdnUserInfo.getArticleType();
...@@ -61,8 +68,6 @@ public class CsdnUserInfoServiceImpl extends ServiceImpl<CsdnUserInfoMapper, Csd ...@@ -61,8 +68,6 @@ public class CsdnUserInfoServiceImpl extends ServiceImpl<CsdnUserInfoMapper, Csd
} }
} }
} }
}
}
@Override @Override
public void resetUserDayStatus() { public void resetUserDayStatus() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册