package com.ruoyi.other.controller;
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.log.annotation.Log;
|
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.security.annotation.Logical;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import com.ruoyi.other.api.dto.CompanyPreferentialDTO;
|
import com.ruoyi.other.service.TCompanyPreferentialService;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
|
/**
|
* <p>
|
* 公司优惠设置 前端控制器(公司管理-优惠设置弹窗使用)
|
* </p>
|
*
|
* @author mxcd
|
* @since 2026-09-28
|
*/
|
@RestController
|
@RequestMapping("/company-preferential")
|
public class TCompanyPreferentialController {
|
|
@Resource
|
private TCompanyPreferentialService companyPreferentialService;
|
|
/**
|
* 查询公司的优惠设置(未配置时仅返回公司ID,优惠字段为空)
|
*/
|
@RequiresPermissions(value = {"/companyManagement/list"}, logical = Logical.OR)
|
@GetMapping("/detail")
|
@ApiOperation(tags = {"管理后台-公司管理"}, value = "查询公司优惠设置")
|
public AjaxResult<CompanyPreferentialDTO> detail(@RequestParam("companyId") Integer companyId) {
|
return AjaxResult.success(companyPreferentialService.getPreferential(companyId));
|
}
|
|
/**
|
* 内部接口:查询公司的优惠设置(VIN码充电结算按优惠设置计费使用,未配置时优惠字段为空)
|
*/
|
@GetMapping("/inner/detail")
|
@ApiOperation(value = "内部-查询公司优惠设置", tags = {"内部调用"})
|
public R<CompanyPreferentialDTO> innerDetail(@RequestParam("companyId") Integer companyId) {
|
return R.ok(companyPreferentialService.getPreferential(companyId));
|
}
|
|
/**
|
* 保存公司的优惠设置(一个公司一条配置,保存即覆盖)
|
*/
|
@RequiresPermissions(value = {"/companyManagement/list"}, logical = Logical.OR)
|
@PostMapping("/save")
|
@ApiOperation(tags = {"管理后台-公司管理"}, value = "保存公司优惠设置")
|
@Log(title = "【公司管理】优惠设置", businessType = BusinessType.UPDATE)
|
public AjaxResult<Integer> save(@RequestBody CompanyPreferentialDTO dto) {
|
return AjaxResult.success(companyPreferentialService.savePreferential(dto));
|
}
|
}
|