package com.engine.htsc.movereimburse.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.movereimburse.service.MoveReimbursedService;
import com.engine.htsc.movereimburse.service.impl.MoveReimbursedServiceImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.general.Util;

import javax.servlet.http.HttpServletRequest;
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;

public class MoveReimbursedAction {
    private Log log = LogFactory.getLog(this.getClass());

    private MoveReimbursedService getService() {
        return ServiceUtil.getService(MoveReimbursedServiceImpl.class);
    }

    @POST
    @Path("/getColiedInvInfo")
    @Produces({MediaType.APPLICATION_JSON})
    public String coliedInvoice(@Context HttpServletRequest request) {
        log.info("========================== getColiedInvInfo start ==========================");
        String invInfo = Util.null2String(request.getParameter("invInfo"));
        String requestId = Util.null2String(request.getParameter("requestId"));
        log.info("invInfo: " + invInfo + ", requestId: " + requestId);
        String result = JSONObject.toJSONString(getService().getColiedInvInfo(invInfo, requestId));
        log.info("即将返回给前端的参数是：" + result);
        log.info("========================== getColiedInvInfo end ==========================");
        return result;
    }
}
