| | |
| | | |
| | | |
| | | 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.plugins.pagination.Page; |
| | |
| | | import com.example.jz.modle.entity.GroupUser; |
| | | import com.example.jz.modle.entity.Message; |
| | | import com.example.jz.modle.entity.Report; |
| | | import com.example.jz.modle.entity.User; |
| | | import com.example.jz.modle.vo.ReportListVo; |
| | | import com.example.jz.modle.vo.ReportVXVO; |
| | | import com.example.jz.service.GroupUserService; |
| | | import com.example.jz.service.MessageService; |
| | | import com.example.jz.service.ReportService; |
| | | import com.example.jz.service.UserService; |
| | | 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.transaction.annotation.Transactional; |
| | | 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.Map; |
| | | |
| | | /** |
| | | * 报案表(Report)表控制层 |
| | |
| | | GroupUserService groupUserService; |
| | | @Resource |
| | | MessageService messageService; |
| | | @Autowired |
| | | UserService userService; |
| | | |
| | | /** |
| | | * 分页查询所有数据 |
| | |
| | | return R.ok(reportService.getReportListVoById(id)); |
| | | } |
| | | |
| | | @GetMapping("/rejectReport/{id}") |
| | | @ApiOperation(value = "修改驳回后接口") |
| | | public R<ReportVXVO> getOne(@PathVariable Integer id){ |
| | | ReportVXVO res = reportService.getRejectReportById(id); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | /** |
| | | * 报案 |
| | | * |
| | |
| | | return R.ok(reportService.audit(report)); |
| | | } |
| | | |
| | | @PostMapping("/reject") |
| | | @ApiOperation(value = "驳回") |
| | | public R<Boolean> reject(@RequestBody Map map) { |
| | | return R.ok(reportService.reject((Integer) map.get("id"), (String) map.get("reason"))); |
| | | } |
| | | |
| | | @ApiOperation(httpMethod = "PUT", value = "案件台-报案人员-编辑") |
| | | @PutMapping("/updateReport") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R updateReport(@RequestBody Report report) { |
| | | report.setPic(null); |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R updateReport(@RequestBody AddReportDto report) { |
| | | Integer causeId = report.getCauseId(); |
| | | if(causeId==null){ |
| | | return R.failed("关联案件不能为空"); |
| | | } |
| | | int imgIndexFirst = report.getPic().indexOf("/img"); |
| | | int imgIndexEnd = report.getPic().length(); |
| | | if(report.getPic().indexOf("?") != -1){ |
| | | imgIndexEnd = report.getPic().indexOf("?"); |
| | | } |
| | | String pic = report.getPic().substring(imgIndexFirst + 5, imgIndexEnd); |
| | | report.setPic(pic); |
| | | reportService.updateById(report); |
| | | Report one = reportService.getOne(new LambdaQueryWrapper<Report>().eq(Report::getId, report.getId())); |
| | | User user = new User(); |
| | | user.setRealName(report.getReporterName()); |
| | | user.setUserIdcard(report.getIdcard()); |
| | | user.setUserMobile(report.getMobile()); |
| | | user.setPic(pic); |
| | | user.setId(one.getUserId()); |
| | | userService.updateById(user); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(httpMethod = "POST", value = "案件台-报案人员-报案材料导出") |
| | | @PostMapping("/exportReporter") |
| | | @ApiOperation(httpMethod = "POST", value = "案件台-案件录入-报案人员-报案人元导入") |
| | | @PostMapping("/reporterUpload") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public void exportReport(@RequestParam(value = "id") Integer id, HttpServletResponse response) { |
| | | reportService.exportReporter(id, response); |
| | | @SneakyThrows |
| | | public R uploadReporter(@RequestParam(value = "multipartFile") MultipartFile multipartFile, Integer causeId) { |
| | | reportService.loadFileReport(multipartFile,causeId); |
| | | 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); |
| | | // } |
| | | } |
| | | |