xiaoyong931011
2023-08-17 e203174b7798c223e2a568ff9493b492cdc4b413
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
package cc.mrbird.febs.dapp.controller;
 
import cc.mrbird.febs.common.controller.BaseController;
import cc.mrbird.febs.common.entity.FebsConstant;
import cc.mrbird.febs.common.utils.FebsUtil;
import cc.mrbird.febs.dapp.dto.HlmBasicPerkDto;
import cc.mrbird.febs.dapp.entity.*;
import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.dapp.service.IAdminMallGoodsService;
import cc.mrbird.febs.dapp.service.IMallNewsInfoService;
import cc.mrbird.febs.dapp.vo.AdminMallGoodsCategoryVo;
import cc.mrbird.febs.dapp.vo.AdminMallOrderVo;
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;
 
@Controller("goodsView")
@RequestMapping(FebsConstant.VIEW_PREFIX + "goodsView")
@RequiredArgsConstructor
public class ViewAdminMallGoodsController extends BaseController {
 
    private final IAdminMallGoodsService mallGoodsService;
    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
 
    /**
     * 商品分类-新增
     * @return
     */
    @GetMapping("categoryAdd")
    @RequiresPermissions("categoryAdd:add")
    public String helpCenterAdd() {
        return FebsUtil.view("goods/categoryAdd");
    }
 
    /**
     * 商品分类-详情
     * @param id
     * @param model
     * @return
     */
    @GetMapping("categoryUpdate/{id}")
    @RequiresPermissions("categoryUpdate:update")
    public String detail(@PathVariable long id, Model model) {
        AdminMallGoodsCategoryVo data = mallGoodsService.getMallGoodsCategoryInfoById(id);
        model.addAttribute("goodsCategoryVo", data);
        return FebsUtil.view("goods/categoryUpdate");
    }
    /**
     * 商品分类列表
     * @return
     */
    @GetMapping("categoryList")
    @RequiresPermissions("categoryList:view")
    public String categoryList() {
        return FebsUtil.view("goods/categoryList");
    }
    /**
     * 商品列表
     * @return
     */
    @GetMapping("goodsList")
    @RequiresPermissions("goodsList:view")
    public String goodsList() {
        return FebsUtil.view("goods/goodsList");
    }
 
    /**
     * 商品-新增
     * @return
     */
    @GetMapping("goodsAddNew")
    @RequiresPermissions("goodsAddNew:add")
    public String goodsAddNew() {
        return FebsUtil.view("goods/goodsAddNew");
    }
 
    /**
     * 商品-编辑-详情
     * @param id
     * @param model
     * @return
     */
    @GetMapping("goodsUpdateNew/{id}")
    @RequiresPermissions("goodsUpdateNew:update")
    public String goodsUpdate(@PathVariable long id, Model model) {
        MallGoods data = mallGoodsService.selectGoodsById(id);
        model.addAttribute("goodsInfo", data);
        return FebsUtil.view("goods/goodsUpdateNew");
    }
 
    /**
     * 订单列表
     * @return
     */
    @GetMapping("orderList")
    @RequiresPermissions("orderList:view")
    public String orderList() {
        return FebsUtil.view("goods/orderList");
    }
 
    /**
     * 订单-资金流水
     * @param id
     * @param model
     * @return
     */
    public static long idOrderMoneyFlow;
    @GetMapping("orderMoneyFlow/{id}")
    @RequiresPermissions("orderMoneyFlow:update")
    public String orderMoneyFlow(@PathVariable long id, Model model) {
        idOrderMoneyFlow = id;
        return FebsUtil.view("goods/orderMoneyFlow");
    }
 
    /**
     * 订单-发货
     * @param id
     * @param model
     * @return
     */
    @GetMapping("deliverGoods/{id}")
    @RequiresPermissions("orderMoneyFlow:update")
//    @RequiresPermissions("deliverGoods:update")
    public String deliverGoods(@PathVariable long id, Model model) {
        AdminMallOrderVo data = mallGoodsService.getMallOrderInfoById(id);
        data.setId(id);
        model.addAttribute("deliverInfo", data);
        return FebsUtil.view("goods/deliverGoods");
    }
 
    @GetMapping("profitSetting")
    @RequiresPermissions("profitSetting:view")
    public String profitSetting() {
        return FebsUtil.view("goods/profitSetting");
    }
 
    @GetMapping("basicPerk")
    @RequiresPermissions("basicPerk:view")
    public String basicPerkSetting(Model model) {
        HlmBasicPerkDto hlmBasicPerkDto = new HlmBasicPerkDto();
        DataDictionaryCustom donateScorePercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.DONATE_SCORE_PERCENT.getType(),
                DataDictionaryEnum.DONATE_SCORE_PERCENT.getCode());
        if (donateScorePercentDic != null) {
            String donateScorePercent = ObjectUtil.isEmpty(donateScorePercentDic.getValue()) ? "0" : donateScorePercentDic.getValue();
            hlmBasicPerkDto.setDonateScorePercent(donateScorePercent);
        }
        DataDictionaryCustom staticReleaseDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.STATIC_RELEASE.getType(),
                DataDictionaryEnum.STATIC_RELEASE.getCode());
        if (staticReleaseDic != null) {
            String staticRelease = ObjectUtil.isEmpty(staticReleaseDic.getValue()) ? "0" : staticReleaseDic.getValue();
            hlmBasicPerkDto.setStaticRelease(staticRelease);
        }
        DataDictionaryCustom directReleaseDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.DIRECT_RELEASE.getType(),
                DataDictionaryEnum.DIRECT_RELEASE.getCode());
        if (directReleaseDic != null) {
            String directRelease = ObjectUtil.isEmpty(directReleaseDic.getValue()) ? "0" : directReleaseDic.getValue();
            hlmBasicPerkDto.setDirectRelease(directRelease);
        }
        DataDictionaryCustom maxReleaseDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.MAX_RELEASE.getType(),
                DataDictionaryEnum.MAX_RELEASE.getCode());
        if (maxReleaseDic != null) {
            String maxRelease = ObjectUtil.isEmpty(maxReleaseDic.getValue()) ? "0" : maxReleaseDic.getValue();
            hlmBasicPerkDto.setMaxRelease(maxRelease);
        }
        DataDictionaryCustom usdtOrderReleaseDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.USDT_ORDER_PERCENT.getType(),
                DataDictionaryEnum.USDT_ORDER_PERCENT.getCode());
        if (usdtOrderReleaseDic != null) {
            String usdtOrderRelease = ObjectUtil.isEmpty(usdtOrderReleaseDic.getValue()) ? "0" : usdtOrderReleaseDic.getValue();
            hlmBasicPerkDto.setUsdtOrderRelease(usdtOrderRelease);
        }
        DataDictionaryCustom teamPerkLevelEqualsDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.TEAM_PERK_LEVEL_EQUALS.getType(),
                DataDictionaryEnum.TEAM_PERK_LEVEL_EQUALS.getCode());
        if (teamPerkLevelEqualsDic != null) {
            String teamPerkLevelEquals = ObjectUtil.isEmpty(teamPerkLevelEqualsDic.getValue()) ? "0" : teamPerkLevelEqualsDic.getValue();
            hlmBasicPerkDto.setTeamPerkLevelEquals(teamPerkLevelEquals);
        }
        DataDictionaryCustom memberBuyMaxAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.MEMBER_BUY_MAX_AMOUNT.getType(),
                DataDictionaryEnum.MEMBER_BUY_MAX_AMOUNT.getCode());
        if (memberBuyMaxAmountDic != null) {
            String memberBuyMaxAmount = ObjectUtil.isEmpty(memberBuyMaxAmountDic.getValue()) ? "0" : memberBuyMaxAmountDic.getValue();
            hlmBasicPerkDto.setMemberBuyMaxAmount(memberBuyMaxAmount);
        }
        DataDictionaryCustom packagePoorDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.PACKAGE_POOR.getType(),
                DataDictionaryEnum.PACKAGE_POOR.getCode());
        if (packagePoorDic != null) {
            String packagePoor = ObjectUtil.isEmpty(packagePoorDic.getValue()) ? "0" : packagePoorDic.getValue();
            hlmBasicPerkDto.setPackagePoor(packagePoor);
        }
        DataDictionaryCustom packageTotalScoreDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.PACKAGE_TOTAL_SCORE.getType(),
                DataDictionaryEnum.PACKAGE_TOTAL_SCORE.getCode());
        if (packageTotalScoreDic != null) {
            String packageTotalScore = ObjectUtil.isEmpty(packageTotalScoreDic.getValue()) ? "0" : packageTotalScoreDic.getValue();
            hlmBasicPerkDto.setPackageTotalScore(packageTotalScore);
        }
        DataDictionaryCustom packageScorePriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.PACKAGE_SCORE_PRICE.getType(),
                DataDictionaryEnum.PACKAGE_SCORE_PRICE.getCode());
        if (packageScorePriceDic != null) {
            String packageScorePrice = ObjectUtil.isEmpty(packageScorePriceDic.getValue()) ? "0" : packageScorePriceDic.getValue();
            hlmBasicPerkDto.setPackageScorePrice(packageScorePrice);
        }
        DataDictionaryCustom packageSaleToPoorPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.PACKAGE_SALE_TO_POOR_PERCENT.getType(),
                DataDictionaryEnum.PACKAGE_SALE_TO_POOR_PERCENT.getCode());
        if (packageSaleToPoorPercentDic != null) {
            String packageSaleToPoorPercent = ObjectUtil.isEmpty(packageSaleToPoorPercentDic.getValue()) ? "0" : packageSaleToPoorPercentDic.getValue();
            hlmBasicPerkDto.setPackageSaleToPoorPercent(packageSaleToPoorPercent);
        }
        DataDictionaryCustom withDrawFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.WITHDRAW_FEE.getType(),
                DataDictionaryEnum.WITHDRAW_FEE.getCode());
        if (withDrawFeeDic != null) {
            String withDrawFee = ObjectUtil.isEmpty(withDrawFeeDic.getValue()) ? "0" : withDrawFeeDic.getValue();
            hlmBasicPerkDto.setWithDrawFee(withDrawFee);
        }
        model.addAttribute("hlmBasicPerk", hlmBasicPerkDto);
        return FebsUtil.view("goods/basicPerkSetting");
    }
 
 
    /**
     * 轮播图---列表
     */
    @GetMapping("platformBanner")
    @RequiresPermissions("platformBanner:view")
    public String platformBanner() {
        return FebsUtil.view("goods/platformBanner");
    }
 
    /**
     * 轮播图---修改
     */
    @GetMapping("platformBannerUpdate/{id}")
    @RequiresPermissions("platformBannerUpdate:update")
    public String platformBannerUpdate(@PathVariable long id, Model model) {
        PlatformBanner data = mallGoodsService.selectPlatformBannerById(id);
        model.addAttribute("member", data);
        return FebsUtil.view("goods/platformBannerDetail");
    }
 
    /**
     * 轮播图---新增
     */
    @GetMapping("platformBannerAdd")
    @RequiresPermissions("platformBannerAdd:add")
    public String platformBannerAdd() {
        return FebsUtil.view("goods/platformBannerAdd");
    }
 
 
 
    private final IMallNewsInfoService mallNewsInfoService;
 
    /**
     * 新闻中心-列表
     * @return
     */
    @GetMapping("newsInfoList")
    @RequiresPermissions("newsInfoList:view")
    public String newsInfoList() {
        return FebsUtil.view("goods/newsInfoList");
    }
 
    /**
     * 新闻中心-新增
     * @return
     */
    @GetMapping("newsInfoAdd")
    @RequiresPermissions("newsInfoAdd:add")
    public String newsInfoAdd() {
        return FebsUtil.view("goods/newsInfoAdd");
    }
 
    /**
     * 新闻中心-详情
     * @param id
     * @param model
     * @return
     */
    @GetMapping("newsInfoUpdate/{id}")
    @RequiresPermissions("newsInfoUpdate:update")
    public String newsInfoUpdate(@PathVariable long id, Model model) {
        MallNewsInfo data = mallNewsInfoService.getNewsInfoById(id);
        model.addAttribute("newsInfo", data);
        return FebsUtil.view("goods/newsInfoUpdate");
    }
 
    @GetMapping("newsCategory")
    @RequiresPermissions("news:category:view")
    public String newsCategory() {
        return FebsUtil.view("goods/newsCategory");
    }
 
    @GetMapping("addCategory")
    @RequiresPermissions("news:category:add")
    public String addCategory(Long id, Model model) {
        if (id != null) {
            MallNewsCategory obj = mallNewsInfoService.findNewsCategoryById(id);
            model.addAttribute("obj", obj);
        }
        return FebsUtil.view("goods/newsCategoryAdd");
    }
 
    @GetMapping("updateCategory/{id}")
    @RequiresPermissions("news:category:update")
    public String updateCategory(@PathVariable Long id, Model model) {
        if (id != null) {
            MallNewsCategory obj = mallNewsInfoService.findNewsCategoryById(id);
            model.addAttribute("obj", obj);
        }
        return FebsUtil.view("goods/newsCategoryAdd");
    }
}