CsdnController.java 3.0 KB
Newer Older
1 2
package com.kwan.springbootkwan.controller;

3
import com.kwan.springbootkwan.entity.CsdnUserInfo;
4
import com.kwan.springbootkwan.entity.Result;
5
import com.kwan.springbootkwan.service.CsdnAutoReplyService;
6
import com.kwan.springbootkwan.service.CsdnService;
7
import com.kwan.springbootkwan.service.CsdnUserInfoService;
8 9
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
10
import lombok.extern.slf4j.Slf4j;
11
import org.apache.ibatis.annotations.Param;
12 13 14 15 16
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

17
import java.util.Objects;
18

19 20
@Slf4j
@RestController
21
@Api(tags = "csdn三连用户管理")
22 23 24 25
@RequestMapping("/csdn")
public class CsdnController {

    @Autowired
26
    private CsdnService csdnService;
27
    @Autowired
28
    private CsdnAutoReplyService csdnAutoReplyService;
29
    @Autowired
30
    private CsdnUserInfoService csdnUserInfoService;
31

32
    @ApiOperation(value = "单人三连", nickname = "单人三连")
33 34
    @GetMapping("/singleTriplet")
    public Result singleTriplet(@Param("username") String username) {
35
        CsdnUserInfo csdnUserInfo = csdnUserInfoService.getUserByUserName(username);
36
        if (Objects.nonNull(csdnUserInfo)) {
37 38
            csdnService.singleArticle(csdnUserInfo);
        }
39
        return Result.ok("单人三连完成");
40 41
    }

42
    @ApiOperation(value = "多人三连", nickname = "多人三连")
43 44 45
    @GetMapping("/multiTriplet")
    public Result multiTriplet() {
        csdnService.multiTriplet();
46 47
        return Result.ok("多人三连完成");
    }
48

49
    @ApiOperation(value = "自动回复", nickname = "自动回复")
50 51
    @GetMapping("/autoReply")
    public Result autoReply() {
52
        csdnAutoReplyService.commentSelf();
53 54
        return Result.ok("自动回复完成");
    }
55

56 57 58 59 60
    @ApiOperation(value = "重置全员新博客状态", nickname = "重置全员新博客状态")
    @GetMapping("/resetAllCurrentStatus")
    public Result resetAllCurrentStatus() {
        csdnUserInfoService.resetAllCurrentStatus();
        return Result.ok("重置全员新博客状态完成");
61 62
    }

63 64 65
    @ApiOperation(value = "重置指定人员新博客状态", nickname = "重置指定人员新博客状态")
    @GetMapping("/resetCsdnUserInfo")
    public Result resetCsdnUserInfo(@Param("username") String username) {
66
        CsdnUserInfo csdnUserInfo = csdnUserInfoService.getUserByUserName(username);
67 68 69 70 71 72 73
        if (Objects.nonNull(csdnUserInfo)) {
            csdnUserInfoService.resetCsdnUserInfo(csdnUserInfo);
        }
        return Result.ok("重置指定人员新博客状态完成");
    }

    @ApiOperation(value = "重置新一天用户状态", nickname = "重置新一天用户状态")
74 75 76 77 78
    @GetMapping("/resetUserDayStatus")
    public Result resetUserDayStatus() {
        csdnUserInfoService.resetUserDayStatus();
        return Result.ok("重置新一天用户状态完成");
    }
79
}