/*
 * Author: Zev
 * 生成controller
 */
package com.tofly.gpsboot.controller.sign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tofly.common.core.entity.ResultRespone;
import com.tofly.gpsboot.controller.BaseController;
import com.tofly.gpsboot.service.sign.PdasignhisService;
import com.tofly.pojo.plan.Pdasignhis;
import com.tofly.pojo.plan.dto.PdasignhisDto;
import com.tofly.pojo.plan.vo.AttendanceReportVo;
import com.tofly.pojo.plan.vo.PdasignhisVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 上下班签到历史信息
 *
 * @author admin
 * @date Thu Mar 18 00:00:00 CST 2021
 */
@RestController
@RequestMapping("/pdasignhis")
@Api(tags="上下班签到历史信息")
public class PdasignhisController extends BaseController<Pdasignhis, PdasignhisVo> {
    @Autowired
    private PdasignhisService service;
    @Autowired
    public PdasignhisController(PdasignhisService service) {
        init(service);
    }

    @GetMapping("/page")
    @ApiOperation(value = "分页查询")
//    @ToFlyAppLog(title = "分页查询上下班签到历史信息")
    public ResultRespone<Page<PdasignhisVo>> getPdasignhisPage(Page page, @ModelAttribute PdasignhisDto parDto) {
        ResultRespone<Page<PdasignhisVo>> rest = new ResultRespone<>();
        Page<PdasignhisVo> buildPage = service.getPdaSignHisPage(page, parDto);
        rest.setResult(buildPage);
        return rest;
    }

    @GetMapping("/attendanceReport")
    @ApiOperation(value = "考勤报表")
//    @ToFlyAppLog(title = "考勤报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime", value = "开始时间（yyyy-MM-dd HH:mm:ss）", required = true, dataType = "String"),
            @ApiImplicitParam(name = "endTime", value = "结束时间（yyyy-MM-dd HH:mm:ss）", required = true, dataType = "String"),
            @ApiImplicitParam(name = "deptIds", value = "部门ID 多个用,隔开", required = true, dataType = "String"),
    })
    public ResultRespone<List<AttendanceReportVo>> attendanceReport(String startTime, String endTime, String deptIds) {
        return ResultRespone.success(service.attendanceReport(startTime, endTime, deptIds));
    }
}
