package cn.flightfeather.supervision.lightshare.web
|
|
import cn.flightfeather.supervision.lightshare.service.LedgerService
|
import cn.flightfeather.supervision.lightshare.vo.CopyLedgerVo
|
import cn.flightfeather.supervision.lightshare.vo.LedgerCheckVo
|
import cn.flightfeather.supervision.lightshare.vo.LedgerVo
|
import io.swagger.annotations.Api
|
import io.swagger.annotations.ApiOperation
|
import io.swagger.annotations.ApiParam
|
import org.springframework.http.client.MultipartBodyBuilder
|
import org.springframework.web.bind.annotation.*
|
import org.springframework.web.multipart.MultipartFile
|
import org.synchronoss.cloud.nio.multipart.Multipart
|
import springfox.documentation.annotations.ApiIgnore
|
import javax.servlet.http.HttpServletResponse
|
|
@Api(tags = ["台账API接口"])
|
@RestController
|
@RequestMapping("/ledger")
|
class LedgerController(val ledgerService: LedgerService) {
|
|
@ApiOperation(value = "获取台账类型")
|
@GetMapping("/type")
|
fun getLedgerType(
|
@ApiParam("场景类型id") @RequestParam(value = "sceneType") sceneType: Int
|
) = ledgerService.getLedgerType(sceneType)
|
|
@ApiOperation(value = "获取用户某个时间点下应该提交的所有台账及对应的提交状态、审核状态等信息")
|
@GetMapping("/{userId}/summary")
|
fun getUserLedgerSummary(
|
@ApiParam("用户id") @PathVariable userId: String,
|
@ApiParam("场景类型id") @RequestParam(value = "sceneType") sceneType: Int,
|
@ApiParam(value = "时间", example = "yyyy-MM-dd") @RequestParam(value = "time")time: String
|
) = ledgerService.getUserLedgerSummary(userId, sceneType, time)
|
|
@ApiOperation(value = "获取台账详情")
|
@GetMapping("/{userId}/detail")
|
fun getLedgerDetail(
|
@ApiParam("用户id") @PathVariable userId: String,
|
@ApiParam("台账类型id") @RequestParam(value = "ledgerSubTypeId", required = false) ledgerSubTypeId: Int?,
|
@ApiParam("场景类型id") @RequestParam(value = "sceneType") sceneType: Int,
|
@ApiParam("上传开始时间") @RequestParam(value = "startTime") startTime: String,
|
@ApiParam("上传结束时间") @RequestParam(value = "endTime") endTime: String,
|
@ApiParam("页码") @RequestParam(value = "page", required = false) page: Int?,
|
@ApiParam("单页数据量") @RequestParam(value = "per_page") perPage: Int,
|
response: HttpServletResponse
|
) = ledgerService.getLedgerDetail(userId, ledgerSubTypeId, sceneType, startTime, endTime, page, perPage, response)
|
|
@ApiOperation(value = "获取用户某类台账详情或者所有台账的详情")
|
@GetMapping("/{userId}/detail2")
|
fun getLedgerDetail2(
|
@ApiParam("用户id") @PathVariable userId: String,
|
@ApiParam(value = "台账子类型id, 如果不传,则默认根据场景类型获取所有台账", required = false) @RequestParam(value = "ledgerSubTypeId", required = false) ledgerSubTypeId: Int?,
|
@ApiParam("场景类型id") @RequestParam(value = "sceneType") sceneType: Int,
|
@ApiParam(value = "时间", example = "yyyy-MM-dd") @RequestParam(value = "time", required = false) time: String?
|
) = ledgerService.getLedgerDetail2(userId, ledgerSubTypeId, sceneType, time)
|
|
@ApiOperation(value = "上传台账信息")
|
@PostMapping("/{userId}/upload")
|
fun uploadLedger(
|
@ApiParam("用户id") @PathVariable userId: String,
|
@ApiParam("台账信息json") @RequestParam("params") ledgerVoList: String,
|
@ApiParam("台账图片") @RequestPart("images") files:Array<MultipartFile>
|
) = ledgerService.uploadLedger(userId, ledgerVoList, files)
|
|
@ApiOperation("上传不涉及台账")
|
@PostMapping("/upload/noLedger")
|
fun uploadNoLedger(
|
@RequestParam("userId") userId: String,
|
@RequestParam("time") time: String,
|
@RequestParam(required = false) remark: String?,
|
@RequestBody ledgerIdList: List<Int>
|
) = ledgerService.uploadNoLedger(userId, time, remark, ledgerIdList)
|
|
@ApiOperation(value = "获取某个台账显示图标url")
|
@GetMapping("/{userId}/img")
|
fun getLedgerImg(
|
@ApiParam("用户id") @PathVariable userId: String,
|
@ApiParam("台账类型id") @RequestParam("ledgerType") ledgerType: Int
|
) = ledgerService.getLedgerImg(userId, ledgerType)
|
|
@ApiIgnore("该接口未使用,考虑后续删除")
|
@ApiOperation(value = "获取多个台账图标信息")
|
@GetMapping("/{userId}/imgs")
|
fun getLedgerImgs(
|
@ApiParam("用户id") @PathVariable userId: String,
|
@ApiParam("台账类型id数组") @RequestParam("ledgerTypes") ledgerTypes: List<Int>
|
) = ledgerService.getLedgerImgs(userId, ledgerTypes)
|
|
@ApiOperation("复制场景的台账")
|
@PostMapping("/copy")
|
fun copyLedger(
|
@RequestParam("userId") userId: String,
|
@RequestParam("time") time: String,
|
@RequestBody copyLedgerList: List<CopyLedgerVo>
|
) = ledgerService.copyLedger(userId, time, copyLedgerList)
|
|
@ApiOperation("审核台账")
|
@PostMapping("/check")
|
fun checkLedger(
|
@RequestParam("verifierId") verifierId: String,
|
@RequestParam(value = "remark", required = false) remark: String?,
|
@RequestBody recordList: List<LedgerCheckVo>
|
) = ledgerService.checkLedger(verifierId, remark, recordList)
|
}
|