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);
|
}
|
|
}
|