BeisenFacadeOSFService.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. package com.kingdee.eas.custom.recuritment.task.osf;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.google.common.collect.Maps;
  5. import com.kingdee.bos.BOSException;
  6. import com.kingdee.bos.Context;
  7. import com.kingdee.bos.bsf.service.app.IHRMsfService;
  8. import com.kingdee.bos.rabbitmq.guava.Lists;
  9. import com.kingdee.eas.common.EASBizException;
  10. import com.kingdee.eas.custom.beisen.utils.BeisenApiClient;
  11. import com.kingdee.eas.custom.beisen.utils.BeisenParam;
  12. import com.kingdee.eas.custom.beisen.utils.BeisenParamByProperties;
  13. import com.kingdee.eas.custom.recuritment.bizEnum.ExecuteResultEnum;
  14. import com.kingdee.eas.custom.recuritment.task.osf.database.MobileTypeEnum;
  15. import com.kingdee.eas.util.ExceptionUtil;
  16. import com.kingdee.eas.util.app.DbUtil;
  17. import com.kingdee.jdbc.rowset.IRowSet;
  18. import com.kingdee.util.enums.DynamicEnum;
  19. import org.apache.commons.lang3.StringUtils;
  20. import java.io.IOException;
  21. import java.sql.Date;
  22. import java.sql.SQLException;
  23. import java.text.SimpleDateFormat;
  24. import java.util.Collection;
  25. import java.util.List;
  26. import java.util.Map;
  27. /**
  28. * 237
  29. * description: BeisenFacadeOSFService <br>
  30. * date: 2025/7/2 16:51 <br>
  31. * author: lhbj <br>
  32. * version: 1.0 <br>
  33. */
  34. public class BeisenFacadeOSFService implements IHRMsfService {
  35. String syncBeisenReserveTalentPool ="syncBeisenReserveTalentPool";
  36. String syncUnBeisenReserveTalentPool ="syncUnBeisenReserveTalentPool";
  37. @Override
  38. public Object process(Context context, Map<String, Object> map) throws EASBizException, BOSException {
  39. String mack = (String) map.get("mack");
  40. JSONObject result = null;
  41. try {
  42. if (syncBeisenReserveTalentPool.equals(mack)) {
  43. String resignBizBillID = (String) map.get("resignBizBillID");
  44. result = _syncBeisenReserveTalentPool(context, resignBizBillID);
  45. }else if(syncUnBeisenReserveTalentPool.equals(mack)){
  46. String resignBizBillID = (String) map.get("resignBizBillID");
  47. result = _syncUnBeisenReserveTalentPool(context, resignBizBillID);
  48. }else {
  49. result = new JSONObject();
  50. result.put("errMsg", "未找到实现方法");
  51. }
  52. } catch (Exception e) {
  53. e.printStackTrace();
  54. result = new JSONObject();
  55. result.put("errMsg", e.getMessage());
  56. }
  57. return result;
  58. }
  59. /**
  60. * 入职
  61. *
  62. * @param ctx
  63. * @param resignBizBillID
  64. * @return
  65. * @throws BOSException
  66. * @throws SQLException
  67. * @throws IOException
  68. */
  69. protected JSONObject _syncBeisenEmpenrollbizTalentPool(Context ctx, String resignBizBillID) throws BOSException, SQLException, IOException {
  70. return null;
  71. }
  72. /**
  73. * 离职-审核通过
  74. *
  75. * @param ctx
  76. * @param resignBizBillID
  77. * @return
  78. * @throws BOSException
  79. * @throws SQLException
  80. * @throws IOException
  81. */
  82. protected JSONObject _syncBeisenReserveTalentPool(Context ctx, String resignBizBillID) throws Exception {
  83. JSONObject result = null;
  84. StringBuilder sql = new StringBuilder();
  85. sql.append(" select top 1 rbr.CFApplyId,rbr.CFCandidateId from T_REC_Offer offer ");
  86. sql.append(" left join T_REC_ResumeBaseRec rbr on offer.FResumeBaseRecID=rbr.fid ");
  87. sql.append(" where offer.FPERSONID in(select fpersonid from T_HR_ResignBizBillEntry where fbillid=?) order by offer.fsendDate desc ");
  88. IRowSet rs = DbUtil.executeQuery(ctx, sql.toString(), new String[]{resignBizBillID});
  89. String CFApplyId = "";
  90. String CFCandidateId = "";
  91. while (rs.next()) {
  92. CFCandidateId = rs.getString("CFCandidateId");
  93. CFApplyId = rs.getString("CFApplyId");
  94. }
  95. if (StringUtils.isNotBlank(CFCandidateId)) {
  96. result =this.TransferPhase(ctx,BeisenParam.BEISEN_CONFIG_RESERVE_STATUSID,resignBizBillID,CFCandidateId,CFApplyId);
  97. } else {
  98. result =this.CreateOrUpdateApplicant(ctx, resignBizBillID);
  99. }
  100. return result;
  101. }
  102. /**
  103. * 离职-反审批
  104. * @param ctx
  105. * @param resignBizBillID
  106. * @return
  107. * @throws BOSException
  108. * @throws SQLException
  109. * @throws IOException
  110. */
  111. protected JSONObject _syncUnBeisenReserveTalentPool(Context ctx, String resignBizBillID) throws Exception {
  112. JSONObject result = null;
  113. StringBuilder sql = new StringBuilder();
  114. sql.append(" select top 1 rbr.CFApplyId,rbr.CFCandidateId from T_REC_Offer offer ");
  115. sql.append(" left join T_REC_ResumeBaseRec rbr on offer.FResumeBaseRecID=rbr.fid ");
  116. sql.append(" where offer.FPERSONID in(select fpersonid from T_HR_ResignBizBillEntry where fbillid=?) order by offer.fsendDate desc ");
  117. IRowSet rs = DbUtil.executeQuery(ctx, sql.toString(), new String[]{resignBizBillID});
  118. String CFApplyId = "";
  119. String CFCandidateId = "";
  120. while (rs.next()) {
  121. CFCandidateId = rs.getString("CFCandidateId");
  122. CFApplyId = rs.getString("CFApplyId");
  123. }
  124. if (StringUtils.isNotBlank(CFApplyId)) {
  125. result =this.TransferPhase(ctx,BeisenParam.BEISEN_CONFIG_UNRESERVE_STATUSID,resignBizBillID,CFCandidateId,CFApplyId);
  126. } else {
  127. result =this.removeApplicantFromTalentPool(ctx, resignBizBillID);
  128. }
  129. return result;
  130. }
  131. /**
  132. * 移出人才库
  133. * @param ctx
  134. * @param resignBizBillID
  135. * @return
  136. * @throws Exception
  137. */
  138. protected JSONObject removeApplicantFromTalentPool(Context ctx, String resignBizBillID) throws Exception {
  139. JSONObject result = new JSONObject();
  140. ExecuteResultEnum syncStatus = ExecuteResultEnum.SUCCESS;
  141. try {
  142. IRowSet rowSet = DbUtil.executeQuery(ctx,"select CFCandidateId,CFSyncBeisenResult from T_HR_ResignBizBillEntry where fbillid=?",new String[]{resignBizBillID});
  143. List<String> candidateIds = Lists.newArrayList();
  144. while (rowSet.next()){
  145. String CFSyncBeisenResult = rowSet.getString("CFSyncBeisenResult");
  146. String CFCandidateId = rowSet.getString("CFCandidateId");
  147. if (StringUtils.isBlank(CFCandidateId)&&StringUtils.isNotBlank(CFSyncBeisenResult)) {
  148. JSONObject jsonObject = JSONObject.parseObject(CFSyncBeisenResult);
  149. if (null != jsonObject && 200 == jsonObject.getInteger("code")) {
  150. JSONObject jsonObjectSync = this.GetApplicantIdBySyncId(jsonObject);
  151. result.put("GetApplicantIdBySyncId", jsonObjectSync);
  152. if (null != jsonObjectSync && 200 == jsonObjectSync.getInteger("code")) {
  153. JSONObject dataSync = jsonObjectSync.getJSONObject("data");
  154. if (null != dataSync) {
  155. String candidateId= dataSync.getString("applicantId");
  156. candidateIds.add(candidateId);
  157. syncStatus = ExecuteResultEnum.SUCCESS;
  158. }
  159. }
  160. }
  161. }
  162. if (StringUtils.isNotBlank(CFCandidateId)) {
  163. candidateIds.add(CFCandidateId);
  164. }
  165. }
  166. if(!candidateIds.isEmpty()) {
  167. result.put("candidateIds",candidateIds);
  168. //离职人才库id
  169. Map<String, String> objectMap = this.getBeisenTalentPool(ctx);
  170. String talentPoolId=objectMap.get("talentPoolId");
  171. BeisenApiClient client = BeisenApiClient.getInstance();
  172. JSONObject jsonData = new JSONObject();
  173. BeisenParamByProperties byProperties = new BeisenParamByProperties();
  174. Map<String, String> config = byProperties.getConfig();
  175. jsonData.put("talentPoolId", talentPoolId);
  176. jsonData.put("applicantIds", candidateIds);
  177. System.out.println(jsonData.toJSONString());
  178. JSONObject jsonObject = client.callApi(BeisenParam.POST_REMOVEAPPLICANTFROMTALENTPOOL_URL, jsonData);
  179. result.put("POST_REMOVEAPPLICANTFROMTALENTPOOL_URL", jsonObject);
  180. if (null != jsonObject && 200 == jsonObject.getInteger("code")) {
  181. syncStatus = ExecuteResultEnum.SUCCESS;
  182. } else {
  183. syncStatus = ExecuteResultEnum.ERROR;
  184. }
  185. }
  186. } catch (Exception e) {
  187. e.printStackTrace();
  188. syncStatus = ExecuteResultEnum.ERROR;
  189. throw e;
  190. } finally {
  191. List<String> candidateIds = (List<String>) result.get("candidateIds");
  192. if(null!=candidateIds&&(!candidateIds.isEmpty())) {
  193. updateSyncBeisenResultBillId(ctx, resignBizBillID, syncStatus, candidateIds.get(0), result.getJSONObject("POST_TRANSFERPHASE_DATA"));
  194. }else {
  195. updateSyncBeisenResultBillId(ctx, resignBizBillID, syncStatus, "", result.getJSONObject("POST_TRANSFERPHASE_DATA"));
  196. }
  197. }
  198. return result;
  199. }
  200. /**
  201. * 转移阶段状态
  202. *
  203. * @param ctx
  204. * @param resignBizBillID 离职
  205. * @param candidateId 应聘者id
  206. * @param applyId 申请Id
  207. * @return
  208. * @throws Exception
  209. */
  210. public JSONObject TransferPhase(Context ctx,String STATUSID, String resignBizBillID, String candidateId, String applyId) throws Exception {
  211. JSONObject result = new JSONObject();
  212. ExecuteResultEnum syncStatus = ExecuteResultEnum.SUCCESS;
  213. try {
  214. BeisenApiClient client = BeisenApiClient.getInstance();
  215. JSONObject jsonData = new JSONObject();
  216. BeisenParamByProperties byProperties = new BeisenParamByProperties();
  217. Map<String, String> config = byProperties.getConfig();
  218. JSONArray applyIds = new JSONArray();
  219. applyIds.add(applyId);
  220. jsonData.put("applyIds", applyIds);
  221. jsonData.put("phaseId", config.get(BeisenParam.BEISEN_CONFIG_PHASEID));
  222. jsonData.put("statusId", config.get(STATUSID));
  223. System.out.println(jsonData.toJSONString());
  224. JSONObject jsonObject = client.callApi(BeisenParam.POST_TRANSFERPHASE_URL, jsonData);
  225. result.put("POST_TRANSFERPHASE_DATA",jsonObject);
  226. if (null != jsonObject && 200 == jsonObject.getInteger("code")) {
  227. syncStatus = ExecuteResultEnum.SUCCESS;
  228. }else {
  229. syncStatus = ExecuteResultEnum.ERROR;
  230. }
  231. } catch (Exception e) {
  232. e.printStackTrace();
  233. syncStatus = ExecuteResultEnum.ERROR;
  234. throw e;
  235. } finally {
  236. updateSyncBeisenResultBillId(ctx,resignBizBillID,syncStatus,candidateId,result.getJSONObject("POST_TRANSFERPHASE_DATA"));
  237. }
  238. return result;
  239. }
  240. /**
  241. * 创建应聘者
  242. *
  243. * @param ctx
  244. * @param resignBizBillID
  245. * @return
  246. * @throws Exception
  247. */
  248. public JSONObject CreateOrUpdateApplicant(Context ctx, String resignBizBillID) throws Exception {
  249. JSONObject result = new JSONObject();
  250. ExecuteResultEnum syncStatus = ExecuteResultEnum.ERROR;
  251. result.put("code", "ses");
  252. result.put("msg", "");
  253. String candidateId = "";
  254. try {
  255. Map<String, String> objectMap = this.getBeisenTalentPool(ctx);
  256. BeisenApiClient client = BeisenApiClient.getInstance();
  257. Map<String, Object> personData = this.getPersonData(ctx, resignBizBillID);
  258. String code = (String) result.get("code");
  259. if ("ses".equals(code)) {
  260. Map<String, Object> data = (Map<String, Object>) personData.get("data");
  261. if(null!=data&&(!data.isEmpty())) {
  262. JSONObject jsonData = new JSONObject();
  263. jsonData.putAll(data);
  264. jsonData.put("talentPoolIds", objectMap.values());
  265. BeisenParamByProperties byProperties = new BeisenParamByProperties();
  266. Map<String, String> config = byProperties.getConfig();
  267. jsonData.put("channelId", config.get(BeisenParam.BEISEN_CONFIG_CHANNELID));
  268. //jsonData.put("acquireMannerId",2);
  269. System.out.println(jsonData.toJSONString());
  270. JSONObject jsonObject = client.callApi(BeisenParam.POST_CREATEORUPDATEAPPLICANT_URL, jsonData);
  271. result.put("POST_CREATEORUPDATEAPPLICANT_DATA", jsonObject);
  272. result.put("personData", personData);
  273. if (null != jsonObject && 200 == jsonObject.getInteger("code")) {
  274. JSONObject jsonObjectSync = this.GetApplicantIdBySyncId(jsonObject);
  275. result.put("GetApplicantIdBySyncId", jsonObjectSync);
  276. if (null != jsonObjectSync && 200 == jsonObjectSync.getInteger("code")) {
  277. JSONObject dataSync = jsonObjectSync.getJSONObject("data");
  278. if (null != dataSync) {
  279. candidateId = dataSync.getString("applicantId");
  280. syncStatus = ExecuteResultEnum.SUCCESS;
  281. }
  282. }
  283. }
  284. }
  285. }
  286. } catch (Exception e) {
  287. e.printStackTrace();
  288. syncStatus = ExecuteResultEnum.ERROR;
  289. result.put("msg", ExceptionUtil.getExcLinkStackTrace(e));
  290. result.put("code", "err");
  291. throw e;
  292. } finally {
  293. updateSyncBeisenResultBillId(ctx, resignBizBillID, syncStatus, candidateId, result.getJSONObject("POST_CREATEORUPDATEAPPLICANT_DATA"));
  294. }
  295. return result;
  296. }
  297. /**
  298. * 根据同步Id获取应聘者Id
  299. *
  300. * @param jsonObject
  301. * @return
  302. */
  303. public JSONObject GetApplicantIdBySyncId(JSONObject jsonObject) throws IOException {
  304. BeisenApiClient client = BeisenApiClient.getInstance();
  305. String syncId = "";
  306. if (null != jsonObject) {
  307. syncId = jsonObject.getString("data");
  308. }
  309. JSONObject object = client.callApi(BeisenParam.POST_GETAPPLICANTIDBYSYNCID_URL + "?syncId=" + syncId, jsonObject);
  310. return object;
  311. }
  312. /**
  313. * shr系统数据组装北森请求参数
  314. *
  315. * @param ctx
  316. * @param resignBizBillID
  317. * @return
  318. * @throws BOSException
  319. * @throws SQLException
  320. */
  321. protected Map<String, Object> getPersonData(Context ctx, String resignBizBillID) throws BOSException, SQLException {
  322. Map<String, Object> result = Maps.newHashMap();
  323. result.put("code", "ses");
  324. result.put("msg", "");
  325. StringBuilder sql = new StringBuilder();
  326. sql.append("");
  327. sql.append(" select prm.faddress address,p.fbirthday birthday, ");
  328. sql.append(" p.fname_l2 pName,p.fnumber pNumber, ");
  329. sql.append(" re1.fenterDate enterDate,rbe.fleftcompanydate leftcompanydate,rbe.FBIZDATE bizDate, ");
  330. sql.append(" poli.fname_l2 poliName,poli.fnumber poliNumber, poli.CFBeisenVal poliBeisenVal, ");
  331. sql.append(" wed.fname_l2 wedName,wed.fnumber wedNumber, wed.CFBeisenVal wedBeisenVal, ");
  332. sql.append(" folk.fname_l2 folkName,folk.Fnumber folkNumber, folk.CFBeisenVal folkBeisenVal, ");
  333. sql.append(" dip.fnumber dipNumber,dip.fname_l2 dipName, dip.CFBeisenVal dipBeisenVal, ");
  334. sql.append(" p.CFDyxlbyxx dyxlbyxx,p.FWorkLocation workLocation, ");
  335. sql.append(" p.fidcardbegindate idCardbeginDate,p.fidcardenddate idCardendDate, ");
  336. sql.append(" p.FHeight height, (case when (isnull(p.fgender,3)-1)>0 then (isnull(p.fgender,3)-1) else 1 end) gender, ");
  337. sql.append(" isnull(p.fidcardno,p.fpassportno) idCardNO, (case when p.fidcardno is null then 2 else 1 end) isIdCard, ");
  338. sql.append(" prm.femail email,prm.FLinkTelNum linkTelNum, ");
  339. sql.append(" p.FIDCardIssueOrg idCardIssueOrg,rbe.FDescription description, ");
  340. sql.append(" pos.fname_l2 posName,pos.Fnumber posNumber, ");
  341. sql.append(" p.CFDyxlbysj dyxlbysj,p.FnativePlace_l2 nativePlace, ");
  342. sql.append(" p.fofficePhone officePhone, prm.FNCell NCell,p.FhjAddress hjAddress,");
  343. sql.append(" nl.fname_l2 nlName,nl.fnumber nlNumber,nl.CFBeisenVal nlBeisenVal,");
  344. sql.append(" prm.FLinkName linkName,");
  345. sql.append(" '' ");
  346. sql.append(" from T_BD_Person p ");
  347. sql.append(" inner join T_HR_ResignBizBillEntry rbe on rbe.fpersonid=p.fid ");
  348. sql.append(" inner join (select re1.fpersonid,max(re1.fbizdate) fbizdate,min(re1.FENTERDATE) fenterDate from T_HR_ResignBizBillEntry re1 ");
  349. sql.append(" group by re1.fpersonid) re1 on rbe.fpersonid=re1.fpersonid and re1.fbizdate=rbe.fbizdate ");
  350. sql.append(" inner join T_HR_ResignBizBill rb on rb.fid = rbe.FBILLID ");
  351. sql.append(" and rb.FBILLSTATE = 3 ");
  352. sql.append(" left join T_ORG_Position pos on pos.fid = rbe.FPositionID ");
  353. sql.append(" left join T_BD_HRPolitical poli on poli.fid=p.fpoliticalfaceid ");
  354. sql.append(" left join T_BD_HRWed wed on wed.fid=p.fwedid ");
  355. sql.append(" left join T_BD_HRFolk folk on folk.fid=p.ffolkid ");
  356. sql.append(" left join T_BD_HRDiploma dip on dip.fid=p.FHighestDegreeID ");
  357. sql.append(" left join T_HR_PERSONCONTACTMETHOD prm on prm.fpersonid=p.fid ");
  358. sql.append(" left join T_BD_Nationality nl on nl.fid=p.FNationalityID ");
  359. sql.append(" where rb.FBILLSTATE = 3");
  360. if (StringUtils.isNotBlank(resignBizBillID)) {
  361. sql.append(" and rb.fid='" + resignBizBillID + "' ");
  362. } else {
  363. sql.append(" and rbe.CFSyncStatus != 1 ");
  364. }
  365. IRowSet rowSet = DbUtil.executeQuery(ctx, sql.toString());
  366. List<Map<String, Object>> list = Lists.newArrayList();
  367. while (rowSet.next()) {
  368. Map<String, Object> map = Maps.newHashMap();
  369. Map<String, Object> standardResume = Maps.newHashMap();
  370. map.put("standardResume", standardResume);
  371. Map<String, Object> personProfile = Maps.newHashMap();
  372. standardResume.put("personProfile", personProfile);
  373. //现居住地址(可邮寄{"code":400,"data":"00000000-0000-0000-0000-000000000000","message":"值不在数据源的范围内,字段名:Gender,值:-1"}
  374. String address = rowSet.getString("address");
  375. personProfile.put("extxianjuzhudizhikeyouji_433899_1099396040", this.setValue(address));
  376. //addressTX 通信地址 现居住地 OgLivingArea
  377. //personProfile.put("OgLivingArea", this.setValue(address));
  378. //height 身高 身高(厘米) Height
  379. String height = rowSet.getString("height");
  380. if (StringUtils.isNotBlank(height)) {
  381. personProfile.put("Height", this.setValue(height));
  382. }
  383. //婚姻状况
  384. String wedName = rowSet.getString("wedName");
  385. String wedNumber = rowSet.getString("wedNumber");
  386. String wedBeisenVal = rowSet.getString("wedBeisenVal");
  387. if (StringUtils.isNotBlank(wedBeisenVal)) {
  388. personProfile.put("exthunyinzhuangkuang_433899_1285520393", this.setValue(wedBeisenVal));
  389. }
  390. //政治面貌
  391. String poliName = rowSet.getString("poliName");
  392. String poliNumber = rowSet.getString("poliNumber");
  393. String poliBeisenVal = rowSet.getString("poliBeisenVal");
  394. if (StringUtils.isNotBlank(wedBeisenVal)) {
  395. personProfile.put("Polity", this.setValue(poliBeisenVal));
  396. }
  397. //姓名,工号
  398. String pName = rowSet.getString("pName");
  399. String pNumber = rowSet.getString("pNumber");
  400. personProfile.put("Name", this.setValue(pName));
  401. //personProfile.put("JobNumber", this.setValue(pNumber));
  402. //出生日期 OgBirthday
  403. Date birthday = rowSet.getDate("birthday");
  404. if (null != birthday) {
  405. personProfile.put("birthday", this.setValue(birthday));
  406. personProfile.put("OgBirthday", this.setValue(birthday));
  407. }
  408. //手机号
  409. String NCell = rowSet.getString("NCell");
  410. if (StringUtils.isNotBlank(NCell)) {
  411. personProfile.put("Mobile", this.setValue(NCell));
  412. //手机号类型
  413. personProfile.put("MobileType", this.setValue(MobileTypeEnum.CHINESE_MAINLAND.getKey()));
  414. }
  415. //dyxlbyxx 毕业学校 毕业学校 OgLastSchool
  416. String dyxlbyxx = rowSet.getString("dyxlbyxx");
  417. //personProfile.put("OgLastSchool", this.setValue(dyxlbyxx));
  418. //毕业时间
  419. // Date dyxlbysj = rowSet.getDate("dyxlbysj");
  420. // if(null!=dyxlbysj) {
  421. // personProfile.put("GraduationDate", this.setValue(dyxlbysj));
  422. // // personProfile.put("OgGraduationDate", this.setValue(dyxlbyxx));
  423. // }
  424. //HighestDegreeID 最高学历 第一学历 OgFirstEducationLevel string 是 是 第一学历-文本
  425. String dipNumber = rowSet.getString("dipNumber");
  426. String dipName = rowSet.getString("dipName");
  427. String dipBeisenVal = rowSet.getString("dipBeisenVal");
  428. //personProfile.put("OgFirstEducationLevel", this.setValue(dipBeisenVal));
  429. //personProfile.put("LastEducationLevel", this.setValue(dipBeisenVal));
  430. //idCardBeginDate 身份证开始日期 证件生效日期 CertificateValidityDate
  431. //idCardEndDate 身份证截止日期 证件失效日期 CertificateValidityOverDate
  432. // Date idCardbeginDate = rowSet.getDate("idCardbeginDate");
  433. // Date idCardendDate = rowSet.getDate("idCardendDate");
  434. // if(null!=idCardbeginDate && null!=idCardendDate) {
  435. // personProfile.put("CertificateValidityDate", this.setValue(idCardbeginDate));
  436. // personProfile.put("CertificateValidityOverDate", this.setValue(idCardendDate));
  437. // }
  438. // String idCardIssueOrg = rowSet.getString("idCardIssueOrg");
  439. // personProfile.put("CertificateGrantUnit", this.setValue(idCardIssueOrg));
  440. //籍贯
  441. personProfile.put("NativeArea", this.setValue(1));
  442. //民族
  443. String folkName = rowSet.getString("folkName");
  444. String folkNumber = rowSet.getString("folkNumber");
  445. String folkBeisenVal = rowSet.getString("folkBeisenVal");
  446. if(StringUtils.isNotBlank(folkBeisenVal)) {
  447. personProfile.put("Nation", this.setValue(folkBeisenVal));
  448. }
  449. String email = rowSet.getString("email");
  450. personProfile.put("Email", this.setValue(email));
  451. //国籍
  452. String nlBeisenVal = rowSet.getString("nlBeisenVal");
  453. personProfile.put("Nationality", this.setValue(nlBeisenVal));
  454. String description = rowSet.getString("description");
  455. String bizDate = rowSet.getString("bizDate");
  456. String workLocation = rowSet.getString("workLocation");
  457. //证件类型 CertificateType integer 是 是
  458. String idCardNO = rowSet.getString("idCardNO");
  459. personProfile.put("CertificateNumber", this.setValue(idCardNO));
  460. String isIdCard = rowSet.getString("isIdCard");
  461. personProfile.put("CertificateType", this.setValue(isIdCard));
  462. String gender = rowSet.getString("gender");
  463. personProfile.put("Gender", this.setValue(gender));
  464. //personProfile.put("OgGender", this.setValue(gender));
  465. String linkTelNum = rowSet.getString("linkTelNum");
  466. personProfile.put("EmergencyPhone", this.setValue(linkTelNum));
  467. String linkName = rowSet.getString("linkName");
  468. personProfile.put("EmergencyContact", this.setValue(linkName));
  469. String posName = rowSet.getString("posName");
  470. String posNumber = rowSet.getString("posNumber");
  471. String nativePlace = rowSet.getString("nativePlace");
  472. String officePhone = rowSet.getString("officePhone");
  473. if (StringUtils.isBlank(idCardNO)) {
  474. result.put("code", "err");
  475. String msg = (String) result.get("msg");
  476. result.put("msg", msg + "身份正号与护照号不能同时为空!");
  477. continue;
  478. }
  479. if (StringUtils.isBlank(email) && StringUtils.isBlank(NCell)) {
  480. result.put("code", "err");
  481. String msg = (String) result.get("msg");
  482. result.put("msg", msg + "邮箱与手机号不能同时为空!");
  483. continue;
  484. }
  485. result.put("data", map);
  486. list.add(map);
  487. }
  488. return result;
  489. }
  490. /**
  491. * syncStatus 同步北森状态 业务枚举 CFSyncStatus
  492. * syncBeisenResult 同步北森结果 字符串 CFSyncBeisenResult
  493. */
  494. public void updateSyncBeisenResultBillId(Context ctx, String id, ExecuteResultEnum syncStatus, String candidateId, JSONObject jsonData) throws BOSException {
  495. String syncBeisenResult="";
  496. if(null!=jsonData) {
  497. syncBeisenResult = jsonData.toJSONString();
  498. }
  499. DbUtil.execute(ctx,
  500. "update T_HR_ResignBizBillEntry set CFSyncBeisenResult=?,CFCandidateId=?,CFSyncStatus=? where FBILLID =?",
  501. new String[]{syncBeisenResult, candidateId, syncStatus.getValue(), id}
  502. );
  503. }
  504. /**
  505. * syncStatus 同步北森状态 业务枚举 CFSyncStatus
  506. * syncBeisenResult 同步北森结果 字符串 CFSyncBeisenResult
  507. */
  508. public void updateSyncBeisenResultEntryId(Context ctx, String id, ExecuteResultEnum syncStatus, String candidateId, JSONObject jsonData) throws BOSException {
  509. String syncBeisenResult = jsonData.toJSONString();
  510. DbUtil.execute(ctx,
  511. "update T_HR_ResignBizBillEntry set CFSyncBeisenResult=?,CFCandidateId=?,CFSyncStatus=? where fid =?",
  512. new String[]{syncBeisenResult, candidateId, syncStatus.getValue(), id}
  513. );
  514. }
  515. public Map<String, Object> setValue(Integer val) {
  516. return this.setValue(val.toString());
  517. }
  518. public Map<String, Object> setValue(Date val) {
  519. SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
  520. return this.setValue(dateFormat.format(val));
  521. }
  522. public Map<String, Object> setValue(Date val, SimpleDateFormat dateFormat) {
  523. return this.setValue(dateFormat.format(val));
  524. }
  525. public Map<String, Object> setValue(String val) {
  526. return this.setValue("value", val);
  527. }
  528. public Map<String, Object> setValue(String key, Object val) {
  529. Map<String, Object> map = Maps.newHashMap();
  530. map.put(key, (null == val ? "" : val));
  531. return map;
  532. }
  533. protected Map<String, String> getBeisenTalentPool(Context ctx) throws BOSException, SQLException {
  534. Map<String, String> map = Maps.newHashMap();
  535. IRowSet rowSet = DbUtil.executeQuery(ctx, "select top 1 cftalentPoolId,cftalentPoolType from CT_REC_BeisenTalentPool where cfstdIsDeleted='0' and cfisLieftTalentPool = 0 and FNumber='离职人才库' ");
  536. if (rowSet.next()) {
  537. String talentPoolId = rowSet.getString("cftalentPoolId");
  538. String talentPoolType = rowSet.getString("cftalentPoolType");
  539. map.put("talentPoolId", talentPoolId);
  540. return map;
  541. } else {
  542. throw new IllegalArgumentException("未匹配到北森离职人才库,请先在sHR系统中维护好“北森人才库”数据");
  543. }
  544. }
  545. }