puzhibing
2026-09-29 010b1028b7121ae37d76441af1df7a2d9f698fc5
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
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));
    }
}