package com.engine.htsc.seal.web;

import com.engine.common.util.ServiceUtil;
import com.engine.htsc.seal.service.SendApplyPrintService;
import com.engine.htsc.seal.service.SendManualSignService;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;

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;

/**
 * 手动签章流程接口
 */
public class SendManualSignForApplicationAction {

    @POST
    @Path("/sendManualSignForAppliaction")
    @Produces({MediaType.TEXT_PLAIN})
    public String receiveSealForAppliaction(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationFile(user,requestid,docids,"ZB");
    }

    @POST
    @Path("/sendFromApplicationLicense")
    @Produces({MediaType.TEXT_PLAIN})
    public String sendFromApplicationLicense(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationLicense(user,requestid,docids,"ZB");
    }

    @POST
    @Path("/sendManualSignForAppliactionLH")
    @Produces({MediaType.TEXT_PLAIN})
    public String receiveSealForAppliactionLH(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationFile(user,requestid,docids,"LH");
    }

    @POST
    @Path("/sendFromApplicationLicenseLH")
    @Produces({MediaType.TEXT_PLAIN})
    public String sendFromApplicationLicenseLH(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationLicense(user,requestid,docids,"LH");
    }

    @POST
    @Path("/sendManualSignForAppliactionZG")
    @Produces({MediaType.TEXT_PLAIN})
    public String receiveSealForAppliactionZG(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationFile(user,requestid,docids,"ZG");
    }

    @POST
    @Path("/sendFromApplicationLicenseZG")
    @Produces({MediaType.TEXT_PLAIN})
    public String sendFromApplicationLicenseZG(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationLicense(user,requestid,docids,"ZG");
    }

    @POST
    @Path("/sendManualSignForAppliactionCX")
    @Produces({MediaType.TEXT_PLAIN})
    public String receiveSealForAppliactionCX(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationFile(user,requestid,docids,"CX");
    }

    @POST
    @Path("/sendFromApplicationLicenseCX")
    @Produces({MediaType.TEXT_PLAIN})
    public String sendFromApplicationLicenseCX(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationLicense(user,requestid,docids,"CX");
    }

    @POST
    @Path("/sendManualSignForAppliactionZJ")
    @Produces({MediaType.TEXT_PLAIN})
    public String receiveSealForAppliactionZJ(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationFile(user,requestid,docids,"ZJ");
    }

    @POST
    @Path("/sendFromApplicationLicenseZJ")
    @Produces({MediaType.TEXT_PLAIN})
    public String sendFromApplicationLicenseZJ(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationLicense(user,requestid,docids,"ZJ");
    }

    @POST
    @Path("/sendManualSignForAppliactionHK")
    @Produces({MediaType.TEXT_PLAIN})
    public String receiveSealForAppliactionHK(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bs = new BaseBean();
        bs.writeLog("-------------sendManualSignForAppliaction-------------");
        String requestid = Util.null2String(request.getParameter("requestid"));
        String docids = Util.null2String(request.getParameter("docid"));
        User user = HrmUserVarify.getUser(request, response);

        SendManualSignService sendManualSignService = ServiceUtil.getService(SendManualSignService.class);
        return sendManualSignService.sendFromApplicationFile(user,requestid,docids,"HK");
    }
}
