组织变更
This commit is contained in:
parent
c9cd94f094
commit
ef63d1dab5
|
|
@ -1,5 +1,6 @@
|
|||
package com.weaver.seconddev.jcl.organization.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
|
|
@ -12,17 +13,18 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @use:同步兼职信息到组织
|
||||
* @date 2025年6月18日
|
||||
* @use:开放平台-组织人事接口-封存部门
|
||||
* @date 2025年7月17日
|
||||
* @author xuxy
|
||||
*/
|
||||
@Service("RemoveCache_jcl")
|
||||
public class RemoveCache implements EsbServerlessRpcRemoteInterface {
|
||||
@Service("disableDepartment_jcl")
|
||||
public class DisableDepartment implements EsbServerlessRpcRemoteInterface {
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
|
@ -31,13 +33,15 @@ public class RemoveCache implements EsbServerlessRpcRemoteInterface {
|
|||
@Autowired
|
||||
private SyncDataUtils syncDataUtils;
|
||||
|
||||
public static String path = "/api/hrm/fix/removeCache";
|
||||
public static String path = "/api/hrm/restful/disableDepartment";
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoveCache.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(DisableDepartment.class);
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
String id = null!=params.get("id")?String.valueOf(params.get("id").toString()):"";
|
||||
log.error("syncDepartment.id : [{}]",id);
|
||||
|
||||
/**
|
||||
* 多租户查询主表名称(JCL_开放平台接口配置表)
|
||||
|
|
@ -45,56 +49,46 @@ public class RemoveCache implements EsbServerlessRpcRemoteInterface {
|
|||
Map<String, String> ebTablePzInfo = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", "uf_jcl_kfptjkpzb_tag");
|
||||
String objPzId = ebTablePzInfo.get("objId");
|
||||
String ebTablePzName = ebTablePzInfo.get("table_name");
|
||||
log.error("RemoveCache.objPzId:{},ebTablePzName:{}", objPzId,ebTablePzName);
|
||||
log.error("syncDepartment.objPzId:{},ebTablePzName:{}", objPzId,ebTablePzName);
|
||||
|
||||
/**
|
||||
* 获取token系统参数信息查询
|
||||
*/
|
||||
Map<String, Object> apiInfo = getApiInfo(ebTablePzName);
|
||||
String host = String.valueOf(apiInfo.get("ipdz"));
|
||||
log.error("RemoveCache.apiInfo:{}", apiInfo);
|
||||
|
||||
log.error("syncDepartment.apiInfo:{}", apiInfo);
|
||||
/**
|
||||
* 2.同步该数据到组织人员兼职信息
|
||||
*/
|
||||
|
||||
/**
|
||||
* 3.组装数据
|
||||
*/
|
||||
/***
|
||||
* 数据规则
|
||||
*/
|
||||
JSONArray paramArray = new JSONArray();
|
||||
String[] ids = id.split(",");
|
||||
for (String s : ids) {
|
||||
JSONObject paramJson = new JSONObject();
|
||||
//此处应该有多个id
|
||||
paramJson.put("id",s);
|
||||
paramArray.add(paramJson);
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("all",true);
|
||||
log.error("RemoveCache.jsonObject:{}", jsonObject);
|
||||
jsonObject.put("datas",paramArray);
|
||||
log.error("syncDepartment.jsonObject:{}", jsonObject);
|
||||
try {
|
||||
String accessToken = syncDataUtils.getToken(apiInfo);
|
||||
log.error("RemoveCache.accessToken:{}", accessToken);
|
||||
log.error("syncDepartment.accessToken:{}", accessToken);
|
||||
if(StringUtils.isNotBlank(accessToken)){
|
||||
jsonObject.put("access_token",accessToken);
|
||||
log.error("RemoveCache.result:jsonObject{},path:{},host:{}", jsonObject,path,host);
|
||||
result = syncDataUtils.doPostHttp(jsonObject, path,host);
|
||||
log.error("RemoveCache.result:111{}", result);
|
||||
// 获取 responseBody
|
||||
String responseBody = String.valueOf(result.get("responseBody"));
|
||||
log.error("RemoveCache.responseBody:{}", responseBody);
|
||||
// // 获取 data 列表
|
||||
// Gson gson = new Gson();
|
||||
// Type type = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
// Map<String, Object> responseBodyNew = gson.fromJson(responseBody, type);
|
||||
// log.error("RemoveCache.responseBodyNew:{}", responseBodyNew);
|
||||
// // 获取 data 列表
|
||||
// List<Map<String, Object>> data = (List<Map<String, Object>>) responseBodyNew.get("data");
|
||||
// log.error("RemoveCache.data:{}", data);
|
||||
// // 获取第一个元素的 keyValue
|
||||
// if (!data.isEmpty()) {
|
||||
// String keyValue = (String) data.get(0).get("keyValue");
|
||||
// log.error("RemoveCache.keyValue:{}", keyValue);
|
||||
// }
|
||||
log.error("syncDepartment.result:111{}", result);
|
||||
}else{
|
||||
result.put("status2","fail");
|
||||
}
|
||||
log.error("RemoveCache.result:{}", result);
|
||||
log.error("syncDepartment.result:{}", result);
|
||||
}catch (Exception e) {
|
||||
result.put("status2","exception");
|
||||
log.error("RemoveCache:"+e);
|
||||
log.error("Exception_em:"+e);
|
||||
}
|
||||
return WeaResult.success(result);
|
||||
}
|
||||
|
|
@ -105,7 +99,7 @@ public class RemoveCache implements EsbServerlessRpcRemoteInterface {
|
|||
*/
|
||||
public Map<String, Object> getApiInfo(String ebTablePzName){
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String sql = "select id,ipdz,jkbs,app_key,app_sec,corpid from "+ebTablePzName+" where DELETE_TYPE=0 and tenant_key = '"+RecruitModuleUtils.getCurrentTenantKey()+"' and jkbs ='syncExtra' ";
|
||||
String sql = "select id,ipdz,jkbs,app_key,app_sec,corpid from "+ebTablePzName+" where DELETE_TYPE=0 and tenant_key = '"+RecruitModuleUtils.getCurrentTenantKey()+"' and jkbs ='syncDepartment' ";
|
||||
log.error("getApiInfo.sql:{}", sql);
|
||||
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
||||
Loading…
Reference in New Issue