定时任务同步获取系统参数代码优化

This commit is contained in:
zengweihai 2024-06-04 15:28:45 +08:00
parent 29115f3041
commit bff7f48d66
3 changed files with 8 additions and 36 deletions

View File

@ -111,7 +111,7 @@ public class CostCenterTaskImpl extends AbstractTask {
private JSONObject getOAUserData(Query query,String oaUrl) { private JSONObject getOAUserData(Query query,String oaUrl) {
String requestBody = JSON.toJSONString(query); String requestBody = JSON.toJSONString(query);
//返回参数 //返回参数
String json = HttpRequest.post("http://" + oaUrl + "/api/hrm/resful/getHrmUserInfoWithPage").body(requestBody).execute().body(); String json = HttpRequest.post( oaUrl + "/api/hrm/resful/getHrmUserInfoWithPage").body(requestBody).execute().body();
JSONObject resultJson = JSONObject.parseObject(json);;//查询oa接口返回人员数据 JSONObject resultJson = JSONObject.parseObject(json);;//查询oa接口返回人员数据
String code = resultJson.getString("code");//第一次执行查询判断接口调用是否成功否则不执行后续逻辑 String code = resultJson.getString("code");//第一次执行查询判断接口调用是否成功否则不执行后续逻辑
if (!Objects.equals("1",code)){//当code不为1时调用失败 if (!Objects.equals("1",code)){//当code不为1时调用失败

View File

@ -137,9 +137,8 @@ public class HrmDepartmentTaskImpl extends AbstractTask implements Plugin {
*/ */
private JSONObject getOADepartment(Query query,String oaUrl){ private JSONObject getOADepartment(Query query,String oaUrl){
String requestBody = JSON.toJSONString(query); String requestBody = JSON.toJSONString(query);
oaUrl = "http://"+oaUrl+"/api/hrm/resful/getHrmdepartmentWithPage";
//返回参数 //返回参数
String json = HttpRequest.post(oaUrl).body(requestBody).execute().body(); String json = HttpRequest.post(oaUrl+"/api/hrm/resful/getHrmdepartmentWithPage").body(requestBody).execute().body();
JSONObject jsonObject = JSONObject.parseObject(json);//查询oa接口返回数据 JSONObject jsonObject = JSONObject.parseObject(json);//查询oa接口返回数据
String code = jsonObject.getString("code");//第一次执行查询判断接口调用是否成功否则不执行后续逻辑 String code = jsonObject.getString("code");//第一次执行查询判断接口调用是否成功否则不执行后续逻辑
if (!Objects.equals("1",code)){//当code不为1时调用失败 if (!Objects.equals("1",code)){//当code不为1时调用失败
@ -219,31 +218,4 @@ public class HrmDepartmentTaskImpl extends AbstractTask implements Plugin {
} }
return orgParam; return orgParam;
} }
// //数据服务接口修改数据
// OperateOption option = OperateOption.create();
// JSONObject item = dataList.getJSONObject(i);
// String id = item.getString("id");//oa部门id
// String departmentCode = item.getString("departmentcode");//部门编码
// String departmentName = item.getString("departmentname");// 全称
// String departmentMark = item.getString("departmentmark");// 简称
// String canceled = item.getString("canceled");// 封存标志1 封存其他为未封存 对应星瀚使用状态
// String supDepId = item.getString("supdepid");// 上级部门oaid
// Date created = item.getDate("created");// 创建时间戳
// Date modified = item.getDate("modified");// 修改时间戳
// //String subCompanyId1 = item.getString("subcompanyid1");// 分部id
// //String showOrder = item.getString("showorder");//排序
//
// QFilter qFilter = new QFilter("number", QCP.equals,departmentCode);
// DynamicObject bos_adminorg = BusinessDataServiceHelper.loadSingle("bos_adminorg", qFilter.toArray());
// if (bos_adminorg != null){//查找到晨曦公司修改其数据
// bos_adminorg.set("shkd_oaid",id);
// bos_adminorg.set("number",departmentCode);
// bos_adminorg.set("name",departmentName);
// bos_adminorg.set("simplename",departmentMark);
// bos_adminorg.set("enable",canceled.equals("1") ? "0":"1");
// bos_adminorg.set("createtime",created);
// bos_adminorg.set("modifytime",modified);
// OperationServiceHelper.executeOperate("save", "bos_adminorg", new DynamicObject[]{bos_adminorg}, option);
// }
} }

View File

@ -150,7 +150,7 @@ public class UserTaskImpl extends AbstractTask {
private JSONObject getOAUserData(Query query,String oaUrl){ private JSONObject getOAUserData(Query query,String oaUrl){
String requestBody = JSON.toJSONString(query); String requestBody = JSON.toJSONString(query);
//返回参数 //返回参数
String json = HttpRequest.post("http://" + oaUrl + "/api/hrm/resful/getHrmUserInfoWithPage").body(requestBody).execute().body(); String json = HttpRequest.post( oaUrl + "/api/hrm/resful/getHrmUserInfoWithPage").body(requestBody).execute().body();
JSONObject resultJson = JSONObject.parseObject(json);;//查询oa接口返回人员数据 JSONObject resultJson = JSONObject.parseObject(json);;//查询oa接口返回人员数据
String code = resultJson.getString("code");//第一次执行查询判断接口调用是否成功否则不执行后续逻辑 String code = resultJson.getString("code");//第一次执行查询判断接口调用是否成功否则不执行后续逻辑
if (!Objects.equals("1",code)){//当code不为1时调用失败 if (!Objects.equals("1",code)){//当code不为1时调用失败