jiangqs
2023-06-11 962e7325d72222a4ffd4d74a1fc5612f95326e98
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
package com.ruoyi.shop.controller.management;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.shop.domain.dto.*;
import com.ruoyi.shop.domain.vo.*;
import com.ruoyi.shop.service.shop.ShopProportionService;
import com.ruoyi.shop.service.shop.ShopRelTagService;
import com.ruoyi.shop.service.shop.ShopService;
import com.ruoyi.shop.service.shop.ShopSuggestService;
import com.ruoyi.system.api.domain.dto.MgtBaseGetDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * @author jqs34
 * @ClassName ShopController
 * @description: TODO
 * @date 2023年04月21日
 * @version: 1.0
 */
@Api(value = "管理台商户相关接口", tags = "管理台商户相关接口", description = "管理台商户相关接口")
@RestController
@RequestMapping("/mgt/shop")
public class MgtShopController {
 
    @Resource
    private ShopService shopService;
 
    @Resource
    private ShopRelTagService shopRelTagService;
 
    @Resource
    private ShopProportionService shopProportionService;
 
    @Resource
    private ShopSuggestService shopSuggestService;
 
    @RequestMapping(value = "/pageMgtShop", method = RequestMethod.POST)
    @ApiOperation(value = "分页获取商户列表")
    public R<Page<MgtShopPageVo>> pageMgtShop(@RequestBody MgtShopPageDto mgtShopPageDto) {
        Page<MgtShopPageVo> page = new Page<>();
        page.setSize(mgtShopPageDto.getPageSize());
        page.setCurrent(mgtShopPageDto.getPageNum());
        List<MgtShopPageVo> mgtShopPageVoList = shopService.pageShop(page,mgtShopPageDto);
        return R.ok(page.setRecords(mgtShopPageVoList));
    }
 
    @RequestMapping(value = "/createMgtShop", method = RequestMethod.POST)
    @ApiOperation(value = "平台编辑商户")
    public R createMgtShop(@RequestBody MgtEditShopDto mgtEditShopDto) {
        Long userId = SecurityUtils.getUserId();
        mgtEditShopDto.setUserId(userId);
        shopService.createShop(mgtEditShopDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/getMgtShopInfo", method = RequestMethod.POST)
    @ApiOperation(value = "获取商户详情")
    public R<MgtShopInfoVo> getMgtShopInfo(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
        MgtShopInfoVo mgtShopInfoVo = shopService.getMgtShopInfo(Long.valueOf(mgtBaseGetDto.getId()));
        return R.ok(mgtShopInfoVo);
    }
 
    @RequestMapping(value = "/getMgtShopTag", method = RequestMethod.POST)
    @ApiOperation(value = "获取商户标签")
    public R<List<MgtShopTagVo>> getMgtShopTag(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
        List<MgtShopTagVo> mgtShopInfoVoList = shopRelTagService.listShopTagVo(Long.valueOf(mgtBaseGetDto.getId()));
        return R.ok(mgtShopInfoVoList);
    }
 
    @RequestMapping(value = "/editMgtShopTag", method = RequestMethod.POST)
    @ApiOperation(value = "修改商户标签")
    public R editMgtShopTag(@RequestBody MgtEditShopTagDto mgtEditShopTagDto) {
        shopService.editShopTag(mgtEditShopTagDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/changeMgtCooperationTime", method = RequestMethod.POST)
    @ApiOperation(value = "修改合作时间")
    public R changeMgtCooperationTime(@RequestBody MgtChangeCoopDto mgtChangeCoopDto) {
        Long userId = SecurityUtils.getUserId();
        mgtChangeCoopDto.setUserId(userId);
        shopService.changeCooperationTime(mgtChangeCoopDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/pageMgtShopProportion", method = RequestMethod.POST)
    @ApiOperation(value = "分页获取商户分成列表")
    public R<Page<MgtShopProportionPageVo>> pageMgtShopProportion(@RequestBody MgtShopProportionPageDto mgtShopProportionPageDto) {
        Page<MgtShopProportionPageVo> page = new Page<>();
        page.setSize(mgtShopProportionPageDto.getPageSize());
        page.setCurrent(mgtShopProportionPageDto.getPageNum());
        List<MgtShopProportionPageVo> mgtShopProportionPageVoList = shopService.pageMgtShopProportion(page,mgtShopProportionPageDto);
        return R.ok(page.setRecords(mgtShopProportionPageVoList));
    }
 
    @RequestMapping(value = "/editMgtShopProportion", method = RequestMethod.POST)
    @ApiOperation(value = "修改商户分成")
    public R editMgtShopProportion(@RequestBody MgtShopProportionEditDto mgtShopProportionEditDto) {
        mgtShopProportionEditDto.setUserId(SecurityUtils.getUserId());
        shopProportionService.editMgtShopProportion(mgtShopProportionEditDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/pageMgtShopSuggest", method = RequestMethod.POST)
    @ApiOperation(value = "平台获取商户建议列表")
    public R<Page<MgtShopSuggestPageVo>> pageMgtShopSuggest(@RequestBody MgtShopSuggestPageDto mgtShopSuggestPageDto) {
        Long userId = SecurityUtils.getUserId();
        mgtShopSuggestPageDto.setUserId(userId);
        Page<MgtShopSuggestPageVo> page = new Page<>();
        page.setSize(mgtShopSuggestPageDto.getPageSize());
        page.setCurrent(mgtShopSuggestPageDto.getPageNum());
        List<MgtShopSuggestPageVo> mgtShopSuggestPageVoList = shopSuggestService.pageMgtShopSuggest(page,mgtShopSuggestPageDto);
        return R.ok(page.setRecords(mgtShopSuggestPageVoList));
    }
 
    @RequestMapping(value = "/mgtReplayShopSuggest", method = RequestMethod.POST)
    @ApiOperation(value = "平台回复会员建议")
    public R mgtReplayShopSuggest(@RequestBody MgtReplayShopSuggestDto mgtReplayShopSuggestDto) {
        Long userId = SecurityUtils.getUserId();
        mgtReplayShopSuggestDto.setUserId(userId);
        shopSuggestService.mgtReplayShopSuggest(mgtReplayShopSuggestDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/listMgtShopSuggestTag", method = RequestMethod.POST)
    @ApiOperation(value = "获取商户建议标签")
    public R<List<MgtShopSuggestTagVo>> listMgtShopSuggestTag(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
        List<MgtShopSuggestTagVo> mgtShopSuggestTagVoList = shopSuggestService.listMgtShopSuggestTag(Long.valueOf(mgtBaseGetDto.getId()));
        return R.ok(mgtShopSuggestTagVoList);
    }
 
    @RequestMapping(value = "/mgtEditShopSuggestTag", method = RequestMethod.POST)
    @ApiOperation(value = "平台编辑会员建议标签")
    public R mgtEditShopSuggestTag(@RequestBody MgtTagShopSuggestDto mgtTagShopSuggestDto) {
        Long userId = SecurityUtils.getUserId();
        mgtTagShopSuggestDto.setUserId(userId);
        shopSuggestService.mgtEditShopSuggestTag(mgtTagShopSuggestDto);
        return R.ok();
    }
}