package com.engine.htsc.itTestOnline.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.itTestOnline.service.ItTestOnlineService;
import com.engine.htsc.itTestOnline.service.impl.ItTestOnlineServiceImpl;
import com.engine.htsc.ityssq.service.ItyssqService;
import com.engine.htsc.ityssq.service.impl.ItyssqServiceImpl;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.interfaces.htsc.GlobatTools.JAVATools;

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;

/**
 * @Title: ecology-9
 * @Company: 泛微软件
 * @author: K1810039
 * @version: 1.0
 * @CreateDate: 2022-06-13
 * @Description: IT测试和上线（管理平台）根据工号，查询部门id,部门领导
 * @ModifyLog:
 **/
public class ItTestOnlineAction {
    public ItTestOnlineService getService(){
        return ServiceUtil.getService(ItTestOnlineServiceImpl.class);
    }

    @POST
    @Path("/getDeptDirectors")
    @Produces({MediaType.TEXT_PLAIN})
    public String getDeptDirectors(@Context HttpServletRequest request, @Context HttpServletResponse response){
        Map<String,String> apidatas = new HashMap<>();
        try {
            String loginId = request.getParameter("loginId");
            apidatas = getService().getDeptDirectors(loginId);
            JAVATools.writelog("result apidatas---->"+apidatas);
            apidatas.put("api_status", "true");
        } catch (Exception e) {
            e.printStackTrace();
            apidatas.put("api_status", "false");
            apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
        }
        return JSONObject.toJSONString(apidatas);
    }
}
