人员新增任务中增加同步OA绑定
This commit is contained in:
parent
5907e65433
commit
e75ce1af72
|
@ -22,6 +22,7 @@ import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import shkd.utils.DobeDWUtils;
|
import shkd.utils.DobeDWUtils;
|
||||||
|
import shkd.utils.OAUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -90,7 +91,7 @@ public class DobeDWpersonTask extends AbstractTask implements Plugin {
|
||||||
QFilter exprtFilter = new QFilter("number", QCP.not_in, exprtNumber);
|
QFilter exprtFilter = new QFilter("number", QCP.not_in, exprtNumber);
|
||||||
QFilter dwFilter = new QFilter("source", QCP.equals, "dw");
|
QFilter dwFilter = new QFilter("source", QCP.equals, "dw");
|
||||||
QFilter enableFilter = new QFilter("enable", QCP.equals, "1");
|
QFilter enableFilter = new QFilter("enable", QCP.equals, "1");
|
||||||
DynamicObject[] dos = BusinessDataServiceHelper.load("bos_user","id,enable,isforbidden",new QFilter[]{exprtFilter.and(dwFilter).and(enableFilter)});
|
DynamicObject[] dos = BusinessDataServiceHelper.load(entityName,"id,enable,isforbidden",new QFilter[]{exprtFilter.and(dwFilter).and(enableFilter)});
|
||||||
if(dos.length > 0){
|
if(dos.length > 0){
|
||||||
DynamicObject currentUser = null;
|
DynamicObject currentUser = null;
|
||||||
for (int i = 0; i < dos.length; i++) {
|
for (int i = 0; i < dos.length; i++) {
|
||||||
|
@ -227,10 +228,26 @@ public class DobeDWpersonTask extends AbstractTask implements Plugin {
|
||||||
}
|
}
|
||||||
if(addList.size() > 0){
|
if(addList.size() > 0){
|
||||||
UserServiceHelper.add(addList);
|
UserServiceHelper.add(addList);
|
||||||
|
List<DynamicObject> userinfos = new ArrayList<>();
|
||||||
|
DynamicObject userinfo = null;
|
||||||
//判断执行结果
|
//判断执行结果
|
||||||
for (UserParam result : addList) {
|
for (UserParam result : addList) {
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
log.info(String.format("人员新增异常:%s", result.getMsg()));
|
log.info(String.format("人员新增异常:%s", result.getMsg()));
|
||||||
|
}else{
|
||||||
|
userinfo = BusinessDataServiceHelper.newDynamicObject(entityName);;
|
||||||
|
userinfo.set("number",result.getDataMap().get("number"));//人员编号
|
||||||
|
userinfo.set("name",result.getDataMap().get("name"));//人员姓名
|
||||||
|
userinfos.add(userinfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//处理OA人员绑定
|
||||||
|
if(userinfos.size() > 0){
|
||||||
|
String billNo = "person-new-bid";
|
||||||
|
//获取token
|
||||||
|
String oaToken = OAUtils.getOaToken(billNo);
|
||||||
|
if (!DobeDWUtils.isEmpty(oaToken)) {
|
||||||
|
OAUtils.thirdpartyUser(userinfos, oaToken, billNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue