Commit d495a694 authored by alex yao's avatar alex yao

fix: 修正人力资源接口[职位、简历]出参

parent 4cd02136
......@@ -34,6 +34,7 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDema
import cn.com.yict.framemax.core.exception.BusinessException;
import cn.com.yict.framemax.data.model.PagingInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
......@@ -67,7 +68,9 @@ public class HumanResourceServiceImpl implements HumanResourceService {
@Retryable(value = Exception.class, maxAttempts = 2, backoff = @Backoff(delay = 1000, multiplier = 2))
public Resume uploadResume(String fileURL, Long positionId, Long userId) throws Exception {
BizHumanResourcePositionEntity bizHumanResourcePositionEntity = bizHumanResourcePositionService.get(positionId);
if (bizHumanResourcePositionEntity == null) {
throw new BusinessException("该岗位信息不存在");
}
Map<String, Object> inputs = new LinkedHashMap<>();
inputs.put("position", JsonUtils.serialize(bizHumanResourcePositionEntity));
......@@ -96,7 +99,7 @@ public class HumanResourceServiceImpl implements HumanResourceService {
throw new BusinessException("提取简历失败");
}
Resume resume = JsonUtils.deSerialize(response.getAnswer(), Resume.class);
if (resume == null){
if (resume == null) {
throw new BusinessException("提取简历异常");
}
this.saveResume(userId, fileURL, positionId, resume);
......@@ -183,9 +186,9 @@ public class HumanResourceServiceImpl implements HumanResourceService {
bizHumanResourcePositionEntity.setJobRequirements(job.getJobRequirements());
bizHumanResourcePositionEntity.setJobDuties(job.getJobDuties());
bizHumanResourcePositionEntity.setEssential(CollectionUtils.isNotEmpty(por.getEssential()) ? JsonUtils.serialize(por.getEssential()) : null);
bizHumanResourcePositionEntity.setBonusPoints(CollectionUtils.isNotEmpty(por.getBonusPoints()) ? JsonUtils.serialize(por.getBonusPoints()) : null);
bizHumanResourcePositionEntity.setExclusion(CollectionUtils.isNotEmpty(por.getExclusion()) ? JsonUtils.serialize(por.getExclusion()) : null);
bizHumanResourcePositionEntity.setEssential(MapUtils.isNotEmpty(por.getEssential()) ? JsonUtils.serialize(por.getEssential()) : null);
bizHumanResourcePositionEntity.setBonusPoints(MapUtils.isNotEmpty(por.getBonusPoints()) ? JsonUtils.serialize(por.getBonusPoints()) : null);
bizHumanResourcePositionEntity.setExclusion(MapUtils.isNotEmpty(por.getExclusion()) ? JsonUtils.serialize(por.getExclusion()) : null);
bizHumanResourcePositionEntity.setMemberId(memberId);
return id != null ? bizHumanResourcePositionService.update(bizHumanResourcePositionEntity) : bizHumanResourcePositionService.save(bizHumanResourcePositionEntity);
......
......@@ -135,46 +135,30 @@ public class BizHumanResourcePositionConvert {
Por por = new Por();
if (StringUtils.isNotBlank(positionEntity.getEssential())) {
JSONArray jsonArray = JSONObject.parseArray(positionEntity.getEssential());
List<Map<String, String>> list = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
for (String key : jsonObject.keySet()) {
Map<String, String> map = new HashMap<>();
map.put(key, jsonObject.getString(key));
list.add(map);
}
JSONObject jsonObject = JSONObject.parseObject(positionEntity.getEssential());
Map<String, String> map = new HashMap<>();
for (String key : jsonObject.keySet()) {
map.put(key, jsonObject.getString(key));
}
por.setEssential(list);
por.setEssential(map);
}
if (StringUtils.isNotBlank(positionEntity.getBonusPoints())) {
JSONArray jsonArray = JSONObject.parseArray(positionEntity.getBonusPoints());
List<Map<String, String>> list = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
for (String key : jsonObject.keySet()) {
Map<String, String> map = new HashMap<>();
map.put(key, jsonObject.getString(key));
list.add(map);
}
JSONObject jsonObject = JSONObject.parseObject(positionEntity.getBonusPoints());
Map<String, String> map = new HashMap<>();
for (String key : jsonObject.keySet()) {
map.put(key, jsonObject.getString(key));
}
por.setBonusPoints(list);
por.setBonusPoints(map);
}
if (StringUtils.isNotBlank(positionEntity.getExclusion())) {
JSONArray jsonArray = JSONObject.parseArray(positionEntity.getExclusion());
List<Map<String, String>> list = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
for (String key : jsonObject.keySet()) {
Map<String, String> map = new HashMap<>();
map.put(key, jsonObject.getString(key));
list.add(map);
}
JSONObject jsonObject = JSONObject.parseObject(positionEntity.getExclusion());
Map<String, String> map = new HashMap<>();
for (String key : jsonObject.keySet()) {
map.put(key, jsonObject.getString(key));
}
por.setExclusion(list);
por.setExclusion(map);
}
resourcePositionDto.setPor(por);
return resourcePositionDto;
......
package cn.com.poc.human_resources.convert;
import cn.com.poc.common.utils.JsonUtils;
import cn.com.poc.common.utils.StringUtils;
import cn.com.poc.human_resources.dto.BizHumanResourceResumeDto;
import cn.com.poc.human_resources.dto.ResumeDto;
import cn.com.poc.human_resources.entity.BizHumanResourceResumeEntity;
......@@ -8,9 +9,14 @@ import cn.com.poc.human_resources.entity.resume.Info;
import cn.com.poc.human_resources.entity.resume.Resume;
import cn.com.poc.human_resources.entity.resume.Tag;
import cn.com.poc.human_resources.model.BizHumanResourceResumeModel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.stream.Collectors;
public class BizHumanResourceResumeConvert {
......@@ -18,6 +24,7 @@ public class BizHumanResourceResumeConvert {
public static BizHumanResourceResumeEntity modelToEntity(BizHumanResourceResumeModel model) {
BizHumanResourceResumeEntity entity = new BizHumanResourceResumeEntity();
entity.setId(model.getId());
entity.setName(model.getName());
entity.setPosition(model.getPosition());
entity.setFileUrl(model.getFileUrl());
entity.setCoreSkills(model.getCoreSkills());
......@@ -44,6 +51,7 @@ public class BizHumanResourceResumeConvert {
public static BizHumanResourceResumeModel entityToModel(BizHumanResourceResumeEntity entity) {
BizHumanResourceResumeModel model = new BizHumanResourceResumeModel();
model.setId(entity.getId());
model.setName(entity.getName());
model.setPosition(entity.getPosition());
model.setFileUrl(entity.getFileUrl());
model.setCoreSkills(entity.getCoreSkills());
......@@ -70,6 +78,7 @@ public class BizHumanResourceResumeConvert {
public static BizHumanResourceResumeDto entityToDto(BizHumanResourceResumeEntity entity) {
BizHumanResourceResumeDto dto = new BizHumanResourceResumeDto();
dto.setId(entity.getId());
dto.setName(entity.getName());
dto.setPosition(entity.getPosition());
dto.setFileUrl(entity.getFileUrl());
dto.setCoreSkills(entity.getCoreSkills());
......@@ -96,6 +105,7 @@ public class BizHumanResourceResumeConvert {
public static BizHumanResourceResumeEntity dtoToEntity(BizHumanResourceResumeDto dto) {
BizHumanResourceResumeEntity entity = new BizHumanResourceResumeEntity();
entity.setId(dto.getId());
entity.setName(dto.getName());
entity.setPosition(dto.getPosition());
entity.setFileUrl(dto.getFileUrl());
entity.setCoreSkills(dto.getCoreSkills());
......@@ -123,15 +133,39 @@ public class BizHumanResourceResumeConvert {
ResumeDto dto = new ResumeDto();
dto.setId(entity.getId());
dto.setPositionId(entity.getPosition());
dto.setFileUrl(entity.getFileUrl());
Info info = new Info();
info.setName(entity.getName());
info.setCoreSkills(JsonUtils.deSerialize(entity.getCoreSkills(), new TypeReference<List<String>>() {
}.getType()));
info.setEducationBackground(JsonUtils.deSerialize(entity.getEducationBackground(), String.class));
info.setEducationExperience(JsonUtils.deSerialize(entity.getEducationExperience(), new TypeReference<List<String>>() {
}.getType()));
if (StringUtils.isNotBlank(entity.getEducationExperience())) {
JSONObject jsonObject = JSONObject.parseObject(entity.getEducationExperience());
LinkedHashMap<String, String> map = new LinkedHashMap<>();
for (String key : jsonObject.keySet()) {
String value = jsonObject.getString(key);
map.put(key, value);
}
info.setEducationExperience(map);
}
info.setGenderAndAge(JsonUtils.deSerialize(entity.getGenderAndAge(), String.class));
info.setOccupationalHistory(JsonUtils.deSerialize(entity.getOccupationalHistory(), new TypeReference<List<String>>() {
}.getType()));
if (StringUtils.isNotBlank(entity.getOccupationalHistory())) {
JSONObject jsonObject = JSONObject.parseObject(entity.getOccupationalHistory());
LinkedHashMap<String, List<String>> map = new LinkedHashMap<>();
for (String key : jsonObject.keySet()) {
JSONArray jsonArray = jsonObject.getJSONArray(key);
ArrayList<String> list = new ArrayList<>(jsonArray.size());
for (int i = 0; i < jsonArray.size(); i++) {
list.add(jsonArray.getString(i));
}
map.put(key, list);
}
info.setOccupationalHistory(map);
}
info.setOther(JsonUtils.deSerialize(entity.getOther(), new TypeReference<List<String>>() {
}.getType()));
info.setWorkExperience(JsonUtils.deSerialize(entity.getWorkExperience(), String.class));
......@@ -152,6 +186,7 @@ public class BizHumanResourceResumeConvert {
public static BizHumanResourceResumeEntity resumeToEntity(Resume resume) {
BizHumanResourceResumeEntity bizHumanResourceResumeEntity = new BizHumanResourceResumeEntity();
//info
bizHumanResourceResumeEntity.setName(resume.getInfo().getName());
bizHumanResourceResumeEntity.setCoreSkills(JsonUtils.serialize(resume.getInfo().getCoreSkills()));
bizHumanResourceResumeEntity.setEducationBackground(JsonUtils.serialize(resume.getInfo().getEducationBackground()));
bizHumanResourceResumeEntity.setEducationExperience(JsonUtils.serialize(resume.getInfo().getEducationExperience()));
......
......@@ -32,6 +32,20 @@ public class BizHumanResourceResumeDto {
this.position = position;
}
/**
* name
* 姓名
*/
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* 简历文件地址
*/
......
......@@ -10,7 +10,15 @@ public class ResumeDto extends Resume {
private Long id;
private Long positionId;
private String fileUrl;
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public Long getId() {
return id;
......
......@@ -31,6 +31,20 @@ public class BizHumanResourceResumeEntity {
this.position = position;
}
/**
* name
* 姓名
*/
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* 简历文件地址
*/
......
package cn.com.poc.human_resources.entity.position;
import java.util.List;
import java.util.Map;
/**
......@@ -11,39 +10,39 @@ public class Por {
/**
* 必备项
*/
private List<Map<String, String>> essential;
private Map<String, String> essential;
/**
* 加分项
*/
private List<Map<String, String>> bonusPoints;
private Map<String, String> bonusPoints;
/**
* 排除项
*/
private List<Map<String, String>> exclusion;
private Map<String, String> exclusion;
public List<Map<String, String>> getEssential() {
public Map<String, String> getEssential() {
return essential;
}
public void setEssential(List<Map<String, String>> essential) {
public void setEssential(Map<String, String> essential) {
this.essential = essential;
}
public List<Map<String, String>> getBonusPoints() {
public Map<String, String> getBonusPoints() {
return bonusPoints;
}
public void setBonusPoints(List<Map<String, String>> bonusPoints) {
public void setBonusPoints(Map<String, String> bonusPoints) {
this.bonusPoints = bonusPoints;
}
public List<Map<String, String>> getExclusion() {
public Map<String, String> getExclusion() {
return exclusion;
}
public void setExclusion(List<Map<String, String>> exclusion) {
public void setExclusion(Map<String, String> exclusion) {
this.exclusion = exclusion;
}
}
package cn.com.poc.human_resources.entity.resume;
import java.util.List;
import java.util.Map;
public class Info {
private String name;
private List<String> coreSkills;
private String educationBackground;
private List<String> educationExperience;
private Map<String, String> educationExperience;
private String genderAndAge;
private List<String> occupationalHistory;
private Map<String, List<String>> occupationalHistory;
private List<String> other;
private String workExperience;
private String workLocation;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getCoreSkills() {
return coreSkills;
}
......@@ -30,11 +39,11 @@ public class Info {
this.educationBackground = educationBackground;
}
public List<String> getEducationExperience() {
public Map<String, String> getEducationExperience() {
return educationExperience;
}
public void setEducationExperience(List<String> educationExperience) {
public void setEducationExperience(Map<String, String> educationExperience) {
this.educationExperience = educationExperience;
}
......@@ -46,11 +55,11 @@ public class Info {
this.genderAndAge = genderAndAge;
}
public List<String> getOccupationalHistory() {
public Map<String, List<String>> getOccupationalHistory() {
return occupationalHistory;
}
public void setOccupationalHistory(List<String> occupationalHistory) {
public void setOccupationalHistory(Map<String, List<String>> occupationalHistory) {
this.occupationalHistory = occupationalHistory;
}
......@@ -77,5 +86,4 @@ public class Info {
public void setWorkLocation(String workLocation) {
this.workLocation = workLocation;
}
}
......@@ -47,6 +47,21 @@ public class BizHumanResourceResumeModel extends BaseModelClass implements Seria
super.addValidField("id");
}
/**
* name
* 姓名
*/
private String name;
@Column(name = "name", length = 100)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
super.addValidField("name");
}
/**
* position
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment