package com.engine.htsc.clwhsq.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.clwhsq.service.ClwhsqService;
import com.engine.htsc.clwhsq.service.impl.ClwhsqServiceImpl;
import com.engine.htsc.yghmzczysq.service.ZysqWorkflowService;
import com.engine.htsc.yghmzczysq.service.impl.ZysqWorkflowServiceImpl;
import com.google.gson.JsonObject;
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;
import java.util.HashMap;
import java.util.Map;

/**
 * 车辆维护申请
 * cmj
 */
public class ClwhsqAction {
    private ClwhsqService clwhsqService(){

        return ServiceUtil.getService(ClwhsqServiceImpl.class);
    }

    /**
     * 内部审核辅助字段取值 赋值到意见征询辅助字段（yjzxfzzd）
     * @param request
     * @param response
     * @return
     */
    @POST
    @Path("/getNbsh")
    @Produces({MediaType.TEXT_PLAIN})
    public  String getNbsh(@Context HttpServletRequest request, @Context HttpServletResponse response){
        HashMap<String, Object> result = new HashMap<>();
        try{
            User user = HrmUserVarify.getUser( request, response );
            Map<String,Object> Paramsmap= ParamUtil.request2Map(request);
            Map<String ,Object> map = clwhsqService().getNbsh(user,Paramsmap);
            result.put("code",200);
            result.put("msg","success");
            result.put("data",map);
            return JSONObject.toJSONString(result);
        }catch (Exception e){

            result.put("code",500);
            result.put("msg","error");
            result.put("data","");
            return JSONObject.toJSONString(result);
        }



    }
}
