|
@@ -257,8 +257,8 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
params.put("type","file");
|
|
|
params.put("filename",fileName);
|
|
|
// params.put("url","https://worktime.ttkuaiban.com/upload/"+fileName);
|
|
|
- params.put("url","http://47.101.180.183:9097/upload/"+fileName);
|
|
|
-// System.out.println("uploadJobFileUrl=== "+"http://47.101.180.183:9097/upload/"+fileName);
|
|
|
+ params.put("url","http://1.94.62.58:9097/upload/"+fileName);
|
|
|
+// System.out.println("uploadJobFileUrl=== "+"http://1.94.62.58:9097/upload/"+fileName);
|
|
|
params.put("md5",md5);
|
|
|
String requestBody = JSONObject.toJSONString(params);
|
|
|
HttpEntity<String> entity = new HttpEntity<>(requestBody, headers);
|
|
@@ -2485,6 +2485,73 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Async("taskExecutor")
|
|
|
+ public void getUserByCompanyIdAndTransferLicense(Integer companyId,String takeoverId) throws Exception {
|
|
|
+ if (StringUtils.isEmpty(takeoverId)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String providerAccessToken = getProviderAccessToken();
|
|
|
+ String url ="https://qyapi.weixin.qq.com/cgi-bin/license/get_active_info_by_user?provider_access_token=" + providerAccessToken;
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
+ List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).eq("is_active", 0));
|
|
|
+ if (users.size() != 0 && wxCorpInfo != null && wxCorpInfo.getSaasSyncContact().equals(1)){
|
|
|
+ //发送请求
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+ MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
|
+ headers.setContentType(type);
|
|
|
+ headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
|
|
+ for (User item : users) {
|
|
|
+ JSONObject requestMap = new JSONObject();
|
|
|
+ requestMap.put("corpid", wxCorpInfo.getCorpid());
|
|
|
+ requestMap.put("userid", item.getCorpwxUserid());
|
|
|
+ HttpEntity<JSONObject> entity = new HttpEntity<>(requestMap, headers);
|
|
|
+ ResponseEntity<String> ResponseEntity = restTemplate.postForEntity(url, entity, String.class);
|
|
|
+ if (ResponseEntity.getStatusCode() == HttpStatus.OK) {
|
|
|
+ String resp = ResponseEntity.getBody();
|
|
|
+ JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
+ if (respJson.getInteger("errcode")==0){
|
|
|
+ Integer status = respJson.getInteger("active_status");
|
|
|
+ if (status.equals(1)){
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
+ String handoverId = item.getCorpwxUserid();//要转移的成员
|
|
|
+
|
|
|
+ String url1 ="https://qyapi.weixin.qq.com/cgi-bin/license/batch_transfer_license?provider_access_token=" + providerAccessToken;
|
|
|
+ HttpHeaders headers1 = new HttpHeaders();
|
|
|
+ RestTemplate restTemplate1 = new RestTemplate();
|
|
|
+ MediaType type1 = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
|
+ headers1.setContentType(type1);
|
|
|
+ headers1.add("Accept", MediaType.APPLICATION_JSON.toString());
|
|
|
+ JSONObject requestMap1 = new JSONObject();
|
|
|
+ requestMap1.put("corpid", wxCorpInfo.getCorpid());
|
|
|
+ ArrayList<HashMap<String, String>> list1 = new ArrayList<>();
|
|
|
+ HashMap<String, String> map1 = new HashMap<>();
|
|
|
+ map1.put("handover_userid",handoverId);
|
|
|
+ map1.put("takeover_userid",takeoverId);
|
|
|
+ list1.add(map1);
|
|
|
+ requestMap1.put("transfer_list", list1);
|
|
|
+ HttpEntity<JSONObject> entity1 = new HttpEntity<>(requestMap1, headers1);
|
|
|
+ ResponseEntity<String> ResponseEntity1=restTemplate1.postForEntity(url1, entity1, String.class);
|
|
|
+ if (ResponseEntity1.getStatusCode()==HttpStatus.OK){
|
|
|
+ String body = ResponseEntity1.getBody();
|
|
|
+ JSONObject respJson1 = JSONObject.parseObject(body);
|
|
|
+
|
|
|
+ if (respJson1.getInteger("errcode")==0){
|
|
|
+ log.info("转移失败");
|
|
|
+ } else {
|
|
|
+ log.info("转移失败:"+respJson1.toJSONString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 企业微信账号继承
|
|
|
* @param handoverId
|
|
@@ -2708,4 +2775,6 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
System.out.println("end getAsyncJobResult method");
|
|
|
return mediaId;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|