青羊经侦大队-数据平台
whj
2022-07-19 caaa6ec6ee809b1c9e56600ba1468e8f4da0103b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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;
 
/**
 * 案件表(Cause)表控制层
 *
 * @author makejava
 * @since 2022-07-13 11:52:57
 */
@RestController
@RequestMapping("cause")
@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) {
        causeService.addCause(causeDto);
        return R.ok();
    }
 
    @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));
    }
 
 
    @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));
    }
 
    @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 = "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));
    }
}