package com.bonus.app.controller;

import com.bonus.app.entity.PeopleInfoEntity;
import com.bonus.app.entity.StayPersonEntity;
import com.bonus.app.service.IStayPersonService;
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.bracelet.vo.ProjectVo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
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("/stayPerson/")
@Slf4j
public class StayPersonController extends BaseController{


    @Autowired
    private IStayPersonService service;

    /**
     * 查询现场人员列表
     * @param vo
     * @return
     */
    @GetMapping("getStayPersonList")
    @SysLog(title = "现场人员管理", businessType = OperaType.QUERY,  module = "基础管理->现场人员管理", details = "查询现场人员列表")
    public TableDataInfo getStayPersonList(@RequestBody ProjectVo vo) {
        startPage();
        List<StayPersonEntity> list = service.getStayPersonList(vo);
        return getDataTable(list);

    }

    /**
     * 切换时获取工程列表
     * @param proId
     * @return
     */
    @GetMapping("getProjectList/{proId}")
    @SysLog(title = "现场人员管理", businessType = OperaType.QUERY,  module = "基础管理->现场人员管理", details = "切换时获取工程列表")
    public AjaxResult getProjectList(@PathVariable Long proId) {
        return service.getProjectList(proId);
    }

    /**
     * 修改安全帽、马甲编号
     * @param vo
     * @return
     */
    @PostMapping("editCodeInfoList")
    @SysLog(title = "现场人员管理", businessType = OperaType.QUERY,  module = "基础管理->现场人员管理", details = "修改安全帽、马甲编号")
    public AjaxResult editCodeInfoList(@RequestBody ProjectVo vo) {
        return service.editCodeInfoList(vo);
    }

    /**
     * 单个人员进行人脸验证
     * @param vo
     * @return
     */
    @PostMapping("singleRecognition")
    @SysLog(title = "现场人员管理", businessType = OperaType.QUERY,  module = "基础管理->现场人员管理", details = "单个人员进行人脸验证")
    public AjaxResult singleRecognition(@RequestBody PeopleInfoEntity vo) { return service.singleRecognition(vo); }

    /**
     * 所有人员进行人脸验证
     * @param list
     * @return
     */
    @PostMapping("allRecognition")
    @SysLog(title = "现场人员管理", businessType = OperaType.QUERY,  module = "基础管理->现场人员管理", details = "所有人员进行人脸验证")
    public AjaxResult allRecognition(@RequestBody List<PeopleInfoEntity> list) {
        return service.allRecognition(list);
    }
}
