package com.engine.htsc.GwRelated.fzjg.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.GwRelated.fzjg.Service.FzjgfwBaseService;
import com.engine.htsc.GwRelated.fzjg.Service.imp.FzjgfwBaseServiceimp;
import com.engine.htsc.ReimbursementFlow.Service.Impl.GettravlapplctionServiceImpl;
import com.engine.htsc.itlxlc.service.ItlxlcService;
import com.engine.htsc.itlxlc.service.impl.ItlxlcServiceImpl;
import com.weaver.general.Util;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.interfaces.htsc.GlobatTools.JAVATools;
import weaver.interfaces.htsc.comInfo.PropBean;

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 javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;

/**
 * @author xf
 * @version 1.0.0
 * @ClassName Fzjgaction.java
 * @createTime 2021年11月17日 10:58:00
 */
public class Fzjgaction {


    public FzjgfwBaseService getService(HttpServletRequest request, HttpServletResponse response) {
//        User user = HrmUserVarify.getUser( request, response );
//        return  (FzjgfwBaseServiceimp) ServiceUtil.getService(FzjgfwBaseServiceimp.class,user);
//    }
        return ServiceUtil.getService(FzjgfwBaseServiceimp.class);
    }
    @POST
    @Path("/getfqxtypevalue")
    @Produces({MediaType.TEXT_PLAIN})
    public String getfqxtypevalue(@Context HttpServletRequest request, @Context HttpServletResponse response) {

        try {
            User user = HrmUserVarify.getUser( request, response );
            Map<String,Object> param = ParamUtil.request2Map(request);
            JSONObject jsonObject = getService(request,response).getfqxtype(param,user);
            if(jsonObject==null || jsonObject.size()<=0){
                return  JAVATools.Apiretrun("400","error");
            }
            return  JAVATools.Apiretrun("200",jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  JAVATools.Apiretrun("400","error");

    }


    @POST
    @Path("/getfzjggwadmin")
    @Produces({MediaType.TEXT_PLAIN})
    public String getfzjggwadmin(@Context HttpServletRequest request, @Context HttpServletResponse response) {

        try {
            User user = HrmUserVarify.getUser( request, response );
            Map<String,Object> param = ParamUtil.request2Map(request);
            JSONObject jsonObject = getService(request,response).getfzjggwadmin(param,user);
            if(jsonObject==null || jsonObject.size()<=0){
                return  JAVATools.Apiretrun("400","error");
            }
            return  JAVATools.Apiretrun("200",jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  JAVATools.Apiretrun("400","error");

    }
}
