package com.engine.recruit.entity.position; import com.alibaba.fastjson.JSON; import com.engine.recruit.exception.CustomizeRunTimeException; import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient; import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDynamicField; import com.weaver.rpa.sdk.clients.core.ERPASDKClients; import weaver.formmode.recruit.modeexpand.util.RecruitPositionUtil; import weaver.general.BaseBean; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; /** * @author:dxfeng * @createTime: 2024/05/27 * @version: 1.0 */ public class PositionSdkInstance { private ERPAResumeSDKClient resumeSDKClient; // 职位类型 private List boss_type; private List liepin_type; private List lagou_type; private List job51_type; private List zhilian_type; // BOSS直聘 是否外驻 private List boss_resident; private List boss_resident_country; private List boss_resident_language; private List boss_resident_time; private List boss_resident_time_2; // 前程无忧-发布城市 private List job51_city; // 前程无忧-所属行业 private List job51_industry; private static volatile PositionSdkInstance positionSdkInstance; private PositionSdkInstance() { } public static PositionSdkInstance getPositionSdkInstance() { if (positionSdkInstance == null) { synchronized (PositionSdkInstance.class) { if (positionSdkInstance == null) { ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient(); if (!RecruitPositionUtil.checkAvailable(client)) { throw new CustomizeRunTimeException("checkAvailable失败!千里聆SDK不可用"); } ResumeJobDynamicField resumeJobDynamicField = client.getResumeJobDynamicField(); positionSdkInstance = new PositionSdkInstance(); positionSdkInstance.setResumeSDKClient(client); client.addResumeSavedListener(resumeMqMessage -> { // 处理获取到的简历信息 new BaseBean().writeLog("【简历接收回调】:" + JSON.toJSONString(resumeMqMessage)); //Thread thread = new Thread(new SdkResumeSavedThread(resumeMqMessage)); //thread.start(); }); client.start(); positionSdkInstance.setBoss_resident(resumeJobDynamicField.getBoss_resident()); // 去除千里聆返回的重复数据 List boss_resident_country1 = resumeJobDynamicField.getBoss_resident_country(); List collect = new ArrayList<>(boss_resident_country1.stream() .collect(Collectors.toMap( ResumeJobDynamicField.Item::getValue, item -> item, (existing, replacement) -> existing )) .values()); positionSdkInstance.setBoss_resident_country(collect); positionSdkInstance.setBoss_resident_language(resumeJobDynamicField.getBoss_resident_language()); positionSdkInstance.setBoss_resident_time_2(resumeJobDynamicField.getBoss_resident_time_2()); positionSdkInstance.setBoss_resident_time(resumeJobDynamicField.getBoss_resident_time()); positionSdkInstance.setJob51_city(resumeJobDynamicField.getJob51_city()); positionSdkInstance.setJob51_industry(resumeJobDynamicField.getJob51_industry_txt()); positionSdkInstance.setBoss_type(resumeJobDynamicField.getBoss_type()); positionSdkInstance.setLiepin_type(resumeJobDynamicField.getLiepin_type()); positionSdkInstance.setLagou_type(resumeJobDynamicField.getLagou_type()); positionSdkInstance.setJob51_type(resumeJobDynamicField.getJob51_type()); positionSdkInstance.setZhilian_type(resumeJobDynamicField.getZhilian_type()); } } } return positionSdkInstance; } public ERPAResumeSDKClient getResumeSDKClient() { return resumeSDKClient; } public void setResumeSDKClient(ERPAResumeSDKClient resumeSDKClient) { this.resumeSDKClient = resumeSDKClient; } public List getBoss_type() { return boss_type; } public void setBoss_type(List boss_type) { this.boss_type = boss_type; } public List getLiepin_type() { return liepin_type; } public void setLiepin_type(List liepin_type) { this.liepin_type = liepin_type; } public List getLagou_type() { return lagou_type; } public void setLagou_type(List lagou_type) { this.lagou_type = lagou_type; } public List getJob51_type() { return job51_type; } public void setJob51_type(List job51_type) { this.job51_type = job51_type; } public List getZhilian_type() { return zhilian_type; } public void setZhilian_type(List zhilian_type) { this.zhilian_type = zhilian_type; } public List getBoss_resident() { return boss_resident; } public void setBoss_resident(List boss_resident) { this.boss_resident = boss_resident; } public List getBoss_resident_country() { return boss_resident_country; } public void setBoss_resident_country(List boss_resident_country) { this.boss_resident_country = boss_resident_country; } public List getBoss_resident_language() { return boss_resident_language; } public void setBoss_resident_language(List boss_resident_language) { this.boss_resident_language = boss_resident_language; } public List getBoss_resident_time() { return boss_resident_time; } public void setBoss_resident_time(List boss_resident_time) { this.boss_resident_time = boss_resident_time; } public List getBoss_resident_time_2() { return boss_resident_time_2; } public void setBoss_resident_time_2(List boss_resident_time_2) { this.boss_resident_time_2 = boss_resident_time_2; } public List getJob51_city() { return job51_city; } public void setJob51_city(List job51_city) { this.job51_city = job51_city; } public List getJob51_industry() { return job51_industry; } public void setJob51_industry(List job51_industry) { this.job51_industry = job51_industry; } }