From 1fb2cfb2bcb152bee03f8a332700241693cfd9b6 Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期二, 16 八月 2022 13:37:00 +0800
Subject: [PATCH] bug处理
---
src/main/java/com/example/jz/controller/CauseController.java | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/example/jz/controller/CauseController.java b/src/main/java/com/example/jz/controller/CauseController.java
index 55f3170..2a4ce10 100644
--- a/src/main/java/com/example/jz/controller/CauseController.java
+++ b/src/main/java/com/example/jz/controller/CauseController.java
@@ -16,6 +16,7 @@
import io.swagger.annotations.ApiResponse;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -52,7 +53,7 @@
@ApiOperation(httpMethod = "POST", value = "妗堜欢鍙�-妗堜欢褰曞叆-娣诲姞妗堜欢")
@PostMapping("/addCause")
@ApiResponse(message = "鎵ц鎴愬姛", code = 200)
- public R addCause(@RequestBody CauseDto causeDto) {
+ public R addCause(@RequestBody @Validated CauseDto causeDto) {
causeService.addCause(causeDto);
return R.ok();
}
@@ -60,7 +61,7 @@
@ApiOperation(httpMethod = "PUT", value = "妗堜欢鍙�-妗堜欢褰曞叆-淇敼妗堜欢")
@PutMapping("/updateCause")
@ApiResponse(message = "鎵ц鎴愬姛", code = 200)
- public R updateCause(@RequestBody CauseDto causeDto, Integer id) {
+ public R updateCause(@RequestBody @Validated CauseDto causeDto, Integer id) {
return R.ok(causeService.updateCause(causeDto, id));
}
@@ -110,26 +111,26 @@
return R.ok();
}
+ @ApiOperation(httpMethod = "POST", value = "妗堜欢鍙�-妗堜欢褰曞叆-鎶ユ浜哄憳-鎶ユ浜哄厓瀵煎叆")
+ @PostMapping("/reporterUpload")
+ @ApiResponse(message = "鎵ц鎴愬姛", code = 200)
+ @SneakyThrows
+ public R uploadReporter(@RequestParam(value = "multipartFile") MultipartFile multipartFile,Integer causeId) {
+ causeService.loadFileReport(multipartFile,causeId);
+ return R.ok();
+ }
+
@ApiOperation(httpMethod = "GET", value = "鏍规嵁缇ょ粍id鏌ヨ妗堜欢鍒嗛〉")
@GetMapping("/getAllReportList")
@ApiResponse(message = "鎵ц鎴愬姛", code = 200)
- public R<IPage<ReportListVo>> get(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer groupId) {
- return R.ok(reportService.getPageByGroupId(page, reportParamDto, groupId));
+ public R<IPage<ReportListVo>> get(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer causeId) {
+ return R.ok(reportService.getPageByGroupId(page, reportParamDto, causeId));
}
@ApiOperation(httpMethod = "POST", value = "娣诲姞浜哄憳")
@PostMapping("/addReporter")
@ApiResponse(message = "鎵ц鎴愬姛", code = 200)
- public R<Boolean> get(AddReportDto addReportDto) {
- if (addReportDto.getReporterName() == null || addReportDto.getReporterName().equals("")) {
- return R.failed("鎶ユ浜哄憳涓嶈兘涓虹┖");
- }
- if (addReportDto.getMobile() == null || addReportDto.getMobile().equals("")) {
- return R.failed("鎶ユ浜哄憳鐢佃瘽涓嶈兘涓虹┖");
- }
- if (addReportDto.getIdcard() == null || addReportDto.getIdcard().equals("")) {
- return R.failed("鎶ユ浜哄憳韬唤璇佷笉鑳戒负绌�");
- }
+ public R<Boolean> get(@RequestBody AddReportDto addReportDto) {
return R.ok(causeService.addReportPeople(addReportDto));
}
--
Gitblit v1.8.0