Sunshine
2024-11-04 177f10973fd9bc1f0930369bb086ad9f0053440c
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
package com.nova.sankuai.controller.v1;
 
import com.nova.sankuai.domain.vo.PayTypeParamVo;
import com.nova.sankuai.domain.vo.SystemConfigVo;
import com.nova.sankuai.domain.vo.channel.ChannelConfigVo;
import com.nova.sankuai.infra.utils.ResultJson;
import com.nova.sankuai.service.IChannelInfoService;
import com.nova.sankuai.service.ISystemParamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
 
/**
 * @author weikangdi
 * @create 2021/12/20
 */
@Api(tags = "系统配置")
@RestController
@RequestMapping(value = "/api/v1/systemConfig")
@AllArgsConstructor
public class SystemConfigController {
 
    private final IChannelInfoService channelInfoService;
    private final ISystemParamService systemParamService;
 
    @GetMapping(value = "/getConfig")
    @ApiOperation(value = "获取配置信息")
    public ResultJson<ChannelConfigVo> getConfig(String appId, HttpServletRequest request) {
        ChannelConfigVo configParams = channelInfoService.getChannelInfoByKey(appId, request);
        return ResultJson.ok(configParams);
    }
 
    @GetMapping(value = "/getSystemParam")
    @ApiOperation(value = "获取系统默认配置参数")
    public ResultJson<SystemConfigVo> getSystemParam() {
        SystemConfigVo result = systemParamService.getSystemParam();
        return ResultJson.ok(result);
    }
 
    @GetMapping(value = "/getPayTypeParam")
    @ApiOperation(value = "获取系统内可用支付方式")
    @PreAuthorize("hasAuthority('systemConfig.getPayTypeParam')")
    public ResultJson<PayTypeParamVo> getPayTypeList() {
        PayTypeParamVo result = systemParamService.getPayTypeList();
        return ResultJson.ok(result);
    }
 
    @GetMapping(value = "/updatePayType")
    @ApiOperation(value = "编辑默认支付方式")
    @PreAuthorize("hasAuthority('systemConfig.updatePayType')")
    public ResultJson<Void> updatePayType(Integer code) {
        systemParamService.updatePayType(code);
        return ResultJson.success();
    }
}