gongzuming
2024-08-23 d9fc483d7bf49707a6b35eaa68a20657e02459a9
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
package com.mzl.flower.web.content;
 
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.config.security.SecurityUtils;
import com.mzl.flower.dto.request.content.AddFeedbackDTO;
import com.mzl.flower.dto.request.content.QueryFeedBackDTO;
import com.mzl.flower.dto.request.content.ReplyFeedbackDTO;
import com.mzl.flower.dto.response.content.FeedbackDTO;
import com.mzl.flower.service.content.FeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.constraints.NotNull;
 
@RestController
@RequestMapping("/api/feedback")
@Api(value = "投诉反馈管理", tags = "投诉反馈管理")
@Validated
@Slf4j
public class FeedbackController extends BaseController {
 
    private final FeedbackService feedbackService;
 
    public FeedbackController(FeedbackService feedbackService) {
        this.feedbackService = feedbackService;
    }
 
    @PostMapping("/page/new")
    @ApiOperation(value = "用户提交投诉反馈", notes = "提交投诉反馈")
    public ResponseEntity<ReturnDataDTO> add(@Validated @RequestBody AddFeedbackDTO dto) {
        feedbackService.add(dto);
        return returnData(R.SUCCESS.getCode(),null);
    }
 
    @GetMapping("/my/feedback/list")
    @ApiOperation(value = "用户查询我的投诉反馈", notes = "用户查询我的投诉反馈")
    public ResponseEntity<ReturnDataDTO<Page<FeedbackDTO>>> queryMyPage(Page page) {
        QueryFeedBackDTO dto = new QueryFeedBackDTO();
        dto.setUserId(SecurityUtils.getUserId());
        return returnData(R.SUCCESS.getCode(), feedbackService.queryPage(dto,page));
    }
 
 
    @GetMapping("/page/view")
    @ApiOperation(value = "详情", notes = "详情")
    public ResponseEntity<ReturnDataDTO<FeedbackDTO>> detail(@NotNull(message = "id不能为空") Long id) {
        return returnData(R.SUCCESS.getCode(),feedbackService.detail(id));
    }
 
    @GetMapping("/page")
    @ApiOperation(value = "运营查询-分页", notes = "查询-分页")
    public ResponseEntity<ReturnDataDTO<Page<FeedbackDTO>>> queryPage(QueryFeedBackDTO dto, Page page) {
        return returnData(R.SUCCESS.getCode(), feedbackService.queryPage(dto,page));
    }
 
    @PostMapping("/page/reply")
    @ApiOperation(value = "运营回复投诉反馈", notes = "运营回复投诉反馈")
    public ResponseEntity<ReturnDataDTO> reply(@Validated @RequestBody ReplyFeedbackDTO dto)  {
        feedbackService.reply(dto);
        return returnData(R.SUCCESS.getCode(), null);
    }
 
}