KKSU
2024-09-10 e17dc6ecf00516037d94332ef2d71ef6c3ec9727
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
package cc.mrbird.febs.mall.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.DataDictionaryEnum;
import cc.mrbird.febs.common.enumerates.ProductEnum;
import cc.mrbird.febs.mall.dto.*;
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.mapper.MallMemberSpeakMapper;
import cc.mrbird.febs.mall.mapper.MallProductNftMapper;
import cc.mrbird.febs.mall.service.ICommonService;
import cc.mrbird.febs.mall.service.IMallNewsInfoService;
import cc.mrbird.febs.mall.vo.AdminMallProductNftVo;
import cc.mrbird.febs.mall.vo.AdminMallProductSellPickVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.management.Query;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
 
/**
 * @author wzy
 * @date 2022-05-13
 **/
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/admin/news")
public class AdminNewsInfoController extends BaseController {
 
    private final IMallNewsInfoService mallNewsInfoService;
    private final MallProductNftMapper mallProductNftMapper;
    private final MallMemberSpeakMapper mallMemberSpeakMapper;
    private final ICommonService commonService;
 
    /**
     * 用户留言
     */
    @GetMapping("getSpeakList")
    public FebsResponse getSpeakList(MallMemberSpeak mallMemberSpeak, QueryRequest request) {
        Map<String, Object> data = getDataTable(mallNewsInfoService.getSpeakList(mallMemberSpeak, request));
        return new FebsResponse().success().data(data);
    }
 
    /**
     * 用户留言
     * @param id
     * @return
     */
    @PostMapping(value = "/speakState/{id}")
    public FebsResponse speakState(@PathVariable Long id) {
        MallMemberSpeak mallMemberSpeak = mallMemberSpeakMapper.selectById(id);
        mallMemberSpeak.setState(ProductEnum.SPEAK_DEAL.getValue());
        mallMemberSpeakMapper.updateById(mallMemberSpeak);
        return new FebsResponse().success();
    }
 
    /**
     * NFT预约产品
     */
    @GetMapping("getProductNFTList")
    public FebsResponse getProductNFTList(MallProductNft mallProductNft, QueryRequest request) {
        Map<String, Object> data = getDataTable(mallNewsInfoService.getProductNFTList(mallProductNft, request));
        return new FebsResponse().success().data(data);
    }
 
    /**
     * NFT预约产品-新增
     */
    @PostMapping("addProductNFT")
    @ControllerEndpoint(operation = "NFT预约产品-新增", exceptionMessage = "操作失败")
    public FebsResponse addProductNFT(@Valid AdminMallProductNftDto adminMallProductNftDto) {
        return mallNewsInfoService.addProductNFT(adminMallProductNftDto);
    }
 
    @PostMapping(value = "/upNFT/{id}")
    public FebsResponse upNFT(@PathVariable Long id) {
        MallProductNft mallProductNft = mallProductNftMapper.selectById(id);
        mallProductNft.setState(ProductEnum.PRODUCT_NFT_OPEN.getValue());
        mallProductNftMapper.updateById(mallProductNft);
        return new FebsResponse().success();
    }
 
    @PostMapping(value = "/unUpNFT/{id}")
    public FebsResponse unUpNFT(@PathVariable Long id) {
        MallProductNft mallProductNft = mallProductNftMapper.selectById(id);
        mallProductNft.setState(ProductEnum.PRODUCT_NFT_CLOSE.getValue());
        mallProductNftMapper.updateById(mallProductNft);
        return new FebsResponse().success();
    }
 
    /**
     * NFT预约产品-删除
     */
    @GetMapping("delNFT/{id}")
    @ControllerEndpoint(operation = " 新闻中心-删除", exceptionMessage = "操作失败")
    public FebsResponse delNFT(@NotNull(message = "{required}") @PathVariable Long id) {
        return mallNewsInfoService.delNFT(id);
    }
 
    /**
     * NFT预约产品-更新
     */
    @PostMapping("nftInfoUpdate")
    @ControllerEndpoint(operation = "NFT预约产品-更新", exceptionMessage = "操作失败")
    public FebsResponse nftInfoUpdate(@Valid MallProductNft mallProductNft) {
        return mallNewsInfoService.nftInfoUpdate(mallProductNft);
    }
 
    /**
     * 用户NFT预约列表
     */
    @GetMapping("getBuyList")
    public FebsResponse getBuyList(MallProductBuy mallProductBuy, QueryRequest request) {
        Map<String, Object> data = getDataTable(mallNewsInfoService.getBuyList(mallProductBuy, request));
        return new FebsResponse().success().data(data);
    }
 
    /**
     * 用户NFT预约子记录列表
     */
    @GetMapping("getBuyRecordList")
    public FebsResponse getBuyRecordList(MallProductBuy mallProductBuy, QueryRequest request) {
        Map<String, Object> data = getDataTable(mallNewsInfoService.getBuyRecordList(mallProductBuy, request));
        return new FebsResponse().success().data(data);
    }
 
    /**
     * 用户NFT提现列表
     */
    @GetMapping("getSellList")
    public FebsResponse getSellList(MallProductSell mallProductSell, QueryRequest request) {
        Map<String, Object> data = getDataTable(mallNewsInfoService.getSellList(mallProductSell, request));
        return new FebsResponse().success().data(data);
    }
 
    /**
     * 用户NFT提现-匹配提现用户列表
     * @return
     */
    @GetMapping(value = "findSellList")
    public FebsResponse findSellList() {
        List<AdminMallProductSellPickVo> categories = mallNewsInfoService.findSellList();
        return new FebsResponse().success().data(categories);
    }
 
    /**
     * 用户NFT提现-手动分配
     */
    @PostMapping("pickSellRecord")
    @ControllerEndpoint(operation = "用户NFT提现-手动分配", exceptionMessage = "操作失败")
    public FebsResponse pickSellRecord(@Valid AdminPickSellRecordDtoDto pickSellRecordDto) {
        return mallNewsInfoService.pickSellRecord(pickSellRecordDto);
    }
 
    /**
     * 用户NFT提现-取消
     */
    @GetMapping("buyRecordCancel/{id}")
    @ControllerEndpoint(operation = " 用户NFT提现-取消", exceptionMessage = "操作失败")
    public FebsResponse buyRecordCancel(@NotNull(message = "{required}") @PathVariable Long id) {
        return mallNewsInfoService.buyRecordCancel(id);
    }
 
    /**
     * 用户NFT提现-确认支付
     */
    @PostMapping("buyRecordPay")
    @ControllerEndpoint(operation = "用户NFT提现-确认支付", exceptionMessage = "操作失败")
    public FebsResponse buyRecordPay(@Valid AdminBuyRecordPayDto buyRecordPayDto) {
        return mallNewsInfoService.buyRecordPay(buyRecordPayDto);
    }
 
    /**
     * 用户NFT提现-确认收款
     */
    @GetMapping("buyRecordConfirm/{id}")
    @ControllerEndpoint(operation = " 用户NFT提现-确认收款", exceptionMessage = "操作失败")
    public FebsResponse buyRecordConfirm(@NotNull(message = "{required}") @PathVariable Long id) {
        return mallNewsInfoService.buyRecordConfirm(id);
    }
 
    /**
     * 基础设置
     * @param gfaBasicSetDto
     * @return
     */
    @PostMapping(value = "/gfaBasicSet")
    public FebsResponse gfaBasicSet(AdminGfaBasicSetDto gfaBasicSetDto) {
        commonService.updateDataDic(
                DataDictionaryEnum.YU_YUE_START_TIME.getType(),
                DataDictionaryEnum.YU_YUE_START_TIME.getCode(),
                gfaBasicSetDto.getStartTime());
        commonService.updateDataDic(
                DataDictionaryEnum.YU_YUE_END_TIME.getType(),
                DataDictionaryEnum.YU_YUE_END_TIME.getCode(),
                gfaBasicSetDto.getEndTime());
        commonService.updateDataDic(
                DataDictionaryEnum.MEMBER_FROZEN_FCM_CNT.getType(),
                DataDictionaryEnum.MEMBER_FROZEN_FCM_CNT.getCode(),
                gfaBasicSetDto.getFrozenFcmCnt());
        commonService.updateDataDic(
                DataDictionaryEnum.OUT_FCM_FEE.getType(),
                DataDictionaryEnum.OUT_FCM_FEE.getCode(),
                gfaBasicSetDto.getOutFcmFee());
        commonService.updateDataDic(
                DataDictionaryEnum.INSURE_END_MINUTE.getType(),
                DataDictionaryEnum.INSURE_END_MINUTE.getCode(),
                gfaBasicSetDto.getMinuteCnt());
//        commonService.updateDataDic(
//                DataDictionaryEnum.FCM_PRICE.getType(),
//                DataDictionaryEnum.FCM_PRICE.getCode(),
//                gfaBasicSetDto.getFcmPrice());
//        commonService.updateDataDic(
//                DataDictionaryEnum.FCM_DESTORY_CNT.getType(),
//                DataDictionaryEnum.FCM_DESTORY_CNT.getCode(),
//                gfaBasicSetDto.getFcmDesToryCnt());
//        commonService.updateDataDic(
//                DataDictionaryEnum.FCM_DESTORY_TOTAL.getType(),
//                DataDictionaryEnum.FCM_DESTORY_TOTAL.getCode(),
//                gfaBasicSetDto.getFcmDesToryTotal());
        commonService.updateDataDic(
                DataDictionaryEnum.NFT_FEE.getType(),
                DataDictionaryEnum.NFT_FEE.getCode(),
                gfaBasicSetDto.getNftFee());
        commonService.updateDataDic(
                DataDictionaryEnum.OUT_FCM_MIN.getType(),
                DataDictionaryEnum.OUT_FCM_MIN.getCode(),
                gfaBasicSetDto.getOutFcmMin());
        commonService.updateDataDic(
                DataDictionaryEnum.NFT_MIN.getType(),
                DataDictionaryEnum.NFT_MIN.getCode(),
                gfaBasicSetDto.getNftMin());
        commonService.updateDataDic(
                DataDictionaryEnum.FCM_DESTORY_POINT_PERCENT.getType(),
                DataDictionaryEnum.FCM_DESTORY_POINT_PERCENT.getCode(),
                gfaBasicSetDto.getFcmDesToryCntPointPercent());
        commonService.updateDataDic(
                DataDictionaryEnum.FCM_DESTORY_TOTAL_PERCENT.getType(),
                DataDictionaryEnum.FCM_DESTORY_TOTAL_PERCENT.getCode(),
                gfaBasicSetDto.getFcmDesToryCntPercent());
        commonService.updateDataDic(
                DataDictionaryEnum.CARD_CHANGE.getType(),
                DataDictionaryEnum.CARD_CHANGE.getCode(),
                gfaBasicSetDto.getAroundType());
        commonService.updateDataDic(
                DataDictionaryEnum.COIN_CHANGE.getType(),
                DataDictionaryEnum.COIN_CHANGE.getCode(),
                gfaBasicSetDto.getChangeType());
        commonService.updateDataDic(
                DataDictionaryEnum.COIN_INSIDE_CHANGE.getType(),
                DataDictionaryEnum.COIN_INSIDE_CHANGE.getCode(),
                gfaBasicSetDto.getAroundInsideType());
        commonService.updateDataDic(
                DataDictionaryEnum.COIN_WITHDRAW.getType(),
                DataDictionaryEnum.COIN_WITHDRAW.getCode(),
                gfaBasicSetDto.getCoinWithdraw());
        return new FebsResponse().success();
    }
 
    /**
     * 新闻中心-列表
     * @param mallNewsInfo
     * @param request
     * @return
     */
    @GetMapping("getNewInfoList")
    public FebsResponse getNewInfoList(MallNewsInfo mallNewsInfo, QueryRequest request) {
        Map<String, Object> data = getDataTable(mallNewsInfoService.getNewInfoList(mallNewsInfo, request));
        return new FebsResponse().success().data(data);
    }
 
    /**
     * 新闻中心-新增
     */
    @PostMapping("addNewsInfo")
    @ControllerEndpoint(operation = " 新闻中心-新增", exceptionMessage = "操作失败")
    public FebsResponse addNewsInfo(@Valid MallNewsInfoDto mallNewsInfoDto) {
        return mallNewsInfoService.addNewsInfo(mallNewsInfoDto);
    }
 
    /**
     * 新闻中心-删除
     */
    @GetMapping("delNewsInfo/{id}")
    @ControllerEndpoint(operation = " 新闻中心-删除", exceptionMessage = "操作失败")
    public FebsResponse delNewsInfo(@NotNull(message = "{required}") @PathVariable Long id) {
        return mallNewsInfoService.delNewsInfo(id);
    }
 
    /**
     * 新闻中心-更新
     */
    @PostMapping("updateNewsInfo")
    @ControllerEndpoint(operation = "新闻中心-更新", exceptionMessage = "操作失败")
    public FebsResponse updateNewsInfo(@Valid MallNewsInfoDto mallNewsInfoDto) {
        return mallNewsInfoService.updateNewsInfo(mallNewsInfoDto);
    }
 
 
    @GetMapping("findNewsCategoryList")
    @ControllerEndpoint(operation = "新闻分类列表", exceptionMessage = "获取失败")
    public FebsResponse findNewsCategoryList(MallNewsCategory mallNewsCategory, QueryRequest request) {
        return new FebsResponse().success().data(getDataTable(mallNewsInfoService.findNewsCategoryInPage(mallNewsCategory, request)));
    }
 
    @PostMapping("addOrModifyNewsCategory")
    @ControllerEndpoint(operation = "新闻分类", exceptionMessage = "新增失败")
    public FebsResponse addOrModifyNewsCategory(MallNewsCategory mallNewsCategory) {
        mallNewsInfoService.addOrModifyNewsCategory(mallNewsCategory);
        return new FebsResponse().success().message("新增成功");
    }
 
    /**
     * 新闻分类-删除
     */
    @GetMapping("delNewsCategoryInfo/{id}")
    @ControllerEndpoint(operation = "新闻分类-删除", exceptionMessage = "操作失败")
    public FebsResponse delNewsCategoryInfo(@NotNull(message = "{required}") @PathVariable Long id) {
        return mallNewsInfoService.delNewsCategoryInfo(id);
    }
 
    @GetMapping(value = "findAllCategoryList")
    public FebsResponse findAllCategoryList() {
        List<MallNewsCategory> categories = mallNewsInfoService.findAllCategory();
        return new FebsResponse().success().data(categories);
    }
 
    @PostMapping(value = "/topNews/{id}")
    public FebsResponse topNews(@PathVariable Long id) {
        MallNewsInfo mallNewsInfo = new MallNewsInfo();
        mallNewsInfo.setIsTop(1);
        mallNewsInfo.setId(id);
        mallNewsInfoService.updateById(mallNewsInfo);
        return new FebsResponse().success();
    }
 
    @PostMapping(value = "/unTopNews/{id}")
    public FebsResponse unTopNews(@PathVariable Long id) {
        MallNewsInfo mallNewsInfo = new MallNewsInfo();
        mallNewsInfo.setIsTop(2);
        mallNewsInfo.setId(id);
        mallNewsInfoService.updateById(mallNewsInfo);
        return new FebsResponse().success();
    }
}