package com.engine.htsc.subcompany.tools;

import com.weaver.general.Util;
import weaver.conn.RecordSet;

public class UfzgsplModelTools {
    public static String getUfzgsJobGrade(String userId) {
        String sql = "select a.deptTypeCode,a.deptdepth,a.deptdirectors,h.SECLEVEL " +
                "from hrmdepartmentdefined a,hrmresource h where a.deptid = h.departmentid " +
                " and h.id = " + userId + "";
        RecordSet rs = new RecordSet();
        rs.execute(sql);
        Integer deptdepth = null;
        Integer secLevel = null;
        String deptTypeCode = null;
        String result = "";
        if (rs.next()) {
            deptdepth = Util.getIntValue(Util.null2String(rs.getString("deptdepth")));
            secLevel = Util.getIntValue(Util.null2String(rs.getString("SECLEVEL")));
            if (secLevel>=0&&secLevel<50) {
                if (2==deptdepth){
                    result = "PT_LV2";//二级部门普通员工
                }else {
                    result = "PT";//一级部门普通员工
                }
            } else if (secLevel >= 50) {
                if (2==deptdepth){
                    result = "FZR_LV2";//二级部门负责人
                }else {
                    result = "FZR";//一级部门负责人
                }
            }
        }
        return result;
    }
}
