package com.engine.htsc.trip.web;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.trip.service.GetStandardService;
import com.engine.htsc.trip.service.impl.GetStandardServiceImpl;
import weaver.general.Util;
import weaver.interfaces.htsc.GlobatTools.JAVATools;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class GetStandardAction {

    GetStandardService getService() {
        return ServiceUtil.getService(GetStandardServiceImpl.class);
    }

    /**
     * 查询总部差旅报销标准
     */
    @POST
    @Path("/doGetStandard")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public String getProject(List<Map<String,String>> param) {
        Map<String, Object> apidatas = new HashMap<String, Object>();
        List<Map<String,String>> resultList = new ArrayList<>();
        try {
            JAVATools.SetCmdwritelog("查询人员差标" + "入参:" + JSONObject.toJSONString(param));
            resultList = getService().getReimbursementStandard(param);
            apidatas.put("datas", resultList);
        } catch (Exception e) {
            //异常处理
            e.printStackTrace();
            apidatas.put("api_status", false);
            apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
        }
        //数据转换
        return JSONObject.toJSONString(apidatas);
    }
}
