陶杰
2025-01-07 23ae87b2b99947e89cfa5fde81937870279e3180
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package com.mzl.flower.web.flower;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
import com.mzl.flower.base.annotation.OperationLog;
import com.mzl.flower.dto.request.flower.*;
import com.mzl.flower.dto.response.flower.*;
import com.mzl.flower.entity.log.OperationRecord;
import com.mzl.flower.service.flower.FlowerMarkupPsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
 
@RestController
@RequestMapping("/api/flower/markup/ps")
@Api(value = "平台二次加价管理", tags = "平台二次加价管理")
@Validated
@Slf4j
public class FlowerMarkupPsController extends BaseController {
 
    @Autowired
    private FlowerMarkupPsService psService;
 
    @PostMapping("/list/new")
    @OperationLog(value = "新增合伙人配置", type = "markup_s_p")
    @ApiOperation(value = "新增合伙人配置")
    public ResponseEntity<ReturnDataDTO> saveMarkupPs(@RequestBody FlowerMarkupPsSaveDTO dto) {
        String content = "新增合伙人配置:合伙人id:【" + dto.getPartnerId() + "】";
        OperationRecord operationRecord = getOperationRecord(content);
        return returnData(R.SUCCESS.getCode(), psService.saveMarkupPs(dto), operationRecord);
    }
 
    @GetMapping("/list")
    @ApiOperation(value = "获取合伙人配置列表")
    public ResponseEntity<ReturnDataDTO<Page<FlowerMarkupPsDTO>>> selectMarkupPsList(Page page, FlowerMarkupPsQueryDTO dto){
        return returnData(R.SUCCESS.getCode(), psService.selectMarkupPsList(page, dto));
    }
 
    @GetMapping("/list/delete")
    @OperationLog(value = "删除合伙人配置", type = "markup_s_p")
    @ApiOperation(value = "删除合伙人配置")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<?>> deleteMarkupPs(Long id){
        psService.deleteMarkupPs(id);
        String content = "删除合伙人配置id:【" + id+ "】";
        OperationRecord operationRecord = getOperationRecord(content);
        return returnData(R.SUCCESS.getCode(), null, operationRecord);
    }
 
    @PostMapping("/spcg/list/save/batch")
    @OperationLog(value = "批量新增商品分类加价", type = "markup_s_p")
    @ApiOperation(value = "批量新增商品分类加价")
    public ResponseEntity<ReturnDataDTO> saveMarkupSpCgBatch(@RequestBody FlowerMarkupPsSpCgBatchSaveDTO dto, HttpServletRequest request) throws IOException {
        psService.saveMarkupSpCgBatch(dto,request);
        String content = "批量新增商品分类加价:商品分类Id:【" + dto.getCategoryId() + "】,A级:【"+dto.getLevelA()+"】,B级:【" + dto.getLevelB() + "】,C级:【" + dto.getLevelC() + "】" +
                ",D级:【"+dto.getLevelD()+"】,E级:【" + dto.getLevelE() + "】,O级:【" + dto.getLevelO() + "】";
        OperationRecord operationRecord = getOperationRecord(content);
        return returnData(R.SUCCESS.getCode(), null,operationRecord);
    }
 
    @PostMapping("/spcg/list/save")
    @ApiOperation(value = "新增商品分类加价")
    public ResponseEntity<ReturnDataDTO> saveMarkupSpCg(@RequestBody FlowerMarkupPsSpCgSaveDTO dto,HttpServletRequest request) throws IOException {
        psService.saveMarkupSpCg(dto,request);
        return returnData(R.SUCCESS.getCode(), null);
    }
 
    @GetMapping("/spcg/list/view")
    @ApiOperation(value = "查询商品分类加价详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"),
            @ApiImplicitParam(name = "categoryId", value = "商品分类id", required = true, dataType = "Long", paramType = "query"),
    })
    public ResponseEntity<ReturnDataDTO<FlowerMarkupSpCgDTO>> getMarkupSpCg(Long partnerId, Long categoryId){
        return returnData(R.SUCCESS.getCode(), psService.getMarkupSpCg(partnerId, categoryId));
    }
 
    @GetMapping("/spcg/list")
    @ApiOperation(value = "获取商品分类加价列表")
    public ResponseEntity<ReturnDataDTO<Page<FlowerMarkupSpCgListDTO>>> selectMarkupSpCgList(Page page
            , FlowerMarkupPsSpCgQueryDTO dto){
        return returnData(R.SUCCESS.getCode(), psService.selectMarkupSpCgList(page, dto));
    }
 
    @GetMapping("/spcg/list/delete")
    @OperationLog(value = "删除商品分类加价", type = "markup_s_p")
    @ApiOperation(value = "删除商品分类加价")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"),
            @ApiImplicitParam(name = "categoryId", value = "商品分类id", required = true, dataType = "Long", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<?>> deleteMarkupSpCg(Long partnerId, Long categoryId){
        psService.deleteMarkupSpCg(partnerId, categoryId);
        String content = "删除商品分类加价:合伙人id:【" + partnerId + "】,商品分类id:【"+categoryId+"】";
        OperationRecord operationRecord = getOperationRecord(content);
        return returnData(R.SUCCESS.getCode(), null,operationRecord);
    }
 
    @PostMapping("/sp/list/save")
    @ApiOperation(value = "新增商品加价")
    public ResponseEntity<ReturnDataDTO> saveMarkupSp(@RequestBody FlowerMarkupPsSpSaveDTO dto,HttpServletRequest request) throws IOException {
        psService.saveMarkupSp(dto,request);
        return returnData(R.SUCCESS.getCode(), null);
    }
 
    @GetMapping("/sp/list/view")
    @ApiOperation(value = "查询商品加价详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"),
            @ApiImplicitParam(name = "flowerId", value = "商品id", required = true, dataType = "Long", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<FlowerMarkupSpDTO>> getMarkupSp(Long partnerId, Long flowerId){
        return returnData(R.SUCCESS.getCode(), psService.getMarkupSp(partnerId, flowerId));
    }
 
    @GetMapping("/sp/list")
    @ApiOperation(value = "获取商品加价列表")
    public ResponseEntity<ReturnDataDTO<Page<FlowerMarkupSpListDTO>>> selectMarkupSpList(Page page, FlowerMarkupPsSpQueryDTO dto){
        return returnData(R.SUCCESS.getCode(), psService.selectMarkupSpList(page, dto));
    }
 
    @GetMapping("/sp/list/delete")
    @OperationLog(value = "删除商品加价", type = "markup_s_p")
    @ApiOperation(value = "删除商品加价")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"),
            @ApiImplicitParam(name = "flowerId", value = "商品id", required = true, dataType = "Long", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<?>> deleteMarkupSp(Long partnerId, Long flowerId){
        psService.deleteMarkupSp(partnerId, flowerId);
        String content = "删除商品加价:合伙人id:【" + partnerId + "】,商品id:【"+flowerId+"】";
        OperationRecord operationRecord = getOperationRecord(content);
        return returnData(R.SUCCESS.getCode(), null,operationRecord);
    }
}