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 iGuid: String,
|
@ApiParam("文件业务类型id", allowableValues = "") @PathVariable btid: String,
|
) = mediafileService.findBysubtaskbtid(iGuid, 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)
|
}
|
}
|