riku
2022-06-09 9867f6d5c5bccfe52b878c344c536905dd6b309e
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/NotificationController.kt
@@ -5,6 +5,7 @@
import cn.flightfeather.supervision.lightshare.vo.NotificationVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
import javax.servlet.http.HttpServletResponse
@@ -16,35 +17,35 @@
    @ApiOperation(value = "获取用户未读通知")
    @GetMapping
    fun getNotificationUnRead(
            @RequestParam(value = "userId") userId: String,
            @RequestParam(value = "page") page: Int,
            @RequestParam(value = "per_page") perPage: Int,
        @ApiParam("用户id") @RequestParam(value = "userId") userId: String,
        @ApiParam("页码") @RequestParam(value = "page") page: Int,
        @ApiParam("单页数据量") @RequestParam(value = "per_page") perPage: Int,
            response: HttpServletResponse
    ) = notificationService.getNotificationUnRead(userId, page, perPage, response)
    @ApiOperation(value = "更新通知读取状态")
    @PostMapping("/{userId}/readState")
    fun updateReadState(
            @PathVariable("userId") userId: String,
            @RequestBody readStates: List<NoticeReadStateVo>
        @ApiParam("用户id") @PathVariable("userId") userId: String,
        @ApiParam("通知读取状态") @RequestBody readStates: List<NoticeReadStateVo>
    ) = notificationService.updateReadState(userId, readStates)
    @ApiOperation(value = "获取通知长文本内容")
    @GetMapping("/text")
    fun getNotificationText(
            @RequestParam(value = "id") notificationId: String
        @ApiParam("通知id") @RequestParam(value = "id") notificationId: String
    ) = notificationService.getNotificationText(notificationId)
    @ApiOperation(value = "获取总未读通知数量")
    @GetMapping("/{userId}/unread")
    fun getUnReadNoticeNum(
            @PathVariable("userId") userId: String
        @ApiParam("用户id") @PathVariable("userId") userId: String
    ) = notificationService.getUnReadNoticeNum(userId)
    @ApiOperation(value = "发布通知")
    @PostMapping("{userId}/release")
    fun releaseNotice(
            @PathVariable("userId") userId: String,
            @RequestBody notice: NotificationVo
        @ApiParam("用户id") @PathVariable("userId") userId: String,
        @ApiParam("通知") @RequestBody notice: NotificationVo
    ) = notificationService.releaseNotice(userId, notice)
}