package com.engine.attendance.component.persongroup.web;

import com.engine.attendance.component.persongroup.service.SchedulingResultsService;
import com.engine.attendance.component.persongroup.service.impl.SchedulingResultsServiceImpl;
import com.engine.common.util.ApiReturnTools;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import lombok.extern.slf4j.Slf4j;

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;
@Slf4j
public class SchedulingResultsAction {

    private SchedulingResultsService basicsetService = ServiceUtil.getService(SchedulingResultsServiceImpl.class);
    /**
     * 获得排班结果列表查询
     * @return
     */
    @POST
    @Path("/getSchedulingData")
    @Produces({"text/plain"})
    public String getSchedulingData(@Context HttpServletRequest request, @Context HttpServletResponse response) {
        try {
            Map<String,Object> paramMap = ParamUtil.request2Map(request);
            Map<String,Object> dataMap = basicsetService.queryDataTable(paramMap);
            return ApiReturnTools.success(dataMap);
        }catch (Exception e){
            log.error("execute fail,catch error: [{}]",e);
            return ApiReturnTools.error("500","saveApplicableOrganization error");
        }
    }
}
