package com.engine.shuzhi.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.shuzhi.service.SzResumeCenterService;
import com.engine.shuzhi.service.impl.SzResumeCenterServiceImpl;
import weaver.general.BaseBean;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;

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;

/**
 * @author wangj
 * @version 1.00版本
 * @Date 2023/6/26
 */

public class SzResumeController {
    public SzResumeCenterService getService() {
        return ServiceUtil.getService(SzResumeCenterServiceImpl.class);
    }

    @GET
    @Path("/getResumeInfo")
    @Produces(MediaType.TEXT_PLAIN)
    public String getResumeInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
        response.setContentType("application/x-www-form-urlencoded; charset=utf-8");
        Map<String, Object> apidatas = new HashMap<String, Object>();
        try {
            Map<String, Object> paramMap = ParamUtil.request2Map(request);

            apidatas = this.getService().getResumeInfo(paramMap);
            apidatas.put("status", "1");
        } catch (Exception e) {
            apidatas.put("status", "-1");
            apidatas.put("error", e.getMessage());
            new BaseBean().writeLog("getResumeInfo: ", e);
        }
        return JSONObject.toJSONString(apidatas);
    }

    @GET
    @Path("/updateResume")
    @Produces(MediaType.TEXT_PLAIN)
    public String updateResume(@Context HttpServletRequest request, @Context HttpServletResponse response) {
        response.setContentType("application/x-www-form-urlencoded; charset=utf-8");
        Map<String, Object> apidatas = new HashMap<String, Object>();
        try {
            Map<String, Object> paramMap = ParamUtil.request2Map(request);
            apidatas = this.getService().updateResume(paramMap);
            apidatas.put("status", "1");
        } catch (Exception e) {
            apidatas.put("status", "-1");
            apidatas.put("error", e.getMessage());
            new BaseBean().writeLog("updateResume: ", e);
        }
        return JSONObject.toJSONString(apidatas);
    }

}
