|
@@ -131,13 +131,20 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
adminOrg.setFullname(orgName);
|
|
|
//adminOrg.setParent_code("ITCS");
|
|
|
adminOrg.setOrg_code("0");
|
|
|
- adminOrg.setParent_code(adminOrgUnitInfo.getParent().getNumber());
|
|
|
+ AdminOrgUnitInfo parent = adminOrgUnitInfo.getParent();
|
|
|
+ if (parent != null) {
|
|
|
+ adminOrg.setParent_code(parent.getNumber());
|
|
|
+ }
|
|
|
Map map = new HashMap();
|
|
|
//部门负责人
|
|
|
PositionInfo responPosition = adminOrgUnitInfo.getResponPosition();
|
|
|
- String responPositionId = responPosition.getId().toString();
|
|
|
- PersonPositionInfo personPositionInfo = getOAIDbyPostitonId(ctx, responPositionId);
|
|
|
- map.put("bmfzr", personPositionInfo.getPerson().getName());
|
|
|
+ if (responPosition != null) {
|
|
|
+ String responPositionId = responPosition.getId().toString();
|
|
|
+ PersonPositionInfo personPositionInfo = getOAIDbyPostitonId(ctx, responPositionId);
|
|
|
+ if (personPositionInfo != null && personPositionInfo.getPerson() != null) {
|
|
|
+ map.put("bmfzr", personPositionInfo.getPerson().getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
//经理 总监 副总
|
|
|
IPosition iPosition = PositionFactory.getLocalInstance(ctx);
|
|
|
PositionCollection positionCollection = iPosition.getPositionCollection("where adminOrgUnit = '" + adminOrgUnitInfo.getId() + "'");
|
|
@@ -145,25 +152,23 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
PositionInfo positionInfo = positionCollection.get(j);
|
|
|
String positionName = positionInfo.getName();
|
|
|
logger.error("_syncOrgUnitToOA---positionName---" + positionName);
|
|
|
- if ("经理".equals(positionName)) {
|
|
|
- PersonPositionInfo oaiDbyPostitonId = getOAIDbyPostitonId(ctx, positionInfo.getId().toString());
|
|
|
- //String oaid = oaiDbyPostitonId.getPerson().get("oAid").toString();
|
|
|
- String personName = oaiDbyPostitonId.getPerson().getName();
|
|
|
- map.put("bmjl", personName);
|
|
|
- }
|
|
|
- if ("总监".equals(positionName)) {
|
|
|
- PersonPositionInfo oaiDbyPostitonId = getOAIDbyPostitonId(ctx, positionInfo.getId().toString());
|
|
|
- String personName = oaiDbyPostitonId.getPerson().getName();
|
|
|
- map.put("jl", personName);
|
|
|
- }
|
|
|
- if ("副总经理".equals(positionName)) {
|
|
|
- PersonPositionInfo oaiDbyPostitonId = getOAIDbyPostitonId(ctx, positionInfo.getId().toString());
|
|
|
- String personName = oaiDbyPostitonId.getPerson().getName();
|
|
|
- map.put("fz", personName);
|
|
|
+ if ("经理".equals(positionName) || "总监".equals(positionName) || "副总经理".equals(positionName)) {
|
|
|
+ PersonPositionInfo oaiDbyPostiton = getOAIDbyPostitonId(ctx, positionInfo.getId().toString());
|
|
|
+ if (oaiDbyPostiton != null) {
|
|
|
+ String personName = oaiDbyPostiton.getPerson().getName();
|
|
|
+ if ("经理".equals(positionName)) {
|
|
|
+ map.put("bmjl", personName);
|
|
|
+ }
|
|
|
+ if ("总监".equals(positionName)) {
|
|
|
+ map.put("jl", personName);
|
|
|
+ }
|
|
|
+ if ("副总经理".equals(positionName)) {
|
|
|
+ map.put("fz", personName);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ adminOrg.setCustomData(map);
|
|
|
}
|
|
|
- adminOrg.setCustomData(map);
|
|
|
- //adminOrg.setOrder((String.valueOf(adminOrgUnitInfo.getIndex())));
|
|
|
dataList.add(adminOrg);
|
|
|
}
|
|
|
//执行同步组织到OA
|
|
@@ -187,7 +192,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
*/
|
|
|
public PersonPositionInfo getOAIDbyPostitonId(Context ctx, String postitonId) throws BOSException {
|
|
|
IPersonPosition iPersonPosition = PersonPositionFactory.getLocalInstance(ctx);
|
|
|
- PersonPositionCollection personPositionCollection = iPersonPosition.getPersonPositionCollection("select * ,person.name where primaryPosition = '" + postitonId + "'");
|
|
|
+ PersonPositionCollection personPositionCollection = iPersonPosition
|
|
|
+ .getPersonPositionCollection("select * ,person.name where primaryPosition = '" + postitonId + "'");
|
|
|
PersonPositionInfo personPositionInfo = personPositionCollection.get(0);
|
|
|
return personPositionInfo;
|
|
|
}
|
|
@@ -199,7 +205,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
* @param dataList
|
|
|
* @return
|
|
|
*/
|
|
|
- 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) {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
//封装请求参数
|
|
@@ -319,7 +326,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
* @throws BOSException
|
|
|
*/
|
|
|
@Override
|
|
|
- protected void _syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException {
|
|
|
+ protected void _syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws
|
|
|
+ BOSException, EASBizException {
|
|
|
ISyncLog iSyncLog = SyncLogFactory.getLocalInstance(ctx);
|
|
|
SyncLogInfo syncLogInfo = new SyncLogInfo();
|
|
|
syncLogInfo.setEntityName(SyncEntityNameEnum.postiton);
|
|
@@ -394,7 +402,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
* @return
|
|
|
* @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();
|
|
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
|
|
String data = String.format("token = %s &data = %s", getToken(), param);
|
|
@@ -425,7 +434,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
* @throws BOSException
|
|
|
*/
|
|
|
@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);
|
|
|
logger.error("_syncpersonToOA----------------------start");
|
|
|
logger.error("_syncpersonToOA----------------------billds: " + billds);
|
|
@@ -463,10 +473,6 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
sic.add("primaryPosition.id");
|
|
|
sic.add("primaryPosition.name");
|
|
|
sic.add("primaryPosition.number");
|
|
|
- sic.add("primaryPosition.job.name");
|
|
|
- sic.add("primaryPosition.job.number");
|
|
|
- sic.add("primaryPosition.job.jobType.name");
|
|
|
- sic.add("primaryPosition.job.jobType.number");
|
|
|
EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
PersonPositionCollection personPositionCollection = iPersonPosition.getPersonPositionCollection(entityViewInfo);
|
|
|
for (int i = 0; i < personPositionCollection.size(); i++) {
|
|
@@ -479,7 +485,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
logger.error("_syncpersonToOA------------------dataList----- " + mapper.writeValueAsString(dataList));
|
|
|
//调用执行人员组织到OA
|
|
|
executeSyncPersonToOA(ctx, dataList, syncLogInfo);
|
|
|
- _syncPersonFromOAById(ctx, billds);
|
|
|
+ //_syncPersonFromOAById(ctx, billds);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
syncLogInfo.setSyncStatus(SyncStatusEnum.ERROR);
|
|
@@ -494,7 +500,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
*
|
|
|
* @param dataList
|
|
|
*/
|
|
|
- public void executeSyncPersonToOA(Context ctx, List dataList, SyncLogInfo syncLogInfo) throws IOException, BOSException, EASBizException {
|
|
|
+ public void executeSyncPersonToOA(Context ctx, List dataList, SyncLogInfo syncLogInfo) throws
|
|
|
+ IOException, BOSException, EASBizException {
|
|
|
if (dataList != null && dataList.size() > 0) {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
//封装请求参数
|
|
@@ -533,7 +540,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
* @param personPositionInfo
|
|
|
* @return
|
|
|
*/
|
|
|
- public PersonEntity packagingPerson(Context ctx, PersonPositionInfo personPositionInfo) throws BOSException, EASBizException {
|
|
|
+ public PersonEntity packagingPerson(Context ctx, PersonPositionInfo personPositionInfo) throws
|
|
|
+ BOSException, EASBizException {
|
|
|
SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
//人员
|
|
|
PersonInfo personInfo = personPositionInfo.getPerson();
|
|
@@ -576,17 +584,14 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
//电子邮件
|
|
|
person.setEmail(personInfo.getEmail());
|
|
|
//入职日期
|
|
|
- IEmpEnrollBizBillEntry iEmpEnrollBizBillEntry = EmpEnrollBizBillEntryFactory.getLocalInstance(ctx);
|
|
|
- EmpEnrollBizBillEntryCollection empEnrollBizBillEntryCollection = iEmpEnrollBizBillEntry.getEmpEnrollBizBillEntryCollection("where person = '" + personInfo.getId() + "'");
|
|
|
- if (empEnrollBizBillEntryCollection.size() > 0) {
|
|
|
- EmpEnrollBizBillEntryInfo empEnrollBizBillEntryInfo = empEnrollBizBillEntryCollection.get(0);
|
|
|
- Date enrollDate = empEnrollBizBillEntryInfo.getEnrollDate();
|
|
|
- person.setCompanystartdate(originalFormat.format(enrollDate));
|
|
|
- //参加工作日期
|
|
|
- Date jobStartDate = empEnrollBizBillEntryInfo.getJobStartDate();
|
|
|
- if (jobStartDate != null) {
|
|
|
- person.setWorkstartdate(originalFormat.format(jobStartDate));
|
|
|
- }
|
|
|
+ Date enterDate = personPositionInfo.getEnterDate();
|
|
|
+ if (enterDate != null) {
|
|
|
+ person.setCompanystartdate(originalFormat.format(enterDate));
|
|
|
+ }
|
|
|
+ //参加工作日期
|
|
|
+ Date jobStartDate = personPositionInfo.getJobStartDate();
|
|
|
+ if (jobStartDate != null) {
|
|
|
+ person.setWorkstartdate(originalFormat.format(jobStartDate));
|
|
|
}
|
|
|
//登录名称
|
|
|
person.setLoginid(personInfo.getNumber());
|
|
@@ -654,7 +659,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
|
|
|
* @throws EASBizException
|
|
|
*/
|
|
|
@Override
|
|
|
- protected void _syncPersonFromOAByNumber(Context ctx, String personNumbers) throws BOSException, EASBizException {
|
|
|
+ protected void _syncPersonFromOAByNumber(Context ctx, String personNumbers) throws
|
|
|
+ BOSException, EASBizException {
|
|
|
super._syncPersonFromOAByNumber(ctx, personNumbers);
|
|
|
ISyncLog iSyncLog = SyncLogFactory.getLocalInstance(ctx);
|
|
|
logger.error("_syncPersonFromOAByNumber -> personNumbers" + personNumbers);
|