9060 22 horas atrás
pai
commit
8676b5238d

+ 71 - 0
src/com/kingdee/eas/custom/osf/GetCusDataOsfService.java

@@ -0,0 +1,71 @@
+package com.kingdee.eas.custom.osf;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.Context;
+import com.kingdee.bos.bsf.service.app.IHRMsfService;
+import com.kingdee.eas.basedata.org.PositionCollection;
+import com.kingdee.eas.basedata.org.PositionFactory;
+import com.kingdee.eas.basedata.org.PositionInfo;
+import com.kingdee.eas.common.EASBizException;
+import com.kingdee.eas.hr.base.EmployeeTypeCollection;
+import com.kingdee.eas.hr.base.EmployeeTypeFactory;
+import com.kingdee.eas.hr.base.EmployeeTypeInfo;
+import com.kingdee.eas.hr.base.VariationReasonCollection;
+import com.kingdee.eas.hr.base.VariationReasonFactory;
+import com.kingdee.eas.hr.base.VariationReasonInfo;
+
+/**
+ * 
+ * @author coyle
+ *
+ */
+public class GetCusDataOsfService implements IHRMsfService {
+
+	private static final Logger logger = LoggerFactory.getLogger(GetCusDataOsfService.class);
+	// 职位
+	private static final String POSITION = "position";
+	// 变动原因
+	private static final String REASON = "Reason";
+	// 用工关系状态
+	private static final String RELATIONSHIP = "relationship";
+
+
+	public Object process(Context ctx, Map map) throws EASBizException, BOSException {
+		logger.error("GetCusDataOsfService  enter ");
+		
+
+		String dataType = (String) map.get("dataType");
+		// 
+		String billno = (String) map.get("billno");
+		 	
+		//返回数据
+		Map dataMap = new HashMap();
+		if(StringUtils.equals(dataType, POSITION)) {
+			PositionCollection positionCol  = PositionFactory.getLocalInstance(ctx).getPositionCollection("where number = '"+ billno+"'");
+			PositionInfo info = positionCol.get(0);
+			dataMap.put("id", info.getId().toString());
+			dataMap.put("name", info.getName().toString());
+		}else if(StringUtils.equals(dataType, REASON)) {
+			VariationReasonCollection varCol  = VariationReasonFactory .getLocalInstance(ctx).getVariationReasonCollection("where number = '"+ billno+"'");
+			VariationReasonInfo info = varCol.get(0);
+			dataMap.put("id", info.getId().toString());
+			dataMap.put("name", info.getName().toString());
+		} else if (StringUtils.equals(dataType, RELATIONSHIP)) {
+			EmployeeTypeCollection varCol = EmployeeTypeFactory.getLocalInstance(ctx)
+					.getEmployeeTypeCollection("where number = '" + billno + "'");
+			EmployeeTypeInfo info = varCol.get(0);
+			dataMap.put("id", info.getId().toString());
+			dataMap.put("name", info.getName().toString());
+		}
+
+		return dataMap;
+	}
+
+}

+ 1 - 0
src/com/kingdee/eas/custom/sendmessage/callback/CallBackToOSFServlet.java

@@ -34,6 +34,7 @@ import java.util.Properties;
  * author: lhbj <br>
  * version: 1.0 <br>
  */
+
 public class CallBackToOSFServlet extends HttpServlet {
     private static final long serialVersionUID = 1426489082732035281L;
     private static final Logger logger = LoggerFactory.getLogger(CallBackToOSFServlet.class);

+ 66 - 92
websrc/com/kingdee/eas/custom/recuritment/task/osf/BeisenFacadeOSFService.java

@@ -16,14 +16,12 @@ import com.kingdee.eas.custom.recuritment.task.osf.database.MobileTypeEnum;
 import com.kingdee.eas.util.ExceptionUtil;
 import com.kingdee.eas.util.app.DbUtil;
 import com.kingdee.jdbc.rowset.IRowSet;
-import com.kingdee.util.enums.DynamicEnum;
 import org.apache.commons.lang3.StringUtils;
 
 import java.io.IOException;
 import java.sql.Date;
 import java.sql.SQLException;
 import java.text.SimpleDateFormat;
-import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
@@ -35,8 +33,9 @@ import java.util.Map;
  * version: 1.0 <br>
  */
 public class BeisenFacadeOSFService implements IHRMsfService {
-    String syncBeisenReserveTalentPool ="syncBeisenReserveTalentPool";
-    String syncUnBeisenReserveTalentPool ="syncUnBeisenReserveTalentPool";
+    String syncBeisenReserveTalentPool = "syncBeisenReserveTalentPool";
+    String syncUnBeisenReserveTalentPool = "syncUnBeisenReserveTalentPool";
+
     @Override
     public Object process(Context context, Map<String, Object> map) throws EASBizException, BOSException {
         String mack = (String) map.get("mack");
@@ -45,10 +44,10 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             if (syncBeisenReserveTalentPool.equals(mack)) {
                 String resignBizBillID = (String) map.get("resignBizBillID");
                 result = _syncBeisenReserveTalentPool(context, resignBizBillID);
-            }else if(syncUnBeisenReserveTalentPool.equals(mack)){
+            } else if (syncUnBeisenReserveTalentPool.equals(mack)) {
                 String resignBizBillID = (String) map.get("resignBizBillID");
                 result = _syncUnBeisenReserveTalentPool(context, resignBizBillID);
-            }else {
+            } else {
                 result = new JSONObject();
                 result.put("errMsg", "未找到实现方法");
             }
@@ -60,21 +59,6 @@ public class BeisenFacadeOSFService implements IHRMsfService {
         return result;
     }
 
-    /**
-     * 入职
-     *
-     * @param ctx
-     * @param resignBizBillID
-     * @return
-     * @throws BOSException
-     * @throws SQLException
-     * @throws IOException
-     */
-    protected JSONObject _syncBeisenEmpenrollbizTalentPool(Context ctx, String resignBizBillID) throws BOSException, SQLException, IOException {
-
-        return null;
-    }
-
     /**
      * 离职-审核通过
      *
@@ -99,14 +83,16 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             CFApplyId = rs.getString("CFApplyId");
         }
         if (StringUtils.isNotBlank(CFCandidateId)) {
-            result =this.TransferPhase(ctx,BeisenParam.BEISEN_CONFIG_RESERVE_STATUSID,resignBizBillID,CFCandidateId,CFApplyId);
+            result = this.TransferPhase(ctx, BeisenParam.BEISEN_CONFIG_RESERVE_STATUSID, resignBizBillID, CFCandidateId, CFApplyId);
         } else {
-            result =this.CreateOrUpdateApplicant(ctx, resignBizBillID);
+            result = this.CreateOrUpdateApplicant(ctx, resignBizBillID);
         }
         return result;
     }
+
     /**
      * 离职-反审批
+     *
      * @param ctx
      * @param resignBizBillID
      * @return
@@ -128,15 +114,16 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             CFApplyId = rs.getString("CFApplyId");
         }
         if (StringUtils.isNotBlank(CFApplyId)) {
-            result =this.TransferPhase(ctx,BeisenParam.BEISEN_CONFIG_UNRESERVE_STATUSID,resignBizBillID,CFCandidateId,CFApplyId);
+            result = this.TransferPhase(ctx, BeisenParam.BEISEN_CONFIG_UNRESERVE_STATUSID, resignBizBillID, CFCandidateId, CFApplyId);
         } else {
-            result =this.removeApplicantFromTalentPool(ctx, resignBizBillID);
+            result = this.removeApplicantFromTalentPool(ctx, resignBizBillID);
         }
         return result;
     }
 
     /**
      * 移出人才库
+     *
      * @param ctx
      * @param resignBizBillID
      * @return
@@ -149,14 +136,12 @@ public class BeisenFacadeOSFService implements IHRMsfService {
         result.put("msg", "成功");
         ExecuteResultEnum syncStatus = ExecuteResultEnum.SUCCESS;
         try {
-            IRowSet rowSet = DbUtil.executeQuery(ctx,"select CFCandidateId,CFSyncBeisenResult from T_HR_ResignBizBillEntry where fbillid=?",new String[]{resignBizBillID});
+            IRowSet rowSet = DbUtil.executeQuery(ctx, "select CFCandidateId,CFSyncBeisenResult from T_HR_ResignBizBillEntry where fbillid=?", new String[]{resignBizBillID});
             List<String> candidateIds = Lists.newArrayList();
-
-            while (rowSet.next()){
-
+            while (rowSet.next()) {
                 String CFSyncBeisenResult = rowSet.getString("CFSyncBeisenResult");
                 String CFCandidateId = rowSet.getString("CFCandidateId");
-                if (StringUtils.isBlank(CFCandidateId)&&StringUtils.isNotBlank(CFSyncBeisenResult)) {
+                if (StringUtils.isBlank(CFCandidateId) && StringUtils.isNotBlank(CFSyncBeisenResult)) {
                     JSONObject jsonObject = JSONObject.parseObject(CFSyncBeisenResult);
                     if (null != jsonObject && 200 == jsonObject.getInteger("code")) {
                         JSONObject jsonObjectSync = this.GetApplicantIdBySyncId(jsonObject);
@@ -164,7 +149,7 @@ public class BeisenFacadeOSFService implements IHRMsfService {
                         if (null != jsonObjectSync && 200 == jsonObjectSync.getInteger("code")) {
                             JSONObject dataSync = jsonObjectSync.getJSONObject("data");
                             if (null != dataSync) {
-                                String candidateId= dataSync.getString("applicantId");
+                                String candidateId = dataSync.getString("applicantId");
                                 candidateIds.add(candidateId);
                                 syncStatus = ExecuteResultEnum.SUCCESS;
                             }
@@ -175,11 +160,11 @@ public class BeisenFacadeOSFService implements IHRMsfService {
                     candidateIds.add(CFCandidateId);
                 }
             }
-            if(!candidateIds.isEmpty()) {
-                result.put("candidateIds",candidateIds);
+            if (!candidateIds.isEmpty()) {
+                result.put("candidateIds", candidateIds);
                 //离职人才库id
                 Map<String, String> objectMap = this.getBeisenTalentPool(ctx);
-                String talentPoolId=objectMap.get("talentPoolId");
+                String talentPoolId = objectMap.get("talentPoolId");
                 BeisenApiClient client = BeisenApiClient.getInstance();
                 JSONObject jsonData = new JSONObject();
                 BeisenParamByProperties byProperties = new BeisenParamByProperties();
@@ -201,19 +186,19 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             throw e;
         } finally {
             List<String> candidateIds = (List<String>) result.get("candidateIds");
-            if(null!=candidateIds&&(!candidateIds.isEmpty())) {
+            if (null != candidateIds && (!candidateIds.isEmpty())) {
                 JSONObject jsonData = result.getJSONObject("POST_TRANSFERPHASE_DATA");
-                if(null==jsonData){
-                    jsonData=new JSONObject();
+                if (null == jsonData) {
+                    jsonData = new JSONObject();
                 }
-                jsonData.put("resultMsg",result.get("msg"));
+                jsonData.put("resultMsg", result.get("msg"));
                 updateSyncBeisenResultBillId(ctx, resignBizBillID, syncStatus, candidateIds.get(0), jsonData);
-            }else {
+            } else {
                 JSONObject jsonData = result.getJSONObject("POST_TRANSFERPHASE_DATA");
-                if(null==jsonData){
-                    jsonData=new JSONObject();
+                if (null == jsonData) {
+                    jsonData = new JSONObject();
                 }
-                jsonData.put("resultMsg",result.get("msg"));
+                jsonData.put("resultMsg", result.get("msg"));
                 updateSyncBeisenResultBillId(ctx, resignBizBillID, syncStatus, "", result.getJSONObject("POST_TRANSFERPHASE_DATA"));
             }
         }
@@ -230,7 +215,7 @@ public class BeisenFacadeOSFService implements IHRMsfService {
      * @return
      * @throws Exception
      */
-    public JSONObject TransferPhase(Context ctx,String STATUSID, String resignBizBillID, String candidateId, String applyId) throws Exception {
+    public JSONObject TransferPhase(Context ctx, String STATUSID, String resignBizBillID, String candidateId, String applyId) throws Exception {
         JSONObject result = new JSONObject();
         ExecuteResultEnum syncStatus = ExecuteResultEnum.SUCCESS;
 
@@ -248,10 +233,10 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             jsonData.put("statusId", config.get(STATUSID));
             System.out.println(jsonData.toJSONString());
             JSONObject jsonObject = client.callApi(BeisenParam.POST_TRANSFERPHASE_URL, jsonData);
-            result.put("POST_TRANSFERPHASE_DATA",jsonObject);
+            result.put("POST_TRANSFERPHASE_DATA", jsonObject);
             if (null != jsonObject && 200 == jsonObject.getInteger("code")) {
                 syncStatus = ExecuteResultEnum.SUCCESS;
-            }else {
+            } else {
                 syncStatus = ExecuteResultEnum.ERROR;
             }
         } catch (Exception e) {
@@ -260,11 +245,11 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             throw e;
         } finally {
             JSONObject jsonData = result.getJSONObject("POST_TRANSFERPHASE_DATA");
-            if(null==jsonData){
-                jsonData=new JSONObject();
+            if (null == jsonData) {
+                jsonData = new JSONObject();
             }
-            jsonData.put("resultMsg",syncStatus.getAlias());
-            updateSyncBeisenResultBillId(ctx,resignBizBillID,syncStatus,candidateId,result.getJSONObject("POST_TRANSFERPHASE_DATA"));
+            jsonData.put("resultMsg", syncStatus.getAlias());
+            updateSyncBeisenResultBillId(ctx, resignBizBillID, syncStatus, candidateId, result.getJSONObject("POST_TRANSFERPHASE_DATA"));
         }
         return result;
     }
@@ -288,11 +273,11 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             BeisenApiClient client = BeisenApiClient.getInstance();
             Map<String, Object> personData = this.getPersonData(ctx, resignBizBillID);
             String code = (String) personData.get("code");
-            result.put("code",personData.get("code"));
-            result.put("msg",personData.get("msg"));
+            result.put("code", personData.get("code"));
+            result.put("msg", personData.get("msg"));
             if ("ses".equals(code)) {
                 Map<String, Object> data = (Map<String, Object>) personData.get("data");
-                if(null!=data&&(!data.isEmpty())) {
+                if (null != data && (!data.isEmpty())) {
                     JSONObject jsonData = new JSONObject();
                     jsonData.putAll(data);
                     jsonData.put("talentPoolIds", objectMap.values());
@@ -300,7 +285,7 @@ public class BeisenFacadeOSFService implements IHRMsfService {
                     Map<String, String> config = byProperties.getConfig();
                     jsonData.put("channelId", config.get(BeisenParam.BEISEN_CONFIG_CHANNELID));
                     //jsonData.put("acquireMannerId",2);
-                    System.out.println("同步北森参数:"+jsonData.toJSONString());
+                    System.out.println("同步北森参数:" + jsonData.toJSONString());
                     JSONObject jsonObject = client.callApi(BeisenParam.POST_CREATEORUPDATEAPPLICANT_URL, jsonData);
                     result.put("POST_CREATEORUPDATEAPPLICANT_DATA", jsonObject);
                     result.put("personData", personData);
@@ -325,10 +310,10 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             throw e;
         } finally {
             JSONObject jsonData = result.getJSONObject("POST_CREATEORUPDATEAPPLICANT_DATA");
-            if(null==jsonData){
-                jsonData=new JSONObject();
+            if (null == jsonData) {
+                jsonData = new JSONObject();
             }
-            jsonData.put("resultMsg",result.get("msg"));
+            jsonData.put("resultMsg", result.get("msg"));
             updateSyncBeisenResultBillId(ctx, resignBizBillID, syncStatus, candidateId, jsonData);
         }
         return result;
@@ -376,7 +361,7 @@ public class BeisenFacadeOSFService implements IHRMsfService {
         sql.append(" dip.fnumber dipNumber,dip.fname_l2 dipName, dip.CFBeisenVal dipBeisenVal, ");
         sql.append(" p.CFDyxlbyxx dyxlbyxx,p.FWorkLocation workLocation, ");
         sql.append(" p.fidcardbegindate idCardbeginDate,p.fidcardenddate idCardendDate, ");
-       
+
         sql.append(" p.FHeight height, (case when (isnull(p.fgender,3)-1)>=0 then (isnull(p.fgender,3)-1) else 2 end) gender, ");
         sql.append(" isnull(p.fidcardno,p.fpassportno) idCardNO, (case when p.fidcardno is null then 2 else 1 end) isIdCard, ");
         sql.append(" prm.femail email,prm.FLinkTelNum linkTelNum, ");
@@ -468,7 +453,7 @@ public class BeisenFacadeOSFService implements IHRMsfService {
 
             //dyxlbyxx	毕业学校	毕业学校	OgLastSchool
 
-            String dyxlbyxx = rowSet.getString("dyxlbyxx");
+            //String dyxlbyxx = rowSet.getString("dyxlbyxx");
             //personProfile.put("OgLastSchool", this.setValue(dyxlbyxx));
             //毕业时间
 //            Date dyxlbysj = rowSet.getDate("dyxlbysj");
@@ -477,9 +462,9 @@ public class BeisenFacadeOSFService implements IHRMsfService {
 //               // personProfile.put("OgGraduationDate", this.setValue(dyxlbyxx));
 //            }
             //HighestDegreeID	最高学历	第一学历	OgFirstEducationLevel	string	是	是	第一学历-文本
-            String dipNumber = rowSet.getString("dipNumber");
-            String dipName = rowSet.getString("dipName");
-            String dipBeisenVal = rowSet.getString("dipBeisenVal");
+//            String dipNumber = rowSet.getString("dipNumber");
+//            String dipName = rowSet.getString("dipName");
+//            String dipBeisenVal = rowSet.getString("dipBeisenVal");
             //personProfile.put("OgFirstEducationLevel", this.setValue(dipBeisenVal));
             //personProfile.put("LastEducationLevel", this.setValue(dipBeisenVal));
             //idCardBeginDate	身份证开始日期	证件生效日期	CertificateValidityDate
@@ -497,32 +482,21 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             //籍贯
             personProfile.put("NativeArea", this.setValue(1));
             //民族
-            String folkName = rowSet.getString("folkName");
-            String folkNumber = rowSet.getString("folkNumber");
+            //String folkName = rowSet.getString("folkName");
+            //String folkNumber = rowSet.getString("folkNumber");
             String folkBeisenVal = rowSet.getString("folkBeisenVal");
-            if(StringUtils.isNotBlank(folkBeisenVal)) {
+            if (StringUtils.isNotBlank(folkBeisenVal)) {
                 personProfile.put("Nation", this.setValue(folkBeisenVal));
             }
-
             String email = rowSet.getString("email");
-
             personProfile.put("Email", this.setValue(email));
-
-
             //国籍
             String nlBeisenVal = rowSet.getString("nlBeisenVal");
             personProfile.put("Nationality", this.setValue(nlBeisenVal));
-
-
-            String description = rowSet.getString("description");
-
-
-            String bizDate = rowSet.getString("bizDate");
-
-            String workLocation = rowSet.getString("workLocation");
-
+//            String description = rowSet.getString("description");
+//            String bizDate = rowSet.getString("bizDate");
+//            String workLocation = rowSet.getString("workLocation");
             //证件类型	CertificateType	integer	是	是
-
             String idCardNO = rowSet.getString("idCardNO");
             personProfile.put("CertificateNumber", this.setValue(idCardNO));
             String isIdCard = rowSet.getString("isIdCard");
@@ -537,11 +511,11 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             String linkName = rowSet.getString("linkName");
             personProfile.put("EmergencyContact", this.setValue(linkName));
 
-            String posName = rowSet.getString("posName");
-            String posNumber = rowSet.getString("posNumber");
-
-            String nativePlace = rowSet.getString("nativePlace");
-            String officePhone = rowSet.getString("officePhone");
+//            String posName = rowSet.getString("posName");
+//            String posNumber = rowSet.getString("posNumber");
+//
+//            String nativePlace = rowSet.getString("nativePlace");
+//            String officePhone = rowSet.getString("officePhone");
 
             if (StringUtils.isBlank(idCardNO)) {
                 result.put("code", "err");
@@ -566,15 +540,17 @@ public class BeisenFacadeOSFService implements IHRMsfService {
      * syncBeisenResult	同步北森结果	字符串	CFSyncBeisenResult
      */
     public void updateSyncBeisenResultBillId(Context ctx, String id, ExecuteResultEnum syncStatus, String candidateId, JSONObject jsonData) throws BOSException {
-        String syncBeisenResult="";
-        if(null!=jsonData) {
+        String syncBeisenResult = "";
+        if (null != jsonData) {
             syncBeisenResult = jsonData.toJSONString();
+            if (syncBeisenResult.length() > 1500) {
+                syncBeisenResult = syncBeisenResult.substring(0, 1500);
+            }
         }
-            DbUtil.execute(ctx,
-                    "update T_HR_ResignBizBillEntry set CFSyncBeisenResult=?,CFCandidateId=?,CFSyncStatus=? where FBILLID =?",
-                    new String[]{syncBeisenResult, candidateId, syncStatus.getValue(), id}
-            );
-
+        DbUtil.execute(ctx,
+                "update T_HR_ResignBizBillEntry set CFSyncBeisenResult=?,CFCandidateId=?,CFSyncStatus=? where FBILLID =?",
+                new String[]{syncBeisenResult, candidateId, syncStatus.getValue(), id}
+        );
     }
 
     /**
@@ -625,6 +601,4 @@ public class BeisenFacadeOSFService implements IHRMsfService {
             throw new IllegalArgumentException("未匹配到北森离职人才库,请先在sHR系统中维护好“北森人才库”数据");
         }
     }
-
-
 }

+ 2 - 1
websrc/com/kingdee/eas/custom/recuritment/web/handler/OfferListHandlerEx.java

@@ -1,4 +1,4 @@
-package com.kingdee.shr.recuritment.web.handler;
+package com.kingdee.eas.custom.recuritment.web.handler;
 
 import com.kingdee.bos.Context;
 import com.kingdee.eas.custom.recuritment.task.BeisenTransferPhaseFacadeFactory;
@@ -6,6 +6,7 @@ import com.kingdee.eas.custom.recuritment.task.IBeisenTransferPhaseFacade;
 import com.kingdee.shr.base.syssetting.context.SHRContext;
 import com.kingdee.shr.base.syssetting.exception.SHRWebException;
 import com.kingdee.shr.base.syssetting.exception.ShrWebBizException;
+import com.kingdee.shr.recuritment.web.handler.OfferListHandler;
 import com.kingdee.util.StringUtils;
 import org.springframework.ui.ModelMap;