jiangqs
2023-06-06 306c67fe623de2273d70a92ea5faac24c42b1960
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
package com.ruoyi.system.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.system.api.domain.dto.MgtPageDto;
import com.ruoyi.system.domain.dto.MgtAgreementEditDto;
import com.ruoyi.system.domain.dto.MgtBannerEditDto;
import com.ruoyi.system.domain.dto.MgtCooperationEditDto;
import com.ruoyi.system.domain.dto.MgtServiceMobileEditDto;
import com.ruoyi.system.domain.vo.MgtBannerPageVo;
import com.ruoyi.system.service.config.AgreementService;
import com.ruoyi.system.service.config.BannerService;
import com.ruoyi.system.service.config.CooperationService;
import com.ruoyi.system.service.config.CustomConfigService;
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;
 
/**
 * @ClassName MgtConfigController
 * @Description TODO
 * @Author jqs
 * @Date 2023/6/6 9:14
 * @Version 1.0
 */
@Api(value = "平台端配置相关接口", tags = "平台端配置相关接口", description = "平台端配置相关接口")
@RestController
@RequestMapping("/mgt/config")
public class MgtConfigController {
 
    @Resource
    private CustomConfigService customConfigService;
 
    @Resource
    private CooperationService cooperationService;
 
    @Resource
    private AgreementService agreementService;
 
    @Resource
    private BannerService bannerService;
 
    @RequestMapping(value = "/editCooperation", method = RequestMethod.POST)
    @ApiOperation(value = "修改申请合作")
    public R editCooperation(@RequestBody MgtCooperationEditDto mgtCooperationEditDto) {
        Long userId = SecurityUtils.getUserId();
        mgtCooperationEditDto.setUserId(userId);
        cooperationService.editCooperation(mgtCooperationEditDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/editServiceMobile", method = RequestMethod.POST)
    @ApiOperation(value = "修改客服电话")
    public R editServiceMobile(@RequestBody MgtServiceMobileEditDto mgtServiceMobileEditDto) {
        Long userId = SecurityUtils.getUserId();
        mgtServiceMobileEditDto.setUserId(userId);
        customConfigService.editServiceMobile(mgtServiceMobileEditDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/editAgreement", method = RequestMethod.POST)
    @ApiOperation(value = "修改协议")
    public R editAgreement(@RequestBody MgtAgreementEditDto mgtAgreementEditDto) {
        Long userId = SecurityUtils.getUserId();
        mgtAgreementEditDto.setUserId(userId);
        agreementService.editAgreement(mgtAgreementEditDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/editBanner", method = RequestMethod.POST)
    @ApiOperation(value = "修改banner")
    public R editBanner(@RequestBody MgtBannerEditDto mgtBannerEditDto) {
        Long userId = SecurityUtils.getUserId();
        mgtBannerEditDto.setUserId(userId);
        bannerService.editBanner(mgtBannerEditDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/pageBanner", method = RequestMethod.POST)
    @ApiOperation(value = "分页获取banner")
    public R<Page<MgtBannerPageVo>> pageMerShopRecommend(@RequestBody MgtPageDto mgtPageDto) {
        Long userId = SecurityUtils.getUserId();
        mgtPageDto.setUserId(userId);
        Page<MgtBannerPageVo> page = new Page<>();
        page.setSize(mgtPageDto.getPageSize());
        page.setCurrent(mgtPageDto.getPageNum());
        List<MgtBannerPageVo> mgtBannerPageVoList = bannerService.pageMgtBannerVo(page);
        return R.ok(page.setRecords(mgtBannerPageVoList));
    }
}