From 48e1a3658117ebda9270d87092cfb0d31a634b92 Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期四, 21 七月 2022 15:07:00 +0800
Subject: [PATCH] bug修改
---
src/main/java/com/example/jz/controller/ReportController.java | 48 +++++++++++++++++++++++++++++++++---------------
1 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/example/jz/controller/ReportController.java b/src/main/java/com/example/jz/controller/ReportController.java
index f2cc3f0..6ea3049 100644
--- a/src/main/java/com/example/jz/controller/ReportController.java
+++ b/src/main/java/com/example/jz/controller/ReportController.java
@@ -1,9 +1,11 @@
package com.example.jz.controller;
+
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.jz.modle.R;
+import com.example.jz.modle.dto.AddReportDto;
import com.example.jz.modle.dto.ReportParamDto;
import com.example.jz.modle.entity.Report;
import com.example.jz.modle.vo.ReportListVo;
@@ -11,9 +13,12 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
+import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.util.Date;
@@ -25,7 +30,7 @@
*/
@RestController
@RequestMapping("report")
-@Api(value = "鎶ユ鎺ュ彛", tags = "鎶ユ鎺ュ彛")
+@Api(value = "妗堜欢鍖�-妗堜欢浜哄憳", tags = "妗堜欢鍖�-妗堜欢浜哄憳")
public class ReportController extends ApiController {
/**
* 鏈嶅姟瀵硅薄
@@ -36,7 +41,7 @@
/**
* 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹�
*
- * @param page 鍒嗛〉瀵硅薄
+ * @param page 鍒嗛〉瀵硅薄
* @param reportParamDto 鏌ヨ瀹炰綋
* @return 鎵�鏈夋暟鎹�
*/
@@ -61,17 +66,14 @@
/**
* 鎶ユ
*
- * @param report 瀹炰綋瀵硅薄
+ * @param addReportDto 瀹炰綋瀵硅薄
* @return 鏂板缁撴灉
*/
@PostMapping
@ApiOperation(value = "鎶ユ")
- public R<Boolean> insert(@RequestBody Report report) {
- report.setCtime(new Date());
- report.setStatus(0);
- //TODO 鍔ㄦ�佽幏鍙栧綋鍓嶇殑鐢ㄦ埛id
- report.setUserId(1);
- return R.ok(reportService.save(report));
+ public R<Boolean> insert(@RequestBody AddReportDto addReportDto) {
+
+ return R.ok(reportService.addReport(addReportDto));
}
/**
@@ -86,7 +88,7 @@
return R.ok(reportService.audit(report));
}
- @ApiOperation(httpMethod = "PUT", value = "鎶ユ浜虹紪杈�")
+ @ApiOperation(httpMethod = "PUT", value = "妗堜欢鍙�-鎶ユ浜哄憳-缂栬緫")
@PutMapping("/updateReport")
@ApiResponse(message = "鎵ц鎴愬姛", code = 200)
public R updateReport(@RequestBody Report report) {
@@ -94,20 +96,36 @@
return R.ok();
}
- @ApiOperation(httpMethod = "DELETE", value = "鎶ユ浜轰汉鍛橀��缇�")
+ @ApiOperation(httpMethod = "DELETE", value = "妗堜欢鍙�-鎶ユ浜哄憳-閫�缇�")
@DeleteMapping("/leaveGroup")
@ApiResponse(message = "鎵ц鎴愬姛", code = 200)
- public R leaveGroup( @RequestParam(value = "id") Integer id,@RequestParam(value = "groupId") Integer groupId) {
- reportService.leaveGroup(id,groupId);
+ public R leaveGroup(@RequestParam(value = "id") Integer id, @RequestParam(value = "groupId") Integer groupId) {
+ reportService.leaveGroup(id, groupId);
return R.ok();
}
- @ApiOperation(httpMethod = "DELETE", value = "鍒犻櫎鎶ユ浜�")
+ @ApiOperation(httpMethod = "DELETE", value = "妗堜欢鍙�-鎶ユ浜哄憳-鍒犻櫎")
@DeleteMapping("/deleteReporter")
@ApiResponse(message = "鎵ц鎴愬姛", code = 200)
- public R deleteReporter( @RequestParam(value = "id") Integer id) {
+ public R deleteReporter(@RequestParam(value = "id") Integer id) {
reportService.removeById(id);
return R.ok();
}
+
+ @ApiOperation(httpMethod = "POST", value = "妗堜欢鍙�-鎶ユ浜哄憳-鎶ユ鏉愭枡瀵煎嚭")
+ @PostMapping("/exportReporter")
+ @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+ public void exportReport(@RequestParam(value = "id") Integer id, HttpServletResponse response) {
+ reportService.exportReporter(id, response);
+ }
+
+ @ApiOperation(httpMethod = "POST", value = "妗堜欢鍙�-鎶ユ浜哄憳-鎶ユ浜哄憳瀵煎叆")
+ @PostMapping("/upload")
+ @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+ @SneakyThrows
+ public R upload(@RequestParam(value = "multipartFile") MultipartFile multipartFile) {
+ reportService.loadFile(multipartFile);
+ return R.ok();
+ }
}
--
Gitblit v1.8.0