KKSU
2024-04-01 9471f6e4286ce7e9f2d879951603d14c578d839f
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
package cc.mrbird.febs.dapp.controller;
 
import cc.mrbird.febs.common.annotation.ControllerEndpoint;
import cc.mrbird.febs.common.controller.BaseController;
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.common.enumerates.DataDicEnum;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.dapp.entity.DappCoinPrice;
import cc.mrbird.febs.dapp.entity.PlatformBanner;
import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.dapp.service.DappSystemService;
import cc.mrbird.febs.dapp.service.IAdminBannerService;
import cc.mrbird.febs.dapp.vo.CoinSetVo;
import cc.mrbird.febs.rabbit.producer.ChainProducer;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Map;
 
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/admin/banner")
public class AdminBannerController extends BaseController {
 
    private final IAdminBannerService iAdminBannerService;
    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
    private final RedisUtils redisUtils;
    private final DappSystemService dappSystemService;
    private final ChainProducer chainProducer;
 
    /**
     * 价格---列表
     */
    @GetMapping("coinPrice")
    public FebsResponse coinPrice(DappCoinPrice dappCoinPrice, QueryRequest request) {
        Map<String, Object> data = getDataTable(iAdminBannerService.findCoinPriceInPage(dappCoinPrice, request));
        return new FebsResponse().success().data(data);
    }
 
    /**
     * 价格---新增
     * @return
     */
    @GetMapping("coinPriceAdd/{price}")
    @ControllerEndpoint(operation = "价格---新增", exceptionMessage = "操作失败")
    public FebsResponse coinPriceAdd(@NotNull(message = "{required}") @PathVariable String price) {
        return iAdminBannerService.coinPriceAdd(price);
    }
 
    /**
     * 轮播图---列表
     */
    @GetMapping("platformBanner")
    public FebsResponse platformBanner(PlatformBanner platformBannerEntity, QueryRequest request) {
        Map<String, Object> data = getDataTable(iAdminBannerService.findPlatformBannerInPage(platformBannerEntity, request));
        return new FebsResponse().success().data(data);
    }
 
    /**
     * 轮播图---确认
     * @return
     */
    @PostMapping("platformBannerConfirm")
    @ControllerEndpoint(operation = "轮播图---确认", exceptionMessage = "设置失败")
    public FebsResponse platformBannerConfirm(@Valid PlatformBanner platformBannerEntity) {
        return iAdminBannerService.platformBannerConfirm(platformBannerEntity);
    }
 
    /**
     * 轮播图---删除
     * @return
     */
    @GetMapping("platformBannerDelete/{id}")
    @ControllerEndpoint(operation = "轮播图---删除", exceptionMessage = "删除失败")
    public FebsResponse platformBannerDelete(@NotNull(message = "{required}") @PathVariable Long id) {
        return iAdminBannerService.platformBannerDelete(id);
    }
 
    /**
     * 轮播图---新增
     */
    @PostMapping("platformBannerAdds")
    @ControllerEndpoint(operation = "轮播图---新增", exceptionMessage = "新增失败")
    public FebsResponse platformBannerAdds(@Valid PlatformBanner platformBannerEntity) {
        iAdminBannerService.platformBannerAdd(platformBannerEntity);
        return new FebsResponse().success();
    }
 
    @PostMapping(value = "/hdSubmit")
    @ControllerEndpoint(operation = "滑点释放", exceptionMessage = "操作失败")
    public FebsResponse hdSubmit() {
        log.info("滑点奖励");
        BigDecimal usdtAmount = new BigDecimal(
                redisUtils.getString(DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue())
        ).setScale(2,BigDecimal.ROUND_DOWN);
        BigDecimal coinAmount = new BigDecimal(
                redisUtils.getString(DataDicEnum.GFA_HUA_DIAN_WALLET_COIN_AMOUNT.getValue())
        ).setScale(2,BigDecimal.ROUND_DOWN);
        if(BigDecimal.ZERO.compareTo(usdtAmount) > 0){
            return new FebsResponse().fail().message("请设置钱包USDT");
        }
        if(BigDecimal.ZERO.compareTo(coinAmount) > 0){
            return new FebsResponse().fail().message("请设置钱包代币");
        }
        dappSystemService.tradeProfitDistribute(1L);
        return new FebsResponse().success().message("操作成功");
    }
 
    @PostMapping(value = "/cashOutSetting")
    @ControllerEndpoint(operation = "轮播图---新增", exceptionMessage = "新增失败")
    public FebsResponse cashOutSetting(CoinSetVo coinSetVo) {
 
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_BUY_MIN_AMOUNT.getValue(),
                DataDicEnum.GFA_BUY_MIN_AMOUNT.getValue(),
                coinSetVo.getMinAmount()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_BUY_MAX_AMOUNT.getValue(),
                DataDicEnum.GFA_BUY_MAX_AMOUNT.getValue(),
                coinSetVo.getMaxAmount()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_ACHIEVE_RELEASE.getValue(),
                DataDicEnum.GFA_ACHIEVE_RELEASE.getValue(),
                coinSetVo.getAchieveRelease()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_ACHIEVE_OUT.getValue(),
                DataDicEnum.GFA_ACHIEVE_OUT.getValue(),
                coinSetVo.getAchieveOut()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_TUAN_DUI_PERCENT.getValue(),
                DataDicEnum.GFA_TUAN_DUI_PERCENT.getValue(),
                coinSetVo.getTdPercent()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_TUAN_DUI_LEVEL.getValue(),
                DataDicEnum.GFA_TUAN_DUI_LEVEL.getValue(),
                coinSetVo.getTdLevel()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_TUAN_DUI_LEVEL_YI.getValue(),
                DataDicEnum.GFA_TUAN_DUI_LEVEL_YI.getValue(),
                coinSetVo.getTdLevelYi()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_TUAN_DUI_LEVEL_ER.getValue(),
                DataDicEnum.GFA_TUAN_DUI_LEVEL_ER.getValue(),
                coinSetVo.getTdLevelEr()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_TUAN_DUI_LEVEL_SAN.getValue(),
                DataDicEnum.GFA_TUAN_DUI_LEVEL_SAN.getValue(),
                coinSetVo.getTdLevelSan()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_TUAN_DUI_LEVEL_SI.getValue(),
                DataDicEnum.GFA_TUAN_DUI_LEVEL_SI.getValue(),
                coinSetVo.getTdLevelSi()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_TUAN_DUI_LEVEL_WU.getValue(),
                DataDicEnum.GFA_TUAN_DUI_LEVEL_WU.getValue(),
                coinSetVo.getTdLevelWu()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_ZHUAN_ZHANG_KAI_GUAN.getValue(),
                DataDicEnum.GFA_ZHUAN_ZHANG_KAI_GUAN.getValue(),
                coinSetVo.getZzkg()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.SYSTEM_START_FLAG.getValue(),
                DataDicEnum.SYSTEM_START_FLAG.getValue(),
                coinSetVo.getSsf()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue(),
                DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue(),
                coinSetVo.getUsdtAmount()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_HUA_DIAN_WALLET_COIN_AMOUNT.getValue(),
                DataDicEnum.GFA_HUA_DIAN_WALLET_COIN_AMOUNT.getValue(),
                coinSetVo.getCoinAmount()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_HUA_DIAN_SELF.getValue(),
                DataDicEnum.GFA_HUA_DIAN_SELF.getValue(),
                coinSetVo.getHdSelf()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_HUA_DIAN_TEAM.getValue(),
                DataDicEnum.GFA_HUA_DIAN_TEAM.getValue(),
                coinSetVo.getHdTeam()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_HUA_DIAN_WORK.getValue(),
                DataDicEnum.GFA_HUA_DIAN_WORK.getValue(),
                coinSetVo.getHdWork()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_HUA_DIAN_LEVEL.getValue(),
                DataDicEnum.GFA_HUA_DIAN_LEVEL.getValue(),
                coinSetVo.getHdLevel()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.GFA_DAYS.getValue(),
                DataDicEnum.GFA_DAYS.getValue(),
                coinSetVo.getGfaDays()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.MEMBER_ZHIYA_TIME.getValue(),
                DataDicEnum.MEMBER_ZHIYA_TIME.getValue(),
                coinSetVo.getZhiyaTime()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.MEMBER_ZHIYA_AMOUNT.getValue(),
                DataDicEnum.MEMBER_ZHIYA_AMOUNT.getValue(),
                coinSetVo.getZhiyaAmount()
        );
        return new FebsResponse().success();
    }
}