|
@@ -53,13 +53,13 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
propt.load(new FileInputStream(syncOAConfigPath));
|
|
propt.load(new FileInputStream(syncOAConfigPath));
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
- String errorMsg = "鑾峰彇閰嶇疆鏂囦欢鎶ラ敊锛岃�妫€鏌ラ厤缃�細" + syncOAConfigPath + " " + e.getMessage();
|
|
|
|
|
|
+ String errorMsg = "获取配置文件报错,请检查配置:" + syncOAConfigPath + " " + e.getMessage();
|
|
throw new BOSException(errorMsg);
|
|
throw new BOSException(errorMsg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鍚屾�缁勭粐
|
|
|
|
|
|
+ * 同步组织
|
|
*
|
|
*
|
|
* @param ctx
|
|
* @param ctx
|
|
* @param billds
|
|
* @param billds
|
|
@@ -80,7 +80,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
IAdminOrgUnit iAdminOrgUnit = AdminOrgUnitFactory.getLocalInstance(ctx);
|
|
IAdminOrgUnit iAdminOrgUnit = AdminOrgUnitFactory.getLocalInstance(ctx);
|
|
List dataList = new ArrayList();
|
|
List dataList = new ArrayList();
|
|
//String actionType = action == null ? "" : action.getValue().toLowerCase();
|
|
//String actionType = action == null ? "" : action.getValue().toLowerCase();
|
|
- //褰撳弬鏁癰illIds涓嶄负绌哄€兼椂锛屽�閲忓悓姝ュ弬鏁颁腑鐨勯儴闂ㄦ暟鎹�埌OA
|
|
|
|
|
|
+ //当参数billIds不为空值时,增量同步参数中的部门数据到OA
|
|
FilterInfo filterInfo = null;
|
|
FilterInfo filterInfo = null;
|
|
if (!StringUtils.isEmpty(billds)) {
|
|
if (!StringUtils.isEmpty(billds)) {
|
|
Set<String> adminOrgIds = AtsUtil.toSet(billds);
|
|
Set<String> adminOrgIds = AtsUtil.toSet(billds);
|
|
@@ -112,7 +112,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
//adminOrg.setOrder((String.valueOf(adminOrgUnitInfo.getIndex())));
|
|
//adminOrg.setOrder((String.valueOf(adminOrgUnitInfo.getIndex())));
|
|
dataList.add(adminOrg);
|
|
dataList.add(adminOrg);
|
|
}
|
|
}
|
|
- //鎵ц�鍚屾�缁勭粐鍒癘A
|
|
|
|
|
|
+ //执行同步组织到OA
|
|
executeSyncOrgUnitToOA(ctx, dataList, syncLogInfo);
|
|
executeSyncOrgUnitToOA(ctx, dataList, syncLogInfo);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -125,7 +125,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鎵ц�鍚屾�缁勭粐鍒癘A
|
|
|
|
|
|
+ * 执行同步组织到OA
|
|
*
|
|
*
|
|
* @param dataList
|
|
* @param dataList
|
|
* @return
|
|
* @return
|
|
@@ -133,15 +133,15 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
public void executeSyncOrgUnitToOA(Context ctx, List dataList, SyncLogInfo syncLogInfo) throws IOException, BOSException, EASBizException {
|
|
public void executeSyncOrgUnitToOA(Context ctx, List dataList, SyncLogInfo syncLogInfo) throws IOException, BOSException, EASBizException {
|
|
if (dataList != null && dataList.size() > 0) {
|
|
if (dataList != null && dataList.size() > 0) {
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
- //灏佽�璇锋眰鍙傛暟
|
|
|
|
|
|
+ //封装请求参数
|
|
String data = mapper.writeValueAsString(dataList);
|
|
String data = mapper.writeValueAsString(dataList);
|
|
String params = String.format("token = %s &data = %s", getToken(), data);
|
|
String params = String.format("token = %s &data = %s", getToken(), data);
|
|
logger.error("executeSyncOrgUnitToOA----------------------params" + params);
|
|
logger.error("executeSyncOrgUnitToOA----------------------params" + params);
|
|
- //灏佽�璇锋眰鍙傛暟
|
|
|
|
|
|
+ //封装请求参数
|
|
String syncOrgUnitApiUrl = this.propt.getProperty("syncOrgUnitApiUrl");
|
|
String syncOrgUnitApiUrl = this.propt.getProperty("syncOrgUnitApiUrl");
|
|
logger.error("executeSyncOrgUnitToOA----------------------syncOrgUnitApiUrl" + syncOrgUnitApiUrl);
|
|
logger.error("executeSyncOrgUnitToOA----------------------syncOrgUnitApiUrl" + syncOrgUnitApiUrl);
|
|
if (StringUtils.isEmpty(syncOrgUnitApiUrl)) {
|
|
if (StringUtils.isEmpty(syncOrgUnitApiUrl)) {
|
|
- throw new BOSException("鍚屾�缁勭粐鍒癘A鎺ュ彛鍦板潃涓嶈兘涓虹┖!");
|
|
|
|
|
|
+ throw new BOSException("同步组织到OA接口地址不能为空!");
|
|
}
|
|
}
|
|
OkHttpClient client = new OkHttpClient();
|
|
OkHttpClient client = new OkHttpClient();
|
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
|
@@ -156,13 +156,13 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
.addHeader("Connection", "keep-alive")
|
|
.addHeader("Connection", "keep-alive")
|
|
.build();
|
|
.build();
|
|
Response response = client.newCall(request).execute();
|
|
Response response = client.newCall(request).execute();
|
|
- //澶勭悊鍝嶅簲缁撴灉,鍐欏叆鏃ュ織
|
|
|
|
|
|
+ //处理响应结果,写入日志
|
|
handlerResponse(ctx, response, syncLogInfo);
|
|
handlerResponse(ctx, response, syncLogInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 澶勭悊鍝嶅簲缁撴灉,鍐欏叆鏃ュ織
|
|
|
|
|
|
+ * 处理响应结果,写入日志
|
|
*
|
|
*
|
|
* @param ctx
|
|
* @param ctx
|
|
* @param response
|
|
* @param response
|
|
@@ -186,16 +186,17 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
if (response.isSuccessful()) {
|
|
if (response.isSuccessful()) {
|
|
String code = respMap.getString("code");
|
|
String code = respMap.getString("code");
|
|
if ("1".equals(code)) {
|
|
if ("1".equals(code)) {
|
|
|
|
+ JSONObject result = respMap.getJSONObject("result");
|
|
StringBuilder msg = new StringBuilder();
|
|
StringBuilder msg = new StringBuilder();
|
|
- for (String orgNumber : respMap.keySet()) {
|
|
|
|
- JSONObject jsonObject = respMap.getJSONObject(orgNumber);
|
|
|
|
|
|
+ for (String orgNumber : result.keySet()) {
|
|
|
|
+ JSONObject jsonObject = result.getJSONObject(orgNumber);
|
|
msg.append("[").append(orgNumber).append("]");
|
|
msg.append("[").append(orgNumber).append("]");
|
|
if ("1".equals(jsonObject.getString("code"))) {
|
|
if ("1".equals(jsonObject.getString("code"))) {
|
|
success++;
|
|
success++;
|
|
- msg.append("鍚屾�鎴愬姛\n");
|
|
|
|
|
|
+ msg.append("同步成功\n");
|
|
} else {
|
|
} else {
|
|
fail++;
|
|
fail++;
|
|
- msg.append("鍚屾�澶辫触锛�").append(jsonObject.getString("msg")).append("\n");
|
|
|
|
|
|
+ msg.append("同步失败,").append(jsonObject.getString("msg")).append("\n");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
syncLogInfo.setSyncStatus(SyncStatusEnum.SUCCESS);
|
|
syncLogInfo.setSyncStatus(SyncStatusEnum.SUCCESS);
|
|
@@ -209,27 +210,27 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
|
|
syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
|
|
- syncLogInfo.setSyncResult("璇锋眰瓒呮椂");
|
|
|
|
|
|
+ syncLogInfo.setSyncResult("请求超时");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
|
|
syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
|
|
- syncLogInfo.setSyncResult("鍚屾�鏁版嵁涓虹┖");
|
|
|
|
|
|
+ syncLogInfo.setSyncResult("同步数据为空");
|
|
}
|
|
}
|
|
iSyncLog.save(syncLogInfo);
|
|
iSyncLog.save(syncLogInfo);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鑾峰彇token
|
|
|
|
|
|
+ * 获取token
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
private String getToken() throws BOSException {
|
|
private String getToken() throws BOSException {
|
|
String key = this.propt.getProperty("key");
|
|
String key = this.propt.getProperty("key");
|
|
if (StringUtils.isEmpty(key)) {
|
|
if (StringUtils.isEmpty(key)) {
|
|
- throw new BOSException("鑾峰彇token key涓嶈兘涓虹┖锛�");
|
|
|
|
|
|
+ throw new BOSException("获取token key不能为空!");
|
|
}
|
|
}
|
|
- long l = System.currentTimeMillis();//鏃堕棿鎴虫�绉掓暟
|
|
|
|
|
|
+ long l = System.currentTimeMillis();//时间戳毫秒数
|
|
String code = key.concat(Long.toString(l));
|
|
String code = key.concat(Long.toString(l));
|
|
String s = DigestUtils.md5Hex(code).toUpperCase();
|
|
String s = DigestUtils.md5Hex(code).toUpperCase();
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
@@ -240,7 +241,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鍚屾�鑱屼綅淇℃伅
|
|
|
|
|
|
+ * 同步职位信息
|
|
*
|
|
*
|
|
* @param ctx
|
|
* @param ctx
|
|
* @param billds
|
|
* @param billds
|
|
@@ -259,7 +260,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
logger.error("_syncPositionToOA---billds: " + billds);
|
|
logger.error("_syncPositionToOA---billds: " + billds);
|
|
String data = getPositionColData(ctx, billds);
|
|
String data = getPositionColData(ctx, billds);
|
|
String syncPositionApiUrl = this.propt.getProperty("syncPositionApiUrl");
|
|
String syncPositionApiUrl = this.propt.getProperty("syncPositionApiUrl");
|
|
- synScyRequest(ctx,data, syncPositionApiUrl,syncLogInfo);
|
|
|
|
|
|
+ synScyRequest(ctx, data, syncPositionApiUrl, syncLogInfo);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
syncLogInfo.setSyncStatus(SyncStatusEnum.ERROR);
|
|
syncLogInfo.setSyncStatus(SyncStatusEnum.ERROR);
|
|
@@ -272,35 +273,36 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鑾峰彇宀椾綅淇℃伅
|
|
|
|
|
|
+ * 获取岗位信息
|
|
|
|
+ *
|
|
* @param ctx
|
|
* @param ctx
|
|
* @param billIds
|
|
* @param billIds
|
|
* @return
|
|
* @return
|
|
* @throws IOException
|
|
* @throws IOException
|
|
* @throws BOSException
|
|
* @throws BOSException
|
|
*/
|
|
*/
|
|
- protected String getPositionColData(Context ctx,String billIds) throws IOException, BOSException {
|
|
|
|
|
|
+ protected String getPositionColData(Context ctx, String billIds) throws IOException, BOSException {
|
|
List list = new ArrayList();
|
|
List list = new ArrayList();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
Set positionIds = new HashSet();
|
|
Set positionIds = new HashSet();
|
|
PositionCollection positionCollection = new PositionCollection();
|
|
PositionCollection positionCollection = new PositionCollection();
|
|
IPosition localInstance = PositionFactory.getLocalInstance(ctx);
|
|
IPosition localInstance = PositionFactory.getLocalInstance(ctx);
|
|
- if (org.apache.commons.lang.StringUtils.isNotBlank(billIds)){
|
|
|
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotBlank(billIds)) {
|
|
String[] split = billIds.split(",");
|
|
String[] split = billIds.split(",");
|
|
for (int i = 0; i < split.length; i++) {
|
|
for (int i = 0; i < split.length; i++) {
|
|
positionIds.add(split[i]);
|
|
positionIds.add(split[i]);
|
|
}
|
|
}
|
|
positionCollection = localInstance.getPositionCollection("where id in( " + AtsUtil.convertSetToString(positionIds) + ")");
|
|
positionCollection = localInstance.getPositionCollection("where id in( " + AtsUtil.convertSetToString(positionIds) + ")");
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
positionCollection = localInstance.getPositionCollection();
|
|
positionCollection = localInstance.getPositionCollection();
|
|
}
|
|
}
|
|
for (int i = 0; i < positionCollection.size(); i++) {
|
|
for (int i = 0; i < positionCollection.size(); i++) {
|
|
PositionEntity positionEntity = new PositionEntity();
|
|
PositionEntity positionEntity = new PositionEntity();
|
|
PositionInfo positionInfo = positionCollection.get(i);
|
|
PositionInfo positionInfo = positionCollection.get(i);
|
|
DeletedStatusEnum deletedStatus = positionInfo.getDeletedStatus();
|
|
DeletedStatusEnum deletedStatus = positionInfo.getDeletedStatus();
|
|
- if ("2".equals(deletedStatus.getValue())){ // 澶辨晥
|
|
|
|
|
|
+ if (deletedStatus.getValue() == 2) { // 失效
|
|
positionEntity.setAction("delete");
|
|
positionEntity.setAction("delete");
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
positionEntity.setAction("add");
|
|
positionEntity.setAction("add");
|
|
}
|
|
}
|
|
positionEntity.setJobtitlecode(positionInfo.getNumber());
|
|
positionEntity.setJobtitlecode(positionInfo.getNumber());
|
|
@@ -308,20 +310,21 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
positionEntity.setJobtitleremark(positionInfo.getName());
|
|
positionEntity.setJobtitleremark(positionInfo.getName());
|
|
list.add(positionEntity);
|
|
list.add(positionEntity);
|
|
}
|
|
}
|
|
- //灏佽�璇锋眰鍙傛暟
|
|
|
|
|
|
+ //封装请求参数
|
|
String data = mapper.writeValueAsString(list);
|
|
String data = mapper.writeValueAsString(list);
|
|
logger.error("_syncPositionToOA----------------------data" + data);
|
|
logger.error("_syncPositionToOA----------------------data" + data);
|
|
return data;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鍚屾�璇锋眰鏂规硶
|
|
|
|
|
|
+ * 同步请求方法
|
|
|
|
+ *
|
|
* @param param
|
|
* @param param
|
|
* @param aipUrl
|
|
* @param aipUrl
|
|
* @return
|
|
* @return
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
- public void synScyRequest(Context ctx,String param, String aipUrl, SyncLogInfo syncLogInfo) throws IOException, BOSException, EASBizException {
|
|
|
|
|
|
+ public void synScyRequest(Context ctx, String param, String aipUrl, SyncLogInfo syncLogInfo) throws IOException, BOSException, EASBizException {
|
|
OkHttpClient client = new OkHttpClient();
|
|
OkHttpClient client = new OkHttpClient();
|
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
|
String data = String.format("token = %s &data = %s", getToken(), param);
|
|
String data = String.format("token = %s &data = %s", getToken(), param);
|
|
@@ -336,14 +339,14 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
.addHeader("User-Agent", "PostmanRuntime-ApipostRuntime/1.1.0")
|
|
.addHeader("User-Agent", "PostmanRuntime-ApipostRuntime/1.1.0")
|
|
.addHeader("Connection", "keep-alive")
|
|
.addHeader("Connection", "keep-alive")
|
|
.build();
|
|
.build();
|
|
- //澶勭悊鍝嶅簲缁撴灉,鍐欏叆鏃ュ織
|
|
|
|
|
|
+ //处理响应结果,写入日志
|
|
Response response = client.newCall(request).execute();
|
|
Response response = client.newCall(request).execute();
|
|
handlerResponse(ctx, response, syncLogInfo);
|
|
handlerResponse(ctx, response, syncLogInfo);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鍚屾�鍛樺伐淇℃伅
|
|
|
|
|
|
+ * 同步员工信息
|
|
*
|
|
*
|
|
* @param ctx
|
|
* @param ctx
|
|
* @param billds
|
|
* @param billds
|
|
@@ -353,10 +356,11 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
@Override
|
|
@Override
|
|
protected void _syncPersonToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException {
|
|
protected void _syncPersonToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException {
|
|
super._syncPersonToOA(ctx, billds, action);
|
|
super._syncPersonToOA(ctx, billds, action);
|
|
|
|
+ _syncPersonFromOAById(ctx, billds);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鏍规嵁id浠嶰A绯荤粺鍚屾�浜哄憳淇℃伅
|
|
|
|
|
|
+ * 根据id从OA系统同步人员信息
|
|
*
|
|
*
|
|
* @param ctx
|
|
* @param ctx
|
|
* @param personIds
|
|
* @param personIds
|
|
@@ -381,13 +385,13 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
this._syncPersonFromOAByNumber(ctx, personNumbers.toString());
|
|
this._syncPersonFromOAByNumber(ctx, personNumbers.toString());
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
- throw new BOSException("鏍规嵁id浠嶰A绯荤粺鍚屾�浜哄憳淇℃伅鏂规硶鎶ラ敊: " + e.getMessage());
|
|
|
|
|
|
+ throw new BOSException("根据id从OA系统同步人员信息方法报错: " + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鏍规嵁宸ュ彿浠嶰A绯荤粺鍚屾�浜哄憳淇℃伅
|
|
|
|
|
|
+ * 根据工号从OA系统同步人员信息
|
|
*
|
|
*
|
|
* @param ctx
|
|
* @param ctx
|
|
* @param personNumbers
|
|
* @param personNumbers
|
|
@@ -405,10 +409,10 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
logger.error("_syncPersonFromOAByNumber -> personNumbers" + personNumbers);
|
|
logger.error("_syncPersonFromOAByNumber -> personNumbers" + personNumbers);
|
|
try {
|
|
try {
|
|
String updatePersonSql = "update t_bd_person set cfOAId = ? where fnumber = ?";
|
|
String updatePersonSql = "update t_bd_person set cfOAId = ? where fnumber = ?";
|
|
- int pagesize = 2000;//姣忛〉鏁伴噺
|
|
|
|
- int curpage = 1;//褰撳墠椤�
|
|
|
|
- int totalSize = 0;//鎬绘潯鏁�
|
|
|
|
- int totalPage = 0;//鎬婚〉鏁�
|
|
|
|
|
|
+ int pagesize = 2000;//每页数量
|
|
|
|
+ int curpage = 1;//当前页
|
|
|
|
+ int totalSize = 0;//总条数
|
|
|
|
+ int totalPage = 0;//总页数
|
|
List<Object[]> updateParams = new ArrayList<Object[]>();
|
|
List<Object[]> updateParams = new ArrayList<Object[]>();
|
|
boolean flag = true;
|
|
boolean flag = true;
|
|
do {
|
|
do {
|
|
@@ -437,7 +441,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 鎵ц�浠嶰A绯荤粺鍚屾�浜哄憳淇℃伅
|
|
|
|
|
|
+ * 执行从OA系统同步人员信息
|
|
*
|
|
*
|
|
* @param updateParams
|
|
* @param updateParams
|
|
* @param curpage
|
|
* @param curpage
|
|
@@ -445,7 +449,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
*/
|
|
*/
|
|
public Integer executeSyncPersonFromOA(List<Object[]> updateParams, int curpage, int pagesize, String personNumbers)
|
|
public Integer executeSyncPersonFromOA(List<Object[]> updateParams, int curpage, int pagesize, String personNumbers)
|
|
throws IOException, BOSException, EASBizException {
|
|
throws IOException, BOSException, EASBizException {
|
|
- //灏佽�璇锋眰鍙傛暟
|
|
|
|
|
|
+ //封装请求参数
|
|
String params = null;
|
|
String params = null;
|
|
if (StringUtils.isEmpty(personNumbers)) {
|
|
if (StringUtils.isEmpty(personNumbers)) {
|
|
params = String.format("token = %s ¶ms = {\"pagesize\":%d,\"curpage\":%d}", getToken(), pagesize, curpage);
|
|
params = String.format("token = %s ¶ms = {\"pagesize\":%d,\"curpage\":%d}", getToken(), pagesize, curpage);
|
|
@@ -453,17 +457,17 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
params = String.format("token = %s ¶ms = {\"workcode\":\"%s\",\"pagesize\":%d,\"curpage\":%d}", getToken(), personNumbers, pagesize, curpage);
|
|
params = String.format("token = %s ¶ms = {\"workcode\":\"%s\",\"pagesize\":%d,\"curpage\":%d}", getToken(), personNumbers, pagesize, curpage);
|
|
}
|
|
}
|
|
logger.error("executeSyncPersonFromOA----------------------params" + params);
|
|
logger.error("executeSyncPersonFromOA----------------------params" + params);
|
|
- //灏佽�璇锋眰鍙傛暟
|
|
|
|
- String syncPersonFromApiUrl = this.propt.getProperty("syncOrgUnitApiUrl");
|
|
|
|
- logger.error("executeSyncPersonFromOA----------------------syncOrgUnitApiUrl" + syncPersonFromApiUrl);
|
|
|
|
- if (StringUtils.isEmpty(syncPersonFromApiUrl)) {
|
|
|
|
- throw new BOSException("鑾峰彇浜哄憳鎺ュ彛鍦板潃涓嶈兘涓虹┖!");
|
|
|
|
|
|
+ //封装请求参数
|
|
|
|
+ String getHrmUserApiUrl = this.propt.getProperty("getHrmUserApiUrl");
|
|
|
|
+ logger.error("executeSyncPersonFromOA----------------------getHrmUserApiUrl" + getHrmUserApiUrl);
|
|
|
|
+ if (StringUtils.isEmpty(getHrmUserApiUrl)) {
|
|
|
|
+ throw new BOSException("获取人员接口地址不能为空!");
|
|
}
|
|
}
|
|
OkHttpClient client = new OkHttpClient();
|
|
OkHttpClient client = new OkHttpClient();
|
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
|
RequestBody body = RequestBody.create(mediaType, params);
|
|
RequestBody body = RequestBody.create(mediaType, params);
|
|
Request request = new Request.Builder()
|
|
Request request = new Request.Builder()
|
|
- .url(syncPersonFromApiUrl)
|
|
|
|
|
|
+ .url(getHrmUserApiUrl)
|
|
.post(body)
|
|
.post(body)
|
|
.addHeader("content-type", "application/x-www-form-urlencoded")
|
|
.addHeader("content-type", "application/x-www-form-urlencoded")
|
|
.build();
|
|
.build();
|
|
@@ -493,7 +497,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
throw new BOSException(msg);
|
|
throw new BOSException(msg);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- throw new BOSException("璇锋眰瓒呮椂");
|
|
|
|
|
|
+ throw new BOSException("请求超时");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|