package com.engine.attendance.vacation.web;


import com.engine.attendance.vacation.service.VocationService;
import com.engine.attendance.vacation.service.impl.VocationServiceImpl;
import com.engine.common.util.ApiReturnTools;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.common.util.Utils;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
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 VocationAction {


    private VocationService vocationService = ServiceUtil.getService(VocationServiceImpl.class);

    /**
     * tableName  表名
     * columns    查询的列名
     * conditions 查询条件
     * orderby 排序及limit
     * @return
     */
    @GET
    @Path("/generateVocation")
    @Produces({"text/plain"})
    public String generateVocation(@Context HttpServletRequest request, @Context HttpServletResponse response) {
        try {
            Map<String,Object> paramMap = ParamUtil.request2Map(request);
            Map<String,String> formmodeIdMap = Utils.getFormmodeIdMap();
            //假期额度模块id
            String modeId = formmodeIdMap.get("uf_jcl_kq_jqed");
            paramMap.put("modeId",modeId);
            vocationService.generateVocation(paramMap);
            return ApiReturnTools.success(Maps.newHashMap());
        }catch (Exception e){
            log.error("sync fund status fail,catch error: [{}]",e);
            return ApiReturnTools.error("200","查询失败");
        }
    }




}
