BeisenFacadeOSFService.java 28 KB

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