feiyu02
2024-08-15 196bb14112448857a885e32dc4149e308e00b01a
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
package cn.flightfeather.supervision.lightshare.web
 
import cn.flightfeather.supervision.domain.entity.Company
import cn.flightfeather.supervision.domain.entity.PersonalInfo
import cn.flightfeather.supervision.domain.entity.SelfPatrolTask
import cn.flightfeather.supervision.lightshare.service.AuthService
import cn.flightfeather.supervision.lightshare.service.SelfPatrolService
import cn.flightfeather.supervision.lightshare.vo.AuthSceneVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.format.annotation.DateTimeFormat
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
import java.util.*
 
@Api(tags = ["应急自巡查相关API接口"])
@RestController
@RequestMapping("/selfPatrol")
class SelfPatrolController(val selfPatrolService: SelfPatrolService) {
 
    @ApiOperation(value = "获取自巡查类型")
    @GetMapping("/type")
    fun getPatrolType(
        @ApiParam("场景类型id") @RequestParam(value = "sceneType") sceneType: Int
    ) = selfPatrolService.getPatrolType(sceneType)
 
    @ApiOperation(value = "发布应急自巡查任务")
    @PostMapping("/publish")
    fun publishTask(
        @ApiParam("自巡查任务") @RequestBody tasks: List<SelfPatrolTask>,
    ) = selfPatrolService.publishTask(tasks)
 
    @ApiOperation(value = "获取该用户发布的自寻查任务")
    @GetMapping("/task/published")
    fun getPublishedTask(
        @ApiParam("发布人id") @RequestParam("userId") userId: String,
        @ApiParam("发布时间") @RequestParam(value = "date", required = false) date: String?,
    ) = selfPatrolService.getPublishedTask(userId, date)
 
    @ApiOperation(value = "获取发布给该用户的自巡查任务")
    @GetMapping("/task/uploaded")
    fun getToTask(
        @ApiParam("接收人id") @RequestParam("userId") userId: String,
        @ApiParam("发布时间") @RequestParam(value = "date", required = false) date: String?,
    ) = selfPatrolService.getToTask(userId, date)
 
    @ApiOperation(value = "获取自巡查任务的上传记录")
    @GetMapping("/task/record")
    fun getTaskRecord(
        @ApiParam("任务id") @RequestParam("taskId") taskId: String,
    ) = selfPatrolService.getTaskRecord(taskId)
 
    @ApiOperation(value = "上传自巡查信息")
    @PostMapping("/task/record/upload")
    fun uploadSelfPatrol(
        @ApiParam("用户id") @RequestParam userId: String,
        @ApiParam("应急自巡查任务id") @RequestParam(required = false) taskId: String?,
        @ApiParam("自巡查信息json") @RequestParam("params") list: String,
        @ApiParam("自巡查图片") @RequestPart("images") files: Array<MultipartFile>,
    ) = selfPatrolService.uploadSelfPatrol(userId, taskId, list, files)
 
    @ApiOperation("上传不涉及自巡查")
    @PostMapping("/task/record/upload/noInvolved")
    fun uploadNoSelfPatrol(
        @RequestParam("userId") userId: String,
        @ApiParam("应急自巡查任务id") @RequestParam(required = false) taskId: String?,
        @RequestParam("time") time: String,
        @RequestParam(required = false) remark: String?,
        @RequestBody idList: List<Int>,
    ) = selfPatrolService.uploadNoSelfPatrol(userId, taskId, time, remark, idList)
 
    @ApiOperation(value = "获取用户某类自巡查详情")
    @GetMapping("/record/detail")
    fun getDetail(
        @ApiParam("用户id") @RequestParam userId: String,
        @ApiParam(value = "自巡查子类型id") @RequestParam subTypeId: Int,
        @ApiParam(value = "自寻查任务id") @RequestParam taskId: String,
    ) = selfPatrolService.getDetail(userId, subTypeId, taskId)
 
    @ApiOperation(value = "获取某自巡查任务的详情")
    @GetMapping("/record/details")
    fun getDetailList(
        @ApiParam(value = "自寻查任务id") @RequestParam taskId: String,
    ) = selfPatrolService.getDetailList(taskId)
}