package com.kingdee.eas.custom.beisen.synchronouspos.osf; import com.alibaba.fastjson.JSONObject; import com.google.common.collect.Maps; import com.kingdee.bos.Context; import com.kingdee.bos.rabbitmq.guava.Lists; import com.kingdee.eas.custom.beisen.utils.BeiSenUtils; import com.kingdee.eas.custom.beisen.utils.Helper; import java.io.IOException; import java.net.URISyntaxException; import java.net.URLEncoder; import java.util.HashMap; import java.util.List; import java.util.Map; /** * * description: StaffManageRunnable
* date: 2025/8/12 9:24
* author: lhbj
* version: 1.0
*/ public class StaffManageProcess{ public Map>> orgProcess(Context context, List> orgListMap) throws IOException, URISyntaxException { Map>> result = Maps.newHashMap(); List> list = Lists.newArrayList(); List> listMap = Lists.newArrayList(); result.put("list",list); result.put("listMap",listMap); BeiSenUtils b = new BeiSenUtils(context); Helper helper = b.helper; String token = b.getAccessToken(); for(Map pos : orgListMap) { // 若访问令牌不为空且开始时间和结束时间不为空 if (!com.kingdee.util.StringUtils.isEmpty(token)) { // 创建请求头的 Map Map header = new HashMap(); // 设置请求头的 Content-Type header.put("Content-Type", "application/json"); // 设置请求头的 Authorization header.put("Authorization", "Bearer " + token); String url = "https://openapi.italent.cn/UserFrameworkApiV3/api/v1/departments/Put?originalId=" + URLEncoder.encode((String) pos.get("id"), "UTF-8"); JSONObject requestBody = new JSONObject(pos); System.out.println("url:" + url); System.out.println("requestBody:" + requestBody); JSONObject responseJson = helper.getURL(url, header, requestBody, "PUT", requestBody.getString("posId"), "更新", "北森"); System.out.println("responseJson:" + responseJson); listMap.add(responseJson); list.add(pos); } } return result; } public Map>> posProcess(Context context,List> posListMap) throws IOException, URISyntaxException { Map>> result = Maps.newHashMap(); List> list = Lists.newArrayList(); List> listMap = Lists.newArrayList(); result.put("list",list); result.put("listMap",listMap); BeiSenUtils b = new BeiSenUtils(context); Helper helper = b.helper; String token = b.getAccessToken(); for(Map pos : posListMap) { // 若访问令牌不为空且开始时间和结束时间不为空 if (!com.kingdee.util.StringUtils.isEmpty(token)) { // 创建请求头的 Map Map header = new HashMap(); // 设置请求头的 Content-Type header.put("Content-Type", "application/json"); // 设置请求头的 Authorization header.put("Authorization", "Bearer " + token); String url = "https://openapi.italent.cn/RecruitV6/api/v1/RecruitOnBoarding/UpdatePost"; JSONObject requestBody = new JSONObject(pos); System.out.println("url:"+url); System.out.println("requestBody:"+requestBody); JSONObject responseJson = helper.getURL(url,header, requestBody, "PUT",requestBody.getString("posId"),"更新","北森"); System.out.println("responseJson:"+responseJson); listMap.add(responseJson); list.add(pos); } } return result; } }