无关风月
21 小时以前 7cab5bda99ca42188bc15b2dae7d1fa4d1833fd9
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.admin.controller;
 
 
import com.ruoyi.admin.entity.Agreement;
import com.ruoyi.admin.service.AgreementService;
import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.annotation.Logical;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.Objects;
 
/**
 * <p>
 * 协议政策、司机操作指导 前端控制器
 * </p>
 *
 * @author hjl
 * @since 2024-05-29
 */
@RestController
@RequestMapping("/agreement")
@Api(tags = {"后台-隐私政策/司机操作指南"})
public class AgreementController {
 
    @Resource
    private AgreementService agreementService;
 
    /**
     * 根据类型获取注册协议、隐私政策、司机操作指南
     *
     * @param type 查询类型
     */
    @RequiresPermissions(value = {"system_agreement", "system_operate"}, logical = Logical.OR)
    @ApiOperation(value = "根据类型获取注册协议、隐私政策、司机操作指南", tags = {"后台-隐私政策/司机操作指南"})
    @GetMapping(value = "/dataInfo")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "查询类型(0注册协议;1:隐私政策;2:司机操作指导;3:服务规则管理)", name = "type", dataType = "Integer", required = true)
    })
    public R<Agreement> dataInfo(@RequestParam("type") Integer type) {
        return agreementService.dataInfo(type);
    }
 
    /**
     * 获取司机操作指南
     */
    @GetMapping(value = "/operate")
    public R<Agreement> operate() {
        return agreementService.dataInfo(Constants.TWO);
    }
 
    /**
     * 根据类型获取注册协议、隐私政策
     * -- 用户端远程调用
     *
     * @param type 查询类型
     */
    @GetMapping(value = "/agreementPolicy")
    public R<Agreement> agreementPolicy(@RequestParam("type") Integer type) {
        return agreementService.dataInfo(type);
    }
 
    /**
     * 保存政策协议
     *
     * @param agreement 协议信息
     */
    @RequiresPermissions(value = {"advantage_update", "operate_save"}, logical = Logical.OR)
    @ApiOperation(value = "保存政策协议", tags = {"后台-隐私政策/司机操作指南"})
    @PostMapping(value = "/saveData")
    public R<String> saveData(@RequestBody Agreement agreement) {
        return agreementService.saveData(agreement);
    }
 
    /**
     * 修改服务规则管理
     *
     * @param agreement 修改服务规则管理
     */
    @RequiresPermissions(value = {"advantage_update", "operate_save"}, logical = Logical.OR)
    @ApiOperation(value = "修改服务规则管理", tags = {"后台-修改服务规则管理[2.0]"})
    @PostMapping(value = "/updateAgree")
    public R<String> updateAgree(@RequestBody Agreement agreement) {
        if(Objects.isNull(agreement.getContentType()) || agreement.getContentType()!=3){
            return R.fail("服务规则管理类型异常");
        }
        agreementService.updateById(agreement);
        return R.ok();
    }
 
}