package com.engine.htsc.workflow.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.workflow.service.DesignedProcessorService;
import com.engine.htsc.workflow.service.impl.DesignedProcessorServiceImpl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
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;

public class DesignedProcessorAction {

    DesignedProcessorService getService(){
        return ServiceUtil.getService(DesignedProcessorServiceImpl.class);
    }

    @GET
    @Path("/setting/getLcZdclr")
    @Produces({MediaType.TEXT_PLAIN})
    public String getLcDetail(@Context HttpServletRequest request, @Context HttpServletResponse response){
        Map<String, Object> apidatas = new HashMap<String, Object>();
        try {
            apidatas = getService().getDesignedProcessor(ParamUtil.request2Map(request));
        }catch (Exception e){
            //异常处理
            e.printStackTrace();
            apidatas.put("api_status", false);
            apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
        }
        return JSONObject.toJSONString(apidatas);
    }


}
