feiyu02
2025-09-17 8c15c9cc0d6474ed77e313258f9b09f7f2d6366e
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
package cn.flightfeather.supervision.lightshare.web
 
import cn.flightfeather.supervision.domain.ds1.entity.Mediafile
import cn.flightfeather.supervision.lightshare.service.MediafileService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
 
@Api(tags = ["MediafileController"], description = "多媒体文件API接口")
@RestController
@RequestMapping("/mediafile")
class MediafileController(val mediafileService: MediafileService) {
    @GetMapping
    fun getAll() = mediafileService.findAll()
 
    @PutMapping
    fun add(@RequestBody mediafile: Mediafile) = mediafileService.save(mediafile)
 
    @PostMapping
    fun update(@RequestBody mediafile: Mediafile) = mediafileService.update(mediafile)
 
    @GetMapping("/{id}")
    fun getById(@PathVariable id: String) = mediafileService.findOne(id)
 
    @ApiOperation("根据业务类型获取文件")
    @GetMapping("/{id}/{btid}")
    fun getBySubtaskId(
        @ApiParam("巡查id") @PathVariable id: String,
        @ApiParam("文件业务类型id", allowableValues = "") @PathVariable btid: String,
    ) = mediafileService.findBysubtaskbtid(id, btid)
 
    @ApiOperation("获取所有任意拍常规记录图片", notes = "通过巡查记录id或巡查任务id获取对应的所有任意拍图片,两个参数任选其一即可")
    @GetMapping("/routine")
    fun getRoutineRecord(
        @ApiParam("巡查记录id", required = false) @RequestParam(required = false) iGuid: String?,
        @ApiParam("巡查任务id", required = false) @RequestParam(required = false) stGuid: String?,
    ) = resPack { mediafileService.getRoutineRecord(iGuid, stGuid) }
 
    @DeleteMapping("/{id}")
    fun delete(@PathVariable id: String) = mediafileService.delete(id)
 
    @PostMapping("/add")
    fun addProblem(
        @RequestParam("mediafileVoList") mediafileVoList: String,
        @RequestPart("Photos") files: Array<MultipartFile>,
    ) {
        mediafileService.addMedifile(mediafileVoList, files)
    }
}