package com.njcn.device.pq.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.param.DeviceLogParam;
import com.njcn.device.pq.pojo.param.EventLogParam;
import com.njcn.device.pq.pojo.vo.DeviceLogVO;
import com.njcn.device.pq.pojo.vo.EventLogVO;
import com.njcn.device.pq.service.LogManageService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version 1.0.0
 * @author: chenchao
 * @date: 2022/05/26 16:08
 */
@Validated
@Slf4j
@RestController
@RequestMapping("/logManage")
@Api(tags = "日志管理")
@AllArgsConstructor
public class LogManageController extends BaseController {

    private final LogManageService deviceLogService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getEventLogData")
    @ApiOperation("暂降推送日志")
    @ApiImplicitParam(name = "eventLogParam", value = "查询终端日志信息", required = true)
    public HttpResult<Page<EventLogVO>> getEventLogData(@RequestBody @Validated EventLogParam eventLogParam){
        String methodDescribe = getMethodDescribe("getEventLogData");
        Page<EventLogVO> list = deviceLogService.getEventLogData(eventLogParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }



}
