xiaoyong931011
2023-08-14 657d6ca995fade9e0f23002c54263f1c972a254f
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
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.DataDictionaryCustom;
import cc.mrbird.febs.dapp.entity.MallGoods;
import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.dapp.service.IAdminMallGoodsService;
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("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");
    }
 
    @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");
    }
}