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();
|
}
|
}
|