|
|
@@ -0,0 +1,58 @@
|
|
|
+package com.cyksj.web.controller.user;
|
|
|
+
|
|
|
+import com.cyksj.common.annotation.NoSubmit;
|
|
|
+import com.cyksj.dto.Result;
|
|
|
+import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.model.entity.UserComplaint;
|
|
|
+import com.cyksj.model.views.UserComplaintFrontView;
|
|
|
+import com.cyksj.service.user.UserComplaintService;
|
|
|
+import com.cyksj.web.util.StpUserUtil;
|
|
|
+import com.ejlchina.searcher.BeanSearcher;
|
|
|
+import com.ejlchina.searcher.SearchResult;
|
|
|
+import com.ejlchina.searcher.util.MapUtils;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+/*
|
|
|
+ *项目名: netflix
|
|
|
+ *文件名: UserComplaintController
|
|
|
+ *创建者: JavaZou
|
|
|
+ *创建时间:2023/6/16 11:26
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/applets/user/complaint")
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class UserComplaintController {
|
|
|
+ private final UserComplaintService userComplaintService;
|
|
|
+
|
|
|
+ private final BeanSearcher beanSearcher;
|
|
|
+
|
|
|
+ private final HttpServletRequest request;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户投诉
|
|
|
+ */
|
|
|
+ @PostMapping
|
|
|
+ @NoSubmit
|
|
|
+ public Result<String> insert(@RequestBody @Validated UserComplaint userComplaint) {
|
|
|
+ long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
+ userComplaint.setUserId(userId);
|
|
|
+ userComplaintService.insertUserComplaint(userComplaint);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult("投诉成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我的投诉列表
|
|
|
+ */
|
|
|
+ @GetMapping("/get")
|
|
|
+ public Result<SearchResult<UserComplaintFrontView>> get() {
|
|
|
+ long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
+ SearchResult<UserComplaintFrontView> search = beanSearcher.search(UserComplaintFrontView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
+ .field(UserComplaintFrontView::getUserId, userId)
|
|
|
+ .build());
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
+}
|