|
@@ -83,12 +83,16 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
|
|
|
public static final String GET_USER_INFO_WITHDP = "https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token=ACCESS_TOKEN&department_id=DEPARTMENT_ID";
|
|
|
|
|
|
+ public static final String GET_BATCHSEARCH_USER_INFO = "https://qyapi.weixin.qq.com/cgi-bin/service/contact/batchsearch?provider_access_token=ACCESS_TOKEN";
|
|
|
+
|
|
|
public static final int TEXT_CARD_MSG_BUSTRIP_WAITING_AUDIT = 0;//出差待审核
|
|
|
public static final int TEXT_CARD_MSG_BUSTRIP_AGREE = 1;//出差审核通过
|
|
|
public static final int TEXT_CARD_MSG_BUSTRIP_DENY = 2;//出差审核驳回
|
|
|
public static final int TEXT_CARD_MSG_REPORT_DENY = 10;//日报驳回
|
|
|
public static final int TEXT_CARD_MSG_REPORT_AGREE = 11; //日报审核通过
|
|
|
|
|
|
+ public static final HashMap CURSOR=new HashMap();
|
|
|
+
|
|
|
@Value("${suitId}")
|
|
|
private String suitId;
|
|
|
@Value("${suitSecret}")
|
|
@@ -701,6 +705,51 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
return find;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg getBatchSearchUserInfo(WxCorpInfo wxCorpInfo, List<String> userNameList) throws Exception {
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
+ String url = GET_BATCHSEARCH_USER_INFO.replace("ACCESS_TOKEN",getProviderAccessToken());
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+ JSONObject jsonObject=new JSONObject();
|
|
|
+ jsonObject.put("auth_corpid",wxCorpInfo.getCorpid());
|
|
|
+ jsonObject.put("agentid",wxCorpInfo.getAgentid());
|
|
|
+ JSONArray jsonArray=new JSONArray();
|
|
|
+ for (String s : userNameList) {
|
|
|
+ JSONObject item=new JSONObject();
|
|
|
+ item.put("query_word",s);
|
|
|
+ item.put("query_type",1);
|
|
|
+ item.put("query_range",1);
|
|
|
+ item.put("limit",50);
|
|
|
+ item.put("full_match_field",1);
|
|
|
+ item.put("cursor",CURSOR.get("cursor"));
|
|
|
+ jsonArray.add(item);
|
|
|
+ }
|
|
|
+ jsonObject.put("query_request_list",jsonArray);
|
|
|
+ HttpEntity<String> requestEntity = new HttpEntity<String>(jsonObject.toJSONString(), headers);
|
|
|
+ ResponseEntity<String> responseEntity = this.restTemplate.exchange(url,
|
|
|
+ HttpMethod.POST, requestEntity, String.class);
|
|
|
+ if (responseEntity.getStatusCode() == HttpStatus.OK) {
|
|
|
+ String resp = responseEntity.getBody();
|
|
|
+ JSONObject json = JSONObject.parseObject(resp);
|
|
|
+ if(json.getIntValue("errcode")>0){
|
|
|
+ throw new Exception(json.toJSONString());
|
|
|
+ }
|
|
|
+ JSONArray resultList = json.getJSONArray("query_result_list");
|
|
|
+ for (int i = 0; i < resultList.size(); i++) {
|
|
|
+ User user=new User();
|
|
|
+ JSONObject dataItem = resultList.getJSONObject(i);
|
|
|
+ JSONObject request = dataItem.getJSONObject("query_request");
|
|
|
+ user.setName(request.getString("query_word"));
|
|
|
+ JSONObject result = dataItem.getJSONObject("query_result");
|
|
|
+ JSONObject userTarget = result.getJSONObject("user");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ getProviderAccessToken();
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void reqPunchRecord(WxCorpInfo corpInfo, long startTime, long endTime, Object[] objects, boolean showLog,String userId,LocalDate date)throws Exception {
|
|
|
DateTimeFormatter mdFormat = DateTimeFormatter.ofPattern("yyyy/M/d");
|