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
package com.panzhihua.applets.api;
 
import javax.annotation.Resource;
 
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 com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.wallet.ComActWalletDetailDTO;
import com.panzhihua.common.model.dtos.community.wallet.PageComActWalletTradeDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.wallet.ComActWalletRankingVO;
import com.panzhihua.common.model.vos.community.wallet.ComActWalletTradeVO;
import com.panzhihua.common.model.vos.community.wallet.ComActWalletVO;
import com.panzhihua.common.service.community.CommunityService;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
 
@RestController
@RequestMapping("/wallet/")
@Api(tags = {"钱包模块"})
public class WalletApi extends BaseController {
 
    @Resource
    private CommunityService communityService;
 
    @ApiOperation(value = "查询我的钱包", response = ComActWalletVO.class)
    @PostMapping("/get/my")
    public R getWallet() {
        ComActWalletDetailDTO walletDetailDTO = new ComActWalletDetailDTO();
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        if (loginUserInfo == null) {
            return R.fail("请先登录");
        }
        walletDetailDTO.setUserId(loginUserInfo.getUserId());
        Long communityId = loginUserInfo.getCommunityId();
        if (null == communityId || 0 == communityId) {
            return R.fail("用户未绑定社区");
        }
        walletDetailDTO.setCommunityId(communityId);
        return communityService.getUserWalletDetail(walletDetailDTO);
    }
 
    @ApiOperation(value = "查询我的收支记录", response = ComActWalletTradeVO.class)
    @PostMapping("/get/trade")
    public R getWalletTrade(@RequestBody PageComActWalletTradeDTO walletTradeDTO) {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        if (loginUserInfo == null) {
            return R.fail("请先登录");
        }
        walletTradeDTO.setUserId(loginUserInfo.getUserId());
        Long communityId = loginUserInfo.getCommunityId();
        if (null == communityId || 0 == communityId) {
            return R.fail("用户未绑定社区");
        }
        walletTradeDTO.setCommunityId(communityId);
        return communityService.getUserWalletTrade(walletTradeDTO);
    }
 
    @ApiOperation(value = "查询收益排行榜", response = ComActWalletRankingVO.class)
    @PostMapping("/get/ranking")
    public R getWalletRanking(@RequestBody PageComActWalletTradeDTO walletTradeDTO) {
        Long communityId = this.getCommunityId();
        if (null == communityId || 0 == communityId) {
            return R.fail("用户未绑定社区");
        }
        walletTradeDTO.setCommunityId(communityId);
        return communityService.getWalletRanking(walletTradeDTO);
    }
}