|
|
@@ -19,32 +19,17 @@ import com.kingdee.eas.custom.beisen.utils.BeisenParamByPropertiesUtil;
|
|
|
import com.kingdee.eas.hr.ats.AtsUtil;
|
|
|
import com.kingdee.eas.hr.base.*;
|
|
|
import com.kingdee.eas.hr.emp.*;
|
|
|
-import com.kingdee.eas.util.ToolUtils;
|
|
|
import com.kingdee.eas.util.app.DbUtil;
|
|
|
import com.kingdee.jdbc.rowset.IRowSet;
|
|
|
import com.kingdee.util.DateTimeUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
|
-import javax.ejb.*;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
-import java.rmi.RemoteException;
|
|
|
|
|
|
import com.kingdee.bos.*;
|
|
|
-import com.kingdee.bos.util.BOSObjectType;
|
|
|
-import com.kingdee.bos.metadata.IMetaDataPK;
|
|
|
-import com.kingdee.bos.metadata.rule.RuleExecutor;
|
|
|
-import com.kingdee.bos.metadata.MetaDataPK;
|
|
|
-// import com.kingdee.bos.metadata.entity.EntityViewInfo;
|
|
|
-import com.kingdee.bos.framework.ejb.AbstractEntityControllerBean;
|
|
|
-import com.kingdee.bos.framework.ejb.AbstractBizControllerBean;
|
|
|
-// import com.kingdee.bos.dao.IObjectPK;
|
|
|
-import com.kingdee.bos.dao.IObjectValue;
|
|
|
-import com.kingdee.bos.dao.IObjectCollection;
|
|
|
-import com.kingdee.bos.service.ServiceContext;
|
|
|
-import com.kingdee.bos.service.IServiceContext;
|
|
|
|
|
|
import com.kingdee.eas.common.EASBizException;
|
|
|
|
|
|
@@ -65,47 +50,69 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
beisenApiClient = BeisenApiClient.getInstance();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
- protected void _beforeSyncPerson(Context ctx, int day) throws BOSException, EASBizException {
|
|
|
- // 获取到所有需要的personid
|
|
|
- Set<String> personSet = new HashSet();
|
|
|
- // 获取当前日期
|
|
|
- Date now = new Date();
|
|
|
- // 获取指定天数前的日期
|
|
|
- Date dayBefore = getDayBefore(now, day);
|
|
|
- FilterInfo filterInfo = new FilterInfo();
|
|
|
- FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
- filterItems.add(new FilterItemInfo("lastUpdateTime", dayBefore, CompareType.GREATER_EQUALS));
|
|
|
- filterItems.add(new FilterItemInfo("lastUpdateTime", now, CompareType.LESS_EQUALS));
|
|
|
- SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
- sic.add(new SelectorItemInfo("id"));
|
|
|
- IPerson iPerson = PersonFactory.getLocalInstance(ctx);
|
|
|
- EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
- PersonCollection personCol = iPerson.getPersonCollection(entityViewInfo);
|
|
|
- // 循环获取所有人员id
|
|
|
- for (int i = 0; i < personCol.size(); i++) {
|
|
|
- PersonInfo personInfo = personCol.get(i);
|
|
|
- personSet.add(personInfo.getId().toString());
|
|
|
- }
|
|
|
+ protected void _beforeSyncPerson(Context ctx, int day, String endDate) throws BOSException, EASBizException {
|
|
|
+ try {
|
|
|
+ Date now = null;
|
|
|
+ Date dayBefore = null;
|
|
|
+ // 获取到所有需要的personid
|
|
|
+ Set<String> personSet = new HashSet();
|
|
|
+ if (StringUtils.isEmpty(endDate)) {
|
|
|
+ // 获取当前日期
|
|
|
+ now = new Date();
|
|
|
+ // 获取指定天数前的日期
|
|
|
+ dayBefore = day > 0 ? getDayBefore(now, day) : getDayBefore(now, 5);
|
|
|
+ } else {
|
|
|
+ now = DateTimeUtils.parseDate(endDate);
|
|
|
+ // 获取指定天数前的日期
|
|
|
+ dayBefore = getDayBefore(now, day);
|
|
|
+ }
|
|
|
+ FilterInfo filterInfo = new FilterInfo();
|
|
|
+ FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
+ filterItems.add(new FilterItemInfo("lastUpdateTime", dayBefore, CompareType.GREATER_EQUALS));
|
|
|
+ filterItems.add(new FilterItemInfo("lastUpdateTime", now, CompareType.LESS_EQUALS));
|
|
|
+ logger.error("filterInfo--" + filterInfo.toSql());
|
|
|
+ SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
+ sic.add(new SelectorItemInfo("id"));
|
|
|
+ IPerson iPerson = PersonFactory.getLocalInstance(ctx);
|
|
|
+ EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
+ PersonCollection personCol = iPerson.getPersonCollection(entityViewInfo);
|
|
|
+ // 循环获取所有人员id
|
|
|
+ for (int i = 0; i < personCol.size(); i++) {
|
|
|
+ PersonInfo personInfo = personCol.get(i);
|
|
|
+ personSet.add(personInfo.getId().toString());
|
|
|
+ }
|
|
|
|
|
|
- sic = new SelectorItemCollection();
|
|
|
- sic.add(new SelectorItemInfo("person.id"));
|
|
|
- entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
- // 获取员工变动记录的personid
|
|
|
- IEmpPosOrgRelation empIns = EmpPosOrgRelationFactory.getLocalInstance(ctx);
|
|
|
- EmpPosOrgRelationCollection empCol = empIns.getEmpPosOrgRelationCollection(entityViewInfo);
|
|
|
- // 循环获取所有人员id
|
|
|
- for (int i = 0; i < empCol.size(); i++) {
|
|
|
- EmpPosOrgRelationInfo empPosOrgRelation = empCol.get(i);
|
|
|
- String personIdStr = empPosOrgRelation.getPerson().getId().toString();
|
|
|
- personSet.add(personIdStr);
|
|
|
+ sic = new SelectorItemCollection();
|
|
|
+ sic.add(new SelectorItemInfo("person.id"));
|
|
|
+ entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
+ // 获取员工变动记录的personid
|
|
|
+ IEmpPosOrgRelation empIns = EmpPosOrgRelationFactory.getLocalInstance(ctx);
|
|
|
+ EmpPosOrgRelationCollection empCol = empIns.getEmpPosOrgRelationCollection(entityViewInfo);
|
|
|
+ // 循环获取所有人员id
|
|
|
+ for (int i = 0; i < empCol.size(); i++) {
|
|
|
+ EmpPosOrgRelationInfo empPosOrgRelation = empCol.get(i);
|
|
|
+ String personIdStr = empPosOrgRelation.getPerson().getId().toString();
|
|
|
+ personSet.add(personIdStr);
|
|
|
+ }
|
|
|
+ // 同步到beisen
|
|
|
+ String s = convertSetToString(personSet);
|
|
|
+ _syncPerson(ctx, s, day);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new RuntimeException(e);
|
|
|
}
|
|
|
- // 同步到beisen
|
|
|
- String s = convertSetToString(personSet);
|
|
|
- _syncPerson(ctx, s, day);
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
+ SyncPersonToBeisenFacadeControllerBean syncPersonToBeisenFacadeControllerBean = new SyncPersonToBeisenFacadeControllerBean();
|
|
|
+ Date now = new Date();
|
|
|
+ Date dayBefore = syncPersonToBeisenFacadeControllerBean.getDayBefore(now, 455);
|
|
|
+ System.out.println(DateTimeUtils.format(dayBefore));
|
|
|
+ }
|
|
|
+
|
|
|
public static String convertSetToString(Set set) {
|
|
|
if (set != null && set.size() > 0) {
|
|
|
Iterator iter = set.iterator();
|
|
|
@@ -134,7 +141,7 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
* @throws EASBizException
|
|
|
*/
|
|
|
@Override
|
|
|
- protected void _syncPerson(Context ctx, String personId, int day) throws BOSException, EASBizException {
|
|
|
+ protected String _syncPerson(Context ctx, String personId, int day) throws BOSException, EASBizException {
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
@@ -163,7 +170,7 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
}
|
|
|
}
|
|
|
// 查询所有人的直接上级
|
|
|
- Map personParentMap = getPersonParent(ctx);
|
|
|
+ Map<String, Set<String>> personParentMap = getPersonParent(ctx);
|
|
|
IPersonPosition iPersonPosition = PersonPositionFactory.getLocalInstance(ctx);
|
|
|
EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
PersonPositionCollection personPositionCollection = iPersonPosition.getPersonPositionCollection(entityViewInfo);
|
|
|
@@ -174,6 +181,7 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
Map msgMap = new HashMap();
|
|
|
PersonPositionInfo personPositionInfo = personPositionCollection.get(i);
|
|
|
PersonInfo person = personPositionInfo.getPerson();
|
|
|
+ msgMap.put("personId", person.getId().toString());
|
|
|
String email = person.getEmail();
|
|
|
if (StringUtils.isEmpty(email)) {
|
|
|
// throw new BOSException(person.getName() + "同步失败:邮箱不能为空,请维护!!");
|
|
|
@@ -181,14 +189,12 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
jsonArray.add(msgMap);
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
Object bsUserId = person.get("bsUserId"); // 用户ID
|
|
|
Object beisenId = person.get("beisenId");// 入职单基本信息ID
|
|
|
logger.error("bsUserId--" + bsUserId);
|
|
|
logger.error("beisenId--" + beisenId);
|
|
|
String originalId = URLEncoder.encode(person.getId().toString(), StandardCharsets.UTF_8.name());
|
|
|
- String nCell = person.getNCell();
|
|
|
+ String nCell = "(" + person.getGlobalRoaming() + ")" + person.getNCell();
|
|
|
String name = person.getName();
|
|
|
msgMap.put("number", person.getNumber());
|
|
|
msgMap.put("name", name);
|
|
|
@@ -198,28 +204,41 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
|
|
|
|
|
|
JSONObject personJson = new JSONObject();
|
|
|
+ JSONObject customFieldList = new JSONObject();
|
|
|
// 基本信息
|
|
|
+ personJson.put("staffCode", person.getNumber());// 工号
|
|
|
personJson.put("email", email);// 邮箱
|
|
|
personJson.put("userName", email);// 用户名
|
|
|
personJson.put("name", name);// 姓名
|
|
|
personJson.put("originalId", person.getId().toString());// 来源方用户ID
|
|
|
personJson.put("mobile", nCell);// 手机号
|
|
|
+ personJson.put(config.get("HIREDATE"), DateTimeUtils.format(person.getHireDate()));// 入职日期
|
|
|
+ msgMap.put("personJson", personJson);
|
|
|
// 用工信息
|
|
|
EmployeeTypeInfo employeeType = person.getEmployeeType();
|
|
|
EmployeeTypeEnum inServiceEnum = employeeType.getInService();
|
|
|
personJson.put("origin", 1);// 1:平台
|
|
|
- personJson.put(config.get("EMPLOYEETYPENUMBER"), employeeType.getNumber());// 用工关系状态
|
|
|
+ customFieldList.put(config.get("EMPLOYEETYPENUMBER"), employeeType.getNumber());// 用工关系状态
|
|
|
+
|
|
|
// 组织信息
|
|
|
AdminOrgUnitInfo personDep = personPositionInfo.getPersonDep();
|
|
|
personJson.put("departmentOriginalId", personDep.getId());// 部门外部标识
|
|
|
- personJson.put(config.get("HIREDATE"), DateTimeUtils.format(person.getHireDate()));// 入职日期
|
|
|
+ // customFieldList.put(config.get("HIREDATE"), DateTimeUtils.format(person.getHireDate()));// 入职日期
|
|
|
// 上级信息
|
|
|
- Object lineManagerOriginalId = personParentMap.get(personId) == null ? null : URLEncoder.encode(personParentMap.get(personId).toString(), StandardCharsets.UTF_8.name());
|
|
|
- personJson.put(config.get("lineManagerOriginalId"), lineManagerOriginalId);// 直线上级外部标识
|
|
|
+ logger.error("personParentMap.get(person.getId().toString()) --" + personParentMap.get(person.getId().toString()));
|
|
|
+ Set<String> bsUserIds = personParentMap.get(person.getId().toString());
|
|
|
+ Object lineManagerOriginalId = convertSetToString(bsUserIds);
|
|
|
+ logger.error("lineManagerOriginalId--" + lineManagerOriginalId);
|
|
|
+ logger.error("config.get(lineManagerOriginalId)--" + config.get("lineManagerOriginalId"));
|
|
|
+ customFieldList.put(config.get("lineManagerOriginalId"), lineManagerOriginalId);// 直线上级外部标识
|
|
|
// 岗位信息
|
|
|
PositionInfo primaryPosition = personPositionInfo.getPrimaryPosition();
|
|
|
- personJson.put(config.get("positionNumber"), primaryPosition.getNumber());// 岗位编码
|
|
|
- personJson.put(config.get("positionName"), primaryPosition.getName());// 岗位名称
|
|
|
+ customFieldList.put(config.get("positionNumber"), primaryPosition.getNumber());// 岗位编码
|
|
|
+ customFieldList.put(config.get("positionName"), primaryPosition.getName());// 岗位名称
|
|
|
+ personJson.put("customFieldList", customFieldList);// 自定义字段集合
|
|
|
+ logger.error("personJson--" + personJson);
|
|
|
+ System.out.println("personJson--" + personJson);
|
|
|
+
|
|
|
// 判断是否在北森存在 如果beisenId为空并且是在职状态需要再北森创建员工
|
|
|
if (beisenId == null) {
|
|
|
if (bsUserId == null) {
|
|
|
@@ -231,9 +250,10 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
}
|
|
|
// 创建员工信息
|
|
|
String staffsPost = config.get("STAFFSPOST");
|
|
|
- logger.error("personJson--" + personJson);
|
|
|
JSONObject staffs = beisenApiClient.callApi(staffsPost, personJson);
|
|
|
if (!"200".equals(staffs.getString("code"))) {
|
|
|
+ msgMap = new HashMap();
|
|
|
+ msgMap.put("personId", person.getId().toString());
|
|
|
msgMap.put("message", "创建员工信息失败,原因:" + staffs.get("message"));
|
|
|
jsonArray.add(msgMap);
|
|
|
continue;
|
|
|
@@ -244,7 +264,13 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
msgMap.put("bsUserId", data);
|
|
|
msgMap.put("创建员工信息:", staffs.get("message"));
|
|
|
} else {
|
|
|
+ logger.error("updatePersonInfoInBeisen--1");
|
|
|
updatePersonInfoInBeisen(personJson, config, (String) bsUserId, msgMap);
|
|
|
+ if (inServiceEnum.getValue() == 2 || inServiceEnum.getValue() == 0) {
|
|
|
+ updateDimission(config, originalId, msgMap);
|
|
|
+ } else if (inServiceEnum.getValue() == 1) {
|
|
|
+ updateInduction(config, originalId, msgMap);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
// 查询待入职人员信息 通过beisenId 入职员工ID获取入职记录guid和userId
|
|
|
@@ -268,6 +294,7 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
// 更新bsUserId
|
|
|
updatePersonBensenId(ctx, person, (String) bsUserId);
|
|
|
}
|
|
|
+ logger.error("updatePersonInfoInBeisen--2");
|
|
|
updatePersonInfoInBeisen(personJson, config, userId, msgMap);
|
|
|
// 更新bsUserId
|
|
|
updatePersonBensenId(ctx, person, userId);
|
|
|
@@ -280,7 +307,20 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
// staffInfos.put("email", email);
|
|
|
staffInfos.put("mobilePhone", nCell);
|
|
|
staffInfos.put("staffStatus", 1);
|
|
|
+ // 入职记录
|
|
|
+ JSONArray entryRecord = new JSONArray();
|
|
|
+ JSONObject entryRecordData = new JSONObject();
|
|
|
+ entryRecordData.put("id", result.get("guid"));
|
|
|
+ JSONArray extendInfos = new JSONArray();
|
|
|
+ JSONObject extendInfo = new JSONObject();
|
|
|
+ extendInfo.put("text", ""); // 入职用工关系状态
|
|
|
+ extendInfo.put("name", config.get("RZEMPLOYEETYPENUMBER")); // 入职用工关系状态
|
|
|
+ extendInfo.put("value", employeeType.getNumber()); // 入职用工关系状态
|
|
|
+ extendInfos.add(extendInfo);
|
|
|
+ entryRecordData.put("extendInfos", extendInfos);
|
|
|
+ entryRecord.add(entryRecordData);
|
|
|
updateStaffInfo.put("staffInfos", staffInfos);
|
|
|
+ updateStaffInfo.put("entryRecord", entryRecord);
|
|
|
logger.error("updateStaffInfo--" + updateStaffInfo);
|
|
|
JSONObject updateStaffRet = beisenApiClient.callApi(config.get("UPDATESTAFFURL"), updateStaffInfo);
|
|
|
msgMap.put("更新待入职人员信息:", updateStaffRet.get("code"));
|
|
|
@@ -288,10 +328,11 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
// 通过userId更新员工信息
|
|
|
if (inServiceEnum.getValue() == 2 || inServiceEnum.getValue() == 0) {
|
|
|
// 通过OriginalId设置员工离职
|
|
|
- String putSetdimission = config.get("PUTSETDIMISSION") + "=" + originalId;
|
|
|
- logger.error("putSetdimission--" + putSetdimission);
|
|
|
- JSONObject setdimission = beisenApiClient.callPutApi(putSetdimission, new JSONObject());
|
|
|
- msgMap.put("通过OriginalId设置员工离职:", setdimission.get("message"));
|
|
|
+ // String putSetdimission = config.get("PUTSETDIMISSION") + "=" + originalId;
|
|
|
+ // logger.error("putSetdimission--" + putSetdimission);
|
|
|
+ // JSONObject setdimission = beisenApiClient.callPutApi(putSetdimission, new JSONObject());
|
|
|
+ // msgMap.put("通过OriginalId设置员工离职:", setdimission.get("message"));
|
|
|
+ updateDimission(config, originalId, msgMap);
|
|
|
// 入职管理设置离职
|
|
|
String recruitOnBoardingPost = config.get("RECRUITONBOARDINGPOST") + "?entryId=" + result.get("guid");
|
|
|
logger.error("recruitOnBoardingPost--" + recruitOnBoardingPost);
|
|
|
@@ -300,10 +341,7 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
} else if (inServiceEnum.getValue() == 1) {
|
|
|
// 入职管理设置已入职 需求变更无需调用该接口
|
|
|
// 设置员工在职
|
|
|
- String putSetinduction = config.get("PUTSETINDUCTION") + "?originalId=" + originalId + "&accountEnable=true";
|
|
|
- logger.error("putSetinduction--" + putSetinduction);
|
|
|
- JSONObject setinduction = beisenApiClient.callPutApi(putSetinduction, new JSONObject());
|
|
|
- msgMap.put("设置员工在职:", setinduction.get("message"));
|
|
|
+ updateInduction(config, originalId, msgMap);
|
|
|
}
|
|
|
}
|
|
|
jsonArray.add(msgMap);
|
|
|
@@ -314,7 +352,42 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
jsonArray.add(e.getMessage());
|
|
|
// throw new RuntimeException(e);
|
|
|
}
|
|
|
- logger.error("jsonArray--" + jsonArray);
|
|
|
+ logger.error("jsonArray--" + jsonArray.toString());
|
|
|
+ System.out.println("jsonArray--" + jsonArray);
|
|
|
+ return jsonArray.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过OriginalId设置员工离职
|
|
|
+ *
|
|
|
+ * @param config
|
|
|
+ * @param originalId
|
|
|
+ * @param msgMap
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ public void updateInduction(Map config, String originalId, Map msgMap) throws IOException {
|
|
|
+ // 设置员工在职
|
|
|
+ String putSetinduction = config.get("PUTSETINDUCTION") + "?originalId=" + originalId + "&accountEnable=true";
|
|
|
+ logger.error("putSetinduction--" + putSetinduction);
|
|
|
+ JSONObject setinduction = beisenApiClient.callPutApi(putSetinduction, new JSONObject());
|
|
|
+ msgMap.put("设置员工在职:", setinduction.get("message"));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过OriginalId设置员工离职
|
|
|
+ *
|
|
|
+ * @param config
|
|
|
+ * @param originalId
|
|
|
+ * @param msgMap
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ public void updateDimission(Map config, String originalId, Map msgMap) throws IOException {
|
|
|
+ // 通过OriginalId设置员工离职
|
|
|
+ String putSetdimission = config.get("PUTSETDIMISSION") + "=" + originalId;
|
|
|
+ logger.error("putSetdimission--" + putSetdimission);
|
|
|
+ JSONObject setdimission = beisenApiClient.callPutApi(putSetdimission, new JSONObject());
|
|
|
+ msgMap.put("通过OriginalId设置员工离职:", setdimission.get("message"));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -325,7 +398,6 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
personJson.remove("userName");
|
|
|
String putbyuserid = config.get("PUTBYUSERID") + "?userId=" + userId;
|
|
|
logger.error("putbyuserid--" + putbyuserid);
|
|
|
- logger.error("personJson--" + personJson);
|
|
|
JSONObject updateStaffs = beisenApiClient.callPutApi(putbyuserid, personJson);
|
|
|
msgMap.put("通过userId更新员工信息:", updateStaffs.get("message"));
|
|
|
}
|
|
|
@@ -394,7 +466,7 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
for (int q = 0; q < employmentRecord.size(); q++) {
|
|
|
JSONObject employment = employmentRecord.getJSONObject(q);
|
|
|
String entryDate = employment.getString("entryDate");
|
|
|
- logger.debug("entryDate--" + entryDate);
|
|
|
+ logger.error("entryDate--" + entryDate);
|
|
|
// 处理entryDate为空的数据必须要保存一条数据,如果不为空则保存最新的一条数据
|
|
|
result.put("userID", employment.getString("userID"));
|
|
|
if (!StringUtils.isEmpty(entryDate) && DateTimeUtils.parseDate(entryDate).getTime() > dataTime) {
|
|
|
@@ -434,9 +506,9 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
* @return
|
|
|
*/
|
|
|
public Map getPersonParent(Context ctx) throws BOSException, SQLException {
|
|
|
- Map personParentMap = new HashMap();
|
|
|
+ Map<String, Set> personParentMap = new HashMap();
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
- sb.append("select person.fid as personId , personParent.fid as personParentId\n").append("\n");
|
|
|
+ sb.append("select person.fid as personId , personParent.fid as personParentId,personParent.CFBsUserId userId\n").append("\n");
|
|
|
sb.append("from T_ORG_PositionMember positioonMenber\n").append("\n");
|
|
|
sb.append("left join T_ORG_Position position on position.fid = positioonMenber.FPositionID\n").append("\n");
|
|
|
sb.append("left join T_ORG_Position positionParent on position.fid = positionParent.FPARENTID\n").append("\n");
|
|
|
@@ -445,11 +517,18 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
sb.append("left join t_Bd_person personParent on personParent.fid = positioonMenber.FPERSONID").append("\n");
|
|
|
IRowSet iRowSet = DbUtil.executeQuery(ctx, sb.toString());
|
|
|
while (iRowSet.next()) {
|
|
|
- personParentMap.put(iRowSet.getString("personId"), iRowSet.getString("personParentId"));
|
|
|
+ Set set = new HashSet();
|
|
|
+ if (personParentMap.containsKey(iRowSet.getString("personId"))) {
|
|
|
+ set = personParentMap.get(iRowSet.getString("personId"));
|
|
|
+ }
|
|
|
+ set.add(iRowSet.getString("userId"));
|
|
|
+ personParentMap.put(iRowSet.getString("personId"), set);
|
|
|
+ // personParentMap.put(iRowSet.getString("personId"), iRowSet.getString("personParentId"));
|
|
|
}
|
|
|
return personParentMap;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 查询字段
|
|
|
*
|
|
|
@@ -467,6 +546,7 @@ public class SyncPersonToBeisenFacadeControllerBean extends AbstractSyncPersonTo
|
|
|
sic.add("person.nCell");
|
|
|
sic.add("person.gender");
|
|
|
sic.add("person.email");
|
|
|
+ sic.add("person.globalRoaming");
|
|
|
sic.add("person.employeeType.name");
|
|
|
sic.add("person.employeeType.number");
|
|
|
sic.add("person.employeeType.inService");
|