ResumeSyncToPEPersonServiceEx.java 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package com.kingdee.shr.recuritment.service.offer;
  2. import com.kingdee.bos.BOSException;
  3. import com.kingdee.bos.Context;
  4. import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
  5. import com.kingdee.bos.metadata.entity.SelectorItemCollection;
  6. import com.kingdee.eas.base.attachment.AttachmentInfo;
  7. import com.kingdee.eas.common.EASBizException;
  8. import com.kingdee.eas.custom.beisen.utils.HRAttachmentUploadUtil;
  9. import com.kingdee.eas.custom.recuritment.utils.AttachmentUtils;
  10. import com.kingdee.shr.attachment.ISHRAttachmentExt;
  11. import com.kingdee.shr.attachment.SHRAttachmentExtCollection;
  12. import com.kingdee.shr.attachment.SHRAttachmentExtFactory;
  13. import com.kingdee.shr.attachment.SHRAttachmentExtInfo;
  14. import com.kingdee.shr.preentry.*;
  15. import com.kingdee.shr.recuritment.*;
  16. import com.kingdee.shr.recuritment.app.service.ResumeSyncToPEPersonService;
  17. import com.kingdee.shr.recuritment.utils.RecBaseUtils;
  18. import org.apache.commons.lang3.StringUtils;
  19. import org.slf4j.Logger;
  20. import org.slf4j.LoggerFactory;
  21. /**
  22. * @Description 简历同步预入职档案
  23. * @Date 2025/9/18 19:53
  24. * @Created by 59279
  25. */
  26. public class ResumeSyncToPEPersonServiceEx extends ResumeSyncToPEPersonService {
  27. private static Logger logger = LoggerFactory.getLogger(ResumeSyncToPEPersonServiceEx.class);
  28. /**
  29. * 同步简历信息到预入职人员信息中
  30. *
  31. * @param ctx 上下文对象
  32. * @param person 预入职人员信息对象
  33. * @param resume 简历基本信息对象
  34. */
  35. @Override
  36. public void syncResumeToPEPerson(Context ctx, PreEntryPersonInfo person, ResumeBaseRecInfo resume) {
  37. super.syncResumeToPEPerson(ctx, person, resume);
  38. //简历id
  39. try {
  40. String resumeId = resume.getId().toString();
  41. IRecApproval iRecApproval = RecApprovalFactory.getLocalInstance(ctx);
  42. RecApprovalCollection recApprovalCollection =
  43. iRecApproval.getRecApprovalCollection("where resumeBaseRec = '" + resumeId + "'");
  44. if (!recApprovalCollection.isEmpty()) {
  45. //获取招聘审批信息
  46. RecApprovalInfo recApprovalInfo = recApprovalCollection.get(0);
  47. //获取背调信息
  48. String personalScreening = recApprovalInfo.getPersonalScreening();
  49. if (StringUtils.isNotBlank(personalScreening)) {
  50. person.put("personalScreening", personalScreening);
  51. SelectorItemCollection updateSic = new SelectorItemCollection();
  52. updateSic.add("personalScreening");
  53. //更新背调信息
  54. PreEntryPersonFactory.getLocalInstance(ctx).updatePartial(person, updateSic);
  55. }
  56. }
  57. } catch (Exception e) {
  58. logger.error(e.getMessage(), e);
  59. }
  60. if (person != null) {
  61. logger.error("***************************同步简历附件到预入职开始***************************");
  62. //预入职id
  63. String id = person.getId().toString();
  64. //简历id
  65. String resumeId = resume.getId().toString();
  66. try {
  67. //删除简历附件
  68. String filter = "where boid = '" + id + "' and (attachment.name like '%标准简历%' or attachment.name like '%面试评价%' or attachment.name like '%原始简历%' or attachment.name like '%背景调查审批表%' )";
  69. AttachmentUtils.deleteAttachment(ctx, filter);
  70. ISHRAttachmentExt ishrAttachmentExt = SHRAttachmentExtFactory.getLocalInstance(ctx);
  71. SHRAttachmentExtCollection shrAttachmentExtCollection =
  72. ishrAttachmentExt.getSHRAttachmentExtCollection("select attachment.* where boID = '" + resumeId + "'");
  73. String uipk = "hr.preentry.resume.base";//预入职人员_基本信息
  74. for (int i = 0; i < shrAttachmentExtCollection.size(); i++) {
  75. SHRAttachmentExtInfo shrAttachmentExtInfo = shrAttachmentExtCollection.get(i);
  76. AttachmentInfo attachmentInfo = shrAttachmentExtInfo.getAttachment();
  77. if (attachmentInfo == null || attachmentInfo.getFile() == null) {
  78. continue;
  79. }
  80. String type = attachmentInfo.getSimpleName();
  81. String fileName = attachmentInfo.getName();
  82. byte[] file = attachmentInfo.getFile();
  83. //上传附件
  84. HRAttachmentUploadUtil.uploadAttachment(ctx, file, type, fileName, id, uipk, "null0");
  85. }
  86. } catch (Exception e) {
  87. logger.error(e.getMessage(), e);
  88. }
  89. logger.error("***************************同步简历附件到预入职结束***************************");
  90. }
  91. }
  92. }