package com.engine.htsc.GwRelated.fzjg.Dao;

import weaver.general.Util;
import weaver.hrm.authority.manager.HrmDepartmentManager;
import weaver.interfaces.htsc.GlobatTools.DBTools;
import weaver.interfaces.htsc.GlobatTools.JAVATools;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author xf
 * @version 1.0.0
 * @ClassName FzjgfwBaseDao.java
 * @createTime 2021年11月17日 11:17:00
 */
public class FzjgfwBaseDao {


    public static boolean isgwuservf(Map<String,String> map){
       String hgfktdfzr=Util.null2String(map.get("hgfktdfzr"));
       String fxqfkg= Util.null2String(map.get("fxqfkg"));
       String userid= Util.null2String(map.get("userid"));
       String deptid= Util.null2String(map.get("deptid"));
       String sql=" select wm_concat_old(ry) as ry from uf_lcgwry " +
               " where xzlc ='fzjgfw' and jg=? and ( xzgw =? or xzgw=?) ";
       Map<String,Object> retmap= DBTools.getsqltomap(sql,deptid,hgfktdfzr,fxqfkg);
        if(retmap==null && retmap.size()<=0){
            return true;
        }

        String ryvalue= Util.null2String(retmap.get("ry"));
        if((","+ryvalue+",").indexOf(","+userid+",")>=0){
            return false;
        }else{
            return true;
        }
    }

    public static String getdepttype(String deptid){
        String retstr="0";
        String sql=" select depttypecode,deptid from hrmdepartmentdefined where 1=1 ";
        Map<String,String> map=new HashMap<>();
        map.put("deptid",deptid);
        Map<String,Object> returnmap=JAVATools.GetTableToMap(sql,map);
        String depttypecode=Util.null2String(returnmap.get("depttypecode"));
        //判断是不是营业部
        if((",JGLX02,JGLX04,JGLX05,JGLX06,").indexOf(","+depttypecode+",")<0){
            //
            retstr="1";
        }

        return retstr;

    }
}
