fwq
2022-06-17 32e62c64b2e384d11443cb4ae90177d5664dc8d8
src/main/java/com/hx/mp/util/CorpMpUtil.java
@@ -71,6 +71,42 @@
        }
        return -1;
    }
    /**
     * 添加工作人员
     * @param at 访问at
     * @param userId 用户id
     * @param name 名称
     * @param depId 部门id
     * @param position 职位
     * @param tel 电话
     * @param email 邮箱
     * @return 返回
     */
    public static JSONObject addUserObj(String at, String userId, String name, int depId
            , String position,String tel,String email) {
        if(StringUtils.isEmpty(tel)&&StringUtils.isEmpty(email)){
            throw new TipsException("添加企业微信手机号和邮箱不能都为空!");
        }
        JSONObject obj = new JSONObject();
        obj.put("userid", userId);
        obj.put("name", name);
        obj.put("department", depId);
        obj.put("position", position);
        obj.put("mobile", tel);
        obj.put("email", email);
        obj = HttpURLUtil(MessageFormat.format(URL_ADD_USER, at), obj.toString());
        if(obj == null){
            obj = new JSONObject();
        }
        return obj;
    }
    /**
     * 更新工作人员
     * @param at 访问at
@@ -103,7 +139,7 @@
    /**
     * 删除工作人员
     * @param at 访问at
     * @param userId 用户id
     * @param userId 企业用户id
     * @return 返回
     */
    public static int deleteUser(String at, String userId) {
@@ -128,14 +164,26 @@
        obj.put("userid", userId);
        obj = HttpURLUtil(MessageFormat.format(URL_INFO_USER, at,userId), obj.toString());
        System.out.println("userId:"+userId);
        System.out.println("obj:"+obj.toString());
        if(obj != null) {
            return obj.optInt("errcode", -1);
        }
        return -1;
    }
    /**
     * 获取企业用户信息
     * @param at 访问at
     * @param userId 用户id
     * @return 返回
     */
    public static JSONObject userData(String at, String userId) {
        JSONObject obj = new JSONObject();
        obj.put("userid", userId);
        return obj = HttpURLUtil(MessageFormat.format(URL_INFO_USER, at,userId), obj.toString());
    }
    /**
     * 添加部门