BeisenFacadeOSFService.java 28 KB

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