package com.bonus.app.controller;

import com.bonus.app.entity.DeviceWarnEntity;
import com.bonus.app.entity.StayPersonEntity;
import com.bonus.app.entity.ViolationInfoEntity;
import com.bonus.app.service.IStayPersonService;
import com.bonus.app.service.IWarnReminderService;
import com.bonus.common.core.constant.BusinessConstants;
import com.bonus.common.core.text.Convert;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.entity.app.vo.SafetyHatVo;
import com.bonus.common.entity.bracelet.vo.ProjectVo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 现场人员管理模块
 * APP
 */
@RestController
@RequestMapping("/warnReminder/")
@Slf4j
public class WarnReminderController extends BaseController{


    @Autowired
    private IWarnReminderService service;

    /**
     * 查询预警提醒 设备预警列表
     * @param vo
     * @return
     */
    @GetMapping("getDeviceWarnList")
    @SysLog(title = "预警提醒管理", businessType = OperaType.QUERY,  module = "基础管理->预警提醒管理", details = "查询预警提醒设备预警列表")
    public AjaxResult getDeviceWarnList(DeviceWarnEntity vo) {
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(BusinessConstants.PAGE_NUM), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(BusinessConstants.PAGE_SIZE), 10);
        PageHelper.startPage(pageNum, pageSize);
        PageInfo<DeviceWarnEntity> pageInfo = service.getDeviceWarnList(vo.getProId());
        return AjaxResult.success(pageInfo.getList());
    }


    /**
     * 查询预警提醒 违章识别列表
     * @param vo
     * @return
     */
    @GetMapping("getViolationInfoList")
    @SysLog(title = "预警提醒管理", businessType = OperaType.QUERY,  module = "基础管理->预警提醒管理", details = "查询预警提醒违章识别列表")
    public AjaxResult getViolationInfoList(ViolationInfoEntity vo) {
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(BusinessConstants.PAGE_NUM), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(BusinessConstants.PAGE_SIZE), 10);
        PageHelper.startPage(pageNum, pageSize);
        PageInfo<ViolationInfoEntity> pageInfo = service.getViolationInfoList(vo.getProId());
        return AjaxResult.success(pageInfo.getList());
    }

}
