package com.engine.attendance.attendanceplan.web;

import com.engine.attendance.attendanceplan.service.AttendancePlanService;
import com.engine.attendance.attendanceplan.service.impl.AttendancePlanServiceImpl;
import com.engine.common.util.ApiReturnTools;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import java.util.Map;

public class AttendancePlanAction {
    private AttendancePlanService basicsetService = ServiceUtil.getService(AttendancePlanServiceImpl.class);
    /**
     * 根据人员查询考勤项目
     * @return
     */
    @POST
    @Path("/getAttendanceItemsByPerson")
    @Produces({"text/plain"})
    public String getAttendanceItemsByPerson(@Context HttpServletRequest request, @Context HttpServletResponse response) {
        Map<String,Object> paramMap = ParamUtil.request2Map(request);
        Map<String,Object> dataMap = basicsetService.getAttendanceItemsByPerson(paramMap);
        return ApiReturnTools.success(dataMap);
    }
    /**
     * 根据人员查询综合工时
     * @return
     */
    @POST
    @Path("/getWorkHoursItemByPerson")
    @Produces({"text/plain"})
    public String getWorkHoursItemByPerson(@Context HttpServletRequest request, @Context HttpServletResponse response) {
        Map<String,Object> paramMap = ParamUtil.request2Map(request);
        Map<String,Object> dataMap = basicsetService.getWorkHoursItemByPerson(paramMap);
        return ApiReturnTools.success(dataMap);
    }
}
