xiaoyong931011
2022-12-15 ec2c41a6dfbcd99b90d8df2b71f364f7d4fae96c
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
package cc.mrbird.febs.dapp.controller;
 
import cc.mrbird.febs.common.contants.AppContants;
import cc.mrbird.febs.common.entity.FebsConstant;
import cc.mrbird.febs.common.utils.FebsUtil;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.dapp.entity.DappMemberEntity;
import cc.mrbird.febs.dapp.entity.DappSystemProfit;
import cc.mrbird.febs.dapp.entity.DataDictionaryCustom;
import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
import cc.mrbird.febs.dapp.mapper.DappSystemProfitDao;
import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.dapp.service.DappMemberService;
import cc.mrbird.febs.dapp.vo.AdminSystemFeeVo;
import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
 
import java.math.BigDecimal;
 
/**
 * @author
 * @date 2022-03-21
 **/
@Controller("dappView")
@RequestMapping(FebsConstant.VIEW_PREFIX + "dappView")
@RequiredArgsConstructor
public class ViewController {
 
    private final RedisUtils redisUtils;
    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
    private final DappSystemProfitDao dappSystemProfitDao;
 
    @GetMapping(value = "admin")
    @RequiresPermissions("admin:view")
    public String user() {
        return FebsUtil.view("dapp/user");
    }
 
    @GetMapping(value = "admin/add")
    @RequiresPermissions("admin:add")
    public String addUser() {
        return FebsUtil.view("dapp/userAdd");
    }
 
    @GetMapping(value = "admin/update")
    @RequiresPermissions("admin:update")
    public String updateUser() {
        return FebsUtil.view("dapp/userUpdate");
    }
 
    @GetMapping(value = "admin/simulate")
    @RequiresPermissions("admin:simulate")
    public String simulate() {
        return FebsUtil.view("dapp/simulate-data");
    }
 
    @GetMapping(value = "admin/simulateResult/{batch}")
    public String simulateResult(@PathVariable("batch") String batch, Model model) {
        String url = "https://birdworld.vip/index.html?isDev=true&batchNo=" + batch;
        model.addAttribute("url", url);
        return FebsUtil.view("dapp/simulate-result");
    }
 
 
    @GetMapping("member")
    @RequiresPermissions("member:view")
    public String member() {
        return FebsUtil.view("dapp/member");
    }
 
    @GetMapping("memberWithdraw")
    @RequiresPermissions("withdraw:view")
    public String memberWithdraw() {
        return FebsUtil.view("dapp/member-withdraw");
    }
 
    @GetMapping("walletCoin")
    @RequiresPermissions("walletCoin:view")
    public String walletCoin() {
        return FebsUtil.view("dapp/member-wallet-coin");
    }
 
    @GetMapping("walletMine")
    @RequiresPermissions("walletMine:view")
    public String walletMine() {
        return FebsUtil.view("dapp/member-wallet-mine");
    }
 
    @GetMapping("moneyChange")
    @RequiresPermissions("moneyChange:view")
    public String moneyChange() {
        return FebsUtil.view("dapp/money-change-flow");
    }
 
    @GetMapping("transfer")
    @RequiresPermissions("transfer:view")
    public String transfer() {
        return FebsUtil.view("dapp/member-transter");
    }
 
    @GetMapping(value = "ratio")
    @RequiresPermissions("ratio:view")
    public String returnRatio() {
        return FebsUtil.view("dapp/return-ratio");
    }
 
 
    @GetMapping(value = "agentReturn")
    @RequiresPermissions("agentReturn:view")
    public String agentReturn() {
        return FebsUtil.view("dapp/agent-return");
    }
 
 
    @GetMapping(value = "priceSetting")
    @RequiresPermissions("price:setting:view")
    public String priceSetting(Model model) {
        BigDecimal price = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_ETH_NEW_PRICE);
        model.addAttribute("newestPrice", price);
        return FebsUtil.view("dapp/newest-price-setting");
    }
 
    //费率设置
    @GetMapping(value = "systemFeeSet")
    @RequiresPermissions("fee:setting:view")
    public String systemFeeSet(Model model) {
        AdminSystemFeeVo adminSystemFeeVo = new AdminSystemFeeVo();
        DataDictionaryCustom rebateDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.REBATE_PERCENT.getType(), DataDictionaryEnum.REBATE_PERCENT.getCode());
        if (ObjectUtil.isNotEmpty(rebateDic)) {
            String value = rebateDic.getValue() == null ? "0" : rebateDic.getValue();
            adminSystemFeeVo.setRebatePercent(value);
        }
        DataDictionaryCustom memberFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MEMBER_FEE.getType(), DataDictionaryEnum.MEMBER_FEE.getCode());
        if (ObjectUtil.isNotEmpty(memberFeeDic)) {
            String value = memberFeeDic.getValue() == null ? "0" : memberFeeDic.getValue();
            adminSystemFeeVo.setMemberFee(value);
        }
        DataDictionaryCustom serviceFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WITHDRAW_SERVICE_FEE.getType(), DataDictionaryEnum.WITHDRAW_SERVICE_FEE.getCode());
        if (ObjectUtil.isNotEmpty(serviceFeeDic)) {
            String value = serviceFeeDic.getValue() == null ? "0" : serviceFeeDic.getValue();
            adminSystemFeeVo.setServiceFee(value);
        }
 
        DataDictionaryCustom symbolPrice = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SYMBOL_PRICE.getType(), DataDictionaryEnum.SYMBOL_PRICE.getCode());
        if (ObjectUtil.isNotEmpty(symbolPrice)) {
            String value = symbolPrice.getValue() == null ? "0" : symbolPrice.getValue();
            adminSystemFeeVo.setSymbolPrice(value);
        }
        model.addAttribute("systemFee", adminSystemFeeVo);
        return FebsUtil.view("dapp/system-fee-set");
    }
 
    /**
     * 动能列表
     * @return
     */
    @GetMapping(value = "systemProfit")
    @RequiresPermissions("systemProfit:view")
    public String systemProfit() {
        return FebsUtil.view("dapp/system-profit");
    }
 
 
    public static long systemProfitId;
    /**
     * 动能列表-流水详情
     * @param id
     * @param model
     * @return
     */
    @GetMapping("/systemProfitFlow/{id}")
    @RequiresPermissions("systemProfitFlow:view")
    public String systemProfitFlow(@PathVariable long id, Model model) {
        systemProfitId = id;
        return FebsUtil.view("dapp/system-profit-flow");
    }
 
    public static long teamInfoMemberId;
    /**
     * 用户列表-团队详情
     * @param id
     * @param model
     * @return
     */
    @GetMapping("/teamInfo/{id}")
    @RequiresPermissions("teamInfo:view")
    public String teamInfo(@PathVariable long id, Model model) {
        teamInfoMemberId = id;
        return FebsUtil.view("dapp/member-teamInfo");
    }
}