whycxzp
2023-08-19 ee63d3cabbfadf9f3a5e45f05764aa97d187ee0f
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
package com.whyc.controller;
 
import com.whyc.dto.Response;
import com.whyc.pojo.FaultUpload;
import com.whyc.service.FaultUploadService;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RequestMapping("faultUpload")
@RestController
@Api(tags = "项目考核-故障隐患上报")
public class FaultUploadController {
 
    @Autowired
    private FaultUploadService service;
 
    /**
     *  需要校验,只能上传未上传过 或者 上传已被拒绝的 记录
     */
    @PostMapping
    @ApiOperation("上传,走审批流程")
    public Response add(@RequestBody FaultUpload fault){
        return service.add(fault);
    }
 
    @PutMapping("confirm")
    @ApiOperation(value = "确认",notes = "属性status:-1-确认不属实,1-确认属实")
    public Response updateConfirm(@RequestBody FaultUpload fault){
        return service.updateConfirm(fault);
    }
 
    @PostMapping("listPage")
    @ApiOperation(value = "列表分页-组内",notes = "包机组内成员可见")
    public Response listPage(@RequestParam int pageNum,@RequestParam int pageSize,
                             @RequestBody FaultUpload upload){
        int userId = ActionUtil.getUser().getUId().intValue();
        return service.listPage(pageNum, pageSize,upload,userId);
    }
 
    @GetMapping("typeCount")
    @ApiOperation(value = "隐患故障上报类型统计",notes = "timeType:不传-所有,1-本月,2-本季度,3-本年")
    public Response getTypeCount(@RequestParam(required = false) Integer timeType){
        int userId = ActionUtil.getUser().getUId().intValue();
        return service.getTypeCount(timeType,userId);
    }
 
    @PostMapping("listPage2")
    @ApiOperation(value = "列表分页-管理")
    public Response listPage2(@RequestParam int pageNum,@RequestParam int pageSize,
                              @RequestBody FaultUpload upload){
        int userId = ActionUtil.getUser().getUId().intValue();
        return service.listPage2(pageNum, pageSize,upload,userId);
    }
 
    @GetMapping("groupNameCount")
    @ApiOperation(value = "隐患故障上报统计-管理",notes = "timeType:1-本月,2-本季度,3-本年")
    public Response groupNameCount(@RequestParam int timeType){
        int userId = ActionUtil.getUser().getUId().intValue();
        return service.groupNameCount(timeType,userId);
    }
 
    @GetMapping("listOfLastPeriod")
    @ApiOperation(value = "隐患故障上报进度-最近一周及最近一月-管理",notes = "type:1-最近一周,2-最近一月")
    public Response getListOfLastPeriod(int type){
        int userId = ActionUtil.getUser().getUId().intValue();
        return service.getListOfLastPeriod(type,userId);
    }
 
    @GetMapping("myUploadStatusCount")
    @ApiOperation(value = "我的隐患故障上报状态数量统计")
    public Response getMyUploadStatusCount(){
        int userId = ActionUtil.getUser().getUId().intValue();
        return service.getMyUploadStatusCount(userId);
    }
 
}