diff --git a/src/main/java/com/kwan/springbootkwan/controller/AlgorithmicProblemController.java b/src/main/java/com/kwan/springbootkwan/controller/AlgorithmicProblemController.java deleted file mode 100644 index b5f3d775db06e56d460d409eff0464fadf7e7dcd..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/controller/AlgorithmicProblemController.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.kwan.springbootkwan.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.kwan.springbootkwan.entity.AlgorithmicProblem; -import com.kwan.springbootkwan.entity.Result; -import com.kwan.springbootkwan.entity.dto.AlgorithmicProblemDTO; -import com.kwan.springbootkwan.entity.query.AlgorithmicProblemQuery; -import com.kwan.springbootkwan.service.AlgorithmicProblemService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * 算法题(AlgorithmicProblem)表控制层 - * - * @author makejava - * @since 2023-10-07 09:15:45 - */ -@RestController -@RequestMapping("algorithmicProblem") -public class AlgorithmicProblemController { - - @Resource - private AlgorithmicProblemService algorithmicProblemService; - - /** - * 获取面试题的种类的数量 - * - * @return - */ - @GetMapping("/questionType") - public Result questionType() { - return Result.ok(this.algorithmicProblemService.questionType()); - } - - /** - * 获取面试题的种类的数量 - * - * @return - */ - @GetMapping("/allQuestionType") - public Result allQuestionType() { - return Result.ok(this.algorithmicProblemService.allQuestionType()); - } - - /** - * 分页查询所有数据 - * - * @return 所有数据 - */ - @GetMapping("/page") - public Result selectAll(@RequestParam Integer page - , @RequestParam Integer pageSize - , @RequestParam String questionName - , @RequestParam Integer questionType) { - Page pageParm = new Page<>(); - pageParm.setCurrent(page); - pageParm.setSize(pageSize); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.orderByDesc("id"); - if (questionType != 0) { - wrapper.eq("question_type", questionType); - } - wrapper.eq("is_delete", 0); - if (StringUtils.isNotEmpty(questionName)) { - wrapper.like("question_name", questionName); - } - return Result.ok(AlgorithmicProblemDTO.Converter.INSTANCE.from(this.algorithmicProblemService.page(pageParm, wrapper))); - } - - /** - * 随机一题 - */ - @GetMapping("/random") - public Result random() { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("is_delete", 0); - wrapper.orderByAsc("rand()").last("limit 1"); - return Result.ok(AlgorithmicProblemDTO.Converter.INSTANCE.from(this.algorithmicProblemService.getOne(wrapper))); - } - - /** - * 新增问题 - * - * @return 所有数据 - */ - @PostMapping("/add") - public Result add(@RequestBody AlgorithmicProblemQuery addInfo) { - final Integer addType = addInfo.getAddType(); - final String questionName = addInfo.getQuestionName(); - if (StringUtils.isEmpty(questionName)) { - return Result.error("问题不能为空"); - } - //批量添加 - if (addType == 1) { - final String[] split = questionName.split("\n"); - for (String str : split) { - str = str.trim().replace("- ", ""); - if (StringUtils.isEmpty(str)) { - continue; - } - AlgorithmicProblem algorithmicProblem = new AlgorithmicProblem(); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("question_name", str); - wrapper.eq("is_delete", 0); - final AlgorithmicProblem one = this.algorithmicProblemService.getOne(wrapper); - if (one == null) { - BeanUtils.copyProperties(addInfo, algorithmicProblem); - algorithmicProblem.setQuestionName(str); - this.algorithmicProblemService.save(algorithmicProblem); - } - } - } else { - AlgorithmicProblem algorithmicProblem = new AlgorithmicProblem(); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("question_name", questionName); - wrapper.eq("is_delete", 0); - final AlgorithmicProblem one = this.algorithmicProblemService.getOne(wrapper); - if (one == null) { - BeanUtils.copyProperties(addInfo, algorithmicProblem); - this.algorithmicProblemService.save(algorithmicProblem); - return Result.ok(); - } else { - return Result.error("该面试问题已存在"); - } - } - return Result.ok(); - } - - /** - * 更新面试题 - * - * @param query - * @return - */ - @PostMapping("/update") - public Result update(@RequestBody AlgorithmicProblemQuery query) { - AlgorithmicProblem algorithmicProblem = new AlgorithmicProblem(); - BeanUtils.copyProperties(query, algorithmicProblem); - return Result.ok(this.algorithmicProblemService.updateById(algorithmicProblem)); - } - - /** - * 删除面试题 - * - * @param id - * @return - */ - @GetMapping("/delete") - public Result delete(@RequestParam("id") Integer id) { - AlgorithmicProblem algorithmicProblem = new AlgorithmicProblem(); - algorithmicProblem.setIsDelete(1); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("id", id); - return Result.ok(this.algorithmicProblemService.update(algorithmicProblem, wrapper)); - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/controller/AphorismPoetryController.java b/src/main/java/com/kwan/springbootkwan/controller/AphorismPoetryController.java deleted file mode 100644 index b9fff96895aec412a5c5aa0cb4f9b84225020ebf..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/controller/AphorismPoetryController.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.kwan.springbootkwan.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.kwan.springbootkwan.entity.AphorismPoetry; -import com.kwan.springbootkwan.entity.Result; -import com.kwan.springbootkwan.entity.dto.AphorismPoetryDTO; -import com.kwan.springbootkwan.entity.query.AphorismPoetryQuery; -import com.kwan.springbootkwan.service.AphorismPoetryService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * 名言警句(AphorismPoetry)表控制层 - * - * @author makejava - * @since 2023-10-09 11:13:12 - */ -@RestController -@RequestMapping("aphorismPoetry") -public class AphorismPoetryController { - /** - * 服务对象 - */ - @Resource - private AphorismPoetryService aphorismPoetryService; - - /** - * 分页查询所有数据 - * - * @return 所有数据 - */ - @GetMapping("/page") - public Result selectAll(@RequestParam Integer page - , @RequestParam Integer pageSize - , @RequestParam String poetryText) { - Page pageParm = new Page<>(); - pageParm.setCurrent(page); - pageParm.setSize(pageSize); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.orderByDesc("id"); - wrapper.eq("is_delete", 0); - if (StringUtils.isNotEmpty(poetryText)) { - wrapper.like("poetry_text", poetryText); - } - return Result.ok(AphorismPoetryDTO.Converter.INSTANCE.from(this.aphorismPoetryService.page(pageParm, wrapper))); - } - - /** - * 随机一题 - */ - @GetMapping("/random") - public Result random() { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("is_delete", 0); - wrapper.orderByAsc("rand()").last("limit 1"); - return Result.ok(AphorismPoetryDTO.Converter.INSTANCE.from(this.aphorismPoetryService.getOne(wrapper))); - } - - /** - * 新增问题 - * - * @return 所有数据 - */ - @PostMapping("/add") - public Result add(@RequestBody AphorismPoetryQuery poetryQuery) { - final Integer addType = poetryQuery.getAddType(); - final String poetryText = poetryQuery.getPoetryText(); - if (StringUtils.isEmpty(poetryText)) { - return Result.error("内容不能为空"); - } - //批量添加 - if (addType == 1) { - final String[] split = poetryText.split("\n"); - for (String str : split) { - str = str.trim().replace("- ", ""); - if (StringUtils.isEmpty(str)) { - continue; - } - AphorismPoetry algorithmicProblem = new AphorismPoetry(); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("poetry_text", str); - wrapper.eq("is_delete", 0); - final AphorismPoetry one = this.aphorismPoetryService.getOne(wrapper); - if (one == null) { - BeanUtils.copyProperties(poetryQuery, algorithmicProblem); - algorithmicProblem.setPoetryText(str); - this.aphorismPoetryService.save(algorithmicProblem); - } - } - } else { - AphorismPoetry aphorismPoetry = new AphorismPoetry(); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("poetry_text", poetryText); - wrapper.eq("is_delete", 0); - final AphorismPoetry one = this.aphorismPoetryService.getOne(wrapper); - if (one == null) { - BeanUtils.copyProperties(poetryQuery, aphorismPoetry); - this.aphorismPoetryService.save(aphorismPoetry); - return Result.ok(); - } else { - return Result.error("该诗词已存在"); - } - } - return Result.ok(); - } - - /** - * 更新面试题 - * - * @param query - * @return - */ - @PostMapping("/update") - public Result update(@RequestBody AphorismPoetryQuery query) { - AphorismPoetry aphorismPoetry = new AphorismPoetry(); - BeanUtils.copyProperties(query, aphorismPoetry); - return Result.ok(this.aphorismPoetryService.updateById(aphorismPoetry)); - } - - /** - * 删除面试题 - * - * @param id - * @return - */ - @GetMapping("/delete") - public Result delete(@RequestParam("id") Integer id) { - AphorismPoetry aphorismPoetry = new AphorismPoetry(); - aphorismPoetry.setIsDelete(1); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("id", id); - return Result.ok(this.aphorismPoetryService.update(aphorismPoetry, wrapper)); - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/controller/ChatbotController.java b/src/main/java/com/kwan/springbootkwan/controller/ChatbotController.java deleted file mode 100644 index eb45b42cc1dc24f47fdb8bb83253abac883845a8..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/controller/ChatbotController.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.kwan.springbootkwan.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.kwan.springbootkwan.entity.Chatbot; -import com.kwan.springbootkwan.entity.Result; -import com.kwan.springbootkwan.entity.dto.ChatbotDTO; -import com.kwan.springbootkwan.service.ChatbotService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; -import java.io.Serializable; -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - - -/** - * (Chatbot)表控制层 - * - * @author : qinyingjie - * @version : 2.2.0 - * @date : 2023/7/11 18:04 - */ -@RestController -@RequestMapping("chatbot") -public class ChatbotController { - /** - * 服务对象 - */ - @Resource - private ChatbotService chatbotService; - - /** - * 获取所有数据 - * - * @return - */ - @GetMapping - public Result selectAll() { - - List list = this.chatbotService.list(); - list = list.stream().sorted(Comparator.comparing(Chatbot::getId).reversed()).collect(Collectors.toList()); - return Result.ok(list); - } - - - /** - * 分页查询所有数据,本地缓存的使用 - * - * @return 所有数据 - */ -// @Cacheable("chatbot-cache") - @GetMapping("/page") - public Result selectAll(@RequestParam Integer page - , @RequestParam Integer pageSize - , @RequestParam String question) { - Page pageParm = new Page<>(); - pageParm.setCurrent(page); - pageParm.setSize(pageSize); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.orderByDesc("id"); - wrapper.eq("is_delete", 0); - if (StringUtils.isNotEmpty(question)) { - wrapper.like("question", question); - } - return Result.ok(ChatbotDTO.Converter.INSTANCE.from(this.chatbotService.page(pageParm, wrapper))); - } - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("{id}") - public Result selectOne(@PathVariable Serializable id) { - return Result.ok(this.chatbotService.getById(id)); - } - - /** - * 新增数据 - * - * @param chatbot 实体对象 - * @return 新增结果 - */ - @PostMapping - public Result insert(@RequestBody Chatbot chatbot) { - return Result.ok(this.chatbotService.save(chatbot)); - } - - /** - * 修改数据 - * - * @param chatbot 实体对象 - * @return 修改结果 - */ - @PutMapping - public Result update(@RequestBody Chatbot chatbot) { - return Result.ok(this.chatbotService.updateById(chatbot)); - } - - /** - * 删除数据 - * - * @param idList 主键结合 - * @return 删除结果 - */ - @DeleteMapping - public Result delete(@RequestParam("idList") List idList) { - return Result.ok(this.chatbotService.removeByIds(idList)); - } - - @GetMapping("/delete") - public Result delete(@RequestParam("id") Integer id) { - Chatbot chatbot = new Chatbot(); - chatbot.setIsDelete(1); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("id", id); - return Result.ok(chatbotService.update(chatbot, wrapper)); - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/controller/CsdnArticleInfoController.java b/src/main/java/com/kwan/springbootkwan/controller/CsdnArticleInfoController.java deleted file mode 100644 index 35dfde3a6ee319878c160a4aa4d2fbdf73668c08..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/controller/CsdnArticleInfoController.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.kwan.springbootkwan.controller; - -import cn.hutool.core.collection.CollectionUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.kwan.springbootkwan.entity.CsdnArticleInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.Result; -import com.kwan.springbootkwan.entity.dto.CsdnArticleInfoDTO; -import com.kwan.springbootkwan.entity.query.CsdnArticleInfoQuery; -import com.kwan.springbootkwan.entity.query.CsdnUserInfoQuery; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; -import com.kwan.springbootkwan.service.CsdnArticleInfoService; -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.commons.lang3.StringUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Objects; - -@Slf4j -@Api(tags = "csdn文章管理") -@RestController -@RequestMapping("/csdnArticleInfo") -public class CsdnArticleInfoController { - - @Resource - private CsdnService csdnService; - @Resource - private CsdnUserInfoService csdnUserInfoService; - @Resource - private CsdnArticleInfoService csdnArticleInfoService; - - @ApiOperation(value = "分页查询所有数据", nickname = "分页查询所有数据") - @PostMapping("/page") - public Result selectAll(@RequestBody CsdnArticleInfoQuery query) { - final String articleId = query.getArticleId(); - final String nickName = query.getNickName(); - final String userName = query.getUserName(); - final Integer likeStatus = query.getLikeStatus(); - final Integer collectStatus = query.getCollectStatus(); - final Integer commentStatus = query.getCommentStatus(); - Page pageParm = new Page<>(); - pageParm.setCurrent(query.getPage()); - pageParm.setSize(query.getPageSize()); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("is_delete", 0); - if (StringUtils.isNotEmpty(articleId)) { - wrapper.eq("article_id", articleId); - } - if (StringUtils.isNotEmpty(userName)) { - wrapper.eq("user_name", userName); - } - if (Objects.nonNull(likeStatus)) { - wrapper.eq("like_status", likeStatus); - } - if (Objects.nonNull(collectStatus)) { - wrapper.eq("collect_status", collectStatus); - } - if (Objects.nonNull(commentStatus)) { - wrapper.eq("comment_status", commentStatus); - } - if (StringUtils.isNotEmpty(nickName)) { - wrapper.like("nick_name", nickName); - } - wrapper.orderByDesc("update_time"); - return Result.ok(CsdnArticleInfoDTO.Converter.INSTANCE.from(this.csdnArticleInfoService.page(pageParm, wrapper))); - } - - @ApiOperation(value = "新增文章", nickname = "新增文章") - @PostMapping("/add") - public Result add(@RequestBody CsdnArticleInfoQuery addInfo) { - final String userName = addInfo.getUserName(); - final String articleId = addInfo.getArticleId(); - if (StringUtils.isNotEmpty(userName) && StringUtils.isNotEmpty(articleId)) { - final List articles = this.csdnArticleInfoService.getBlogs(userName); - for (BusinessInfoResponse.ArticleData.Article article : articles) { - if (articleId.equals(article.getArticleId().toString())) { - //首先查询用户 - CsdnUserInfoQuery addUserInfo = new CsdnUserInfoQuery(); - addUserInfo.setUserName(userName); - addUserInfo.setAddType(0); - csdnUserInfoService.add(addUserInfo); - CsdnArticleInfo csdnArticleInfo = this.csdnArticleInfoService.getArticleByArticleId(articleId); - if (csdnArticleInfo == null) { - csdnArticleInfo = new CsdnArticleInfo(); - csdnArticleInfo.setArticleId(articleId); - csdnArticleInfo.setUserName(userName); - csdnArticleInfo.setArticleTitle(article.getTitle()); - csdnArticleInfo.setArticleDescription(article.getDescription()); - csdnArticleInfo.setArticleUrl(article.getUrl()); - csdnArticleInfo.setNickName(addUserInfo.getNickName()); - this.csdnArticleInfoService.saveArticle(csdnArticleInfo); - } - break; - } - } - } - return Result.ok(); - } - - @ApiOperation(value = "更新用户", nickname = "更新用户") - @PostMapping("/update") - public Result update(@RequestBody CsdnArticleInfoQuery query) { - CsdnArticleInfo csdnUserInfo = new CsdnArticleInfo(); - csdnUserInfo.setId(query.getId()); - csdnUserInfo.setUserName(query.getUserName()); - csdnUserInfo.setNickName(query.getNickName()); - csdnUserInfo.setArticleUrl(query.getArticleUrl()); - csdnUserInfo.setArticleId(query.getArticleId()); - return Result.ok(this.csdnArticleInfoService.updateById(csdnUserInfo)); - } - - @ApiOperation(value = "删除用户", nickname = "删除用户") - @GetMapping("/delete") - public Result delete(@RequestParam("id") Integer id) { - CsdnArticleInfo csdnArticleInfo = new CsdnArticleInfo(); - csdnArticleInfo.setIsDelete(1); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("id", id); - return Result.ok(this.csdnArticleInfoService.update(csdnArticleInfo, wrapper)); - } - - @ApiOperation(value = "单篇文章三连", nickname = "单篇文章三连") - @GetMapping("/triplet") - public Result triplet(@RequestParam("articleId") Integer articleId) { - final CsdnArticleInfo csdnArticleInfo = this.csdnArticleInfoService.getArticleByArticleId(articleId.toString()); - if (csdnArticleInfo != null) { - final String userName = csdnArticleInfo.getUserName(); - CsdnUserInfo csdnUserInfo = csdnUserInfoService.getUserByUserName(userName); - BusinessInfoResponse.ArticleData.Article article = new BusinessInfoResponse.ArticleData.Article(); - article.setDescription(csdnArticleInfo.getArticleDescription()); - article.setTitle(csdnArticleInfo.getArticleTitle()); - article.setUrl(csdnArticleInfo.getArticleUrl()); - csdnService.tripletByArticle(csdnUserInfo, article, csdnArticleInfo); - } - return Result.ok("单篇文章三连完成"); - } - - @ApiOperation(value = "多条blog三连", nickname = "多条blog三连") - @PostMapping("/multiTriplet") - public Result multiTriplet(@RequestBody List articleIds) { - if (CollectionUtil.isNotEmpty(articleIds)) { - for (String articleId : articleIds) { - triplet(Integer.valueOf(articleId)); - } - } - return Result.ok("重置多个人员新博客状态完成"); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/controller/CsdnController.java b/src/main/java/com/kwan/springbootkwan/controller/CsdnController.java deleted file mode 100644 index c73845946e2063ba83bbbde5d1c2b69732a87cd4..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/controller/CsdnController.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.kwan.springbootkwan.controller; - -import cn.hutool.core.collection.CollectionUtil; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -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; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; -import java.util.Objects; - -@Slf4j -@RestController -@Api(tags = "csdn三连用户管理") -@RequestMapping("/csdn") -public class CsdnController { - - @Autowired - private CsdnService csdnService; - @Autowired - private CsdnAutoReplyService csdnAutoReplyService; - @Autowired - private CsdnUserInfoService csdnUserInfoService; - - @ApiOperation(value = "单人三连", nickname = "单人三连") - @GetMapping("/singleTriplet") - public Result singleTriplet(@Param("username") String username) { - CsdnUserInfo csdnUserInfo = csdnUserInfoService.getUserByUserName(username); - if (Objects.nonNull(csdnUserInfo)) { - csdnService.singleArticle(csdnUserInfo); - } - return Result.ok("单人三连完成"); - } - - @ApiOperation(value = "多人三连", nickname = "多人三连") - @PostMapping("/multiTriplet") - public Result multiTriplet(@RequestBody List userNames) { - if (CollectionUtil.isNotEmpty(userNames)) { - for (String userName : userNames) { - singleTriplet(userName); - } - } - return Result.ok("多人三连完成"); - } - - @ApiOperation(value = "全员三连", nickname = "全员三连") - @GetMapping("/allTriplet") - public Result allTriplet() { - csdnService.allTriplet(); - return Result.ok("全员三连完成"); - } - - @ApiOperation(value = "自动回复", nickname = "自动回复") - @GetMapping("/autoReply") - public Result autoReply() { - csdnAutoReplyService.commentSelf(); - 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) { - CsdnUserInfo csdnUserInfo = csdnUserInfoService.getUserByUserName(username); - if (Objects.nonNull(csdnUserInfo)) { - csdnUserInfoService.resetCsdnUserInfo(csdnUserInfo); - } - return Result.ok("重置指定人员新博客状态完成"); - } - - @ApiOperation(value = "重置多个人员新博客", nickname = "重置多个人员新博客") - @PostMapping("/resetCsdnUserInfo") - public Result resetCsdnUserInfo(@RequestBody List userNames) { - if (CollectionUtil.isNotEmpty(userNames)) { - for (String userName : userNames) { - resetCsdnUserInfo(userName); - } - } - return Result.ok("重置多个人员新博客状态完成"); - } - - @ApiOperation(value = "重置新一天用户状态", nickname = "重置新一天用户状态") - @GetMapping("/resetUserDayStatus") - public Result resetUserDayStatus() { - csdnUserInfoService.resetUserDayStatus(); - return Result.ok("重置新一天用户状态完成"); - } - - @ApiOperation(value = "给指定人员添加10篇博客", nickname = "给指定人员添加10篇博客") - @GetMapping("/add10Blog") - public Result add10Blog(@Param("username") String username) { - csdnUserInfoService.add10Blog(username); - return Result.ok("给指定人员添加10篇博客完成"); - } - -} diff --git a/src/main/java/com/kwan/springbootkwan/controller/CsdnTripletDayInfoController.java b/src/main/java/com/kwan/springbootkwan/controller/CsdnTripletDayInfoController.java deleted file mode 100644 index 5799259aabdb9a537c874d93b300d03a00498143..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/controller/CsdnTripletDayInfoController.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.kwan.springbootkwan.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; -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; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Objects; - - -@Api(tags = "csdn每日三连监控") -@RestController -@RequestMapping("/dayInfo") -public class CsdnTripletDayInfoController { - - @Autowired - private CsdnTripletDayInfoService csdnTripletDayInfoService; - - @GetMapping("/add") - public Result autoReply() { - return Result.ok(csdnTripletDayInfoService.todayInfo()); - } - - @ApiOperation(value = "分页查询所有数据", nickname = "分页查询所有数据") - @PostMapping("/page") - public Result selectAll(@RequestBody CsdnTripletDayInfoQuery query) { - final Date startDate = query.getStartDate(); - final Date endDate = query.getEndDate(); - Page pageParm = new Page<>(); - pageParm.setCurrent(query.getPage()); - pageParm.setSize(query.getPageSize()); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("is_delete", 0); - if (Objects.nonNull(startDate)) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - String startFormattedDate = sdf.format(startDate); - wrapper.ge("triplet_date", startFormattedDate); - } - if (Objects.nonNull(endDate)) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - String endFormattedDate = sdf.format(endDate); - wrapper.le("triplet_date", endFormattedDate); - } - wrapper.orderByDesc("create_time"); - return Result.ok(CsdnTripletDayInfoDTO.Converter.INSTANCE.from(this.csdnTripletDayInfoService.page(pageParm, wrapper))); - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/controller/CsdnUserController.java b/src/main/java/com/kwan/springbootkwan/controller/CsdnUserController.java deleted file mode 100644 index e379c88fdc5b6015b31c187893dae92e11cecb71..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/controller/CsdnUserController.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.kwan.springbootkwan.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -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.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -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; - - @ApiOperation(value = "分页查询所有数据", nickname = "分页查询所有数据") - @PostMapping("/page") - public Result selectAll(@RequestBody CsdnUserInfoQuery query) { - final Integer userWeight = query.getUserWeight(); - final String nickName = query.getNickName(); - final String userName = query.getUserName(); - final String articleType = query.getArticleType(); - final Integer likeStatus = query.getLikeStatus(); - final Integer collectStatus = query.getCollectStatus(); - final Integer commentStatus = query.getCommentStatus(); - Page pageParm = new Page<>(); - pageParm.setCurrent(query.getPage()); - pageParm.setSize(query.getPageSize()); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("is_delete", 0); - if (StringUtils.isNotEmpty(userName)) { - wrapper.eq("user_name", userName); - } - if (StringUtils.isNotEmpty(articleType)) { - wrapper.eq("article_type", articleType); - } - if (Objects.nonNull(userWeight)) { - wrapper.eq("user_weight", userWeight); - } - if (Objects.nonNull(likeStatus)) { - wrapper.eq("like_status", likeStatus); - } - if (Objects.nonNull(collectStatus)) { - wrapper.eq("collect_status", collectStatus); - } - if (Objects.nonNull(commentStatus)) { - wrapper.eq("comment_status", commentStatus); - } - if (StringUtils.isNotEmpty(nickName)) { - wrapper.like("nick_name", nickName); - } - wrapper.orderByDesc("update_time"); - return Result.ok(CsdnUserInfoDTO.Converter.INSTANCE.from(this.csdnUserInfoService.page(pageParm, wrapper))); - } - - @ApiOperation(value = "新增用户", nickname = "新增用户") - @PostMapping("/add") - public Result add(@RequestBody CsdnUserInfoQuery addInfo) { - csdnUserInfoService.add(addInfo); - return Result.ok(); - } - - @ApiOperation(value = "更新用户", nickname = "更新用户") - @PostMapping("/update") - public Result update(@RequestBody CsdnUserInfoQuery query) { - CsdnUserInfo csdnUserInfo = new CsdnUserInfo(); - csdnUserInfo.setId(query.getId()); - csdnUserInfo.setUserName(query.getUserName()); - csdnUserInfo.setNickName(query.getNickName()); - csdnUserInfo.setUserWeight(query.getUserWeight()); - csdnUserInfo.setUserHomeUrl(query.getUserHomeUrl()); - return Result.ok(this.csdnUserInfoService.updateById(csdnUserInfo)); - } - - @ApiOperation(value = "删除用户", nickname = "删除用户") - @GetMapping("/delete") - public Result delete(@RequestParam("id") Integer id) { - CsdnUserInfo csdnUserInfo = new CsdnUserInfo(); - csdnUserInfo.setIsDelete(1); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("id", id); - return Result.ok(this.csdnUserInfoService.update(csdnUserInfo, wrapper)); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/controller/InterviewQuestionController.java b/src/main/java/com/kwan/springbootkwan/controller/InterviewQuestionController.java deleted file mode 100644 index 4b3114b613c2d10d9aab781da7050b09b9d50df1..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/controller/InterviewQuestionController.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.kwan.springbootkwan.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.kwan.springbootkwan.entity.InterviewQuestion; -import com.kwan.springbootkwan.entity.Result; -import com.kwan.springbootkwan.entity.dto.InterviewQuestionDTO; -import com.kwan.springbootkwan.entity.query.InterviewQuestionAdd; -import com.kwan.springbootkwan.entity.query.InterviewQuestionUpdate; -import com.kwan.springbootkwan.service.InterviewQuestionService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * 面试题(InterviewQuestion)表控制层 - * - * @author makejava - * @since 2023-09-08 16:31:51 - */ -@RestController -@RequestMapping("interviewQuestion") -public class InterviewQuestionController { - /** - * 服务对象 - */ - @Resource - private InterviewQuestionService interviewQuestionService; - - /** - * 导入问题 - * - * @return 所有数据 - */ - @GetMapping("/upload") - public Result uploadFile(@RequestParam String path) { - return Result.ok(this.interviewQuestionService.uploadFile(path)); - } - - /** - * 获取面试题的种类的数量 - * - * @return - */ - @GetMapping("/questionType") - public Result questionType() { - return Result.ok(this.interviewQuestionService.questionType()); - } - - /** - * 获取所有的面试题的种类的数量 - * - * @return - */ - @GetMapping("/allQuestionType") - public Result allQuestionType() { - return Result.ok(this.interviewQuestionService.allQuestionType()); - } - - /** - * 分页查询所有数据 - * - * @return 所有数据 - */ - @GetMapping("/page") - public Result selectAll(@RequestParam Integer page - , @RequestParam Integer pageSize - , @RequestParam String question - , @RequestParam Integer questionType) { - Page pageParm = new Page<>(); - pageParm.setCurrent(page); - pageParm.setSize(pageSize); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.orderByDesc("id"); - if (questionType != 0) { - wrapper.eq("question_type", questionType); - } - wrapper.eq("is_delete", 0); - if (StringUtils.isNotEmpty(question)) { - wrapper.like("question", question); - } - return Result.ok(InterviewQuestionDTO.Converter.INSTANCE.from(this.interviewQuestionService.page(pageParm, wrapper))); - } - - /** - * 新增问题 - * - * @return 所有数据 - */ - @PostMapping("/add") - public Result add(@RequestBody InterviewQuestionAdd addInfo) { - final Integer addType = addInfo.getAddType(); - final String question = addInfo.getQuestion(); - if (StringUtils.isEmpty(question)) { - return Result.error("问题不能为空"); - } - //批量添加 - if (addType == 1) { - final String[] split = question.split("\n"); - for (String str : split) { - str = str.trim().replace("- ", ""); - if (StringUtils.isEmpty(str)) { - continue; - } - InterviewQuestion interviewQuestion = new InterviewQuestion(); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("question", str); - wrapper.eq("is_delete", 0); - final InterviewQuestion one = this.interviewQuestionService.getOne(wrapper); - if (one == null) { - interviewQuestion.setQuestion(str); - interviewQuestion.setQuestionType(addInfo.getQuestionType()); - this.interviewQuestionService.save(interviewQuestion); - } - } - } else { - InterviewQuestion interviewQuestion = new InterviewQuestion(); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("question", question); - wrapper.eq("is_delete", 0); - final InterviewQuestion one = this.interviewQuestionService.getOne(wrapper); - if (one == null) { - interviewQuestion.setQuestion(question); - interviewQuestion.setQuestionType(addInfo.getQuestionType()); - this.interviewQuestionService.save(interviewQuestion); - return Result.ok(); - } else { - return Result.error("该面试问题已存在"); - } - } - return Result.ok(); - } - - /** - * 更新面试题 - * - * @param addInfo - * @return - */ - @PostMapping("/update") - public Result update(@RequestBody InterviewQuestionUpdate addInfo) { - InterviewQuestion interviewQuestion = new InterviewQuestion(); - interviewQuestion.setId(addInfo.getId()); - interviewQuestion.setQuestion(addInfo.getQuestion()); - interviewQuestion.setQuestionType(addInfo.getQuestionType()); - return Result.ok(this.interviewQuestionService.updateById(interviewQuestion)); - } - - - /** - * 删除面试题 - * - * @param id - * @return - */ - @GetMapping("/delete") - public Result delete(@RequestParam("id") Integer id) { - InterviewQuestion interviewQuestion = new InterviewQuestion(); - interviewQuestion.setIsDelete(1); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("id", id); - return Result.ok(this.interviewQuestionService.update(interviewQuestion, wrapper)); - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/controller/PicInfoController.java b/src/main/java/com/kwan/springbootkwan/controller/PicInfoController.java deleted file mode 100644 index 7b17ba3323b6f2a8c4306444736bfedb9562d45b..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/controller/PicInfoController.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.kwan.springbootkwan.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.kwan.springbootkwan.entity.PicInfo; -import com.kwan.springbootkwan.entity.Result; -import com.kwan.springbootkwan.service.PicInfoService; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; -import java.io.Serializable; -import java.util.List; - -/** - * 图片信息表(PicInfo)表控制层 - * - * @author makejava - * @since 2023-08-09 12:44:02 - */ -@RestController -@RequestMapping("picInfo") -public class PicInfoController { - /** - * 服务对象 - */ - @Resource - private PicInfoService picInfoService; - - @GetMapping(value = "/getAll") - public Result getAll() { - return Result.ok(this.picInfoService.list()); - } - - /** - * 分页查询图片 - * - * @return 所有数据 - */ - @GetMapping("/page") - public Result selectAll(@RequestParam Integer page, @RequestParam Integer pageSize - , @RequestParam Integer picType) { - Page pageParm = new Page<>(); - pageParm.setCurrent(page); - pageParm.setSize(pageSize); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.orderByDesc("id"); - wrapper.eq("is_delete", 0); - wrapper.eq("type", picType); - return Result.ok(this.picInfoService.page(pageParm, wrapper)); - } - - /** - * 分页查询所有数据 - * - * @param page 分页对象 - * @param picInfo 查询实体 - * @return 所有数据 - */ - @GetMapping - public Result selectAll(Page page, PicInfo picInfo) { - return Result.ok(this.picInfoService.page(page, new QueryWrapper<>(picInfo))); - } - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("{id}") - public Result selectOne(@PathVariable Serializable id) { - return Result.ok(this.picInfoService.getById(id)); - } - - /** - * 新增数据 - * - * @param picInfo 实体对象 - * @return 新增结果 - */ - @PostMapping - public Result insert(@RequestBody PicInfo picInfo) { - return Result.ok(this.picInfoService.save(picInfo)); - } - - - /** - * 新增图片 - * - * @param path - * @return - */ - @PostMapping(value = "/insertByPath") - public Result insertByPath(@RequestParam String path, @RequestParam Integer type) { - return Result.ok(this.picInfoService.insertByPath(path, type)); - } - - - /** - * 通过url新增图片 - * - * @param url - * @return - */ - @PostMapping(value = "/insertByBaiduUrl") - public Result insertByBaiduUrl(@RequestParam String url, @RequestParam Integer type) { - return Result.ok(this.picInfoService.insertByBaiduUrl(url, type)); - } - - - /** - * 修改数据 - * - * @param picInfo 实体对象 - * @return 修改结果 - */ - @PutMapping - public Result update(@RequestBody PicInfo picInfo) { - return Result.ok(this.picInfoService.updateById(picInfo)); - } - - /** - * 删除数据 - * - * @param idList 主键结合 - * @return 删除结果 - */ - @DeleteMapping - public Result delete(@RequestParam("idList") List idList) { - return Result.ok(this.picInfoService.removeByIds(idList)); - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/controller/RedisController.java b/src/main/java/com/kwan/springbootkwan/controller/RedisController.java index 856dc5e39295b25e7ee3449c8fe4908a1cdf7cb5..0d93d72f49583f0c3f6cb32ac717024035388311 100644 --- a/src/main/java/com/kwan/springbootkwan/controller/RedisController.java +++ b/src/main/java/com/kwan/springbootkwan/controller/RedisController.java @@ -14,6 +14,14 @@ import java.util.concurrent.TimeUnit; import static com.kwan.springbootkwan.constant.CommonConstant.PREFIX_REDIS_KEY; + +/** + * redis测试信息 + * + * @author : qinyingjie + * @version : 2.2.0 + * @date : 2023/10/30 13:33 + */ @Slf4j @Api(value = "redis测试信息", tags = "RedisController") @RestController diff --git a/src/main/java/com/kwan/springbootkwan/entity/CsdnArticleInfo.java b/src/main/java/com/kwan/springbootkwan/entity/CsdnArticleInfo.java deleted file mode 100644 index 0382ab98a9ce9464cf66d1c11ad0d4ccf3493305..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/CsdnArticleInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -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.util.Date; - -@Data -@ApiModel("csdn文章类") -@TableName("csdn_article_info") -public class CsdnArticleInfo extends Model { - @ApiModelProperty("主键id") - private Integer id; - @ApiModelProperty("文章id") - private String articleId; - @ApiModelProperty("文章URL") - private String articleUrl; - @ApiModelProperty("文章标题") - private String articleTitle; - @ApiModelProperty("文章描述") - private String articleDescription; - @ApiModelProperty("用户名称") - private String userName; - @ApiModelProperty("用户昵称") - private String nickName; - @ApiModelProperty("点赞状态") - private Integer likeStatus; - @ApiModelProperty("收藏状态") - private Integer collectStatus; - @ApiModelProperty("评论状态") - private Integer commentStatus; - @ApiModelProperty("创建时间") - private Date createTime; - @ApiModelProperty("更新时间") - private Date updateTime; - @ApiModelProperty("逻辑删除,0未删除,1已删除") - private Integer isDelete; -} - diff --git a/src/main/java/com/kwan/springbootkwan/entity/CsdnTripletDayInfo.java b/src/main/java/com/kwan/springbootkwan/entity/CsdnTripletDayInfo.java deleted file mode 100644 index 4b66fad49e762bd849e1dfae1fddc951697135f1..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/CsdnTripletDayInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -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; - -@Data -@ApiModel("csdn每日三连监控类") -@TableName("csdn_triplet_day_info") -public class CsdnTripletDayInfo extends Model { - @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; - @ApiModelProperty("逻辑删除,0未删除,1已删除") - private Integer isDelete; -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/entity/CsdnUserInfo.java b/src/main/java/com/kwan/springbootkwan/entity/CsdnUserInfo.java deleted file mode 100644 index 3240c1cf43bf9026850ba9b177536cf5ec3f7511..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/CsdnUserInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -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 implements Serializable { - @ApiModelProperty("主键id") - private Integer id; - @ApiModelProperty("用户code") - private String userName; - @ApiModelProperty("CSDN用户名称") - private String nickName; - @ApiModelProperty("点赞状态") - private Integer likeStatus; - @ApiModelProperty("收藏状态") - private Integer collectStatus; - @ApiModelProperty("评论状态") - private Integer commentStatus; - @ApiModelProperty("用户权重") - private Integer userWeight; - @ApiModelProperty("用户主页") - private String userHomeUrl; - @ApiModelProperty("文章类型") - private String articleType; - @ApiModelProperty("创建时间") - private Date createTime; - @ApiModelProperty("更新时间") - private Date updateTime; - @ApiModelProperty("逻辑删除,0未删除,1已删除") - private Integer isDelete; -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/entity/dto/AlgorithmicProblemDTO.java b/src/main/java/com/kwan/springbootkwan/entity/dto/AlgorithmicProblemDTO.java deleted file mode 100644 index b6ff7aefd35e7143f96b162b6718e439228442bd..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/dto/AlgorithmicProblemDTO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.kwan.springbootkwan.entity.dto; - -import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.kwan.springbootkwan.entity.AlgorithmicProblem; -import com.kwan.springbootkwan.mapstruct.FromConverter; -import lombok.Data; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; -import org.mapstruct.factory.Mappers; - -import java.util.Date; - -/** - * 面试题(InterviewQuestion)表实体类 - * - * @author makejava - * @since 2023-09-08 16:31:53 - */ -@Data -@SuppressWarnings("serial") -public class AlgorithmicProblemDTO extends Model { - /** - * 主键id - */ - private Integer id; - /** - * 面试问题 - */ - private String questionName; - /** - * 类型 - */ - private Integer questionType; - /** - * 1~10的分值 - */ - private Integer degreeOfImportance; - /** - * 1:简单;2:中等;3:困难 - */ - private Integer degreeOfDifficulty; - /** - * 困难指数 - */ - private Integer difficultyOfScore; - /** - * 力扣的问题号 - */ - private Integer leetcodeNumber; - /** - * 力扣的问题链接 - */ - private String leetcodeLink; - /** - * 创建时间 - */ - private Date createTime; - - @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) - public interface Converter extends FromConverter { - AlgorithmicProblemDTO.Converter INSTANCE = Mappers.getMapper(AlgorithmicProblemDTO.Converter.class); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/entity/dto/AlgorithmicQuestionTypeDTO.java b/src/main/java/com/kwan/springbootkwan/entity/dto/AlgorithmicQuestionTypeDTO.java deleted file mode 100644 index 1a7df58ff87d5876236b37bc818fbc6f2a73d9bf..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/dto/AlgorithmicQuestionTypeDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.kwan.springbootkwan.entity.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class AlgorithmicQuestionTypeDTO { - /** - * 问题类型编码 - */ - private Integer questionType; - /** - * 问题类型名称 - */ - private String name; - /** - * 问题类型数量 - */ - private Integer typeSize; -} - diff --git a/src/main/java/com/kwan/springbootkwan/entity/dto/AphorismPoetryDTO.java b/src/main/java/com/kwan/springbootkwan/entity/dto/AphorismPoetryDTO.java deleted file mode 100644 index a7057ee3cb19c7aee4403b5ba67fd01c51c09a3d..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/dto/AphorismPoetryDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.kwan.springbootkwan.entity.dto; - -import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.kwan.springbootkwan.entity.AphorismPoetry; -import com.kwan.springbootkwan.mapstruct.FromConverter; -import lombok.Data; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; -import org.mapstruct.factory.Mappers; - -import java.util.Date; - - -/** - * 诗词实体类 - * - * @author : qinyingjie - * @version : 2.2.0 - * @date : 2023/10/9 11:19 - */ -@Data -@SuppressWarnings("serial") -public class AphorismPoetryDTO extends Model { - /** - * 主键id - */ - private Integer id; - /** - * 诗词内容 - */ - private String poetryText; - /** - * 创建时间 - */ - private Date createTime; - - @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) - public interface Converter extends FromConverter { - AphorismPoetryDTO.Converter INSTANCE = Mappers.getMapper(AphorismPoetryDTO.Converter.class); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/entity/dto/ChatbotDTO.java b/src/main/java/com/kwan/springbootkwan/entity/dto/ChatbotDTO.java deleted file mode 100644 index dd680a3495a198ffa833af743cc3747d3c665f1c..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/dto/ChatbotDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.kwan.springbootkwan.entity.dto; - -import com.kwan.springbootkwan.entity.Chatbot; -import com.kwan.springbootkwan.mapstruct.FromConverter; -import lombok.Data; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; -import org.mapstruct.factory.Mappers; - -import java.util.Date; - - -@Data -public class ChatbotDTO { - - private Integer id; - private String question; - private String response; - private Date createTime; - private Integer isDelete; - - @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) - public interface Converter extends FromConverter { - Converter INSTANCE = Mappers.getMapper(Converter.class); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/entity/dto/CsdnArticleInfoDTO.java b/src/main/java/com/kwan/springbootkwan/entity/dto/CsdnArticleInfoDTO.java deleted file mode 100644 index 0203de4b16e6e649d6aa9822d41555892910004b..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/dto/CsdnArticleInfoDTO.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.kwan.springbootkwan.entity.dto; - -import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.kwan.springbootkwan.entity.CsdnArticleInfo; -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; -import org.mapstruct.factory.Mappers; - -import java.util.Date; - -@Data -@ApiModel("csdn文章DTO") -public class CsdnArticleInfoDTO extends Model { - - @ApiModelProperty("主键id") - private Integer id; - @ApiModelProperty("文章id") - private String articleId; - @ApiModelProperty("文章URL") - private String articleUrl; - @ApiModelProperty("文章标题") - private String articleTitle; - @ApiModelProperty("文章描述") - private String articleDescription; - @ApiModelProperty("用户名称") - private String userName; - @ApiModelProperty("用户昵称") - private String nickName; - @ApiModelProperty("点赞状态") - private Integer likeStatus; - @ApiModelProperty("收藏状态") - private Integer collectStatus; - @ApiModelProperty("评论状态") - private Integer commentStatus; - @ApiModelProperty("创建时间") - private Date createTime; - @ApiModelProperty("更新时间") - private Date updateTime; - @ApiModelProperty("逻辑删除,0未删除,1已删除") - private Integer isDelete; - - @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) - public interface Converter extends FromConverter { - Converter INSTANCE = Mappers.getMapper(Converter.class); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/entity/dto/CsdnTripletDayInfoDTO.java b/src/main/java/com/kwan/springbootkwan/entity/dto/CsdnTripletDayInfoDTO.java deleted file mode 100644 index 4801099794aa98ce96c1a40fa954b6403eccfb4e..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/dto/CsdnTripletDayInfoDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.kwan.springbootkwan.entity.dto; - -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; -import org.mapstruct.factory.Mappers; - -import java.util.Date; - -@Data -@ApiModel("csdn三连监控DTO") -public class CsdnTripletDayInfoDTO extends Model { - @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; - @ApiModelProperty("逻辑删除,0未删除,1已删除") - private Integer isDelete; - - @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) - public interface Converter extends FromConverter { - Converter INSTANCE = Mappers.getMapper(Converter.class); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/entity/dto/CsdnUserInfoDTO.java b/src/main/java/com/kwan/springbootkwan/entity/dto/CsdnUserInfoDTO.java deleted file mode 100644 index e008a2cc5275d901df03f1ac64fafa443cc6baef..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/dto/CsdnUserInfoDTO.java +++ /dev/null @@ -1,48 +0,0 @@ -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; -import org.mapstruct.factory.Mappers; - -import java.util.Date; - -@Data -@ApiModel("csdn三连用户DTO") -public class CsdnUserInfoDTO extends Model { - - @ApiModelProperty("主键id") - private Integer id; - @ApiModelProperty("用户code") - private String userName; - @ApiModelProperty("CSDN用户名称") - private String nickName; - @ApiModelProperty("点赞状态") - private Integer likeStatus; - @ApiModelProperty("收藏状态") - private Integer collectStatus; - @ApiModelProperty("评论状态") - private Integer commentStatus; - @ApiModelProperty("用户权重") - private Integer userWeight; - @ApiModelProperty("用户主页") - private String userHomeUrl; - @ApiModelProperty("文章类型") - private String articleType; - @ApiModelProperty("创建时间") - private Date createTime; - @ApiModelProperty("更新时间") - private Date updateTime; - @ApiModelProperty("逻辑删除,0未删除,1已删除") - private Integer isDelete; - - @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) - public interface Converter extends FromConverter { - Converter INSTANCE = Mappers.getMapper(Converter.class); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionDTO.java b/src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionDTO.java deleted file mode 100644 index 7ffe169c644d8f5943e7976935df4f4dc51fcb1f..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionDTO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.kwan.springbootkwan.entity.dto; - -import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.kwan.springbootkwan.entity.InterviewQuestion; -import com.kwan.springbootkwan.mapstruct.FromConverter; -import lombok.Data; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; -import org.mapstruct.factory.Mappers; - -import java.util.Date; - -/** - * 面试题(InterviewQuestion)表实体类 - * - * @author makejava - * @since 2023-09-08 16:31:53 - */ -@Data -@SuppressWarnings("serial") -public class InterviewQuestionDTO extends Model { - //主键id - private Integer id; - //面试问题 - private String question; - //问题回答 - private String response; - //知识类型,先默认0,后面再区分 - private Integer questionType; - //创建时间 - private Date createTime; - //逻辑删除,0未删除,1已删除 - private Integer isDelete; - - @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) - public interface Converter extends FromConverter { - InterviewQuestionDTO.Converter INSTANCE = Mappers.getMapper(InterviewQuestionDTO.Converter.class); - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionTypeDTO.java b/src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionTypeDTO.java deleted file mode 100644 index 10d7f3dfe6db38ab4e228ca39329d1855871fdad..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionTypeDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.kwan.springbootkwan.entity.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class InterviewQuestionTypeDTO { - /** - * 问题类型编码 - */ - private Integer questionType; - /** - * 问题类型名称 - */ - private String name; - /** - * 问题类型数量 - */ - private Integer typeSize; -} - diff --git a/src/main/java/com/kwan/springbootkwan/mapper/AlgorithmicProblemMapper.java b/src/main/java/com/kwan/springbootkwan/mapper/AlgorithmicProblemMapper.java deleted file mode 100644 index 8166b81b84c4150a255fd71fe4e586b5df16acc5..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/mapper/AlgorithmicProblemMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.kwan.springbootkwan.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.kwan.springbootkwan.entity.AlgorithmicProblem; -import com.kwan.springbootkwan.entity.dto.AlgorithmicQuestionTypeDTO; - -import java.util.LinkedList; - -/** - * 算法题(AlgorithmicProblem)表数据库访问层 - * - * @author makejava - * @since 2023-10-07 09:15:45 - */ -public interface AlgorithmicProblemMapper extends BaseMapper { - - LinkedList questionType(); -} - diff --git a/src/main/java/com/kwan/springbootkwan/mapper/AphorismPoetryMapper.java b/src/main/java/com/kwan/springbootkwan/mapper/AphorismPoetryMapper.java deleted file mode 100644 index 6fc01d785e813faa262810343ac805efa2c78f6d..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/mapper/AphorismPoetryMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.kwan.springbootkwan.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.kwan.springbootkwan.entity.AphorismPoetry; - -/** - * 名言警句(AphorismPoetry)表数据库访问层 - * - * @author makejava - * @since 2023-10-09 11:13:12 - */ -public interface AphorismPoetryMapper extends BaseMapper { - -} - diff --git a/src/main/java/com/kwan/springbootkwan/mapper/CsdnArticleInfoMapper.java b/src/main/java/com/kwan/springbootkwan/mapper/CsdnArticleInfoMapper.java deleted file mode 100644 index 6b5ceafd9ddbd0c4a716a0dfaf1efcc6cb0eb248..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/mapper/CsdnArticleInfoMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.kwan.springbootkwan.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.kwan.springbootkwan.entity.CsdnArticleInfo; -import org.apache.ibatis.annotations.Mapper; - - - -@Mapper -public interface CsdnArticleInfoMapper extends BaseMapper { - -} - diff --git a/src/main/java/com/kwan/springbootkwan/mapper/CsdnTripletDayInfoMapper.java b/src/main/java/com/kwan/springbootkwan/mapper/CsdnTripletDayInfoMapper.java deleted file mode 100644 index d0e03eed5352c3601846ed8b440cd2357ebccd6a..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/mapper/CsdnTripletDayInfoMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.kwan.springbootkwan.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; - -/** - * 每日三连监控(CsdnTripletDayInfo)表数据库访问层 - * - * @author makejava - * @since 2023-10-26 20:55:30 - */ -public interface CsdnTripletDayInfoMapper extends BaseMapper { - -} - diff --git a/src/main/java/com/kwan/springbootkwan/mapper/CsdnUserInfoMapper.java b/src/main/java/com/kwan/springbootkwan/mapper/CsdnUserInfoMapper.java deleted file mode 100644 index 4a8433637b9c60dafcf95e7bd8933c0fbd4fadf4..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/mapper/CsdnUserInfoMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.kwan.springbootkwan.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.kwan.springbootkwan.entity.CsdnUserInfo; - -/** - * csdn用户信息(CsdnUserInfo)表数据库访问层 - * - * @author makejava - * @since 2023-10-23 16:03:13 - */ -public interface CsdnUserInfoMapper extends BaseMapper { - -} - diff --git a/src/main/java/com/kwan/springbootkwan/mapper/InterviewQuestionMapper.java b/src/main/java/com/kwan/springbootkwan/mapper/InterviewQuestionMapper.java deleted file mode 100644 index 5d3a0df280db4e5c4616c441d790cb0161a5e33d..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/mapper/InterviewQuestionMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.kwan.springbootkwan.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.kwan.springbootkwan.entity.InterviewQuestion; -import com.kwan.springbootkwan.entity.dto.InterviewQuestionTypeDTO; -import org.apache.ibatis.annotations.Param; - -import java.util.LinkedList; - -/** - * 面试题(InterviewQuestion)表数据库访问层 - * - * @author makejava - * @since 2023-09-08 16:31:51 - */ -public interface InterviewQuestionMapper extends BaseMapper { - - /** - * 获取面试题的种类 - * - * @return - */ - LinkedList questionType(); - - /** - * 获取面试题的种类 - * - * @return - */ - LinkedList questionType(@Param("id") String id); -} - diff --git a/src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java b/src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java deleted file mode 100644 index 7cbc5e240164d3c8b440c6d7d673e60f982e050f..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.kwan.springbootkwan.schedule; - -import com.kwan.springbootkwan.service.CsdnAutoReplyService; -import com.kwan.springbootkwan.service.CsdnService; -import com.kwan.springbootkwan.service.CsdnTripletDayInfoService; -import com.kwan.springbootkwan.service.CsdnUserInfoService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -@Slf4j -@Component -public class CsdnSchedule { - - @Autowired - private CsdnService csdnService; - @Autowired - private CsdnUserInfoService csdnUserInfoService; - @Autowired - private CsdnAutoReplyService csdnAutoReplyService; - @Autowired - private CsdnTripletDayInfoService csdnTripletDayInfoService; - - @Scheduled(cron = "0 0 8,10,12,14,16,18,20 * * ?") - public void execute() { - log.info("execute task is running ... ..."); - csdnService.allTriplet(); - csdnAutoReplyService.commentSelf(); - log.info("execute task is finish ... ..."); - } - - @Scheduled(cron = "0 0/30 * * * ?") - public void resetAllCurrentStatus() { - log.info("executeInit task is running ... ..."); - csdnUserInfoService.resetAllCurrentStatus(); - log.info("executeInit task is finish ... ..."); - } - - @Scheduled(cron = "0 0 1 * * ?") - public void resetTripletDayInfo() { - log.info("resetTripletDayInfo task is running ... ..."); - //新增当前天的新的一条数据 - csdnUserInfoService.resetUserDayStatus(); - csdnTripletDayInfoService.todayInfo(); - log.info("resetTripletDayInfo task is finish ... ..."); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/AlgorithmicProblemService.java b/src/main/java/com/kwan/springbootkwan/service/AlgorithmicProblemService.java deleted file mode 100644 index ec145ff1e4f1d5e53c2073bcadb5c4ec5388744e..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/AlgorithmicProblemService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.kwan.springbootkwan.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.kwan.springbootkwan.entity.AlgorithmicProblem; -import com.kwan.springbootkwan.entity.dto.AlgorithmicQuestionTypeDTO; - -import java.util.List; - -/** - * 算法题(AlgorithmicProblem)表服务接口 - * - * @author makejava - * @since 2023-10-07 09:15:47 - */ -public interface AlgorithmicProblemService extends IService { - - /** - * 根据已有数据查询类型 - * - * @return - */ - List questionType(); - - - /** - * 问题类型字典 - * - * @return - */ - List allQuestionType(); -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/AphorismPoetryService.java b/src/main/java/com/kwan/springbootkwan/service/AphorismPoetryService.java deleted file mode 100644 index 3c04fe3514a2bdc157b686f31eafaabc28ba7b14..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/AphorismPoetryService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.kwan.springbootkwan.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.kwan.springbootkwan.entity.AphorismPoetry; - -/** - * 名言警句(AphorismPoetry)表服务接口 - * - * @author makejava - * @since 2023-10-09 11:13:13 - */ -public interface AphorismPoetryService extends IService { - -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/CsdnArticleInfoService.java b/src/main/java/com/kwan/springbootkwan/service/CsdnArticleInfoService.java deleted file mode 100644 index 8bb45f17267ab42d0f6a1f246eb03793cb5cbc64..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/CsdnArticleInfoService.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.kwan.springbootkwan.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.kwan.springbootkwan.entity.CsdnArticleInfo; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; - -import java.util.List; - -/** - * csdn文章信息(CsdnArticleInfo)表服务接口 - * - * @author makejava - * @since 2023-10-28 01:58:46 - */ -public interface CsdnArticleInfoService extends IService { - /** - * 通过文章id获取文章信息 - * - * @return - */ - CsdnArticleInfo getArticleByArticleId(String articleId); - - /** - * 保存文章Blog - * - * @return - */ - void saveArticle(CsdnArticleInfo csdnArticleInfo); - - - /** - * 获取最新的10篇文章 - * - * @param username - * @return - */ - List getArticles(String username); - - /** - * 获取最新的10篇博客(只能是blog类型) - * - * @param username - * @return - */ - List getBlogs(String username); -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/CsdnAutoReplyService.java b/src/main/java/com/kwan/springbootkwan/service/CsdnAutoReplyService.java deleted file mode 100644 index b4b03a07cdc5bc831bc8dadae13e8b8f81c2beb3..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/CsdnAutoReplyService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.kwan.springbootkwan.service; - -/** - * 自动回复 - * - * @author : qinyingjie - * @version : 2.2.0 - * @date : 2023/10/24 01:25 - */ -public interface CsdnAutoReplyService { - - /** - * 评论自己的文章 - * - * @return - */ - void commentSelf(); -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/CsdnCollectService.java b/src/main/java/com/kwan/springbootkwan/service/CsdnCollectService.java deleted file mode 100644 index de555fbf0bf3627924e0349bcc6b8bd78e6db2ea..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/CsdnCollectService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.kwan.springbootkwan.service; - - -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; - -/** - * 收藏 - * - * @author : qinyingjie - * @version : 2.2.0 - * @date : 2023/10/24 01:00 - */ -public interface CsdnCollectService { - - /** - * 查询是否收藏过 - * - * @return - */ - Boolean isCollect(String articleId, CsdnUserInfo csdnUserInfo); - - /** - * 收藏 - * - * @return - */ - Boolean collect(BusinessInfoResponse.ArticleData.Article article, CsdnUserInfo csdnUserInfo, CsdnTripletDayInfo csdnTripletDayInfo); -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/CsdnCommentService.java b/src/main/java/com/kwan/springbootkwan/service/CsdnCommentService.java deleted file mode 100644 index b2d4fee76f4bd6fff78fc6493ddbc7c91716e5d0..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/CsdnCommentService.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.kwan.springbootkwan.service; - -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; -import com.kwan.springbootkwan.entity.resp.CommentResponse; - -/** - * 评论 - * - * @author : qinyingjie - * @version : 2.2.0 - * @date : 2023/10/24 01:25 - */ -public interface CsdnCommentService { - - /** - * 查询是否评论过 - * - * @return - */ - Boolean isComment(BusinessInfoResponse.ArticleData.Article article, CsdnUserInfo csdnUserInfo); - - /** - * 评论别人的文章 - * - * @return - */ - Boolean comment(String articleId, CsdnUserInfo csdnUserInfo, CsdnTripletDayInfo csdnTripletDayInfo); - - /** - * 评论文章 - * - * @param articleId - * @param commentInfo - * @param commentId - * @return - */ - CommentResponse dealComment(String articleId, String commentInfo, Integer commentId); -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/CsdnLikeService.java b/src/main/java/com/kwan/springbootkwan/service/CsdnLikeService.java deleted file mode 100644 index df710e527079c064715d4ddbd99d8ddb99e161d8..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/CsdnLikeService.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.kwan.springbootkwan.service; - - -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; - -/** - * 点赞 - * - * @author : qinyingjie - * @version : 2.2.0 - * @date : 2023/10/24 00:19 - */ -public interface CsdnLikeService { - - /** - * 查询是否点过赞 - * - * @return - */ - Boolean isLike(String articleId, CsdnUserInfo csdnUserInfo); - - /** - * 点赞和取消点赞接口,true,点过,false,没有点过 - * - * @return - */ - Boolean like(String articleId, CsdnUserInfo csdnUserInfo, CsdnTripletDayInfo csdnTripletDayInfo); -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/CsdnService.java b/src/main/java/com/kwan/springbootkwan/service/CsdnService.java deleted file mode 100644 index ee8c3c91187a50233707d312091d90cd31841305..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/CsdnService.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.kwan.springbootkwan.service; - -import com.kwan.springbootkwan.entity.CsdnArticleInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; - -/** - * csdn博客自动化 - * - * @author : qinyingjie - * @version : 2.2.0 - * @date : 2023/10/23 14:59 - */ -public interface CsdnService { - - /** - * 单人三连 - * - * @return - */ - void singleArticle(CsdnUserInfo csdnUserInfo); - - /** - * 多人三连 - */ - void allTriplet(); - - /** - * 根据文章三连 - * - * @param csdnUserInfo - * @param article - */ - void tripletByArticle(CsdnUserInfo csdnUserInfo, BusinessInfoResponse.ArticleData.Article article, CsdnArticleInfo csdnArticleInfo); -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/CsdnTripletDayInfoService.java b/src/main/java/com/kwan/springbootkwan/service/CsdnTripletDayInfoService.java deleted file mode 100644 index 124eda842f9cb1a910ffb087a1f8cfa1c3e897d8..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/CsdnTripletDayInfoService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.kwan.springbootkwan.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; - -/** - * 每日三连监控(CsdnTripletDayInfo)表服务接口 - * - * @author makejava - * @since 2023-10-26 20:55:31 - */ -public interface CsdnTripletDayInfoService extends IService { - - - /** - * 重置每日三连监控 - */ - CsdnTripletDayInfo todayInfo(); - -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/CsdnUserInfoService.java b/src/main/java/com/kwan/springbootkwan/service/CsdnUserInfoService.java deleted file mode 100644 index be7753cf8a3a6c3b9d8ef3cf1570d0711f9a3719..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/CsdnUserInfoService.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.kwan.springbootkwan.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.query.CsdnUserInfoQuery; - -import java.util.List; - -/** - * csdn用户信息(CsdnUserInfo)表服务接口 - * - * @author makejava - * @since 2023-10-23 16:03:14 - */ -public interface CsdnUserInfoService extends IService { - - - /** - * 通过用户名获取user信息 - * - * @return - */ - CsdnUserInfo getUserByUserName(String username); - - /** - * 通过用户名获取user信息 - * - * @return - */ - List getAllUser(); - - - /** - * 重置新文章的状态 - */ - void resetAllCurrentStatus(); - - /** - * 重置新一天的状态 - */ - void resetUserDayStatus(); - - /** - * 重置某个人某一天的状态 - * - * @param csdnUserInfo - */ - void resetCsdnUserInfo(CsdnUserInfo csdnUserInfo); - - /** - * 新增用户 - * - * @param addInfo - */ - void add(CsdnUserInfoQuery addInfo); - - /** - * 给指定人员添加10篇博客 - * - * @param username - */ - void add10Blog(String username); - -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/InterviewQuestionService.java b/src/main/java/com/kwan/springbootkwan/service/InterviewQuestionService.java deleted file mode 100644 index 1d2a4eb1cdb330b54000f5288a7f4c74fe3a0bc1..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/InterviewQuestionService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.kwan.springbootkwan.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.kwan.springbootkwan.entity.InterviewQuestion; -import com.kwan.springbootkwan.entity.dto.InterviewQuestionTypeDTO; - -import java.util.List; - -/** - * 面试题(InterviewQuestion)表服务接口 - * - * @author makejava - * @since 2023-09-08 16:31:53 - */ -public interface InterviewQuestionService extends IService { - /** - * 上传面试题 - * - * @param path - * @return - */ - boolean uploadFile(String path); - - /** - * 获取面试题的种类 - * - * @return - */ - List questionType(); - /** - * 获取所有的类型 - * - * @return - */ - List allQuestionType(); -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/AlgorithmicProblemServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/AlgorithmicProblemServiceImpl.java deleted file mode 100644 index 5b5c1da55562bca2af8bd1b4b6c3849e649dd65d..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/AlgorithmicProblemServiceImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.kwan.springbootkwan.entity.AlgorithmicProblem; -import com.kwan.springbootkwan.entity.DictionaryManagement; -import com.kwan.springbootkwan.entity.dto.AlgorithmicQuestionTypeDTO; -import com.kwan.springbootkwan.mapper.AlgorithmicProblemMapper; -import com.kwan.springbootkwan.service.AlgorithmicProblemService; -import com.kwan.springbootkwan.service.DictionaryManagementService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 算法题(AlgorithmicProblem)表服务实现类 - * - * @author makejava - * @since 2023-10-07 09:15:47 - */ -@Service("algorithmicProblemService") -public class AlgorithmicProblemServiceImpl extends ServiceImpl implements AlgorithmicProblemService { - - @Autowired - private AlgorithmicProblemMapper interviewQuestionMapper; - @Autowired - private DictionaryManagementService dictionaryManagementService; - - @Override - public List questionType() { - final List algorithmicQuestionTypeDTOS = this.allQuestionType(); - //获取种类,并按数量排序 - LinkedList types = interviewQuestionMapper.questionType(); - types.addFirst(new AlgorithmicQuestionTypeDTO(0, "全部", 0)); - for (AlgorithmicQuestionTypeDTO algorithmicQuestionTypeDTO : types) { - //数据库存的是问题类型的编码 - final AlgorithmicQuestionTypeDTO item = algorithmicQuestionTypeDTOS.stream().filter(x -> x.getQuestionType().equals(algorithmicQuestionTypeDTO.getQuestionType())).findFirst().get(); - algorithmicQuestionTypeDTO.setName(item.getName()); - } - return types; - } - - @Override - public List allQuestionType() { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("dict_type", 2); - wrapper.eq("is_delete", 0); - final List list = dictionaryManagementService.list(wrapper); - return list.stream() - .map(item -> { - AlgorithmicQuestionTypeDTO algorithmicQuestionTypeDTO = new AlgorithmicQuestionTypeDTO(); - algorithmicQuestionTypeDTO.setQuestionType(item.getCode()); - algorithmicQuestionTypeDTO.setName(item.getName()); - return algorithmicQuestionTypeDTO; - }).collect(Collectors.toList()); - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/AphorismPoetryServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/AphorismPoetryServiceImpl.java deleted file mode 100644 index 44d52dbcd786b61308fa8f1037994ca4db23860a..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/AphorismPoetryServiceImpl.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.kwan.springbootkwan.mapper.AphorismPoetryMapper; -import com.kwan.springbootkwan.entity.AphorismPoetry; -import com.kwan.springbootkwan.service.AphorismPoetryService; -import org.springframework.stereotype.Service; - -/** - * 名言警句(AphorismPoetry)表服务实现类 - * - * @author makejava - * @since 2023-10-09 11:13:13 - */ -@Service("aphorismPoetryService") -public class AphorismPoetryServiceImpl extends ServiceImpl implements AphorismPoetryService { - -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/ChatbotServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/ChatbotServiceImpl.java deleted file mode 100644 index cffa4eeef1755327c2ad4f151bb394f847952137..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/ChatbotServiceImpl.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.kwan.springbootkwan.mapper.ChatbotMapper; -import com.kwan.springbootkwan.entity.Chatbot; -import com.kwan.springbootkwan.service.ChatbotService; -import org.springframework.stereotype.Service; - -/** - * (Chatbot)表服务实现类 - * - * @author makejava - * @since 2023-07-11 18:02:31 - */ -@Service -public class ChatbotServiceImpl extends ServiceImpl implements ChatbotService { - -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnArticleInfoServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnArticleInfoServiceImpl.java deleted file mode 100644 index 4b46f1d23c5fd74297c1ff163fde9d8fe6c9fa48..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnArticleInfoServiceImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.http.HttpResponse; -import cn.hutool.http.HttpUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.kwan.springbootkwan.entity.CsdnArticleInfo; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; -import com.kwan.springbootkwan.mapper.CsdnArticleInfoMapper; -import com.kwan.springbootkwan.service.CsdnArticleInfoService; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Objects; - -/** - * csdn文章信息(CsdnArticleInfo)表服务实现类 - * - * @author makejava - * @since 2023-10-28 01:58:46 - */ -@Service("csdnArticleInfoService") -public class CsdnArticleInfoServiceImpl extends ServiceImpl implements CsdnArticleInfoService { - - @Value("${csdn.cookie}") - private String csdnCookie; - @Value("${csdn.url.user_article_url}") - private String url; - - @Override - public CsdnArticleInfo getArticleByArticleId(String articleId) { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("is_delete", 0); - wrapper.eq("article_id", articleId) - .last("limit 1"); - return this.getOne(wrapper); - } - - @Override - public void saveArticle(CsdnArticleInfo add) { - final String articleId = add.getArticleId(); - CsdnArticleInfo csdnArticleInfo = this.getArticleByArticleId(articleId); - if (Objects.isNull(csdnArticleInfo)) { - csdnArticleInfo = new CsdnArticleInfo(); - csdnArticleInfo.setArticleId(articleId); - csdnArticleInfo.setUserName(add.getUserName()); - csdnArticleInfo.setArticleTitle(add.getArticleTitle()); - csdnArticleInfo.setArticleDescription(add.getArticleDescription()); - csdnArticleInfo.setArticleUrl(add.getArticleUrl()); - csdnArticleInfo.setNickName(add.getNickName()); - this.save(csdnArticleInfo); - } - } - - @Override - public List getArticles(String username) { - HttpResponse response = HttpUtil.createGet(url) - .header("Cookie", csdnCookie) - .form("page", 1) - .form("size", 10) - .form("businessType", "lately") - .form("noMore", false) - .form("username", username) - .execute(); - final String body = response.body(); - ObjectMapper objectMapper = new ObjectMapper(); - BusinessInfoResponse businessInfoResponse; - List list = null; - try { - businessInfoResponse = objectMapper.readValue(body, BusinessInfoResponse.class); - final BusinessInfoResponse.ArticleData data = businessInfoResponse.getData(); - list = data.getList(); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - if (CollectionUtil.isEmpty(list)) { - return null; - } - return list; - } - - @Override - public List getBlogs(String username) { - HttpResponse response = HttpUtil.createGet(url) - .header("Cookie", csdnCookie) - .form("page", 1) - .form("size", 10) - .form("businessType", "blog") - .form("noMore", false) - .form("username", username) - .execute(); - final String body = response.body(); - ObjectMapper objectMapper = new ObjectMapper(); - BusinessInfoResponse businessInfoResponse; - List list = null; - try { - businessInfoResponse = objectMapper.readValue(body, BusinessInfoResponse.class); - final BusinessInfoResponse.ArticleData data = businessInfoResponse.getData(); - list = data.getList(); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - if (CollectionUtil.isEmpty(list)) { - return null; - } - return list; - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnAutoReplyServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnAutoReplyServiceImpl.java deleted file mode 100644 index 6d0036a3cba088bbf744ba86d1eb2a878c155895..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnAutoReplyServiceImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.http.HttpResponse; -import cn.hutool.http.HttpUtil; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; -import com.kwan.springbootkwan.entity.resp.CommentListResponse; -import com.kwan.springbootkwan.entity.resp.CommentResponse; -import com.kwan.springbootkwan.service.CsdnArticleInfoService; -import com.kwan.springbootkwan.service.CsdnAutoReplyService; -import com.kwan.springbootkwan.service.CsdnCommentService; -import com.kwan.springbootkwan.service.CsdnService; -import com.kwan.springbootkwan.service.CsdnUserInfoService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Objects; - -@Slf4j -@Service -public class CsdnAutoReplyServiceImpl implements CsdnAutoReplyService { - @Value("${csdn.cookie}") - private String csdnCookie; - @Value("#{'${csdn.self_reply}'.split(';')}") - private String[] selfReply; - @Value("${csdn.self_user_name}") - private String selfUserName; - @Value("${csdn.url.is_comment_list_url}") - private String commentListUrl; - @Autowired - private CsdnService csdnService; - @Autowired - private CsdnArticleInfoService csdnArticleInfoService; - @Autowired - private CsdnCommentService csdnCommentService; - @Autowired - private CsdnUserInfoService csdnUserInfoService; - - @Override - public void commentSelf() { - List list = csdnArticleInfoService.getArticles(selfUserName); - if (CollectionUtil.isNotEmpty(list)) { - for (BusinessInfoResponse.ArticleData.Article article : list) { - final String type = article.getType(); - if (StringUtils.equals("blog", type)) { - final String urlInfo = article.getUrl(); - String articleId = urlInfo.substring(urlInfo.lastIndexOf("/") + 1); - String url = commentListUrl + articleId; - HttpResponse response = HttpUtil.createPost(url) - .header("Cookie", csdnCookie) - .form("page", 1) - .form("size", 200)//获取当前文章的200条评论 - .execute(); - final String body = response.body(); - ObjectMapper objectMapper = new ObjectMapper(); - CommentListResponse articleInfo; - try { - articleInfo = objectMapper.readValue(body, CommentListResponse.class); - final CommentListResponse.DataInfo data = articleInfo.getData(); - final List otherCommentList = data.getList(); - if (CollectionUtil.isNotEmpty(otherCommentList)) { - for (CommentListResponse.Comment oneComment : otherCommentList) { - final CommentListResponse.Info info = oneComment.getInfo(); - final String userName = info.getUserName(); - final String nickName = info.getNickName(); - final Integer commentId = info.getCommentId(); - if (!StringUtils.equals(userName, selfUserName)) { - final List sub = oneComment.getSub(); - boolean flag = false; - if (CollectionUtil.isNotEmpty(sub)) { - for (CommentListResponse.SubComment subComment : sub) { - //如果没有自己的评论,需要评论 - final String subUserName = subComment.getUserName(); - if (StringUtils.equals(subUserName, selfUserName)) { - flag = true; - } - } - } - if (CollectionUtil.isEmpty(sub) || !flag) { - //需要评论 - int start = -1; - int end = selfReply.length; - int temp_count = (int) (Math.floor(Math.random() * (start - end + 1)) + end); - CommentResponse reply = csdnCommentService.dealComment(articleId, selfReply[temp_count], commentId); - log.info(reply.toString()); - } - //三连此评论人 - CsdnUserInfo csdnUserInfo=csdnUserInfoService.getUserByUserName(userName); - if (Objects.isNull(csdnUserInfo)) { - //新增用户 - csdnUserInfo = new CsdnUserInfo(); - csdnUserInfo.setUserName(userName); - csdnUserInfo.setNickName(nickName); - csdnUserInfo.setLikeStatus(0); - csdnUserInfo.setCollectStatus(0); - csdnUserInfo.setCommentStatus(0); - csdnUserInfo.setUserWeight(7); - csdnUserInfo.setUserHomeUrl("https://blog.csdn.net/" + userName); - csdnUserInfoService.save(csdnUserInfo); - } - csdnService.singleArticle(csdnUserInfo); - } - } - } - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - } - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java deleted file mode 100644 index 57d57273deeb9817d7790308a9756aa9734e7ee3..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import cn.hutool.http.HttpResponse; -import cn.hutool.http.HttpUtil; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; -import com.kwan.springbootkwan.entity.resp.CollectInfoQuery; -import com.kwan.springbootkwan.entity.resp.CollectResponse; -import com.kwan.springbootkwan.entity.resp.IsCollectResponse; -import com.kwan.springbootkwan.enums.CollectStatus; -import com.kwan.springbootkwan.service.CsdnCollectService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Service -public class CsdnCollectServiceImpl implements CsdnCollectService { - - @Value("${csdn.cookie}") - private String csdnCookie; - @Value("${csdn.self_folder_id}") - private Integer selfFolderId; - @Value("${csdn.self_user_name}") - private String selfUserName; - @Value("${csdn.url.is_collect_url}") - private String isCollectUrl; - @Value("${csdn.url.add_collect_url}") - private String addCollectUrl; - - @Override - public Boolean isCollect(String articleId, CsdnUserInfo csdnUserInfo) { - HttpResponse response = HttpUtil.createGet(isCollectUrl) - .header("Cookie", csdnCookie) - .form("articleId", articleId) - .execute(); - final String body = response.body(); - ObjectMapper objectMapper = new ObjectMapper(); - try { - final int code = objectMapper.readValue(body, IsCollectResponse.class).code; - final IsCollectResponse.CollectDataDetail data = objectMapper.readValue(body, IsCollectResponse.class).getData(); - if (code == 200) { - final boolean status = data.status; - if (status) { - log.info("文章{}已经收藏过", articleId); - csdnUserInfo.setCollectStatus(CollectStatus.HAVE_ALREADY_COLLECT.getCode()); - } else { - log.info("文章{}未收藏", articleId); - csdnUserInfo.setCollectStatus(CollectStatus.UN_PROCESSED.getCode()); - } - return status; - } - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - return true; - } - - @Override - public Boolean collect(BusinessInfoResponse.ArticleData.Article article, CsdnUserInfo csdnUserInfo, CsdnTripletDayInfo csdnTripletDayInfo) { - final String userName = csdnUserInfo.getUserName(); - final Integer collectStatus = csdnUserInfo.getCollectStatus(); - if (CollectStatus.HAVE_ALREADY_COLLECT.getCode().equals(collectStatus) || CollectStatus.COLLECT_IS_FULL.getCode().equals(collectStatus)) { - return true; - } - final String urlInfo = article.getUrl(); - String articleId = urlInfo.substring(urlInfo.lastIndexOf("/") + 1); - CollectResponse collectResponse = null; - try { - CollectInfoQuery collectInfoQuery = new CollectInfoQuery(); - collectInfoQuery.setSourceId(Integer.valueOf(articleId)); - collectInfoQuery.setFromType("PC"); - collectInfoQuery.setAuthor(userName); - collectInfoQuery.setDescription(article.getDescription()); - collectInfoQuery.setSource("blog"); - List list = new ArrayList<>(); - list.add(selfFolderId); - collectInfoQuery.setFolderIdList(list); - collectInfoQuery.setTitle(article.getTitle()); - collectInfoQuery.setUrl(article.getUrl()); - collectInfoQuery.setUsername(selfUserName); - ObjectMapper objectMapper = new ObjectMapper(); - String jsonCollectInfo = objectMapper.writeValueAsString(collectInfoQuery); - HttpResponse response = HttpUtil.createPost(addCollectUrl) - .header("Cookie", csdnCookie) - .header("Content-Type", "application/json") - .body(jsonCollectInfo) - .execute(); - final String body = response.body(); - collectResponse = objectMapper.readValue(body, CollectResponse.class); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - final int code = collectResponse.code; - if (code == 200) { - log.info("文章{}收藏成功", articleId); - csdnUserInfo.setCollectStatus(CollectStatus.COLLECT_SUCCESSFUL.getCode()); - csdnTripletDayInfo.setCollectNum(csdnTripletDayInfo.getCollectNum() + 1); - } else if (code == 400000101) { - log.info("收藏文章{}参数缺失", articleId); - csdnUserInfo.setCollectStatus(CollectStatus.MISSING_PARAMETER.getCode()); - } else if (code == 400) { - log.info("今日收藏次数已达上限!"); - csdnUserInfo.setCollectStatus(CollectStatus.COLLECT_IS_FULL.getCode()); - } else { - log.info("其他收藏错误"); - csdnUserInfo.setCollectStatus(CollectStatus.OTHER_ERRORS.getCode()); - } - return true; - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java deleted file mode 100644 index 051f93c0c3b20e3b6c6d8e4ab09fba108421b324..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.http.HttpResponse; -import cn.hutool.http.HttpUtil; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; -import com.kwan.springbootkwan.entity.resp.CommentListResponse; -import com.kwan.springbootkwan.entity.resp.CommentResponse; -import com.kwan.springbootkwan.enums.CommentStatus; -import com.kwan.springbootkwan.service.CsdnCommentService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Objects; - -@Slf4j -@Service -public class CsdnCommentServiceImpl implements CsdnCommentService { - - @Value("${csdn.cookie}") - private String csdnCookie; - @Value("#{'${csdn.self_comment}'.split(';')}") - private String[] selfComment; - @Value("${csdn.self_user_name}") - private String selfUserName; - @Value("${csdn.url.is_comment_list_url}") - private String commentListUrl; - @Value("${csdn.url.comment_url}") - private String commentUrl; - - - @Override - public Boolean isComment(BusinessInfoResponse.ArticleData.Article article, CsdnUserInfo csdnUserInfo) { - final Integer commentStatus = csdnUserInfo.getCommentStatus(); - if (CommentStatus.COMMENT_IS_FULL.getCode().equals(commentStatus) - || CommentStatus.RESTRICTED_COMMENTS.getCode().equals(commentStatus)) { - return true; - } - final String urlInfo = article.getUrl(); - String articleId = urlInfo.substring(urlInfo.lastIndexOf("/") + 1); - String url = commentListUrl + articleId; - HttpResponse response = HttpUtil.createPost(url) - .header("Cookie", csdnCookie) - .form("page", 1) - .form("size", 200) - .execute(); - final String body = response.body(); - ObjectMapper objectMapper = new ObjectMapper(); - CommentListResponse articleInfo; - try { - articleInfo = objectMapper.readValue(body, CommentListResponse.class); - final CommentListResponse.DataInfo data = articleInfo.getData(); - final List list = data.getList(); - if (CollectionUtil.isNotEmpty(list)) { - for (CommentListResponse.Comment comment : list) { - final CommentListResponse.Info info = comment.getInfo(); - final String userName = info.getUserName(); - if (StringUtils.equals(userName, selfUserName)) { - log.info("文章{}已经评论过", articleId); - csdnUserInfo.setCommentStatus(CommentStatus.HAVE_ALREADY_COMMENT.getCode()); - return true; - } - } - } - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - csdnUserInfo.setCommentStatus(CommentStatus.UN_PROCESSED.getCode()); - return false; - } - - @Override - public Boolean comment(String articleId, CsdnUserInfo csdnUserInfo, CsdnTripletDayInfo csdnTripletDayInfo) { - final Integer commentStatus = csdnUserInfo.getCommentStatus(); - if (CommentStatus.COMMENT_IS_FULL.getCode().equals(commentStatus) - || CommentStatus.RESTRICTED_COMMENTS.getCode().equals(commentStatus)) { - return true; - } - //评论 - int start = -1; - int end = selfComment.length; - int temp_count = (int) (Math.floor(Math.random() * (start - end + 1)) + end); - CommentResponse comment = this.dealComment(articleId, selfComment[temp_count], null); - final int code = comment.code; - final String message = comment.getMessage(); - if (code == 200) { - log.info("文章{}评论成功", articleId); - csdnUserInfo.setCommentStatus(CommentStatus.COMMENT_SUCCESSFUL.getCode()); - csdnTripletDayInfo.setCommentNum(csdnTripletDayInfo.getCommentNum() + 1); - } else if (code == 400 && StringUtils.equals(message, "您已达到当日发送上限,请明天尝试!")) { - log.info(message); - csdnUserInfo.setCommentStatus(CommentStatus.COMMENT_IS_FULL.getCode()); - } else if (code == 400 && message.contains("因存在恶意评论嫌疑,您的账号已被禁言")) { - log.info("因存在恶意评论嫌疑,您的账号已被禁言"); - csdnUserInfo.setCommentStatus(CommentStatus.RESTRICTED_COMMENTS.getCode()); - } else if (code == 400 && StringUtils.equals(message, "您评论太快了,请休息一下!")) { - log.info("您评论太快了,请休息一下!"); - csdnUserInfo.setCommentStatus(CommentStatus.COMMENT_TOO_FAST.getCode()); - } else { - log.info("其他错误"); - csdnUserInfo.setCommentStatus(CommentStatus.OTHER_ERRORS.getCode()); - } - return true; - } - - /** - * 评论文章 - * - * @param articleId - * @return - */ - @Override - public CommentResponse dealComment(String articleId, String commentInfo, Integer commentId) { - HttpResponse response; - if (Objects.nonNull(commentId)) { - response = HttpUtil.createPost(commentUrl) - .header("Cookie", csdnCookie) - .form("articleId", articleId) - .form("content", commentInfo) - .form("commentId", commentId) - .execute(); - } else { - response = HttpUtil.createPost(commentUrl) - .header("Cookie", csdnCookie) - .form("articleId", articleId) - .form("content", commentInfo) - .execute(); - } - - final String body = response.body(); - log.info(body); - ObjectMapper objectMapper = new ObjectMapper(); - CommentResponse commentResponse = null; - try { - commentResponse = objectMapper.readValue(body, CommentResponse.class); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - return commentResponse; - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnLikeServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnLikeServiceImpl.java deleted file mode 100644 index 15c83ddd8dc2582710ecdcf46a99c953813cd958..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnLikeServiceImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import cn.hutool.http.HttpResponse; -import cn.hutool.http.HttpUtil; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.resp.LikeResponse; -import com.kwan.springbootkwan.enums.LikeStatus; -import com.kwan.springbootkwan.service.CsdnLikeService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - - -@Slf4j -@Service -public class CsdnLikeServiceImpl implements CsdnLikeService { - @Value("${csdn.cookie}") - private String csdnCookie; - @Value("${csdn.url.like_url}") - private String url; - - @Override - public Boolean isLike(String articleId, CsdnUserInfo csdnUserInfo) { - final String userName = csdnUserInfo.getUserName(); - final Integer likeStatus = csdnUserInfo.getLikeStatus(); - if (LikeStatus.LIKE_IS_FULL.getCode().equals(likeStatus)) { - return true; - } - String url = "https://blog.csdn.net/" + userName + "/article/details/" + articleId; - HttpResponse response = HttpUtil.createGet(url) - .header("Cookie", csdnCookie) - .form("articleId", articleId) - .execute(); - final String body = response.body(); - if (body.contains("isLikeStatus = true")) { - log.info("文章{}已经点过赞", articleId); - csdnUserInfo.setLikeStatus(LikeStatus.HAVE_ALREADY_LIKED.getCode()); - return true; - } else { - log.info("文章{}未点过赞", articleId); - csdnUserInfo.setLikeStatus(LikeStatus.UN_PROCESSED.getCode()); - return false; - } - } - - @Override - public Boolean like(String articleId, CsdnUserInfo csdnUserInfo, CsdnTripletDayInfo csdnTripletDayInfo) { - final Integer likeStatus = csdnUserInfo.getLikeStatus(); - if (LikeStatus.HAVE_ALREADY_LIKED.getCode().equals(likeStatus) || LikeStatus.LIKE_IS_FULL.getCode().equals(likeStatus)) { - return true; - } - HttpResponse response = HttpUtil.createPost(url) - .header("Cookie", csdnCookie) - .form("articleId", articleId) - .execute(); - final String body = response.body(); - ObjectMapper objectMapper = new ObjectMapper(); - try { - final int code = objectMapper.readValue(body, LikeResponse.class).code; - final LikeResponse.LikeDataDetail data = objectMapper.readValue(body, LikeResponse.class).getData(); - if (code == 200) { - final boolean status = data.status; - if (status) { - log.info("文章{}点赞成功", articleId); - csdnUserInfo.setLikeStatus(LikeStatus.LIKE_SUCCESSFUL.getCode()); - csdnTripletDayInfo.setLikeNum(csdnTripletDayInfo.getLikeNum() + 1); - } else { - log.info("文章{}点赞取消", articleId); - csdnUserInfo.setLikeStatus(LikeStatus.CANCEL_LIKES.getCode()); - } - return status; - } else if (code == 400) { - log.info("今日点赞次数已达上限!"); - csdnUserInfo.setLikeStatus(LikeStatus.LIKE_IS_FULL.getCode()); - } - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - return true; - } -} diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java deleted file mode 100644 index 5a737964899eb9f3e3724866b0b09fb651687522..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import cn.hutool.core.collection.CollectionUtil; -import com.kwan.springbootkwan.entity.CsdnArticleInfo; -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; -import com.kwan.springbootkwan.enums.CommentStatus; -import com.kwan.springbootkwan.service.CsdnArticleInfoService; -import com.kwan.springbootkwan.service.CsdnCollectService; -import com.kwan.springbootkwan.service.CsdnCommentService; -import com.kwan.springbootkwan.service.CsdnLikeService; -import com.kwan.springbootkwan.service.CsdnService; -import com.kwan.springbootkwan.service.CsdnTripletDayInfoService; -import com.kwan.springbootkwan.service.CsdnUserInfoService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; -import java.util.Objects; - - -@Slf4j -@Service -public class CsdnServiceImpl implements CsdnService { - - @Value("${csdn.num_of_articles_per_person}") - private Integer numOfArticlesPerPerson; - @Autowired - private CsdnLikeService csdnLikeService; - @Autowired - private CsdnUserInfoService csdnUserInfoService; - @Autowired - private CsdnArticleInfoService csdnArticleInfoService; - @Autowired - private CsdnCollectService csdnCollectService; - @Autowired - private CsdnCommentService csdnCommentService; - @Autowired - private CsdnTripletDayInfoService csdnTripletDayInfoService; - - @Override - public void singleArticle(CsdnUserInfo csdnUserInfo) { - final String username = csdnUserInfo.getUserName(); - List list = csdnArticleInfoService.getArticles(username); - if (CollectionUtil.isNotEmpty(list)) { - final int size = list.size(); - numOfArticlesPerPerson = size < numOfArticlesPerPerson ? size : numOfArticlesPerPerson; - for (int i = 0; i < numOfArticlesPerPerson; i++) { - final BusinessInfoResponse.ArticleData.Article article = list.get(i); - final String type = article.getType(); - if (!StringUtils.equals("blog", type)) { - csdnUserInfo.setArticleType(type); - csdnUserInfo.setUpdateTime(new Date()); - csdnUserInfoService.updateById(csdnUserInfo); - continue; - } - //先去查询文章,没有查到的话就插入文章 - final String articleUrl = article.getUrl(); - String articleIdFormUrl = articleUrl.substring(articleUrl.lastIndexOf("/") + 1); - final Object articleId = article.getArticleId(); - if (Objects.isNull(articleId)) { - article.setArticleId(articleIdFormUrl); - } - CsdnArticleInfo csdnArticleInfo = this.csdnArticleInfoService.getArticleByArticleId(article.getArticleId().toString()); - if (Objects.isNull(csdnArticleInfo)) { - csdnArticleInfo = new CsdnArticleInfo(); - csdnArticleInfo.setArticleId(article.getArticleId().toString()); - csdnArticleInfo.setArticleUrl(articleUrl); - csdnArticleInfo.setArticleTitle(article.getTitle()); - csdnArticleInfo.setArticleDescription(article.getDescription()); - csdnArticleInfo.setUserName(username); - csdnArticleInfo.setNickName(csdnUserInfo.getNickName()); - this.csdnArticleInfoService.saveArticle(csdnArticleInfo); - } - this.tripletByArticle(csdnUserInfo, article, csdnArticleInfo); - } - } - } - - - /** - * 根据文章三连 - * - * @param csdnUserInfo - * @param article - */ - @Override - public void tripletByArticle(CsdnUserInfo csdnUserInfo, BusinessInfoResponse.ArticleData.Article article, CsdnArticleInfo csdnArticleInfo) { - //获取每日三连总信息 - final CsdnTripletDayInfo csdnTripletDayInfo = csdnTripletDayInfoService.todayInfo(); - final String urlInfo = article.getUrl(); - String articleId = urlInfo.substring(urlInfo.lastIndexOf("/") + 1); - //点赞 - final Boolean isLike = csdnLikeService.isLike(articleId, csdnUserInfo); - if (!isLike) { - csdnLikeService.like(articleId, csdnUserInfo, csdnTripletDayInfo); - } - final Integer commentNum = csdnTripletDayInfo.getCommentNum(); - if (commentNum < 49) { - //评论 - final Boolean comment = csdnCommentService.isComment(article, csdnUserInfo); - if (!comment) { - csdnCommentService.comment(articleId, csdnUserInfo, csdnTripletDayInfo); - } - } else { - csdnUserInfo.setCommentStatus(CommentStatus.COMMENT_NUM_49.getCode()); - } - //收藏 - final Boolean collect = csdnCollectService.isCollect(articleId, csdnUserInfo); - if (!collect) { - csdnCollectService.collect(article, csdnUserInfo, csdnTripletDayInfo); - } - - csdnTripletDayInfo.setUpdateTime(new Date()); - csdnTripletDayInfoService.updateById(csdnTripletDayInfo); - - csdnUserInfo.setUpdateTime(new Date()); - csdnUserInfoService.updateById(csdnUserInfo); - - csdnArticleInfo.setUpdateTime(new Date()); - csdnArticleInfo.setLikeStatus(csdnUserInfo.getLikeStatus()); - csdnArticleInfo.setCollectStatus(csdnUserInfo.getCollectStatus()); - csdnArticleInfo.setCommentStatus(csdnUserInfo.getCommentStatus()); - csdnArticleInfoService.updateById(csdnArticleInfo); - } - - @Override - public void allTriplet() { - final List allUser = csdnUserInfoService.getAllUser(); - if (CollectionUtil.isNotEmpty(allUser)) { - for (CsdnUserInfo csdnUserInfo : allUser) { - singleArticle(csdnUserInfo); - } - } - log.info("全部三连完成"); - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnTripletDayInfoServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnTripletDayInfoServiceImpl.java deleted file mode 100644 index b9b9379fc1294e58876bef2ef2f71aa2970d8a89..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnTripletDayInfoServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.kwan.springbootkwan.entity.CsdnTripletDayInfo; -import com.kwan.springbootkwan.mapper.CsdnTripletDayInfoMapper; -import com.kwan.springbootkwan.service.CsdnTripletDayInfoService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.util.Objects; - -/** - * 每日三连监控(CsdnTripletDayInfo)表服务实现类 - * - * @author makejava - * @since 2023-10-26 20:55:31 - */ -@Slf4j -@Service("csdnTripletDayInfoService") -public class CsdnTripletDayInfoServiceImpl extends ServiceImpl implements CsdnTripletDayInfoService { - @Override - public CsdnTripletDayInfo todayInfo() { - Date currentDate = new Date(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); - String formattedDate = sdf.format(currentDate); - log.info("当前日期是:{}", formattedDate); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("is_delete", 0); - wrapper.eq("triplet_date", formattedDate); - final CsdnTripletDayInfo one = this.getOne(wrapper); - if (Objects.isNull(one)) { - CsdnTripletDayInfo csdnTripletDayInfo = new CsdnTripletDayInfo(); - csdnTripletDayInfo.setTripletDate(new Date()); - csdnTripletDayInfo.setLikeNum(0); - csdnTripletDayInfo.setCollectNum(0); - csdnTripletDayInfo.setCommentNum(0); - csdnTripletDayInfo.setUpdateTime(new Date()); - this.save(csdnTripletDayInfo); - } - return one; - } -} - diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java deleted file mode 100644 index 641b52f2f5600e27856b8ccc57ba6543fa016aa0..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import cn.hutool.core.collection.CollectionUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.kwan.springbootkwan.constant.CsdnConstant; -import com.kwan.springbootkwan.entity.CsdnArticleInfo; -import com.kwan.springbootkwan.entity.CsdnUserInfo; -import com.kwan.springbootkwan.entity.query.CsdnUserInfoQuery; -import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; -import com.kwan.springbootkwan.enums.CollectStatus; -import com.kwan.springbootkwan.enums.CommentStatus; -import com.kwan.springbootkwan.enums.LikeStatus; -import com.kwan.springbootkwan.mapper.CsdnUserInfoMapper; -import com.kwan.springbootkwan.service.CsdnArticleInfoService; -import com.kwan.springbootkwan.service.CsdnCollectService; -import com.kwan.springbootkwan.service.CsdnUserInfoService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Objects; - -@Service("csdnUserInfoService") -public class CsdnUserInfoServiceImpl extends ServiceImpl implements CsdnUserInfoService { - - @Autowired - private CsdnCollectService csdnCollectService; - @Autowired - private CsdnArticleInfoService csdnArticleInfoService; - - @Override - public CsdnUserInfo getUserByUserName(String username) { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("is_delete", 0); - wrapper.eq("user_name", username) - .last("limit 1"); - return this.getOne(wrapper); - } - - @Override - public List getAllUser() { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("is_delete", 0); - wrapper.orderByAsc("rand()"); - return this.list(wrapper); - } - - @Override - public void resetAllCurrentStatus() { - final List allUser = this.getAllUser(); - if (CollectionUtil.isNotEmpty(allUser)) { - for (CsdnUserInfo csdnUserInfo : allUser) { - this.resetCsdnUserInfo(csdnUserInfo); - } - } - } - - @Override - public void resetCsdnUserInfo(CsdnUserInfo csdnUserInfo) { - final Integer commentStatus = csdnUserInfo.getCommentStatus(); - final String userName = csdnUserInfo.getUserName(); - final String articleType = csdnUserInfo.getArticleType(); - final List articles = csdnArticleInfoService.getArticles(userName); - if (CollectionUtil.isNotEmpty(articles)) { - final BusinessInfoResponse.ArticleData.Article article = articles.get(0); - final String type = article.getType(); - if (StringUtils.equals(type, CsdnConstant.ARTICLE_TYPE)) { - final String articleUrl = article.getUrl(); - String articleId = articleUrl.substring(articleUrl.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); - } - } else { - csdnUserInfo.setLikeStatus(LikeStatus.UN_PROCESSED.getCode()); - csdnUserInfo.setCollectStatus(CollectStatus.UN_PROCESSED.getCode()); - csdnUserInfo.setCommentStatus(CommentStatus.UN_PROCESSED.getCode()); - csdnUserInfo.setArticleType(type); - this.updateById(csdnUserInfo); - } - } - } - - @Override - public void add(CsdnUserInfoQuery addInfo) { - final String userName = addInfo.getUserName(); - final Integer addType = addInfo.getAddType(); - if (StringUtils.isNotEmpty(userName)) { - //批量添加 - if (addType == 1) { - final String[] split = userName.split("\n"); - for (String str : split) { - str = str.trim(); - if (StringUtils.isNotEmpty(str)) { - CsdnUserInfo csdnUserInfo = this.getUserByUserName(str); - if (csdnUserInfo == null) { - csdnUserInfo = new CsdnUserInfo(); - BeanUtils.copyProperties(addInfo, csdnUserInfo); - csdnUserInfo.setUserName(str); - csdnUserInfo.setUserHomeUrl("https://blog.csdn.net/" + str); - this.save(csdnUserInfo); - } - addInfo.setNickName(csdnUserInfo.getNickName()); - } - } - } else { - CsdnUserInfo csdnUserInfo = this.getUserByUserName(userName); - if (csdnUserInfo == null) { - csdnUserInfo = new CsdnUserInfo(); - BeanUtils.copyProperties(addInfo, csdnUserInfo); - csdnUserInfo.setUserHomeUrl("https://blog.csdn.net/" + userName); - this.save(csdnUserInfo); - } - addInfo.setNickName(csdnUserInfo.getNickName()); - } - } - } - - @Override - public void add10Blog(String username) { - final CsdnUserInfo csdnUserInfo = this.getUserByUserName(username); - final List blogs = csdnArticleInfoService.getBlogs(username); - for (BusinessInfoResponse.ArticleData.Article article : blogs) { - CsdnArticleInfo csdnArticleInfo = this.csdnArticleInfoService.getArticleByArticleId(article.getArticleId().toString()); - if (Objects.isNull(csdnArticleInfo)) { - csdnArticleInfo = new CsdnArticleInfo(); - csdnArticleInfo.setArticleId(article.getArticleId().toString()); - csdnArticleInfo.setArticleUrl(article.getUrl()); - csdnArticleInfo.setArticleTitle(article.getTitle()); - csdnArticleInfo.setArticleDescription(article.getDescription()); - csdnArticleInfo.setUserName(username); - csdnArticleInfo.setNickName(csdnUserInfo.getNickName()); - this.csdnArticleInfoService.saveArticle(csdnArticleInfo); - } - } - } - - @Override - public void resetUserDayStatus() { - final List allUser = this.getAllUser(); - if (CollectionUtil.isNotEmpty(allUser)) { - for (CsdnUserInfo csdnUserInfo : allUser) { - final String userName = csdnUserInfo.getUserName(); - final List articles = csdnArticleInfoService.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); - } - } - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/InterviewQuestionServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/InterviewQuestionServiceImpl.java deleted file mode 100644 index b3152a24db4d941ad4739f7ebc370928c8097081..0000000000000000000000000000000000000000 --- a/src/main/java/com/kwan/springbootkwan/service/impl/InterviewQuestionServiceImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.kwan.springbootkwan.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.kwan.springbootkwan.entity.DictionaryManagement; -import com.kwan.springbootkwan.entity.InterviewQuestion; -import com.kwan.springbootkwan.entity.dto.InterviewQuestionTypeDTO; -import com.kwan.springbootkwan.mapper.InterviewQuestionMapper; -import com.kwan.springbootkwan.service.DictionaryManagementService; -import com.kwan.springbootkwan.service.InterviewQuestionService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 面试题(InterviewQuestion)表服务实现类 - * - * @author makejava - * @since 2023-09-08 16:31:53 - */ -@Slf4j -@Service("interviewQuestionService") -public class InterviewQuestionServiceImpl extends ServiceImpl implements InterviewQuestionService { - - @Resource - private InterviewQuestionMapper interviewQuestionMapper; - @Resource - private DictionaryManagementService dictionaryManagementService; - - @Override - public boolean uploadFile(String path) { - log.info("uploadFile() called with: path= {}", path); - // 定义文件路径 - Path filePath = Paths.get(path); - try { - // 读取文件的所有行到List对象 - List lines = Files.readAllLines(filePath); - // 遍历List对象并输出每一行 - for (String line : lines) { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("question", line);// 按照 age 字段降序排列 - final InterviewQuestion one = this.getOne(wrapper); - if (one == null) { - log.info("uploadFile() called with: question= {}", line); - InterviewQuestion interviewQuestion = new InterviewQuestion(); - interviewQuestion.setQuestion(line); - interviewQuestion.setResponse(""); - this.save(interviewQuestion); - } - } - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } - - @Override - public List questionType() { - final List interviewQuestionTypeDTOS = this.allQuestionType(); - //获取种类,并按数量排序 - LinkedList types = interviewQuestionMapper.questionType(); - types.addFirst(new InterviewQuestionTypeDTO(0, "全部", 0)); - for (InterviewQuestionTypeDTO interviewQuestionTypeDTO : types) { - //数据库存的是问题类型的编码 - final InterviewQuestionTypeDTO item = interviewQuestionTypeDTOS.stream().filter(x -> x.getQuestionType().equals(interviewQuestionTypeDTO.getQuestionType())).findFirst().get(); - interviewQuestionTypeDTO.setName(item.getName()); - } - return types; - } - - @Override - public List allQuestionType() { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("dict_type", 1); - wrapper.eq("is_delete", 0); - final List list = dictionaryManagementService.list(wrapper); - return list.stream() - .map(item -> { - InterviewQuestionTypeDTO interviewQuestionTypeDTO = new InterviewQuestionTypeDTO(); - interviewQuestionTypeDTO.setQuestionType(item.getCode()); - interviewQuestionTypeDTO.setName(item.getName()); - return interviewQuestionTypeDTO; - }).collect(Collectors.toList()); - } -} \ No newline at end of file diff --git a/src/main/resources/mapper/AlgorithmicProblemMapper.xml b/src/main/resources/mapper/AlgorithmicProblemMapper.xml deleted file mode 100644 index 8aa9880b94a274b5daab7ebfc02f595c2fb8c4ef..0000000000000000000000000000000000000000 --- a/src/main/resources/mapper/AlgorithmicProblemMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/src/main/resources/mapper/AphorismPoetryMapper.xml b/src/main/resources/mapper/AphorismPoetryMapper.xml deleted file mode 100644 index 70f7fbc812d408e938121170705b688c18dff315..0000000000000000000000000000000000000000 --- a/src/main/resources/mapper/AphorismPoetryMapper.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/main/resources/mapper/InterviewQuestionMapper.xml b/src/main/resources/mapper/InterviewQuestionMapper.xml deleted file mode 100644 index fac26604a8b04a4901feaea53eec2924552b3b47..0000000000000000000000000000000000000000 --- a/src/main/resources/mapper/InterviewQuestionMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - -