Browse Source

更新同步Oa元数据

Heyuan 9 months ago
parent
commit
edad6f6436

+ 4 - 5
metadata/com/kingdee/eas/custom/synctask/SyncTranForOAFacade.facade

@@ -20,7 +20,7 @@
       <innerID>abeed33f-d70a-46f2-a853-0153b781da73</innerID>
       <innerID>abeed33f-d70a-46f2-a853-0153b781da73</innerID>
       <accessLevel>public</accessLevel>
       <accessLevel>public</accessLevel>
       <subClassingMode>normal</subClassingMode>
       <subClassingMode>normal</subClassingMode>
-      <returnValueType />
+      <returnValueType>java.util.Map</returnValueType>
       <metadataRef />
       <metadataRef />
       <transactionAttribute>Supports</transactionAttribute>
       <transactionAttribute>Supports</transactionAttribute>
       <userDefined>true</userDefined>
       <userDefined>true</userDefined>
@@ -61,7 +61,7 @@
       <innerID>66cda9b5-ce91-4eb0-bfcd-6f9e16fc0d1f</innerID>
       <innerID>66cda9b5-ce91-4eb0-bfcd-6f9e16fc0d1f</innerID>
       <accessLevel>public</accessLevel>
       <accessLevel>public</accessLevel>
       <subClassingMode>normal</subClassingMode>
       <subClassingMode>normal</subClassingMode>
-      <returnValueType />
+      <returnValueType>java.util.Map</returnValueType>
       <metadataRef />
       <metadataRef />
       <transactionAttribute>Supports</transactionAttribute>
       <transactionAttribute>Supports</transactionAttribute>
       <userDefined>true</userDefined>
       <userDefined>true</userDefined>
@@ -102,7 +102,7 @@
       <innerID>991851e6-d2e5-40de-94aa-51c558bc080d</innerID>
       <innerID>991851e6-d2e5-40de-94aa-51c558bc080d</innerID>
       <accessLevel>public</accessLevel>
       <accessLevel>public</accessLevel>
       <subClassingMode>normal</subClassingMode>
       <subClassingMode>normal</subClassingMode>
-      <returnValueType />
+      <returnValueType>java.util.Map</returnValueType>
       <metadataRef />
       <metadataRef />
       <transactionAttribute>Supports</transactionAttribute>
       <transactionAttribute>Supports</transactionAttribute>
       <userDefined>true</userDefined>
       <userDefined>true</userDefined>
@@ -231,8 +231,7 @@
     </rs>
     </rs>
     <rs key="facade[com.kingdee.eas.custom.synctask.SyncTranForOAFacade].methods.method[syncOrgUnitToOA].description">
     <rs key="facade[com.kingdee.eas.custom.synctask.SyncTranForOAFacade].methods.method[syncOrgUnitToOA].description">
       <lang locale="en_US" value="null" />
       <lang locale="en_US" value="null" />
-      <lang locale="zh_CN" value="null" />
-      <lang locale="zh_HK" value="null" />
+      <lang locale="zh_CN" value="" />
       <lang locale="zh_TW" value="null" />
       <lang locale="zh_TW" value="null" />
     </rs>
     </rs>
     <rs key="facade[com.kingdee.eas.custom.synctask.SyncTranForOAFacade].methods.method[syncOrgUnitToOA].parameters.parameter[action].alias">
     <rs key="facade[com.kingdee.eas.custom.synctask.SyncTranForOAFacade].methods.method[syncOrgUnitToOA].parameters.parameter[action].alias">

+ 22 - 15
src/com/kingdee/eas/custom/synctask/AbstractSyncTranForOAFacadeControllerBean.java

@@ -21,6 +21,7 @@ import com.kingdee.eas.framework.exception.EASMultiException;
 import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
 import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
 
 
 import com.kingdee.eas.common.EASBizException;
 import com.kingdee.eas.common.EASBizException;
+import java.util.Map;
 import java.lang.String;
 import java.lang.String;
 
 
 
 
@@ -36,15 +37,17 @@ public abstract class AbstractSyncTranForOAFacadeControllerBean extends Abstract
         return new BOSObjectType("07053019");
         return new BOSObjectType("07053019");
     }
     }
 
 
-    public void syncOrgUnitToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
+    public Map syncOrgUnitToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
     {
     {
         try {
         try {
             ServiceContext svcCtx = createServiceContext(new MetaDataPK("abeed33f-d70a-46f2-a853-0153b781da73"), new Object[]{ctx, billds, action});
             ServiceContext svcCtx = createServiceContext(new MetaDataPK("abeed33f-d70a-46f2-a853-0153b781da73"), new Object[]{ctx, billds, action});
             invokeServiceBefore(svcCtx);
             invokeServiceBefore(svcCtx);
-              if(!svcCtx.invokeBreak()) {
-            _syncOrgUnitToOA(ctx, billds, action);
+            if(!svcCtx.invokeBreak()) {
+            Map retValue = (Map)_syncOrgUnitToOA(ctx, billds, action);
+            svcCtx.setMethodReturnValue(retValue);
             }
             }
             invokeServiceAfter(svcCtx);
             invokeServiceAfter(svcCtx);
+            return (Map)svcCtx.getMethodReturnValue();
         } catch (BOSException ex) {
         } catch (BOSException ex) {
             throw ex;
             throw ex;
         } catch (EASBizException ex0) {
         } catch (EASBizException ex0) {
@@ -53,20 +56,22 @@ public abstract class AbstractSyncTranForOAFacadeControllerBean extends Abstract
             super.cleanUpServiceState();
             super.cleanUpServiceState();
         }
         }
     }
     }
-    protected void _syncOrgUnitToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
+    protected Map _syncOrgUnitToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
     {    	
     {    	
-        return;
+        return null;
     }
     }
 
 
-    public void syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
+    public Map syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
     {
     {
         try {
         try {
             ServiceContext svcCtx = createServiceContext(new MetaDataPK("66cda9b5-ce91-4eb0-bfcd-6f9e16fc0d1f"), new Object[]{ctx, billds, action});
             ServiceContext svcCtx = createServiceContext(new MetaDataPK("66cda9b5-ce91-4eb0-bfcd-6f9e16fc0d1f"), new Object[]{ctx, billds, action});
             invokeServiceBefore(svcCtx);
             invokeServiceBefore(svcCtx);
-              if(!svcCtx.invokeBreak()) {
-            _syncPositionToOA(ctx, billds, action);
+            if(!svcCtx.invokeBreak()) {
+            Map retValue = (Map)_syncPositionToOA(ctx, billds, action);
+            svcCtx.setMethodReturnValue(retValue);
             }
             }
             invokeServiceAfter(svcCtx);
             invokeServiceAfter(svcCtx);
+            return (Map)svcCtx.getMethodReturnValue();
         } catch (BOSException ex) {
         } catch (BOSException ex) {
             throw ex;
             throw ex;
         } catch (EASBizException ex0) {
         } catch (EASBizException ex0) {
@@ -75,20 +80,22 @@ public abstract class AbstractSyncTranForOAFacadeControllerBean extends Abstract
             super.cleanUpServiceState();
             super.cleanUpServiceState();
         }
         }
     }
     }
-    protected void _syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
+    protected Map _syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
     {    	
     {    	
-        return;
+        return null;
     }
     }
 
 
-    public void syncPersonToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
+    public Map syncPersonToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
     {
     {
         try {
         try {
             ServiceContext svcCtx = createServiceContext(new MetaDataPK("991851e6-d2e5-40de-94aa-51c558bc080d"), new Object[]{ctx, billds, action});
             ServiceContext svcCtx = createServiceContext(new MetaDataPK("991851e6-d2e5-40de-94aa-51c558bc080d"), new Object[]{ctx, billds, action});
             invokeServiceBefore(svcCtx);
             invokeServiceBefore(svcCtx);
-              if(!svcCtx.invokeBreak()) {
-            _syncPersonToOA(ctx, billds, action);
+            if(!svcCtx.invokeBreak()) {
+            Map retValue = (Map)_syncPersonToOA(ctx, billds, action);
+            svcCtx.setMethodReturnValue(retValue);
             }
             }
             invokeServiceAfter(svcCtx);
             invokeServiceAfter(svcCtx);
+            return (Map)svcCtx.getMethodReturnValue();
         } catch (BOSException ex) {
         } catch (BOSException ex) {
             throw ex;
             throw ex;
         } catch (EASBizException ex0) {
         } catch (EASBizException ex0) {
@@ -97,9 +104,9 @@ public abstract class AbstractSyncTranForOAFacadeControllerBean extends Abstract
             super.cleanUpServiceState();
             super.cleanUpServiceState();
         }
         }
     }
     }
-    protected void _syncPersonToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
+    protected Map _syncPersonToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException
     {    	
     {    	
-        return;
+        return null;
     }
     }
 
 
     public void syncPersonFromOAByNumber(Context ctx, String personNumbers) throws BOSException, EASBizException
     public void syncPersonFromOAByNumber(Context ctx, String personNumbers) throws BOSException, EASBizException

+ 4 - 3
src/com/kingdee/eas/custom/synctask/ISyncTranForOAFacade.java

@@ -9,15 +9,16 @@ import com.kingdee.bos.Context;
 import com.kingdee.bos.BOSException;
 import com.kingdee.bos.BOSException;
 import com.kingdee.bos.util.*;
 import com.kingdee.bos.util.*;
 import com.kingdee.eas.common.EASBizException;
 import com.kingdee.eas.common.EASBizException;
+import java.util.Map;
 import java.lang.String;
 import java.lang.String;
 import com.kingdee.bos.Context;
 import com.kingdee.bos.Context;
 import com.kingdee.bos.framework.*;
 import com.kingdee.bos.framework.*;
 
 
 public interface ISyncTranForOAFacade extends IBizCtrl
 public interface ISyncTranForOAFacade extends IBizCtrl
 {
 {
-    public void syncOrgUnitToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException;
-    public void syncPositionToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException;
-    public void syncPersonToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException;
+    public Map syncOrgUnitToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException;
+    public Map syncPositionToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException;
+    public Map syncPersonToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException;
     public void syncPersonFromOAByNumber(String personNumbers) throws BOSException, EASBizException;
     public void syncPersonFromOAByNumber(String personNumbers) throws BOSException, EASBizException;
     public void syncPersonFromOAById(String personIds) throws BOSException, EASBizException;
     public void syncPersonFromOAById(String personIds) throws BOSException, EASBizException;
 }
 }

+ 10 - 6
src/com/kingdee/eas/custom/synctask/SyncTranForOAFacade.java

@@ -9,6 +9,7 @@ import com.kingdee.bos.orm.template.ORMObject;
 import com.kingdee.bos.BOSException;
 import com.kingdee.bos.BOSException;
 import com.kingdee.bos.util.*;
 import com.kingdee.bos.util.*;
 import com.kingdee.eas.common.EASBizException;
 import com.kingdee.eas.common.EASBizException;
+import java.util.Map;
 import java.lang.String;
 import java.lang.String;
 import com.kingdee.bos.Context;
 import com.kingdee.bos.Context;
 import com.kingdee.bos.framework.*;
 import com.kingdee.bos.framework.*;
@@ -38,11 +39,12 @@ public class SyncTranForOAFacade extends AbstractBizCtrl implements ISyncTranFor
      *OA部门信息同步-User defined method
      *OA部门信息同步-User defined method
      *@param billds 组织id
      *@param billds 组织id
      *@param action 操作
      *@param action 操作
+     *@return
      */
      */
-    public void syncOrgUnitToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException
+    public Map syncOrgUnitToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException
     {
     {
         try {
         try {
-            getController().syncOrgUnitToOA(getContext(), billds, action);
+            return getController().syncOrgUnitToOA(getContext(), billds, action);
         }
         }
         catch(RemoteException err) {
         catch(RemoteException err) {
             throw new EJBRemoteException(err);
             throw new EJBRemoteException(err);
@@ -52,11 +54,12 @@ public class SyncTranForOAFacade extends AbstractBizCtrl implements ISyncTranFor
      *OA岗位信息同步-User defined method
      *OA岗位信息同步-User defined method
      *@param billds 岗位id
      *@param billds 岗位id
      *@param action 操作类型
      *@param action 操作类型
+     *@return
      */
      */
-    public void syncPositionToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException
+    public Map syncPositionToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException
     {
     {
         try {
         try {
-            getController().syncPositionToOA(getContext(), billds, action);
+            return getController().syncPositionToOA(getContext(), billds, action);
         }
         }
         catch(RemoteException err) {
         catch(RemoteException err) {
             throw new EJBRemoteException(err);
             throw new EJBRemoteException(err);
@@ -66,11 +69,12 @@ public class SyncTranForOAFacade extends AbstractBizCtrl implements ISyncTranFor
      *OA人员信息同步-User defined method
      *OA人员信息同步-User defined method
      *@param billds 人员id
      *@param billds 人员id
      *@param action 操作类型
      *@param action 操作类型
+     *@return
      */
      */
-    public void syncPersonToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException
+    public Map syncPersonToOA(String billds, ActionTypeEnum action) throws BOSException, EASBizException
     {
     {
         try {
         try {
-            getController().syncPersonToOA(getContext(), billds, action);
+            return getController().syncPersonToOA(getContext(), billds, action);
         }
         }
         catch(RemoteException err) {
         catch(RemoteException err) {
             throw new EJBRemoteException(err);
             throw new EJBRemoteException(err);

+ 4 - 3
src/com/kingdee/eas/custom/synctask/SyncTranForOAFacadeController.java

@@ -9,6 +9,7 @@ import com.kingdee.bos.Context;
 import com.kingdee.bos.BOSException;
 import com.kingdee.bos.BOSException;
 import com.kingdee.bos.util.*;
 import com.kingdee.bos.util.*;
 import com.kingdee.eas.common.EASBizException;
 import com.kingdee.eas.common.EASBizException;
+import java.util.Map;
 import java.lang.String;
 import java.lang.String;
 import com.kingdee.bos.Context;
 import com.kingdee.bos.Context;
 import com.kingdee.bos.framework.*;
 import com.kingdee.bos.framework.*;
@@ -18,9 +19,9 @@ import com.kingdee.bos.framework.ejb.BizController;
 
 
 public interface SyncTranForOAFacadeController extends BizController
 public interface SyncTranForOAFacadeController extends BizController
 {
 {
-    public void syncOrgUnitToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException, RemoteException;
-    public void syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException, RemoteException;
-    public void syncPersonToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException, RemoteException;
+    public Map syncOrgUnitToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException, RemoteException;
+    public Map syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException, RemoteException;
+    public Map syncPersonToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException, RemoteException;
     public void syncPersonFromOAByNumber(Context ctx, String personNumbers) throws BOSException, EASBizException, RemoteException;
     public void syncPersonFromOAByNumber(Context ctx, String personNumbers) throws BOSException, EASBizException, RemoteException;
     public void syncPersonFromOAById(Context ctx, String personIds) throws BOSException, EASBizException, RemoteException;
     public void syncPersonFromOAById(Context ctx, String personIds) throws BOSException, EASBizException, RemoteException;
 }
 }

+ 77 - 64
src/com/kingdee/eas/custom/synctask/SyncTranForOAFacadeControllerBean.java

@@ -28,10 +28,6 @@ import com.kingdee.eas.custom.log.app.SyncStatusEnum;
 import com.kingdee.eas.custom.synctask.entity.AdminOrg;
 import com.kingdee.eas.custom.synctask.entity.AdminOrg;
 import com.kingdee.eas.custom.synctask.entity.PersonEntity;
 import com.kingdee.eas.custom.synctask.entity.PersonEntity;
 import com.kingdee.eas.custom.synctask.entity.PositionEntity;
 import com.kingdee.eas.custom.synctask.entity.PositionEntity;
-import com.kingdee.eas.hr.affair.EmpEnrollBizBillEntryCollection;
-import com.kingdee.eas.hr.affair.EmpEnrollBizBillEntryFactory;
-import com.kingdee.eas.hr.affair.EmpEnrollBizBillEntryInfo;
-import com.kingdee.eas.hr.affair.IEmpEnrollBizBillEntry;
 import com.kingdee.eas.hr.ats.AtsUtil;
 import com.kingdee.eas.hr.ats.AtsUtil;
 import com.kingdee.eas.hr.base.EmployeeTypeInfo;
 import com.kingdee.eas.hr.base.EmployeeTypeInfo;
 import com.kingdee.eas.hr.emp.IPersonPosition;
 import com.kingdee.eas.hr.emp.IPersonPosition;
@@ -88,7 +84,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
      * @throws BOSException
      * @throws BOSException
      */
      */
     @Override
     @Override
-    protected void _syncOrgUnitToOA(Context ctx, String billds, ActionTypeEnum action) throws BOSException, EASBizException {
+    protected Map _syncOrgUnitToOA(Context ctx, String billds, ActionTypeEnum action)
+            throws BOSException, EASBizException {
         ISyncLog iSyncLog = SyncLogFactory.getLocalInstance(ctx);
         ISyncLog iSyncLog = SyncLogFactory.getLocalInstance(ctx);
         SyncLogInfo syncLogInfo = new SyncLogInfo();
         SyncLogInfo syncLogInfo = new SyncLogInfo();
         syncLogInfo.setEntityName(SyncEntityNameEnum.adminOrg);
         syncLogInfo.setEntityName(SyncEntityNameEnum.adminOrg);
@@ -113,6 +110,14 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
             sic.add("parent.number");
             sic.add("parent.number");
             sic.add("responPosition.name");
             sic.add("responPosition.name");
             sic.add("responPosition.number");
             sic.add("responPosition.number");
+            sic.add("bmfzr.number");
+            sic.add("bmfzr.name");
+            sic.add("bmjl.name");
+            sic.add("bmjl.number");
+            sic.add("zj.name");
+            sic.add("zj.number");
+            sic.add("fz.name");
+            sic.add("fz.number");
             EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
             EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
             AdminOrgUnitCollection adminOrgUnitCollection = iAdminOrgUnit.getAdminOrgUnitCollection(entityViewInfo);
             AdminOrgUnitCollection adminOrgUnitCollection = iAdminOrgUnit.getAdminOrgUnitCollection(entityViewInfo);
             for (int i = 0; i < adminOrgUnitCollection.size(); i++) {
             for (int i = 0; i < adminOrgUnitCollection.size(); i++) {
@@ -120,12 +125,17 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
                 String orgName = adminOrgUnitInfo.getName();
                 String orgName = adminOrgUnitInfo.getName();
                 AdminOrg adminOrg = new AdminOrg();
                 AdminOrg adminOrg = new AdminOrg();
                 boolean isSealUp = adminOrgUnitInfo.isIsSealUp();
                 boolean isSealUp = adminOrgUnitInfo.isIsSealUp();
-                if (isSealUp) {
+                if (action == ActionTypeEnum.DELETE) {
+                    logger.error("_syncOrgUnitToOA---action--" + action.getValue());
                     adminOrg.setAction("delete");
                     adminOrg.setAction("delete");
-                    adminOrg.setCanceled("0");
                 } else {
                 } else {
                     adminOrg.setAction("add");
                     adminOrg.setAction("add");
                 }
                 }
+                if (isSealUp) {
+                    adminOrg.setCanceled("0");
+                } else {
+                    adminOrg.setCanceled("1");
+                }
                 adminOrg.setCode(adminOrgUnitInfo.getNumber());
                 adminOrg.setCode(adminOrgUnitInfo.getNumber());
                 adminOrg.setShortname(orgName);
                 adminOrg.setShortname(orgName);
                 adminOrg.setFullname(orgName);
                 adminOrg.setFullname(orgName);
@@ -137,42 +147,22 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
                 }
                 }
                 Map map = new HashMap();
                 Map map = new HashMap();
                 //部门负责人
                 //部门负责人
-                PositionInfo responPosition = adminOrgUnitInfo.getResponPosition();
-                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() + "'");
-                for (int j = 0; j < positionCollection.size(); j++) {
-                    PositionInfo positionInfo = positionCollection.get(j);
-                    String positionName = positionInfo.getName();
-                    logger.error("_syncOrgUnitToOA---positionName---" + positionName);
-                    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);
-                }
+                IObjectValue bmfzr = (IObjectValue) adminOrgUnitInfo.get("bmfzr");
+                map.put("bmfzr", bmfzr == null ? "" : bmfzr.get("name"));
+                //经理
+                IObjectValue bmjl = (IObjectValue) adminOrgUnitInfo.get("bmjl");
+                map.put("bmjl", bmjl == null ? "" : bmjl.get("name"));
+                //总监
+                IObjectValue zj = (IObjectValue) adminOrgUnitInfo.get("zj");
+                map.put("zj", zj == null ? "" : zj.get("name"));
+                //副总
+                IObjectValue fz = (IObjectValue) adminOrgUnitInfo.get("fz");
+                map.put("fz", fz == null ? "" : fz.get("name"));
+                adminOrg.setCustomData(map);
                 dataList.add(adminOrg);
                 dataList.add(adminOrg);
             }
             }
             //执行同步组织到OA
             //执行同步组织到OA
-            executeSyncOrgUnitToOA(ctx, dataList, syncLogInfo);
+            return executeSyncOrgUnitToOA(ctx, dataList, syncLogInfo);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             syncLogInfo.setSyncStatus(SyncStatusEnum.ERROR);
             syncLogInfo.setSyncStatus(SyncStatusEnum.ERROR);
@@ -205,7 +195,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
      * @param dataList
      * @param dataList
      * @return
      * @return
      */
      */
-    public void executeSyncOrgUnitToOA(Context ctx, List dataList, SyncLogInfo syncLogInfo) throws
+    public Map executeSyncOrgUnitToOA(Context ctx, List dataList, SyncLogInfo syncLogInfo) throws
             IOException, BOSException, EASBizException {
             IOException, BOSException, EASBizException {
         if (dataList != null && dataList.size() > 0) {
         if (dataList != null && dataList.size() > 0) {
             ObjectMapper mapper = new ObjectMapper();
             ObjectMapper mapper = new ObjectMapper();
@@ -234,8 +224,9 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
                     .build();
                     .build();
             Response response = client.newCall(request).execute();
             Response response = client.newCall(request).execute();
             //处理响应结果,写入日志
             //处理响应结果,写入日志
-            handlerResponse(ctx, response, syncLogInfo);
+            return handlerResponse(ctx, response, syncLogInfo);
         }
         }
+        return null;
     }
     }
 
 
     /**
     /**
@@ -248,12 +239,14 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
      * @throws BOSException
      * @throws BOSException
      * @throws EASBizException
      * @throws EASBizException
      */
      */
-    private void handlerResponse(Context ctx, Response response, SyncLogInfo syncLogInfo)
+    private Map<String, Map<String, String>> handlerResponse(Context ctx, Response response, SyncLogInfo syncLogInfo)
             throws IOException, BOSException, EASBizException {
             throws IOException, BOSException, EASBizException {
         if (syncLogInfo == null) {
         if (syncLogInfo == null) {
-            return;
+            return null;
         }
         }
         ISyncLog iSyncLog = SyncLogFactory.getLocalInstance(ctx);
         ISyncLog iSyncLog = SyncLogFactory.getLocalInstance(ctx);
+        Map<String, Map<String, String>> resultMap = new HashMap<String, Map<String, String>>();
+        String errorMsg = null;//错误信息
         if (response != null) {
         if (response != null) {
             int success = 0;
             int success = 0;
             int fail = 0;
             int fail = 0;
@@ -263,37 +256,51 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
             if (response.isSuccessful()) {
             if (response.isSuccessful()) {
                 String code = respMap.getString("code");
                 String code = respMap.getString("code");
                 if ("1".equals(code)) {
                 if ("1".equals(code)) {
-                    JSONObject result = respMap.getJSONObject("result");
                     StringBuilder msg = new StringBuilder();
                     StringBuilder msg = new StringBuilder();
+                    JSONObject result = respMap.getJSONObject("result");
                     for (String orgNumber : result.keySet()) {
                     for (String orgNumber : result.keySet()) {
+                        Map<String, String> map = new HashMap<>();
                         JSONObject jsonObject = result.getJSONObject(orgNumber);
                         JSONObject jsonObject = result.getJSONObject(orgNumber);
                         msg.append("[").append(orgNumber).append("]");
                         msg.append("[").append(orgNumber).append("]");
                         if ("1".equals(jsonObject.getString("code"))) {
                         if ("1".equals(jsonObject.getString("code"))) {
                             success++;
                             success++;
+                            map.put("state", "success");
+                            map.put("msg", "同步成功");
                             msg.append("同步成功\n");
                             msg.append("同步成功\n");
                         } else {
                         } else {
                             fail++;
                             fail++;
+                            map.put("state", "fail");
+                            map.put("msg", jsonObject.getString("msg"));
                             msg.append("同步失败,").append(jsonObject.getString("msg")).append("\n");
                             msg.append("同步失败,").append(jsonObject.getString("msg")).append("\n");
                         }
                         }
+                        resultMap.put(orgNumber, map);
                     }
                     }
+                    int total = fail + success;
                     syncLogInfo.setSyncStatus(SyncStatusEnum.SUCCESS);
                     syncLogInfo.setSyncStatus(SyncStatusEnum.SUCCESS);
-                    syncLogInfo.setSyncCount(fail + success);
+                    syncLogInfo.setSyncCount(total);
                     syncLogInfo.setSuccessNum(success);
                     syncLogInfo.setSuccessNum(success);
                     syncLogInfo.setFailNum(fail);
                     syncLogInfo.setFailNum(fail);
                     syncLogInfo.setSyncResult(msg.toString());
                     syncLogInfo.setSyncResult(msg.toString());
                 } else {
                 } else {
                     syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
                     syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
-                    syncLogInfo.setSyncResult(respMap.getString("msg"));
+                    errorMsg = respMap.getString("msg");
+                    syncLogInfo.setSyncResult(errorMsg);
                 }
                 }
             } else {
             } else {
                 syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
                 syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
                 syncLogInfo.setSyncResult("请求超时");
                 syncLogInfo.setSyncResult("请求超时");
+                errorMsg = "请求超时";
             }
             }
         } else {
         } else {
             syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
             syncLogInfo.setSyncStatus(SyncStatusEnum.FAIL);
             syncLogInfo.setSyncResult("同步数据为空");
             syncLogInfo.setSyncResult("同步数据为空");
+            errorMsg = "同步数据为空";
         }
         }
         iSyncLog.save(syncLogInfo);
         iSyncLog.save(syncLogInfo);
+        if (!StringUtils.isEmpty(errorMsg)) {
+            throw new BOSException(errorMsg);
+        }
+        return resultMap;
     }
     }
 
 
 
 
@@ -326,7 +333,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
      * @throws BOSException
      * @throws BOSException
      */
      */
     @Override
     @Override
-    protected void _syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws
+    protected Map _syncPositionToOA(Context ctx, String billds, ActionTypeEnum action) throws
             BOSException, EASBizException {
             BOSException, EASBizException {
         ISyncLog iSyncLog = SyncLogFactory.getLocalInstance(ctx);
         ISyncLog iSyncLog = SyncLogFactory.getLocalInstance(ctx);
         SyncLogInfo syncLogInfo = new SyncLogInfo();
         SyncLogInfo syncLogInfo = new SyncLogInfo();
@@ -338,7 +345,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
             logger.error("_syncPositionToOA---billds: " + billds);
             logger.error("_syncPositionToOA---billds: " + billds);
             String data = getPositionColData(ctx, billds);
             String data = getPositionColData(ctx, billds);
             String syncPositionApiUrl = this.propt.getProperty("syncPositionApiUrl");
             String syncPositionApiUrl = this.propt.getProperty("syncPositionApiUrl");
-            synScyRequest(ctx, data, syncPositionApiUrl, syncLogInfo);
+            return synScyRequest(ctx, data, syncPositionApiUrl, syncLogInfo);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             syncLogInfo.setSyncStatus(SyncStatusEnum.ERROR);
             syncLogInfo.setSyncStatus(SyncStatusEnum.ERROR);
@@ -346,8 +353,6 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
             iSyncLog.save(syncLogInfo);
             iSyncLog.save(syncLogInfo);
             throw new BOSException(e.getMessage());
             throw new BOSException(e.getMessage());
         }
         }
-
-
     }
     }
 
 
     /**
     /**
@@ -402,7 +407,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
-    public void synScyRequest(Context ctx, String param, String aipUrl, SyncLogInfo syncLogInfo) throws
+    public Map synScyRequest(Context ctx, String param, String aipUrl, SyncLogInfo syncLogInfo) throws
             IOException, BOSException, EASBizException {
             IOException, BOSException, EASBizException {
         OkHttpClient client = new OkHttpClient();
         OkHttpClient client = new OkHttpClient();
         MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
         MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
@@ -421,7 +426,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
                 .build();
                 .build();
         //处理响应结果,写入日志
         //处理响应结果,写入日志
         Response response = client.newCall(request).execute();
         Response response = client.newCall(request).execute();
-        handlerResponse(ctx, response, syncLogInfo);
+        return handlerResponse(ctx, response, syncLogInfo);
     }
     }
 
 
 
 
@@ -434,7 +439,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
      * @throws BOSException
      * @throws BOSException
      */
      */
     @Override
     @Override
-    protected void _syncPersonToOA(Context ctx, String billds, ActionTypeEnum action)
+    protected Map _syncPersonToOA(Context ctx, String billds, ActionTypeEnum action)
             throws BOSException, EASBizException {
             throws BOSException, EASBizException {
         super._syncPersonToOA(ctx, billds, action);
         super._syncPersonToOA(ctx, billds, action);
         logger.error("_syncpersonToOA----------------------start");
         logger.error("_syncpersonToOA----------------------start");
@@ -459,6 +464,9 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
             sic.add("person.number");
             sic.add("person.number");
             sic.add("person.name");
             sic.add("person.name");
             sic.add("person.id");
             sic.add("person.id");
+            sic.add("person.securityLe.id");
+            sic.add("person.securityLe.name");
+            sic.add("person.securityLe.number");
             sic.add("person.workPlace.name");
             sic.add("person.workPlace.name");
             sic.add("person.personnelCa.name");
             sic.add("person.personnelCa.name");
             sic.add("person.immediateSu.oAid");
             sic.add("person.immediateSu.oAid");
@@ -484,14 +492,14 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
             ObjectMapper mapper = new ObjectMapper();
             ObjectMapper mapper = new ObjectMapper();
             logger.error("_syncpersonToOA------------------dataList----- " + mapper.writeValueAsString(dataList));
             logger.error("_syncpersonToOA------------------dataList----- " + mapper.writeValueAsString(dataList));
             //调用执行人员组织到OA
             //调用执行人员组织到OA
-            executeSyncPersonToOA(ctx, dataList, syncLogInfo);
+            return executeSyncPersonToOA(ctx, dataList, syncLogInfo);
             //_syncPersonFromOAById(ctx, billds);
             //_syncPersonFromOAById(ctx, billds);
-        } catch (IOException e) {
+        } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             syncLogInfo.setSyncStatus(SyncStatusEnum.ERROR);
             syncLogInfo.setSyncStatus(SyncStatusEnum.ERROR);
             syncLogInfo.setSyncResult(e.getMessage());
             syncLogInfo.setSyncResult(e.getMessage());
             iSyncLog.save(syncLogInfo);
             iSyncLog.save(syncLogInfo);
-            throw new RuntimeException(e);
+            throw new BOSException(e.getMessage());
         }
         }
     }
     }
 
 
@@ -500,7 +508,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
      *
      *
      * @param dataList
      * @param dataList
      */
      */
-    public void executeSyncPersonToOA(Context ctx, List dataList, SyncLogInfo syncLogInfo) throws
+    public Map executeSyncPersonToOA(Context ctx, List dataList, SyncLogInfo syncLogInfo) throws
             IOException, BOSException, EASBizException {
             IOException, BOSException, EASBizException {
         if (dataList != null && dataList.size() > 0) {
         if (dataList != null && dataList.size() > 0) {
             ObjectMapper mapper = new ObjectMapper();
             ObjectMapper mapper = new ObjectMapper();
@@ -529,9 +537,9 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
                     .build();
                     .build();
             Response response = client.newCall(request).execute();
             Response response = client.newCall(request).execute();
             //处理响应结果,写入日志
             //处理响应结果,写入日志
-            handlerResponse(ctx, response, syncLogInfo);
-
+            return handlerResponse(ctx, response, syncLogInfo);
         }
         }
+        return null;
     }
     }
 
 
     /**
     /**
@@ -578,7 +586,7 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
             person.setLocationid((String) workPlace.get("name"));
             person.setLocationid((String) workPlace.get("name"));
         }
         }
         //移动电话
         //移动电话
-        person.setMobile(personInfo.getCell());
+        person.setMobile(personInfo.getNCell());
         //办公室电话
         //办公室电话
         person.setTelephone(personInfo.getOfficePhone());
         person.setTelephone(personInfo.getOfficePhone());
         //电子邮件
         //电子邮件
@@ -587,6 +595,8 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
         Date enterDate = personPositionInfo.getEnterDate();
         Date enterDate = personPositionInfo.getEnterDate();
         if (enterDate != null) {
         if (enterDate != null) {
             person.setCompanystartdate(originalFormat.format(enterDate));
             person.setCompanystartdate(originalFormat.format(enterDate));
+        } else {
+            throw new BOSException("同步人员【" + personInfo.getName() + "】 入职日期不可为空!");
         }
         }
         //参加工作日期
         //参加工作日期
         Date jobStartDate = personPositionInfo.getJobStartDate();
         Date jobStartDate = personPositionInfo.getJobStartDate();
@@ -598,13 +608,16 @@ public class SyncTranForOAFacadeControllerBean extends AbstractSyncTranForOAFaca
         //明文密码,会转密文  默认:Scy$1234
         //明文密码,会转密文  默认:Scy$1234
         person.setPassword("Scy$1234");
         person.setPassword("Scy$1234");
         //安全级别
         //安全级别
-        person.setSeclevel("3");
+        IObjectValue securityLe = (IObjectValue) personInfo.get("securityLe");
+        if (securityLe != null) {
+            person.setSeclevel(securityLe.get("name").toString());
+        }
         //人员类别
         //人员类别
         IObjectValue personnelCa = (IObjectValue) personInfo.get("personnelCa");
         IObjectValue personnelCa = (IObjectValue) personInfo.get("personnelCa");
         if (personnelCa != null) {
         if (personnelCa != null) {
             Map customMap = new HashMap();
             Map customMap = new HashMap();
-            customMap.put("field", personnelCa.get("name"));
-            person.setWorkCustomData(customMap);
+            customMap.put("field6", personnelCa.get("name"));
+            person.setBaseCustomData(customMap);
         }
         }
         //职级
         //职级
         JobLevelInfo jobLevel = personPositionInfo.getJobLevel();
         JobLevelInfo jobLevel = personPositionInfo.getJobLevel();