| | |
| | | package com.example.jz.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.api.ApiController; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.example.jz.dao.GroupDao; |
| | | import com.example.jz.dao.GroupUserDao; |
| | | import com.example.jz.dao.MessageDao; |
| | | import com.example.jz.dao.ReportDao; |
| | | 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.entity.Cause; |
| | | import com.example.jz.modle.entity.GroupUser; |
| | | import com.example.jz.modle.vo.NewCauseVo; |
| | | import com.example.jz.modle.vo.ReportListVo; |
| | | import com.example.jz.service.CauseService; |
| | | import com.example.jz.service.GroupService; |
| | | 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.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (Cause)表控制层 |
| | | * 案件表(Cause)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2022-07-11 16:55:40 |
| | | * @since 2022-07-13 11:52:57 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("cause") |
| | | @Api(tags = "案件区-案件录入") |
| | | public class CauseController extends ApiController { |
| | | /** |
| | | * 服务对象 |
| | | */ |
| | | @Resource |
| | | private CauseService causeService; |
| | | private ReportService reportService; |
| | | |
| | | /** |
| | | * 分页查询所有数据 |
| | | * |
| | | * @param page 分页对象 |
| | | * @param cause 查询实体 |
| | | * @return 所有数据 |
| | | */ |
| | | @GetMapping |
| | | public R selectAll(Page<Cause> page, Cause cause) { |
| | | return success(this.causeService.page(page, new QueryWrapper<>(cause))); |
| | | @Autowired |
| | | public void setReportService(ReportService reportService) { |
| | | this.reportService = reportService; |
| | | } |
| | | |
| | | /** |
| | | * 通过主键查询单条数据 |
| | | * |
| | | * @param id 主键 |
| | | * @return 单条数据 |
| | | */ |
| | | @GetMapping("{id}") |
| | | public R selectOne(@PathVariable Serializable id) { |
| | | return success(this.causeService.getById(id)); |
| | | @Autowired |
| | | public void setCauseService(CauseService causeService) { |
| | | this.causeService = causeService; |
| | | } |
| | | |
| | | /** |
| | | * 新增数据 |
| | | * |
| | | * @param cause 实体对象 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping |
| | | public R insert(@RequestBody Cause cause) { |
| | | return success(this.causeService.save(cause)); |
| | | |
| | | @ApiOperation(httpMethod = "POST", value = "案件台-案件录入-添加案件") |
| | | @PostMapping("/addCause") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R addCause(@RequestBody @Validated CauseDto causeDto) { |
| | | int count = causeService.count(new LambdaQueryWrapper<Cause>().eq(Cause::getName, causeDto.getName())); |
| | | if(count>0){ |
| | | return R.failed("该案件名已存在,请重新输入"); |
| | | } |
| | | causeService.addCause(causeDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改数据 |
| | | * |
| | | * @param cause 实体对象 |
| | | * @return 修改结果 |
| | | */ |
| | | @PutMapping |
| | | public R update(@RequestBody Cause cause) { |
| | | return success(this.causeService.updateById(cause)); |
| | | @ApiOperation(httpMethod = "PUT", value = "案件台-案件录入-修改案件") |
| | | @PutMapping("/updateCause") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R updateCause(@RequestBody @Validated CauseDto causeDto, Integer id) { |
| | | return R.ok(causeService.updateCause(causeDto, id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除数据 |
| | | * |
| | | * @param idList 主键结合 |
| | | * @return 删除结果 |
| | | */ |
| | | @DeleteMapping |
| | | public R delete(@RequestParam("idList") List<Long> idList) { |
| | | return success(this.causeService.removeByIds(idList)); |
| | | |
| | | @ApiOperation(httpMethod = "GET", value = "案件台-案件录入-案件录入列表") |
| | | @GetMapping("/getCauseList") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R getCauseList(String cause, Integer status, Integer size, Integer current) { |
| | | return R.ok(causeService.getCauserListByCondition(cause, status, size, current)); |
| | | } |
| | | |
| | | @GetMapping("/getVxCauseList") |
| | | @ApiOperation(httpMethod = "GET", value = "微信找案件") |
| | | public R<List<NewCauseVo>> getVxCauseList(@RequestParam String phone){ |
| | | List<NewCauseVo> res = causeService.getVxCauseList(phone); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | @ApiOperation(httpMethod = "GET", value = "案件台-案件录入-案件录入列表") |
| | | @GetMapping("/getCause") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R getCause(String cause, Integer status, Integer size, Integer current,Integer id) { |
| | | return R.ok(causeService.getCauserListByCondition(cause, status, size, current,id)); |
| | | } |
| | | @ApiOperation(httpMethod = "GET", value = "案件台-案件录入-负责人查询") |
| | | @GetMapping("/getManagerList") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | 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 = "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 causeId) { |
| | | return R.ok(reportService.getPageByGroupId(page, reportParamDto, causeId)); |
| | | } |
| | | |
| | | @ApiOperation(httpMethod = "POST", value = "添加人员") |
| | | @PostMapping("/addReporter") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R<Boolean> get(@RequestBody AddReportDto addReportDto) { |
| | | return R.ok(causeService.addReportPeople(addReportDto)); |
| | | } |
| | | |
| | | @ApiOperation(httpMethod = "GET", value = "获取案件的id和名称列表") |
| | | @GetMapping("/getCauseIdAndName") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R getCauseIdAndName() { |
| | | return R.ok(causeService.getCauseIdAndName()); |
| | | } |
| | | } |
| | | |