mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package com.panzhihua.applets.api;
 
import javax.annotation.Resource;
 
import com.panzhihua.common.model.vos.community.integral.IntegralTradeVO;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.web.bind.annotation.*;
 
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityRankVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityTradeVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserRuleVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserVO;
import com.panzhihua.common.service.community.CommunityService;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
 
@Slf4j
@RestController
@RequestMapping("/integral/")
@Api(tags = {"用户积分模块"})
public class ComActIntegralUserApi extends BaseController {
 
    @Resource
    private CommunityService communityService;
 
    @ApiOperation(value = "查询积分说明")
    @GetMapping("/explain")
    public R getIntegralExplain() {
        return communityService.getIntegralExplainApplets();
    }
 
    @ApiOperation(value = "查询社区领取积分列表", response = ComActIntegralUserRuleVO.class)
    @PostMapping("/receive")
    public R getIntegralReceive() {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if (userInfoVO == null) {
            return R.fail("请先登录");
        }
        return communityService.getIntegralReceiveApplets(userInfoVO.getUserId(), userInfoVO.getCommunityId());
    }
 
    @ApiOperation(value = "积分统计", response = ComActIntegralUserVO.class)
    @ApiImplicitParam(name = "communityId", value = "社区id")
    @GetMapping("/user/statistics")
    public R getIntegralUserList(@RequestParam(value = "communityId", required = false) Long communityId) {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if (userInfoVO == null) {
            return R.fail("请先登录");
        }
        return communityService.getIntegralUserListApplets(userInfoVO.getUserId(), communityId);
    }
 
    @ApiOperation(value = "查询我的积分余额", response = ComActIntegralUserVO.class)
    @ApiImplicitParam(name = "communityId", value = "社区id", required = true)
    @GetMapping("/user/balance")
    public R getUserIntegralBalance(@RequestParam("communityId") Long communityId) {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if (userInfoVO == null) {
            return R.fail("请先登录");
        }
        return communityService.getUserIntegralBalance(userInfoVO.getUserId(), communityId);
    }
 
    @ApiOperation(value = "获取积分详情", response = IntegralTradeVO.class)
    @ApiImplicitParam(name = "id", value = "积分明细id", required = true)
    @GetMapping("/user/detail")
    public R getUserIntegralDetail(@RequestParam("id") Long id) {
        return communityService.getUserIntegralDetail(id);
    }
 
    @ApiOperation(value = "查询社区积分排行榜", response = ComActIntegralCommunityRankVO.class)
    @PostMapping("/community/rank")
    public R getIntegralCommunityRank(@RequestBody ComActIntegralCommunityRankDTO communityRankDTO) {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if (userInfoVO == null) {
            return R.fail("请先登录");
        }
        return communityService.getIntegralCommunityRankApplets(communityRankDTO);
    }
 
    @ApiOperation(value = "查询用户积分明细", response = ComActIntegralCommunityTradeVO.class)
    @PostMapping("/community/trade")
    public R getIntegralCommunityTrade(@RequestBody ComActIntegralCommunityRankDTO communityTradeDTO) {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if (userInfoVO == null) {
            return R.fail("请先登录");
        }
        communityTradeDTO.setUserId(userInfoVO.getUserId());
        return communityService.getIntegralCommunityTradeApplets(communityTradeDTO);
    }
 
}