package com.seeyon.ctp.rest.resources.esign;

import cn.hutool.log.Log;
import com.seeyon.apps.esign.service.EsignFlowQueryService;
import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.rest.resources.BaseResource;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;

@Path("/eFlow")
public class EsignFlowQueryResource extends BaseResource {

    private static final Log log = Log.get(EsignFlowQueryResource.class);
    private EsignFlowQueryService esignFlowQueryService = (EsignFlowQueryService) AppContext.getBean("esignFlowQueryService");

    @Context
    HttpServletRequest req;

    @GET
    @Produces({"application/json"})
    @Path("/queryFlowStatus")
    public Response queryTemplates() {
        try {
            return success(esignFlowQueryService.queryFlow(req.getParameter("orgName"),req.getParameter("eFlowId")));
        }catch (Exception e) {
            e.printStackTrace();
            log.error(e.getMessage(),e);
        }
        return fail("失败");
    }
}
