From caaa6ec6ee809b1c9e56600ba1468e8f4da0103b Mon Sep 17 00:00:00 2001 From: whj <1070107765@qq.com> Date: 星期二, 19 七月 2022 15:39:15 +0800 Subject: [PATCH] commit --- src/main/java/com/example/jz/controller/CauseController.java | 88 +++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 82 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/example/jz/controller/CauseController.java b/src/main/java/com/example/jz/controller/CauseController.java index 43fe51b..a5cde56 100644 --- a/src/main/java/com/example/jz/controller/CauseController.java +++ b/src/main/java/com/example/jz/controller/CauseController.java @@ -1,14 +1,23 @@ 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.CauseDto; +import com.example.jz.modle.dto.ReportParamDto; +import com.example.jz.modle.vo.ReportListVo; import com.example.jz.service.CauseService; +import com.example.jz.service.ReportService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; +import lombok.SneakyThrows; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; @@ -20,26 +29,39 @@ */ @RestController @RequestMapping("cause") -@Api(tags = "妗堜欢鍖�") +@Api(tags = "妗堜欢鍖�-妗堜欢褰曞叆") public class CauseController extends ApiController { /** * 鏈嶅姟瀵硅薄 */ @Resource private CauseService causeService; + private ReportService reportService; + + @Autowired + public void setReportService(ReportService reportService) { + this.reportService = reportService; + } + + @Autowired + public void setCauseService(CauseService causeService) { + this.causeService = causeService; + } + @ApiOperation(httpMethod = "POST", value = "娣诲姞妗堜欢") @PostMapping("/addCause") @ApiResponse(message = "鎵ц鎴愬姛", code = 200) public R addCause(@RequestBody CauseDto causeDto) { - return R.ok(causeService.addCause(causeDto)); + causeService.addCause(causeDto); + return R.ok(); } - @ApiOperation(httpMethod = "POST", value = "淇敼妗堜欢") - @PostMapping("/updateCause") + @ApiOperation(httpMethod = "PUT", value = "淇敼妗堜欢") + @PutMapping("/updateCause") @ApiResponse(message = "鎵ц鎴愬姛", code = 200) - public R updateCause(@RequestBody CauseDto causeDto,Integer id) { - return R.ok(causeService.updateCause(causeDto,id)); + public R updateCause(@RequestBody CauseDto causeDto, Integer id) { + return R.ok(causeService.updateCause(causeDto, id)); } @@ -56,5 +78,59 @@ public R getManagerList() { return R.ok(causeService.getManagerList()); } + + @ApiOperation(httpMethod = "GET", value = "鑾峰彇鎶ユ浜哄憳") + @GetMapping("/getReporterList") + @ApiResponse(message = "鎵ц鎴愬姛", code = 200) + public R getReporterList(Integer causeId) { + return R.ok(causeService.getReporterList(causeId)); + } + + @ApiOperation(httpMethod = "GET", value = "鑾峰彇妗堜欢缇ゅ叕鍛�") + @GetMapping("/getGroupAnnouncement") + @ApiResponse(message = "鎵ц鎴愬姛", code = 200) + public R getGroupAnnouncement(Integer groupId) { + return R.ok(causeService.getGroupAnnouncement(groupId)); + } + + @ApiOperation(httpMethod = "DELETE", value = "妗堜欢鍒犻櫎") + @DeleteMapping("/deleteCause") + @ApiResponse(message = "鎵ц鎴愬姛", code = 200) + public R deleteCause(@RequestParam(value = "id") Integer id) { + causeService.deleteCause(id); + return R.ok(); + } + + @ApiOperation(httpMethod = "POST", value = "妗堜欢瀵煎叆") + @PostMapping("/upload") + @ApiResponse(message = "鎵ц鎴愬姛", code = 200) + @SneakyThrows + public R upload(@RequestParam(value = "multipartFile") MultipartFile multipartFile) { + causeService.loadFile(multipartFile); + 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)); + } + + @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("鎶ユ浜哄憳韬唤璇佷笉鑳戒负绌�"); + } + return R.ok(causeService.addReportPeople(addReportDto)); + } } -- Gitblit v1.8.0