企业微信批量获取审批工单
采用定时任务,企业微信限制是每分钟不超过600次,因此我们可以设置定时任务,每分钟获取一次
HttpsClient http = new HttpsClient();HashMap json = new HashMap<>();HashMap headers = new HashMap<>(3);String abc=http.sendGet("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=“+企业微信id+”&corpsecret="+corpsecret);//获取方法查看企业微信apiHashMap hashMap1 = JSON.parseObject(abc, HashMap.class);String access_token = (String) hashMap1.get("access_token");String url1="https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovalinfo?access_token="+access_token;long timestamp1 = (System.currentTimeMillis() / 1000)-60;long timestamp2 = System.currentTimeMillis() / 1000;json.put("starttime", timestamp1);json.put("endtime", timestamp2);json.put("cursor", 0);json.put("size", 100);JSONObject json1 = new JSONObject(json);String s = json1.toString();headers.put("content-type", "application/json");String def = http.sendPostWithJson(url1, s, headers);HashMap hashMap2 = JSON.parseObject(def, HashMap.class);List result = (List) hashMap2.get("sp_no_list");//循环从单号获取信息for(int i=0;i json2 = new HashMap<>();json2.put("sp_no",result.get(i));JSONObject json3 = new JSONObject(json2);String s2=json3.toString();String url2="https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail?access_token="+access_token;String temp = http.sendPostWithJson(url2, s2, headers);HashMap temp1 = JSON.parseObject(temp, HashMap.class);String id =(String) (((Map) ((List) ((Map) ((Map) ((Map) ((List) ((Map) ((Map) temp1.get("info")).get("apply_data")).get("contents")).get(0)).get("value")).get("selector")).get("options")).get(0)).get("key"));//获取图片List fileId = (List) ((Map) ((Map) ((List) ((Map) ((Map) temp1.get("info")).get("apply_data")).get("contents")).get(4)).get("value")).get("files");for(int j=0;j
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
